sentences:
Does anyone have a example of Dual Contouring in C#? I'm trying to develop a method of creating terrain using Perlin. I've followed plenty of the Minecraft tutorials, and got them to function. I've done some playing around with MarchingSquares, but I'm not digging it.
Now, I've been trying to create a method of dual contouring, and I'm also trying to get the concept of Octrees down at the same time. I used to segment my array of data in small chunkes, but the whole Collapsing and making a larger "chunk" function like a smaller chunker is just not regiserting.

I was hoping someone can share some C# code, preferably for Unity but really just something for me to try to pick apart to understand would help.

When it really comes down to it, I'm not trying to make a game where different "voxels" aren't different types of blocks, just represent where dirt is and where dirt isn't. In game, I want dirt to be taken away due to explosions, but not have a method of placing dirt. I'd like this effect for large enclosed game levels.

Any comments or advice are appreciated.

sentences:
Disable/Remove Warning about a not bound Render Target View So to render into my shadow map depthstencil buffer i only bind a DepthStencilView to the Output Merger. Like this

    m_pContext->OMSetRenderTargets(0,0, m_pShadowMapDV);
    m_pContext->ClearDepthStencilView(m_pShadowMapDV, D3D11_CLEAR_DEPTH, 1.0f, 0);

Now this works fine and my shadow-map also produces the desired result. What bothers me though is the constant warnings in the debug-window. Is there a way or trick to disable that warning?

D3D11 WARNING: ID3D11DeviceContext::DrawIndexed: The Pixel Shader expects a Render Target View bound to slot 0, but none is bound. This is OK, as writes of an unbound Render Target View are discarded. It is also possible the developer knows the data will not be used anyway. This is only a problem if the developer actually intended to bind a Render Target View here. [ EXECUTION WARNING #3146081: DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET]

This might be a pretty dumb question, but after googling a lot i still came up empty. Only i a lot of people who are not doing this on purpose.

EDIT: Maybe the question can be asked in another way:

Is there a way to define an empty PixelShader? If i define the return value as void it notifies me, that i have to at least return the 4 pixel colors. If i don't give it any Semantics it does not work either.

sentences:
Stack based state design for isometric character movement, am I doing it right? I have been reading around about stack-based FSM, and I found it to be perfect for my game. However, when a character moves, it consequently have to face in some direction (and animation of each direction will be different), now the problem that I am facing in my state machine design is the scope of each state.

For example, should I divide the state into MOVE_LEFT, MOVE_RIGHT, MOVE_UP, MOVE_DOWN or should I create one MOVE state with some direction argument in it. Now, the latter seems to be better, however, if I am to trigger direction change, how would I do it for a one-state MOVE? I could directly change the direction argument and manually change the animation sequence, which will destroy the whole purpose of state machine (State machine should change animation sequence OnEnter() state). Else, I would have complicate the state machine into hierarchy of states (Sub-states,etc.), and this seem unconvincing for me.

Or maybe I should implement some type of multiple, simultaneous states ---- Character's State (Jump, Move, Idle, Attack, etc) and Direction's State (Up down left right), then make it works concurrently, and apply stack-based architectue on Character's State only.

sentences:
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:
Retrieving JSON return value from function and parsing in Construct 2 I would like to know how to parse a JSON object and parse each value into either an array, or something that I can use to set values of several global variables in my project file. I want to avoid editing the Javascript file itself, so please try to provide an approach that can be done in Construct itself rather than an external way.

Code sample

 axonify.game = {
  gameData: function() {
    data = {
      name: 'Block Mania',
      timeLimit: 30,
      addedTimePerQuestion: 0,
      addedTimePerCorrectQuestion: 15,
      questionCount: questionCount
    };
    return data;
  },

sentences:
Loading textures with SharpDX in Metro I have converted my C# game from OpenTK (OpenGL) to SharpDX (DirectX) and have it up and running from Visual Studio 2010. I also have it up and running from Visual Studio 11 in Metro, in the Windows 8 Developer Preview. However, the Metro build is still lacking textures, so my polygons are simply colored right now. The problem is that the methods used to load images are absent in the Metro DLLs. These methods are all missing from the Texture2D class (inherited from the Resource class) in Metro:

SharpDX.Direct3D11.Resource.FromStream
SharpDX.Direct3D11.Resource.FromFile
SharpDX.Direct3D11.Resource.FromMemory

Does anyone know if these will eventually be implemented in Metro? Or is there an alternate approach I could be using? Please keep in mind that I never knew a thing about DirectX or SharpDX before this, so I'm still very wet behind the ears with all this.

Finding any kind of help or information for SharpDX is not easy, which is a shame, because it seems to be a great solution for 3D in Metro using C#.

sentences:
isometric drawing order with larger than single tile images - drawing order algorithm? I have an isometric map over which I place various images. Most images will fit over a single tile, but some images are slightly larger. For example, I have a bed of size 2x3 tiles.

This creates a problem when drawing my objects to the screen as I get some tiles erroneously overlapping other tiles.

The two solutions that I know of are either splitting the image into 1x1 tile segments or implementing my own draw order algorithm, for example by assigning each image a number. The image with number 1 is drawn first, then 2, 3 etc.

Does anyone have advice on what I should do?

It seems to me like splitting an isometric image is very non obvious. How do you decide which parts of the image are 'in' a particular tile? I can't afford to split up all of my images manually either.

The draw order algorithm seems like a nicer choice but I am not sure if it's going to be easy to implement. I can't solve, in my head, how to deal with situations whereby you change the index of one image, which causes a knock on effect to many other images. If anyone has an resources/tutorials on this I would be most grateful.

sentences:
Unity3D-2D: Setting Time.timeScale to 0 for a certain public prefab until positioned? So I have a button in my game which spawns a "tower" at a given location. The tower, when spawned, acts normally and I can drag it around using my drag script.

I wonder how can I set the Time.timeScale to 0 when I first spawn the tower (only for that prefab) UNTILL I click again to set it's position.

sentences:
Rendering only a part of the screen in high detail If graphics are rendered for a large viewing angle (e.g. a very large TV or a VR headset), the viewer can't actually focus on the entire image, just a part of it. (Actually, this is the case for regular sized screens as well.)

Combined with a way to track the viewer's eyes (which is mostly viable in VR I guess), you could theoretically exploit this and render the graphics away from the viewer's focus with progressively less details and resolution, gaining performance, without losing perceived quality.

Are there any techniques for this available or under development today?

sentences:
Determining the end location for AI movement in groups in a 2D RTS I have written an RTS game (a demo for a game engine of sorts, actually) in which the user's basic interaction with the game is to select a bunch of soldiers and then right-click on the map to move them to the specified location. This is in JavaScript and you can play with it here (code).

Ignoring the problem of how the soldiers move from their current location to their destination, my question is about determining what their actual destination is. Here is what I've tried so far:

Attempt 1: Tell all selected soldiers to move to the coordinates the mouse clicked. This has the odd behavior that all the soldiers will then go cluster around the target unnaturally.
Attempt 2: Find the average coordinates of all selected soldiers, then find the offset from that center point for each soldier, and finally translate that offset around the mouse coordinates. This works fine except that if your selected soldiers are far apart they will not get close to the target.
Attempt 3: Build a grid around the mouse coordinates and place each selected soldier into a cell of the grid. If each soldier makes it to their assigned cell, this works great. However, soldiers are assigned to grid cells in the order the soldiers were spawned, so sometimes they collide (i.e. all the soldiers on the right side will try to go to the left side) which looks unnatural.
Attempt 4: Use a grid like before, but first sort the soldiers by location so that they line up sensibly, i.e. if you clicked below the group then the soldiers at the bottom of the group will end up on the bottom of the grid when they reach their destination. This works pretty well but there are glitches sometimes and I'm not sure why.

Here is the function that determines the destination coordinates:

function moveSelectedSoldiersToMouse() {
  var w = 0, h = 0, selected = [];
  // Get information about the selected soldiers.
  myTeam.soldiers.forEach(function(soldier) {
    if (soldier.selected) {
      selected.push(soldier);
      w += soldier.width;
      h += soldier.height;
    }
  });
  var numSelected = selected.length, k = -1;
  if (!numSelected) return;
  // Build a grid of evenly spaced soldiers.
  var sqrt = Math.sqrt(numSelected),
      rows = Math.ceil(sqrt),
      cols = Math.ceil(sqrt),
      x = Mouse.Coords.worldX(),
      y = Mouse.Coords.worldY(),
      iw = Math.ceil(w / numSelected), // grid cell width
      ih = Math.ceil(h / numSelected), // grid cell height
      wg = iw*1.2, // width of gap between cells
      hg = ih*1.2; // height of gap between cells
  if ((rows-1)*cols >= numSelected) rows--;
  w = iw * cols + wg * (cols-1); // total width of group
  h = ih * rows + hg * (rows-1); // total height of group
  // Sort by location to avoid soldiers getting in each others' way.
  selected.sort(function(a, b) {
    // Round to 10's digit; specific locations can be off by a pixel or so
    var ax = a.x.round(-1), ay = a.y.round(-1), bx = b.x.round(-1), by = b.y.round(-1);
    return ay - by || ax - bx;
  });
  // Place the grid over the mouse and send soldiers there.
  for (var i = 0; i < rows; i++) {
    for (var j = 0; j < cols; j++) {
      var s = selected[++k];
      if (s) {
        var mx = x + j * (iw+wg) - w * 0.5 + s.width * 0.5,
            my = y + i * (ih+hg) - h * 0.5 + s.height * 0.5;
        // Finally, move to the end destination coordinates
        s.moveTo(mx, my);
      }
    }
  }
}

You can paste this function into your browser's JavaScript console when viewing the demo and mess around with it to change the soldiers' behavior.

My question is: is there a better way to determine the target location for each soldier to move to?

sentences:
FPS Android game that moves the gun as user swipes the screen I am Making a First Person shooter game for android. Gun moves in all directions I swipe left right up or down. But the speed is so slow. How can i increase it's Speed.Here is my code.

void FixedUpdate ()
{
    foreach (Touch t in Input.touches)
        if (t.phase == TouchPhase.Began)
        {
            initialTouch = t;
        }
        else if (t.phase == TouchPhase.Moved && !hasSwiped)
        {
            float deltaX = initialTouch.position.x - t.position.x;
            float deltaY = initialTouch.position.y - t.position.y;
                //distance formula
            distance = Mathf.Sqrt((deltaX * deltaX) +(deltaY * deltaY));
            bool swipeSideways = Mathf.Abs (deltaX) > Mathf.Abs (deltaY);
            if (distance > 100f)
            {
                if (swipeSideways && deltaX > 0) {
                    this.transform.Rotate (new Vector3 (0, 30f, 0), rotationSpeed * Time.deltaTime);
                }

                else if (swipeSideways && deltaX <=0)// swipe right
                {
                    this.transform.Rotate (new Vector3 (0, 30f, 0), -rotationSpeed * Time.deltaTime);
                }

                hasSwiped = true;
            }

        }

        else if (t.phase == TouchPhase.Ended)
        {
            initialTouch = new Touch ();
            hasSwiped = false;
        }

}

sentences:
Is "forcing the user" to accept the terms an acceptable design in a smartphone/iPhone game? I am about to release my first iPhone game, has been a long project and I involved several people. My lawyer strongly recommended me to add a "terms and conditions" page at the beginning of the app and to allow the user to continue to the game only if he presses "I agree".

In the iTunes game description I will include a link to the EULA and a warning saying "DISCLAIMER: The game will ask you to agree to the following EULA: HTTPLINK EULA.".

My main reason for adding this is that I got the license to use the name from relatively famous people and I need to put the terms and conditions in order to protect both my company and my licensee.

Some developers suggested me to avoid this strongly as I will lose user base. From my perspective I think that including terms and conditions is a fair thing to do and non-smartphones users are used to accept EULAs. It is true that on smartphones you rarely see this and can this really affect my game? Would you argue against my design choice to allow the user to play only if he accepts the EULA?

Are there among you any smartphone game developers that have had similar concerns and have asked their users to accept the EULA?

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:
Moving from HeroEngine to Unity/Torque 3D Short background: small team with some financial back-up from investors, yet no multi-billion-$ enterprise, working on an MMORPG for PC.

HeroEngine looks like the perfect solution. Everything included that's needed to get started, programming languages also include C++/C#. Sounds perfect.

However, once the money's rolling in, a company might prefer work on its own, including its own server park, etc.

Does anyone have experience in using HeroEngine? Is it possible to migrate projects from it to Unity/Torque 3D or the like? Are there legal restrictions (I had a look into the license agreements yet was unable to find an answer to this)?

Should they get started with HeroEngine and the migrate later or is it wiser to choose an engine like Unity/Torque 3D from the get-go?

sentences:
Random Sobol 3D Cell in Unity There is a blueprint in UE4 for making Sobol random 3D cell. It places random objects inside cell structure.
How to make this in Unity?

For example, if I make a sphere prefab I would need to generate Sobol distribution in some volume.

EDIT:

@Seyed Morteza Kamali have made a script:

sentences:
Inertia in flight simulation using box2d I'm trying to simulate flight using box2d and libgdx.

The main problem I am currently experiencing is with inertia: since there is no air, the plane looks like it were drifting.

I wasn't able how to turn off inertia.

I have two ideas:

Imitate air resistance by applying force
Imitate flight using linear velocity without using any box2d physics

Are any of these two ways correct? Or maybe there is way to turn off inertia?

sentences:
How do I understand a big c++ gaming project in SFML? Currently I am doing SFML- c++ as a basement in game development before starting out Unreal

When I see a game project in  SFML,  the codebase is huge, like above 30 classes, 100 functions, how can I get an idea of the code project, any suggestions about the usual standard class names in SFML projects and their purpose would be helpful.

sentences:
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:
touch.phase == TouchPhase.Canceled not worked i m tired to handle and solve issues related to multitouch. i m use maximume 5 touch simultaneously but when two touches are down on two object and i moved my fingures then that both touches fired TouchPhase.Ended event but not fired TouchedPhase.Canceled.

I want to fired TouchPhase.Canceled when i my fingures out of those objects.

if (touch.phase == TouchPhase.Began) { hitObject.GetComponent ().TouchDown (hitObject); }

if (touch.phase == TouchPhase.Ended) { hitObject.GetComponent ().TouchExit (hitObject); }

if (touch.phase == TouchPhase.Moved || touch.phase == TouchPhase.Stationary) { hitObject.GetComponent ().TouchStay (hitObject); }

if (touch.phase == TouchPhase.Canceled) { print ("Touched canceled...."); hitObject.GetComponent ().TouchExit (hitObject); }

sentences:
Render to texture and then to screen cause flickering So I have my class vItem which has a vector (consider elements like layers) of textures, origin rects and destination rects plus other stuff.
Basically whenever I update any of the layers in the vector I redraw everything on an internal texture which is then displayed on the screen, here's the function that draws on the texture:

void vItem::draw(){
    if(sprites.size() <= 0)
        return;

    // This calculates the dimensions of a rectangle big enough to contain every texture
    SDL_Point size = calculateSpriteRect();

    if(size.x <= 0 || size.y <= 0)
        return;

    // If the final texture does not exists or its dimensions are different from the new rectangle I destroy it and recreate it
    if(final_sprite == NULL || size.x != final_sprite_size.x || size.y != final_sprite_size.y){
        if(final_sprite != NULL)
            SDL_DestroyTexture(final_sprite);
        final_sprite = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, size.x, size.y);
        SDL_SetTextureBlendMode(final_sprite, SDL_BLENDMODE_BLEND);
        final_sprite_size = {size.x, size.y};
    }

    SDL_RenderPresent(renderer);
    SDL_SetRenderTarget(renderer, final_sprite);
    SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0);
    SDL_RenderClear(renderer);
    for(int i = 0; i < sprites.size(); i++){
        SDL_SetTextureAlphaMod(sprites[i].sprite, sprites[i].alpha);
        SDL_RenderCopy(renderer, sprites[i].sprite, &sprites[i].source, &sprites[i].bounds);
    }
    SDL_RenderPresent(renderer);
    SDL_SetRenderTarget(renderer, NULL);
}

The problem comes after this function: I have a child class of vItem called vButton where I have two layers of text (one normal and the other on for when the mouse is over the button), and when I update alpha values of the layers to hide one level and show the other one draw() is called. This transition causes an instant flickering (black background right before drawing).
When I removed vSync I noticed that this wasn't happening anymore, but I need vSync.

UPDATE:
Ok... Apparently if I remove both SDL_RenderPresent(renderer); the flickering is gone and everything is rendering correctly, but I can't understand why. This is the final function:

void vItem::draw(){
    if(sprites.size() <= 0)
        return;

    // This calculates the dimensions of a rectangle big enough to contain every texture
    SDL_Point size = calculateSpriteRect();

    if(size.x <= 0 || size.y <= 0)
        return;

    // If the final texture does not exists or its dimensions are different from the new rectangle I destroy it and recreate it
    if(final_sprite == NULL || size.x != final_sprite_size.x || size.y != final_sprite_size.y){
        if(final_sprite != NULL)
            SDL_DestroyTexture(final_sprite);
        final_sprite = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, size.x, size.y);
        SDL_SetTextureBlendMode(final_sprite, SDL_BLENDMODE_BLEND);
        final_sprite_size = {size.x, size.y};
    }

    //SDL_RenderPresent(renderer);
    SDL_SetRenderTarget(renderer, final_sprite);
    //SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0);
    //SDL_RenderClear(renderer);
    for(int i = 0; i < sprites.size(); i++){
        SDL_SetTextureAlphaMod(sprites[i].sprite, sprites[i].alpha);
        SDL_RenderCopy(renderer, sprites[i].sprite, &sprites[i].source, &sprites[i].bounds);
    }
    //SDL_RenderPresent(renderer);
    SDL_SetRenderTarget(renderer, NULL);
}

How can the renderer keep information about the texture on texture rendering and texture on screen rendering at the same time (since I have only one SDL_RenderPresent() left at the end of my game loop)? Is it meant to work like that?

sentences: What's the difference between an "SDK" and an "engine?" In delving into game programming, I have encountered both "SDKs" and "game engines". What are their relationships and differences to each other?

sentences:
How can I achieve area fill in the video? I am trying to clone a game while learning Unity but I am stuck. How can I achieve area fill like shown in this Area Fill Example Video?
When I searched for it I found the "Flood Fill" algorithm but I am also not sure is it the right solution for this or not. Because in flood fill we have to select a point and check neighbors with same value and convert them, however here how can I decide which point to select and fill?
For example at 00:03 in video I close an area and game fills the area with cubes. With flood fill, if I select a starting point above that line, algorithm can travel through all outer tiles and very well can fill them with cubes also but game fills lesser area there. Why does the game pick a smaller area here? How do they decide which portion of the game field they should fill?
And in 00.11 when cube hit white wall they completely fill the remaining area because I guess they assume it is fully closed. But again my question is how can you decide that? Which methods provide area fills like this?
If someone has an idea or experience about this can points me to the right direction I'd really appreciate. Thanks in advance.

sentences:
Simple collision resolution in a platformer game I want to make a 2d platformer with moving, jumping and wall sliding. How can I make a simple pleasant collision resolution system that works for the following rectangles.
Player is red, platform is black, I want to detect if the player is sliding a wall, or hitting the ground, or doing both ( as in third example). Also take the appropriate response.
Also I have no idea what I am talking about so a little context might help.
These resources helped me:
How to resolve collision:
2D AABBs and resolving multiple collisions
How to detect overlap between aabb vs aabb:
http://noonat.github.io/intersect/

sentences:
Scene2d How to make it work for a Visual Novel I kinda understand that you can use Scene2d for a Hud or stuff like that, I'm new to Java and so far I've done games that update in real time like let's say Flappy bird (simple games), so i wanted to try something different and now I'm kinda stuck, instead of having all the level be decided at the start of the game i want to instead have a forward and backwards button (Visual Novel) that lets me update the screen on each click, the problem is that i don't know how to do it in a clean way, is there a way to update the button on real time or any technique to have an entire "dialog level" scripted?
(sorry if this sounds confusing i don't know how to phrase it properly, if you have played or seen a visual novel you would understand what I'm talking about)

sentences:
Unity prefab from multiple sprites I am making a prefab of a simple building by combining sprites. As you can see in the Hierarchy view, this simple building is composed of very many gameobjects which I created via dragging sprites into the scene/Hierarchy and then manually editing their coordinate positions.

Is there a simpler way of doing this? I feel that the process of creating this building consumed too much time I could spend on other aspects of development. If this is the only way, then in what ways could I optimize my workflow?

sentences:
Is there a sprite sheet creator that satisfies these requirements? I'm looking for a decent sprite sheet packer.

Features:

Command line interface for Linux.
Effective packing algorithm.
Configurable padding between sprites in the sheet.
Configurable fixed sprite sheet size (i.e. pack to many sheets).
Duplicate sprites detection, preferably with some tolerance to allow for FP errors when packing rasterized vector images.
Auto-crop by transparent pixels (i.e. sprite is cropped when packed and it is correctly reflected in the data).
Support for web-graphics formats (jpg, png at least).
Reasonable data output format (sprite sheet indes).

Paid software is okay as long as the price is reasonable.

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 "stacked sprites" in XNA? I'm working on a simple Sinistar-style shooter in XNA, and I'm constantly running into trouble with transformations.  I feel like I'll get it eventually, but this problem is really bending my mind.

My little ship has two states: idle and engines-firing.  Idle is a single frame, and engines is a few frames that animate. Got all that.  Part 1 of the issue: Instead of using rotated images, I just use XNA's rotation to orient the ship.  Seems to work ok, but I think my origin point is off because it seems to rotate at a point just below the vertical axis of the ship (default orientation is ship's nose pointing up), instead of in the dead center of the ship.  Likewise, when I switch to engines, the sprites are different heights (due to the flames) so the origin of rotation doesn't seem like it would be constant.  Do I need to specify all my frames the same size so as to preserve the origin point?

Second bit: The gun turret sits on top of the ship, as a separate sprite.  With a bit of trial-and-error and calculation, I can get the gun to align on top where I want it.  But then when the ship rotates, it rotates out from under the gun!  Would fixing the first problem adequately cover this one, or is there some trick to getting the gun's position to translate properly?

So:

Do I need to have all my sprite's frame-rectangles be the same dimensions?
Is there a standard technique in XNA for stacking multiple sprites so they act as one unit, including for rotations?

sentences:
Prevent tile layout gaps I'm making a map viewer where you can specify where tiles go in a map and then see it on the screen, translate it, and zoom in and out.

Here's a picture showing the tiles used to make my example map

Here's the tiles connected together, more or less my desired result.

The problem is that at particular combinations of translations and zoom levels the spacing is off. Here's an example picture of the problem.

In order to arrange the tiles I'm using a Perspective projection matrix parametrized by the zoom level, a camera matrix which just translates the scene based the camera's 2d position, and finally each tile is translated using another matrix derived from its x and y position.

tile * camera * projection

How can I avoid this weird spacing issue at particular positions? I'm guessing this is some kind of floating point precision issue, but I'm not sure.

(for those interested, the tiles I'm using are from this collection)

EDIT:

I was using the following parameters for the standard openGL perspective projection matrix:

let near = 0.5;
let far = 1024.0;

let scale = zoom * near;
let top = scale;
let bottom = -top;
let right = aspect_ratio * scale;
let left = -right;

where aspect_ratio is the window width divided by the window height, (in pixels,) and zoom in the error case above was set to 8.0. I read some more on perspective projection and floating point errors but couldn't find anything sensible to change so I resorted to adjusting the parameters. Specifically I tried setting near to 1.0 and now I can't replicate the weird spacing. So I guess my problem is solved?

But this is a mysterious and unsatisfying answer, so I would still appreciate it if someone could explain what went wrong, and how I can avoid it in the future without fiddling with numbers until it "magically" works!

EDIT responding to amitp

Here's a screenshot from the same version as above (with near still set to 0.5), with the background set to red as suggested. This seems to indicate that it's something wrong with the tile layout, not image bleed.

sentences:
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: How would I go about merging two models together in-game to create a new model? Let's say I have two models: model 1 is hilt and model 2 is blade. How would I merge these to models together to create a sword?

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 can I describe a square in OpenGL ES 2.0? I need to draw a Tic-Tac-Toe board in Xcode using OpenGL ES 2.0. I am new to graphics programming and can't find good information on drawing a square in opengl es in iOS. I looked at Ray's tutorials, which are good, however he covers drawing a rotating cube. All I want is a square; how can I describe a square for OpenGL?

sentences:
How to Convert Sprite into Texture I Have image with a sprite and i want to change this image sprite to Texture so that I can assign it to the material And i don't want to keep multiple copies for each image as a sprite and texture.

Is there any way to change sprite to texture at run time?

sentences:
How to position a sprite in a 2D animation skeleton? Given two joints that define a bone, I would like to know how to decide where, between those two joints, I should draw the sprite. This should be a fairly simple thing to solve, but there is one thing that I am not sure about.

After I've determined the rotation of the sprite (which is the absolute angle the joints form with the x-axis), I also need to determine the origin point from where I need to start drawing the transformed image.

So how should I position the sprite between the two joints? Should I make the center of the image be the midpoint between the two joints, or should I make one the of the joints be the origin? Do these things matter that much (could the wrong positioning make the sprite move oddly during the animation)?

sentences:
How can I stop the next screen from briefly displaying at the start of a CCTransitionFadeTR? I am testing transitions in cocos2d, and am running into a problem.

I have a MainMenu screen which contains a button.  The idea is that clicking on the button will trigger a CCTransitionFadeTR transition to a WhackMain screen where there is a CCLabelTTF which displays "Hello World".

But when I press the button and start the transition, the WhackMain screen appears at full opacity for a moment before the transition from MainMenu to WhackMain begins.  The transition appears to be working correctly, apart from WhackMain being visible for a moment before the transition begins.

How can I keep this from happening?

Here is my code, if it will help identify the problem:

MainMenu.m:

#import "MainMenu.h"
#import "WhackMain.h"

@implementation MainMenu

+(CCScene *) scene1 {
// 'scene' is an autorelease object.
CCScene *scene1 = [CCScene node];

// 'layer' is an autorelease object.
MainMenu *layer1 = [MainMenu node];

// add layer as a child to scene
[scene1 addChild: layer1];

// return the scene
return scene1;
}

-(id) init {
// always call "super" init
// Apple recommends to re-assign "self" with the "super" return value
if( (self=[super init])) {

    CGSize winSize = [[CCDirector sharedDirector] winSize];

    // Create a label for display purposes
    _label = [[CCLabelTTF labelWithString:@"Last button: None"
                               dimensions:CGSizeMake(320, 50) alignment:UITextAlignmentCenter
                                 fontName:@"Arial" fontSize:32.0] retain];
    _label.position = ccp(winSize.width/2,
                          winSize.height-(_label.contentSize.height/2));
    [self addChild:_label];

    // Standard method to create a button
    CCMenuItem *starMenuItem = [CCMenuItemImage
                                itemFromNormalImage:@"ButtonStar.png" selectedImage:@"ButtonStarSel.png"
                                target:self selector:@selector(starButtonTapped:)];

    // position the label on the center of the screen
    starMenuItem.position =  ccp( winSize.width /2 , winSize.height/2 );

    CCMenu *starMenu = [CCMenu menuWithItems:starMenuItem, nil];
    starMenu.position = CGPointZero;
    [self addChild:starMenu];
}
return self;
}

- (void)starButtonTapped:(id)sender {
  [_label setString:@"Last button: *"];
  [[CCDirector sharedDirector] replaceScene:[CCTransitionFadeTR
                                           transitionWithDuration:2 scene:[WhackMain scene2]]];
}

// on "dealloc" you need to release all your retained objects
- (void) dealloc {
[super dealloc];
}

@end

WhackMenu.m:

#import "WhackMain.h"
#import "MainMenu.h"

@implementation WhackMain

+(CCScene *) scene2 {
// 'scene' is an autorelease object.
CCScene *scene2 = [CCScene node];

// 'layer' is an autorelease object.
WhackMain *layer2 = [WhackMain node];

// add layer as a child to scene
[scene2 addChild: layer2];

// return the scene
return scene2;
}

-(id) init {
// always call "super" init
// Apple recommends to re-assign "self" with the "super" return value
if( (self=[super init])) {

    // create and initialize a Label
    CCLabelTTF *label = [CCLabelTTF labelWithString:@"Hello World" fontName:@"Marker Felt" fontSize:64];

    // ask director the the window size
    CGSize size = [[CCDirector sharedDirector] winSize];

    // position the label on the center of the screen
    label.position =  ccp( size.width /2 , size.height/2 );

    // add the label as a child to this Layer
    [self addChild: label];
}
return self;
}

// on "dealloc" you need to release all your retained objects
- (void) dealloc {
[super dealloc];
 }

@end

sentences:
Game treatment collaboration tools Other than using a wiki, what good (or purpose-built) tools allow for collaborative work on a game treatment?

I have a couple ideas I'd like to get fleshed-out and built, and have a small team who will work me on the project(s). How can we best iterate-over and define the game-play, graphical styles, etc?

sentences:
Point line collision reaction I am trying to program point line segment collision detection and reaction.  I am doing this for fun and to learn.

The point moves (it has a velocity, and can be controlled by the user), whilst the lines are strait and stationary.  The lines are not axis aligned.  Everything is in 2D.

It is quite straight forward to work out if a collision has occurred.  For each frame, the point moves from A to B.  AB is a line, and if it crosses the line segment, a collision has occurred (or will occur) and I am able to work out the point of intersection (poi).

The problem I am having is with the reaction.  Ideally I would like the point to be prevented from moving across the line.  In one frame, I can move the point back to the poi (or only alow it to move as far as the poi), and alter the velocity.  The problem I am having with this approach (I think) is that, next frame the user may try to cross the line again.

Although the point is on the poi, the point may not be exactly on the line.  Since it is not axis aligned, I think there is always some subtle rounding issue (A float representation of a point on a line might be rounded to a point that is slightly on one side or the other).  Because of this, next frame the path might not intersect the line (because it can start on the other side and move away from it) and the point is effectively allowed to cross the line.

Firstly, does the analysis sound correct?

Having accepted (maybe) that I cannot always exactly position the point on the line, I tried to move the point away from the line slightly (either along the normal to the line, or along the path vector).  I then get a problem at edges.  Attempting to fix one collision by moving the point away from the line (even slightly) can cause it to cross another line (one shape I am dealing with is a star, with sharp corners).  This can mean that the solution to one collision inadvertently creates another collision, which is ignored.

Again, does this sound correct?

Anyway, whatever I try, I am having difficulty with edges, and the point is occasionally able to penetrate the polygons and cross lines, which is undesirable.  Whilst I can find a lot of information about collision detection on the web (and on this site) I can find precious little information on collision reaction.

Does any one know of any good point line collision reaction tutorials?  Or is my approach too flawed/over complicated?

sentences: Real world terrain import into UE4 I am trying to create a basic game in Unreal Engine 4.8.1 and I wish to have it set in the Dubai, UAE but i cannot find a way that will successfully use terrain data i have obtained (NASA Shuttle RADAR 90m) to create a 1:1 scale map in unreal without creating huge world spikes. Does anyone know a method that can import the data without creating terrain spikes?

sentences:
Why am I getting the error "SDL_Event has not been declared"? I don't understand what I'm doing wrong. In my game.cpp, I have this:

void Game::input() {
    SDL_Event e;
    while(SDL_PollEvent(&e)) {
        if(e.type == SDL_QUIT) {running=false; cout << "Quitting" << endl;}
        if(e.type == SDL_KEYDOWN) {
            if(e.key.keysym.sym == SDLK_ESCAPE) {
            running=false;
            }
            moveSprite(e);
        }
        if(e.type == SDL_KEYUP) {
        }
        SDL_GetMouseState(&mousex, &mousey);
    }
}

In my player header file, I have:

class player {
public:
    player();
    int getPlayerX();  //get player's x position
    int getPlayerY();  //get player's y position
    void moveSprite( SDL_Event& e );
private:
    int xPos, yPos;
};

I'm getting the following error:

  SDL_Event has not been declared"

on the line: void moveSprite( SDL_Event& e );

It seems like something simple but I've been staring at it for hours and I can't figure it out. Be gentle, I'm a third semester programming student.

sentences:
How to smoothly track and draw player movement? I am currently using C# XNA Framework to simply connect some development concepts that I've learned/used over the past few months. Right now I have a Web Service that keeps track of connected clients and their 2D positions. I have a very small map that uses triangles to represent clients and their positions.

What I am seeing is my client updates very smooth (because I update my own position locally before sending it off to the web service), however, other triangles come in and appear choppy.

I use a web service that is called approximately every 20ms (and responds pretty quickly might I add). However, I know that XNA framework calls its update/draw methods approximately 60 times per second correct? Given this, there is ALWAYS going to be the appearance of choppiness.

Is there some strategy or pattern to handling this? I thought about implementing a method on the client side that basically says, give me start position and end position and I'll transition the triangle between the two points smoothly. But this may not be the right answer.

What are folks thoughts?

I am using a NetTcpBinding from WCF (Duplex). Is this technology simply too slow?

Is the right strategy simply to let the Service always tell me where the other clients are and the client simply draws them there?

Or does the client compute other information and make assumptions etc?

Thanks for any information on this topic!

sentences:
online game, NPC monster death and hit detection to gain experience points I'm doing a simple idle game, HTML5 client and Node.js server, but I'm making it online, where the client talks to the server (websockets) and all the logic is in the server (I want to prevent cheating as much as possible, because I want to have leaderboards).

My idea is, when the player X attacks the mob Y and it hits for 10 (should gain 10xp), so I send that via websocket, "playerX|10". How do I validate the input, so that a cheater can't just send "playerX|100000000".

Also how do I handle mob deaths? Do I send a "playerX,mobY" and the server replies with a drop?

Am I worrying too much about security? The golden rule is never trust the client, but how?

I'm thinking maybe all the client does is send actions?

message: attack|mobY, and the server calculates everything, xp gains, hit values, but I still don't know how to handle mob death, without having to keep state for the current "fight" with that mobY.

Sorry if I'm not clear enough. If you can share some thoughts or articles about this stuff, I'll be very glad!

sentences:
SDL2 and density-independent pixel I'm currently using SDL2 on Android and that's my first experience with that library (to be honest, mainly chosen because I'd like to learn it).
What is puzzling me is how to deal with different resolutions and density-independent pixels, for I cannot figure out which is the recommended approach to create images and let them look decently on screen on the most of the devices.

Unfortunately, googling around I've not been able to find a decent example or a bunch of information sufficient to clarify the doubts.
It seems that the most common suggestion is to choose a fixed size virtual resolution for the content rectangle, thus draw on top of it and finally resize it to the actual one, but it would be appreciated to know if this one is really a widely used approach and if there are some others that are more suitable.

Thank you.

sentences:
Good Book or Resource for 2D Game Art I have a very clear idea for my first Game . I have immense Experience in Coding Games in LibGDX but i am very poor at game art . So far I've been hating all the characters I've drawn . Are there any good books or other resource for learning 2D Character and Game elements Art .

Thank You

sentences: How to find points of a reflected 2d bezier curve about a line Pardon me if this sounds primitive. I have created a bezier curve with control points A, B, C, D, which are known (see image below). How can I find control points B1, C1, D1 for a new bezier curve reflected in AR1 and A2, B2 and C2 for a new bezier curve reflected in DR2?

sentences:
PBR Metalness Implementation: specColor at Value 1? I am doing a BRDF supporting the metalness/roughness workflow.
I know that in cases of Metalness = 1.0 the reflectance value is taken from the albedo map - so is the specular color to tint the highlights.

My question is if the specular color is taken at the same value that it is in the albedo or is it set to 1.0 first and then used ?

Example:

A Pixel in my Albedo Map has a  Hue/Sat/Value of 0.5/0.5/0.5

With metalness = 1 the reflectance is 0.5.

Is specColor

a) 0.5/0.5/0.5
b) 0.5/0.5/1.0 (to not dim the specular) ?

Thanks,
Jens

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:
Solids as high viscocity Liquids A friend of mine and I were discussing different idea for allow materials in a world to be destroyed in a very piecemeal fashion and he proposed the idea of representing solids as very viscious fluids. My intuition is that this would be either: A) very difficult, or B) very resource intensive, but I am unsure.

Is such a model feasible for an RPG/adventure rpg/fps?

edit:clarification: The idea is for collisions and objects breaking to be handled by this system. To basically allow any object handled this way to be destructable instead of having scripted destroyable objects.

sentences:
Rendering a image with some transparency has removed all black pixels and makes full texture transparent I am writing a program where with Directx11 I am rendering a texture to a flat rectangle something along the line a of 2D engine. Now parts of this image need to be transparent, to this effect I looked into alpha blending and it seemed to work until i changed textures and realized that it had removed all black pixels and made the whole image transparent not just those pixels that are blank. So how in Directx11 do you have it so that you preserve the transparency of the original image. I am using a ShaderResourceView that is a loaded png for the texture

**//Setup Blend State
D3D11_BLEND_DESC BlendStateDescription;
ZeroMemory(&BlendStateDescription, sizeof(D3D11_BLEND_DESC));

BlendStateDescription.RenderTarget[0].BlendEnable = TRUE;
BlendStateDescription.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
BlendStateDescription.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA;

BlendStateDescription.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC1_COLOR;
BlendStateDescription.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
BlendStateDescription.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ONE;
BlendStateDescription.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
BlendStateDescription.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;

dev->CreateBlendState(&BlendStateDescription, &blend);
float blendFactor[] = { 0, 0, 0, 0 };
UINT sampleMask = 0xffffffff;

devcon->OMSetBlendState(blend, blendFactor, sampleMask);**

sentences:
How to render the sprites for a 2D soft body physics system This is not a question as to how to achieve soft body physics, but rather if I have a mass-spring system how to modify a sprite with that information.
I am using unity so I dont have access to vector based graphics.

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:
When and why is a Pool class needed to hold objects? I've been studying opengl es and an example I saw was using a "Pool" class to keep track of touch and keyboard events.

Could someone please explain how and why a pool class is needed. From what I was reading it had something to do with garbage collection and limiting the number of input classes that are made.

This all seems a little abstract to me, so if someone could please explain what is going on, I'd appreciate it, I'll pasted some code here:

    public Pool(PoolObjectFactory < T > factory, int maxSize) {
        this.factory = factory;
        this.maxSize = maxSize;
        this.freeObjects = new ArrayList < T > (maxSize);
    }

    public T newObject() {
        T object = null ;
        if (freeObjects.isEmpty())
            object = factory.createObject();
        else
            object = freeObjects.remove(freeObjects.size() - 1);
            return object;
    }

    public void free(T object) {
        if (freeObjects.size() < maxSize)
            freeObjects.add(object);
    }

    PoolObjectFactory <TouchEvent> factory = new PoolObjectFactory <TouchEvent> () {

    @Override
    public TouchEvent createObject() {
         return new TouchEvent();
    }

    Pool <TouchEvent> touchEventPool = new Pool <TouchEvent> (factory, 50);
    TouchEvent touchEvent = touchEventPool.newObject();
    . . . do something here . . .
    touchEventPool.free(touchEvent);

Thanks!

sentences: C# XNA Elasticity Behavior What is elasticity? How do I implement such a thing?

sentences:
IsoMetric Map draw: sort with Z-Buffer and anchor point I'm writing an IsoMetric renderer for my html5 isometric game. The isometric renderer should be able to render objects with floating point coordinates.

SOURCE: https://github.com/ilmattodel93/EaselJs-Isometric-with-Heightmaps

As now, the renderer works pretty well, but I have some questions and a problem to fix.
Note that little square is the anchor point, and lines are AABB (not correctly drawn I think).

THE PROBLEM

If you have a look at the demo, you should note that when the dragon is behind the tree on a higher level, it will be rendered over the tree instead of behind, as expected.

As you can see in js/mmo/renderer/IsoEntity.js#L91 and js/mmo/renderer/IsoLayer.js#L65, i have a "rough" implementation, and maybe it is'nt good.
I've googoled around and find something called "topological sort", i've attempted to implement it, but it does'nt seems to solve.

For each tile I have information about minX, minY, minZ, maxX, maxY, maxZ. An AABB as you can notice.

THE QUESTION

My question is, how can I solve this problem? Is it better (and will be faster) to maybe implement a depth-buffer? And how can I implement it? Will it ensure high performance? Maybe will a correct anchor point (represented with little square) solve the problem?

Thanks for any help! :D

sentences:
Updating XNA BoundingSphere - sphere moves in opposite Y direction? In my players update method I calc the new world matrix then I update a boudingsphere by:

MyBoundingSphere = MyBoundingSphere.Transform(World);

However when the the model's World has moved vertically down MyBoundingSphere moves vertically up?! (i.e. MyBoundingSphere.Center.Y increases instead of decreases);

sentences:
How to calcolate moving vector of object by its rotation degress in 2d i have object in game which is rotating when i move my joystick , now i need to   calculate its movement vector by its rotation
the object always moving forward and controlled by the joystick , the joystick is only setting its direction by degree .
here is the image which illustrate the scene .
i need some formula of the vector which the object will move .

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:
Procedural generation of semi-correct planetary systems So there are lots of resources you can find via Google or using the search here on how to procedural generate a whole galaxy. But I couldn't find any good resource on how to generate planetary systems that follow these criteria:

The systems don't have to be accurate simulations of orbits but should be close to plausible orbits. I don't care about any simulation that cares about how the system might look in 200k years, the orbits could be rock solid. The main problem I'm facing is how to randomly generate a system that could be seen as plausible. This becomes especially interesting when you have a system with a binary star.

Just randomly creating orbits won't make up a plausible system, you'll end up with obviously non working orbits. Yes, I'm aware of the N-body problem :) but this doesn't help me, at least I think so, to solve the problem of generating a plausible system procedural?

I think you could just randomly spawn planets on their orbit and give them a mass and then use the N-body mathematics to calculate if they're more or less valid, if not start over and randomly generate new orbits until you get something that matches, but this would be very inefficient.

sentences:
How to create a thread in XNA for pathfinding? I am trying to create a separate thread for my enemy's A* pathfinder which will give me a list of points to get to the player. I have placed the thread in the update method of my enemy. However this seems to cause jittering in the game every-time the thread is called.

I have tried calling just the method and this works fine. Is there any way I can sort this out so that I can have the pathfinder on its own thread? Do I need to remove the thread start from the update and start it in the constructor? Is there any way this can work?

Here is the code at the moment:

bool running = false;
bool threadstarted;
System.Threading.Thread thread;

public void update()
{
    if (running == false && threadstarted == false)
    {
        thread = new System.Threading.Thread(PathThread);

        //thread.Priority = System.Threading.ThreadPriority.Lowest;
        thread.IsBackground = true;
        thread.Start(startandendobj);
        //PathThread(startandendobj);
        threadstarted = true;
    }
}

public void PathThread(object Startandend)
{

    object[] Startandendarray = (object[])Startandend;
    Point startpoint = (Point)Startandendarray[0];
    Point endpoint = (Point)Startandendarray[1];

    bool runnable = true;
    // Path find from 255, 255 to 0,0 on the map
    foreach(Tile tile in Map)
    {
        if(tile.Color == Color.Red)
        {
            if (tile.Position.Contains(endpoint))
            {
                runnable = false;
            }
        }
    }
    if(runnable == true)
    {
        running = true;
        Pathfinder p = new Pathfinder(Map);
        pathway = p.FindPath(startpoint, endpoint);
        running = false;
        threadstarted = false;
    }
}

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:
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:
Minecraft custom name laucher I'm trying to create a custom name laucher for Minecraft. I run an offline server and was wanting to give some of my friends a laucher to use so they can play. I have done this before with a batch file. Now I'm using JavaUI and I'm trying to start Minecraft from the Java program. I have yet to get Minecraft to pop up.

Here is the code i am using:

if (e.getSource() == app.startNorm){
    List<String> command = new ArrayList<String>();
    command.add("java");
    command.add("-jar");
    command.add(System.getenv("APPDATA") + "\\.minecraft\\bin\\* -Djava.library.path=\"" + System.getenv("APPDATA") + "\\.minecraft\\bin\\natives\" net.minecraft.client.Minecraft CustomNameHere");
    try{
        //line below wont work
        ProcessBuilder builder = new ProcessBuilder(command);
        Process proc = builder.start();
        app.setSize(500, 300);
        app.process.setVisible(true);
        app.memory.setVisible(false);
        app.start.setVisible(false);
        InputStream in = proc.getInputStream();
    } catch (IOException e1) {
        //always get dialog, when not never see minecraft pop up
        JOptionPane.showMessageDialog(null, "There was a problem with starting Minecraft");
    }
}

I was hoping someone could show me how to get this, or any other way to lauch Minecraft from inside my program.

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: Which consoles support fee-less indie game publishing? On which consoles can I publish indie games without paying a license fee?

sentences:
Why is my character jumping at different heights randomly? I have a character controller on my character's gameobject and I'm trying to make the character jump. This is working but sometimes he jumps way higher than other times. Does anyone know why this is happening? Here's the code:

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

public class Movement : MonoBehaviour
{
CharacterController cc;
public float Speed;
float Forward;
float Sideways;
float vertical;
public float gravity;
public float Jump;

// Start is called before the first frame update
void Start()
{
    cc = GetComponent<CharacterController>();
}

// Update is called once per frame
void Update()
{
    Forward = Input.GetAxis("Vertical") * Speed;
    Sideways = Input.GetAxis("Horizontal") * Speed;

    if (!cc.isGrounded)
    {
        vertical -= gravity * Time.deltaTime;
    }
    else
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            vertical = Jump * Time.deltaTime;
        }

        vertical = -8 * Time.deltaTime;
    }

   Vector3 Delta = transform.TransformDirection(Sideways, vertical, Forward);

    cc.Move(Delta * Time.deltaTime);
}
}

sentences:
Create body on a sprite (box2D) I'm quite experimented in objective C, but now i'm tried cocos2D and his features.

I need to add a body on a spritesheet (if possible on a classic 'UIImageView'), in order to detect collisions after.

Is there a way to create a box2D body, and that it suits sprite position ?

Because i wrote :

-(void) accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration
{
    CGPoint current = myUIImageView.center;
    int accelerator = 25;
    if (current.y > 70 && current.y < 407)
    {
        current.y -= acceleration.y*accelerator;
    }
    else if (current.y <= 70)
    {
        if (acceleration.y < 0)
        {
            current.y -= acceleration.y*accelerator;
        }
    }
    else if (current.y >= 407)
    {
        if (acceleration.y > 0)
        {
            current.y -= acceleration.y*accelerator;
        }
    }
    myUIImageView.center = current;
}

and found some codes, but looks very hard...

Thanks for your help !

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:
Transform a Screen Delta I have a delta in screen coordinates that I want to transform to a 3d delta in world space.

The delta is in this case a movement across the (x,y) coordinates in screen space on the near projection plane for a known z in the 3d space. The goal is to move an object in 3d space horizontally and vertically.

How would I do this?

I guess it has something to do with getting rid of the translation component in the world-view-projection matrix, as the delta is only influenced by the scaling and rotation part of the matrices.

I tried the naive approach by setting the translation component in the world-view-projection matrix to 0, but that did not work.

The only working solution i found so far is to unproject the (0,0,z) coordinate of the object to world space and then unproject the delta (x,y,z) to world space. The result of these 2 un-projections is then substracted to get the delta in world space.

sentences:
Achieve same effect as a FixedJoint2D but also match RigidBody2D forces Trying to make an object that is affected by rigidbody physics in exactly the same way as the object it's linked to. So torque, velocity, and any resultant torque or velocity from a collision.

This image demonstrates what I mean:

I've tried using FixedJoint2D, my objects share velocity but do not share torque, applying torque doesn't do anything to either object, it seems locked. I tried using other joints, such as DistantJoint2D(doesn't match y value, only separation value), TargetJoint2D(immediately negates velocity), RelativeJoint2D(The closest to actually working, but glitches out when torque is applied, it acts on a centre of mass between the two connected objects and the objects sort of spin around each other, sometimes getting closer together or farther apart)

I also can't just apply the transform position and rotation to the second object, since these objects will be colliding with moving objects. The objects that they collide with slide into the squares and are pinched away when using this method.

So I need to know if there is a way to use the FixedJoint2D or RelativeJoint2D or another method or joint that I do not know of to achieve this same effect. Perhaps applying the collision forces happening to one object to the other but it needs to be immediate and I don't know how to apply the collision from one object to another.

sentences:
How to set up flatbuffers in Android Studio - Gradle? Just switching over from Eclipse to Android Studio. I think I'm supposed to use Gradle to automatically download dependencies from the web. Sounds great, but I can't get it working with anything, in particular Google's flatbuffers.

So I found the link on the Maven repository, and I think I'm supposed to do something with the following:

// https://mvnrepository.com/artifact/com.github.davidmoten/flatbuffers-java
compile group: 'com.github.davidmoten', name: 'flatbuffers-java', version: '1.3.0.1'

But the comments in my project's Gradle (which is supposed to be a library by the way - but that's another story...) says I should not place my "dependencies here" (see below)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.1.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {
repositories {
    jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

So what am I supposed to do? I've heard of "modules" - so I could load flatbuffers in as a module?

sentences:
Rectangles clear each other when moving on canvas I am having this problem after moving rectangles, they seem to delete one another.
Most probably it is a problem with clearRect(...) method.
This is the clean function I am using:

clean: function(element){
        // All default values clean all the screen
        if(typeof element.x === 'undefined'){
            element.x = 0;
        }

        if(typeof element.y === 'undefined'){
            element.y = 0;
        }

        if(typeof element.width === 'undefined'){
            element.width = canvas.width;
        }

        if(typeof element.height === 'undefined'){
            element.height = canvas.height;
        }

        // In case values are entered
        if(element.type === 'rectangle'){
            ctx.clearRect(element.x,element.y,element.width,element.height);
        }
    }

This is the rendering

rect: function(element){
    // Check if color is defined
    if(typeof element.color === 'undefined'){
        element.color = 'black';
    }
    else{
        ctx.fillStyle = element.color;
    }

    // Draw the rectangle
    ctx.fillRect(element.x,element.y,element.width,element.height);
}

sentences:
One pass rendering with GL_TEXTURE_CUBE_MAP_ARRAY I try to rework rendering of point light shadows from "pass per cube face" to "one pass using geometry shader".

initialization:

glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, texId);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_DEPTH_COMPONENT, getWidth(), getHeight(), 6 * lightsNumber, 0, GL_DEPTH_COMPONENT, GL_FLOAT, (ByteBuffer) null);
glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, 0);

glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO);
glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, texId, 0);

int status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE) {
   throw new IllegalStateException("Could not create FrameBuffer: " + status);
}

glBindFramebuffer(GL_FRAMEBUFFER, 0);

using:

glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO);
glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, shadowBuffer.getTexture().getId(), lightNumber);

glClear(GL_DEPTH_BUFFER_BIT);

renderMeshes(scene, transformation);

depthShaderProgram.unbind();
glBindFramebuffer(GL_FRAMEBUFFER, 0);

GS:

#version 430

layout (triangles) in;
layout (triangle_strip, max_vertices=18) out;

uniform mat4 projLightViewMatrix[12]; // just two light
uniform int lightNumber;

void main() {
  for (int lIdx = 0; lIdx < lightNumber; lIdx++) {
    for(int face = 0; face < 6; face++) {
      gl_Layer = lIdx * 6 + face;
      for(int i = 0; i < 3; i++) {
        gl_Position = projLightViewMatrix[gl_Layer] * gl_in[i].gl_Position;
        EmitVertex();
      }
      EndPrimitive();
    }
  }
}

It casts shadows only for 1st light.
Could you notice something wrong?

sentences:
Opengl mutiple texture in a shader Im using modern opengl and c++.

How do I draw a number of triangles each one having a different texture in one draw call when I only have 32 texture units on my graphics card and the max texture size is 1024? My video card has 2gb of memory yet it can only hold 32 texture at a time?

Why do graphics cards have this limitation? I'm a c++ programmer and in c++ you don't have restrictions like that. The only restriction that you have is how much RAM you have which is fine.

sentences:
How can I make 3D lighting smooth? I'm trying to view 3D objects in a terminal. Everything was looking good until I implemented lighting. I'm using shadow rays to determine where the object should be lit. Although it's working I don't know how to make it smooth, I haven't tried anything since I don't actually know what to do.
Here's how a sphere is looking (light is coming from above):

As you can see it's either really dark (.) or light (@) so it's hard to determine the object.

sentences:
What is the purpose of a Direct3D vertex layout? This tutorial (msdn) gives a description of a vertex layout.

This is an example of a input layout:

D3D11_INPUT_ELEMENT_DESC layout[] =
{
    { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
};
UINT numElements = ARRAYSIZE(layout);

It seems to me that it would be easier to bypass this and simply consider data sent to the vertex shader/pixel shader as a block of floats and allow the vertex or pixel shader to interpret it as it wants.

My question is this:

What is the purpose of a vertex
layout?
Is a vertex layout optional
in Direct3D 11?

sentences: libgdx: How do you remove a cell from TiledMap? I am making a Terraria-style sidescrolling game with an open world. I am using a TiledMap to render all of the tiles. If I want to remove a tile, like if it is broken, how would I stop it from being rendered?

sentences:
Which is the better way to distribute server workload for MMO server? I'm making a server for MMO in Unity, which implies that I'll have a big world, split into maps which will be on different servers (to distribute the workload), managed by one master server.

Now I can't decide weather I should use one executable per map and have few executables run on each server or have few maps on one executable, which will have it's own server.
Second solution also would allow me to redistribute the workload by moving maps from one server to other (which shouldn't take long to do since servers don't need to load models).

Btw servers need to be made in Unity for the physics simulation and collisions...

The networking part can easily be multithreaded simply by using many threads to process the requests and generate response.
But since Unity is single threaded adding more maps would slow down the physics engine (plus the same thread has to apply all actions of the players to the game), so the first solution helps here by using multiple executables.
(Edit: Note: physics engine will take considerable amount of CPU time, even while the scene is empty)

Which solution should I chose?

EDIT:
On the end I decided to use both: few executables on each server, with each executable being able to run multiple maps and being able to dynamically create dungeons when needed.

sentences:
RayCasting with Mode7 I'm trying to join the mode7 algorithm with RayCasting. For mode7, I'm using a simple rotation matrix to implement the rotation. The result is a little strange and I can't fix it. Do you know what is the problem of the alignment of the algorithms? See the gif below to understand:

The code I'm using is:

function mode7() {
    let _x = 0;
    let _y = 0;
    let z = 0;
    let sin = Math.sin(degreeToRadians(data.player.angle));
    let cos = Math.cos(degreeToRadians(data.player.angle));
    for(let y = data.projection.halfHeight; y < data.projection.height; y++) {
        for(let x = 0; x < data.projection.width; x++) {
            _x = ((data.projection.width - x) * cos) - (x * sin);
            _y = ((data.projection.width - x) * sin) + (x * cos);

            _x /= z;
            _y /= z;

            if(_y < 0) _y *= -1;
            if(_x < 0) _x *= -1;

            _y *= 8.0;
            _x *= 8.0;

            _y %= data.floorTextures[0].height;
            _x %= data.floorTextures[0].width;

            screenContext.fillStyle = data.floorTextures[0].data[Math.floor(_x) + Math.floor(_y) * data.floorTextures[0].width];
            screenContext.fillRect(x, y, 1, 1);
        }
        z += 1;
    }
}

Is there someway or a tutorial to teach how to fix this issue? I tried to find it but i didn't find anyone about RayCasting with mode7.

sentences:
Do Gradle 'implementation' replace Unity Jar Resolver dependencies? I have a project with several *Dependencies.xml files which the Unity Jar Resolver resolves fetching the .aar files and storing them on Plugins/Android.

When installing Ironsource, I saw in the documentation that it says to add the dependencies to the mainTemplate.gradle file:

dependencies {
    // Your other dependencies //
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services-ads-identifier:16.0.0'
    compile 'com.android.support:support-v4:27.1.1'
    **DEPS**
     // Your other dependencies //
     // ... //
     // AdMob's dependency //
    compile 'com.google.android.gms:play-services-ads:17.1.1'
}

Because one of my dependencies that the jar resolver imports is an older version of support-v4 my build fails.

Seeing this new alternative, can I move all the dependencies files to the gradle file and let Gradle auto resolve this problem on the post build process?

Is there any pros/cons that the jar resolver has that Gradle doesn't? For what I know the Jar Resolver uses gradle.

sentences:
How to report bugs found on procedurally generated levels? There is many topics on how procedural generating works but I couldn't find any info on how to test and - what's more important - how to report bugs that may occur on procedurally generated levels. What is the best way to describe a bug, for example related to level design, on a map that will look different each time you play new game? What information should be included in bug report so reproducing it would be easier for level designer, level artist, etc. and then also during regression process?

EDIT:
It is worth mentioning that the game, I am preparing to test, is in very early phase of developing and is constantly changing along with the systems responsible for generating levels. The purpose of this research is to learn how to describe bugs (what info to include in report) so the regression in a changing environment would be as less time consuming and as effective as possible.

sentences:
Extending ModelProcessor How can one extend a model processor inside Windows Forms. In a normal XNA game you would simply create a new class like so(I think...):

[ContentProcessor]
public class ExtendedModelProcessor : ModelProcessor
{
    protected override ModelContent Process(NodeContent input,
        ContentProcessorContext context)
    {
        ModelContent m = base.Process(input,context)
        //my own code
    }
}

How can I duplicate this inside Windows Forms project, I am working on a project from microsoft site, "WinFormsContentLoading sample". I tried creating a class like above, but didnt work, then I tried to change the processor on contentBuilder.Add(...,"ExtendedModelProcessor"). And I also tried creating a new .dll ContentExtensionLibrary and then adding it inside ContentBuilder class, under:

static string[] pipelineAssemblies =
{
    "Microsoft.Xna.Framework.Content.Pipeline.FBXImporter" + xnaVersion,
    "Microsoft.Xna.Framework.Content.Pipeline.XImporter" + xnaVersion,
    "Microsoft.Xna.Framework.Content.Pipeline.TextureImporter" + xnaVersion,
    "Microsoft.Xna.Framework.Content.Pipeline.EffectImporter" + xnaVersion,
    Application.StartupPath + "\\myDll.dll"
};

And adding the .dll to the same folder as the program. But nothing worked. How can I create an extension for ModelProcessor inside Windows Forms?

Thanks

sentences:
D3D11 SetShader States I have some questions regarding the XXSetShader and what happens after, for instance I would like to know if when XXSetShader is called the subsequent calls would be bound to that particular shader, like PSSetShaderRsources. Because at load time I am bounding the resource views needed for that particular shader, then the next one and so on, but what I found is that the resources were not bound, I need to set them again every time the XXSetShader is called.

Am I doing something wrong? it's not supposed to work like that, the purpose of this is to have the least change states at runtime.

Thanks.

sentences:
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:
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:
Unity. Input in function for UI button OnClick I am trying to create multiple selections for some items on my UI. To perform multiple selections of items I want a user to hold left control button. But then I add

if (Input.GetKeyDown(KeyCode.LeftControl)){
/* Logic */
}

It registers in debugger what LeftControl is pressed but it skips all logic in brackets. This function is public and created for UI button.
Is Input and Button.OnClick compatible at all?

sentences:
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:
How can i add a description of gameobject when click on the gameobject? I have this DetectInteractable working script attached to Player (FPSController).

I'm using tag to detect interactable objects, each object i want to be interactable i change his tag in the editor to "Interactable". ( Maybe there is a better way to do it without using tag ? It's working but many told me not to use tag. )

I'm using Raycast to hit a gameobject detect if it's "Interactable" and if it does i display on the gameobject his name. For example "Security Door" or "Screen Monitor" or "Surveillance Camera"

Now i want to do that if i hit a gameobject with the raycast and it's "Interactable" if i will click the mouse left button it will display a description text description about the gameobject. But this time i want to use some gui box so it will be in front of the screen in the middle and not on the gameobject.

The problem is that i need to create a script for every "Interactable" gameobject and make that if i click on a button it will display a description.

Then how do i make the script and how can i make that when i attach the script to each gameobject it will make in the inspector a box of text so i can enter and type there the description of the item(GameObject) ?

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

public class DetectInteractable : MonoBehaviour
{
    public Camera cam;
    public float distanceToSee;
    public string objectHit;
    public Image image;
    public bool interactableObject = false;
    public Canvas canvas;
    public Text interactableText;

    private RaycastHit whatObjectHit;
    private RotateObject rotateobj;

    private void Start()
    {
        rotateobj = GetComponent<RotateObject>();
    }

    private void Update()
    {
        Debug.DrawRay(cam.transform.position, cam.transform.forward * distanceToSee, Color.magenta);

        if (rotateobj.rotating == false)
        {
            if (Physics.Raycast(cam.transform.position, cam.transform.forward, out whatObjectHit, distanceToSee))
            {
                if (whatObjectHit.collider.gameObject.tag == "Interactable")
                {
                    image.color = Color.red;
                    objectHit = whatObjectHit.collider.gameObject.name;
                    interactableObject = true;
                    interactableText.gameObject.SetActive(true);
                    interactableText.text = whatObjectHit.collider.gameObject.name;
                    print("Hit ! " + whatObjectHit.collider.gameObject.name);
                }
                else
                {
                    image.color = Color.white;
                    interactableText.gameObject.SetActive(false);
                    print("Not Hit !");
                }
            }
            else
            {
                image.color = Color.white;
            }
        }
    }

    public class ViewableObject : MonoBehaviour
    {
        public string displayText;
        public bool isInteractable;
    }
}

sentences:
Pathfinding with car steering Is there pathfinding algorithm which takes car steering into account?

I have large space where user can place cars (trucks actually) and other blocker objects.
Objects can be placed vertically or horizontally oriented and have different sizes (may be 3x6 or 2x4 or other size).
User needs to be able to select new location for any car - then I need to calculate how can that car move to selected location.

I have pathfinding working, and I can find paths with different size but only for square objects.

Update:

Pathfinding need to give only path that is possible with that type of car. For example on empty map with only one car, if user selects new location right next to its current location, car can't strafe or turn in place it has to either reverse and steer or do U turn or something.
Also it must ensure that car orientation at end is what user requested.

sentences: Jump Point Search on an infinite grid I recently found Jump Point Search and it seems like a really interesting algorithm. But I wonder about what its performance is like when your grid is of infinite size. When searching diagonally, is it not possible that the orthogonal rays being sent out can go on for an arbitrarily long amount of time on an infinite grid even if the place you want to pathfind to is just a few steps away? Is JPS feasible in general for such grids?

sentences:
How are deterministic games possible in the face of floating-point non-determinism? To make a game like an RTS networked, I've seen a number of answers here suggest to make the game completely deterministic; then you only have to transfer the users' actions to each other, and lag what's displayed a little bit in order to "lock in" everyone's input before the next frame is rendered.  Then things like unit's positions, health, etc. don't need to be constantly updated over the network, because every player's simulation will be exactly the same.  I've also heard the same thing suggested for making replays.

However, since floating-point calculations are non-deterministic between machines, or even between different compilations of the same program on the same machine, is this really possible to do?  How do we prevent that fact from causing small differences between players (or replays) that ripple throughout the game?

I've heard some people suggest avoiding floating-point numbers altogether and using int to represent the quotient of a fraction, but that doesn't sound practical to me - what if I need to, for example, take the cosine of an angle?  Do I seriously need to rewrite an entire math library?

Note that I am mainly interested in C#, which as far as I can tell, has exactly the same problems as C++ in this regard.

sentences: Is there a way to use Post Processing Effects on Mobile? I tried to use the built in unity Post Processing stack, I simply just want a vignette effect for my game, but it when I tested it on my phone it ran < 25 fps, which is too low in my opinion. Is there a way to recreate the effect for better performance?

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:
Crash when using datablocks I have really throughly searched the net and could not find any solution for this so I ask for help here.

Anyway, I have this datablock in datablocks.cs:

    datablock t2dSceneObjectDatablock(EnemyShipConfig)
{
   canSaveDynamicFields = "1";
   Layer = "3";
   size = "64 64";
   CollisionActiveSend = "1";
   CollisionActiveReceive = "1";
   CollisionCallback = true;
   CollisionLayers = "3";
   CollisionDetectionMode = "POLYGON";
   CollisionPolyList = "0.00 -0.791 0.756 0.751 -0.746 0.732";
   UsesPhysics = "0";
   Rotation = "-90";
   WorldLimitMode = "KILL";
   WorldLimitMax = "880 360";
   WorldLimitMin = "-765 -436";

   minFireRate = "2000";
   maxFireRate = "1200";
   laserSpeed  = "800";
   minSpeed    = "100";
   maxSpeed    = "150";
};

This is an exact reproduction of an object that I have manually edited in the editor. So far, I just used clone() to get as many enemies as I need, while it was out of sight. It is a r-type style shooter, so I need a variable amount of enemies. Since clone() spams my log, I decided to use datablocks, since it is also more flexible.

That's what I get when I use clone():

  Con::execute - 0 has no namespace: onRemoveFromScene

However, once spawning begins, my game freezes and crashes:

    function SpawnEnemy()
{
    //%spawnedEnemy = EnemyShipMaster.clone(true);
    %spawnedEnemy = new t2dStaticSprite()
    {
       class         = "EnemyShip";
       sceneGraph    = $global_sceneGraph;
       datablock     = "EnemyShipConfig";
       imageMap      = "starshipImageMap";
       layer = 3;
    };

    %speed  = getRandom(%spawnedEnemy.minSpeed, %spawnedEnemy.maxSpeed);
    %y      = getRandom(-320, 320);

    // Set Properties
    %spawnedEnemy.setPositionX(700);
    %spawnedEnemy.setPositionY(%y);
    %spawnedEnemy.setVisible(true);
    %spawnedEnemy.setLinearVelocityX( -%speed );
    %spawnedEnemy.setTimerOn( getRandom( %spawnedEnemy.maxFireRate, %spawnedEnemy.minFireRate ) );
}

// Definition of $global_sceneGraph from game.cs:
$global_sceneGraph = sceneWindow2D.loadLevel(%level);

As I said, it works fine when I use clone() (which is commented out here), but my log gets spammed. I really hope someone can shed some light for me, this is driving me crazy.

sentences:
Highlight edge on 3d cube in directx I want to make a 3d editor in DX9/XNA for a project I'm working on. I'm just thinking through how I would go about certain tasks and I'm stuck on one particular thing, which is crucial to making the editor working.

The editor will allow 3d objects to be added to the scene. For example I would add a cube to the scene. Now I want to be able to select one edge of the cube. When this edge is selected it should change colour. The remaining edges should not change colour.

If my description is not clear enough then it would basically be the same as the edge tool in blender. If you look at the following image you will see the first double cube has its centre edge highlighted

http://wiki.blender.org/index.php/File:Manual-Part-II-EdgeSpecials-EdgeSlide.png

I can't recall coming across anything in DX9 or XNA that allows edges to highlighted in this way. Would this be done in a shader perhaps?

Thanks

Edit From OP:  (Can't seem to post comments so editing the original.)
I had considered drawing lines but wasn't sure if it would trace the exact same path as the edge. I guess I it would be best to try this first before dismissing it. The purpose of the post was to find out if xna or dx9 had something built into it to do this sort of thing. I'm currently just in the design phase so have not implemented anything.

I would accept the answer from Roy T but I can't find the option to do so! Thanks.

sentences:
Locomotion-system with irregular IK Im having some trouble with locomtions (Unity3D asset) IK feet placement. I wouldn't call it "very bad", but it definitely isn't as smooth as the Locomotion System Examples.

The strangest behavior (that is probably linked to the problem) are the rendered foot markers that "guess" where the characters next step will be. In the demo, they are smooth and stable. However, in my project, they keep flickering, as if Locomotion changed its "guess" every frame, and sometimes, the automatic defined step is too close to the previous step, or sometimes, too distant, creating a very irregular pattern.

The configuration is (apparently)Identical to the human example in the demo, so I guessing the problem is my model and/or animation. Problem is, I can't figure out was it is =S

Has anyone experienced the same problem? I uploaded a video of the bug to help interpreting the issue (excuse the HORRIBLE quality, I was in a hurry).

sentences:
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 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:
multiple contacts for SAT collision detection I have implemented SAT algorithm for obb-obb intersection and I am able to generate a contact for this collision type. My problem is that SAT only generate ONE contact and in many situation I need more than one contact. For example, If I have a big cube and above it I have a small cube I need two contact (two contacts in 2D and 4 contacts in 3D) one for each bottom vertex of small cube.

My question is how can I generate more than one contacts with SAT?

Thanks.

sentences:
Tons of stuttering in XNA? As stated in the title, my program stutters like crazy, even though my program for the most part runs for 60 fps. During the moments it stutters, FPS momentarily drops down to 59(stats from FRAPS).

Here is an video capture of the stuttering in action. If you look closely, you can see the game stutter around 3-4 times. It is much more noticeable in real life.

http://gfycat.com/SevereCanineBabirusa

CLR Profiler shows that garbage collection doesn't run at all during that time, never mind 4 times, so it's not that.

Here's the code for movement:

            //Movement logic
            //Increase the speed
            speed = Math.Min(speed + (speedIncrement * (gameTime.ElapsedGameTime.Milliseconds / 200.0f)), maxSpeed);

            for (int i = fruits.Count - 1; i >= 0; i--)
            {
                //Move the fruits
                fruits[i].pos.Y += speed * gameTime.ElapsedGameTime.Milliseconds;
                fruits[i].rect.Y = (int)fruits[i].pos.Y;
                //Check if the fruit is past the screen. If it is, remove it from fruits
                if (fruits[i].rect.Y > screenHeight)
                {
                    fruits.Remove(fruits[i]);
                }
            }

IsFixedTimeStep is set to false, but SyncronizeWithVerticalTrace is on. Any idea what could be the cause of the stuttering?

EDIT: Apparently it was a combination of this: http://answers.microsoft.com/en-us/windows/forum/windows_7-performance/presentationfontcacheexe-uses-50-of-my-cpu/4200fe85-458f-4f19-b791-1fe5395304da and f.lux eating up my CPU/GPU cycles.

sentences:
Event queue: tell or ask? I'm working my way through a lot of game development resources, coming from a completely different field of software development, I'm interested in learning what patterns are frequently used in game development, and which aren't.

During my research, I wanted to know if/how event queues are handled in games, and came across Game Programming Patterns' post about Event Queues. (as an aside, what an awesome resource that book is!)

In it, Bob Nystrom gives an example of a "play audio" queue, where one part of the system can produce/enqueue the playing of an audio fragment, and the audio handler/consumer can act on that request whenever it can.

I like this pattern a lot, but the end-result still feels like it results in domains being crossed, because the sender (in this example the part of the system that deals with a unit dying) has to ask the audio system to play the "deathSoundID" sound using playSound(deathSoundID) (which, in this case, then enqueues that request for the audio engine to pick up as soon as it can).

What I expected to be proposed is that the sender in this case tells the audio engine that an event occurred (by having the audio engine listen for events from this specific game system), at which point the audio engine can then determine if/how it wants to act on that specific event.

Now, admittedly, there's still crossing of domains here, as in my example, the audio engine now has to have some kind of (huge) case statement that couples any game event to an audio-related action, but you no longer have to litter unrelated functions with calls to playSound, and it also forces you to be a good citizen, and allow other systems to act on whatever action you just took, be it the audio engine in this case, or the "gamepad rumbler" engine that wants to rumble your gamepad because you've just slain a large enemy.

Another downside to this is that you need many more queues for all your systems (if you want to avoid some kind of global event queue, which I think you should), which might not be practical/performant enough to do, so perhaps that's the reason why it wasn't chosen here.

Either way, as a newcomer to game development, I'm interested to hear why one would be preferable over the other, and in what situations that would be the case.

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

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

sentences:
Programming Test for a job in Game Dev - expected levels of documentation etc If this is the wrong place to be asking this - please let me know and I'll happily ask it somewhere else!

I am completing a C++ Proficiency test for a "Junior Engine Programmer" role at a game studio in the UK. The test involves creating a pathfinding demo and rendering it to the screen. I won't go too into the details of the test, but the brief doesn't mention any documentation or unit testing etc.

I've been told by a lecturer I should definitely include both of those, despite not being asked, and by another that I should use my time more wisely to make a great implementation. What is the done thing here? The only thing close that the brief mentions is making clear where I've used other libraries.

Is there anything else I should consider submitting with the implementation as well? Thinking of technical specification such as class diagrams etc, or anything really.

Thanks!

sentences:
Giving the illusion of speed I'm making a racing game that feels a lot like xtreme g 64 or fzero.

Making the player feel like they are moving extremely fast is important for this game. Actually moving them fast enough to give them that feeling is out of the question. Collision detection and a few other aspects of the physics engine prohibit it.

My current solution is the following:

Map the speed to the field of view for the projection matrix so that the FOV is 30 at speed x and 100 at speed y with a linear increase for the FOV inbetween x and y. This will probably be some polynomial once I test it out some.
Trail render any light sources on the vehicle. I am just adding a trail rendered blurred object of the same color as any light source: tail lights, jet flames, etc.
slight camera shake when you are above 3y/2 speed
your max speed without a boost is y/2, when you have a boost the max speed is y and these effects all become pretty noticeable

My Question:
I can't do any post processing effects on the iphone. I'm limited to poor mans solutions like the one I did. Is there another approach that is more common or better? My solution seems like what they would have done back in the N64 days so I'm wondering if there's a better way. The problem with this solution is that it makes it seems cheap to stretch the FOV like I am. It's a cool effect, but still feels cheap when you play it.

Here's a link to a very limited version of my effect

The speed they are simulating is supposed to be 400kph, I'm simulating about 2000 meters per second, about 18 times their speed. so my effects are very exaggerated.

Note:
I'de give you a screenshot but setting up a test scene that doesn't display the art assets would be hard. Setting up one with the art assets would get me sued.
My object is on the ground so I'm avoiding effects that are used more for aircraft.
There is no wind or dust so that is a little more limiting in using those elements.

sentences:
Why is my collision detection not accurate? After trying and trying, I still cannot understand why the leg of character exceeds the wall but no clipping issue when I hit the wall from below. How should I fix it to make him stand still on the wall?

From collideWithBox() function below, it shows that playerDest.Y = boxDest.Y - boxDest.height; will get the position the character should standstill on the wall. Theoretically, the clipping effect won't be happen as the character hit the box from below works with the equation playerDest.Y = boxDest.Y + boxDest.height;.

void collideWithBox()
{
    if ( spriteCollide(playerDest, boxDest) && keyArr[VK_UP])
        //playerDest.Y += 50;
        playerDest.Y = boxDest.Y + boxDest.height;
    else if ( spriteCollide(playerDest, boxDest) && !keyArr[VK_UP])
        playerDest.Y = boxDest.Y - boxDest.height;
}

void initPlayer()
{
    //  Create texture.
    hr = D3DXCreateTextureFromFileEx(d3dDevice, "player.png", 169, 44,
        D3DX_DEFAULT, NULL, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED,
        D3DX_DEFAULT, D3DX_DEFAULT, D3DCOLOR_XRGB(255, 255, 255),
        NULL, NULL, &player);

    playerRect.left = playerRect.top = 0;
    playerRect.right = 29;
    playerRect.bottom = 36;

    playerDest.X  = 0;
    playerDest.Y  = 564;

    playerDest.length = playerRect.right - playerRect.left;
    playerDest.height = playerRect.bottom - playerRect.top;
}

void initBox()
{
    hr = D3DXCreateTextureFromFileEx(d3dDevice, "brock.png", 330, 132,
        D3DX_DEFAULT, NULL, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED,
        D3DX_DEFAULT, D3DX_DEFAULT, D3DCOLOR_XRGB(255, 255, 255),
        NULL, NULL, &box);

    boxRect.left = 33;
    boxRect.top = 0;
    boxRect.right = 63;
    boxRect.bottom = 30;

    boxDest.X = boxDest.Y = 300;

    boxDest.length = boxRect.right - boxRect.left;
    boxDest.height = boxRect.bottom - boxRect.top;
}

bool spriteCollide(Entity player, Entity target)
{
    float left1, left2;
    float right1, right2;
    float top1, top2;
    float bottom1, bottom2;

    left1 = player.X;
    left2 = target.X;
    right1 = player.X + player.length;
    right2 = target.X + target.length;

    top1 = player.Y;
    top2 = target.Y;

    bottom1 = player.Y + player.height;
    bottom2 = target.Y + target.height;

    if (bottom1 < top2) return false;
    if (top1 > bottom2) return false;

    if (right1 < left2) return false;
    if (left1 > right2) return false;

    return true;
}

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 with move gameobject line renderer I create DrawLine class, I want my character to follow the line I draw.

How do I move my character on draw line renderer ?

Thanks!

public class DrawLine : MonoBehaviour
{

    public GameObject linePrefab;
    public GameObject currentLine;

    public LineRenderer lineRenderer;
    public EdgeCollider2D edgeCollider;
    public List<Vector2> fingerPositions;

    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            CreateLine();
        }
        if (Input.GetMouseButton(0))
        {
            Vector2 tempFingerPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            if (Vector2.Distance(tempFingerPos, fingerPositions[fingerPositions.Count - 1]) > .1f)
            {
               UpdateLine(tempFingerPos);
            }

        }
    }

    void CreateLine()
    {
        currentLine = Instantiate(linePrefab, Vector3.zero, Quaternion.identity);
        lineRenderer = currentLine.GetComponent<LineRenderer>();
        edgeCollider = currentLine.GetComponent<EdgeCollider2D>();
        fingerPositions.Clear();
        fingerPositions.Add(Camera.main.ScreenToWorldPoint(Input.mousePosition));
        fingerPositions.Add(Camera.main.ScreenToWorldPoint(Input.mousePosition));

        lineRenderer.SetPosition(0, fingerPositions[0]);
        lineRenderer.SetPosition(1, fingerPositions[1]);

        edgeCollider.points = fingerPositions.ToArray();
    }

    void UpdateLine(Vector2 newFingerPos)
    {
        fingerPositions.Add(newFingerPos);
        lineRenderer.positionCount++;
        lineRenderer.SetPosition(lineRenderer.positionCount - 1, newFingerPos);
        edgeCollider.points = fingerPositions.ToArray();

    }

}

```

sentences:
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:
representing transforms without a world/global reference frame Background:

I'm trying to make a segmented/portal-based game engine
that supports impossible (non-euclidean?) geometry.

By segmented/portal-based I mean the world is divided into segments which are connected by portals.
This technique was used by the engines for classic shooters like Doom and Duke Nukem 3d.

The portals do not look or function like the portals in the game Portal, which is unfortunately what most of the results that queries containing "portal" bring up.

Each area is in its own coordinate system
with each portal defining the transformation between
the portal entrance in the origin segment and
the portal exit in the destination segment.

It is possible for there to be multiple portals connecting the segments and for those portals to have different transformations.
If I understand correctly, this makes the world non-euclidean and precludes storing a transformation for each connected segment on a segment.

Objects have transforms for each segment they are present in.
So instead of the usual transform setup of objects having a local transform, a parent transform, and a world transform
there is no world transform and it is possible to have more than one "parent" transform.

Advanced math is not my strong point.
I understand the basics of the transformations
but there are some details I don't fully grok
and almost certainly some important or useful
properties that I am not aware of.

Questions:

Where do I "store" or "collect" the results of applying transformations to an object?

Do I apply them to the object's local tranform or do I apply it to the object's transforms relative to "parent" segments?

It seems like a bad idea to accrue transformations on the local transform, but perhaps I don't understand the purpose of the local transform.

Research before asking question:

tutorial on simple portals in unreal that helped with outlining the transformation logic, but is focused on unreal and does not answer my questions.

flipcode portal rendering tutorial which gets brought out anytime there is a question about portal-based rendering. I have read through it a couple times, although the small font is hard for me to read so it is very possible I missed some details.

related question

related question

discussion on gamedev subreddit

sentences:
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:
Unity3D - Determining if a spherical object is grounded using raycast I'm making a game revolving around moving a ball around a space. My game has a jump mechanic, so I need to know when I'm grounded in order to determine when I'm able to jump. Best way to check this is to setup raycast from ball's origin and make it constantly face downwards. However, I'm running into an embarrassing issue: the ball keeps rotating, so I'm not able to find a constant downward ray to use for finding the ground.

I started making code that looks similar to this, which the object's local transform:

bool grounded = false;
Ray ray = new Ray(transform.position, -transform.up);
RaycastHit hit;

if(Physics.Raycast(ray, out hit)){
//determine if object is on ground
grounded = true;
}

This caused the issue I stated earlier, where the ray would point downward but only relative to the object's current rotation. In other words, if the ball was upside-down, the ray would be pointing upwards.

My current code for this look similar to this, which now uses world space to determine what is 'down':

bool grounded = false;
Ray ray = new Ray(transform.position, -Vector3.up);
RaycastHit hit;

if(Physics.Raycast(ray, out hit)){
//determine if object is on ground
grounded = true;
}

However, in this instance, the ball raycast actually points directly to position Vector3(0,-1,0), which is even weirder than my initial problem and shouldn't be an issue based on other posts about this issue.

The only other way I can think of to properly determine whether the object is grounded is to see if it collides with anything. However, the other reasons I want to determine whether the player is grounded using raycast are:

for determining whether the player is over an endless pit (e.g. if they fell off the world) in order to start a kill/respawn timer
to ensure the player can perform a move equivalent to a butt stomp while in the air

If anyone knows how to perform a raycast on a spherical object in Unity, it's be much appreciated.

sentences:
How can I get the specific tile in a collision with a Tilemap? I am developing a simple platformer, I have three types of tiles right now:

Floor: does nothing on collision.
Bad: makes the player lose the game.
Good: makes the player beat the game.

I am trying to detect the collision with this code I found:

extends RigidBody2D

func _process(delta):
    var tile = get_parent().get_node("TileMap").get_cellv(get_parent().get_node("TileMap").world_to_map(position))
    print(tile)

The tile variable is supposed to contain the identifier of the type of tile the player is touching, but it doesn't, it always returns -1 (No exception or error, just -1).

I believe returning -1 means it isn't touching any tile, but it is.

This is using Godot 3.0 stable.

What am I missing?

Thank you for your patience.

sentences:
How do I correctly import an animation from blender into UE4? I have animated a conveyor belt in blender. When I import the animation to UE4, the conveyor belt does not move correctly. What am I doing wrong?
Here is a link to my blender file: Blender File

sentences:
Effective methods to continuously update movement in a tower defense game? We are four guys making a Tower Defense game as a project in first grade on a university. The game is going to be really simple!

Three different towers
Three different monsters
One map (maybe add some more if we have time)

The game has to be object oriented.

The class structure is as following

Game - Drawing of graphic, etc.
Level - Every level is an object of this class. Each level has a finite number of wave-objects (in a list)
Wave - Contains a list of monster-objects.
Monster - This is a superclass. We make subclasses for the different type of monsters
Tower - Superclass to the towers. There are subclasses for each type of tower.

We are thinking about how to solve the problem that many objects have to do stuff, at the same time, e.g. move one pixel in one direction.

What we came up with is the idea of implementing av class Timer, to control when objects do things. I am not sure this is the best way to do it. Could someone give some good ideas about how to solve the continious update case?

sentences:
Vuforia AR/VR sample with Google Cardboard SDK: I cannot switch from augmented reality to virtual reality I have followed the Integrating Cardboard to the AR/VR Sample latest tutorial. I have configured the provided scene sample according to that tutorial. I have compiled it to Android without any problem.

The game load an AR scene with a yellow pointer in the center. If I understood well, if a glaze at the ImageTargetStones GameObject, it will switch to VR. Unfortunately I cannot find that GameObject anywhere. I only see the AR scene with nothing than the yellow pointer.

I don't find what I'm missing. Why is not that ImageTargetStones GameObject in the AR scene?

UPDATE 1

I think I want to use Vuforia for an uncommon use. I think that's a reason of a possible misunderstanding.

I don't want to use its image recognition possibilities. I want to switch between AR to VR when glazing to a button.

I have tried to duplicate the VRButton to move it to an independent place of the scene with no parent. I have checked its IsTrigger checkbox. I have added a PointerEnter EventTrigger that set Focused to true. I have added a PhysicsRaycaster to both AR Camera and MainCamera (child of CardboardMain-Head).

Nothing happens when I gaze at the button. I have to compile everytime I want to try it by the way. I did not manage to make it work in the editor.

UPDATE 2

I haven't been able to do it with vuforia yet. I have done it with WebCamTexture. Specifically, I have used the scripts of this answer: http://answers.unity3d.com/answers/687987/view.html . The result is not nice because the image from camera seems closer than it actually is (with Vuforia, there is not that problem)

sentences:
Are Textures cached by GPU or buffered from memory for every frame? Are the textures buffered from memory(RAM) for each Draw Call/Frame or are cached in VRAM.

As per my research, I believe in the former case, if it is, then isn't the second approach a better option?

For example, in First Person Shooter games, the weapon is going to be rendered 98% of the time, so are those weapon textures cached by the GPU locally?

I am not sure about this, so I hope someone could explain this.

sentences:
Smooth interpolation with variable time steps My game engine just went through a small overhaul that changed its fixed time step loops into variable time steps ones. Though everything has already been adapted steadily to the new environment, there is still one algorithm that relied heavily on steady ticks: my camera's behavior.

It was pretty much like this (pseudo-code):

    class Camera {
        const float factor = /* value between 0 and 1 */;

        void update() {
            Vector2 distance = player.getPosition() - this.getPosition();
            this.move(distance * factor);
        }
    }

What is generally done for this sort of "pursuing" behavior? This is more than simple speeds and accelerations.

I could go with the following, but it still leaves a feeling of choppiness when in contrast with the rest of the game.

    class Camera {
        const float factor = /* value between 0 and 1 */;
        const float fixedStep = 1.0f / 40.0f; // supposing that it worked under 40FPS before

        float timeAcc = 0.0f;

        void update (float timeElapsed) {
            timeAcc += timeElapsed;

            while (timeAcc >= fixedStep) {
                timeAcc -= fixedStep;

                Vector2 distance = player.getPosition() - this.getPosition();
                this.move(distance * factor);
            }
        }
    }

It is C#-like pseudo-code, but don't be fooled: I'm actually using C++ and SFML, so I don't have many (or any) already-implemented methods at my reach.

sentences:
Design Pattern for "Default Object" I'm making a first person dungeon crawler like Eye of the Beholder.

During execution, I have a Map object. It contains Cell objects. Anc each Cell contains, at most, four Wall objects.

The Wall object has data for it's texture, and special elements like a door, a switch, etc. But most walls will end up being empty, boring walls.

My idea is to make this "boring wall" a single instance, that is referenced by all the cells that need it. Is there any design pattern or recipe in how to work with this? Or do you have any ideas?

I would like the entity's usability to be the same as the remaining entities (although I realise the default instance must be immutable).

I don't know if it helps, but I'm working with Lua.

Thanks in advance.

sentences:
Destroying the instance that instantiated the prefab What I have so far:

A fuel that has Fuel script attached to it.
The fuel prefab is first instantiated from another script in its Start() method.

problem:
The Fuel script is such that it results in instantiation of prefab fuel repeatedly at some intervals of time and keeps destroying the earlier ones.
But

the prefab that was instantiated from the other script stays there always. I want this prefab to be destroyed as well(or atleast made invisible) while the process of instantiation and destruction of of fuel prefabs continues to go on.

How do I achieve this?

sentences:
In Box2D, how do I create an infinitely oscillating spring? How do I create an ideal spring that can oscillate indefinitely using Box2D?

A b2DistanceJoint works almost perfectly, but it eventually slows to a stop, even with damping set to 0. I think it is because b2DistanceJoint is not meant for creating springs, but for preserving the distance between two bodies by correction the violated distance with a spring like behaviour. Hence, it should have a damping to eventually bring back the bodies to initial state and stop at some point.

sentences:
OpenGL and 3ds model loading: Path of least resistance? Hey guys, im working on a final class project for a graphics class, and me and a teammate are making a simple 3d tower defense game.

We're currently planning on using 3ds models and drawing them with OpenGL.However, niether of us have a lot of practice/experience with loading/drawing models.

What is the fastest and/or easiest (not neccesarily the best or most feature-implemented) way to load a 3ds model and draw it with a OpenGL/glut setup?

sentences:
Xna, writing XML  end element got another question here. Its not about actually writing/reading files in XML, i already know how to-do this. But rather something that has bugged me for awhile.
Ok, so when i write out my files, they look like this:

<?xml version="1.0" encoding="utf-8"?>
<XnaContent>
 <Asset Type="ProjectWitch.Animation">
      <Filename>C:\Users\Daniel Randell\Desktop\Project Witch\Project Witch (MAIN)\Project_Witch (MAIN)\Project_Witch (MAIN)Content\player.png</Filename>
      <CurrentFrame>0</CurrentFrame>
      <Number_Of_Frames>1</Number_Of_Frames>
      <Max_Time_Per_Frame>0</Max_Time_Per_Frame>
      <Animate_Once>0</Animate_Once>
      <Using_Image>1</Using_Image>
      <Rect>
        0    166  64   58
      </Rect>
      <Vector2>
        12   12
      </Vector2>
      <Rect>
        81   71   51   59   False
        80   71   13   43   True
        121  71   12   22   True
        130  82   7    41   True
        89   63   11   23   True
      </Rect>
 </Asset Type="ProjectWitch.Animation">

As you can see the problem, it should write out at the end:

      </Asset>
 </XnaContent>

But it's always writes out the:

 </Asset Type="ProjectWitch.Animation">

Its a bit annoying to keep having to look into the XML files and deleting this, so i'm wondering what i'm doing wrong?

Saving Code:
http://pastebin.com/yyC3q3aS

Thanks for any help :).

sentences:
Do I have to use new keyword for unity single game object? I'm using Unity4.
Do I have to use new keyword for single game object? look at the following code.

1.
GameObject obj = new GameObject();
obj = Resources.Load("Prefabs/Ball", typeof(GameObject)) as GameObject;

2.
GameObject obj;
obj = Resources.Load("Prefabs/Ball", typeof(GameObject)) as GameObject;

is it the same?

sentences:
How do I change the direction of a circle when it hits a corner? I have a 2D Ball that might go against a wall.
If the Ball goes against the wall perpendicularly, it will just invert its direction (assuming no air resistance and no bounces that should make its speed change).
My problem is: how the velocity of the Ball changes when it goes against a corner?
This is the case I didn't figure out how to handle:

sentences:
ScriptableObjects events execution order? Given the code:
[CreateAssetMenu(fileName = "newGameManagerInstance", menuName = "Game/Game Manager Instance")]
public class GameManagerSO : ScriptableObject
{
    private GameManager instance;

    public GameManager Instance { get { return instance; } set { instance = value; } }

    private void Awake()
    {
        Debug.Log("1");
    }

    private void OnEnable()
    {
        Debug.Log("2");
    }

    private void OnDisable()
    {
        Debug.Log("3");
    }

    private void OnDestroy()
    {
        Debug.Log("4");
    }
}

I have two questions:

Why the output in console when I enter play mode is "3" and then "2"? Shouldn't OnDisable be executed after OnEnable?

I'm using this scriptable object to hold an object reference only (I don't have the need to serialize the object, it's just a handy way I found to pass that reference through scenes without committing to singletons); can I code all initialization code for the object in OnEnable method? Can I assume it will always execute before any MonoBehaviour read it?

Also

sentences:
Perlin noise example the same on CPU as GPU? I am looking for an example site with a Perlin Noise implementation in both CPU and GPU, that generates somewhat the same results in those two places.

I see many CPU implementations of Perlin Noise, but they don't match up with the GPU implementations that I found.

The reason I need this is for physics. The map is generated with Perlin Noise on the GPU in 2D, but this also means that to do physics, I must have a CPU version of the algorithm that generates the same results.

sentences: What is the benefit of YCbCr? Why would someone want to store images as YCbCr instead of RGB in RAM or in GPU memory?

sentences:
Find which collider is causing collision (implementing danger zone) I have multiple SphereColliders attached to GameObject, one bigger to detect collision danger zone and the other, smaller, for actual collision (both triggers!). When the OnTriggerEnter() how do I find which one of those two caused trigger enter event?

private void OnTriggerEnter(Collider other)
{
    foreach (var collider in GetComponents<SphereCollider>())
    {
        if(isColliding(collider)) //how to find if this particular trigger isColliding ?
        {
            if(collider.radius > 0.5)//smaller or bigger one
               GetComponent<MeshRenderer>().material.color = _dangerColor;
            else handleCollision();
        }
    }

}

Because the accepted answer provides two solutions, it would be in order to specify how I solved the problem. In the end I went for keeping outter collider and doing "manual" overlap test for inner one (since I did not need physics response, it was the lesser evil). It also turned into new feature, it allows me to lerp danger color.

sentences:
Optimizing UV Map Sheet Based On Surface Area? I am trying to get my UV Map Sheets Optimized Based On Surface Area , I need Them optimized cause my scene area is huge and i want to use them in UDK so i am trying to get maximum possible optimization and i am running out of time

Here is What i Try TO Achieve :

Default 3DS Max :

Optimized By HAND THIS IS WHAT I WANT  Or Even Better If There Is Automated Intelligence Tool

Also I know this Tools Flatiron , UVPacker But They Are No Use

sentences:
Unable to add asset/sprite, not sure why I'm using Unity and have a 2D project.  I'm trying to add a background image to my project/scene, but I'm unable to.

Adding smaller .png files to the project work fine, by simply dragging them onto the Hierarchy tab.  My background image, and larger images, do not work though.  Below is the image in question:

It's a 66kb png.  Nothing weird about it.

How should I be adding it as a background if I'm unable to add it as a sprite?

Below is the assets settings under Import Settings:

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:
In practice, is it better to store Euler angles or store three vectors represent as "front/right/up"? I'm writing a game engine, and when it comes to the transform part, I just use the representation which unity/ue uses, that is: a vector for the position, a vector for Euler angles, and a vector for scale.

But I found that in most cases, I need to deal with the axis of an object, it's much intuitively to use the three axes.

So in practice, is it better to store Euler angles or vectors for axis?

Let me give a example to explain myself:
Here's my transform class:

class Transform {
 public:
    glm::vec3 position_;
    glm::vec3 rotation_;
    glm::vec3 scale_;
}

And each time I want to "move it forward to xxx meters", I need to calculate a front vector, which is a local z axis of the object(I use the term 'local' which comes from blender, the local cooradinate, not sure I make myself clear), what I do is to rotate the (0,0,1) with the Euler angles, to get a vector, which is the "local" z axis of the object.

My question is that is it batter to use the data structure I pasted above, or use there vectors, represent for x,y,z axes for the object?

sentences: Can't find Model Substance Painter - Lost in the Void I must have zoomed out too far, turned the camera in the wrong direction, whatever. The model is lost, I cannot find it in the 3D View. This is a complex project and I don't want to start over. I have tried orthographic view and all known keyboard shortcuts. But I am still lost in the void and I can't find my 3D Model. I'm about to plant a bomb at Substance Painter HQ or at least give them a phone call wishing death on them all.

sentences:
How does one calculate the surface normal, in 2D collisions? I have a ball, which should bounce when it collides with a surface. I know the formula for reflections;
$$ v_1 - 2n(v_1 \cdot n) $$

However, I cannot obtain the required information. I know:

the ball position,
the ball velocity,
the ball radius,
the polygon center
the polgygon width and height
the polgyon corner coordinates

How does one calculate the surface normal, in 2D collisions?

sentences:
Wang tiles generating I'm trying to get rid of repetition on terrain, when viewed from up high. To achieve that, I've chosen Wang tiles. One thing I'm missing, and can't really find is any kind of generator that can take a source image and generate a set of Wang tiles from it.

So is there any kind of generator that implements Wang tiles generation from source image? I've tried to read the research papers, but algorithms descriptions there are quite sketchy and vague to be actually put to code.

sentences:
AABB SAT code detects collision wrongly I've been having trouble getting my SAT code working using AABBs, and I've been trying to find a solution but, I'm scratching my head.

For some reason, it detects collisions very wrongly, as shown by this desk check I did.
(AABBvsAABB method at bottom.)

Consider two AABB, A and B.

A = X: 0, Y: 0, W: 102, H: 19

B = X = 87, Y: 6, W: 1, H: 1

These are colliding.

First, calculate normal

Normal = (0,0) - (87,6) = (-87,-6)

Next, we get half widths

aExtent = 102/2 = 51
bExtent = 1/2 = .5

Now lets calculate the overlap of the two.

 xExtent = 51 + .5 - |-87| = 51.5 - 87 =  -35.5

xExtent is less than zero so it says its not colliding, obviously this is wrong.

   /// <summary>
   /// Compares bounding boxes using Seperating Axis Thereom.
   /// </summary>
   public static bool AABBvsAABB(AABB a, AABB b, ref Manifold manifold)
   {
        manifold.Normal = a.Position - b.Position;

        //Calculate half widths
        float aExtent = a.Width / 2f;
        float bExtent = b.Width / 2f;

        //Calculate the overlap.
        float xExtent = aExtent + bExtent - Math.Abs(manifold.Normal.X);

        //If the overlap is greater than 0
        if (xExtent > 0)
        {
            //Calculate half widths
            aExtent = a.Height / 2f;
            bExtent = b.Height / 2f;

            //Calculate overlap
            float yExtent = aExtent + bExtent - Math.Abs(manifold.Normal.Y);

            if (yExtent > 0)
            {
                //Variable to multiply the normal by to make the collision resolve
                Vector2 faceNormal;

                //Check to see which axis has the biggest "penetration" ;D

                //Collision is happening on Y axis
                if (xExtent > yExtent)
                {
                    faceNormal = manifold.Normal.X < 0 ? -Vector2.UnitX : Vector2.UnitX;
                    manifold.PenetrationDepth = xExtent;
                    manifold.Normal = Physics.GetNormal(a.Position, b.Position);
                    manifold.Normal.X *= faceNormal.X;
                }
                //Collision happening on X axis
                else
                {
                    faceNormal = manifold.Normal.Y < 0 ? -Vector2.UnitY : Vector2.UnitY;

                    manifold.PenetrationDepth = yExtent;
                    manifold.Normal = Physics.GetNormal(a.Position, b.Position);
                    manifold.Normal.Y *= faceNormal.Y;
                }
                manifold.AreColliding = true;
            }
        }
        return manifold.AreColliding;
    }

Any idea what I am doing wrong here?

sentences:
OnMouseDown() and Collision not working for game object created within another game objects script I have created a game object (Brick) and added a script (BrickScript) to it. Within this script I create a Window game object if a certain condition is satisfied. Please see code below:

if (hasWindow) {
    if (window == null) {
        var size = gameObject.GetComponent<SpriteRenderer>().bounds.size;
        window = (GameObject)Instantiate (Resources.Load ("Prefabs/OtherPrefabs/Window"),
            new Vector3 (transform.position.x + 0.5 * size.x,
                        transform.position.y + 0.5f * size.y,
                        transform.position.z),
            Quaternion.Identity));
        window.name = gameObject.name + "Window";
    }
}

The Brick and window game objects actually overlap a bit. I realized that when hasWindow = true (the window is created) the condition in the code below is not satisfied and other game objects don't collide with the Brick. But when hasWindow = false (the window is not created), everything seems to work well. How can I solve this?

void OnMouseDown () {
    if (Input.GetMouseButtonDown(0)) {
        Debug.Log ("touch down");
        hasBeenTouched = true;
    }
}

sentences:
GdxRuntimeException uiskin.atlas I have problem when trying to use the uiskin.atlas from github/libgdx. I've downloaded(cloned) it from libgdx.git but it just doesnt work.

I get the following error:
Com.badlogic.gdx.utils.GdxRuntimeException: Error reading pack file: data/uiskin.atlas

And further down in the catlog it says:
Caused by: java.lang.IllegalArgumentException: 256,128 is not a constant in com.badlogic.gdx.graphics.Pixmap$Format

What does that mean?
Anyone knows how to solve it?

Im using the line
skin = new Skin(Gdx.files.internal("data/uiskin.json"));

Im at work at the moment so can't give more info than this. The error happens both in Eclipse and in AIDE on my phone.

sentences:
Drag 3D camera with mouse cursor I have a camera that is moved by changing its X and Z coordinates. However, the camera is rotated, so when an object moves by 1 unit in the world, the number of pixels it moves by isn't trivial to determine.

How could I move the camera so that if the pointer is at a set point, that point will be under the cursor after the cursor moves?

I have a PerspectiveCamera and the number of pixels that the pointer was dragged in each direction (X and Y) on the screen.

sentences:
Legality of using names in a game? If I am creating a board-game type game, does anyone know if it is legal to use others' names in the game?

ie. A playing card with "George Bush" or "Michael Jackson" on it.

Also, is it the same for brand names?

sentences:
Fixed timestep and interpolation question I'm following Glenn Fiedlers excellent Fix Your Timestep! tutorial to step my 2D game. The problem I'm facing is in the interpolation phase in the end.

My game has a Tween-function which lets me tween properties of my game entites. Properties such as scale, shear, position, color, rotation etc. Im curious of how I'd interpolate these values, since there's a lot of them. My first thought is to keep a previous value of every property (colorPrev, scalePrev etc.), and interpolate between those.

Is this the correct method? To interpolate my characters I use their velocity;
renderPostion = position + (velocity * interpolation), but I cannot apply that to color for example.

So what is the desired method to interpolate various properties or a entity? Is there any rule of thumb to use?

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:
Raycasting "fisheye effect" question Continuing my exploration of raycasting, I am very confused about how the correction of the fisheye effect works.

Looking at the screenshot below from the tutorial at permadi.com, the way I understand the cause of the fisheye effect is that the rays that are cast are distances from the player, rather than the distances perpendicular to the screen (or camera plane) which is what really needs to be displayed. The distance perpendicular to the screen then, in my world, should simply be the distance of Y coordinates (Py - Dy) assuming that the player is facing straight upwards.

Continuing the tutorial, this is exactly how it seems to be according to the below screenshot. From my point of view, the "distorted distance" below is the same as the distance PD calculated above, and what's labelled the "correct distance" below should be the same as Py - Dy. Yet, this clearly isn't the case according to the tutorial. My question is, WHY is this not the same? How could it not be? What am I understanding and visualizing wrong here?

UPDATE: Here's another perspective. The tutorial at lodev.org has another way of handling the fisheye effect which confuses me in the same way. This one relies on distance vectors more than angles and calculates the perpendicular distance to the wall according to the below formulas where mapX is the position of the player, rayPosX is the position of the wall that has been hit by a ray, and rayDirX is the direction of the ray (along with its Y counterparts of course). (1-stepX)/2 is simply a way of adding 1 if the ray is on the left side of the field of view. By the same logic as in the above tutorial, the perpendicular distance is simply mapX - rayPosX in my world. Why does rayDirX need to be divided to it?

//Calculate distance projected on camera direction (oblique distance will give fisheye effect!)
if (side == 0)
      perpWallDist = fabs((mapX - rayPosX + (1 - stepX) / 2) / rayDirX);
else
      perpWallDist = fabs((mapY - rayPosY + (1 - stepY) / 2) / rayDirY);

sentences:
Creating Animal Crossing style world rendering with Python I've dabbled a bit with writing 3D rendering code in the past, although I'm interested in knowing if there is existing code (libraries) written for/with bindings to Python that might facilitate the creation of a world effect similar to this.

The world is a tile map wrapped to barrel basically with the actor in the center and objects in the horizon falling behind a threshold.

My hope here is to try and spare myself as much as I can to do with the actual perspective, rendering, culling, etc... and focus more on the game and networking logic itself.  However any advice on the subject as to what approaches might be best suited here are welcome!

sentences:
Alternative ways to make a battle system in a mobile indie game more fun and engaging I'm developing an indie game for mobile platforms, and part of the game involves a PvP battle system (where the target player is passive). My vision is simple: the active player can select a weapon/item, then attack/use, and display the calculated outcome. I have a concept for battle modifiers that affect stats to make it more interesting, but I'm not convinced this by itself will add enough of a fun factor.

I've received some inspiration from the game engine that powers Modern War/Kingdom Age/Crime City, but I want more control to make it more fun. In those games, you don't have the option to select weapons or use items, and the "battling" screen is simply 3D eye candy. Since this will be an indie game, I won't be spending $$$ on a team of professional 3D artists/animators, so my edge needs to be different.

What are some alternatives to expensive eye candy that you or others have used to make a non-3D PvP game more fun and engaging? Did the alternative concepts survive the release?

sentences: Math behind simulating a simple light source for rotated rectangle? Say I have a 2D Rectangle. By offsetting its position by x y and rendering a shadow by an offset, it gives the illusion of a shadow. If I rotate the rectangle Z degrees and try it with the same offset, it appears as though the light source has moved. How can I compensate for the angle so it appears as though the shadow is always coming from the same direction?

sentences: Is there a way to set a shader define in Löve? I know I can use shader:send() to change variables, but is there a way to set/change a #define?

sentences:
How to resize a D3D11Texture2D? I would like to scale a D3D11Texture2D to make it smaller.

I'm using AcquireNextFrame to get an output of my desktop but it's on FullHD resolution. I just want to scale the texture because I need then to send the buffer over network.

Here is my code :

if (mRealTexture == nullptr) {
        D3D11_TEXTURE2D_DESC description;
        texture2D->GetDesc(&description);
        description.BindFlags = 0;
        description.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
        description.Usage = D3D11_USAGE_STAGING;
        description.MiscFlags = 0;
        hr = mDevice->CreateTexture2D(&description, NULL, &mRealTexture);
        if (FAILED(hr)) {
            if (mRealTexture) {
                mRealTexture->Release();
                mRealTexture = nullptr;
            }
            return NULL;
        }
    }
    mImmediateContext->CopyResource(mRealTexture, texture2D);

    if (mScaledTexture == nullptr) {
        D3D11_TEXTURE2D_DESC description;
        texture2D->GetDesc(&description);
        description.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
        description.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
        description.Width = 1440;
        description.Height = 585;
        description.MipLevels = 4;
        description.ArraySize = 1;
        description.SampleDesc.Count = 1;
        description.SampleDesc.Quality = 0;
        description.Usage = D3D11_USAGE_DEFAULT;
        hr = mDevice->CreateTexture2D(&description, NULL, &mScaledTexture);
        if (FAILED(hr)) {
            if (mScaledTexture) {
                mScaledTexture->Release();
                mScaledTexture = nullptr;
            }
            return NULL;
        }
    } //How to copy the mRealTexture to the mScaledTexture and get the new buffer ?

    D3D11_MAPPED_SUBRESOURCE mapped;
    hr = mImmediateContext->Map(mRealTexture, 0, D3D11_MAP_READ_WRITE, 0, &mapped);
    if (FAILED(hr)) {
        mRealTexture->Release();
        mRealTexture = NULL;
        return NULL;
    }
    unsigned char *source = static_cast<unsigned char *>(mapped.pData);

Thank you very much for your help.

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:
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 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:
How many and which axes to use for 3D OBB collision with SAT I've been implementing the SAT based on:

Dynamic Collision Detection using Oriented Bounding Boxes [PDF]

On page 7, in the table, it refers the 15 axis to test so we can find a collision, but with just Ax, Ay and Az, I'm already getting collisions.

Why do i need to test all the other cases? Is there any situation where just Ax, Ay and Az are not enough?

sentences:
Is it possible to use a spherical collision component in UDK? I have an object in UDK, which has a SkeletalMesh. At certain times in the game, I want this object to continue rendering the SkeletalMesh, but I'd like it to use spherical collision temporarily.

After reading a bunch about PrimitiveComponents, my understanding is that UDK supports cylindrical and box-like collision, but not spherical without using a static mesh.

EDIT:
What I have now is a StaticMesh with a material that makes it invisible. I've added a StaticMeshComponent to my Pawns. I can shut off the Pawn's collision, and turn on the StaticMesh collision. But it doesn't respond to impulses. I figure I'm missing something in how you turn on the RigidBody thingy.

CylinderComponent.SetActorCollision(false, false);
SetPhysics(PHYS_RigidBody);
RBCollisionComponent.SetStaticMesh(RBCollisionMesh);
RBCollisionComponent.AddImpulse(InImpulse);
RBCollisionComponent.WakeRigidBody();

sentences:
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 do I create a HUD that appears to occupy 3D space/can animate? I'm working with a group to try and make a first person space platformer in Unity, and was wondering if there would be anyway to create a HUD that moves and reacts to player actions, specifically looking around - similar to the way the HUD moves in Metroid Prime. I'd also like it appear projected onto the inside of a helmet.

I'm not entirely sure what best-practice would be in this situation. Should we just attach the GUI elements to transparent objects in 3D space, then parent them to the main camera, essentially building our HUD with actual objects; or is there another way that would be more efficient? I'm still very new to game development, but this is something we'd really like to have in our game if at all possible.

sentences:
Is there still a market for 2D games? Do 2D games still sell well? Assume it has nice visuals and good game-play.

I want to make games and want to start with 2D, but I am a bit hesitant, I have more than 8 years experience with 3D applications like Maya and other software, but not games. I'd like to know if it's worth the time investment to make 2D games.

sentences:
Bodies do not stay sticked together by joint in retina display I'm rehearsing on Box2D revolute joints. Everything's going pretty well except for one thing. For some reason bodies joined together with revolute joints do not stay sticked, they start getting apart from each other from the app start when I run it on retina device or simulator. On non retina device it works just fine, as expected. Here's the screenshot of the non-retina version:

And here's the behavior when I run the same app on retina device/simulator:

I'm taking content scale factor into account.

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

  64 Players on P.C ( 32vs32)

  & bigger maps with more vehicles & buildings.

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

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

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

sentences:
RaycastHit.point to local coordinates I'm trying to detect where approximately an enemy in my game has been hit.
I have added a box collider with a height of 1.8 metres to the enemy.

When the player then shoots, I use a RaycastHit to check if the enemy has been hit.
This works fine.

My code is this:

GameObject nHit = _LaserScript.hit.collider.gameObject;

if (nHit != null)
{
    Vector3 nHP = _LaserScript.hit.point; //"hit" is a RaycastHit
    Debug.Log("hit at x: " + nHP.x.ToString() + ", y: " + nHP.y.ToString() + ", z: " + nHP.z.ToString() + "\n");
}

I can relatively easy determine if the enemy has been hit at the head by checking

if (nHP.y > 1.5f)
{
    //headshot detected
}

However, I'm not sure if these coords have to be converted to "local" coordinates.

I tried to determine if I shot the enemy at the left side of his body or on the right side.

To my surprise, the "x" coord of the raycast was always around 1.2, and I have no idea why. I was expecting the x value of the hit to be somewhat between 0 and 0.5f as the collider is not wider than 0.5f.

Basically, I would like a hit at the left "border" of the enemy to have an x value between 0 and 0.1f.

Do I have to convert these hit coordinates (of which the docs say they're world coords) to "local" coords?

sentences:
How do I Animate a character in Unity3D (Animator)? first of all, I am new to Programming and Unity, but I want to create a simple game with Unity3D. I am using the StandardAssets (character) where all animations are included, but I dont get how to change animation state.

In the beginning I used this simple c# script to move the player:

    //move the player
    //A/D / LEFT /RIGHT
    transform.Translate (Vector3.right * Input.GetAxis("Horizontal") * speed * Time.deltaTime);
    //FORWARD/BACKWARDS
    transform.Translate (Vector3.forward * Input.GetAxis ("Vertical") * speed * Time.deltaTime);

But then I was only able to move the player around without any animations.

In the "Animator I am using the standard Controller "ThirdPersonAnimatorController".
But how can I interact with the Controller/Animator? The Condition to change from Idle to Walk is CharStateMove = 1.
But How can I change this value? I thought of something like "CharStateMove++;"

Or is there a more easier way to animate a character? Because I dont want to spent the whole time on animate the character. A very simple Animation would be enaught for me...

sentences:
Unity remove logo in splash screen Heavily related to this question, as of now, Unity's TOS has changed dramatically. And searching in the TOS, it looks like I'm allowed to remove the Unity logo in my exported game. Looking at Section 4.1, it still retains:

  You will not remove, alter or obscure any copyright, trademark,
  service mark or other proprietary rights notices incorporated in or
  accompanying the Services.

However looking at how "Services" is defined in the first paragraph of the TOS:

  Unity Technologies ApS (“Unity”, “our” or “we”) provides
  game-development and related software (the “Software”),
  development-related services (like Unity Analytics (“Developer
  Services”)), and various Unity communities (like Unity Answers and and
  the Made with Unity Platform (“Communities”)), provided through or in
  connection with our website, accessible at unity3d.com or unity.com
  (collectively, the “Site”). Except to the extent you and Unity have
  executed a separate agreement, these terms and conditions exclusively
  govern your access to and use of the Software, Developer Services,
  Communities and Site (collectively, the “Services”)

It does not seem to include the exported game itself. And even if Section 4.1 says "accompanying the services", I assume it still wouldn't include the game as the game does not need to accompany them. Otherwise it would be illegal to remove the logo from the splash screen from a game made in Unity Pro since the TOS applies to all tiers of Unity. Furthermore, I haven't found anywhere that says you can't modify or hack into the produced executables (I even looked in here which contains another part of the TOS). Does this mean I can remove the logo from the splash screen no matter what Unity tier (personal, plus or pro) I'm using?

(My aim is to actually move it to a dedicated credits section accessible from the title screen of the game rather than having it appear in the splash screen. Players of the game will still know that it's made in Unity.)

sentences:
How to create scrollable text in AndEngine? I'm creating some tutorial text that the user should be able to scroll.

Is there any way to make vertical scroll in AndEngine so that we can easily view all the content by scrolling up and down?

sentences:
Unity3d CarController character positioning issue I use the unity standard asset components CharacterController and Car and put an empty gameobject onto the car where the camera should be placed when i am inside the car. The empty gameobject is called "Driver". The character controller has an empty called "Head" where its head is.

When i get in the car i perform the following operation

GameObject car = GameObject.Find("Car");
transform.position = car.transform.Find("Driver").transform.position + Vector3.up*1;
transform.parent = car.transform.Find("Driver").transform;
Camera.main.transform.position = car.transform.Find("Driver").transform.position;
Camera.main.transform.rotation = car.transform.Find("Driver").transform.rotation;

and to get out of it, i use the following

GameObject car = GameObject.Find("Car");
transform.position = car.transform.position;
transform.parent = null;
transform.rotation = Quaternion.identity;
Camera.main.transform.position = transform.Find("Head").transform.position;

My problem is when i get into the car and out again, the character is positioned at the position where i have entered the car, so it doesnt seems to update its position with the car movement.

What am i doing wrong?

Thanks in advance

sentences:
Split the camera into sections? I have a layout for my game similar to this:

Where the light gray area is reserved for HUD elements and the dark gray area is reserved for the actual game. One function I want to offer in the dark gray area is the ability to zoom and move around, which works independently from the light gray area, meaning that no matter how far I zoom in/out or how far I move, the light gray area remains unaffected.

How can I do this without always taking the offset center into account? How can I completely separate the game play part and the HUD?

sentences:
Translation Matrix not working properly Hello,
I get this result when i try to scale and then translate a vec4 in my shader.
I created a mat4x4 class on my own and some functions wich return some matrices for me, everything works, but not the translationfunction.

Currently, I use this Shader Codes:

GLchar* vertexShaderCode = {
"#version 330 core                              \n"
"layout(location=0) in vec3 position;           \n"
"uniform mat4 scale;                            \n"
"uniform mat4 translate;                        \n"
"out vec4 vertexColor;                          \n"
"void main()                                    \n"
"{                                              \n"
"   gl_Position = translate*scale*vec4(position,1.0); \n"
"   vertexColor = vec4(1.0f,0.5f,0.7f,1.0f);    \n"
"}                                              \n"

GLchar* fragmentShaderCode = {
"#version 330 core                              \n"
"in vec4 vertexColor;                           \n"
"out vec4 color;                                \n"
"void main()                                    \n"
"{                                              \n"
"   color = vertexColor;                        \n"
"}                                              \n"

The matrix setup looks like this:

program.use(true);
h3d::mat4x4 mat_scale,
            mat_translate;
mat_scale     = h3d::Math::scale(.5f, .5f, 0.f);
mat_translate = h3d::Math::translate(.5f, .5f, 0.0);

GLint location_scale       = program.Uniform.getLocation("scale");
GLint location_translation = program.Uniform.getLocation("translate");

program.use(true);
glUniformMatrix4fv(location_scale,      1, GL_TRUE,mat_scale.getRowWiseValues());
glUniformMatrix4fv(location_translation,1, GL_TRUE,mat_translate.getRowWiseValues());

So basically, the h3d::Math::scale(X,Y,Z) returns:

X,0,0,0
0,Y,0,0
0,0,Z,0
0,0,0,1

And h3d::Math::translate(X,Y,Z) returns this:

1,0,0,X
0,1,0,Y
0,0,1,Z
0,0,0,1

The vertices are normal:

GLfloat vertices[] = {
    -1.0f, 1.0f, 0.f,
     1.0f, 1.0f, 0.f,
     1.0f,-1.0f, 0.f,
    -1.0f,-1.0f, 0.f,
};

What do I am doing wrong ? I really appreactiate your help !
All the other matrices are working (scale, rotate, perspective).

sentences:
What's the best practice for a progress bar in OpenGL ES 2.0? My attempt: I make a texture (could be a single colour or otherwise), and then stretch that texture from a minimum 0 up to a maximum max value. This works, but leaves me rather dissatisfied for a number of reasons, one of which being:

If I want rounded corners as the bar progresses, the edges are squashed or stretched.

My question: What is the best practice to achieve a progress bar result.

Thoughts: Is there a way to stop openGL from drawing anything from a certain x value onwards of a texture? That way I could draw the texture as it should appear, but specify the value of x.

I have found this potentially useful link.

Update

I get the impression that using the stencil buffer might be the way to go. The stencil buffer allows to define any region you like through which other rendered geometry can be clipped. Apparently there are many other uses for the stencil buffer, e.g. reflections.

Possible Solution

I ultimately achieved what I wanted using the stencil buffer combined with my own shader, since OpenGL ES 2.0 does not support glAplhaTest and related functions. Here's an image of the result:

The texture drawn to the stencil buffer was an elongated rectangle with rounded corners. The texture drawn to the image buffer was just a stretched red rectangle, which as you can see is clipped to the stencil contents. You need to write your own shader to deal with the alpha channel since OpenGL ES 2.0 does not support the glAplhaTest and related functions.

Note - perhaps this isn't the best image example. In fact the presented solution allows you to progressively reveal the left and right caps, which I unfortunately didn't demonstrate in the above image.

sentences:
Rotating an image in Python So I am making an "Asteroids" like game and I can principally get my sprites image to rotate but when I do, the image gets kinda torn apart. This is the method I am using for rotation. Any help would be appreciated.

  def turnLeft(self):

   rotatedSurf1 = pygame.transform.rotate(self.image,10)
   rotatedRect1 = rotatedSurf1.get_rect()
   rotatedRect1.center = (25,25)
   self.image.blit(rotatedSurf1,rotatedRect1)

sentences:
How to make it possible to change the width of the stripes? I am making a shader to create stripes based on this tutorial, but I cannot set the width for each stripe and make a shader that accepts light.
Shader "Unlit/Stripes-2"
{
    Properties{
        [IntRange] _NumColors("Number of colors", Range(2, 4)) = 2
        _Color1("Color 1", Color) = (0,0,0,1)
        _Ratio1("Width 1", Float) = 0.1 // Width for first color.
        _Color2("Color 2", Color) = (1,1,1,1)
        _Ratio2("Width 2", Float) = 0.1
        _Color3("Color 3", Color) = (1,0,1,1)
        _Ratio3("Width 3", Float) = 0.1
        _Color4("Color 4", Color) = (0,0,1,1)
        _Ratio4("Width 4", Float) = 0.1
        _Tiling("Tiling", Range(1, 500)) = 10
        _WidthShift("Width Shift", Range(-1, 1)) = 0
        _Direction("Direction", Range(0, 1)) = 0
        _WarpScale("Warp Scale", Range(0, 1)) = 0
        _WarpTiling("Warp Tiling", Range(1, 10)) = 1
    }

        SubShader
    {

        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag

            #include "UnityCG.cginc"

            int _NumColors;
            fixed4 _Color1;
            fixed4 _Color2;
            fixed4 _Color3;
            fixed4 _Color4;
            int _Tiling;
            float _WidthShift;
            float _Direction;
            float _WarpScale;
            float _WarpTiling;

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

            float2 rotatePoint(float2 pt, float2 center, float angle) {
                float sinAngle = sin(angle);
                float cosAngle = cos(angle);
                pt -= center;
                float2 r;
                r.x = pt.x * cosAngle - pt.y * sinAngle;
                r.y = pt.x * sinAngle + pt.y * cosAngle;
                r += center;
                return r;
            }

            float random(float2 uv)
            {
                return frac(sin(dot(uv, float2 (12.9898, 78.233))) * 43758.5453123);
            }

            fixed4 frag(v2f i) : SV_Target
            {
                const float PI = 3.14159;

                float2 pos = rotatePoint(i.uv.xy, float2(0.5, 0.5), _Direction * 2 * PI);

                pos.x += sin(pos.y * _WarpTiling * PI * 2) * _WarpScale;
                //pos.x *= _Tiling;

                int value = floor((frac(pos.x)) * _NumColors + _WidthShift);
                value = clamp(value, 0, _NumColors - 1);
                switch (value) {
                    case 3: return _Color4;
                    case 2: return _Color3;
                    case 1: return _Color2;
                    default: return _Color1;
                }
            }
            ENDCG
        }
    }
}

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:
Difference in light between Unity 5.5.2f1 and Unity 2019 The lighting is different between Unity 5.5.2f1 and Unity 2019. Please see the attached image.
I dislike the way the lighting is done in the 2019 version. Both verions are installed out of the box, without any additions.
What do I need to change / set up inside Unity 2019, in order to have the exact lighting as in 5.5.2f1 version?

sentences:
How do I run an iPhone GameSalad App on an iOS Device? I have made a simple game application with GameSalad . It runs fine in the iPhone simulator after loading the GameSalad Viewer but doesn't work in the device as it gives a code signing error. If I change the IPA according to the device then the GameSalad Viewer crashes and the app does not run.

Does anyone have a solution for this?

sentences:
unity - problem in limiting rotation of object? I am trying to make a game with unity.

In this game, player uses mouse to rotate a container or box around x and z (rotate to left and right and also toward the camera and opposite).

I used below code to control movement and limit it.

float zRot = transform.eulerAngles.z;
float xRot = transform.eulerAngles.x;
float yRot = transform.eulerAngles.y;
Debug.Log (
  "xDir : "  + xRot.ToString() +
  " yDir : " + yRot.ToString() +
  " zDir : " + zRot.ToString() );

if ((xRot >= 330 || xRot <= 30) && (zRot >= 330 || zRot <= 30)) {
  transform.Rotate (Input.GetAxis ("Mouse Y"), 0, -Input.GetAxis ("Mouse X"));
}
else {
  Debug.Log(xRot.ToString() + "  " + zRot.ToString ());

  transform.Rotate (-transform.rotation.x , transform.rotation.y,-transform.rotation.z );
}

The contatiner rotate 60 degrees in x and z and when it gets to the limits it stops, which is what I want. However when I rotate in both direction to the near the limits (330 or 30), the contatiner becomes out of control and it rotates freely and constantly. It's like the contatiner has passed the limits.

The questions are:

Did I used a good approach to limit the rotation and how to stop the object completely when it get to the limit of rotation?
When and why the object becomes out of control exactly?

sentences: Desura sales experiences Does anyone know of (or have) an experience selling an indie title through Desura? How does it compare with other typical indie game distribution avenues?

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:
Using pygame with multiple threads I have decided to try out pygame. I created a class that is supposed to handle all the GUI and game related stuff.
My idea is that I would have two seperate threads. One to handle the GUI and one to handle all the calculations the game does in the background.
import threading
import pygame
import pygame_gui

class Game ():

    engine_running = True
    gui_running = True
    clock = pygame.time.Clock()

    gui_framerate = 60.0
    engine_framerate = 120.0

    def __init__(self):

        pygame.init()
        pygame.display.set_caption('Explodotech')
        self.window_surface = pygame.display.set_mode((800, 600))
        self.background = pygame.Surface((800, 600))
        self.background.fill(pygame.Color('#000000'))

        self.manager = pygame_gui.UIManager((800, 600))

        ### Define GUI Elements here

        self.quit_button = pygame_gui.elements.UIButton(relative_rect=pygame.Rect((650, 500),
                        (100, 50)), text='Quit', manager=self.manager,
                        tool_tip_text = "Quit the game")

        ### Create and start the threads
        self.gui_thread = threading.Thread(target = self.gui_loop)
        self.engine_thread = threading.Thread(target = self.engine_loop, args = [])

        self.gui_thread.start()
        self.engine_thread.start()

    def start_polling(self):
        """Starts the main loop"""
        self.engine_running = True

    def stop_polling(self):
        """Stops the main loop"""
        self.engine_running = False

    def gui_loop(self):
        """Managing all the GUI stuff"""

        print ("GUI-loop started!")

        while self.gui_running:
            print("Polling GUI")
            dT = self.clock.tick_busy_loop(60)/1000.0

            for event in pygame.event.get():

                if event.type == pygame.QUIT:
                    self.gui_running = False

                if event.type == pygame.USEREVENT:
                    if event.user_type == pygame_gui.UI_BUTTON_PRESSED:
                        if event.ui_element == self.quit_button:
                            self.quit_button_event()

                self.manager.process_events(event)

            self.manager.update(dT)

            self.window_surface.blit(self.background, (0, 0))
            self.manager.draw_ui(self.window_surface)

            pygame.display.update()

    def engine_loop(self):
        """Doing all the game calculations in the background"""
        while self.engine_running:
            print(self.clock.tick_busy_loop(1))

    ### Define GUI events here

    def quit_button_event(self):
        """Shut down the GUI"""
        print("Quit-button pressed!")
        self.gui_running = False
        self.engine_running = False

Basically what's happening here is that I have two threads one should run the "gui_loop" function the other should run the "engine_loop". However when the gui thread starts and gets into its while-loop it get stuck. The windows goes unresponsive and I have to force windows to shut it down.
However if I a create a Game-object and call the function directly it all works fine (obviously commenting out the party where I create the Thread-object):
g = Game()
g.gui_loop()

Any pointers what I am doing wrong would be greatly appreciated!

sentences:
How do I add a prefab to another prefab? I want to instantiate a prefab, and then instantiate another prefab and then set the second prefab to the first prefab.

However, this doesn't work.

This is my code:

    //instantiate a new weapon prefab
    Transform nNewInstantiatedPrefab = Instantiate(tPrefab, new Vector3(0, 0, 0), Quaternion.identity);
    if (nNewInstantiatedPrefab == null)
    {
        Debug.Break();
    }

    //instantiate a new amount info canvas
    GameObject nNewAmount = Instantiate(ItemInfoCanvasPrefab, new Vector3(0, 0, 0), Quaternion.identity);
    if (nNewAmount == null)
    {
        Debug.Break();
    }
    nNewAmount.transform.SetParent(nNewInstantiatedPrefab);

    //now test if the prefab has been attached to the other prefab:
    Transform nTest = Helpers.GoFromName(nNewInstantiatedPrefab, "AmountCanvas");
    if (nTest == null)
    {
        Debug.Break();//this line is called
    }

And this is the helper function. I haven't had any problems with it so far:

public static Transform GoFromName(Transform t, string uName)
{
    foreach (Transform g in t)
    {
        if (g.name == uName)
        {
            return g;
        }
    }
    Debug.Break();
    return null;
}

Am I doing something fundamentally wrong, and perhaps prefabs can't be added to other prefabs?

Thank you!

sentences:
Correctly bitmasking path tiles based on existing paths Currently, I have a bitmasking implementation that sometimes incorrectly bitmasks the tiles. Conventionally, it is done correctly, and the math/etc is sound, but it achieves results such as the following:

This is similar to what you might expect, and looks fine when doing simple x-shaped crossings. However, I would like for the images to remain unchanged in some of these cases. For instance, the parallel paths in the third image would remain parallel paths instead of being bitmasked into many crossings. In the first and second images, only the parts of the path highlighted in the following images would be bitmasked (Different parts of path labelled for clarity.)

If I purely update only the tiles that make up the newest path, I again get good results in simple x-shaped crossings, however I get results such as those demonstrated in the following image:

What could I do to achieve results where this would not occur? I have though about adding some sort of flag to the tile to indicate that it is a crossing, but how could I detect that?

sentences:
Making a quad cover the screen I'm trying to make a shader and I need a fullscreen quad to do so.

I have everything set up and working, but when I render the quad it appears as a small square. This would probably be because I'm passing the cameras world, projection and view matrix into the shader and so the quad appears as a normal object. If I remove this it doesn't appear at all.

How do I go from it rendering as a part of the scene which moves with the camera to being something that completely covers the screen?

edit:

Vertices:

new VertexPositionTexture(new Vector3(-1, -1, 0), new Vector2(0, 0)),
new VertexPositionTexture(new Vector3(1, -1, 0), new Vector2(1, 0)),
new VertexPositionTexture(new Vector3(-1, 1, 0), new Vector2(0, 1)),
new VertexPositionTexture(new Vector3(1, 1, 0), new Vector2(1, 1))

Indices:

ushort[] indices = { 0, 1, 2, 2, 1, 3 };

Render:

        for (int l = 0; l < loader.GlowShader.CurrentTechnique.Passes.Count; l++)
        {
            //loader.GlowShader.Parameters["World"].SetValue(camera.World);
            //loader.GlowShader.Parameters["View"].SetValue(camera.View);
            //loader.GlowShader.Parameters["Projection"].SetValue(camera.Projection);
            loader.GlowShader.Parameters["glowTexture"].SetValue(renderTargetTexture);

            loader.GlowShader.CurrentTechnique.Passes[l].Apply();
            renderQuad.Render();
        }

sentences:
Why don't ShaderToy shaders work with LibGDX? Can someone tell me what is different about the shader implementation in LibGDX that makes it incompatible with the shaders from ShaderToy? It looks like you can use ShaderToy shaders directly with other frameworks so am wondering what the difference is.
People talk about converting shadertoy shaders from GLSL to HLSL for use with Unity or Monogame, but as far as I know LibGDX uses GLSL so I don't see why the code is different?

sentences: Comparing meshes and reducing duplication of data I'm writing a class that reads an obj file, indexes each mesh and creates a VAO and GameObject of the appropriate type. I've stumbled on a design issue. Objects of the same name (Tree_A001, Tree_A002) are currently skipped over, and their min and max extents are used to calculate their centre, and therefore where to position the a copy of that mesh. Not only does this mean I've read in the mesh twice, just to ignore all the data as soon as I've got the min and max, but in my case I have 230 trees. It works but takes 12-15 seconds to read in the file itself, and I've not been able to gleam the rotation or scale of said object. I understand that comparing the min and max extents of the duplicate mesh to the original could let me get the scale,  but as soon as the mesh is rotated in the scene file then it breaks. I'd like to do something more efficient than this however, and I'm stuck on what do to. What is the done thing in professional games, that allows multiple objects to be placed in a 3d modelling software, and their individual position rotation and scale to be kept? I've experimented with using single triangles to represent the position and scale etc but it makes designing the scene much harder as you can't see what you're placing. Thanks for any advice

sentences:
Correctly Implementing SSAO I am trying to implement Normal-Oriented SSAO and i'm having an issue with the results.  Portions of the screen are inverted/wrong, typically half way through the screen but not always, it seems tied to the camera, but can also be anything lol.  Here is the resulting render:

And here is the SSAO Shader:

void main()
{

  vec3 WorldPosition = texture(GPositionsTexture, In_TexCoords).xyz;
  vec3 WorldNormal = normalize(UnScaleNormal( texture( GNormalsTexture, In_TexCoords ).xyz ));

  vec3 Random = texture(KernalNoiseTexture, In_TexCoords * KernelNoiseScale).xyz;
  vec3 Tangent = normalize(Random - WorldNormal * dot(Random, WorldNormal));
  vec3 BiTangent = cross(WorldNormal, Tangent);
  mat3 TBN = mat3(Tangent, BiTangent, WorldNormal);

  float Occlusion = 0.0;
  for (int i = 0; i < KERNEL_SIZE; ++i)
  {
    // get sample position:
    vec3 Sample = inverse(TBN) * Kernel[i];
    Sample = Sample * Radius + WorldPosition;

    // project sample position:
    vec4 Offset = vec4(Sample, 1.0);
    Offset = CamData.Projection * CamData.View * Offset;
    Offset.xy /= Offset.w;
    Offset.xy = Offset.xy * 0.5 + 0.5;

    // get sample depth:
    float SampleDepth = texture(GPositionsTexture, Offset.xy).z;

    // range check & accumulate:
    float RangeCheck= abs(WorldPosition.z - SampleDepth) < Radius ? 1.0 : 0.0;
    Occlusion += (SampleDepth <= Sample.z ? 1.0 : 0.0) * RangeCheck;
  }

Occlusion = 1 - (Occlusion / KERNEL_SIZE);

Out_Diffuse = pow(Occlusion, Power);
}

sentences:
component Initialization in component-based game architectures I'm develping a 2d game (in XNA) and i've gone slightly towards a component-based approach, where i have a main game object (container) that holds different components.

When implementing the needed functionality as components, i'm now faced with an issue -- who should initialize components?

Are components usually passed in initialized into an entity, or some other entity initialized them?

In my current design, i have an issue where the component, when created, requires knowledge regarding an attached entity, however these 2 events may not happen at the same time (component construction, attaching to a game entity).

I am looking for a standard approach or examples of implementations that work, that overcome this issue or present a clear way to resolve it

sentences:
Why can´t this boolean stop the sound from playing 60 times a second? The code:
local dontPlayMoreThanOnceDammit = false

function Behavior:Awake()
    local sound = CraftStudio.FindAsset( "motorbuson1" )
    self.mySoundInstance = sound:CreateInstance()
    self.mySoundVolume = 1.0
    self.mySoundInstance:SetLoop( true )
    self.mySoundInstance:SetVolume( 1.0 )
 end

function Behavior:Update()
    if dontPlayMoreThanOnceDammit == false and CraftStudio.Input.WasButtonJustPressed( "on" ) then
        self.mySoundVolume = 1.0
        self.mySoundInstance:Play()
        dontPlayMoreThanOnceDammit = true
    end
    if CraftStudio.Input.IsButtonDown( "off" ) then
        self.mySoundInstance:Stop()
        dontPlayMoreThanOnceDammit = false
    end
end

Error it gives:

sentences:
Rotating an object smoothly I'm trying to rotate a ship in an asteroid game. What I'm doing is creating a float angle variable and at each time I press left or right buttons, I increase and decrease it, and in the drawing function, I rotate the ship by that amount.

The behaviour that I get is not really correct, because what I want is at each press, the ship should move smoothly and not by small increments.
This is what I'm doing:

 static float ang = 20.0f;

 if(event.getCode() == KeyEvent::KEY_RIGHT)
 {
      ship.m_Angle+=ang*getElapsedSeconds();
 }
 else if(event.getCode() == KeyEvent::KEY_LEFT)
 {
      ship.m_Angle-=ang*getElapsedSeconds();
 }

 gl::pushMatrices();
 gl::translate(Vec2f(m_Pos.x,m_Pos.y));

 gl::rotate(Vec3f(0,0,m_Angle));
 gl::scale(0.3,0.3,0.3);
 gl::color(ci::Color(1,1,1));

 gl::drawLine(Vec2f(-52,-23),Vec2f(69,0));
 gl::drawLine(Vec2f(-43,-20),Vec2f(-43,20));
 gl::drawLine(Vec2f(69,0),Vec2f(-52,23));
 gl::popMatrices();

EDIT: I would also like to limit the angle, it goes forever and the variable will overflow.

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: Skeletal animation using directx 11 I tried to find tutorials about skeletal animation or books that talk about subject to implement it, but I couldn't find any tutorials except talking md5 animated files. I would like tutorials that talk about that subject.

sentences:
How to correct obtain HWND from SDL2? I use Urho3D which uses SDL2 as a window system. I want create another window as GUI and make it child for main window of Urho3D.

What I did is:

// insde virtual void Start() // Urho3D app
SDL_Window * sdlw = context->GetSubsystem<Graphics>()->GetWindow();
int width = context->GetSubsystem<Graphics>()->GetWidth();
int height = context->GetSubsystem<Graphics>()->GetHeight();
HWND mw = SDLWindows::GetWindowHWND(sdlw);
wpfC = WPFI::CreateWPFControl(0, 0, width, height);
HWND www = SetParent(wpfC, mw); // SetParent is windows function
if (www == NULL)
{
    std::cout << "------------------------------\n"
        << "www = NULL\n"
        << GetLastError() << "\n"
        << "------------------------------\n";
}

HWND SDLWindows::GetWindowHWND(SDL_Window * wnd)
{
    SDL_SysWMinfo sysInfo;
    SDL_VERSION(&sysInfo.version);
    SDL_GetWindowWMInfo(wnd, &sysInfo);
    return sysInfo.info.win.window;
}

I got Invalid window handle (1400) Error on SetParent().

I am not sure if I am doing it right, but I am sure that my wpfC is ok because I have another test project where it is working but instead SDL window I use win32 Window.

I think SDL_GetWindowWMInfo() give me a wrong handle.

Question is how to obtain HWND from SDL_Window correctly and be sure that it is right HWND?

If it is not possible do it that way, is there another way how to create child window from HWND inside main SDL2 window?

sentences:
Solving maze without return ability I need to write a program that will solve maze. Maze has graph structure, where each node - some room, and edges - exits to other rooms:

Specification:

We start from a random room.
Maze has dead-ends, 0 or few exits.
We don't know anything about all maze, only the number of current
room and list of doors from it.
When we enter new room we don't know where we came from (what door
from current room leads us back to previous room).
We can recognize when we reach exit.
Each step we move from current room to some available door from it.
If we are at room 6 for example, we can't just jump to begin. It's like robot movement.
We know exactly ID of current room. We know ID of each door in current room (not in all maze).
We control robot.

I looked all known algorithms, but they all require at least additional ability to return to previous room. According to specification we can't use any algorithms that search for shortest path (actually, I don't need the shortest), because we know only about current room. We can't use Left-(Right-)hand following algorithms, because don't know direction of exits. Probably, the only solution that meets specification is choosing random exit in every room in hope that some time exit will be found...

Any suggestion how to solve such maze in more smart way?

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:
How to display three dimensional Objects in a 2D Game using OpenGL and orthographic Projection? I am creating a 2D (2.5D) game using OpenGL and orthographic projection.

It is simple to have relatively flat objects, e.g. characters.
I simply use a quad with a texture of the character and move that about.

However, what is the best way to draw big objects that have depth, e.g. a big house?
Do I use one quad with a three dimensional looking represantation of the house on it, or do I use multiple quads (e.g. front, side, top)?

I prefer using one quad with a three dimensional looking texture on it. What are the drawbacks to this approach?

sentences:
How to 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:
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:
Divide a tile map into multiple images So let's say I have a tilemap 5 x 5, which equals 25 tiles.
How can I divide my tilemap into 25 different images? I'm using tiled, but I don't know if it is possible to do it on there or if I need to use one other program.
Of course, my tilemap is bigger than 5 x 5, so it's why I'm asking because it would consume a lot of my time.
Thanks.

sentences:
What are my tool options to prototype a 2D online multiplayer game? I'm looking for the best tool to allow me to quickly put together a 2D game that relies largely on networking. It's extremely likely that this game will require a server side program to constantly run. I have little experience with these things and since it's a prototype i'd like the easiest options for achieving this.

I am looking to make this game for the web and mobile devices, although at present I only have access to ios hardware, (no android etc).

I just want to get the bare bones of this set up so I can test it from the earliest opportunity to see if it's fun.

EDIT - doesn't unity have some inbuilt networking stuff in it?

sentences:
Is it possible to use nav-mesh in 2d game in Unity? I'm working on game that needs navigation and obstacle avoidance. I've used nav-mesh on 3d project before but now I'm trying to use it in 2d sprite game but it seems like it doesn't work.

I want to know if really it doesn't work and, if it doesn't, what would be a good replacement for a 2d project for the navigation of entities.

I'm looking for free tools.

sentences:
XNA 4.0: Problem with loading XML content files I'm new to XNA so hopefully my question isn't too silly. I'm trying to load content data from XML.

My XML file is placed in my Content project (the new XNA 4 thing), called "Event1.xml":

<?xml version="1.0" encoding="utf-8" ?>
<XnaContent>
  <Asset Type="MyNamespace.Event">  // error on this line
    <name>1</name>
  </Asset>
</XnaContent>

My "Event" class is placed in my main project:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace MyNamespace
{
    public class Event
    {
        public string name;
    }
}

The XML file is being called by my main game class inside the LoadContent() method:

Event temp = Content.Load<Event>("Event1");

And this is the error I'm getting:

There was an error while deserializing intermediate XML. Cannot find type "MyNamespace.Event"

I think the problem is because at the time the XML is being evaluated, the Event class has not been established because one file is in my main project while the other is in my Content project (being a XNA 4.0 project and such).

I have also tried changing the build action of the xml file from compile to content; however the program would then not be able to find the file and would give this other warning:

Project item 'Event1.xml' was not built with the XNA Framework Content Pipeline. Set its Build Action property to Compile to build it.

Any suggestions are appreciated. Thanks.

sentences:
draw two models changing the MVP matrix (android opengl) I'm newbie with opengl2 in android, and I'm making an app in which I'm testing some things. Now I was trying to duplicate a sphere object with a texture, so I thought it was enough to change my MVP matrix applying a small translation to the Model matrix, using same View Matrix and same projection matrix.

int[] numIndices = balon.getNumIndices();
ShortBuffer[] indices = balon.getIndices();

GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mMVPMatrix, 0);
for (int j = 0; j < numIndices.length; j++) {
    GLES20.glDrawElements(GLES20.GL_TRIANGLES,
            numIndices[j], GLES20.GL_UNSIGNED_SHORT,
            indices[j]);
}

GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mMVPMatrix2, 0);
for (int j = 0; j < numIndices.length; j++) {
    GLES20.glDrawElements(GLES20.GL_TRIANGLES,
            numIndices[j], GLES20.GL_UNSIGNED_SHORT,
            indices[j]);
}

balon is an object of type Sphere. mMVPMatrix and mMVPMatrix2 are the MVP matrices I was talking about. I simply changed the MVP matrix and did the drawing again. The result is that I have the two spheres, but one of them is behaving strangely, appears distorted, the position in which appears is right, the two spheres move along, but one of them changes it's shape.

What I'm missing?, I guess I have to duplicate some things in my code before I do this, but what?, thought that being the same model, this was enough...

This is how I changed the MVP matrix:

Matrix.setIdentityM(mModelMatrix, 0);
Matrix.setIdentityM(mModelMatrix2, 0);
Matrix.translateM(mModelMatrix, 0, posX, posY, posZ);
Matrix.translateM(mModelMatrix2, 0, posX+0.5f, posY+0.5f, posZ);

Matrix.multiplyMM(mMVPMatrix, 0, mViewMatrix, 0, mModelMatrix, 0);
Matrix.multiplyMM(mMVPMatrix2, 0, mViewMatrix, 0, mModelMatrix2, 0);
Matrix.multiplyMM(mMVPMatrix, 0, mProjectionMatrix, 0, mMVPMatrix, 0);
Matrix.multiplyMM(mMVPMatrix2, 0, mProjectionMatrix, 0, mMVPMatrix2, 0);

sentences: Which Swing control should I use to render graphics with? I'm using the Swing UI toolkit in Java, and I want to use the Graphics class to draw images and grids in a control. Which is the most appropriate control for this?

sentences:
In UE4, how do I turn my character's body together with the camera? I made a simple punch animation in Blender and exported it into Unreal Engine 4. In-game, the character appeared from a 3rd-person perspective, but I made it look like first-person by adjusting the camera.

Now, whenever I turn the camera in-game, I can look around at different parts of the character's body. (For example, if I turn right I can see shoulder of my character, and if I am facing the front I can see just the wrists.) Whenever I turn the camera and run the punch animation, it looks weird because the character model isn't aligned with the camera.

How can I make the body turn together with the camera, so my animation looks right?

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:
Importing a windows project into android using cocos2d-x What I am trying to do today is to import a full project to Android, but no tutorials are available for that that I have seen. My approach was to create a new android project, copy all the classes and resources in the folders and calling ./build_native.sh but I get an error because most of the files are not being included in the project. I tried opening the Android.mk and I can see why "LOCAL_SRC_FILES := AppDelegate.cpp \ HelloWorldScene.cpp" are the only files linked.

Should I manually modify the make file or can it be automated by some way I don't know?

Thank you.

UPDATE:

I manually added all files and headers to the make file and I get errors linking Box2D or cocosdenshion libraries.

sentences:
Creating 2d array in gamemaker from code According to GameMaker2 arrays documentation, GML has 2d arrays. At the same time I could not find any references how can I create 2d array from code. I tried doing

board = array_create(global.MAX_HEIGHT);
for(var i = 0; i < global.MAX_HEIGHT; i++){
    board[i] = array_create(global.MAX_WIDTH);
}

but that seems to have created a 1d array of 1d arrays, meaning I cannot access them using board[x, y] (if I try it doesn't assign values properly) , or even board[x][y] (compilation error). Is there a way to dynamically create 2d array? Or to access this array more elegantly, instead of having to use

inside_array = board[i];
inside_array[j] = value;

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

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

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

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

sentences:
OpenGL not rendering textures i'm using OpenGL 2.1 with SDL2.0 and i'm trying to render a texture, using this steps:
load the image:

    Image* image = new Image();

image->image = SDL_LoadBMP(path.c_str());

if (!image->image)
    throw std::runtime_error(SDL_GetError());

return image;

and then generate a texture for it:

Texture2D* Texture2D::fromImage(const Image* image){
GLint format;
Texture2D* t2d = new Texture2D();

glGenTextures(1, &t2d->tid);
glBindTexture(GL_TEXTURE_2D, t2d->tid);
t2d->size.setWidth(image->getWidth());
t2d->size.setHeigth(image->getHeight());

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

switch (image->getBPP()){
case 24:
    format = GL_RGB;
    break;
case 32:
    format = GL_RGBA;
    break;
default:
    throw std::runtime_error("Unsurpoted pixel format!");
    break;
}

glTexImage2D(GL_TEXTURE_2D, 0, format, image->getWidth(), image->getHeight(), 0, format, GL_UNSIGNED_BYTE, image->getPixels());

return t2d;
}

and then i try to render it:

void Painter::drawTexture(Texture2D* texture, const SizeF& size, const PointF& position){
camera.set(camera.getWidth(), camera.getHeight());

texture->bind();//only call glBindTexture(GL_TEXTURE_2D, tid);

glBegin(GL_QUADS);
glColor4f(color.getR(), color.getG(), color.getB(), color.getA());
glTexCoord2f(0.0f, 1.0f);
glVertex2f(position.getX(), position.getY());
glTexCoord2f(1.0f, 1.0f);
glVertex2f(position.getX() + size.getWidth(), position.getY());
glTexCoord2f(1.0f, 0.0f);
glVertex2f(position.getX() + size.getWidth(), position.getY() + size.getHeight());
glTexCoord2f(0.0f, 0.0f);
glVertex2f(position.getX(), position.getY() + size.getHeight());
glEnd();
}

but all i got is box with the defined color, i don't understand why, i have already followed this steps before to render a texture, but this time it is not working, i'm not using glEnable(GL_TEXTURE_2D) because i read that this is not necessary, but when i do call it i got the error code 1282, but i got no errors on the textures creation, can someone give me some light here? thanks

sentences:
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 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:
Explaining Unity Sprite-Default Shader I would like to know why we would use alpha blending in that shader for just rendering a sprite, which is just a texture ?
What is tint color ?
Why we multiply the alpha value by the color here ?

fixed4 c = tex2D(_MainTex, IN.texcoord) * IN.color; // why ?
c.rgb *= c.a; // why ?
Shader "Sprites/Default"
{
    Properties
    {
        [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
        _Color ("Tint", Color) = (1,1,1,1)
        [MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
    }

    SubShader
    {
        Tags
        {
            "Queue"="Transparent"
            "IgnoreProjector"="True"
            "RenderType"="Transparent"
            "PreviewType"="Plane"
            "CanUseSpriteAtlas"="True"
        }

        Cull Off
        Lighting Off
        ZWrite Off
        Fog { Mode Off }
        Blend One OneMinusSrcAlpha

        Pass
        {
        CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #pragma multi_compile DUMMY PIXELSNAP_ON
            #include "UnityCG.cginc"

            struct appdata_t
            {
                float4 vertex   : POSITION;
                float4 color    : COLOR;
                float2 texcoord : TEXCOORD0;
            };

            struct v2f
            {
                float4 vertex   : SV_POSITION;
                fixed4 color    : COLOR;
                half2 texcoord  : TEXCOORD0;
            };

            fixed4 _Color;

            v2f vert(appdata_t IN)
            {
                v2f OUT;
                OUT.vertex = mul(UNITY_MATRIX_MVP, IN.vertex);
                OUT.texcoord = IN.texcoord;
                OUT.color = IN.color * _Color;
                #ifdef PIXELSNAP_ON
                OUT.vertex = UnityPixelSnap (OUT.vertex);
                #endif

                return OUT;
            }

            sampler2D _MainTex;

            fixed4 frag(v2f IN) : SV_Target
            {
                fixed4 c = tex2D(_MainTex, IN.texcoord) * IN.color;
                c.rgb *= c.a;
                return c;
            }
        ENDCG
        }
    }
}

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:
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:
Open World Object Management I'm currently creating a system that essentially creates a world at run-time based on a seed I choose. In this system, I made it so that there are certain "chunks" that divide up different sections of the world, and in these sections, I have different meshes that are completely unique to that chunk. Each chunk is also divided into 4 subchunks, which are exactly half the width and height of it's chunk.

The purpose of the chunks and subchunks is so as the player, you could walk around the level, with the current chunk, as well as the adjacent chunks stored into memory with their meshes, and those adjacent chunks, which cannot be seem from where the player is, are loaded, however their meshes are not currently loaded, and as the player moves, the system will load and unload these chunks meshes into memory, that way only the meshes needed to render are loaded in at this time.

The problem that I'm having is when I move from one chunk to another, and load the new chunks meshes, and unload the unnecessary chunks meshes, there's a lag spike that only lasts for about half a second. (But it quite noticable) The spike IS NOT coming from the loading and unloading of the mesh, (my memory manager is fast with allocation and deallocation and the loading and unloading are handled on a separate thread) the problem is when I go to change the memory inside the vertex and index buffers. (Which whenever there is a swap, adds AND removes 4 times each during one game loop.

Does anyone have any idea on how I should handle my open world objects? A good reference would be something along the lines of Skyrim or World of Warcraft; They have the large terrain in these worlds and they are most definitely not 100% loaded in the game at once, so how would I go about making it that so as you progress through the world, objects are handled with little to no skip?

Thanks a lot for the help in advance, and if there is clarification needed, simply ask.

Edit: Added code showing my AddVerts function, which is used to pass vertex data to the GPU.

// unsigned int* AddVerts(const VertexFormat *pVerts, const unsigned int nNumVerts)
// returns  :   unsigned int*           offset in buffer to where the mesh is located
// ins      :   const VertexFormat*     vertices to pass on to the GPU
//              const unsigned int      number of vertices allocated for the const VertexFormat*
void *buffer = nullptr;
unsigned int nSize = nNumVerts*sizeof(VertexFormat);

if( ( m_unBufferFlags & D3DUSAGE_DYNAMIC ) != 0 )
    m_pVertexBuffer->Lock(nVertLocation*sizeof(VertexFormat), nSize, &buffer, D3DLOCK_NOOVERWRITE);
else
    m_pVertexBuffer->Lock(nVertLocation*sizeof(VertexFormat), nSize, &buffer, 0);

// copy data to buffer
memcpy(buffer, pVerts, nNumVerts*sizeof(VertexFormat));
m_pVertexBuffer->Unlock();

m_dllOffsets.addTail(nVertLocation);

return &(m_dllOffsets.GetTail()->element);

sentences:
Unity3D behaves differently in scene and game view We are having AI being able to shoot. Everything works fine when having them play in Scene view, but when going into Game view the position they are shooting from is different.

Does anyone know what could cause this? That the Unity "Scene view" behaves other than "Game view"?

Hope there's anyone there to help us out, thanks in advance.

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:
Interrupt on behaviour tree I'm using a custom Behaviour Tree library (not UDK or any other engine) so I'm wondering on the best way to cause an interrupt to a currently running node. I don't have decorators or parallel nodes in this library so looking for a different way to do it. I don't care about the specific reasons as to why the interrupt is needed. In general it just needs to tell the currently running node to stop running so the tree can be transversed again and that would find out the reason as the main "threats" would be checked.

I'm trying to think of a clean way to cause such interrupts in the tree. Generally the conditions that are already in the tree would be the reason for the interrupt (IsEnemyInRange,  IsThirsty, IsHungry, etc) but if a node is running over multiple frames these don't get checked.

Any ideas given the above limitations I listed?

sentences:
In an Entity-Component System, how to represent the world/level/gameboard? I am trying to learn more about Entity-Component Systems, and something that kinda stuck out at me was the question of how to represent the world in such a system? More specifically, I'm trying to do a version of Tetris with such a system, and I was wondering how I would put the board, and the fallen pieces in place?

I was thinking of having each piece be an Entity, and it would store a number of Block Components, which would represent the individual blocks that make up the pieces, and it's relative position to the center of the piece. Would it be a good idea to simply transfer this component to some Board Entity, which would hold many of these components in the board?

sentences:
How to pick zoomed objects in an isometric game? I´m currently working on an isometric game engine and right now I'm looking for help concerning my zoom function.

On my tilemap there are several objects, some of them are selectable. When a house (texture size 128 x 256) is placed on the map I create an array containing all pixels (= 32768 pixels). Therefore each pixel has an alpha value; I check if the alpha value is bigger than 200 so it seems to be a pixel which belongs to the building. So if the mouse cursor is on this pixel the building will be selected -> PixelCollision.

Now I've already implemented my zooming function which works quite well. I use a scale variable which will change my calculation on drawing all map items.

What I'm looking for right now is a precise way to find out if a zoomed out/in house is selected. My formula works for values like 0.5 (zoomed out) or 2 (zoomed in) but not for values in between.

Here is the code I use for the pixel index:

var pixelIndex = (int)(((yPos / (Scale * Scale)) * width) + (xPos / Scale) + 1);

Example:

Let´s assume my mouse is over pixel coordinate (38, 222) on the original house texture. Using the code above we get the following pixel index:

var pixelIndex = ((222 / (1 * 1)) * 128) + (38 / 1) + 1;
               = (222 * 128) + 39
               = 28416 + 39
               = 28455

If we now zoom out to scale 0.5, the texture size will change to 64 x 128 and the amount of pixels will decrease from 32768 to 8192. Of course also our mouse coordinate changes by the scale to (19, 111). The formula makes it easy to calculate the original pixelIndex using our new coordinates:

var pixelIndex = ((111 / (0.5 * 0.5)) * 64) + (19 / 0.5) + 1;
               = (444 * 64) + 39
               = 28416 + 39
               = 28455

But now comes the problem. If I zoom out just to scale 0.75 it does not work any more. The pixel amount changes from 32768 to 18432 pixels since texture size is 96 x 192. Mouse coordinate is transformed to point (28, 166). The formula gives me a wrong pixelIndex.

var pixelIndex = ((166 / (0.75 * 0.75)) * 96) + (28 / 0.75) + 1;
               = (295.11 * 96) + 38.33
               = 28330.66 + 38.33
               = 28369

Does anyone have a clue what's wrong in my code? Must be the first part (28330.66) which causes the calculation problem.

sentences:
Unity Event Register / Deregister and Scene Unload From what I understand in C#, normally when you register an event, it maintains a reference to the object of the containing method, so in order for garbage collection to pick up an object, you need to first deregister it.
My question:  In unity when one scene is loaded and another is unloaded, do I need to first clean up and deregister any registered events, or does the scene unload process destroy objects and remaining references?

sentences:
How 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:
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:
Rendering hundreds of animated characters in Unity3D I am currently doing some research in anticipation to the development of a game where there is going to be hundreds of secondary entities which will interact with the player and among themselves (little soldiers with a very simple AI and not too many faces).

What I've found so far is that there is a way of avoiding the GameObject overhead, at least for the rendering bit of things, by using the Graphics class, with the Drawmesh method more specifically.

I've tested it and it's not too complicated. I could render any of my models using it and then make them move by rendering the graphics around coordinates in some non-unity "Character" object. The fact that the drawmesh call has to be every frame is actually quite convenient in this case !

However, I've ran into a problem : how do I deal with animated objects ?
Now, I've also done some research on that, and what I've found is that you can "Bake" the skinned mesh into a mesh usable with Graphics.Drawmesh. Then I thought about rendering animated far away characters by updating their mesh with their current animation at a certain interval. This would make the character look wierd but at long distances and among many others it should render quite well.

But the thing is, since I don't want to create a GameObject for each entity, or more precisely only for the ones up close that need a collider and everything so the players can target them with a raycast. And I sure as hell don't want to create a skinned mesh renderer for each far-away character, as it would defeat the point of using Graphics.Drawmesh.

I've thought about one solution to this problem : I could have one "hidden" GameObject with the proper models and animations get requests from "Optimized", meaning far-away character to set himself to a certain frame of a certain animation, bake his mesh and send it back to whoever requested it. I did not run any tests with that solution (I came up with it while writing this) but I'm kinda afraid that updating the mesh of a single entity potentially hundreds of times per frame might lead to wierd behaviors. Besides, I'd have to put it far away so that it doesn't get found by the players.

So, my exact question is : Do you have any better idea as to how I could optimize rendering all those characters some other way, and if not, is there a way to ask Unity "what would this mesh look like on this frame of this animation", thus allowing me to avoid creating a Gameobject just for that.

Thanks a lot in advance !
Cheers !

sentences:
Managing animations for object state transitions I'm looking for an optimized way to handle simple state transitions on my game objects. By "simple" I mean not more than 1-2 actions per object, and most algorithms are linear.

For example, I have an UI element that implements a switch (like a light switch) and it has two states - "up" (lights turned on) and "down" (lights turned off). Let's say I want to make it so that I can switch the switch from one state to another, and update its presentation in a smooth way using linear interpolation (move the foreground sprite up or down).

The question is if I should always check if the object should update its state (every frame), or should I add/remove this object from the update loop on demand, or is there any other (better) way of handling this situation?

Currently I have it implemented the following way: my object has a boolean variable called animated and in my onframe loop I have the following code:

if (this.animated)
    /* calculate new positions for the sprite */
else
    /* do nothing */`

And it would appear to me that this kind of code is not very well optimized. How to handle this kind of things better?

sentences:
Moving bounding box in 3D using libGDX How do I go about moving a bounding box in libGDX?

I want to make the bounding box capture my character and move with him.

So ideally I want to be able to copy my vector 3 from my model instance and set it on the bounding box.

There doesn't seem to be any method like setToTranslation() on the BoundingBox class. How am I supposed to do it?

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:
How to decelerate Ship using Vector Objects in Java I am developing an Asteroids type game in Java, using a custom Vector2D class for the Ship. I have a vector object for its position, direction and velocity. I am having an issue with the ship deceleration, currently when there is no thrust (forward key is released) then I multiply my velocity vector by the Drag constant which is 0.3. However the ships speed does not decelerate and will stop abruptly instead, upon releasing the thrust key.

Here is the update method in my Ship Class:

public void update() {
    velocity = new Vector2D(direction);

    if(ctrl.action().turn > 0) {
        direction.rotate(ctrl.action().turn / STEER_RATE);
    }
    else if(ctrl.action().turn < 0){
        direction.rotate(ctrl.action().turn / STEER_RATE);
    }

    //Acceleration
    if(ctrl.action().thrust == 1) {
        velocity.addScaled(direction, DT).mult(MAG_ACC);
    }
    //Deceleration
    else if(ctrl.action().thrust == 0){
        velocity.mult(DRAG);
    }
    position.addScaled(velocity, DT);
    position.wrap(FRAME_WIDTH, FRAME_HEIGHT);
}

Contructor:

public Ship (Controller ctrl) {
    centerX = FRAME_WIDTH/2.0;
    centerY = FRAME_HEIGHT/2.0;
    this.ctrl = ctrl;
    position = new Vector2D(centerX, centerY);
    direction = new Vector2D(position).normalise();
    velocity = new Vector2D(direction);
}

I'd like to ask how I can slow the ship velocity rather than it losing all of its speed instantly. If more code is required I am happy to show it.

sentences: Running a scene in the background I've made 2 scenes where a room is another scene and the other is the outside of it. But whenever I do something in either scenes, and enter the other, it resets everything I did in the first one. I'm thinking of making the scene running in the background the whole time but how can I do that?

sentences:
Scaling surface changes colors I'm building a pixel art game with pygame, and I'd like to scale it to double the size. I have tried the pygame.transform methods like scale and scale2x, but they seem to alter the colors quite badly, there's an added red hue. Is there a way to scale pixel art correctly in pygame? Basically making each pixel 2x2 of the same color. Or do I have to do it manually, if yes, any suggestions?

This is the setup I have currently, "works" but messes up the colors:

#set scaling
scaling = 1

screen = pygame.Surface( (screen_w, screen_h) )
window = pygame.display.set_mode( (screen_w * scaling, screen_h * scaling) )

while not done:

    #do things...

    pygame.transform.scale(screen, (screen_w * scaling, screen_h * scaling), window)
    pygame.display.update()

E. for reference, here's what happens.

No pygame scaling

vs. pygame scaling

sentences:
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:
Texture Editing with Multi-Threading So I have this giant Texture2D (4096 * 4096, don't ask why) and all its data stored in an array of Colors. When I hit left MouseButton I create a blue 64 by 64 square at the cursor's position using the following code.

        int dx = Mouse.GetState().X + (int)camera.Pos.X - graphics.PreferredBackBufferWidth / 2;
        int dy = Mouse.GetState().Y + (int)camera.Pos.Y - graphics.PreferredBackBufferHeight / 2;

        for (int x = dx; x < dx + 64; x++)
        {
            for (int y = dy; y < dy + 64; y++)
            {
                textureData[x + y * texture.Width] = Color.Blue;
            }
        }

        texture.SetData<Color>(lvlData);

Sadly this hangs the program for a split second. So I thought, maybe it's possible to run that piece of code in a different thread.

Is it possible to multi-thread that and if so, how would I go about doing that? Or is it another way to optimize this?

Thanks for any help!

sentences:
Switching from software Engineer to Game developer I don't know if this is the right place to ask this.

I've been working as a software engineer for 3.5 years so far, mostly web apps, mobile apps, web pages in banking systems, educational, etc but I always wanted to work as a game developer.

Currently I have a university degree in CS, and I'm attending a masters degree in Apps design.

I've very little experience in game dev (only for hobby), some space shooters and some steps in unity, also I took some courses of blender, and did some simple sprites (those 8 bit characters but animate them is a big problem for me atm.) but I've never gone too far.

I know I cannot focus on all aspects of game development, because it is a huge world integrated with different disciplines, but I need to make a portfolio with some of my games at least. (I only have partial prototypes, some of them work, some don't...)

I need some advise of people who are in the game business.

Which platform/framework do you recommend for me ? I already know a bit of Unity and I feel pretty comfortable with it. I can get some assets to work with (models/audio, etc), there are some free material in the store, and I have budget to spend on that too if necessary.
How do game companies hire people? What am I suppose to aim for a job? I mean this is a world full of disciplines and I need to focus in something particular I guess, I'm a senior frontend developer too, so I guess I should focus on coding. I think portfolio is the best way of showing your work.

Any suggestions are welcome! thanks!

sentences:
Following a path in a smooth fashion I am currently making a 2d tower defense game with a static, predetermined lane that the enemies follow (i.e. towers cannot block the path and path finding is not the problem I am trying to solve).

I am trying to figure how exactly to make units follow this lane in a smooth way. I have two rough ideas about how to do this, but I would love some input on which is likely to be easier to implement/the more standard technique. Or of course if I there is some totally different way that I haven't considered I would love to learn about that as well.

Waypoints:
My first idea was to define the path as a series of hard coded waypoints. Units would then use a basic "seek" steering algorithm (such as this one) to move to each waypoint along the path in succession. However, I have wondered if it might be hard to keep the units from deviating to much from the lane I want them to follow. I wonder if inability to turn sharply enough might cause them to sort of "glide" out off of the desired lane. I suppose I might be able to prevent that though by allowing for a relatively strong steering force to be applied?

Bezier Curves:
The second solution I have considered is to define the path with a bezier curve and at each time step calculate the point along the curve with is (dt * speed) away from the unit's current location. I suspect that this technique would make it much easier to precisely define the path that units will follow, but I don't know know how exactly to go about implementing this. Any suggestions?

Also, I don't this will change anyone's answers, but units also must be able to travel at a constant speed along the path. Additionally, I am programming this game in python using the pyglet framework.

If anything about the question is unclear please let me know.

Edit:
Also for whatever its worth, I'm sort of trying to replicate the movement behavior of enemies in the Kingdom Rush.

sentences:
How can I determine the direction of the balls after collision in billiards game? I'm making a billiard game and I have two questions:

How do I find the velocity of two balls when they collide with each other and how do I apply it to both balls?

I already know the angles that they're gonna move, I just need to find the velocity that they'll move in those directions.

My game is in 3D, and I'm using Unity. I don't want to use Unity's built-in physics to compute the result in this case, I'd like to know how to compute it myself.

sentences:
How do I get an unique hardware id with gdscript? Using Godot Engine, I'm trying to implement digital rights management (DRM) using an uuid, and I want to get the user's MAC address.  Is there an easy way to do this with gdscript?
On Linux, I could call OS.execute to run "ip link show" and parse out mac addresses from the output.  However, I would rather not maintain platform specific versions.  I also hope to avoid having to compile in native code.

sentences:
Do I really need to use a graphics API? Is it necessary to use graphics APIs to get hardware acceleration in a 3D game? To what degree is it possible to free of dependencies to graphics-card APIs like OpenGL, DirectX, CUDA, OpenCL or whatever else?

Can I make my own graphics API or library for my game? Even if it's hard, is it theoretically possible for my 3D application to independently contact the graphics driver and render everything on the GPU?

sentences:
How to make pathfinding agents avoid each other using A* in unity? So far Ive implemented a 2D grid graph using 2D physics. My enemies have a seeker script, AI destination setter (with the player position attached) and a basic AIPath script that is set to 2D
When I press play, my enemy game objects move away from the marked area where they can't go, and the area remains static. Is there a way to make this marked area follow the colliders using A*?
This is the script Im using: https://arongranberg.com/astar/documentation/4_1_16_7f164ebc/aipath.html
I don't have the pro version of the above asset though, so can't make use the built in function that handles situation like this.

sentences:
Game Maker x and y coordinates wrong I'm making a game which the user can use the arrow keys to scroll left and right to view the map.  I had an issue with the health bars of my enemies being drawn way off even though I set them to be drawn at the x and y position of the enemy.

I tried to debug using the following line to draw something at mouse_x and mouse_y:

draw_text(mouse_x, mouse_y, "X");

The X on screen would be at the correct position (the mouse position) when the mouse was at 0, 0, BUT as the mouse was moved farther right or down, the respective x or y offset became bigger and bigger, almost like I said to draw the X at mouse_x * 1.5, mouse_y * 1.5.

I'm using a view (view[0]) to allow the user to scroll through the map, and I thought this might be the source of the issue.  This is the code I used to allow the user to scroll left and right:

if (view_xview[0] < room_width - view_wview[0]){
    view_xview += clamp(room_width - view_xview[0], 0, 10);
}else{
    view_xview[0] = room_width - view_wview[0];
}

The same code was used for moving left, but reversed.

sentences:
Should I initialize a Box2D World per Level? I'm using a LevelManager to load Tiled maps in my libGDX game, which stores:

Static:

final Size of map in Tiles
final Size of map in Pixels
final Size of an individual tile
TiledMap ACTIVE_MAP
World WORLD

When the map is loaded, it creates a new World and stores it in the static WORLD, later populating it with static bodies based on objects found in the map's Collision layer.

My reasoning for using static is down to the fact that logically, only one map will be playable at any one time, however I've got it in my head that only constants and singletons should be static, so this feels strange for me. Is there a better, more efficient way of handling this?

Should I have one World per Level, or a global World independent of what TiledMap is active?

In other words, should I initialize WORLD once and leave it as is, making it final, or continue what I am doing and initialize it as a new World whenever a new TiledMap is loaded?

How do I correctly dispose of all bodies within the World, essentially clearing it?

I'm going to have to do this every time I load a new map, regardless of whether or not WORLD is global.

sentences:
Matrix transformation I have to find components of a matrix for 3D transformation. I have a first system in which transformations are made by multiplying:
M1 = Scale x Rotation x Translation.
I want to have the same transformations in an engine who compute like this:
M2 = Scale x Translation x Rotation
So when I enter the same values there's a problem du to the inversion of translation and rotation.

How can I compute the values in the last matrix M2 for having the same transformation?

Thanks

sentences: How to detect collision position and that position's texture color in Unity? I have a prefab and I use Circlecollider2D for physics operations. I want to detect the color of the contact position of the collided objects ? Is is possible by using Unity's collider classes ?

sentences:
How to disable collider2D when another gameobject is on top of it Each black colored square has a BoxCollider2D. How can I disable the collider after I put another game object on top of it?

Here is the sample output:

sentences:
Cellbased maps explanation? I've been trying to understand cellbased maps and how they work, i have googled alot but can't seem to find any explanation for it.

With cell based maps i mean the ones where you do height and everything like walls roof floor in each cell.
If possible i would appreciate an explanation from a Javascript perspective, but only a theoretical explanation can do.

So why do we use them? how do they work?
Is it just like a normal array with more information?

sentences:
Converting double "perlin noise" value to a set of colors I've been working all day at learning perlin and other methods for generating terrain. I have a 2d top-down game and I need to generate random regions of connected colors. I've been playing with existing implementations - some worked very well, some didn't. My main problem was that several implementations were very inconsistent and were not returning the same noise number for a coordinate - something that's important to me.

I finally landed on an implementation of Simplex I like, and with all of my tests it's generating the same noise value for every coordinate properly.

However, the noise values are doubles with unknown ranges, for example:

x:1525 y:1125 Noise: 0.0
x:1525 y:1150 Noise: 0.2764424964813472
x:1525 y:1175 Noise: 0.02497111685822111
x:1525 y:1200 Noise: 0.22943575651784293
x:1525 y:1225 Noise: -0.498659492513381
x:1525 y:1250 Noise: -0.9257368870408553
x:1525 y:1275 Noise: 0.2976243577485172

I have a list of a dozen initial tile colors and am stumped as to best way to ensure that I can safely choose a color from the range based on the noise value.

Secondary question if possible - if anyone knows how I can change the above class to compute the noise values by using a seed (to eventually allow people to generate specific maps with known seeds)

sentences:
How to correctly setup latest LWJGL libraries to Eclipse? A year ago, I understood how to setup an LWJGL project in Eclipse IDE.
Now LWJGL has a lot of changes including a different file structure.
I downloaded the latest release, LWJGL 3.1.0 Build 40 from the official site.

There's also a page explaining how to get started, but it does not help me to set it up in Eclipse.
When I extract the downloaded .zip file, I only get .jar files (and .txt licences).
I see nowadays there are no .dll natives for a specific operating system.

Instead of that, I see jars like lwjgl-glfw-natives-windows.jar. I expect these are now the files that were previously .dll files.

Can someone explain to me how to set it all up correctly?

sentences:
Is it bad to store other memory in a system, alongside the components buffer using an Entity-Component-System architecture (ECS)? I'm currently writing a simple ECS architecture for an engine and I have the fundamentals in place but after reading up on this architecture, it is designed in such a way that the memory is contiguous for all of the components and systems.

My understanding is that the components should be stored right after each other so they are not somewhat fragmented in memory? So that way when I update all of the components, the cache prefetcher can help out performance by fetching the next lot of components (limited understanding) without jumping around.

class system1 final
{
public:
        //...

private:
    std::vector<component1>         m_components;
};

class system2 final
{
public:
        //...

private:
    std::vector<component2>         m_components;
};

Then in some manager, you would initialize the systems so that they are as close as possible in memory.

But what if I wanted to allocate additional memory in the systems? Like a few extra buffers for dealing with system-specific information. That would then separate the component buffers so they are no longer next to each other.

class system1 final
{
public:
        //...

private:
    std::vector<component1>         m_components;
    std::vector<int>                m_somebuffer;
    std::vector<int>                m_someOtherBuffer;
};

class system2 final
{
public:
        //...

private:
    std::vector<component2>         m_components;
};

Would this cause any problems and does this break the whole ECS
principle?
What should I be considering here for maximum performance without stumbling on issues later?

I don't want to optimize prematurely but knowing what makes an architecture fast and somewhat optimal during development is an interesting topic for me. Any input is greatly appreciated.

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:
Is frustum culling necessary in a Flash/AS3 game? I'm making a 2D game where the map will be scrolled frequently, and only a small part of it will be visible at any time.

Which implementation would run faster?

The naive way: Make the map a single
huge MovieClip and move it around.
The elegant way: Split the map into
multiple chunks and use a frustum
culling algorithm to render only the
ones that are visible.

Now that I think of it, this question boils down to whether Flash does its own frustum culling on big MovieClips.

sentences:
How to access arrays of prefabs and other properties through the inspector in a given hierarchy The script below is added to an empty game object WeaponGroup, which can be populated using the editor. I have made a new game object WeaponGroups which should have a script SetupWeaponGroupsScript. How can I transfer the properties below so that each WeaponGroup (SetupWeaponGroupsScript will have an array of WeaponGroup objects) is setup in a way similar to what is done below, so that I make the SetupWeaponsScript properties hidden to the inspector and populate them through SetupWeaponGroupsScript?

public class SetupWeaponsScript {

// Here's our tuple combining a weapon prefab and a direction.
[System.Serializable]
public struct DirectedWeapon {
    public WeaponScript weapon;
    public WeaponScript.Direction direction;
}

// The prefabs array is now this tuple type.
public DirectedWeapon[] weaponPrefabs;
public WeaponScript[] weapons;

void Start ()
{
    weapons = new WeaponScript[weaponPrefabs.Length];

    for (int i = 0; i < weaponPrefabs.Length; i++)
    {
        // Using typed Instantiate to save a GetComponent call.
        weapons[i] = Instantiate<WeaponScript>(weaponPrefabs[i].weapon);
        weapons[i].weaponDir = weaponPrefabs[i].direction;
    }
}
}

In other words I'd like to have the following hierarchy in the editor:

sentences: How to edit specific mipmap images in a DDS? I am looking for a way to edit individual mipmaps within a DDS file. To my knowledge, the NVidia Plugin only lets you create the largest image and then computes the smaller ones automatically. However, the problem is that after long tests with the different available algorithms and sharpening strengths I still think that at least the 2nd and 3rd of the smaller mips could look better if created manually. Is there a way to do so?

sentences:
How can i create sprite sheet from 3d model (3D studio max) I built simple 3D model of a car, with simple animation in which it's wheels are turning.

Now i want to create a sprite sheet, the only way i know how to do it, is to render manually 20 frames from the from, then combine them to a strip manually, then rotate it by 10 degrees, render 20 frames of animation again and combine them to a strip...

Is there a way to do it automatically ?
With out rotating the scene manually and render it and combining .. it's a lot of work, takes more time then the modelling itself...

Thanks

sentences:
Unity: Increase animation speed of individual component in a blend tree? I have blend tree with four different turns: a sprinting turn, running turn, walking turn, and standing turn.

I need to somehow make the angular velocity increase from sprinting down to standing, so that as the character gets slower he turns faster (otherwise it is basically unplayable).

How do I increase the angular velocity of an individual animation in the blend tree?  The usual "speed" attribute disappears when I put the animation in the blend tree...and I have not figured out how to access the blend tree substate from code yet.

Here is an image of the blend tree, and the inspector:

sentences:
SerializedPropertyBindings NullReferenceException Using:

Unity 4.6.1 Pro

Visual Studio 2013 Pro, c#

Team Foundation Connected to git vc

Windows 7 Premium

Building 2D iOS app (2D set up)

Details:

Periodically, this error is occurring. There is no pattern to invoke this error so far.

I then found this on the official Unity forums: Strange error showing up

But, I would like to avoid creating an entirely new project and re-importing everything, since it is getting to become a slightly large project. I do remember deleting an asset out of the file directory(not in unity), on accident, so this may be the issue. Is there any way to clean/wipe/fix this issue, w/o doing a fresh project and import?

I appreciate the guidance.

sentences:
"Painting" elements in html5 canvas I'm making a game in coffeescript (although for the sake of this problem that's probably not all that relevant) and html5's canvas. It's a game that involves a paint cannon, that fires circular particles of paint that can paint elements of the level and the player. The problem is I'm not sure how to accomplish the painting. The diagram below illustrates what I'm trying to accomplish:

Using canvas, the particles are drawn using context.arc(), the players using drawRect.arc() and the floor can be an arbitrary polygon with drawing code as follows:

    @drawingContext.beginPath();

    tV = b2Math.AddVV(pos, b2Math.MulMV(body.GetTransform().R, @vertices[0]))
    @drawingContext.moveTo(tV.x, tV.y)
    for i in [1..@vertices.length - 1]
        v = b2Math.AddVV(pos, b2Math.MulMV(body.GetTransform().R, @vertices[i]))

        @drawingContext.lineTo(v.x, v.y)
    @drawingContext.lineTo(tV.x, tV.y)

    @drawingContext.closePath()
    @drawingContext.stroke()
    @drawingContext.fill()

It would be too intensive to keep track of all the circles that should be painted on to objects and would soon bog down, with potentially 60 clipped circles per second being added to be drawn on top of objects.

The original thought was to stack two canvases on top of each other, so then we could draw the levels once and then when ever necessary just draw the paint splat over them once and forget about it (changing the composition mode to source-atop to get appropriate clipping), and since we're not redrawing it would stay there. However, this won't work on moving objects (like players) (that can also rotate and change size relative to the camera). I'm not sure how to do it, since all objects are made up of solid colour to start with there's no texture data or anything we can modify.

sentences:
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:
Making a player move to my mouse when clicked? How can I get my player to move to the mouse when it is clicked (like in Warcraft)?

So far I have tried:

if (Mouse.isButtonDown(0)) {

    if (X < Mouse.getX()) {
        X += Speed;
    }
    if (X > Mouse.getX()) {
        X -= Speed;
    }
    if (Y < Mouse.getY()) {
        Y += Speed;
    }
    if (Y > Mouse.getY()) {
        Y -= Speed;
    }
}

But that only does what I want if I hold the mouse down.

sentences:
Libgdx Texture change I have been working for several days to try and figure out how to change a texture whenever a scene2d Table is clicked in libgdx, I am using pixmaps to dynamically change the textures colors instead of changing the texture completely.

everything works fine when i detect key presses so whenever i press 1 the color of the players hair changes to a random color but now i want it to happen when i press a Table.

to change the texture i use this method

public static Texture genDynamicTexture(String path, HashMap<String,Color> colors) {

    //load texture from asset handler
    Texture texture = GameUtils.getGame().manager.get(path,Texture.class);

    //create pixmap from texture
    if(!texture.getTextureData().isPrepared()) {
        texture.getTextureData().prepare();
    }
    //transfer pixel data from gpu to cpu
    Pixmap pixmap = texture.getTextureData().consumePixmap();

    //grey-scale colors
    Color gsHair = toColor(207,31,201);
    Color gsSkin = toColor(207,97,31);
    Color gsShirt1 = toColor(39,207,31);
    Color gsShirt2 = toColor(65,65,160);
    Color gsPants = toColor(90,9,22);
    Color gsShoe1 = toColor(253,255,66);
    Color gsShoe2 = toColor(43,58,50);
    Color black = toColor(0,0,0);

    //loop through pixels in the pixmap
    for(int x = 0; x < pixmap.getWidth(); x++) {
        for(int y = 0; y < pixmap.getHeight(); y++) {
            int pixelColor = pixmap.getPixel(x, y);
            if(pixelColor != 0 && pixelColor != Color.rgba8888(black)) {
                if(pixelColor == Color.rgba8888(gsHair)) {
                    pixmap.setColor(colors.get("hair"));
                    pixmap.drawPixel(x, y);
                }else if(pixelColor == Color.rgba8888(gsSkin)) {
                    pixmap.setColor(colors.get("skin"));
                    pixmap.drawPixel(x, y);
                }else if(pixelColor == Color.rgba8888(gsShirt1)) {
                    pixmap.setColor(colors.get("shirt1"));
                    pixmap.drawPixel(x, y);
                }else if(pixelColor == Color.rgba8888(gsShirt2)) {
                    pixmap.setColor(colors.get("shirt2"));
                    pixmap.drawPixel(x, y);
                }else if(pixelColor == Color.rgba8888(gsPants)) {
                    pixmap.setColor(colors.get("pants"));
                    pixmap.drawPixel(x, y);
                }else if(pixelColor == Color.rgba8888(gsShoe1)) {
                    pixmap.setColor(colors.get("shoe1"));
                    pixmap.drawPixel(x, y);
                }else if(pixelColor == Color.rgba8888(gsShoe2)) {
                    pixmap.setColor(colors.get("shoe2"));
                    pixmap.drawPixel(x, y);
                }
            }
        }
    }

    //transfer pixel data from cpu to gpu
    Texture tex = new Texture(pixmap);
    pixmap.dispose();
    texture.dispose();
    return tex;

}

like i said everything works fine if it is a key press but when i detect it using a Table it does not work ( i have already added it to the stage and am calling stage.act() and stage.draw() )

color.addListener(new ClickListener() {
        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            return true;
        }
        @Override
        public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            characterPack.reloadSpriteSheet("Players/greyscale-player.png", 2, 2, characterPack.colors, "skin");
        }
    });

thanks in advance.

sentences:
Prefab can't accept script-created material I am doing mod support for my game. I want users to be able to change materials of any prefab in the game. In order to achieve that, I create a new material from the imported data and then apply it to an existing prefab.
However, it does not work. It works if I try to assign the newly created material to an object on the scene (not a prefab) and it works if I try to assign an existing material to a prefab. However, assigning a new material to a prefab results in this:

I am fairly certain that is exactly the issue since it can be reproduced as easily as with this snippet of code:
GameObject prefab = Resources.Load("Prefabs/Cubes/IceCube") as GameObject;
prefab.GetComponent<MeshRenderer>().sharedMaterial = new Material(Shader.Find("Standard"));

What am I doing wrong? How can that be worked around?

sentences: 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 can I update a sprite sheet without affecting the sprites already being used? Every time I overwrite my sprite sheet with additional or updated sprites, I have to reattach the textures to all of my Animations and Sprite Renderers.  How can I update a sprite sheet without affecting the sprites on that sheet which are already being used?

During the development of even a small game, hundreds of textures are being used.  And new textures are being added and updated every day.  This results in many hours spent reattaching textures which could otherwise be used being productive.  What strategy can I use to prevent this?

This is an example of what I mean:

I have a sprite sheet with 40 textures. All of its sprites are attached to their relative GameObjects. I decide I want to change the color of one of my sprites' hat. I go into gimp and load the sprite sheet. I change the color of the hat. I overwrite the old sprite sheet.

Back in Unity, all of the textures are no longer attached to their respective GameObjects. I go in and splice the sprite sheet again and manually reattach all of the textures. Then I decide I like the old hat better. I go back into gimp, change the sprite sheet, and am then forced to reattach all of the textures...again. There has to be a better way! (Also would like to be capable off adding new sprites in addition to editing old ones.)

sentences:
Multiplayer game servers architecture I'm trying to create MMORPG with huge world divided by chunks. I was thinking a lot about servers architecture. I don't want my main game server to have direct access from clients and I do want to have some abilities for load balancing and for expanding whole system.

Finally I came up with this architecture:

The Game Server - which store game state and trigger events and so on. This server does not communicate with clients. It will be connected to database to store game state from time to time.
Streaming Servers - servers that handle client connections and stream game state to them as far as players actions to server. I suppose them to work through UDP. With this  approach I will have some benefits:

I can put then in different countries to lower pings.
I can have as many then as my budget allows me to. Adding more streaming servers would allow to handle more client online.
if something happens with one of streaming servers (due to hacker attacks or server hardware/software failure) this will not effect whole systems and other players experience. Players from this server can be routed to another.

Physics Servers - they would handle chunk physics and maybe some other heavy stuff. With adding new physics servers I can extend my system so that it would able to proceed more and more data, if needed.

What are the pitfalls of such an architecture? How good is it?

How would clients know to which streaming server they should connect? I suspect that here I should have one more - routing server that would do something like load balancing stuff and route user to one of the working streaming servers.

Would I have some problems with data synchronization?

sentences:
Is using XNA title storage for level/config files a Bad Idea? I've reached the point in development where my Game Engine can actually do stuff, and it's time to start thinking about how to store / load the various bits and pieces where they need to be.

I've decided to go with file storage (rather than a database), which means I'm probably going to be using .xml, .json, or .csv files. The only remaining question is how to actually store them within the game's binaries (so that any players won't be able to edit levels willy nilly).

XNA's Title Storage, being read-only, seemed as good a starting place as any, but when I loaded up the MSDN page, there's this warning on the top:

  This topic describes how to add files to title storage that the game will access through stream I/O. This is the exceptional case, and is not recommended for most XNA Game Studio games. Instead, consider using the Content Pipeline to manage your game data most efficiently.

Emphasis mine.

So is it a bad idea to use Title Storage for level/config files, or is that warning intended to stop people from using it to store things like Texture2Ds and SpriteFonts ?

sentences: Game Maker Studio: How to make Player Circular Movement I want to make a player move in circular but not that he move automatic but manual. Similar like in the game Zero Refelx.

sentences:
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:
Height field/Shallow water eqation water simulation with ground height Hey guys I found a lot of tutorials on 2D height field/swe water simulation but I have yet to find one that takes into account of ground height, i.e.

http://zejiazheng.com/?p=87

The overall water simulation results is fantastic however it does not takes into account of ground height and it doesnt work when the height of water is 0.

Would appreciate help on how to implement that as I've been stuck for several weeks on how to implement it. Thanks!

sentences:
Correcting projection of 360° content onto a sphere - distortion at the poles I'm using the Autopano Giga 4.4 and Autopano Video Pro 2.6 to stitch and create spherical content, but I've recently moved into wanting to create 360° tours via Unity. I know this is partly a developers question, but if anyone out there can help me with the right specs for exporting a spherical image or video from Giga to use to create the image for the inside of the sphere on Unity, I'd appreciate it!

Experimenting with Premiere and FCPX to edit highlight reels of spherical content, I've had seamless experiences created. For some reason in Unity, the images appear to be stretched around the sphere wrong and it's creates issues on the top and bottom of the image:

The image shown is the bottom of the sphere. I'm using the Android platform to hopefully turn these tours into apps when completed. Thank you for any help!

sentences:
Third Person Camera Splines I'm having trouble coming up with a formula/method of creating third person camera with a variable distance from the player given a specific camera pitch.

This image shows something close to my desired result:

I basically only have two requirements. The camera has to be directly calculated from a pitch. The camera should roughly follow a smooth curve between the minimum and maximum camera distance and the halfway point is around 50% of the distance (as seen by the graph in the top right of the image).

So, Option A:

I create a function online to convert a pitch directly to a camera distance and use that. http://www.timotheegroleau.com/Flash/experiments/easing_function_generator.htm

I have this working and it ends up looking close but has two distinct problems. It is rigid and doesn't allow me to edit any of the offsets or distances without having to create a whole new function and the camera at 0 degrees pitch ends up being around 15-30% of the maximum distance which doesn't feel as good as if it were closer to 50%.

Option B:

Come up with a spline, perhaps a cubic bezier, between the min and max distances and somehow project the camera on to that spline given a specific pitch. I'm not sure how I would be able to do this. The disadvantages would be that the camera distance curve would not be as smooth without some tweaking and again it would require more work if any of the distances or offsets change.

Option C:

Come up with a specific formula which I have no idea how to find. Given the min and max camera distances, the offsets, and the camera pitch, return a distance that follows a smooth camera distance curve and a mid point of roughly 50% of the max distance.

So my question is can/how do I accomplish Option B or C? Is there a better way?

sentences: How to use XNA in WPF? How can I render some graphics using XNA to a widget/control in a WPF app? Specifically, I don't need any WPF controls inside the XNA graphics window, I just want to put some controls around it for a level editor.

sentences:
How to rotate sides of rubik's cube by mouse drag? I am trying to make a Rubik's cube simulator. I built the Cube by arranging 27 pieces in appropriate place. I wanna simulate the cube like This.
This is what my cube looks like.

I successfully wrote a simple script to rotate the whole cube while dragging the mouse on background. I was also able to rotate sides with key inputs like U, F etc. For this I created 6 empty game objects (UpLayer, FrontLayer etc.) and positioned them in centre of corresponding sides. I store every piece in an array. Now, when the user presses a key, suppose U, I

Make all 9 pieces of upper layer child of empty game object UperLayer at runtime.
Rotate the UperLayer object around its local y axis 90 degrees.
Make required changes in the array.
Un-parent all the pieces.

It works perfectly for every layer. But now, I wanna rotate the layer when user drags it with mouse (Check the above link). I can't think of any approach to do so. I need help.

sentences:
Can't assign animation to animation variable declared in script Unity2D So I'm trying to have my script pause an animation when the user clicks. Here's what I have so far:

I defined the animation up at the top

public Animation anim;

and then further down,

 void Update () {
        if (Input.GetMouseButtonDown(0))
        {
            anim["myAnimation"].speed = 0.0f;
        }

 }

Code gives no error, however in Unity I have a GameController object to which this script is attached to. The gamecontroller object has a vacant field into which I drop my animation to. The issue is that when I try and drag and drop my animation or try to place it into that field, nothing happens, I keep getting the error down at the bottom saying that "The variable anim of GameController has not been assigned." How do I go about assigning myAnimation to the variable anim?

When I try and drag and drop my animation file to this, nothing happens. This is under the GameController script which I assigned to a GameController object.

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:
How to disable gravity for a RigidBody moving on a slope? I created a script that handles movement for my player (moving around, going down and up slopes). However, since I'm using a RigidBody not a CharacterController when I go up slope and stop on the middle of it the gravity pulls me backward, which is fine, but the problem is when I move forward, the gravity force pulls me backward when I'm trying to go forward. This problem wouldn't have appeared if my character wasn't a sphere but my character is a sphere so it always roll down when gravity is applied to it.

What I want is to somehow stop the gravity for a second or reset it to zero when I move my character, and when I'm going up a slope so it won't hold me back. I tried:

if(grounded) rb.velocity = Vector3.zero;

but I don't think it's the right approach.

sentences:
HLSL: how to get/set effectvariable to an array of structs with Direct3D10 HLSL Code:

//Lights
struct Light
{
    float3 pos;
    float3 dir;
    int type;
} m_aLights[3];

How can I get/set an effectvariable to m_aLights with Direct3D10?

Thanks

sentences:
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:
Filling a 2D polygone with N points more or less equally distanced Following challenge: having any number of connected 2D faces forming virtually a polygone and filling the polygone with a variable number of points equally distanced to each other.

So here is a sample 2D object with any number of faces, all connected to each other, forming virtually a polygone:

Here is what I would like to calculate (in JavaScript or Python or pseudo): a variable number of points inside the faces, equally distanced to each other.

Some notes:

The points distance to each other doesn't need to be 100% the equal.
Prioritized points are at the borders of the faces
I should be able to define the targeted number of points, but it doesn't need to be exactly that number of points, can be more or less.
Any ideas how to approach?

sentences:
Dialogue Audio: Forming sentences using different recordings I am working on a game where the exact dialogue to be spoken out depends on context. The most common use case is for scoring - The game keeps player score and I want the game to tell the player her current score using audio. For example, audio can be - "You've killed 10 enemies", or "You're score just crossed 100!". In both these sentences, the numbers 10 and 100 depend on the current game context.

What I would want to do is record the sentence "You've killed .... enemies", and then also record all the numbers separately, and then form a complete sentence when needed. Are there any solutions which can do this in a way that the dialogue sounds fairly natural?

sentences:
Frequently change TextMeshPro text without garbage allocation? Is there a way to frequently change a timer display created with TMP, without it generating garbage?

I'm currently using TMP.SetText(), which is supposed to not generate garbage, but it does.

sentences:
What's wrong with this turn to face algorithm? I implement a torpedo object that chases a rotating planet. Specifically, it will turn toward the planet each update. Initially my implement was:

void move() {
        vector3<float> to_target = target - get_position();
        to_target.normalize();
        position += (to_target * speed);
}

which works perfectly for torpedo that is a solid sphere. Now my torpedo is actually a model, which has a forward vector, so using this method looks odd because it doesn't actually turn toward but jump toward.
So I revised it a bit to get,

double get_rotation_angle(vector3<float> u, vector3<float> v) const {
    u.normalize();
    v.normalize();
    double cosine_theta = u.dot(v);
    // domain of arccosine is [-1, 1]
    if (cosine_theta > 1) {
        cosine_theta = 1;
    }
    if (cosine_theta < -1) {
        cosine_theta = -1;
    }
    return math3d::to_degree(acos(cosine_theta));
}

vector3<float> get_rotation_axis(vector3<float> u, vector3<float> v) const {
    u.normalize();
    v.normalize();
    // fix linear case
    if (u == v || u == -v) {
        v[0] += 0.05;
        v[1] += 0.0;
        v[2] += 0.05;
        v.normalize();
    }
    vector3<float> axis = u.cross(v);
    return axis.normal();
}

void turn_to_face() {
    vector3<float> to_target = (target - position);
    vector3<float> axis = get_rotation_axis(get_forward(), to_target);
    double angle = get_rotation_angle(get_forward(), to_target);
    double distance = math3d::distance(position, target);
    gl_matrix_mode(GL_MODELVIEW);
        gl_push_matrix(); {
        gl_load_identity();
        gl_translate_f(position.get_x(), position.get_y(), position.get_z());
        gl_rotate_f(angle, axis.get_x(), axis.get_y(), axis.get_z());
        gl_get_float_v(GL_MODELVIEW_MATRIX, OM);
    } gl_pop_matrix();
    move();
}

void move() {
    vector3<float> to_target = target - get_position();
    to_target.normalize();
    position += (get_forward() * speed);
}

The logic is simple, I find the rotation axis by cross product, the angle to rotate by dot product, then turn toward the target position each update. Unfortunately, it looks extremely odds since the rotation happens too fast that it always turns back and forth. The forward vector for torpedo is from the ModelView matrix, the third column A:

        MODELVIEW MATRIX
--------------------------------------------------
R           U           A           T
--------------------------------------------------
1           0           0           0
0           1           0           0
0           0           1           0
0           0           0           1
--------------------------------------------------

Any suggestion or idea would be greatly appreciated.

EDIT
In my current implementation, I don't have forward vector, the only vector I have is position. OM is my orientation matrix. In addition, I have my camera call to glu_look_at before any object update, that's the reason why I have to store all the transformation of object in OM and doing this allow me to check for collision easier. In short,
vector3<float> get_forward() : return the third column.
vector3<float> get_position() : return the forth column.
vector3<float> get_up_vector() : return the 2nd column.

And in my drawing routine,

void draw() {
    gl_push_matrix(); {
        // camera is set here ...
        // ...
        gl_mult_matrix_f(OM);
        // draw
    } gl_pop_matrix();
}

sentences:
How can I move bodies in Farseer, using touch input? The player should be able to move a Farseer body with it's fingers. How can I do that? What is the best way to create a Farseer body for the player's finger so that the player can move other Farseer bodies with it? I don't know how to do that.

If the player pushes a body(for example windmill sail) hard with it's finger, then the body should move/rotate faster.

UPDATE:

I want to move the body RectangleA1 with my finger/cursor. But something isn't working.
If I press somewhere on the screen and move the cursor/finger a little bit around, then I get very often an error message in this line:

world.Step(Math.Min(elapsed, (1f / 60f)));

An exception of type 'System.NullReferenceException' occurred in FarseerForWindowsPhone.DLL but was not handled in user code

Additional information: Object reference not set to an instance of an object.

What is wrong? Why am I getting this error message?

My code:

    World world;
    Body RectangleA1, RectangleA2;
    Texture2D RectangleA1Sprite, RectangleA2Sprite;
    Body body;
    Fixture fixture;
    bool MouseJointAktiv = false;
    FarseerPhysics.Dynamics.Joints.FixedMouseJoint MouseJoint;
    private static float _displayUnitsToSimUnitsRatio = 100f;

    public static Vector2 ToDisplayUnits(Vector2 simUnits)
    {
        return simUnits * _displayUnitsToSimUnitsRatio;
    }

    RectangleA1 = BodyFactory.CreateRectangle(world, 1.50f, 0.50f, 1.0f);
    RectangleA1.BodyType = BodyType.Dynamic;
    RectangleA1.Mass = 20;
    RectangleA1.Position = new Vector2(4f, 1f);
    RectangleA1.Rotation = 0f;
    RectangleA1.CollisionCategories = Category.Cat5;

    RectangleA2 = BodyFactory.CreateRectangle(world, 3.50f, 0.50f, 1.0f);
    RectangleA2.BodyType = BodyType.Static;
    RectangleA2.Mass = 40;
    RectangleA2.Position = new Vector2(4f, 3f);
    RectangleA2.Rotation = 0f;
    RectangleA2.CollisionCategories = Category.Cat10;

    protected override void Update(GameTime gameTime)
    {
      float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;
      world.Step(Math.Min(elapsed, (1f / 60f)));

      TouchCollection touchCollection = TouchPanel.GetState();
      foreach (TouchLocation tl in touchCollection)
      {
        if ((tl.State == TouchLocationState.Pressed))
        {
          fixture = world.TestPoint(ConvertUnits.ToSimUnits(new Vector2(tl.Position.X, tl.Position.Y)));
          if (fixture != null)
          {
            body = fixture.Body;
            MouseJoint = new FarseerPhysics.Dynamics.Joints.FixedMouseJoint(body, new Vector2(tl.Position.X, tl.Position.Y));
            MouseJoint.MaxForce = 1000 * body.Mass;
            world.AddJoint(MouseJoint);
            body.Awake = true;
            }
          }

          if ((tl.State == TouchLocationState.Moved))
          {
            if (MouseJointAktiv == true)
              MouseJoint.WorldAnchorB = ConvertUnits.ToSimUnits(new Vector2(tl.Position.X, tl.Position.Y));
          }

          if ((tl.State == TouchLocationState.Released))
          {
            world.RemoveJoint(MouseJoint);
            MouseJoint = null;
            MouseJointAktiv = false;
          }
        }

        base.Update(gameTime);
    }

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: 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:
Identifying Entity 'Types' in an Entity-Component System If an Entity has no explicit 'type' (e.g. player) and is simply a collection of components, how do I identify the entities that my systems should and should not be working on? For example, in a game of Pong the paddle and ball both collide with the window boundaries. However, the collision handling systems for each will be different, therefore a system should not handle entities of the wrong type.

void PlayerCollisionSystem::update(std::vector<Entity *> entities) {
  typedef std::vector<Entity *>::iterator EIter;
  for (EIter i = entities.begin(); i != entities.end(); ++i) {
    Entity *player = *i; // How do I verify that the entity is a player?

    // Get relevant components.
    PositionComponent *position = player->getComponent<PositionComponent>();
    VelocityComponent *velocity = player->getComponent<VelocityComponent>();
    SpriteComponent *sprite = player->getComponent<SpriteComponent>();

    // Detect and handle player collisions using the components.
  }
}

Both the player and the ball share the same relevant component types for collision handling yet their system implementations will be different.

If I have a container of all game entities, how do I identify specific types of entity without inheriting Entity or including a member variable such as std::string type, in which case an entity is no longer simply a collection of components?

sentences:
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: Is there a way to make a dynamic world such as a MMORPG horizontally scalable? Imagine a open-world of 500+ players with data changing as fast as 20 updates/player/second. Last time I worked in a similar MMORPG, it used SQL, so obvioulsy it couldn't query the DB all the time. Instead, it loaded all players from the DB to memory as C++ objects and used them. That is, it scaled vertically. Would it be possible to make that server horizontally scalable instead? Is there a database designed to support that amount of updates concurrently?

sentences:
Splitting Pygame functionality between classes or modules? I am attempting to make my pygame application more modular so that different functionalities are split up into different classes and modules.
I am having some trouble getting pygame to allow me to draw or load images in secondary classes when the display has been set and pygame.init() has been done in my main class.

I have typically used C# and XNA to accomplish this sort of behavior, but this time I need to use python.

How do I init Pygame in class1, then create an instance of class2 which loads and converts() images.

I have tried pygame.init() in class 2 but then it tells me no display mode has been set, when it has been set in class1. I am under the impression I do not want to create multiple Pygame displays as that gets problematic.

I am probably missing something pythonic and simple but I am not sure what. How do I create a Display class, init Python and then have other modules do my work like loading images, fonts etc.?

Here is the simplest version of what I am doing:

class1:
    def __init__(self):
        self.screen = pygame.display.set_mode((600,400))
        self.imageLoader = class2()

class2:
    def __init__(self):
        self.images = ['list of images']

    def load_images():
        self.images = os.listdir('./images/') #get all images in the images directory
        for img in self.images:
            #read all images in the directory and load them into pygame
            new_img = pygame.image.load(os.path.join('images', img)).convert()
            scale_img = pygame.transform.scale(new_img, (pygame.display.Info().current_w, pygame.display.Info().current_h))
            self.images.append(scale_img)

if __name__ == "__main__":
    c1 = class1()
    c1.imageLoader.load_images()

Of course when it tries to load an convert the images it tells me Pygame has not been initialized, so I throw in a pygame.init() in class2 (I have heard it is safe to init multiple times) and then the error goes to:

  pygame.error: No video mode has been set

sentences:
Is there a terrain generation method where seed data is stored for each chunk instead of surface data? I'm a web programmer but I do like the idea of working on games at some point. As an enthusiast, I'm curious:

Is there an accepted terrain building practice in which developers create a generation engine which accepts various seed values to control terrain in a non-random environment?

I'm thinking of a method of, instead of storing gigabytes of map data, just storing a couple of megabytes of seed data, different types of seed data values for each chunk of the map, allowing the client to dynamically generate the map of your desired "design" (Not random gen), with only building and structure component configurations to be saved as map data.

Is there a name for this? It seems like it would be a good method of keeping a game's file size small.

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:
Libgdx, TiledMap, and tearing My TiledMap tears when the window is specific sizes, resized, or the camera moves.

The tileset is padded by 2px and have tried as high as 10px. Each tile is 70x70.

Here are the pack.json settings,

{
    paddingX: 2,
    paddingY: 2,
    bleed: true,
    edgePadding: true,
    duplicatePadding: true,
    maxWidth: 4096,
    maxHeight: 4096,
    filterMin: Nearest,
    filterMag: Nearest,
    ignoreBlankImages: true,
    wrapX: ClampToEdge,
    wrapY: ClampToEdge,
    grid: true,
    fast: false
}

Here is the code.

Parameters params = new Parameters();
params.textureMinFilter = TextureFilter.Nearest;
params.textureMagFilter = TextureFilter.Nearest;
TileMap map = new TmxMapLoader().load(file.getAbsolutePath(),params);

So what am I doing wrong? If nothing, does that mean libgdx absolutely cannot handle TileMaps of any sort?

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

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

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

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

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

         SubShader
         {

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

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

sentences:
RTS Attack Formation If i select a group of units and send them somewhere i form them like the following;

If i select them and order an attack, i want three things to happen:

High range units should keep the distance while attacking.
Each unit should attack if possible.
Attack formation should not look too unnatural.

Now i can handle the first two by forming the units as a circle by considering the range and unit count etc. But it looks very unnatural.

It's acceptable if some of the units are being idle for some reason, but i want most of the units join attack and they don't look so artificial.

Any ideas on that? Thanks.

sentences:
Should I ask my artist to make Sprites in full resolution or can I scale them up? I'm started with Unity development and my artist asked me what size she should make the sprites for the game.

They are all pixel art and she didn't know if she should make them on Photoshop on a small resolution, do them already on the iOS resolution 1920x1080 or even if she should use a vector program and then rasterize them.

How is this normally done?

sentences:
ArgumentNullException Parameter name: format I have made a simple game using Unity with Vuforia and exported for Android and iOS. It works fine on Android, but on iOS it crashed and gave the error:

ArgumentNullException: Argument cannot be null. Parameter name:
format at System.Type.GetTypeFromHandle (RuntimeTypeHandle handle) [0x00000] in :0
at System.String.FormatHelper (System.Text.StringBuilder result, IFormatProvider provider, System.String format, System.Object[] args) [0x00000] in :0
at System.String.Format (IFormatProvider provider, System.String format, System.Object[] args) [0x00000] in :0
at System.String.Format (System.String format, System.Object[] args) [0x00000] in :0
at UnityEngine.Debug.LogFormat (System.String format, System.Object[] args) [0x00000] in :0
at Vuforia.TrackerManager.InitTracker[T] () [0x00000] in :0
at Vuforia.TrackerManager.InitTracker[T] () [0x00000] in :0
at Vuforia.TrackerManager.InitTracker[T] () [0x00000] in :0

  (Filename: currently not available on il2cpp Line: -1)

sentences:
GameObject is only rendered when it has a negative z scale I have an orthographic camera that looks like this:

I create 2d polygonal meshes that have uniform z values in their vertices. I use Camera.ViewportToWorldPoint() to map these viewpoint vertices to world vertices.
The initial z valueI use for each polygon vertex is 1.0f. When I view my generated polygons, they each have a scale of (1,1,1) and are not being rendered. However, when I set the z value of the scale to any value less than zero, the mesh is rendered.
Could this be an issue with my camera's properties?

sentences:
Resources to learn XNA for a professional c# developer I'm a .net consultant (mainly c#) for my job, but for a while now, I've been interested in making a game in XNA (as a hobby project).

I've had a "beginner" course in XNA when I was still a student, but I've lost most of the information (plus, it was VERY beginner, not enough to get you really started).

So my question, which resources would be useful for me to learn XNA (books, blogs, websites, tutorials, resource websites - like textures, audio files, etc..)?

I know this is a very open question, but I'm thankful for any information.

sentences:
TVOS SiriRemote micro pad value change handler is not called I have a UIViewController which inherits from GCEventViewController and I register a value change handler for the GCController microPad Profile.

But when I use the SiriRemote in the Simulator none of my handling methods is called. When I stop with the touches the touchesEnded function is called though on that particular view controller.

This is are excerpts of my code:

var gameController : GCController? {
    get {
        return self.currentGameController
    }
    set(v) {
        self.currentGameController = v
        self.controllerUserInteractionEnabled = false
        if let microPad = v!.microGamepad {
            microPad.allowsRotation = false
            microPad.reportsAbsoluteDpadValues = true
            microPad.valueChangedHandler = self.microPadValueChangeHandler
        }

    }
}
...
 override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
    log.info("||||| TOUCHES ENDED IN GAMEVIEW_CONTROLLER |||||.")
}

func microPadValueChangeHandler( _ gp : GCMicroGamepad , _ gc : GCControllerElement ) {
    log.info("||||||||| microPadValueChangeHandler ||||||")
    log.info("|||||||||||||||||||||||||||||||||||||||||||")
    log.info("")
}

...

Any ideas why the microPadValueChangeHandler is NOT called and the touchedEnded is called?

Any help is greatly appreciated.

Cheers,

Frank

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:
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:
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:
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:
unity3d - AI terrain detection My goal is to have my animals walk around within a certain range. Everything works except for when it comes to the y axis. I can choose a position for it to walk and it will go there but I have no way of telling the height of the terrain at the selected point, or at the points all along the way. Im wondering how I can have my npc's always walk on the ground rather than walking through the ground.

My code is here if it helps, but my problem is pretty straight forward.

    if(timer == 0) {
        //Look at target
        myTransform.rotation = Quaternion.Slerp (myTransform.rotation, Quaternion.LookRotation (walkToPosition - myTransform.position), rotationSpeed * Time.deltaTime);

        if(Vector3.Distance (walkToPosition, myTransform.position) > 1) {
            //Move towards target
            myTransform.position += myTransform.forward * walkSpeed * Time.deltaTime;

            anim.CrossFade("walk");
        } else {
            walkToPosition.x = Random.Range(initialSpawn.x - walkDistance, initialSpawn.x + walkDistance);
            walkToPosition.z = Random.Range(initialSpawn.z - walkDistance, initialSpawn.z + walkDistance);
            timer = walkCooldown;
            anim.CrossFade("idle");
        }
        Debug.Log (walkToPosition);
    }

EDIT:

I am doing this project in Unity3d. I do not need to know how to render this, all I am looking for is some kind of function or something that I can use to tell the character to walk along the ground rather than walking through it.

At the moment when I set a new walk to position, the Y coord is 0, which means the character is going to forcibly go to the 0 axis without even considering the terrain.

sentences: Can't set the correct camera to current There are three cameras in my scene - Camera1, Camera2, Camera3. I want to have Camera1 as the only current camera. But whenever I remove the "current" tick from Camera2, Camera3 becomes current, and vice versa. No matter what ticks I tick and in what order, I cannot reach the desired state - Camera1 as current, Camera2, and Camera3 as not current. What's going on?

sentences:
Performance problem with chunked LOD I managed to create Zoomable planet. When I get closer to it the respective chunks are splitting and every split holds 4 x 16x16 grid (1024 verts). When getting closer the respective chunks split again and so on. AT the end (let's say when Im on ground), there is so much splits, that when looking on horizont its about 120000 vertices, what is way to much and drops fps to around 7-12. Where I really want like 3-4 layers - near detailed, far less detailed, farest coarse.

I can't get my brain around how to fix this. Any advice appreciated.

sentences:
How to create a skybox in an infinite world like minecraft? I'm making a minecraft-clone game in C++ using OpenGL.

I created a skybox using OpenGL's cube map but the camera can go outside of the skybox since it's an infinite world. Then I changed it to update the skybox's coordinate based on camera's coordinate like below but it didn't change anything.

How can I make a skybox stay at a relative position from the camera?

auto coord = camera.getCoords();
// positive x
skyboxMesh->addFace(
              coord.x + size, coord.y + size, coord.z - size,
              coord.x + size, coord.y + size, coord.z + size,
              coord.x + size, coord.y - size, coord.z - size,
              coord.x + size, coord.y - size, coord.z + size
              );

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:
(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:
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: Is it okay to use STL in my iPhone C++ 2d game? I've read a couple posts on the subject and it sounds hairy. But I think people are talking about using STL containers for Objective-C objects. I'm using pure C++.

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:
Lens Distortion not working with Unity 5.3.5 I have downloded the latest sdk from this link

https://github.com/googlevr/gvr-unity-sdk

I imported the package into my project.From the prefab added GvrMain to my scene and set the Distortion Correction to none as mentioned in the video below and edited the "GvrDistortion.cginc" shader .

https://www.youtube.com/watch?v=yJVkdsZc9YA

But the lens distortion is not working for me. I have a dout that whether to edit the same folder or should create a new shader and include the existing shader file

I am using unity 5.3.5 and GoogleVRForUnity package

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:
Enemy clones don't target player In a small game that I'm making enemies multiply when you kill them, however when clones are instantiated they don't chase the player like the original prefabs do (example: http://gfycat.com/VastActualElver)

Here is relevant part of my code:

 #pragma strict
    var moveSpeed : int = 3;

    var player : Transform;
    var MaxDist = 10;
    var MinDist = 1;

    function Update () {
        if(curhealth <= 0){
            Dead();
        }
        transform.LookAt(player);
        if(Vector3.Distance(transform.position, player.position) >= MinDist){
            transform.position += transform.forward * moveSpeed * Time.deltaTime;
        }
    }

function Dead () {
    Destroy(gameObject);
    var posx = Random.Range(-10, 10);
    var posz = Random.Range(-10, 10);
    Instantiate(enemys, Vector3(posx, 0.5, posz), transform.rotation);
}

What am I missing?

sentences: How can I transmit move information from player to player in a web application? I am trying to create an online chess game using ActionScript and Flex.  It works well when I have two players on the same PC, but I want to publish it as a web app.  How can I transmit a move or action from one user to another, such that the other user sees what the first one did?

sentences:
Texture will not rotate with gluSphere I have a gluSphere generated in my display that is rotating, but having a problem with the texture rotating with the sphere as well. So in a nutshell, no matter how the sphere rotates, the texture around the sphere remains in the same position regardless.

How am able to update the texture along with the sphere so that it rotates?

private static Texture testTex;
...

// This method is called in init()
public void sphereTexture(GL2 gl)
{
    InputStream iStream = null;

    try
    {
        iStream = getClass().getResourceAsStream("cratepng.png");
        TextureData data = TextureIO.newTextureData(iStream, false, null);
        testTex = TextureIO.newTexture(data);
        testTex.getImageTexCoords();
        testTex.setTexParameteri(GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
        testTex.setTexParameteri(GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_NEAREST);
        iStream.close();
    }
    catch(IOException e)
    {
        e.printStackTrace();
        System.exit(1);
    }
    // Set material properties
    gl.glEnable(GL2.GL_TEXTURE_GEN_S);
    gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S, GL2.GL_REPEAT);
    gl.glTexGeni(GL2.GL_S, GL2.GL_TEXTURE_GEN_MODE, GL2.GL_NORMAL_MAP);

    gl.glEnable(GL2.GL_TEXTURE_GEN_T);
    gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_T, GL2.GL_REPEAT);
    gl.glTexGeni(GL2.GL_T, GL2.GL_TEXTURE_GEN_MODE, GL2.GL_NORMAL_MAP);

    gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
    gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_LINEAR);

    testTex.setTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S);
    testTex.setTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_T);
}

// Draw Sphere (FILL, LINE, POINT) method called in display()
public void draw(GL2 gl, GLU glu)
{

    gl.glTranslatef(1f, 0.0f, -20.0f);
    gl.glRotatef(angleSphere, 1f, 0.0f, 0.0f); //90

    GLUquadric sphere = glu.gluNewQuadric();
    glu.gluQuadricDrawStyle(sphere, GLU.GLU_LINE);
    glu.gluQuadricTexture(sphere, true);
    glu.gluQuadricNormals(sphere, GLU.GLU_SMOOTH);
    glu.gluQuadricOrientation(sphere, GLU.GLU_OUTSIDE);

    testTex.enable(); // enable texture
    testTex.bind(); // bind texture

    glu.gluSphere(sphere, radius, slices, stacks);

    testTex.disable();
    glu.gluDeleteQuadric(sphere);
    angleSphere += speed;
    //System.out.println(angleSphere);

}

sentences:
I'm looking for a paper from Teknikus.dk I'm looking for this great paper about Verlet integration: http://www.teknikus.dk/tj/gdc2001.htm

I've found this link on many websites, forums, blogs, everyone is recommending it !

The website is down for more than one week.

sentences:
Optimal solution for storing card values in a multiplayer card game I am developing multiplayer turn based card game(Mendikot)

in JAVA.There are four players in two teams, partners sitting opposite
A standard international 52-card pack is used. The cards of each suit rank from high to low A-K-Q-J-10-9-8-7-6-5-4-3-2.
Each player gets random 13 card each.

Now I have two ways to store this data,one is to store the data using data structure as below.

private static String[] suits = { "Hearts", "Spades", "Diamonds", "Clubs"};

private static String[] ranks = { "Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King" };

and then store each combination of "suits and ranks" for each of the four players in a separate list and then update the list after each turn to remove played card.

Secondly I can go a database solution with table like "Players","Card","Moves" etc.
where in the "Moves" tables will store cards own by each player.Which can be cleared after the game is over

I am considering this Portal as multithreaded as many players can form different rooms to play.

Please suggest me the optimal way to store the data considering the concurrent nature of the portal.

sentences:
Libgdx game rendering works only after app resume I've encountered a strange problem while trying to develop my game.
I deployed the game to my Honor5C and when I open it, a red screen appears, because (I think) only these 2 standard lines of code are functioning properly:

Gdx.gl.glClearColor(1, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

But every other sprite is NOT being rendered. The thing is, if I go back to the phone's main menu, without closing the app, and then I pop it back up again, everything works fine. Here's my render method:

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

    cam.update();

    world.step(1f/60f, 6, 2);

    batch.begin();
    batch.setProjectionMatrix(cam.combined);
    bgSprite.draw(batch);

    platformSprite.draw(batch);

    idleSprite1.setPosition((playerBody.getPosition().x * PIXELS_TO_METERS) -
            idleSprite1.getWidth() / 2, (playerBody.getPosition().y * PIXELS_TO_METERS) -
            idleSprite1.getHeight() / 2);

    idleSprite1.draw(batch);

    batch.end();
}

What could it be? I've found absolutely nothing googling the issue for an hour straight now. Thank you all.

EDIT @ Charanor

No static variables are being used.
Here's the initialization for the variables used in the render method:

batch = new SpriteBatch();

    background = new Texture(Gdx.files.internal("data/bg.jpg"));
    bgSprite = new Sprite(background);
    bgSprite.setPosition(-683f, -384f);

    platform = new Texture(Gdx.files.internal("data/platform.jpg"));
    platformSprite = new Sprite(platform);
    platformSprite.setPosition(-50f, -100f);

    idle1 = new Texture(Gdx.files.internal("data/Idle.png"));
    idleSprite1 = new Sprite(idle1);
    idleSprite1.setPosition(-70f, 0);

    cam = new OrthographicCamera();
    cam.position.set(0,0,0);

    viewport = new StretchViewport(1366f, 768f, cam);
    viewport.apply();

EDIT 2: I've discovered the game still keeps not working if, after launching it, you press the android "back" button and then pop the game back up . The red screen stays. It appears the only way to make it work is to launch the app, press the android button that lets you see what applications are active and switch back to the game from there. It's getting ridiculous.

EDIT 3: I've done some more testing and here's what I found: if you deselect the app and reselect it again either with the recent apps button or the home button we know it works. But, if you press the android back button (it goes back to the phone main menu) after the game is already working fine, and then reopen it, the problem comes back and the screen goes back to full red!

sentences:
Is there a "box2d without physics" lib (only for collision detection)? Box2d Collision detection algorithms are probably the best ones out there. Unfortunately, they are bundled together with a realistic physics engine that I don't need.

Is there an open source project out there that strips out the physics part of Box2D, or provides a similar functionality?

sentences:
How to make a string[] from the words of a file in Unity? I have .txt file containing all the English words separated by line breaks.

I want to turn them to a string[] so I can easily pick a random one from them.

The way I would do that in normal C# is the File.ReadAllLines(path) function in the System.IO namespace.

But, I don't think that I can use System.IO with Unity so the alternative that I could come up with is the TextAsset class which I can use to reference an imported text asset and get its text property as a string.

But, if I have a giant string how can I simply split it up into individual words and store them as a string[]?

sentences:
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: Why does Mojang write Minecraft in Java Is there any specific reason why Java was the right choice for Minecraft?

sentences: Are game manuals worthwhile anymore? Is there any point in including manuals with games today?  It seems like most manuals are more for background story or art than any actual help.  Additionally, it seems like most games are including "help" inside of their games in the means of tutorials or similar means.  Do enough users actually look at their manuals to make them worthwhile to include?

sentences:
Making abilities (Programming FFG's boardgame Descent) I am trying to program Fantasy Flights boardgame "Descent - Journeys in the Dark", but I have hit a wall when dealing with implementing abilities, which are a crucial part of the game.

Abilities are used alot of different places, but are similar most of the time.

For a hero an ability could be:
At the start of his turn, Varikas the Dead recovers 1 fatigue

I have written monsters with abilities like this: Damage 2/Command

Equipment/Treasures look like this: When(TakingDamage):Exhaust&CancelDamage:2, When(MakingAttack(Type=Magic)):Gain:Surge 1 and When(Equipped(State=StartOfTurn))):Discard&Hero.Healt=Hero.HealthMax&Hero.Fatigue=Hero.FatigueMax

My idea is to maybe have some ability factory that will build an ability by reading the string formats, but I do not know how to implement them as a whole, and I am therefor turning to you.

Do any of you have any experience doing stuff like this, maybe when making D&D, Magic the Gathering, or maybe Descent?

Kind Regards
Thediabloman

sentences:
Detect clusters of tokens on an x y grid Ok, so I have a two dimensional grid working on integer x and y coordinates.

Each of this coordinates can have one and only one token on it.

The tokens have the capability of check and return an adjacent token given a direction in which to search (they'll return null in case nothing is there)

I now need an algorithm to check the grid for clusters of 3 or more adjacent tokens and add each cluster to a dedicated variable (meaning than, instead of just stopping after return one cluster, it needs to check for all clusters on the board)

I've been thinking for a while but came out with nothing, any help?

sentences: Using DirectX(SharpDX) what is the best way to create a single large image from smaller images? I'm looking for the best way to combine several images (1060 x 1060)each into on large image. I'm looking to create one texture to apply to a single Quad. I was thinking multiple quads and then just use a Shader in 3D. However, I cannot seem to figure out how to get this to work correctly. I have 16 quads in a 4 x 4 arrangement. However, I can only see 4 of 16. I'm trying to get the 16 to fit like a single quad would without a camera.

sentences:
Character falls through the Platform Effector 2D in Unity. How can I fix it? Character falls through the Platform Effector 2D in Unity. How can I fix it?
Here is the demonstration: https://imgur.com/G5YkTxa.
I tried changing the Edit - Project Settings... - Physics 2D - Default Contact Offset from the current 0.01 value to the 0.1 value. The result is the same and here is the demonstration of it: https://imgur.com/3TAOsNY.
Here are my settings for the platform:

Here are my settings for the character's RigidBody 2D:

Here is what character colliders look like when my character runs: https://imgur.com/CTialU3.
I basically run the recorded inside Unity animation of running and move my character with the help of the:
        private void FixedUpdate()
        {
            ... some code which computes the velocity vector depending on the input (the pressed buttons)
            characterRigidBody2D.velocity = velocityVector;
        }

I googled for a while now similar issues, but was not able to find a solution. I want to avoid the character falling down randomly during running.

sentences:
What are some ways I can create random but consistent levels with an increase in difficulty So I am relatively new to gaming, however, I am working on a breakout style game and I am not sure how to generate levels. In theory I would like some approach that will let me generate tons of levels with slightly increasing difficulty. After these are generated I would like them to be the same for every user every time. That last part got me thinking about maybe using some sort of noise to generate the maps.

Does anyone have experience in this area? Are there some best practices? It would be great if the answer was "broader" than Breakout, but I can live with just Breakout.

sentences: Gamemaker Key Press Duration I am looking for a way to track the duration of a key press in gamemaker. I was looking into alarm functions, but I figured there's a more elegant way. How can I track the duration of a keypress?

sentences:
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:
How can I exclude an object from receiving shadows? I would like to make it so that a certain object is being excluded from receiving shadows.

While it itself should cast shadows onto other objects, it should not receive shadows from other objects.

How can I achieve this?

I'm using HDRP.

Seemingly, the option not to receive shadows is not present when using HDRP.

The MeshRenderer looks like this:

sentences:
OrthographicCamera and viewport not giving expected effect I recently asked a question about this area that I think was too broad, so I will try a new approach.

I have the following code I am experimenting with:

        batch = new SpriteBatch();
        texture = new Texture(Gdx.files.internal("bg_test.png"));

        sprite = new Sprite(texture);
        sprite.setSize(GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT);

        myGameWidth = Gdx.graphics.getWidth();
        myGameHeight = Gdx.graphics.getHeight();

        float aspectRatio = (float)myGameHeight / (float) myGameWidth;

        cam = new OrthographicCamera();
        viewport = new StretchViewport(GAME_WORLD_WIDTH * aspectRatio, GAME_WORLD_HEIGHT * aspectRatio, cam);
        viewport.apply();
        cam.position.set(GAME_WORLD_WIDTH / 2, GAME_WORLD_HEIGHT / 2, 0);

Now I thought StretchViewport was supposed to stretch the image across whatever screen you tried, however I get this result in desktop when I try with config.height=800, config.width=400:

Now if I change the following line:

viewport = new StretchViewport(GAME_WORLD_WIDTH * aspectRatio, GAME_WORLD_HEIGHT * aspectRatio, cam);

to:

viewport = new StretchViewport(GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT, cam);

(I remove aspect ratio) This makes the image fill the screen the way I thought StretchViewport should, but I dont want to ignore the aspect ratio.

What makes it even weirder is that this only happens when I run desktop heigt>width(portrait), if I change it to the opposite width>height(landscape) then the image fills the screen too much, so the edges of the image go outside the screen :S

Am I missing something here? Is my aspectRatio wrong? I want to make sure my games will scale nicely across devices before I really get started with libgdx, right now all different viewports show me the same result with this padding.

I really can't figure this out, I get the behaviour (stretch) I want when I dont use aspectratio, but everywhere I read it tells me to use aspectratio. I really just wanna solve this so I can start with the fun stuff  ^^

sentences:
Sending high scores to a web server in an open source game I've never dealt with sending/receiving data from web servers in my games, so I absolutely have no idea how to do this. I tried googling for a good solution but couldn't find anything satisfying.

I currently get data from my web server by doing a HTTP request that gets the contents of a JSON text file stored on the server, and parses them in-game.

I do not know how to "write" high scores to the server, and even worse I do not know how to avoid people sending what they want to the server since the game is open source.

How is this usually done?

sentences: Ara matrices calculated on the GPU or on the CPU? Would built-in matrix functions be faster than my custom ones? If I add a math library (for example containing a Matrix class) and use it in my program drawing with OpenGL, will my be work slower than if I used standard OpenGL functions for matrix calculations? Does the same hold true for DirectX?

sentences:
Understanding Scene Graphs and Graph Edges So I'm trying to getting to grips with using Scene graphs and nodes in my code (game coding in C++) and I think I understand the basics of them and how they are used (and I can definitely see the benefits), but I'm coming across the term "Graph Edge" and I can't find any reading material explaining exactly what they are and how they fit in with Scene Graphs/trees/nodes in object hierarchy structures.

If anyone knows of any good material or has their own answer on what graph edges are and how they fit in (in use and implementation) that would be great.

Thanks

sentences:
Artifacts on top of platform sprite only when moving I made a floating platform in Unity which has a propeller movement animation. I attached a script I wrote to the game object that adds slight vertical and horizontal movement using the game object transform.position. This is creating some weird artifacts at the top of the sprite, but only when the movement code is active. When I don't move the platform and just leave it still to animate there are no artifacts.

Gameplay:

Sprite Import Settings:

Sprite Renderer:

Camera Settings:

Resolution:

sentences:
Passing of board data in board games Every time I make board game, I am faced with a decision. I have classes for the board and/or game logic, and another for the UI. I don't know how I should pass the board data to the UI. I could make a method on the board class that returns an array which represents the "board state", then just iterate over them on the UI. Or I can make a method that gets the value/s of a single coordinate, e.g. a getValue(int row, int col) method. Here are sample codes (in Java):

public class Board{
    private int[][] grid;
    private int rows;
    private int cols;

    // Constructor and other methods here, getRows(), getCols(), etc....

    public int getValue(int row, int col){
        return grid[row][col];
    }
}

public class UI{
    private Board board;
    // Constructor and other methods here

    public void someMethod(){
        for(int i = 0; i < board.getRows(); i++){
            for(int j = 0; j < board.getCols; j++){
                // Do something with board.getValue(i, j);
            }
        }
    }
}

or I can do this:

public class Board{
    private int[][] grid;
    private int rows;
    private int cols;

    // Constructor and other methods here, getRows(), getCols(), etc....

    public int[][] getBoardState(int row, int col){
        int[][] boardcopy = new int[][]

        for(int i = 0; i < board.getRows(); i++){
            for(int j = 0; j < board.getCols; j++){
                boardcopy[i][j] = grid[i][j];
            }
        }

        return boardcopy;
    }
}

What should I use? Or if this is debatable, could you just explain the pros and cons of each?

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: 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:
Rolling on collision I'm having a small issue where if I collide with another object (let's use a simple cube) with my player (this player is just a sphere), the ball will infinitely roll in the opposite direction and WILL NOT STOP. my code is as follows:

using UnityEngine;

public class PlayerController : MonoBehaviour
{
    private Rigidbody rb;
    private float moveHorizontal;
    private float moveVertical;

    public float moveSpeed;

    // Start is called before the first frame update
    private void Awake()
    {
        rb = GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    void Update()
    {
        moveHorizontal = Input.GetAxis("Horizontal");
        moveVertical = Input.GetAxis("Vertical");
    }

    private void FixedUpdate()
    {
        MovePlayer();
    }

    private void MovePlayer()
    {
        Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
        rb.AddForce(movement * moveSpeed);
    }

I even changed the ForceMode to ForceMode.Impulse so be able to see what it was doing a little easier, and it is in fact slowly rolling away infinitely with no way to stop it.

Both objects have a Rigidbody for them to be able to react to being hit. This is my first time messing with 3d. I tried to do something like this to make it not roll away on impact

private void OnCollisionExit(Collision collision)
    {
        if (collision.collider.gameObject.layer != LayerMask.NameToLayer("Ground"))
        {
            rb.velocity = Vector3.zero;
        }
    }

But then if I want to jump on the cube (lets say the cube is an enemy and I'm jumping on it to kill it), then it acts very wonky each time it touches the edge of the cube and I haven't made it on top (again, because the velocity is being set to zero).
I am all out of ideas and would love some input here!

EDIT: I now realize that the ball will slowly roll forever even without collision and just simply moving. I am very lost !

sentences:
2d game view camera zoom, rotation & offset using 'Filter' / 'Shader' processing? I wish to add the ability to zoom-in, zoom-out, rotate and move the view in a top-down view over a collection of points and lines in a large 2d map. I split the map into a grid so I only need to render the points that are 'near' the camera.
My question is, how do I render a point A(Xp,Yp) assuming the following details:

Offset of the camera pov from the origin of the map is:

Xc, Yc

Meaning the camera center is positioned on top of that point. If there's a point in Xc, Yc it is positioned in the center of the screen.

The rotation angle is:

alpha

The scale is:

S

Read my answer first. I am thinking there is more optimized solution, thanks.

My question is how to include the following improvement:

I read in the AS3 Bible book that: In regards to ShaderInput, You can use these methods to coerce Pixel Bender to crunch huge sets of data masquerading as images, without doing too much work on the ActionScript side to make them look like images.

Meaning if I am performing the same linear function on a lot of items, I can do it all at once if I use Shaders correctly and save processing time.

Does anyone know how that is accomplished?

Here is a sample of what I mean:

http://wonderfl.net/c/eFp0/

sentences:
I know fundamental programming. But how do I get started in game development now? I'm a 20 year old programming student. I know fundamental programming in BASIC, C, C++ and JAVA. What I wanted to ask is, where do I go from here? Are there any books that the community can mention that will help me develop a game or at least learn game development? I've had a lot of ideas and really want to make some sort of prototype to see if I'm suited for the industry.

I really don't mind learning any new languages but I need to know what I should begin with. A good book that will help with a little more understanding as I go up will be very helpful. Maybe a tutorial to develop some basic 2D games like a side-scroller, snake or pocket tanks in an easy to understand SDK?

I know that to get some credit under your belt, you need to be able to make a few games on your own.

Also, what platform should I start on? The PC, iOS or Android (as an introduction) for now. I don't want to get into high level game design just yet. Just something a bit basic to help out in future development.

Anything pointing me in the right direction will be  really really helpful.

Edit: Also, I want to say that I'm looking towards this from a game designer's point of view more than a game programmer. I want suggestions on any SDKs or easy to use programs I can use to understand game design. Then delve deeper into the programming after that.

Not as employment but as developing your own games (for now).

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 make one solid object in Maya? How can I "glue" more objects to each other so I get one object? (It is for resizing models), couldn't find anything about it on the internet, but I'm dutch, so maybe that's why. Thank you very much!

sentences:
Choosing the correct normal for a collision I have taken the task of building a basic impulse physics engine. Circle vs Circle collision resolution has been done and I moved onto Line vs Circle. I can detect a collision and know that the normal should be perpendicular to the line which can be calculated easily (2d physics engine). However it's the direction of the normal that I cannot work out.

From the image you can see there are 2 possible normals, one upwards (the correct one) and one downwards. How do I choose the correct normal?

sentences:
How to check metadata stored in FBX files? Is there a way to check and edit metadata information stored in FBX files? I'm using 3ds Max's fbx exporter. Can this be done with it or is there any other tool for that?

For example: adding name, contact info, tags or anything that provides ownership of the file.

sentences:
How much time would it take to make a sprite-based isometric game with customizable characters? I've never been good with 3-d models, but I can do sprites. I was hoping I could perhaps make a 2-d isometric game that acts like 3-d. Something like Don't Starve is what I have in mind.

Here's the kind of features I would like to include in games:

Rotatable camera. Don't Starve is obviously sprite-based, but you can rotate the camera. The effect may not look that great, but it allows the game to work like it has 3-d graphics when it doesn't.
Customizable character. You choose what your character looks like, such as their clothing, hair style, skin color, maybe their face. The issue is, I also want my characters to be animated. I know the number of sprites I'd have to make for that would be huge, but I figured I could shorten the process with things like palette swapping and reversing sprites. Could I have the game procedurally generate a sprite from multiple parts that are all animated? Or would I have to have every single possible combination pre-rendered? Yeah, I'd still have to make a huge number either way, but I can still cut corners where I can.

And yes, I know having both of these things would require me to create an insane number of sprites, but I'd still like to attempt it, if its possible. Also, I'd like to avoid a pixelated look, if that's doable. And yes, I know that would make creating sprites even more laborious, but gimp makes drawing clean lines rather easy, so I'm not too worried about it.

How long would it take me to create each sprite? With that, I could figure out how long it would take me to craft all of them, if I calculate how many sprites I would need per character.

And yes, thinking about the logistics of it all is immense. Animated, customizable characters in game with a rotating camera, meaning that even static objects would need multiple sprites. And no, I don't intend to include camera pitch. Obviously, I'm pushing the boundaries of what I can do as-is.

sentences:
How do open world game engines allocate memory? My troubles
I've been trying to create a game engine but since I am not well experienced in C++ I am having trouble deciding on how to load new scenes efficiently level by level or just an open world.
Example
Recent games are heavy, Most populat games are about 40 to 100 gigabytes but neither RAM nor GPU have that much memory at least Normal PC or Consoles.
So obviously most game engines pre-allocate enough memory to fit the scene and sometimes just tolerate some wasted memory but how would you decide how much is enough?
Possible solution
I was planning to create separate game loops, before entering the game loop I would load each level, then start the loop, thus I would be able to deallocate preceding level and then reallocate new memory for a next level.
Since I am new to the world of games and memory management my solution may sound rather stupid, But I need to know how to handle such situations efficiently.

sentences: Creating a planet out of an existing terrain I am creating a game that I have created a terrain for. I really like the terrain so I am wanting to keep it but I want to have the game take place on a full planet. Avoiding paying $200 for an asset already made, how would I develop something to allow me to "tile" this terrain to make a full planet and to make it round instead of flat? I know this has to be somewhat possible with the expensive assets on the asset store that are for round terrains. I just need to figure out how and I can't find anything online that is much help.

sentences:
Where do I write code in my minecraft modding environment? So this is probably a stupid question but I'm just beginning so I hope someone can help. I set up my whole modding environment in eclipse but the problem is that I don't know where to start writing code that will be run while playing the game. I'm used to there being a run method that will constantly loop and run the code within that method but there doesn't seem to be such a thing. I tried putting stuff in my main class under the init event handler but that just crashed my game. I was just testing stuff out and tried putting this code in the init area which caused the game to crash when I tried running the client:

Entity player = Minecraft.getMinecraft().player;
if(player.posX>100.0)
{
 player.posX = 12.0;
}

sentences: Is there a way to use the UnityEngine.UI with SteamVR and the Vive? I recently got into developing VR games using the Vive as my standard platform. Now I would like to design some UnityEngine.UI elements that would be interactable via the built in pointer scripts that come with the SteamVR module from the Unity Asset Store.  However, I can't seem to find any kind of built in method for allowing interaction between the pointers and buttons, scroll bars, etc.  I have also been unable to write anything myself that would do the trick, it's almost as if the Unity UI is just not designed to interact in a VR environment at all.  Does anyone have a method for using the UnityEngine.UI in a VR environment?  If so, can you please point me in the right direction?

sentences:
How to handle a Sprite Class? Currently I am learning XNA and while playing around with some tutorials knowing what I am aiming for a game it made me think that the Sprite Class will be something very important and re-used a lot of times, not sure if I am mistaken or not with this thinking.

Bellow you can see the Sprite code I am using at the momment and I was wondering:

How a Sprite Class should be or what
functions in general it should have
or am I mistaken that the Sprite
Class will not be used by every
sprite in my game ?

For example, in my sprite I could hold all property of the sprite even if one property is not being used, let's say an object that does not move around so it would have no speed which I could simple have a property saying that speed is disabled.

So i guess my real question is:

How should I structure my Sprite
Class to have the best usage out of
it ?

If you have a sample code to show I would appreciate aswell not really necessary, just for reference (also it doesnt need to be in c#).

Hope my question is not too confusing.

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace MyGameTest
{
    class Sprite
    {
        public string AssetName;

        public Rectangle Size;

        private float mScale = 1.0f;

        public Vector2 Position = new Vector2(0, 0);

        public Vector2 Speed = new Vector2(0, 0);

        private Texture2D mSpriteTexture;

        public float Scale
        {
            get { return mScale; }
            set
            {
                mScale = value;
                Size = new Rectangle(0, 0, (int)(mSpriteTexture.Width * Scale), (int)(mSpriteTexture.Height * Scale));
            }
        }

        public void LoadContent(ContentManager theContentManager, string theAssetName)
        {
            mSpriteTexture = theContentManager.Load<Texture2D>(theAssetName);
            AssetName = theAssetName;
            Size = new Rectangle(0, 0, (int)(mSpriteTexture.Width * Scale), (int)(mSpriteTexture.Height * Scale));
        }

        public void Draw(SpriteBatch theSpriteBatch)
        {
            theSpriteBatch.Draw(mSpriteTexture, Position,
                                new Rectangle(0, 0, mSpriteTexture.Width, mSpriteTexture.Height),
                                Color.White, 0.0f, Vector2.Zero, Scale, SpriteEffects.None, 0);
        }
    }
}

sentences:
Box2D pixel to meter conversion I have a game that was written in pixels and now I want to change it to meters like(box2D do). How I need to do that. I have wached a lot of tutorials and all they have some SCALING FACTOR but when I implement it my game don't work as I aspected. How I need to do that? For example I have a Coin and I want to make position of that coin random. I also want that coin sprite have a CircleShape (Box2D). Here are my code where I update my coin coordinates at specific time

if(time > 1.5f && !goToWallet && setUpCoin){
                coin.setCoinPosition(-100, -100); // do not show coin on the screen
                coin.update(coin.getCoinX(), coin.getCoinY());
                cam.update();
                if(showTime > MathUtils.random(5, 20) && !goToWallet){
                    coin.setCoinPosition(MathUtils.random(50, Gdx.graphics.getWidth() - 50)/100f, MathUtils.random(50, Gdx.graphics.getHeight() - 50)/100f); // random position of the screen IN PIXELS!!!
                    coin.update(coin.getCoinX(), coin.getCoinY());
                    cam.update();
                    time = showTime = 0.0f;
                }
            }

The problem is that is very easy to do in pixels, but How I need to do that in meters?

Here's my Coin class

public class Coin {
    /*
    A lot of variables
    */

    private final float radius;
    private BodyDef body;
    private FixtureDef bodyPhysics;
    private static Box2DDebugRenderer rend;
    private static World world;
    private static CircleShape coin;

    public Coin(World world, Box2DDebugRenderer rend){
        this.rend = rend;
        this.world = world;

        body = new BodyDef();
        bodyPhysics = new FixtureDef();
        coin = new CircleShape();
        coin.setRadius(.05f);
        body.type = BodyType.StaticBody;
        bodyPhysics.shape = coin;
        world.createBody(body).createFixture(bodyPhysics);
}
public void setCoinPosition(float x, float y){
    this.x = x;
    this.y = y;
    coin.setPosition(new Vector2(x, y));
}

}

sentences:
With a rolling pawn, how can I have a component that follows its rotation, but stays upright and only rolls? I'm using the UE4 rolling pawn to create a Metroid Prime morph ball style pawn. I've got it set up with a ribbon particle component on a spring arm, inheriting yaw, but if I set it to inherit roll, the axes invert and cause the particle emitter to flip and break the ribbon trail.

I'm sure there's some kind of rotation math that it needs, but it's beyond me. I've tried doing various math things to the axes, but I haven't been able to get it to click at all.

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

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

sentences:
On cocos2d, what is better: one monolithic game cycle or many scheduled selectors? I am building a simple tower defense game, and I have to take a decision between two(or more, feel free to suggest other ways) to do the game cycle.

Option 1: Monolithic game cycle:

I could have a global scheduled selector that calls update for every sprite/object/logic thing that I need to calculate.

I could achieve this by having a singelton Game class that has a mutable array of objects and then on the Scene(or that singelton) I could have a setup with:

[self schedule: @selector(gameCycle:) interval:0.1];

And then on that gameCycle do something like:

-(void) gameCicle: (ccTime)dt {
    for(Entity* e in [[Game sharedGame] entities]){
        [e gameCicle];
    }
}

Second option: Each object could create its own selector @ init.
This is almost the same, but instead of a singleton, every time that i create a object I could create a new scheduled selector as such:

-(id) initWithTexture:(CCTexture2D*)texture rect:(CGRect)rect {
    if( (self=[super initWithTexture:texture rect:rect])) {
        [[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES];
            [self schedule: @selector(gameCycle:) interval:0.1];
    }
    return self;
}

Now I don't know what is better(or if there is a very big difference in performance). What is the usual/best approach for cocos2d?

sentences:
Should I be sharing data between graphics and physics engine in the game? I'm writing the game engine that consists of few modules. Two of them are the graphics engine and the physics engine.

I wonder if it's a good solution to share data between them?

Two ways (sharing or not) looks like that:

Without sharing data

GraphicsModel{
    //some common for graphics and physics data like position

    //some only graphic data
    //like textures and detailed model's verticles that physics doesn't need
};

PhysicsModel{
    //some common for graphics and physics data like position

    //some only physics data
    //usually my physics data contains A LOT more informations than graphics data
}

engine3D->createModel3D(...);
physicsEngine->createModel3D(...);

//connect graphics and physics data
//e.g. update graphics model's position when physics model's position will change

I see two main problems:

A lot of redundant data (like two positions for both physics and graphics data)
Problem with updating data (I have to manually update graphics data when physics data changes)

With sharing data

Model{
     //some common for graphics and physics data like position
};

GraphicModel : public Model{
    //some only graphics data
    //like textures and detailed model's verticles that physics doesn't need
};

PhysicsModel : public Model{
     //some only physics data
    //usually my physics data contains A LOT more informations than graphics data
}

model = engine3D->createModel3D(...);
physicsEngine->assingModel3D(&model); //will cast to
//PhysicsModel for it's purposes??

//when physics changes anything (like position) in model
//(which it treats like PhysicsModel), the position for graphics data
//will change as well (because it's the same model)

Problems here:

physicsEngine cannot create new objects, just "assing" existing ones from engine3D (somehow it looks more anti-independent for me)
Casting data in assingModel3D function
physicsEngine and graphicsEngine must be careful - they cannot delete data when they don't need them (because second one may need it). But it's rare situation. Moreover, they can just delete the pointer, not the object. Or we can assume that graphicsEngine will delete objects, physicsEngine just pointers to them.

Which way is better?

Which will produce more problems in the future?

I like the second solution more, but I wonder why most graphics and physics engines prefer the first one (maybe because they normally make only graphics or only physics engine and somebody else connect them in the game?).

Have they any more hidden pros & contras?

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: Best platform for puzzle game development on the iPad I have a series of hidden object and puzzle games mapped out that I want to develop for the iPad and although I have written programs before, it's been a while. I've been trying to find the best platform to use and can't seem to find any helpful suggestions although HTML 5 seems to be the most mentioned. I will be using original graphics, perhaps some video cutscenes and music (think Dire Grove). Any suggestions?

sentences:
independent lighting per mesh in blender In Blender, is it possible to assign lighting objects/effects exclusively to a single mesh? For instance, if I place two meshes next to each other, and two lights (one shining on each mesh), I would want each mesh to not cast a cast any shadow on the other.

For example, in the following rendered image from a "test" star system view:

The rings are casting shadows on the right-most planets. I want the rings to only cast shadows on their own planet.

Is this possible?

sentences:
How to access `GameObject` to which `MonoBehaviour` is added from C# `Attribute` Unity's RequireComponent inherits from System.Attribute. Somehow they made it that whenever component is added it has a reference to GameObject its being added to. So they can callAddComponent` to it.

I am trying to replicate that behaviour.

My theory is that because UnityEngine.RequireComponent has types stored inside class - they do it by reflection later. In method AddComponent<T> they get T class attributes from type and then try to cast them, get information from them, and apply to GameObject. If that is the case, then I doubt I will be able to do something with it, unless I have access to change AddComponent<T> somehow.

Is there another way around it?(that is no problem to do in code (just extension), but what about how it will work in inspector) Maybe apply different method to Unity`s default component addition.

EDIT

[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
public class RequireComponentAttribute : Attribute
{
    public RequireComponentAttribute(Type type, int quantity)
    {
        if (quantity < 0)
            throw new ArgumentOutOfRangeException("Required components quantity cannot be negative");
    }

#if UNITY_EDITOR
#endif
}

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:
How do I determine distance of a point within a ProBuilder mesh? As in the title, I have an effect prepped for my game which applies certain derived parameters to a post-processing effect after the player enters a boundary I created with ProBuilder. Finding how far inside the bound the player is; that is, how far the player would have to travel, at minimum, to leave it; would help me scale this effect. It is not an axis-aligned boundary, and its sloped shape is fairly important. Having the effect go full-on on crossing the boundary would be jarring to the player.

I'm tempted to resort to traditional edge testing with this, but I would like to highlight that it will be done at least once per frame on multiple objects, so I would like to keep it as simple, and non-home-rolled, as possible.

The other possibility would be to keep track of time exposed and scale it by that; but this isn't ideal and I'm seriously curious as to whether a penetration-depth-testing method exists out-of-box.

A requested image of my setup:

It is laterally symmetric, and that is unlikely to ever need to change. However, future volumes are likely to have varying angles and heights. Depth is more-or-less irrelevant, as while I'm using 3D, this game has the physics of a 2D platformer; so you can consider it to have infinite depth if you need to. As you can see on the right, I've added almost nothing to it, other than the MagneticField.cs custom script (which does not even reference the mesh, only whether it's been crossed) and a debug class, TriangleReport.cs, that I'm working on right now.

One thought I had was to get triangles for the top, bottom, left, and right edges, use them to define planes, and then determine the distance from those planes; but if you've got something better I am all ears!

sentences: Blender How to unlock transform on bone I was trying to create IK constraint following a Nathan Vegdahl tutorial, and everything was nice and shiny, until i tried to actually move a bone. It's not moving, only rotating. I see that transform lock panel on location is grey and completly locked, and i have no idea what's wrong.

sentences:
Dialog/event system in Java/libGDX I hope that I'm posting this correctly as I'm new to the site, feel free to correct me if I'm in the wrong spot.

As for my issue:
I'm working on an 2D side-scrolling platformer game in libGDX, and I've run into an issue that I've considered before but never received a solid answer. Here's an example of what I'm wondering about:
In games like, say, the Legend of Zelda, when the player steps on a switch, or catches a torch on fire, this can open a door or release a monster or cause a myriad of other things to happen.

Now, I imagine that this utilizes some sort of Event-trigger relationship or messaging system, but it seems that it would be insane to hardcode all of these events into the game engine itself, even when utilizing an event-based system.

The same goes for tutorial and dialog systems: the player interacts with an NPC, or some sort of in-game object, and the dialog/tutorial continues at certain points.

In my game, I will specifically need to be able to have events triggered after a character does a certain thing, and I will need to be able to have series of dialogues triggered.  I think that I know how I could hardcode these things, but I'm going to have numerous levels that I wish to develop with a level editor such as Tiled, instead of hardcoding them.  Because of this, I don't know how I would integrate events into such a system.

My questions are: what do game programmers do to avoid hardcoding these things into their games? With something like a massive quest system with tons of dialog, or numerous levels with switches and events to trigger, how are these integrated into the game?

Thank you for any answer you can give me, I'm really stumped on this one :)

P.S. If you need any more clarity on what I'm asking for, please tell me so I can give more detail if needed.

P.P.S
I saw this post Level editor event system, how to translate event to game action but I've seen on other pages that people go back and forth on whether to use a scripting language, or some sort of file format like XML or JSON, and it's very confusing...

sentences:
Problem with preloading plist file in Cocos2d-x I am using Cocos2d-x engine with 3.2 version.

In my splash screen I am prefeching a plist by below line

SpriteFrameCache::getInstance()->addSpriteFramesWithFile("ui.plist");

Now inside game when I am creating a sprite I am getting an assert fail error

Sprite *ss = Sprite::createWithSpriteFrameName("pause.png");

  Assert failed: Invalid spriteFrameName: pause.png

Also when the splash screen is removed, I am getting the below line in console

  cocos2d: TextureCache: removing unused texture:
  D:/cocos2dx/projects/ABCD/Resources/mid/ui.png

Is there anything I need to add or something?
I was doing the same thing for 2.x and was working but not in 3.2

EDIT:
In 3.x if you are calling this line
Director::getInstance()->purgeCachedData();, remember that it will delete all textures from the cache memory. So handle all sprite-sheets manually.

sentences:
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:
SDL 2.0 OpenGL not drawing anything except background My 'hello triangle' compiles well, no errors, but doesn't drawing anything. Here's my code:

main.cpp

#include "src/App.h"

int main( int argc, char* args[] )
{
    App app(600, 400, false);
    app.Run();
    return 0;
}

App.h

#ifndef APP_H
#define APP_H

#include <SDL.h>

class App
{
public:
    explicit App(size_t win_width, size_t win_height, bool fullscreen_mode)
            : m_window_width(win_width), m_window_height(win_height),
            m_fullscreen(fullscreen_mode) {
        };

     void Run();

private:
    void Draw();
    void Update(double dt);
    void Resize(size_t width, size_t height);
    void ProcessEvents();

private:
    size_t m_window_width;
    size_t m_window_height;
    bool m_fullscreen;
    bool is_done;
    SDL_Window* m_window;
    SDL_GLContext m_glcontext;
};

#endif // APP_H

App.cpp

#include "../App.h"
#include <SDL_opengl.h>
#include <cassert>

void App::Run()
{
    SDL_Init(SDL_INIT_VIDEO);
    m_window = SDL_CreateWindow("Okno gry",
                                SDL_WINDOWPOS_CENTERED,
                                SDL_WINDOWPOS_CENTERED,
                                m_window_width, m_window_height,
                                SDL_WINDOW_OPENGL | (m_fullscreen?SDL_WINDOW_FULLSCREEN:SDL_WINDOW_RESIZABLE));

    m_glcontext = SDL_GL_CreateContext(m_window);
    Resize(m_window_width, m_window_height);
    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY);

    glClearColor(0, 0, 1, 0);
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_EQUAL);

    is_done = false;
    size_t last_ticks = SDL_GetTicks();
    while(!is_done)
    {
        ProcessEvents();

        size_t ticks = SDL_GetTicks();
        double delta_time = (ticks - last_ticks) / 1000;
        last_ticks = ticks;

        if (delta_time > 0 )
        {
            Update(delta_time);
        }

        Draw();
    }
    SDL_Quit();
}

void App::Draw()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();
    glBegin(GL_TRIANGLES);
    {
        glColor3f(1, 1, 0);
        glVertex2f(1, 1);
        glVertex2f(0, 1);
        glVertex2f(0, 0);
    }
    glEnd();
    SDL_GL_SwapWindow(m_window);
}

void App::ProcessEvents()
{
    if (is_done) return;

    SDL_Event event;
    while (SDL_PollEvent(&event))
    {
        if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
        {
            Resize(event.window.data1, event.window.data2);
        }
        else if (event.type == SDL_QUIT)
        {
            is_done = true;
            break;
        }
    }
}

void App::Resize(size_t width, size_t height)
{
    m_window_width = width;
    m_window_height = height;

    glViewport(0, 0, static_cast<int>(width), static_cast<int>(height));
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();

    glOrtho(0, 1, 0, 1, -1, 10);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
}

void App::Update(double dt)
{
    //printf("%d", dt);
}

Can anyone help? I don't know why it's not running.

sentences:
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:
Looping Background in Unity I am currently learning C# with Unity 2D but I have come across an issue after following a tutorial.

I am trying to get my camera to follow my player within the game but also to get my background looping so I dont have to have it miles long. I have added a boxcollider2D to outside left edge of the camera to pick up the background and then loop it to the right hand side before the camera gets there but for some reason it chucks it quite far to the right so I have areas with nothing showing but the player.

The only difference from the tutorial is that he was using 6 panels of background/ground whereas I am only using 1 big background sprite and 1 long ground sprite.

Heres my code for my looper;

public class BGLooper : MonoBehaviour {

    int numBGPanels = 2;

    void OnTriggerEnter2D(Collider2D collider){

        float widthOfBGObject = ((BoxCollider2D)collider).size.x;

        Vector3 pos = collider.transform.position;

        pos.x += widthOfBGObject * numBGPanels - widthOfBGObject / 4f;

        collider.transform.position = pos;

    }
}

Please help me so I can carry on creating my game :)

sentences:
HLSL: An array of textures and sampler states The shader must switch between multiple textures depending on the Alpha value of the original texture for each pixel. Now this would word fine if I didn't have to worry about SamplerStates. I have created my array of textures and can select a texture based on the Alpha value of the pixel. But how do I create an Array of SamplerStates and link it to my array of textures? I attempted to treat the SamplerState as a function by adding the (int i) but that didn't work. Also I can't use Texture.Sample since this is shader model 2.0.

//shader model 2.0 (DX9)
texture subTextures[255];
SamplerState MeshTextureSampler(int i)
{
    Texture = (subTextures[i]);
};

float4 SampleCompoundTexture(float2 texCoord, float4 diffuse)
{
    float4 SelectedColor = SAMPLE_TEXTURE(Texture, texCoord);
    int i = SelectedColor.a;
    texture SelectedTx = subTextures[i];
    return tex2D(MeshTextureSampler(i), texCoord) * diffuse;
}

sentences:
From Position/Target to Orientation/Elevation I have an orbit camera class that calculates the camera position from Orientation/Elevation and distance from target. I decided to replace these initial values for the camera instantiation with simply Vector3's position and target. How do I calculate Orientation/Elevation and distance from target from these two vectors?

I only got as far as creating a Matrix (Matrix.LookAt) and decomposing it. The translation that can be used for the distance from target partition is trivial, but what do I do with the Quaternion portion to get the elevation/orientation?

sentences:
How can I implement collision for a "pseudo-3D" game? I'm looking for high level implementation details, not specifics.

I've worked with bounding boxes before in some 2D games, but I'm currently tackling a "2D + depth" (2.5D?) style game along the lines of Double Dragon, Battletoads, TMNT: The Arcade Game, etc and I'm curious what a sensible collision system would be.

I think collisions between actual game objects is, for the most part, okay. I'm basically using a bounding box test that only executes if the objects' positions are within some depth threshold of each other. My real question is about collisions between floors and walls.

I want more freedom with the floors and walls than those older games listed as examples, so I've also put "mesh objects" into the game that are essentially just planes defined as combinations of triangles (simple floors also exist). The mesh objects can be static or dynamic (ie, floating platforms), and are built out of arbitrary points (ie, they are not always flat and parallel with the floor).

I can mathematically calculate collisions between objects and meshes, but I'm not sure how to go about calculating collisions between meshes themselves.

For example, how can I calculate whether two arbitrary triangles made of three arbitrary 3D points collide on a turn given position, speed, and acceleration vectors for each?

If this system sounds clumsy, I'm open to suggestions :)

sentences:
Texture animation/coordinates in VBOs Situation

I've got a large map divided into 16*16 parts (comparable to Minecraft) for x and z. For every part a VBO is generated and stored using GL_STATIC_DRAW.

Problem

The technique described above works fine and with good performance, however it restricts (due to the nature of GL_STATIC_DRAW) modifications that may happen frequently, especially texture animations (that is incrementing texture coordinates to select another sub rectangle in the texture).

Now I'm asking myself how to solve that problem. Switching to GL_DYNAMIC_DRAW seems like an overkill to me, since most of the geometry is static, thus better placed in GPU's memory.

Generating a separate VBO (or even a vertex array?) is an option that came into my mind, however this would greatly increase complexity. Any ideas?

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:
Where does the Game class come from in the DrawableGameComponent constructor? I'm making a project to Windows Phone using Silverlight + XNA, but I don't know how I can use the DrawableGameComponent because the constructor requires a Game class, it looks like this:

Planet.cs

class Planet : DrawableGameComponent
{
    public Planet(Game game): base(game){

    {
}

but in my first page of Silverlight and XNA project not is a Game class it's this:

GamePage.xaml.cs

public partial class GamePage : PhoneApplicationPage
{
   ...
}

Where do I find the Game class to pass into the DrawableGameComponent constructor?

sentences:
Creating a content pipeline for a Unity I have a game with lots of assets, such as data files, images, etc. My understanding is that Unity is optimized to know about all resources at build time. i.e. binding those assets to Scene GameObjects or prefabs. And for performance reasons, dynamically loading files from the /Resources folder is discouraged.

My question is how can I set up a "content pipeline" for converting my asset files stored outside of Unity into a format that Unity expects.

With the XNA toolset you can create a separate project and "build" the content into a bundle. Is there way to achieve similar results in Unity? Or is the best I can do creating an external tool, and simply copying files into my Unity/Textures or Unity/DataFiles folder and generate the Unity metadata files myself?

If there isn't an off-the-shelf solution, do you have any experiences or recommendations with solving this problem?

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:
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 would be the benefit of placing all of a room's textures on an object outside of the camera's view? Pokémon XD: Gale of Darkness does an odd thing with textures. As described in this video, all textures for a room are placed on an object outside of the camera's view:

  This kind of caught me off-guard. I wasn't really expecting anything to be on the other side of this room, but when I turned the camera around, it was all the textures that were inside this room plastered into one spot. Now I can't explain this whatsoever; I've never seen this in any other game that I've covered. But what's really odd is that this isn't an isolated case, this happens periodically throughout Pokémon XD. Now it's not in every room and city, but from time to time, you will see its textures on some type of object in an area that's off-camera.

What would be the benefit of doing this? The scene is shown to the player all at once after loading, so I'm not seeing how it would help with loading times or anything.

sentences:
How to implement soft edge areas with particles My game is created using Phaser, but the question itself is engine-agnostic.

In my game I have several environments, essentially polygonal areas that player characters can move into and be affected by. For example ice, fire, poison etc'
The graphic element of these areas is the color filled polygon area itself, and particles of the suitable type (in this example ice shards).
This is how I'm currently implementing this - with a polygon mask covering a tilesprite with the particle pattern:

The hard edge looks bad. I'd like to improve by doing two things:
1. Making the polygon fill area to have a soft edge, and blend into the background.
2. Have some of the shards go out of the polygon area, so that they are not cut in the middle and the area doesn't have a straight line

for example (mockup):

I think 1 can be achieved with blurring the polygon, but I'm not sure how to go about with 2.

How would you go about implementing this?

sentences:
Physics for Android Game I'm making a 2D game for the Android phone, one that involves falling balls. I want to use a physics engine to properly simulate the balls falling and hitting other objects. I'm currently using Phys2D, but when the game runs in the emulator it doesn't look natural; slow and rough. Course, I don't know if this is because of the emulator or Phys2D seeing as how I don't own an Android phone (A real drawback not being able to test on the actual phone, I know, but I can't afford a smartphone).

Anyways, do you think the game would run faster and smoother on an actual android phone, or is it the engine I'm using, or how I'm using it. If it's the engine, any recommendations on Java physics engines?

UPDATE: If you want to test the game yourself, you can find the rough prototype here: http://bpcp.angelfire.com/BallDrop.apk

sentences:
Download and open an zip file ingame on unity for android I would like to know if it is possible to have a game that would download a rar or zip file from a website and extract it to the internal storage for use, and if it is a good option since i have to use a directory structure to open fbx models that have the texture on a folder with the same name of the fbx.

The App is made for android and the files should not be bigger than 30mb.

sentences:
Reorder a set of points in order to draw a triangle fan (example) I'm doing a light engine (c++, using sfml), and to connect the light vertices, I thought about drawing a triangle fan.
Here is a representation of a triangle fan (sfml documentation):

The points HAVE TO be "ordered" to draw the shape correctly, otherwise it would mess the shape I suppose.

I drew the desired effect in ms paint:

As you can probably see, there is a central point, a light, and other points that I want to connect together. The problem is that the points are not always ... "In a row/Ordered" ? Let's see an example and simplify this problem.

In the example above, I can't connect the points from 0 to 8 because it would mess the shape.

I would like to reorder the points so I can connect them properly, like :

Do you have any ideas ?

I thought about doing something based on the "point in polygon" algorithm, like checking if the point is "on the right/left" but it seems complicated.

I don't necessarily need code (if you have time it would be nice) but I can try to do some, I just need ideas. Thanks

sentences:
Gameobject rotation around anchored pivot I'm looking for the best way to rotate the Camera(EYES) around a center of my character (Player Prototype) because if I turn around, the Camera enter inside the character.
My FPS script is attached to Player Prototype, but the Camera isn't because i have to make particular rotation. So I don't know what I have to do.

Have will I make the parent? If I will make it, Eyes will sum rotations to those of the parent.
Or maybe I have to handle this in LateUpdate()?
With RotationAround() I don't understand how to pass the second argument which is a Vector3, but I have a Quaternion.Euler.

So at this point I accept all the advice or examples of what I can do to solve it.

sentences:
How to use local-storage So I have this game and I would like to have a save function. Here is my code below:

function SaveData() {
  localStorage.setItem('save', score);
  localStorage.setItem('save', btoa(JSON.stringify(score)));
}
function LoadData() {
  score = window.localStorage.getItem('save');
  document.getElementById('demo').innerHTML = score;
}
window.onload = function()  {
LoadData();
}

When it loads it does not use the storage or it says Not a Number (NaN)

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:
Should I make a FPS game on Fixed Function Pipeline or Programmable Pipeline OpenGL? I have a “FPS” game I have programmed in Fixed Function Pipleline and one made in Programmable pipeline OpenGL. While the programmable pipeline has lots of weird things that you can edit, it does not have glLoadIdentity that I need for the gun to be attached to the camera. There is little to no information on this subject and most of the information that I can find is in the fixed function pipeline rather than the programmable one. Keep in mind that with the fixed function pipeline, I can just use the glloadidentity function and attach it then move on to another thing. On the programmable one, I don’t know how to do this, so I have spent a whole week looking up how I can do it.

Should I just use the fixed function pipeline one and abandon the programmable pipeline?

What shall I do?

Thanks!

sentences:
How to change FPS during runtime in LibGDX? I would like to be able to change the desired fps (foregroundFPS) during runtime without having to restart the game. I know how to set it before launch with LwjglApplicationConfiguration but I have no clue how to set it during runtime.

An example use would be in a menu where the player can select his FPS.

How can I do that ?

sentences:
Python/Kivy game for steam I'm developing a game in Python with Kivy as the gui. I've heard a few programs mentioned that compile python files to .exe's. However, I cant seem to find any that mention compiling .py and .kv files.

I wish to eventually publish my game to Steam Direct but i would like to know if my current approach to coding the game will hinder me doing so.

My actual question is, is there a way to compile a Python game with Kivy to an .exe file?

sentences:
XNA texture garbage collection I use a

 Dictionary<string, Texture2D>

for storing textures and every texture in the game is a reference to a texture from this dictionary. However when all references are gone, does the GC dispose of the textures (I don't think so as they are still accessible)?

And if it doesn't, how can I count the references to the textures so I can dispose of them manually?

sentences:
Unity2D: Increase spawn object movement when player collects every 10 points I want to make my spawned objects (enemy prefabs) movement speed up every 10 points my player collects.
This is my movement script, attached to my enemy prefab (so that it can be spawned in my game and move):

public static int movespeed = 20;
public Vector3 userDirection = Vector3.right;

public void Update()
{
    transform.Translate(userDirection * movespeed * Time.deltaTime);
 }
}

And this is my score script attached to my player:

public Text ScoreText;
public AudioClip Coinsound;
public Text Highscoretext;
public GameObject enemy;
Movement movement;

private int Score;
public int highScore = 0;

void Start ()
{
    Score = 0;
    SetScoreText ();
    if (PlayerPrefs.HasKey ("Highscore"))
    {
        highScore = PlayerPrefs.GetInt("Highscore");
    }
}
void OnTriggerEnter2D(Collider2D other)
{
    if (other.gameObject.CompareTag ("Pick Up")) {
        other.gameObject.SetActive (false);
        Score = Score + 1;
        SetScoreText ();
        AudioSource.PlayClipAtPoint (Coinsound, transform.position);

    }
}

As mentioned before I want to make my spawned enemy prefabs to move faster when my player collects every ten points. Thank you :)

sentences: 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:
Unity - How to keep an object at the right or left of another object I created a WallCheckRight and a WallCheckLeft linked to my character.
However, I noticed that when my character do a flip, they switch place (right to left and left to right)

Is there any way to prevent that?

sentences:
Control convention for circular movement? I'm currently doing a kind of training project in Unity (still a beginner). It's supposed to be somewhat like Breakout, but instead of just going left and right I want the paddle to circle around the center point. This is all fine and dandy, but the problem I have is: how do you control this with a keyboard or gamepad? For touch and mouse control I could work around the problem by letting the paddle follow the cursor/finger, but with the other control methods I'm a bit stumped.

With a keyboard for example, I could either make it so that the Left arrow always moves the paddle clockwise (it starts at the bottom of the circle), or I could link it to the actual direction - meaning that if the paddle is at the bottom, it goes left and up along the circle or, if it's in the upper hemisphere, it moves left and down, both times toward the outer left point of the circle.

Both feel kind of weird. With the first one, it can be counter intuitive to press Left to move the paddle right when it's in the upper area, while in the second method you'd need to constantly switch buttons to keep moving.

So, long story short: is there any kind of existing standard, convention or accepted example for this type of movement and the corresponding controls? I didn't really know what to google for (control conventions for circular movement was one of the searches I tried, but it didn't give me much), and I also didn't really find anything about this on here. If there is a Question that I simply didn't see, please excuse the duplicate.

sentences:
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 to load .max files to Panda3D Possible Duplicate:
  How to convert .max files to .egg on linux

Is there a way to load .max files directly to Panda3D engine? I am running Panda3D on linux so converting them using 3ds max is bit difficult.
Or at least is there a work around this problem?

sentences:
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:
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:
How to add custom control shapes to a rig in Maya I find most Maya animation videos has these circle lines to control character part rotation:

Why does my imported fbx not have these circle lines?

sentences:
P2P network hiding positions? I have been working on a P2P architecture for secure gaming and I have divided the problem into five sub-problems:

Unlawful modification of sent game state
Accurately drop cheaters
Agreeing on a game state
Avoiding "look ahead" cheat
Hiding sensitive information from opponents

The first four I have pretty much all solved but it is the last one which I am having trouble with.

Before I go into details I just want to ask if there's anything I've missed in my list of making a "cheat proof" p2p network. I am not interested in cheats such as using aimbots, I am only interested in making the p2p network as secure as a centralized server.

So in my effort so far on hiding sensitive information I've focused on the position of players in a game where the position of your opponent should not always be known. The problem then becomes how to determine if you should send you position to your opponent without knowing the position of your opponent.

I have ruled out methods such as the opponent sending multiple false positions for you to compare yours too since your opponent can easily abuse such a system since he will get your position if one of the false positions happened to be "visible" from your position.

The method I have been focusing on one in which you receive a "visual field" from your opponent and can thereby determine if you should send your position or not. This is however a problem in games such as League of Legends where the visual field of your opponent is also highly sensitive information. I have tried to solve this by transforming the visual field using a singular matrix meaning you cannot go from the transformed version of the visual field back to the original version, but since it is a linear transformation you can still figure out if your position is inside the visual field or not.

This does not however work perfectly, the exact visual field cannot be restored after transformation, but information about the "slopes" in the visual field (the visual field is constructed by several lines, and the slope of each line can be determined) can be restored and this can be used to relatively inexpensively  reconstruct the original visual field.

In essence, what I need is a function which can determine if a position is "visible" or not, and reconstructing this function/visual field has to be so computationally demanding that once you are done reconstructing the visual field it is no longer relevant for the game in action. Is there any super smart person out there who happens to know of such a method?

Edit
People seam kind of confused about the whole "vision field" so I aim to give a more detailed explanation here. The vision field consists groups of a set of lines, you can easily check if a position is inside one of these groups by just checking which side of the line your position is, if it's on the same side for all lines in that group you know it's inside that group and thus inside the vision field.

The information being sent however is not this line, but a transformation of the line and the transformation (2 by 2 singular a matrix), you can still check which side of the line your position is on by first transforming it using the transformation you received and comparing that value to the transformed line. The key here is that the transformation is singular, meaning it is impossible to find an inverse to go back to the original line. However it is possible to determine the slope of the line which makes reconstructing the line by just checking on which side of the transformed line a lot of points lie until you have pinpointed the origin of the line a lot computationally cheaper than if you did not know the slope of the line.

What I am looking for is a method for determining if a point is inside of an area, where reconstructing the area from the method is either impossible (which I doubt exists since you can always brute force it) or very computationally heavy.

sentences: Mesh deformation maya to unity I have a model that has been modeled & rigged in Maya, whenever i export it as an FBX and take it into unity it seems to collapse at certain areas (see the attachments for a before and after). The model is fine when brought into unity in the T position but once I give a pose in maya & get it to unity it seems to collapse in certain areas. I’ve even tried importing FBX file into 3ds max , model seems to have no problem in it. Its only when I import into unity I seem to get this problem.

sentences:
2D Collision response - rotating, moving polygon hitting a wall I'm trying to bounce a polygon that has both velocity and angular velocity off a (immovable) wall when one of the vertices collides with it. I can detect the collision, and I've worked out how to calculate the inputs and know what outputs I need, but haven't been able to find or work out an implementation for the response. Any help would be greatly appreciated.

function collisionResponse(
    c, // object center of mass position
    v, // velocity of object
    a, // the angular velocity of the object
    p, // point of contact with line
    n  // normalized normal of line
) {
    //  Make a vector from center mass to contact point
    cp = p - c;

    //  Total velocity at contact point (add angular effect)
    pv.x = v.x - cp.y * a;
    pv.y = v.y + cp.x * a;

    //  Reflect point of contact velocity off the line (wall)
    rv = reflect( pv, n );

    // magic happens..

    result.v = ?? // resulting object velocity
    result.a = ?? // resulting object angular velocity
    return result;
}

sentences:
Preventing a game object that has faded out from colliding with other game objects I have the following cycle for fading sprites in and out

fade out (1 second) -> delay (2 seconds)-> fade in -> delay (2 seconds)

Please see my code below:

IEnumerator FadeTo(Material material, float targetOpacity, float duration) {

    Color color = material.color;
    float startOpacity = color.a;

    float t = 0;

    while(t < duration) {
        t += Time.deltaTime;
        float blend = Mathf.Clamp01(t / duration);

        color.a = Mathf.Lerp(startOpacity, targetOpacity, blend);
        material.color = color;
        yield return null;
    }
}

IEnumerator EnemyCycle()
{

    while (isRepeating)
    {

        for (int j = 0; j < enemies.Length; j++) {

            var _myMaterial = enemies [j].GetComponent<Renderer>().material;
            var _currentFade = StartCoroutine(FadeTo(_myMaterial, 0f, 1f));
            enemies [j].GetComponent<CircleCollider2D> ().enabled = false;
        }

        yield return new WaitForSeconds (2);

        for (int j = 0; j < enemies.Length; j++) {

            enemies [j].GetComponent<CircleCollider2D> ().enabled = true;
            var _myMaterial = enemies [j].GetComponent<Renderer>().material;
            var _currentFade = StartCoroutine(FadeTo(_myMaterial, 1f, 1f));
        }

        yield return new WaitForSeconds (2);

    }
}

The above code cycle works when I am not disabling and enabling the colliders. i.e., without the following lines of code:

enemies [j].GetComponent<CircleCollider2D> ().enabled = false;
enemies [j].GetComponent<CircleCollider2D> ().enabled = true;

But when I place the two lines (as I've done in the above code), the enemy game objects don't follow the fade in and out cycle, mostly they don't even fade out.
I really need to be able to prevent the enemies from colliding with other game objects when I have faded them out during my fade in and out cycle. How can I solve this issue?

sentences:
How do I calculate the tangent to a point on a circle? I have a line that is from the center of a circle to a point on it's edge that is changing constantly (radius is drawn to a point orbiting a circle)
I want to make a line tangential to the circle whose midpoint is always the orbiting point. I know how to do it on paper but coding it in logic is the problem. Can someone show me how or point me to resources that I could use that would help me?

    public Line calculateTangent(Circle ball){

    //the point orbiting the circle
    circleEdge = new Vector2f((float)(radius*Math.cos(angle*Math.PI/180f)), (float)(radius*Math.sin(angle*Math.PI/180f)));
    //the line that I want to be perpendicular to at all times
    radiusLine = new Line(ball.getCenterX(), ball.getCenterY(), circleEdge.getX(), circleEdge.getY());
    //no idea how to do this last part
    perpendicular =

    }

sentences:
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:
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:
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:
Possible to test a game on multiple machines without owning multiple machines? I'm working on a small PC game (Uses custom engine written in C++) that I would like to test. Not as much the gameplay but the engine itself. See if there are any crashes, errors, glitches or missing library files. I'm using OpenGL for graphics and that always does unexpected things with a different driver / GPU.

At the same time I don't yet want to give out the half-finished game for public testing. Is there such online service that allows you to upload a program to run and gives you back the result of the run. A log file or a screencap or what not. Or is it possible to do such testing with VirtualBox?

sentences:
Determining and culling non-visible vertices Ahoy!

After posting my previous question on tile maps, i've been tinkering with an implementation i'm rather pleased with so far but would like to gather some more information about submitting geometry to be rendered by OpenGL.

A little background information:

I've set up a tile map which renders "volumes" in a layered manner very much like Minecraft's implementation using voxels (note; i'm not creating another bloody minecraft clone!) but with a twist in that any "volume" can be extruded along the Y-axis to create variably sized tiles. This all works fine and for the purposes of my tile map, is exactly what I set out to achieve.

My question:

My current confusion lies within the realms of how the vertex data is submitted to be rendered. I'm conscious that when two volumes are rendered in a single tile (think of them as layers; rock on the bottom, mud or water on top), the bottom volume is not actually visible unless there are no neighbouring tiles. To this end, is there any point in submitting the vertices for an object that may not be visible?

Consider two cuboids side by side. From any angle, you can only ever see 5 faces of each cuboid as the other faces are adjacent. Does OpenGL recognise this and discard them (if glCullFace or another appropriate method is used/enabled?) or do I need to actually determine what is visible and remove redundant vertices myself? Is there any harm in not removing them?

For the purposes of my tile map, I don't imagine that my "world" will ever be large enough to cause issues with rendering speed but I'd would like to optimise this so non-visible volumes are simply not rendered. I've been toying with a few ideas for determining which volumes are visible before adding them to the VBO but was wondering how much leg work OpenGL would do for me. There's no point me trying to solve a problem that doesn't exist and also, would OpenGL be able to calculate this much quicker that my own implementation?

I'd like the tile map to be deformable whereby the top-most volumes can be removed or resized to reveal the volumes below (also, some tiles may be transparent, such as water) so rendering the whole tile map (or at least what is visible on screen) would seem necessary.

I have the implementation down and working so far and it's running at a reasonable speed without any issues. I'm just not sure how much work OpenGL does in the background with regards to rendering and culling vertex data that isn't actually visible due to it being obscured by other objects. Can anyone provide insight into this, or at least point me in the direction of where I can read up on such matters?

Any help and information would be greatly appreciated :)

sentences:
moving in the wrong direction Solution:

To move a unit forward:

forward = Quaternion(0,0,0,1)
rotation.normalize() # ocassionally
...
pos += ((rotation * forward) * rotation.conjugated()).xyz().normalized() * speed

I think the trouble stemmed from how the Euclid math library was doing Quaternion*Vector3 multiplication, although I can't see it.

I have a vec3 position, a quaternion for rotation and a speed.

I compute the player position like this:

rot *= Quaternion().rotate_euler(0.,roll_speed,pitch_speed)
rot.normalize()
pos += rot.conjugated() * Vector3(0.,0.,-speed)

However, printing the pos to console, I can see that I only ever seem to travel on the x-axis.

When I draw the scene using the rot quaternion to rotate my camera, it shows a proper orientation.

What am I doing wrong?

Here's an example:

You start off with rotation being an identity quaternion: w=1,x=0,y=0,z=0
You move forward; the code correctly decrements the Z
You then pitch right over to face the other way; if you spin only 175deg it'll go in right direction; you have to spin past 180deg.  It doesn't matter which direction you spin in, up or down, though
Your quaternion can then be something like: w=0.1,x=0.1,y=0,z=0
And moving forward, you actually move backward?!

(I am using the euclid Python module, but its the same as every other conjulate)

The code can be tried online at http://williame.github.com/ludum_dare_24_evolution/
The only key that adjusts the speed is W and S.  The arrow keys only adjust the pitch/roll.

At first you can fly ok, but after a bit of weaving around you end up getting sucked towards one of the sides.  The code is https://github.com/williame/ludum_dare_24_evolution/blob/cbacf61a7159d2c83a2187af5f2015b2dde28687/tiny1web.py#L102

sentences:
How can I detect disconnected clients in a peer-to-peer network of this topology? I'm working on my first multiplayer game (RTS genre) and for the networking model, I'm leaning more towards a peer-to-peer model as opposed to a client-server model. I want my game to be able to handle a large number of users concurrently (around 50-100 users) in a reasonable manner.

I've come up with a proof of concept that can achieve moderate speed and moderate load balancing across the network. For it to work, one of the peers has to be designated as a central authority (i.e. the host). The host then receives updates from users through a star topology and then broadcasts the changes to other users through a tree topology, as below:

This type of network has one big problem: churn. I'm having trouble figuring out how to deal with users that disconnect from the network. If nothing is done for them, all of that user's children (and descendants) will lose connection.

How can I detect disconnected nodes in a peer-to-peer network of my expected size and remove them without harming the other, still-connected clients and without placing undue load on the designated host?

sentences:
Why is my texture displaying incorrect colours using dx11? I am trying to load my data from a binary file (ppm) and create a texture using this data. It is important that I learn to do it this way as I am eventually going to be packing all of my textures into a single binary file and then index them so creating the texture with pure binary data is something that I need to be able to do.

It seems that the texture is drawing correctly, but the colours are incorrect. I saved my image as .ppm just for this test application.

Here is the code to load my data

ppm ppm;

ppm.read(std::string("textureppm.ppm"));

//just to ensure the data is correct
uint32_t val = ppm.pixels[0];
unsigned char r = (val & 0xFF000000) >> 24;
unsigned char g = (val & 0x00FF0000) >> 16;
unsigned char b = (val & 0x0000FF00) >> 8;
unsigned char a = (val & 0x000000FF);

ID3D11ShaderResourceView* texSRV = nullptr;
D3D11_SUBRESOURCE_DATA initData = { &ppm.pixels, ppm.width * sizeof(uint32_t), 0};

D3D11_TEXTURE2D_DESC desc = {};
desc.Width = ppm.width; desc.Height = ppm.height; desc.MipLevels = 1; desc.ArraySize = 1;
desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
desc.SampleDesc.Count = 1;
desc.Usage = D3D11_USAGE_IMMUTABLE;
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;

ID3D11Texture2D* tex;
HRESULT hr = getDevice()->CreateTexture2D(&desc, &initData, &tex);

if (SUCCEEDED(hr))
{
    D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc = {};
    SRVDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
    SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
    SRVDesc.Texture2D.MipLevels = 1;

    hr = getDevice()->CreateShaderResourceView(tex,
        &SRVDesc, &texSRV);
}

if (FAILED(hr)) {
    throw 0;
}
else {
    setTexture(texSRV);
}

I have packed each byte into a uint32_t as it seems that is the format that is required DXGI_FORMAT_R8G8B8A8_UNORM

Here is the packing

uint32_t ppm::CreateRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
{
    uint32_t value = 0;
    int r2 = (r & 0xff) << 24;
    int g2 = (g & 0xff) << 16;
    int b2 = (b & 0xff) << 8;
    int a2 = (a & 0xff);

    value += r2 + g2 + b2 + a2;

    return value;
}

This code produces the following texture

When the original texture is

Does anyone know what I am doing wrong?

sentences:
Unity: How do I fix the players model rotation in a NetworkManager to spawn properly? How do I fix the players model rotation in a NetworkManager to spawn properly?

I created a game with the NetworkManager code.
Player Model is a cone I made and imported.

all works fine but when the NetworkManager spawns the player model it is sideways.
I have tried turning it in 3ds but the player remains sideways when it is spawned by NetworkManager on run, Ohterwise the model is fine in unity, and no matter how I rotate it, in or out of unity , The NetworkManager Rotates it.
All other objects attached to the main object remain with proper orientation all, All other objects including instantiated ones appear properly.

sentences:
Drag and drop card game--NullReference Exception despite object existing? I am trying to build a Hearthstone-style online TCG. Right now I am just working on getting the cards to drag around on the screen. Since I'm new to Unity, I'm using this tutorial https://www.youtube.com/watch?v=AM7wBz9azyU&index=3&list=PLbghT7MmckI42Gkp2cILkO2nRxK2M4NLo

I've copied the code in the tutorial pretty much exactly. What I have looks like this:

public class dragable : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler {

   public Transform parentToReturnTo = null;

   GameObject placeholder = null;

   public void OnBeginDrag(PointerEventData eventData)
   {
       Debug.Log("OnBeginDrag");

       placeholder = new GameObject();
       placeholder.transform.SetParent(this.transform.parent);

       LayoutElement le = placeholder.AddComponent<LayoutElement>();
       if (le) {
           Debug.Log("Found it!"); //Found le here...
       }
       else
       {
           Debug.Log("No dice.");
       }
       le.preferredWidth = this.GetComponent<LayoutElement>().preferredWidth; //can't find le--why?
       le.preferredHeight = this.GetComponent<LayoutElement>().preferredHeight;
       le.flexibleHeight = 0;
       le.flexibleWidth = 0;

       parentToReturnTo = this.transform.parent;
       this.transform.SetParent(this.transform.parent.parent);

       GetComponent<CanvasGroup>().blocksRaycasts = false;
   }

The rest of the class doesn't seem to effect the problem I'm having. That problem being: whenever I try to write to the LayoutElement le, the console returns a NullReferenceException error. But when I try to read le--for instance, testing if it exists in the if (le) loop (which exists only for debugging this particular issue), it works fine. Also, if you watch the tutorial video, you'll see that there is a "tabletop" on the upper half of the canvas that you can drop cards on to--this doesn't seem to work unless I comment out all code that tries to write to le's attributes. Anyone know how to fix this?

sentences:
WebGL CORS error loading simple texture in Chrome Here's my code:

function loadTexture() {
    textureImage = new Image();

    textureImage.onload = function() {
        setupTexture();
    }

    textureImage.src = "jumper2.png";
}

function setupTexture() {
    texture = gl.createTexture();

    gl.bindTexture(gl.TEXTURE_2D, texture);
    gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);

    // this next line has the error: Uncaught SecurityError: An attempt was made to break through the security policy of the user agent.
    gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, textureImage);
    gl.texParameteri(gl.TEXTURE_2D, gl.OES_TEXTURE_FLOAT_LINEAR, gl.NEAREST);

    if (!gl.isTexture(texture)) {
        alert("Error: Texture is invalid");
    }

    glProgram.samplerUniform = gl.getUniformLocation(glProgram, "uSampler");
    gl.uniform1i(glProgram.samplerUniform, 0);
}

I've researched it and it is a CORS error a "Cross-origin resource sharing" error, but it's a local file! I can't figure out what's wrong.

I did make the picture using gimp, and I'm not sure the coding was right on the export, but I eliminated a previous error using "gl.OES_TEXTURE_FLOAT_LINEAR".

sentences:
Getting world space vertex coordinates in Unity I'd like to get world space coordinates for a specific mesh vertex. Transform.TransformPoint() seems to be what I need however I'm unable to get the correct position.

In the scene I have an object called "head" at Pos (0, 0, 0) Scale (0.03, 0.03, 0.03) and I'm trying to get the position of vertex id 590 in order to spawn another object at that specific location.

Mesh mesh = GameObject.Find ("head").GetComponent<MeshFilter>().mesh;
Vector3[] vertices = mesh.vertices;
Vector3 newPos = transform.TransformPoint (vertices [590]);
Debug.Log (newPos);

The value of newPos is not on the head object.

sentences:
Unity3D) Is there a way not to draw line renderer if vertex pos is zero? I make a curved line with line renderer.
and a sphere move along it.
i want to draw a line only behind the sphere.

so i do something like this.

``
lr.positionCount = 256;

    while (delta < time)
    {
        lr.SetPosition(i++, curPos);

        yield return new WaitForFixedUpdate();
    }

``

and the problem is, because of i set the size of Positions 256,
if time is short, there are zero vectors in position.
so line renderer draw meaningless line.

is there a way to set PositionCount dynamically like List?
or any good way to not draw if positions are zero?

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:
How to run different animations with same suffix for different public objects? I would like to be able to run the corresponding animation (ending with "Get" in the title) for whatever item GameObject I plug into this treasurebox.

I made 2 prefabs for "item-get" animations today. Both GameObjects consist of 3 sprites: The image representing the item, and 2 lightray images that I enable/disable in alternation to get a halo effect (see animation below).

You can see the 2 prefabs and their corresponding animation components in the Project panel:

These next two images show how similar the animations are--they even both require two of the same sprites, flareA and flareB.

Here is the code I am currently using to set the state of the ItemBox GameObject and run the animations. You can see that while the itemGet prefab is public (that is, I can plug in whatever gameobject I want in the editor), line 27 explicitly calls for the animation belonging only to the turd item.

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

public class ItemBox : MonoBehaviour
{

    bool disabled = false;
    private Animator anim;
    public GameObject itemGet = null;

    void Start()
    {
        anim = GetComponent<Animator>();
        if (!disabled)
        {
            anim.Play("ItemBoxIdleState");
        }
    }

    void OnTriggerEnter (Collider other)
    {
        if (!disabled && other.gameObject.tag == "Player")
        {
            anim.Play("ItemBoxGetItemState");
            GameObject itemClone = Instantiate(itemGet, transform.position + new Vector3(0, 0.375f, 0), Camera.main.transform.rotation);
            itemClone.GetComponent<Animator>().Play("turdGet");
            Destroy(itemClone, 1.6f);
            disabled = true;
        }
    }
}

How can I change line 27 (the line before 'Destroy') so that it runs the appropriate "*Get" animation for whatever itemGet object I plug into the inspector? I think I am already close. I intend to make more items (not too many for now) and the animation I want to play will always be structured like "Get".

UPDATE 07/29/19:  I tried making a public AnimationClip object in the ItemBox script and putting that name in quotes for line 27 and thw script still works, but now I get an index error saying the animation state was not found. I don't think I can plug the name of the public variable into the .Play("") quotes and make it work; I think it only worked because there is only one animation for that item anyway. I ended up removing this new variable and just keeping the .Play("") part as empty quotes and it still works. I might decide to add more animations to these item objects later so I still need to know how to specifically play the animation that ends in "Get".

sentences: How do you change a Body's origin in Farseer? In Farseer 3.3.1 for XNA, how do I change the origin of a Body? For example, when I create a Circle Body, instead of it rotating around its center, I want it to rotate around another specified point.

sentences:
Accessibility of games, how is important for you? I'm blind and I would know if there is someone that consider important the accessibility, from a blind in particular, when develop a new game.
I don't speak about an audio game, I'm speaking about a video game that implements a TTS or a GUI compatible with screen readers!

sentences:
How to design 2D collision callback methods? In a 2D game where you have a lot of possible combination of collision between objects, such as:

object A vs object B => object B vs A;

object A vs object C => object C vs A;

object A vs object D => object D vs A;

and so on ...

Do we need to create callback methods for all single type of collision? and do we need to create the same method twice? Like, say a bullet hits a wall, now I need a method to penetrate the wall for the wall, and a method to destroy the bullet for the bullet!!

At the same time, a bullet can hit many objects in the game, and hence, more different callback methods!!!

Is there a design pattern for that?

sentences:
Does distant and large objects use up a lot CPU usage? Okay I'm new to Unity, and I'm making a space sim pc game. You know, space is huge, light years of distance between stars. Even if I set 1 AU (150,000,000 KM) as 1 unit, 1 light year will be 63,000 units, that's far far away from one another. Let say planet Earth's scale is 1, then the Sun will be 110x times the size of the Earth. This is big, because if the player's scale is 1, then we need to rescale the planets, the stars. I don't know whether or not Unity will handle large objects or far objects nicely, what I mean here is if a planet is, for example 10000 units, will the objects stop being processed by cpu? And does large objects use more cpu performance, if it does, how much it use?

What I want to know
1. Does far far away objects use up more cpu usage?
2. Does gigantic objects use up more cpu usage? I know it sure does, but how much? Is it 2x scale = 2x cpu usage on that object?
3. Do you have a way to minimize the usage of cpu, or more efficient way to do with large and distant objects?

I'm just started Unity last month, and get excited about how much could Unity do, but i always concern about how much cpu usage does this task use up. Any ideas?

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:
Unity Anti-Cheat solutions I'm currently working for a websites client development team and need guidance on where to go for anti-cheat with unity.

We have scripting, where a user can code in their own features via a editor we have made in lua, with a scripting api that allows them to interact with parts of the game via said scripting, others can exploit this with tools and execute scripts on games that didnt have said scripts, via "hacking". I'm trying to stop script execution exploit(eg scripts being executed that weren't put there by the author) and general hacks such as speedhacks, assembly injection, etc. We have tried the anti-cheat toolkit but it hasn't worked well for us. In terms of execution we have the lua5.2 library in a dll, of course they can hook this library and execute anything via luas execution functions built in, statistcally linking the library would help defend againist this but that is not a option that is easily done in unity, so anyone could just hook it and execute any script/lua they want. we have server-side scripts(executed on server) and client/local-side scripts(executed on client/locally), we've done our best to secure these but we're looking into more ways to help protect us, such as anti-cheat.

We have plans to possible invest into paid anti-cheats in the future such as battleeye, easyanticheat, etc.

we currently don't make a lot of capital and i have no experience making any type of anti-cheat nor anti cheat in unity, where do i start and what do i do?

sentences:
How to render metaballs? How  to render metaballs?
I am a Python programmer familiar with the Panda3d and Blender3d APIs. My math kinda sucks, but I know enough to write game logic code and procedural model generation code, as well as importers/exporters for the 3d modeller Blender. So you kind of get my level of experience. So can anyone explain or link to a tutorial which explains what needs to be done, without advanced math or with mentioning what math concepts are needed?

This is what I want to achieve:

http://www.youtube.com/watch?v=dEipENLes10
http://www.dailymotion.com/video/xn3xfn_mercury-meltdown-psp-un-trailer-pour-mercury-meltdown_videogames?search_algo=2

Though with probably more metaballs on screen at the same time.

sentences:
How do I set the size of a single 'unit' in my game? I'm currently trying to remake/port an old game created on Unreal Engine 2.5 to my own engine, and I have access to its physics data. It's using a scale of 80 units per meter, or 1 unit = 1.25cm.
The walk speed value for example is 5, and physics is simulated at 60 FPS, so the walking speed I need to implement would be 3.75 meters per second.
But I don't exactly know what the size of a game engine's "unit" actually means. I of course want my own engine (I'm using C++, OpenGL, and GLM) to use this same scale, but I'm not sure how to go about that. I'd assume this affects not only physics/movement code, but the scale of models and maps I load in as well, so it's important to make sure it's the same as in the original game.
How would I implement this? What parts of a game does the size of a 'unit' affect and how? Just the physics and movement calculations, or the graphics side as well (matrices, clipping space, FOV, etc.)?
(I'm not sure if I'm overthinking things)

sentences:
Deferred rendering order? There are some effects for which I must do multi-pass rendering. I've got the basics set up (FBO rendering etc.), but I'm trying to get my head around the most suitable setup. Here's what I'm thinking...

The framebuffer objects:

FBO 1 has a color attachment and a depth attachment.
FBO 2 has a color attachment.

The render passes:

Render g-buffer: normals and depth (used by outline & DoF blur shaders); output to FBO no. 1.
Render solid geometry, bold outlines (as in toon shader), and fog; output to FBO no. 2. (can all render via a single fragment shader -- I think.)
(optional) DoF blur the scene; output to the default frame buffer OR ELSE render FBO2 directly to default frame buffer.
(optional) Mesh wireframes; composite over what's already in the default framebuffer.

Does this order seem viable? Any obvious mistakes?

sentences:
How do I make the viewport move? I'm working with a game in C# XNA and I want to draw a texture and a position in the middle of the screen.
The thing is that I want the viewport to move around and not the player.
So for example:
If I push right I want the viewport to move right and keep the player in the middle of the screen.

Since GraphicsDevice.Viewport.X and Y are not variables, I have no idea how to do this.

sentences:
How can I draw a specific GameObject into a texture in Unity? I need to draw only a few specific objects into a texture (with their material) and then use that RenderTexture as a texture for an another object. I think Graphics.DrawMesh() and Graphics.SetRenderTarget() would be helpful, but I'm not sure.

Ultimately I'm trying to create refractive water, which will refract only specified GameObjects, not layers. How can I do this?

sentences:
What strategies can I use to update the visuals of my game to be more modern? I'm  making a browser strategy game.

Now my problem is that I have a feeling that my design is dated.
For now I have only used background colors and borders to make things look nice, but I have planed to add some pictures later.

Here is what it looks like now:

(Click for larger)

You will see that the game has a top and bottom bar and has the main section in the middle.  My main concern is that this may not be best idea, because not full width and height of the window is used.

What strategies can I use to update the visuals of the site to a more modern look?

sentences:
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:
When a Render Pass decides what textures it needs, how are shaders written? I am studying render graph architectures (I've seen the Frostbite presentation).
A RenderPass has outputs (i.e. textures you draw to) and inputs.
How are these inputs bound to the internal pipeline ?
Lets say I have an AO Pass and it has Normals and Depth as the input.
Do I just bind the texture to a register and that's it and sample it?
What about the actual shaders (for drawing geometry) that also use textures?

sentences:
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:
Incosistent jump, stuttering I've written this C# code to handle movement in my testing project. The game is supposed to be 2D, some kind of a platformer, just to get me started with Unity. However, it seems there's something odd going on. The movement isn't particularly smooth (especially in Editor, it's a bit better when built and ran as .exe file) and jumping is very inconsistent, meaning sometimes it jumps to a certain height and sometimes it jumps ridiculously high. Seems random.

using UnityEngine;
using System.Collections;

public class PlayerMovement : MonoBehaviour {

    public float MaxSpeed = 10f;
    public float JumpForce = 700f;
    public Transform GroundCheck;
    public LayerMask WhatIsGround;

    bool facingRight = true;
    bool isOnGround = false;
    float groundRadius = 0.2f;

    void FixedUpdate()
    {
        isOnGround = Physics2D.OverlapCircle(GroundCheck.position, groundRadius, WhatIsGround);
        if (isOnGround && Input.GetAxis("Jump") > 0)
        {
            rigidbody2D.AddForce(new Vector2(0, JumpForce));
        }

        float move = Input.GetAxis("Horizontal") * MaxSpeed;
        rigidbody2D.velocity = new Vector2(move, rigidbody2D.velocity.y);

        if ((move < 0 && facingRight) || (move > 0 && !facingRight))
            Flip ();
    }

    void Flip()
    {
        Vector3 scale = transform.localScale;
        scale.x *= -1;
        transform.localScale = scale;

        facingRight = !facingRight;
    }
}

Can anyone tell me what's wrong? There are just two simple platforms and one character, everything done in 2D mode with 2D psychics. The funny thing is that every tutorial handles movement differently and as a beginner in game development I'm kinda baffled by it.

Oh, and the version of Unity is 4.5.3f3, if that changes anything... I'm considering trying the newest beta of 4.6 to see if it is any better, because they're bragging about the new GUI and better 2D physics..
Also, I'm using Windows 8.1.

sentences:
Why does a 3D scene need to be voxelized before it can be transformed into a navmesh? Why do solutions such as Recast voxelize a 3D scene before transforming it back into polygons?
Would it not be possible to just determine intersections of meshes, check for slope angles and adjust triangulations in that way? I think agent height problems could also be solved by testing sweeps upwards against the other meshes.

sentences:
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:
Government or NGO grants for game development I live in the United States, and I was curious whether or not any governmental grants or NGOs (Non-Governmental Organizations) support game developers via grants or other funding options for games that are not directly developed for commercial gain.

After a quick googling, the only examples I could find were the NEA media arts grant which is restricted to games that can be claimed to be art (arguably all of them), and the ESA Foundation which focus on games for learning but are restricted to giving funding to non-profit organizations.

Are there any other institutions that accept applications for games from individuals? Perhaps similar to Y-Combinator where you have to present a short video of yourself, and a working prototype of your game along with background of the team you will be using to develop it? I'd also like to know whether or not there are institutions that would like to promote a certain cause or aspect through game development by providing developers with resources to pursue this? (Similar to this DOE project)

sentences:
Unity plane that is normal to Z axis I want to create a plane that will be normal to the Z axis, but I am having difficulty  visualizing what rotation it needs to have.

I want to have a top-down view upon the plane such that I can use the X and Y coordinate system for position, and the Z axis for height.

It seems intuitive for me to point the camera in the same rotation as this plane, and give it an orthogonal view and a positive Z value (and set gravity to have a negative Z value), but I seem to be fighting against the grain and running into more issues than I should be, so I would like to ask what rotations I should be using for this.

What rotation should I use for the plane? can the camera share the same rotation? (assuming I want the top to be +y and the right to be +x as seen from the camera.

sentences:
How Does Ultima 7 manage different floors in 2d In U7, you can move among floors without the function "tranport" the player to another place, as for example the first ff ones.

How can it tell whenever the character is moving from floor z to floor z+1? (of course, it uses stairs, but what is the logic behind this?) How does pathfinding in those cases work?

sentences:
How can I reward dungeon masters that take risks? I am working on a MORPG project featuring essentially two major roles: adventurers and dungeon masters. My concern is about balancing the two roles.

For those who have heard of it, the principle is inspired from the French comics Dungeon. The business model of a dungeon, as stated in the comics, is the following:
dungeon masters place treasures in heavily guarded dungeons, to lure in adventurers seeking fame and fortune. While some of them succeed, most die in the process, dropping valuable items which joins the pile of treasures of the dungeon, further attracting more adventurers.
Dungeon master make a living by collecting the right amount from these drops to create new rooms, pay mercenaries, fetch new creatures, breed dragons and whatnot.

Adventurers are quite classic: they are combat oriented characters that can attack monsters or fellow players and earn XP, items and money in the process, gradually making them stronger.

Dungeon masters are trade oriented. Their difficulty is balancing budgets: treasures and dragons are expensive. Now, I already expect a sort of equilibrium among dungeon masters because dungeons that are either too hard or too easy are naturally penalized (low attempt rate or low kill rate, respectively). DM vs DM balancing: check.

Since PvP combat is enabled in dungeons, there is also a competition  among adventurers pushing weak players to stick to easy dungeons that offer little reward to more advanced players. Adventurers vs advanturers balancing: check.

However there is one specific imbalance between the two roles that I am trying to solve: adventurers have a bias toward attempting dungeons above their league, because even if they die (dropping some items and respawning outside the dungeon), they will have gained some XP in the process. This is good because it rewards risk-takers. On the other hand, dungeon masters do not have any advantage of this kind: if an adventurer completes the dungeon and escapes with their share of the treasure, nothing is gained. This would be a pity if it lead dungeon master to be too cautious about their defenses, killing the probability of ever completing the dungeon. Adventurer vs DM balancing: problem.

Hence my question: what reward mechanism could I introduce that incitates dungeon masters to maintain a small but non-zero winning probability?

sentences: Examples of good Javascript/HTML5 based games Now that Flash is largely being replaced with HTML5 elements (video, audio, canvas, etc.) are there any good examples of web-based games built on completely open standards (meaning Javascript, HTML and CSS)? I see a lot of examples of pure HTML5 implementations of what was once only in Flash (like stuff here: http://www.html5rocks.com/) but not many games, a domain which still seem dominated by Flash. I'm curious what's possible and what the limitations are.

sentences:
OnTriggerEnter : is it called in both collider object? I've 2 object: a Player and a Bonus object.

In both script I've "OnTriggerEnter" script.

In Player OnTrigger I:
  Take Bonus value and add it to my Player (health, point, ammo)

In Bonus OnTrigger I:
  Play audio (when take it), Play Particle System and so on...

But, it seems it's called only Player's OnTriggerEnter ... Why ?

In Unity, if I have OnCollision/OnTrigger enter in both object, which event is called ? Both ?

Thanks

sentences:
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:
Creating my own kill cam I plan on creating my own kill cam system for a sandbox tool set.  After thinking about the mechanics of the kill cam itself, however, I'm quite lost.  I'm trying to recreate the ones commonly seen in call of duty games that show, from the view of the killer, the actual killing scene.

My Thoughts:

-I can't just keep in memory when people kill others because I wouldn't know when to start the 'recording process'.  There is on way for me to accurately determine when somebody is 'about' to kill someone.

-My only real idea so far is to have a complete duplicate of everything loaded off to the side copying all the movement from the original world but with a 10 second delay.  That way, all the kill cams would be 10 seconds long and the persons camera would just be moved to the second world of their killer.

My Questions:

Is there already an accepted way to do this?  Does anybody have any good ideas for something like this?  Thanks if you can!

sentences:
Lerping to a center point while in motion I have an enemy that initially flies in a circular motion, while facing away from the center point. This is how I achieve that:

position.Y = (float)(Math.Cos(timeAlive * MathHelper.PiOver4) * radius + origin.Y);
position.X = (float)(Math.Sin(timeAlive * MathHelper.PiOver4) * radius + origin.X);

if (timeAlive < 5)
{
   angle = (float)Math.Atan((0 - position.X) / (0 - position.Y));

   if (0 < position.Y)
      RotationMatrix = Matrix.CreateRotationX(MathHelper.PiOver2) * Matrix.CreateRotationZ(-1 * angle);
   else
      RotationMatrix = Matrix.CreateRotationX(MathHelper.PiOver2) * Matrix.CreateRotationZ(MathHelper.Pi - angle);
}

That part works just fine. After five seconds of this, I want the enemy to turn inward, facing the center point. However, I've been trying to lerp to that point, since I don't want it to simply jump to the new rotation. Here's my code for trying to do that:

else
{
   float newAngle = -1 * (float)Math.Atan((0 - position.X) / (0 - position.Y));
   angle = MathHelper.Lerp(angle, newAngle, (float)gameTime.ElapsedGameTime.Milliseconds / 1000);

if (0 < position.Y)
   RotationMatrix = Matrix.CreateRotationX(MathHelper.PiOver2) * Matrix.CreateRotationZ(MathHelper.Pi - angle);
else
   RotationMatrix = Matrix.CreateRotationX(MathHelper.PiOver2) * Matrix.CreateRotationZ(-1 * angle);
}

That doesn't work so fine. It seems like it's going to at first, but then it just sort of skips around. How can I achieve what I want here?

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: XNA HLSL - what happens if I grab a pixel outside a texture? I'm using the tex2D function of HLSL, and I am wondering what will happen if I try to grab a pixel from a pixel coordinate outside of my texture (as an example 1.1). Will it clamp? Will it repeat the texture and grab something else? Will it return transparent?

sentences:
Some example of basic algorithms and frameworks used in game creation I understand this sounds like a broad topic, I'm asked to have those skill from one of my applied job description.  The thing is that i have been with Unity3d for 2~3 years, but I'm not really sure what are they asking for, it would be the best if you could give me a list of names or some examples to start with.

Thank you.

sentences:
What does this FVF value in the FVFData block of an .X file equate to? I'm trying to read and ultimately write a mesh from/to file. This mesh has 2 sets of texture coordinates. The second set I know are held within the FVFData{} block of the .x file. The second set of coordinates is the only data within this block...the block looks like this:

FVFData {
258;
60;
1050755713,
1060090006,
...
}

This is 30 sets of 2 floating point values...

258 is equal to 0x102...
D3DFVF_TEX1( 1, 2-component vector ) is equal to 0x100...
...where does the extra 0x002 come from? is that just D3DFVF_XYZ..?
...why are they coupled for this data block when there is no position data in the block?

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 to export Visual Studio game for mass distribution I've coded a Visual Studio 2015 game in SDL2 and ran some distribution tests, I gave a user the game's .exe (the raw game with no files) and they got the error SDL2.dll is missing. How would I export the game so it includes the least amount of rubbish (visual studio) files and doesn't produce these sdl errors.

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

sentences:
How can I handle shadowing of a planet's rings by the planet itself? I assume the most straightforward way to draw planetary rings (such as those around Saturn) is to use a texture that is transparent everywhere except for the rings, and then place the planet in the middle of the texture and that's it.

The problem with this approach is that I don't know how to shadow the area of the rings texture that is behind the planet (which isn't lit by the sun). At the moment I have a rings texture that is permanently lit and a planet that darkens in the areas where it's not lit by the sun. The planet revolves around the sun, so the lit/shadowed areas are constantly changing.

Any suggestions on how to apply shadow on the rings?

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:
How to increase the acceleration of an object on the Y axis? So far I am able to make the character fall at a constant rate but I am unsure how to make the character accelerate while falling.

When the character is falling I have a line of code as such:

position.y -= 7f;

How can I change my implementation such that the character falls faster over time?

sentences:
Implementing a 2d Selection Box I'm in the process of implementing a selection box for my simulation and am having difficulty with something which appears simple. At the moment, I can draw the selection box and accurately select the items under it, provided the box was dragged from the top-left-hand corner downwards:

If I start dragging the box from any other point the rectangle doesn't correspond to that of the viewport, as demonstrated by the negative width and height.

Here is my code:

// selectionBox is Rectangle

if (mouse.LeftButton == ButtonState.Pressed && prevMouse.LeftButton == ButtonState.Pressed)
{
    if (selecting)
    {
        selectionBox.Width = mouse.X - selectionBox.X;
        selectionBox.Height = mouse.Y - selectionBox.Y;
    }
    else
    {
        selecting = true;
        selectionBox.X = mouse.X;
        selectionBox.Y = mouse.Y;
    }
}

// Code to handle selection finished omitted

// Drawing code
if (selecting)
{
    DrawingHelper.DrawRectangle(selectionBox, Color.Yellow, false);
    DrawingHelper.DrawRectangle(new Rectangle(startPoint.X - 4, startPoint.Y - 4, 8, 8), Color.Red, true);
}

How can I adjust the X, Y, Width and Height of my selection box so that X and Y are always the top-left of the selection box no matter where the selection began?

sentences:
Import Unity 2D objects in Libgdx I'm using Libgdx to do some simple home projects. I'm trying to make a simple 2D game with Box2d using R.U.B.E as editor. I create a 2d terrain in R.U.B.E now I want to create the terrain texture.
I see this tool for Unity:

https://www.assetstore.unity3d.com/en/#!/content/15761

This type of tool is exactly what I need for terrains. What I want to know is not related with this specific tool, but I wan't to know if I can import Unity 2d objects generated by tools related to Unity in my Libgdx 2d games?

sentences:
2D Skeletal animations exported to SVG I would like to create skeletal animations, and Synfig looks quite promising.

This is a video walk through
of its "bones" feature, used to do skeletal animation.

Ticks all the boxes thus far, however, I couldn't find out if animations could be exported as SVG. The closest I got to this was sif2svg, which is a pure XSLT transform, and lists "All sif elements aren’t supported, so it may have a lot of glitchs." as a limitation.

Has anyone had any experience here creating and exporting skeletal animations to SVG?
Is Synfig capable of doing this?
Are there alternative tools capable of doing this?

sentences: How to make pathways/corridors in a randomly generated dungeon? I am trying to make a random dungeon generator using Unity. I have been able to setup the rooms properly and connect them to each other using a minimum spanning tree algorithm. I have attached an image below where you can see what I have so far. The next step will be to create pathways/corridors to connect the rooms together but I am having difficulty understanding how I am supposed to go about it. I want the corridors to be straight or form an 'L' shape when connecting to each other. So I was wondering if anyone could help me out with this. Any help is appreciated.

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:
Why are there lines in between my tiles? I'm making a top down XNA game.  The maps are created by tiles.  A problem I recently noticed is a 'grid' of lines between the tiles.  It only shows up sometimes and only depending on the camera position.  I let XNA handle the positioning, why are these lines showing up?

Here is a picture with the lines:

However, after moving my camera over just a bit, it magically goes back to how it is supposed to appear:

Thanks for any help!

EDIT:

This is the best I can do for source code, this is an extremely large project and the rendering is done it multiple areas:

Main Render Loop For dynamic elements such as tiles:

    spriteBatch.Begin(SpriteSortMode.Deferred, Nothing, SamplerState.LinearClamp, Nothing, Nothing, Nothing, Matrix.CreateTranslation(CameraX, CameraY, 0))
    Mode.Render(spriteBatch, False)
    For Each j As [Delegate] In DynamicInjectionList
        j.DynamicInvoke(spriteBatch)
    Next
    DynamicInjectionList.Clear()
    spriteBatch.End()

Mode.Render:

For x As Integer = 0 To GRIDMAX - 1
    For y As Integer = 0 To GRIDMAX - 1
        For z As Integer = 0 To 2
            Dim ter As TiledTerrain = Terrain(x, y, z)
            If ter IsNot Nothing Then
                sb.Draw(CBaseClient.TextureLibrary("TileMap"), New Rectangle(x * GRIDSIZE, y * GRIDSIZE, GRIDSIZE, GRIDSIZE), New Rectangle(ter.Texture_X, ter.Texture_Y, GRIDSIZE, GRIDSIZE), Color.White)
            End If
        Next
    Next
Next

TiledTerrain.vb Class:

Imports ProtoBuf

<ProtoContract()> _
Public Class TiledTerrain

    <ProtoMember(1)> _
    Public Property X As Integer
    <ProtoMember(2)> _
    Public Property Y As Integer
    <ProtoMember(3)> _
    Public Property Z As Integer

    <ProtoMember(4)> _
    Public Property Texture_X As Integer
    <ProtoMember(5)> _
    Public Property Texture_Y As Integer

End Class

My Research:

I've done some searching into it and this is was I've found:

This problem is called tearing (I believe?)
It is commonly caused by using a floating point data type to hold the tile position (I'm using Integer so this shouldn't be a problem right?)

sentences:
Optimal Way to Create Card Templates in Unity 2D I have a couple questions involving software architecture and best practices in Unity. Although I have some programming knowledge, I am just starting with Unity and C#, and I would like some input from people with more experience than myself so I can learn Unity the right way and do not let bad habits take root.
In a nutshell: I am trying to put together a simple card drawing mechanic, where I would define a card layout (kind of like a class) and then initialise two-three at a time with data pulled randomly from a data source. Cards would have standard attributes like, cost, image, name, etc.
My first question is: what would be the optimal way to define the card template? Off the top of my head, I would say that it should be a prefab. But I am aware that there are other options as well, such as scriptable objects.
My other, related question, is: what would be a good way to store card data with future expandability in my mind. If my idea ever comes to fruition, I would like to release new card packs periodically, expanding the main card stock bit-by-bit. So, I am guessing, storing it in a simple JSON is probably not the best choice from a software architecture point of view.
Thank you for your answers!

sentences:
Why do my sprites stutter when I move them too quickly? The Problem
I have some sprites animating across my screen (some spaceships).
I alter their X coordinates (like -5, for animation) in my game loop.

I want the animation to happen faster, however when I alter their coordinates too much (like position-=5 each time), the animation becomes jumpy and stutters.

For example, decrementing objects xPosition by 1 = slow moving smooth animation
But, decrementing objects xPosition by 5 = faster, but choppy/stuttering animation

What I've tried
The only way I can think is to make my game FPS like 100 with a lower position incrementing speed, which is extremely wasteful.

My game loop is below.
(I know this isn't a great game loop, but its one of the few I understand. I also can't see how it would be a problem for this example)

private final int FPS = 60;
private final long TICKS = 1000/FPS; //16.67ms per update max

public void run() {
    long startTime = System.currentTimeMillis();

    while(gameRunning){

        cycleEnemies();
        repaint();

        startTime += TICKS;

        sleepTime = startTime - System.currentTimeMillis();

        //So timeout isnt negative
        if(sleepTime > 0){
            try{
                Thread.sleep(sleepTime);
            }catch(InterruptedException e){
                System.out.println("Interrupted: " + e.getMessage());
            }
        }else{
            //We're running behind!
        }
    }

}

And this is my cycle method:

    private void cycleEnemies(){
        for(Enemy e : enemyShips){
            e.setXPosition(e.getXPosition() - 5);
        }
    }

This is my drawing code:

private void drawEnemy(Graphics g){
    //Loop through enemyShips array, drawing all
    for(Enemy e: enemyShips){
        g.drawImage(e.getTexture().getImage(), e.getXPosition(), e.getYPosition(), null);
    }
}

sentences:
Mesh does not translate accordingly to WheelCollider So I am trying to implement a car controller script in Unity were the WheelTransform position and rotation is set with every update as the same as the WheelCollider position and rotation, it all works fine except for one thing: when translating the WheelTransform, if the car goes slowly, WheelTransform translates as expected, but when the car goes faster, there's a clear offset between the WheelTransform position and the actual position of WheelCollider. Here's the code were WheelTransform position and rotation is set as the same as the WheelCollider position and rotation:
private void UpdateWheels()
    {
        UpdateWheelPos(frontLeftWheelCollider, frontLeftWheelTransform);
        UpdateWheelPos(frontRightWheelCollider, frontRightWheelTransform);
        UpdateWheelPos(rearLeftWheelCollider, rearLeftWheelTransform);
        UpdateWheelPos(rearRightWheelCollider, rearRightWheelTransform);
    }

    private void UpdateWheelPos(WheelCollider wheelCollider, Transform trans)
    {
        Vector3 pos;
        Quaternion rot;
        wheelCollider.GetWorldPose(out pos, out rot);
        trans.rotation = rot;
        trans.position = pos;
    }

Every single one of the car controller scripts I've found and tried use the same code for this section, I have also tried with 2d sprites without any colliders as WheelTransform but neither the scripts or changing WheelTransform solved the problem. Thanks in advance for the help.

sentences:
Missing any kind of lights? I am trying to make my first 3D game in OpenGL with Shaders (LWJGL3)
I read and follow a lot of tutorials but can't figure it out what kind of light I am missing here? The wall doesn't get any effect from the light

It is supposed to be like this one:

And my point light part in fragment:

vec4 calcLightColour(vec3 light_colour, float light_intensity, vec3 position, vec3 to_light_dir, vec3 normal)
{
    vec4 diffuseColour = vec4(0, 0, 0, 0);
    vec4 specColour = vec4(0, 0, 0, 0);

    // Diffuse Light
    float diffuseFactor = max(dot(normal, to_light_dir), 0.0);
    diffuseColour = diffuseC * vec4(light_colour, 1.0) * light_intensity * diffuseFactor;

    // Specular Light
    vec3 camera_direction = normalize(-position);
    vec3 from_light_dir = -to_light_dir;
    vec3 reflected_light = normalize(reflect(from_light_dir , normal));
    float specularFactor = max( dot(camera_direction, reflected_light), 0.0);
    specularFactor = pow(specularFactor, specularPower);
    specColour = speculrC * light_intensity  * specularFactor * material.reflectance * vec4(light_colour, 1.0);

    return (diffuseColour + specColour);
}

vec4 calcPointLight(PointLight light, vec3 position, vec3 normal)
{
    vec3 light_direction = light.position - position;
    vec3 to_light_dir  = normalize(light_direction);
    vec4 light_colour = calcLightColour(light.colour, light.intensity, position, to_light_dir, normal);

    // Apply Attenuation
    float distance = length(light_direction);
    float attenuationInv = light.att.constant + light.att.linear * distance +
        light.att.exponent * distance * distance;
    return light_colour / attenuationInv;
}

sentences:
How can I move an object in an "infinity" or "figure 8" trajectory? When I want to move object around point I do:

    point.x *= cosf(timer.timeElapsed);
    point.y *= sinf(timer.timeElapsed);

How to make point move on eight or infinity sign trajectory?

sentences:
How can I repeat a Texture Region in libGDX I have a texture that is part of a sprite sheet. I want draw the texture to cover a certain length, but I want it to repeat not stretch. However,when I use the following code

batch.draw(hillBottom, hill1.getX(), hill1.getY(), hill1.getWidth(), hill1.getHeight(), 0, 0, 1, hill1.getNumBlocks());

I receive an error indicating that the first argument must be a Texture not a Texture Region. I am new to game development, but I have read from multiple different guides that loading seperate textures in a game hinders performance which is why it should only be done if completely necessary. Is there anyway I can repeat the Texture Region?

sentences:
Geometry shader vertex position to point at camera I have a shader that takes an array of points. At each point, a geometry shader creates a quad oriented towards the camera.
This works fine when the camera and point are at around the same Y value, however, looking up/down upon the billboard results in it shrinking to a point the closer the camera approaches being directly above/below.
Example (Youtube)
[maxvertexcount(4)]
void geom(point v2g IN[1], inout TriangleStream<g2f> triStream) {
    // Calculate some vectors
    float3 up = float3(0, 1, 0);
    float3 look = _WorldSpaceCameraPos - IN[0].position;
    look = normalize(look);
    float3 right = cross(up, look);

    // And how far off-centre our corners are
    float halfS = 0.5f * IN[0].colorScale[1] * _Scale;

    // Calculate verts
    float4 v[4];
    v[0] = UnityObjectToClipPos(IN[0].position + float4(+halfS * right - halfS * up, 1.0f));
    v[1] = UnityObjectToClipPos(IN[0].position + float4(+halfS * right + halfS * up, 1.0f));
    v[2] = UnityObjectToClipPos(IN[0].position + float4(-halfS * right - halfS * up, 1.0f));
    v[3] = UnityObjectToClipPos(IN[0].position + float4(-halfS * right + halfS * up, 1.0f));

    // pass through color texture lookup
    float2 color = float2(IN[0].colorScale[0], .5);

    // Start pushing verts
    g2f o;
    o.position = v[0];
    o.color = color;
    o.uv = float2(1.0f, 0.0f);
    triStream.Append(o);

    ...

I'm guessing my issue is related to the fact that my up and look are approaching coincidence, as the forward derives directly from the camera and the up is in world space, however, I'm uncertain of my diagnosis and unclear on how to generate an appropriately rotated up?

sentences:
Compiling the Latest MonoGame.dll on GitHub I've been searching for hours, but still I cannot find "How to compile the latest MonoGame source code from GitHub".

I have tried cloning the GitHub project (develop branch) and I've been looking for the solution that can be used so it will open on Xamarin studio and compile directly, but I have no luck and I don't know if it is the right procedure to get the latest MonoGame library.

Can anyone please help me cite the steps and procedures needed to compile the latest MonoGame source code from GitHub?

sentences:
What's wrong with my animation trigger script? So I am making an RPG and I am setting up the player. I am trying to trigger an attack animation by pressing a button. I wrote this down and I get an error that says "Expressions in statements must only be executed for their side-effects". I don't know what that means, but it is an error that won't let me play the game without fixing it. I'm not sure where to go from here. How would I fix the error? EDIT: I'm not using Mecanim, nor am I planning on using it.

This is the script. It is in JavaScript (Unity3D).

#pragma strict

var anim: AnimationClip;

function Start()
{
    animation["Sword Slash"].layer = 4;
    animation["Sword Slash"].wrapMode.Once;
}

function Update ()
{

    if (Input.GetKeyDown ("c"))
    {
        animation.Play("Sword Slash");
    }
}

sentences:
Unity C# Microphone input in Android different than on PC? I'm working on a mobile app inside Unity, in which I need to input and repeat microphone input almost immediately..

I've worked it out and it works great when I play it from within the Unity Editor. I get some very strange behavior though when I try it from my Android phone (Galaxy Note 3)..

So I decided to run some tests and noticed quite different behavior..

Using this sample code:

using UnityEngine;
using System.Collections;

public class testingMicScript : MonoBehaviour {

    void Start () {
        audio.loop = true;
        audio.clip = Microphone.Start (null,true,10,44100);
        while(!(Microphone.GetPosition(null)>0)){}
        audio.Play ();
    }
}

and playing it from withing the Editor it works great, I speak and hear myself back after a few milliseconds. I compile the app and run it from my phone and when I speak I get a very strange echo which goes on until the sound is completely distorted and I get a strange hiss, until audio is completely muted..

Why is that? Is there any particular setting I should go through? Or do I have to change something in my code?

sentences:
What is the order of postprocessing effects? I am newbie in game development. I have read how many shader effects are implemented usually, and I have implemented msot of them by myself. However, now, I have the situation when I have to program my post process pipelines and so is the question: in what order should I do post process effects? Mostly I ask about: SSAO, blur, motion blur, chromatic abberation, fog, shadows... Actually, I am curios about all of them. So, the basic idea of my engine is:

Always draw everything to the texture.
Apply (so called by me - "prePostProcess") effects (lighting, for example).
Apply post process fx (blur and so on).

I understand that as I change the texture sequentially then the result will be different if I change the order in which programs are used to change the texture. Like: chromatic aberration and then blur is different between blur and then chromatic aberration.

I code my game with opengl 4.4 at this moment, so I tagged it so.

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:
Why would running WebGL app in Edge improve performance in Firefox? I have a WebGL app (built using Unity 2019) which I'm testing locally in Firefox and Edge. If the app is only running in a tab in Firefox, it runs at 25 - 50 fps and has noticeable stutter. If I run the app in Firefox and Edge at the same time (each browser on its own monitor), the performance in Firefox significantly improves - it jumps up to 50 - 60 fps and stutter is eliminated.

Frankly, the results sound ridiculous even to me, but I've tested it over and over and it's 100% consistent. Opening the app in a tab in Edge immediately improves performance in Firefox. Closing the tab in Edge immediately reduces performance in Firefox.

I'm on Windows 10 with a GTX 2070 Super.

sentences:
What are the factors that determine the default frequency of a shader call? After i have been played for some days with various vertex and fragments shaders seems clear to me that this programs are called by the GPU at every and each rendering cycle, the problem is that I can't really quantify this frequency and I can't tell if is based on some default values or not because I don't have a big collection of hardware right now to do extensive tests.

For what i know the answer could be really trivial like "it's the same of the refresh rate of your monitor", but i would like some good answers on that to be clear on this.

For instance looks really odd to me that all the techniques used to control the amount of FPS that i have seen until now uses a call for the OpenGL function glutGet(GLUT_ELAPSED_TIME) to retrieve a value in ms about when the rendering started but I have to relies on the CPU to do the math. Why I can't set an FPS value in OpenGL if OpenGL clearly has a counter and a timer/clock?

PS
I'm referring to OpenGL 3.0+

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:
What are "frame rate" and "fps?" Can someone give me a detailed
explanation about frame rate and fps concepts?

sentences:
How can I give the mouse position to my GameObject nicely? I am making a basic Asteroids game in SFML, and I want the Player ship to always look at the mouse. I have a LookAt(x,y) function which works, but I am not sure how to get the mouse position from the Player's Update() method!

I see several possible solutions to this:

The LookAt(x,y) function is changed to be public, and instead of the Player calling it within its own Update() function, it is called externally (maybe in an Update() function in the GameManager class, which has access to both the Player and the InputManager)
The Player is given a pointer to the mouse position on creation, which is updated every frame in the InputManager on MouseMotion
The Player is given a pointer to the InputManager, which it can then use in the Update() function to access mouse coordinates.
The InputManager class is made 'static', and the Player accesses the mouse position directly via InputManager.GetMousePos()

Ideally I want the Player's behaviour to be contained. I don't feel that it is neat to create new properties, functions or callbacks outside the player class just so that the player has access to two integers. The last solution (making the InputManager static) seems neat to me (especially since it only requires 1 new line of code in the Player class, and doesn't require the Player to hold onto new properties), but I've heard that using singletons is an 'anti-pattern' and should be avoided!

sentences:
Creating a glitch effect similar to Watch Dogs I'm currently working on a LibGDX game. When a user does something wrong, I would like all the graphics on the screen to jitter very similar to the glitch/distort effect seen in the game Watch Dogs (See Below).

My question is this: can this effect be achieved in real time by writing a shader? If so are there any references online on how to do this? (I've had a quick Google but all I could find is how to achieve this effect in Photoshop/After Effects).

Thank you for your help.

Screen jitter: https://www.youtube.com/watch?v=EYkqC9uI8Nc

Text glitch effect: https://www.youtube.com/watch?v=Wj26Wp2AH-U

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: Can I incorporate a small fraction of a song into my iOS game? I was wondering if I can use a small portion of a song without running into any copyright issues. I would give full credit to the artist as well.

sentences:
Composite 3-D and 2-D using Anamorphic Projection? I'm working on a game which takes place on a two dimensional grid similar to the fluid background grid in Geometry Wars. It is implemented as a procedurally drawn spring system which may have force applied to the intersection points resulting in a primitive fluid dynamic simulation.

Let's say I want to elevate the grid into three-space. One way would be to upgrade the whole world to 3-d. Then I could render the grid to a texture and map it onto a plane which could be placed in three dimensions. What I am more interested in, however, is how I might 'fake' it by simulating perspective using 2-D. For example, its easy to vary the horizontal grid spacing based on the cell's row in the grid. By squeezing it at the top I can create a visually convincing vanishing point, but the physics and interaction with the grid is not right.

I'd like to be able to layer the 2-D grid over a separate 3-D layer such that they appear to be one. Have y'all seen the impressive demonstrations of anamorphic projection recently featured on YouTube?

Intrigued, I found another tutorial video which shows how to draw anamorphically using pencil and paper.

Anyone have an idea of how to approach the problem of creating an anamorphic projection space in 2-D that would line up with a given perspective projection as that of a typical 3-D Camera?

I envision that this would manifest as an array of weightings applied to each point in the 2-dimensional grid which I could use to modulate the physics forces that drive the grid, creating a more realistic spring system than is possible with a simple faked perspective.

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: Remove tutorial projects from learn tab in Unity In Unity I downloaded one of the tutorial projects in the learn tab. However I don't need it anymore. What should I do to get rid of it?

sentences:
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 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:
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:
How can I create a 2D camera with zoom and parallax scrolling that works on every Windows Phone resolution? Mario game that uses parallax scrolling: http://www.youtube.com/watch?v=de5f3mvRyIY

I want to create a Windows Phone jump-and-run game with parallax scrolling. The parallax scrolling should be like in this Mario game. The character should be centered in the viewport.
I use the code of this tutorial to create the camera and parallax scrolling:
http://www.david-gouveia.com/portfolio/2d-camera-with-parallax-scrolling-in-xna/

I can zoom in and zoom out with the camera and the player(basketball) is in the center of the viewport, but parallax scrolling isn’t working correctly on every Windows Phone resolution. I get different results on every resolution. The backgrounds look different on every resolution.

For example:

WVGA emulator(resolution: 800x480pixel): http://s1.directupload.net/images/140730/ljbsolu2.png

720p emulator(resolution: 1280x720pixel): http://s1.directupload.net/images/140730/36ic4rfo.png

If you compare both pictures, you see that the backgrounds are not on the same place on both resolutions when the basketball touches the orange rectangle.

Why are the background layers not on the same place in both pictures?

I use the same sprites and same coordinates for the sprites on every Windows Phone resolution. In the WVGA picture, I just zoomed out with the camera so that you can see the entire background.
How can I create a Windows Phone game that uses parallax scrolling and looks on every resolution the same? The background layers should be on the same place on every resolution.

sentences:
Handmade Terrain vs. Terrain Engine in Unity? I'm planning a game right now, to be made in Unity, and I'm trying to decide how I'll approach the basic level construction. Essentially, my game takes place on an island in an infinite ocean, very similar to Wuhu Island:

My question concerns all the stuff heightmaps can't handle. To use Wuhu Island as an example, note the lighthouse cliff, and the nearby similarly jutting-out cliff. The volcano itself is also empty, and there are some tunnels through it on the other side.

I was thinking I would just model the entire island myself in Cinema 4D, but as I read more about the terrain system, it seems Unity has special optimized rendering systems in place for terrain objects. Would I be shooting myself in the foot performance-wise if I just built my island entirely by hand? This will be for mobile, so the little stuff might well count. Am I even approaching this question correctly - if not, how would you best go about creating (something very close to) Wuhu Island as a level in Unity? Is there any reason for me to not do it as one mesh? I have effectively zero experience with 3D game dev - only rendered 3D video/stills for other applications, so this is a learning process.

sentences:
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: Polygons depth sorting in Z-buffer Why is it that the Z-buffer algorithm does not require polygons to be depth sorted to function correctly?

sentences:
Aspect ratio of drawn quad messed up after rotating When I draw a quad that is rotating the aspect ratio of the quad gets messed up and the size changes.

Gif of what is happening

I am confident it has something to do with the way I calculate the size because that is relative to the width and height of the screen, I just don't know why the aspect ratio would change since the aspect ratio of the screen doesn't change.

Code of transformationMatrix creation:

        Matrix4f matrix = Maths.createTransformationMatrix(
                new Vector2f(
                        gui.getPosition().getX() / Display.getWidth() * 2 - 1 + gui.getSize().getX() / Display.getWidth(),
                        -gui.getPosition().getY() / Display.getHeight() * 2 + 1 - gui.getSize().getY() / Display.getHeight()
                ), gui.getRotation()
                ,new Vector2f(
                        gui.getSize().getX() / Display.getWidth(),
                        gui.getSize().getY() / Display.getHeight()
                )
        );
        shader.loadTransformation(matrix);

The x size, y size, x position and y position are in pixels, if you put in 1600 pixels for x position and the screen is 1600 pixels wide it will fill the whole screen. The calculation that is done here will translate those sizes to a value that the shaders will display on the screen.

I had tried calculating the sizes in a different way:

gui.getSize().getX() / (float) (Display.getWidth() * Math.abs(Math.cos((Math.toRadians(gui.getRotation())))) + Display.getHeight() * Math.abs(Math.sin((Math.toRadians(gui.getRotation()))))),

but this does not work at all, my thought process was that if it is sideways it should use Display.getHeight to calculate the x size and if it is vertical it should use Display.getWidth. This does work for 0, 90, 180 and 270 degrees rotation, but in between it gets smaller and weird. Of course I've also done this for the x position but then cos and sin switched around.

video of this method

And this is the createTransformationMatrix method:

public static Matrix4f createTransformationMatrix(Vector2f translation, float rotation, Vector2f scale) {
    Matrix4f matrix = new Matrix4f();
    matrix.setIdentity();
    Matrix4f.translate(translation, matrix, matrix);
    Matrix4f.rotate((float) Math.toRadians(rotation), new Vector3f(0, 0, 1), matrix, matrix);
    Matrix4f.scale(new Vector3f(scale.x, scale.y, 1f), matrix, matrix);
    return matrix;
}

sentences:
How to implement Microwave Signals in Unity? I need to implement microwave signals for object detection in Unity.

I know there are raycast sensors in Unity, but can microwave signals be simulated or can a proxy of microwave signals be created in Unity using the raycast sensors?

sentences:
How to 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:
How do I balance skill/luck in a forum game? I am trying make a forum game where members of the forum can play daily, with role-playing elements, and tactical decisions. I've hosted werewolf games before, but I want this to be a little more involved. Mt new venture is a U-Boat game, where 10 members of the forum can sign up.  The game takes places in several phases, such as Patrol, Intercept, Attack, Evasion, Re-engage/Escape. In each phase the forum spits out some situations based on random numbers generated by the forum. The players make decisions and the results of their decisions advance the game to the next phase (or not).

For example: in the Patrol phase, the players basically roleplay, chat, and BS...entertain themselves. Each day the random number generator cranks out a number for contact. Let's say the RNG spits out a 90, which means enemy convoy spotted. (89 and less, no contact; 90 and up = contact).

The game moves to the Intercept phase, and the RNG spits out a number that tells the player the course of the convoy. In simple terms, the convoy can be moving away from the U-boat, parallel, towards, etc.

Here's where I need help: the players should make some kind of decision, such as "flank speed toward the convoy", "flank speed 45 degrees port" to intercept a convoy on a parallel course, etc. Now, how do I grade the decision?

How do I construct it so that the smarter/safer his choice, the better the results? Obviously, I cannot use the RNG for the outcome, there has to be some way to balance his skill in making a good decision.

Anyone have any ideas? I apologize if this is not the right place to ask this type of question.
thanks!
Neal

sentences: Including sprite file  for mobile games I'm making a simple online RPG for Android & IOS using HTML5 & Phonegap and was wondering: should I include sprite file with the game for downloads (because of bandwidth)? What should I do when I modify the sprite file in the future? (i.e. forced update).

sentences:
Procedural Generation of Infinite Level What are some good approaches to procedurally generating an infinite 2d level? The level could be constrained in either dimension but not necessarily.

The approach that makes most sense to me so far is using a grid-based radius. e.g. divide the play area into a grid with squares of a certain size and then load X squares in a radius around the player. Then when the player moves to another square build the next set and drop the farther (Persisting explored area is not necessary.) When a square is built, it contains a random arrangement of objects. When objects leave the outer ring of squares they are removed from the world. Are there better or different ways? Or if this is a good approach, what are potential issues?

For discussion's sake, you can think of the level as a top down asteroid field with power ups, etc scattered throughout.

sentences:
Categorize contact & overlap cases for 2D & 3D axis-aligned bounding boxes My question is similar to this one. I want to determine whether two axis-aligned boxes are not only intersecting, but if they are intersecting and just touching on one edge or face, or if they are overlapping in some way.

Below is an example of these two options.

sentences:
How do I pause and unpause gameobjects on is own in the scene without pressing keys in unity3d I can't get my gameobject to pause or unpause in the scene in Unity3d.
I need the game to pause for a couple of seconds maybe longer than unpause
 by itself. Here is my script :

using UnityEngine;
using System.Collections;

public class hu : MonoBehaviour {
GameObject[] pauseObjects;
public bool isPaused;
 void Start () {

 pauseObjects = GameObject.FindGameObjectsWithTag("Player");

 }

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

  {
   if(Time.timeScale == 1)
   {
    Time.timeScale = 7f;

   } else if (Time.timeScale == 8f){

    Time.timeScale = 1;

   }
 }
}
}

sentences:
How do I use UsePass in a shader in Unity when the pass does not have a name? I'm trying to use passes from a given built-in shader in Unity. The docs say that the syntax is UsePass "Name". The problem is that built-in shaders don't have names on their passes. How could I do that in this case?

To be more specific, at the moment I need to use the Skybox shader passes. Here is one of the Subshaders in the internal Skybox.shader file:

SubShader {
Tags { "Queue"="Background" "RenderType"="Background" }
Cull Off ZWrite Off Fog { Mode Off }
Color [_Tint]
Pass {
    SetTexture [_FrontTex] { combine texture +- primary, texture * primary }
}
Pass {
    SetTexture [_BackTex]  { combine texture +- primary, texture * primary }
}
Pass {
    SetTexture [_LeftTex]  { combine texture +- primary, texture * primary }
}
Pass {
    SetTexture [_RightTex] { combine texture +- primary, texture * primary }
}
Pass {
    SetTexture [_UpTex]    { combine texture +- primary, texture * primary }
}
Pass {
    SetTexture [_DownTex]  { combine texture +- primary, texture * primary }
}
}

As can be seen there's no name in the passes. My shader is the following:

Shader "Custom/Outline" {
Properties {
_Color ("Main Color", Color) = (.5,.5,.5,1)
    _OutlineColor ("Outline Color", Color) = (1,0,0,1)
    _Outline ("Outline width", Range (0.0, 0.1)) = .05
_SpecColor ("Specular Color", Color) = (0.5, 0.5, 0.5, 1)
_Shininess ("Shininess", Range (0.03, 1)) = 0.078125
_MainTex ("Base (RGB) Gloss (A)", 2D) = "white" {}
}

SubShader {
//Tags { "RenderType"="Opaque" }
Tags { "RenderType"="Background" }
Pass {
    Name "OUTLINE"
    Tags { "LightMode" = "Always" }

    // Outline pass logic (not important for the problem)...
}
UsePass "RenderFX/Skybox/..." // WHAT SHOULD I DO HERE?
//UsePass "Bumped Specular/FORWARD"
}

The problematic line is at the end, as can be seen. The shader works for the Opaque case, using the "Bumped Specular/FORWARD" pass (see the commented lines). The built-in Bumped Specular shader is the following:

Shader "Bumped Specular" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_SpecColor ("Specular Color", Color) = (0.5, 0.5, 0.5, 1)
_Shininess ("Shininess", Range (0.03, 1)) = 0.078125
_MainTex ("Base (RGB) Gloss (A)", 2D) = "white" {}
_BumpMap ("Normalmap", 2D) = "bump" {}
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 400

CGPROGRAM
#pragma surface surf BlinnPhong

sampler2D _MainTex;
sampler2D _BumpMap;
fixed4 _Color;
half _Shininess;

struct Input {
float2 uv_MainTex;
float2 uv_BumpMap;
};

void surf (Input IN, inout SurfaceOutput o) {
fixed4 tex = tex2D(_MainTex, IN.uv_MainTex);
o.Albedo = tex.rgb * _Color.rgb;
o.Gloss = tex.a;
o.Alpha = tex.a * _Color.a;
o.Specular = _Shininess;
o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
}
ENDCG
}

FallBack "Specular"
}

Even when using the Bumped Specular I had to find the pass name by trial and error, seeing code snippets from older versions, etc. That's why I like to have code for everything... I could just read the code of the shader management system and figure it out. Anyway... any ideas?

sentences:
Android OpenGL ES 2 framebuffer not working properly I'm trying to understand how framebuffers work. In order to achieve that, I want to draw a very basic triangle to a framebuffer texture and then draw the resulting texture to a quad on the default framebuffer.

However, I only get a fraction of the triangle like below. LE: The triangle's coordinates should be (1) -0.5f, -0.5f, 0 (2) 0.5f, -0.5f, 0 (3) 0, 0.5f, 0

Here's the code to render:

@Override
public void onDrawFrame(GL10 gl) {
    renderNormalStuff();
    renderFramebufferTexture();
}

protected void renderNormalStuff() {
    GLES20.glViewport(0, 0, texWidth, texHeight);
    GLUtils.updateProjectionMatrix(mProjectionMatrix, texWidth, texHeight);

    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, fbo[0]);

    GLES20.glUseProgram(mProgram);

    GLES20.glClearColor(.5f, .5f, .5f, 1);
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);

    Matrix.setIdentityM(mModelMatrix, 0);
    Matrix.multiplyMM(mMVPMatrix, 0, mViewMatrix, 0, mModelMatrix, 0);
    Matrix.multiplyMM(mMVPMatrix, 0, mProjectionMatrix, 0, mMVPMatrix, 0);

    GLES20.glUniformMatrix4fv(u_MVPMatrix, 1, false, mMVPMatrix, 0);

    GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, vbo[0]);
    GLES20.glVertexAttribPointer(a_Position, 3, GLES20.GL_FLOAT, false, 12, 0);

    GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, vbo[1]);
    GLES20.glVertexAttribPointer(a_Color, 4, GLES20.GL_FLOAT, false, 16, 0);

    GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, ibo[0]);
    GLES20.glDrawElements(GLES20.GL_TRIANGLES, indexBuffer.capacity(), GLES20.GL_UNSIGNED_BYTE, 0);

    GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);
    GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, 0);

    GLES20.glUseProgram(0);
}

private void renderFramebufferTexture() {
    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);

    GLES20.glUseProgram(fboProgram);

    GLES20.glClearColor(.0f, .5f, .25f, 1);
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);

    GLES20.glViewport(0, 0, width, height);

    GLUtils.updateProjectionMatrix(mProjectionMatrix, width, height);

    Matrix.setIdentityM(mModelMatrix, 0);
    Matrix.multiplyMM(mMVPMatrix, 0, mViewMatrix, 0, mModelMatrix, 0);
    Matrix.multiplyMM(mMVPMatrix, 0, mProjectionMatrix, 0, mMVPMatrix, 0);

    GLES20.glUniformMatrix4fv(fbo_u_MVPMatrix, 1, false, mMVPMatrix, 0);

    //draw the texture
    GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texture[0]);
    GLES20.glUniform1i(fbo_u_Texture, 0);

    GLUtils.sendBufferData(fbo_a_Position, 3, quadPositionBuffer);
    GLUtils.sendBufferData(fbo_a_TexCoordinate, 2, quadTexCoordinate);

    GLES20.glDrawElements(GLES20.GL_TRIANGLES, quadIndexBuffer.capacity(), GLES20.GL_UNSIGNED_BYTE, quadIndexBuffer);

    GLES20.glUseProgram(0);
}

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:
Camera Aligned To Sphere Surface I am writing a planet renderer and have come across a problem that is really limiting the usability of the program. When I am on the planet (anywhere but the north pole) I cannot rotate the camera to the left or to the right as I would if I was on a flat plane. Instead I can only move as if I were aligned to a regular flat plane. This gives me awkward viewing as seen here:

This limits me to only really looking straight ahead of the camera and straight behind the camera.

I drew this to try to illustrate the problem:

Will setting the up-vector of the camera to be the the point on the sphere where I am located normalized alleviate this problem?
I am at a dead-end here and any ideas would be greatly appreciated.
Thanks.

sentences:
Clip shadow frustum to scene bounds I have a global light in my scene. It casts shadows using shadow mapping and has an associated camera (for rendering to the shadow map). I'm going to refer to it as my "shadow camera" from now on.

I need to find a way to place my shadow camera's near plane as close as possible to my scene's bounding box (clip it to the scene bounds).
I need to do this so the shadow casters are never clipped by the shadow camera's near plane (otherwise I'd get holes inside of shadows) and to make sure I don't accidentally cull any shadow casters behind the camera. This would also allow me to increase the shadow mapping precision, because it lets me move the near and far planes closer together.

Example 1 (possible to do using a simple plane check):

Example 2 (NOT possible to do using a simple plane check):

The black box is the scene's AABB (but it would be nice if this would work for OBBs or other shapes too).
The yellow arrow represents the light direction.
The green box is the shadow camera's frustum without any modifications.
The red box is my desired result.

At the moment I'm constructing the red box by projecting the black box onto the global light's direction vector and use the closest vertex's distance to compute the shadow camera's near plane. But this makes it impossible to get something as seen in the 2nd image. Instead the red box starts above the scene's AABB.
I have thought of using SAT for this, but it doesn't seem to be the solution.

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:
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:
Make a game object move inside circle and bounce from walls without gravity I have a circle with a RigidBody2D and CircleCollider2D components on it.

I'm trying to make it move constantly inside a bigger circle without gravity involved, make it bounce off the circle walls like it has constant velocity but without any delays, same speed all the time.

Here is an example of the same behaviour but inside a rectangle:

I would like to do the same but inside a circle and detect the collision with the circle walls

Thanks in advance :)

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 would a game developer write their own engine instead of using existing ones? I have observed that many big and well-known game developers often develop their own engines. Examples include Valve, Crytek, Ubisoft, Epic Games and Square-Enix.

Could it simply be because they can, or is it likely that existing engines do not meet enough requirements, so we would develop our own? I can hardly imagine a game that requires a specific engine. The likes of of Unity or Unreal are simply enough to make any kind of game; even if not, they have source code, which can be modified to satisfy even some extraordinary needs.

Why would a game developer write their own engine instead of using existing ones?

sentences:
Is it possible to design a multiplayer game which can be played from different devices? I want to design a online multiplayer game for all gaming devices e.g. Desktop PC, Internet browser, Android phones, Android tablets, iPhone, iPad, XBOX 360 etc. Now my main requirement is that, I want all devices can be used to play the game in multiplayer mode together i.e. One player can be connected using PC another using Android phone and other may be with iPhone or iPad.

My doubts are:

How to make all devices to connect to common game server?
What will be the logic for graphics and texture because all devices screen will be of different aspect ratio?

sentences: How much extra power is required for a stereoscopic 3D game? If we use Cryengine 3 for game development and make the game 3D compatible. Because 3D sends out two pictures, will this mean that you need a computer with twice the "power"? So if you get 30 fps when playing normal you will need 60 fps for playing with 3D?

sentences:
How can I solve the "Unable to find back camera" error? I'm trying to run a script that will display video from my webcam on my computer, but when I run it the error unable to find back camera pops up.

My webcam is hooked up and working, so as my other script, but this one doesn't do what I need it to do.

How can I fix this?

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

public class MainCam : MonoBehaviour
{
    private bool camAvailable;
    private WebCamTexture backCam;
    private Texture defaultBackground;

    public RawImage background;
    public AspectRatioFitter fit;

    private void Start()
    {
        defaultBackground = background.texture;
        WebCamDevice[] devices = WebCamTexture.devices;

        if (devices.Length == 0)
        {
            Debug.Log("No camera detected");
            camAvailable = false;
            return;
        }

        for (int i = 0; i < devices.Length; i++)
        {
            if (!devices[i].isFrontFacing)
            {
                backCam = new WebCamTexture(devices[i].name, Screen.width, Screen.height);
            }
        }

        if (backCam == null)
        {
            Debug.Log("Unable to find back camera");
            return;
        }

        backCam.Play();
        background.texture = backCam;

        camAvailable = true;
    }

    private void Update()
    {
        if (!camAvailable)
            return;

        float ratio = (float)backCam.width / (float)backCam.height;
        fit.aspectRatio = ratio;

        float scaleY = backCam.videoVerticallyMirrored ? -1f: 1f;
        background.rectTransform.localScale = new Vector3(1f, scaleY, 1f);

        int orient = -backCam.videoRotationAngle;
        background.rectTransform.localEulerAngles = new Vector3(0, 0, orient);
    }
}

sentences:
Footstepper with Vr Unity I have the Footstepper: Complete Footstep Solution from the unity store, and i dont get it working with the Vr,
I made the footstep material like official documentation said, Then
i put the Footstepper Setup in the ovrPlayer object.
The problem is that sometimes sound the default fallback, so i think that the colission is not detected as it suppose.
Some idea ?

sentences:
snap an object to another object? so I have some walls which are cubes stretched along a direction.and I have some windows and doors that are suppose to snap to a wall and don't let go until the desired location is out of the snapping range.and in the meantime I want the Objects to move along the wall but never detach from it.

if I wasn't clear enough let me know.

sentences:
Blend different biomes using linear interpolation I've been scouring the internet for hours looking for a solution to blending biomes that have different amplitudes and frequencies together to create a seamless world. A recurring theme I'm seeing is that they have solved it by using linear or bilinear interpolation. I'm having trouble finding an implementation that would work for me.

Currently each biome is the same noise function but with adjusted frequencies and amplitudes to create variation. The problem is that it would result in "seams" between biomes, for example the plains and a mountains biome.

I think I understand how linear interpolation works. I have functions for it as well, but I'm confused as how to implement it. The game is essentially a 2D Minecraft type game. Would I have to determine the neighboring biomes by doing additional calculations across the x axis for every single block? I'm worried about performance if I somehow do this method.

I'm not sure if this would help but biomes are just determined using three instances of 1D noise, depth, temperature and rainfall. Depth is really just for oceans, but rainfall and temperature determine the biome. I have this basic setup (probably not the best code)

if(biome === 'desert') {
    frequency = 0.09;
    amplitude = 8;
    elevation = 65;
  } else if(biome === 'mountain') {
    frequency = 0.1;
    amplitude = 20;
    elevation = 65;
  } else if(biome === 'tundra') {
    frequency = 0.08;
    amplitude = 7;
    elevation = 65;
  } else if(biome === 'spruce') {
    frequency = 0.01;
    amplitude = 4;
    elevation = 65;
  } else if(biome === 'plains') {
    frequency = 0.08;
    amplitude = 8;
    elevation = 65;
  } else if(biome === 'forest') {
    frequency = 0.008;
    amplitude = 7;
    elevation = 65;
  } else if(biome === 'ocean') {
    frequency = 0.2;
    amplitude = 9;
    elevation = 30;
  } else if(biome === 'icy ocean') {
    frequency = 0.2;
    amplitude = 9;
    elevation = 30;
  }

  var height =
  (this.biome.noise.terrain.value(xt * frequency) * amplitude) + elevation;

sentences:
How can I store my 2D map in JAVA? I'm working on a 2d adventure game where the player can explore a random generated map. It's working perfectly if I set it to be about 3000x1000 blocks (my array is 3000x1000x2), but this is TOO SMALL. When I want to make a bigger map it trows an OutOfMemory error.

I store my map in a 3d float array where the first two dim shows the position on the world plus I need 2 more data (3rd dim) for each block the type (int blockID) and the stored last update time (float elapsedTime).

Can it be better if I make it 2 separeted 2d array?

This 3d array is the one what is too big and trows OutOfMemory error. The blocks that have made Objects are the ones that can be seen(~32x14 block) the other are just two number ID and elapsedTime.

How should I store the map data?

EDIT:

This code:

   int x = 10000;
   int y = 10000;
   float[][][] ft;
   ft = new float[x][y][2];

It trows OutOfMemory error.

sentences:
Server-client communication: Quick and verbose or involved and compact? TL;DR: Does the short development time required for HTTP/XML offset its size issues compared to developing a custom protocol?

As some of you might have divined; I'm currently working on a turn-based strategy game of the massively multiplayeriffic variety. The target turn-length is anywhere from 6 hours and up, so synchronization will be, on the whole, a bit easier than, say, an FPS or an MMORPG.

The issue then, is how the clients connect to the server. As I see it, I have basically two options: HTTP using some manner of XML exchange, or direct socket communication using some arcane protocol.

Because casual gaming is the "big thing" nowadays; the idea is that the game will be the sort of game where you can pick it up, play for 5 or 10 minutes, and then put it down and come back the day after; an approach that would greatly benefit from having the communication be stateless (as in HTTP).

On the other hand, target devices include the iPad and (perhaps) other mobile devices down the road; any protocol used would probably benefit greatly from being compact, if not so much for the speed (see above), but more in order to not cost the user everything he has if he plays on the road using cellular data networks.

On the gripping hand; using HTTP as the basic communication protocol greatly facilitates the creation of a web-based client.

All of this leaves me, as far as I can see, anyway, with 3 options:

XML over HTTP: A bit of bloat, but easy to implement in all cases.
Custom protocol: Allows for a very streamlined protocol, but trickier to implement.
All of the above: Small protocol for application clients; big protocol for web clients, increases implementation complexity and maintenance time required geometrically.

Does the short development time required for HTTP/XML offset its size issues compared to developing a custom protocol?

sentences:
What concepts are used to procedurally generate video game content using music like in Audiosurf, Beat Hazard & Symphony? I'm curious as to how video games like Audiosurf, Beat Hazard and Symphony procedurally generate content using music. What are the common concepts used to accomplish this? And in what way is the music read and interpreted into data that can be used in the game?

Also, I plan on using Java, so if there are any Java-specific information anyone can share, that would be greatly appreciated.

sentences:
How do I point with my straight line the point that moves in the figure "infinite" / "8"? I need a help for my project.

Given a straight line "a" - "b"
I have "a" point anchored and "b" can move.
I need to make sure that the "b" point of the straight line always points to the "c" point, taking into consideration that "a" is anchored.

I can not use the LookAt () because I need to be able to use the mouse too.

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: Different Screen Sizes and Camera in Unity Now I know that no matter what the screen size is the camera will keep its height, so no worries about that. My question is, is there a way to manipulate the camera, either its orthographic size, or its viewport rect width, height, x or y so that the camera will fit perfectly on different screen resolutions. I know this a perfect solution for supporting different screens problem but how do other games do that? I mean I took some games from google play like bunny skater, or stick hero, those games look the same on Huawei P6 which has 1280x720 resoltuion, on Prestigio Multipad 4 which has 1024x768 and on HP Slate 7 which has 1024 x 600 resultion, now my question is how do they do that? I think the closest solution to this is to manipulate viewport rect of the camera, I'm saying this because I found a script that does so but it leaves black bars on top and bottom, the game looks the same on every device though but as I said it leaves black bars on top and bottom, so is there a solution on how to do this?

sentences:
Using std::threads to optimize drawing I'm currently developing a 3D game with its own engine. I have some performance issues in the function that orders all the draw events and sends them to the GPU. I've heard about threads, and I thought that it could be nice if I could pass that code to another thread.
The structure is something like:

Global function that receives all events and calls OpenGL to draw

void DrawAll(float dt, vector<draw_events>)

Function inside the EventSystem, that calls the previous function

Events passed by copy, that have pointers to objects in the scene  (scene is in main thread)

void ModuleEventSystem::PostUpdate(float dt)
{
   DrawAll(dt, draw_events);
}

This has been tested, and has worked well.

Now I have inside:

std::thread draw_thread;
void ModuleEventSystem::PostUpdate(float dt)
{
   if(draw_thread.IsJoinable())
         draw_thread.Join();

   draw_thread = std::thread(DrawAll, dt, events_to_draw);
}

The problem: not only the performance as become worse, objects in scene doesn't draw at all.
I have never worked on threads before, so I don't know if the issue is having a thread with OpenGl calls and pointers pointing to objects in the main thread, or is the bad structure of code... Or even if this kind of optimization is not possible at all.
Thank all of you.

sentences:
Unity3D Drag Object with Mouse Gives Invalid Position I am trying to implement a simple script to drag a GameObject with the mouse in Unity.
However, when the position of the object is updated with the following script, I get an error saying:

transform.position assign attempt for 'purpie_5' is not valid. Input position is { Infinity, 51351759646418134000000000000000.000000, -143589927261340110000000000000000000000.000000 }.
UnityEngine.Transform:set_position(Vector3)

I am not sure what I am doing wrong. This is the code I am using:

public class MouseInputInterface : MonoBehaviour {

#region PUBLIC MEMBERS
public Transform heldObject;
#endregion //PUBLIC MEMBERS

#region PRIVATE MEMBERS
private GameObject currTarget;
private Vector3 touchOffset;
private bool dragging = false;
#endregion //PRIVATE MEMBERS

// Use this for initialization
void Start ()
{

}

    void Update()
    {
    if(Input.GetMouseButton(0))
    {
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        if(Physics.Raycast(ray,out rHit))
        {

            currTarget = rHit.transform.gameObject;

            if(currTarget != null)
            {
                if(!dragging && currTarget.transform.tag == "Moveable")
                {
                    dragging = true;
                    heldObject = currTarget.transform;
                }

            }

        }

        if(heldObject != null)
        {
            /*calculate offset*/
            Vector3 screenPoint = Camera.main.WorldToScreenPoint(heldObject.position);

            /*calculate offset from camera*/
            Vector3 offset = heldObject.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));

            //form the current position
            Vector3 curPosition = Camera.main.ScreenToWorldPoint(screenPoint) + offset;

            heldObject.transform.position = curPosition;
        }
    }
    else if(Input.GetMouseButtonUp(0))
    {
        //clear held object
        heldObject = null;
        //clear flag
        dragging = false;
    }

    }
}

Thanks for the help.

sentences:
What is the integrator used in PhysX? What type of integrator is used in the PhysX engine? Euler? Runge-Kutta?

I tried to look through the comments in the SDK header and source files. But, could not find any information about this.

sentences:
How to create pixel graphics in 3D? I stumbled across this game on itch.io: Backland
After trying to find information on how to accomplish the same graphics, I found this tutorial: Youtube Video

How can I accomplish this 3-dimensional, pixelated look in a game?

Other possibly relevant information:
I have been using the Godot engine, but I would appreciate information that can be used anywhere
I am well versed in programming, but I am new to everything else related to game development

sentences:
Creating several instances of the same object, and selecting only one I'm playing around with making a puzzle game, haven't done that much before I run into my first problem. I want to create a certain amount of the same object/function. But without hardcoding the different instances.

I think maybe an array is a good idea? and then a for loop to push the objects in? Then I need to be able to select one of these objects by clicking on it, how would I do that? How do I know which ball in the array was clicked? A loop again?

I made a jsFiddle example (you need to click the orange ball to select, then you can move it around by clicking the canvas). This is what I want to do, but with more balls. How would you solve this?

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: How to build a game for linux in unity I made a game and uploaded it to a game site. I exported the build as windows mac OS and Linux. My thinking was that it supported all of those platforms but i guess not. Someone commented saying that the game didn't support linux. I have no idea why since it said it built for mac and windows and linux. Do i have to change settings? If so were? if its target platform i cant because the only option is windows.

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:
Min/Max of two vectors? This seems like a simple question, but i'm having trouble searching the internet for it.

In XNA, during a collision detecting method, I would determin the minimum of some vectors.

// Get the minimum top point
Vector2 minTopPoint1 = Vector2.Min(topLeft1, topRight1);
// Get the minimum bottom point
Vector2 minBottomPoint1 = Vector2.Min(bottomLeft1, bottomRight1);
// Get the minimum of both the top and bottom points.
Vector2 minPoint1 = Vector2.Min(minTopPoint1, minBottomPoint1);

I switched over to making a C++ engine, and am trying to replicate the collision formula (Honestly, it's confusing enough, I just need to replicate it from XNA)
I made my own Vector2, and now I need to make this Min function.

So, what is the minimum or maximum of two vectors?
Is it just the magnitude of the two vectors measured against eatchother?
Is it the x and y values min/maxed somehow?

sentences:
Optimal number of work groups for compute shaders In OpenGL, is there a way to dynamically determine the preferred workgroup size of the underlying hardware? Or at least, to approximate it using some queried metrics?

In OpenCL, you can do this using some implementation defined constants, but so far I wasn't able to find something similar for OpenGL.

sentences:
How do I create a camera? I am trying to create a generic camera class for a game engine, which works for different types of cameras (Orbital, GDoF, FPS), but I have no idea how to go about it.

I have read about quaternions and matrices, but I do not understand how to implement it. Particularly, it seems you need "Up", "Forward" and "Right" vectors, a Quaternion for rotations, and View and Projection matrices.

For example, an FPS camera only rotates around the World Y and the Right Axis of the camera; the 6DoF rotates always around its own axis, and the orbital is just translating for a set distance and making it look always at a fixed target point.

The concepts are there; implementing this is not trivial for me.

SharpDX seems to have has already Matrices and Quaternions implemented, but I don't know how to use them to create a camera.

Can anyone point me on what am I missing, what I got wrong?

I would really enjoy if you could give a tutorial, some piece of code, or just plain explanation of the concepts.

sentences:
Port a WP7 game to WP8 with Monogame I have a full working game for WP7, I want to port it to WP8 with Monogame. I have installed Monogame and I have done all tests to see that it is working inside Visual Studio Express 2012 for Windows Phone 8. Now I just don't understand how to rebuild my WP7 version game within a Monogame project to target WP8 devices.

So, if you would have the entire solution of a WP7 game, how would you make it work on WP8 with Monogame?

Thanks!

sentences:
Omni-directional shadow mapping What is a good/the best way to fill a cube map with depth values that are going to give me the least amount of trouble with floating point imprecision?

To get up and running I'm just writing the raw depth to the buffer, as you can imagine it's pretty terrible - I need to to improve it, but I'm not sure how.

A few tutorials on directional lights divide the depth by W and store the Z/W value in the cube map - How would I perform the depth comparison in my shadow mapping step?

The nvidia article here http://http.developer.nvidia.com/GPUGems/gpugems_ch12.html appears to do something completely different and use the dot of the light vector, presumably to counter the depth precision worsening over distance? He also scales the geometry so that it fits into the range -.5 +.5 - The article looks a bit dated, though - is this technique still reasonable?

Shader code http://pastebin.com/kNBzX4xU

Screenshot http://imgur.com/54wFI

sentences: How can I minimise data sent through a network in a modern FPS? I am aware of snapshot interpolation with the use of delta compression as being a technique used to minimise the amount of data sent in a modern FPS game like Quake 3, but what other techniques are there?

sentences:
OpenGL managing many textures smoothly I'm working on a game right now and running into some noticeable performance issues and limitations.

Basically, I have this:

A few QGLWidgets, all sharing contexts with eachother (probably irrelevant that I'm using Qt [also: Windows, fwiw]).
About 216000 total frames of 128x128 videos (with alpha, internal format GL_RGBA, data format GL_BGRA/GL_UNSIGNED_INT_8_8_8_8_REV, video codec is Quicktime RLE, decoded with libav), spread into approximately 120 videos of 1800 frame average length. This translates to roughly 216000*128*128*4 = 14.2 GB of raw data, not including overhead.

The game behaves as follows:

There are many "modes". At any given time only one mode is active. Each mode uses a very small known subset of the available videos, say 5-10 videos (= about 9000 - 18000 frames) tops.
There's a bunch of 2D quads flying around the screen, each displaying whatever videos depending on the current mode. Objects don't all display the same frame, the video time offsets are random. The videos loop.
Every few minutes, the mode changes. Objects cross-fade to their new videos, so there is some overlap regarding when various sets of videos are needed.
It is critical that this thing keep running smoothly, at 60 FPS, with no pauses for loading, etc.

My problem is this:

My initial approach was to simply preload all videos off the disk and into textures, in video memory (via glTexImage2D and friends). I didn't mind the slow startup. This worked great early on, when I didn't have a lot of videos. The game could run smoothly because all the textures were already loaded.

Now I have too many videos. I'm becoming extremely limited by available video memory, and the preload-everything strategy is no longer working. I haven't become limited by system memory yet but that's also inevitable. I suspected this was going to be an issue and kept my fingers crossed, but alas. I hit the limit way sooner than I expected.

I tried switching to a strategy where, every time a mode transition started I pre-loaded the videos for that mode (and every time a transition ended I unloaded the videos for the previous mode). This works as far as memory goes but it pauses everything for a very long time while loading (as in 3-8 seconds depending on the number of videos and the graphics hardware).

I've done the best searching that I know how to do, all of the texture memory management posts, blogs, tutorials etc. just talk about the basic technique of creating and destroying textures, rather than strategies for managing large numbers of them in an application. I went through every question in the auto-search on here that had a relevant-looking title. I did find out that OpenGL is definitely not thread-safe, which kind of kills my asynchronous background loading idea, unless there's some other way to implement that.

So my question is: What's a good strategy to use for swapping out tons of textures (200000+, 128x128 typical size) when at any given time only a small portion of those are needed, while maintaining a smooth frame rate? How is this typically done?

sentences:
sharing preferences between two apps on android with libgdx I am making an android game with both a demo version and a paid version. I want users who decide to buy the paid version to continue from where they left off, with all their old data and settings.

I've set a shared user id between both applications, and now I'm wondering if it's possible to use libgdx preferences across both versions.

I am also open to other ideas on how to implement this.

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:
Function call to AndroidJabaObject to an instance of com.prime31.PlayGameServicesPlugin causes the application to stop responding Using Prime31 PlayGameServices attempting to call 'authenticate' causes the game to stop responding very soon after.

There isn't much I can show as there's literally no logs showing up in logcat.

Is there any way I can debug this?

I did notice 'enableDebugPrints' on the AndroidJavaObject was 'false' and I don't know how to set it to true, which might help with prints?

I've tried catching an exception but that hasn't worked.

sentences:
HTML5 Multiplayer movement I'm making a 2d multiplayer html5 game that needs client-side movement, collision etc.

Client sends active cursors to the server (w,a,s,d), server updates cursors on all clients and clients handles movement for each other. Every client sends server it's x,y every 100ms and server updates sender's x,y on all clients.

It works perfectly if player's latency is <1ms but even if player has 40ms latency everything seems like teleporting.

How can i make everything smooth without handling movement on the server? (like transformice.com do)

Sorry for my grammar.

sentences:
Line segment / circle intersection - X value seems wrong? Major Edit

I'm making a Breakout clone, and having difficulty with collision detection between a circle and line segment.

Apologies, my earlier question was a result of frustration and no sleep :)

Having read this post on collision detection I've re-written my collision code to the following:

    // Takes 2 points on a line, a circle centre, and a circle radius
    // Returns true is collision, false otherwise
    public Boolean DoesCollide(Vector2 a, Vector2 b, Vector2 c, float rad)
    {
        // First up, let's normalise our vectors so the circle is on the origin
        Vector2 normA = a - c;
        Vector2 normB = b - c;

        Vector2 d = normB - normA;

        // Want to solve as a quadratic equation, need 'a','b','c' components
        float aa = Vector2.Dot(d, d);
        float bb = 2 * (Vector2.Dot(normA, d));
        float cc = Vector2.Dot(normA,normA)-(rad*rad);

        // Get determinant to see if LINE intersects
        double deter = Math.Pow(bb, 2.0) - 4 * aa * cc;
        if (deter > 0)
        {
            // Get t values (solve equation) to see if LINE SEGMENT intersects
            double t = (-bb - Math.Sqrt(deter)) / (2 * aa);
            double t2 = (-bb + Math.Sqrt(deter)) / (2 * aa);
            Boolean match = false;

            if (0.0 <= t && t <= 1.0)
            {
                // Interpolate to get collision point
                Vector2 collisionPoint = c + Vector2.Lerp(normA, normB, (float)t);
                match = true;
            }
            if (0.0 <= t2 && t2 <= 1.0)
            {
                Vector2 collisionPoint2 = c + Vector2.Lerp(normA, normB, (float)t2);
                match = true;
            }
            return match;
        }
        else
            return false;
    }

However, I'm getting strange results for the X components of the collision points found 'on hit' - see the following debug output:

Coll at {X:1033.931 Y:620}, t1 = 0.203759334390812, Normalised = {X:0.8576241    Y:0.5142772}
Coll2 at {X:1052.069 Y:620}, t2 = 0.409877029245551, Normalised = {X:0.8615275 Y:0.5077109}
Circ cent = {X:1043 Y:610}, rad = 13.5

As you can see, the X components are 10px either side of the circle centre, but the Y component (620) is the very topmost pixel of the top of the Breakout paddle. Surely here the X points can't be 20 pixels apart, given the location of the Y point?

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 to set up a key press to start the game I've tried to create a simple start menu for my game which informs the player to press a key to start the game but the problem is that it works only if the key is pressed all the time...i'm not sure what would be the right way to deal with this.
Here is my code:

   if (Game.keysPressed[KeyBindings.S]) {

        if (game.livesLeft != 0) {
            game.createEnemies();
            game.update();
            game.draw();
            requestAnimationFrame(game.gameLoop);
        }
        if (game.livesLeft == 0) {
            game.drawLostGame();
        }
    }

Basically if the S key is pressed the game works, but when you release the key Game.keysPressed[KeyBindings.S] becomes false and the if statement won't be executed anymore, so that's why i need to find a way that by pressing only once the if statement will be executed until the player loses.
I've tried with while(true) and similar things but it didn't work.
Help would be appreciated! Thanks

sentences:
How can I manually syncronize render calls with a monitor's refresh rate in Direct3D 9? I have an application that utilizes Direct3D 9 to render 3D graphics. I'm trying to manually control the number of frames rendered in a given second. Here is pseudocode:

while( bInGame )
{
    // handle window stuff
    dispatchEvents();

    // handle d3d9 stuff
    if( !windowMessages )
    {
        // process animation
        OnD3D9FrameMove(GetElapsedTime());

        // when work is done render a frame (30 frames per second)
        while(GetElapsedTime() < 0.03333333f){ Thread.Sleep(1); }
    }
}

The above code is very rough but explains what I'm trying to do. I want to allow time between frames to process work( i.e. visibility, animation, etc. ). The actual code works well except for one problem. Screen anomalies occur due to rendering frames out of sync with the screen's refresh rate. The anomalies are best described as horizontal tearing, an undesirable result.

When I activate vsync while using this code the screen anomalies do not appear. However, I can't use vsync because it prevents my game loop from continuing until the frame is rendered and thus consumes the spare time that I would like to set aside for work.

How can I get around this problem? I would like to sync with the monitor using my application rather than the Direct3D API. This way I can control the work flow...Any ideas?

sentences:
Encapsulating Box2D C++ two virtually the same functions I have two functions that are virtually the same with a few small differences in code, one to create a static body and one to create a dynamic body, however if I call both of them it results in a segmentation fault, but I'm not quite sure why as far as I know I'm not trying to redefine any objects (other than bbox which is a box2d * body).

I've tried debugging it it appears the issue is caused by b2FixtureDef but I again Don't know exactly what it is, From looking at the memory somewhere there is an allocation issue as 0xfeeefeee shows up in a dump of the registers.

as long as I only use one its fine but when I use two or more it crashes.
if someone could point me in the right direction ( the code is valid 0 errors and 0 warnings so I'm not looking for handouts )

void entity::setAsPlatform(float hx, float hy, b2World world)
{
   b2BodyDef platformDef;
   platformDef.position.Set(bbox_pos.x,bbox_pos.y);
   b2Body * platform = world.CreateBody(&platformDef);
   b2PolygonShape platformShape;
   platformShape.SetAsBox(hx, hy);
   b2FixtureDef platformFixture;
   platformFixture.shape = &platformShape;
   platform->CreateFixture(&platformFixture);
   bbox = platform;
}

void entity::setAsPlayer(float hx, float hy, b2World world)
{
   b2BodyDef platformDef;
   platformDef.position.Set(bbox_pos.x,bbox_pos.y);
   platformDef.type = b2_dynamicBody;
   b2Body * platform = world.CreateBody(&platformDef);
   b2PolygonShape platformShape;
   platformShape.SetAsBox(hx, hy);
   b2FixtureDef platformFixture;
   platformFixture.shape = &platformShape;
   platform->CreateFixture(&platformFixture);
   bbox = platform;
 }

and in main.cpp

entity platform("Platform", 20, 500);
platform.setAsPlatform(2.0f, 50.0f, world);

entity player("Player", 0, 20);
player.setAsPlayer(1.0f,1.0f,world);

sentences: Pass parameters from html page to start() function in unity3D webplayer application I want to pass a parameter from web browser to Unity3D web player as soon as it is loaded. I know that, as soon as the web-player is loaded, the start() function is execute inside web-player. So I want to pass parameter from  web browser to this start() function.

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: Real Time Physics Based Mesh Deformation I'm working on a game through unity that draws one of is essential elements from traditional tool forging techniques for building tools and such. I want the feel of the game to be able to create a tool that is truly yours and slowly make it better in both design and functionality over time. One major thing I cant't seem to figure out is to be able to take a mesh (in this case a hot piece of meta) and deform it in such a way that you aren't loosing any of the mesh, its just being shifted slightly with each hit of a hammer (or in my testing case click of a mouse). I have looked all over youtube and various forums and I can't seem to find an efficient way of going about it. Any thoughts?

sentences:
Where will my character stop? Many years ago I coded some AI for a budget pseudo-3d game. There was one calculation which I never really figured out the best way to do, and that was calculating where the enemy would end up if it stopped now. For example:

The enemy is currently at X = 540.0.
The enemy is moving right at 10 pixels per frame.
When the enemy wants to stop, it's speed will drop by 1 pixel per frame until it reaches zero.

Is there a simple formula that would get me the position where the enemy ends up when he is fully stopped? I ended up precalculating and hardcoding the offset which worked for my needs but would have to be calculated separately for enemies with different speeds.

sentences: How do I get the axes for SAT collision detection In SAT collision detection how do I calculate the axes for projection?

sentences:
Does client side prediction sync with the server in the past? I've spent some time now messing around and just trying to learn dead reckoning and client side prediction for the fun of it.  Most of what I do doesn't need it, so i've never had a need to go down the path.

I get how to predict the client and i've got a completely deterministic setup with a lockstep of 60fps for the physics on client and server.  Both client and server use the same movement code, and i'm using constant velocity to reduce complexity.  I also understand how to interpolate for corrections.  I also have the server and client ticking at nearly the same time (as close as one can really get it).

The problem i'm having, that doesn't seem clear to me in anything I've read (i'll put links at the end to a few things), is what does the client message sync against on the server? So, for example, the client is at 0, 0, 0, with a heading of 0, 0, 1 at tick 0.  At tick 5 the client presses the button to start moving forward at 40u/s and sends the message to the server.  We'll say that the trip to the server takes 50ms and 50ms back.  So the server gets the message at tick 8 (roughly), and here is where I am slightly lost.

The client sent the tick they pressed the button along with the position and new velocity.  Does the server do:

A. Look back at tick 5 and say "you're good b/c you were where you
should be at that tick"
B. Check against tick 8 and say "well you where at 0, 0, 0 at tick 8,
so you didn't start moving until then".

It would seem with B, which is what i'm currently doing, that the server is always sending back a correction.  B also has a bad side affect that when I stop, I'm almost never where the server is and the interpolation of this feels impossible to get right.

While with A, it would seem I have to redo all collisions for that object from tick 5 thru 8 on the server, but this sends less corrections and would give a smoother feel.  I understand that A is used for lag compensation when firing a weapon or taking some action that would affect other entities, but is that also used for motion?

Things I've read:
http://gafferongames.com/
http://www.gabrielgambetta.com/fpm1.html
Various articles out of books and other websites that seem to skip past this detail

Thanks in advance for any help.

sentences:
Deploying GWT application / LibGDX and TextureAtlas problem I encountered with a little problem. After GWT (and LibGDX) deployment I got an error:

  GwtApplication: exception: Couldn't load image '/images/objects.png',
  file does not exist Couldn't load image '/images/objects.png', file
  does not exist

This error throws when TextureAtlas tries to load the image from settings.text file:

  images/objects.png
  format: RGBA8888
  filter: Nearest,Nearest
  repeat: none
  hills
  rotate: false
  xy: 0, 0
  size: 1024, 146
  orig: 1024, 146
  offset: 0, 0
  index: -1

I tried to use any type of path

"/assets/images/object.png"
"/clutchkick/assets/images/object.png"
"/public_html/clutchkick/assets/images/object.png"
and so on..

Any suggestions?

By the way there are no any problems on android or desktop deployment.

EDIT:
The same problem occurs when trying to load a Tmx map.

sentences:
Smooth path/direct movement I have a tile based isometric map and an A* algorithm that returns a path. I am looking to smooth this path efficiently but with good aesthetics. Basically i am using my grid for building the map and pathfinding but i want the player, enemies and certain types of objects to be detached from this grid.

I can think of a line of sight implementation where i start at the first tile of the path, from there check each further tile if i have a clear path straight to it. And repeat from there.

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:
Does the quality of a video card connected to a monitor used in play mode with Unreal Engine matter? I have 3 video cards:

inferior onboard vga (not connected to a monitor)
inferior discreate vga (connected to a secondary monitor)
superior discreate vga  (connected to a primary monitor)

When using Unreal Engine in play mode, should the play window be viewed on the   monitor connected to superior vga?

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:
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 does skin width work in Unity's CharacterController? I'm trying to write my own character controller and I want to understand how Unity's works. I think what it does is this: at each fixed update it takes the smaller collider reduced by the skin width, casts it forward to see where it hits something, then moves the character forward so that the full size collider touches that point. So my first question is is that right, am I missing an important step?
My next question is how does Physics.SphereCast work? What subroutines and geometric algorithms are involved? Every Collider has the methods Raycast, ClosestPoint, and ClosestPointOnBounds, so does Physics.SphereCast just use some combination of those functions for each Collider, or is there more math involved on top of that? And are sphere casting and capsule casting the main geometric algorithms used by the character controller, or are there others I should be aware of?

sentences:
DirectX Bullet Tracer Effect I'm wondering if anyone knows some common and efficient ways to do a fast tracer for an instant bullet.

I've seen people speak on forums of using primitive lines with DirectX, but I doubt this is up to "Commercial" standards. I also thought of using some sort of minimal prism geometry encompassing the line and using a shader but even then, I'm not sure how to give it that nice glow and fade.
I'm obviously not looking for any code in specific, just some ideas in general.

Thanks,
Joey

sentences:
Drawing a deferred decal when the camera clips its bounding geometry I have a building grid effect that I decal onto my terrain using a cube that moves to follow the cursor.

You can see if the camera gets too close to the cube, it gets clipped by the camera's near plane:

See the clipping just starting here:

I'd like to find a solution to this as the camera may be this low to the ground or lower upwards of 50% of the time during gameplay. (the rest of the time you would use the view from above, as illustrated by the clip I provided).
Is there any way to solve this problem?
I'd like to correctly render the cube's shader despite/while clipping with the camera.
is this possible and how?
.
.
.
EDIT & UPDATE :

I'm implementing camera-to-cubemesh clipping detection and already having issues :
public class Grid : MonoBehaviour
{
    #region
    [Header("First point to Camera Controller")]
    [SerializeField]
    public CameraController CameraController;
    MeshRenderer constructionGrid;
    private Camera cam;

    private void Start()
    {
        cam = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<UnityEngine.Camera>();
        constructionGrid = GameObject.FindGameObjectWithTag("GridViewer").GetComponent<MeshRenderer>();
    }

    void Update()
    {
        Plane[] frustumPlanes = GeometryUtility.CalculateFrustumPlanes(cam);
        if (GeometryUtility.TestPlanesAABB(frustumPlanes, constructionGrid.bounds))
        {
            Debug.Log("Clipping");
        }
        else
        {
            Debug.Log("Not");
        }
    }

This always logs "Cliping" whether clipping or not.
If I add a meshCollider to the shadercube the same happens but the shadercube jitters all over the place.
I can't figure out clipping detection.

sentences:
Unity: How to receive input events on a RectTransform that does not contain any image/text/...? In Unity 2018.3: Imagine a GameObject with only a RectTransform component and a custom script attached to it - otherwise completely empty. Is there a way to receive input events (like IPointerClickHandler.OnPointerClick) without adding any graphical GUI components like text/image/rawimage/etc. ?

In other words: Is there a component or superclass available to receive input events without adding an unused graphical component?

Any clarifications are welcome,
Thank you.

sentences:
What is the appropriate way to implement collision in 2D worlds? If I want to create a 2D game map which features areas traversable by a player through standard up/down/left/right inputs, and then have areas that are NOT traversable... perhaps just a bush, or a sign post, or a rock.

What is the appropriate agent to enforce these rules?

It seems like the trendy thing is to ship off these responsibilities to Box2D, but that seems wrong to me. Is there a technique with lower overhead to produce the same effect? Is it as simple as inventorying and enumerating through every rock and making sure the player can or cannot walk to the space they are trying to walk to? That's how I am doing it now.

sentences:
How to calculate the stopping distance of a wheel collider? I have an 'AI' bus in my game that needs to pull over occasionally at a bus stop. What I want to do is change the acceleration and brake force based on the stopping distance of the bus. I don't want to simply use the distance between the bus stop and the bus because each time the bus pulls over, it could be traveling at a different speed.

Right now it uses the distance between the bus stop and the bus. It doesn't really work well though because if a bus is traveling faster, it will take a longer distance to stop and will likely go past the bus stop. Same thing if it were going slower.

How do I calculate the stopping distance my bus will take to come to a complete stop?

sentences:
how to do partial updates in OpenGL? It is general wisdom that you redraw the entire viewport on each frame.

I would like to use partial updates; what are the various ways can do that, and what are their pros, cons and relative performance?

(Using textures, FBOs, the accumulator buffer, any kind of scissors that can affect swapbuffers etc?)

A scenario: a scene with a fair few thousand visible trees; although the textures are mipmapped and they are drawn via VBOs roughly front-to-back with so on, its still a lot of polys.  Would streaming a single screen-sized texture be better than throwing them at the screen every frame?  You'd have to redraw and recapture them only on camera movement or as often as your wind model updates or whatever, which need not be every frame.

sentences:
Moving an image by rotating and increasing y axis causes a trailing issue Forgive me if me anything is unclear, this is a tricky thing for me to explain.

In an applet I draw a little ship gif. I have it so I can rotate the object and then increase or decrease the y axis to move the little guy around the screen. The problem it seems is that the coordinates for the ship are not in sync with those of the applet window?

For example: the boundaries for my applet window are 800 by 600. I move the ship by rotating it and then increasing or decreasing the y axis, but whenever the Y axis is exceeds 600 or is lower than 0 I get this weird trailing issue. Am I doing buffering right?

here are my "Main" and "ship" classes:

Main class:

    public class Main extends Applet implements Runnable, KeyListener
{
    ship player1;
    private Image i;
    private Graphics buffer;
    AffineTransform affineTransform = new AffineTransform();

    public void init()
    {
        this.setSize(800, 600);
        this.setBackground(Color.BLACK);
        addKeyListener(this);
    }

    @Override
    public void start() {
        player1 = new ship();
        Thread thread = new Thread(this);
        thread.start();
    }

    @Override
    public void paint (Graphics g){
        Graphics2D g2d=(Graphics2D)g;
        player1.paint(g2d, this);
    }

    @Override
    public void update(Graphics g){
        Graphics2D g2d=(Graphics2D)g;
        if(i == null){
            i = createImage(this.getSize().width, this.getSize().height);
            buffer = i.getGraphics();
        }
        buffer.setColor(getBackground());
        buffer.fillRect(0, 0, this.getWidth(), this.getHeight());
        buffer.setColor(getForeground());
        paint(buffer);
        g2d.drawImage(i, 0, 0, this);
    }

    @Override
    public void keyPressed(KeyEvent e) {
        switch(e.getKeyCode()){
        case KeyEvent.VK_RIGHT:
            player1.rotateRight();
            break;
        case KeyEvent.VK_LEFT:
            player1.rotateLeft();
            break;
        case KeyEvent.VK_UP:
            player1.moveUp();
            break;
        case KeyEvent.VK_DOWN:
            player1.moveDown(this);
            break;
        }
    }

    @Override
    public void keyReleased(KeyEvent e) {
    }
    @Override
    public void keyTyped(KeyEvent e) {
    }

    @Override
    public void run() {
        while(true){
            repaint();
            try {
                Thread.sleep(17);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}

ship class:

    public class ship {
    private Image sprite_ship;
    //private Image ship_engines_green;
    private int x = 300;
    private int y = 500;
    //private int dx = 10;
    private int dy = 10;
    private int my = 0;
    AffineTransform affineTransform = new AffineTransform();
    double rotation;

    public ship() {
        sprite_ship = Toolkit.getDefaultToolkit().getImage("ship.gif");
        //ship_engines_green = Toolkit.getDefaultToolkit().getImage("ship_engines_green.gif");
    }

    public void moveDown(Main M){
        y += dy;
        System.out.println("Y axis: "+y);
        System.out.println("X axis: "+x);
    }

public void moveUp(){
        y -= dy;
        System.out.println("Y axis: "+y);
        System.out.println("X axis: "+x);
    }

public void rotateRight(){
    rotation += 5;
    System.out.println("Rotation : "+rotation);
}
public void rotateLeft(){
    rotation -= 5;
    System.out.println("Rotation : "+rotation);
}
    public void paint(Graphics g, Main M){
        int spriteHeight = sprite_ship.getHeight(null);
        int spriteWidth = sprite_ship.getWidth(null);
        Graphics2D g2d=(Graphics2D)g;
        affineTransform = g2d.getTransform();
        g2d.rotate(Math.toRadians(rotation), x+spriteWidth/2, y+spriteHeight/2);
        g2d.drawImage(sprite_ship,x,y,M);
        rotation = 0;
    }
}

much thanks for any suggestions or if anyone can point out something I'm doing that's terribly misguided.

sentences:
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: Loading files while running game I am curious as to what technique(s) are used to load files in while a game is running. For example, Minecraft will load chunks as you get within a certain range of them. How is this achieved without producing lag? Is multithreading involved?

sentences:
Efficiently checking input and firing events I'm writing an InputHandler class in XNA, and there are several different keys considered valid input (all of type Microsoft.XNA.Framework.Input.Keys). For each key, I have three events:

internal event InputEvent XYZPressed;
internal event InputEvent XYZHeld;
internal event InputEvent XYZReleased;

where XYZ is the name of the Keys object representing that key. To fire these events, I have the following for each key:

if (Keyboard.GetState().IsKeyDown(XYZ))
{
  if (PreviousKeyState.IsKeyDown(XYZ))
  {
    if (XYZHeld != null)
      XYZHeld();
  }
  else
  {
    if (XYZPressed != null)
      XYZPressed();
  }
}
else if (PreviousKeyState.IsKeyDown(XYZ))
{
  if (XYZReleased != null)
    XYZReleased();
}

However, this is a lot of repeated code (the above needs to be repeated for each input key). Aside from being a hassle to write, if any keys are added to/removed from the keys (if functionality is added/removed), a new section needs to be added (or an existing one removed).

Is there a cleaner way to do this? Perhaps something along the lines of

foreach key
  check which state it's in
  fire this key's event for that state

where the code does the foreach (automatically checking exactly those keys that "exist") rather than the coder?

sentences:
Unity - Problems with scene object orientation and rotation after updating my project from 5.0.0 to 5.2.2 Last year I made a large project on Unity 5.0.0, today I re-opened it on 5.2.2 to do some work on it. I was given the message that the project needed to be updated, I allowed it to do the update. Now when I open up my scenes, many of my scene objects are misplaced, the rotation is completely wrong and positioned in the wrong place. My scenes are of a refinery and the most commonly broken object is the pipework, something that would take hours to correct manually.

My pipework is created this way...

All pipes are made in blender and each scene's pipes are saved as a single blender model (with each pipe make from a bezier curve and left as a separate object).
Once imported into Unity (as a single .blend file), I've then dragged and dropped coloured materials onto all the individual pipes, so they are all coloured correctly.

This has all been fine until updating the project to 5.2.2 - now some of the pipes are in the right place, but many are rotated in completely the wrong direction, leaving it looking a mess. If I delete the pipes from Unity and reimport the pipe model back in, this would solve the problem, but then all the materials/colours will be gone. Due to the sheer amount of pipes throughout the whole project, to re-colour them all again would be an extremely problematic task, especially as it's critical that the pipes are the right colour.

I am confused how some of the pipes within the same pipe model are fine and the others are wrong, it would be so much easier to sort if they had all changed rotation together, then I could just switch them all back in 1 go. I have a total of 13 scenes and so far all of them have suffered the same problem.

Nothing whatsoever has been changed on any of the scenes, assets or indeed anything in the project folder. In fact I haven't touched a single file within the project since October last year, so it is certainly to do with updating to 5.2.2. Is there anything I can do to fix the problem without having to re-import the models back in or manually rotate everything back?

I have attached some screenshots to show the issue - See how in the blender image, all the pipework is placed correctly and then in the Unity image, half the pipes have flipped and are facing the wrong way. I have removed the ground so this can be seen clearer. Any help would be much appreciated.

Many thanks

sentences:
How do I change my gravity and jumping logic to put the character at a specific height at a specific point in time? I'm making a 2D platformer on Android using libGDX. One thing I've had a problem with recently is gravity and jumping. I found a few tutorials on the internet and was able to come up with this...

public static final int JUMP_HEIGHT = 64;
public static final float JUMP_GRAVITY= -6.0f;
public static final float MAX_GRAVITY = 20.0f;
public static final float GRAVITY= 19.0f;

private void updateGravity(float delta) {
    if(Gdx.input.isTouched() && !jumping) {
        jumping = true;
        gravity = Config.JUMP_GRAVITY;
    }

    if(jumping) {
        // change frame to jump
        sprite.setRegion(walkFrames[0]);
        sprite.translate(0, (-1*gravity));
        // runner has landed?
        if(sprite.getY() <= idleY) {
            jumping = false;
            sprite.setPosition(Config.RUNNER_X, idleY);
        }
        // slowdown / fall
        if (gravity < Config.MAX_GRAVITY) gravity += Config.GRAVITY*delta;

    }
}

The code works and my character will jump and fall smoothly. Although the time it takes for him to jump and comedown is independent from delta the height he jumps is not. If the device lags while jumping he will jump only a portion of how high he should. For the life of me I cannot get it to make sure it jumps a specific height (JUMP_HEIGHT) and in a specific time independent of the delta.

sentences:
What do I need to get an independent developer license for CryENGINE 3? I have searched Google and CryEngine forums and I can't seem to get a solid answer to this question.

I have seen threads where developers are complaining that they can't sell their game because they can't get a licence after finishing their project.

Now, I am considering using CryEngine for my game because I like the royalty system, as it means I do not have to make any upfront payments but I don't want to have to get through the game and then find that I Crytek refuse to give me a license because I didn't know what the rules were, or something.

sentences:
How to draw the player standing behind a tree in an Entity Component System? I'm making a top-down Javascript canvas game using the Entity Component System architecture.
For an entity to be drawn on the screen every frame, it needs a PositionComponent and a SpriteComponent. The rendering system looks like this:
for (let entity of scene.query(CT.Sprite, CT.Position)) {
  this.drawEntity(entity);
}

This works well, but I'm not sure how to modify this to give the player the ability to hide behind objects. For example, in Stardew Valley, you can stand in front of, and behind, objects, as demonstrated in this screenshot: https://i.imgur.com/B90jGS7.png
How can this be implemented in an ECS? Because currently my rendering system just iterates through every object and draws them.
Also, currently, for drawing the map (scenery and whatnot), it renders the map to a texture and then just redraws that single texture every frame (for performance reasons, instead of redrawing 10,000 tiles every frame). I'd imagine this makes it even more difficult to integrate.
My assumption is that I have to take into account the entity's position in some way? That is, an entity with { x: 0, y: 400 } will be drawn before an entity with position { x: 0, y: 500 }, but I'm also unsure of how to integrate this with an ECS.
Thanks for reading.

sentences:
Transfer my UDK 2 project to UDK 3? Is it possible to export my UDK 2 project to UDK 3 ?
What kinds of things aren't transferable?

sentences:
How to Make UI Open and Close on Keypress I've been working on a 2D RPG and have been trying to make a script that will open or close the public UI element that is selected in properties. I don't receive any errors, but I do receive a warning that says:

Assets\Scripts\KeyManager.cs(7,18): warning CS0414: The field 'KeyManager.activeUI' is assigned but its value is never used

Here's the script that is connected to my canvas:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class KeyManager : MonoBehaviour
{
    private bool activeUI;
    public GameObject UI;

    void Start()
    {
        activeUI = false;
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.I) && (activeUI = false))
        {
            activeUI = true;
            UI.SetActive(true);
        }

        else if (Input.GetKeyDown(KeyCode.I) && (activeUI = true))
        {
            activeUI = false;
            UI.SetActive(false);
        }
    }
}

sentences:
Why when using editor script with handles with DrawSolidArc it's not drawing any arc over the object? This is the editor script is in the Assets/Editor
using UnityEngine;
using UnityEditor;

[CustomEditor(typeof(DrawSolidArc))]
public class DrawSolidArcEditor : Editor
{
    public float arrowSize = 1;

    void OnSceneGUI()
    {
        DrawSolidArc t = target as DrawSolidArc;

        Handles.color = Color.blue;
        Handles.Label(t.transform.position + Vector3.up * 2,
                             t.transform.position.ToString() + "\nShieldArea: " +
                             t.shieldArea.ToString());

        Handles.BeginGUI();
        GUILayout.BeginArea(new Rect(Screen.width - 100, Screen.height - 80, 90, 50));

        if (GUILayout.Button("Reset Area"))
            t.shieldArea = 5;

        GUILayout.EndArea();
        Handles.EndGUI();

        Handles.color = new Color(1, 1, 1, 0.2f);
        Handles.DrawSolidArc(t.transform.position, t.transform.up, -t.transform.right,
                                180, t.shieldArea);

        Handles.color = Color.white;
        t.shieldArea = Handles.ScaleValueHandle(t.shieldArea,
                        t.transform.position + t.transform.forward * t.shieldArea,
                        t.transform.rotation, 1, Handles.ConeHandleCap, 1);
    }
}

And the mono script for example this script is attached to a simple 3d cube :
using UnityEngine;

[ExecuteInEditMode]
public class DrawSolidArc : MonoBehaviour
{
    public float shieldArea = 5;
}

but there is nothing around the cube. not also near it nothing.
it should draw arch in the editor.
Later I want to be able to use the mouse with a click down and drag to be able to change the arc size but for not it's not drawing any arc.
I took the example from the unity official docs :
https://docs.unity3d.com/540/Documentation/ScriptReference/Handles.DrawSolidArc.html
I noticed now also for example that I don't see the gui button in the inspector of the object that the mono script is attached to :
if (GUILayout.Button("Reset Area"))

not sure what's wrong with the editor script.
This is working. I still wonder why the unity docs example didn't work but this is working and I don't need the editor script. The problem with this script is that I must to turn on the Gizmos in the editor and I don't want to make it turned on all the time. So it's working but not as I wanted.
I want to draw the arc without the gizmos.
using UnityEngine;

[ExecuteInEditMode]
public class DrawSolidArc : MonoBehaviour
{
    public Vector3 offset = Vector3.one;
    public float fieldOfViewAngle = 20;
    public float viewDistance = 4;
    public bool usePhysics2D = false;

    public void OnDrawGizmos()
    {
        DrawLineOfSight(this.transform, offset, fieldOfViewAngle, viewDistance, usePhysics2D);
    }
    public static void DrawLineOfSight(Transform transform, Vector3 positionOffset, float fieldOfViewAngle, float viewDistance, bool usePhysics2D)
    {
#if UNITY_EDITOR
        var oldColor = UnityEditor.Handles.color;
        var color = Color.yellow;
        color.a = 0.1f;
        UnityEditor.Handles.color = color;
        var halfFOV = fieldOfViewAngle * 0.5f;
        var beginDirection = Quaternion.AngleAxis(-halfFOV, (usePhysics2D ? Vector3.forward : Vector3.up)) * (usePhysics2D ? transform.up : transform.forward);
        UnityEditor.Handles.DrawSolidArc(transform.TransformPoint(positionOffset), (usePhysics2D ? transform.forward : transform.up), beginDirection, fieldOfViewAngle, viewDistance);
        UnityEditor.Handles.color = oldColor;
#endif
    }
}

sentences:
Creating an abstract Animation class I'm creating a simple 2d game with c++ and SFML, and I've got a simple framework going for animating a sprite using a "SpriteSheet" image (an big image containing all the "frames" of an animation)

I've got it working fairly well, I've attempted to copy the concept from another engine i'm familar with (Starling for Flash).. in which they use a "Juggler" which updates a sprite's properties based on a timeline, independant of the sprite...

I've got the animation working for swapping frames using a class i created called Tween... it calls a function update(float gameTime); which updates the sprites subRect to the correct frame...

I'd like to make this a more rebust solition, allowing the Tween class to do more than just frame animations.. I've been trying to use polymorphism to create Children to Tween such as "Anim", "Move", "Rotate", and "Scale" which all have a update() function which updates the sprite accordingly... The idea being a list of a number of these classes (for instance, a Scale and Rotate) can be added to a vector list and then each can call their update function, each updating their specific functions.. the problem seems to be that if i create a list of Tweens, then call update, it uses Tweens implementation of Tween.update() and not it's inherited children, I don't know how/if it's possible to allow this...

sentences:
Hardware for iPhone 2d games development Do I need the cutting edge MacBook Pro or iMac for 2D games development?

Would a iPod touch (with Wi-Fi support) do instead of a full-fledge iPhone?

sentences: How do I create a 'disable minimap' skill for a StarCraft 2 mod? I would like to make a "disable minimap" type of skill, which when used will make an area of the minimap black (such that you can't see enemies or allies on the map). How can I accomplish this?

sentences:
How to get an AbstractClientPlayer for all players? I'm working on an minecraft forge mod (1.8.8). I have en custom (ownable) entity and want to set its texture to the texture of its owner, because it's a mini version of the owner.

I found out that i can get the texture of players with AbstractClientPlayer#getLocationSkin(), but i can't figure out how to access either EntityOtherPlayerMP or EntityPlayerSP, which implement AbstractClientPlayer, in my custom renderer. Is there a way to get all AbstractClientPlayer, regardless of SP or MP? I can access the GameProfile and i have the EntityPlayer of the owner.

sentences:
Calculating vertex normals in OpenGL C++ Does anyone knows a simple solution for calculating vertex normals? I've been looking for this on the internet but i cant find a simple solution, for example, if I have some vertices like this:

GLfloat vertices[] =
{
 0.5f,  0.5f, 0.0f,  // Top Right
 0.5f, -0.5f, 0.0f,  // Bottom Right
-0.5f, -0.5f, 0.0f,  // Bottom Left
-0.5f,  0.5f, 0.0f   // Top Left
};

sentences:
Optimizing black and white matrix block drawing Disclaimer:
I am uncertain if this is the best place to post this question, so please advise me of how I can best find the answer if I am doing something wrong. I am asking this question because I am trying to optimize a drawing function of a PC game I am programming.

Preface: There is a matrix of blocks, that can be either on (black) or off (white). There will be different colors, but for the sake of simplicity I am presenting the problem to you as black and white only, so please imagine this matrix forming some random pattern like a QR code which would be a good example.

Problem: Instead of drawing each black block individually, I want to determine how to draw all black blocks using as minimum calls to my draw black rectangle function as possible.

Question: Is there any existing process that I can refer to so as to make my drawing process as efficient as possible, or how would I logically go about tackling this conundrum?

Edit: Tried to produce some example code for us to play with

std::vector<std::vector<bool>> matrix;

int width = 100;
int height = 100;

matrix.resize(height);

for(int h = 0; h < height; h++)
{
    matrix[h].resize(width);
    for(int w = 0; w < width; w++)
    {
        matrix[h][w] = random 1/0
    }
}

void draw()
{
    .. draw matrix using a minimum amount of calls to draw_rectangle
}

void draw_rectangle(int x, int y, int width, int height)
{
    .. draws a set of black blocks
}

sentences: What does the hull shader attribute "patchsize" do? What does the hull shader attribute [patchsize(12)] do? MSDN fails to mention it. Do I have to use it? Should I use it?

sentences:
Move car to coordinate with considering z-angle I have such question:

I have a car, her coordinates (x, y, z) and z-angle (from 0 to 360 degrees).

And i have x, y, z of checkpoint.

how to calculate the angle to which need to turn the car to get to the point, taking into account its direction?

something like that:

Sorry for my English :D

sentences:
What's the easiest way to fill my 3d enviornment with temporary graphics? Currently I am starting a 3D game with C# but I don't have a designer yet nor any images or anything or any money to invest on it.

I would like to develop it using some sort of placeholder or whatever to fill the graphics so I can make at least the basics of it and later simply switch for the real thing.

Should the place holders be actual sample images or can I use for example a ball to represent a body (what will be the impact of it later when I switch to the actual body it self)?

sentences:
Frequent stuttering, high FPS spikes with VSync option turned on in Unity standalone build I'm experiencing an issue using Unity 4.3.2 and standalone builds. If I turn on VSync in the project's Quality settings, running the game at the native monitor resolution, I'll frequently get high framerate spikes (over 100FPS), and a strong stutter for a few frames, and then it drops back down to 60FPS and runs normally. If I run the game at a lower resolution (800x600 for example), the framerate stays at around 500FPS and the stuttering is consistent.

However, if I turn off VSync in the Quality settings, and force it on in the Nvidia Control Panel, I don't experience any stuttering or framerate spikes, nor when I turn off VSync completely (but lots of screen tearing, which is very ugly and distracting).

Can anyone explain this behavior? Is there anything that can be done to circumvent it? I'd imagine other Unity developers have used the built in Unity VSync with success before (or maybe not?!) so I'm hoping I'm just doing something wrong on my end.

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

sentences:
Phaser: How to call a function inside another function? So I actually have the following code that works:

var player;
var box_tnt;

function create (){
    this.physics.add.collider(player, box_tnt, hitTnt, null, this);
}

//the function hitTnt stop the game because the player died
function hitTnt (player, boxes){
   this.physics.pause();
   console.log('Game Over!');
   textGameOver.setText('GAME OVER');
   player.setTint(0xff0000);
   player.anims.play('default');
   gameOver = true;
}

and I want to do something like:

var player;
var box_tnt;

function create (){
    this.physics.add.collider(player, box_tnt, hitTnt, null, this);
}

//the function hitTnt stop the game because the player died
function hitTnt (player, boxes){
    gameOver();
    //other stuff here
}

function gameOver (){
    this.physics.pause();
    console.log('Game Over!');
    textGameOver.setText('GAME OVER');
    player.setTint(0xff0000);
    player.anims.play('default');
    gameOver = true;
}

but I have the following error message:

  TypeError: gameOver is not a function

Do you have please any ideas how to do it properly?

sentences: Where can I get people to test my game? I've just finished making the core aspects of my HTML5 game. I have a server and all that, but is there a site where I can find people that would test my game? I figured that getting my friends to do it wouldn't be a good option because they are probably biased, so I need people that I never met before, complete strangers. Also, would the people at gamedev forums be willing to do that? Would it be considered as advertising?

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

sentences:
How to make and correctly use progress bar in cocos2d-iphone? I have a game that uses a progress bar to inform player of level of certain stats of the player. For example hunger, when it starts at zero and slowly adds up to maximum bar. When he eats the hunger reduces.

I tried implementing as progressBar, but it works wrong, as the bar expands both ways, and I need it to grow one side only. Also I had hard time setting the bar, since it uses actions.

Is there an easy way to do it?

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:
Combining a pure ECS with a FSM scheduling system Currently I am evaluating how to refactor my core game logic since I tried to design most of it in pure ECS but isn't really completely feasible the way I intended it.
My game at its core is a turn-based roguelike with multiple (implicit) phases during a turn:

Player Action Phase: Movement, Attack or Item Usage

If the chosen action was Attack or Item Usage, handle it right away
Otherwise, queue a Movement intent

Movement Phase: All units that decided to move will move simultaneously
Attack Phase: All enemy units that haven't moved will attack one-by-one
End Phase: Resolve status effects

These phases have been difficult to design with ECS. Certain systems have checks whether the should run right now with a bunch of tag components. Examples include:

The BehaviorSystem updates enemy entities, that are currently thinking (applied after any player actions have been resolved), but have neither finished their turn yet and are not suppressed by anything (usually used to await animations).
The AttackerSelectionSystem that only runs when no movement or attack animation is currently playing and then only picks enemies that still have to attack, sorts them by initiative and tags the next enemy to start his attack during the next frame.

Eventually my current architecture won't scale well with more and more systems to come, especially with different kinds of game states such as game elements that are UI only, in-town/hub maps where I don't need any of these combat/turn-based elements and finally the instance/dungeon areas where I will need them.

My idea is now to include a FSM in my Game class decoupled from the ECS itself to handle my current approach to invoke systems:
auto Game::Implementation::updateSystems(const sf::Time DeltaTime) -> void {
  updatePlayerControllers(Registry, InputManager, Tilemap);
  updateBehaviors(Registry, Tilemap);
  updateMovementAnimations(Registry, DeltaTime);
  updateAttackerSelection(Registry);
  updateAttackAnimations(Registry, DeltaTime);
  updateDamageEvents(Registry, ContentManager);
  updateFloatingCombatTextAnimations(Registry, DeltaTime);
  updateEndOfTurn(Registry);
  updateLocalToWorldTransforms(Registry);
  updateSpriteRendererTransforms(Registry);
  updateEntityRemovals(Registry);
}

Now I am evaluating how to implement this in a clean way. I fear with too many states I might end up with spaghetti scheduling using weird if/switch constructs. Alternatively I could add a check at the beginning of each system whether the current state of the FSM/game allows them to even run.
Finally a most sophisticated approach would most likely be a dependency graph with conditions that will schedule the systems to run each frame.
Are there any common patterns and approaches to handle this scheduling based on game/turn state?

sentences:
Matrix transformations vs manipulating vertex data directly I was wondering whats more efficient to do if you want to transform a mesh. 1) Transforming a matrix and pass that to a shader or
2) Manipulate the meshs vertex data directly

I was wondering because LibGDX is using the second option to transform sprites. And calculating the translation, rotation and scaling for every mesh every frame seems a bit too much, since you have to change the vertex data every frame too.

sentences:
Location of "units" in Code So, I've been playing around with the concept of a game, mechanically think of the Civilization games(Tile, turn-based strategy) but I am quite uncertain about where I should store the units location in the code. The tiles exist on a X and Y coordination of integers and that's how I imagine that the unit's would work too.

To clarify, I am unsure what's most effective, if it's example one: To have the tiles have a variable for which units are standing upon it and then when the unit move destroy them and recreate them on the tiles they are moving to.

That way when the tile is clicked it should be very easy to get the unit but it seems like it might be unsafe to remove and recreate units or sending a variable along. This might also be very unpractical when issuing an order to move somewhere, though, I am don't know.

The second example is to add the units to some kind of unit arraylist (or alike) but by that the game would have to find the unit with the right coordinates in said list (right?), this might appear as if the game is unresponsive and slow. Though it might not matter when you sort the list every x interval...

Any other ways to do it, ideas, fixes or even comments from you guys would be much appreciated.

sentences:
How to 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:
Tilemap Collision Generation - Tracing Polygons with Slopes I've been using Godot for my game, but it has a unfortunate quirks with tilemap collision where physics objects can bounce weirdly near tile seams and kinematic bodies can often get stuck in seams as well. For early alpha work, I've been able to get around this by not using tilemap collision and then tracing the contours by hand... Well this isn't going to scale well to 200 rooms (or whatever I end up having) and could easily lead to mismatched collision data, so I've decided that this process needs to be automated.

Tilemaps have a few different tile types - fully solid, diagonal slopes, and 2:1 slopes.

My first attempt matched each of these types to a half-tile size, marking each vertex as solid or not solid, and then combining all the vertices (with their overlap) into a single grid of vertices. I could then use all of these together by marching along the perimeter and probing ahead to detect corners. Turns out this works well for convex corners but has serious issues in concave corners, plus there isn't enough data to detect slopes properly, so it often resulted in extra slopey parts or cutting into slopes just slightly.

From there I decided to add some extra information on the vertex grid, such as whether a vertex is a slope edge and doing clever things surrounding the properties of how it overlaps, but it's quickly blowing up into a lot of specific cases.

I spent much of today thinking about adding vertex normals to each tile definition, but I realized it wasn't going to work without adding a bunch of different tile solidity types.

Are there better approaches than what I'm thinking that don't involve brittle/lossy intermediate representations or ridiculous amounts of special cases?

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:
D3D11 Can only Pixel Shader and Compute Shader stages write to buffers? I am reading Practical Rendering and Computation with Direct3D 11.
In the book the D3D11 pipeline is often described with this image:

In the Chapter about resources, Paragraph about buffers, I understood that the only stages that can write to buffers are the Pixel Shader and the Compute Shader, using Unordered Access Views.
Is it correct? If so, why? Is it because of the inherent architecture of GPUs?

Then, what would be the typical method to output data from a different stage?
For example, how could one get the result of a computation done in the vertex shader, without needing to pass through the other stages?

sentences:
Engine and level of detail for maze / labyrinth / dungeon scene? My question is similar to these:

Algorithm for generating a 2d maze
To scene graph or not to scene graph?

I.e. in this case should I use jME3 or some other engine (I heard Unreal offers a free engine) for a 3D dungeon game and when I build up the dungeon, should I use an algorithm for a new dungeon every time or should I use a static scene?

I've code to build a small wall that adds it to my scene which is mostly programmaticly achieved with less 3D modelling and more algorithmic solutions:

  /** This loop builds a wall out of individual bricks. */
  public void initWall() {
    float startpt = brickLength / 4;
    float height = 0;
    for (int j = 0; j < 15; j++) {
      for (int i = 0; i < 6; i++) {
        Vector3f vt =
         new Vector3f(i * brickLength * 2 + startpt, brickHeight + height, 10);
        makeBrick(vt);
      }
      startpt = -startpt;
      height += 2 * brickHeight;
    }
  }

  /** This method creates one individual physical brick. */
  public void makeBrick(Vector3f loc) {
    /** Create a brick geometry and attach to scene graph. */
    Geometry brick_geo = new Geometry("brick", box);
    brick_geo.setMaterial(wall_mat);
    rootNode.attachChild(brick_geo);
    /** Position the brick geometry  */
    brick_geo.setLocalTranslation(loc);
    /** Make brick physical with a mass > 0.0f. */
    brick_phy = new RigidBodyControl(2f);
    /** Add physical brick to physics space. */
    brick_geo.addControl(brick_phy);
    bulletAppState.getPhysicsSpace().add(brick_phy);
  }

sentences:
How to animate large and complex sprites with modular parts I am trying to animate sprites like metal slug bosses.
But they can't be animated as regular and squared sprites because the have multiple moving parts at same time.
Considering i am talking about arcade games, frameworks like spine and mecanim did not exist in that time.
I am seeking for techiques to do that, but only found examples animating simple sprite sheets.
Does somebody know how was it done ?
Link to slug flyer sprite sheet
Link to big shiee boss sprite sheet

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:
Get the address of a matrix in GLM library Is there a way to get the address of a matrix from a GLM matrix?

I'm using opengl 4 and glm library though I can't seem to find anything, which might help.

sentences:
Choosing between Playmaker or Game Creator for a non-coder The Unity Asset Store is having a huge sale today and saw these two featured.
I'm trying to create a one-level third-person horde mode shooter. It would spawn in at least 3 different enemy types that I can shoot at in a set amount of waves. I would like to know which one can easily make this for me as a non-coder. AI doesn't need to be that extensive just monsters chasing after the Player is enough.
Not to say too much, I just need this much to green light something so I would like to hear your advise
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:
Crossfade Between Two Music Tracks in Pygame My intention is to have two music tracks, which are similar in nature, fade between each other at various times.  When such a fade occurs, one music track should fade from full volume to muted in a short period of time, and, simultaneously, the other track should fade from 0 to 100 and continue playing from there.  They must be able to do this dynamically at any time - when a certain action occurs, the fade will occur and the new track will start playing at the same time index that the other one left off at.

This might be plausible by either using volume manipulation or by starting and stopping the music (however, it appears that only a "fadeout" option exists, and there is a lack of a "fadein" option).  How can I do this?  What is the best method, if any, that exists?  If it is impossible using Pygame, alternatives to Pygame are acceptable.

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:
Isometric displaying two different images in different positions I'm creating a simple Isometric game using HTML5 and Javascript, but I can't seem to get the display to work, at the moment i have 9 tiles that have X and Y positions and the player has a X and Y position, the players X and Y properties are set to 100, and the tiles are as shown

tiles[0] = new Array(3);
tiles[1] = new Array(3);
tiles[2] = new Array(3);
tiles[0][0] = new point2D( 100, 100);
tiles[0][1] = new point2D( 160, 100);
tiles[0][2] = new point2D( 220, 100);
tiles[1][0] = new point2D( 100, 160);
tiles[1][1] = new point2D( 160, 160);
tiles[1][2] = new point2D( 220, 160);
tiles[2][0] = new point2D( 100, 220);
tiles[2][1] = new point2D( 160, 220);
tiles[2][2] = new point2D( 220, 220);

Now I use this method to work out the isometric position

function twoDToIso( point )
{
var cords = point2D;
cords.x = point.x - point.y;
cords.y = (point.x + point.y) / 2;
return cords;
}
point2D is

function point2D( x, y)
{
this.x = x;
this.y = y;
}

Now this i'm sure does work out the correct positioning, but here is the output Isometric view

I just need to move my player position a tiny bit, but is that the best way to display my player position in the right position?

Canvas

P.S. the tile width is 120 and height is 60 and the player is width 30 by height 15

sentences: Java LWJGL - How can I click to interact with objects? I want to be able to click on a monster to walk to him and start attacking him. The part that doesnt make sense to me is the conversion between the mouse position, and the actual terrain position. There are camera angles to worry about, heights, seperate terrains, how is this done???? I am using Java LWJGL and rendering with OpenGL 4.4

sentences:
How can I optimize per-pixel drawing in SDL? I've been messing around with C++ the last few days and I'm trying to figure out how to draw the screen pixel by pixel each frame.

It sounded simple enough at first, but then I realized for loops during the games main loop is nothing but a slow mess. How do I safely and with speed show visual effects?

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:
Problem with camera drag and draggable UI elements I implemented my camera drag using the following method:

 if (Input.GetMouseButtonDown(0))
        {
            dragging = true;
            followPlayer = false;
            oldPos = transform.position;
            panOrigin = Camera.main.ScreenToViewportPoint(Input.mousePosition);
        }

        if (Input.GetMouseButton(0))
        {
            Vector3 pos = Camera.main.ScreenToViewportPoint(Input.mousePosition) - panOrigin;
            transform.position = oldPos + -pos * panSpeed;
            transform.position = new Vector3(Mathf.Clamp(transform.position.x, xMin, xMax), Mathf.Clamp(transform.position.y, yMin, yMax), transform.position.z);
        }

        if (Input.GetMouseButtonUp(0))
        {
            dragging = false;
            //  followPlayer = true;
        }

But i also have draggable UI components that implement the  IBeginDragHandler, IDragHandler, IEndDragHandler interfaces. Problem is of course while draging the item in the canvas the camera still moves. Any idea how to solve this besides the obvious setting of bools in the inplementation of the interfaces to prevent the camera drag code from executing. An other problem is that I have other non UI object in the game that I want to click so implementing a transparent UI element behind all other UI will not work for me.

sentences:
Creating jar file for SFS2X is making issue I created a test script to explore Smartfoxserver 2X(SFS 2X). In Eclipse I created 2 classes for math Handler with the SFS plugin. and I export the project as a .jar file. Then I place the jar file in this path \SmartFoxServer_2X\SFS2X\extensions\myExt, then started the server. The server is getting close, It's not working. I checked a lot of tutorials all are using the same method. I don't know what was the issue. If anyone knows please help.
Class 1:
package com.smartFoxServerPracticeOne;
import com.smartfoxserver.v2.extensions.SFSExtension;

public class GameManagerReq extends SFSExtension {
    @Override
    public void init() {
        // TODO Auto-generated method stub
        this.addRequestHandler("math", MathHandler.class);
    }
}

Class 2:
package com.smartFoxServerPracticeOne;

import com.smartfoxserver.v2.entities.User;
import com.smartfoxserver.v2.entities.data.ISFSObject;
import com.smartfoxserver.v2.entities.data.SFSObject;
import com.smartfoxserver.v2.extensions.BaseClientRequestHandler;

public class MathHandler extends BaseClientRequestHandler {

    @Override
    public void handleClientRequest(User player, ISFSObject params) {
        int n1 = params.getInt("n1");
        int n2 = params.getInt("n2");

        ISFSObject rtn = new SFSObject();
        rtn.putInt("sum", n1 + n2);

        GameManagerReq parentEx = (GameManagerReq) getParentExtension();
        parentEx.send("math", rtn, player);
    }
}

sentences:
How to convert OpenGL 2.0 code to OpenGL-ES 2.0? I have a 3D game library that uses OpenGL 2.0 for PC and I need to convert it to OpenGL-ES 2.0 to compile it for Android.
Because the library is huge, I'd like to avoid converting it line-by-line by hand.
Is there some faster way I can convert desktop OpenGL to OpenGL-ES source code, like a wrapper, or maybe some layer running on Android that converts desktop OpenGL to ES at runtime?

sentences: What is the difference between a level designer and an environment artist? What are a level designer's roles in the development of a game, what are an environment artist's, and how do they compare? Are they overlapping roles? Does a game development team typically have both roles?

sentences:
Get JSON property dynamically in Unity C#? I'm saving game data into JSON, however basically I can't get property with just string just like in JavaScript.

This makes my code to write so many if/switch statements, looks very not clean, hard to read.

For instance, if I have this struct to save data as JSON:

public struct PlayerData {
    public int compensator;
    public int silencer;
    ...
}

I want to do something like this:

string attachmentName = "compensator";

if (PlayerData[attachmentName]) {
    weapon[attachmentName].gameObject.SetActive(true);
}

This part:

weapon[attachmentName].gameObject.SetActive(true);

Can do with Dictionary, but this part can't, because it's C# struct/class:

if (PlayerData[attachmentName]) {

Is there a way to access JSON data dynamically in this case?

sentences:
Euler angle and Quaternion conversion become weird when yaw is bigger than 90 degrees I'm writing a camera which needs to change a quaternion to Euler angles than change them back, it only works when the yaw is less than 90 degrees, I wrote a example to check:
glm::vec3 euler_angler = {0, 0, 0};
  for (int i = 0; i < 91; i++) {

    std::cout << "before: " << euler_angler.x << ", " << euler_angler.y << ", " << euler_angler.z << std::endl;

    euler_angler.y += 1;

    glm::quat quat({glm::radians(euler_angler.x), glm::radians(euler_angler.y), glm::radians(euler_angler.z)});

    glm::vec3 new_euler_angler = glm::eulerAngles(quat);

    std::cout << "after: " << glm::degrees(new_euler_angler.x) << ", " << glm::degrees(new_euler_angler.y) << ", "

              << glm::degrees(new_euler_angler.z) << std::endl;

  }

and when the Euler angles is {0, 89, 0}, then the Euler angles changed back to quat is the same, which is {0, 89, 0}, but when the origin changes to {0, 90, 0}, the new_euler_angler suddenly becomes to {180, 89.0001, 180}, and makes my camera rotation a mess.
Can someone help why this happened and what should I do?
the code of my camera:
glm::vec3 euler_angler = glm::eulerAngles(transform_data.rotation);
euler_angler.x = euler_angler.x + glm::radians(delta_y);
euler_angler.y += glm::radians(delta_x);
euler_angler.z = 0;
transform_data.rotation = glm::quat(euler_angler);

and here's my calculation of view matrix(which is a suspect because all other tutorials are using lookat matrix, I'm not sure my way is right or not):
// the position and rotation of the camera
auto transform_data = actor_.GetTransform().GetData();
glm::mat4 view = glm::mat4(1.0f);
view = glm::translate(view, -transform_data.position);
view = glm::toMat4(glm::quat(transform_data.rotation.w,
                               -transform_data.rotation.x,
                               -transform_data.rotation.y,
                               -transform_data.rotation.z)) * view;
render_camera_.SetViewMatrix(view);
glm::mat4 projection;
projection = glm::perspective(glm::radians(fov_), (float) aspect_, 0.1f, 100.0f);
render_camera_.SetProjectionMatrix(projection);

sentences:
Where should I host my flash games? I'm looking at hosting my flash game on a site like Kongregate or NewGrounds, but with so many choices, I'm left wondering what are the pros & cons of the various options?

I'm interested in:

Reaching the biggest audience
Making some money (eg. I know that Kongregate shares ad revenue)
Other features/benefits of the site (eg integration APIs for high scores, micro payments, etc)

sentences:
How do you render planets without distortion? I've recently been working on a little spaceship flying sim in Unity and want to add planets. Up till now, I've been hand modeling them in Blender. But I want to have a way to generate large planets with heightmaps. While researching the topic, I found this video about a voxel planet game and its tech, Here. In the video, they describe a way to render a planet with low distortion. They also relate it to how No Man's Sky does it.

My question is, Are there other methods of rendering planets that have zero distortion?
I would prefer if the answers wouldn't be Unity3D specific since i'm considering switching to Monogame or DirectX.

Thanks in advance!

Edit. I've been asked to describe the distortion.
The distortion is what happens when a cube gets mapped to a sphere. The video suggests a method of using shader warping when on the ground but using the method of squishing a cube to a sphere when in space. This method causes a noticeable warp when going from space to ground because it switches rendering methods. My question is if there is a way to prevent that warp and provide a truly seamless transition from space to ground.

One more edit, I have found another video on a seamless planet engine called Outerra here It seems to have no warping when leaving the atmosphere. It can be seen at 0:50 and at2:22 in this video.

sentences:
How to support Surface pens in Unity? Our game works great with touch or mouse, but the Surface pen doesn't seem to register as a pointing device at all. How can we support the pen in Unity in a native build?

This question on the Unity Answers site suggests we could build it as a UWP app, but that means restricting ourselves to a very limited subset of the .NET framework (specifically, we lose a lot of the Serialization libraries).

sentences:
How can I move game objects using keyboard in the Unity scene editor? I know I can click on the "move" button

and use my mouse to drag the object around. How can I do the same using my keyboard?

sentences:
How to deal with Character body parts from Design to Cocos2d I'm trying to figure out the pattern the game developers use together with game designers:

See the picture below with the independent parts:

Questions:

1) Should I create different image parts from different body parts or keep frame by frame animaton? (I know both can be used, but I'm trying to figure what is commonly used in the industry)

2) If I'm going to generate different image parts from different body parts (which is I thing is more logical) how would I export that to Cocos2d (Vector or Bitmap)?

sentences:
C# 2D Game Design/Architecture Question I am developing a 2D game for windows phone using C# and XNA. I have a list of screens managed by an engine. each screen has a list of components like 'camera', 'skyBackground', 'landBackground', 'units' and so on. All those components inherit from an interface 'IComponent' which has the following:

public interface IComponent
{
    void Initialize();

    void Update();

    void Draw(Camera camera, Color tint);

    BoundingBox BoundingBox { get; }
}

This has it advantages and disadvantages. It unifies all game objects so i can treat them the same, but creates some harmless but still annoying issues like having plenty of empty initialize functions, or a camera with an empty draw method, or a UI class that doesn't need the camera as a passed in parameter to draw in the 'Draw' function but takes it anyways and so on.

I then thought of creating a number of interfaces like 'IUpdate', 'IInitialize', 'IDraw', 'IBoundingBox' and having my screens store a list of 'object' rather than a list of 'IComponents', and then in the update method i would do as follows:

foreach object obj in objects
    if(obj is IUpdate)
        ((IUpdate)obj).Update();

But I don't know how the 'is' command works behind the scenes, maybe its a costly feature which shouldn't be called each frame for all objects in each loop.

So am not sure what to do here, should I accept a unified interface with the few currently harmless kinks it introduces or use my 2nd idea? or maybe you could suggest another alternative?

Thanks a lot

sentences:
Displaying pixels on a canvas at 60 hertz I'm (new to SO and) attempting to code an "emulator" for an 8-bit CPU I am making with a friend.
I have only ever used Java to make simple GUIs with Swing, and from reading similar questions it seems to me that using repaint() and Graphics2D to display 60fps is not the way to go.

From my attempts at using a custom JComponent to draw, I couldn't agree more. Despite calling screenComponent.repaint() 60 times per second, Java was only updating the screen around 2 times per second, whereas the video memory byte array (stores pixel data) that was also updated 60 times per second (before calling repaint) did change every frame.

So my question is: what can I use to display my one-dimension pixel array (using y * width + x to get pixels at a coordinate) and update it at 60fps?

What I need to be able to do:

draw each individual pixel with a set color
-draw text with a font and size (the computer I am emulating has a toggle able text-only graphics mode)
efficiency is not a huge concern since the main purpose of this is to test assembly programs that will later run on the physical CPU, but it needs to update the screen at 60 Hertz and run CPU clock cycles at least at 1 kilohertz
scale up the canvas as the cpu only displays at 78 by 128 pixels (I did this in swing by using g2d.fillRect to display pixels and multiplying the arguments by a screen size multiplier integer)
not 3D

sentences: How to 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:
Limiting x and y movement so you can't go off camera So I want to make an on rails shooter like that of Star-Fox in the Unity engine. What I would like to do is limit the ship from moving off the screen. You move along the X and Y axis so i wont have to keep these invisible colliders in their place but I cant get another way to work.

and I know I have to find a way to convert camera space to world space I just can't find a way how.

This is my current controller and I commented a few failed attempts.

also I'm using a perspective camera and I'd like to keep the rigibody movement if possible.

public float turnSpeed = 10;//Horizontal

//private Vector3 moveDirection = Vector3.zero;

public Rigidbody rb;
void Start()
{
    rb = GetComponent<Rigidbody>();
}
void Update()
{//Screen.width
    //transform.position = new Vector3(Mathf.Clamp(transform.position.x, -holdMyRatio, holdMyRatio),
   //                                  Mathf.Clamp(transform.position.y, -holdMyRatio, holdMyRatio), 0);
    //CharacterController controller = GetComponent<CharacterController>();
    rb.AddRelativeForce(Vector3.right * turnSpeed * Input.GetAxis("Horizontal"));
    rb.AddRelativeForce(Vector3.up * turnSpeed * Input.GetAxis("Vertical"));
  //  moveDirection.x = Input.GetAxis("Mouse X") * turnSpeed;// * Time.smoothDeltaTime;
   // moveDirection.y = Input.GetAxis("Mouse Y") * turnSpeed;// * Time.smoothDeltaTime;
  //  controller.Move(moveDirection * Time.smoothDeltaTime);
}

sentences:
JavaScript - 2D Top-down Tile Collision Detection I am developing a small Top-down Game (Much like the old Zelda Games) and I'm having an issue in terms of Collision detection (The actual theory itself rather than assigning Tiles as solid, etc.)

I have a function called "checkTileCollision" which takes two parameters, X and Y, and is called through the Player's Move function. X and Y are the location of the player AFTER they have moved, as it's suppose to check the position the player is moving to for a solid Tile(s), and if it finds any, returns true to stop movement.

My Player is larger than a Tile (For examples sake, let's say each Tile is 32x32 and the Player is 26x60) and I need to know an efficient way to detect whether or not the player is attempting to step on to a Solid tile. The Player doesn't move on the Grid and is free-moving, so X and Y are true positions and not Tile co-ordinates.

Please note; I am aware of things such as Box2D but I'm wanting to do this without the use of third party libraries.

Any help is appreciated!

sentences:
Make the texture array node work with cubemaps? I am working on a procedural interior mapping shader in Unity's Shader Graph. Ideally, I'd like to feed it a set of cubemaps it can pick from semi-randomly.
However, it seems that by default the texture array asset one can provide to a graph does not support reading cubemaps.
Does anyone have a way to use this, or perhaps a clever custom node or alternate texture mapping, so that I can read a number of cubemaps into the shader semi-randomly? Preferably an arbitrary number, but even a fixed number would be somewhat of an improvement.

sentences:
Actor in Stage Does Not Update the MoveTo XY Location I am creating a game wherein an apple is being shot with an arrow. The apple's location is the XY location of the user input and the arrow actor has to move to that location using the code actor.moveto. The problem is the arrow only moves only once to the user input's direction. I know that the moveTo action of the actor is updated many times per second when I called stageArrow.act in the update method so I am wondering why the arrow only moves once. Here's my code:

appleclass.java

public class AppleClass implements Screen {

Arrow arrow;
private final MainApp app;
public Image ShotImage;

public AppleClass(final MainApp app){
        this.app = app;
        this.stageApple = new Stage(new StretchViewport(app.screenWidth,app.screenHeight , app.camera));
        this.stageArrow =new Stage(new StretchViewport(app.screenWidth,app.screenHeight , app.camera));

        arrow = new ArrowClass(app);

    }

@Override
    public void show() {

        InputMultiplexer inputMultiplexer = new InputMultiplexer();
        inputMultiplexer.addProcessor(stageApple);
        inputMultiplexer.addProcessor(stageArrow);
        Gdx.input.setInputProcessor(inputMultiplexer);

        arrow();

    }

    public void arrow(){
        arrow.isTouchable();
        stageArrow.addActor(arrow);
        arrow.addAction((moveTo(Gdx.input.getX(),Gdx.input.getY(),0.3f)));   //===> only executes once.
        arrow.addListener(new InputListener(){
            public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor){

            if (Gdx.input.isTouched()){
                        ShotImage.setVisible(true);

                          }
                        }
                    });}

}

@Override
    public void render(float delta) {

        Gdx.gl.glClearColor(0, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        update(delta);
}

public void update(float deltaTime){

        stageApple.draw();
        stageArrow.draw();

        stageApple.act(deltaTime);
        stageArrow.act(deltaTime);

    }

ArrowClass.java

public class ArrowClass extends Actor {
    MainApp app;
    AppleClass appleClass;
    public Texture arrowTexture;

    public ArrowClass(final MainApp app){
        this.app = app;
        arrowTexture = new Texture("medievalarrow.png");
        this.setSize(arrowWidth, arrowHeight);
        this.setTouchable(Touchable.enabled);
        this.setBounds(app.screenWidth*0.45f,0,arrowWidth,arrowHeight);
        this.setOrigin(0,0);

}
@Override
    public void draw(Batch batch, float parentAlpha) {
        super.draw(batch, parentAlpha);

        final float delta = Gdx.graphics.getDeltaTime();
        this.act(delta);

        app.batch.begin();
        app.batch.draw(arrowTexture, getX(),getY(),getWidth(),getHeight());
        app.batch.end();

    }
}

Any help will be highly appreciated. Thanks.

sentences:
How to get multiple string values from override ToString()? I want to get multiple string values(selectedNameand selectedCurrency) individually from public override string ToString()below.
How do I go on about it?

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

       [CreateAssetMenu(fileName = "Country", menuName = "Country/Country", order = 0)]
       public class country : ScriptableObject
       {
           [System.Serializable]
           public class Item
           {
               public string Name;
               public string Currency;
               public string Capital;
               public string[] City;

    public override string ToString()
    {
    string selectedName = this.name;
    string selectedCurrency = this.currency;
    return selectedName + selectedCurrency;
    }

           }

           public Item[] m_Items;
       public Item PickRandomly()
    {
        int index = Random.Range(0, m_Items.Length);
        return m_Items[index];
    }
}

I need to use the selected string values in the script below.

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

    public class GameController: MonoBehaviour
    {   public country country; //This is the scriptable object country
    public Text countryText;
    public Text currencyText;

    void Start(){
    countryText.text = country.PickRandomly().ToString(); // This is where I need the country name string to show up.
currencyText.text = country.PickRandomly().ToString(); // This is where I need the currency string to show up.
    }
    }

Right now it just displays a random country name and currency for example USA USD in both the fields.

sentences:
Unity3D: How to just center a mesh inside a character controller! Hi I have a simple character mesh and it's parented to my character controller-invisible-capsule object and all the moving code is applied to the parent (if that's relevant), but the point Is I'm trying to line up the mesh to be exactly inside the capsule to make it look like the player is walking ABOVE the ground (pretty normal ...?) So by default the character controller is origined in the center so I move it up by half of it's height to try to get it to line up with the character mesh, which has it's origin below it's feet a little, and this is the result:

as you can clearly see, his feet slightly go into the ground, I have no idea why this is happen, then should be just above the ground like any other normal feet! Here's the code for setting the capsule up half of it's width, since it starts by lining up the mesh in it's CENTER for some reason:

Vector3 tempPos = player.transform.position;

        tempPos.y += (capsuleSize.y / 2);// + chassidSize.y / 12;
        chassid.transform.position = player.transform.position;
        player.transform.localPosition = tempPos;
        chassid.transform.parent = player.transform;

and here's a picture of the mesh (which is just a blender file, easier for import):

As you can see, in the blender file, the origin is slightly below the characters feet, IN THE CENTER, so I don't know why it's not working as planned.

Also, you can see in the first picture that he's slightly moved to the center of the controller on the z(?) axis, but I want him to be completely centered in, any idea how to fix this?

sentences:
How to 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:
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:
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:
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:
Multiple render targets: Output target format performance questions This is probably API independent (more dependent on hardware implementation), but just in case, I'm using OpenGL.

The question is restricted to PC hardware.

I have a couple of questions concerning the output textures that are being rendered to (e.g. in gbuffer geometry pass)

Is there a (noticeable, measurable) performance penalty of using different formats for the
different output textures? e.g. RGB8 (unsigned byte) (8 bits for each component) for diffuse color, RGBA8 (unsigned byte) for specular color + roughness, RGB16F for normals?
Is it worth it to pack smaller component data into larger types just so I can have equal render targets (and fewer of them in number)? E.g. just having two RGBA16F render targets, packing diffuse + specular + roughness into the first, and normals and other stuff into the second render target using bitmasking?
Are there output texture data types/formats that I should avoid entirely?

sentences:
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:
Can we flip znear and zfar so that positive z values increase away from the viewer? I am confused about the projection matrix in OpenGL.

i have a habit of writing the code as follows.

glViewport(0,0,w,h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if(w<=h)
   glOrtho(0.0f,250.0f,0.0f,250.0f*h/w,1.0,-1.0);
else
   glOrtho(0.0f,250.0f*w/h,0.0f,250.0f,1.0,-1.0);
 glMatrixMode(GL_MODELVIEW);
 glLoadIdentity();

Simple, This code sets the viewing clipping region that maintains the equal width and height. negative z value points away from the viewer. as z value extends from 1 to -1. anything that lies outside this value wont be visible to the user.
But i have seen the code like this.

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(left,right,bottom,top,1.0, 500.0);  //how????
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0f, 0.0f, -250.0f);       ///?????
glutSolidSphere(15.0f,15,15);           /// how is this visible on the screen
}

Please help me understand this code. As from my point of view the z value is totally flipped near is 1.0 its okay but zfar is 500 and following that code there is a translation of z value to -250. and drawing that sphere will be visible on the screen how? My question is can we flip znear and zfar so that positive z value will go away from the viewer.

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:
What would it take to program a game engine like the build engine My favorite games of all time are thanks to Ken Silverman's BUILD engine, The engine that brought us DukeNukem 3D, Shadow warrior and Blood. I've read a few articles on the build engine however I haven't found any good ones that go in depth. Ive been programming in C for 3 and a bit years now and am reading through many books every day, so I believe I have minimal skills needed to take on this task.

I was wondering what it would take to make my own "Build engine". What sort of mathematics do I need to learn/know, What books would you recommend, what sort of programming do I need to know (I.E low level programming with bitwise operators or any thing else). My current goal is not to make a game like Duke nukem 3D but to merely make a engine that supports things like sloped walls, translucency, wall and floor sprites etc.

sentences:
How to add Collider to a Line Renderer in unity? I have created a semicircle using a line renderer, I need to add a collider to this so whenever enemy objects hit this they get destroyed, how do I do this.
Current Code

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

public class CreateCircle : MonoBehaviour
{
    // Start is called before the first frame update

    public float radius;
    void Start()

    {
        int segments =60;
        int pointCount = segments+1;

        Vector3[] points = new Vector3[pointCount];

        LineRenderer line = gameObject.GetComponent<LineRenderer>();
        line.positionCount = pointCount; //line.SetVertexCount(pointCount);

        for(int i=0;i<pointCount;i++)
        {
            float Deg = (i*60 / segments);
            float Rad = Mathf.Deg2Rad *Deg;

            points[i] = new Vector3 ( Mathf.Sin(Rad) * radius,Mathf.Cos(Rad)*radius,0);
            // Debug.Log(" Point: "+i+" Deg: "+Deg+" Rad: "+Rad+" Vector 3:"+points[i]);
        }
        line.SetPositions(points);

        Mesh lineMesh = new Mesh();
        line.BakeMesh(lineMesh,Camera.main,true);

        MeshCollider lineCollider = line.gameObject.AddComponent<MeshCollider>();

    }

    void OnColliderEnter(Collider col){
        Destroy(col.gameObject);
    }

}
```

sentences:
As an aspiring game developer, which game engine should I learn? I am currently a full-time student and part-time game developer. I have released six 2D games into Android and WP7 markets. I have also dabbled in 3d development with C++ and DirectX. I am decent at 2D, but have a lot to learn in 3D. I want to be a professional 3D game developer for PCs and/or consoles.

As I understand, most game developers use off-the-shelf engines in AAA games.

My situation is as follows:

I will learn alone. No team involved.
I am interested in graphics programming (writing shader code) as well as gameplay programming.
I am not (currently) interested in learning core game engine architecture in depth.
I have no plans on releasing any commercial 3d game any time soon. Learning purposes only.
I want to code in C++ and for Windows platform only.

Which 3D game engine should I invest my time learning? Which one is industry standard? Will it help my resume?

sentences: Is there a way that I can use Krita assets that I draw in Spine for animation? I am using Krita to create my assets for a game. I am also using Spine so that I can animate those assets to add into my game. Is there a way that I can use Krita and Spine together? I would really like to not have to buy Photoshop or have to learn another software to create my assets.

sentences:
Why does my disable z-depth test shader do not work? I wrote the following shader which purpose is to force draw a mesh over the rest, regardless z-depth :

Shader "Custom/AlwaysOnTop"
{
    SubShader
    {
        Tags { "Queue"="Overlay" "RenderType"="Overlay" }
        ZTest Always

        CGPROGRAM
        #pragma surface surf Lambert

        struct Input
        {
            float4 color : COLOR;
        };

        void surf (Input IN, inout SurfaceOutput o)
        {
            o.Albedo = 1;
        }
        ENDCG
    }
    Fallback "Diffuse"
}

It works great, however transparent objects still get draw over it. Setting the queue as Overlay should have solved the problem.

White = AlwaysOnTop shader
Green = Transparent diffuse
Blue = Diffuse

The left face of the white cube should be white, no tinted in green.

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:
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:
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:
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:
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:
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:
How to share microgame with WebGL Publisher? (Unity) I did unity lego microgame tutorials and now I want to publish it with WebGL publisher. I created build files but I can't publish. I get this error:

I rebuild again to solve this problem. (3 more times..) And clicked "locate existing building" again but I still get this error. What should I do?

sentences:
Why do multiplayer games/chat services ever need to be able to open all NAT ports? I understand that games need to be able to open NAT ports in order to receive incoming connections.

What I do not understand is why there is an issue between "limited" and "open" NAT. The only reason I can see that a game would ever need to have the flexibility to open any port is if it is intending to accept incoming connections on ports that aren't specified in advance as part of the protocol. (If there was a restricted set specified in advance, forwarding these and no others should satisfy all of the game's demands for NAT forwarding, meaning that "open" would not need to be a thing.)

This seems to imply there's some port negotiation going on as part of the protocol (otherwise how does the connector know that this port, not specified in advance, is available?) but if a connection is already established to conduct the negotiation, why move to a different port? And even then, why can't negotiation be limited to a subrange of ports rather than the entire range?

sentences: Using non-copyrighted music for a paid game I'm making a game. It will be sold and not free. Am I allowed to use non-copyrighted music in it?

sentences:
Tools or techniques for UV unwrapping/texturing terrain with features such as roads? I'm trying to create a map similar to Outset island in Loz: Wind Waker. Here is an example of what I'm trying to create:

As you can see, the roads more or less have dedicated tris. However, when I look at the UV data, it looks like a complete mess:

For reference, this is the texture without any overlays:

I have no idea how to go about creating a similar effect in my own game -- are there any tools I can use? What is this technique called?

sentences:
2D Terrain Modification/Expansion? I have a problem which I don't really know what to call, and I would like to apologize in advance for perhaps the misleading title. Let's say I break a few objects in the 2D game and they scatter along the floor, I want the objects to now become apart of the floor.

The solution doesn't have to account for movement, it can wait till the object has come to a stop before updating the terrain. It is intended the terrain doesn't produce any concave shapes as I assume that would just add a whole new layer of complexity.

I thought of a few solutions but I am completely new to this all and if all you can do is point me in the right direction I would greatly appreciate it.
What am I actually asking? I am honestly just looking either for the general Maths involved, or what this type of process is even called if it has a proper term or a few suggestions for a solution.

(In the images, the blue rectangles are rigid bodies, the black lines are the edges of the environment, and the red line is the floor/terrain that changes in relation to the blue rectangles)

sentences:
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:
How to monitor the collisions between multiple bodies I'm making a 2D platformer with Box2D and LibGDX, shooter, and I'm implementing the logic for a snail in the game. The basic idea is that it walks across the ground leaving a sort of, slime trail, and when the snail is not colliding with slime, it should create more. I've set it up to where it will move across the ground creating slime objects, but I'm looking for a way to detect if the snail is colliding with any slime. I have this in my World contact listener:

begin contact:

    case Finals.SLITHERIKTER_BIT | Finals.SLIME_BIT:
        ((Slitherikter) ((fixtureA.getFilterData().categoryBits ==
        Finals.SLITHERIKTER_BIT) ? fixtureA.getUserData() :
        fixtureB.getUserData())).isColidingWithSlime = true;

end contact:

    case Finals.SLITHERIKTER_BIT | Finals.SLIME_BIT:
        ((Slitherikter) ((fixtureA.getFilterData().categoryBits ==
        Finals.SLITHERIKTER_BIT) ? fixtureA.getUserData() :
        fixtureB.getUserData())).isColidingWithSlime = false;

Depending on that variable:

if(!isColidingWithSlime && body.getLinearVelocity().y == 0) slime.add(new Slime(body.getPosition().add(0, -primaryFixture.getShape().getRadius()), color));

I understand why it doesn't work, but don't know what to do, Please help.

EDIT For clarification, I should specify, that if the snail is colliding with slime, I don't' want it to make more because this works pretty well, but I"m attempting to severely limit slime production to increase performance. I only want to create new slime if there's no collision at all.

sentences: Converting Animation data from Maya to DirectX in C++ I am currently trying to export an animation from Maya and import to a program I am working on. One of the problems I currently have is that when imported, the mesh and animation data looks reversed along the Z-axis. I do know the Maya is right handed where as DirectX is left handed. I was curious if there was a simple solution to this. I was able to convert the mesh just fine, with the help of this web page, http://rastertek.com/dx10tut08.html. But this didn't tell me how to the animation data as well. Any help solving this problem would be awesome. Thanks in advance.

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: Instancing effectiviness At about how many instances would instancing become effective? DirectX dynamic buffers seem to take a little more out of the fps than an immutable one would. So obviously you wouldn't want to make a dynamic buffer for one mesh. What about two or three? I realize there's probably many variables to take into account but just to get a grasp on it?

sentences:
onSceneTouchEvent Triggering more than once on one click in Andengine I am making a simple american football game, and I'm having an issue with the onSceneTouchEvent function, I have this code:
public boolean onSceneTouchEvent(final Scene pScene, final TouchEvent pSceneTouchEvent) {

    if (hiking == 0) {
        Log.v("me", "Only the player should move");
        return hike();
    } else {
        Log.v("me", "this shouldn't ever happen on first click");
        return throwBall(pSceneTouchEvent);
    }

}

Inside hike() I set hiking to 1, so that theoretically, the player should be able to click anywhere to hike the ball, (all the other sprites start moving and the ball is not thrown). Then on the second click the ball is thrown. But with one click on the emulator, the ball is hiked and thrown at the same time, I also see this in the log (after only one click):

12-21 14:34:32.113: V/me(1189): Only the player should move
12-21 14:34:32.143: V/me(1189): this shouldn't ever happen on first click
12-21 14:34:32.183: V/me(1189): this shouldn't ever happen on first
click

So it appears that it's triggering three times on one click? Why is this happening? How can I make it only run the code once per click?
Update:
Perhaps I could just prevent any events by using a timer? Like disable the listener for a second after the hike? I'm hoping there is a better solution though.

sentences:
Help understanding IEnumerator Move routine I have this code and I know what it does (it will move an object up and down)

But I don't know how its elements work. Could someone please explain it to me?

IEnumerator Move (Vector3 Target) // What this IEnumerator do?
{
    while (Mathf.Abs ((Target - transform.localPosition).y) > 0.1f) {
        Vector3 Direction = Target.y == Top.y ? Vector3.up : Vector3.down;
        //Is this an if/else? and if yes why if target.y == top.y its first choice is vector3.up?

        transform.localPosition += Direction * 5 * Time.deltaTime;
        yield return null;
    }
    yield return new WaitForSeconds(1f);
    Vector3 newTarget = Target.y ==Top.y ? Bottom : Top;
    //Same line but result order is different ?.?

    StartCoroutine(Move(newTarget));
}

sentences:
Is it legal to record music with a synthesizer and use it in my game? I want to make music for game on my own because I don't have professional composer hired. I have found some softwares for making music, but most of them cost some money.
I have an idea to record music on synthesizer, then edit it and use in my game.
My question is:

Is it legal to record music (that I have composed and edited) on synthesizer and use it in my game (the game may be free or charged)?

sentences:
Rigged through Blender (Rigify) and Errors in Unity I am working on a Unity scene and as the 3D model is missing the bones, I ended up going to Blender for the rigging.

For that, I followed the procedure that Unity suggests by using the add-on Rigify. I was also following this tutorial, which was really helpful.

After exporting from Blender (in .fbx) and importing it on Unity, I went through the configurations (as @vcard suggested here)

In the "Rig" section, I pressed the button "Configure" (to configure the Avatar Definitions) and came across an error "Character is not in T pose".

I solved this one quite fast by accessing the menu "Pose" (in the Inspector) and then "Enforce T Pose".

After that, back in the scene, I came across the following error on the Inspector:

  Invalid Avatar Rig Configuration: Missing or invalid transform:
  Required human bone 'Head' not found.

I went straight to the configurations and decided to add the specific bones to the Head that appeared on the inspector (in the Avatar Definitions configurator). With that, I came found out that the problem is really the organization where there were placed by Rigify.

Any guidance is appreciated.

sentences:
EventSystem.current is null private void OnEnable()
{
    Debug.Log(EventSystem.current);
    EventSystem.current.SetSelectedGameObject(gameObject);
}

Very simple script for selecting a UI element on enable. However, EventSystem.current prints null to the console.
Unity 2019.3.15f1
I have an Rewired event system in the scene.
Also tried putting this in an IEnumerator and waiting a frame before logging to the console - no change.

sentences:
How to manage different speed of actions in RogueLike games? How to manage different speed of actions in RogueLike games?

What I mean is that turn based games may have actors acting at different "speed", depending on the action and some other characteristics. The actors then effectively do more actions/turns than others if they have greater speed, or not.

How to determine when an actor should be able to act (turn scheduling?)?

It looks like there is different ways to do it?
Can you explain some with algorithms?

sentences:
Inverse Explosion with Unity2d I am currently trying to make all other objects push away from the player when the player explodes. It currently works, but it pushes close objects a little and far objects very far. What I want is for close objects to get pushed back more than far objects.
Here is the current code:

function explode () {
var all_rigidbodies = FindObjectsOfType(Rigidbody2D);

for (var r : Rigidbody2D in all_rigidbodies) {
    if (Vector2.Distance(r.transform.position, transform.position) < 6 && r.tag != "Player") {
        var px : float = r.transform.position.x - transform.position.x;
        var py : float = r.transform.position.y - transform.position.y;

        r.AddForce((Vector2(px, py) * 200), ForceMode2D.Force);
    }
}

Any ideas on how to inverse the vector or force, or better ways to achieve 2D explosions?

EDIT: Ended up just normalizing force so its all the same knockback

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:
Setting up a singleton class in Unity I have spent a long time (4-5 hours) digging around as to why my version of the Breakout Unity Tutorial was not working. There where repeated errors of

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

when running the game and calling Game Manager scripts from other scripts in the game.

After much reading up on vaguely useful questions and answers on here I know well enough what the error text means, but the answers on here that describe the error in detail do not reference how to solve this issue on an instance of a singleton.
Elsewhere I found a solution, and want to show this solution as I figure that can help a lot of other people searching for why this issue occurs:

Qualifier:
There is an inconsistency with the Breakout Tutorial

see the instantiation of the Game Manager class:

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

public class GM : MonoBehaviour {

    public int lives = 3;
    public int bricks = 20;
    public float resetDelay = 1f;
    public Text livesText;
    public GameObject gameOver;
    public GameObject youWon;
    public GameObject bricksPrefab;
    public GameObject paddle;
    public GameObject deathParticles;

    /***
     * The below sets the Game Manager Class (GManager) as an instance so is a
     * static variable. This means its accessed via the class rather than via
     * an instance of the class.
     * This means Game Manager can be reached from other scripts with code
     * `GManager.instance.xxx = whatever`
     * So only one GManager instance will be running. This is a singleton pattern.
     ***/
    public static GM instance = null;

    private GameObject clonePaddle;

    // Use this for initialization
    void Awake ()
    {
        if (instance == null)
            instance = this;
        else if (instance != this)
            Destroy (gameObject);

        Setup();

    }

    public void Setup()
    {
       ...
    }

Please read my solution below:

sentences:
Why I cant change the GUILayout.Button color to green when click on a button? I used a break point and it's getting to the line:

style.normal.textColor = Color.green;

But not changing the color of the clicked button.
And there are no any errors or exceptions.

using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using UnityEditor;
using UnityEngine;
using System.IO;

public class Manager : EditorWindow
{
    [MenuItem("Tools/Manager")]
    static void Manage()
    {
        EditorWindow.GetWindow<Manager>();
    }

    private void OnGUI()
    {
        var style = new GUIStyle(GUI.skin.button);
        style.normal.textColor = Color.red;
        style.fontSize = 18;

        string[] assetPaths = new string[2];
        string[0] = "Test";
        string[1] = "Test1";

        foreach (string assetPath in assetPaths)
        {
            if (assetPath.Contains(".test")
            {
                var i = assetPath.LastIndexOf("/");
                var t = assetPath.Substring(i + 1);

                if (GUILayout.Button(t, style, GUILayout.Width(1000), GUILayout.Height(50)))
                {
                    style.normal.textColor = Color.green;
                }
            }
        }
    }
}

sentences:
Pixel Shader from Visual Studio Graphics Diagnostics i want to check my pixel shader variables in graphics diagnostics but unfortunately when i click start debugging in pixel history (mentioned below), a new tap will open and says source is not available. am i have to do anything before start debugging my shader in graphics diagnostics tool ?

Thanks

just to mention that, I use DirectX 11 and C++

sentences:
Why I get different size for equal attributes types? I trying to implement flexible shader attributes, but when I try to get them I got strange info.
This is my vertex shader:

    GLchar* vertexShader =
    "in vec4 position; \n"
    "in vec4 loc;\n"
    "\n"
    "void main()\n"
    "{\n"
    "gl_Position = position + loc;\n"
    "}";

This is my code with the help of which I get attributes info:

GLint i;
GLint count;

GLint size; // size of the variable
GLenum type; // type of the variable (float, vec3 or mat4, etc)

const GLsizei bufSize = 16; // maximum name length
GLchar name[bufSize]; // variable name in GLSL
GLsizei length; // name length

glGetProgramiv(shader->GetProgram(), GL_ACTIVE_ATTRIBUTES, &count);
printf("Active Attributes: %d\n", count);

for (i = 0; i < count; i++)
{
    glGetActiveAttrib(shader->GetProgram(), (GLuint)i, bufSize, &length, &size, &type, name);

    printf("Attribute #%d Type: %u Lenght: %d\n", i, type, length);
}

And what I get:

Why I got such strange info and how I can get size of each attribute?

sentences:
How can I make a sprite-sheet-based animation system? I want to make animations based on a sprite sheet, but I'm stuck implementing it.

The key things I need my code to do are:

Play through a set of images once (e.g. a jump animation)
Loop through a set of images continuously (e.g. a walking animation)
Change an animation's speed

How can I implement such a system?

sentences:
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:
Getting dynamic objects to match baked lighting on nearby static objects Here's how the hallway in my game looks now:

You might notice the dark section near the centre of the screen; This is, in fact, a pair of cupboard doors which are not set to static and so don't get included in the baked lighting.

The problem is, since all of my house lights are baked only, it looks like the only light these doors are getting is the ambient light - so quite dark.

Is there an alternative, best practise to ensure non-static objects get lit sufficiently when lighting is baked?

sentences:
How do I replicate the warp effect from Geometry Wars? I'm trying to achieve the warp effect that you see in games like Geometry Wars.

Can someone help explain what is going on here? I feel like the grid's z axis is manipulated in some way, any way, by the programmer, but is there maybe some known mathematical equation to really get the correct warping effect?

Edit: To be more specific, I mean the warping of the grid. How everything looks pulled towards the negative z axis and then bounces.

sentences:
LibGDX - Textures rendering at wrong position Update 2:

Let me further explain my problem since I think that i didn't make it clear enough:
The Y-coordinates on the bottom of my screen should be 0. Instead it is the height of my screen. That means the "higher" i touch/click the screen the less my y-coordinate gets.
Above that the origin is not inside my screen, atleast not the 0 y-coordinate.

Original post:

I'm currently developing a tower defence game for fun by using LibGDX.
There are places on my map where the player is or is not allowed to put towers on.
So I created different ArrayLists holding rectangles representing a tile on my map. (towerPositions)

for(int i = 0; i < map.getLayers().getCount(); i++) {
            curLay = (TiledMapTileLayer) map.getLayers().get(i);

            //For all Cells of current Layer
            for(int k = 0; k < curLay.getWidth(); k++) {
                for(int j = 0; j < curLay.getHeight(); j++) {
                    curCell = curLay.getCell(k, j);

                 //If there is a actual cell
                if(curCell != null) {
                    tileWidth = curLay.getTileWidth();
                    tileHeight = curLay.getTileHeight();
                    xTileKoord = tileWidth*k;
                    yTileKoord = tileHeight*j;

                    switch(curLay.getName()) {

                     //If layer named "TowersAllowed" picked
                    case "TowersAllowed":
                        towerPositions.add(new Rectangle(xTileKoord, yTileKoord,  tileWidth, tileHeight));

// ... AND SO ON

If the player clicks on a "allowed" field later on he has the opportunity to build a tower of his coice via a menu.
Now here is the problem: The towers render, but they render at wrong position. (They appear really random on the map, no certain pattern for me)

for(Rectangle curRect : towerPositions) {
            if(curRect.contains(xCoord, yCoord)) {

                //Using a certain tower in this example (left the menu out
                if(gameControl.createTower("towerXY")) {

                    //RenderObject is just a class holding the Texture and x/y coordinates
                    renderList.add(new RenderObject(new Texture(Gdx.files.internal("TowerXY.png")), curRect.x, curRect.y));
                }
            }
        }

Later on i render it:

game.batch.begin();
    for(int i = 0; i < renderList.size() ; i++) {
        game.batch.draw(renderList.get(i).myTexture, renderList.get(i).x, renderList.get(i).y);
    }
game.batch.end();

regards

sentences:
X, Y, Z coordinate standards? I'm pretty new to 3D development of any kind, nonetheless games. As I read through tutorials and examples, I find that the X/Y/Z coordinates seem a bit backwards than my first guess.

I had imagined that if a person were walking around a field, their X/Y position would be changing and if they were to jump or walk up or down a hill, then their Z position would be changing. My assumptions appear to be wrong because walking around a field seems to change X/Z and jumping or going up/down a hill alters the Y.

1) Are my observations correct? 3D is new to me and I may not be thinking about things properly.

2) What's the logic behind horizontal movement being X/Z and vertical movement being Y?

3) Would it be so wrong of me to use X/Y as horizontal movement and Z as vertical movement in the XNA Framework?

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:
Any good books on graphics programming? I've been looking for a book that takes a bottom-up approach for graphics programming. So something that starts with 2d filtering, maybe moving into normal mapping, then ambient occlusion, etc.

I ask because I've been lazy for the last few years in game development and always used an engine that handles this. I want to start writing some shaders for my games instead of relying on the cryptic ones that I've borrowed in the past. I think a very strong knowledge in this will help and I'm a bottom-up kind of learner so please help me out!

I know the GPU Gems series is great, but they seem to be more like a cookbook than a bottom-up approach that I want. You tend to get more scattered theory from cookbooks instead of building on theory from previous chapters.

EDIT: Preferably something you've read! I can search amazon for this, but it's hard to get a unbiased review that way.

sentences:
Python/PyGame mixer.music playback of OGG file has intermittent clicking sound - how to proceed? I have a class within my python + pygame game that handles sound - it worked well until I tried use pygame.mixer.music to switch between streaming .ogg music files. The class switches between them on the pause event.

The issue I'm having is that the music will play, and even switch between tracks fine, but about half the time I'm getting a quiet, regular clicking noise over the sound track. I've checked, and the pygame mixer is set to the same bitrate as my .ogg files. I've tried playing with number of channels and tracks, all to no avail. I'm not sure what the root cause of the clicking is - whether I've chosen a poor file encoding / bitrate, or just not initialized/called pygame mixer correctly.

Here is the problimatic code:

class SoundMgr():

def __init__(self):
       pygame.mixer.init(22050, -8, 4, 4096)
       self.musicFilename = ""
       self.musicPos = 0
       self.musicVolume = .35
       self.musicMuteVolume = .1

def playMusicTrack(self, which):
    pygame.mixer.music.load("data/music/" + which + ".ogg")
    pygame.mixer.music.set_volume(self.musicVolume)
    pygame.mixer.music.play(-1)
    self.musicFilename = which

def dampenMusic(self):
    mark = pygame.mixer.music.get_pos() * 0.001
    self.musicPos += mark
    pygame.mixer.music.load("data/music/" + self.musicFilename + "b.ogg")
    pygame.mixer.music.play(-1, self.musicPos)
    pygame.mixer.music.set_volume(self.musicMuteVolume)

def undampenMusic(self):
    mark = pygame.mixer.music.get_pos() * 0.001
    self.musicPos += mark
    pygame.mixer.music.load("data/music/" + self.musicFilename + ".ogg")
    pygame.mixer.music.play(-1, self.musicPos)
    pygame.mixer.music.set_volume(self.musicVolume)        </code>

When I call dampenMusic / undampenMusic the track plays correctly, but about half the time it has a clicking sound over it. The other half of the time it plays perfectly. I've tested, and I can't discover any pattern to when it will / won't have the static.

The clicking noise is about 2 times a second, and is about 50% the volume of the track.

Anyone who is more experienced with pygame / sound encoding able to give me any tips?

sentences: How to stitch terrains together in Unity I'm building a world that consists of multiple terrains and I was wondering, how do I go about stitching them together so that features of my map will "fit" together?  I know Unity has the SetNeighbors() method, but it appears as though that simply tells each terrain which terrain is next to the other.  What I'm trying to accomplish is having multiple terrains and being able to have something like a mountain range move from one terrain to another and make it appear as though it's all one terrain.

sentences:
Make an object rotates by an arbitrary angle and rotates toward a target in Unity I have an object facing up in Unity. I need it to move from point A to point B, without prior knowledge of where A and B are. So when I place it at point A, I need to rotate it toward point B. I used this:

this.gameObject.transform.rotation = Quaternion.FromToRotation(A.position, B.position);

However, before doing the movement, I also need to rotate the object by 90° around the X axis. I used this:

this.gameObject.transform.rotation = Quaternion.Euler(90.0f, 0.0f, 0.0f);

These two functions worked, but separately. When I try to use these two functions together, the last function called overrides the other.

sentences:
How to draw smooth circle in Libgdx I am trying to draw an circle to Libgdx which is created from Image not ShapeRenderer. But when I try to draw image to SpriteBatch it does not draw smoothly.

I checked the image resolution and Image Dimension is 1673x1673 and Sprite Size is 80x80.

  //This is my GameState code
  @Override
    public void render(float delta) {
        update(delta);
        SpriteBatch sb = game.batch;
        Color bg = ThemeFactory.getInstance().getTheme().backgroundColor;
        Gdx.gl.glClearColor(bg.r, bg.g, bg.b, bg.a);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        sb.setProjectionMatrix(camera.combined);
        sb.begin();
        for(int i =0;i<elements.size();i++){
            if(!(elements.get(i) instanceof Arrow)){
                elements.get(i).render(sb);//HERE IS DRAWING HAPPENING
            }
        }
        sb.end();
        barriers.render(sb);
        renderHud();
    }

My circle constructor and rendering code is below.

public Circle(Texture texture, Size size, Vector3 position){
        mSprite = new Sprite(texture);
        mSprite.setSize(size.width, size.height);//80x80
        mSprite.setPosition(position.x, position.y);
        mSprite.setOriginCenter();
    }
@Override
public void render(SpriteBatch sb) {
    mSprite.draw(sb);
}

I tried TextureFilters Nearest Nearest and Linear Linear but nothing has changed. And also increased samples for desktop and android applications, nothing has changed too.

sentences:
How to implement the graph for pathfinding using A* The game I am working on is based on a maze where each level is procedurally generated. The pathfinding grid is a 2D array where each node holds its connections. Path requests are handled one at a time so there can't be two path calculations going on simultaneously. So far I have each node hold its data required for the A* (H,F,G scores and its parent) and manipulate them directly in the algorithm. Since the nodes are the actual nodes and not copies of them, every time the algorithm runs the data changes permanently and I have to manually set them on default values before the next run.

So my questions are :

1) Is this a valid way of handling pathfinding in a game?

2) What other data manipulation techniques I could use in order to avoid that?

If you need a copy of the code it's all on my github under Pathfinding
and Managers/PathfindingManager.

sentences:
Decelerate moving platform at targets I'm trying to make a moving platform move at a constant speed and then when it is near the target start to slow down, I have trying to do this with Lerp, but I'm not satisfied with the results because of two reasons: it goes way too fast between targets, and way too slow near targets.

Also, when it reaches a target it immediately boosts off in the opposite direction. What I want to achieve is for the platform to move steadily between targets, decelerate near targets, and when reaching a target start to accelerate back to the steady speed.

What is the best way for achieving this? Lerp, Smoothstep, other? Thanks! (I'm using Unity)

My current solution:

 _dVeloctiy = _velocity * Time.fixedDeltaTime;
 Vector3 newPosition = Vector3.Lerp(_rigidBody.position, currentTargetPosition, _dVeloctiy.magnitude);
  _rigidBody.MovePosition(newPosition);

  Vector3 dPosition = _rigidBody.position - currentTargetPosition;

  if (dPosition.magnitude > 0.05f)
  {
      _isTurning = false;
  }

  if (dPosition.magnitude < 0.05f && !_isTurning)
  {
      currentTargetPosition = (currentTargetPosition == targetPosition1 ? targetPosition2 : targetPosition1);
      _isTurning = true;
  }

sentences:
Unity 2D - Object following target instead of moving towards it I'm making a 2D game with Unity that's based on avoiding/evading enemies.
The problem i'm facing right now is i can't get the enemies to move towards the target/player, but instead they follow it. So they never actually "attack" because they only follow it around and don't even come close to it. Also if the target/player stops moving, they stop moving.

I'm wondering if it could be something in my scene, since i've asked this question on multiple forum threads in the unity forums section and everyone seems to answer with the same lines of code.

Extra information:

My enemy has a box collider on it with no rigidbody 2D.
My player has a box collider on it with a rigidbody 2D.

Kind regards.

using UnityEngine;
using System.Collections;

public class BeeBehaviour : MonoBehaviour {

  public Transform target;
  public float moveSpeed = 3;

  void Start () {
    target = GameObject.Find("MainObject").transform;
  }

  void Update () {
    Chase();
  }

  void Chase () {
        Vector3 targetDirection = target.position - transform.position;
        transform.position += targetDirection * moveSpeed * Time.deltaTime;
  }
}

sentences:
How do I mask graphics in Unity to create a searchlight effect? I'm trying to make a searchlight-style punchout mask effect in Unity 2D. This is the effect I'm looking for:

That animation is made in Fireworks, using a white to black gradient circle masked on top of the map image below it. Here's a single frame for closer viewing.

How can I create this effect in Unity?

So far, I have a separate camera that only renders the white circle using a culling mask, but I'm not sure what to do from there.

sentences:
Alpha interpolation in a pixel shader How does the interpolation in a fragment shader work when it comes to the alpha parameter?

I'm programming a shader with SharpDX, DirectX11. My idea is to interpolate 2 3d points of a segment, so that I'll have the position interpolated in between in the pixel shader. But I want to know what happens with the alpha parameter when that position is blocked by another polygon.

For instance, if alpha is 1.0 at the left end of my segment and 0.0 at the other one. What is the value of alpha in the middle, 0.5? Or does it depend on the visibility at that point (meaning it could be, for instance, 1.0 OR 0.0 depending on if that part of the segment is hidden by a poolygon?

sentences:
How to get direction and velocity of movement of an object dragged with the mouse in Unty (C#) I have an object that is dragged by the mouse (X and Z positions) over a table, with the following simple code:

 Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
 if(Physics.Raycast(ray, out hit));
 pos = new Vector3(hit.point.x,myobject.transform.localScale.y/2,hit.point.z);
 myobject.GetComponent<Rigidbody>().MovePosition(pos);

The dragging works as expected. What I am struggling with is how can one retrieve the direction and velocity of such a movement, i.e. the direction and the velocity of that object when moved by being dragged by the mouse (I use Unity, C#). I have searched online, but only found the common ways to retrieve velocity and movement when using standard Rigidbody movement, not when dragged by the mouse.

sentences:
Continous horizontal animation of objects We have to continously animate objects from right to left in a panel. The player has to pop the first object.

If the first object could not be destroyed by the player and it reaches the left border of the panel, the game is over:

We have experimented by implementing this using Android widgets.

The panel is a HorizontalScrollView and the objects are ImageViews placed in a LinearLayout. The HSV is continously scrolled using ObjectAnimators and when the first object is popped by the player, a new object is added to the LinerLayout. This solution has some problems: the LinearLayout gets infinitely big, adding new objects to our model and layouting them causes small hiccups and the animator speed is changable through the Android developer options which makes implementing high score pointless.

What would be a "standard" solution for games with an infinite animation where constant animation speed and good performance are critical? Is using native widgets possible with these requirements or should we throw everything away and use a Canvas?

sentences:
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:
Poor performance in android when running APK, runs fine in browser I have created a small game project in HTML5 using Phaser engine (tried both 1.1.5 and 1.1.6). Then to port it to mobile platform, used Phonegap/Cordova for Windows Phone 8, Android and iOS.

In my game, there are around 10 elements, which get animated (moving from point a to point b and some rotation at same time). On iOS and Windows Phone 8, I didn't face any issue.

But with Android, performance is unacceptable. On the other hand, if I run my game via device browser, it run smooth without any lag. But compiled APK runs very jerky and elements move very slow & in flickering manner.

I have checked android hardware acceleration flag is set to "true" in manifest file. Tried changing it false too, but that didn't reflected any change in performance.

I have checked same on Android 4.2 on Samsung S2 device and on that performance is better. But on Asus Nexus Tab 7 (running Android 4.4) its very jerky, while the OS and Device both are latest. Also checked on another device running Android 4.3 (Samsung Galaxy Grand Duos) and on that too performance is not good at all.

In my game tried both WebGL / Canvas rendering (Phaser engine uses Pixi.js, which fallback to 2d canvas if WebGL isn't supported), but no change. Similarly with easeljs.

If anyone else faced similar issue and can suggest any way to get native like performance. I checked cocoonjs examples and while they seems smooth and acceptable, I can't go for that route.

sentences:
how to call the specific animation? I have a script to control the player simply moves Left, move right, etc..
but the animation when winning, losing, or Light, just put it on the animation and animator and no script for it.

I wanted to ask. if player enter at the collider, how to call animation light ?

void OnTriggerEnter2D(Collider2D theCollider)
    {
        try
        {
            // how can i call animation light //
        }
        catch { /*On error do nothing*/ }
    }

sentences:
What is Clash of Clans projection called? What is the Clash of Clans projection (it doesn't seem to be isometric Image )
Image from here

sentences:
Component systems: No inheritance hierarchy at all, or a basic one? (I asked a similar question, but it had more questions inside it and I feel it wasn't clear enough, so I'm opening a new one).

Until recently I implemented all my games using an inheritance hierarchy. Those were simple games.

For example:

          Entity
          /    \
      Movable  Static
      /  \        /  \
    Orc  Mage   Tree  Wall

This worked for simple games.

However recently I read about 'entity component systems'. Using this approach, a class doesn't inherit from another class in order to receive functionality. Instead it is composed with it, which allows for more flexible designs.

My question is this:

I know that each component is a class (derived from a common base class).

However, there is one thing I don't understand: In the 'component system' approach, is there one class that all entities are instances of - and the only difference between entities is the components they contain?

For example: There is a class Entity. All entities in the game are instances of this class.

The only differences between them is that they are composed with different Component objects.

For example:

Component aiComponent = new AIComponent();
Component movementComponent = new MovementComponent();
Component physicsComponent = new PhysicsComponent();
Component rangedAttackComponent = new RangedAttackComponent();

Entity orc = new Entity();
orc.addComponent(aiComponent);
orc.addComponent(movementComponent);
orc.addComponent(physicsComponent);

Entity shootingCastle = new Entity();
orc.addComponent(aiComponent);
orc.addComponent(rangedAttackComponent);
orc.addComponent(physicsComponent);

As you can see, both orc and shootingCastle are instances of the Entity class. But they are composed with different components.

Is this how 'entity component systems' are supposed to be? No inheritance hierarchy at all? Or is there still a basic inheritance hierarchy, but most of the logic is inside components?

sentences:
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:
MMOFPS Player Positions I'm working on a MMO game project. I have a question about MMOFPS game architecture. (I have basic network knowladge)

(MMOFPS) I want to send player position to other players(clients) and other players will render the player. Namely this is the base of the game world. I have read some article about positioning and somebody says "use inputs for movement update" and others says "use  position posting". That's the first problem. What is better? input or position based movement posting? What is more suitable for a MMOFPS game? (And how to do it?)

SUMMARY: I need to learn "how real multiplayer games work?" (but basically). In my first project I have used TCP protocol for posting position (not inputs) and I have sent position data 4 times per second. Server delivered them to other clients and other clients handled this data and maked a smooth movement. This is a very basic method to do it but I know that isn't MMO! Can anybody help me about understanding MMO game architecture?

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 is the best way to eliminate grinding in games? This is a very persistent question in game design, especially in games where you need to hold/retain players like MMO or social games. (On a side note grinding can easily calculated so its easy tool for engagement and timed progression).

The question other than community building/competition are there solutions that can replace grinding and still hold your audience for certain period of time (without adding large amounts of game assets and code)?

sentences:
How to stop the RotateAround function to rotate after Keypress in Unity I have a camera follow script and I am rotating the camera with Q and E key to right and left. The Camera is a child of a camHolder object. I came up with this code, which rotates around the player to the right and left, but it's shaking as it tries to keep rotating around the player.

I didn't come up with a solution to stop the RotateAround function, instead I tried setting rotateSpeed to 0 after I let go of the key, but that didn't work either.

public Transform player;
public float smoothSpeed = 0.125f;
public float rotateSpeed;
private Vector3 velocity = Vector3.zero;

[SerializeField]
private Vector3 offset;

[Space]
public Transform camHolder;

void LateUpdate ()
{
    CameraFollowPlayer();
}

void Update()
{
    RotateCamera();
}

void CameraFollowPlayer()
{
    camHolder.position = Vector3.SmoothDamp(transform.position, player.position + offset,
                                             ref velocity, smoothSpeed * Time.deltaTime);
    transform.LookAt(player.position);
}

void RotateCamera()
{
    if(Input.GetKey (KeyCode.E))
    {
        rotateSpeed += 20f;
        if(rotateSpeed >= 20f)
        {
            rotateSpeed = 20f;
        transform.RotateAround(player.position, transform.up, rotateSpeed * Time.deltaTime);
        }
    }
    else
    {
        rotateSpeed = 0f;
    }

    if(Input.GetKey (KeyCode.Q))
    {
        rotateSpeed += 20f;
        if(rotateSpeed >= 20f)
        {
            rotateSpeed = 20f;
            transform.RotateAround(player.position, transform.up, -rotateSpeed * Time.deltaTime);
        }
    }
    else
    {
        rotateSpeed = 0f;
    }
}

sentences:
What is morph target animation? I've been using Adobe Flash and its keyframe-based animation for some years.
I recently about heard morph-targets animation from Wikipedia.

It seems that the morph target animation is also keyframe-based.
What are the differences between Flash's animation and morph target animation?

sentences:
LibGDX Rectangle not Scaling to ImageButton Instance as Expected below is the class I wrote for a GameButtoninstance:

public class GameButton {

private ImageButton button;
private TextureRegionDrawable drawableUp, drawableDown;
private Rectangle hitbox;

public GameButton(int x, int y){
    final int boxSize = 100;
    drawableUp = new TextureRegionDrawable(AssetLoader.gameButtonUp);
    drawableDown = new TextureRegionDrawable(AssetLoader.gameButtonDown);
    button = new ImageButton(drawableDown, drawableUp, drawableUp);
    button.setPosition(x,y);
    button.setSize(100,100);
    hitbox = new Rectangle(x,y,0,0);

    button.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            if(button.isChecked()){
                hitbox.setSize(boxSize,boxSize);
                Gdx.app.log("Button", "active ("+hitbox.getWidth()+","+hitbox.getHeight()+")");
            }else{
                hitbox.setSize(0,0);
                Gdx.app.log("Button", "inactive ("+hitbox.getWidth()+","+hitbox.getHeight()+")");
                button.setChecked(false);
            }
        }
    });
}

public Rectangle getHitbox(){ return hitbox; }

public ImageButton getButton(){return button;}}

Essentially this class defines an ImageButton with a bounding Rectangle that changes size whenever I click the button. The size change works as expected, however the bounding Rectangle isn't up to scale with the ImageButton. AssetLoader.gameButtonUp is a TextureRegion with coordinates (131,142) the same dimensions as the texture image.

However, when I use ShapeRenderer to draw where the rectangle is on screen I get this,

when the desired outcome to have that big square is to be on top of the blue button in this image and for it to be the same size

(Ignore the smaller rectangle in the top left)

I'm still new to libGDX, so any help would be appreciated.
Thanks.

sentences:
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:
Save Texture2D to file in Monogame I'm working on a tilesheet builder tool for my game to speed up tile creation, and I need to save a generated texture2D as a png. I've tried using the .SaveAsPng function but it isn't implemented in Monogame.

Is there any way around this in monogame?

EDIT:
I've tried this:

private void SaveTextureData(RenderTarget2D texture, string filename)
    {
        byte[] imageData = new byte[4 * texture.Width * texture.Height];
        texture.GetData<byte>(imageData);

        System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(texture.Width, texture.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
        System.Drawing.Imaging.BitmapData bmData = bitmap.LockBits(new System.Drawing.Rectangle(0, 0, texture.Width, texture.Height), System.Drawing.Imaging.ImageLockMode.ReadWrite, bitmap.PixelFormat);
        IntPtr pnative = bmData.Scan0;
        System.Runtime.InteropServices.Marshal.Copy(imageData, 0, pnative, 4 * texture.Width * texture.Height);
        bitmap.UnlockBits(bmData);
        bitmap.Save(filename);
    }

but it's giving a weird output, and I don't know why:
http://i.imgur.com/XT9Dnjj.png

Thanks for any help!

sentences:
How could I do a 2d pixel design in game where you can see though the obstacles/upper floors? Maybe the question didnt show much... but what I'm trying to do is e.g. if I'm in a train platform with two floors overlapped, or in a place where I'm blocked by some obstacle to see my char. from my view. I want to let my character be visible but have how should I say, have lines? of the obstacles overlapped a bit so i can have an impressing there is an obstacle but you're seeing your char. through, kinda like half-visible, kinda like gradation.

tl;dr - I want to see my character who is normally should be blocked the view from my POV to be visible, while also making the player to see that there's something between the character and the POV. is there a method I can check?

using dots to create this via photoshop.

sentences:
SDL Multiple keyboard support I am making a game with multiplayer split screen mode using SDL. Basically, I like the idea of having each player plug in his own keyboard to the PC, set custom controls via options and being able to play it with controls that he likes.

However, there's a problem. This code gets the keyboard event:

SDL_Event event;
SDL_PollEvent(&event);

SDL_Event has member SDL_KeyboardEvent key, which has member Uint8 which. In short:

event.key.which;

According to this, it should represent keyboard device index, however, I've tried connecting three keyboards to my PC and press the buttons at the same time and the result wasn't satisfying: they all had same keyboard indexes. Is there a solution to this? Or am I missing something?

sentences:
How to add zombie arms to enemies in HTML canvas I'm making a game with HTML canvas (not WEBGL). I have zombies that go to the center of the screen, but for now they are just circles. I want to give them two arms, like the arms players have in surviv.io. I have looked at this question: Moving an object in a circular path. I don't know what trigonometry to use to calculate the angle. Here is my code:

var canvas = document.querySelector('#canvas');
var context = canvas.getContext('2d');

function Enemy(x, y) {
  this.x = x;
  this.y = y;
  this.r = 5;
  this.color = `hsl(${Math.floor(Math.random() * 360)},50%,50%)`;
  this.vx = 0;
  this.vy = 0;
  this.draw = () => {
    this.x += this.vx;
    this.y += this.vy;
    context.beginPath();
    context.fillStyle = this.color;
    context.arc(this.x, this.y, this.r, 0, Math.PI * 2);
    context.fill();
  }
}
var enemy = new Enemy(0, 0);

function loop() {
  requestAnimationFrame(loop);
  context.fillStyle = 'rgba(0,0,0,0.2)';
  context.fillRect(0, 0, canvas.width, canvas.height);
  var angle = Math.atan2(canvas.height / 2 - enemy.y, canvas.width / 2 - enemy.x);
  enemy.vx = Math.cos(angle);
  enemy.vy = Math.sin(angle);
  enemy.draw();
}
requestAnimationFrame(loop)
<canvas id='canvas'>

I want the arms facing the center, and I want them to move when the enemy changes direction.

sentences:
Cursor is locked and hidden, and can't click UI I have a player with a third person character controller component. I have a problem with the cursor lock: it hides the cursor so I cannot click UI buttons.
protected virtual void CharacterInit()
{
    cc = GetComponent<vThirdPersonController>();
    if (cc != null)
         cc.Init();

    tpCamera = FindObjectOfType<vThirdPersonCamera>();
    if (tpCamera) tpCamera.SetMainTarget(this.transform);

    Cursor.visible = false;
    Cursor.lockState = CursorLockMode.Locked;
}

sentences:
A* and Space partitioning I'm planning on implementing A* in my game for pathfinding, I understand the basics of how the algorithm works but I was wondering, other than finding the start and end nodes Are there any benefits to placing the navigation graph into a tree? It seems to me that it wouldn't really benefit any as each node has a list of connections to other nodes. But I recall reading an article about pathfinding a while back and it suggested using a space partition tree, I believe it suggested an AABB tree to be exact.

If A* wouldn't benefit would any of the algorithms benefit from such a thing?

And no, sadly I can't find the article again.

sentences:
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:
How to use phaser documention? im new to game development and i began with phaser which seems to be a great framework but i can't understand it's documention very well.
Lets talk about phaser groups docs examples

How you understand how to use groups based on the documention ? Examples are clearer but limited they dont cover everything.

PS: valueerror answered this question in html5gamedevs

link to answer

sentences: How many directional lights in Unity In Unity, how many directional lights can be active at once? 1, 2, 4, or 8? I thought 2, but I have searched and cannot confirm.

sentences:
How to generate random level from a seed? How would I go about using a random seed to generate a game level? The same seed should always generate the exact same level.

For this example it would be a Worms style level. So each level would have a theme (grasslands, snow etc), base terrain, different objects such as trees.

So where would I start to create this kind of level generator? What would be involved? What concepts does it use?

Bonus points for any any good links (bonus bonus points for anything related to how it was done in worms or similar).

Thanks.

sentences:
Unity - how to put a target under a character's feet that follows ground model contours? In my current projects, one of the power-ups needs to place a target marker centered on the position of the player triggering it - the actual design for this is TBC, but will be a circle with a radius of 10 units.

The ground for the playing arena is a model, and not flat. Assuming that I use a texture to show this target area, how can I have this texture render following the contours of the ground?

Alternatively, any other approach to solving this would be appreciated.

Thank!

sentences:
Game Loop Problem - Growth and Recharge as Integer Values I have a question about game loops. I understand that you shouldn't have a static loop, say 100ms and set something's speed to 1px/frame so it moves 10px/sec. You should have a speed and multiple that by the elapsed time so frame rate does not effect game speed. This works fine for values that can be floats, but what if I need integer values? Say shields recharging or something. I have a damage system is my game and I would really love to stay away from float damage values, both for memory and game design reasons.

However if I just have a running total of elapsed time, and I recharge one point once this elapsed time is over 1 second then over the course of time won't I have some consistency errors between recharging over one set of 100 real seconds and another set of 100 real seconds because those two sets may not have the same number of frames in them. This questions also comes up in rate of fire. If I need a turret to fire every .5seconds, won't there be some variance if I do a running total of elapsed time? Sometimes it may fire every .501 seconds and other time .510 seconds?

I guess my question is, how exact are games really? Do most games just do a check every frame and say, "Well your rate of fire is .5 seconds, and its been .504 since you last fired, so fire now." If so would it work out for the next fire cycle to only check for .496 seconds to average out? I know it most games under 10 minutes this would barely be noticeable, but over the long term this may actually mater in some cases.

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

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

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

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

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

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

    gl_Position = gl_ModelViewProjectionMatrix * vec4(Position,1);

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

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

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

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

sentences:
Ball vs 45-degree slope collision detection I have a simple game in which the player moves a ball around. The ball bounces off of walls. Right now I have square walls(■) implemented: I use simple bounding-box collisions to check if the player will move into a wall when updating its x or y speed and if so, I multiply that speed with -1 to make them bounce.

However, I also want to implement triangular pieces(◢◣◤◥). To bounce back I believe one can simply use:

   newxspeed = -1*yspeed;
   newyspeed = -1*xspeed;

However, what I am having trouble with is the collision detection: When does the player hit the diagonal?

sentences:
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: Weird blue shine on URP Lit shader Unity I recently started to use URP and I am noticing a weird blue like tint on shiny objects that use the URP/lot shader and I can't understand what it is and how can i remove it.

sentences:
Unable to detect continuous keypress event in SDL I am developing a game using SDL, and am unable to do continuous motion for my object when a key is held down.

I'm calling SDL_PollEvent() to retrieve all events during a frame, and passing each resulting SDL_Event structure into this function:

void Avatar::handle_input(SDL_Event keyInput){
if( keyInput.type == SDL_KEYDOWN )
{
    //Adjust the velocity
    switch( keyInput.key.keysym.sym )
    {
    case SDLK_LEFT: Move(1); break;
    case SDLK_RIGHT: Move(2); break;
    }
}

The problem is that when I hold down the right or left arrow keys, the avatar only moves once instead of moving continuously for as long as I hold down the key.  How can I make the motion continue for as long as the key is held down?

sentences:
Procedural terrain using 3D noise I'm coding a procedural terrain generation based on this article from GPU Gems 3.

But using CPU (not GPU). I'm stuck at generating the procedural terrain. I just can't
figure out how make a 3D texture the way it looks in the article (fig. 1-10). Am I missing something big here? Here is the code:

float CTerrain::DensityFunction(float x, float y, float z) {
    CPerlin3DTexture perl_tex;
    float noise;
    uint32_t octaves = 3;
    float amplitude[10] = {0.25,0.5,1.0,1.9,4.1,8.1,16.1,9,10};
    float lacunarity = 1.5;
    float freq[10] = {4.03,1.96,1.01,0.51,0.2487,0.12563,0.8013,0.39913, 0, 0};
    uint32_t i;

noise = 0.0;
    for(i=0; i < octaves; ++i ) {
        noise += perl_tex.noise(x * freq[i],
                                y * freq[i],
                                z * freq[i]) * amplitude[i];
        x *= lacunarity;
        y *= lacunarity;
        z *= lacunarity;
    }

    return noise;
}

Values (nx,ny,nz) = (128,128,10)

float ***CTerrain::GenerateDensityTexture(uint32_t nx, uint32_t ny, uint32_t nz) {
float step[3];
int32_t i, j, k;

step[0] = 1.0 / (float)nx;
step[1] = 1.0 / (float)ny;
step[2] = 1.0 / (float)nz;
for(i = 1; i < nx-1; i++) {
    for(j = 1; j < ny-1; j++) {
        for(k = 1; k < nz-1; k++) {
            tex[i][j][k] = DensityFunction((float)i * step[0],
                                           (float)j * step[1],
                                           (float)k * step[2]);
        }
    }
 }

return tex;
}

Help, anybody? This is what I get from the above code:

sentences:
What is the graphical effect occurring to non-mipmapped distant textures called? We all know about mip-mapping. It reduces texture quality when a texture is further away.

Without mip-mapping, a texture appears to "flicker", like the top of the mountain here:

Is there any specific name for it?

I want to write a sentence like "I applied mip-mapping to solve the ___ effect", or "This is known as ___, and occurs when mip-mapping is not used".

sentences:
Cross-platform ad-hoc local mobile multiplayer I want to implement ad-hoc cross-platform (iOS, Android, and PC) device discovery for local multiplayer, like this scenario: http://www.youtube.com/watch?v=csXYZf2vGdE  Multiple players, each with different devices (iOS, Android, PC). One player starts a game. The others can search and automatically discover his game and enter into a local multiplayer match. This would all be done P2P, without any dedicated game servers.

Is this possible with current technology?

sentences: Can I use xna tutorials to learn monogame? Can I use xna tutorials to learn monogame? I can't find any good monogame tutorials but there are tons of xna tutorials available and from what I have seen they are pretty much the same thing.

sentences:
Implementing a build queue in a browser based game I need to be able to execute certain events at a given time in my game, for example, say the player "Builds a building" this building should take 15mins to process. Implementing this seems straightforward enough, simply enter the event into the database and execute the event when the time comes for it to be completed.

However, it is my understanding that i would need a script that is running permanently on the server and continually checks the event database for delayed events to execute and process them as needed. My question is, is this the right approach or should i be tackling the "event que" differently?

Some of the events that will be processed can effect many different players so they would need to happen in real time, as opposed to be lazy loaded.

You can see similar such event queues in browser games such as travian, grepolis etc.

Update - If i was to implement a purely lazy load method, are there any flaws in the following pseudo code?

    ## upon player_x pages load

## start a loop that will only exit once all needed events have been processed

## check for any events initiated by player_x that are overdue

## get event and lock it for processing

    ## does this event involve another players object?

        ## if it does, then lets check if said object also has any events that should happen before this event

            ## if it has, then lets process one of those events instead, and loop again once processed

            ## if it doesnt have any previous events, then we're free to process this event, do it

## loop till all overdue events for player_x's object are done

sentences:
Why lib3ds can't open this max model? I'm using lib3ds's 3dsplay example to load this model, whose suffix is .max
but get this error:
3dsplayer: Error: Loading 3DS file failed.

But it can load the .3ds model shipped with lib3ds.
Why lib3ds can't open this .max model?

sentences:
How to blend motions with Mecanim I'm struggling with Mecanim.

My concern is to blend straight/turning animations with strafe animation for a humanoid character.

I downloaded a SampleAsset from unity and took Ethan character as example. The animator uses a blendtree which naturally blend idle/walking/running animations with a smooth turning left/right animations. In this case the Ethan character cannot strafe.

I'm trying to understand how to blend strafe movement with it's actual straight/turning blending motion.

Was I somewhat clear?

sentences:
Making a multi-pieced rectangular breakable body with Farseer Using Farseer 3.3.1  I want to create a rectangular BreakableBody with many pieces.  Right now here is my code:

Vertices polygon = PolygonTools.CreateRectangle( 2.5f , 1.25f );
List<Vertices> triangulated = FlipcodeDecomposer.ConvexPartition(polygon);
BreakableBody breakableBody = new BreakableBody(triangulated, World, 1);
breakableBody.MainBody.Position = Vector2.Zero;
breakableBody.Strength = 5;
World.AddBreakableBody(breakableBody);

This code turns the rectangle into two pieces (cut from corner to corner).  I have tried four of the five decomposing methods (Flipcode, Bayazit, CDT and Earclip).  I also haven't been able to find any good examples of a rectangle being divided into multiple pieces.

Preferably, I am looking for a way to create random sized pieces, but cutting it into 32 cubes ( 8 x 4 ) would be fine also.

sentences:
Translate the ModelView matrix, or change vertex coordinates? If I have a simple 2D scene and I want to move the objects inside the scene on the X and Y axis, should I send OpenGL the original vertex coordinates with each move and apply a ModelView matrix transform, or should I simply send the updated coordinates?

Since the scene is simple and there are really not that many vertices, I'm not using vertex buffers.

sentences:
C++ in Unity with dependencies I am currently creating a c++ program to eventually use in Unity. This c++ program contains references to libraries like OpenCV and dlib, referenced with a include statement which calls in other files, which are installed on my machine. My question is:

How do you compile your c++ project so that it runs in Unity completely self-contained? i.e no reference to external files are needed, and all that are references are included within the program. Is there a specific tool to use, or a useful tutorial on the net?

Thanks for the help.

sentences:
Intersect of vector and triangle side I'm trying to create a triangular touch surface for iOS where the user can drag around a point inside this triangle. Using information from this page, it is easy to figure out if the dragged point is inside or outside the triangle. However, I want to clip the point to the triangle edges if the user drags outside the triangle.

This is easy for side AB and side AC, because I just have to set vectors u or v to zero respectively if the user's finger drags outside of these edges. However, I'm not sure how to find point p, on side BC. I need to find this point of intersection if the user drags their finger outside of edge BC.

sentences:
Storage and Lookup of Voxel Chunks How can one store chunks in such a way that they can be looked up using their XYZ location without wasting memory?

The problem with a HashMap<Vector3i, Chunk> is that you have to keep creating Vector3i objects, just to use them in the lookup.

I am basically looking for a solution that does not involve the creation of an object to perform a lookup.

sentences:
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 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:
Can state setting warnings be ignored? If I am running DirectX 11 in debug mode (D3D11_CREATE_DEVICE_DEBUG), I am constantly getting these warnings:

D3D11 WARNING: ID3D11DeviceContext::OMSetRenderTargets: Resource being set to OM DepthStencil is still bound on input! [ STATE_SETTING WARNING #9: DEVICE_OMSETRENDERTARGETS_HAZARD]
D3D11 WARNING: ID3D11DeviceContext::OMSetRenderTargets[AndUnorderedAccessViews]: Forcing PS shader resource slot 6 to NULL. [ STATE_SETTING WARNING #7: DEVICE_PSSETSHADERRESOURCES_HAZARD]

It is because I am setting a resource as a render target while it is currently bound to the PS. However, my rendering flow is set up such as it relies on the api to force the resource slot to null, and it works.

Is there any reason I should be bothered with these warnings or I can rely on the api to enforce this every time? I only tested on 2 GPU-s: Intel HD 3000 and Nvidia GT525m.

sentences:
Huge slowdown when running Lua as statically linked lib versus stand alone interpreter I'm developing some algorithms in Lua which are run mostly in Lua (few calls to C++) and I'm noticing a huge slowdown when I'm running them from my app rather than the default Lua interpreter.
The script returns in about 11 seconds with the interpreter, and about 5+ minutes with my program.

I don't think it is a problem with calling the C++ function, overruling that function with an empty function in the script has no noticeable effect for time.

Both Lua and the program are compiled with Visual Studio 2010 (I created a new solution for Lua, with projects for both the interpreter and static library)

I've run a profiler on the code (the Very Sleepy profiler, can't get a Lua profiler working but haven't tried to much) and found that in my application around 50% of the time is spend on malloc.. and 40% on free, both called from the Lua garbage collector (tried disabling that to check, but that crashes with using to much memory (understandably), the Lua interpreter peeks at about 4mb ram usage).

I'm new at Lua, so its very possible I've done something wrong somewhere, anyone got a few hints to try?

sentences:
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:
android game performance regarding timers Im new to the game-dev world and I have a tendancy to over-simplify my code, and sometimes this costs me alot fo memory.

Im using a custom TimerTask that looks like this:

    public class Task extends TimerTask {

    private MainGamePanel panel;
    public Task(MainGamePanel panel) {
    this.panel=panel;
    }

    /**
    * When the timer executes, this code is run.
    */
    public void run() {
    panel.createEnemies();
    }
    }

this task calls this method from my view:

    public void createEnemies() {
    Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.female);
    if(enemyCounter < 24){
        enemies.add(new Enemy(bmp, this));
    }
    enemyCounter++;
      }

Since I call this in the onCreate-method instead of in my views contructor (because My enemies need to get width and height of view). Im wondering if this will work when I have multiple levels in game (start a new intent). And if this kind of timer really is the best way to add a delay between the spawning-time of my enemies performance-wise.

adding code for my timer if any1 came here cus they dont understand timers:

    private Timer timer1 = new Timer();
    private long delay1 = 5*1000; // 5 sec delay

    public void surfaceCreated(SurfaceHolder holder) {
    timer1.schedule(new Task(this), 0, delay1); //I call my timer and add the delay
    thread.setRunning(true);
    thread.start();
}

sentences:
Isometric view : what is the right angle to use? Wikipedia states in an isometric view, all angles must be equal to 120.

I am building my assets by making screenshots of some 3D models, so I can get any point of view on them. I tried to capture them with a POV which gave me angles of 120 everywhere, but once I put those 2D assets in an isometric game engine, it was a bit weird looking.

Then I noticed something weird : in Age Of Empires, angles are not of 120 but 127 ! example : http://img1.wikia.nocookie.net/__cb20120311170558/ageofempires/images/7/74/Age_of_empires_building_towncenter.jpg
I tried building assets so that their base has an angle of 127 and it's better looking.

What is the reason behind that ? What is the right angle to use ? What do you use ?

sentences:
Game Maker Studio - how do I disable mouse click for a duration of time? I Have a button that starts in a rest state, and then after clicking on the button, it animates out. I want to disable the mouse click for around 30 steps after the button has been clicked, otherwise the player will be able to constantly click on the button, which resets the animation and messes up my menu.

Is there any way to disable the mouse click for a duration of time before enabling it again?

This is the code I have used to try and make the variable "click" alternate between true and false (it is supposed to remain false while alarm[0] is between 30 and 0).

Initially (in the create event)

click = false;
alarm[0] = -1;
alarmReset = true;

this is the code found in the step event:

if(mouse_check_button_pressed(mb_left))
{
    if(alarmReset == true)
    {
    click = true;
    alarm[0] = 30;
    alarmReset = false;
    }
}

if (alarm[0] > 0 )
{
    if (alarm[0] < 30)  click = false;
}
if (alarm[0] < 0 ) alarmReset = true;

When running this code, "click" is initially false, but when I click, it gets set to true, and then is never set to false again. Any help would be appreciated.

sentences:
Is there any reason not to make all my components a single class? What would be the downside to using a generic all-encompassing Component class versus specific classes (PositionComponent, InputComponent, et cetera) for each component in an entity/component system?

By 'generic' I mean:

class Component {
  String name; // component name, like "position"
  Map<Key, Object> attribs; // Attributes like "x" and "y" stored here.
}

Where a 'specific' component might be:

class PositionComponent {
  int x, y;
}

I feel like creating a separate class for each component means tons of 3-5 line classes in my code-base.

sentences:
Best way to calculate unit deaths in browser game combat? My browser game's combat system is written and mechanically functioning well.  It's written in PHP and uses a SQL database.  I'm happy with the unit balance in relation to one another.  I am, however, a little worried about how I'm calculating unit deaths when one player attacks another because the deaths seem to pile up a little fast for my taste.

For this system, a battle doesn't just trigger, calculate winner, and end.  Instead, it is allowed to go for several rounds (say one round every 15 mins.) until one side passes a threshold of being too strong for the other player and allows players to send reinforcements between rounds.

Each round, units pair up and attack each other.  Essentially what I do is calculate the damage:

AP = Attack Points
HP = Hit Points

Units AP * Quantity * Random Factors * other factors (such as attrition)

I take that and divide by the defending unit's HP to find the number of casualties of defending units.  So, for example (simplified to take out some factors), if I have: 500 attackers with 50 AP vs 1000 defenders with 100 HP = 250 deaths.  I wonder if that last step could be handled better to reduce the deaths piling up.

Some ideas:

I just change all the units with more HP?
I make sure to set the Attacking unit's AP to be a max of the defender's HP to make sure they only kill 1 unit.  (is that fair if I have less huge units vs many small units?)
I spread the damage around more by including the defending unit's quantity more? i.e. in that scenario some are dead and some are 50% damage.  (How would I track this every round?).  This kind of seems like the best idea, but not sure how i'd track it in the DB.
Other better mathematical approaches?

sentences:
Good book/resource recommendation for HTML5 mobile game development? The problem: I am taking an existing, 5 year old, html based MMORTS game and "HTML5-ing" it, "AJAX-ing" it and most importantly, optimizing for mobile devices like iPhone, android etc. For these devices, the application will be packaged as a downloadable app that is a wrapper for a browser which actually shows the game..

The Question
Looking for a good book, or books, or in-depth articles that would help me learn:

what tools I have in iOS, andriod applications for optimizing an html based game. things like caching of images, etc
what kind of connectivity, or interactivity I can expect between the html/javascript pages and the wrapper - can I play sounds in the wrapper by triggering them from javascript? etc
tip and tricks to optimize html/html5 & Javascript application to run well on mobile devices
ETC :)

Any recommendations would be greatly appreciated!!

sentences:
How 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:
How do I summarize a game idea into a short document? I have a lot of game ideas, but never the time to work on them. I don't want to lose these ideas, so I want to 'store' them somewhere to come back to in the future. Sometimes an idea isn't really that good, and coming back would help me decide whether a game idea is worth pursuing.

I plan to keep these in some kind of catalog form. I would like to be able to capture the 'feel' of a game in as few words as possible. Even if looking back at the design a few years later, the feel and atmosphere of the game should be recoverable very quickly.

This isn't really a full design document, but something like a 'one-page' summary.

sentences:
Using spritesheets with z-buffer I am working on a 2D game with sprite sheets. I might be completely overlooking something here, but I can't figure out for the life of me how to use sprite sheets with z-buffer testing.

Here are the conflicting issues as I understand them:

A sprite in a spritesheet will have transparent pixels all around it that define where the sprite doesn't exist (since each frame in the sprite sheet "grid" is a rectangle, but the sprite is contained within that rectangle).
Transparency doesn't work with z-testing.

Therefore, it's impossible to use spritesheets with the z-buffer? I should just use painter's algorithm then?

Are both of those conclusions correct?

sentences:
Stitching meshes together I have a voxel engine that generates a mesh per chunk and now I want my meshes to be 1 mesh, but if I create them as a single mesh I kind of lose the benefit of chunking the data in the first place.

=Here's what i'm currently getting

I need to remove the gaps, any ideas?

sentences: Socket.io emit textfield Hello everyone I learned how to emit from socket.io website guides but I was wondering how does the chat example receive its input? For example in my cocos2dx app how do I pass a text field over to the socket.io chat?

sentences:
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:
What is missing from SDL for it to gain more widespread adoption? As I understand, SDL offers abstractions that let you make windows, handle input and audio much easier than doing so directly with the low level APIs provided by several operating systems.

However, it seems that a lot of games, both indie and AAA, don't use it, and I would like to know why. This makes me suspect that there may be areas where SDL is lacking, such as features, performance, or robustness, when compared to platform-specific APIs.

Apart from platform support, that is, considering only the platforms SDL supports, I do not understand what would keep a developer from using SDL for their game, since I feel like, based on my admittedly limited knowledge, it'd be much smarter to use SDL on the platforms that do support it.

sentences:
How do I draw a dotted or dashed line? I'm trying to draw a dashed or dotted line by placing individual segments(dashes) along a path and then separating them. The only algorithm I could come up with for this gave me a dash length that was variable based on the angle of the line. Like this:

private function createDashedLine(fromX:Float, fromY:Float, toX:Float, toY:Float):Sprite
{
    var line = new Sprite();
    var currentX = fromX;
    var currentY = fromY;
    var addX = (toX - fromX) * 0.0075;
    var addY = (toY - fromY) * 0.0075;
    line.graphics.lineStyle(1, 0xFFFFFF);

    var count = 0;

    // while line is not complete
    while (!lineAtDestination(fromX, fromY, toX, toY, currentX, currentY))
    {
        /// move line draw cursor to beginning of next dash
        line.graphics.moveTo(currentX, currentY);

        // if dash is even
        if (count % 2 == 0)
        {
            // draw the dash
            line.graphics.lineTo(currentX + addX, currentY + addY);
        }

        // add next dash's length to current cursor position
        currentX += addX;
        currentY += addY;

        count++;
    }
    return line;
}

This just happens to be written in Haxe, but the solution should be language neutral. What I would like is for the dash length to be the same no matter what angle the line is. As is, it's just adding 75 thousandths of the line length to the x and y, so if the line is and a 45 degree angle you get pretty much a solid line. If the line is at something shallow like 85 degrees then you get a nice looking dashed line. So, the dash length is variable, and I don't want that. How would I make a function that I can pass a "dash length" into and get that length of dash, no matter what the angle is?

If you need to completely disregard my code, be my guest. I'm sure there's a better solution.

EDIT:
To clarify, I can't use vectors (unless they're easy to implement, I'm not even sure how vec2 works) also I'd like the dash length to be based on neither line rotation NOR line length. So, no scaling the line to get the dash length.

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: Where can I find fonts for my game? Where can I find fonts (preferably free, but a reasonable fee is acceptable) that I can use in my for-pay/commericial game?

sentences:
How can I ensure reasonably spaced out enemies I have a simple javascript game and I'm initializing their positions on the y axis using random numbers. How can I ensure that they are reasonably spaced apart?
My simple algorithm is:

 y = (Math.random()*1000%600);

However I frequently get enemies almost directly on top of each other. This is a huge problem for the game, since it's a word game and the enemies have text on their center, that if overlapped makes them impossible to kill since you can't see the words. Any advice would be appreciated! I'm pretty new to making games in general so this has all been a learning experience for me!

sentences:
How to get access to Nintendo Switch development environment? I would like to make game for Nintendo Switch.

I have been searching for an SDK of the same, but I couldn't find any. The only thing I found was that I can use Unreal Engine or Unity to make games for Nintendo Switch.

However I don't want to use any of these game engines and instead want to code from scratch, making my own game engine in the process.

Isn't there a C/C++ (or any language) sdk which will allow me to make games for Nintendo Switch without using Unreal/Unity or any other game engine ?

sentences:
Get closest Child to cursor I'm currently rewoking my RTS cover system. This should highlight the closest coverspots from my mouse cursor and sent the units to these locations. everything works, but I can't get the closest sport, it always selects the sames ones, regardless to the mouse position.

These cover spots are child objects of the obstacle, that has this script attached.

This is my not working implementation of the idea:

 void Update()
    {

        var dist = Mathf.Abs(transform.position.z - Camera.main.transform.position.z);
        var v3Pos = new Vector3(Input.mousePosition.x, Input.mousePosition.y, dist);
        v3Pos = Camera.main.ScreenToWorldPoint(v3Pos);
        mousePos = v3Pos;
}

...

public void getPointDistances()
    {
        foreach (CoverPosition pos in coverPositions)
        {
            if (!pos.occupied)
            {
                pos.distanceToCursor = Vector3.Distance(pos.transform.position, mousePos);
            }
        }
        Array.Sort(coverPositions, delegate (CoverPosition x, CoverPosition y) { return y.distanceToCursor.CompareTo(x.distanceToCursor); });

    }

Later, I simply Iterate over the sorted array and make it visisible.

I'm woking on this for hours, but i cannot find, a solution why it always displays the same cover spots.

I hope, someone can find my (possibly stupid) error.

Edit:

I also tried this, but tata returned always the same values, regardless of my mouse positioning:

Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;
        if (Physics.Raycast(ray, out hit))
            mousePos = hit.transform.position;

sentences:
Sprite is getting out of screen when changing resolution - Unity Hello I am making this layout:

I used sprites for birds but used UI for the blue food thrower. I used UI for it so it will not get cut when screen resolution changes.
But I also need to add food itself which I need to make 2D to interact with birds.
Now It is not visible over UI, So I changes Canvas-Render Mode to world space. But I cannot adjust text in that mode. Its not visible.
Then I tried converting the food thrower to Sprite but it get cut. Any authentic and cleaner way to do it?

sentences:
Fixing the frame rate for SDL2 2D game Working on a 2D game with SDL2, for now on Window, but I'd like to dream and imagine that if I finish it, I could run it on other platforms that SDL2 games can target. A core part of which is GGPO based lockstep netplay. So, I want to fix my framerate (to 60fps).
On Windows, should I use VSync, but then somehow override/ignore it if the refresh rate of the monitor is not 60Hz? Or not use Vsync at all, and handle the fixed frame rate manually in all cases?
It seems in this case, various platform specific hoops need to be jumped through, as SDL_Delay (= Windows Sleep()) is nowhere near accurate enough. Seems I would need to dive out of platform independnce a bit to handle this?

sentences:
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:
Are C and Objective-C sufficient for creating games on the iOS? These days, I'm focusing on games development on the iOS.
C++ is the lingua franca for games development but seriously, I prefer to code in C programming language, not in C++.

So for iOS games development, are C and Objective-C sufficient for creating games?

sentences:
Implement continuous integration (smoke test) Moving from J2EE industry to Android development there is a question in my mind, about continuous integration to perform smoke or integration testing.

I'm building a single game, a memory card game, with junit for small logic testing of classes but cannot figure how to implement the testing for the use of canvas.

If the application is developed just with UI elements from android, it is easy to use the UI Testing environment on the SDK:
UI android automatic testing

but what for canvas?

I would try to explain the current infrastructure:

github or bitbucket as CSV
Jenkins server

  Which captures with SCM a commit on github or bitbucket, download the
  changes, compiles and executes all the junit on the application for
  fail-fast.

TestRail

  Where the testcases for QA are described

While working on J2EE industry I had, a part from previous ones:

JBehave (http://jbehave.org/)

  Which reads from testrail all the testcases linked to a Test plan and
  executes it (the test-cases should use a pattern)

ex:
Preconditions:
1. Be on login screen

Steps:
1. Fill login with *{username}*
2. Fill password with *{password}*
3. Click on button *Login*

Expected:
1.
2.
3. Message with info *Login error*

Jemmy

  As the link you can find above, it is used to test java swing
  components, looks for a common element and interacts with it.

So, from jenkins:

1. we check for changes on code
2. compile the code
3. execute junit
4. execute BDD (deploy code on a server, and execute the integration-testing with jbehave)

graphically it is shown as a pipeline:

My question is:

Is it possible to implement the part I miss, the automatic testing, on canvas application?

As the application can be run on multiple devices, each one with different screen sizes, menu positions, I don't like to use x,y coordinates on tests definitions.

Was anyone in my same concern and found a correct "best practices" solution?

Currently, our QA team, is moving from excel, yeah you read it right, from excel to test rail, so moving from manual testing for test-cases to automatic fail-fast continuous integration would help QA as Development team.

Thank you!!!

sentences:
Why do I get this compile error when using InputComponents in UE4? I'm following this documentation, but it doesn't compile cause of "InputComponent". Unfortunately the error is not that clear even in my language.

Here's the error:

  CompilerResultsLog: Error: C:\Users\Paradisee\Desktop\C++\Paper\Source\Paper\PlayerTile.cpp(83) : note: I tipi a cui si punta sono privi di relazioni. La conversione richiede reinterpret_cast, cast di tipo C o cast di tipo funzione
  CompilerResultsLog: ERROR: UBT ERROR: Failed to produce item: C:\Users\Paradisee\Desktop\C++\Paper\Binaries\Win64\UE4Editor-Paper-583.dll

Here's the code:

// Called to bind functionality to input
void APlayerTile::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
    Super::SetupPlayerInputComponent(PlayerInputComponent);

    // Respond every frame to the values of our two movement axes, "MoveX" and "MoveY".
    InputComponent->BindAction("MoveX", IE_Pressed, this, &APlayerTile::MoveX);
    InputComponent->BindAction("MoveY", IE_Pressed, this, &APlayerTile::MoveY);
}

This is the definition of the method MoveX():

void APlayerTile::MoveX(float AxisValue)
{

}

sentences:
How can I get the normal vector for a plane from a set of vertices? I'm working on a HLSL / C++ little project to going over my graphics work, and I am unsure how I am to get a facing vector from a vertex polygon. I can't seem to find the formula.

The positions are P1, P2,P3

Let's call them class VertexPoint with P1.x, P1.y, P1.z for example?

sentences:
Creating a knockback effect I'm fairly new to creating a 2D game in java and I'd love some help. I'm trying to create a sort of knock back effect the enemies have on you. So when you are touched by a enemy you will:

lose life
be knocked back a few pixels

I thought about saying something simple such as:

    if ((player.x & player.y) == (enemy.x & enemy.y)){
        player.x += 8;
        player.y += 8;
    }

But seeing as this will only push you back with no hope of moving while being pushed, I didn't want to use it. Is there any simple, yet effective way for going about this?

sentences:
What is the technical term for animation of a dead body? In some 3D games when a 3D model of a person is shot to death (or suddenly dead) his body falls to the ground and every limb, the head and the body move free.
What is this particular way of handling dead bodies called?
Is it possible with UDK?

If you didn't understand, I meant like in this video: see how the corpse falls.

sentences:
Couldn't all games avoid post-start loading? Just as giant open world games load massive maps dynamically, couldn't we load separate maps, menus, and virtually any interface or 3D setting via that same dynamic loading method? Without changing the environment, it seem like interfaces and various locations within the game could all be loaded dynamically the same way massive open world maps are loaded as you walk through them.
Why isn't this done? I see so many modern games where you have to wait a minute or more while the match / map / level is loading. I know there's a latency involved with connecting peers, but that doesn't take more than a few moments in my experience. What issues exists with this concept to stop it from being used to eliminate loading time involved with loading map / level / interface data?

sentences:
Unity download image from Firebase database I am currently trying to download an image using Google Firebase.

The database stores a URL to an image on Firebase storage, Unity pulls the URL from the DB and uses Unity WWW to download it. However the texture shows up as a red question mark texture.

If I use a http URL from another website however it works, is Unity able to download from https addresses?

This downloads the URL from Firebase and stores it in the data_url variable:

void DownloadViaURL()
{
    Debug.Log("Called DownloadViaURL");
    FirebaseDatabase.DefaultInstance
   .GetReference("test_image")
   .GetValueAsync().ContinueWith(task => {
       Debug.Log("Default Instance entered");
       if (task.IsFaulted)
       {
           Debug.Log("Error retrieving data from server");
       }
       else if (task.IsCompleted)
       {
           DataSnapshot snapshot = task.Result;

           string data_URL = snapshot.GetValue(true).ToString();

           //Start coroutine to download image
           StartCoroutine(AccessURL(data_URL));
       }
   });
}

This uses Unity WWW to download from the URL:

IEnumerator AccessURL(string url)
{

    //Debug.Log("Accessing texture URL in database");
    using (WWW www = new WWW(url))
    {
        yield return www;
        Renderer r = GetComponent<Renderer>();
        r.material.mainTexture = www.texture;
        Debug.Log("Texture URL: " + www.url);
    }
}

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:
How do find the right GLxx object for a given function in LWJGL? I'm just starting to learn the fundamentals of OpenGL via LWJGL. Every OpenGL function is implemented as a method on a GLxx class. The xx corresponds to the version of the spec when that function was introduced, such as GL20 for functions added in OpenGL 2.0. So far, so good.

The difficulty comes when following tutorials or looking at code that is written against the C API. I'm finding myself having to either guess or Google the version for every single function that I want to use. This is quite time consuming.

Is there a quick way of finding out which version of OpenGL any given feature was introduced? (Or any other way of figuring out the right LWJGL class for a function?).

sentences:
Applying movement to a Rigid Body Isometric in Unity 3D I'm making an isometric dungeon crawler. I initially used transform to get isometric movement and things worked well, but I couldn't use collision which meant it was unsuitable. So I'm now trying to use Rigidbody and I'm having some weird issues.

First of all, this is the code I currently have:

public class CharControllerRigid : MonoBehaviour{
    [SerializeField]
    private Rigidbody characterRigid;
    private Vector3 inputVector;
    void Start()
    {
        characterRigid = GetComponent<Rigidbody>();
    }

    void Update()
    {
        inputVector = new Vector3(Input.GetAxis("Horizontal") * 10f, characterRigid.velocity.y, Input.GetAxisRaw("Vertical"));
        transform.LookAt(transform.position + new Vector3(inputVector.x, 0, inputVector.z));
    }
    private void FixedUpdate()
    {
        characterRigid.velocity = inputVector;
    }
}

I have two issues:

First, how do I get the movement to work on an isometric plain?

Second, how do I get the movement to work in all directions? Current when I move left and right the movement is good, but up and down are really slow in comparison.

sentences: Where is the Mclip matrix & how do I set it? According to this article, the Mclip matrix will be used, but I didn't find any function in Directx11 to set this matrix. How do I set it?

sentences:
How to avoid a boring late game in strategy games while still keeping victories satisfying? A common thing I've noticed in strategy games (of all types, 4X, RTS, MOBA, etc.) is that most games eventually get to a point where it is fairly clear who is going to win, and the rest of the game just becomes playing out the motions, and if the winning player/team doesn't make a major misstep, they will win.

This is just kind of the nature of strategy games. They inherently have a "snowball" effect. The gameplay is all about setting yourself up for success over your opponents in the future, and whoever does this better in the earlier stages of the game should win in the later stages. This happens in every strategy game to some extent, even the most classic. In Chess, it becomes increasingly harder to win if your opponent takes more and more of your pieces and forces your remaining pieces into tough situations.

As I said, this is just a fundamental part of the genre, so I'd hesitate to call it a problem. However, on occasion, in these types of games, you have matches where no player/team gains a significant advantage early, and the game comes down to the last turn. In my opinion, these are the most exciting and interesting matches you can have. Furthermore, when this doesn't happen, the late stages of the game can feel very boring for everyone involved, where the winning player is just awaiting their inevitable victory, and the losing player their inevitable demise (this can be especially unfun for the losing player, as they probably have very few options, and it is just really unlikely that they are having a good time).

So it would be cool if we could design a strategy game that avoids consistently falling into this state, right? Well, I have seen a handful of games like this, where a losing player consistently has avenues to victory, no matter how far behind they are. The issue with this is that if an upset happens (say one player was dominating the whole game, and then a losing player makes one good play at the end of the game to win), that victory can feel very unsatisfying for the winning player, as they may feel they didn't deserve it. Similar, the player who was winning most of the game may be very unhappy, as they may feel like victory was robbed from them, and they didn't deserve to lose. So essentially, no one is happy with the result. This approach may also make the early game less fun, as players may feel like it just doesn't matter.

So is it possible to design a strategy game that avoids both of these issues? A game where we don't consistently fall into a boring lategame with a forgone conclusion, and yet also keep victories feeling satisfying and deserved? Or are these issues far too fundamental to strategy gameplay to overcome?

If this question is too vague on its own, then we can focus on 4X strategy games, as those are the games I have experience with, and that I am interested in designing.

sentences:
What counts as a successful ad view in a mobile app? There is one thing about mobile ads that I can't completely understand.
Let's say I put ads in my free mobile game. What counts as a successful ad view? When it is just displayed on a user's screen or the user has to open the ad in order for it to count as viewed?

sentences:
MissingComponentException when using Animator I followed some tutorials to add WASD movement to a character; I managed to set up the animator thing and it works in the bottom right corner viewport.

Next I tried adding the following C# script with basic movements:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AppleInput : MonoBehaviour
{
    private Animator animator;
    // Start is called before the first frame update
    void Start()
    {
        animator = GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update()
    {
        animator.SetFloat("Horizontal", Input.GetAxis("Horizontal"));
        animator.SetFloat("Vertical", Input.GetAxis("Vertical"));
    }
}

Configured like so:

But then I get the error message:

MissingComponentException: There is no 'Animator' attached to the "action10Prob_normalsDONEyet" game object, but a script is trying to access it.
You probably need to add a Animator to the game object "action10Prob_normalsDONEyet". Or your script needs to check if the component is attached before using it.

How do I solve this error?

sentences:
How can I prevent a latitude/longitude based chunk system from Mercator projection stretching? I'm working on an little mapbox based game and I'm currently working on an latitude/longitude-based chunk system. The distance between each of them should be the same. As you can see in the example the width and height of each chunk are equal. The little grey square is just the chunk middle. Those chunks were created near latitude/longitude zero, where they aren't effected by the Mercator projection.

But due to the Mercator projection the distances between the chunks are increasing as more as they move away from the middle (they look kinda stretched).

As you can see the distances between each one aren't equal anymore. The height of each of those chunks did increase. Here's another picture of the Mercator projection to visualize what I mean:

The chunks of the first picture were created near the middle of the word map (where the big black upper arrow points towards). The chunks from the second pictures were created near the bottom of the world map, where the other arrow points towards.

The type of game I'm developing requires equal chunk sizes and also it doesn't look that good when at some point the chunks look different due to the stretching.

I want to achieve a chunk system like this on the mercator projection :

I calculate the chunks as follows:

First we need the player latitude/longitude coordinates : 3.0146683, 5.3046076

One latitude is about: 110.57 km -> 110570 meters.
One longitude is about: 111.32 km -> 111320 meters.

One chunk should be about 750 meters on the map.

Because latitude and longitude got different ranges we need to adjust the chunk size.

One latitude factor = 110570 / 750 = 147,43.
One longitude factor = 111320 / 750 = 148,42.

One latitude chunk size = 110570 / 147 = 750 meters.
One longitude chunk size = 111320 / 148,42 = 750 meters.

(Maybe this step is unnecessary)

Now we convert the Lat/Lng to meters.

Latitude in Meter = 3.0146683 * 110570 meters = 333 331.873931 Meters.
Longitude in Meter = 5.3046076* 111320 meters = 590 508.918032 Meters.

Now we need to calculate the meters till the last chunk by using modulo.

Latitude Modulo => 333 331.873931 modulo 750 = 331 meter.
Longitude Modulo => 590 508.918032 modulo 750 = 258 meter.

After that we are able to calculate the Latitude and Longitude chunks.

Latitude chunk position = 333 331.873931 - 331 = 333 000.873931.
Longitude chunk position = 590 508.918032 -258 = 590 250.918032.

When we didive that now through the chunk size we get the actual chunk position.

Chunk X = 333 000.873931 / 750 = 444,0011.
Chunk Y = 590 250.918032 / 750 = 787,001.

Rounded: Chunk X = 444; Chunk Y = 787.

Now we know that the player stands right in this chunk [444;787].

In the next step I just calculate the Chunk X and Y back to latitude and
longitude and convert them via transform.AsUnityPosition to 3D coordinates,
where I place those grey objects then.

So basically I need a way to have the same visual distance between each of those chunks. Or either a way to change the projection from Mercator to a square projection, where nothing is stretched. I never worked with mapbox/Google Maps before... so I'm a newbie. Or is there maybe a formula I can use to prevent my chunks from being stretched by the projection?

Thanks for your time and attention! :)

sentences:
Avoid if statements in DirectX 10 shaders? I have heard that if statements should be avoid in shaders, because both parts of the statements will be execute, and than the wrong will be dropped (which harms the performance).

It's still a problem in DirectX 10? Somebody told me, that in it only the right branch will be execute.

For the illustration I have the code:

float y1 = 5; float y2 = 6; float b1 = 2; float b2 = 3;

if(x>0.5){
    x = 10 * y1 + b1;
}else{
    x = 10 * y2 + b2;
}

Is there an other way to make it faster?

If so, how do it?

Both branches looks similar, the only difference is the values of "constants" (y1, y2, b1, b2 are the same for all pixels in Pixel Shader).

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:
How to design a server for a multiplayer game? I'm trying to write a multiplayer game where players join small matches with other players. What I also want is a way for players to login and go online. How would I design the a server that could handle logging in, matchmaking and the actual running of the match? I'd like to have multiple threads on the server to handle input from all the players, but I'm not exactly sure what I want to put in a single process and what I want to split apart. How would I set up the sockets for something like this?

I'd probably end up having this run on Amazon EC2 or something similar if that makes a difference.

I was planning on making the game a MOBA where there would be a small number of players (6-10) and latency would be relevant.

sentences:
Advice on rendering a 2D scene My game  will be made up of objects. Essentially the level editor will give me a bunch of objects to choose from and I can drag them in and thus a level is made. The objects could have animation in which case they are responsible for knowing which frame and layer they are on.

So then I can have these:

Animated non-movable objects
Unanimated non-movable objects
Animated movable objects
Unanimated movable objects

So first I was thinking of, when the level starts, build a quadtree for all non-movable objects.

This way I can easily avoid rendering ones which are not in view.

Then from there I can do bounding box check on dynamic objects (or maybe if I add something like Box2D it can do it).

But then comes the rendering.

At first I was thinking of each object rendering itself, but then I cannot do atlasing.

I'd like to do atlasing. I was thinking that animated objects can just use their own frame sheet. But objects which are not animated should use atlasing.

I know this can be categorized as premature optimization, but I don't want to eventually find out that it is horribly slow.

Any design suggestions / comments would be welcome. Does it seem like a good idea to try to atlas in the sort of game I'm making, which is a platformer that is not tile based.

sentences:
Software polygon rasterization with transparency using raw image data I have an image with shapes in it (squares and triangles with different colors scattered in the image) and I have an algorithm that matches the image and extracts the geometry vertices from image raw data (unsigned char*) and the extracted vertices are correct and I have checked theme there is no doubt about theme.

Now that I have got the vertices of the squares and triangles from the raw image data. How can I fill the pixels that lies inside the vertices with transparency so they become deleted shapes?

PS: the vertices that i have got are just an array of points and each point has x and y property in it and the raw image data is rgba8888 (32 bit).

sentences:
changing coordinate system I'm currently trying to transform a system by scaling it on x and y axis and have some uncertainty. I have the general concept that scaling works as such:

My original box has corners at (0, 0) and (3, 2) and I'm asked to scale the x axis by 3 and the y axis by -2.

Is this what the correct solution would look like (with corners at (0,2) and (6,-2))?

sentences:
Draw Ordering with Glowing Objects This is mostly a general design theory question, but for reference the bulk of my game is in JavaScript.
I can draw images to the screen that layer on top of each other in the order that I please. One of the layers, I call it the light layer, is simply a series of black squares that change opacity based on the light levels in the game. During night, these black squares are almost opaque (unless a light source is affecting them) and during the day they are nearly invisible.
Glowing things, like bulbs or radar console screens, are drawn above the light layer to make it look as if they're exempt from the light effect. (Glowing)
However, the turret head is a non-glowing object that needs to appear above the glowing objects. For example, it might partially cover the radar console screen or light bulbs. However, it isn't meant to glow.
This is where the paradox occurs. The turret head needs to be below the light layer, but also above the glowing elements.
Any ideas of how I could solve such a paradox?

sentences:
What do gameplay programmers do? Game development has lots of fronts... gameplay, physics, graphics, etc. and whenever I look up the answer for this question it's always something vague like: "extended knowledge of c++, c# or whatever".

But what exactly does that mean? Does the gameplay programmers know lots of openGL, directX? maybe lots of vectors, matrices? Do they need to know some network programming?

So what kind of coding and other tasks do gameplay programmers do?

sentences:
Can animation parameters only be changed in scripts? I have a very simple animation parameter in the Animator, a boolean that is "true" when a shooting animation is playing (to stop the game logic from allowing more shooting during a gun recoil animation). I assumed I'd be able to access this in animations, i.e. setting it to true when a shooting animation started, and false when it ended. But I just can't see how to access it in my animations. It's not available under "Add Curve". Am I missing something?

I can do this in other ways, but this just seemed like the cleanest.

sentences:
Is it possible to create accelerated 3D graphics on Windows using one's own API? Say I want to come up with a way to replace what OpenGL and DirectX specifications do: communicate with GPU to get some functions done that help hardware-acceleration and rapid drawing of screen data. Is it possible to write some mock-up copy that can communicate with the GPU the same way that, say, an OpenGL specification could or DX to drive the same functions (or similar ones)?

What I'm saying is, somebody somehow made a way to communicate with a device driver to get acceleration and faster graphics, 3-D functions, etc. Is it possible one can create the same "inbetween" library or software that can do pretty much the same thing -- interact  with the device driver and drive OpenGL/DX similar operations or some other specification, but using my own self-written procedures to do so?

In other words, is it possible to replace OpenGL/DX code that communicates with a graphics driver with your own code that does the same thing, but is instead written by you?

I'm not asking about writing a device driver, but writing something that communicates with it, such as how DX/OpenGL does. OpenGL is 100% open-source and you can see how every single function/operation/line of code works when you link with it and use a debugger, etc.

We know OpenGL usually doesn't directly interact with a GPU most of the time, and although it does sometimes, the identic function can easily be replaced by debugging.

sentences:
GLFW - Camera rotation system I need to make a camera rotation system similar to the one here

http://madebyevan.com/webgl-path-tracing/

To rotate, press the Left mouse button and drag. So far I figured a basic idea of how this could be implemented.

Note that although it looks like the scene is rotating in front of the camera but in my case I want to rotate the camera instead. Since the scene contains hundreds of thousands of triangles and I wouldn't wanna apply a matrix operation to each of them.

I have represented my camera by a 4x4 matrix. The columns from 1 to 4 are side, up, look at and eye respectively.

So here's what I thought so far.

1) Subtract old cursor position from new cursor position. Doing this for X and Y we get a direction vector as to where the mouse is headed.

2) Invert this direction. And translate the camera a little in this direction. So if the mouse is headed right, the camera heads left. This is done by checking the components of the direction vector.

if (dir.x < 0)
    cam.eye += side
if(dir.x > 0)
    cam.eye -= side
if (dir.y < 0)
    cam.eye += up
if(dir.x > 0)
   cam.eye -= up

Note the translations are inverse. If less than zero than add the side vector instead of subtracting it.

3) Now find a vector perpendicular to it. So if the mouse was headed left or right the vector perpendicular to it is the Y axis. I calculate this by taking the cross(vec(0,0,1), direction_vector). Note this is not the inverse but the actual direction vector.

4) Rotate the camera a little along this perpendicular axis a little.

If you imagine these operations for the X axis. This feels like the camera is moving in some sort of circle around the scene. That is, the camera translates a little, then rotates. Next time it translates by adding the side (which was changed when it first rotated) it moves a little diagonally. In this way it feels like it rotates in a circle.

So this works somewhat fine for pure X and Y rotation and upto a certain extent. Fails when i move the mouse diagonally or in Pure X/Y rotation when I go beyond a certain point probably 90 degrees.

Any advice or suggestions? I am not using OpenGL instead doing this with GLFW and GLM. The renderer is a raytracer/pathtracer.

sentences:
Photon alongside LibGDX Can anyone point me to a possible implementation of the Photon network engine along with LibGDX for Android?  Or any multiplayer networking SDK for all that matters.

From reading source code it seems that Photon uses the native Android SDK heavily, like Intents and such, which are not provided through LibGDX.

sentences:
Model colors look much better in blender than Unity (LWRP), how to fix bad colors in Unity LWRP? I made some models in blender 2.8:

After importing them to Unity, they look much worse:

Still the same material as in blender, I use the LWRP and have had nothing but issues with it, the lack of AO being one. Is there something I'm missing because it should not look this much worse in the Game Engine?

sentences:
OpenGL: How to render a "shadow" for an object that's behind another? First off, an image from Fez that depicts the effect I'm after:

I'm trying to achieve a similar effect in my project. I'm quite certain this is done with a stencil buffer, but the resources on such effect are scarce. How should I approach this? I'm guessing I'm after a sort of "AND" stencil where I'd render a semi-transparent black rectangle over the player where only the pixels that had both the player and a map object.

I'm not sure if it has any effect on it (besides maybe inverting the stencil operations..?), but for other reasons, my pipeline first renders the world and the player is rendered last.

sentences:
How can I orient a circle relative to the position of a 3D object? How can I orient a circle that has a position to a 3D object? If I have a 3D object which is a hemisphere, I would like to let the circle be underneath that hemi-sphere and whenever the hemisphere moves, the circle move with the same angle and position, and underneath it.

In other words, I would like to attach a 2D circle to a hemisphere and parallel to it.

sentences:
Expandable 2d environment by spawning and controlling individual tiles what is the best way to implement an environment that is "expandable" in every direction so that when the player moves in any direction a new row or column of tiles that can be manipulated individually is created,however as the player moves into the new created area whenever he decides to comeback, the tiles that disappeared by going off the screen are there when he comes back.

What I'm trying to do is make a new row if the player moves upwards or downwards, or make a new column if the player moves sideways. But I can control the individual tiles to make them change colors or place items. Then whenever the player advances and new tiles are created and others are moved off the screen if the player decides to come back to the area the item that was placed and color change is still there. Sorry if I'm not explaining my best, if you need a better explanation I'll be happy to give you one. Thank you.

sentences:
Maya - How to clean combine mesh history? I've combined a load of meshes using Mesh > Combine. Each mesh was already skinned to my rig. The combine worked ok and the rig / skinning is fine. However I'm left with a bunch of transform nodes:

If I delete history on the newly combined object these nodes are deleted but the skin becomes unbound. If I delete them manually the skin also becomes unbound and the materials disappear from the model. If I export (to Unity) all of these transforms are included, even if I just export a selection of the skeleton & mesh.
How can I get rid of these transform nodes and keep my skinned rig? I've searched online & in the help files and have tried various things for two days now without success.
I'm using Maya LT 2016 SP 4 Ext 3.
Many thanks

sentences:
How to filter list of all objects in Unity project, by their type? I want to filter the list of project objects in unity, and view all objects of specific type in the project. (by type, not by name)
How can I do that?

sentences:
Different iPhone screen resolutions and game graphics We are developing a 2D game for iPhone using cocos2d-x. The artists are drawing the raster graphic for a resoluion of 640x960. For older iPhone devices, those that have a resolution of 320x480, should we provide a completely new set of graphics, to be adapted to the smaller resolution?
I was thinking of simply scaling the whole scene of a factor of 2. That would save us the time to write a specific set of graphic elements for the smaller resolution.
What is the best practices? How do you guys handle the different screen resolution w.r.t. the graphic part of the game?

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:
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:
Giving one controler button two functions I'm currently working on a game that allows the player to do some different actions.

Dodge (X button)
Attack (A button)
Use Item (Y Button)
Block (BButton)

I would like to be able to use the "Y" button to both use items and pick items up. This dual functionality would be determined by how long the player held the button and if the player was standing next to an item. I'm sure there have been studies on this and how long the player expects for a delay to use the second functionality but I'm worried that I have become biased in my testing and I can't find anything online.

My question is: Is there some sort of standard for this type of a time delay for the button? If so where can I learn more about it?

sentences: How can I use a different upscaling method in dx11? I need to upscale images using the 'box' scaling algorithm as the pixel art textures in my game don't scale well with bilinear because of the blur. Either that, or use high res pictures which would be undesirable and inflate the size by many times.

sentences:
iPhone 3d Model format: .h file, .obj, or some other? I'm beginning to write an iPhone game using OpenGL-ES and I've come across a problem with deciding what format my 3D models should be in.  I've read (link escapes me at the moment) that some developers prefer the models compiled in Objective-C .h files.  Still, others prefer having .obj as these are more portable (i.e., for deployment on non-iPhone platforms).

Various 3D game engines seem to support many(?) formats, but I'm not going to use any of these engines as I would like to actually learn OpenGL-ES.  Am I putting myself at a disadvantage here by not using a packaged engine?

Thanks!

sentences:
Work out the point on an ellipse given centre, radius, and direction vector? I have a vector (white line), a centre and a radius along each of the semi-major and semi-minor axes of an ellipse (green line). I need to find the point where the white line intersects the green.

I have tried to work it out using Atan2, Sin and Cos but that doesn't quite work (blue line). It works when parallel to an axis but doesn't otherwise, I have a feeling this is because I am trying to perform the calculation on an ellipse where the horizontal and vertical radii are different.

Vector2 delta = (screenPos - canvasCentre).normalized;
float angle = Mathf.Atan2(delta.y, delta.x);
Vector2 position = canvasCentre + new Vector2(
                Mathf.Cos(angle) * radius.x,
                Mathf.Sin(angle) * radius.y);

sentences:
Looking to render video in game? I have recently been looking to add a feature which will allow me to render a movie\video into my game. I.e, something pre-rendered and played as the game starts.

I am using Java2D purely so I am curious if there are any frameworks out there that will allow me to do this in an active rendering environment.

Thanks.

sentences:
Play a sound on button click before loading the load scene in Unity3D I am trying to play the sound of the button click before loading the scene in unity. However, the sound is never played. Below is my code, help would be appreciated.

public void RestartGame()
{
    audioManager.PlaySound(forwardSound);
    StartCoroutine(DelaySceneLoad("Gameplay"));
}

IEnumerator DelaySceneLoad(string scene)
{
    yield return new WaitForSeconds(forwardSound.length);
    GameTracker.SetGameOver(false);
    SceneManager.LoadScene(scene);
}

sentences:
Order independent transparency in particle system I'm writing a particle system and would like to find a trick to achieve proper alpha blending without sorting particles because:

Each particle is a point sprite in a single mesh and I can't use scene graph ability to sort transparent nodes. The system node should be properly sorted, though.
Particle position is computed on shader from initial velocity, acceleration and time. In order to sort the system I would have to perform all this computations on CPU, which is something I want to avoid.
Sorting hundreds of particles against camera position and uploading it on GPU each frame seams to be quiet heavy operation.

Alpha testing seems to be fast enough on GLES 2.0 and works fine for non-transparent but "masked" textures. Still, it's not enough for semi-transparent particles.

How would you handle this?

sentences:
Components accessing Game state and other global data I have the following example component:

public class DoStuff : MonoBehaviour
{

    public GameManager Data; // data to be shared among components and scenes,

    public bool Predicate()
    {
        return Data.State == Idle;
    }

    public void Execute()
    {
        if (!Predicate()) return;
        //Do stuff
    }
}

It needs to access data that I have in a data class (not a component) called GameInfo, which the GameManager creates on start. What is the 'best practice' for accessing data like that in a unity component.

Make GameInfo static (or Unity equivalent)
Drag the GameManager GameObject from my Scene on this component from the Editor
Use FindObjectOfType(typeof(GameManager)) to find the data on Awake/Start
Turn GameInfo into a component and attach to empty GameObject in my scene, then follow #2.
Some other method?

Thoughts:

Having come from working on Internal tools and webservices, making things Static is rarely a good idea, but maybe for Game development making my global game state data static is the exact thing to do.
I don't have any problems with this other than it just feels strange, but that's probably just due to being new to this mindset.
I believe this uses reflection to search, which if only done once at start would be no big deal, but I feel this option is less nice than #2.

sentences: How do i draw a ray in unity So i am trying to scrap together something for vr in which the locomotion is about the player holding the direction where he wants to go to(basically planning what he is going to do)while holding down the button a ray is beeing drawn and when the player lets go the character moves until he reaches the end of the ray i tried looking up something but couldnt find anything regarding something like this

sentences:
Game freezes, cannot see why My game freezes randomly, mostly when changing from one level to the next. I cannot tell why this is the case. There are no errors or warnings. This happens when i build the game and when I am testing the game in the Unity editor. It will say unfreeze itself after a few seconds.  I have attached one of the level codes and the timer code. I have also attached a picture of how it looks when it freezes.
This is one of the level codes :

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO.Ports;
public class Arduino5 : MonoBehaviour
{
    SerialPort sp = new SerialPort("\\\\.\\COM5", 9600);// Com port and the baud rate of the arduino
    Material m_Material;
    GameObject Sphere;

    void Awake()
    {
        Sphere = GameObject.FindWithTag("Player");
        m_Material = GameObject.FindWithTag("Player").GetComponent<Renderer>().material;
    }
    void Start()
    {
        if (!sp.IsOpen)
        { // If the erial port is not open
            sp.Open(); // Open
        }
        sp.ReadTimeout = 250; // Timeout for reading
    }

    // Update is called once per frame
    void Update()
    {
        if (sp.IsOpen)
        { // Check to see if the serial port is open
            try
            {
                string portreading = sp.ReadLine(); // get the string output of the serial port
                float amount = int.Parse(portreading);

                if ((amount > 50f) )
                {
                    m_Material.color = Color.grey;
                    Renderer _rend = Sphere.GetComponent<Renderer>();
                    Sphere.GetComponent<Renderer>().material = _rend.material;
                    _rend.material.mainTexture = Resources.Load("face4") as Texture;

                }
                else
                {
                    m_Material.color = Color.white;
                }
            }
            catch (System.Exception)
            {

            }
        }
    }
}

and this is the Timer code:

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

public class Timer : MonoBehaviour
{
    public int timeLeft = 5;
    public Text countdownText;

    // Use this for initialization
    void Start()
    {
        StartCoroutine("LoseTime");
    }

    // Update is called once per frame
    void Update()
    {
        countdownText.text = ("Time Left = " + timeLeft);

        if (timeLeft <= 0)
        {
            StopCoroutine("LoseTime");
            countdownText.text = "Times Up!";
            Invoke("ChangeLevel", 1.0f);
        }
    }

    IEnumerator LoseTime()
    {
        while (true)
        {
            yield return new WaitForSeconds(1);
            timeLeft--;
        }
    }
    void ChangeLevel()
    {
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
    }
}

In terms of trying to close the serial port, would something like this work:

void Start()

{
    if (!sp.IsOpen)
    { // If the erial port is not open
        sp.Open(); // Open
        sp.ReadTimeout = 250;
    }

// Timeout for reading
else if (sp != null)
{

    {
        sp.Close();
    }
}

}

sentences:
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:
Camera Rolling when Implementing Pitch and Yaw I am implementing a camera in opengl for an android game and am having problems getting the pitch/yaw/roll of the camera correct. I have read many tutorials on quaternions and have implemented a basic camera based on this link.

Everything works well except for when I pitch and yaw I get unwanted roll. I have read things that say I need to apply the pitch/yaw rotation together to prevent this, and other things that said not to track individual changes to angles, but I'm not sure what they mean or how to extend this implementation to mine. I am new to this type of math so any help would be appreciated.

My goal is to have a camera that can rotate similar to how a space ship would rotate - I want the camera to be able to rotate 360 degrees in all directions and turn upside-down - which is why I was rotating the upVector too.

Any suggestions on what I can do to not have the camera roll when rotating around the y and y axes?

Thanks!

Here is the code that translates user input into two angles, and rotates the lookVector, upVector, and rightVector of the camera. My problem is the camera is also rolling when I just pitch and yaw.

// Java
// Camera uses a position vector, lookAt vector, and upVector
// eventually calls Matrix.setLookAtM()

Camera c = mRenderer.theCamera;

// PVector is a class that implements a 3 dimensional vector

float thetaX = getTouchChange(...); // set by the user touching the screen
float thetaY = getTouchChange(...); // set by the user touching the screen

// I keep 3 vectors in the camera class, one points up, one points right,
// and the 3rd is the point I am looking at

///////////////////////////////////////////////
// Pitch - rotate the up and look around right
///////////////////////////////////////////////
// get up and look vectors
PVector lookVector = PVector.sub(c.getLookAtPoint(), c.getLocation());
PVector otherVector = c.getUpDirection();
// get axis
PVector rAxis = c.getRightDirection();
rAxis.normalize();
// rotate look
PVector rotated = Quaternion.rotateVector(lookVector, rAxis, thetaY);
// Add back camera location to convert vector to actual look points
rotated.add(mRenderer.theCamera.getLocation());
c.setLookAtPoint(rotated);
// rotate up
rotated = Quaternion.rotateVector(otherVector, rAxis, thetaY);
rotated.normalize();
c.setUpDirection(rotated);

///////////////////////////////////////////////
// Yaw - rotate the look and right around up
///////////////////////////////////////////////
// get up and look vectors
lookVector = PVector.sub(c.getLookAtPoint(), c.getLocation());
otherVector = c.getRightDirection();
// get axis
rAxis = c.getUpDirection();
rAxis.normalize();
// rotate look
rotated = Quaternion.rotateVector(lookVector, rAxis, thetaX);
// Add back camera location to convert vector to actual look points
rotated.add(mRenderer.theCamera.getLocation());
c.setLookAtPoint(rotated);
// rotate right
rotated = Quaternion.rotateVector(otherVector, rAxis, thetaX);
rotated.normalize();
c.setRightDirection(rotated);

In my rendering code I update the camera orientation by calling the following

// called in onSurfaceChanged
Matrix.frustumM(m3DProjectionMatrix, 0, -screenRatio, screenRatio, -1, 1, 1, 70);

// called in onDrawFrame
Matrix.setLookAtM(m3DViewMatrix, 0,
    theCamera.getLocation().x, theCamera.getLocation().y, theCamera.getLocation().z,
    theCamera.getLookAtPoint().x, theCamera.getLookAtPoint().y, theCamera.getLookAtPoint().z,
    theCamera.getUpDirection().x, theCamera.getUpDirection().y, theCamera.getUpDirection().z);

Matrix.multiplyMM(m3DMVPMatrix, 0, m3DProjectionMatrix, 0, m3DViewMatrix, 0);

// m3DMVPMatrix is eventually passed to the shader along with the shape data

sentences:
How to deal with events in a game with multiple players, in Unity? As I'm developing our game I have asked myself a couple times "When we have more than 1 player, how will I ensure events from player A do not crossover to player B?"

As an example, lets say player A clicks on a unit. This publishes an event with data on the click location, the type of object it is, and the player that clicked. This can be received by lets say a selection manager script that just keeps track of what is currently selected for that player.

The problem now, is that this event is received by every player. Every player will receive this event and try and select that object, and perform various tasks along the way.

Is there a method of programming in unity to ensure that an event is only subscribed to by classes that have the same player component referenced (only the appropriate players methods will be added to the invocation list of delegates under the player)? Or will I just need to create a check at the subscribers to these events to only accept the event data if it's the same player?

ie.

if ( RClickEventArgs.Player.GetInstanceID() == player.GetInstanceID()) {}

Edit: For clarity. Here is an example event.

public delegate void RightClickHandler(string clickType, RClickEventArgs e);
public static event RightClickHandler RightClickEvent;
private void RightClick()
{
    if(Input.GetMouseButtonDown(1))
    {
        if (userInput.isMouseOnScreen && !EventSystem.current.IsPointerOverGameObject())
        {
            GameObject hitObject = inputValidations.FindHitObject();
            Vector3 hitPoint = inputValidations.FindHitPoint();
            hitPoint.z = -1;

            if (hitObject && hitPoint != ResourceManager.InvalidPosition && hitObject.name != "Ground")
            {
                RightClickEvent("Object", new RClickEventArgs(hitObject, hitPoint, player));
            }
            else if (hitObject.name == "Ground")
            {
                RightClickEvent("Ground", new RClickEventArgs(hitPoint, player));
            }
        }
    }
}

When an object is clicked an event is published with relevant info on what was clicked. There are subscribers to this event using "MouseClickEvents += YourMethodNameHere;". This works as intended. However, since two players will have the same scripts as components this creates an issue where the 2nd player's scripts also add themselves to the invocation list of player 1's delegates, and vice versa (as far as I know, I don't know how to check what is in the invocation lists). So each player receives their own events, and the events of the other player.

If I have a fundamental misunderstanding of a concept here, please let me know.

sentences:
What is the correct way to authenticate a player with password from Unity to a php api server? So, I have a game in Unity for mobiles that gives you the possibility to sign-up with username, email and password to unlock extra features.
The datas are sent, through a POST request, to a PHP+MYSQL server that expose an API. I'm developing both so I have complete freedom on how to implement it.

My question is what is the correct way to:

save auth data on player mobile device so it can automatically login
on subsequent runs of the game
how to safely send username and password to my server for the authentication

I want to protect data from man in the middle attacks and I don't want to send clear password because users tends to always use the same email/password combination.

Thank you

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: Do Google/Apple provide the multiplayer servers for an app themselves? I have an app that I have been working on and I was wondering does Google/Apple host the server requirements for the multiplayer aspects of an app?

sentences:
2D Screen Coordinates to 2D World Coordinates in LWJGL I'm making a 2d top down game with lwjgl and am having trouble converting my 2d screen coordinates to 2d world coordinates.

Here's what I have so far

 private Vector2f toWorldCoords(Vector4f eyeCoords) {
    Matrix4f invertedView = Matrix4f.invert(MathUtil.createViewMatrix(camera), null);
    Vector4f rayWorld = Matrix4f.transform(invertedView, eyeCoords, null);
    Vector2f mouseRay = new Vector2f(rayWorld.x, rayWorld.y);
    mouseRay.normalise();
    return mouseRay;
}

public Vector2f screenToWorld(Vector2f mouseCoords) {
    Vector2f normalizedCoords = CursorHandler.getNormalisedDeviceCoordinates();
    Vector4f clipCoords = new Vector4f(normalizedCoords.x, normalizedCoords.y, -1.0f, 1.0f);
    Vector2f worldRay = toWorldCoords(clipCoords);

    return worldRay;
}

I understand it's been asked before, and I've tried following some 3d tutorials that deal with the same topic, but so far I haven't been able to use the code successfully.

Thanks

sentences:
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:
Spherical harmonics lighting interpolation I want to use hardware filtering to smooth out colors in texels of a texture when I'm accessing texels at coordinates that are not directly at the center of the texel, the catch being that the texels store 2 bands of spherical harmonics coefficients (=4 coefficients), not RGBA intensity values.

Can I just use hardware filtering like that (GL_LINEAR with and without mip mapping) without any considerations?

In other terms: If I were to first convert the coefficients back to intensity representations, than manually interpolate between two intensities, would the resulting intensity be the same as if I interpolated between the coefficient vectors directly and then converted the interpolated result to intensities?

sentences:
Flow/design of steering behaviors implementation I am implementing some simple steering behaviors like: follow the leader, separation, cohesion and flee(from the leader when he walks in our direction - aka spread the group for him).

I am having issues with design of this system. I know how each of this behavior works separately but I simply can't do it with "if ladder" (as I did up to know). Can someone lead me on how to concatenate/normalize/multiply the forces and how to join them in one resultant force ?

EDIT

What I am exactly talking about is: for now I have something like so :

if(leaderGoingAtMe)
    makeSpaceForhisMovement()
else if(followTheLeader)
    goto(positionBehindLeader)

if(separation)
    addSeparationForce()
if(cohesion)
    addCohesionForce()

if(velocity > maxSpeed)
    clamp(velocity, maxSpeed)

Which is EXTREMELY bad in my opinion but I have no idea how to improve it.

sentences:
Circle to Circle collision - bad accuracy Circle1 (blue) is moving and its X and Y bounds are the screen (meaning it bounces off the walls).

Circle2 (black) is stationary. Circle1(blue) is supposed to bounce off of Circle2 without intersecting, regardless of the collision point. As you can see on the image below, the blue circle bounces off properly only at the blue arrow spots, otherwise(red arrows), blue ball goes INSIDE the black circle, gets stuck in there for a second and then gets out.

I have no idea why this is happening. Please take a look at my code and help me out.
Thanks.

public void handle(ActionEvent t) {
                if (counter++ % 5 == 0) {
                    // Moves the ball depending on the values of X and Y
                    circle.setLayoutX(circle.getLayoutX() + X); //velocity
                    circle.setLayoutY(circle.getLayoutY() + Y); //velocity

// Bounce off the walls (working perfectly)
                    final Bounds bounds = canvas.getBoundsInLocal();
                    boolean leftWall = circle.getLayoutX() <= (bounds.getMinX() + circle.getRadius());
                    boolean topWall = circle.getLayoutY() <= (bounds.getMinY() + circle.getRadius());
                    boolean rightWall = circle.getLayoutX() >= (bounds.getMaxX() - circle.getRadius());
                    boolean bottomWall = circle.getLayoutY() >= (bounds.getMaxY() - circle.getRadius());

//THE PROBLEM IS HERE

//Collision between circle1 and circle2 (stationary black circle.
                    double dx = circle.getLayoutX() - circle2.getLayoutX();
                    double dy = circle.getLayoutY() - circle2.getLayoutY();
                    double radii = circle.getRadius() + circle2.getRadius();

                    if ( (dx * dx) + (dy * dy) <= radii * radii) {
                        X = X * -1; //X gets inverted to change direction

                    }

 //The code below is working perfectly.
                    // If the bottom or top wall has been touched, the ball reverses direction.
                    if (bottomWall || topWall) {

                        Y = Y * -1;
                        //circle.setLayoutY(circle.getLayoutY() - 50); - Wasn't working. Had to create X and Y to fix the problem.

                    }
                    // If the left or right wall has been touched, the ball reverses direction.
                    if (leftWall || rightWall) {
                        X = X * -1;
                    }
                }
            }

        }));

        loop.setCycleCount(Timeline.INDEFINITE);
        loop.play();
    }

P.S. Apologies for the amazing paint skills :D

sentences:
Collision response and delta-time problems I'm working on a 2d top-down shooter game. At the time, I am trying to get the movement and collision right, but I have a few problems with this.
First of all, I am making my game frame independent with delta time but that makes it harder for me to implement a collision system.

For example, I am checking collisions like this(java and libgdx):

public boolean collision(Rectangle collision) {
    this.setX(this.getX() + this.delta.x);
    this.AABB.x = this.getX();

    if (this.AABB.overlaps(ext))
    {
        this.setX(this.getX() - this.delta.x);

        this.AABB.x = this.getX();

        collided = true;
    }

    // The same for Y
    this.setY(this.getY() + this.delta.y);
    AABB.y = this.getY();

    if (AABB.overlaps(ext))
    {
        this.setY(this.getY() - this.delta.y);

        AABB.y = this.getY();

        collided = true;
    }

    if (collided)
        System.out.println("Collided, setting X to " + this.getX() + " and Y to " + this.getY());

    return collided;
}

Basically, I move the character on X, if there is a collision, I move it back to where it was before, and do the same for Y.The problem with this approach is that as the movement is frame independent, every frame delta.x and delta.y will be different, so when moving the player back to where it was before colliding will end up in different results.

    this.setX(this.getX() + this.delta.x); // delta.x is a little bit different every frame because of delta time.
    this.AABB.x = this.getX();

    if (this.AABB.overlaps(ext))
    {
        this.setX(this.getX() - this.delta.x); // So this will also bring me back to a different location every frame.

        this.AABB.x = this.getX();

        collided = true;

How can I deal with this(or is this acceptable, as it is almost invisible)?

Any help apreciated, thanks!

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:
is edit tangent possible in 3dsmax? I have a custom hlsl directx shader,
it takes vertex normals for rim light calculation.
and vertex tangent(it stores unified normals) for edge render(enlarge model & cull front).

I can export one fbx with auto smooth normals, and one fbx with unify normals, combine them in unity, it works but the process is slow. I just wonder if I can do it directly in 3ds max, so 3d artist can preview the result directly in their tools.

I tried storing unify normals data in texture coordinate or vertex color, but the data will be wrong once bone animation is running. So I believe normal + tangent is the only way to go if I want to have rim lighting & edge render together for a animated character model use in Unity3D.

I guess FBX SDK will help, but I have no experience in using it.

I wish someone could tell me a way to store vertex normals data into tangent.
or tell me is it not possible so that I should consider another solution.

thanks you.

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:
Control Torque Inputvector I'm faced with the following problem:

I'm trying to implement a rigidbody-based movement for my submarine game which means I want (need?) to useAddForce() and AddTorque() in order to get proper collision detection.

Currently I'm achieving the desired rotational behavior by quaternion multiplication/rotation.

But with this approach, the submarine bugs through the terrain. To avoid that it seems my only option is to use a rigidbody.

Here's a video illustrating the problem.

On the left is the correct behavior. I want to keep the nose pointing where it has been tilted at and not rotate around a fixed axis, Vector3.up in this case.

How can I calculate the correct input for AddTorque(vec3) to get the result I need?

Left attempt with quaternions (what I need):

input2 = Input.GetAxis("Sideways");
transform.rotation =
    Quaternion.Euler(0, input2 * Time.deltaTime * rotation_speed, 0) * transform.rotation;

Right attempt with torque (which doesn't quite work yet):

// in Update()
rotateY = Input.GetAxis("Sideways");

void FixedUpdate() {
    // experimenting with AddTorque() and various inputs didn't
    // get me any further
    rb.AddRelativeTorque(Vector3.up * rotateY * speed);
}

I hope someone can point me in the right direction, thanks in advance.

sentences:
How to properly do top-down aRPG melee attacks? I'm reposting this from my own thread in reddit's gamedev community, since there were too few responses:

I've been looking for some info on that, but I mostly find articles on the design of such systems, which are very useful, but not helpful from the coder's point of view. My main idea is similar to what the 2D Zelda games used to do, but with more directional freedom. In Zelda, you can only face one of the cardinal directions and attack the enemy there.
My idea is to have the same but with any direction, since we now have analog sticks, or even mice. I'm pretty sure this has been done before, and a few Flash games come to mind, such as the Zombie Apocalypse game Dead Frontier (which is now done on Unity3D, but was Flash back when I played it)

I'm working with Unity3D (although I'm making a 2D game), and I'm not completely happy with where I'm going.

This:  is my current hacky solution for a Melee hit check. The green triangle is the player, the faint green circle is a trigger that checks if there are enemies in this trigger, and the red boxy thing is an enemy.
When the player presses the "melee attack" button, it picks one of the enemies in the trigger (by order of the first one to enter the trigger) and causes damage.

Among a few things I've added to that are: Slow down the player movement during an attack, so that they can't "run n' slash" through an entire level, and also limit how many attacks the player can do per second. An attack cannot start if the previous one hasn't finished yet.

This is looking a bit crude, though. I just kind of hacked it together and it doesn't feel as natural as in other games I've played.

Here's my hacky Melee Attack script in my prototype (it uses a few magic numbers, such as the attack duration):

void Update()
{
 //other logic
    if (Input.GetMouseButtonDown (0) && sec <= 0)
    {
        attackDuration = 0.5f; //setting how long the attack takes from start to finish
    }
    if (attackDuration > 0)
    {
        attackDuration -= Time.deltaTime;
        if (attackDuration <= 0.25f && !done) //cause the damage when the attack is halfway done
        {
            if(EnemiesInRange.Count > 0)
            {
                Enemy target = ((GameObject)EnemiesInRange[0]).GetComponent<Enemy>();
                target.health -= 10;
                if (target.health <= 0)
                {
                    EnemiesInRange.Remove(target.gameObject); //if the enemy dies, it's no longer a valid target.
                }

            }
            done = true;
        }
    }
    else
    {
        done = false;
        sec = 0; //attack over, reset it to zero (to avoid stuff like -0,001)
    }
//other logic
}

Meanwhile, in the CharacterMovement.cs script:

void Update()
{
//other logic
    if(gameObject.GetComponent<MeleeAttack>().sec <= 0)
    {
        lookAtMouse();
        transform.Translate(new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), 0) * baseSpeed, Space.World);
    }
    else
    {
        transform.Translate(new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), 0) * (baseSpeed*0.25f), Space.World);
    }
//other logic
}

What I'm doing here is stopping the player to change their facing during the attack as well as slowing the movement down to 1/4 the base speed.

Anyway, any advice? How could I make attacking and moving feel more natural? What about the hit mechanics themselves?

My biggest gripe right now is: I don't think "Pick an enemy in a small circular area ahead of the player" is really good.  What should I do?

sentences:
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:
Help with transform.lookat and camera? Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
transform.LookAt(mousePos);

This will actually make the camera follow the mouse, but it goes crazy, the camera seems to spin in circles rapidly : here is actually a gif of what is happening. https://gyazo.com/952da6c28e644b7b0e6500a597b6804e/preview Could anyone help me figure how how to fix it?

sentences:
Accessing DualShock 4 motion sensor in Windows (ideally Unity) I'm trying to use a DualShock 4's IMU as a motion controller in Unity, under Windows 7.

So far I've tried:

DS4Windows (1.5.11): reads motion sensor data, but does not expose them to Unity as axes unless I map them to the left & right sticks. This is not enough since I lose use of the sticks, I can only fit 4 of the 6 channels of data, and the values coming through are clipped into a narrow range.
Motioninjoy (0.7.1001): does not appear to detect the DS4 as a controller (latest docs refer only to DS3 and prior)
GlovePIE (0.43): after following instructions for using the DualShock 3 with LibUSB-Win32 (a long shot), SixAxis properties are all blank.

In the past I've used external programs like GlovePIE to capture Wii remote motion sensor data and pass it to Unity via OSC messages, so I'd be open to an approach like this if I can't get Unity to read the controller's sensors directly through its Input system.

Anyone had luck with this?

sentences:
OpenGL shader program per shape or model I have a program which imports models from .obj files and then draws them with OpenGL. I have a model which contains many shapes (meshes?). Not every shape has texcoords defined inside .obj file (it looks like 1//1 instead of 1/1/1) and I try to use one shader program which depends on texcoords.

What would be the best solution for that problem? Should I use separate programs for shapes that have texcoords and another for shape without texcoords defined?

Maybe there is a way to check if some attributes were passed to shader program?

This is the gist with .obj, .mtl and shader files, maybe that will help you to understand my problem.

sentences:
Unity3d webplayer failed to download data file When testing my game web builds on localhost, I get the error "Failed to download data file". The game data file is correctly placed, and the page loads fine, it just wont download the plugin, or prompt me to do so.

I tried the following things:
Add MIME Types to IIS 7.5:

Open IIS Manager
Double click "MIME Types" in the IIS section.
Click Add on the right side "Actions" menu.
File name extension: = .unity3d
MIME type: application/unity3d
click ok
Restart the server (right side "Actions" menu)

That didn't work for me specifically because it turned out I was using IIS Express, so I did the following:

If Windows 7, browse to 'C:\Users\\Documents\IISExpress\config\' and open the file: ApplicationHost.config.

Search for 'staticContent' and add the following before the closing tag:

However, again, it didn't work..

sentences:
Render in a imGui Window How do i render my game scene into an imgui window?

I want to get from this:

to this :

sentences:
What's wrong with this Open GL ES 2.0. Shader? I just can't understand this. The code works perfectly on the emulator(Which is supposed to give more problems than phones…), but when I try it on a LG-E610 it doesn't compile the vertex shader. This is my log error(Which contains the shader code as well):

EDITED

Shader:

uniform mat4 u_Matrix;

uniform int u_XSpritePos;
uniform int u_YSpritePos;
uniform float u_XDisplacement;
uniform float u_YDisplacement;

attribute vec4 a_Position;
attribute vec2 a_TextureCoordinates;

varying vec2 v_TextureCoordinates;

void main(){
    v_TextureCoordinates.x= (a_TextureCoordinates.x + u_XSpritePos) * u_XDisplacement;
    v_TextureCoordinates.y= (a_TextureCoordinates.y + u_YSpritePos) * u_YDisplacement;

    gl_Position = u_Matrix * a_Position;
}

Log reports this before loading/compiling shader:

11-05 18:46:25.579: D/memalloc(1649): /dev/pmem: Mapped buffer base:0x51984000 size:5570560 offset:4956160 fd:46
11-05 18:46:25.629: D/memalloc(1649): /dev/pmem: Mapped buffer base:0x5218d000 size:5836800 offset:5570560 fd:49

Maybe it has something to do with that men alloc? The phone is also giving a constant error while plugged: ERROR FBIOGET_ESDCHECKLOOP fail, from msm7627a.gralloc

Edited: "InfoLog:" refers to glGetShaderInfoLog, and it's returning nothing. Since I removed the log in a previous edit I will just say i'm looking for feedback on compiling shaders.

Solution + More questions: Ok, the problem seems to be that either ints are not working(generally speaking) or that you can't mix floats with ints. That brings to me the question, why on earth glGetShaderInfoLog is returning nothing? Shouldn't it tell me something is wrong on those lines? It surely does when I misspell something.

I solved by turning everything into floats, but If someone can add some light into this, It would be appreciated. Thanks.

sentences:
Licensing Theme Music from other games As part of my game, I thought it would be fun to make a hidden level that pays tribute to Mario Bros (one of the earliest games I ever played). It would be themed in that way with 8-bit graphics and question mark blocks and completing the level would say "Thank you but the princess is in another castle" or such.

For the sound track, I'm thinking of just overlaying the standard mario theme music by playing it on a virtual keyboard using a different instrument/timing or something.

My question is, am I legally safe? I'm not using anyone else's actual music, I'm just playing the same tune in a different way myself. Do I have to get licensing for this?

sentences: Direct3D Error Code 80070057 I'm getting a failure returned when calling Direct3DDevice->CreateDepthStencilSurface(). But rather than returning one of the values that the documentation says it should return (D3DERR_NOTAVAILABLE, D3DERR_INVALIDCALL, D3DERR_OUTOFVIDEOMEMORY, E_OUTOFMEMORY), it returns error code 80070057. What does this mean?

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:
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:
Should each Entity have its own update and render methods? First, the questions:

Should each Entity (which are classes like Character, Tree, Enemy) have its own update() and render() methods?
If that's the case, then should I use Interfaces like "Renderable" and "Updatable"?

I ask you this because most of the tutorials I followed "told" me to include all Input Handling and Updates inside the Game's main update() method, and all the Rendering inside the Game's main render() method.

I know these tutorials are very simple but even a few more complex ones still had all the Entities' actions inside the same block of code, which made me doubt the ideas I previously had (separating updates and renders per each object).

To clarify, I feel like I should have something like this:

update() {
    HandleTheUserInput();
    for each active Entity in the game right now {
        entity.update();
    }
}

Then, the same thing for rendering (except the input part). Am I following the right path here or should I rethink the current architecture ideas I have? Thank you.

sentences:
How do you prevent AABBs from passing through each other? I know what an AABB is, but I don't know how you would check for collision with an object that is going really fast. If an object goes fast enough, it can skip over other bounding boxes without it detecting a collision.

Example:

So, for an object with a bounding box to move from (0, 0) to (525, 670) in one update, would I have to somehow iterate over each point from the starting point to the end? Because I need objects to be able to go fast and still be tested for collision on other bounding boxes. I hope that makes sense.

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:
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:
What scripting language would you recommend for a C++ game project? By scripting here I mean not just putting config data in a script, but scripting parts of the project like some class methods, test specific game loop, etc. This would be not just to accelerate development, but also allow players to see some of these scripts to tweak some aspects of the game.

Some language like Lua have some wrappers like luabind, but when I've used it in the past it had problems because it didn't support method redefinition in a context of inheritance.

What are your suggestions of language / wrappers to use or not to use?

sentences:
Struggling to implement A* pathfinding execution So I've implemented pathfinding to my game which works well with a tile based map. All tiles have an x & y integer coordinate for example the tile on the top left would be 0,0 the adjecent tiles would we 0,1; 1,0 and 1,1. My pathfinding returns a path based on these coordinates.

My game however is using float coordinates. So that an entity is basically able to stand on or between two tiles at the same time. For that  the tile coordinates are multiplied by 32 (the size of one tile). That means the first tile would be 32,32  and the adjecent tiles 64,32; 32,64; 64,64

My approach was to get a target X and Y from my pathfinding to calculate the next step and multiply it by 32. So if the entity is supposed to move to the top left for example the targetX and Y would be 1*32, 1*32.

After the targetX & targetY is set i'll increase or decrease the coordination of moving entity by its movementspeed, when it's reached its targetX & targetY i'll get the next step and to the same until no steps are left.

However I'm encountering various problems because it's not really possible to set an entity to a certain field because its possible to stand on two tiles at the same time and entities only have float coordinates. Especially when an entity is supposed to move around a narrow corner its getting stuck because of the offset between the pathfinding and the float coordinates of the entity.

I hope my problem became more or less clear, how could I deal with that or how is dealt with that problematic in general? I'm glad about any advices.

Edit: No diagonal movement is intended.

sentences:
Writing a server for a multiplayer game I've been looking on the internet, but I can't really find any good answers to all my questions..

I started to think about writing a little multiplayer game on my own and after thinking and thinking and thinking about how I should begin I came to the conclusion, that implementing the network communication part at first wouldn't be a bad idea since the testing part becomes "easier".

So my first question is:

Is there any library that would make my life easier if I wanted to write the server part in C++?

I just don't know how one would implement the communication between server and client. Imagine a game that is made up of blocks (like minecraft if you want) but the client should only receive a tiny part of that map. So my question at this one is: Would you send raw byte data? Or would you use more abstract formats like XML? Let us assume that this should work with "many" clients as well..

And here is another thing..

Would one use either a single thread that collects all connections and sends requests to specific worker threads or would you create a new thread for every single connection that is established to the server?

sentences:
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:
Why does my game freeze when I try and display a menu? I make a MenuScene when my Game loads, which grabs some intro text from levelData and displays it and a button to start playing the level. When the MenuScene is created and displayed in onLoadComplete() it's fine. However when I display it again when advancing the level (levelData is loaded with new data and the MenuScene reset) it freezes, showing the game at the point the level was beaten. The menu is not displayed at all. I'm just calling

loadIntro();
this.mScene.setChildScene(this.mIntroScene, false, true, true);
this.mEngine.stop();

to display the MenuScene (the same both times, it works the first time but not the second), where loadIntro() is

private void loadIntro() {
            this.mIntroScene = new MenuScene(this.mCamera);

            final TextMenuItem intro = new TextMenuItem(-1, mFont, levelData.getIntroText());
            intro.setBlendFunction(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
            intro.setSize(400, 150);
            this.mIntroScene.addMenuItem(intro);

            final SpriteMenuItem startMenuItem = new SpriteMenuItem(MENU_START, this.mMenuStartTextureRegion);
            startMenuItem.setBlendFunction(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
            this.mIntroScene.addMenuItem(startMenuItem);

            this.mIntroScene.buildAnimations();
            this.mIntroScene.setBackgroundEnabled(false);
            this.mIntroScene.setOnMenuItemClickListener(this);

    }

What am I doing wrong?

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:
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:
Character movement in Unity For an endless runner game such as Subway Surfer, in order to move your character so smoothly in both z-axis and x-axis, which component of the followings is better:

CharacterController or RigidBody?

Can we use both of them together; if so, will it have any effect on the performance of our game?

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:
Why use this equation to get a percentage? In an XNA book I read that this code does an action with a 0.2% of probability
but I don't' understand why:

float chance = 0.2f;

if((float)rand.Next(0,1000) / 10 <= chance)
{
...
}

I understand the statement, but not the reasoning for that equation. Can anyone explain me, please?

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:
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:
Calculating the "power" of a player in a "Defend Your Castle" type game I'm a making a "Defend Your Castle" type game, where each player has a castle and must send units to destroy the opponent's castle. It looks like this (and yeah, this is the actual game, not a quick paint drawing..):

Now, I'm trying to implement the AI of the opponent, and I'd like to create 4 different AI levels: Easy, Normal, Hard and Hardcore. I've never made any "serious" AI before and I'd like to create a quite complete one this time.

My idea is to calculate a player's "power" score, based on the current health of its castle and the individual "power" score of its units. Then, the AI would just try to keep a score close to the player's one(Easy would stay below it, Normal would stay near it and Hard would try to get above it). But I just don't know how to calculate a player's power score. There are just too many variables to take into account and I don't know how to properly use them to create one significant number(the power level).

Could anyone help me out on this one?

Here are the variables that should influence a player's power score:

Current castle health, the unit's total health, damage, speed and attack range.
Also, the player can have increased Income(the money bag), damage(the + Damage) and speed(the + speed)... How could I include them in the score?

I'm really stuck here... Or is there an other way that I could implement AI for this type of game?

Thanks for your precious time.

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:
How can I determine the extreme color values in a texture? I am looking for a way to determine the most extreme color values for all of the texels in a texture. So for a texture consisting only of black and white texels, the extreme values should be (0,0,0) and (1,1,1) expressed in RGB format. For a color gradient from red to green I should get the values (1,0,0) and (0,1,0).

Now obviously I could do this on the CPU by iterating over all the pixels/texels of the texture and keeping track of the color values found to be most apart from each other, but this is probably relatively slow, so I am looking for a way to do this using the GPU/shaders.

Is this possible using shaders? I am not experienced with GPGPU, so a solution in HLSL/GLSL would be preferred. Or maybe there is a fast algorithm I could use on the CPU?

sentences:
How 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:
Parallelizing creation of geometry chunks in minecraft-like game In my game I separate creation of chunks into two stages. The first is where I generate the heightmap using simplex noise and the 2nd is when I create the actual vertex buffers. I do it like this so that when creating the geometry I can always look at neighboring chunks so I can do decide things like visibility of faces.

Right now I'm working on loading chunks in the background. My first attempt was to create a simple job queue and just push all of the jobs for stage 1 first followed by all the jobs for stage 2. The problem then becomes a thread trying to start a job for the 2nd stage before all the necessary 1st stage jobs are done.

I suppose I could just have another worker thread that waits for all the 1st stage jobs to finish but that seems less than ideal. It also means I can't do anything clever like starting a stage 2 chunk job after that chunk and all surrounding chunks have gone through stage 1 instead of just waiting for all pending chunks to have gone through stage 1.

What is the correct system to use when dealing with dependencies of this kind?

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:
Loop around a 2D Tile Map I have made an algorithm for procedurally generating a 2D tile map in Unity.

The player can use the mouse to pan the view and look at the map.

My intention was that when the player reaches one of the sides of the map, he would simply see the other side as if he was going around the Earth so to speak.

The only way I have achieved this is by simply instantly setting the camera's position to the other side of the map when the player crosses one of the edges. The problem with this is that the player never actually sees the "border" connection continuously and that bothers me since I took the care to generate the map in such a way that connecting the east/west edges makes sense.

How can I achieve the desired effect?

sentences:
LibGDX controllers: how to fix crashes in JRuby? I'm using JRuby with LibGDX and it's been going quite swimmingly, save for a crash I experience every time I try to use the controllers extension.

Here's a basic rundown:

I've required all the related jars (gdx-controllers.jar, gdx-controllers-desktop.jar, and gdx-controllers-desktop-natives.jar).
I've imported the controllers package via import "com.badlogic.gdx.controllers".
I call Controllers.controllers, which goes to the getControllers method.
My game crashes with this error:

libc++abi.dylib: terminating with uncaught exception of type OIS::Exception: CocoaInputManager::_parseConfigSettings >> Unable to find a window or event target

I think the error is due to a lack of a view being passed to OIS library (here's an online view of a related source).

How do I prevent the controllers extension from crashing my game? More importantly, how do I make it work? :)

sentences:
How can I create a spacial grid? I just created a tile map for my game, and its a side profile game. The game looks sort of like Terraria, where there is blocks you can place and break. I want the player to be able to collide with the blocks, and I don't know how to achieve something like this.

The game is in Javascript but I can understand other languages so feel free to give examples in the language of your choice.

sentences:
Player stats include additional attribute I am currently running a role-playing game called DNDBBS and would like to know: If there is stats for Strength, Intelligence, Wisdom, Dexterity, Constitution, Piety, should there be one for Charisma? Is this standard DND?

Edited: 07/31/2018 11:00:00 CST:

The DNDBBS is a Modem (POTS) oriented multi-node text based Adventure game. It can be found on google or http://www.filegate.net/pdnbasic/

Edited: 08/03/2018 21:25:00 CST:

I decided to also add Beauty and Glamour for Lady class.

sentences:
How can I create a "cracked glass" material? I'm trying to figure out how the cracked and chipped glass effect in a Bioshock Infinite Burial at Sea Episode 2 works.

My current guess is that it is essentially a transparent shader with gloss. It would have a map defining the direction of reflections from the environment, with the cracks being significantly different from the mesh's normals. It would also include some kind of model of the angular dependence of the amount of refraction/transmission to reflection so that it can roughly approximate Fesnel's equations.

It doesn't appear to be a full refractive model, so I'm wondering how exactly this is implemented? Am I right with what I have said above?

sentences:
Problems with Creating Snake's Clone on Java I'm creating Snake's clone. My app have too classes: Snake.java and Board.java.

Right now I have three problems:

1) There are two constants - BOARDS_WIDTH, BOARDS_HEIGHT. They are meant to be dimensions for playground where snake moves and collects apples. It's dynamic and I can set them as I want. For example 640 x 480, 160 x 160 or whatever. Only thing I need to keep in my mind is that both numbers must divide with 16. Why? Because constant UNIT is set to 16 x 16 and, for example, when board's dimensions are set to 160 x 160, it means that there would be 10 x 10 units large playground (160 / 16 = 10). Problem: playground is always two pixels (not units) larger than it meant to be. Like if I have set dimensions to 160 x 160, actual dimensions will be 162 x 162! Here are screenshot...

If you measure this image... after pill (apple, if you like) there are two extra pixels.

2) Collisions. I think - it's because problem #1. You see, there are code lines...

if( x[0] < 0 || x[0] > BOARDS_WIDTH || y[0] < 0 || y[0] > BOARDS_HEIGHT ) {

    inGame = false;

}

They should prevent snake from going into walls. Actual result is that snake goes few units in the wall - then only the game stops... i want it to stop exactly when snake collide with the wall!

3) How to make snake start to move only when users clicks any of arrows? Right now it's like snake starts to move her body, but her head is stopped. After joints * DELAY snake's all joints are under her head! Ha, ha...

sentences:
Unity 5.6 - Can no longer select empty GameObject with Gizmo in editor Has anyone else noticed this?
I'm using the latest version of Unity (5.6.0p2) and it appears Gizmos are no longer selectable by default.

Is there any way to restore this behaviour?

Some of my objects are essentially empty (no meshrenderer/Filter) with a MonoBehavior attached, which require a gizmo drawn sphere so it can be selected.

Is there a better/more appropriate way of making non-mesh gameobjects selectable in the editor that I'm not aware of?

I understand I could use Handles to detect a mouse click but this doesn't allow for simple drag selection (marquee tool) if I want to select a load at once.

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:
Seamless tiling with TexturePacker and Marmalade/IwGX I'm looking for a way to get seamless tiling working, where the tiles are sprites off a TexturePacker sprite sheet, and the rendering is done with Marmalade's IwGX's streams. I also need to render the tiles in multiple scales at the same time.

Even with TP settings "reduce border artifacts: off" and "inner padding: 0", there are very noticeable, pixel-wide gaps between the tiles. If I move the tiles close together, they look fine at a scale of 1, but anything smaller or larger yields gaps.

If I use one tile per texture, I get no gaps, but it means that I either can't have a variety, or each tile will take one draw call + material switching, which is not only slow, but brings the gaps back.

Any tips?

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: 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:
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:
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:
Increasing resolution of a texture? I'm doing some experiments on my own to improve my general skills with HLSL and so forth. In other words, I'm not doing any serious game development, but only looking to expand my knowledge within the field.
I'm trying to figure out how I can increase the resolution of a texture, and multiply it X amount of times.
Consider the following low-resolution picture:

A typical scenario for me would be to scale up this picture 3 times in the shader without interpolation, and draw the new result:

I've been experimenting with a shader that transfers the small picture on to a texture as a variable on the shader. I got that far. Now I just need it to take that texture using tex2D or something else, and scale it up.
How would I do that?

sentences:
Wrap texels between desired values I'm using a basic pixel shader here

uniform sampler2D texture;
uniform float pixel_threshold;

void main()
{
    float factor = 1.0 / (pixel_threshold + 0.001);
    vec2 pos = floor(gl_TexCoord[0].xy * factor + 0.5) / factor;
    gl_FragColor = texture2D(texture, pos) * gl_Color;
}

It works great in my game. But on a new enemy it doesn't. This enemy is different because it uses a texture atlas- one big texture holding more frames than just the character. The sampling gets messed up because factorapproaches 0 so does the xy coord therefore sampling some pixels outside of the character's sheet. Likewise when pixel_threshold gets small, the xy coord goes outside of the character's spot in the texture.

Clamping is not the solution because we want it to wrap around. I've tried many ways of wrapping but not seem to offer the desired effect of the original.

I tried using 4 uniforms: left,top,width,height and passing in the masking values used when drawing the sprite from the spritesheet.

vector2 size = mySprite.getSize();
float left = mySprite.getTextureRect().left / size.x;
float top  = mySprite.getTextureRect().top / size.y;
float width= mySprite.getTextureRect().width/ size.x;
float height=mySprite.getTextureRect().height/size.y;

myShader.setUniformf("left", left);
...
myShader.setUniformf("height", height);

How can I have the pixel blur shader stay within the texel ranges provided by the uniform? Thanks.

sentences:
How to get an game object to instantiate lower than where It's created? When I press the collider where my allies spawn I want for them to spawn a little bit lower when I instantiate. I have tried to use Vector 3 and GetComponent, but It gives this error:

'Assets/Scripts/PlaceMonster.cs(26,33): error CS0131: The left-hand side of an assignment must be a variable, a property or an indexer'

I just want for my allies to spawn a little bit lower than the collider, but I'm stumped on what's the problem.

void OnMouseUp () {
    theAllyMenu.gameObject.SetActive (false);
    if (canPlaceAlly ()) {
        ally = (GameObject)
            //GetComponent<Transform>().transformPic = transformPic;
            transform.position = new Vector3(transform.position.x, transform.position.y - -5, transform.position.z);
            Instantiate (allyPrefab, transform.position, Quaternion.identity);
    }

}

sentences:
"Walking" along a rotating surface in LimeJS I'm trying to have a character walk along a plank (a long, thin rectangle) that works like a seesaw, being rotated around a central point by box2d physics (falling objects). I want the left and right arrow keys to move the player up and down the plank, regardless of it's slope, and I don't want to use real physics for the player movement.

My idea for achieving this was to compute the coordinate based on the rotation of the plank and the current location "up" or "down" the board.

My math is derived from here:
https://math.stackexchange.com/questions/143932/calculate-point-given-x-y-angle-and-distance

Here's the code I have so far:

movement = 0;
if(keys[37]){ // Left
    movement = -3;
}

if(keys[39]){ // Right
    movement = 3;
}

// this.plank is a LimeJS sprite.
// getRotation() Should return an angle in degrees
var rotation = this.plank.getRotation();

// this.current_plank_location is initialized as 0
this.current_plank_location += movement;

var x_difference = this.current_plank_location * Math.cos(rotation);
var y_difference = this.current_plank_location * Math.sin(rotation);

this.setPosition(seesaw.PLANK_CENTER_X + x_difference, seesaw.PLANK_CENTER_Y + y_difference);

This code causes the player to swing around in a circle when they are out of the center of the plank given a slight change in rotation of the plank.

Any ideas on how I can get the player position to follow the board position?

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:
Input.mousePosition gives a NullReferenceException I'm trying to Add raycast shooting to my player but when I get the Vector2 mouse position it give this error

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

This is my code

   Vector2 mousePosition =
         new Vector2(Camera.main.ScreenToWorldPoint(Input.mousePosition).x,
                     Camera.main.ScreenToWorldPoint(Input.mousePosition).y);

How can i fix this ?

sentences:
Use raycast to fix bullet's direction? Player cam has a raycast. I need it to work as pointer for player's bullet direction. If the ray hits any kind of object this spot will be the aim of player's bullets.

Here is my script

public class camraycast : MonoBehaviour {

Camera mycamera;
GameObject prefab;

public int bulletSpeed = 10;
public GameObject angle; //  camera
public GameObject players;

void Start () {
    prefab = Resources.Load("bullets") as GameObject;
    mycamera = GetComponent<Camera>();
}

void Update() {

    if (Input.GetMouseButtonDown(0))
    {
        Vector3 camScreen = new Vector3(0.5f, 0.5f, 0f); // center of the screen
        float rayLength = 100f;
        Ray ray = mycamera.ViewportPointToRay(camScreen);
        RaycastHit hit;
        Debug.DrawRay(ray.origin, ray.direction * rayLength, Color.red);

        if (Physics.Raycast(ray, out hit, rayLength))
        {
            print ("Looking at : " + hit.transform.name);
            GameObject bullets = Instantiate(prefab) as GameObject;
            bullets.transform.position = players.transform.position + angle.transform.forward * 0.1f;
            Rigidbody rb = bullets.GetComponent<Rigidbody>();
            rb.AddForce((hit.point - angle.transform.position) * bulletSpeed);
            Destroy(bullets, 9f);
        }
    }
    Vector3 camScreens = new Vector3(0.5f, 0.5f, 0f); // center of the screen
    float rayLengths = 100f;
    Ray rays = mycamera.ViewportPointToRay(camScreens);
    Debug.DrawRay(rays.origin, rays.direction * rayLengths, Color.red);
}
}

sentences:
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:
Camera follows player but how to stop camera moving when player moves The player is moving automatically diagonally down the screen, and I have the camera as a child on the player. I would like the camera to always be following the player (who sometimes slows down / speeds up) as they are automatically moving, but when the player moves left and right, I don't want the whole camera view to shift with this.

I am moving the player with this:

transform.Translate(xSpeed, ySpeed, 0);

And the player can move the character with this:

Vector2 direction = new Vector2(0.2f, 0.67f);

if (Input.GetKeyDown(KeyCode.LeftArrow))
{   //transform stores the position data of the playu
    transform.Translate(direction * -distance);
}

else if (Input.GetKeyDown(KeyCode.RightArrow))
{
    transform.Translate(direction * distance);
}

However when they move with this I would like not for the camera to shift with the movement, but still continue to follow them as they move across the 2D map.

@Hash Buoy I can't add comments yet, but the player is automatically moving at an angle, which the camera follows them. They can move left and right with the arrow keys, and I was just wondering how to stop the camera shifting left and right (also as a 45 degree angle) when they do this

sentences:
Playerbody is turning, but not moving in direction turned So, I have a simple WASD script, and I've added a part so when Mouse X is moved, the playerBody (character) rotates in that direction, so, when W is pressed (to go forward) the player does not move in the direction turned, but it moves in the same direction. Although the playerBody has turned, the player still moves in the same direction.... why?
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;

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

    void Update()
    {
        if (characterController.isGrounded)
        {
            // We are grounded, so recalculate
            // move direction directly from axes

            moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0.0f, 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") * speed * Time.deltaTime;
        float MOUSEX = Input.GetAxis("Mouse X") * speed * Time.deltaTime;

        charBody.Rotate(Vector3.up * MOUSEX);

    }
}

Thanks

sentences:
How can I generate a 3d model via a series of transforms? Is it possible to generate 3D models using some sort of object transformation (like it's shown here), using PovRay or any other tool, and import them into Blender / Unity?

For example starting with a primitive sphere:

And applying a series of transforms/noise to generate something like:

Then baking them in, resulting in a 3D model of an asteroid that can be used in game.

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:
Agent trying to reach same position as other agents, instead start spinning in place I create units in my game and have a rally point where they should walk to when created, like Age of Empires.

My problem is that since they compete for this position after a while, sometimes they end up doing this:

https://gfycat.com/decentquestionableandeancondor

https://gfycat.com/densehonoredgalapagosalbatross

As you can see one of the guys cant reach the rally point, so he starts rotating.

I realize this has to do with stopping distance, but no matter how high I set the stopping distance this eventually becomes a problem when there are many enough units. And if I set it too high they dont walk to the rally point at all, since its not THAT far from the building they spawn from.

Is there any way to manage this scenario? i.e just making him go as close as he can, and then stop?

My AI Script:

using UnityEngine;
using UnityEngine.AI;

[RequireComponent(typeof(NavMeshAgent))]
public class BaseAi : MonoBehaviour
{
    [HideInInspector]
    public NavMeshAgent agent;

    [HideInInspector]
    public NavMeshObstacle obstacle;

    float sampleDistance = 50;

    Transform mTransform;

    private void Awake()
    {
        agent = GetComponent<NavMeshAgent>();
        obstacle = GetComponent<NavMeshObstacle>();
        mTransform = transform;
    }

    private void Start()
    {
        agent.avoidancePriority = Random.Range(agent.avoidancePriority - 10, agent.avoidancePriority + 10);
    }

    void LateUpdate()
    {
        if (agent.isActiveAndEnabled && agent.hasPath)
        {
            var projected = agent.velocity;
            projected.y = 0f;

            if (!Mathf.Approximately(projected.sqrMagnitude, 0f))
                mTransform.rotation = Quaternion.LookRotation(projected);
        }
    }

    /// <summary>
    /// Returns true if the position is a valid pathfinding position.
    /// </summary>
    /// <param name="position">The position to sample.</param>
    public bool SamplePosition(Vector3 point)
    {
        NavMeshHit hit;
        return NavMesh.SamplePosition(point, out hit, sampleDistance, NavMesh.AllAreas);
    }

    public bool SetDestination(Vector3 point)
    {
        if (SamplePosition(point))
        {
            agent.SetDestination(point);
            return true;
        }

        return false;
    }

    public void Teleport(Vector3 point)
    {
        agent.Warp(point);
    }

    /// <summary>
    /// Return true if agent reached its destination
    /// </summary>
    public bool ReachedDestination()
    {
        if (agent.isActiveAndEnabled && !agent.pathPending)
        {
            if (agent.remainingDistance <= agent.stoppingDistance)
            {
                if (!agent.hasPath || agent.velocity.sqrMagnitude == 0f)
                {
                    return true;
                }
            }
        }

        return false;
    }

    public void ToggleObstacle(bool toggleOn)
    {
        agent.enabled = !toggleOn;
        obstacle.enabled = toggleOn;
    }

    void OnDrawGizmos()
    {
        if (agent == null) { return; }
        if (agent.path == null) { return; }

        Color lGUIColor = Gizmos.color;

        Gizmos.color = Color.red;
        for (int i = 1; i < agent.path.corners.Length; i++)
        {
            Gizmos.DrawLine(agent.path.corners[i - 1], agent.path.corners[i]);
        }
    }
}

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:
How To Approach 360 Degree Snake I've recently gotten into XNA and must say I love it. As sort of a hello world game I decided to create the classic game "Snake". The 90 degree version was very simple and easy to implement. But as I try to make a version of it that allows 360 degree rotation using left and right arrows, I've come into sort of a problem.

What i'm doing now stems from the 90 degree version: Iterating through each snake body part beginning at the tail, and ending right before the head. This works great when moving every 100 milliseconds. The problem with this is that it makes for a choppy style of gameplay as technically the game progresses at only 6 fps rather than it's potential 60.

I would like to move the snake every game loop. But unfortunately because the snake moves at the rate of it's head's size it goes way too fast. This would mean that the head would need to move at a much smaller increment such as (2, 2) in it's direction rather than what I have now (32, 32). Because I've been working on this game off and on for a couple of weeks while managing school I think that I've been thinking too hard on how to accomplish this. It's probably a simple solution, i'm just not catching it.

Here's some pseudo code for what I've tried based off of what makes sense to me. I can't really think of another way to do it.

for(int i = SnakeLength - 1; i > 0; i--){
    current = SnakePart[i], next = SnakePart[i - 1];

    current.x = next.x - (current.width * cos(next.angle));
    current.y = next.y - (current.height * sin(next.angle));

    current.angle = next.angle;
}

SnakeHead.x += cos(SnakeAngle) * SnakeSpeed;
SnakeHead.y += sin(SnakeAngle) * SnakeSpeed;

This produces something like this: Code in Action. As you can see each part always stays behind the head and doesn't make a "Trail" effect.

A perfect example of what i'm going for can be found here: Data Worm. Not the viewport rotation but the trailing effect of the triangles.

Thanks for any help!

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:
How can I move a created Image in Slick2D? I want a image to follow the mouse, and I use Image class of Slick 2D:

public void init(GameContainer gameContainer, StateBasedGame stateBasedGame) throws SlickException {
    mouseImage = new Image("res/mouse.png");
}
public void render(GameContainer gameContainer, StateBasedGame stateBasedGame, Graphics  graphics) throws SlickException {
    mouseImage.draw(0,0,0.1f);
}

But it seems that it does not have method for re-positioning a Image object. So how can I implement it (in update method)? Thanks.

sentences:
Enemy collision detection with movie clips I have created multiple movieclips with animations within them.  It is an obstacle avoidance game and I cannot seem to be able to get my enemies to contact my playableCharacter. The enemies I have created are each embedded on certain levels of my game. I have created an array, enemiesArray to have each of my enemies placed within it. Here is the code for that:

//step 1: make sure array exists
if(enemiesArray!=null && enemiesArray.length!=0)
{
    //step 2: check all enemies against villain
    for(var i:int = 0;i < enemiesArray.length; i++)
    {
        //step 3: check for collision
        if(villain.hitTestObject(enemiesArray[i]))
        {
            //step 4: do stuff
            trace("HIT!");
            removeChild(enemiesArray[i]);
            enemiesArray.splice(i,1);

            removeChild(villain);
            villain = null;
        }
    }
}

What I am unsure of is whether or not my enemiesArray is actually holding the movieclips I have suggested. If it was, this code would be tracing back a "HIT" for every time I ran into an enemy and would kill my character. It is not doing that however.

I am thinking I have to push my movieclips into my array but I don't know how to do that or where for that matter.

Any and all help would be much appreciated.

sentences:
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:
Nav Mesh Agents are not moving along the mesh I'm fairly new to unity.I've been playing with Nav Mesh Agents lately.I have encountered this problem twice.The first time I didn't bother redoing my project all over again.But now its bothering me too much.
I initially had a NavMesh baked along the road in my game.But later I had to change the layout of the roads, hence I had to rebake the Nav Mesh.
But now I'm having the problem where the agents are not moving along the Nav Mesh to Reach the destination, but instead they "try" to move along the shortest path.As a result of this all agents gather to a point rather than moving along the track.I've shown below a picture to better illustrate my problem.

They try to move along the red line instead of going along the road and then getting to the destination.
I'm pretty confident that nothing's wrong with my code because it worked earlier and works well in other scenes.Is there anything I missed when re-baking the Nav Mesh?Any help to get the agents to move along the road is much appreciated?
Thanks in advance.

sentences:
How to synchronize the speed of spawned object and spawning time interval? I want a stream of enemies coming from the top of the screen one behind other in a line, with their speed (speed of the whole stream i.e. every enemy) increased over time.

When I simply increased their speed, a continuous stream of balls (which will be my enemies) is lost since objects are spawned at a fixed time interval irrespective of the varying speeds of the spawned balls.

To maintain the continuous flow of balls what I wanted is to generate balls rapidly as the speed increases. So there should be a direct relationship between spawning interval and speed of the stream.

How can I do that?

sentences:
Is AGS outdated for Point & Click Adventures? I am working on a Point and Click Adventure game being coded on the AGS engine, and just recently, the question of 'is this outdated?' has come up.

I'll admit, AGS is a rather old, and kind of went out of style with the P&C genre itself, but I have not found anything quite like it that specializes in this specific format of games.

So, is it outdated, and if so, is there a better alternative?

sentences:
Best way to notify a user on Facebook that it's their turn to act I'm creating a turn-based game that I'd like to integrate into Facebook.  Players may not necessarily be playing in real time so having a way for them to know when it's their turn is desirable.

I was initially thinking facebook notifications, but it appears that has been deprecated:
https://stackoverflow.com/questions/4619164/how-to-send-a-facebook-notification-through-their-api

The alternatives don't sound terribly pleasant (writing on their wall, or having the player that just finished their turn send a request)

Are there any better alternatives?

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: Create a filled pixmap for box2d fixture I'm trying to make a pixmap that fills in a Box2D fixture. It would be kind of like a fill bucket. I've done this before, but I want it to work on rectangles and other polygons. Is there an algorithm to do is, or will I need to write on myself? Thanks.

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:
How do I check if a window has focus in SDL2? Is there a replacement for SDL_GetAppState function in SDL2 from older SDL versions? Why was it removed? I want to use it so I can check if the user has focused the framebuffer window or not.

I found it in the documentation of the SDL 1.2.15 (Documentation page) but it seems like it disappeared in SDL2.X.

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:
Best way to get elapsed time in miliseconds in windows I'm trying to do it using two FILETIMEs, casting them to ULONGLONGs, substracting the ULONGLONGs, and dividing the result by 10000. But it's pretty slow, and I want to know if there is a better way to do it.I use c++ with visual studio 2008 express edition. This is what I'm using:

FILETIME filetime,filetime2;
GetSystemTimeAsFileTime(&filetime);
Sleep(100);
GetSystemTimeAsFileTime(&filetime2);
ULONGLONG time1,time2;
time1 = (((ULONGLONG) filetime.dwHighDateTime) << 32) + filetime.dwLowDateTime;
time2 = (((ULONGLONG) filetime2.dwHighDateTime) << 32) + filetime2.dwLowDateTime;
printf("ELAPSED TIME IN MS:%d",(int)((time2-time1)/10000));

sentences:
Should I use Box2D for collision-detection only (not simulating physics)? I'm using Box2D only to check collisions and for no physical simulation. I create bodies (and shapes for them) and use my own code to move them, by setting their velocities and positions every frame. I only fetch collision data from the Box2D world.

Is this a good idea? For example, can it cause undefined behaviour from Box2D? Is there a more performance friendly way of dealing with different shape collision detections?

Do better methods exist for this?

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:
Adding physics to a Blueprint actor in UE4 I am trying to create a dice in ue4 and be able to read off what value it gives. I've made a mesh in Blender and created a texture, imported them and created a blueprint actor and added the static mesh to it.

When I start the game the dice just floats in the air and isn't affected by gravity. I have tried just using the static mesh and I can get that to be affected by gravity. However, I need to add scripts to the object so I can give it a random rotation and read its value, so I created a blueprint actor. I've looked online for a way to give this actor physics, nut nothing.

Does anyone know how I can add physics to a blueprint actor?

Also if anyone has any info on giving the actor a random rotation and reading the value of the dice that would be great.

sentences:
Rendering another screen on top of main game screen in fullscreen mode my game runs in fullscreen mode and uses active rendering. The graphics are drawn on the fullscreen window in each game loop:

    public void render() {
    Window w = screen.getFullScreenWindow();
    Graphics2D g = screen.getGraphics();
        renderer.render(g, level, w.getWidth(), w.getHeight());
    g.dispose();
    screen.update();
    }

This is the screen.update() method:

public void update(){
    Window w = device.getFullScreenWindow();
    if(w != null){
        BufferStrategy s = w.getBufferStrategy();
        if(!s.contentsLost()){
            s.show();
        }
    }
}

I want to display another screen on my main game screen (menu, inventory etc). Lets say I have a JPanel inventory, which has a grid of inventory cells (manually drawn) and some Swing components like JPopupMenu. So i tried adding that to my window and repainting it in the game loop, which worked okay most of the time... but sometimes the panel wouldn't get displayed. Blindly moving things around in the inventory worked, but it just didn't display. When i alt-tabbed out and back again, it displayed properly.

I also tried drawing the rest of the inventory on my full screen window and using a JPanel to display only the buttons and popupmenus. The inventory displayed properly, but the Swing components keep flickering. I'm guessing this is because I don't know how to combine active and passive rendering.

    public void render() {
        Graphics2D g = screen.getGraphics();
        invManager.render(g);
    g.dispose();
    screen.update();
    invPanel.repaint();
    }

Should i use something else instead of a JPanel? I don't really need active rendering for these screens, but I don't understand why they sometimes just don't display. Or maybe I should just make my own custom components instead of using Swing? I also read somewhere that using multiple panels/frames in a game is bad practice so should I draw everything on one window/frame/panel?

If I CAN use JPanels for this, should I add and remove them every time the inventory is toggled? Or just change their visibility?

sentences:
Find extreme points of a rotated ellipse function on a given axis How to find the points where it is most extreme on the X and Y axis?

For example lets say I have an equation that describes an ellipse that is rotated:

(x * RadiusX * Rx + y * RadiusX * Ux)^2 +
(x * RadiusY * Ry + y * RadiusY * Uy)^2 = RadiusY^2

How can I find the points where it will be most extreme on each axis

Please keep in mind the values for variables RadiusX, RadiusY, Rx, Ry, Ux, Uy are known.

An example with values:

((x * 1 * 0.70711) + (y * 1 * -0.70711))^2 +
((x * 1.414213 * -0.70711) + (y * 1.414213* -0.70711))^2 = 1.414213 * 1.414213

sentences:
How do I fill a region in Roblox? I try this:

workspace.Terrain:FillRegion(Region3.new(Vector3.new(2048, -256, 2048), Vector3.new(-2048, -512, -2048)):ExpandToGrid(4), 4, Enum.Material.Basalt)

I get the error Region cannot be empty. What gives? Of course the region is empty, I am trying to change that. Is :FillRegion() broken?

sentences:
Cardboard VR Mode rendering black in Unity I've searched around and seen this problem is quite common, but none of the fixes I've read have resolved the issue: If VR Mode is enabled in the GvrViewerMain prefab, the scene will render as just a black screen.

I've set the Graphics API to OpenGLES2, I've disabled Multithreaded Rendering, I've disabled direct render, yet this continues to be an issue.

This happens both within unity itself and if it is built and run to my phone. Has anybody encountered this problem/do you know of any further steps to take to resolve the issue?

sentences:
How to detect when the mouse is over a particular enemy collider, without falsely selecting bullet colliders? I have an enemy shooting around. My game mechanic involves hovering over the enemy with the mouse to drain its health. While the enemy is moving, you need to follow it with your mouse. If you don't succeed to follow it and the mouse leaves the enemy's collider, the enemy's health should be refilled.

The trouble is that the enemies' bullets have also a collider, and OnMouseOver acts weird when more colliders appear on top of each other.

How can I only select a particular Layer for the enemy to detect only that layer without acknowledging the bullets layer?

My Code so far:

public class FightDarkalls : MonoBehaviour
{

    [Header("Guidance Light On?")]
    public bool _guidanceLight = false;
    [Header("Target Settings")]
    public GameObject _monster;
    public GameObject _targetEffect;
    public Animator _TargetEffectAnim;
    public LayerMask _monsterLayer;
    int _layer;
    [Space]
    [Header("Damage Darkall")]
    public float damage = 0.1f;
    public float damageSpeed = 2.5f;
    [Header("OBJs to deactivate when Darkall dead")]
    public GameObject[] _deactivateOBJsOnDeath;
    [Header("Health Settings")]
    public GameObject _healthBar;
    public float startingHealth;
    public float health;
    public GameObject _deathDarkallParticle;
    //Animator
    private Animator _anim;

    Vector2 mousePosition;
    public LayerMask _interactLayer;

    private void Start()
    {
        _targetEffect.SetActive(false);
        _anim = GetComponent<Animator>();
        _TargetEffectAnim = _targetEffect.GetComponent<Animator>();
    }

    private void Update()
    {
        CheckIfGuidanceIsActive();

        _healthBar.transform.localScale = new Vector2(health, 1f);

        _deathDarkallParticle.transform.position = Vector2.Lerp(_deathDarkallParticle.transform.position, _monster.transform.position, 100f * Time.deltaTime);

        SetMousePosition();
    }

    void CheckIfGuidanceIsActive()
    {
        if (GameObject.Find("_GuidanceLight").GetComponent<FollowCursor>   ()._guidanceActivated == true)
        {
            _guidanceLight = true;
        }
        else
            _guidanceLight = false;
    }

    private void OnDrawGizmos()
    {
        Gizmos.DrawSphere(mousePosition, 1f);
    }

    private void OnMouseOver()
    {
        if (_guidanceLight)
        {
            //[DAMAGE]\\
            health -= damage * Time.deltaTime * damageSpeed;
            _anim.SetBool("TakeDamage", true);
            //Activate Target Effect
            _targetEffect.SetActive(true);
            _TargetEffectAnim.SetBool("OnDarkallOver", true);
            //Damage the target
            //Kills the target
            if (health <= 0f)
            {
                foreach (GameObject _dOBJs in _deactivateOBJsOnDeath)
                {
                    _dOBJs.GetComponent<SpriteRenderer>().enabled = false;
                }
                //Change Cam Shake to another OBJ
                GameObject.Find("Main Camera").GetComponent<CameraShake>().CamShakeEffect(0.1f, 0.5f);
                health = 0f;
                _deathDarkallParticle.SetActive(true);
                _deathDarkallParticle.GetComponent<ParticleSystem>().Play();
                _monster.gameObject.SetActive(false);
                Destroy(_monster.gameObject, 3f);
            }
        }
    }
    private void OnMouseExit()
    {
        _anim.SetBool("TakeDamage", false);
        //If failed to kill, reset health
        health = startingHealth;
        //Deactivate Target
        _targetEffect.SetActive(false);
        _TargetEffectAnim.SetBool("OnDarkallOver", false);
    }

    void SetMousePosition()
    {
        mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
    }
}

sentences:
Retro-game development - how did 8-bit computers store large level maps and build a screen from them? Not sure whether this would be better in the retro-computing exchange, but I'm trying in game development first.
During the 80s I played a lot of what would now be called "arcade adventures" on the BBC Micro; games like Citadel, Camelot, Jet Set Willy, etc.
Jet Set Willy could support 64 rooms, Citadel had over 100.

Presumably, some form of encoding was used to compress the maps to fit in the limited storage space that these machines had, but does anyone have any information on how these games actually managed to cram screen layout and object types and locations into this limited space, then decode these into a tilemap and game objects?

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:
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:
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:
WinAPI window taking 50% of CPU when idle I'm currently working on a game that creates a window using WindowsAPI.  However, at the moment the process is taking up 50% of my CPU.  All I am doing is creating the window and looping using the code found below:

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
    MSG message = {0};
    WNDCLASSEX wcl = {0};

    wcl.cbSize = sizeof(wcl);
    wcl.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
    wcl.lpfnWndProc = WindowProc;
    wcl.cbClsExtra = 0;
    wcl.cbWndExtra = 0;
    wcl.hInstance = hInstance = hInstance;
    wcl.hIcon = LoadIcon(0, IDI_APPLICATION);
    wcl.hCursor = LoadCursor(0, IDC_ARROW);
    wcl.hbrBackground = 0;
    wcl.lpszMenuName = 0;
    wcl.lpszClassName = "GL2WindowClass";
    wcl.hIconSm = 0;

    if (!RegisterClassEx(&wcl))
        return 0;

    hWnd = CreateAppWindow(wcl, "Application");

    if (hWnd)
    {
        if (Init())
        {
            ShowWindow(hWnd, nShowCmd);
            UpdateWindow(hWnd);

            while (true)
            {
                while (PeekMessage(&message, 0, 0, 0, PM_REMOVE))
                {
                    if (message.message == WM_QUIT)
                        break;

                    TranslateMessage(&message);
                    DispatchMessage(&message);
                }

                if (message.message == WM_QUIT)
                    break;

               if (hasFocus)
            {
                elapsedTime = GetElapsedTimeInSeconds();
                lastEarth += elapsedTime;
                lastUpdate += elapsedTime;
                lastFrame += elapsedTime;
                lastParticle += elapsedTime;

                if(lastUpdate >= (1.0f / 100.0f))
                {
                    Update(lastUpdate);
                    lastUpdate = 0;
                }
                if(lastFrame >= (1.0f / 60.0f))
                {
                    UpdateFrameRate(lastFrame);
                    lastFrame = 0;
                    Render();
                    SwapBuffers(hDC);
                }
                if(lastEarth >= (1.0f / 10.0f))
                {
                    UpdateEarthAnimation();
                    lastEarth = 0;
                }
                if(lastParticle >= (1.0f / 30.0f))
                {
                    particleManager->rightBooster->Update();
                    particleManager->rightBoosterSmoke->Update();
                    particleManager->leftBooster->Update();
                    particleManager->leftBoosterSmoke->Update();

                    particleManager->breakUp->Update();
                    lastParticle = 0;
                }
            }
            else
            {
                WaitMessage();
            }
            }
        }

        Cleanup();
        UnregisterClass(wcl.lpszClassName, hInstance);
    }

    return static_cast<int>(message.wParam);
}

So even when I am not drawing anything when the window has focus it still takes up 50%.  I don't understand how this is taking up so much system resources.

Am I doing something wrong?

Any help would be much appreciated, thank you!

sentences:
Continuous running vs timed tasks? I've started making a browser-based game, as a hobby, where users log in via a website and can manage a soccer team. I need to have some sort of process running to handle player development, running matches, age players, generally progressing time..

I've never done anything like this before and therefore I'm putting this out there to get some feedback from other people.

So, my idea was that I could have a continuously running application which can handle all the "off-line" processing. But, that got me thinking that another approach could be to have, f.ex. a "PlayerTrainingTask" running daily, a "RunMatchesTask", running on a fixture-based schedule, et.c.

Which approach is most appropriate? or is there another option I haven't thought of?

What are your thoughts?

sentences: Unity store data in database Is it possible to store assets used in a Unity game (2D or 3D) in the database? I think it is less efficient but want to have single source of truth and maybe have the game contact the database everytime it loads to get the new updates.

sentences:
How to raycast against a physx cloth mesh? I'm using the PhysX 3.3 SDK in a application and mostly everything is working fine. However, I'm trying to develop a feature that would allow users to click on various actors in the scene and modify their properties.

My approach so far has been to use the PhysX raycast to query the scene and use RaycastHit to return a pointer to the actor. This works fine for rigid bodies, but for cloth actors, the hit is invariably null.

This suggests that PhysX can't raycast against cloth objects, but other than my tests, I haven't seen anything in the docs (or on the interwebs) that say this definitively.

Any thoughts?

sentences: How can i use A star pathfinding algorithm How would i implement an A star algorithm for a game that i'm making on the android in java? i'm looking for a pre-made A star API in java with classes and methods to call. i don't want to have to code from scratch.

sentences:
Occasionally nothing renders until the game window is resized - how to fix? So, I'm making a game in Java, I'm using the BufferStrategy and Graphics class to render onto the screen.

But sometimes, when I run the game nothing is rendered onto the screen. But as soon as I resize the window, everything gets rendered fine.

At first I thought it had something to do with the BufferStrategy and graphics class, but when I printed those classes in the console after the initialization, they have the same values when the game is rendering fine and when the bug occurs.

I'm confused, is there a fix for this without altering a lot of code?

I'm creating my BufferStrategy as :

canvas.createBufferStrategy(3);

bs = canvas.getBufferStrategy();
g = bs.getDrawGraphics();

I'm not sure if the bug is occuring there though...

sentences: How to make something happen every N seconds in game? I want to have something happen every N seconds, how would I do that? Maybe use a timer but how?

sentences:
Parallel Storylines - Underused Francise Characters One Hero Rule: Video games have only one protagonist. Example: in an rpg, party members are not seen in a field map, or they just follow you. Their role is "cannon fodder" tier, meaning who the hell cares if it dies. I never added it to my party anyway, following the min max gamefaq guide telling me to remove all its equipment beforehand. You end up with a video game that has only a single actor that plays 1000 tropes, in real life each person plays ~5 tropes at most. This is a bug caused by a single protagonist rule, i want to eliminate this rule through smart game design.

The problem is, in movies you can depict unlimited different characters and the story continuity never breaks, but in a video game leads to loss of context, can it be done?
conclusion: video games are an inferior mean of screenplay.

In Suikoden / Breath of fire 4, each chapter is devoted to a specific protagonist view, this is nice concept however it can get ankward...

Loss of context:
You would end up progressing their individual character storylines a little bit, but since you "switched context" to another protagonist, you lost track of what the other protagonist did, you no longer remember the progression of the story. This will never work... Especially if switch happens very frequently and the battles last too long.

Game Balance: Extra party members do not add to battle effectiveness:
in suikoden by endgame you have 200 party members but they are irrelevant since random encounters use only 4 party members. It is better to keep the same cast throughout the game and become overleveled than spread xp to never used party members.

Android "Pimp your money" games fixes this by adding a 30 min cooldown to each party member. This is nice, but they don't have story... Also this mechanic enforces a "play everyone a little bit", disables free choice of which party member to pick, amplifying your loss of context.

Why i want this? imagine a game like kingdom hearts where each party member gets its own storyline.

Questions:

1) Need Story-Telling Methods that avoid loss of context.

2) Need Battle Game Balance Rules.

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:
C# Top down movement limitation I'm using C# and Visual Studios 2010 with XNA 4.0+lua, and my teacher has asked us to make a 2D RPG game similar to zelda(top down). I was aiming to use just one image for each map region, instead of using the tile approach, however i'm stuck on the aspect of movement limitation.

My teacher mentioned being able to mask another image on top of the map's current image, using only back and white colors and using those to be able control where the avatar can move(move where black is and restrict movement where white is). He did not, however, instruct us on how to do this, and I have been unable to find any tutorials anywhere.

I'm fairly new to C# in general, so if anyone can point me in the direction of a tutorial that could help me accomplish this, or add their own advice I would really, greatly appreciate it.

sentences:
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:
Bouncing off edge in libGDX doesn't work after resizing window I have a game in which the enemy has to bounce of the edge, when it hits it. It is working fine, normally, but when I resize the window, the bouncing breaks. It doesn't bounce properly.

In the image, the red enemy is not in the screen. How would I make it bounce off properly even after resizing the window?

Here is my BasicEnemy code:

public class BasicEnemy extends Enemy {

    public BasicEnemy(Player player, float x, float y) {

        super(player, new TextureRegion(), x, y, 5, 5);
        width = 16;
        height = 16;
    }

    @Override
    public void tick(float dt) {

        wrapPos();
        if (touchesPlayer())
            player.setHealth(player.getHealth() - 1);

        x += velX;
        y += velY;
    }

    @Override
    public void render(SpriteBatch batch, ShapeRenderer renderer) {

        renderer.setColor(Color.RED);
        renderer.rect(x - width/2, y-height/2, width, height);
    }
}

Here is my Enemy code:

public abstract class Enemy extends Entity {

    protected Player player;

    public Enemy(Player player, TextureRegion region, float x, float y,
        float velX, float velY) {

        super(region, x, y, velX, velY);
        this.player = player;
    }

    @Override
    protected void wrapPos() {

        if (x > Gdx.graphics.getWidth() - width /2 || x < width/2) {

            //Here we flip the speed, so it bounces the other way.
            velX = -velX;
        }

        //Same as above, but with on the y-axis.
        if (y > Gdx.graphics.getHeight() -height/2 || y < height/2) {

            velY = -velY;
        }
    }

    protected boolean touchesPlayer() {

        return getBoundingBox().overlaps(player.getBoundingBox());
    }
}

sentences:
glfw resizing causing image scaling I have a quad rendered that extends from the top left of the window to with width of the window that is also 64 pixels high. When I resize the window, from its initial size, the quad and text scales proportionately bigger or smaller in the same say Photoshop can scale a image. What I'm seeking on a basic level is that regardless of how I resize the window, everything drawn remains the same. From the below image, the right side is the initial size and the left side is what happens when I drag the window to be a smaller size. The red bar and text scales with it. This is how Im handling my resizing:
glfwSetWindowSizeCallback(pWindow, WindowSizeCallback); // initialized after context

void WindowSizeCallback(GLFWwindow* window, int width, int height)
{
    glfwSetWindowSize(window, width, height);
}

sentences:
Stacking Drawing Matrix for SpriteBatch in XNA I'm trying to make a 2D engine for XNA with SpriteBatch. My object unit is Entity, which can include other Entities as its children. However, when drawing them, the rotation and scaling stacking do not work well.

Here is my Entity code:

    protected virtual void PreDraw(Engine pEngine)
    {
        pEngine.PushMatrix();

        { // Transform Matrix
            // Translate
            pEngine.DrawingMatrix *= Matrix.CreateTranslation(this.X, this.Y, 0);

            { // Scale
                float translateX = this.ScaleCenterY + this.X;
                float translateY = this.ScaleCenterX + this.Y;

                pEngine.DrawingMatrix *= Matrix.CreateTranslation(-translateX, -translateY, 0);
                pEngine.DrawingMatrix *= Matrix.CreateScale(this.ScaleX, this.ScaleY, 0);
                pEngine.DrawingMatrix *= Matrix.CreateTranslation(translateX, translateY, 0);
            }

            { // Rotation
                float translateX = this.RotationCenterX + this.X;
                float translateY = this.RotationCenterY + this.Y;

                pEngine.DrawingMatrix *= Matrix.CreateTranslation(-translateX, -translateY, 0);
                pEngine.DrawingMatrix *= Matrix.CreateRotationZ(MathHelper.ToRadians(this.Rotation));
                pEngine.DrawingMatrix *= Matrix.CreateTranslation(translateX, translateY, 0);
            }
        }

    }

    protected virtual void Draw(Engine pEngine) { }

    protected virtual void PostDraw(Engine pEngine)
    {
        pEngine.PopMatrix();
    }

I will implement some primitive entities by overridding Draw method. Here is my Drawing call, and the Draw implementation for Rectangle, and the StartDrawing in the Engine:

Managed Draw call every drawing:

    public void ManagedDraw(Engine pEngine)
    {
        if (!this.Visible) return;

        { // Perform Drawing
            this.PreDraw(pEngine);

            int childIndex = 0;

            // Underlay Children
            while (childIndex < this.Children.Count && this.Children[childIndex].Z < 0)
            {
                this.Children[childIndex].ManagedDraw(pEngine);
                childIndex++;
            }

            // Draw Self
            this.Draw(pEngine);

            // Overlay Children
            for (; childIndex < this.Children.Count; childIndex++)
            {
                this.Children[childIndex].ManagedDraw(pEngine);
            }

            this.PostDraw(pEngine);
        }

    }

** Draw implementation of Rectable**:

    protected override void Draw(Engine pEngine)
    {
        pEngine.StartDrawing();
        pEngine.SpriteBatch.Draw(pEngine.RectangleTexture, new Rectangle(0, 0, (int)this.Width, (int)this.Height), new Rectangle(0, 0, 1, 1), this.Color);
        pEngine.StopDrawing();
    }

Start Drawing of Engine:

    public void StartDrawing()
    {
        this.SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, null, null, this.DrawingMatrix);
    }

Here is one example of my failure, where the parent has Rotation of 30, while the children has none, but it should be in the center of the parent (red) rectangle:

Please give me the problem with above Drawing Matrix. What should I do to achieve the stacking?

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:
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:
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:
Moving camera in large view In my cocos2d app I was wondering how to make a CCSprite move on the screen but have the screen focused on the CCSprite, so when the sprite moves the view moves with the CCSprite. Is there a tutorial to do this?

Thanks

sentences:
Network game like MMO - TPC or UDP I saw this subject several times, however I will wish better understand.

I am working on the development of a 2d game like a little MMO. (Currently I only do  research). I see people who says it's easier to use TCP for all the game. But is it really viable ?

In my mind, what I would have made is to use UDP in multicast. What about this solution ?

Thank 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 to detect line break in a String using UnityScript? Code:

var i:int=0;
var text:String;
var compare:String="";
var isFound:boolean=false;
function Start(){
text=AssetDatabase.LoadAssetAtPath("Assets/words.txt",TextAsset).text;
}

function Update(){
    if(!found)
   com("textToSearch");
  }

 function com(s:String){
    if(i<text.Length){
    comText=comText+text[i];
    if(//condition for line break)
    if(comText==s){
       print("found");
       found=true;
    }
   else{
         comText="";
      }
   i++;
   }

 }

In the text document each word ends with a line break. So if I just found a condition for a line break then I can easily search through the document.

sentences:
How can I test different TV display types for my XBLIG game? The XBLIG submission check-list asks to ensure all gameplay-critical graphics be visible in the 'TitleSafeArea'.

I've received a bug report during play-testing that says parts of my scrolling 2D map are only half-visible (chopped off from the left of the screen).

I've tested the game on a 47" TV and a 19" VGA monitor and both look fine. However, the bug report says the issue occurs on a standard 20" TV.

How can I test different sizes without buying differently sized TVs?

sentences: What happens in pre production of a game? I see a lot of games in "pre-production" and was just wondering what actually happens in this stage. Is it just planning or does a prototype get made or what?

sentences:
Calculate Relative Mouse Movements Regardless of position Context

I'm working on making a variant of the atari game Breakaway IV and I'm trying to improve my mouse input handling.

I use the input of a mouse's motion left and right to move the bumper.

public void mouseLocationChanged(Point mouseLocation) {
    if (lastMouseLocation == null) {
        lastMouseLocation = mouseLocation;
        return;
    }
    bumperStep = (int) ((mouseLocation.x - lastMouseLocation.x) * SENSITIVITY_MULTIPLIER);
    lastMouseLocation = mouseLocation;
}

Then in the update method of my game I check if there is a bumper movement queued up.

 public void update() {
    if (inputHandler.isBumperMove()) {
        submitBumperMove(inputHandler.getBumperMove());
    }
    ...
}

If there is, I move the bumper with the below code.

public void submitBumperMove(int move) {
    if (move < -1 * BUMPER_SPEED_LIMIT) {
        move = -1 * BUMPER_SPEED_LIMIT;
    } else if (move > BUMPER_SPEED_LIMIT) {
        move = BUMPER_SPEED_LIMIT;
    }

    testPoint.x = bumper.x + move;
    testPoint.y = bumper.y;

    while (testPoint.x != bumper.x) {
        if (!willCollideWithWall(bumper, testPoint)) {
            bumper.x = bumper.x + move;
            if (bumper.hasBall){
                ball.x = ball.x + move;
            }
        } else {
            move = shrinkStep(move);
            testPoint.x = bumper.x + move;
        }
    }
}

Observed bugs

I don't reset bumperStep with the call to getBumperMove() so the cursor drifts if there isn't a different input to set bumperStep to 0. This mainly happens when the mouse exits the window.
When resetting bumperStep to 0 with getBumperMove() (making it consumeBumperMove()) the mouse can run out of the window before the bumper reaches the edge of the game and the bumper can't be moved to the edge.

Proposed Solution

I was considering resetting the mouse cursor in the center of my window (with the cursor invisible) while the game is in "play" mode with each game update. This would prevent the problem of the mouse leaving the screen and not working while still allowing me to consume the movements which will stop the drifting bumper I'm observing.

Questions(finally ;-) )

Is there a better approach to getting mouse left and right movements from any position in java, or should I stick with just keeping the cursor where I want it?
If locking the cursor is the way to go, how can I pragmatically set the mouse position in Java? I've heard about a Robot class that is supposed to help, but it looked like an application needs special signing/permission to use that.

sentences:
Online service and/or application to develop a story line for an adventure game My friends and I were talking about an adventure game. There will be a surplus of possibilities in the game and the player can pick from this wide variety of choices at each stage to do something. There will be consequences for each decision and that may or may not end the story.

The result would be somthing like this:

(picture from flashforward series S01E17)

If any of you watched heroes season 1 there is also similar time lines represented as strings in isaac mandez workshop. Sorry for bad quality examples but right now I can't think of any better one.

Do you know any website or application which we can use to create the timeline?

These features are required:

The ability to represent events as boxes.
The ability to connect distant events to each other.
The ability to move events on a scene freely
The ability to expand the scene easily
There should be some color options for the lines representing connections between events
Easily sharing the idea with one another
It's much more better to have a WYSIWYG editor
Easily explore in the large scene of events

In the end if you know any application which could let me create a board just like the one in my sample picture and please share it

sentences:
XNA - Strange Texture Rendering Issue Using XNA BasicEffect I have been reading and working through Riemers 3D XNA tutorials to expand my knowledge of XNA from 2D into 3D. Unfortunately I am having rendering issues that I am unable to solve and I need a point in the right direction.

I am not expecting the Models to look identical to Blender but there is some serious discoloring from the texture files once rendering through XNA. The Character model is using completely incorrect colors (Red where Grey should be) and the Cube is rendering a strange pattern where a flat color should be drawn.

My sampling mode is set to PointClamp.

The Character model that I created has a 32 by 32 pixel texture that has been UV mapped to the model in blender. The model was then exported to .FBX. For the Cube Model a 64 by 64 pixel texture is used.

foreach (ModelMesh mesh in samuraiModel.Meshes)
{
    foreach (BasicEffect effect in mesh.Effects)
    {
        effect.Projection = Projection;
        effect.View = View;
        effect.World = World;
    }
    mesh.Draw();
}

Does this look like it is caused by a mistake I made while UV Mapping or Creating Materials in Blender?
Is this a problem with using the default XNA BasicEffect?
Or something completely different that i have not considered?

Thank You!

sentences:
Approach on how to split game assets into split archives With a custom binary file format for archives that is structured similiar to Valve's VPK files I have a Game.index.gcf which holds information about all files and where exactly they are stored. I can split up and say, that the /Assets/Maps and /Assets/Scripts folders should be stored in Game.000.gcf while the bigger /Assets/Music folder could be split up into Game.001.gcf and Game.002.gcf. This should boost performance but only if done right. Moreover with updates I could say, just update this particular split archive and not the entire archive (when storing everything in one really huge a file).

As of yet, I don't know how to write such an adaptive algorithm which automatically decides the best way to split all archives and files. What aspects should I keep in mind and what should I be aware of when creating these? Do you have any suggestions?

sentences:
How can I add two Vector3 directions together? I have a direction to my target object, which is in a Vector3 format. I want cast a number of rays, as offsets from this initial direction.

X is the object. D is the direction the player needs to travel in. A & C are other directions that I want to cast rays towards to check for impacts.

A    D    C
 \   |   /
  \  |  /
   \ | /
    [x]

I was trying to add an offset, such as Vector3.Right to the Direction and then normalise the result, however this only works if everything is oriented towards World Space.

So how can I convert and add a direction (Vector3.right) as an offset to an existing direction?

I'm fairly sure I just have World Space and Local Space directions mixed up but can't see an easy way to convert between this with Vector3?

sentences:
How to calculate normal vector of a Bézier curve? How I can calculate the normal vector for two dimensional Bézier curve?

(I have the control points of the curve in the x y plane)

sentences: How to call animation event from another GameObject I have an animation event but I want it to call a function from a script that is attached to a different GameObject that I'm not animating. Is this even possible?

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:
How to program a cutting tool for 3D model in game I'm looking for a resource to figure out how to program a function to cut a 3d model in game.

Example: Enemy/NPC is sliced into 2 pieces with a sword. His body is not hollow, you can see bloody texture where normally a 'polygon hole' would be.

The first step is to actually 'cut/slice' the model, then add in polygons to fill the hole in the model. I know this can be done in 3D modelling software, but I'm not sure how to go about doing this in a game, code-wise. I do not wish to use 'pre cut-up" models, the code will determine where the cut is.

Any pointers in the right direction would be greatly appreciated.

sentences: How do I import Motionbuilder animation into my game? I have an animation sequence for a 3D model built in Autodesk Motionbuilder. How would import the data for the sequence into my java game for my model? Is there any tutorial on how to accomplish this? I already have my 3D model loaded into the scene.

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 can I get a straight path using A*? How to change A* work so that the path is more like a straight Euclidean distance? I read that you need to break some nodes, but how to implement this?

I need heuristic like this:

Is such a heuristic possible taking into account some obstacles on the map?

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: 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:
Would landscape left/right make difference when developing Google VR CardBoard Game with Unity? I'm trying to make a simple VR cardboard game using Google VR SDK for Unity. I'm really confused about the problem as my title. Will the values got from

GvrViewer.Instance.HeadPose.Orientation.x;

change when the orientation of smartphone change from Portrait to Landscape Left/Right?

The following code works in Unity demo (after press play button and use alt+right-click to trigger head movement simulation), but I don't have a cardboard so I'm not sure whether it will still work on smartphone with landscape left or right attached to a cardboard.

private void Update()
{
    // forward if the value is positive.
    float forwardValue = GvrViewr.Instance.HeadPose.Orientation.x;
    // turn left if the value is negative.
    float turnValue = GvrViewr.Instance.HeadPose.Orientation.y;
}

private void Move()
{
    Vector3 movement = transform.forward * forwardValue * m_Speed * Time.deltaTime;

    // Apply this movement to the rigidbody's position.
    m_Rigidbody.MovePosition(m_Rigidbody.position + movement);
}

private void Turn()
{

    // Determine the number of degrees to be turned based on the input, speed and time between frames.
    float turn = turnValue * m_TurnSpeed * Time.deltaTime;

    // Make this into a rotation in the y axis.
    Quaternion turnRotation = Quaternion.Euler(0f, turn, 0f);

    // Apply this rotation to the rigidbody's rotation.
    m_Rigidbody.MoveRotation(m_Rigidbody.rotation * turnRotation);
}

sentences:
Rotate sprite direction Cocos2d I want that my sprite go always forward, and you can only control his direction moving right and left (on 360 degrees). I don't know why, but the movement it's senseless.

The constants to move and rotate:

const int POD_DEGRE_MOVE = 5;
const int POD_STEP_MOVE = 3;

The sprite initalization:

_dragonSprite->setPosition(Point(visibleSize.width / 2,_dragonSprite->getContentSize().height * 0.75));
addChild(_dragonSprite, 2);

The event key listener:

void GameScene::onKeyPressed(EventKeyboard::KeyCode keyCode, Event *event){
    _pressedKey = keyCode;

    switch (_pressedKey) {

    case EventKeyboard::KeyCode::KEY_LEFT_ARROW:
        giro = -POD_DEGRE_MOVE;
        _isMoving = true;
        break;
    case EventKeyboard::KeyCode::KEY_RIGHT_ARROW:
        giro = POD_DEGRE_MOVE;
        _isMoving = true;
        break;

    }

}
    void GameScene::onKeyReleased(EventKeyboard::KeyCode keyCode, Event *event){
        if (_pressedKey == keyCode) {
            _pressedKey = EventKeyboard::KeyCode::KEY_NONE;
            _isMoving = false;
            giro = 0;
        }
    }

And the calculations of the new direction:

void GameScene::update(float dt) {

    _dragonSprite->setRotation(_dragonSprite->getRotation() + giro);
    _podVector = Vec2(cos(_dragonSprite->getRotation()) * POD_STEP_MOVE, sin(_dragonSprite->getRotation()) * POD_STEP_MOVE);
    Vec2 newPos = Vec2(_dragonSprite->getPosition().x + _podVector.x, _dragonSprite->getPosition().y + _podVector.y);

_dragonSprite->setPosition(newPos);
}

Another problem is that the sprite at the start moves to the right (because Cos(0)==1), so I rotate the image of the sprite 90 degrees to the right, to then rotate it again at the initialization 90 to the left so the sprite is in the right position and his start angle is 90 (sin(90)==1), but the angle is not 90, and it moves as he wishes.

The last problem I have with this is that when I press a key (right or left), the sprite stops, rotates, and starts again (a direction that is not the direction where the sprite is aiming, that's the main problem). The sprite shouldn't stop while you are moving it.

Can anyone help me?

sentences:
Map individual images to the surface of a sphere I know this is a FAQ but I don't know the terms to search on. I even saw something like this with a blue globe, but now I can't find it any more!

I'm trying to make a UV map to apply to a sphere (in SceneKit, so one big image).

The map is made up of multiple photos taken with the camera pointed in different directions. You could imagine taking a series of polaroids, putting a dot of glue in the center of each one, and then sticking it to the outside of a basketball. Compare and contrast with using paper mache, which would plaster the surface smoothly - in this case it's all bumps and gaps, but that's what I want.

It's easy enough to composite each image into a single 2D map. However, when you apply that to the sphere, all the formerly linear edges end up convex - barrel distortion. I need to transform each one (to be concave) before I composite them, so that when they are applied to the sphere they return to being rectangles as seen from the center.

So... assuming I have a collection of images, the FOV angle of the camera, and the alt/az orientation when they were taken, what's the trick for mapping them into a proper UV texture to recreate the "bumpy ball" with nice linear edges?

sentences:
What data-type should I use for in-game currency? In a simple business simulation game (built in Java + Slick2D), should a player's current amount of money be stored as a float or an int, or something else?

In my use-case, most transactions will use cents ($0.50, $1.20, etc.), and simple interest rate calculations will be involved.

I've seen people saying you should never use float for currency, as well as people saying you should never use int for currency. I feel like I should use int and round any necessary percentage calculations. What should I use?

sentences:
Why not use vectors to represent orientation? From what I've read, people mostly use either quaternions or 3x3 matrices to represent 3D orientations, while plain vectors are used for angular velocity/momentum.
Since we can use vectors to represent angular velocities, why can't we also use vectors to represent orientations? Are there any specific reasons or is it simply less convenient?

EDIT: Just to clarify, I mean using a 3D vector to represent a rotation around an arbitrary axis, with the magnitude being the rotation.

sentences: How to set LOD specifications for all meshes in unreal at once? I have a large model and want to avoid separately setting the LOD specifications for each component in the model. Is there are way set LOD specifications for all meshes in unreal at once since I want to set the same specifications for each one? (percentages, how many LOD's, and at what screen distance they kick in, using Unreal's autogenerated LOD's).

sentences:
Help with open and close UI Menu on background mouse click I am trying to make a point and click game in unity 5.2.2.

My problem is that I need to have a UI menu to open, when the player clicks with the left mouse button on the background sprite, and it should close again, when he click on it again. I have created a script, and so far it works like that, but It also closes, when I click on the menu buttons itself, which means that I can't use the menu which opens. Please help me to how I can achive that.

The way the menu should work, is like in the game Game Dev Tycoon, where the player can open and close the menu, when clicking on the game background.

Here is my script, in its current form.

using UnityEngine;
using System.Collections;
/// <summary>
/// This is the main class, for the entire game. The purpose of this class, is to control any gameplay in the game.
/// </summary>
public class GameManagerScript : MonoBehaviour {

public GameObject gameUI;                                           //The actual Game UI

    public void Awake()
    {
        gameUI.SetActive(false);
    }

    // Game Manager Game Loop
    public void Update()
    {
        CheckForKeyInput();
    }

    void CheckForKeyInput()
    {
        //Mouse0 = First mouse button
        if (Input.GetKeyDown(KeyCode.Mouse0))
        {
            Debug.Log("Mouse0 button fired!");
            gameUI.SetActive(!gameUI.activeSelf);
        }
        //If escape, exit the game
        else if (Input.GetKeyDown(KeyCode.Escape))
        {
            Debug.Log("Application has been exited");
            Application.Quit();
        }
    }
}

sentences:
Loading custom shader in Monogame I have been trying to load this custom FX file into a Monogame project, and everything I try fails.  (code taken from http://www.david-gouveia.com/scrolling-textures-with-zoom-and-rotation/)

sampler TextureSampler : register(s0);
float2 ViewportSize;
float4x4 ScrollMatrix;

void SpriteVertexShader(inout float4 color : COLOR0, inout float2 texCoord : TEXCOORD0, inout float4 position : POSITION0)
{
   position.xy -= 0.5;

   position.xy = position.xy / ViewportSize;
   position.xy *= float2(2, -2);
   position.xy -= float2(1, -1);

   texCoord = mul(float4(texCoord.xy, 0, 1), ScrollMatrix).xy;
}

technique SpriteBatch
{
    pass
    {
        VertexShader = compile vs_2_0 SpriteVertexShader();
    }
}

If I convert it to an XNB file, and attempt to load it via the Content processor, it says "Could not load asset!", indicating that the file cannot be found.  The XNB file is there along with the rest of the content, it is just not being loaded.

Next, I compiled the FX files into a MGFX file using 2MGFX.  I included the MGFX files as an embedded resource and attempted to load the file by doing:

Effect test = new Effect(GraphicsDevice, Properties.Resources.parallax);

This crashed at Effect.cs saying argument out of range error.

What do I need to do to use this shader in Monogame?

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

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

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

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

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

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

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

Thnx
Matt

sentences:
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:
Generate 4 vectors rotated in cardinal directions from a central vector There is some unit vector, which is a coordinate in a spherical space. It is necessary to obtain from it 4 vectors diverted in different directions (right, left, forward, backward) by a certain number of degrees. For these actions I use the following code:

Vector3 center = point;
Vector3 left = Quaternion.Euler(-30, 0, 0) * center;
Vector3 right = Quaternion.Euler(30, 0, 0) * center;
Vector3 back = Quaternion.Euler(0, 0, -30) * center;
Vector3 front = Quaternion.Euler(0, 0, 30) * center;

The problem is that this works when point is equal or close to Vector3.up. When deviating from the vertical position, the lateral vectors begin to "stick together".

Here is a visualization of what I need:

Test code is attached:

using System.Collections;
using UnityEngine;

public class Test : MonoBehaviour
{
    public GameObject centerGO;
    public GameObject leftGO;
    public GameObject rightGO;
    public GameObject backGO;
    public GameObject frontGO;

    ArrayList list = new ArrayList();

    void Start()
    {
        SetCenterPoint(Vector3.up);
    }

    void Update()
    {
        DrawDebugRays();

        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit))
        {
            SetCenterPoint(hit.point);
        }
    }

    void SetCenterPoint(Vector3 point)
    {
        Vector3 center = point;
        Vector3 left = Quaternion.Euler(-30, 0, 0) * center;
        Vector3 right = Quaternion.Euler(30, 0, 0) * center;
        Vector3 back = Quaternion.Euler(0, 0, -30) * center;
        Vector3 front = Quaternion.Euler(0, 0, 30) * center;

        centerGO.transform.position = center;
        leftGO.transform.position = left;
        rightGO.transform.position = right;
        backGO.transform.position = back;
        frontGO.transform.position = front;

        list.Clear();
        list.Add(center);
        list.Add(left);
        list.Add(right);
        list.Add(front);
        list.Add(back);
    }

    void DrawDebugRays()
    {
        for (int i = 0; i < list.Count; i++)
        {
            Color color = Color.red;
            switch (i)
            {
                case 0:
                    color = Color.green;
                    break;
                case 1:
                case 2:
                    color = Color.blue;
                    break;
            }
            Debug.DrawRay(Vector3.zero, (Vector3)list[i], color);
        }
    }
}

sentences:
OpenGL multiple viewports with 3d-2d viewing I am trying to draw two viewports, the one on top having a 3D stuff into it, and the other at bottom with a 2D stuff fed into it. However, whatever 2D stuff i draw in the bottom viewport is not rendered to the screen. Below is the piece of my code.

    void display() {

    //first viewport of height h/8
    glViewport(0, 0, width, height / 8);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    /*glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();*/
    gluOrtho2D(-2.0, 2.0, -2.0, 2.0);
    glClear(GL_COLOR_BUFFER_BIT);
    glColor3f(0.0f, 1.0f, 1.0f);
    glRectf(-1.0, 1.0, 1.0, -1.0);
    glFlush();

    //second viewport of height 7h/8
    glViewport(0, 2*height / 8, width, 7 * (height / 8));
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    aspect = (double)8 * width / ((double)height * 7);
    gluPerspective(fieldofview, aspect, nearPlane, farPlane);
    // setup viewing matrix
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    gluLookAt(0.0f, 20.0f, 10.0f,
        0.0f, 0.0f, 0.0f,
        0.0f, 0.0f, 1.0f);

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glPushMatrix();
    draw_model(objs[0]); // draw the plane
    draw_model(objs[1]); // draw the first diamond
    glPopMatrix();

    glPushMatrix();
    glRotatef(angle, 0.0f, 0.0f, 1.0f);
    glTranslatef(moving_position.x, moving_position.y, moving_position.z);
    draw_model(objs[2]); // draw the second diamond
    glPopMatrix();
    glutSwapBuffers();
    move(8);
    // set up menus
}

void reshape(int x, int y) {
    width = x;
    height = y;
    if (height == 0)        // not divided by zero
        height = 1;
}

void main(int argc, char* argv[]) {
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
    glutInitWindowPosition(position_x, position_y);
    glutInitWindowSize(width, height);
    winId = glutCreateWindow("Mesh Viewer");
    glutReshapeFunc(reshape);
    glutDisplayFunc(display);       // display function
    init();
    glutMainLoop();
}

Below is my output, with no rectangle in 1st viewport:

Moreover, can I apply some background color to the second viewport without using the glScissor?

sentences:
Storing huge 2D tiled map in a txt file I'm working on a global startegy game that uses a 2D tiled map. The map is to be 8000x8000 tiles large (this size is fixed, the map stays the way it is throughout the game), since I'm covering a large real-world area, but have to do so in detail. I want to store this map in a txt file. To do so I want to use simple IDs for the tiles, but that still leaves me with 2 bytes per tile and a total of about 185 Mb for my txt file, which is far too large.
So I went ahead and thought of ways to reduce the size of the file that contains the map. This is what I came up with:
Instead of stupidly defining an ID per field, I define regions, lines and specific fields:

region: a rectangle of any size (requires 23 bytes, regardless of its size)

line: a straight line of any length in any simple compass-direction (north, west, east, south) (requires 20 bytes, regardless of its length)

specific field: a specific single field (requires 13 bytes, due to the coordinates that have to be given)

using these three simple "objects" I managed to reduce the size of the file significantly. I may want to add that fields that have already been defined can be overwritten. Take the following rectangle for example:

1 1 1 1 2

1 1 1 1 2

2 2 2 2 2

This could be defined as a 5x3 rectangle of 2s with a 4x2 rectangle of 1s overwriting part of it (total of 46 bytes, as opposed to 195 bytes when defining every field specifically)

The problem I have now is the following:
I'm trying to write a map-editor to simplify the process of making such a map. Obviously this editor should automatically generate the map-file, using the previously described objects to reduce the size. The question is, how do I go about writing such an algorithm, meaning one that finds optimal or near-optimal combinations of regions, lines and specific fields, possibly without taking 3 hours to do so? The algorithm that qucikly came to mind was your typical straightforward approach of going through all possible rectangles, picking out those that work best, then going through the undefined fields and defining lines and then specifying the rest specifically, but as you can probably tell, this approach takes a lot of time, so I'd rather avoid it. I had the idea of splitting the large map into smaller parts, but in the process the algorithm loses some of its precision, as this would eliminate rectangles and lines that cross over two or more of these smaller parts.

So, does anyone perhaps have an idea how to optimize the algorithm, or maybe even a better approach? I'd be very grateful for some help here, since I can't quite go on writing the game without the map in place...

I realise this is a lot of text and perhaps an even bigger problem, but anyways

Thanks in advance,

LegionaryCohort

sentences:
SRTM data represented in 3D using Unity Terrain I am new to using Terrain height maps in Unity.

I'm trying to use real-world terrain height data, using sources including:

The US Geological Survey (files like N24E054.hgt)
Google Maps (SRTM hdr files, tfw files, and tif files)

I want to import this high definition terrain data into a Unity terrain.

In Unity, it seems like terrain can only import Raw data representation.

How can I use an hgt file to shape a Unity Terrain?

sentences:
Bullet Physics Simulation Running Slow I'm in the process of converting my game engine from java which used the LWJGL and JBullet to c++. However, when I was implementing Bullet physics my simple simulation of a box dropping from specified height onto a plane ran very slowly.

After scouring the forms I came across two possible solutions:

Compiling my simulation in release mode rather than debug.
Enabling compiler optimizations for speed.

After building in release and enabling the compiler optimizations my simulation still runs at the same speed. I've tested the FPS which usually runs between 400-350fps and that the simulations was stepped each frame. I can't find anyone that has had the same problem as me and I can't understand why JBullet which is a java port of the Bullet Physics Library runs fine on the same PC. Any help would be much appreciated. Thanks!

sentences:
Stars coming out of screen I am pretty new to Graphics Programming. I am currently using OpenGL.
I have got some hands-on in last few days. I have knowledge of Texture Mapping, Cubemap, Multitexturing. But somehow I am not able to bridge the gap between my understanding and actual coding

What I am trying to do is create a demo of a stars coming out of screen. It should look realistic.

Now, my questions are:
1. Is Cubemap capable of doing this?
2. Do I need to write particle engine for this?(Really, don't want to at this stage)
3. This is kinda most needed for me. May I See some code..? In some tutorial / just code would also do.. but i think if its similar to my requirement then only it will Help

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:
How does super.render() call this method? Today I was experimenting with adding different screens with Scene2d in libgdx and while doing so I became confused how super.render() in my render() method from my starter class (MyGdxGame) called render() in my PlayScreen() class. Basically I understand you use super to call methods, fields, invoke a super class constructor etc... however I don't see how my Main class witch extends Game is a subclass/derived class of my PlayScreen class witch simply implements Screen. In short I don't see how those two classes are related so that super.render() in MyGdxGame class can call render() in my PlayScreen class.

Also I looked at the API and Screen implements ScreenAdapter and Game implements ApplicationListener but I still don't see how that connects.

Starter class:

public class MyGdxGame extends Game {
    Game game;

    @Override
    public void create() {
        game = this;
        setScreen(new MainMenu(game));
    }

    @Override
    public void render() {
        super.render();
    }

    public void dispose() {
        super.dispose();
    }

    public void pause() {
        super.pause();
    }
}

PlayScreen class:

public class PlayScreen implements Screen {
    private static Player player;
    SpriteBatch batch;
    GameControls x;
    CollisionManager collisionManager;
    ArrayList<Tree> trees;
    Iterator itr;
    Enemy enemy;
    Animations animation;
    Game game;
    MainMenu mainMenu;

    public PlayScreen(Game game, MainMenu mainMenu) {
        this.game = game;
        this.mainMenu = mainMenu;
    }
// more code ...
}

sentences:
Pen tablet input for FPS So in my FPS camera look code, I have something like this:

window->camera->stepYaw( getMouseDx()*speed ) ; // mouseDx is mouse change since last frame
window->camera->stepPitch( getMouseDy()*speed ) ;

This works fine on a normal mouse. But with pen input, its very very janky and radical.

How should one control an FPS camera from pen tablet input instead of traditional mouse?

sentences:
How to draw things on top of objects drawn in OnRenderObject()? I am using Unity, here is the method in question. So I know this method draws objects after the camera is done rendering the scene. I have not come across a way in Unity to draw these objects in a certain layer, rather than being the last thing to be drawn.

If it all possible, I am looking to do exactly that: have my custom shaped objects not be renderered last. The problem is that it draws over the UI as well as one other thing that it shouldn't draw over (the player). In case anybody ask I have to use custom UI because the game uses Kinect; basically sprites that detect when the player's hand is over them.

Here is a picture of part of my scene and the problem at hand:

In this example the custom object is a simple line (I cannot use Unity's line renderer for separate reasons).

sentences:
Is there a build-in function to count the amount of sprites drawn by SpriteBatch per frame? I'm hoping to find out how many sprites are on the screen at any given time.

In other words, is it possible to find out how many times spriteBatch.Draw();
is called between spriteBatch.Begin(); and spriteBatch.End();?

I'm looking for a build-in function. Although I'm more then happy to write something myself, I'd rather not reinvent the wheel, and maybe I've overlooked something.

sentences:
What does glTranslatef function is translating in this code? I understand translation from mathematics view where we can have a triangle with a certain coordinates. We can translate this triangle by multiplying the coordinates of the triangle (expressed in the form of a matrix) by a translation vector.

In the code below, I could not see what glTranslate () is translating since we havent drawn anything yet. What are we translating? Are we applying the translation to some default objects or something?

         void display(void)
     {
     glClear (GL_COLOR_BUFFER_BIT);
     ///////////////////////////////////////////////////////
     glPushMatrix();
     glTranslatef (-1.0, 0.0, 0.0);
     glRotatef ((GLfloat) shoulder, 0.0, 0.0, 1.0);
     glTranslatef (1.0, 0.0, 0.0);
     glPushMatrix();
     glScalef (2.0, 0.5, 1.0);
     glutWireCube (1.0);
     glPopMatrix();
     ////////////////////////////////////////////////////////
     glTranslatef (1.0, 0.0, 0.0);
     glRotatef ((GLfloat) elbow, 0.0, 0.0, 1.0);
     glTranslatef (1.0, 0.0, 0.0);
     glPushMatrix();
     glScalef (2.0, 0.5, 1.0);
     glutWireCube (1.0);
     glPopMatrix();
     /////////////////////////////////////////////////////////
     glPushMatrix();
     glTranslatef(1.6, 0.22, 0.0);
     glRotatef ((GLfloat) finger, 0.0, 0.0, 1.0);
     glScalef (0.6, 0.1, 0.08);
     glutWireCube (1.0);
     glPopMatrix();
     glPopMatrix();
     ////////////////////////////////////////////////////////
     glutSwapBuffers();
     }

sentences:
OpenGLES 2.0 batching method and do not draw inactive object I am researching about "batching" objects for one big VBO and reduce draw call.

These are what I am doing now:

Create interleaved VBO based on texture or render state (like Blending)

So, for example, there will be two separate VBO and draw call if I want only some object has blending

For more batching, add unused vertex data.

eg) Object "A" doesn't need to have color data, but I added white empty color, so can be batched in interleaved array

For hiding object, set vertex positions to 0.0. So, stay on the array, but cannot see.

eg) if it is quad, set to [0.0, 0.0, 0.0, 0.0]

These are my questions:

Should I create one Giant VBO, and use draw call based on offset??

If I do that, then is there any limitation on glbufferData?? (or performance drop, if too much data in)
Is there any method that vbo can contain different types of interleaved vertex?
Is multiple "offset" draw call not affect performance unlike single draw call?

Should I bind multiple texture atlas to each unit, and use uniform?

Currently, I am only binding one texture per draw.

Is there correct way for above #3 method?? (Feels like not correct)
I am updating "All" vertices every frame, even though some object doesn't need to be updated. (glBufferData) Should I do multiple update call??

Sorry for my wording, but please point me anything that I am doing something wrong.

Thank you.

sentences:
XNA - Darkening background and drawing something on top In a game a group of friends and I are working on using XNA, we wanted to create an effect where we could darken the screen and draw something else on top of the darkened portion. For example, we have a title screen that is drawn as a background sprite, a logo, a few buttons, and a lot of particle effects (all separate Texture2D's), but when you select the "Exit" button, the entire title screen darkens, and two (undarkened) buttons are drawn over-top ("exit" and "cancel" buttons).

Initially, we were going to do this by having two separate render targets, one for the title screen, and one for the yes and no buttons. Then, when we wanted to display the topmost render target, we darkened the render target that the title screen was drawn to, and then draw the new render target on top. The problem with this is that the second render target is filled with black pixels that simply get drawn over the background, blocking it out completely.

We have two ideas to fix this. The first idea is to draw the second render target on top of the first using BlendState.Additive, so that the black pixels are simply added to the background instead of drawn over-top. The problem with this is that it makes the other buttons look weird, since they're being drawn over top other things on the title screen. The second idea was to manually set every black pixel in the second render target to Color.Transparent, but we're not sure how efficient that is.

Any ideas on how we could achieve this effect?

sentences:
Registering a C++ callback with Lua API without additional libraries Basically, I'm trying to register a callback into a Lua state like this:

class MyClass
{
    public:
        int myLuaFunction(lua_State* L)
        {
            //do something
        }

};

I want to be able to call MyClass::myLuaFunction of a given instance (which could register itself).

I've spent a couple hours trying to do tricks with templates and lambdas in an attempt to get it to work, but I haven't got anything successful (mainly the fact that I couldn't pass a lamba function that uses parent scope variables to Lua's API).

Without having to download any other libraries (just Lua's standard interpreter implementation), how could I do this?

sentences:
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:
Validating User Actions on the Server I am currently working on a networked first person shooter. I have created a server implementation that can synchronize player data. But while implementing a damage system, I realized that I almost simply sent a packet with

PLAYER DAMAGE [target id] [amount]

But that would likely be open for any player to save a list of IDs and inject that packet to damage every ID. Unfortunately the server is unable to know what the environment is like -- meaning it cannot check if there is something between the two players or likewise.

How would I keep this from being possible?

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:
Constant size geometries How can I display objects in a 3D perspective projection that look like as if their size does not change, despite of the camera's position?
I am using DirectX 9.0. I know of PositionTransformed declaration usage, but I was thinking of scaling the objects in every frame as the camera zooms in/out to achieve this.
Is there a way to know the "scale" of a perspective projection?

An example usage would be to show lines with constant width. E.g. roads on a map.

Update, I've found the solution

check the accepted answer.

sentences:
Compile shader and root signature of a ray tracing shader into a single binary using DXC I'm new to DXR, so please
If I got it right, when we want to compile a ray tracing shader using the DirectX Shader Compiler, we need to specify lib_6_* as the target profile.
Now assume I've got a HLSL file containing a single ray generation shader RayGen whose root signature is specified by a RootSignature attribute of the form
#define MyRS "RootFlags(LOCAL_ROOT_SIGNATURE),"  \
        "DescriptorTable("                  \
            "UAV(u0, numDescriptors = 1),"  \
            "SRV(t0, numDescriptors = 1))"
[rootsignature(MyRS)]
[shader("raygeneration")]
void RayGen() {}

Using IDxcCompiler::Compile, I'm able to compile both the shader itself using the target profile lib_6_3 and the root signature using the target profile rootsig_1_1, but if I got it right it's not possible to invoke IDxcCompiler::Compile such that the created IDxcBlob contains both the shader and the root signature. (I've tried to add the argument -rootsig-define MyRS to the call for the compilation of the shader, but it seems to me that the compiler expects the root signature specified in this way to be a global root signature.)
So, I end up with two IDxcBlob's. Is there any possibility to "merge" them into a single one which can later be used to specify the shader as well in a call of ID3D12Device5::CreateRootSignature?

sentences:
Map circular thumbstick to square I want to make a plane controller using SDL2. I want to use one joystick for pitch/roll. Y-axis sets the pitch-flaps, and X-axis sets the roll-flaps.
But there is one problem: Say I want to fully pitch and roll at the same time: I will hold the joystick at a 45 degree angle. But in SDL2, the joyAxis then get reported as 0.707... which is roughly half of the square root of 2. I understand why this happens: the physical joystick is restricted within a circle, so to move it up, you need to sacrifice a little bit of left/right. So the magnitude of the input vector is at most 1, instead of sqrt(2). How do I correct for this in code? I can't think of a good mapping.
I would like something like this:
float rawInput[2] = {0.707, 0.707};
float actualInput[2] = squaredCircle(rawInput); // {1,1}

rawInput = {1, 0};
actualInput = squaredCircle(rawInput); // {1,0}

What is a good squaredCircle function?

sentences:
How to add time delay in Unity C# So I'm trying to make a camera zoom in, but Thread.Sleep doesn't work.
Here is the code:
    void Start() {
    for (int a = 0; a > 1000; a = a + 1)
    {
        Debug.Log("Done!");
        Thread.Sleep(100);
    }
}

The error code is this:
Assets\StartScene\CamScript.cs(12,13): error CS0103: The name 'Thread' does not exist in the current context

sentences:
Achievements system like in Starcraft2 I am playing Starcraft2 and I am fascinated of how it is engineered. So lets say you played a 1v1 ranked game and you pumped 10 marines in the first 320 seconds. You'll get an achievement for that. I was wondering how is the achievements system designed underneath? Yes it analyzes the replay file which is frame based, but how?
There are 1000 achievements now.

sentences:
xna orbit camera troubles I have a Model named cube to which I load in LoadContent(): cube = Content.Load<Model>("untitled");.

In the Draw Method I call DrawModel:

    private void DrawModel(Model m, Matrix world)
    {
        foreach (ModelMesh mesh in m.Meshes)
        {
            foreach (BasicEffect effect in mesh.Effects)
            {
                effect.EnableDefaultLighting();
                effect.View = camera.View;
                effect.Projection = camera.Projection;
                effect.World = world;
            }
            mesh.Draw();
        }
    }

camera is of the Camera type, a class I've setup.  Right now it is instantiated in the initialization section with the graphics aspect ratio and the translation (world) vector of the model, and the Draw loop calls the camera.UpdateCamera(); before drawing the models.

class Camera
{
    #region Fields
    private Matrix view; // View Matrix for Camera
    private Matrix projection; // Projection Matrix for Camera
    private Vector3 position; // Position of Camera
    private Vector3 target; // Point camera is "aimed" at
    private float aspectRatio; //Aspect Ratio for projection
    private float speed; //Speed of camera
    private Vector3 camup = Vector3.Up;
    #endregion

    #region Accessors
    /// <summary>
    /// View Matrix of the Camera -- Read Only
    /// </summary>
    public Matrix View
    {
        get { return view; }
    }
    /// <summary>
    /// Projection Matrix of the Camera -- Read Only
    /// </summary>
    public Matrix Projection
    {
        get { return projection; }
    }
    #endregion

    /// <summary>
    /// Creates a new Camera.
    /// </summary>
    /// <param name="AspectRatio">Aspect Ratio to use for the projection.</param>
    /// <param name="Position">Target coord to aim camera at.</param>
    public Camera(float AspectRatio, Vector3 Target)
    {
        target = Target;
        aspectRatio = AspectRatio;
        ResetCamera();
    }

    private void Rotate(Vector3 Axis, float Amount)
    {
        position = Vector3.Transform(position - target, Matrix.CreateFromAxisAngle(Axis, Amount)) + target;
    }

    /// <summary>
    /// Resets Default Values of the Camera
    /// </summary>
    private void ResetCamera()
    {
        speed = 0.05f;
        position = target + new Vector3(0f, 20f, 20f);
        projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, aspectRatio, 0.5f, 100f);
        CalculateViewMatrix();
    }

    /// <summary>
    /// Updates the Camera.  Should be first thing done in Draw loop
    /// </summary>
    public void UpdateCamera()
    {
        Rotate(Vector3.Right, speed);
        CalculateViewMatrix();
    }

    /// <summary>
    /// Calculates the View Matrix for the camera
    /// </summary>
    private void CalculateViewMatrix()
    {
        view = Matrix.CreateLookAt(position,target, camup);
    }

I'm trying to create the camera so that it can orbit the center of the model.  For a test I am calling Rotate(Vector3.Right, speed); but it rotates almost right but gets to a point where it "flips."  If I rotate along a different axis Rotate(Vector3.Up, speed); everything seems OK in that direction.

So I guess, can someone tell me what I'm not accounting for in the above code I wrote?  Or point me to an example of an orbiting camera that can be fixed on an arbitrary point?

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:
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:
How can I call two functions in a sequence with onclick? I'm learning Unity.

I have two functions, one that transitions to a new scene and the other one is the button animation.

I add both functions to the onclick of a given button. I assume it calls both functions at the same time and executes the transition without running the animation.

I want the button to run the animation first (I'm using DOTWEEN) and once it's done to execute the transition.

sentences:
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:
Sidescroller variable terrain heightmap for walking/collision I've been fooling around with moving on sloped tiles in XNA and it is semi-working but not completely satisfactory. I also have been thinking that having sets of predetermined slopes might not give me terrain that looks "organic" enough. There is also the problem of having to construct several different types of tile for each slope when they're chained together (only 45 degree tiles will chain perfectly as I understand it).

I had thought of somehow scanning for connected chains of sloped tiles and treating it as a new large triangle, as I was having trouble with glitching at the edges where sloped tiles connect. But, this leads back to the problem of limiting the curvature of the terrain.

So...what I'd like to do now is create a simple image or texture of the terrain of a level (or section of the level) and generate a simple heightmap (of the Y's for each X) for the terrain. The player's Y position would then just be updated based on their X position.

Is there a simple way of doing this (or a better way of solving this problem)? The main problem I can see with this method is the case where there are areas above the ground that can be walked on. Maybe there is a way to just map all walkable ground areas?

I've been looking at this helpful bit of code:
http://thirdpartyninjas.com/blog/2010/07/28/sloped-platform-collision/
but need a way to generate the actual points/vectors.

EDIT:
I did try pregenerating sloped paths using the link I posted but now I'm convinced I should use per-pixel collision as you suggested. I've been looking at the example at: http://create.msdn.com/en-US/education/catalog/tutorial/collision_2d_perpixel and am trying to figure out how to adjust the sprite once a collision has been detected. As David suggested, I made a few sensor points (feet, sides, bottom center, etc.) and can easily detect when these points actually collide with non-transparent portions of a second texture (simple slope). I'm having trouble with the algorithm of how I would actually adjust the sprite position based on a collision.

Say I detect a collision with the slope at the sprite's right foot. How can I scan the slope texture data to find the Y position to place the sprite's foot so it is no longer inside the slope? The way it is stored as a 1D array in the example is a bit confusing, should I try to store the data as a 2D array instead?

I also noticed several people mention that it's best to separate collision checks horizontally and vertically, why is that exactly?

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 to make Rigidbody.AddForce less delayed in Unity3D? I'm trying to make it so that when the player in my game moves left or right, he lightly jumps from his current position to his new position. The way I have it set up now, the jump occurs once he has arrived at his new position. What can I do to make it so that the jump happens sooner so that it appears that he jumps to his new position? Here is the code I have that controls that part of his movement:
if (Input.GetKeyDown(KeyCode.LeftArrow) && transform.position.x > minXPos)
    {
        targetPos = new Vector3(transform.position.x - xIncrement, transform.position.y, transform.position.z);
        rb.AddForce(Vector3.up * jumpForceTwo, ForceMode.Impulse);
        transform.position = Vector3.MoveTowards(targetPos, transform.position, speed);
        isHorizontalingLeft = true;
    }
else if (Input.GetKeyDown(KeyCode.RightArrow) && transform.position.x < maxXPos)
    {
        targetPos = new Vector3(transform.position.x + xIncrement, transform.position.y, transform.position.z);
        rb.AddForce(Vector3.up * jumpForceTwo, ForceMode.Impulse);
        transform.position = Vector3.MoveTowards(targetPos, transform.position, speed);
        isHorizontalingRight = true;
    }

Here is a video showing what is happening (sorry it's blurry):
https://youtu.be/rPewtb8QywE

sentences:
Using components in the XNA Game State Management example? In the game state management example at the App Hub, they say that if you want to use components in the example you can extend the GameScreen to host other components inside itself.

I'm having a very hard time trying to tie this up.
I tried extending the GameScreen class by adding a public property of public List<DrawableGameCompnent> components { get; set; } and then add my components to that list when I initialize the current screen as well as looping over the components in the LoadContent, Update and Draw methods. However, this doesn't feel like the correct way to go - mainly because it doesn't work when I get to the implementation of my GameplayScreen.

Any thoughts?

sentences:
How do I get the camera's local XYZ axis in Direct X 11? I'm currently working on quaternion rotation and I have them working, but it seems to be using the world XYZ axis to rotate around, which is an issue as the camera rotates itself around an axis.

Similar to the last image, how do I rotate the camera around its local XYZ axis rather than the world XYZ?

Edit:

The camera now rotates around its local axis, but when doing so, it does not change its values in world space. I can hold a key down and it will rotate around the correct axis, but once I release the key it will snap back to its original position before the rotation began. What must I do to allow the local changes to be applied to world space?

sentences:
Entity Component System: Retrieving components quickly Possible Duplicate:
  Retrieving components from game objects (entities)

I'm working on an entity-component-system game at the moment. I've looked in particular at the Artemis framework and a c# port of it but I am writing my own implementation of the pattern.
http://gamadu.com/artemis/manual.html

I'm puzzled as to how components are retrieved from the EntityManager.
As far as I can tell I have two options:

Assign each type of component a static ID, that is used as the index of the component (my entities are held as EntityComponent[entityID][componentIndex]) but I'm concerned that in a situation where an entity has a component of ID 9, that I will then have size the array to 10 and have 9 empty elements preceding the sole component, consuming memory unnecessarily.
Alternatively I could write a generic method e.g EntityManager.GetComponent(int entityID)
but this would require a look up or OfType<> call against the entities components.

Surely there is a more efficient way. What am I missing?
Artemis includes a ComponentMapper class but I struggle to understand what it does.
I want to ensure the basics of the system work as efficiently as possible.
Many thanks in advance for any feedback.

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:
How much a game can borrows from a franchise before becoming a fangame/infringing the copyright Let's say you like the theme/world of a franchise, for example SpongeBob SquarePants, and you want to make it into maybe a business game where you hold an underwater restaurant. Make burgers, invent recipes, have fishes as customers etc. How much can you borrow from the original franchise before crossing the red line ? I know that the names are the first to be copyrighted, but if for example your cook looks like a yellow square sponge, is that an infringement ? Even more, if you want to implement the concept of "Special Formula" as in the anime (without naming it in the same way), is that an infringement ?

Thanks.

sentences:
Two 2D objects in Unity aren't colliding together In Unity 5, I have a player shooting a projectile in aim to hit a boss, and inflict damage upon contact with the projectile. Though for some reason, the projectile and boss aren't colliding with each other.

I've done the following;

Made sure that both the projectile and boss have a BoxCollider 2D and Rigidbody 2D
Made sure that they're on the same Z-Index and on the same layer
Tried to Debug.Log() if there's any collision (there isn't)
Made sure I'm using OnCollisionEnter2D on the boss' health script
Compared the syntax I use with another collision (where the player collides with an object and dies - this works perfectly fine).

However, none of these seem to be working.
This is the boss' health script:

void OnCollisionEnter2D (Collision2D coll)
{
    Debug.Log("COLLIDED");
    bosshealth -= 1;
}

Here is the projectile prefab:

And the boss prefab:

Does anyone have a clue as to why they're not colliding? the projectile just glides over the boss

EDIT: I found a temporary fix! Disabling the Kinematics of the boss allows for both objects to collide, and successfully display a debug message!
Just a problem though; I don't want the boss to freely float around in space. I use the kinematic to ensure it stays put at all times until told to by scripts.

Is there a way to get around not having to disable the kinematics?

EDIT 2: Then again, I am removing the projectiles on impact anyway, so the actual boss doesn't move, but that seems dirty :/

sentences:
Transform manipulator for Unity/Oculus Touch game like in Quill, Medium etc I'm trying to create a script to manipulate the transform of a gameobject using the Oculus Touch just as in for instance Quill or Medium, with rotation, translation and scaling. Can somebody help me with this? My initial attempt was to focus on rotation and I got it almost working I think. Here's the code:

void Update()
{
  // On button down
  if (OVRInput.GetDown(OVRInput.Button.SecondaryIndexTrigger))
  {
    originalRotation = transform.localRotation;
    originalControllerRotation =
      OVRInput.GetLocalControllerRotation(OVRInput.Controller.RTouch);
  }

  // While button is down
  if (OVRInput.Get(OVRInput.Button.SecondaryIndexTrigger))
  {
    var controllerRotation =
      OVRInput.GetLocalControllerRotation(OVRInput.Controller.RTouch);

    var rotation = originalRotation;
    rotation *= Quaternion.Inverse(originalControllerRotation);
    rotation *= controllerRotation;
    transform.localRotation = rotation;
  }
}

This kind of works but the rotation center doesn't look right. I want it to rotate around the center of the right touch controller and it looks to be rotating around the local origo of the gameobject. How do I modify the code so it rotates around the controller instead?

sentences:
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:
How to detect RayHit on part of model and not entire model I'm building a low poly role playing Hack and Slash game. When I click it renders a sprite & character moves to that location(with RayCast).

But in this case. I don't want the click to occur on side of the bridge. Clicks should only occur in green coloured part & not in the red part. How should I fix this problem?

sentences:
A* pathfinding for dynamic obstacles and player made blockages? Hi I'm creating a TD in Unity 5 and need some help with my Pathfinding.

I'm going to use Arons A* pathfinding for my AI which enables me to use dynamic objects and update the path during run-time. However in my game I want the player to be able to block the minions with special turrets which will force the minions to attack the "block tower" instead to get past to their destination.

How could I accomplish something like this?

Image for more clarity:

sentences:
Fade a texture effect as it nears the end of a cylinder mesh In my game I have a laser beam that travels for about 15m, but abruptly stops due to the mesh the texture is attached to. How can I setup my shader graph so that the end of the texture fades away? I can't find anything similar to this anywhere online, and have tried multiple things (gradient/colors with lerp attached to alpha) but just can't figure it out as I'm too new to the whole shader graph thing. Anything helps, thank you.
Note: The texture is 'animated' and scrolls along the path of the beam using the shader graph

sentences:
creating a process to run in c++ // i need to run a process in c++ Hey I don't know why that when I compile this code that the fear.exe process is not running I am using visual studio for my coding ide choice the project is a win32 project // application method, that I am using..

I should say that I added a new item a c++ file called main.c++ and should I use the code file that Defines the entry point for the application. or does it matter.

#include "iostream"
#include "Windows.h"
#include "OVR_CAPI_D3D.h"
#include "Win32_DirectXAppUtil.h"
#include "stdio.h"
#include "string.h"
#include "Shlobj.h"
#include "Shlwapi.h"

using namespace std;

int WINAPI WinMain(HINSTANCE hinst, HINSTANCE, LPSTR, int)
{
    STARTUPINFO startinfo = { 0 };

    PROCESS_INFORMATION processinfo = { 0 };

    BOOL bsuccess = CreateProcess(TEXT("E:\SteamLibrary\steamapps\common\FEAR Ultimate Shooter Edition\FEAR.exe"), NULL, NULL, NULL, FALSE, NULL, NULL,
        NULL, &startinfo, &processinfo);

    if (bsuccess)
    {
        cout << "Process Injected" << endl
            << "Process ID:\t" << processinfo.dwProcessId << endl;

    }
    else
    {
            cout << "Error to start the injected process" << GetLastError() << endl;
        }
        cin.get();
        return(0);
    }

sentences:
Bad Viewports Using Unity with Google Cardboard VR on iOS I'm using unity 2017.3.1f1, building for an iPhone SE.

I'm able to build the google HelloVR scene, available from the Google Cardboard VR unity package. However, in the end result, the cameras are giving the wrong display. They aren't lined up to create stereoscopic vision at all, and the image appears distorted.

Here is an example of the output: https://i.imgur.com/Y4pqdiy.jpg

Is there a default setting in the Google Cardboard VR package that can be changed to fix this?

sentences: Sending message to all players in room from Photon server? I need to send a message to all players in the room from a Photon server. Sending the message from a player would introduce too much latency so I need the server to collect data and distribute messages at a rate of 16/s without a player's influence. Is there a way to do this?

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:
using odd number of sprites in multi-row spriteSheet? Using XNA it's pretty easier to loop through a sprite sheet, I tell it how many rows and how many columns it has and I have a method that loops through the whole set.

I usually use this method in my sprite class, but I have a sprite sheet that has a odd number of sprites, and does not use the entire last line.  Any ideas on how to do this?

for example: I have 3 rows of 6 columns, but on the last row I only have 3 sprites.

Thanks!

sentences:
Multithreaded callback I'm making a multiplayer game where players fight in vehicles, and I am doubting my server architecture. As it will be physics, network and AI intensive I would like to split these 3 topics into their own thread. Perhaps even one thread per AI.
The physics thread will run at a fixed time-step and do the same loop over and over.

Integrate gamestate at fixed timestep of 0,005s (200Hz)
Solve gamestate for constraints and collisions
One such constraint is a vehicle controller, which is a struct consisting of throttle, steer, brake etc. is applied to a single vehicle.
Callback

The network is called every 6 physics frames, thus the networking runs at ~33Hz
The AI is also called every 6 frames.
Note: network and AI can be called in lockstep

The AI threads will calculate the next move on a need-by-need basis.

Copy gamestate into private memory
Calculate next move
Update their vehicle controller in the game state

The network thread will

Listen for incoming UDP packets, handle them, apply changes to gamestate such as player's vehicle controller, bullet spawn
When called for, broadcast the new gamestate to clients

Copy gamestate into private buffer
Create array of differences from last state

Vehicle parts removed/added
Vehicle parts moved/rotated
Players joined/left
Projectile impacts and damages

Pack the differences together and broadcast.

When a new player joins:

grab the last private game state buffer and send it whole
Change gamestate by spawning a vehicle and allocating a controller

What I'm having trouble with:

Creating threads on the fly has overhead, so I would like to avoid it by pre-creating and "parking" the threads, and calling them when needed. Once called, they do their duty, such as calculate the next move for the AI to make. Then the threads "hibernate". Note that I don't want the threads to wait in a busy loop and read some shared memory for "activation".
The AI and Network threads need to make private copies of the game state, because the physics run so fast the game state might be changed mid-read.

Mitigation 1: swapping game state buffers. Still no guarantee.
Mitigation 2: locking the gamestate. This is a bad idea because the physics should not be held up.

How can I achieve this in C++? Does x86 offer actual interrupts for this? How about other architectures, or are there libraries that do this for me?
Or should I do it another way?

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:
How can i Randomize Unique Numbers in Java So i'm making a game where i have to randomize 52 numbers from 1 to 52 so the order has to change i use this

    class Deck
{
    Random r = new Random();
    int[] Card = new int[52];
}

sentences:
How efficiently use SDL_RenderFillRects? For the sake of learning C++, I would like to optimize a "Game of life" project I made.
In my first attempt, I used a bunch of SDL_RenderFillRect to draw the board squares.
In my second attempt, I used a single SDL_RenderFillRects to avoid the cost of calling the GPU a lot of times.

However, I am probably wrong in my second implementation because it is not faster than the first one (or barely 5%). Moreover, my implementation is all but elegant.

In the two cases, I only draw the living cells.

The SDL_RenderFillRect solution:

SDL_Rect fillRect;
for (int column=0; column<array_width; ++column)
{
    for (int row=0; row<array_height; ++row)
    {
        if (board[column][row]) // // Checks if the cell is alive
        {
            fillRect = {column*CELL_SPACE,row*CELL_SPACE,CELL_SIZE,CELL_SIZE};
            SDL_RenderFillRect(gRenderer, &fillRect);
        }
    }
}

The SDL_RenderFillRects solution:

SDL_Rect fillRect;
static SDL_Rect rect_list[120000]; // The list of squares to be drawn
int array_index_count = 0;
for (int column=0; column<array_width; ++column)
{
    for (int row=0; row<array_height; ++row)
    {
        if (board[column][row]) // Checks if the cell is alive
        {
            fillRect = {column*CELL_SPACE,row*CELL_SPACE,CELL_SIZE,CELL_SIZE};
            rect_list[array_index_count] = fillRect; // Adds the cell to the array
            ++array_index_count;
        }
    }
}
SDL_RenderFillRects(gRenderer, rect_list, array_index_count);

I am not happy with the way I use SDL_RenderFillRects.
First, I don't know in advance how many living cells there will be, forcing me to declare an oversized array.
Second, I indeed avoided a lot of SDL_RenderFillRect calls, but at the price of long iteratings over the rect_list array.

How to use the SDL_RenderFillRects function properly?

sentences:
Questions before I revamp my rendering engine to use shaders (GLSL) I've written a fairly robust rendering engine using OpenGL ES 1.1 (fixed-function.) I've been looking into revamping the engine to use OpenGL ES 2.0, which necessitates that I use shaders. I've been absorbing information all day long and still have some questions.

Firstly, lighting. The fixed-function pipeline is guaranteed to have at least 8 lights available. My current engine finds lights that are "close" to the primitives being drawn and enables them; I don't know how many lights are going to be enabled until I draw a given model. Nothing is dynamically allocated in GLSL, so I have to define in a shader some number of lights to be used, right? So if I want to stick with 8, should I write my general purpose shader to have 8 lights and then use uniforms to tell it how many / which lights to use?

Which brings me to another question: should I be concerned with the amount of data I'm allocating in a shader? Recent video cards have hundreds of "stream processors." If I've got a fragment shader being used on some number of fragments in a given triangle, I assume they must each have their own stack to work on. Are read-only variables copied here, or read when needed?

My initial goal is to rework my code so that it is virtually identical to the current implementation. What I have in mind is to create my own matrix stack so that I can implement something along the lines of push/popMatrix and apply all my translations, rotations, and scales to this matrix, then provide the matrix to the vertex shader so that it can make very quick vertex translations. Is this approach sound?

Edit: My original intention was to ask if there was a tutorial that would explain the bare minimum necessary to jump from fixed-function to using shaders.

Thanks!

sentences:
Problem with texture's quality in Unity .

After setting a texture to GameObject, it looks bad.  Some pixels can be seen and colors are distorted. The image itself is in good quality but after importing it to Unity, it looks ugly.

Screenshot explanations:

left, image attached to the GUITexture GameObject
middle, image before importing to Unity
right, after importing (shown in inspector)

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: Calculating contact points with SAT After detecting a collision between two convex shapes by using separating axis theorem and calculating MTV. How can I calculate the contact points?(for applying torque to the rigid body).

sentences:
Difference between methods - onClick.AddListener and On Click under UI button inspector? Within my Unity Project in my code, (see below), I have a button called Check which executes when CheckPress() function is called. I read two approaches by which this can be done.
Appraoch 1: Using Check.onClick.AddListener(CheckPress); and then attaching script to Canvas. When I press run and click the Check button, this works.
Approach 2: The other approach I read is that, I can attach my script to Canvas. From there I select the button Check from hierarchy, then under inspector I see On Click(), I click + sign and then drag the Canvas and place it in Object (see the attached image), then under No Function I select the CheckButtonBehaviour Script and select the CheckPress(). When I press run and click the Check button, this also works as intended.
I wanted to know if these two approaches are same or different. If they are different, then in which context either approach should be implemented.
using System.Collections.Generic;
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
using System.IO;
using System.Threading;
using UnityEditor;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System;
using System.Linq;

public class CheckButtonBehaviour : MonoBehaviour
{

public Button Check;
public Button Play;
public Button NextSignal;

public List<string> signals = new List<string> {"Speech1", "Speech2", "Speech3", "Speech4"};
public List<string> shuffledSignals = new List<string>();
public int index = 1;
public int counter = 3;

private static int localPort;
private string IP;
public int port = 8050;
IPEndPoint remoteEndPoint;
UdpClient client;

void Start()
{

    var rndr = new System.Random();
    shuffledSignals = signals.OrderBy(i => rndr.Next()).ToList();

    IP = "127.0.0.1";
    port = 8050;
    remoteEndPoint = new IPEndPoint(IPAddress.Parse(IP), port);
    client = new UdpClient();
    Play.gameObject.SetActive(false);
    NextSignal.gameObject.SetActive(false);

    Check.onClick.AddListener(CheckPress);

}

public void CheckPress()
{

    byte[] data0 = Encoding.ASCII.GetBytes("starting"); ///OLD CODE part
    client.Send(data0, data0.Length, remoteEndPoint);
    Debug.Log("<color=blue>Something is sent to MAX</color> : starting");

    Check.gameObject.SetActive(true);
    Check.interactable = false;
    Check.enabled = false;

    Play.gameObject.SetActive(true);
    NextSignal.gameObject.SetActive(true);

}

sentences:
Porting a SFML game to the browser? I've been messing around with SFML, it's my first experience with C++ and I'm enjoying it. But I'm wondering how to publish my game onto anything other than a native platform. Noting that this is my first time dealing with porting and C++, could anyone explain this to me as if I'm 5?

Thanks in advance.

sentences:
OpenGL: why do I have to set a normal with glNormal? I'm learning some basics of OpenGL but I'm wondering why there is a call glNormal to set the normal of vertices.

If I create a simple triangle like this:

glBegin(GL_TRIANGLES);
    glVertex3f(0,0,0);
    glVertex3f(1,0,0);
    glVertex3f(0,1,0);
glEnd();

Shouldn't the normals be defined implicitly by the type of the geometric primitive? If I don't set a normal will OpenGL calculate it?

sentences:
How do I implement deceleration? I say "deceleration" because I'm not using acceleration at the moment; what I mean is moving the velocity back towards zero, eventually stopping.

I'm new to vectors and not so great with physics and such. How is "deceleration" normally handled?

What I have now works, but it seems kind of hackish.

update:function(Game, t, dt) {
    var speed = Game.Input.isKeyDown('shift') ? 8 : 4;

    if (Game.Input.isKeyDown('a')) {
        this.velocity.i -= speed;
    }
    else if (Game.Input.isKeyDown('d')) {
        this.velocity.i += speed;
    }
    else {
        if (Math.abs(this.velocity.i) > 3) {
            this.velocity.i += (this.velocity.i > 0) ? -speed : speed;
        }
        else {
            this.velocity.i = 0;
        }
    }

    if (Game.Input.isKeyDown('w')) {
        this.velocity.j -= speed;
    }
    else if (Game.Input.isKeyDown('s')) {
        this.velocity.j += speed;
    }
    else {
        if (Math.abs(this.velocity.j) > 3) {
            this.velocity.j += (this.velocity.j > 0) ? -speed : speed;
        }
        else {
            this.velocity.j = 0;
        }
    }

    this.updateVectors(dt);
}

I used 3 because anything lower exhibits weird behaviour, I'm guessing if I raised the speed then it would need to be changed.

sentences:
How do games like Street Fighter compensate for bad frame rates? I know fighting games like Street Fighter like to run and are capped to a standard 60 fps. All their combos, animations, chains, etc... are based on frames. So, how do they compensate for slowdowns when the game can't catch up the needed frame rate?

It doesn't seem an easy task like just scale the used frame count data used in the different systems of the game because of the discrete nature of frames.

Any tip on this?

sentences:
Unity: Record real time game play in high quality using offline rendering? I'm looking to record Unity gameplay at really high quality (360 Stereo 8k 120 fps). I can't do this in real time due to the GPU resources required so I need to do offline rendering (frame perfect rendering).
The problem is offline rendering by its nature doesn't accept user input, so I can't record live gameplay footage. I'm looking for a solution that lets me record live gameplay and then render it out at this higher quality.
I considered recording the user input or the gameobjects properties and then playing them back while rendering the footage. I tried a number of assets like Ultimate Replay 2.0, Record and Play, GameObject Recorder, even tried Unity Recorder to an animation but none of them record all of the changes to components on a gameobject. I think I'll have to write my own code, although I'm not sure what the best method would be, I'm reluctant to sink to much development time into this if there's an easier solution that I've overlooked?
Initially I'm looking for a solution that works inside the Unity editor but would love to be able to give this ability to end users.

sentences:
Useful resources for beginning AI What resources are available, including both free articles/ebooks and physical books and things, for game developers looking to begin simple AI programming/design?

Note: I know of this question, but that's more asking about where to start on a specific topic; I'm more asking about resources in general.

sentences:
Is it reasonable to use a 2D texture as a lookup table in GLSL I need a lookup table in a shader. The input values would be color values and the output other color values. Something like:

uniform float lut[256];

color = vec3(lut[int(color.r*255.)], lut[int(color.g*255.)], lut[int(color.b*255)]);

does what I need but certain implementations of OpenGL ES do not allow arrays with variable indexing so finally I've arrived to the conclusion that the most portable way is to have a 2D texture as the LUT. A texture of 256x256 could store many different lookup tables, each one (256 entries) in a single row.

In order to load a row in the texture (c++) I would use:

glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 256, 1, GL_LUMINANCE, GL_UNSIGNED_BYTE, data);

to store a table in the first row (I assume that internally in the texture I'd have the value repeated in R, G and B)

To fetch the LUT in the fragment shader I'd use texture2D(lut,vec2(index, constRow))   (index in the range 0-1 and constRow = 0 being the row in the texture where it is stored the lut).

Is that a reasonable way to implement that?

Update:
In order to fetch values in the texture-LUT you need normalized indexes (0.0-1.0), so to access row 7 I have to index it as texture2D(lut, vec2(index, 7./255.)); From what I see the result is (or may be) an interpolation with the two other consecutive rows.

sentences: ue4editor.exe GPU selection Even though I set ue4editor.exe to use integrated graphics on my laptop, it somehow ends up using the discrete nvidia gpu; is there a way to set the preferred gpu with the unreal suite?

sentences:
Getting .mesh & .skeleton from Blender2Ogre export I have downloaded the add-on blender2ogre from this source :
http://code.google.com/p/blender2ogre/

And I have created a simple mesh, with walking animation (similar to the gingerbreadman tutorial). My question is, whenever I want to export the project, I can only see the .scene export format. There is no option whatsoever to export as .mesh and .skeleton. Also, how can I export the walking animation separately, in other words, if my project have couple more animation, how can i separate those during export?

sentences:
Getting rid of dead objects in a game effectively? I'm using a for loop or foreach loop (doesn't matter) to loop through all my objects when they need to be updated or drawn. However, when an object gets killed, I want it to get removed from the collection again.

I do this by adding the object to a dead-objects list, and then, when everything has been drawn and updated, I go through everything in this list, removing the objects in the list from the original source as well.

Is there a better way of doing this?

sentences:
Unity - Bullet spawns in wrong position in client I am making a multiplayer game with prefab shooting, but unfortunately the prefab  sometimes spawns in the wrong position when I shoot from a client. The bullet tends to spawn in a location where the player was a few miliseconds ago, making that the bullet sometimes spawns inside of the player which killing the player in the process.

For shooting, I currently have this code setup to instantiate the bullet

void Update() {
    if (Input.GetMouseButtonDown(0)) {
        float angle = GetComponentInChildren<Weapon>().angle;
        CmdShootBullet(angle);
        rigidbody.AddForce(Quaternion.AngleAxis(angle + 180, Vector3.forward) * Vector3.right * (bulletPrefab.GetComponent<Bullet>().force / 7.5f));
    }
}

[Command]
void CmdShootBullet (float angle) {
    GameObject bullet = Instantiate(bulletPrefab, firePoint.position, Quaternion.identity);
    Bullet bulletScript = bullet.GetComponent<Bullet>();
    bulletScript.shotBy = gameObject;
    bullet.GetComponent<Rigidbody>().AddForce(Quaternion.AngleAxis(angle, Vector3.forward) * Vector3.right * bulletScript.force);
    NetworkServer.Spawn(bullet);
}

And this is the setup for the location of the player and the gun. The top one is the player, the bottom is the gun.

My guess is that it has to do with lag, that the player position does not update soon enough, so how would I make it that the bullet spawns in the position of the player in the client rather than the position of the player in the host?

sentences:
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:
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:
Pygame How To Use Collision? Can someone tell me how to implement collision in Pygame?
For example I have a sprite called A and another one called B.
How do I detect if they collide in Pygame?

sentences:
unlimited (wraparound) 3d terrain How can I create a wrap around unlimited 3D terrain:
To make it clear:
If I step out of terrain in (1) or (A) I want to get to (2) resp. (B)

        |B
        V
     +----------+
2 -->|          |--> 1
     |          |
     |          |
     +----------+
        |A
        V

I do not know how to wrap around the terrain and all the items which are on the terrain(NPCs etc) I thought of portals, but then I have problems on the corners of the terrain.
In 2D it is quite simple(even trivial), but on 3D I cannot find a solution..
Any advice or tutorial ailable?

sentences:
reading input from multiple mice in QB64 in Windows 10? I am looking to write a non-network multiplayer game for Windows 10 with QB64 that accepts input from 2 or more USB mice plugged into the system. Like a simple Pong game where additional players plug mice into a USB hub to use as game controllers.
I have been googling this and found some older threads

Is it possible to detect two different mice at the same time, and have their movements recorded seperately? Asked 8 years, 9 months ago
How do I read input from multiple keyboards/mice on one computer? Asked 7 years, 6 months ago

however these are pretty old threads from before Windows 10, also they seem to be more oriented towards C++ or .NET.
Can anyone provide some example how it might be done with QB64 under Windows 10?
Thanks

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:
FPS reticule image scaling with resolution problem I am running into a problem when I set the resolution of my screen and the objects in the HUD. When an increase of resolution happens the reticule image becomes bigger, when I want it to stay the same. Anyone got any tips?

Thanks in advice.

sentences:
GLSL shader compilation When i'm compiling a shader does it have to be complete? Can i use glCompileShader on a shader without a main() function? The OpenGL reference documentation has a nice writeup on program linking errors, but i can't find one for shader linking, so i have to ask here.

I want to have the ability to have each part of a shader in a different file. So f.e. i'll have a material calculating function and i'll have a "main" shader with the main function that'll only reference the material calculating function. Right now i have my shaderes as arrays of strings that they can read from a file, then i put together an array of string pointeres and compile that into a single shader (vertex, fragment, geometry). But if i could compile each invidividual shaders (parts of vertex shaders, instead of the whole vertex shader put together in an array of strings) and put them together when i'm linking the program, that would make the code much clearer and i could move the shader compilation code from the program managing code to the shader object itself (the one that load the string from file and exposes it).

sentences:
How to write a custom WaitUntil that is reusable? In my turn based game, I like to have a function similar to Unity's WaitForSeconds, WaitUntil that can be called within a IEnumerator that suspends the coroutine execution for the given amount of moves. I already have a public working UnityEvent (moveEvent) which I could listen to.

So I could call it from any IEnumerator like:

IEnumerator Example()
{
    yield return new WaitForMoves(2);
}

I think I'd need a separate class like:

class WaitForMoves {

  int moves = 0;

  void Start() {
    Game.moveEvent.AddListener(OnMoveComplete);
  }

  void OnMoveComplete() {
     moves++;
  }

  // I'm not sure how to write this in a way that it waits
  // until this.moves === movesToWait
  public WaitForMoves(int movesToWait) {

  }
}

sentences: GLSL mesh discard command? Is there a GLSL command similar to the discard, but it discards the whole mesh and not just a fragment?

sentences:
Function for sun movement? So, given a sun sprite set at the horizon (x = 0, y = worldheight/2) I'm trying to devise a function to make the sun rise, then fall.

The best way to do this would be the sin function, but I have no idea how to use it.

if using y = sin(x), then x would have to range between 0 and pi for a full curve, while having a constant velocity for X.

Any thoughts or suggestions?

Edit: Thanks guys!

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:
Drawing different per-pixel data on the screen I want to draw different per-pixel data on the screen, where each pixel has a specific value according to my needs. An example may be a random noise pattern where each pixel is randomly generated.

I'm not sure what is the correct and fastest way to do this. Locking a texture/surface and manipulating the raw pixel data? How is this done in modern graphics programming?

I'm currently trying to do this in Pygame but realized I will face the same problem if I go for C/SDL or OpenGL/DirectX.

sentences:
Help with off-game tasks I love writing video games for fun, and often do that.

I noticed, anyway, that most of the times implementing the gameplay itself doesn't take too much time to me (maybe because I already did that plenty times and know what and how to do for most of the things), but when I try to implement off-game stuff I get lost.

By off-game I mean what is not gameplay: menus, cutscenes between levels, world map to choose levels, saving and loading status, managing replays ... Only tried to write a few of these a few times, but always failed; that's why I never really completed and distributed a game.

Are these common problems? And where should I start to do this? Where could I find some books/guides about such stuff?

sentences:
Exponential Variance Shadow Mapping - implementation I use a variance shadow mapping with a "standard" light bleeding fix in my graphics engine which is based on deferred rendering.. I have a single shadow map for a directional light beacause a test scene is relatively small. Saving depth looks like this:

float moment1 = gl_FragCoord.z;
float moment2 = moment1 * moment1;
outColor = vec2(moment1, moment2);

Then I perform a separable gaussian blur on that texture.

Shadow test:

float Chebyshev(vec2 moments, float mean, float minVariance)
{
    float shadow = 1.0f;
    if(mean <= moments.x)
    {
        shadow = 1.0f;
        return shadow;
    }
    else
    {
        float variance = moments.y - (moments.x * moments.x);
        variance = max(variance, minVariance);
        float d = mean - moments.x;
        shadow = variance / (variance + (d * d));
        float amount = 0.3f;
        shadow =  clamp((shadow - amount) / (1.0f - amount), 0.0f, 1.0f); // standard light bleeding fix
        return shadow;
    }
}

vec4 shadowCoord = shadowMatrix * vec4(viewSpacePosition, 1.0f);
vec2 moments = texture(ShadowMap, shadowCoord.xy).xy;
float minVariance = 0.000001f;
float shadow = Chebyshev(moments, shadowCoord.z, minVariance);

I found a interesting technique - Exponential Variance Shadow Mapping which should provides better light bleeding fix. Here is saving depth for that technique:

float positiveExponent = 40.0f;
float negativeExponent = 5.0f
float depth = gl_FragCoord.z;
vec2 exponents = vec2(positiveExponent, negativeExponent);
depth = 2.0f * depth - 1.0f;
float pos = exp(exponents.x * depth);
float neg = -exp(-exponents.y * depth);
vec2 warpDepth = (pos, neg);
outColor = vec4(warpDepth, warpDepth * warpDepth);

How to implement a shadow test for that technique ? Here is my attempt:

float positiveExponent = 40.0f;
float negativeExponent = 5.0f;
vec2 exponents = vec2(positiveExponent, negativeExponent);

vec2 warpDepth(float depth)
{
    depth = 2.0f * depth - 1.0f;
    float pos = exp(exponents.x * depth);
    float neg = -exp(-exponents.y * depth);
    vec2 wDepth = vec2(pos, neg);
    return wDepth;
}

float Chebyshev(vec2 moments, float mean, float minVariance)
{
    float shadow = 1.0f;
    if(mean <= moments.x)
    {
        shadow = 1.0f;
        return shadow;
    }
    else
    {
        float variance = moments.y - (moments.x * moments.x);
        variance = max(variance, minVariance);
        float d = mean - moments.x;
        shadow = variance / (variance + (d * d));
        return shadow;
    }
}

vec4 shadowCoord = shadowMatrix * vec4(viewSpacePosition, 1.0f);
vec4 moments = texture(ShadowMap, shadowCoord.xy).xyzw;
vec2 posMoments = vec2(moments.x, moments.z);
vec2 negMoments = vec2(moments.y, moments.w);
vec2 wDepth = warpDepth(shadowCoord.z);
//float minVariance = 0.000001f;
//Edit
vec2 depthScale = 0.0001f * exponents * wDepth;
vec2 minVariance = depthScale * depthScale;
float posResult = Chebyshev(posMoments, wDepth.x, minVariance.x);
float negResult = Chebyshev(negMoments, wDepth.y, minVariance.y);
shadow = min(posResult, negResult);

Unfortunately it doesn't remove light bleeding. Did I do something wrong ? Maybe I should calculate two different minVariance based on the positive and negative exponents ?

Edit1:
Calculating minVariance this way:

vec2 depthScale = 0.0001f * exponents * wDepth;
vec2 minVariance = depthScale * depthScale;
float posResult = Chebyshev(posMoments, wDepth.x, minVariance.x);
float negResult = Chebyshev(negMoments, wDepth.y, minVariance.y);

gives better results but light bleeding is still quite visible.

Edit2:
Light bleeding:
EVSM with minVariance which is calculated as above gives better result than VSM without standard light bleeding fix, but to get the best result I also use standard light bleeding fix with EVSM. A light bleeding fix is performed in Chebyshev function but maybe I should add it after following calculation: shadow = min(posResult, negResult) ?

EVSM causes small artifacts on the illuminated side of the objects so I add some glPolygonOffset when saving EVSM depth.

sentences:
Textures drawn with visible missing lines of pixels I am making a game in monogame and have encountered the following problem:

The black arrows mark the places where the rendering is "off". As you can see the gray lines aren't "flush" or "smooth". Instead they have a "cut".

The two cuts at the top is at the same height, suggesting that an error happens with the positioning during drawing in that height. The two topmost cuts are 1 pixel off (from the cut and down) and the bottom cut is 1 pixel off  compared to the texture but 2 pixels in total (again from cut and down). Furthermore, the cuts are always in the same place. The topmost cuts and the bottom cut are part of two different "draws" and happens even if the other is removed.

The background experiences this too some other places, but vertically and not horizontally as with the HUD.

This only happens in the resolution of 1920x1080 and not in any other I've tried. The problem fixes itself in fullscreen though.

What causes this and how do I fix it?

EDIT

The resolution is certainly 1920x1080. I've double checked that.

This is how i draw the gray frame at the top

spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend);

spriteBatch.Draw(txtExpFrameLeft, new Vector2(0, 7), null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0.81f);

spriteBatch.End();

No resizing at all.

EDIT 2

Here is the result from the checker board:

As said, there are missing lines spread evenly around. When i move the gamecursor onto one of those "lines", it itself is also affected. Everything is still fine in fullscreen

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:
Anchor a health bar to a character/enemy I have a game I'm working on where the player can see the health bars of the player's avatar and other creatures in the game.  I want this health bar to always follow the character/creature around.  However, I can't figure out how to do this.  I thought having the position change when the respective object moved would do the trick, but apparently, it doesn't.  When watching the health bar's transform, however, it shows that it is moving with it's respective object but I don't see it on the game screen.  Can anyone explain how I go about accomplishing this?  Here's the Dropbox link to the project.

HealthBar Script

public class EnemyHealthBar:MonoBehaviour{
    public Texture2D healthBar;
    public Texture2D health;
    public Rect healthBarPosition;
    public Rect healthPosition;
    public GameObject monster;

    void Start(){
    }
    void Update(){
        transform.position = new Vector3(monster.transform.position.x, monster.transform.position.y, monster.transform.position.z);
        Debug.Log(transform.position);
    }
    void OnGUI(){
        GUI.DrawTexture(healthBarPosition, healthBar);
    }
}

Video of what's currently happening

Dropbox Link

sentences:
GUI Label shows on screen when object is out of view? I have GUI Labels over NPCs in my game, and the labels display their name above their head. But when I walk away and go somewhere else, their names stay on screen like it's mirrored or something?

Here's what I'm talking about:

This is how it looks normally

This is what happens when I walk out of view.

The Code:

using UnityEngine;
using System.Collections;

public class NPC : MonoBehaviour {

private float left;
private float top;
public float leftModifier;
public float topModifier;

private Vector3 NPCScreenPosition;

//FIX THE MIRRORING ISSUE

void Start () {

}

void Update () {
    Vector3 NPCNameWorldPosition = (transform.position + new Vector3(0.0f, transform.lossyScale.y, 0.0f));
    NPCScreenPosition = Camera.main.WorldToScreenPoint(NPCNameWorldPosition);
    left = NPCScreenPosition.x + leftModifier;
    top = Screen.height - (NPCScreenPosition.y + topModifier);
}

void OnGUI() {
    GUI.Label(new Rect(left, top, 150, 25), gameObject.name.ToString());
  }
}

sentences:
How can I get a 2D texture to rotate like a compass in XNA? I'm working on a small maze puzzle game and I'm trying to add a compass to make it somewhat easier for the player to find their way around the maze. The problem is: I'm using XNA's draw method to rotate the arrow and I don't really know how to get it to rotate properly. What I need it to do is point towards the exit from the player's position, but I'm not sure how I can do that.

So does anyone know how I can do this? Is there a better way to do it?

sentences:
DirectX 11 GenerateMips only works with premultiplied alpha? The GenerateMips method in the ID3D11DeviceContext allows generation of mipmaps at runtime, which is fine for fully opaque textures. However, when this method is used with transparent textures that do not have premultiplied alpha, the resulting mip levels tend to have black outlines at the transparency edges. For instance, this PNG texture, loaded through WIC and processed with GenerateMips, produces mipmaps with edge pixels that are way too dark:

My question: Is there any way to specify to that this texture uses non-premultiplied alpha, so that DirectX can generate more correct mip levels?

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:
Deploying MonoGame without OpenAL or Installer I just shipped my first working MonoGame in-development game to one of my friends. He got some OpenAL DLL crashes, until he installed OpenAL.

Is there a way to include the OpenAL dependencies somehow with my game? I noticed Visual Studio already copies MonoGame, OpenTK, Tao.SDL, etc. to the bin directory.

Edit: XNA/MonoGame/VisualStudio already creates all the required DLLs, content, etc. in bin; it's only OpenAL that doesn't appear (there's no DLL). What's the best way to handle this without creating an installer?

sentences:
How do I properly light characters in a Unity scene? I made a game prototype and want to improve some of rendering the visuals through light baking (which I'm new to). While I was mostly able to do this in my environiments, I'm having issues doing this for my characters in Unity. Previously, they came out with odd-ish dark shadows in places as they were affected by light and dull colors. After I begin light baking though and adding Light probes in areas that my characters would be extremely light, especailly on the skin areas. It doesn't look good at all.

Alternatively, without using light probes, it looks like this.

I'm genuinely confused on how to properly light these characters if I can't get a middle ground of proper lighting. Can anyone help me try to understand this and solve this problem?

sentences:
Should I use the X-Y-plane when using an orthographic projection in OpenGL? I'm currently at a loss rendering a tile-based 3D map with an orthographic projection in OpenGL. Imagine any isometric 3D game (using actual geometry instead of sprites).

Internally, the tiles of my map have x and y coordinates (for column and row position within the map respectively). The tile with x=0 and y=0 is the one in the "top left", the one with y=0 and x=1 the one to the right of the first tile and so on.

Since in OpenGL, the coordinate system is so that the X-Z-plane is the "ground" plane, I create the model matrix for each tile by using the tile's y coordinate for the matrix' (or position vector's) z component. I then set up an orthographic "camera" by using glm::ortho().

This seems to work fine at first, but I quickly ran into clipping issues when trying to render larger parts of the map. I assume this is due to the fact that the orthographic projection clips on z. A quick and dirty attempt of having the map in the X-Y-plane confirmed this, as I didn't have clipping issues then.

Now, I'm not sure what's the best approach here?

Change the code so the tiles are being layed out in the X-Y plane? In that case, it seems as if I would have to remember to rotate every single object around x accordingly, which seems wrong.
Do I need to set up the orthographic projection manually to use Y as the clipping plane? Is that even possible? I think OpenGL always uses z for clipping, right?
Some other approach? I think I'm lost in coordinates and matrices, really.

I assume this is a common problem with a well-known solution, so I'm hoping to learn about that before I go ahead, change a lot and then learn I did it the wrong way...

sentences:
Game Maker Studio 2 problems with too many instances So I am trying to make a management game, a space station simulator if you will, with potentially hundreds and thousands of customers entering and leaving the station every game day. So my plan of handling this is to first create a persistent object called oManager. Over the course of the game, oManager will continuously spawn instances of this object called oPerson.

The part of oManager that spawns person:

global.dailyflow = 100;
show_debug_overlay(true);
var number_a_day = irandom_range(ceil(global.dailyflow*0.6),global.dailyflow);
trader_base = floor(number_a_day*0.02);
trader_extra = floor(trader_base*(1+global.trader_modifier/100));
tourist_base = ceil(number_a_day*0.1);
tourist_extra = ceil(tourist_base*(1+global.tourist_modifier/100));
passerby_base = ceil(number_a_day*0.53);
passerby_extra = ceil(passerby_base*(1+global.passerby_modifier/100));
shopper_base = ceil(number_a_day*0.25);
shopper_extra = ceil(shopper_base*(1+global.shopper_modifier/100));
mercenary_base = floor(number_a_day*0.1);
mercenary_extra = floor(mercenary_base*(1+global.mercenary_modifier/100));

repeat(trader_base+trader_extra){
    with instance_create_layer(0,0,"instances",oPerson){
        guy_type = 0;
        event_user(0);
    }
}

repeat(tourist_base+tourist_extra){
    with instance_create_layer(0,0,"instances",oPerson){
        guy_type = 1;
        event_user(0);
    }
}

repeat(passerby_base+passerby_extra){
    with instance_create_layer(0,0,"instances",oPerson){
        guy_type = 2;
        event_user(0);
    }
}

repeat(shopper_base+shopper_extra){
    with instance_create_layer(0,0,"instances",oPerson){
        guy_type = 3;
        event_user(0);
    }
}

repeat(mercenary_base+mercenary_extra){
    with instance_create_layer(0,0,"instances",oPerson){
        guy_type = 4;
        event_user(0);
    }
}

Each oPerson instance decides on how many days he stays, where he would go to and how much money he spends each day, with much more to come in the future. However, the problem I am currently facing is that the game would just crash after about one game day. I think the problem is there are just too many instances and the game just cannot handle it. I tried to create only one oPerson of each type per day and it worked fine. I consider it essential to make each person an instance itself, considering they have to make pretty complex decisions, but I don't know how to make it work.

The game crashes specifically when I click on a button to change room. All of the objects are persistent.

sentences:
Game Server Framework / Engine that supports AMF? I am looking for a server technology that supports AMF (because I plan on using an as3/flash front end).

I would like to develop game logic / simulations that run on the server.  Small number of users and logic at first, but that will grow.

I might use this for some simple turn based / simple tests, but I am hoping this will also support some tougher real time (RTS) or even MMO style games and simulations.

So far I have been looking at (in order of what I think is most promising so far):

WebORB - Looks the most promising so far, appears to be well supported and developed, lots of features, yet sells itself as easy.  Looks like they have a community open source/free version

Cubeia Firebase - Looks really good, only thing that worries me is their statement that it does not work well for real time style games, but is ideal for turn-based.  It might be ok for now, but what if I need to scale the game up?   Open Source/Free

BlazeDS - Looks promising, supported by adobe, I should be able to develop game logic in the BlazeDS server and has amf support.   Open Source/Free

Red5 - No release since 2010, some activity though. (has amf)  Open Source/Free - however have not been able to locate any good 'game' examples / tutorials.

FlashMOG - looks interesting, but I am not sure if it is robust enough to act as an actual game server with continuously running logic.  No release since 2010,  Uses PHP as a socket server.  Open Source/Free

RedDwarf (used to be SGS/Project Darkstar) -- no release since 2010, is this active?  Has AS3 library, but it is out of date too?  Open Source/Free

Cirrus,
Wowza,
FMS - these are more of a media server?

SmartFox,
Electroserver - these are nice, but are not open source/free.  I believe they have limited connection versions available and while I am hoping to scale my project above those limitations I do not expect to be drawing an income to pay for the licenses at that point

LCDS (live cycle data services) - similar to blazeDS, not free

Any other options or clarifications??

sentences:
How can I tell how much video card memory I'm using? I want to programmatically determine at runtime how much video card memory is being used by my program.  Specifically I'm wondering about how to do it on a Windows machine using OpenGL, but am interested of ways to do it on other platforms as well.

I know there are utilities out there that will show me the memory usage as my program is running, but I want to be able to query that information from my code.

sentences:
toString() - method doesnt' choose right Array Index My topic is a adventure game. The heroes have Superpowers, but if I want to print the superpowers from a superhero, it prints just the last index of my array, which I set it before.

My code: `

public void createdTeam() {
    Superhero krieger = new Superhero("Thylraz");
    Superpower[] kriegerPowers = { new Superpower("Schwertwirbel\n", " Thylraz wirbelt mit seinem Schwert."),
            new Superpower("Schildschlag\n", " Thylraz schlägt den Zombie mit dem Schwert."),
            new Superpower("Durchschlag\n", " Thylraz macht einen Durchschlag!") };
    krieger.setSuperpowers(kriegerPowers);
    krieger.setHeroRole("Krieger");
    team.add(0, krieger);
    Superhero archer = new Superhero("Artemis");
    Superpower[] archerPowers = {
            new Superpower("gezielter Schuss", " Artemis versucht einen gezielten Schuss zu treffen."),
            new Superpower("Pfeilregen", " Artemis lässt Pfeile über den Zombie regnen!"),
            new Superpower("Falkenschlag", " Artemis ruft nach ihrer Falke!") };
    archer.setSuperpowers(archerPowers);
    archer.setHeroRole("Bogenschützin");
    team.add(1, archer);
    Superhero berserk = new Superhero("Adukan");
    Superpower[] berserkPowers = {
            new Superpower(" Elektroschlag", " Adukan lädt seine Äxte mit Elektrizität auf und schlägt zu!"),
            new Superpower(" Blutrausch",
                    " Adukan geriet in Blutrausch! Er haut auf sein Gegner mit voller Aggro!"),
            new Superpower(" Blutiger Schlag", " Adukan versucht einen tödlichen Schlag zu treffen!") };
    berserk.setSuperpowers(berserkPowers);
    berserk.setHeroRole("Berserker");
    team.add(2, berserk);
}

and my print method:

public void printOneSuperhero() {
    System.out.println("\nVon welchem Superhelden möchtest du die Daten sehen?\n");
    int index = selectSuperhero();
    System.out.println("=====================================================================================");
    System.out.println("Heldenname\tHeldenrolle\tHP-Max\tHP\tEXP\tKampfbereit\tlebendig\tFähigkeiten");
    System.out.println("=====================================================================================");
    System.out.println(team.get(index).toString());
    startMenu();
}

public class Superpower {
private String id = UUID.randomUUID().toString();
private static String superpowerName;
private static String actionDescription;

public Superpower(String superpowerName, String actionDescription) {
    this.superpowerName = superpowerName;
    this.actionDescription = actionDescription;
}
public String toString() {
         return "Skill: " + superpowerName + "\n" + "Beschreibung: " + actionDescription + "\n";

}

}

Edit:

public int selectSuperhero() {
int index = 0;
for (int i = 0; i < team.size();) {
    System.out.println("Position: " + (i++) + "" + team.get(index).print());
    index++;
}
index = scan.nextInt();
return index;

}

sentences:
Different number of lights => different shader I have a shader that computes lighting for each light.

PointLight PointLights[10];

uniform const float NumPointLights;

for(int i = 0; i < NumPointLights; i++)
{
lightVec = PointLights[i].Position - pos;
lightDist = length(lightVec);
    // Do other stuff with light here, etc.
}

If I set NumPointLights to 2, the loop still iterates 10 times, and discards the result of the last 8 iterations.

Should I set a compiler flag that will permit the loop to actually loop only 8 times, or should I make 10 shaders, a shader for each number of lights that can be rendered?

On some small pieces of geometry I occaisionally need 10 lights. 90% of the time I only need 1-2 lights. How do I proceed?

sentences:
How to derive euler angles from matrix or quaternion? Currently working on steering behavior for my AI and just hit a little mathematical bump.

I'm in the process of writing an align function, which basically tries to match the agent's orientation with a target orientation. I've got a good source material for implementing this behavior but it uses euler angles to calculate the rotational delta, acceleration, and so on. This is nice, however I store orientation as a quaternion and the math library I'm using doesn't provide any functionality for deriving the euler angles. But if it helps I also have rotational matrices at my disposal too.

What would be the best way to decompose the quaternion or rotational matrix to get the euler information?

I found one source for decomposing the matrix, but I'm not quite getting the correct results. I'm thinking it may be a difference of column/row ordering of my matrices but then again, math isn't my strong point. http://nghiaho.com/?page_id=846

sentences:
Swaying Camera when Walking You can see the effect in many games. The camera sways or wiggles a bit while walking to make the movement feel more realistic.

I have implemented a camera in my game. (Who'd have thunk it?) So is there a common approach to build this swaying effect in?

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:
Can't Transform.SetParent in Unity i have a problem that i don't understand why is happenning and it's driving me mad.
I'm trying to code a script to put the player in the car by disabling the third person controller and then Transform.SetParent.
Here's the code:

  public ThirdPersonCharacterControl Controller;
  public GameObject Player;
  public GameObject Car;

 public void PutWheel()
    {
        if(isInteractive)
        {
            if(isCar)
            {
                PlacePlaceables();
                Controller.enabled = false;
                Player.transform.SetParent(Car);
            }
        }
    }

The error is:

Assets/Scripts/Player/Interactible.cs(361,34): error CS1502: The best overloaded method match for `UnityEngine.Transform.SetParent(UnityEngine.Transform)' has some invalid arguments

Assets/Scripts/Player/Interactible.cs(361,44): error CS1503: Argument `#1' cannot convert `UnityEngine.GameObject' expression to type `UnityEngine.Transform'

Why is that happening? It doesn't make sense to me because everything seems correct.

sentences:
Limit Quaternion/vector3 axe in a certain interval I have some trouble to understand, and handle Quaternion and Vector3. I'm improving the tutorial Tank of Unity:

EDIT: Because a video explain so much better, there is a link to the 30 secondes video I made:
https://www.youtube.com/watch?v=nNrmlfbHNTI&feature=youtu.be

In the first part, the turret turn with restriction made with the both line newRotation.z = 0.0f; and newRotation.x = 0.0f; (see code bellow).

In the second part, I just comment this two line.

My probleme is: i want to be able to look up and down (like in the second part of the video, but with a DEPRESSION LIMIT (don't look too much high and too much down)

I try soo manny case and can't manage the thing i want to do...
there is the code of the script in ref to the Tank turret:

public float m_TurnSpeed = 8f;
private Transform m_Transform;
private int floorMask;
private float camRayLength = 100f;

void Awake()
{
    floorMask = LayerMask.GetMask ("Ground");
    m_Transform = GetComponent <Transform> ();
}

void FixedUpdate()
{
    Turning ();
}

void Turning()
{
    Ray camRay = Camera.main.ScreenPointToRay (Input.mousePosition);
    RaycastHit floorHit;

    if (Physics.Raycast (camRay, out floorHit, camRayLength, floorMask))
    {
        Vector3 playerToMouse = floorHit.point - transform.position;
        Quaternion newRotation = Quaternion.Slerp(m_Transform.rotation, Quaternion.LookRotation(playerToMouse), Time.deltaTime * m_TurnSpeed);

/////////////////////////////////////////////////////////////////////
////////// EDIT 2: probleme solved with the following line //////////
/////////////////////////////////////////////////////////////////////

        //block totaly Z and X quanta
        //newRotation.z = 0.0f;
        //newRotation.x = 0.0f;

        m_Transform.rotation = newRotation;

        float tmpX = m_Transform.localEulerAngles.x;
        if (tmpX > 20.0f && tmpX < 90.0f)
            tmpX = 20.0f;
        else if (tmpX < 315.0f && tmpX > 280.0f)
            tmpX = 315.0f;
        m_Transform.localEulerAngles = new Vector3(tmpX , m_Transform.localEulerAngles.y, 0.0f);
    }
}

Thanks !

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:
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:
What kind of steering behaviour or logic can I use to get mobiles to surround another? I'm using path finding in my game to lead a mob to another player (to pursue them). This works to get them overtop of the player, but I want them to stop slightly before their destination (so picking the penultimate node works fine).

However, when multiple mobs are pursuing the mobile they sometimes "stack on top of each other". What's the best way to avoid this? I don't want to treat the mobs as opaque and blocked (because they're not, you can walk through them) but I want the mobs to have some sense of structure.

Example:

Imagine that each snake guided itself to me and should surround "Setsuna". Notice how both snakes have chosen to prong me? This is not a strict requirement; even being slightly offset is okay. But they should "surround" Setsuna.

sentences:
Can someone explain Flappy Bird's physics to me? I am having a difficult time trying to understand the Flappy Bird physics. I know it seems simple but I kind of suck at math. I am trying to see if I can make a simple game like this but it is just the dang physics that are throwing me off. I have something like gravity effecting the bird but when you click the screen and I add some amount to the y position but it doesn't look good. You guys have any ideas?

Stuff like:

velocity += -9.8 * Gdx.graphics.getDeltaTime();
position.y += 0.5 * velocity;

That is falling but when I tap the device I would like to know how to add upward force but when it loses it continue falling.

sentences:
SDL_types.h file not found using xcode Getting this error when trying to use SDL_mixer...

SDL_types.h file not found..

I am including all the correct files as far as I can tell and have included the frameworks (both SDL and SDL_mixer) to my /systems/library/frameworks folder and it compiles well until I add SDL_mixer.h to my project. What should I do?

Here is main.cpp

#include <SDL/SDL.h>
#include "SDLMain.h"
#include "SDL_mixer.h"

int main(int argc, char ** argv)
{
    SDL_Init(SDL_INIT_EVERYTHING);
    Mix_Chunk song;
    //Initialize SDL_mixer
    if( Mix_OpenAudio( 22050, MIX_DEFAULT_FORMAT, 2, 4096 ) == -1 )
    {
        return false;
    }

    song = Mix_LoadWAV("song.wav");
    SDL_SetVideoMode(1000, 500, 32, SDL_SWSURFACE);
    SDL_Event event;
    bool done = false;
    while(!done)
    {
        while (SDL_PollEvent(&event))
        {
            if (event.type == SDL_QUIT)
            {
                done = true;
            }
            if (event.type == SDL_KEYDOWN)
            {
                if (event.key.keysym.sym == SDLK_UP)
                {
                    Mix_PlayChannel( -1, song, 0 );
                }
            }
        }
    }
    SDL_Quit();

    return 0;
}

Thanks

sentences: Implementing Skyrim's save system in Unity Unity has it's own way of saving in which you can add values and any type of information to the registry and it will be saved for future use. However what happens when you try to create a more complex save system such as the one featured in Skyrim. In this case it even get's a screenshot of the moment you pause the game to save and uses it to identify the save file. Also all the current actions the user and the npcs where doing at the moment gets save. How can I implement this complex save system into unity using it's current way of handling save data?

sentences:
Should I code game logic separately from game engine scripts I'm developing a game in Unity3d, economic strategy.
I wonder if I should code logic inside unity scripts, or write it as an external module/library?

By game logic I mean game model, which describe game entities, they relation with each other, their methods. And this logic has nothing to do with and doesn't need to know anything about networking, rendering, representation etc.

If I do it inside unity scripts, then logic is tied to unity engine and I don't see a way to implement multiplayer(client-server) without rewriting whole logic for server-side, where unity cannot be used.

I would like to define logic outside of scripts, and later, reference it inside some "main" unity script. This way I could implement multiplayer easily.

Is this a common practice, or should I avoid it, or maybe there is some alternative patterns?

sentences:
Alternate Answer for collision problem? I am building a top-down game in unity which works well. In this game, I have a 3D object (red cube) which a player has to control and there are other cubes like white, yellow and black cubes which spawns in the interval of 5 seconds. In each 5 seconds, prefabs of these three villain cubes instantiates and follows the player.

There is also a text that says yellow, black and white and changes constantly. For instance, the text is now white and it changes to black within certain interval of time and changes to white in certain interval of time (this is random) So, the player has to collide with the cube same as the the text otherwise the player will die.

Now, the problem is I have built the game just fine and can't get to deactivate player when the player hits the unrelated cube.

The script is(for instantiating:-)

public class ColorChecker : MonoBehaviour {
    public GameObject[] text;
    public int hold;

    public float startTime;
    public float startTimebtwSpawn;
    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {
        startTimebtwSpawn -= Time.deltaTime;
        if (startTimebtwSpawn <= 0) {
            startTimebtwSpawn = startTime;
            hold = Random.Range (1, 4);
        }
        if (hold == 1) {
            text [0].SetActive (true);
            text [1].SetActive (false);
            text [2].SetActive (false);

        } else if (hold == 2) {
            text [1].SetActive (true);
            text [0].SetActive (false);
            text [2].SetActive (false);

        } else if (hold == 3) {
            text [2].SetActive (true);
            text [0].SetActive (false);
            text [1].SetActive (false);
        }
}
}

The script for destroying the object is:-

public class DestroyCubes : MonoBehaviour {
    public ColorChecker colorchecker;
    // Use this for initialization
    void Start () {

    }

    void OnCollisionEnter (Collision col){
        if (colorchecker.hold == 1 && col.gameObject.tag == "CubicMonster1") {
            Destroy (col.gameObject);
        } else if (colorchecker.hold == 2 && col.gameObject.tag == "CubicMonster2") {

            Destroy (col.gameObject);
        } else if (col.gameObject.tag == "CubicMonster3" && colorchecker.hold == 3) {
            Destroy (col.gameObject);
        }

    }
}

Now, I can obviously check if it is unrelated by a long code like

if (colorchecker.hold == 1 && col.gameObject.tag == "CubicMonster2" && so on){

Destroy (gameObject);

}

Rather than writing a long if statement like this, Is there a better way that I can handle this ?

sentences:
Update sprite position when speed changes if frame rate is low I have a sprite moving horizontally from left to right. For each iteration I want to start decreasing the speed.
This works ok, and the sprite will stop at some point, however depending on the frame rate it won't always stop
at the same place. What's wrong with my code?

...
Vector2 Position;
Vector2 Speed;
...
Speed.X = 50;
...

public override void Update(GameTime theGameTime)
{
    float time = (float) theGameTime.ElapsedGameTime.TotalSeconds;

    Position += Speed * time;

    Speed.X-=10; // Reduce speed for next iteration
    if ( Speed.X < 0 ) Speed.X = 0;
}

I have also tried by doing

Speed.X-=10 * time;

but that didn't work.

sentences: 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:
GameObjects deleted before scene loads I am trying to persist objects on scene loading, but the objects always get deleted when the scene does load.

LevelManager.CS

public void LoadLevel(string name){
    if (name == "Main")
    {
        SceneManager.LoadSceneAsync(name);
        GameManager.LoadState();
    }
    else
    {
        GameManager.SaveState();
        SceneManager.LoadScene(name);
    }
    Debug.Log("the scene is: " + name);
}

I placed the LoadScene method ontop in the hopes it would complete loading the scene before moving onto the next method call.
In the next method call, I restore objects to their state.

GameManager.CS

public static void LoadState()
        {
            ES3.Load<Dictionary<Vector2, Building>>("Buildings");

            foreach(Vector2 v2 in buildingPositions.Keys)
            {
                Building b = buildingPositions[v2];

                if(b.GetType() == typeof(Farm))
                {
                    newFarm = Instantiate(farmPrefab) as Farm;
                    Debug.Log("Build: " + newFarm);
                    newFarm.transform.position = v2;
                    Debug.Log(newFarm.transform.position);
                    newFarm.level = b.level;
                    **//newFarm.name = b.name;**
                    newFarm.levelText = newFarm.GetComponentInChildren<Text>();
                }
            }

            CheckTheCall();
    }

What actually happens is when the scene is changed, the LoadState code is run at the same time, which then causes my object to be deleted after the scene has finished loading, because its created before the scene changes.

The third last line "newFarm.name = b.name" gives me an error that newFarm was destroyed. The last line "CheckTheCall()" calls newFarm (which I declare at the top of the script to ensure scope wasn't the issue) and that shows newFarm exists as a farm. THEN after all this, the scene changes, so my instantiated object is deleted.

I'm so confused I tried with just SceneManager.LoadScene(name) but the result is still the same. It's like the entire function completes and then the scene loads.

Any ideas on how to get around this one? I need the objects to spawn back into the main scene in the same state they were.

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:
Rotate spritesheet graphics in flixel I am using the flash flixel engine, and have a sprite sheet of a spaceship from top-down view. The sprite sheet includes a bunch of different states and animation frames. Problem is that I have drawn them all facing upwards (north), and my maths is all done assuming the sprites face to the right (east).

In flixel v2.5 is there a way to rotate the sprite graphics without affecting the "angle" property of the FlxSprite that is using the graphics? I was thinking along the lines of a pre-process, as I initialise everything. I don't really want to fix all the graphics, or hack into my maths at this point. This also might come in handy later.

sentences:
How to work with a scene objects in batchmode? I had an object in first scene, with DontDestroyOnLoad parameter. And when the second scene (void Start ()) loaded, I searched for this object through GameObject.Find(). But this function works only in graphical mode.

I can do this:

EditorSceneManager.OpenScene("Assets/Scenes/Main.unity");
GameObject go = GameObject.Find("TestObject");

But this will not work, engine will be searching only static objects (wich were originally on this scene).
Are there any options? Maybe I should use some additional parameters (I didnt find anything)

sentences:
Circle colliders dont work I have a destination and 2 players.

I want the players to reach the destination and not overlap in the process.

I attached to each player a circle 2D collider and a rigidbody 2D.

Also this script:

using UnityEngine;
using System.Collections;

public class Agent : MonoBehaviour {

    public Transform destination;
    private Vector2 destPostion;
    private Vector2 playerPosition;

    public float rotation = 0;

    Vector2 velocity = Vector2.zero;

    public int maxForce = 5; //rate of acceleration
    public int maxSpeed = 4; //grid squares / second

    //private Rigidbody2D rb;

    void Start () {
        //rb = gameObject.GetComponent<Rigidbody2D>();
        destPostion.x = destination.position.x;
        destPostion.y = destination.position.y;
    }

    // Update is called once per frame
    void FixedUpdate () {
        Vector3 temp = transform.position;
        destPostion.x = destination.position.x;
        destPostion.y = destination.position.y;

        playerPosition.x = transform.position.x;
        playerPosition.y = transform.position.y;
        //Work out the force for our behaviour
        var seek = steeringBehaviourSeek();

        //Apply the force
        velocity = velocity + (seek * Time.deltaTime);

        //Cap speed as required
        var speed = velocity.magnitude;
        if (speed > maxSpeed) {
            velocity = velocity * (4 / speed);
        }

        //Calculate our new movement angle
        rotation = Mathf.Atan2(velocity.x, -velocity.y) * 180 / Mathf.PI;
        transform.rotation = Quaternion.Euler(0, 0, rotation);

        playerPosition = playerPosition + (velocity * (Time.deltaTime));

        temp.x = playerPosition.x;
        temp.y = playerPosition.y;
        transform.position = temp;
        //rb.MovePosition(temp);
    }

    private Vector2 steeringBehaviourSeek() {

        //Desired change of location
        Vector2 desired = destPostion - playerPosition;

        //Desired velocity (move there at maximum speed)
        desired = desired * (maxSpeed / desired.magnitude);

        //The velocity change we want
        var velocityChange = desired - velocity;

        //Convert to a force
        return velocityChange * (maxForce / maxSpeed);
    }
}

The problem is they start moving for a bit and they stop.

Also in the scene when I move them with the mouse they overlap. Any ideas?

sentences:
Is there any way to change the layering of objects in Actionscript 3 without altering the run order? I'm making a simple platformer in Adobe Animate, and I need the player to be layered in front of the stage because of a gimmick in the game. Unfortunately, whenever I change the layering order, it also seems to change the order that AS3 runs the instances.

Is there any way to change the layering order without affecting the instance order, or vice-versa?

I'm only just starting with programming, so please bear in mind that I probably won't understand many of the technical terms.

Thanks in advance!

sentences:
Move a ball horizontally left and right but restricting forwards and backwards motion unity 2d I am trying to develop an endless runner where there is a sphere as the player and it is moving left and right following the position of a finger on a touch screen. However, when I try to do this I cannot get the player to lock on the Y-axis. I want a constant force that speeds up overtime which I have using the constant force 2d supplied by unity. I have two versions of code, the first follows the finger but the player is able to move up and down as well:

using UnityEngine;
using System.Collections;

public class Test : MonoBehaviour
{
    public GameObject character;
    public float speed = 500.0f;

    void Start()
    {
        Input.multiTouchEnabled = false;
    }

    void Update()
    {
        if (Input.touchCount == 1 && Input.GetTouch(0).phase == TouchPhase.Moved)
        {
            Vector2 target = Camera.main.ScreenToWorldPoint(
                              new Vector2(Input.mousePosition.x, Input.mousePosition.y));
            character.transform.Translate(Vector3.MoveTowards(character.transform.position,
                              target, speed * Time.deltaTime) - character.transform.position);
    }
}

The second code I have allows the player to move left and right by tapping rather than following but is still sloppy:

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

public class PlayerMovement : MonoBehaviour
{
    public Rigidbody2D rb;

    public float sidewaysForce = 500f;
    // Start is called before the first frame update
    void Start()
    {
        rb = GetComponent<Rigidbody2D>();
    }

    // Update is called once per frame
    void Update()
    {
        {
            foreach (Touch touch in Input.touches)
            {
                if (touch.position.x < Screen.width / 2)
                {
                    rb.velocity = new Vector2(sidewaysForce * -1, rb.velocity.y);
                }
                if (touch.position.x > Screen.width / 2)
                {
                    rb.velocity = new Vector2(sidewaysForce * +1, rb.velocity.y);
                }
            }
        }
    }
}

Any help on this would be awesome Thanks!!!

sentences:
How can I make the y extent height also to be random when instantiate new objects? With the script I instantiate random objects above the terrain. But the random was only on x and z. Now I want the height of the objects to be random as well.

The terrain position is: X = -250, Y = 0, Z = -250.

So I changed the line:

var y = Extents.y;

To:

var y = Random.Range(-Extents.y, Extents.y);

But now half of the objects above the terrain and half below the terrain, and I want them all to be above the terrain; thus the random height should be above the terrain.

My full code for reference:

using System;
using UnityEngine;
using Random = UnityEngine.Random;

[ExecuteInEditMode]
public class SphereBuilder : MonoBehaviour
{
    // for tracking properties change
    private Vector3 _extents;
    private int _sphereCount;
    private float _sphereSize;

    /// <summary>
    ///     How far to place spheres randomly.
    /// </summary>
    public Vector3 Extents;

    /// <summary>
    ///     How many spheres wanted.
    /// </summary>
    public int SphereCount;

    public float SphereSize;

    private GameObject parent;

    private void Start()
    {
        parent = GameObject.Find("Target Builder");
    }

    private void OnValidate()
    {
        // prevent wrong values to be entered
        Extents = new Vector3(Mathf.Max(0.0f, Extents.x), Mathf.Max(0.0f, Extents.y), Mathf.Max(0.0f, Extents.z));
        SphereCount = Mathf.Max(0, SphereCount);
        SphereSize = Mathf.Max(0.0f, SphereSize);
    }

    private void Reset()
    {
        Extents = new Vector3(250.0f, 20.0f, 250.0f);
        SphereCount = 100;
        SphereSize = 20.0f;
    }

    private void Update()
    {
        UpdateSpheres();
    }

    private void UpdateSpheres()
    {
        if (Extents == _extents && SphereCount == _sphereCount && Mathf.Approximately(SphereSize, _sphereSize))
            return;

        // cleanup
        var spheres = GameObject.FindGameObjectsWithTag("Target");
        foreach (var t in spheres)
        {
            if (Application.isEditor)
            {
                DestroyImmediate(t);
            }
            else
            {
                Destroy(t);
            }
        }

        var withTag = GameObject.FindWithTag("Terrain");
        if (withTag == null)
            throw new InvalidOperationException("Terrain not found");

        for (var i = 0; i < SphereCount; i++)
        {
            var o = GameObject.CreatePrimitive(PrimitiveType.Sphere);
            o.tag = "Target";
            o.transform.localScale = new Vector3(SphereSize, SphereSize, SphereSize);
            o.transform.parent = parent.transform;

            // get random position
            var x = Random.Range(-Extents.x, Extents.x);
            //var y = Extents.y; // sphere altitude relative to terrain below
            var y = Random.Range(-Extents.y, Extents.y);
            var z = Random.Range(-Extents.z, Extents.z);

            // now send a ray down terrain to adjust Y according terrain below
            var height = 10000.0f; // should be higher than highest terrain altitude
            var origin = new Vector3(x, height, z);
            var ray = new Ray(origin, Vector3.down);
            RaycastHit hit;
            var maxDistance = 20000.0f;
            var nameToLayer = LayerMask.NameToLayer("Terrain");
            var layerMask = 1 << nameToLayer;
            if (Physics.Raycast(ray, out hit, maxDistance, layerMask))
            {
                var distance = hit.distance;
                y = height - distance + y; // adjust
            }
            else
            {
                Debug.LogWarning("Terrain not hit, using default height !");
            }

            // place !
            o.transform.position = new Vector3(x, y, z);
        }

        _extents = Extents;
        _sphereCount = SphereCount;
        _sphereSize = SphereSize;
    }
}

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:
Unity setting rectTransform on an UI Image with a Vector3, do I need to convert coords? I am trying to build a menu with a cursor.  I created the menu and that in the unity UICamera on the canvas.  It looks great.  I want the cursor to move so what I did was move the cursor by hand and record the values at each location I want the cursor to possibly be (see attached).  The problem is later when I try to set the value to these via this:

pauseCursor.rectTransform.position = new Vector3 (-45f, -80.6f, 0);

It fails and looking in the inspector again the x,y values are like 300, 800 or something.  I am guessing I need a conversion I just am not sure where or how.
Do I get the Ui camera reference and use the WorldToScreen?

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:
Libgdx: scrolling background for preview screen Good day, I have been coding for quite a while now and I'm at a certain point where I am having difficulties on solving something. I've been creating a preview screen which contains the following:

reads .txt file and stores them in an array which will be displayed on the screen.
the text will have an animation which will be moving upwards like a Star Wars type of intro.
the background of the screen will also move upwards.

The problems that I have encountered are the following:

my text did not fit on the screen, but I did try to change the font and the font size and also did change the spacing in the .txt file.
the text always starts in the middle of the screen which it should start at the bottom of the screen.
the background is buggy, tried to debug it but still can find a solution for a parallaxbackground(scrolling background)

and here is the code.

public class PreviewScreen implements Screen {

    private static DugManMainClass game;
    private SpriteBatch batch;
    private OrthographicCamera camera;
    private Texture tx1 = Assets.bgmenu;
    private BitmapFont font = Assets.menufont2;
    private final static List<String> lines = new ArrayList<String>();
    private static int time = 0;
    private float temp = 0;
    private Sprite s;

    public PreviewScreen(DugManMainClass game) {

        this.game = game;

        //reads .txt file and stores them in an array

        try
        {
            BufferedReader br = new BufferedReader(new InputStreamReader(Gdx.files.internal("previewtext.txt").read()));
            String line = "";
            while ((line = br.readLine()) != null) {
                lines.add(line);
            }
            br.close();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }

    @Override
    public void render(float delta) {

        float w = s.getHeight();

        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        //temp is a timer which will do the animation effect for the text and background
        temp += Gdx.graphics.getDeltaTime();

        while(temp>1.0f/60.0f)
        {
            PreviewScreen.tick();
            temp -=1.0f/60.0f;

            //here is my problem for the background

            s.setU(temp+1f);
            s.setU2(temp+1f);

        }

        batch.setProjectionMatrix(camera.combined);
        batch.begin();
        s.draw(batch);

// i commented this out because i waited to draw my sprite which is the background text(parallaxbackground)
//      batch.draw(s, 0, -(temp / 10 % w));
//      batch.draw(s, 0, -(temp / 10 % w) + w);

        int yo = time / 4;

        //this is where the the text problem is
        for (int y = 0; y <= 420 / 12; y++)
        {
            int yl = yo / 12 + 420 / 12 - y;
            if (yl >= 0 && yl < lines.size())
            {
                font.draw(batch,lines.get(yl), (800 - 30 * 12) / 2,  y * 12 + yo % 12);
            }
        }

        batch.end();

    }

    @Override
    public void resize(int width, int height) {}

    @Override
    public void show() {

        batch = new SpriteBatch();

        float w = 800;
        float h = 420;

        camera = new OrthographicCamera();
        camera.setToOrtho(false, w, h);

        tx1.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);

        s = new Sprite(tx1);
        s.setPosition(0, 0);

        Assets.bgsound3.play(1f);

    }

    @Override
    public void dispose() {
        Assets.dispose();
    }

    public static void tick() {
        time++;

        if (Gdx.input.isKeyPressed(Keys.ENTER) || Gdx.input.isTouched()) {
            game.setScreen(new MainMenuScreen(game));
            Assets.bgsound3.stop();
        }

        if (time / 4 > lines.size() * 10 + 250) {

            game.setScreen(new MainMenuScreen(game));
            Assets.bgsound3.stop();
        }
    }

}

sentences: 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:
How can I get the Text component from TextMeshPro ? I'm getting null exception At the top of the screen :
public GameObject uiSceneText;
private TextMeshPro textMeshPro;

Then in the script at some point :
uiSceneText.SetActive(true);

if (textMeshPro.text != "")
    textMeshPro.text = "";

The exception error null is on the textMeshPro on the line :
if (textMeshPro.text != "")

textMeshPro is null.
This screenshot shows the TextMeshPro in the Hierarchy :

and I see that the Scene Image object and its child Scene Text both are enabled true.
I want to get the text and add replace a new text with the text already in the Text but the textMeshPro is null.
The complete script :
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;

public class PlayerSpaceshipAreaColliding : MonoBehaviour
{
    public float rotationSpeed;
    public float movingSpeed;
    public float secondsToRotate;
    public GameObject uiSceneText;

    private float timeElapsed = 0;
    private float lerpDuration = 3;
    private float startValue = 1;
    private float endValue = 0;
    private float valueToLerp = 0;
    private Animator playerAnimator;
    private bool exitSpaceShipSurroundingArea = false;
    private bool slowd = true;
    private TextMeshPro textMeshPro;

    // Start is called before the first frame update
    void Start()
    {
        textMeshPro = uiSceneText.GetComponent<TextMeshPro>();

        playerAnimator = GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update()
    {
        if (exitSpaceShipSurroundingArea)
        {
            if (slowd)
                SlowDown();

            if (playerAnimator.GetFloat("Forward") == 0)
            {
                slowd = false;

                LockController.PlayerLockState(false);

                uiSceneText.SetActive(true);

                if (textMeshPro.text != "")
                    textMeshPro.text = "";

                textMeshPro.text = "Here I will add the new text.";

            }

            if (slowd == false)
            {

            }
        }
    }

    private void OnTriggerEnter(Collider other)
    {
        if (other.name == "CrashLandedShipUpDown")
        {
            exitSpaceShipSurroundingArea = false;
            Debug.Log("Entered Spaceship Area !");
        }
    }

    private void OnTriggerExit(Collider other)
    {
        if (other.name == "CrashLandedShipUpDown")
        {
            exitSpaceShipSurroundingArea = true;
            Debug.Log("Exited Spaceship Area !");
        }
    }

    private void SlowDown()
    {
        if (timeElapsed < lerpDuration)
        {
            valueToLerp = Mathf.Lerp(startValue, endValue, timeElapsed / lerpDuration);
            playerAnimator.SetFloat("Forward", valueToLerp);
            timeElapsed += Time.deltaTime;
        }

        playerAnimator.SetFloat("Forward", valueToLerp);
        valueToLerp = 0;
    }
}

sentences:
AS3 Rect-Rect Collision Basically, my game has the player's attack hitbox change based on the attack being performed. I tried to make a simple collision test that takes an enemy's coordinates and have it check to see if it's within the range of the player. I don't want to resort to using Sprites and use hitTest() since efficiency is an issue. Anyway, the problem lies in the fact that the function below always returns true (even when the player is nowhere near the enemy).

private function quickHitTest(boxLeft:int, boxRight:int, boxTop:int, boxBottom:int, rangeWidth:int, rangeHeight:int):Boolean

return ((boxLeft > (300 - (rangeWidth/2)) && (boxBottom > (450 + (rangeHeight / 2)) || boxTop < (450 - (rangeHeight / 2)))) || (boxRight < (300 + (rangeWidth/2)) && (boxBottom > (450 + (rangeHeight / 2)) || boxTop < (450 - (rangeHeight / 2)))));

I having difficulties finding the source of the problem. All help is appreciated.

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:
Blender Object Appearing Gray when all Lights are Off I have an issue with Blender where, when I turn my only light off (a sun lamp) and render the image my object appears gray rather than black (and thus, not appear to the camera).  I can't figure out why this is happening.

Here's what I just did in my scene:

Added a new UV Sphere mesh (to make a total of two spheres), made it visible to the camera, turned off the sun lamp (by setting energy to 0), and rendered.  The result I obtained is below.

I discovered this when attempting to render the first sphere with a material/texture on it and it was too bright.  The material on the spheres (which are different) are very basic, there's no emit, diffuse and specular are at default values.  Could there be an issue with the way my camera is setup?  Thanks in advance!

sentences:
How to save a game state? So I am currently working on a simple game project that most people start of with: "breakout". part of my goal is to make a gamesave of the current gamestate the simplest way possible.

For example, lets say I lose the game or I want to exit the game. Then later, I want to reload the gamestate to the same position of the paddle, ball and bricks. The only problem is I have multiple forms and I just want to save this specific form in its specific state.

I have an idea on how to approach (I would find a way to save the position of the paddle, ball and the bricks and that exact time) just I have no clue how I would execute it.
How can I achieve this?

sentences: Field of view settings for first person shooter Are there any industry standards for setting the field of view (FOV) for FPS games or is it solely based on trial and error? Are there any guidelines for choosing the correct value?

sentences:
Add Atten property in Unity Shaderlab In Unity Shaderlab shader, Is there any way to apply _Atten value?
Using surface shader, and vertex/fragment shader I can do it easily.
But, I didn't find any reference to do that in Shaderlab syntax.

Shader "Diffuse" {
    Properties {
        _Atten ("Light Attenuation Power", Float) = 1.0 // <= how to apply?
        _Color ("Main Color", Color)            = (1,1,1,1)
        _MainTex ("Base (RGB) Transparency (A)", 2D) = "" {}
    }
    SubShader {
        Pass {
            SetTexture[_MainTex]
            {
                  constantColor [_Color]
                combine texture * constant, texture * constant
            }
        }
    }
}

this makes syntax error.

constantColor [_Atten * _Color]

sentences:
How to use the chipmunk physics-engine? I am developing a game demo where I want a physics simulation with balls and obstacles.

I know that this is possible with the chipmunk physics-engine but I don't know how to use it. Can anybody give me suggestions how to get started and provide links to the API documentation?

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

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

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

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

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

sentences:
Real Time vs Turn Based (XNA) What is a more difficult type of game to develop on XNA: A Real Time multiplayer game or a Turn Based multiplayer game? (not client server or peer to peer, just in general)

Any links to articles would be greatly appreciated!

sentences: Why are normal maps in tangent space but not in normal space? I want to implement normal mapping in my little game engine. When getting into normal mapping, I wonder why normal maps are typically in tangent space but not in normal space? That normal maps in object space would be complicated to handle is clear to me. But when in normal space, they could be easily added to the vertex normal, couldn't they? It seems that tangent space requires to construct a transformations matrix for each pixel.

sentences:
Unity Controller navigating UI I want players to be able to use a controller to navigate our game's menus. We use Unity's new UI, and in the EventSystem have specified a controller axis for our vertical axis. However the selection from the controller is extremely sticky. The joystick must be held down for a second in order for it to move its selected item down.

I've tried fooling around with the Gravity, Dead and Sensitivty levels but haven't found anything suitable. Could someone recommend some standard settings so the input is not stick7?

I've been using a Xbox controller with a wireless adapter for PC as my controller.

sentences:
Debugging-Setting Consoles in Games Right now I have the graphical and input portions of a console for my game (command parsing hasn't been implemented yet). I was wondering how you would go about making changes to properties in game objects. For example, if I typed in the console:

skeletonMonster maxHP 20

That would change all of the existing in-game skeletons' max hit points to 20. After you parse this information what are some ways to change the value? How can I change the that member variable without directly accessing it (by making it public/global)?

I'd like to implement this so I don't have to change variables in the code and recompile every time while playtesting.

sentences:
How can I design the environments in my game to be memorable and unique? I've always been a fan of the Metroid series, and more generally nowadays, the metroidvania genre. One thing that I've loved, and most others have praised highly, are the unique and diverse environments and levels you can find in such games. Being able to tell exactly what room someone is in from a simple screenshot is a prime staple to such things.

I have been working on a 2D metroidvania game that's intended to be kind of my personal tribute to the genre, but I feel like I may have put myself in a bit of a corner conceptually. The game takes place on a barren, lifeless planet that's being harvested for resources by a sprawling autonomous mining/factory complex. Throughout the game, you travel throughout the complex, visiting each of the sites that make it up and gaining upgrades to become powerful enough to take down the AI at the center of it all (yeah, original, I know).

So, the conceptual corner... I'll be blunt. As you can probably tell from the title, and the setup in the first paragraph, I'm seriously worried that the areas in my game are going to feel too "same-y" and repetitive. I mean, and it's justified too: my selections of environments are "lifeless, rocky landscape", "lifeless, rocky caves", and "industrial metal corridors", and my selection of enemies consists of "robots", "more robots", and "different, bigger robots". I mean, it's hard to have different environments when the setting you're in has no life to support an "environment". But, I know it can be pulled off. Just look at Hero Core. It manages to pull off distinct and unique areas with much of the same restrictions I have, and with only just two colors to boot!

In closing, and yes, this is just basically an expanded restatement of the title, what are some things I can do to make the areas in my game feel markedly distinct from eachother, despite most of them having a common overarching aesthetic?

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:
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:
Algorithm for procedureral 2D map with connected paths Problem to solve: Generate a random 2D dungeon map for a tile-based game where all rooms are connected.

I am looking for better solutions than what I currently have.

My current solution is that I run two algorithms. The first generates the dungeon with its rooms. The second make sure that all rooms are connected. I am curious what other soltions may exist. Faster and / or easier etc. Speed is not really a concern, but if speed can be gained at no real cost, well, that is a good thing. More important is that I, and others that read, may learn different ways to approach and solve the problem.

Below are my current implementation. Rooms currently have no exits or exits in any 2, 3 or 4 directions.

Generating the dungeon rooms

Setup: Set the current room to the top left room.

Get a valid room type for the room (where valid room type is a type with no exits out of the dungeon and that have exits that matches the exits of the room above and the room to the left. Only need to check above and to the left due to step 2 below).
Put down the room and advance the x-coordinate one step. If the x-coordinate exceeds the dungeon width, set the x-coordinate to 0 and advance the y-coordinate one step. If the y-coordinate exceeds the dungeon height, we are done.
Repeat from #1.

I then check to see if all rooms are connected If they are not all connected I run a second algorithm that, in a non-sexy but definately good enough way in terms of dungeon layout, goes through the rooms and change them so that all end up being connected.

Checking to see if all rooms are connected

Setup: Create a 2D map of integers representing paths and initialize the entries to a "unprocessed" (not yet traversed) value, -1. Set a start path index integer that keeps track of the current path to 1. Set the current room to the top left room by adding it to a stack of rooms to check.

If the stack contains rooms to check, pop it set the path index of the room to the current path index. If the stack does not contain any rooms, increase the path index and try to get a room by advancing column by column, row by row, until we get a room that has not been processed yet. If no room can be found, we are done.
Check to see if the room has an exit to the left. If it has add the left room to the stack if it is not already on there.
Repeat step 2 for down, right and top directions (since we are using a stack that means the rooms are traversed in clockwise order, starting with the top direction).
Repeat from step 1.
If the path indices count is greater than one, there are disconnected rooms.

If there are disconnected rooms I then group the rooms by their path index, get the index of the biggest path and connect all other rooms to those rooms. This is a work in progress, but my (current, "brutish") plan is to go through each room in a room group (except the first) check to see if there is a horizontal or vertical path to the biggeset room group, and if so, create a horizontal / vertical path there by injecting / updating the rooms inbetween. Rinse and repeat. Ugly, yes, but it is something that will not be noticable in terms of visual pattern so it works in that sense.

sentences:
Sprite sheets, Clamp or Wrap? I'm using a combination of sprite sheets for well, sprites and individual textures for infinite tiling.

For the tiling textures I'm obviously using Wrap to draw the entire surface in one call but up until now I've been making a seperate batch using Clamp for drawing sprites from the sprite sheets. The sprite sheets include a border (repeating the edge pixels of each sprite) and my code uses the correct source coordinates for sprites.

But since I'm never giving coordinates outside of the texture when drawing sprites (and indeed the border exists to prevent bleed over when filtering) it's struck me that I'd be better off just using Wrap so that I can combine everything into one batch.

I just want to be sure that I haven't overlooked something obvious. Is there any reason that Wrap would be harmful when used with a sprite sheet?

sentences:
Android developer/publisher royalty sharing I am creating and Android game, and will need to partner with a publisher. I am curious about how this is typically implemented. Probably publishers are going to have a difficult time trusting some developer that they don't know to pay them, assuming the develop puts the game up on Google Play. So will the publisher want the apk file so that they can put it up on Google Play themselves?
Or does Google Play have a mechanism where the royalties can be automatically split between two parties from sales/IAP?
I know that all contracts will be different and it will depend, but I'm just looking to get a general idea of what is usual/typical.

sentences:
How to make this game loop deterministic I am using the following game loop for my pacman clone:

long prevTime = System.currentTimeMillis();
        while (running) {
            long curTime = System.currentTimeMillis();
            float frameTime = (curTime - prevTime) / 1000f;
            prevTime = curTime;

            while (frameTime > 0.0f) {
                final float deltaTime = Math.min(frameTime, TIME_STEP);
                update(deltaTime);
                frameTime -= deltaTime;
            }

            repaint();
        }

The thing is, I don't always get the same ghost movement every time I run the game (their logic is deterministic), so it must be the game loop. I imagine it's due to the final float deltaTime = Math.min(frameTime, TIME_STEP); line. What's the best way of modifying this to perform the exact same way every time I run it? Also, any further improvements I can make?

sentences: What is the best and simplest way to get input text from user in an OpenGL app? I have an OpenGL game and and I want to implement a simple way for the user to enter data/text in an input box. What is the easiest method to do this?

sentences:
Stop rendering hidden objects libgdx I currently am hiding objects that are not in the frustums view.
However, some objects are still being rendered that are in the frustums view, but are hidden. My goal is to not render objects that won't be seen at all rather than not render objects that are in the POV but are hidden.

Let me better explain.

There are three boxes, Box A, Box B, and Box C.
They are all aligned in the x axis, However, Box C has a greater y value than the rest of the boxes. Well if I'm looking straight towards Box C, I will only see Box C. But Box A and Box B are still being rendered.

I want to know if there is a method that I can use to not render objects that are hidden behind other objects.

Thanks in advanced,
Jedi.

sentences:
Unity - Exporting and Importing Terrains To provide modding support via Unity editor, I need to export terrains in editor and load the exported terrain in runtime.

Is this possible by any manner?

sentences:
How can I implement an inventory that stores different types of items? Let’s assume I want to create an RPG with collectible items my character can pick up and store in his inventory.

One item could be a sword, with an attack, defense, and level attributes.

Another item could be an apple, heal percentage, freshness, and servings attributes.

Both items are collectible items, and both objects can be stored in the players inventory, but they share separate sets of attributes.

I am trying to think of a way to set this up in the database. I originally looked to the EAV database model, so I could define a single collectible item entity, and bolt on separate attributes as I needed them, but I discovered EAV is slow because of multiple calls to the database to construct an entity, which wouldn't make it very suitable for a game in my eyes.

I also can't find any game development tutorials that use EAV, so there must be a more common solution I'm not aware of.

sentences:
Collision works except for when coming from right side I am trying to make a bomberman clone. I'm having problems with the collision on the walls that is not on the sides of the map (see image). When I come from the right (going left), the red square (player) goes through the wall but when I come from other sides (up, left, down) the collision works well and the player does not go through. The collision on the side walls works well also even when I come from the right and going left.

I am using Tiled and LibGDX and here is the code:

private void checkCollision(float delta) {
    //player.getVelocity().scl(delta);
    Vector2 position = player.getPosition();

    // just to see if it overlaps because this is the location of the
    // rectangle when getTiles is called when player moves left as shown in the image
    Rectangle rect = new Rectangle(128, 128, 64, 64);
    if(player.getRectangle().overlaps(rect)) {
        System.err.println("overlap");
    }

    if(player.isMovingRight()) {
        Array<Rectangle> tiles = getTiles((int)(position.x/TILE_SIZE + 1), (int)(position.y/TILE_SIZE - 1),
                (int)(position.x/TILE_SIZE + 1), (int)(position.y/TILE_SIZE + 1));
        for (Rectangle tile : tiles) {

            if(player.getRectangle().overlaps(tile)) {
                System.out.println("overlap right");
                player.setPosition(tile.x - player.getWidth() , player.getPosition().y);
            }
        }
    }
    if(player.isMovingLeft()) {
        Array<Rectangle> tiles = getTiles((int)(position.x/TILE_SIZE - 1), (int)(position.y/TILE_SIZE - 1),
                (int)(position.x/TILE_SIZE - 1),  (int)(position.y/TILE_SIZE + 1));
        for (Rectangle tile : tiles) {

            if(player.getRectangle().overlaps(tile)) {
                System.out.println("overlap left"); // this doesn't show
                player.setPosition(tile.x + tile.width, player.getPosition().y);
            }
        }
    }

    if(player.isMovingUp()) {
        Array<Rectangle> tiles = getTiles((int)(position.x/TILE_SIZE - 1), (int)(position.y/TILE_SIZE - 1),
                (int)(position.x/TILE_SIZE + 1), (int)(position.y/TILE_SIZE));
        for (Rectangle tile : tiles) {

            if(player.getRectangle().overlaps(tile)) {
                System.out.println("overlap up");
                player.setPosition(player.getPosition().x, tile.y + tile.height);
            }
        }
    }
    if(player.isMovingDown()) {
        Array<Rectangle> tiles = getTiles((int)(position.x/TILE_SIZE - 1), (int)(position.y/TILE_SIZE + 1),
                (int)(position.x/TILE_SIZE + 1), (int)(position.y/TILE_SIZE + 1));
        for (Rectangle tile : tiles) {

            if(player.getRectangle().overlaps(tile)) {
                System.out.println("overlap down");
                player.setPosition(player.getPosition().x, tile.y - player.getHeight());
            }
        }
    }

    //player.getVelocity().scl(1/delta);

}

private Array<Rectangle> getTiles(int startX, int startY, int endX, int endY) {
    TiledMapTileLayer layer = (TiledMapTileLayer)level.getMap().getLayers().get(1);
    Array<Rectangle> rectangles = new Array<Rectangle>();
    for (int x = startX; x <= endX; x++) {
        for (int y = startY; y <= endY; y++) {
            Cell cell = layer.getCell(x, y);
            if(cell != null) {
                Rectangle rect = new Rectangle(x*TILE_SIZE, y*TILE_SIZE, TILE_SIZE, TILE_SIZE);
                rectangles.add(rect);
            }
        }
    }
    return rectangles;
}

sentences:
How 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:
read in an xml server from Unity3D 4.xx I need examples of how to read an xml from a server, using Unity3D..

I think it's something like this.. but I can not retrieve the information from the nodes..

An example would be of great help..
thank you..

var url = "http://server.com/test2.xml";

var www : WWW = new WWW (url);
  yield www;

var xml : XmlDocument = new XmlDocument();

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:
What is causing my skybox texturing issue? I am using the NVIDIA cubemap tool to generate my .dds file in Photoshop but I am unexpected results when the texture is loaded into my application.

I'm unsure as to whether this is caused by my code, or the texture generation in Photoshop. Does anyone know why this is happening?

The texture is being applied to a sphere and it seems to only be stretching down the centre of the sphere, the rest is ok.

The code I am using to generate the resource view

D3DX11_IMAGE_LOAD_INFO loadSMInfo;
    loadSMInfo.MiscFlags = D3D11_RESOURCE_MISC_TEXTURECUBE;
    loadSMInfo.BindFlags = D3DX11_DEFAULT;
    loadSMInfo.Depth = D3DX11_DEFAULT;
    loadSMInfo.Filter = D3DX11_DEFAULT;
    loadSMInfo.FirstMipLevel = D3DX11_DEFAULT;
    loadSMInfo.MipFilter = D3DX11_DEFAULT;
    loadSMInfo.MipLevels = D3DX11_DEFAULT;

    ID3D11Texture2D* SMTexture = 0;
    hr = D3DX11CreateTextureFromFile(_pd3dDevice, L"assets/textures/skybox/sky.dds",
        &loadSMInfo, 0, (ID3D11Resource**)&SMTexture, 0);

    D3D11_TEXTURE2D_DESC SMTextureDesc;
    SMTexture->GetDesc(&SMTextureDesc);

    D3D11_SHADER_RESOURCE_VIEW_DESC SMViewDesc;
    SMViewDesc.Format = SMTextureDesc.Format;
    SMViewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE;
    SMViewDesc.TextureCube.MipLevels = SMTextureDesc.MipLevels;
    SMViewDesc.TextureCube.MostDetailedMip = 0;

    ID3D11ShaderResourceView * smrv;
    hr = _pd3dDevice->CreateShaderResourceView(SMTexture, &SMViewDesc, &fullcubemap);

Edit: I have changed the sphere to a cube and the texture is looking better quality on two of the faces, but the other faces are stretched and distorted. I'm going to try another texture.

https://i.gyazo.com/6d4556bd79b0e3adce156e631fb2f514.mp4

Edit: I believe the problem is in my shader, forgetting to set the w value on the position to 1.0f.

https://i.gyazo.com/e1fd41679e2257920aebff8d4c766118.mp4

Perhaps the only problem left is a wrong texture image?

sentences:
Detect collision point I'm writing a 3D rigid body physics engine, I am using OpenGl for simulation.

Only convex objects are considered.

My question involves how to detect the point of collision, so that when I apply a response force, I can also calculate torque.

I have used SAT algorithm to detect collision according to this reference,

Everything seems to be work fine , But as i get SAT only gives for objects are they colliding? as well as by how much?, it does NOT give you a reference point at which to apply the response force (and thus calculate torque).

I have looked at

Resource 1

Resource 2

Resource 1

None of them seems to be an answer

sentences:
How can set vibration option with my game in android? I am using AndEngine to develop an Android game and I want vibration to be triggered when an enemy hits a player.

How can I implement this into my game?

sentences:
Art Style Guide - External Image Sources? I've been looking into how to structure an art style guide (ASG); it's a document which helps guide artists how a project's visuals should look. They often have sketches and illustrations from artists working on the project, though I am unsure about using external images.

I am working on a commercial videogame project and I have been writing both a game design document (GDD) and currently an art style guide. Is it legal for me to add artwork I came across while browsing the internet into the ASG? I know that most artists can add external images outside of their project into a section talking about inspirations, but could this be done for areas that loosely talk about, say, an overall aesthetic of something, such as creature or environment design?

For example, say I have a section which talks about the design of fantasy monsters in a chapter about characters. Would it be legally viable to use various images I come across to help show artists what I'm looking for in each creature? I'm guessing that it is legally viable because I don't think I'd be profiting off of an ASG. I hope somebody could verify this for me; I don't want to cause any trouble.

I apologize for making this a bit wordy; I wish I knew how to articulate myself better.

sentences:
Is good practice to optimize FPS even when it's above the lower limit to give illusion of movement? I started over 50 FPS on the iPhone, but now I'm bellow 30 PFS, I've seen most iPhone games clamped to either 60 or 30 FPS, even when 24 or less would give the illusion of movement.

I've concidered my limit to be a little bit over 15 FPS, in fact my physics simulation is updated at that rate (15.84 steps/s) as that is the lowest that still give fluid movement, a bit lower gives jerky motion.

Is there a practical reason why to clamp FPS way above the lower limit?

Update:

The following image could help to clarify

I can independently set the physic simulation step, frame rate, and simulation interval update.

My concern is why should I clamp any of those to values greater than the minimum?

For instance to conserve battery life I could just to choose the lower limits, but it seems that 60 or 30 FPS are the most used values.

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:
first person character controller error I have opened new scene, deleted camera and imported first person character controller from Standard assets.
I placed plane on scene and put first person character controller on plane.

I got this error:

  Assets/Standard Assets/Characters/FirstPersonCharacter/Scripts/RigidbodyFirstPersonController.cs(3,27): error CS0234: The type or namespace name CrossPlatformInput' does not exist in the namespaceUnityStandardAssets'. Are you missing an assembly reference?

How to fix it?

sentences:
Conveying a claustrophobic atmosphere in cavalier oblique projection I need your collaborative knowledge in finding the best way to graphically represent a scene in a manner that would suit a SNES-era rôle-playing game. I've chosen to represent the game in what I'm informed is called "cavalier oblique" projection, which is the same sort of perspective employed in titles like EarthBound:

Wherein articles' fronts and one side are shown, but characters face the camera head-on. For as much reason as anything, this is to avoid the "top-down" view employed by 300% of RPG Maker titles. I don't want to look like a "me-too" player.

The scenario

In the title, the player character has their return path blocked off, with the only path to progression being one leading through a series of very tight-fitting caves. The claustrophobia of the area is  very important, as it's one of the main sources of suspense to which the player is subjected.

The problem

I can't think of a single way to display claustrophobic, branching caves with dead-ends and very tight holes in the projection I've displayed above. There are a few works-around I can think of that revolve around changing the projection (either to a first-person view, which will be immensely difficult to navigate, or to a side-on view like Dig Dug, which is more intended to show branching paths across a y axis as opposed to an x axis) - doing this risks appearing jarring to the player, however, and I'm aiming for immersion above all else.

I ask you, GD - can you think of any such scenarios from your favourite retro games, and how did they display them to the player? Any reference I can get for a successful execution will be immensely appreciated.

sentences:
SAT - How to find Shortest line between two static convex 2D Polygons? RI have a pretty standard SAT algorithm that seems to successfully be detecting collisions but now I am looking for some assistance in finding the shortest line between 2 separated Polygons.

I have spent quite a bit of time searching and trying things with no success.
If someone could point me in the correct direction or give a solution to this I would be most greatful.

While a general n polygon vs n polygon solution would be awesome my use case only requires OBB vs OBB. This could simplify the answer.

sentences:
Allocator error in Unity Suddenly, a wierd error started to come up in my console saying
More than 2048 allocators are registered. Reduce the allocator count.
This error leads to freezing of editor.

sentences: $0.99 or Free with Virtual goods - Revenue Model for mobile games I'm trying to decide between a paid game and a free to play game. Is there research on the pros and cons of each one. I would really appreciate some concrete data on this and not just opinions. This is for mobile (currently iOS with Android later) game.

sentences:
How to make a noise gradient? Introduction:

I am working on a heat map made by Perlin Noise with the next result:

(Figure 1)

                  *(Red means really hot and light blue is colder)*

The algorithm identifies that mountains are colder at their top and plains vary between warm and hot(randomly, there is no physics behind).

QUESTION:

How can i do so that heat map i generated with Perlin Noise looks like this example:

(Figure 2)

where the temperature variations follows something like Earths equator.

My Ideas:

I thought about divide the map manually (from height to height2 is hot and so on...) but i do not like that idea as i want something more dynamic (temperatures may vary so does the heat map)

What i am asking?

Is there any better solution to this idea i had?

Thanks for your interest in this question.

EDIT:

With the code below i made possible the next thing:

public static Texture2D GetAirTemperature(int width, int height, Tiles[,] tiles)
{
    var texture = new Texture2D(width, height);
    var pixels = new Color[width * height];

    for (var x = 0; x < width; x++)
    {
        for (var y = 0; y < height; y++)
        {
            if (y <= 5 || y >= 95)
            {
                pixels[x + y * width] = Coldest;
            }
            else if (y <= 15 || y >= 85)
            {
                pixels[x + y * width] = Colder;
            }
            else if (y <= 30 || y >= 70)
            {
                pixels[x + y * width] = Warm;
            }
            else if (y <= 45 || y >= 55)
            {
                pixels[x + y * width] = Warmer;
            }
            else { pixels[x + y * width] = Warmest; }
        }
    }

    texture.SetPixels(pixels);
    texture.wrapMode = TextureWrapMode.Clamp;
    texture.Apply();
    return texture;
}

and obtaining the next result:

(Figure 3)

How i could multiply/modulate/something it by my Perlin noise so i get something irregular but looks a like Earths Equator?

Because you cannot do like Texture2D * Texture2D (multiply textures)

EDIT2:

What if, instead of using noise, i create my own 2D air temperature map as a starting point?
I mean, my own matrix [width*height].

Temperature will have the input given at the center of matrix (equator) and then, when update the temperature map (a cycle).

A cycle will go once in a while (periodically) to simulate temperature changes.

The input from the sun at the equator [(width/2)x(height/2)] will move outwards from the center into "north and south the matrix" (North is x, y < 50 && south is x,y > 50)

That means i have to check each row and number above and under the equator while maintaining energy conservation and other factors.

It is nice on paper but a hell in coding. Do you have any other idea to accomplish something similar to figure 3?

sentences: Most efficient way to optimize based on gpu type? So, I'm writing an optimization button that should optimize a game based on the type of hardware the user has. I know I can use d3dadapter_identifier9 to achieve this, but what would be the most efficient way of actually implementing it? Not sure whether i should check based on deviceid, name, etc. was hoping someone could give me a couple tips for that. Thanks in advance.

sentences:
SDL text or additional images not loading I've got a basic side scroller that allows the user to run and jump around. I've used various tutorials to get this far, but I can't seem to get any text to render, no matter what method. I also can't get any images to render outside of my draw() function which is rendered at run time, which I think is my problem. (Is it possible to recall the function again to load another image?)

I can't just give a line of code to show the issue since the whole program is interwoven together:

http://pastebin.com/d1CNiVf5

I'm not asking for someone to go through the code and fix everything, just if you could point me in the right direction, or at least know what is causing the problem that would be great!

(Sorry about having all the code in one file, I'm bad a modularising it and kept on getting errors early on in the project because of it. So for learning purposes it's going to be in one file for now).

Edit: At the moment the priority is to get projectiles working. I've tried SDL_UpdateRect and similar but nothing has helped so far.

Edit #2:
SO I've created a new function and have called it on top of the map, like it should do. But now I get a strange output:
http://youtu.be/8piWyjfDgbI

sentences:
Best way to retrieve const data My game uses big const data which i need to retrieve it to use
data used on each level when its needed
data security is important

I got two options in my head which one is better?

Note the data is const and it never changes during game and only i can change it on coding for using it on some levels and after build it always same data

1: using return "data"

Something like this which means data stored in script and finding script will expose data

if(level_number < 10)
{
switch level_number

case 1:
return data_1;
.
.
.
}
if(10<level_number <20)
{
.
.
.
}

2: saving in binary file

Check if the file exist read it and if it isn't then create it during game and use it next time

This one uses binary formatter to save/load data and there is two options for this too

2.1: creating file during game which still have same problem like first solution

2.2: creating file on the editor and load it from plugin folder etc

And second one also have storage usage when first one just a script which returns some const data

I know you cant stop hackers from hacking offline file but i'm also looking better way to save this big const data and retrieve it to use it

Which one is better and if you have better solution i'm happy to hear it

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:
Should competitive multiplayer games be pusposefully inbalanced so they don't get boring? I've had a discussion on the internet about game balancement. Actually, this was a Pokemon fansite, and the discussion started from a simple observation that some pokemon are OP while others are outright bad.
Now I know that Pokemon is a peculiar game... Still, I believe, this topic can be easily generalized to almost any competitve multiplayer game.
Namely, most people were making the argument that while Pokemon gameplay is very inbalanced, it is a good thing, because a perfectly balanced gameplay is inherently boring and dull.
Let me try to quote some of their arguments, (redacting them so that they become more readable outside of chat):

It'd just turn into a game of "lets use my favourite pokemon yayayay". The only thing that would matter than would be type matchups. Or, if the tank/glass cannon diversity was retained, then a team full of tanks would always win.
Pokemon is inherently unbalanced and that's what makes it interesting IMO.
"Optimal" gameplay, for anything, always becomes boring. What's fun to see is to see niche pokemon and gimmicks. There will always be something better that what you say is the best.
You could just make every pokemon 100 across the board and identical everything. Of course, that loses the point of the game.
Being able to use a "bad" mon well is one of the coolest things. There's an optimal team that wins a lot but cteaming exists and you can't really make it un-exist. It's always more fun to win with a stall team than a real shoot em up team.
Perfect games becomes boring, not optimal gameplay. If everyone plays well, there's nothing wrong with that; but if everyone has a perfect team, then what?

That goes right in the face of what I always believed about game balancement. In short, I believed that, regardless of the game's genre: If we have a mon, or unit, or champion, or whatever, which is known to have little to no place in any competetively viable strategy (the Pokemon case) or, if we have a "meta", that is, a strategy that is, in general, the only competetively viable strategy (the League of Legends case), then this is what makes gameplay dull and boring, since it clearly, almost by definition, greatly reduces the pool of viable picks and strategies; and that game designers ought to avoid these pitfalls. Thus, a "perfect" game should have many viable picks, each different than another but none clearly useless, (that is, we should avoid the situation that if one wants to pick A, picking B instead will always be a better idea - some picks may and should be niche and/or situational though), that can be mixed in a plethora of ways to make a plethora of different, but viable teams, thus creating a plethora of different, but viable strategies (this doesn't mean that each team is equivalent or that a team assembled randomly is viable; teams can still be good or bad, but we should avoid the situation that there is only one viable prescription for a good team).
However, what I was being told seems to boil down to something opposite. The people I quoted seemed to think that good balancement of a game can only be achieved at the cost of making all possible picks equivalent, to the point of making it matterless what to pick. They also seemed to think that therefore, in such a scenario, an obvious winning strategy would inevitably emerge, making the game trivial.
Is it really true that a game can only be well balanced if it sacrifices all of its diversity? Is it really true that getting rid of useless picks can only be achieved at the cost of introducing a trivial winning strategy??

sentences:
Workflow for creating spherical heightmaps I'm wondering how I can create a spherical heightmap.

In my ideal workflow, you'd see a 3D sphere that you can edit using procedural terrain techniques (like World Creator) and that spherical terrain can be exported into six seamless images based on what layout you want your images to fold up into a cube in-game to create your planet.

Another option would be if you can at least tell the program you want specific images to tile with other images, such as the designated 'front, right, back, left' images tile with each other and the 'up, down' images seamlessly.

Specifically, I'm making planets for a game that wraps six images into a cube and 'inflates' them into a planetary terrain.

I've made a few basic heightmap sets in a program called Scape, and flipped them so at least four of the images mirror each other, then I edited the interior of those maps to all be different so the landscape isn't repetitive. However, manually editing the top and bottom maps is very daunting to get perfect, and I'm creating a dozen or more planets.

I'd like to know how to make 'front, right, back, left' images tile with 'up and down' images and I can edit the interiors of the images in a 3D program of choice. I've been directed to this site from search queries many times, but I'm a newbie to all things code so I have no clue how to use things such as the Diamond-Square method or any algorithms to achieve seamless textures (what program do you actually use, literally a python script you write in Notepad++ or something?).

sentences:
Script of trajectory without itween I use itween for trajectories of car.
I do not want to use him anymore because I find him very heavy.( more 100 cars in my scène)
I found scripts but all one a variable speed to turn around points.
It is always necessary to find the good compromise in the speed of the car and the rotation speed so that the car does not turn non-stop around a point
It is not easy with a car which goes to 90 kmh and a distance of point of 5 m.
I did not arrive this day and in spite of several tried scripts there.

I look for a script where we give the speed, the path.

Thank you

sentences: GLSL Shader Solution for Ambient Occlusion? For the iOS app I am writing I want to incorporate some aspects of ambient occlusion for photo manipulation. Can someone suggest a GLSL approach that will work. Realtime performance is not super critical. Under a second compute time is fine.

sentences:
SDL draw dynamic select box This might seem obvious to many, but I'm stuck and I cannot find any tutorial which helped me, so it would be great to find the answer here.

I tried to make a rectangle like you have in RTS games, so to speak a dynamic select box, but it does not work correctly.
It would also be enough is someone lists up bullet points which each step for creating a box like this.

(Don't wonder I'm really new to c++)

Mouse.h :

#ifndef MOUSE_H_
#define MOUSE_H_

class Mouse {

public:
    bool leftButtonDown = false;
    bool mouseMoves = false;

    struct MouseCoords {
        int x = -1;
        int y = -1;
    };

    MouseCoords start_coords;
    MouseCoords move_coords;
    Mouse(){}

    void setState(Uint32 eventType, SDL_Event event){

        if ( eventType == SDL_MOUSEBUTTONDOWN) {
            this->leftButtonDown = true;
            SDL_GetMouseState( &this->start_coords.x, &this->start_coords.y );
        }

        if ( eventType == SDL_MOUSEBUTTONUP ) {
            this->leftButtonDown = false;
        }

        if ( eventType == SDL_MOUSEMOTION ) {
            this->mouseMoves = true;
            this->move_coords.x = event.motion.x;
            this->move_coords.y = event.motion.y;
        } else {
            this->mouseMoves = false;
        }
    }

    /**
     * Provides coordinates when mousebutton down
     */
    MouseCoords getCoordinates(){
        return move_coords;
    }

    /**
     * Refresh the coordinates. MUST be called after Mouse::clearCoordinates();
     */
    void clearCoordinates(){
        this->move_coords.x = -1;
        this->move_coords.y = -1;

    }

    /**
     * Creates selector rect, call this in the render loop
     */
     void createSelectBox(SDL_Renderer *renderer){
         if(this->leftButtonDown) {
            Block rect(
                       this->start_coords.x,
                       this->move_coords.y,
                       this->start_coords.y -this->move_coords.y ,
                       this->move_coords.x - this->start_coords.x
                       );
             rect.draw( renderer );
             this->clearCoordinates();
         }
     }
};

#endif

Block.h

#ifndef BLOCK_H_
#define BLOCK_H_
/**
 * Standard Class which can be used to build a player, enemy, or something similar
 */

class Block{
    SDL_Rect rect;
public:
    Block(int x=10, int y=10, int w=10, int h=10, int filled=true){
        rect.x = x;
        rect.y = y;
        rect.w = w;
        rect.h = h;
    }

    /**
     * draw with the given rendererer
     */
    void draw(SDL_Renderer *renderer){
        SDL_SetRenderDrawColor( renderer , 200 , 155 , 255 , 255);
        SDL_RenderDrawRect( renderer, &rect );
        SDL_RenderPresent( renderer );
    }

    bool framed(){
        return 0;
    }

};
#endif

Then in my main.cpp

SDL_Window *window;
SDL_Renderer *renderer;
Mouse mouse;
Block rect;

void renderWindow(){
    window = SDL_CreateWindow("commanding rects", 100, 100, 700, 600, 0);
    renderer = SDL_CreateRenderer(window, -1, 0);
}

void renderGame(Mouse mouse){
    SDL_RenderSetLogicalSize( renderer, 400, 300 );
    SDL_SetRenderDrawColor( renderer, 0, 0, 0, 0);
    SDL_RenderClear( renderer );
    SDL_RenderPresent( renderer );
    mouse.createSelectBox( renderer );

}

void gameLoop(){
    bool game_run = true;
    while (game_run) {
        SDL_Event event;
        while( SDL_PollEvent(&event)){
            if ( event.type == SDL_QUIT ) {
                game_run = false;
            }
            mouse.setState(event.type, event);
        }
        renderGame(mouse);
        SDL_Delay( 15 );
    }

}

int main(){
    renderWindow();
    gameLoop();
    return 0;
}

sentences:
"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: Creating a playlist with LWJGL and OpenAL I'd like to know how to create a playlist for the music in my games. I use LWJGL, and know a bit of OpenAL, however I can't figure out how to test for when a song is over. I want to be able to play one song after another, and I want to do that without hardcoding a timer for each song.

sentences:
How do I derive the angular movement for a craft I have the regular (linear) motion implemented like this:

class Craft{
...
Vector location, velocity, acceleration, angularVelocity, angularAcceleration;

...
//the move class responsible for linear motion
//this method works
 public void move(Vector target){
  Vector desired = target.sub(location);
  desired.normalise();
  accleration.set(desired.multipied(speed));
  velocity.add(acceleratio);
  location.add(velocity);
}

//the turn method
//I need help/tips

public void turn(float angle){
//I need the craft to gradually turn in a circular motion
// so that eventually maybe 10 secs, it makes 360 degrees turn

}

}

sentences:
Are constantly growing (in dimensional size) GameObjects a problem? It's possible the following is fundamental to Unity, and not a problem?

I am using an example of a WheelJoint2D/Car from the Ray Wenderlich tutorials. Note from the pic below, the top level game object called "Car". It has children of "Body" which contains the wheel joints and the wheels (attached to the wheel joints). The top level "Car" GameObject is placed in the scene (here at X=6.4).

Now we run the game for a short time, and the car rolls forward as expected. From the inspector, we would see that X position of the Body and the wheels has changed, but note that the Car game object's X position has not changed:

So, in reality the game object "Car" has grown in the X-dimension. Granted this growth seemingly has nothing to do with physics simulation (as all the rigidbodies and joints are moving along as expected). One interesting side affect is that this growth might make scaling the parent object problematic.

But it seems that if this were an infinite runner, you would have an ever increasingly wide "Car" object. On the surface this seems undesirable, but is it really? And if so, how would you mitigate this (given that this game object hierarchy seems to be the prescribed way of using the wheel joints).

sentences:
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:
LibGDX Headless System.in I started developing a little multiplayer game with LibGDX and Kryonet. I'm also using the headless backend for the server. So far everything went well, but now I'd like to create a command-line parser for the server. I found out that I should make that in a separate thread, so I made a class for that. But the BufferedReader's readLine() method always returns with null (but it doesn't raise any exceptions).
Here is the code I'm using:

public class ServerScreen implements Screen {
    boolean headless;
    Server server;
    CLIParser cliParser = null;

    public ServerScreen(boolean headless) {
        this.headless = headless;
        server = new Server();
        server.start();
        if(headless){
            cliParser = new CLIParser();
            cliParser.start();
        }
        System.out.println("SERVER STARTED");
    }

    //Screen overrides omitted...

    public static class CLIParser implements Runnable{

        public boolean started = false;

        public synchronized void start(){
            if(!started) {
                started = true;
                new Thread(this).start();
            }
        }

        public synchronized void stop(){
            started = false;
        }

        @Override
        public void run() {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            System.out.println("cliParser run started");
            while(started){
                String line = null;
                try {
                    line = br.readLine();
                } catch (Exception e){
                    System.out.println(e);
                }
                if(line != null){
                    System.out.println("READ LINE: " + line);
                }
            }
        }
    }
}

The cliParser starts up successfully, but the readLine() always returns null, and doesn't even blocks the code from running. I don't get any exceptions. I tried the CLIParser in a dummy project, and it works fine, so I assume this could be an issue with the headless backend.

Here is the sample code I used:

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class CliParserTester {

    public CliParserTester(){
        CLIParser cp = new CLIParser();
        cp.start();
    }

    public static void main(String[] args) {
        new CliParserTester();
    }

    public class CLIParser implements Runnable{

        public boolean started = false;

        public synchronized void start(){
            if(!started) {
                started = true;
                new Thread(this).start();
            }
        }

        public synchronized void stop(){
            started = false;
        }

        @Override
        public void run() {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            System.out.println(System.in);
            System.out.println("cliParser run started");
            while(started){
                String line = null;
                try {
                    line = br.readLine();
                    System.out.println(line);
                } catch (Exception e){
                    System.out.println(e);
                }
                if(line != null){
                    System.out.println("READ LINE: " + line);
                }
            }
        }
    }

}

sentences:
Import Unity Package Into Specific Folder Everytime i do import custom unity package file, I alwasy get Messy Folder and files in root of Asset Folder.

Any Idea how to solve this ?

Many Thanks in advance...

sentences: How to display a list of 2D arrays in the inspector Simply put, how do I make public List<bool[,]> appear in the inspector? Every 'bool[,]' is a solution to a puzzle in my game and I want to be able to view and edit them in the inspector.

sentences:
How to switch career to game engine/graphics programming My whole background is related to enterprise applications but I've been thinking of switching my career path from enterprise/business to something that I feel is more challenging and interesting. One of the main fields I've checked is game programming and more specifically engine or graphics programming. One of the requirements I've set is that the new domain requires at least some math/computer science knowledge and have interesting problems to research and solve (hopefully even read some white papers). Graphics programming especially seems to have lot's of that in addition to being interesting in general. I've already started studying the related mathematical background via this book and I believe my general experience in developing and releasing quality software (5+ years) will quickly translate, with the right mentorship, putting me at a level of usefulness of a mid-level game programmer at least.
How should I go about proving this to potential employers? I don't feel like creating small sample games really amounts to anything. Familiarizing myself with an engine like Unity or Unreal seems like a good approach but I'm not sure how to go about it in an engine focused way. I'd potentially like to avoid Gameplay development which is why creating games seems redundant.
I don't want to enter subfields such as server programming or any field that is web-appy but under the umbrella of a game company. I'm also looking to transition relatively quickly which is why I don't want to invest in a game company as a web app developer only to hope to be put into game domain later.
TL;DR: I'm looking for ways to enter the "sciency" side of game programming (graphics/engine programming) with a background in enterprise web apps.

sentences:
Visualizing NavMesh to Camera When Unity builds a NavMesh, you can see it in the scene view if you have the Navigation window open and select "Show NavMesh" in the Navmesh Display box. I'd like to use the exact same overlay in a camera view. Is this accessible in any way? Can it be rebuilt during runtime? Since the navMesh isn't an actual mesh, I can't seem to find a way to make this happen.

EDIT: This is what I'm trying to work with right now:

public class NavMeshToCamera : MonoBehaviour {

    NavMeshTriangulation triangles;
    Mesh mesh;

    void Awake () {
        triangles = NavMesh.CalculateTriangulation();
        mesh = new Mesh();

        mesh.vertices = triangles.vertices;
        mesh.triangles = triangles.indices;
    }
}

I have this script attached to a secondary camera that will be enabled while holding down a button to see an overlay of a minimap of the current dungeon.  I'm not quite sure what to do with the mesh data to provide a mesh visible to the camera.  Since no mesh exists initially, I suppose I'd have to take the new mesh, apply a layer to it, and have only that layer visible to the camera.  But I'm having some difficulties with this.

sentences:
Problem with Raycasting in a 2D Game I'm new to using unity and came across a problem when I was following a tutorial. The game is in two dimensional space, and when my player walks over a certain tile the detection never goes off. Here's the code that I have,

function calculateWalk() {

    yield WaitForSeconds(0.3);

    var hit : RaycastHit;

    if(Physics.Raycast (transform.position, Vector3.down, 100.0)) { // Never evaluates to being true
        var distanceToGround = hit.distance;
        Debug.Log("Hit");

        if(hit.collider.gameObject.tag == "tallGrass") {
            walkCounter++;
            Debug.Log("Tall Grass");
        } // END if
    } // END if
} // END calculateWalk()

I've made sure to attach the script to my player, as well as tag the tiles that I want with "tallGrass". I've followed what was done in the tutorial, but for some reason it's not working out for me, not sure if this is all the code needed to help solve this problem, if more information is needed let me know, I also set my player 1 unit above the tiles.

sentences:
Smoothly resize minimap camera rect width and height I have an orthographic camera that is working as a mini-map. Now I want to make it resizeable using mouse drag. I have applied some UI beside my minimap camera rect and those UI resizing perfectly with this code. But I have no clue that how to resize my camera rect with mouse drag:
 void Awake()
    {
        rectTransform = transform.GetComponent<RectTransform>();
    }

    public void OnPointerDown(PointerEventData data)
    {
        if (!resizePanelFeatureActive) return;
        rectTransform.SetAsLastSibling();
        RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform, data.position, data.pressEventCamera, out previousPointerPosition);
    }

    public void OnDrag(PointerEventData data)
    {
        if (!resizePanelFeatureActive) return;

        if (rectTransform == null)
            return;

        Vector2 sizeDelta = rectTransform.sizeDelta;

        RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform, data.position, data.pressEventCamera, out currentPointerPosition);
        Vector2 resizeValue = currentPointerPosition - previousPointerPosition;

        sizeDelta += new Vector2(resizeValue.x, resizeValue.y);
        sizeDelta = new Vector2(
               Mathf.Clamp(sizeDelta.x, minSize.x, maxSize.x),
               Mathf.Clamp(sizeDelta.y, minSize.y, maxSize.y)
               );

        rectTransform.sizeDelta = sizeDelta;

        previousPointerPosition = currentPointerPosition;
    }

sentences:
Changing JavaScript Player Object based on keypress I'm currently working on a basic JavaScript top-down shooter and I've run into a dilemma. I'm trying to implement a basic toggle weapon system however when I press the key it changes the weapon properly but when I press it again to toggle back it doesn't work. I don't think it's an issue with the rendering because the drawing function is able to detect the different weapons properly. I feel it's an issue with the actual toggle system code.

Here's the code for the player class

class Player{
    constructor(set){
        this.cx = set.x;
        this.cy = set.y;
        this.r = set.r;
        this.color = set.color;
        this.angle = 0;
        this.toAngle = this.angle;
        this.state = 1;
        this.up = false;
        this.down = false;
        this.right = false;
        this.left = false;

        this.bind();
    }
    bind(){
        const self = this;
        c.addEventListener('mousemove', (e) => {
            self.update(e.clientX, e.clientY);
        });
        window.addEventListener('keydown', (e) => {
            if(e.keyCode == 81){
                if(self.state = 1)
                    self.state = 0;
                if(self.state = 0)
                    self.state = 1;
            }

        });
        //toggle code:
        window.addEventListener('keyup', (e) => {
            if(e.keyCode == 81){
                if(self.state = 1)
                    self.state = 0;
                if(self.state = 0)
                    self.state = 1;
            }

        });
    }
    update(ex, ey){
        this.toAngle = Math.atan2(ey - this.cy, ex - this.cx);
    }
    canv(){
        if(this.angle !== this.toAngle){
            clear();
            ctx.save();

            ctx.translate(this.cx, this.cy);
            ctx.rotate(this.toAngle - this.angle);
            ctx.translate(-this.cx, -this.cy);

            drawPlayer(this.cx, this.cy, this.r, 0, 180, this.color, this.state);

            this.angle = this.toAngle;
        }
    }
}
//drawing code (above this one in the complete file)
function drawCircle(x, y, rad, startAngle, endAngle, color){
    ctx.fillStyle = color;
    ctx.beginPath();
    ctx.arc(x, y, rad, startAngle, endAngle);
    ctx.fill();

}
function drawPlayer(x, y, playerR, playerStartAng, playerEndAng, color, state){
    //left hand start
    if(state == 0){
        ctx.fillStyle = color;
        ctx.beginPath();
        ctx.arc(x - 15, y - 15, 10, 0, 180);
        ctx.fill();

        //border
        ctx.strokewidth = 10;
        ctx.strokeStyle = "brown";
        ctx.stroke();
        //end

        //right hand start
        ctx.beginPath();
        ctx.arc(x + 15, y - 15, 10, 0, 180);
        ctx.fill();

        //border
        ctx.strokewidth = 10;
        ctx.strokeStyle = "brown";
        ctx.stroke();
    }
    if(state == 1){
        //right hand start
        ctx.beginPath();
        ctx.arc(x + 7, y - 21, 10, 0, 180);
        ctx.fill();

        //border
        ctx.strokewidth = 10;
        ctx.strokeStyle = "brown";
        ctx.stroke();

        ctx.fillStyle = color;
        ctx.beginPath();
        ctx.arc(x - 7, y - 17, 10, 0, 180);
        ctx.fill();

        //border
        ctx.strokewidth = 10;
        ctx.strokeStyle = "brown";
        ctx.stroke();

        //gun start
        ctx.fillStyle = "black";
        ctx.beginPath();
        ctx.ellipse(x, y - 20, 3, 25, 0, 0, 2 * Math.PI);
        ctx.fill();

        //gun border
        ctx.strokewidth = 10;
        ctx.strokeStyle = "black";
        ctx.stroke();
        //end

    }

    //draw player
    drawCircle(x, y, playerR, playerStartAng, playerEndAng, color);
}

sentences:
How can I prevent picking up health items when I'm already at max health? This is what I have so far..

public class Per10HealthCollect :MonoBehavior

    void OnTriggerEnter(Collider other)
    {
        if (GlobalHealth.healthValue >= 91)
        {
            GlobalHealth.healthValue = 100;
        }
        else
        {
            GlobalHealth.healthValue += 10;
        }
        GetComponent< CapsuleCollider>().Enabled = false;
        this.gameObject.SetActive(false);
    }
}

sentences:
Additive blending problems I'm trying to get the blend of two images to work without luck.

I have a render target on which I have an object, then I want to render again the same object in same position but with different light condition. My goal is to add the result of this two render so I tried to do something like:

glEnable(GL_BLEND);
glBlendFunc (GL_ONE , GL_ONE);

....
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
render on render target A
change light condition
do not clear now
render on render target A again with new light condition
glDisable(GL_BLEND);
display render target A

I am surely missing something because not only just the first image shows, but the object is transparent.

I am extremely sorry if the question is stupid but I'm very new to such things.  Thank you.

edit
Following the answer of @Sam Johnston I've edited my code but, although I solved the transparency, the results are not added (to make sure of this I render one with a completely red light and one with a green light) together, but I get just the first render as result:

glEnable(GL_BLEND);
glBlendFunc (GL_ONE , GL_ZERO);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
render on render target A
change light condition
glBlendFunc (GL_ONE , GL_ONE);
do not clear now
render on render target A again with new light condition
glDisable(GL_BLEND);
display render target A

Have I misunderstood the answer?

Juan

sentences:
In 2D, how can I improve character rotation using raycasts when dealing with sharp/convex edges? Edit:

After making some edits to my polygon collider (based on @Alex F's suggestion), I can indeed confirm that sharp, convex corners are causing the buggy rotation. For now I've decided to only rotate my character if its moving, so standing on a corner when velocity.x = 0 won't cause my collider to rotate rapidly. However, this seems like a band-aid fix, and I'm still wondering if there's a better way to handle these edges. Resuming movement after idling on a corner still causes some buggy behavior, and I'm concerned that this will compound once my rotations become more complicated or frequent:

Original question:

I'm quite inexperienced with quaternions and rotating, so I'm not entirely sure if this issue has to do with my code, the collisions shown in this question, or my game design.

What I'm trying to achieve is "smooth" rotation of my character's collider based on  the normal of the current surface. I've been creating a custom raycast controller in 2D from the ground up, and already know how to find all kinds of information from rays, such as the current angle of a sloped surface. My controller is coming along quite nicely, and rotation is one of the last things I'd like to tackle. It should be able to handle sloped box colliders, but also irregular ground shapes that require something like a polygon collider.

I've been somewhat successful, having learned that I shouldn't set my character's z-rotation directly, but instead update my entire transform.rotation with a method like Quaternion.Lerp. This has worked generally well, but I'm running into issues on irregular ground, and on corners.

Notice the smooth transition from flat to sloped surfaces, but that my collider rotates rapidly when the raycast hits a corner:

Movement is still somewhat smooth on irregular terrain, but there is a noticeable shakiness at times. Sometimes my character's collider rotates rapidly as well (end of gif):

I suspect that the shakiness on the irregular terrain is just my collider getting "caught" on the many edges that the polygon collider creates. I just don't know if this is happening because I could be doing something differently in my code, or if I need to edit the polygon collider, or is caused by something else entirely. Perhaps raycasting isn't the best way to achieve my desired behavior.

[SerializeField]
private float speed = 5;
[SerializeField]
private float gravity = -20;
[SerializeField]
private LayerMask collisionMask;

private BoxCollider2D boxCollider;
private Vector2 velocity;
private Vector2 groundNormal;

private void Awake()
{
    boxCollider = GetComponent<BoxCollider2D>();
}

private void Update()
{
    float playerInput = Input.GetAxisRaw("Horizontal");

    velocity.x = playerInput * speed;
    velocity.y += gravity * Time.deltaTime;

    MoveCharacter(velocity * Time.deltaTime);
}

private void MoveCharacter(Vector2 velocity)
{
    //Rotate the character
    Quaternion targetRotation = Quaternion.FromToRotation(Vector2.up, groundNormal);
    transform.rotation = Quaternion.Lerp(transform.rotation, targetRotation, 0.5f);

    groundNormal = Vector2.zero;

    CollideBelow(ref velocity);
    transform.Translate(velocity);
}

private void CollideBelow(ref Vector2 deltaMovement)
{
    float rayLength = 1;
    Vector2 rayOrigin = transform.position;

    RaycastHit2D hit = Physics2D.Raycast(rayOrigin, -transform.up, rayLength, collisionMask);
    Debug.DrawRay(rayOrigin, -transform.up * rayLength, Color.red);

    if (hit)
    {
        velocity.y = 0;
        deltaMovement.y = -(hit.distance - boxCollider.size.y * 0.5f);

        groundNormal = hit.normal;
    }
}

sentences:
Why are .xnb files used rather than source files? XNA and Monogame are built using a content pipeline, which takes source files (images, sound effects, 3D models, etc.) and converts them to proprietary .xnb files. What's the benefit of doing this as opposed to simply loading source files directly?

To be clear, I'm not asking how to use the content pipeline. Just why .xnb files are used in the first place.

sentences:
How do I avoid writing Manager classes? I seem to keep reading it's a bad idea to use XxxManager style classes in game engine programming, yet even when I try to avoid their use I always end up with something that holds all the actors/entities/game world locations and acts upon them, which ends up being a Manager if by another name.

Is this really a bad pattern to follow? If so, what are the alternatives?

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:
Querying game objects in real-time I'm thinking about working on a game where I need to find all the objects matching certain properties.

For instances I might need to look up all the objects...

Producing gold.
Whose level is 5 or higher.
Within 10 meter from a point.
Currently fighting.
That have anything to do with metal (e.g. producing, consuming, made of, wearing, standing on etc).

And so on and so forth. I would also like to be able to add new objects with new properties without having to change everything else.

Ideally I would need to run multiple queries per frame (hundreds or thousands per second). I'll probably rely on some properties way more than others, but this kind of usage pattern is likely to change over time.

Is there any data structure, design pattern, method or idea to help me implement an efficient real-time query system?

I've been thinking about assigning to each object a dynamic set of tags with properties, then recursively partition the space storing in each partition a mapping from those tags to the objects. It might work, but I'd like to hear about existing solutions before wasting efforts.

sentences:
Why circles are not created if small? I have changed the scale in 3DSMax to my own and now I can't create any object, including circle, if it is of the size which is normal for my scale. Instead, I have to create big object first and then modify it to a smaller size. It looks like there is a minimal size protection is set somewhere - where is the setting for it?

UPDATE

While creating a circle, if I drag for 0.04m circle disappears after drag end. If I drag for 0.08m circle also disappears. If I drag for more than 0.1m, circle persists after drag end.

How can I set it so that it persist after 0.01m too?

sentences:
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:
Custom Fonts in cocos2d I have tried Hiero but it has NEVER worked for me. Is there an alternative application for creating fonts for cocos2d?

Thanks

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:
Unity - Calculating a rotation based on game time I have a simple script to make an object spin:

Spin Speed is the speed to rotate the object on each axis (preferably in degrees per second). Local is whether the rotation should be done based on world axes or object axes. Starting Rotation is the initial rotation of the object.

Normally I would use Transform.Rotate to do the rotation, but in this case I have to make the rotation a function of time, so you can pass in any time value and it will return what the rotation should be at that time.

Here is an example (this doesn't work properly for either world or object axis rotation):

private Quaternion getRotation(float time)
{
    return Quaternion.Euler(InitialRotation + SpinSpeed * time);
}

I just need some help figuring out the math behind calculating rotations for both world and object axes. I think that matrices can be used but I honestly don't remember anything about how to use them.

Here's an example of using world axes with a SpinSpeed of 180 on the y axis and an initial rotation of 45 on the x axis:
https://i.gyazo.com/d7f41b6a88425b5d8b8237cd7ac40878.gif

An example of using local axes with the same parameters as above:
https://i.gyazo.com/d453b3dd239c9f77b86ce372c499d068.gif

sentences:
Libgdx and Box2D TiledMap render is not smooth I'm building simple side scroller game. My player (square) move fast and it interacts with other world objects. Problem is when my player is moving it seems that all world is rendering somehow strange (for example box2d objects are not rendering smooth). When player is not moving everything is ok. Here pic when player is moving

and here when my player stands still

Here I add my code

private OrthogonalTiledMapRenderer renderer;

mapLoader = new TmxMapLoader();
    map = mapLoader.load("level1.tmx");
    renderer = new OrthogonalTiledMapRenderer(map, DIV);
    gamecam.position.set((gamePort.getWorldWidth() / 2),    (gamePort.getWorldHeight() / 2), 0);

public void update(float dt){
        world.step(1/60f, 6, 2);
        if(playerAndGroundTest){
            player.update(dt);
        }

        float x = gamecam.position.x - gamecam.viewportWidth * gamecam.zoom / DIV;
        float y = gamecam.position.y - gamecam.viewportHeight * gamecam.zoom / DIV;

        float width = gamecam.viewportWidth * gamecam.zoom * 2 / DIV;
        float height = gamecam.viewportHeight * gamecam.zoom * 2 / DIV;
        renderer.setView(gamecam.combined, x, y, width, height);

        gamecam.position.set(new Vector2(player.getBody().getPosition().x, (gamePort.getWorldHeight() / 2)), 0);
        gamecam.update();
    }

    @Override
    public void render(float delta) {
        update(delta);
        Gdx.gl.glClearColor(0.4f, 0.4f, 0.4f, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        renderer.render();

        b2dr.render(world, gamecam.combined);
    }

here's Player update function

public void update(float dt){
        body.setLinearVelocity(200 * dt, body.getLinearVelocity().y);
    }

sentences:
Why do MMORPGs still use multiple servers? MMORPGs, some MOBAs like League of Legends or even StarCraft 2 usually force you to pick a server. Usually they are US, EU and SEA, in MMORPGs many per location. I can see that that was necessary a few years ago, but now with the advent of AWS and similar offerings that allow you to seamlessly scale your "server-power", why are there still separate servers?

My train of thought is like this (using Star Wars: The Old Republic as an example): - You are always on one planet, an isolated "instance" from other planets. - If there are too many people on one planet, SW:TOR creates a new instance of the world and puts players in there. - If you leave the world / switch instances you have a loading-screen

So why can't the game create an instance for this planet. This instance (and only this one) has your current data in its database and manages x players. As soon as x-50 players are on this instance, a new server will fire up and new people will spawn on that instance. The 50 spots are reserved for switching to your group, etc.

There could be an instance for all three major regions to keep the latency low, but it would allow you to still play with other players from i.e. SEA if you can live with a 140ms delay (which is still nothing imho).

Whenever you switch an instance or travel to another world, your current server gives all your data to the next server, making sure you don't need one big centralized database. You could still have one that gets updates periodically for analysis purposes.

When you log off or the servers loses connection, the data could then be transferred into a massive database that is optimized for storing the data. The instance servers can then be optimized for high throughput.

Is there any particular reason this will not work? Are there other problems I am missing?

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:
How long does the collision take? I want to simulate a simple force-acceleration (rather than impulse-velocity) physical world made up entirely of disks and I'm having an irritating problem with my physics.

When two disks collide, I can calculate the changes in velocities quite easily using conservation of momentum and conservation of energy. Since this is going to be a force-based simulation, I need to calculate the forces to apply. I thought I'd use the momentum-impulse equality:

mΔv = FΔt

Sounds simple, except I don't know what to do with time(Δt). So I guess the question boils down to this: how long does the collision take? Or rather, do the two objects stick together for a period of time (Δt)?

sentences:
Switching screens in a game I am working on a simple 2D game in Java.

I want the game to have an opening screen, instructions screen, and the screen with the game itself.

From the opening screen the user presses buttons to get to the instructions screen or to the game screen. From the instructions the user should be able to get back to the opening screen. When a game is finished, the user is automatically sent back to the opening screen.

I want all of this to happen in the same JFrame. Each screen should be a class that extends JPanel.

What would be the best way to do that? I thought of making a method inside the Main class (the one with the main() method), the switches screens and can be called from anywhere in the program.

But how will this method switch screens? What would be the best way to replace the JPanels?

Thanks a lot

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:
How to get local point inside a body where mouse click occurred in box2d? I need to find out the point inside a body, lets say a rectangular object, where the mouse was clicked on. I'm makin a game where the force will be applied depending on where the mouse was clicked on the body. Any ideas?

Will body.GetLocalPoint(b2vec2) work?  I tried by passing the mouse coordinates when the click occurred when inside the body but if the body's position is (400,300) in world coordinates then for trace(body.GetLocalPoint(new b2vec2(mouseX,mouseY)).x); I get some value between 380 to 406 or something (eg. 401.6666666). I thought getLocalPoint will give something like x=-10 when clicked to the left of the centre of body or x=15 etc when clicked to the right.

Language is As3 btw.

sentences:
XNA Transparency depending on drawing order? I am drawing two 3D objects, both of them can fade from opaque to transparent independently, and they can intersect between them (so you cannot say when one of them is before the other one). Look at the image for a better understanding (one of the object is a terrain and the other one an area):

Now, if I apply transparency to both of them, and draw the terrain before the area, the terrain is not transparent respecting to the area, but the area is:

And finally, if I draw the area before the terrain, then the area is not transparent respecting of the terrain:

QUESTION: How can I make all the objects transparent to the rest of objects without depending on the drawing order?

sentences:
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:
Can I keep get out of Unity editor features if I'm using ECS Pattern? I'm learning about ECS Pattern to use it in my Unity game, as I saw until now, most of stuffs is created by code.

As I know, each Unity GameObject is a Entity which contains many of Components and GameObjects are instantiated by code (created by my script, for example).

My question is, when I use ECS Pattern, can I keep using the bunch of features offered by Unity editor (like Prefabs, ScriptObjects, Drag Dropg to position, etc) or I need to control all of them by code?

sentences:
View Matrix to Texture Matrix I'm converting view coordinates to texture coordinates for both my shadow maps and Screen space reflections.
I keep seeing this conversion in examples:

            var T = new Matrix
            {
                M11 = 0.5f,
                M22 = -0.5f,
                M33 = 1.0f,
                M41 = 0.5f,
                M42 = 0.5f,
                M44 = 1.0f
            };

            Matrix m = view * projection * T;

What is T and why does this "work"? I'm saying "work" because I not satisfied with the result but the problem may not lie here.

I would like to use and inverted view and projection and then adjust the coordinates from -1,1 to 0,1. But that doesn't work at all.
What have I misunderstood?

sentences:
How to Design a Generic Collision Detection System? I'm designing a C++ 2D collision module, and I ran into a problem designing a system where the collider is unaware of the shape it's colliding against.

I'd like to have a abstract base class called Collision Component and the subclasses define the specific shape (circle, rectangle, polygon, etc...).

The Quad tree and Axis Aligned Bounding Box checks are fine.  The difficulty I ran into is when I'm calculating intersection tests.  I don't know how to define a function in the parent class similar to this:

bool CollisionComponent::IsIntersecting(CollisionComponent* other);

The easiest approach is to cast other to specific subclasses and invoke overloaded functions:

bool IsIntersecting(const Circle& a, const Circle& b);
bool IsIntersecting(const Rectangle& a, const Circle& b);
bool IsIntersecting(const Line& a, const Circle& b);
// on and on

I prefer not to implement functions this way.

I thought of breaking down polygons to its elements, and pass an array of segments into a function.

bool IsIntersecting(const std::vector<Line>& relevantSegments);

Although this would be more robust, I feel like this is more expensive, and I may lose precision when interpreting curves as polygons.  This approach seems to be the best so far though since I can probably optimize it for complicated shapes.

Another approach I've considered was to find the closest point to the center of the other shape, and test if the shape encompasses the point.  Unfortunately, this runs into issues with concave polygons, and cases where the shapes are barely clipping at the edges such as this example:

*------------------------------*
|                              |
|             C                |
|                            __+--*
*-------------------x-____-----* /
                ___---          /
          ___-x-               /
    ___---          C         /
_---                         /
                            /
---------------------------*

/*
C = center
* = vertex
x = point on shape that's closest to the other shape's center
*/

I feel like this problem was solved before, but my reading material doesn't cover this.  How do I design a collision system where the base class does not care about specific shapes?

sentences: What's the performance benefit of saving all logged in characters in MMOs in regular intervals? The majority of MMORPGS have a Worldsave system that will save all the characters once every X hours. I guess the reason is performance. So why is this better, performance wise, than saving a character on disconnection?

sentences:
Need help reducing my build's size I developed an Android game using Unity3D and successfully published it in Play Store. But the apk size almost 30MB which is pretty big for my game. When I checked the Editor Log after the build, this is what I found:

Textures      2.5 mb     20.1%
Meshes        433.8 kb   3.4%
Animations    2.2 kb     0.0%
Sounds        3.9 mb     31.3%
Shaders       191.3 kb   1.5%
Other Assets  157.9 kb   1.2%
Levels        166.9 kb   1.3%
Scripts       1.2 mb     9.4%
Included DLLs 3.9 mb     31.5%
File headers  44.5 kb    0.3%
Complete size 12.5 mb    100.0%

I just don't understand how could the final build will weigh more than twice the size stated in the log

sentences:
Algorithm for staying "alive" forever I am implementing a game where the player is playing(sliding) the little red rectangle and the purpose is to not hit the black rectangles and to not move out of the inner blue rectangle. The black rectangles are moving in trajectories from left to right(right to left) and from top to bottom(bottom to top). The speed they are moving with is constant e.g. 5 pixels. You can get a better idea in this video.

One of the game modes is the following - 2 paths will be proposed by the game displayed as arrows and one of them may lead to "death", while the other will always be the right one and the user will have to choose one of them until he makes the wrong choice. The movement directions can only be top,bottom,left or right and not diagonal and the speed of the red rectangle is constant e.g. 6 pixels and the black rectangles speed is 5 pixels.
I am struggling with the algorithm for the "successful" direction for more than a week and what I have done so far is the following :

Generate a random float number between 1.0 and 2.0 seconds and then divide the generated number by 0.030 for example to get the number of moves that will be made by the black rectangles and red rectangles.
Calculate the black rectangles and red rectangle move points that will be made for the following time session by multiplying the number of moves by the speed which is 5px for the black rectangles and 6px for the red rectangle.
After I know the speed of the black rectangles and the number of moves I can tell their position in any time of the current time session.
Move the red rectangle to the left until it is being hit and remember that result e.g. 15 moves until hit. Do the same thing for right,up,down direction.
Sort the direction by the moves that can be made before hit in ascending order.
Move the red rectangle in the direction in which the most number of moves can be made.
Do the same thing until the time session ends i.e. the random float number generated in the first step.
This solution works most of the time, but some times it leads to a position where an escape is not possible. The problem is not in the code, but in the algorithm logic.
For example look at the following image :

As you can see the red rectangle will go to a position where it will be stuck by two of the black rectangles. The best possible solution in this situation would be to move to top 1 time and then to left and after that to top, because the black rectangle in the top left corner is going to top, but I really have no idea how to solve this task. What would be the optimal way to accomplish this task.
Thank you in advance!

sentences:
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:
360 Orbital Camera Controller I have a stationary cube in my scene that I'm orbiting a camera around. I have my MainCamera nested under a GameObject that I'm calling 'OrbitalCamera'.

I setup the script so that a click (or tap) and drag will rotate the camera around the object in space so it feels like you're rotating the cube (ie: if I click the top of a face on the cube, and pull down, I'm rotating the X value) but you'll actually be rotating the camera.

For the most part, my script works. However, after rotating the Y so much, the camera is upside down and the X gets inverted. Here's my script:

public class OrbitalCamera : MonoBehaviour {
    public bool cameraEnabled;

    [SerializeField] private float touchSensitivity;
    [SerializeField] private float scrollSensitivity;
    [SerializeField] private float orbitDampening;

    protected Transform xFormCamera;
    protected Transform xFormParent;
    protected Vector3 localRotation;
    protected float cameraDistance;

    void Start () {
        cameraEnabled = true;
        xFormCamera = transform;
        xFormParent = transform.parent;
        cameraDistance = transform.position.z * -1;
    }

    void LateUpdate () {
    if (cameraEnabled) {
            // TODO:: FIX PROBLEM WHERE WHEN CAMERA IS ROTATED TO BE UPSIDEDOWN, CONTROLS GET INVERSED
            if (Input.GetMouseButton(0)) {
                if (Input.GetAxis("Mouse X") != 0 || Input.GetAxis("Mouse Y") != 0) {
                    localRotation.x += Input.GetAxis("Mouse X") * touchSensitivity;
                    localRotation.y -= Input.GetAxis("Mouse Y") * touchSensitivity;
                }
            }
        }

        Quaternion qt = Quaternion.Euler(localRotation.y, localRotation.x, 0);
        xFormParent.rotation = Quaternion.Lerp(xFormParent.rotation, qt, Time.deltaTime * orbitDampening);
    }
}

Is there a good method to achieve this type of 360 camera? I'd like dragging from right to left to always move the camera left and dragging left to right to always move the camera right -- no matter how the camera is oriented.

sentences:
Fbx mesh animation opacity export 3d Max does export Opacity value of an material to Fbx, which in Xna (when importet/processed) can be easily found in BasicEffect of a mesh instance Alpha property (and used in draw method).

My question is:

Can opacity values on animated mesh be exported (specific opacity states/values over time/keyframes) ??

From what I gathered it seems that only Opacity value of the First frame of animated mesh is exported (and found in BasicEffect of mesh). So if in Max there are keyframes with different opacity values and Max animation preview clearly show these transparency transitions when moving scroll, then do not get exported to Fbx.

Are there knows techniques/hacks to inject opacity from animated meshed (values over time/keyframes) to Fbx?

sentences:
Collision Code Organization Im making a game in java as a hobby and ive reached a part where i have a few game elements which i want to have collision. Since im using a tilemap, the collision with the wall tiles is pretty simple and since every game element has a pointer to the tilemap, the tile collision code can be placed in the game element class itself, so that every game element collides with the map, at least.

but as for the collision between the game elements themselves, which im going to do with separate axis theorem, i dont really know where to place it. the objects of each level are created on the said level class, since im using a game state manager and each level has a separate class (everything is a state basicly, lets say menu, level1, level2 etc)

So i COULD put the collision code in a, lets say, superclass of Level, but it sounds kinda wrong to put collision code on a class like that, and i dont really have any ideas.

So i would like to know how you organize your collision code in your games, i appreciate any kind of technique or simple architecture

sentences: Unity - Best Random Movement Strategy? As of now, to get random movement of my enemies, I am adding a Rigidbody and a BoxCollider then "throwing" them (i.e. adding velocity) in a random direction for a random amount of time and making them choose a new direction if ever they get outside of their designated area. This does not seem to work that well all the time. Sometimes they manage to get themselves stuck inside obstacles which should be impossible. The more I add guys, the more it seems the physics can't keep up or something with the collisions. Is there a better method to random movement or is "throwing" them perfectly valid? Is my method expensive and terrible? I might have around 50 guys active at a time and perhaps a few hundred to a thousand static obstacles each with their own colliders.

sentences:
Run one cycle of animation when button is pressed in libgdx I am looking for a way to run my animation a complete cycle when a button is pressed. The animation runs as long as the button is pressed but the animation takes a second to play so it becomes too short. I would like to have it played through once, even if the button only was pressed very fast.

It's a character's slash with the knife and it needs to be one complete cycle, I just don't get how to do this.

Anyone has an idea on how I could do this in a better way?

The specific code is now inside render():

 if(Gdx.input.isKeyPressed(Input.Keys.SPACE)) {
        if(direction == HEADING.NORTH) {
            animation = knifeslashnorth;
        } else if (direction == HEADING.WEST) {
            animation = knifeslashwest;
        } else if(direction == HEADING.EAST) {
            animation = knifeslasheast;
        } else if(direction == HEADING.SOUTH) {
            animation = knifeslashsouth;
        }
    }

sentences:
Show only some parts of a point cloud. OpenGl4 I am developing an opengl 4.0 app which is showing a point cloud. In the other hand, I have an array "pos" where I have some x,y,z positions:

pos[number of pos][3] , where 3 refers to [0]:x [1]:y [2]:z

I would like to show only the points of the point cloud which are inside of a sphere of radius R for any of the positions I have in the array pos. I was thinking in sending the array pos to the vertex shader that draws my cloud point and there, do a loop for each position and check if the distance between any of the positions and the vertex is less than a radius R. If so, I put an alpha colour of 1.0. If not, an alpha colour of 0. Something like:

Vertex:

#version 460

uniform mat4 viewMatrix, projMatrix;
uniform float Radius;

in vec4 position;
in vec3 pos[N];

in vec3 color;

float d;

out float Color;
out float AlphaC;

void main()
{
    Color = color;
    AlphaC = 0.0;

    for ( int i = 0; i < pos[i].length; i++ ) {
        d = distance(vec4(pos[i],1),position);
        if (d<Radius) {
            AlphaC = 1.0;
            break;
        }
    }

    gl_Position = projMatrix * viewMatrix * position ;
}

Fragment:

#version 460

in float Color;
in float AlphaC;

out vec4 outColor;

void main()
{
    outColor = vec4(Color, AlphaC);
}

But I am not sure how to send this pos array since this matrix is an Nx3 with N depending in the file of positions that I am using. Any idea? Does N has to be defined before compiling?

sentences:
Edges drop out when rendered at a long distance I have this weird effect when rendering small objects at a long distance. I already tried using anisotropic filtering but maybe I am not doing it right.

Material script:

material Platform/Border
{
  technique
  {
    pass
    {
      ambient 0 1 0.824 1.0
      cull_hardware none
      cull_software none
      lighting on
      texture_unit
      {
        filtering anisotropic
        max_anisotropy 8
        texture white-pixel.png
      }
    }
  }
}

Screenshots:

How to solve this?

sentences: Changing speed of an object Is there a way of changing speed of an object at certain time? I want to change my speed to my initial speed after colliding with any object. I have already added bounce Physics to my colliding objects and player object with Friction set to 0. Please help.

sentences:
How do i prevent IAP abuse using restoring purchases in an online game? Lets say i have a mobile mmorpg (ios/android) where you can purchase premium currency using IAP's... how do i actually prevent the following case :

Player purchases premium currency
Server side checks if the purchase is valid, grants the user premium
currency
Player uses the premium currency to buy some items
Player restores his purchase on google play and gets his money back

Result : Player didnt spended money and still got what he wanted

As long as i know theres no option to prevent that case in google playstore or ios app store... Users can restore purchases within 48 hours after the purchase.

So what could i basically do to prevent this, aslong as i dont use 3rd party payment services like PayPal ?

sentences: 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:
Make GuiText responsive I'm using C# code to make a responsive GuiText.
I was abel to make a responsive GuiTexture, but I'm struggling with doing the same for a GuiText.

Code for the responsive GuiTexture

using UnityEngine;
using System.Collections;

public class ResponsiveGUITexture : MonoBehaviour {
    public float designScreenWidth = 800, designScreenHeight = 480;
    public bool debugMode = false;

    private Rect pixelInset0;

    void Start () {
        pixelInset0 = this.guiTexture.pixelInset;
        this.guiTexture.pixelInset = new Rect(Screen.width / designScreenWidth * pixelInset0.x, Screen.height / designScreenHeight * pixelInset0.y, Screen.width / designScreenWidth * pixelInset0.width, Screen.height / designScreenHeight * pixelInset0.height);
    }

    void Update(){
        if(debugMode){
            this.guiTexture.pixelInset = new Rect(Screen.width / designScreenWidth * pixelInset0.x, Screen.height / designScreenHeight * pixelInset0.y, Screen.width / designScreenWidth * pixelInset0.width, Screen.height / designScreenHeight * pixelInset0.height);
        }
    }
}

sentences: Is there performance difference between OnCollisionEnter and OnTriggerEnter? Is there performance difference between OnCollisionEnter and OnTriggerEnter? I have around 12 objects all calling OnCollisionEnter when in fact OnTriggerEnter could work as well. So I wonder if the are is any difference PERFORMANCE WISE between the two

sentences:
algorithm for combining smaller tiles to balance the bigger ones I have a field of tiles - basically each tile is a country that has some kind of sovereign. The tiles - countries - have different weight. For now I use some numerical value but in the future the weight will depend on tile size, produced resources and so on.

So I want for those countries to make alliances if their sole weight is much lower - or at least lower than a certain threshold - than the weight of the neighborhood tile (each sovereign is basically a primitive AI at that stage that is able to make decision to create the alliance). Here is couple of scenarios

Here are the examples for bigger maps with possible alliances

So my question is - is there some kind of algorithm that allows to achieve that or I have to create it myself or use training sets for AI to gain the ability to form alliances?

sentences:
Fps independent rotation I'm trying in my game to have camera rotation speed idependent of fps. For keyboard it works without problems but not for mouse movoment. At 60 fps it works good but at 200 for example rotation is to slow.

mouse_dif is difference since last frame in pixels. Maybe thats a problem too, bigger screen resolution will rotate faster then smaller.

My code:

const float rot_speed = u.GetRotationSpeed(); // returns 5.f
float val = 0;

if(allow_input == ALLOW_INPUT || allow_input == ALLOW_MOUSE)
    val += float(mouse_dif.x)/200;

if(val > rot_speed*dt)
    val = rot_speed*dt;
else if(val < -rot_speed*dt)
    val = -rot_speed*dt;
u.rot += val;

How can I make it fps independent?

sentences:
Collisions between two objects in 2D space I am implementing the collisions of my game in javascript, and at the moment what happens when the objects collide is that they have their speed changed to 0. What I'm starting to want to do is to make it a little more interesting when the player plays with other objects in motion, they collide and separate. This is a very physical 2D issue itself.
If an object A is at positive velocity at x collides with an object B is at negative velocity at x, collide head-on, what would be the best calculation to do so that they separate naturally after the collision?

What if they go in the same direction in x? and if one has going on x and another on y? How do I deal with all this?

Should I add mass and acceleration to make this separation calculation after the collision?

sentences: Having trouble going from the menu I created w/ Android normally to my LibGDX game file So I wanted to use Android Studio to create the menu for my game so I created a button with an onClick method that included the Intent i and startActivity(i) but when I clicked the button the app would just crash on me

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:
Unity: Trying to add an in-scene 'press E to open' tag as UI element In Unity 5.4.1 I'm trying to add a tag that says 'press E to open' to a door as you approach it. I've got a RayCast pointing forward from the player, detecting the door and , connected to my PlayerController, I've got a copy of a prefab GameObject which itself contains a Text UI element. The GameObject _interactionTag is instantiated into the scene when the player is close enough.
But I'm having some trouble getting it to display correctly in the scene and I'm not sure why.

Here are the relevant parts of my PlayerController:

public class PlayerController : MonoBehaviour {
    public Canvas _canvas;
    private Vector3 _fwd;
    private RaycastHit _hit;
    public GameObject interactiveTag;
    private GameObject _interactiveGameObject = null;
    private GameObject _interactionTag;

    void Update () {
        _fwd = transform.TransformDirection(Vector3.forward);
        if (Physics.Raycast(transform.position, _fwd, out _hit, 3)) {
        if (_hit.distance<1) {
            _interactiveGameObject = _hit.collider.gameObject;
            GameObject _interactionTag = (GameObject) Instantiate(interactiveTag, _interactiveGameObject.transform.position, _interactiveGameObject.transform.rotation);
           _interactionTag.GetComponentInChildren<Text>().text = _interactiveGameObject.GetComponent<IsInteractive>().interactionText; // this gets a text string from the door 'press E to open'
           _interactionTag.transform.SetParent(_canvas.transform, false);
        }
    }
}

In game, the _interactionTag is appearing - though it's backwards and does not appear attached to the door. Also is any of this the best way of getting the 'press E to open' tag to appear attached to the center of the door? I'm beginning to wonder if what I'm doing is best practise.
Thanks for any help.

sentences:
Any significant performance cost to using BlendState.Premultiplied? Normally I guess you'd use BlendState.AlphaBlend because normally when you load your textures through the pipeline they're already premultiplied. However, if you're loading textures at runtime from PNGs or some such, you have to loop through the pixels and premultiply them, which can take a long time if you've got a lot of textures to load.

So it looks (haven't tried it) like using BlendState.NonPremultiplied instead of BlendState.AlphaBlend should handle non-premultiplied textures and produce the same visual result, without all the startup costs. I have to wonder if there's a non-obvious cost to doing this, like a huge drop in performance or something. Anyone know?

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 Industy games handle their code errors and exceptions I've seen games crash and throw errors.
Usually games don't throw raw exception message, but codename error names, such as F204 or similar. I would like to know some thought about that.

Also, as i understand they separate errors in non critical on which maybe some message is shown and there are critical on which game is shut down and error window pops up.

Example, this is how i see it

//Some actions
try{
    Bone bone = character.bones.Get(5);
}catch(ArgumentOutOfRangeException e){

    //show error - stack trace, message, or code name error
    ExceptionHandler(e.ToString(), ErrorType.CRITICAL); //handles

    //also could be, or similar
    ExceptionHandler("V401", ErrorType.CRITICAL); //handles, this is shown in game
}

public Bone Get(int index){
    if (index < 0 || index >= _someData.Length) throw new ArgumentOutOfRangeException("Index is out of range.");
    return _someData[index];
}

I think product users should not really see any exception logs but rather code names.
But what are the suggested management for this - error string manual pass like it did (but i don't think its manageable), constant in separate class, enums?

Edit:
Of course, having an error codename catalog would make the life easier for the devs themselves. If user submits an error, they can find the spot quite quickly. Does this made any sense?

Thanks

sentences:
How to flip a rectangle I'm curently working on a system that make the player character look towards the mouse pointer.
My system is effective but i'm having an issue while displaying the rectangle.

In the Following code i test the mouse position by translating it in the world and then i test if the world pos of the mouse is greater than the position of the player or not. if the mouse is on left side of the boundary, the player will rotate to look at it. To make the rotation, i put the X coordinate on the other side of the position and i make the width negative. THis normaly should emulate the rotation. but my rectangle does not shows up.

Point MousePos = Vector2.Transform(Mouse.GetState().Position.ToVector2(), Matrix.Invert(Camera.GetViewMatrix())).ToPoint;
if (MousePos.X > Position.ToPoint().X)
{
    EntityDisplayRectangle.X = Position.ToPoint().X - (int)EntitySize.X * (int)TileSize.X * _displayResizeFactor / 2;

    EntityDisplayRectangle.Width = (int)EntitySize.X * (int)TileSize.X * _displayResizeFactor;
}else{
    EntityDisplayRectangle.X = Position.ToPoint().X + (int)EntitySize.X * (int)TileSize.X * _displayResizeFactor / 2;

    EntityDisplayRectangle.Width = -((int)EntitySize.X * (int)TileSize.X * _displayResizeFactor);
}
EntityDisplayRectangle.Y = (int)Position.Y - ((int)EntitySize.Y + 1);

here is two screenshots of what i curently have:

the red dot is a point drawn by this line

spriteBatch.DrawPoint(new Vector2(getEntityDisplayRectangle().X, getEntityDisplayRectangle().Y), Color.Red, 3);

So, is there an other way to do or is it even possible?

The player texture is from a tileSet and i use a source rectangle to pick the correct image from it

here is the code that draws the player:

spriteBatch.Draw(TileSet, EntityDisplayRectangle, TileSetOffsetRectangle, Color.White);

Up:

here is the rectangle drawn with a draw rectangle

Note: the red box is the collision box. it's showwn just for debug purpose

it seems that the rectangle struggle to exist when it's width is negative.

sentences:
Is async image loading possible? Can anyone tell me if there is a async version of LoadImage() method? I found about Resources.LoadAsync, however the method doesnt work.

Thank you

sentences:
Limiting the speed of a dragged sprite in Cocos2dx I am trying to drag a row of sprites using ccTouchesMoved. By that I mean that there is a row of sprites (they are colored squares) lined up next to each other and if I grab one with a touch the rest follow it. If a sprite moves off screen I want to append it to the rest of the sprites in formation. However, if the sprite formation moves too fast it creates a slight gap between it and the appended sprites. How do I go about limiting the speed that I can drag the sprite with ccTouchesMoved? This is the only solution I could think of to my problem. If anyone has another suggestion to prevent this sprite gap from happening I would appreciate it.

In ccTouchesBegan I loop through the sprites, mark the one that is touched(used for another part of game), and save the distance between the touch point and every other sprite.

touch = (CCTouch*)(touches->anyObject());
location = touch->getLocation();
for (int i = 0; i < grid->getGridSizeY(); i++) {
    for (int j = 0; j < grid->getGridSizeX(); j++) {
        button = grid->button(i, j);
        button->setDistanceX(location.x-button->getPositionX());
        button->setDistanceY(location.y-button->getPositionY());
        if (button->boundingBox().containsPoint(location)) {
            button->setTouched(true);
        }
    }
}

Then in ccTouchesMoved I loop through all the sprites again and set them to always be the same saved distance from the touch point.

touch = (CCTouch*)(touches->anyObject());
location = touch->getLocation();
for (int i = 0; i < grid->getGridSizeY(); i++) {
    for (int j = 0; j < grid->getGridSizeX(); j++) {
        button = grid->button(i, j);
        button->setPositionX(touchLocation.x - button->getDistanceX());
        button->setPositionY(touchLocation.y - button->getDistanceY());
        }
    }
}

This is the update method code only for a sprite moving off the left side of the screen. No point in writing all the sides until I get one side to work:

for (int i = 0; i < grid->getGridSizeY(); i++) {
    for (int j = 0; j < grid->getGridSizeX(); j++) {
        button = grid->button(i, j);
        //Replaces button if it goes off left side of grid
        if (button->getPositionX() < grid->button(0, 0)->getPositionX() - button->boundingBox().size.height / 2) {
            button->setPositionX(grid->button(grid->getGridSizeY() - 1, 0)->getCoord().x + button->boundingBox().size.height / 2);
            button->setDistanceX(location.x-button->getPositionX());
        }
    }
}

sentences:
Which will be faster? Switching shaders or ignore that some cases don't need full code? I have two types of 2d objects:

In first case (for about 70% of objects), I need that code in the shader:

float2 texCoord = input.TexCoord + textureCoord.xy

But in the second case I have to use:

float2 texCoord = fmod(input.TexCoord, texCoordM.xy - textureCoord.xy) + textureCoord.xy

I can use second code also for first case, but it will be a little slower (fmod is useless here, input.TexCoord will be always lower than textureCoord.xy - textureCoord.xy for sure).

My question is, which way will be faster:

Making two independent shaders for both types of rectangles, group rectangles by types and switch shaders during rendering.
Make one shader and use some if statement.
Make one shader and ignore that sometimes (70% of cases) I don't need to use fmod.

sentences: Money Every Minute System? I'm making a 2D sandbox tycoon in UE4. I haven't started the money system yet, but I was wondering how I could make a money system that gives you a certain amount of money per real-life minute. Then, I want to connect this system up to some text so that the digits go up by whatever amount each minute.

sentences:
Keep player within screen bounds, top down shooter I am using x and z axis to go left/right ; up/down respectively. The Camera is on the y-axis.

I have the following code so far -

private float playerWidth;
    private float playerDepth;

private Vector2 screenBounds;

// Other Variables and Initiators

// Start is called before the first frame update
void Start()
{
    playerRigidbody = GetComponent<Rigidbody>();
    screenBounds = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, Camera.main.transform.position.z));
    //gives x and y values that will be half the screen value. Screen coordinate system is reversed, so these will be negative values
    playerWidth = transform.GetComponent<BoxCollider>().bounds.size.x / 2;
    playerDepth = transform.GetComponent<BoxCollider>().bounds.size.z / 2;
    // we need half the size as we already are at the center of the object, using clamp
}

Tutorials are using SpriteRenderer as this would make more sense in a 2D game, however I am working in 3D space, creating a 2.5D effect.

private void LateUpdate()
    {
        withinScreenBounds();
    }

private void withinScreenBounds()
{
    // check if player does not exceed camera view, else stop all movement.
    Vector3 viewPos = transform.position;
    viewPos.x = Mathf.Clamp(viewPos.x, screenBounds.x + playerWidth, screenBounds.x * -1 - playerWidth);
    viewPos.z = Mathf.Clamp(viewPos.z, screenBounds.y + playerDepth, screenBounds.y * -1 - playerDepth);
    transform.position = viewPos;
    // the above will work with the center of the tank.
}

The tank is currently jittering between screenpoints, not sure if this has to do with the boxcollider itself.

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:
As an indie game dev, what processes are the best for soliciting feedback on my design/spec/idea? Background

I have worked in a professional environment where the process usually goes like the following:

Brain storm idea
Solidify the game mechanics / design
Iterate on design/idea to create a more solid experience
Spec out the details of the design/idea
Build it

Step 3. is generally done with the stakeholders of the game (developers, designers, investors, publishers, etc) to reach an 'agreement' which meets the goals of all involved. Due to this process involving a series of often opposing and unique view points, creative solutions can surface through discussion / iteration. This is backed up by a process for collating the changes / new ideas, as well as structured time for discussion.

As a (now) indie developer, I have to play the role of all the stakeholders (developers, designers, investors, publishers, etc), and often find myself too close to the idea / design to do more than minor changes, which I feel to be local maxima when it comes to the best result (I'm looking for the global maxima, of course).

I have read that ideas / game designs / unique mechanics are merely multipliers of execution, and that keeping them secret is just silly. In sharing the idea with others outside the realm of my own thinking, I hope to replicate the influence other stakeholders have.

I am struggling with the collation of changes / new ideas, and any kind of structured method of receiving feedback.

My question: As an indie game developer, how and where can I share my ideas/designs to receive meaningful / constructive feedback? How can I successfully collate the feedback into a new iteration of the design? Are there any specialized websites, etc?

sentences:
Shadow-casting through time acting in "reverse" before next notciable shadowmap update question was re-written to better explain the problem

I have a scene of big thin parallelepiped, small cube, and a light source, all aligned on Y axis, like so:

 _
| |
| |----[ ]----Light
|_|

Both objects are static and light is sliding on Y axis only.

Also, a tiny (32x32) depth texture from Light's PointOfView is being rendered off-screen and then applied to both cube and parallelepiped on on-screen rendering stage, making effect of a shadow being casted by a small cube on a big parallelepiped.

The problem i am experiencing is that when light moves away from cube, such low-res depth texture is getting updated only 6-7 times, but it's projection on surfaces updates constantly and wrongly: while shadow is supposed to shrink when lightsource moves away and grow when lightsource moves closer, it is in fact doing the reverse between updates of texture projection! In other words, between two updates of texture, it's projection on a parallelepiped grows when light moves away and shrinks when light moves closer and then "jumps" when texture updates, which is looking very wrong.

To better show the problem, i've made this video: http://www.youtube.com/watch?v=XOraTZimmUU (the square in right-upper corner is the depth texture, made from light's POV).
As you can see, at first i am moving light out (decresing negative Y) and you can notice projection growing between "jumps" of texture updates. Then i am moving light in and you can notice projection shrinking between the same "jumps".

My question is: how to reverse this shrinking-growing behavior without increasing shadowmap texture resolution (which only make problem less noticable, but not completly solved)?

Shaders used to map texture on:

Vertex:

#version 120
struct light_t {
  vec3 spot_dir;
  vec3 position;
  mat4 MVP;
  mat4 V;
  mat4 P;
};
attribute vec4 in_position;
uniform mat4 MVP;
uniform mat4 M;
uniform mat4 V;
uniform mat4 P;
uniform light_t light;
varying vec4 shadowcoord;
void main() {
  gl_Position = MVP * in_position;
  mat4 bias = mat4(0.5, 0.0, 0.0, 0.0,
                   0.0, 0.5, 0.0, 0.0,
                   0.0, 0.0, 0.5, 0.0,
                   0.5, 0.5, 0.5, 1.0);
  shadowcoord = bias * light.MVP * in_position;
}

Fragment:

#version 120
varying vec4 shadowcoord;
uniform sampler2D shadowmap;
void main() {
  vec4 color = vec4(0.5);
  float factor = 1.0;
  float z = texture2DProj(shadowmap, shadowcoord.xyw).z;
  if (z < (shadowcoord.z-0.0005)/shadowcoord.w) factor = 0.2;
  gl_FragColor = factor * color;
}

The full self-contained source of minimal (~900 lines, meh) example (extracted from full-scale project) is here (glm math library, C++ compiler and glut is needed):

Compile line:

g++ -g -o example main.cpp  -lGL -lGLU -lglut -lGLEW

Actual source:
http://paste.eientei.org/show/287/

WebGL playground: webglplayground.net/saved/NAfoKmQqJb

sentences:
Which nodes of the Collada DAE are most relevant for game object/character use? I'm really new to game dev / D3D. And I was looking to choose an intermediary format to work with and convert to my internally used format. Collada DAE seems to be good as it can export animation too and it's XML. Kind of bloated but easy to parse.

My expertise is in reusable code writing, libraries, APIs and such. So my first impulse was to go an implement a FULL parser of the Collada format given the fact that I'm not 100% what I need or will need to extract from it.

As it seems Collada is trying to be everything and the kitchen sink, there's definitely stuff in there I don't think I need to be concerned about. So, sanity prevailed and decided to come here and ask the experienced people what are the important nodes for game characters and objects in the .DAE file? Or is there another format considered friendlier by game devs that can export animations too?

I've figured out the following are important:

geometries (mesh + triangles)
materials + images
animations + controllers
visual scenes + scene

What else am I missing from the top-level node list? I don't think lights are important as I deal with that in code. I just need to import meshes + textures + animations. At least for now, as I'm just starting out in D3D programming.

For a non-animated object I can get away with a .OBJ file but for a player with animations, I really don't think .OBJ supports them.

  So the question is: Which DAE nodes are relevant to game objects and animated characters?... and if someone experienced consuming this format could provide a few words describing them, in a more game-friendly way then that specification... would be great! Or should I use another intermediary format but .DAE?

sentences:
Why should I consider using the Source Engine? I've always been a Valve fan, but now that I have the opportuninty to choose a game engine for a project I'm not sure I want to choose the Source Engine after watching this wikipedia entry. My options essentially boiled down to an open source stack (Horde3D + Zoidcom + Spark + SFML + CEGUI, and well, not OSS but PhysX too), UDK and the Source Engine.

My question is (because I really have no experience with it) what would be the technical reasons (not license or other) for any developer to choose the Source Engine over any other open source or commercial option ?, is the Source Engine really worth it as a game development tool or has it time already passed and it is obsolete against other solutions?.

Thanks

Edit: Precised my question a little more
, I'm looking for technical reasons to choose the Source Engine.

sentences:
Rotating Sprite around Y-Axis (2D) I'm going to be creating a game soon, and part of it involves spinning sprites. The sprites will be spinning around the Y-Axis (imagine a spinning plate on top of a stick, where the stick stands up vertically.

The main way I've thought of is to have a series of sprites for various rotation values that I blur between as the 'plate' rotates (the sprite is more complex than a plate, though).

The game will be for iPhone, but I'm open to using any 2D gave development library for it.

sentences:
How to change the color of an invalid texture? In openGL, when I don't bind a texture, or I bind a texture that was loaded incorrectly, any calls to texture2D/texelFetch in the shader will return vec4(0, 0, 0, 1), is there a way to change this to return vec4(1, 1, 1, 1) instead?

Initially I looked for a way to test if the sampler2D was valid, and when I couldn't find that I tried using glColor4f, but that doesn't seem to work either--although that could be the amdgpu driver, it seems to have some trouble with the old pipeline calls generally.

Is there someway to change what this default return color is?

sentences:
How can I show slow motion? In my very, very simple 2D game I'm working on, I'd like there to be moments of slo-mo.

What is the best method of showing the player that the game is currently in slow-motion? As in, what is the most typical and obvious method used by most current games where slow-motion is a feature?

I'm fairly new to game development, and even newer to this site, so am looking for an answer which contains, basically, just bullets of things which should be different between real-time and slow-motion-time.

"Best," to avoid opinionated answers, means established and recognized, common methods of demonstrating slow-mo.

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:
What is the "main" implementation of OpenGL? What is the main implementation of OpenGL?

I see GLUT everywhere, but I want to use whatever is closest to an official implementation, or what ever I will have the most control over.

I might not be asking this right since it's contributed to by different parties. Which is why I have been looking at DirectX, but I see more people using OpenGl so I'd like to use that instead.

sentences:
Jump script using AddForce not working I am making a simple jump script by adding a separate script to the character.
I got the character from the Asset Store and I have left it untouched. I have searched the solution and similar problems to this, and I changed the force or JumpHeight to a pretty high value. But it is still nothing. The logs are printed out just fine.
public class JumpScript : MonoBehaviour {
public Rigidbody rb;
public float JumpHeight = 7.0f;

// Update is called once per frame
void Update () {
    if (Input.GetKeyDown (KeyCode.Space)) {
        Debug.Log ("PRESSSED");
        GetComponent<Rigidbody> ().AddForce (Vector3.up * JumpHeight);
        Debug.Log (GetComponent<Rigidbody> ());
    }
}

sentences:
How do I make an entity move in a direction? I have an Entity instance which is updated every game tick. Let's just assume that entity moves forward constantly. I'd like to be able to give the entity's angle to a function that makes it move in that direction:

moveForward(90); should make them move to the right. If I declared my rotation as a global int, then doing

moveForward(rotation);
rotation++;

would make it trace a small circle with its movement.

How can I do this? I assume this involves vector math; I don't know any, so a brief explanation would be nice.

sentences:
Knowing state of game in real time I'm trying to code a tic tac toe game in java and I need help figuring out how to efficiently and without freezing the program check if someone won the game.

I'm only in the design stages now, I haven't started programming anything but I'm wondering how would I know at all times the state of the game and exactly when someone wins?

Response to MarkR: (note: had to place comment here, it was too long for comment section)

It's not a homework problem, I'm trying to get more practice programming GUI's which I've only done once as a freshman in my second introductory programming course. I understand I'll have a 2D array. I plan to have a 2D integer array where x would equal 1 and o would equal 0. However, won't it take too much time if I check after every move if someone won the game? Is there a way or a data structure or algorithm I can use so that the program will know the state (when I say state I mean not just knowing every position on the board, the int array will take care of that, I mean knowing that user 1 will win if he places x on this block) of the game at all times and thus can know automatically when someone won?

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: Bouncing effect in Farseer WP7 I'm not quite sure what I need to do, but I have a ball falling from the sky and it needs to bounce when it hits an object. Do I configure the ball in some way or do I need to setup a spring object or possibly do something on collision?

sentences:
How do you animate/collide against a tessellated mesh? Now that I have a implemented tessellation for my mesh, I am trying to understand how I can leverage the generated primitives.

Example:

I have the following track mesh generated procedurally, it consists of quads, in the first picture you can see one of them I am highlighting using the mouse.

In the following picture, the shader applies some tessellation, you can see that now a quad has generated 16 quads.

Question (two-folded):

Now that I have more control points for each of my quad, suppose I want to deform one of them, for instance, to look like the following:

How is one supposed to apply such transformation ?

basically, what in terms of code-behind / shader code infrastructure is required to achieve such thing.

How can collisions be checked for against that deformed mesh ?

from what I've understood, a mesh collider would be unpractical since it's a heavy operation that just forbids real-time updates

sentences:
Using The Box2D Polygon "Set()" function? I'm using the Box2D physics engine. And there's a type of shape for box2D called b2PolygonShape.

In this class, you can create polygons. There is also a Set() function that takes an array of points and a vertex count.

Box2D has an example like this:

// This defines a triangle in CCW order.

b2Vec2 vertices[3];

vertices[0].Set(0.0f, 0.0f);

vertices[1].Set(1.0f, 0.0f);

vertices[2].Set(0.0f, 1.0f);

int32 count = 3;

b2PolygonShape polygon;

polygon.Set(vertices, count);

This works. Yet when I tried to practice and mess with this function, I did this:

  b2Vec2 vertices[4];

  vertices[0].Set(0, 0);
  vertices[1].Set(0,10);
  vertices[2].Set(10,10);
  vertices[3].Set(10,0);

  int32 count = 4;

  b2PolygonShape polygon;

  polygon.Set(vertices, count);

When I compiled and ran this, it crashed after the Set() function. Wouldn't this create a square?

Also in the console I got this:

Assertion failed: s > 0.0f

What did I do wrong?

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: Is there a significant amount of overhead when using STL containers instead of plain arrays? I have read discouraging statements about using plain arrays in c++. Where videogame development is involved we are aiming, as far as I know, at max speed execution. STL containers (such as std::vector) bring some elements not present in plain old arrays (iterators, etc). Does such functionality add overhead? (e.g. pointer chasing, etc) If so, is it worth it in real life to lose some speed in exchange for type safety?

sentences:
how to reset etsa function GetJoystickNames in unity? the problem is that if I connect a command the array
GetJoystickNames increases an index but if you disconnect it does not reduce the index and continues counting as if it were connected

sentences:
Job prospects for game QA/testers I'm currently a (happily employed) automated software tester that's curious about game testing/QA. Do game companies hire dedicated testers for pay? If yes, then what are the job prospects like? If no, then how does becoming a game tester work (volunteers? mixed roles? crowdsourcing?). Obviously game companies have full-time devs, artists, designers, managers, etc. but what does QA look like?

NOTE: I'm curious about how QA works in a game dev setting, but I'm not really looking for job tips or "Do this if you want to get into game QA".

sentences:
Framerate Dependant Steering Behaviour I've been studying steering and flocking behaviors, if not directly from Craig Reynolds work on Steering Behaviors For Autonomous Characters (http://www.red3d.com/cwr/steer/). I understand the basic concepts and how to apply forces but the main issue with this is performance. Using Unity, ECS and the job system, I have been able to implement a multi-threaded implementation of some simple behaviors (seek, arrival, evade etc).

The problem is simply that all of the implementations of steering behaviors that I find are all based on this same principle and they all seem to suffer from the same problem - framerate independence. For example, a simplified example of seeking:

// get a vector pointing directly at our target, at the maximum speed.
desired_velocity = normalize(target - position) * max_velocity

// get the steering force direction
steering = desired_velocity - velocity

// ensure the steering force never exceeds our maximum steering force
steering = truncate(steering, max_steering_force)

// ensure the velocity never exceeds the max speed
velocity = truncate (velocity + steering , max_speed)

// apply our velocity
position += velocity * delta_time

When dealing with the final velocity, we are utilizing delta_time to ensure that the velocity is applied in a framerate independent manner. But the steering force is not framerate independent at all. If this was running at 120fps, the steering would reach it's maximum velocity much faster than if the game was running at 30fps.

Is there something more I should be doing here. I've experimented with using delta_time with the steering, but that seems to make little difference.

sentences:
Drawing simulator - Tracking mouse movement I was wondering what would be the logic behind coding a drawing simulator like the one on this website: https://www.mdbg.net/chindict/chindict.php?page=chardict&cdcanoce=0&cdqchi=
The paintbrush tool when you click it, once you start drawing strokes that a similar to what a character is, it will automatically bring out a list of characters that leads toward what you are drawing. Once you are finished, the correct character will show up.
To my idea, I think that a set of coordinates are set already and once the mouse coordinates passes through these points, then from there it will detect and provide all the possibilities and narrows it even further. I think this is very complex but what would be the right path/correct way to go about programming this concept?

sentences:
Shader or No Shader? I have a question about something I don't really understand.
In OpenTK, should I have shaders? Is it frowned upon not to? What are the pros and cons of having shaders?
Can I go perfectly fine without having anything to do with vertex or fragment shaders?

sentences:
How can I change displayed information as a physical control knob is slid along a track I'm making an installation for exhibition or demonstration purpose.

I want to have a physical handle the viewer can slide along a track. As they do so, the information displayed on the screen should change, to correspond to the segment of the track the handle is currently within. Something like what's shown in this YouTube video:

https://www.youtube.com/watch?v=DOElf77g5yI&feature=youtu.be

How can I achieve this?

sentences:
SDL-2.0 library not working with codeblocks-13.12-mingw-tdm I started following lazyfoo's sdl 2.0 tutorials. This is the very first tutorial that explains how to set up SDL 2.0 with code::blocks - SDL 2.0 with code::blocks setup. I am doing exactly what it says but still getting this error:-

|121|fatal error: winapifamily.h: No such file or directory|
    ||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

This is the code that I tried to run. I copied and pasted exactly as it is given in the source code for the tutorial :-

/*This source code copyrighted by Lazy Foo' Productions (2004-2015)
and may not be redistributed without written permission.*/

//Using SDL and standard IO
#include <SDL.h>
#include <stdio.h>

//Screen dimension constants
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;

int main( int argc, char* args[] )
{
    //The window we'll be rendering to
    SDL_Window* window = NULL;

    //The surface contained by the window
    SDL_Surface* screenSurface = NULL;

    //Initialize SDL
    if( SDL_Init( SDL_INIT_VIDEO ) < 0 )
    {
        printf( "SDL could not initialize! SDL_Error: %s\n", SDL_GetError() );
    }
    else
    {
        //Create window
        window = SDL_CreateWindow( "SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN );
        if( window == NULL )
        {
            printf( "Window could not be created! SDL_Error: %s\n", SDL_GetError() );
        }
        else
        {
            //Get window surface
            screenSurface = SDL_GetWindowSurface( window );

            //Fill the surface white
            SDL_FillRect( screenSurface, NULL, SDL_MapRGB( screenSurface->format, 0xFF, 0xFF, 0xFF ) );

            //Update the surface
            SDL_UpdateWindowSurface( window );

            //Wait two seconds
            SDL_Delay( 2000 );
        }
    }

    //Destroy window
    SDL_DestroyWindow( window );

    //Quit SDL subsystems
    SDL_Quit();

    return 0;
}

sentences:
Unity: Instantiate an object respecting the prefab's default rotation Simple question, I hope.

I've built a variety of prefabs for an isometric shooter game (hazards, enemies, health indicator bars, popup texts, shots, explosions).  All of these prefabs were constructed with default rotations appropriate for the gameplay.

My problem is that Instantiate() will overwrite the default rotation of the prefab with whatever is specified as the rotation parameter.  So I'm left with hard-coded rotations in my Instantiate() calls to get things oriented correctly in the X-Z plane. (0,180,0) and (90,0,0) are common ones.  I'd much prefer to Instantiate prefab gameObjects consistently with "no change to their default rotation," but I'm not sure how to accomplish this.

Thanks for the help,
Mike.

sentences:
Unity: Messages in Compound Colliders Lets say I have a 2D character with two colliders: a circle collider that represents the feet, and a box collider that represents the body. Lets say that the character is currently standing on the ground, i.e. only the feet collider is in contact with the ground collider. According to the Unity manual, I will receive an OnCollisionEnter2D message. That message contains a Collision2D object that contains an otherCollider field of type Collider2D. I don't see anything in that object that would tell me which of the two colliders - the body or the feet - initiated the message.

So my question is this: how do you figure out which collider in a compound collider initiated a collision/trigger message?

sentences:
Speed up content loading I am using WinForms Sample downloaded from microsoft website. The problem is, that the model loading time is quite long, using:

contentBuilder.Add(ModelPath, ModelName, null, "ModelProcessor");
contentManager.Load<Model>(ModelName);

even a simple model, such as a cube with no textures, takes 4+ seconds to load. Now, I am no expert on this, but is there anyway to decrease loading time?

EDIT:

I've gone thru the code and found out that calling contentBuilder.Build(); ,which comes right after contentBuilder.Add() method takes up most of the time.

sentences:
Unity SkinnedMeshRender: is there a way to cache mesh and restore later? In unity, I'm writing a script that deforms a mesh associated with a SkinnedMeshRenderer pretty significantly. However, at some point, I'd like to reset it back to particular states. I'd like the ability to both reset to its original position, and an intermediate position.

Right now, I've tried baking the mesh:

Mesh originalMesh = new Mesh();
skinnedMeshRenderer.BakeMesh(originalMesh);

But when I then try to restore it:

skinnedMeshRenderer.sharedMesh = originalMesh;

It doesn't seem to behave as I would have expected.

I've also tried:

Mesh originalMesh = skinnedMeshRenderer.sharedMesh;
//deform sharedMesh
skinnedMeshRenderer = originalMesh;

but this does nothing since it seems to be just storing a reference.

Am I missing something obvious here?

Just to add detail, I want to take a snapshot of all the verticies, weights, blendshapes, etc. And then restore everything back to the snapshot at a later moment in time. I can reset the blendshapes fine, but the mesh seems to be messed up.

sentences:
Animation of moving circle by square's outer surface I want to make this animation in OpenGL, here I attached a simple gif how I want it to looks like:

Main problem is that I can not figure out how to move by corner - circle should smoothly move by corner, not to just jump to another side's begin position.
import Blender
from Blender import Draw,BGL
from Blender.BGL import *
from math import sin,cos
import time

squareLength, squareX, squareY, circleRadius = 200, 200, 200, 20
movingX, movingY = 0, 0

def event(evt, val):
    if evt == Draw.ESCKEY :
        Draw.Exit()

def gui():
    global movingX, movingY

    glClearColor(0.17, 0.24, 0.31, 1.0)
    glClear(BGL.GL_COLOR_BUFFER_BIT)
    glLineWidth(1)
    glColor3f(0.74, 0.76, 0.78)

    glBegin(GL_QUADS)
    glVertex2i(squareX, squareY)
    glVertex2i(squareX, squareY + squareLength)
    glVertex2i(squareX + squareLength, squareY + squareLength)
    glVertex2i(squareX + squareLength, squareY)
    glEnd()

    glColor3f(0.58, 0.65, 0.65)

    glPushMatrix()

    if movingX == -circleRadius:
      if movingY < squareLength:
        movingY += 1
      else:
        movingX = 0
        movingY = squareLength + circleRadius
    else:
      if movingY == squareLength + circleRadius:
        if movingX < squareLength:
          movingX += 1
        else:
          movingX = squareLength + circleRadius
          movingY = squareLength
      else:
        if movingY < 0:
          if movingX > 0:
            movingX -= 1
          else:
            movingX = -circleRadius
            movingY = 0
        else:
          if movingY > 0:
            movingY -= 1
          else:
            movingX = squareLength
            movingY = -circleRadius

    glTranslatef(movingX, movingY, 0)

    glBegin(GL_LINE_LOOP)
    for i in xrange(0, 360, 1):
        glVertex2f(squareX + sin(i) * circleRadius, squareY + cos(i) * circleRadius)
    glEnd()

    glPopMatrix()

    Draw.Redraw(1)

Draw.Register(gui, event, None)

Can you please say me, how can I optimize this code to make circle moving by corners?
Just start learning computer graphics and think up such exercises for training, so I will really appreciate for any help.

sentences:
apply non-hierarchial transforms to hierarchial skeleton? I use Blender3D, but the answer might not API-exclusive.

I have some matrices I need to assign to PoseBones. The resulting pose looks fine when there is no bone hierarchy (parenting) and messed up when there is.

I've uploaded an archive with sample blend of the rigged models, text animation importer and a test animation file here:
http://www.2shared.com/file/5qUjmnIs/sample_files.html
Import the animation by selecting an Armature and running the importer on "sba" file.
Do this for both Armatures.

This is how I assign the poses in the real (complex) importer:

matrix_bases = ... # matrix from file
animation_matrix = matrix_basis * pose.bones['mybone'].matrix.copy()
pose.bones[bonename].matrix = animation_matrix

If I go to edit mode, select all bones and press Alt+P to undo parenting, the Pose looks fine again.

The API documentation says the PoseBone.matrix is in "object space", but it seems clear to me from these tests that they are relative to parent bones.

  Final 4x4 matrix after constraints and drivers are applied (object
  space)

I tried doing something like this:

matrix_basis = ... # matrix from file
animation_matrix = matrix_basis * (pose.bones['mybone'].matrix.copy()  * pose.bones[bonename].bone.parent.matrix_local.copy().inverted())
pose.bones[bonename].matrix = animation_matrix

But it looks worse. Experimented with order of operations, no luck with all.

For the record, in the old 2.4 API this worked like a charm:

matrix_basis = ... # matrix from file
animation_matrix = armature.bones['mybone'].matrix['ARMATURESPACE'].copy() * matrix_basis
pose.bones[bonename].poseMatrix = animation_matrix

pose.update()

Link to Blender API ref:

http://www.blender.org/documentation/blender_python_api_2_63_17/bpy.types.BlendData.html#bpy.types.BlendData

http://www.blender.org/documentation/blender_python_api_2_63_17/bpy.types.PoseBone.html#bpy.types.PoseBone

sentences:
XNA 2D Collision Detection without GetData() I'm currently working on a Worms game which involves terrain deformation. I used to do it with .GetData(), modifying the color array, then using .SetData(), but I looked into changing it to make the work done on the GPU instead (using RenderTargets).

All is going well with that, but I have come into another problem. My whole collision detection against the terrain was based on a Color array representing the terrain, but I do not have that color array anymore. I could use .GetData() every time I modify the terrain to update my Color array, but that would defeat the purpose of my initial changes.

What I would be okay with is using .GetData() once at the beginning, and then modifying that array based on the changes I make to the terrain later on by some other means. I do not know how I would do this though, can anyone help?

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:
Libgdx explain steps for beginner to create and use image as a box2d body I am basically from corona background and new to LibGdx , familiar with stage and actor from scene2D.  Now wants to use physics body from box2d  in the game besides using actor from scene2D.

But I need to use images in the game as body... not shapes..

anyone please explain me the steps to use images as a body.

Thanks..

sentences: 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:
Artifacts at seams between meshes in Unity in isometric camera only I'm trying to piece together some very simple placeholder models that I intend to use as tiles in Unity and I'm seeing odd pixel artifacts along the seams of the tiles that only show up when using an isometric camera. You can see them in this image.

And the same geometry but just from a perspective camera shows no artifacts.

I verified that the two models are exactly aligned right along the seam by checking the actual vertex data. The artifacts are dependent on the camera itself and shift along the seam as the camera is panned and zoomed.

I've disabled shadows, set the texture filter mode to point, disabled mipmap generation

The geometry is quite simple and is imported from the OBJ file below.

# normals
vn -1 0 0
vn 1 0 0
vn 0 0 1
vn 0 0 -1
vn 0 -1 0
vn 0 1 0

# texcoords
vt 0.970703 0.5
vt 0.974609 0.5

# verts
v 0 2 0
v 0 2 -4
v 0 2.3 0
v 0 2.3 -4
v 0 2.5 0
v 0 2.5 -4
v 4 2 0
v 4 2 -4
v 4 2.3 0
v 4 2.3 -4
v 4 2.5 0
v 4 2.5 -4

# faces
f 3/2/1 2/2/1 1/2/1
f 4/2/1 2/2/1 3/2/1
f 5/1/1 4/1/1 3/1/1
f 6/1/1 4/1/1 5/1/1
f 7/2/2 8/2/2 9/2/2
f 9/2/2 8/2/2 10/2/2
f 9/1/2 10/1/2 11/1/2
f 11/1/2 10/1/2 12/1/2
f 7/2/3 3/2/3 1/2/3
f 9/1/3 5/1/3 3/1/3
f 9/2/3 3/2/3 7/2/3
f 11/1/3 5/1/3 9/1/3
f 2/2/4 4/2/4 8/2/4
f 4/1/4 6/1/4 10/1/4
f 8/2/4 4/2/4 10/2/4
f 10/1/4 6/1/4 12/1/4
f 2/2/5 7/2/5 1/2/5
f 8/2/5 7/2/5 2/2/5
f 5/1/6 11/1/6 6/1/6
f 6/1/6 11/1/6 12/1/6

With the following texture applied as Albedo on a default Unity material (a bit odd since it was originally generated in MagicaVoxel)

I'm really at a loss for what could be causing these to show up. Only spotted them because I was testing an outline shader and it was outlining all the artifacts as the normals on those pixels were odd. With a pixel shader set to display _CameraNormalsTexture instead of the color the artifacts are still visible as variances in the normals as you can see in the image below.

sentences:
Weird libGDX BitmapFont Color Change (And Alpha) Bug I want to change the color of my libGDX BitmapFont, but it can't change it. The font is generated with Hiero v5 (Lastest as I Know) but the color of the font doesn't change. Here is the example code, the important part here is how modify the alpha channel for an animation I want.

font = new BitmapFont(game.getAssets().getFont(0.9f).getData(), game.getAssets().getFont(0.9f).getRegion(), false);
textLayout = new GlyphLayout(font, "Tap to Start");
textPosition = new Vector2();
textPosition.x = Constants.HALF_WIDTH - (textLayout.width/2);
textPosition.y = 150;
//font.setColor(255f/255f, 183f/255f, 77f/255f, 0.3f); This doesn't work as well
font.getCache().setColor(255f/255f, 183f/255f, 77f/255f, 0.3f);

//Font Drawing in render Method
font.draw(batch, textLayout, textPosition.x, textPosition.y);

Here is a screen of the result of this code (color doesn't change).

Font resource image has white letters and transparent background.

sentences:
Jumping to land x pixels ahead while not really moving (2D) The player object in my game has its x-axis locked. It can only jump on Y. It's the ground that constantly moves to the left so that it appears like the player is moving to the right.

The ground is moving left at a speed of 240 pixels per second.

Whenever the player falls and hits the ground, I want it to jump so that it hits the ground again when it has gone 180 pixels to the left.

So, it should jump, the ground should get to move 180 pixels and then the player should hit the ground at that moment and jump. Then repeat. 180 pixels each time.

Oh and, the jump height may be variable. Specifically, there will be two jumps: a small jump and a big jump. Both need to land after the ground has moved 180 pixels.

I'm bad at math, so I can't figure it out. I would appreciate any help!

sentences:
XNA Collision In An Entity Part System I've hit a loss in creating a "game engine" in XNA, I'm extremely confused over how to approach collision in an Entity-Part System ( following this as a reference ). I can make all the entities with a collision part speak with one another, but lets say the system I'm using to check collision between all the entities with a collision part picks up a collision how does it go "Oh, since the player is colliding with fire they should take damage" instead of only being able to check which entity should move if any and enacting that.

I've got the EPS set up in my project and all is working happily, I just really want to learn and I'm finding myself far too stuck on this problem to continue farther.

My past work with inheritance and checking these things was very uncomfortable as it checked collision then both objects ran a function that passed the other object in and then it was hardcoded to see what type of object it was and if it was a certain thing ( like an event box which lowers the players movement ) it would act onto that thing. It was just far to clunky and requires a lot of extra work to make sure there are no problems.

This whole concept just seems to fall apart for me when I think of collision including anything past position correction. I really want to learn and need help and will be very appreciative with anyone who can help me get this concept. I'm not sure why it's so elusive to me, and is causing me great distress that I just can't understand it despite thinking about it through most parts of the day the past two days. I just want to build a non-invasive and easy to understand system for this.

So far I just understand that I should attach a collisionPart to the entity and then in my EntityManager I'll add a system that can check through all these entities, determine collision, and act on that.

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: What is balance needed between testing the game mechanic (play testing) and testing the code I do not work in the industry and I wondered very broadly what percentage is given over to play testing versus getting the bugs out.  Or does no-one really work it like this?

sentences:
How can I find the offset rotation and position between two objects in 3D? I have two objects in 3 dimensions, one of them (Child) is attached to the other one (Parent) using the offset between them (XYZ - position and rotation).
Using the Vector3 library, how can I find that Child offsets from the Parent?

Further explanation: let's say we have the parent at position X:0 Y:0 Z:0 with rotations RX:0 RY:0 RZ:0, and there is an attached Child to it with the offset X:10 Y:10 Z:10, RX:90 RY:45 RZ:90 (which is what I want to know). Supposedly, I had the Parent with a different position and rotation, how can I get the offset between it and the Child (which in this case, it should be X:10 Y:10 Z:10, RX:90 RY:45 RZ:90) (in another word, I want the Child position and rotation as the Parent is the center of the map)

I've tried simple math and some other ways on the internet but with no success, since I'm pretty bad at calculating rotations (since vector3 libraries are pretty identical, so as Math libraries, any language should be fine).

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: Implementing a tile-based game Which data structure should be best used to store a pile of tiles from which a player can pick a random tile?

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:
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:
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:
XNA - How to use One Rectangle in sprites for collisions I'm new to XNA and game development in general. If I want to make an object solid so my character cannot pass through it, I would use several Rectangles to make the collision more "realistic"

What I do is to use the method Intersects() with both;

This are two Rectangles that will be solid. (Highlighted in Red):

And I wonder if there is a way to use one rectangle to achieve something like this:

sentences:
Physics / drag of object falling through atomsphere Trying to simulate an object plunging into atmosphere.  It seems to work, until the velocity falls past terminal velocity... down to zero... and then back up!

Something must be wrong with how I am applying drag?  I've looked at the code so long, I've managed to confuse myself.

Here I set variables/constants:

Mass = 5;                           //Object Mass
Radius = 7;                         //Radius of the blunt end facing the air stream (too sensitive!!!)
Area = power(Radius,2)*pi;          //The total area of the blunt end facing the air stream
Gravity = 9.8;                      //Earth
DragCoeff = 1.61;
Velocity = 10000;                   //Initial velocity straight down (vector needs to be added)
Acceleration = Gravity * (1/Mass);  //this is acceleration FORCE... subtract drag from this
Altitude = 100000;                  //initial altitude(meters) (atmosphere "begins" at 100Km)

Then, in the main loop of the program:
(note, delta_time is provided by the system in microseconds from the last execution of the loop)

d_time = delta_time / 1000000;                                          //Convert delta_time to seconds
AirDensity = 1.07* power(2.718,-.00005*Altitude);                       //How dense is the air right now?

TermVel = sqrt(2 * Mass * Gravity / AirDensity * Area * DragCoeff);     //Terminal Velocity at our altitude
Velocity = Velocity + Acceleration * d_time;                            //Acceleration added
Drag = 0.5 * AirDensity * sqr(Velocity)* DragCoeff * Area;              //Drag calculated
Velocity = Velocity - (clamp(Drag, 0, TermVel) * d_time);               //Drag subtracted
Altitude = Altitude - Velocity * d_time;                                //Update the position

Thanks ever so much for your kind help in understanding what I've done wrong here.

SS

Edit:
Thanks, Jason... I think I have the correct changes made... but my mass of "5" was causing it to behave really poorly.... the velocity went way negative... so I increased the mass significantly, and it seems to behave better... I will explore it a bit more.

Does it look like I have it right?

Thank you again, ever so much.

SS

sentences:
How can I create a six sided tillable perlin noise image? I'm attempting to create a tillable hex shaped terrain map using c++.

As part of the process I'd like to use perlin noise, but it seems that in order to make it tillable I'll need to generate it 5 dimentionally and take a "circle" from it (if you know another way please let me know, I'm basing my theory on this post: https://ronvalstar.nl/creating-tileable-noise-maps by Ron Valstar) creating three cylinders that together make up the image

I've coded my own 2d perlin noise function but getting to 5d seems like a whole different beast

Unless anyone knows of one that already exists, I think I'll have to write my own library for generating the noise. I'm working on c++, and while I've seen a few perlin noise libraries I haven't seen any with 5d. I can generate a 5d vector feild no problem but it's the actual linear algebra where I'm confused. It'd involve me doing some quin-linear interpolation and I have no clue how to even start on that. If anyone knows how to do this already or has any resources that could help I'd appreciate it.

in summary:
1) anyone know how to generate 5d perlin?
2) anyone know of a different method to tile a six sided image generated from perlin noise?

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:
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 to get a consistent behavior for a rigid body hooked platform? Consider this platform made of RigidBody2D and PinJoint2D objects:

PinJoint2D setup is:

Softness = 0
Bias = 0.9

When I set the mass of the platform with high value, the structure starts to shake like this:

Why is this happening and how to fix that?

sentences:
Render problems (black, purple and blue effects) in old GPU and Unity3D 5.6 project on Unity 2018 Well, I have a PC that has a GPU from 2009, and now I have some problems with a fork.

The project was on Unity 5 (2015) and I have upgraded it to Unity 2018.1.0, without any problems.

But some times, when I updated scripts or changed something in the scene the problem appeared.

Is a rendering problem that only occurs in DirectX 10 (my GPU is a GeForce 9600 that supports up to DX 9.0c, so I don't underatand how this is capable of running DX 10). Because, if I run with -force-opengl all runs fine.

I can go back, but the problem is in the Library folder, because if I use "Assets > Reimport all" or I remove this folder, the problem dissapeared (before, not now).

This is the problem:

https://i.gyazo.com/eb9199b8590fddf416a8323331e20856.mp4

Researching I have worsened it:

https://i.gyazo.com/dbc5d5f19a845ec77e54d64e3cba85cc.mp4

https://i.gyazo.com/939c8fdf5fd4d68e434958e93e68da14.mp4

As you can see, sometimes the problem is blue and purple, and other times is completely black.

The last problem remembers me to: https://forum.unity.com/threads/black-textures-on-some-devices-android-versions.195328/

I have builded the project and there isn't any problem, so the problem is somewhere in the Editor or with a UNITY_EDITOR preprocessor directive.

I don't know what I have to do to fix this. Is like this is very random.

Any help?

sentences:
Layers with parallax in a game with zoom out by a transformation matrix I'm trying to implement a parallax rendering to my multi layered backgrounds. It's a classic 2d fighting game like The King of Fighters and Street Fighter.

It may have a stage composed by 5 layers.

Layers:

1 = Factor of 100% (the original, where generally the characters and the floor are present)

2 = Factor of 75%

3 = Factor of 50% (half of movement and scale of the first layer)

4 = Factor of 25%

5 = Factor of 0% (static, generally stuff very far away of the camera, like the sky, moon, stars etc.)

The camera with scale 1 shows 640 x 384 pixels, and with the max zoon out (scale 0.5) shows 1280 x 768 pixels.

Ie, all the stages of the game have a maximum size of 1280 x 768

These would be the sizes of the images of each layer aforementioned:

100% = 1280 x 768

75% = 1120 x 672

50% = 960 x 576

25% = 800 x 480

0% = 640 x 384

Every works fine when my transform matrix is with scale of 1, since it's only needed to multiply the actual camera position to the factor of the current layer being rendered.

The difficulty arises when the scale of the camera changes. It seems that I need to compensate the scale of the matrix in the parallax factor of the layers, but I can't figure out how.

Any sugestion?

--UPDATE--

Here some images of an example of a layer with 50% factor (960 x 576):

The first image the camera matrix is with scale 1 (no zoom) and is positioned in left edge of the screen. The second is the same but in the right edge and the last image is with the max zoom out (0.5).

I already correct the scale of the layer, the problem is correct the offset of its translation.

This layer is draw at the position (0, 0) relative to the stage size (1280 x 768) and with a origin Vector of (160 x 96).

--- UPDATE2 ---

I don't think my problem is in the camera matrix, because the sprites without the parallax processing are drawing correctly with any zoom, but here it is:

var gameResolution = new Vector2(640, 384);

var currentScale = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.Width / gameResolution.X * camera.Zoom,
                               GraphicsDevice.Viewport.TitleSafeArea.Height / gameResolution.Y * zoom);

var middleOfScreen = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.Width - 1) / 2f,
                                 GraphicsDevice.Viewport.TitleSafeArea.Height - 1) / 2f);

var currentTranslation = new Vector2(middleOfScreen.X - cameraPosition.X * currentScale.X,
                                     middleOfScreen.Y - cameraPosition.Y * currentScale.Y);

var cameraMatrix = Matrix.CreateTranslation(currentTranslation.X, currentTranslation.Y, 0);

cameraMatrix.M11 = currentScale.X;
cameraMatrix.M22 = currentScale.Y;

sentences:
Unity: I need to edit my prefab but I can't move anything inside it! I imported a character into Unity and turned him into a prefab. I couldn't get my custom "Look-At" script to work for the eyes, which are children of the prefab I imported. So I opened the prefab and discovered (to my HORROR) that I am unable to transform his eyes AT ALL, even in the prefab-view. It's like his body parts are made of stone, or something! I checked his eyes in the Blender scene and don't see any animation data attached to them. So how could this happen? How can I fix it?

The eyes ARE children of a bone called "root", which I don't think has any keyframes in any animation. Further, all my bones imported as empties.

sentences:
Level of detail for the map of stars I have a large list of points (millions) in 2d. Let's say it's a star map. Each star has a radius and position in space.

I want to render this map at different level of details. From a single star to entire star system, galaxy or even universe. I also want it to be fast.

So I started with a quad tree approach: loaded every point into the tree. At any moment of time I can query a tree with a simple question: Give me top N points in this region

But what is a top? I thought to myself that quads can be compared based on total radius of points that they host. So, this gives me sorting order to work with, and the algorithm boils down to a mix of quad tree and a priority queue:

priorityQueue.push(rootQuad)

while priorityQueue.size < N {
  let node = priorityQueue.pop() // take the largest node
  for each child of node {
    if child.intersects(region) {
       priorityQueue.push(child)
    }
  }
}

After this algorithm is done, I can render each point either at its location (if it's a leaf), or at the node's center of mass (if it's intermediate node). It works very fast, and gives decent results.

However there is a problem with this approach. Let's consider a simple grid of points:

If I render each intermediate quad tree node at node's center of mass, then I get these artifacts, where two nodes are collapsed into one:

It almost feels like I should start from leaves, combine individual points into single cluster, until I get N clusters, but this would kill performance.

What would you recommend to do to avoid such artifacts?

sentences:
Making game constants/tables available to game logic classes/routines in a modular manner Suppose I have a game where there are several predefined constants and charts (a XP chart, cost of goods and so on). Those could be defined at runtime, or load from files at start-up. The question is how should those logic routines access the constants and charts?

For example, I could try using global variables, but that cause all classes relying on the variables to  be tightly coupled with them.

sentences:
What knowledge would I need to make a good simulation game I have an idea for a game like theme park but don't know how simulation games are made.

I am not on my first game so I would appreciate constructive answers instead of "its hard, don't do it".

What I want is to know how simulation game mechanics are put together. I figure it would be heaver on the AI than normal games and not knowing much about AI would like to know some programming techniques I should look into for this style game.

Specific techniques please not just a book on AI.

What sort of architecture would be used? I guess it would have some sort of probability engine with pre designed events that are triggered based on the AI state.

Would it use a Finite State Machine (FSM) or be purely event driven?

Any information on how a sims game functions would be cool.

sentences:
Trigger issues (multiple events, enter/exit) not sure if this is a scripting issue or if I've implemented something wrong with the colliders, but here it goes:
All I want is a simple platform trigger that registers when the player steps on it and when they get leave.
I have BoxColliders with IsTrigger on both the platform and the player and in general everything works okay.
However there are some strange edge cases where the OnTriggerExit happens immediately after the OnTriggerEnter. Once I've even managed to stand in a place where it constantly went from Enter to Exit to Enter etc. without the player moving at all!
So I put position outputs in the debug text and the positions of where the Enter/Exit happens is in really strange places, nowhere near the trigger volume!

Initially I put a cooldown on the trigger volume, so it could only trigger every second but that doesn't solve the issue of the Exit triggering for some reason when it shouldn't.
Here's my code for the platform:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TriggerScript : MonoBehaviour
{
    public Collider player;
    public Material activeMaterial, inactiveMaterial;
    public float TriggerVolumeCooldown = 1f;

    private Renderer m_Renderer;
    private bool m_IsOnCooldown;
    private float m_CooldownStartTimestamp;

void Start()
{
    m_Renderer = GetComponent<Renderer>();
    m_Renderer.material = inactiveMaterial;
    m_IsOnCooldown = false;
}

void OnTriggerEnter(Collider collider)
{
    if (collider == player && !m_IsOnCooldown)
    {
        print(" Player entered " + collider.name + " CD: " + m_IsOnCooldown + " xyz: " + collider.GetComponentInParent<Transform>().position);
        m_Renderer.material = activeMaterial;
        m_IsOnCooldown = true;
        m_CooldownStartTimestamp = Time.time;
    }
    else
    {
        print("cooldown");
    }
}

void OnTriggerExit(Collider collider)
{
    //i++;
    if (collider == player)
    {
        print(" Player left " + collider.name + " xyz: " + collider.GetComponentInParent<Transform>().position);
        m_Renderer.material = inactiveMaterial;
    }
}

void Update()
{
    if (m_IsOnCooldown)
    {
        if (Time.time - m_CooldownStartTimestamp > TriggerVolumeCooldown)
        {
            m_IsOnCooldown = false;
        }
    }
}

}

sentences:
How I add gap between Instantiated objects? 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()
    {
        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;
            GameObject ChildGameObject = go.transform.GetChild(1).gameObject;
            ChildGameObject.GetComponent<RawImage>().texture = thisTexture;
            var raw = go.GetComponent<RectTransform>();
            raw.anchoredPosition = new Vector3(1 + 1 * gap, 6, 0);

        }
    }

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

    }
}

The way I'm doing it now is not working it's moving all the objects to the same position and not adding
equal gap's between them.
In the loop I tried to do it this way in this line :
raw.anchoredPosition = new Vector3(1 + 1 * gap, 6, 0);

sentences:
Dealing damage over multiple frames without damaging the same enemy twice I am using Physics.Overlap to find which enemies are in my damage range. But dealing damage in only one frame is not what I want. Some attacks should be active for a longer time, to catch enemies who come into range part-way through the attack.

But if I call the method again, I can get the same enemy multiple times. This means my damage will be higher if the framerate is higher. To avoid this I can:

Put a timer on the enemy that prevents damage for some period of time after taking damage. This is the simplest approach but it's bad if you have high speed, multi-hit attacks that damages the enemy multiple times quickly.
Keep track of damaged enemies with a list. As long as the hitbox is active, check every frame for enemies inside the hitbox. For each enemy found, check whether it's already in the list, add it to the list and damage it if not.
Same as #2 but use a dictionary/hashset.

Option #2 is my current approach. Hashsets are supposed to make dupe checks faster BUT I'm not sure how It does that. I use a List<damageable>  to track damaged enemies and Damageable is an interface.

How does a Hashset<Damageable> differentiate between each entry if they are interfaces?

If I use dictionaries instead I'd need to generate different keys for each enemy. That's another problem unless game objects already have some sort of unique hash key. Even then, there's the possibility of ignoring a gameobject with multiple damageable components.

Then there's also the possibility that I'm getting nothing by doing this optimization. Most hitboxes will probably intersect with 3-5 enemies at most over it's lifetime. Would looping over a list be faster anyways?

sentences: How, if possible, do you add loop cuts to models in real time? I am working on a prototype for a very low poly game. I can't figure out a way for a player to cut or break objects in real time without predefined fractures. For example, if a player cuts a tree, it will separate at the cut point rather than at a predetermine fracture. So how can you create a vertex loop and separate the halves in real time?

sentences:
Camera movement using WASD on x/z plane only I've been wearing my enter key down on google searches - I have a camera script based on the MouseOrbit.js asset. That's all working fine, but in addition to the basic orbiting and the zooming that I've added, I would like to use the WASD keys to move the camera around the world.

The W key would move the camera straight forward, however it would ignore the y axis. For example, using

transform.Translate(Vector3.Forward*Time.Delta*20);

moves the camera forward relative to the camera. This results in you quickly hitting the ground. Moving back obviously does the opposite. The desired effect is sliding across the world without getting any closer/farther to it, regardless of the angle the camera is at.

The closest I can get is using the Space.World parameter of Translate(), but this does not take into account the rotation of my camera. I think if I could take that into account, this would be solved but I'm not clear on how to do that.

sentences:
2D Rendering with OpenGL ES 2.0 on Android (matrices not working) So I'm trying to render two moving quads, each at different locations. My shaders are as simple as possible (vertices are only transformed by the modelview-projection matrix, there's only one color).

Whenever I try and render something, I only end up with slivers of color! I've only done work with 3D rendering in OpenGL before so I'm having issues with 2D stuff.

Here's my basic rendering loop, simplified a bit (I'm using the Matrix manipulation methods provided by android.opengl.Matrix and program is a custom class I created that just calls GLES20.glUniformMatrix4fv()):

Matrix.orthoM(projection, 0, 0, windowWidth, 0, windowHeight, -1, 1);
program.setUniformMatrix4f("Projection", projection);

At this point, I render the quads (this is repeated for each quad):

Matrix.setIdentityM(modelview, 0);
Matrix.translateM(modelview, 0, quadX, quadY, 0);
program.setUniformMatrix4f("ModelView", modelview);
quad.render(); // calls glDrawArrays

and all I see is a sliver of the color each quad is! I'm at my wits end here, I've tried everything I can think of and I'm at the point where I'm screaming at my computer and tossing phones across the room. Anybody got any pointers? Am I using ortho wrong? I'm 100% sure I'm rendering everything at a Z value of 0. I tried using frustumM instead of orthoM, which made it so that I could see the quads but they would get totally skewed whenever they got moved, which makes sense if I correctly understand the way frustum works (it's more for 3D rendering, anyway).

If it makes any difference, I defined my viewport with

 GLES20.glViewport(0, 0, windowWidth, windowHeight);

Where windowWidth and windowHeight are the same values that are pased to orthoM

It might be worth noting that the android.opengl.Matrix methods take in an offset as the second parameter so that multiple matrices can be shoved into one array, so that'w what the first 0 is for

For reference, here's my vertex shader code:

uniform mat4 ModelView;
uniform mat4 Projection;

attribute vec4 vPosition;

void main() {
    mat4 mvp = Projection * ModelView;
    gl_Position = vPosition * mvp;
}

I tried swapping Projection * ModelView with ModelView * Projection but now I just get some really funky looking shapes...

sentences:
Rendering model with multiple tiling textures See edit:

How would I go about rendering a model with multiple tiling textures? I have a few ideas, but all of them have drawbacks, here are a few (by the way this is for an opengl game):

-Use a huge texture, but this comes at the cost of the texture being expensive

-Render diffrent objects for each textured object (eg: one model could be bricks for a house, another could by the roof, each with their own tiled texture), but this would become very messy, very quickly.

Here is an (amazing) image to help demonstrate what I'm trying to do.

The repeating "R" on the red area represents perhaps a repeating brick texture, while the green one represents a roof, maybe roof shingles. To add on to that, I've added a window texture.

My question is, how do most games deal with this? I can't seem to wrap my head around how I could fit this in one texture, but yet I see many other games do exactly what I want.

EDIT:

This should give a better visual demo. I want a large mesh (not very large in the demo) using one texture atlas. (Please keep in mind not all textures in the atlas will be the same size!)

Lets say this is my object, it uses each texture on the atlas, but not the same amount of repeats (brick repeats 3 times, when the smiley face repeats 9 or so times)

How do most games achieve something like this? Without using some huge file with repeating textures.

Example (from BOTW)
I assume they didn't just repeat this texture on the atlas, considering how large that would be (and expensive).

sentences:
How to achieve highly detailed textures on buildings/architecture? I have a bit of experience when it comes to 3D modeling, but something I never really wrapped my head around is environment modeling. You know, you walk down a road and you see lots of buildings, they all look good, with great texture details, and yet they don't go over the texture budget and the framerate is nice.

Now I'm working on a little prototype, and I wanted to test how to make assets for it.

This is supposed to be one floor of a fantasy tower. I did the modeling in Blender (with a rough UV), then I exported it into Quixel, I made a simple texture, 4K resolution because why not at this stage. The problem is, when I look at it ingame or in blender, it's quite awful. This is a single texture and a single material for the whole mesh.

I was expecting this result, because the wall is some 20 meters long, so the texel density is really low. But this is already a 4K texture, when I should be using a 512 or 1k texture really. I mean, when you look at modern games, stuff like this looks sharp enough, with lower res textures than what I'm using now.

So, basically, what is the right approach to something like this?

I was thinking about something like this:

Have the "core" with a low res tiling texture, and then details as separate meshes that I would build in the engine (UE4 in this case). But I'm kinda worried about performance. I mean one floor would be at least 15 meshes, so 15 draws calls, so for ten floors it would be 150 drawcalls or something, I could barely make a village this way.

I know some games do fully modular buldings, like Fallout 4, they have a bunch of "kits" made of 2x2m blocks that snap together and each block has its texture and it looks good. But I don't really need that level of granularity, and I want more individual looking buildings, that don't look really copy-pasted.

And even if I did go that way, if one building is like 100 pieces alone, that's some 100 draw calls, how does that even work ingame?

An example from RDR2, how would go about making something like this? It can't possibly be one single mesh with just one texture.

How can I achieve this kind of result?

sentences:
Character states in component based entity system I'm working on a Zelda-like game (github), and I made a component-based entity system.

I've a Scene class which holds a std::vector of SceneObject.
SceneObject is a collection of components
Scene uses systems, like MovementSystem, DrawingSystem, CollisionSystem to perform actions using components, or directly on components themselves. For example, this isMovementSystem:

#include "CollisionComponent.hpp"
#include "MovementComponent.hpp"
#include "MovementSystem.hpp"
#include "PositionComponent.hpp"

void MovementSystem::process(SceneObject &object) {
    if(object.has<PositionComponent>() && object.has<MovementComponent>()) {
        auto &positionComponent = object.get<PositionComponent>();
        auto &movementComponent = object.get<MovementComponent>();

        movementComponent.movement->process(object);

        movementComponent.isBlocked = false;

        if(object.has<CollisionComponent>()) {
            object.get<CollisionComponent>().checkCollisions(object);
        }

        movementComponent.isMoving = (movementComponent.vx || movementComponent.vy) ? true : false;

        positionComponent.move(movementComponent.vx * movementComponent.speed,
                               movementComponent.vy * movementComponent.speed);

        movementComponent.vx = 0;
        movementComponent.vy = 0;
    }
}

My problem is that I don't know how to handle states for characters.

For example, let's say Link has three states: Standing, Moving and Pushing.

In each state, a different animation is played, so DrawingSystem have to know about this, but I can't put it in a StateComponent because all the objects which need a state don't always need an information on animation.

In each state, I must check for conditions to change the current state and process an action. For example, if Link's current state is Standing, I must check if he's moving or not, to change his state to Moving.

Which components/system do I need to implement this?

sentences:
Exchanging data between custom-built hardware and games I have a built my own steering wheel and motion platform that I would like to connect to popular car racing games (e.g. iRacing, Dirt Rally). I need to read data such as the car's acceleration (to send to the motion platform) from these games and send information such as steering wheel's angle to the game. I have written an SDK in C++ to communicate with my steering will and motion platform. Now I need to interface different games with to that SDK.

I searched quite a bit but could not find much information about how this is generally done. Do game developers provide some sort of extension which allows third party hardware developers to communicate with their game?

Any guidance from the community is much appreciated.

Kam

sentences:
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:
Pass a single boolean from an Android App to a libgdx game I'm writing an Android application that needs to pass a single boolean into an Android game that I am also writing.  The idea is that the user does something in the App which will affect how the game operates.

This is tricky with LIBGDX since I need to get the bool value into the Java files of the game, but of course, you can't call Android specific things from within LIBGDX's main Java files.  I tried using an intent but of course the same problem persists.  I can get the boolean into the MainActivity.Java of the android output of the game, but can't pass it along any further since the android output and the main java files don't know about each other.  I have seen a few tutorials that explain how to use set up an interface in the LIBGDX java files that can call android things.  This seems like wild overkill for what I want to do.

I've been trying to use Android's Shared Preferences with LIBGDX's Gdx.app.getPreferences, but I can't make it work.

Anyhelp would be MUCH appreciated.

I've set up two hello world applications.  One is a standard Android app, with a single button that is supposed to write "true" into the shared preferences.  The other is a standard LIBGDX hello world that is supposed to do nothing but check that bool when launched and if true display one image to the screen, if false, display a different one.

Here's the relevant bit of the Android code:

import android.preference.PreferenceManager;

 public void onClick(View view) {
    if (view == this.boolButton){

        final String PREF_FILE_NAME = "myBool";
        SharedPreferences preferences = getSharedPreferences(PREF_FILE_NAME, MODE_WORLD_WRITEABLE);
        SharedPreferences.Editor editor = preferences.edit();
        editor.putBoolean("myBool", true);
        editor.commit();
    }
}

And here's the relevant bit of the code from the LIBGDX main file:

Preferences prefs = Gdx.app.getPreferences("myBool");
    boolean switcher = prefs.getBoolean("myBool");

    if(switcher == true){
        texture = new Texture(Gdx.files.internal("data/worked512.png"));
        prefs.putBoolean("myBool", false);
        }
        else
        {
        texture = new Texture(Gdx.files.internal("data/libgdx.png"));
        }

Everything compiles fine, it just doesn't work.  I've spent HOURS googling trying to find a way to pass this single boolean from android into a LIBGDX main and I'm totally stumped.

Thanks for your help.

sentences:
Make a sprite jump to a certain direction in libGDX I was wondering how you can make a sprite jump to a certain direction in libGDX just like the brick does in the famous mobile game "Amazing Brick'

I want to make my sprite jump up a bit to the right when I tap the right part of the phone and make it jump up but to the left direction when I tap on the left part of my phone.

I am using libGDX on android studio and I am on a beginner level, trying to develop a unique game for android. Plz help. Thanks in advance. ^o^

sentences: Flash, Java, Unity plugin install penetration? Is there data on how many users have Flash, Java, or Unity plugins installed?

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:
Procedural generation of jagged peaks I would like to generate random cave type backgrounds similar to the one shown below.

I doubt anything I generate will look as good as the image, but something with that feel of sharp, jagged peak should be possible.

I don't have any experience in procedural generation and as such have no idea where to start....

Note: I am using libGdx on Android

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:
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:
Unity collision help So my problem is this:

I have a block, which is used as a "pointer block" to show where a block will be spawned. It will be green if it isn't colliding anyone, meaning you can spawn a block. It gets red when it's colliding with something.

The pointer block is a trigger.

OnTriggerEnter gets called when the collider touches another collider. I want to know when another collider is in my pointer block, not when something is just on the edge of the colldier.

https://www.youtube.com/watch?v=0yNqSJ3yAxA&feature=youtu.be

sentences:
Best way to go for simple online multi-player games? I want to create a trivia game for my website. The graphic design does not have to be too fancy, probably no more advanced than a typical flash game. It needs to be secure because I want users to be able to play for real money. It also needs to run fast so users don't spend their time frustrated with game freezing. Compatibility, as with almost all online products, is key because of the large target market.

I am most acquainted with Java programming, but I don't want to do it in Java if there is something much better. I am assuming I will have to utilize a variety of different languages in order for everything to come together.

If someone could point out the main structure of everything so I could get a good start that would be great!

Language choice for simple secure online multiplayer games?
Perhaps use a database like MySQL, stored on a secure server for the trivia questions?
Free educational resources and even simpler projects to practice?

Any ideas or suggestions would be helpful...

sentences:
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:
OpenGL 3+ Range Picking How do I perform range picking in the latest OpenGL version? By range picking I mean selecting all objects which are picked using a selection rectangle, like in an RTS game.

For single object picking I'm using the ray picking method, which I guess can be used in this case as well, but I'm not sure how I should go about doing that.

Could you give me any pointers?

Thank you.

sentences:
Motion blur is blurring static stuff I made a motion blur using OpenGL immediate mode, basically it involves saving screen to texture, then rendering blended texture back (let's skip the details) with something like this:

glBegin(GL_QUADS);
        glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
        glTexCoord2f(0.0f, 1.0f); glVertex2f(0, 0); // Bottom Left Of The Texture and Quad
        glTexCoord2f(1.0f, 1.0f); glVertex2f(800, 0);   // Bottom Right Of The Texture and Quad
        glTexCoord2f(1.0f, 0.0f); glVertex2f(800,  600);    // Top Right Of The Texture and Quad
        glTexCoord2f(0.0f, 0.0f); glVertex2f(0,  600);
    glEnd();

My problem is: When I use the motion blur, seemly the blended screen get 1 pixel shifted to the opposite of (0, 0), resulting in everything getting blurry, not only the moving stuff.

The stronger I apply the effect, the stronger everything else blurs (as seemly every frame of blur get 1 more pixel shifted).

How I fix that?

sentences:
How does one make games playable before they are fully downloaded? Diablo 3 and StarCraft 2 have a nice feature: I can start playing before the full game or update has finished downloading.

I guess Diablo 3 downloads mandatory files like like UI assets and some meshes and textures that are used across several levels first. However, when starting a game, I can choose any level I want, assuming I have appropriate saves. I never experienced any lag from such when playing—starting is always very smooth.

How does this work? How could I implement a similar feature?

sentences:
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:
Game Asset Size Over Time The size (in bytes) of games have been growing over time. There are probably many factors contributing to this: trailer/cut scene videos being bundled with the game, more and higher-quality audio, multiple levels of detail being used, etc.

What I'd really like to know is how the size of 3D models and textures that games ship with have changed over time. For example, if one were to look at the size of meshes and textures for Quake I (1996), Quake II (1997), Quake III: Arena (1999), Quake 4 (2005), and Enemy Territory: Quake Wars (2007), I'd imagine a steady increase in file size. Does anyone know of a data source for numbers like this?

sentences:
Is localisation important for a mobile game with little text? Let's say it's a physics puzzle (Cut the Rope, Angry Birds) or a runner (Crossy Road, Subway Surfers) clone with some gameplay twists. Assume it puts text on some of the few controls: 'Play', 'Sound Volume', 'Level 15' etc. Most labels are accompanied with "standard" icons. Story is communicated with a text-free comic strip. Tutorial is also text-free.

can I publish it to Apple App Store and Google Play Store to every market while using English labels or it will be rejected?
will sales be affected a lot or negligibly when going:

freemium
premium.

Most articles I have seen are either PR of localisation companies or dealing with large/medium story-rich games.

PS: recommendations like "just remove all the text and use only icons" and "just localize it" are not something I am looking for.

sentences:
Efficient Collisions Iteration? My project has upwards of 3000 2D objects but not all of them collide with each other. Between each object that can collide, a CollisionPair is created and stored inside a flattened array.

Currently, a MaxObjects is defined for accessing the flattened array. Unfortunately, when iterating over this array for collision checks, I get a lot of overhead from the for loop and null checks.

Is there a more efficient way, both in memory and performance, to store and access CollisionPairs?

Note: Many of these objects are axis-aligned boxes - how does Minecraft handle these collisions?

sentences:
EventSystem first selected not highlighting I'm trying to make a menu and encountered this problem.

protected static EventSystem eventSystem
{
    get { return GameObject.Find("EventSystem").GetComponent<EventSystem>(); }
}

public static void ButtonNavigation(List<GameObject> _listButton, int firstSelected)
{
    eventSystem.SetSelectedGameObject(_listButton[firstSelected]);
    print(eventSystem.currentSelectedGameObject);
}

But when I print out the currentSelectedGameobject it clearly says that "Status" is selected but how come it's not highlighted?

I've read some article on using Co-routines but is it really necessary?

sentences:
Long loading times on large PNG file using C++, OpenGL & SOIL I'm currently optimising a C++ OpenGL game, and I've noticed something slightly odd about texture loading.

I've got a number of PNG files I load as textures and use as spritesheets; these are generally 512px or 1024px, with one 2048px. I use SOIL (www.lonesock.net/soil.html) to load the PNGs then bind them to a custom OpenGL texture class.

I've put some primitive code in to measure how long it takes to load these PNG files as textures measured in ticks. Generally speaking the load times are:

512px PNG: 100 - 150 ticks
1024px PNG: 400 - 500 ticks
2048px PNG: 1800 - 2000 ticks

Now I recognise that not all image files are created equally, but these don't quite seem to add up with what I understand in terms of texture files. There's not much to be gained by using fewer larger textures compared to more smaller textures, and often there's no gain for that 2048px PNG compared to four 1024px.

My question is, are these (relative) load times normal? Is there something I'm missing when it comes to loading textures with SOIL?

Note that my question isn't 'how can I generically speed up image loading times' (I may at a later date convert these to more OpenGL friendly file formats like DDS), but more is there a pattern I should / shouldn't be using to optimise this?

Thanks

Nathan

sentences:
How can I make responsive computer and touch click and drag? This code works but it has a little delay on computer controls and higher delay on mobile touch screen controls, so its not responsive as I want it to be.
void OnMouseDown()
{
    offset = transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, transform.position.y, 0.0f));
}

void OnMouseDrag()
{
    Vector3 newPosition = new Vector3(Input.mousePosition.x, transform.position.y, 0.0f);
    transform.position = Camera.main.ScreenToWorldPoint(newPosition) + offset;
    transform.position = new Vector2(Mathf.Clamp(transform.position.x, posXMin, posXMax), transform.position.y);
}

sentences:
Unity / How to Hide "Editor Script" in the Inspector? I want to hide the "editor Script" in the Unity Inspector, so it doesnt show up with all the other components (transform/other scripts etc.)
It works with every other "normal" component like this:

component.hideFlags = HideFlags.HideInInspector;

but when it comes to the Editor Script- it just doesnt hide.

EDIT:
My Custom Editor Script:

using UnityEngine;
using System.Collections;
using UnityEditor;

[ExecuteInEditMode]
[CustomEditor(typeof(DetailCamContScript))]

public class CamEditor : Editor
{

    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        DetailCamContScript myScript = (DetailCamContScript)target;
        if (GUILayout.Button("Set Camera Active"))
        {

            myScript.setCamActive();

        }

    }

}

EDIT: Problem solved.

the problem was: The editor-script was attached to a Gameobject.
It doesnt needs to be attached.

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:
Generate and then rasterize vector shape in Monogame/XNA I apologize if this is too broad, but I can't seem to find information on this anywhere (perhaps I am searching for the wrong thing?)

Anyways, I'm making a simple game where the player visits different, small, circular planets.  I've successfully made a simple circle texture directly with a for loop, but I've run into a few problems:

How can I easily add variation to the landscape (e.g. Perlin noise)
How can I detect where the surface of the planet is?
How can I easily add objects to the surface of the planet?

I realized that all 3 of these problems could most likely be solved if the planet was generated with a vector polygon.  Noise could be easily applied, and the normal of each edge could help with surface detection/object placement.

However, I could barely find any info on the subject.  Let me be clear - I don't want to directly render a vector shape; I want to invisibly create a semi-random polygon, and then create a filled-in texture based on that convex shape.

Is there any easy way to do this?  Is there a better way to execute this idea in general?

sentences:
Audio programming resources I've been very interested in the last few months about getting in to audio programming (I'm from a musical background). I've been a .NET developer for two years and have also done some objective c for an iPhone app recently. I realise I would probably need to work on my C++ chops and have been having a play around with FMOD EX and doing a lot of research into the industry.

I was just wondering if anyone could suggest some good resources for audio programming (be they websites, podcasts, books, videos, online courses etc). Anything from Fourier analysis, low level coding, audio engine creation to audio APIs. I just want to learn as much as possible!

Thanks in advance.

sentences:
Having trouble with 2d projection (Opengl) I need to change the normalize coords from -1 to 1 to the width and height of my application. The reason why I want to change the normalize coords is because i think it would be a easier set position of objects and find the globalbounds of objects
my Rectangle disappear when i put my projection matrix in the vertex shader
Vertex shader code
#version 330

layout(location = 0) in vec4 position;
uniform vec2 offset;
uniform mat4 projection;

void main()
{
 vec4 translate = vec4(offset.x, offset.y, 0.0, 0.0); //Using translate to move the rectangle via
                                                      //gluniform2f
 gl_Position = projection * position + translate;
}

glm::mat4 proj = glm::ortho(-2.f, 2.f, -1.5f, 1.5f, -1.f, 1.f);
shader.setMat4("proj", proj);

sentences:
Trying to understand the XNA fixed time step game loop logic I came across the blog post Understanding GameTime, and after lots of reading on fixed time steps in game loops this is the approach I would like to take. In summary, this is the logic from the post:

Set the desired time spent in Update + Draw as 1/60 of a second (fixed 60 fps).
If time elapsed since last Update + Draw is exactly 1/60 of a second:

Call Update
Call Draw
Tick (Game loops.)

If time elapsed since last Update + Draw takes less than 1/60 of a second:

Call Update
Call Draw
Look at the Clock (Time left over? Wait.)
Tick (Game loops.)

If time elapsed since last Update + Draw takes more than 1/60 of a second?

Call Update (Until we catch up.)
Call Draw
Tick (Game loops.)

I guess the two parts I'm having trouble understanding is in #3, how would the waiting be accomplished since thread sleeps are often not accurate enough, and what does it mean in #4 to call update until we catch up? Catch up to what since the time elapsed is already greater than our target 60 fps?

sentences: Is it a good idea to make most actions in a game driven by simple tiny threads (in Java)? I'm thinking of for example making the jump action of a character, that takes ~1s, a distinct runnable, so then other threads can read its state, with additional control over the action itself by the "action thread". Are people doing this? What is there to consider when thinking about creating and destroying hundreds (or thousends) of threads a second in a bigger game or other application?

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:
My Raycast2D doesn't go where I want and it doesn't return a GameObject I want my Objects to teleport when they hit a wall. For that, I want to shoot a Ray backwards and teleport it to where the ray hits the wall, but whatever I try, it always teleports to the centre of the scene and the ray hit doesn't return a GameObject. This version I tried runs on OnTriggerEnter2D:
RaycastHit2D hit = Physics2D.Raycast(transform.position, -transform.up, 300);
Debug.DrawLine(transform.position, hit.point);
transform.position = hit.point;

I tried some other variations too. If you have any idea, please let me know.

sentences: How can I let the user choose his own background image? Dear Stackoferflow Fourm I would like to have a function in my Android Game Programming that allows the user to choose his own background image (I would like to let the user change the plane image) Unfortunately I have no idea how I could do that. If someone knows how to do it I would be very happy.!

sentences:
Obscuring stored info in a flat-text file I have an idea for an addon for World of Warcraft which would basically be a minigame within the game itself. Eventually, I'd like to have players be able to compete against each other directly. The game would have some RPG-like elements, particularly statistics and abilities, which it would be undesirable for the end users to modify.

So the fact that this is a client-side script, where everything (logic and data storage) are all in flat text files, means that it's impossible for me to truly secure things. But I'd like to at least make it non-trivial to alter things, e.g. so that you can't just open up a file in notepad and type in 'Strength = 256'.

I'm looking for any ideas on how I might obfuscate the data, preferably something which is easy to implement as it's not really what I feel like spending my time on, but probably more sophisticated than ROT-13.

As an example, one idea I had, which I'm not sure if it's feasible (have never made an addon for WoW before) is to serialize the data in base-64.

sentences:
TopDown Island Generation I am trying to generate an island using Simplex Noise. To actually make a island shape i used Amitp's answers to the following questions:

1.Fast, simple procedural 2d island generation

2.Generating random Pools or lakes

Using them i have snippet of code for generation:(width/height is 128)

for(int y = 0; y < HEIGHT; y++) {
        for(int x = 0; x < WIDTH; x++) {
            // amitp's solution
            Vector2 vec = new Vector2(2 * x / WIDTH - 1, 2 * y / HEIGHT - 2);
            float d = Mathf.Sqrt(vec.x * vec.x + vec.y * vec.y);
            //
            float noise = Noise.Generate((float)x / WIDTH * 10, (float)y / HEIGHT * 10);

            // amitp's solution again
            mapData[x, y] = noise > 0.3 + 0.4*d*d ? noise * 10 : 0.0f;
            //

            colors[x + y * WIDTH] = new Color(mapData[x, y], mapData[x, y], mapData[x, y]);
        }
    }

This gives me the following unwanted result:

How do i get fix it to generate properly?

Lastly i'm using Unity.

***EDIT:

Fixed/Changed a couple of things and now i am getting this(still not what i want):

with this changed code:

for(int y = 0; y < HEIGHT; y++) {
        for(int x = 0; x < WIDTH; x++) {
            // amitp's solution
            Vector2 vec = new Vector2(((2 * x) / WIDTH) - 1, ((2 * y) / HEIGHT) - 1);
            float d = Mathf.Sqrt((vec.x * vec.x) + (vec.y * vec.y));
            //
            float noise = Noise.Generate((float)x / WIDTH, (float)y / HEIGHT);

            // amitp's solution again
            mapData[x, y] = noise > 0.3 + 0.4*d*d ? noise * 10 : 0.0f;
            //

            colors[x + y * WIDTH] = new Color(mapData[x, y], mapData[x, y], mapData[x, y]);
        }
    }

sentences: how large should a map be in blender I'm learning blender and am wondering what size(blender units) I should be making my characters and maps. should i consider 1 blender unit as 1 inch, foot, meter or does it not not matter?

sentences:
How do I make night cycle like Dino Chrome? I want to add a day/night system cycling to my runner game like the game Dino Chrome. The condition is when the score reaches 100 it will be night then when it reaches 100 again will be day.
I tried with this code but nothing changed in my game:
if (_GameManager.instance.score % 100 == 0)
{
     fadeToBlack = !fadeFromBlack;

     if (fadeToBlack)
     {
          cam.backgroundColor = new Color(Mathf.MoveTowards(cam.backgroundColor.r, 1f, fadeSpeed * Time.deltaTime),
                                          Mathf.MoveTowards(cam.backgroundColor.g, 1f, fadeSpeed * Time.deltaTime),
                                          Mathf.MoveTowards(cam.backgroundColor.b, 1f, fadeSpeed * Time.deltaTime),
                                          cam.backgroundColor.a);
     }

     if (fadeFromBlack)
     {
          cam.backgroundColor = new Color(Mathf.MoveTowards(cam.backgroundColor.r, 255f, fadeSpeed * Time.deltaTime),
                                          Mathf.MoveTowards(cam.backgroundColor.g, 255f, fadeSpeed * Time.deltaTime),
                                          Mathf.MoveTowards(cam.backgroundColor.b, 255f, fadeSpeed * Time.deltaTime),
                                          cam.backgroundColor.a);
     }
}

Eventually I want to change all game object colors via script with smooth, but for now I just want to apply a change to the camera background.
and this is my whole script

    public static _ObstacleManager instance;

    private void Awake()
    {
        instance = this;
    }

    public float maxTime;
    float timer;

    [Header("CommongObstacle")]
    public GameObject[] Obstacles;

    [Header("BirdObstacle")]
    public GameObject[] buwungObstacle;

    [Header("MeteorObstacle")]
    public GameObject Meteor;
    public Transform[] spawnpoint;

    int choosedSpawnMeteor;
    int choosedObstacle;

    [Header("NightCycle")]
    public float fadeSpeed = 2f;
    public bool fadeToBlack, fadeFromBlack;
    public Camera cam;

    // Start is called before the first frame update
    void Start()
    {
        cam = GetComponent<Camera>();
    }

    // Update is called once per frame
    void Update()
    {
        if (_GameManager.instance.isStarted)
        {
            timer += Time.deltaTime;

            if (timer >= maxTime)
            {
                GenerateObstacle();

                if (_GameManager.instance.score >= 400)
                {
                    GenerateBuwungObstacle();
                }

                timer = 0;
            }

            if (_GameManager.instance.score % 100 == 0 && activeFade == null)
            {
                fadeToBlack = !fadeToBlack;

                Color color = fadeToBlack ? Color.black : Color.white;

                activeFade = StartCoroutine(FadeTo(color));
            }
        }
    }

    //kelipatan 200
    public void GeneratedMeteorObs()
    {
        choosedSpawnMeteor = Random.Range(0, spawnpoint.Length);
        GameObject meteorGo = Instantiate(Meteor, spawnpoint[choosedSpawnMeteor].position, Quaternion.identity);
    }

    public void GenerateObstacle()
    {
        choosedObstacle = Random.Range(0, Obstacles.Length);
        GameObject obstacle = Instantiate(Obstacles[choosedObstacle]);
    }

    public void GenerateBuwungObstacle()
    {
        choosedObstacle = Random.Range(0, buwungObstacle.Length);
        GameObject obstacle = Instantiate(buwungObstacle[choosedObstacle]);
    }

    // Store the fade in progress (so we don't accidentally double-start it)
    Coroutine activeFade;

    // Perform a fade over time, then clear the activeFade variable when done.
    IEnumerator FadeTo(Color destination)
    {
        Color start = cam.backgroundColor;

        for (float t = 0; t < 1f; t += Time.deltaTime / fadeSpeed)
        {
            cam.backgroundColor = Color.Lerp(start, destination, t);
            yield return null;
        }

        cam.backgroundColor = destination;
        activeFade = null;
    }

```

sentences:
GLSL: sampler2D fallback to constant color? So I have the following situation: I'm sharing a blinn shader accross many meshes. Some meshes have specular & normal maps, others do not.

I'd like to, without making the shader code too complicated, be able to specify a constant color instead of a texture, for the normal or specular maps. This is for example if a given mesh doesn't need one of those maps.

The way I imagine it, I would just pass a flat "grey" as the specular map, for instance, and the shader could just act as if a texture was passed in. Is this possible?

Ideally, I don't want to have an extra uniform for each mesh specifying whether or not the texture should be used.

Another alternative would be to actually create a grey texture on the fly, if this is the better way, please advise on the simplest way to do this.

sentences:
Limiting interaction between certain RigidBodies I'm developing a 2D game in Unity and have been tasked with building a particular feature I'm not sure how to accomplish with Unity's physics engine. To simplify, a bunch of objects of type X and O are filled into a pit:

XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XXoXXXoXXXoX

Both objects have Rigidbody2Ds and colliders. Objects of type X have normal gravity and should settle into place. Objects of type O have inverse gravity and should float.

However, O should not be able to push X, and X should not be able to push O. Another way of looking at it is that O should only be able to move upward, and X should only be able to move downward. If we remove some of the Xs directly above an O, the O should float upwards as the Xs fall downwards until the Xs settle on top of the O and everything stops moving:

XXXXXXXXXXXX        XX XXXXXXXXX
XX XXXXXXXXX   -->  XXXXXXXXXXXX
XX XXXXXXXXX   -->  XXoXXXXXXXXX
XXoXXXoXXXoX        XX XXXoXXXoX

(In the actual game Xs and Os can be different sizes; their movement is continuous and they are not constrained into rows or columns).

The Os should be able to support the weight of any arbitrary number of Xs without sinking.

XXXXXXXXXXXX
XXXXXXXXXXXX
XooooooooooX
X          X

Lastly, the Os should be able to float diagonally if there is a space available:

XXXX XXXXXXX      XXX       XX
XXXXX     XX  --> XXXXX   XXXX
XXXX    XXXX  --> XXXXoXXXXXXX
XXXo XXXXXXX      XXXX XXXXXXX

I can't solve this problem simply by adjusting the mass of the Xs or Os since the number of Xs on top of an O may vary. I can't use the built-in RigidBody constraints since they don't allow you to disable only one direction along an axis (e.g. saying an object can move upward but not downward).

What's the proper way to handle this? I could do something like this:

void FixedUpdate() {
    if (movementDirection == Direction.UP) {
        if (transform.position.y < lastYCoordinate) {
            Vector3 position = transform.position;
            position.y = lastYCoordinate;
            transform.position = position;
        }
    }
    lastYCoordinate = transform.position.y;
}

but that feels hacky to me and I suspect it will keep the objects from sleeping. Are there better solutions here?

sentences:
How can I tell if OpenGL has finished rendering the current frame? If I make a call to http://developer.android.com/reference/android/opengl/GLSurfaceView.html#requestRender() from my game loop, how can I tell when OpenGL has finished rendering?

I don't want to make a call to requestRender() again in the next frame until the previous frame has finished rendering.

Sorry for the basic question I'm new to opengl and trying to switch to it from canvas.

Also, is GLSurfaceView.requestRender() a blocking call?

sentences:
2D Lighting From Sun I have been developing a game for over a year now and I have successfully implemented the basic foundation for lighting, but there are still a few things I'm struggling with. The biggest issue right now is the lighting that should be cast from the "sun". The sun should technically light up any block that doesn't have a lot of blocks above it covering up the light that should be reaching it.

The way the current light system works is through a flood-fill algorithm that goes block to block recursively setting light based on different conditions. The light is recalculated when a light source is placed or a block is broken and the algorithm is very efficient. Currently I have a basic implementation of sun where the highest block has light generated straight down from it until the light "runs out". This works when first generated, but doesn't look natural. One case where there's problems is if there is a single block 10 blocks above the terrain which would cause the terrain to be unlit under that block because it didn't receive any sun.

I have been doing research and trying out different techniques, but nothing has worked well and efficiently. Any suggestions are appreciated.

Here is an image of the game in it's current state. You can see the lighting issue with the tree blocking the light of the ground.

sentences:
Translating a terrains position using input in Unity 3D C# I am trying to make a terrain in Unity move, but im having trouble. Here's the code i have.

using UnityEngine;
using System.Collections;

public class NewScript : MonoBehaviour {

Camera camera;

Transform Terrain;
// Use this for initialization
void Start () {

}
// Update is called once per frame
void Update () {
    Terrain.Translate(new Vector3(500, 500 ,500));
}
}

now i would suspect that the terrain would just keep translating its position but it doesnt budge. How do i make a terrain move, or if you cant, how can i make the camera move and preferably with input. I am familiar with the XNA framework, is there a way to implement the input from XNA into unity?

sentences:
What is the Box2D coordinates system? I know that for Box2d I need to translate pixels to meters which is easy peasy. However my problem is what is the orientation of Box2D coordinates system? Is this the same as screen one (right += x, bottom += y) or it is like cartesian (right +=x, bottom -= y) ?

Also, does Box2D coordination system use negative values?

Thank you.

sentences:
Set the name of an animation in collada to be used by AssImp I am using the collada file format to contain my model and animation but when I use AssImp to load the file the name will be empty for the animation. Where is the name for animation set on the collada file format? The documentation seems to have pointed me to library_animations but I tried setting "name" and "id", but both did not end up setting the animation name.

To get the animation name I am simply doing

        aiAnimation* animation = mAIScene->mAnimations[i];
        auto test = animation->mName;

sentences:
How to detect a body between two points on LibGDX I've two Vector2 (A and B), i draw a line between them.

Is there a way to check if the line intersect the Box2D CircleShape?
I need to a boolean output

sentences:
Skysphere to Skybox Texture Conversion I am working on a hobby project and implemented a skybox, no big deal. Now I bought (licensed) a few really nice sky textures. Unfortunately the textures are projected for a skysphere.

I could implement a skysphere handling/rendering, but I figure rendering a box is way more efficient. (That may actually not matter on modern devcies though.) So I decided to transform the textures into 6 textures for a skybox.

My hodge podge solution to convert the textures is I create a scene in blender and render out the appropriate 6 views. If you ask google that is aproptatly the common sollution.

It there a tool that can do the conversion in a more automated way?

sentences:
AABB test does not consistently detect edge-to-edge contact when bounds are very different in size My function compares two AABBs for collision detection, and when they are around the same size it works fine, but I noticed that if I greatly decreased the size of one of them (or augmented the size of the other), then the collision wouldn't be detected correctly; I would have to have them intersect for a collision to be registered, rather than having it register when they are at least in direct contact, which is the intended behavior.

Below is my code:

local function DetectCollision(a, b) -- AABB to AABB
  local collisionX = (a.Position.X + a.Size.X) >= b.Position.X and (b.Position.X + b.Size.X) >= a.Position.X
  local collisionY = (a.Position.Y + a.Size.Y) >= b.Position.Y and (b.Position.Y + b.Size.Y) >= a.Position.Y
  local collisionZ = (a.Position.Z + a.Size.Z) >= b.Position.Z and (b.Position.Z + b.Size.Z) >= a.Position.Z
  return collisionX and collisionY and collisionZ
end

To be more specific, the issues start to occur when I cut the size of one of the AABBs in half. For instance, if I had two cubes where one's size is 12 on all axes and the other is 6 on all axes, then the collision will not register. Upon debugging, I noticed that only one of the collision bools will become false. This seems to depend on what axis the smaller bounding box moves from in relation to the bigger one, so if I moved the smaller AABB away from the bigger one on the y-axis, then collisionY will be false.

sentences: Problem with animations from Blender I have a model that I made in Blender and also I have a gun reloading animation, the model has a rig. So it appears that the animation of the rigged model is devided into 25 different animations but in Unity I can't play all of them at once, if I play only one animation from 25 it will only animate one object (eg. hands) not the magazine or anything else. My question is how is it usually done to play animations from Blender in Unity properly or make animation properly in Blender.

sentences:
How to make an object jump an equal height whenever it hits the ground? So, I want to make an object jump an equal height whenever it touches the ground. Something like a bouncing ball. But I can't use Physics Materials. Here are some ways that I tried:
Used Physics.CheckSphere:
isGrounded = Physics.CheckSphere(rayPoint.position, grounDistance, groundLayer);

if(isGrounded )
{
    rb.AddForce(transform.up * jumpForce, ForceMode.Impulse);
}

Used Raycast:
bool groundHit = Physics.Raycast(rayPoint.position, -transform.up, rayDistance, groundLayer);

if(groundHit)
{
    rb.AddForce(transform.up * jumpForce, ForceMode.Impulse);
}

In each cases, the object jumps a different amount of height each time it reaches the ground. How can I make it jump an equal height each time?

sentences:
Collision detection against complex shapes and curves I am new in game development and for simple games bounding box collision is fine. However, let's say you have a shape or bitmap like this:

This is just an example but if you had more elaborate curves or even a whole shape which was more complex than a simple polygon or rectangle-like shape, how would you do precise collision detection? I am strictly speaking in 2D here. I just want to know the concept behind how you would do this.

sentences: How can I create an "afterimage" effect like this one? How can I make an effect like this? With a particle system?

sentences:
Matrix camera, movement concept Someone told me that the movement concept in my 2D game is bad. When left or right arrow is pressed I'm scrolling the background which makes you feel that player avatar is moving (the avatar's X-position remains the same).

So... he told me something about matrix view. I should create all walls and platforms static and scroll only the camera and move the player's rectangle. I did a little research in Google, but found nothing.

Can you tell me anything about it? How to start? Maybe links, books and resources?

sentences:
Is there an IDE that can simplify the process of creating a game matchmaking website? Yes, I'm an old guy. And I'm well versed in "C" and have written several games which I have been selling on the web for a number of years. And now, I would like to adapt one of my games to be "online". Sounds simple. I'm sure I can use the thousands of lines of "C" code that I've already written. Right?

So my initial investigation begins. First, I think I'll need a server program that lives on a dedicated server (or a VPS probably) that talks to a bunch of client applications that live on individual devices around the world. I can certainly handle that! (I think to myself). I'll break up my existing game into two pieces, a client piece that is just the game displays and buttons, and a server piece that does everything else. Piece of cake, right?

But that means that the "server piece" must be executed on a remote machine somewhere and run 24/7. Can I do that? [apparently, that question is so basic, so uneducated, and so lame, that nobody has ever posed it before. Because hours of Googling does not yield an answer. Fine. I'll assume I can do that and move on.]

I'll need a "game room", which to me means a website where you log in and then go to a lobby of some kind where you can setup your preferences, see if any of your friends are connected, and create or join games. Should be easy, but it's not. No way. Can I do all this with my local website builder? (which happens to be 90 Second Website Builder, a nice product, btw). It turns out, I can not. I can start with that, but must modify each page, so I can interact with my sql database. So I begin making each page a "PHP" page and dynamically modifying the HTML code with PHP code.

I'm already starting to get a headache.

Because the resulting web pages looked terrible, I began looking at using JQuery. I want to user a JQuery dialog on my website to display a list of friends and allow the user to select one to invite to the game. [google search for "how to populate a JQuery dialog from a sql database" yields nothing but more confusion.]

Javascript? Java? HTML? XML? HTML5? PHP? JQuery? Flash? Sockets? Forms? CSS? Learning about each one of these, and how they interact with each other and/or depend on each other is too much for my feeble old brain.

Can anyone simplify this process for me? Is there an IDE that will help me do all this without having to go back to college for a few years?

Thanks,
Scott

sentences:
What are the specifications for 3D animated game assets on the Android platform? (apologies if this is phrased vaguely due to my lack of knowledge; I'm happy to change the question entirely if someone can suggest a more realistic query)

I'm getting a grip on creating 3D characters in Lightwave, Maya, Blender, etc. My goal is to focus on creating creature & character animations specifically for games. I thought it would be a good exercise to make a few critters with a specific scope. As a non-programmer (I've written a few scripts, but I really don't have a passion to code) - can you point me in the right direction to find some guidelines? (I have a programmer handy who will write the code, but I want to be able to give him assets that are as usable as possible)

I assume that Android games are intended to run on limited hardware - maybe there's a polycount I should shoot for, or a particular memory limit? The resources I've found so far all seem to be helpful to developers - haven't found much oriented in my direction

sentences: How to script enable VR in Unity 5.1 Unity 5.1 has integrated VR, its in the Build Player Settings as a checkbox. I want a startup scene that is not VR, then when the user starts it enables the VR camera. Can I do that?

sentences:
Please help me find the error in a pygame code for Tetris? I am creating a Tetris game using Pygame. However, instead of calling a single shape, but code calls all the functions for the shapes randomly one after the other. I tried called the NewShape at different places, but nothings working. If it calls a single shape, then the keyboard control does not work. Please let me know what is wrong. Thank you!

x=50
y=50
def ShapeL(screen,x,y):
    pygame.draw.rect(screen, Cyan, [x,y-50,50,150])
    pygame.draw.line (screen,Cyan, [x, y], [x+50,y])
    pygame.draw.line (screen,Cyan, [x, y+50], [x+50,y+50])
    pygame.draw.line (screen,Cyan, [x, y+100], [x+50,y+100])
    pygame.draw.rect(screen, Cyan, [x+50,y+50 ,50,50])

ShapeChosen=False
def NewShape(screen,x,y):
    ListShapes=[ShapeS, ShapeT, ShapeL, ShapeI, ShapeSquare]
    Shape=random.choice(ListShapes)(screen,x,y)#chooses random shape
    ShapeChosen=True

def BasicGame(x,y):
    Done=False
    while not Done and y!=500 and ShapeChosen!=True:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                Done=True
            elif event.type == pygame.KEYDOWN:
                if event.key ==pygame.K_LEFT:
                    x=x-50
                elif event.key==pygame.K_RIGHT:
                    x=x+50
                elif event.key==pygame.K_DOWN:
                    y=y+50
                elif event.key==pygame.K_SPACE:
                    y=500
            if x==0:#Borders so the shape doesn't leave the screen.
                x=50
            elif x==400:
                x=350
            if y==550:
                y=500
    screen.fill(White)
    NewShape(screen,x,y)

I tried passing the parameter ShapeChosen to the function, however, it did not work as well. I tried passing global ShapeChosen, but it prevents the keyboard functions to work.

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:
Full-screen post-processing and texture size I am newbie writing a post-processing code for mobile devices, and asking some trivial, conventional solution for a specific problem.

AFAIK, post-processing in OpenGL is trivially done with FBO bound to a texture. Anyway, target screen size is usually not square and non-POT(power-of-two) numbers, while texture size needs to be the POT numbers. For example, iPhone 4 screen size is 640x960 pixels. Because all textures need to be POT sized, texture size for post-processing should be 1024x1024 to cover all the pixels. But in this case, over half of the pixels are just wasted. It really feels bad to me. Because simply wasted amount is huge.

Of course I can use smaller 512x512 texture if the post-processing doesn't need to be pixel-perfect. But still, I waste large portions of memory if I keep aspect-ratio. I can fill the texture by adjusting aspect-ratio, but in this case, we need to adjust fragment shader algorithms to get correct result.

Here're my questions.

If I need pixel-perfect post-processing, should I use larger texture which wasting large portion of it? Is this trivial? Or is there better solution? (For example, binding multiple small texture patches to a FBO.)
If I use smaller texture, what is trivial method to handle the aspect-ratio issue? Just use only small portion of the texture keeping aspect-ratio? Or adjust the fragment shader algorithm?

sentences:
Queueing up character actions I'm developing a 2D platformer with action-fighter elements. Currently things are working relatively smoothly but I'm having difficulty sorting something out. For the time, keeping my character's states and actions separated and preventing them from stepping on each others' toes is working out well and properly, but I would like to add a feature to my character to get him to behave a little bit more fluidly for the player.

At the moment, he has numerous attacks and abilities that he can execute, all of them being executed with button presses. Here lies the problem: Being as everything is executed through button presses, while an action is in progress I flag the game to disregard further button presses until the action has completed. Therefore, consecutive actions cannot be performed until after the previous action has completed entirely. In runtime this behavior feels very icky, and very ungamelike.

In games that rest most memorably at the forefront of my mind the player is able to execute button commands during the process of actions, and at the end of the current action, the following action is executed (seems like some sort of a queue system or something)

Can anybody offer any guidance with this?

sentences:
How to store references to scene objects in prefabs? i am instantiating a few game objects in my scene using prefabs and i would like to attach a script to some of them to do something at a certain time but for that i need to reference to scene objects and its not allowing me. anyone know why? and whats the workaround?

i can pull those prefabs into my scene and use them as game objects but that would destroy the idea of prefabs isn't?

sentences: What percentage of game content is normally free on a Free-to-Play game? If I wanted to launch a free-to-play game with different characters, weapons, items and clothes that can be either unlocked through gameplay or bought with real money, what percentage of items should only be available for real money? This isn't "subjective" - I'm interested in examples of real games and estimates of what percentage of their content is free.

sentences:
Generating a grid (Array) of Tetris Pieces What I want to do is quite self explanatory. Just like the title states. I want to code something that will generate a grid which contains is filled of Tetris pieces.
However some conditions must be met :

Having no empty holes for the final grid (all sections of the grid filled)
Having no blocks sticking out (e.g. a long tetris block sticking out of the square grid)

I have tried to approach the problem using my way since the methods used online are too complicated for me.
The first idea I had was to use a 2D array which each row will be gone through to have some generation algorithm. The next row will depend on the previous row. Such as making a 2x2 block. It will check if the current row position is empty, if it is then it will check if the previous row is empty. If it is then it will make keep note that this point is being used. But if the previous block is already been used. It will check what kind of block it is and depending on what information is on that position. It will either be a connecting piece of just a blank piece.

The second idea i have in mind is similar to the first idea.
That is, it will also go through each row but this way is dependent on maths.
Lets say we have a 10x10 grid. We can say each row is made of 10 blocks. And from that we can say each tetris shape is made of miniblocks. E.g the 2x2 block is made of 2x2 small blocks.
So from this we can, go through the first row and for the first 2 blocks of the 10 keep note in the array that we want to generate the a 2x2 tetris block. And we can go to the next row and we know that the previous row there was a 2x2 tetris block that is need to be finished creating in the second row. And so we repeat this to try and get a filled grid of tetris blocks.

Sorry I am not good at explaining/implementating/reading code. Sorry for the inconvenience.
I have been suggested by some people to look at Tetris AI. And maybe use the AI to solve my problem. But I'm not good with reading other people's code. Plus it isn't in the language i understand. And i dont have anyone to go through the code with me.
 So i prefer to use my own idea since i know what is going on. But i don't know how to implement the code.

If there is anyone who could help me in any way it would be my honor.
Thank you in advance.

sentences:
Fps shoots up when sdl2 window is not on top I am learning sdl2 with C++ from Lazy Foo Productions' tutorials. I am using a 5 year old retina mac book pro and xcode.

When reading this entry on calculating frame rate I noticed that when runing the application it would tend to 60 fps and the cpu and energy impact were very low, 2% and Low respectively, but when placing another window over it the fps would shoot up to 5000 along with cpu and energy impact, to 93% and High respectively.

Why is this happening? Is it because sdl2 just stops rendering all together when it is not on top of other windows? Or is it because the OS stops it from rendering?

sentences:
tex2Dlod to limit max mip level to use for a texture (atlas) I'm developing a 3D multitexturing terrain engine in C# on Monogame (XNA) plateform. I would like my engine works on Windows XP or upper, so on DirectX 9c minimum.
Monogame allow me to build a DirectX 9c version of my engine, equal or less than a SM 2.0 (4_0_level_9_1) shader model.

Because there are not texture arrays on SM 2.0 and for performances, I use a texture atlas with each mipmaps build manually (to apply aliasing to each textures individually). My vertex structure contains textures coordinates of the texture atlas.

That's all right ? Fine :)

In my case, the texture atlas looks like that (textures unity: 512x512 count: 6 total: 1024x1536):

So, normally there are 11 mipmaps for this texture size, but I have just generated 10 mipmaps to avoid textures bleeding. The last mipmap of the texture atlas is not set.

My pixel shader code look like this:

float4 MutiTexturing_PS(MultiTexturing_VSOut input) : COLOR
{
    float4 _color;

    _color  = tex2D(TextureAtlasSampler, input.TextureUV1) * input.TextureOpacity.x;
    _color += tex2D(TextureAtlasSampler, input.TextureUV2) * input.TextureOpacity.y;
    _color += tex2D(TextureAtlasSampler, input.TextureUV3) * input.TextureOpacity.z;
    _color += tex2D(TextureAtlasSampler, input.TextureUV4) * input.TextureOpacity.w;

    return saturate(_color);
}

The result is that:

You can see at the background a gradient of dark: this is normal because the lastest mipmap is not set, so texture is transparent. I've have already tried to set the latest mipmap of texture atlas with the lastest generated mipmap (size: 2x3) but... the shader is more smart ! It knows the lastest mipmap must have a 1x1 size and and based its working area on that. So, the dark gradient become a red color.

To avoid the trouble, the only best solution that I have seen on the web is to use tex2Dlod (but if you have a better solution I take). This function return a color of a sampler texture at specified coordinates (like tex2D) but you can also specify the mip level to use. So, after lots of search, I found most frequently this function on the web to calculate the level of mipmap to use with the textures coordinates:

float GetMipmapLevel(float2 textureUV)
{
    float2 dx = ddx(textureUV * TextureAltasWidth);
    float2 dy = ddy(textureUV * TextureAltasHeight);
    float1 d = max(dot(dx, dx), dot(dy, dy));

    return log2(max(d, 1)) * 0.5f; // I can clamp mipmap here :)
}

But by changing my pixel shader code to use tex2Dlod(sampler, float4(texUV.xy, 0, LOD)) and GetMipmapLevel(texUV), I have this result:

I have adjust the calculation by using: return log2(max(d, 1)) * 0.75f;
You can see at the background, a similar result of tex2D function but ... the hill at foreground is to blured !

This is (finally) my question, how can I adjust the mipmap level calculation to get the same result as the tex2D ? How the tex2D function does it ?

If your solution need to use a SM 4.0, I think I'm ready to leave the DirectX 9c support but I'm sure that's possible to do in SM 2.0...
Resources link that can help other pepole in my case:
http://xboxforums.create.msdn.com/forums/p/82969/502102.aspx
http://xboxforums.create.msdn.com/forums/p/51280/309977.aspx

sentences:
Unity OnCollision() not working Seem to have exhausted google looking for an answer to a VERY bullet simple code that should work.

void onCollisionEnter(Collision col) {
    print ("hit " + col.gameObject.name);
    Destroy (gameObject);
    }

Bullet object has the above script, SphereCollider (radius a lot bigger than object), RigidBody, not a trigger, not kinematic, is travelling slow. All checked during runtime.

When it hits a wall (Box collider), it just bounces off but no collisionEnter code is ran.

Debug console bubble is on.

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:
RPG Logarithmic leveling formula? I'm working on a RPG game, however, I am not the amazing person at math that I wish I was, although someone suggested a logarithmic equation would work well. My current idea is for this:

You start off getting levels relatively quickly (lower xp amounts), then once you get higher up like 20-30 maybe it starts to take longer and longer to level, ending somewhere around 10-15 million experience for level 100. Can anyone offer me an equation or suggestions on how to do this? Thanks :)

sentences:
Unity3D : Pause Menu - Android I am making a 2D game for Android. Almost completed the game but now I need a pause game option. I added a pause icon on the top right side of the screen. The icon is a GUI texture.
What I did so far :

I made a script which will bring up some buttons (which is not working) and attached it to the GUITexture.This is the script :

#pragma strict

function OnMouseDown() {
   Debug.Log("*Pause Menu Opens*");
   Time.timeScale = 0;

   if (GUI.Button(Rect(10,10,100,50),"Restart"));
      Application.LoadLevel(Application.loadedLevel);

   if (GUI.Button(Rect(10,60,100,50),"MainMenu"));
      Application.LoadLevel("MainMenu");
}

Now the problem stands at the part where the buttons won't show up and the game freezes at the first frame. Please if you can help I would be really thankful.

Edit #1 : I just noticed that when I click "Pause" the game freezes and it takes me to the MainMenu. That's because I added the GUIButton which takes you to the main menu. I think the whole script structure is wrong. I also forgot to mention that I am new to scripting/unity.

Thank you.

sentences:
How do fixed-point physics (engines) work? I would think there should be an abundance of excellent articles answering this question, but my searches have come up completely empty.
I am developing an embedded graphics engine on a microcontroller which does not have an FPU or math co-processor.
I read somewhere before during my research that reasonably precise physics can be implemented without floating point math by using fixed point math.
How exactly does this work? What generally would be the programmatic behavior of a physics engine with some time step dt?

sentences:
Failed LockRect of IDirect3DSurface9 I have hooked Present method of the IDirect3DDevice9 interface, and I want to be able to start video capturing.

Taking a screenshoot like this work

if (GetAsyncKeyState('O') & 1) {
pDevice->CreateOffscreenPlainSurface((rect.right - rect.left),(rect.bottom - rect.top),D3DFMT_A8R8G8B8,D3DPOOL_SYSTEMMEM,&back_buffer, NULL);
pDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &back_buffer);
D3DXSaveSurfaceToFile(L"C:\\screenshot.bmp", D3DXIFF_BMP, back_buffer, 0, NULL );

IDirect3DSurface9_Release(back_buffer);

}

I seem to fail to lock the surface with 0x8876086C(D3DERR_INVALIDCALL)

HRESULT APIENTRY hook_Present(IDirect3DDevice9* pDevice, const RECT* pSourceRect,const RECT* pDestRect, HWND hDestWindowOverride,const RGNDATA* pDirtyRegion) {
IDirect3DSurface9*back_buffer;
D3DDEVICE_CREATION_PARAMETERS cparams;
RECT rect;
pDevice->GetCreationParameters(&cparams);
GetClientRect(cparams.hFocusWindow, &rect);
if (GetAsyncKeyState('R') & 1) {
    if(dx9Capturing == 0) {
        //Create the AVI file
        // etc code
        dx9Capturing = 1
    }
    else if(dx9Capturing == 1) dx9Capturing = 2; // stop capturing
}

if(dx9Capturing == 1) {
    // Capture the current frame
    pDevice->CreateOffscreenPlainSurface((rect.right - rect.left),(rect.bottom - rect.top),D3DFMT_A8R8G8B8,D3DPOOL_SYSTEMMEM,&back_buffer, NULL);
    pDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &back_buffer);
    D3DLOCKED_RECT  lockedRect;
    if(FAILED(back_buffer->LockRect(&lockedRect,&rect,D3DLOCK_READONLY))) {
        MessageBoxA(NULL, "Failed locking the back buffer!", "Error", MB_OK);
        return orig_Present(pDevice, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
    }
    for(int i=0;i<rect.bottom;i++)
        {
            memcpy((BYTE*)pBits+(rect.bottom-i-1)*rect.right*BITSPERPIXEL/8,(BYTE*)lockedRect.pBits+i*lockedRect.Pitch,rect.right*BITSPERPIXEL/8);
        }
    back_buffer->UnlockRect();
    pAviFile->AddNewFrame(rect.right,rect.bottom,pBits);
}

return orig_Present(pDevice, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);

}

Hooking Reset and I still have the same problem

HRESULT APIENTRY hook_Reset (IDirect3DDevice9* pDevice,D3DPRESENT_PARAMETERS* pPresentationParameters) {
HRESULT hr;
if(pFont) {
    pFont->Release();
}

D3DPRESENT_PARAMETERS d3dpp;
D3DDISPLAYMODE d3ddm;
direct->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm );
ZeroMemory( &d3dpp, sizeof(d3dpp));
    d3dpp.Windowed = true;
    d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
    d3dpp.BackBufferFormat = d3ddm.Format;
    d3dpp.Flags =  D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
hr =  orig_Reset(pDevice, &d3dpp);
return hr;

}

sentences:
Issues detecting if position is inside a Polygon2DCollider I have a Polygon2DCollider set in my scene that I am using Physics2D.OverlapPoint(position, 0) to see if the set position collides with anything. Initially, the collider is stored in memory and then deactivated for future use. When I want to use it I do the following:
targetColliderObj.SetActive(true);

Collider2D collider = Physics2D.OverlapPoint(testPosition, 0);
if (collider == null || collider.tag != targetColliderObj.tag)
{
    Debug.Log("Unable to move down a floor.");
}

In the code above I activate the target gameobject for the Polygon2DCollider and check to see if the testPosition is within the collider. The collider is always null even though I am placing the testPosition inside of the collider. Also, I am checking on layer mask 0. The gameobject of the Polygon2DCollider is also on the Default layer (0).

sentences:
Getting the correct texture from an Atlas I'm writing an OpenGL ES (2.0) app and have a custom Quad class which draws a textured quad for my sprites.

Currently, I put the textures of any sprites of the same size into a single file or atlas, then, when drawing, I can simply specify the frame I want. It will the render the correct frame based on how many textures in the atlas and how many total frames etc. Something like so:

mySprite.x = 0;
mySprite.y = 0;
mySprite frame = 1;
drawSprite(mySprite);

The texture Atlas would look something like this: (Simplified for the purpose of this question, in the real project, there are over 200 textures arranged in neat rows/columns, but the important thing is there is order, every texture is the same size as this is necessary for the calculations).

So, in the example above, I can say, there are 2 columns, 1 row and a total of 2 textures.

So, if I specify 1 as my texture (2nd texture), my sprite class can work out (using the columns, rows, total textures etc..) which texture I want and how to get it.  As I said this is simplified, the calculations are a little but more involved when there are multiple rows.  But it makes doing animations nice and simple as I can simply increment or decrement the current frame.

However, I keep seeing sprite sheets where there is no order.  There are different sized textures seemingly thrown into an atlas like so:

I really would like to go down this route as it means I wouldn't have to separate my sprite sheets by object size, and therefore, vastly reduce the number of separate sheets I have to use.

I can't however work out how one would write a calculation to get the correct texture just by specifying the texture number to render.

So how does this work?  Do I need to manually work out the texel coordinates of each and every object (and indeed frame), manually (and maybe store this value in an array and associate it to a frame number?) or am I missing a trick here somewhere?

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:
To split or not to split large 3D objects? I have a fairly simple question for which I'm seeking guidance:

Should large 3D objects be splitted into smaller ones?

By wide, I mean an object that would be as wide as a game level is, below is some mountain, the first picture shows it as a single mesh, the second picture shows it as multiple meshes.

Facts I've considered (might be wrong):

a large object simplifies the scene hierarchy with less objects in total, but at the same time it might be rendered more often than necessary since it will be considered as visible
a large object made out of smaller objects makes the scene hierarchy more bloated, but at the same time on a performance aspect is better since only visible parts of it by the camera will be rendered, the rest being culled

Note, these objects aren't complex by today standards, that mountain is less than 1K triangles and a complete level is likely to be less than 30K triangles.

Ideally, I would like to have the least amount of objects in the scene hierarchy to keep it simple, but at the same time I am wondering whether or not over simplifying the level might put extra problems on the table I haven't thought about.

sentences:
opengl - texture clamping not working I'm having a problem with post processing in my deferred renderer. When I'm applying an effect like bloom on top of my scene, the bottom of the bloom effect texture leaks into the top of my screen, the top of the texture leaks into the bottom of the screen, the left into the right of the screen and so on. Looks like the uv coords don't get clamped correctly, although I thought I'd have set that all correctly.

The bloom effect in this case is created in a lower resolution and the gets upsampled using linear filtering.

This image shows the problem:

I render the postprocessing effects using a simple quad:

glm::vec3(-1.f, -1.f, 0.f),
glm::vec3(1.f, -1.f, 0.f),
glm::vec3(1.f, 1.f, 0.f),
glm::vec3(-1.f, 1.f, 0.f)

This is the vertex shader I use to render the quad:

#version 430 core

layout(location = 0) in vec3 POSITION;

noperspective out vec2 tex_coord;

void main(void)
{
    tex_coord = POSITION.xy * 0.5 + 0.5;

    gl_Position = vec4(POSITION.xy, 0.0, 1.0);
}

And of course in the fragment shader I'm doing something like this:

#version 430 core

uniform sampler2D uTexture;

noperspective in vec2 tex_coord;

out vec4 frag_color;

void main(void)
{
    frag_color = texture(uTexture, tex_coord);
}

The effect got rendered into a frame buffer object which got set up like this:

glGenFramebuffers(1, &_filterFbo);
glBindFramebuffer(GL_FRAMEBUFFER, _filterFbo);

// filter texture
glGenTextures(1, &_filterTexture);
glBindTexture(GL_TEXTURE_2D, _filterTexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB16F, _effectWidth, _effectHeight, 0, GL_RGB, 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_ARRAY, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, _filterTexture, 0);

I really don't know what's the problem here, I hope anyone got an idea.

Thanks in advance

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:
Need help creating points in an array I'm creating a lightning geometry shader using hlsl that creates an array of points based on an arbitrary number of generations.
The gist of what I want to accomplish is here:
http://drilian.com/2009/02/25/lightning-bolts/

The problem is the fact that the pseudo-code uses a dynamic array which deletes the current generations line segment and then resizes to add new line segments. I can only use fixed sized arrays in hlsl.

My current code is as stands:

int generations = 4;
int pointsarraysize = pow(2, generations) + 1;
float3 points[pointsarraysize];
points[0] = startpoint;
points[pointsarraysize - 1] = endpoint;

for(int currentgeneration = 0; currentgeneration < genetations; ++currentgeneration)
{
    for(int i = 0; i < pointsarraysize; ++i)
    {
        if (i == pow(2, currentgeneration))
        {

        }
    }
}

So what i've got  creates an array of the size of points I want to end up with and sets the start point and end point.

How do I fill the array so that each iteration over the array creates the points in the right place in the array? I can't simply iterate linearly and calculate points depending on the index position because calculating, for example, the first point in an array with 4 generations requires the start point point[0] and a generation 3 point, point[2].

Is this even the best way to fill the array or am I missing something that could simplify the problem? I want to be able to change the number of generations rather than hard coding a certain amount.

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:
How can I make a scrollable text view? I am trying to do an appication in monogame windows. I have a long text to be displayed on screen. I tried to render it on screen using spriteBatch.Drawstring, was succesful to an extent. But, the text did not fit into a required area. I had followed this tutorial. I need a vertical scroll to be implemented to have the entire text inside my desired area. Can anyone suggest some help. This is my current code :

protected override void LoadContent()
    {
        spriteBatch = new SpriteBatch(GraphicsDevice);
        _boxTexture = new SolidColorTexture(GraphicsDevice, Color.Red);
        _borderRectangle = new Rectangle(100, 100, 500, 500);
        _textboxRectangle = new Rectangle(105, 105, 490, 490);
        _font = Content.Load<SpriteFont>("Rockwell");
        _text = "He determined to drop his litigation with the monastry, and relinguish his claims to the wood-cuting and fishery rihgts at once. He was the more ready to do this becuase the rights had becom much less valuable, and he had indeed the vaguest idea where the wood and river in quedtion were.";

    }

private String parseText(String text)
{
String line = String.Empty;
String returnString = String.Empty;
String[] wordArray = text.Split(' ');

foreach (String word in wordArray)
{
    if (font.MeasureString(line + word).Length() > textBox.Width)
    {
        returnString = returnString + line + '\n';
        line = String.Empty;
    }

    line = line + word + ' ';
}

return returnString + line;
}

and inside draw function :

spriteBatch.DrawString(font, parseText(text), new Vector2(textBox.X, textBox.Y), Color.White);

sentences:
What is the exact unit in LibGDX if it says "private static final float WORLD_SIZE = 480"? In the code I see that the WORLD_SIZE variable was initialized with 480
private static final float WORLD_SIZE = 480;

What exactly the 480 means, are they pixels, cm or meters?

sentences:
How to reproduce this (parallax?) effect? I'm wondering how to imitate the camera movement like in the gif below. It´s from a Android game.

This game for example (via GIPHY)

Actually, I am not sure if this can be called a parallax effect, but it is the only word I can think of.

My code until now:

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

public class RotateAroundTarget : MonoBehaviour {

public Transform target;    // The object to follow
public Transform background;
public Transform foreground;
public float speedMod = 20.0f;  // Camera speed
public float topMargin = 0.2f;  // Top rotation margin

// The position of the target
private Vector3 point;
// Point if the camera is rotating to the left
private bool toLeft = false;

// Use this for initialization
void Start () {
    point = target.transform.position;
    transform.LookAt (point);
}

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

    // The camera is moving to the right until it reaches the top margin, then it changes it movement direction
    if (!toLeft) {
        transform.RotateAround (point, new Vector3 (0f, 1f, 0f), Time.deltaTime * speedMod);
        rotateBackground (1);
        rotateForeground (-1);
        Debug.Log ("Izquierda");
        if (transform.rotation.y >= topMargin) {
            toLeft = true;
        }
    } else {
        transform.RotateAround (point, new Vector3 (0f, -1f, 0f), Time.deltaTime * speedMod);
        rotateBackground (-1);
        rotateForeground (1);
            Debug.Log ("Derecha");
        if (transform.rotation.y <= -topMargin) {
            toLeft = false;
        }
    }
}

// Direction = 1 (left) | -1 (right)
public void rotateBackground(float direction){
    background.transform.Rotate (new Vector3(0, Time.deltaTime * (speedMod * 2) * direction, 0));
}

public void rotateForeground(float direction){
    foreground.transform.Rotate (new Vector3(0, Time.deltaTime * (speedMod / 2) * direction, 0));
}
}

But what I obtain in Unity Editor is this:
Result in Unity Editor (via GIPHY)

Any suggestion on how to get this?
Any help would be appreciated.

sentences:
2D platformers: why make the physics dependent on the framerate? "Super Meat Boy" is a difficult platformer that recently came out for PC, requiring exceptional control and pixel-perfect jumping. The physics code in the game is dependent on the framerate, which is locked to 60fps; this means that if your computer can't run the game at full speed, the physics will go insane, causing (among other things) your character to run slower and fall through the ground. Furthermore, if vsync is off, the game runs extremely fast.

Could those experienced with 2D game programming help explain why the game was coded this way? Wouldn't a physics loop running at a constant rate be a better solution? (Actually, I think a physics loop is used for parts of the game, since some of the entities continue to move normally regardless of the framerate. Your character, on the other hand, runs exactly [fps/60] as fast.)

What bothers me about this implementation is the loss of abstraction between the game engine and the graphics rendering, which depends on system-specific things like the monitor, graphics card, and CPU. If, for whatever reason, your computer can't handle vsync, or can't run the game at exactly 60fps, it'll break spectacularly. Why should the rendering step in any way influence the physics calculations? (Most games nowadays would either slow down the game or skip frames.) On the other hand, I understand that old-school platformers on the NES and SNES depended on a fixed framerate for much of their control and physics. Why is this, and would it be possible to create a patformer in that vein without having the framerate dependency? Is there necessarily a loss of precision if you separate the graphics rendering from the rest of the engine?

Thank you, and sorry if the question was confusing.

sentences: Access different vertices of a Mesh Unity 3d I have a mesh and I want to color each group of vertices with a certain color. If anyone could please advise how this can be done in Unity using coding?

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:
Proper way to encapsulate a Shader into different modules I am planning to build a Shader system which can be accessed through different components/modules in C++. Each component has its own functionality like transform-relevated stuff (handle the MVP matrix, ...), texture handler, light calculation, etc...

So here's an example:

I would like to display an object which has a texture and a toon shading material applied and it should be moveable.

So I could write ONE shading program that handles all 3 functionalities and they are accessed through 3 different components (texture-handler, toon-shading, transform).

This means I have to take care of feeding a GLSL shader with different uniforms/attributes. This implies to know all necessary uniform locations and attribute locations, that the GLSL shader owns. And it would also necessary to provide different algorithms to calculate the value for each input variable. Similar functions would be grouped together in one component.

A possible way would be, to wrap all shaders in a own definition file written in JSON/XML and parse that file in C++ to get all input members and create and compile the resulting GLSL. But maybe there is another way that is not so complex?

So I'm searching for a way to build a system like that, but I'm not sure yet which is the best approach.

sentences:
Game stopped working after adding savegame feature? I'm trying to make a text based adventure game with my limited c++ knowledge.. But I ran into trouble with saving and loading gamestates.. The functions I made are

int currentslot;
void savegame(int savestate)
{
fstream plfile("player.dat",ios::in|ios::app|ios::binary);
player temp;
if(currentslot==1)
{
    plfile.seekg(0,ios::beg);
    plfile.read((char*)&temp,sizeof(player));
    temp.savestate=savestate;
    plfile.seekg((-1*sizeof(temp)),ios::cur);
    plfile.write((char*)&temp,sizeof(player));
    plfile.close();
}
else if(currentslot==2)
{
    plfile.seekg(1*sizeof(player),ios::beg);
    plfile.read((char*)&temp,sizeof(player));
    temp.savestate=savestate;
    plfile.seekg((-1*sizeof(temp)),ios::cur);
    plfile.write((char*)&temp,sizeof(player));
}
else if(currentslot==3)
{
    plfile.seekg(2*sizeof(player),ios::beg);
    plfile.read((char*)&temp,sizeof(player));
    temp.savestate=savestate;
    plfile.seekg((-1*sizeof(temp)),ios::cur);
    plfile.write((char*)&temp,sizeof(player));
}
}
void loadgame()
{
int plno;
cout<<"\n\n\n\n\n\t\tSelect which player to load game from:";
cout<<"\n\n\t\t1.Player 1";
cout<<"\n\n\t\t2.Player 2";
cout<<"\n\n\t\t3.Player 3";
cout<<"\n\n\t\tEnter your choice: ";
cin>>plno;
currentslot=plno;
fstream plfile("player.dat",ios::in|ios::binary);
plfile.seekg((plno-1)*sizeof(player),ios::beg);
plfile.read((char*)&p,sizeof(player));
game(p.savestate);
}
void newgame()
{
int plno;
cout<<"\n\n\n\n\n\t\tSelect which slot to save game to(If there is no player         1, don't choose other slots):";
cout<<"\n\n\t\t1.Player 1";
cout<<"\n\n\t\t2.Player 2";
cout<<"\n\n\t\t3.Player 3";
cout<<"\n\n\t\tEnter your choice: ";
cin>>plno;
currentslot=plno;
fstream plfile("player.dat",ios::app|ios::binary);
if(plno==1)
{
    plfile.seekg(0,ios::beg);
    plfile.write((char*)&p,sizeof(p));
}
else if(plno==2)
{
    plfile.seekg(1*sizeof(p),ios::beg);
    plfile.write((char*)&p,sizeof(p));
}
else if(plno==3)
{
    plfile.seekg(2*sizeof(p),ios::beg);
    plfile.write((char*)&p,sizeof(p));
}
game();
}

With the addition of these functions however, the game() function does not seem to be accepting any values (but no error) related to the class:

class player
{
public:
char pl_name[10];
int hp;
int atbt;
int chk_sword;
int chk_bow;
int chk_healthpotion;
int savestate;
player()
{
    strcpy(pl_name,"Unnamed");
    hp=100;
    atbt=0;
    chk_sword=0;
    chk_bow=0;
    chk_healthpotion=1;
    savestate=0;
}
void namegive()
{
    cout<<pl_name;
}
void nameset()
{
    gets(pl_name);
}
void atbtset()
{
    cin>>atbt;
    if(atbt==1)
    {
        chk_sword=1;
    }
    else if(atbt==2)
    {
        chk_bow=1;
    }
}
}p;

I've spent a lot of time trying to figure it out.. Help and/or advice is very much appreciated.
Thanks

sentences:
Unity - Part of the sprite is covered in shadow I have a sprite with Transparent/Cutout/Diffuse shader. Recieving shadows is turned on in SpriteRenderer. The light is a pointlight and I am using deffered rendering path.

However when I am above or right of the object, it is covered in shadow. When I am below or left of the object everything seem to work as it should.If I place the light in the center of the sprite, only a part of the sprite is lit up, the other part is covered in shadow.

Maybe it is something with normals? I need to get rid of the self shading effect.

Shader

Shader "Transparent/Cutout/Diffuse" {
Properties {
    _Color ("Main Color", Color) = (1,1,1,1)
    _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
    _Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
}

SubShader {
Tags {"Queue"="AlphaTest" "IgnoreProjector"="True" "RenderType"="TransparentCutout"}
LOD 200

CGPROGRAM
#pragma surface surf Lambert alphatest:_Cutoff

sampler2D _MainTex;
fixed4 _Color;

struct Input {
    float2 uv_MainTex;
};

void surf (Input IN, inout SurfaceOutput o) {
    fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
    o.Albedo = c.rgb;
    o.Alpha = c.a;
}
ENDCG
}

Fallback "Transparent/Cutout/VertexLit"
}

I found out what unity uses for lambert lightning. Since I use deffered rendering so unity should use function with _PrePass prefix. But the implementation of the actual lighning is implemented somewhere else and is it used for all materials, that looks like dead end.

Custom Lightning

inline fixed4 LightingSLambert (SurfaceOutput s, fixed3 lightDir, fixed atten)
{
fixed diff = max (0, dot (s.Normal, lightDir));

fixed4 c;
c.rgb = s.Albedo * _LightColor0.rgb * (diff * atten * 2);
c.a = s.Alpha;
return c;
}

inline fixed4 LightingSLambert_PrePass (SurfaceOutput s, half4 light)
{
fixed4 c;
c.rgb = s.Albedo * light.rgb;
c.a = s.Alpha;
return c;
}

inline half4 LightingSLambert_DirLightmap (SurfaceOutput s, fixed4 color, fixed4 scale, bool surfFuncWritesNormal)
{
UNITY_DIRBASIS
half3 scalePerBasisVector;
half3 lm = DirLightmapDiffuse (unity_DirBasis, color, scale, s.Normal, surfFuncWritesNormal, scalePerBasisVector);
return half4(lm, 0);
}

sentences:
ray polygon intersection I am looking for an elegant way to do ray and polygon intersections in 2d. I don't care about languages.

Now what I'm doing is taking a line that lies on the ray (with a screen length) and testing line-to-line intersections between this derived-ray and all lines formed by each consecutive vertices in the polygon.

This, for now, is good even if I don't know which parts of the ray are inside or outside the polygon (in cases it is concave one). But for now I don't need this information, even if a general approach could maybe give it.

I don't care about self-intersection polygons.

Any advice? Maybe triangulating the polygons could be an idea?

sentences:
gamemaker getting a ball to bounce 90 degrees off of a 45 angle I am trying to get a circle to bounce off a 45 degree diamond shap using Gamemaker Studio.
I would like the ball to bounce in straight lines so my directions would be 0, 90, 180, or 270 degrees, depending on which side of the diamond the collision takes place.  Precise bouncing is giving me all sorts of results so I think I would have to do it in code.

I tried saying:

  if (direction >=0 && direction <=90) {   direction = 90 }

And doing this for all the angles, but this did not work.

Has anyone encountered this before?

sentences:
Why transform.Rotate(X,0,Z) rotates also Y? In my game I'm trying to rotate a turret.
I'm using the classic pattern:

float h = Input.GetAxis ("Horizontal");
float v = Input.GetAxis ("Vertical");

if (h != 0 || v!=0)
    rb.transform.Rotate (new Vector3(v, 0, h));

The problem is that if I move in vertical axis also Y axis rotates. Why?

How can I achieve a rotation that rotates only the X and Z axis and not the Y axis?

sentences: Art asset creation workflow question: are there any neat ways to save your work and automatically export it to desired format? To be specific: I have used GraphicsGale for pixel art sprites. The program saves its files in its own format (.gal, I believe), but the images in my game have to be .png. Saving it to .png loses information for GraphicsGale, like the palette. Manually keeping to seperate files impairs the workflow. Ideal would be that after every save,  the original file is saved in one folder, and a .png export in another, awaiting runtime and packing. Any suggestion/thoughts?

sentences:
Testing Multiplayer Browser Game on Single Computer I am writing a multiplay browser based game and am running into an issue with playtesting simple interactions. When a browser window loses focus is stops running requestAnimationFrame calls. This effectively pauses the state all visuals when focus is lost.

I would like to have two instances of the game running at the same time. I could playtest in one window and observe how a thirdparty would see those actions in another window.

Right now I am only able to toggle between the two windows and see teleportation like behavior as the client state catches up to the new server state.

I am not sure how, without setting up a second computer, I might test this. Anyone have any experience with this or any advice?

sentences:
The ship "shudders" in scrolling Asteroids In my Asteroids game the user can scroll through space. When scrolling, the ship is drawn in the centre of the window. I use interpolation. I scroll the window uing glOrtho, centering it around the centre of the ship. On my first machine (7 years old, Windows XP, NVIDIA), I am doing 50 updates and 76 frames per second. This is smooth. My other machine an old compaq laptop (Pentium III) with Linux and Radeon OpenGL driver delivers 50 updates and 30 frames per second. The ship regularly seems to "shudder" back and forth when at maximum thrust. When you position the mouse cursor beside the ship it is obvious that its relative position in the window changes. Also, the stars seem blurred into short "lines".

Playing the game in non-scrolling mode, the ship moves within the window, glOrtho is therefore not called repeatedly and there is no problem.

I suspect a bug in my positioning of the ship and the window but I have dumped out these values and they seem to only go forward, not forward-back-forward. The driver does support double buffering. I guess if it is my bug I need to slow the frame-rate down to debug properly. My question: is this an obvious driver bug or is the slower machine uncovering a bug in my stuff and if so, some debugging tips would be appreciated. I am drawing in world co-ordinates and letting OpenGL do the scaling and translation so if I had a quick way of verifying what pixel co-ordinates OpenGL produces for the ship centre, that would help clarify this.

sentences:
nurbs and pathfinding optimization I'm working on a project, and my current milestone is pathfinding. I have a working prototype that consists of several components:

a manually drawing of a path, that matches the visual path that the characters are allowed to walk on
a grid for A* calculations
a ray that pokes through the grid cells neighbors during the A* evaluation, and if it intersects a perfect GREEN  pixel, sets the cell as walkable for A* calculations, and if it hits a transparent pixel, leaves the cell as not walkable
after the rough A* path is calculated,  an algorithm for nurbs makes the turns in the path, more ease in, so to speak

My current issue is that the nurbs path Looks like it can use some optimization, And I can use your help to nudge me in the right direction, either pointing me to some literature or directly brainstorm.. Please see the picture below, it should be clearer what I mean, my goal is to have nurbs in a more straight-line, perhaps using some sort of extrapolation algorithm that is based on the A* result, and simplifies it in such a way that the nurbs curve is straighter from start to end

the project is browser-based Away3D framework(sea3D framework more specific)

its github repository can be found here

Thanks!

below is an example that shows the components described above: in GREEN the path that was draw manually, in RED the A* walkable path, in BLUE shades the nurbs

And another example how it actually looks in game, without all the pathfinding visual representations

sentences:
Why does the following code print logs even after the game object is detroyed? I have the following in a script attached to a game object in a unity scene. When I run this scene and press 'E', I get the following logs. (The game object is destroyed too)

In destroy
After destroy

void Update () {
    if(Input.GetKey(KeyCode.E)){
        Debug.Log ("In destroy");
        Destroy (gameObject);
        Debug.Log ("After destroy");
    }
}

My question is that if the game object is destroyed, then why does the execution continue to the code which logs "After destroy"?

sentences:
How to keep triangles from connecting across voxel mesh I am working on a voxel engine and have just started learning webgl. I have generated a list of Vertices and Indices by using Array.concat() on a template array and adding a value based on my position in loop.

var verticesTemplate = [
    // Front face
    -0.5, -0.5,  0.5,
     0.5, -0.5,  0.5,
     0.5,  0.5,  0.5,
    -0.5,  0.5,  0.5,

    // Top face
    -0.5,  0.5, -0.5,
    -0.5,  0.5,  0.5,
     0.5,  0.5,  0.5,
     0.5,  0.5, -0.5,

    // Right face
    0.5, -0.5, -0.5,
    0.5,  0.5, -0.5,
    0.5,  0.5,  0.5,
    0.5, -0.5,  0.5,

    // Bottom face
    -0.5, -0.5, -0.5,
     0.5, -0.5, -0.5,
     0.5, -0.5,  0.5,
    -0.5, -0.5,  0.5,

    // Left face
    -0.5, -0.5, -0.5,
    -0.5, -0.5,  0.5,
    -0.5,  0.5,  0.5,
    -0.5,  0.5, -0.5,

    // Back face
    -0.5, -0.5, -0.5,
    -0.5,  0.5, -0.5,
     0.5,  0.5, -0.5,
     0.5, -0.5, -0.5,
];
var indicesTemplate = [
    0, 1, 2,      0, 2, 3,    // Front face
    4, 5, 6,      4, 6, 7,    // Back face
    8, 9, 10,     8, 10, 11,  // Top face
    12, 13, 14,   12, 14, 15, // Bottom face
    16, 17, 18,   16, 18, 19, // Right face
    20, 21, 22,   20, 22, 23  // Left face
];
var WorldVertices = [];
var WorldIndices = [];
var IndexLoopIndex = 0;

function generateMeshData() {
    for(var x = 0; x < 4; x++) {
        var blockVertices = [].concat(verticesTemplate);
        addToX(verticesTemplate, blockVertices, x);
        for(var y = 0; y < 4; y++) {
            addToY(verticesTemplate, blockVertices, y);
            for(var z = 0; z < 4; z++) {
                var block = blocks[x][y][z];
                if(block.isActive === true) {
                    // adds a value of 1(The blockSize) to all z coordinates in verticesTemplate and adds to end of WorldVertices
                    addToZ(verticesTemplate, blockVertices, z);
                    WorldVertices = WorldVertices.concat(blockVertices);

                    var indices = [].concat(indicesTemplate);
                    addToXYZ(indicesTemplate, indices, 24*IndexLoopIndex);
                    WorldIndices = WorldIndices.concat(indices);
                    IndexLoopIndex++;
                }
            }
        }
    }
}

The problem is that the triangles are skewed after the mesh is rendered using gl.drawElements. And I can't figure out why. So how can I keep triangles from being drawn that connect cubes?

sentences:
Instantiated Prefab Facing Wrong Way Here's a Youtube video of my problem in action ((in the video I am clicking in various directions, yet the fireball is always created facing down in some direction.))

I've been having a lot of trouble wrapping my brain around Quaternion rotations in Unity2D.

What I'm trying to do is so simple, yet it keeps beating me. I simply want to instantiate a prefab of fireball when I click the button. The problem is that I want the fireball to be facing in the direction of the mouse before firing along. I haven't gotten to the fire and velocity part because I can't get it face the right direction when it's created.

In my playercontrollerscript attached to the player Object I have this (In C#)

        if (Input.GetMouseButtonDown (0) && anim.GetBool ("canAtk")) { //Basic attack controls

        curTarget = Camera.main.ScreenToWorldPoint(Input.mousePosition);

        if(classState == "Cutter"){
            anim.SetTrigger ("attacking");
            anim.SetBool ("canAtk", false);
            StartCoroutine (AttackTiming ());
            anim.SetFloat ("animCombo", playerCombo);
        }
        else if(classState == "Flame"){
            Debug.Log (curTarget);
            var worldTarget = Input.mousePosition;
            Quaternion rot = Quaternion.LookRotation(transform.position - curTarget, Vector3.right);
            Rigidbody2D fballClone = (Rigidbody2D) Instantiate(fireBallz, transform.position, rot);

(You can safely ignore the cutter class part. The problem is when I'm in Flame class. I also have a script attached to the prefab object, but at this moment all it does is control Euler angles so it doesn't rotate along the weirdness axis.

Anyways, each time I hit the button it creates a fireball, but it's like they are 90 degrees behind where they should be. I say "like" because that's not always the case. If I click under my character, then the fireball is pointing up. If I click sort of "Down/right" it points "up/right".

This would be easier if I could visually wrap my head around how the rotations work. Any advice would be appreciated. If you need any more information or screenshots let me know as well. Thanks again.

Update: so previously I had left a line setting curTarget.z to 1 because it was returning -10 for the camera Z and I thought that was related to the problem. Oddly, when I removed that line it halfway fixed the problem. Now, if I click in the down/right or down/left or down it will create the fireball facing correct direction, but if it's "up" any, then it will pretty much face the opposite direction. Also, directly left or directly right causes the fireball to face down.

New Update: (Sort of just updating as I try to work it out.) I turned on Debug.Log(rot) just so I could see the rotation values when I create the fireball.

If I click bottom right I get (0.0, -0.6, -0.4, 0.7) the fireball is facing the correct position as it does always as long as I'm clicking in the "downish" area. When I click top right I get (-0.6, 0.0, 0.7, -0.3) and the fireball is facing Bottom-Left. So I click in the bottom-left direction and I get (0.6, 0.1, 0.7, -0.4) and it's facing bottom-left. My brain is so fried I'm not piecing it together correctly. Something I'm missing.

sentences:
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:
Random tile-based floor plan generation with enclosed rooms I've been working on a project for a while which takes a grid of n*n tiles (starting at n=16 and with n increasing by 4 every so often for new floors), and fills it with rooms of random rectangular sizes, and have been having issues creating an efficient algorithm to do so that fits my requirements:

The outside ring (where x = 1 or n | y = 1 or n) must be corridor tiles (obviously easy)
All rooms must be entirely surrounded by corridor tiles
In no place may there be a 2x2 grid of corridor tiles (so corridors are all 1 tile thick)
There are certain rooms of specific sizes that must be present, and then there are other types of rooms which just fill in the remaining space afterward.
Do not have any corridors that go all the way through the floor.
(Preferably) Room min side length = 2 (relatively easy to program in my code, perhaps not in one of 'your' suggestions)

My algorithm works fine, however at n=12 it takes ~2s to compute on my 4790k, and grows ridiculously exponentially from there: taking 6s for n=14, 29s for n=16, etc... Because there are two particular shapes whose creation must be avoided, as once created they make it impossible to fill up the grid entirely, and so my logic must make sure that doesn't happen, which leads to the performance issues.

My code is far too long to post here, but essentially what it does is:
Go through each 'open tile' (tiles that are not in rooms nor that are a corridor), find the maximum size it can be, then for loop through that size's x and y, see if a room at that x and y would create any of the aforementioned 'illegal' shapes, and if not, add this open tile and this open tile's size to an array of possible sizes and size positions.
I then choose a random size (more or less) from the list, and then create a room there.

Here is an example picture (though some seeds are better than this one) of what my algorithm results in:

Looking all over the internet I haven't been able to find an algorithm that fits my needs - mainly in the 'no corridors going through entire grid' issue.
(This issue is present in the picture I attached due to the smallness of n=12, the larger the grid, the less likely this occurs with my code - the issue is there are some algorithms, like what I am calling the 'recursive' method - ~halving all sectors that are larger than minimum size until done, which will always have at least one, no matter how large, ie...)

(n=64 with recursive method, minSize = 2, maxSize = 4)

sentences:
Need some help to move sprite in XNA when a sprite, like a space ship, reach the window border I call a method to "turn off" the engine by setting the speed to 0. But then it's impossible to move the sprite back, because the speed is set to 0! I would preciate some help to solve this! Perhaps there is another way to do this? Thanks!

Some of the code

if (position.X > 800)
EngineOff();

direction = new Vector2((float)Math.Cos(rotation - 1.62), (float)Math.Sin(rotation - 1.62));
position += direction * speed;

And the method that controls the engine

 // Engine on
    public void EngineOn()
    {
        speed = 1;
    }

    // engine off
    public void EngineOff()
    {
        speed = 0;
    }

EDIT: Would it be possible to rotate the ship, so it's point inwards the game area? Would it be possible to rotate it 1/2 of a turn or 1/4 of a turn? My thought was that when the spaceship hit the border, it just turn around and continue moving inwards the game area.

sentences:
Disable audio listener warnings? "There are no audio listeners...", "There are 2 audio listeners..." The scene I'm working in constantly spams the message There are no audio listeners in the scene. Please ensure there is always one audio listener in the scene. If I add a dummy camera with an Audio Listener, I then get There are 2 audio listeners in the scene. Please ensure there is always exactly one audio listener in the scene.

I know this happens because our camera is created programmatically, with an audio listener.  I also realize this will not affect the non-development build in any way.

Is it possible to disable these warnings completely?

sentences:
How can I compute a velocity proportional to the difference between two hand positions? I'm working on a project with the Kinect SDK and XNA 4. I need take the position of the hands and draw a sprite over it. I'm was doing it directly and because of that I get a "trembling hands" effect. So, I was thinking of making the sprite move from the previous position to the new one given in every frame by the new hand position.

This way, the sprite does not jump from one position to another. This is working just fine, but I'm using a constant value for the velocity, and I really would like to use a variable velocity given by the difference between the previous and the new position. That is: if the hand move more quickly in the reality, the velocity will be higher.

I really don't have a clue on how to make this work. Can somebody point me in the right direction?

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 to turn off antialiasing in Graphics class? I have been using the following code with a Graphics2D buffered image

g.setRenderingHint(
  RenderingHints.KEY_INTERPOLATION,
  RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR);

to ensure the image looks correct when scaled in.

If I use the Graphics class instead of Graphics2D it appears to auto anti-alias and present a zoomed image as blurred.

Is there a way to turn off anti-aliasing with the Graphics class so I do not have to use the Graphics2D class?

sentences:
What are the other three "game dynamics"? Seth Priebatsch recently gave a tedtalk entitled “Building the game layer on top of the world.” In it, Seth described four “game dynamics,” techniques used by game designers to make games fun and addictive. The four dynamics that Priebtsch described were:

Appointment dynamic-a dynamic in which to succeed, one must return at a predefined time to take a predetermined action. (Real life example: happy hour)
Influence and status-the ability of one player to modify the behavior of another's actions through social pressure. (Example: different color credit cards as a reflection of status)
Progression dynamic-a dynamic in which success is granularly displayed and measured through the process of completing itemized tasks. (Example: linkedin profile progress bar)
Communal discovery-a dynamic wherein an entire community is rallied to work together to solve a challenge. (Example: finding interesting content on Digg.com)

Seth explained these four game dynamics in his talk and added that his company has an additional three. Does anyone know (or have any theories) about what the other three game dynamics are?

sentences:
Top-down 2D push angle velocity I'm trying to determine the angle NPCs are pushed in when the PLAYER collides with them, like how 'Retro City Rampage' and 'Shakedown Hawaii' do when you bump in pedestrians.

Here the PLAYER (green) is coming in at an angle of -45, what's the math or formula I need to be looking at to decide the new angle each NPC (red) should adopt?

sentences:
Inputting Only Alphabetical Input - Slick2D I'm trying to obtain the user input for when they enter their own name. However I would prefer to have it Alphabetically.

This is what I'm doing at the moment:

    if (input.isKeyDown(Input.KEY_A)) {

    }
    if (input.isKeyDown(Input.KEY_B)) {

    }
    if (input.isKeyDown(Input.KEY_C)) {

    }
    //continued for each letter.

Is there an easier way to obtain the input? An hopefully make sure its only alphabetical?

sentences:
Design basics for Unity game: sport management type I am planning the classes for my game; and I am having problems to figure out the best way to connect them.

In my game I do not have the classic structure of say a FPS; where you have the player class; with stats, and AI class with enemy AI. my game is more like a sport simulation manager type; so there are various entities:

The player; which take over a team (or play in a team)
The NPC: other players, managers, people that work in the club.
The team (club) itself; where either the player take control of it, so NPC will join it, or will play in it, so the team will have both player and NPCs.
Competitions: self explanatory; team participate in it.

I was thinking to make different base classes, one for team, NPC, player and competitions, but then I need to establish relations between them.

This look more like a DB with relation between tables, compared to a standard FPS game, where everything is strictly divided and you don't get class that "belong" to some other class.

I am using Unity BTW, so far I ahve the GameManager class; which initialize the main menu, the scene manager and UI manager.

Then I have 4 different class (player, NPC, competition and team), and this is where I am stuck. Should I create references to other classes, so when I instantiate for example a team class; then I will put in it a dataset to represent the NPC classes and the player class?

Or should they not know about each other at all, and all the interaction and logic should go in the gamemanager class?

sentences:
Why does invoking glm::refract function return NaN? At the present time, I make a simple raytracing project and I encounter an issue : When I invoking the glm::refract function, it returns me a vec3 with "NaN" values. However, my input data seems to be correct (2 normalized vec3 and my refractive-index is 1.0). Have you got an idea of the problem ? This function is not so well documented.

EDIT :

Very strange, if my refractive index is 1.0f it's working well actually :

glm::vec3 view = glm::vec3(0.191318035, -0.0721754059, 0.978870869);
glm::vec3 normal = glm::vec3(-0.151046738, -0.988510013, -0.00574064208);
float refractIndex = 1.0f;
glm::vec3 output = glm::refract(view, normal, refractIndex);

However, if I invoke the function and passing a refractive index of 1.10000002f for example (my program seems to approximate values and I don't know why...), it doesn't work => returns vec3 with "NaN" values. Like below :

glm::vec3 view = glm::vec3(0.191318035, -0.0721754059, 0.978870869);
glm::vec3 normal = glm::vec3(-0.151046738, -0.988510013, -0.00574064208);
float refractIndex = 1.10000002f;
glm::vec3 output = glm::refract(view, normal, refractIndex);

EDIT 2 :

More weird : If I try with a refractive-index of 1.1f it doesn't work. Same error.

sentences:
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:
Unity 2D: Smooth ease-out movement on grid I'm trying to create a grid movement in Unity, as where the player will ease-out on a tile when stopping, but I can't seem to get it right. I need a little nudge in the right direction for how to implement something like this:

I used a coroutine to execute the movement when input is requested and use an ease-out curve to make the player stop smoothly. But, when walking multiple tiles it is jittery because the ease-out is applied. Also, the smoother I want the ease-out to be, the slower the player moves.

My full code.

public float moveDuration = .5F;
public AnimationCurve moveCurve = AnimationCurve.Linear(0F, 0F, 1F, 1F);

private Rigidbody2D rigidBody;
private BoxCollider2D boxCollider;
private bool isMoving;

void Start() {
    rigidBody = GetComponent<Rigidbody2D>();
    boxCollider = GetComponent<BoxCollider2D>();
}

void Reset() {
    moveSpeed = 8F;
    moveDuration = .5F;
    moveCurve = AnimationCurve.Linear(0F, 0F, 1F, 1F);
    isMoving = false;
}

void Update() {
    if (!isMoving) {
        int x = 0;
    int y = 0;

    x = (int)(Input.GetAxisRaw("Horizontal"));
    y = (int)(Input.GetAxisRaw("Vertical"));
    if (x != 0) y = 0;
    if (x != 0 || y != 0) {
            AttemptMove(x, y);
        }
    }
}

private void AttemptMove(int x, int y) {
    Debug.Log("Attempt move: "+x+","+y);

    Vector2 startPosition = transform.position;
    Vector2 endPosition = startPosition + new Vector2(x, y);

    StartCoroutine(SmoothMovement(endPosition, moveDuration));
}

protected IEnumerator SmoothMovement(Vector3 endPosition, float duration) {
    float elapsed = 0F;
    Vector3 startPosition = transform.position;

    isMoving = true;

    while (elapsed < duration) {
        Vector3 newPosition = Vector3.Lerp(startPosition, endPosition, moveCurve.Evaluate((elapsed/duration)));

        rigidBody.MovePosition(newPosition);
        elapsed += Time.deltaTime;
        yield return null;
    }

    isMoving = false;

}

sentences:
Unity C# : How to make 3D objects move in the grid? I want to move and deploy 3D objects in the grid, like bakery 2(Storm8 Studios). How do you make a grid like that? For example, make a 5x5 grid and move it to a touchdrag. I'd like you to give me some advice.

Pictures for reference: https://lh3.googleusercontent.com/Kwp9i9ExRboeQCtM65sztw3tqEL9R76zZzB9U6j5vs98ueF9ksOU3huMdZqv4KPDZ2E=w2590-h1430

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

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

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

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

sentences:
Unity Destroy Unused GameObjects I'm trying to access a method in another script without using the keyword "static";

public void CreateFarm()
{
    new Farm().NewResourceBuilding(gameObject);
}

My question is; will Unity automatically delete this object once it's done calling the method? Or will I need to manually destroy it? If the latter, how will I go about that?

I've searched on Google and been on this problem for a few days until I've finally come to this solution lol. So annoying to reference a static yet want to add a gameobject via the inspector.

Edit (Left the previous content untouched as some of answers already provided for the above might be useful to others). I have since revised my code and the flow.

I have a scene with a number of "empty lots" which I use images as placeholders childed to a Canvas.

The following steps occur:

Clicking on any of these images calls Unity's event system to open a panel, from the onclick options of the inspector. This panel will allow me to select from a number of different buildings to construct.

ChangePanels.CS

public void RuralBuildingSelected()
{
    empirePanel.SetActive(false);
    characterPanel.SetActive(false);
    ruralBuildingPanel.SetActive(true);
}

Why I wanted to avoid "static" was because no static method is callable from the inspector (AFAIK). I could have created my own script and called a public onclick, but perhaps one of you might be able to advise which option of these is more efficient.

Whichever "emptylot" I clicked on, I wanted them to send through their data into a manager script so whatever building I built, could replace the emptylot.

EmptyLot.CS

public void CreateFarm()
{
    new GameManager().GetEmpty(gameObject);
}

The following follow gives you an option of a number of buildings to construct. If I click on the farm, I need to;

Instantiate a new Farm
Parent it to the emptyLot's parent
To replace the emptylot with the new farm, I set them to have the same positions
Destroy the emptylot that called the new farm into existence
Bring back the main panel

Farm.CS

new public void NewResourceBuilding(ResourceBuildings resource)
    {
        Farm newFarm = Instantiate(resource) as Farm;
        newFarm.transform.SetParent(GameManager.emptyLot.transform.parent);
        newFarm.transform.position = GameManager.emptyLot.transform.position;
        newFarm.levelText = newFarm.GetComponentInChildren<Text>();
        newFarm.name = resource.name;
        Destroy(GameManager.emptyLot);
        GameObject main = GameObject.Find("Main Canvas");
        main.GetComponent<ChangePanels>().MainScene();
    }

My Questions:

The "EmptyLot.CS" script creates a new GameManager to call a public method. I don't reference the object. Will this automatically be added to the garbage collector or should I just destroy it after using it? If I need to destroy it manually, how would I go about that?
I note that if I went ahead with the static methods and implement my own OnClick() method I can condense this to just two scripts instead of the three. So should I do that? Or based on the above code, is it just as efficient to keep it the way it is? I'm not a pro at this, but inline with Wondra's comment (to Almo's answer) it does seem like the approach of creating objects to delete instantly is a performance issue?

Thank you for taking the time to read/help/advice

sentences: 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:
What's the best presentation/terminology for "quit" functionality? I'm writing a game in XNA for Windows and Xbox, and I'm trying to decide how to present quitting options to the user. It seems to me that there are two basic types of "quits":

Quit the game and close it completely. On the PC, return to Windows. On the Xbox, return to the Dashboard.
Quit the current playthrough and return to the title screen.

Is there accepted language for these things? I've tried a few basic searches - I apologize if this has already been asked - but I couldn't find anything. The best I can come up with is this:

Provide a "Quit" option on the title screen menu. This will close the game completely (see #1 above). This might not be strictly necessary on the Xbox, since players can close games using the Guide button (aka the "Xbox button").
Provide an "Exit to Title Screen" option elsewhere in the game. This will quit the current game and return to the title screen (see #2 above).

I don't love the latter option, because it's a bit too verbose for my tastes, but using something shorter, e.g., just "Quit" and "Exit", doesn't seem clear enough.

It seems like the word "Quit" is the logical choice in both places, but wouldn't using the same word for two different things be inconsistent and confusing?

What are other "quit" conventions that you've seen?

sentences:
I'm Dragging object by using touch (mobile) it doesn't stop when hit collider I want to make object stopped when it hit collider of another object.
But it doesn't stop. How can I fix this? - Unity

my code is:

public class move: MonoBehaviour {
    public float speed = 0.5f;
    // Update is called once per frame
    void Update () {
      if (Input.touchCount ==1)
        {
            Touch touch = Input.GetTouch(0);
            float x = -7.5f + 15 * touch.position.x / Screen.width;
            float y = -2;
            transform.position = new Vector2(x * speed, y);
        }
    }
}

sentences:
How do I use the dot product to get an angle between two vectors? I am learning to use normalized vectors in my games.

I've learned that in order to know the angle between two vectors, I can use the dot product. This gives me a value between -1 and 1, where

1 means the vectors are parallel and facing the same direction (the angle is 180 degrees).
-1 means they are parallel and facing opposite directions (still 180 degrees).
0 means the angle between them is 90 degrees.

I want to know how to convert the dot product of two vectors, to an actual angle in degrees. For example, if the dot product of two vectors is 0.28, what is the corresponding angle, between 0 and 360 degrees?

sentences:
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:
Determining If a Point is Within Bounds I've got two points which I need to create a bounding box with, and then check to see if points are within this bounding box. The end result is a marquee selection tool.

So, here is the code I started with:

    var v1 = Camera.main.ScreenToViewportPoint( screenPosition1 );
    var v2 = Camera.main.ScreenToViewportPoint( screenPosition2 );
    var min = Vector3.Min( v1, v2 );
    var max = Vector3.Max( v1, v2 );
    //min.z = camera.nearClipPlane;
    //max.z = camera.farClipPlane;

    var bounds = new Bounds();
    bounds.SetMinMax( min, max );
    return bounds;

So then when I run it, it seems to create the correct bounds:
Center (0.4,0.4,22.3), Extends (0.2,0.2,0.0)

And the point seems like it should be within:
(0.4,0.3,22.4)

Now, my initial thoughts were that the z-index was off. However, i've tried setting that a bunch of different ways, including setting the z index of the center to 22, and the extent to 25. Nothing works.

I'm checking to see if it's contained, with:

bool unitInsideSelection = viewportBounds.Contains(camera.WorldToViewportPoint( gameObject.transform.position ) );

Where viewportBounds is the return object of the function above.

Any Thoughts?

sentences:
Pixel Shader stage did not run I can't figure out why the pixel shader won't run. I'm using the Blinn-Phong per-pixel shader from here. Only change I've made is that I pass an aditional color per vertex which gets multiplied by the light-color in the pixel shader.

So far the Graphics Analyzer shows me a valid IA-result and the same (okay looking) result in the VS-stage. I disabled depth-stencil for testing and though everything looks rather fine I always see "Stage did not run. No output." when I inspect the captured frame.

This is my Projection-matrix:

_projection = Matrix.PerspectiveFovLH((float) Math.PI / 4.0f, viewports[0].Width / viewports[0].Height,
            0.1f, 100f);

Values are Width: 1346, Height: 800

My View is calculated like this:

_rotation = Quaternion.RotationYawPitchRoll(Yaw, Pitch, Roll);
Vector3.Transform(ref _target, ref _rotation, out _target);

Vector3 up = Vector3.UnitY;
Vector3.Transform(ref up, ref _rotation, out up);

_view = Matrix.LookAtLH(Position, _target, up);

Whereas Position: X:50, Y:50, Z:-300, Target: X:50, Y:50, Z:0 and Yaw, Pitch, Roll are all 0.

World-Matrix is currently Matrix.Identity.

The quad I try to render spans itself from X:0, Y:0 to X:100, Y:100 with 4 vertices and 6 indices.

I first thought that SV_POSITION must be a normalized value since it's obviously a SV-coordinate and someone posted in another thread that this solved his problem - but then the VS-stage does not show anything at all and PS still won't run.

It's been quite some years since I last worked with DirectX so I'm not sure anymore why this happens.

sentences:
Per pixel collision depth I need to modify the code below to get the penetration depth from the per pixel collision and return it as a Vector2 to later apply it to the character position.
static bool IntersectPixels(Rectangle rectangleA, Color[] dataA,
                            Rectangle rectangleB, Color[] dataB)
{
    // Find the bounds of the rectangle intersection
    int top = Math.Max(rectangleA.Top, rectangleB.Top);
    int bottom = Math.Min(rectangleA.Bottom, rectangleB.Bottom);
    int left = Math.Max(rectangleA.Left, rectangleB.Left);
    int right = Math.Min(rectangleA.Right, rectangleB.Right);

    // Check every point within the intersection bounds
    for (int y = top; y < bottom; y++)
    {
        for (int x = left; x < right; x++)
        {
            // Get the color of both pixels at this point
            Color colorA = dataA[(x - rectangleA.Left) +
                                 (y - rectangleA.Top) * rectangleA.Width];
            Color colorB = dataB[(x - rectangleB.Left) +
                                 (y - rectangleB.Top) * rectangleB.Width];

            // If both pixels are not completely transparent,
            if (colorA.A != 0 && colorB.A != 0)
            {
                // then an intersection has been found
                return true;
            }
        }
    }

    // No intersection found
    return false;
}

Edit: I need something similar to this:
https://github.com/MonoGame/MonoGame.Samples/blob/develop/Platformer2D/Game/RectangleExtensions.cs
The code from the link above is for getting the intersection depth between two rectangles.
Thanks in advance.

sentences:
SpriteRenderer color not responding to script! I have written a simple c# class that is supposed to change the color of the Player Renderer.
But, there seems to be a problem! whenever I call the function OnCallFun() ... the color stays put and does not change.
I have looked into the solution for quite some time now but no hope.
does anyone have a solution?
using UnityEngine;

public class ChangeColor : MonoBehaviour
{

    // Reference to Sprite Renderer component
    private Renderer rend;

    [SerializeField]
    private Color colorToTurnTo = Color.white;

    // Use this for initialization
    void Start()
    {

        rend = GetComponent<Renderer>();

        // Change sprite color to selected color
        rend.material.SetColor("_SpecColor", colorToTurnTo);
    }
}

sentences:
How to create 2D platformer maps without a game engine's editor? I've been developing a 2D shooting platform videogame for the Sony PSP console using only the ONELua interpreter for the Lua programing language (since there is not any game engine for it). Despite its many useful modules, it doesn't come with tools to create platformers, because ONELua is not a game engine itself.
So I need to figure out how to implement my camera, maps and some other stuff myself. Since Lua is a scripting language, I've been applying best practices and an OOP approach in order to make it scalable and maintainable.
Despite researching a lot, all I'm finding is about Unity, GameMaker, Godot or any other already invented wheel:

How would you make a 2D platformer map so that it interacts with environment (other objects, enemies, etc.)?

Is the map represented by a matrix (kind of RPG map)?

The objects should be hardcoded, I mean, do they have a fixed position?
This last question is because I've read the code form another very similar project but the code has been hardcoded so I consider it as not very maintainable and scalable (since it has more than 1k lines of code in just one script), however at the end it could be hardcoded using some creational map tools, couldn't it? If so, I guess all above questions would be answered.

Based on the code that I've read, I surmise that I would put every object at a fixed position using a level editing tool, applying physics to move those physical objects and so on. Then, if the player "moves" (it would stay in the center of the screen simulating moving, just with a walking animation) then move the whole world (objects and environment) would approach the player, but I think it wouldn't be the best approach for performance.

sentences:
GLM: Camera attached to model moves in opposite direction from the model I have been working on a component based engine with nested game objects each with there own transformation's. Each game object calculates its position in the world based on its parents world transformation multipled by there own local one (ModelsWorldTransform = ParentsWorldTransform * LocalTransform).

This all works great until I attach the camera component to a model and in this scenario, as the model the camera is attached to moves away from the origin, the camera moves in the opposite direction to the movement whitest still seeming like it is in the correct position according to its mat4.

All local transformations are stored in a mat4 rather then three vec3's for position, rotation and scale to save on calculations each update having to generate new mat4's.

Transformation Component Update Code

m_world_transformation = m_local_transformation;
// If we have a parent object
if (m_parent_transform_component)
    m_world_transformation = m_parent_transform_component->GetWorldTransformation() * m_world_transformation;

Camers position buffer being updated

BufferData.view = m_transformation_component->GetWorldTransformation();
m_camera_buffer->SetData();

I'm not sure what i'm missing, if anyone has any sugestions that would be apreatiated.

sentences:
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:
How do I enable higher FPS in XNA 4.0? I created a FpsCounter DrawableGameComponent (linked to code, it's longish). It works great: It displays 60.0 fps normally. If I artificially slow down the game loop, it drops.

My 'game' at the moment is a single keyboard-controlled sprite, so it should be possible to render more frequently than 60 frames a second.

I figured turning off vertical synchronization would increase the FPS cap:

public Game1()
{
    _graphics = new GraphicsDeviceManager(this)
                    {
                        PreferredBackBufferWidth = WindowWidth,
                        PreferredBackBufferHeight = WindowHeight,
                        SynchronizeWithVerticalRetrace = false,
                    };
    _graphics.ApplyChanges();
    Content.RootDirectory = "Content";
}

However, even though the above code seems like it should turn off vsync, it doesn't seem to be. Is there something wrong with my constructor, or perhaps my FPS calculations? Or is there something else that may be limiting the frame count?

sentences:
How would I go about implementing a collision avoidance check, avoiding moving objects from multiple directions? So I'm making a testbed for an AI actor(ship). It's a simple asteroids game using an AI controlled actor.
I'm doing this using VS, monogame.

I have implemented a simple steering behaviour using a tutorial as a guideline, found here. https://gamedevelopment.tutsplus.com/tutorials/understanding-steering-behaviors-collision-avoidance--gamedev-7777
It works somewhat.

The problem occurs when the objects(asteroids) are all moving around(at different speeds), using the guidelines from above, it only checks for collisions for whats infront, at specific points. Which would work if all other objects were static.
My initial thought was to add a check for back,left,right. Then loop it to check all these positions in a 50-150 units radius. But the more I think about it, the more realize there must be a better way. As understand it, that wouldn't really solve it either, and would be performance heavy.

How would I go about implementing a collision avoidance check that 1; takes into account the approaching objects may come from any direction.
2; the differnt velocities of those objects.

Or might it be better to apply the existing check to the objects and passing the data to the actor?

Any references, tips, guide, code snippets or good old wisdom or simple pointer in the right direction, would be enormously appreciated!

sentences:
Scale object based on another object's position Despite an hour or so of Googling I can't seem to figure out how to calculate the scale factor based on distance. Here's the illustration of my problem.

I've tried manipulating the x values and such, but until now I still cannot figure it out.
Here's the snippet:

Vector3 v3Scale = frontWall.transform.localScale;
frontWall.transform.localScale = new Vector3(v3Pos.x*2.0f , v3Scale.y , v3Scale.z);

Any ideas? Thanks in advance!

UPDATE:

if(getTarget.CompareTag("LeftRightWall") && getTarget.transform.childCount == 1)
        {
            float translate = getTarget.transform.position.x - getTarget.transform.GetChild(0).gameObject.transform.position.x;
            Debug.Log("value :"+translate);
            foreach (GameObject frontWall in GameObject.FindGameObjectsWithTag("FrontWall"))
            {
                Vector3 v3Scale = frontWall.transform.localScale;
                float scaleFactor = translate/frontWall.transform.localScale.x;
                frontWall.transform.localScale = new Vector3(translate , v3Scale.y , v3Scale.z);
            }
            v3Pos.z = getTarget.transform.position.z;
            v3Pos.y = getTarget.transform.position.y;
            getTarget.transform.position = v3Pos;
            getTarget.transform.GetChild(0).gameObject.transform.position = new Vector3(-v3Pos.x, v3Pos.y, v3Pos.z);
        }

The LeftRightWall is the ones that I drag on the picture, with another vertical line as its child. The FrontWall is the horizontal line that is stretched when the LeftRightWall is dragged. Hope its clear enough. Thanks

UPDATE: This is the closest one from what I'm trying to achieve... ((

Here's the code:

float translate = getTarget.transform.position.x - getTarget.transform.GetChild(0).gameObject.transform.position.x;
            Debug.Log("value :"+translate);
            foreach (GameObject frontWall in GameObject.FindGameObjectsWithTag("FrontWall"))
            {
                Vector3 v3Scale = frontWall.transform.localScale;
                frontWall.transform.localScale = new Vector3(translate+v3Pos.x, v3Scale.y , v3Scale.z);
            }

UPDATE:
This is what I'm able to do so far, thanks to the answer below. However I still don't know why the other side of the panel is behaving like that. The scale of horizontal lines also shrinks when I click on the vertical line.

This is the updated code:

ray = mainCamera.ScreenPointToRay(Input.mousePosition);
        float dist;
        plane.Raycast(ray, out dist);
        Vector3 v3Pos = ray.GetPoint(dist);
        if(getTarget.CompareTag("LeftRightWall") && getTarget.transform.childCount == 1)
        {
            float translate = getTarget.transform.localPosition.x - getTarget.transform.GetChild(0).gameObject.transform.position.x;
            Debug.Log("value :"+getTarget.transform.GetChild(0).gameObject.transform.localPosition.x);
            foreach (GameObject frontWall in GameObject.FindGameObjectsWithTag("FrontWall"))
            {
                Vector3 v3Scale = frontWall.transform.localScale;
                float scaleFactor = (translate/v3Scale.x);
                frontWall.transform.localScale = new Vector3(v3Scale.x*scaleFactor, v3Scale.y, v3Scale.z);
            }
            v3Pos.z = getTarget.transform.localPosition.z;
            v3Pos.y = getTarget.transform.localPosition.y;
            getTarget.transform.localPosition = v3Pos;
            getTarget.transform.GetChild(0).gameObject.transform.position = new Vector3(-v3Pos.x, v3Pos.y, v3Pos.z);
        }

sentences:
Correct method for choosing the user's video cards? My game uses DirectX 10, and I'm having a problem where users are reporting that my game isn't picking up on their graphics card. Instead it prefers to run on their integrated Intel card, ruining performance. It's possible that this is related to Windows 8. It could also be related to mobile cards.

Until now, I've been creating the DirectX 10 device with no adapter specified (as I've seen in all the examples/demos so far), to allow DirectX to choose its own adapter. Apparently I'm going to have to change that.

I already have a function which runs through all of the available adapters, and chooses the one with the highest amount of dedicated memory. That works great for correcting the problem, but is it correct in general?

Unfortunately, I cannot rely on the card having valid video output (i.e: a monitor hooked up) as the machines affected by this problem report no outputs for the desired card.

What algorithm can I use to properly choose which adapter to use with DirectX?

sentences: Are 2D art assets typically created at their intended in-game display size? I'm wondering if game makers create their sprites smaller than their intended in-game size in order to be more efficient or whether doing that produces unacceptable quality.

sentences:
Newton Game Dynamics: Making an object not affect another object I'm going to be using Newton in my networked action game with Mogre.  There will be two "types" of physics object:  global and local.  Global objects will be kept in sync for everybody; these include the players, projectiles, and other gameplay-related objects.  Local objects are purely for effect, like ragdolls, debris, and particles.

Is there a way to make the global objects affect the local objects without actually getting affected themselves?  I'd like debris to bounce off of a tank, but I don't want the tank to respond in any way.

sentences:
How to get a pixel color from a specific sprite on touch (unity)? I have a 2 layers of a different sprites. How can i get a pixel color from lower sprite?

I know how to get touch and world coordinates, but i have no idea what to do next.

Touch touch0 = Input.GetTouch(0); // screen touch coordinates
Vector2 playerPick = GetComponent<Camera>().ScreenToWorldPoint(touch0.position); // world coordinate

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:
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:
Using a switch command in one shader vs multiple shaders If you have multiple shaders, could you instead of switching between shaders all the time just have one shader with a switch and each case will send you along to another shader function which you require for that specific object? ( And  you would send an enumerated value through your constant buffer for that specific object)

I guess the real question is. What would take up the most performance, the switch or the switching between shaders?

Example:

BigShader(){
   switch(a){
      case 0 :
        { return transPSShader();}
      case 1:
        { return nonTransPSShader();}
ect.
}

sentences:
How to orient hands(or spine) to always look at some target? I am building an FPS game in Unity 3D everything was going cool but when I tried to implement aiming for the rifle everything just broke.

1): I have an IK setup which triggers when you equip weapon, this IK only calculate the hand position and orientation needed to hold the gun and after that the IK system disables itself, basically I am using IK for getting the proper hand position on different guns.

2): Once hands are positioned correctly on the gun then I rotate the hands(or spine, which will rotate hands and head with it) with the mouse to look up, down, right and left.

3): Handgun is very easy to handle, equip it and rotate the arms, arms are almost straight along the z-axis so I just rotate them on the y-axis to aim upward and downwards.

4): With the rifle, I can calculate the hand position and rotation to hold the rifle easily but (because static animation pose of holding he rifle is little oriented to make the player little realistic) when I rotate arms they rotate weirdly.

I checked in the editor by changing the y-axis of the rotation and found that only y-axis can't rotate the arm the way I want and to rotate it that way other axis must change their values. I searched a bit and found that it is a situation called as Gimbal Lock which is very common with euler rotations, I tried many things but still can't fix it.

Original Code:

        leftArm.transform.localEulerAngles = new Vector3(leftArm.transform.localEulerAngles.x,
        leftArm.transform.localEulerAngles.y + (currentCamRotX + offset),
        leftArm.transform.localEulerAngles.z);

        rightArm.transform.localEulerAngles = new Vector3(rightArmFPS.transform.localEulerAngles.x,
        rightArmFPS.transform.localEulerAngles.y + (currentCamRotX + offset),
        rightArmFPS.transform.localEulerAngles.z);

It works great with Handgun but not with Rifle.

I read about and tried following but in vain:

    //Method 1: Failed
    var target = camera.GetChild(0).GetChild(0);
    var direction = target.position - rightArmFPS.position;
    var toRotation = Quaternion.FromToRotation(rightArmFPS.up, direction);
    rightArmFPS.rotation = Quaternion.Lerp(rightArmFPS.rotation, toRotation, Time.deltaTime * 5);

    //Method 2: Failed
    var targetForward = target.position - spine.position;
    targetForward.Normalize();

    var rotAxis = Vector3.Cross(Vector3.forward, targetForward);
    var angle = Mathf.Acos(Vector3.Dot(Vector3.forward, targetForward)) * Mathf.Rad2Deg;

    spine.eulerAngles = rotAxis * angle;

What I am looking for now is if someone can point me what topic I should be looking in(because my poor maths skills are really getting me and I often use very poor workarounds for what could be solved easily with maths or physics), pseudo code to get me started or anything that might help me resolving this issue.

I know there are bunch of other ways to achieve what I am looking for and I have tried many of them like: using IK to position hands and then moving the guns up or down or having animations for each gun aiming up or down but honestly each method has it's own drawback(or its just me who is too noob for these things).

I followed this solution: Orienting a model to face a target

and many others, you might find it duplicate but none of the post on the internet has solved my problem(it is second day and I still can't figure this out).

Hope you understood the question and thanks for reading this:)

sentences:
Best way to connect multiplayer users with each other (matchmaking) on a low powered server? OK so I am using unity to make a multiplayer game, but I'm not sure how to connect players with each other over the internet.

Unlike other questions, this isn't a general problem of working out how to do UPnp or using unity's matchmaking server. My issue is that my server that I would use is a simple low powered pc (running normal windows 10, no idea how to use windows server).

I think it is powerful enough to match players with each other, but not to host more than one or two actual games.

The other issue is that I have a residential internet connection with a dynamic ip that changes every few months. However the speed should be ok (150Mb/s download, 20Mb/s download).

Also, I'm not planning to spend money on a monthly basis for a server (like unity's matchmaking service) as I plan to spend as little as possible (So far I've paid £12 to Microsoft for a dev account and I've received a £200 voucher from them so my current spending is -£189!)

So my question is should I use my server (would it work), are there any online services that are very cheap to use, or is there another way to make this work?

Only other thing is I could use the free 20 users at once on unity's matchmaking, but would this limit be too small?

EDIT:
just for information, my game is a simple tank shooter. I was thinking about limiting the amount of tanks in a game somewhere around 8-20. The bullets in my game are physical objects with rigidbodys and they move at a slower speed (if you've ever played tank trouble, it looks like that). The world is in 3D. There is a potential for there to be up to a hundred bullets in a scene at once at the worst.
After hosting a LAN world with 7 players connected for about 20-30 minutes, windows reports the data usage being around 3-4MB.

sentences:
XNA button mouse click stop propagation My game has a background that I can move with the mouse. I want to add some semi-transparent buttons on top of background as DrawableGameComponent. But when I click the Button mouse click will propagate to underlying background and it will be moved. How to detect that click was handled and not to call Update methods of underlying game components?

Sorry for my bad english.

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 does my character move diagonally? So i've been trying to make the player face towards the direction i pressed. That part works just fine but when I try to move the player it moves diagonally instead of left/right. Any clues?

 if (Input.GetKey(KeyCode.RightArrow))
             {
                 //moves the player
                 rb2d.velocity = new Vector3(2.5f, 0, 0);
                 transform.Translate(rb2d.velocity * Time.deltaTime);

                 //flips the player right
                 if (human.flipY == true)
                 {
                     human.transform.rotation = Quaternion.Euler(0, 0, 270);
                 }
                 else
                 {
                     transform.rotation = Quaternion.Euler(0, 0, -270);
                 }

sentences:
Browser RPG fight calculation formula I am making a simple browser rpg game, similar to battleknight. To keep the game simple, I have just Strength, Constitution, and Luck. But as luck is random based, I'm struggling with fight calculations. I need some kind of formula to calculate attacks.

Preview from battleknight

UPDATE
I was thinking about this model:

Strength - base dmg.

speed - chance of attack avoidance

toughness - increase HP

luck - crit. hit chance

defence - chance of attack blocking.

As I expect, there will be fight between high and lower ranked players so I want to calculate attack differently. My idea is sum of stronger player stats(this will be cap). So random based attributes will be divided by this sum. Example:

cap = sumOfStrongerPlayerAttributes
player1Luck = player1.luck / cap
player2Luck = player2.luck / cap
// also luck can be devided for ensure that crit hits will not be so often

Also crit. hit dmg. will be calculated from based dmg. like:

critHitDmg = player.strength * someKindOfConst

This model will prevent from too often crits. And player who will spend all his resources to level up luck, will have low stamina, defence or base dmg (which is also important for crit. hit dmg)

sentences:
Advantage of Using Addressable Over Asset Bundles in Unity I have a project that already uses asset bundles. I download assets when the game starts and show them to the user when needed.
I see that Unity provides addressables as new solution for asset management. As its new (not very new as its accessible from 2018.2, but official docs dont say a lot) there is not so much about it on the web.
From what it seems, in addressables you dont need to care about the bundle version, or which asset is in which bundle. In addresables, Unity automatically uploads assets to your host, and Unity automatically correctly manages local caching or downloads from a server, so objects behave like they are in the main game package but you have to check if they are loaded or downloaded. Am I right?
Are there any other features that addressables offer?

sentences:
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:
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:
Is there a library that handles hexagon tiled 2D maps? It would represent a map that is semi-square of arbitrary size. It would have a simple system for representation of the map coordinates, such as 0101 (first column, 1st hex). I'd want the map to be able to tell me the distance between two points and what other hexes lay between those two points, as a list or array.

I don't care as much about the language, but C# or Python would be ideal.

Does one exist?

sentences: SDL_RenderCopy to set location I'm coding a game's GUI in SDL2 and c++, I'm using SDL_RenderCopy to load the buttons on to the screen, but don't know how to get buttons in specific spots eg. bottom left corner, slightly below center. How do I achieve this?

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: XNA 4.0 Point Vertex Rendering I have a buffer of about 134 million particles and a very powerful computer to render them smoothly, but I am getting an error when trying to render them as primitive lines. It says that I cannot render more than around 1 million. Is there a way I can do this? Is there a better way to render this other than with lines? I'm comfortable with having 1 pixel points or anything as long as the vertices are shown all the time. I'm basically just plotting the points.

sentences:
Simple mouseray picking in openGL Ive been looking at tutorials and trying to figure out how to do basic ray-picking. But I'm stuck at figuring out what space to do the distance calculations in. What space does glm::unproject() lead to exactly?

This is what I'm doing:

first I get the mouse unprojected, like so

//mouse ray start
vec3 m_uproj = glm::unProject(
    vec3(mouse_xy .x*glutGet(GLUT_WINDOW_WIDTH), mouse_xy .y*glutGet(GLUT_WINDOW_HEIGHT),0.0f),
    workshop.access_gui()->view_mat(),
    workshop.access_gui()->proj_mat(),
    glm::ivec4(0, 0, glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT)));

//end of ray
vec3 m_uproj2 = glm::unProject(
    vec3(mouse_xy.x*glutGet(GLUT_WINDOW_WIDTH), mouse_xy.y*glutGet(GLUT_WINDOW_HEIGHT), 1.0f),
    workshop.access_gui()->view_mat(),
    workshop.access_gui()->proj_mat(),
    ivec4(0, 0, glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT)));

Then I find its direction, mray, like so

vec3 mouse_ray = normalize(m_uproj2 - m_uproj); //get mray direction

And Im expecting to find the closest point to some_object by using this calculation:

vec3 closest_point = mouse_ray * glm::dot(locations[i], mouse_ray); //closest point;

But locations seems to be in the wrong space? Or am I thinking about this the wrong way? Ive been looking around, but I cant find anywhere that explains just this part that I must be misunderstanding.

the idea is to compare the distance between closest point and locations[i], but the results are incorrect. Im getting something like this:

Where it should be red only if the cursor is over the square.

What space does glm::unproj() put my ray in anyway? And in what space should I put the objects that I want to pick/highlight?

sentences:
How many UDP ports for an MMOFPS I'm designing an MMOFPS.  I'm not sure whether to use one UDP port for all clients or one UDP port per client.  Or is there another alternative?

Currently UDP is only being used for position data (X,Y,Z, heading, and pitch).

sentences:
Is it a legal thing to do to sell fabricated accounts of your game? For example, say I create an online mass multiplayer game with in-game purchasing system and with randomness factors as well (the point is that game accounts have actual value and there is a somehow proportional relationship with playing time plus the luck of the player and the account's value) and the game appears to become popular.

Is it legal to, for example, insert cheated accounts into the database (without even spend a second of legitimate playing) and sell those accounts with extremely high price?

sentences:
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 you put all images from a game to 1 file? I've just finished a basic RPG game written in C++ SFML, I've put a lot of effort into the game and I'd want to distribute it, however I've ran into a small issue.

Problem is, I have well over 200 images and map files (they're .txt files which hold map codes) all in the same folder as the executable, when I look in the folder, it makes me want to cry a little bit seeing so many resources, I've never seen a game which shows you all the resources directly, instead I believe they pack the resources in a certain file.

Well, that's what I'm trying to achieve: I'm hoping to pack all the images in 1 file (Maybe the .txt files as well) then being able to read from that file or easily add to it.

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:
C++ Mouse picking for ray to plane intersection I'm making a C++/OpenGL application (decidedly without GLM), and I'd like to understand how to create a ray from the camera eye to the mouse pointer, as well as detect an intersection point from the resulting ray onto a flat plane.

I have:
 - Camera position, camera pitch/yaw, camera's Fwd vector
 - mouse coordinates in pixel measurements (which I can convert to -1:+1 screen space)
 - A world system where XY are the horizontal and Z is up
 - A flat plane where Z=0
 - My own matrix class which is basically just a float[16] and accessed (Get()) as a float*
 - Basic matrix multiply function, cross, dot product functions.

I'm still trying to learn 3D math (this project is somewhat of a reason for that), so I'm still somewhat hazy on how to accomplish this.  Most tutorials I can find are Unity tutorials, or involve using an Unproject function from glu or GLM.

I'd hopefully like to understand how to accomplish this manually as I'd like to understand what's happening.  Thank you for any wisdom or guidance.

sentences:
Is there an algorithm to construct lines (sets of grid points which are all connected) from an unsorted set of grid points? I have a 2d square grid used for pathfinding that I wish to convert into a navigation mesh.  My idea is to pluck out all of the nodes that are on the edge of walkable space, simplify the amount of data with a line reduction algorithm, then triangulate the set of points.  I am stuck at the simplifying step.

To find edge nodes I use a marching squares algorithm.  The downside to using marching squares is that the points are unsorted, and in order to pass the points into the Ramer-Douglas-Peucker algorithm they need to be sorted by connectivity (and separated into individual lines).  I'm looking for an algorithm that can either sort my collection by connectivity or discover edge nodes in a consecutive manner.

I'm trying out Djikstra search to find a path from one point to the next.  To determine if these points are connected, during path reconstruction if the parent point has a Euclidean distance greater than 1 to the current point then they are not directly connected.  I might be able to get this to work but it is proving to be extremely slow.

Here are screenshots of the graph I am working with:

2d pathfinding grid:

unsorted edge nodes discovered via marching squares:

sentences:
Why does this code never switch back to the object at index 0? I have two GameObjects in an array, and the S key is used to cycle an index referring the objects in this array.

When I run the game for the first time and press S, it changes from 0 to 1 and then to 2. After that it just cycles between 1 and 2... but it should be changing between 0 and 1 only; there are only two objects.

Why is this behavior occurring? My code is below:

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

public class SwitchObjects : MonoBehaviour
{
    public GameObject[] objects;
    public int activeIndex = 0;

    public void SetActiveObject(int aIndex)
    {
        activeIndex = aIndex;
        for (int i = 0; i < objects.Length; i++)
            objects[i].SetActive(i == activeIndex);
    }

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.S))
        {
            if (activeIndex == objects.Length)
                activeIndex = 0;
            activeIndex++;
            SetActiveObject(activeIndex);
        }
    }
}

sentences:
Rotation ascending into infinity? I'm creating a rotation for my sun to move, however it quickly extends to Infinity before going into NaN. I thought that taking advantage of the Matrix4f would make this much easier but it does as previously stated. Ideally should have the sun rotate around the sunCenter. Why is it doing this and how would I fix it?

private Vector3f getSunPosition() {
    double rotation = (time / DAY_LENGTH) * 360;
    Matrix4f matrix = new Matrix4f();

    Vector3f pos = sun.getPosition();
    matrix.m03 = pos.x;
    matrix.m13 = pos.y;
    matrix.m23 = pos.z;

    Matrix4f.rotate((float) Math.toRadians(rotation), sunCenter, matrix, matrix);

    return new Vector3f(matrix.m03, matrix.m13, matrix.m23);
}

I had it print out the Vector3f and rotation. The rotation looks a bit odd at first, however I can fix that another time.

Vector3f[1.0, 1.0, 1.0] 0.0
Vector3f[288375.56, 0.18377686, 287549.88] 79.41000366210938
Vector3f[1.96323607E11, -125296.0, 1.96323607E11] 158.82000732421875
Vector3f[1.05730567E17, 0.0, 1.05730567E17] 238.23001098632812
Vector3f[5.5935644E22, 0.0, 5.5935644E22] 240.02999877929688
Vector3f[2.9050322E28, 0.0, 2.9050322E28] 241.8300018310547
Vector3f[1.4801178E34, 0.0, 1.4801178E34] 243.6300048828125
Vector3f[Infinity, 0.0, Infinity] 243.8400115966797
Vector3f[Infinity, NaN, Infinity] 244.04998779296875
Vector3f[NaN, NaN, NaN] 244.25999450683594
Vector3f[NaN, NaN, NaN] 244.41000366210938
Vector3f[NaN, NaN, NaN] 244.55999755859375

sentences:
Using timestamp as a random seed returns identical results And here is the random number generator again.

I work on a game, where a user can create and schedule some levels to player later. For simplicity, let's say I play chess.

I create a new game with AI or an opponent for specific datetime in the future.

The random number generator gets as seed the current timestamp when the user create the game and put the pawn in random positions.

If the user creates too many games at once, the results on pawns positions are identical.

So, I was wondering, what other strategies are out there on picking the right seed number instead of the timestamp.

sentences:
Splitting game into multiple standalone parts I'm digging into Starling's CitrusEngine game engine. I try to understand the idea of structuring the game.

If you take a look at chrome.angrybirds.com or puddingmonsters.com you see that games load states (StarlingState's assets) dynamically which is smart. When the game starts a splash-screen displays, then you get a pre-loader which loads the main state (home, settings and choose-level view) and when you select a level a pre-loader displays again which loads the level state. This looks like they've constructed multiple parts for the game and then connect them together where the pre-loader is displayed when switching from one part to other.

How should we do that in Starling/CitrusEngine? What's the logic here? Flash games usually load all assets at the beginning which is not smart on mobile devices. Is it wise to have multiple StarlingCitrusEngine classes or you should handle the whole game in a single StarlingCitrusEngine class? Please explain in details.

Many thanks for answers.

sentences:
Compiling 2 Dimensional Constant Arrays Right into Pixel Shader to use as Lookup Table I want to use a small 2 dimensional look up table in a fragment shader, but I don't want to pay for the performance cost of fetching it from memory for every fragment.

Is it feasible/reasonable to simply declare or hardcode the table as an array right inside the fragment shader?  If yes, any indicator as to how big I can make it?

Thanks,
- Jim

sentences: Why is there a lack of games for Linux? What is wrong with the Linux/*nix family for games? What makes the development of games for this platform too slow compared to Windows or even OS X?

sentences:
What's the difference between UnityEngine.Random and System.Random? What's the different between this

int randomNumber = UnityEngine.Random.Range(0, 10);

and this

// on top of the class
private System.Random _rnd = new System.Random();

// inside a methode of the same class
int randomNumber = _rnd.Next(0, 10);

I know System.Random must always be initialized on the top of your class what's by UnityEngine.Random is not needed. I know also that System.Random works with a intern "clock" and the "random" number is based on that.

My question is now are there some other difference between UnityEngine.Random and System.Random and witch code is better to use for an Unity project?

sentences:
What am I doing wrong, in regards to multi-texture? I am writing a bump mapping demo, so I need an image texture, and a normal texture which should be loaded into the fragment shader.

This is the texture part of my OpenGL code:

glActiveTexture(GL_TEXTURE0);
GLuint textureID;
glGenTextures(1, &textureID);
glBindTexture(GL_TEXTURE_2D, textureID);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1024, 1024, 0, GL_RGB, GL_UNSIGNED_BYTE, brick);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
GLint textureLocation = glGetUniformLocation(shader, "texture");
glUniform1i(textureLocation, 0);

glActiveTexture(GL_TEXTURE1);
GLuint normal_textureID;
glGenTextures(1, &normal_textureID);
glBindTexture(GL_TEXTURE_2D, normal_textureID);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1024, 1024, 0, GL_RGB, GL_UNSIGNED_BYTE,
    brick_texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
GLint normalTextureLocation = glGetUniformLocation(shader, "normal_texture");
glUniform1i(normalTextureLocation, 1);

Here is the fragment shader:

uniform vec3 light;
uniform sampler2D texture;
uniform sampler2D normal_texture;

void main() {
    vec3 tex = texture2D(normal_texture, gl_TexCoord[0].st).rgb;
    gl_FragColor = vec4(tex, 1.0);
}

I am sure that the brick array contains the image texture, and the brick_texture array contains the normal texture; but it seems normal_texture and texture are both the image texture, not the normal texture. What am I doing wrong, in regards to multi-texture?

sentences:
Drawing chunks, and positioning the camera I've seen many questions and answers regarding how to draw tiled maps but I can't really get my head around it. Many answers suggest either loading the visible part of the map, or loading and unloading chunks of the map. I've decided the best option would be to load chunks, but I'm slightly confused as to how this would be implemented.

Currently I'm loading the full map to a 2D array of buffered images, then drawing it every time repaint is called. Q1: If I were to load chunks of the map, would I load the map as a whole then draw the necessary chunk(s), or load & unload the chunks as the player moves along, and if so, how?

My second question regards the camera. I want the player to be in the centre of the X axis and the camera to follow it. I've thought of drawing everything in relation to the map and calculating the position of the camera in relation to the players coordinates on the map. So, to calculate the camera's X position I understand that I should use cameraX = playerX - (canvasWidth/2), but how should I calculate the Y position? I want the camera to only move up when the player reaches cameraHeight/2 but to move down when the player reaches 3/4(cameraHeight). Q2: Should I check for this in the same way I check for collision, and move the camera relative to the movement of the player until the player stops moving, or am I thinking about it in the wrong way?

sentences: Drag Object to Collide Unity Please help, I am developing a 2D game for a school project and I want to drag the apple to the think box then when it collides, the apple will go back to the original position then it will add 1 point to the score. I'm just new to Unity. So please help

sentences:
Shop and Inventory System I'm creating a JavaScript game, and I'm getting stuck. When the player obtains X amount of gold, a middle column appears (you've unlocked the shop, yay!), and when you obtain more gold than an item costs, it will appear (except special conditions where it requires more than just gold of course).

Right now, I'm stuck on the base foundation of the system, and I would like to hear some suggestions before I move on.

function _shop() {
    this.items = [
        {
            effect : function() { engine.player.revive(true); },
            "price" : 100,
            "name" : "Heal"
        }
    ];
}

The shop holds an array of item objects, some will be holdable, some will be instant use (currently working on instant use).

Now, here's how the item is called:

in my elements.js file --

addShopItem : function(gold) {
    console.log(engine.shop.items.length);
    for (var i = 0; i < engine.shop.items.length; i++) {
        if (engine.shop.items[i]["price"] <= gold) {
            document.getElementById("items").innerHTML += "<br />"+engine.shop.items[i].name;
        }
    }
},

Which is called by going raiding (irrelevant, won't post that code, it's going to change to the engine's trigger function with flags based on the item object.

Now my question is:

Is this a good way to handle an dynamic shop system?
What's the best way to link this to a player object? (My initial guess is an object inventory inside the parent?

sentences: Difference between Unity's [Command] and [Server] [Command] and [Server] functions both run on the server and can also be called by a local player but what is the difference between them?

sentences:
(XNA) Possible to hide, compress, or rename .XNB files? I'm fairly new to XNA (only a week into C# and XNA at this point) but I have been developing games for a while now, and the program I used did not require any/many external files in creating an executable. I am perfectly fine with external files (for the most part) but reading around, it seems as if .XNB files are easily accessed for others to pull your resources out of.

After some thinking, I was wondering if it was possible to do any of these 3 things:
1. Hide the .XNB files within the .exe in which case it would likely create them in an external location only during run-time (wouldn't really solve the main issue, but still)?
2. Compress many of the .XNB binaries into a single binary (such as 1 for sounds, 1 for sprites, etc.)
3. (This one is one simply for my own OCD) Change the extension name from .XNB to something of my choosing? For example, to .DAT instead to make it less of a direct indicator I used XNA and/or these files can be accessed with an .XNB ripper?

None of these would particularly solve my initial problem, but I still wonder if they are possible. Anyhow, thanks in advance guys!

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:
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:
Video feedback effect with recursive RenderTextures in Unity 2018.3 I have a project where I'm playing with a video feedback effect by rendering a camera to a RenderTexture and pointing the camera at a quad displaying that RenderTexture.

This works great normally, but when trying out HDRP, LWRP, (and upgrading materials) or upgrading the entire project to 2018.3, the RenderTexture just stops working and shows black. I also tried with a completely new project and just had a camera, a quad, and a cube. That also didn't work.

Is there any obvious reason this wouldn't be working? I spent a while trying out various settings but couldn't find anything that had any effect, so I really don't even know where to start.

sentences:
How do I synchronise real-time moves of players on a grid? I'm working on a real-time game based on a grid. Each player can move a single square at a time. A server tracks the game state and notifies clients of changes.

It's possible for two players to make a conflicting move, such as attempting to move to the same square. How can I fairly resolve such conflicts when they happen?

My current approach is First come, first served: When the server receives a move, it immediately updates the game state to reflect that. It then discards any conflicting moves it receives later.

The problem is that the moment a move was received does not necessarily line up with moment it was sent. Players on a faster network connection will always have an advantage.

How can I deal with this?

sentences:
What is causing this character overlap during text rendering? I'm trying to display text with a texture and font description created with BMFont in OpenGL 3.3, but whenever I display the text there is some overlap between certain characters.

Here is the text at normal 1.0x scale:

As you can see, the 'e' in "Hello" overlaps the next 'l' a bit (with the same happening for the 'r' in "world") and the 'w' in "world" overlaps the 'o' quite a bit. Here is a 3.5x scale image to make the overlap a bit more apparent:

I was wondering if someone would be able to explain to me why this is occurring and, if possible, explain how to fix it.

My method for generating the vertex mesh is as follows: (C++)

// position control variables
const float tscalex = 1.0f / _font.GetTexture().GetSize().x;
const float tscaley = 1.0f / _font.GetTexture().GetSize().y;
const float hspace  = _font.FindGlyph( ' ' ).XAdvance;
const float vspace  = _font.GetInfo().LineHeight;
float x = 0.0f;
float y = 0.0f;

// generate a quad for each character
char pchar = 0;
for ( uint i = 0; i < _text.length(); ++i )
{
    // apply kerning
    char cchar = _text[ i ];
    x += _font.FindKerning( pchar, cchar );
    pchar = cchar;

    // handle special characters
    switch ( cchar )
    {
        case ' ':
            x += hspace;
            continue;
        case '\t':
            x += hspace * 4;
            continue;
        case '\n':
            y += vspace;
            x = 0.0f;
            continue;
    }

    // get the character's glyph
    const Font::Glyph& glyph = _font.FindGlyph( cchar );

    int width  = glyph.Width;
    int height = glyph.Height;
    int left   = glyph.X;
    int top    = glyph.Y;
    int right  = glyph.X + width;
    int bottom = glyph.Y + height;
    float yy   = y + glyph.YOffset;

    float u1 = float( left   ) * tscalex;
    float u2 = float( right  ) * tscalex;
    float v1 = float( top    ) * tscaley;
    float v2 = float( bottom ) * tscaley;

    // create the quad
    uint16 count = uint16( _mesh.Vertices.Size() );
    _mesh.Vertices.Add( Vertex( Vec3( x,         yy,          0 ) * _scale, Vec3(), Vec2( u1, v1 ) ) );
    _mesh.Vertices.Add( Vertex( Vec3( x,         yy + height, 0 ) * _scale, Vec3(), Vec2( u1, v2 ) ) );
    _mesh.Vertices.Add( Vertex( Vec3( x + width, yy + height, 0 ) * _scale, Vec3(), Vec2( u2, v2 ) ) );
    _mesh.Vertices.Add( Vertex( Vec3( x + width, yy,          0 ) * _scale, Vec3(), Vec2( u2, v1 ) ) );
    _mesh.Indices.Add( count + 0 );
    _mesh.Indices.Add( count + 1 );
    _mesh.Indices.Add( count + 2 );
    _mesh.Indices.Add( count + 2 );
    _mesh.Indices.Add( count + 3 );
    _mesh.Indices.Add( count + 0 );

    // advance
    x += glyph.XAdvance;
}

sentences:
How to use the latest MongoDB C# driver with Unity? I recently updated my Unity 2018 to the 2020 version then I created a new project to connect my game to a MongoDB database.
My main goal is to be able to store not only common data in my collection but also files and images by using GridFS.
I use Visual Studio 2019 Community so for my project. I installed the MongoDB drivers directly from NuGet. In Visual Studio everything is OK, I added a using for all required libraries and I have no errors but when I switch to Unity 2020 it seems that I can't start my project because my MongoDB driver is not correctly loaded there.
I found some tutorials like this one where they had the same problem and fixing it by adding the DLLs directly in the Unity folders. That works for me, but only with the DLLs shared in the tutorial (you can access the working DLLs in the video description).
What is a bit disturbing is that the DLLs' versions seem to be outdated, since the connections process is a bit different from the one in the MongoDB documentation.
I cloned the latest MongoDB C# driver repository from GitHub and tried to reproduce the same process with the latest DLLs, but once again it only works in VS 2019 but not in Unity, even though I have added the DLLs in the Unity folder.
Is there is some kind of compatibility problem between Unity and the latest MongoDB? How can I fix this to work with the latest version?

sentences:
libgdx get the value of a key I'm trying to do collision detection (which I have working well) but now I want to use it for a little more.  I want to check special circumstances for the collision.  Right now I'm checking for containsKey like so:

someCell. ... .getTile().getProperties().containsKey("collision");

This works fine.  But now I want to use the VALUE of that key to determine what the character hit and continue accordingly.  If the value is null, just a normal hit.  But if the value is a sign, and the user chooses, it can be read.  Or if the value is a chest, if the user chooses to do so they can open it (but check that locked is indeed false first, or the user can unlock it).

The thing is, I've looked everywhere and can't find a way to check the value of the key.  And yes, I can just create a lot of keys but it would be easier to have one key that can carry many values and check and alter them based on user input or game circumstances.  I tried

theKey = someCell. ... .getTile().getProperties().containsKey("collision")[.value("someValue");];
theKey.value("someValue");

but neither worked.

So, my question to you is this: how can I access and later edit the value of a custom key created in tiled map editor (should have mentioned that earlier, huh)?

Any help would be appreciated.

sentences:
Null Reference to camera when loading new scene I am getting the error:

  MissingReferenceException: The object of type 'Camera' 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.

The camera in my game contains a persistent object script, which prevents the camera from being destroyed when loading a new scene.

private void Awake()
{
    DontDestroyOnLoad(transform.gameObject);
}

The scene is switched via a method in the GameManager:

public void loadScene(UnityEngine.Object arena)
{
    operation = SceneManager.LoadSceneAsync(arena.name);
    state = GameState.LOADING;
}

and finally the camera contains another script which adds a distortion effect:

void OnRenderImage(RenderTexture source, RenderTexture destination)
{
    distortCam.CopyFrom(mainCam); //Error occurs here
    distortCam.backgroundColor = Color.grey;
    // ...Some more code ...
}

The error occurs in this last method, but the camera still exists in the editor. mainCam is a Camera object that is assigned onAwake via mainCam = GetComponent<Camera>();

Also if I switch the loadScene method to:

public void loadScene(UnityEngine.Object arena)
{
    operation = SceneManager.LoadSceneAsync(arena.name, LoadSceneMode.Additive);
    state = GameState.LOADING;
}

it works perfectly, but it is inconvenient to always have to loadScenes additive.

Why is the reference to the mainCam being lost? I have tried to check if it's null and reassigning it before using it, but so far I still have the problem. Any ideas?

sentences:
Line of sight on a 2d grid I've been looking for similar questions here and on google, but none have worked for me yet.
I have a game, where I have a 2d array of square tiles (they're objects with accessible x and y pixel coords, side length in pixels, and whether are they see-through).

In there, there are enemies and the player. They can move independently from the grid (as in, pardon the example, Minecraft), and I have got access to their coords. What I want is a function that will tell me if a given enemy can see the player or not (just returning bool).
Can you help me?

EDIT: I used Bresenham. If anyone there is from Poland, a great description of Bresanham's jest tutaj :http://edu.i-lo.tarnow.pl/inf/utils/002_roz/2008_06.php :)

sentences: When does OpenGL Perform Perspective Divide When does OpenGL divide by W? Is this done automatically within the vertex shader? It is my understanding that the vertex shader outputs the final vertex position, so I presume no transformations can be made after this point...

sentences:
Is it possible to copyleft license a game engine and still allow users to sell games made with it? I have recently been studying and working on implementing my own game engine. I am interested in making my work open source so that others may use and modify it freely. However, I also want to make sure any modified or improved versions of my engine would also be free to use or modify. This led me to believe a copyleft license would be most appropriate. However, despite wanting all future versions and modifications to the engine source code to be open source, I want people to be able to sell or profit off the games made with the engine. In other words, while the source code of the engine for the sake of the engine itself should remain open source, anything made with the engine for the sake of being played should be allowed to be closed source. Is there an appropriate license for this?

The reason I include the architecture tag is to also ask: If no simple license exists, then is there a way to architect my engine such that what I want to accomplish with licensing is possible? For instance, if my engine uses a scripting language with some entity component system written in the engine's compiled code, then maybe the scripts (which a gameplay programmer using my engine would write to dictate game logic) would be allowed to be closed source? But then anyone playing the game would still require the compiled engine in order to run said scripts. I do not know if this particular example could work, but it is just to give an idea of what I am getting at.

sentences:
How can I convert .obj files to .3ds on Mac? I am on a Mac. I am currently looking for a tool that is able to correctly convert  .obj files (Wavefront) to .3ds files (Autodesk 3ds Max).

I tried Blender but the exported file failed to include the smoothing groups.

What do you recommend I use?

sentences:
How to proper manage a world composed by multiple scenes? I have a UI-only scene for my game that have only Unity UI elements (those that need a Canvas), separate from the world scene.
In the UI scene I have a MonoBehaviour that manage all the effective actions and all the interactions between different UI elements, and In the world scene I have another manager responsible for controlling all the other things in the game scene.
This design worked pretty well until I faced the following situation: in a specific moment the player need to click in BoxColliders that are in the world scene but it is actually a UI-related action. This action of clicking in these BoxColliders are essentially the player clicking in buttons that in this case happen to be 3d objects that need to be composed in the environment, thus need to be in the world scene.
In the situation described above the clicks on those BoxColliders should be managed by the UI Manager, that is alive in the UI scene.
So the problem is: how should I approach this whole situation without breaking a lot of clean code rules? What is tipically done when developing in Unity to solve this kind of problem when you need a reference for an object that lives in another scene without keeping a hard reference for this object (or just calling GameObject.Find in the scene startup)?

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: JAVA -- Should I use a float or double for 1.5 speed for my player's speed? What should I use in general for positions, etc.? The title says it all, but I would like to know if I should use a double 1.5 for my velX and velY factor, or a float 1.5 for my velX and velY factor. Also, I would like to know if I should use a double or float for everything such as positions of entities, etc.. Thanks in advance!

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:
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:
How can I create NPCs and scenes? How would I go about creating NPC Events/Scenes? For example, any RPG will have a ton of different in-game cut scenes where you can express a story line.

What I have thought of so far is having different triggers and a number indicating the state of the story the player is at. When the player hits one of these triggers I will check the state and progress from there. Am I sort of on the right page?

After that how do I animate the scenes? Do I just hard code them into the game? I was thinking this is where a scripting language might be handy? I'm not really sure

I realize this is probably a large question, but if someone could point in the right direction that would be great.

I'm using c# and XNA if that matters at all.

sentences:
Unsticking game objects I have used
void OnCollisionEnter(Collision collision) {
    collision.gameObject.transform.parent = gameObject.transform;
}

To stick two players together when they connect.
Basically after they have collided the second game object is still stuck to the original object and i need that not to be the case.
How do i make the game object not stuck when they come apart ?

sentences:
Separate update and render I'm programming a simple Snake in Java. I'm a complete newbie when it comes to Java and Game Developing, so please bear with me ;)

Until now, I have been using a UI thread, as well as a update-thread.
The update thread just set the position, set the GameObjects, and so on.

I didn't think much of concurrency, but now I've come to a problem.

I wanted to modify the ArrayList<GameObject>, but it throws a java.util.ConcurrentModificationException.

With a little research I found out that this happens because the two threads are trying to access the variables at the same time.

But I didn't really find a way to prevent this.
I thought about copying the array and swapping them out when the rendering is finished, but I would have to deep-copy them, which isn't really the best solution in my opinion.
It probably eats up more CPU resources than a single-threaded game.

Are there any other ways to prevent this?

Thanks a lot for your help!

sentences:
Bullet physics convex hull center of mass I am trying to make a convex hull collider for bullet physics. I am using BulletSharp.CompoundShape and BulletSharp.ConvexHullShape.
This is model of a chair in unity with rigidbody and convex mesh collider (how i expect it to behave):

This is that same model in my engine:

Here is the chair in blender:

When attaching collision shapes to CompoundShape there is an option to add offset, i tried setting that offset to center of volume of mesh i calculated, it did not work.
Simple solution would be to center object in blender somewhere around its center of mass, but can this be avoided?
Can i somehow change the chairs center of mass in bullet?
Here is a picture of chairs acting more naturally after changing the center in blender:

All pictures were taken when rigidbodies were still and probably asleep.

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:
Cube map faster than 6 2D textures? - shadow mapping I've managed to implement shadow mapping to a scene. However, I had problems using a cube map so I eventually gave it up and used 6 2D texture maps instead. To make this work with 6 2D maps, during the rendering process I have to identify in which texture of the 6 each fragment belongs. I'm afraid this could be dropping my frames significantly.

I'm not gonna go into many details for now. I will upload the relevant code if necessary. My main concern is if this method makes my program slower.Will my fps increase using a cube map?

sentences:
Skeletal Mesh Cloth Simulation bug (UDK), unexpected behaviour When I try to move to the left (A) the pawn and the cloth move to the left,
and when I move to the right (D) the pawn and the cloth move to the right too...

Why the cloth always goes in same direction than the pawn? I would expect the cloth to go in the opposite direction, like dragged by the pawn.

To anyone who's experienced with pawn with cloth simulation: please help me T_T

Flag model for testing :
Flag bug

sentences:
How to do geometric projection shadows? I have decided that since my game world is mostly flat I don't need better shadows than geometric projections - at least for now.

The only problem is I don't even know how to do those properly - that is to produce a 4x4 matrix which would render shadows for my objects (that is, I guess, project them on a horizontal XZ plane).

I would like a light source at infinity (e.g., the sun at some point in the sky) and thus parallel projection.

My current code does something that looks almost right for small flying objects, but actually is a very rude approximation, as it doesn't project the objects onto the ground, but simply moves them there (I think). Also it always wrongly assumes the sun is always on the zenith (projecting straight down).

    Gdx.gl20.glEnable(GL10.GL_BLEND);
    Gdx.gl20.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);

//shells

    shellTexture.bind();
    shader.begin();
    for (ShellState state : shellStates.values()) {
        transform.set(camera.combined);
        transform.mul(state.transform);

        shader.setUniformMatrix("u_worldView", transform);
        shader.setUniformi("u_texture", 0);

        shellMesh.render(shader, GL10.GL_TRIANGLES);
    }
    shader.end();

// shadows
    shader.begin();
    for (ShellState state : shellStates.values()) {
        transform.set(camera.combined);
        m4.set(state.transform);

        state.transform.getTranslation(v3);
        m4.translate(0, -v3.y + 0.5f, 0); // TODO HACK: + 0.5f is a hack to ensure the shadow appears above the ground; this is overall a hack as we are just moving the shell to the surface instead of projecting it on the surface!
        transform.mul(m4);

        shader.setUniformMatrix("u_worldView", transform);
        shader.setUniformi("u_texture", 0); // TODO: make shadow black somehow

        shellMesh.render(shader, GL10.GL_TRIANGLES);
    }
    shader.end();

    Gdx.gl.glDisable(GL10.GL_BLEND);

So my questions are:

a) What is the proper way to produce a Matrix4 to pass to openGL which would render the shadows for my objects?

b) I am supposed to use another fragment shader for the shadows which would paint them in semi-transparent grey, correct?

c) The limitation of this simplistic approach is that whenever there is some object on the ground (it is not flat) the shadows will not be drawn, correct?

d) Do I need to add something very small to the y (up) coordinate to avoid z-fighting with ground textures? Or is the fact they will be semi-transparent enough to resolve that problem?

sentences:
Do UDK mutators only apply on local games? I have developed a pretty simple mutator. It works exactly as intended on a local game against bots, but it doesn't work (nor do any of the stock mutators) on a listen server.

Is this to be expected of UDK (May Beta Release by the way)?

sentences:
Monogame project runs in VS but hangs when run via .exe I've been working on a monogame project for a little over a week and had no problems. Today I went to test out the project outside of Visual Studio, by running directly from the .exe in the release folder. When I click on the .exe I get the cursor icon indicating something is loading, but nothing ever does. No window shows up, even though I see processes related to my game in the task manager. Also when I try to end mygame.exe in the taskmanager it doesn't work and the process still sits there.

I've tried both a Windows and Windows OpenGL monogame project and both hang once I click the exe. Does anyone have any idea why this may be or any steps I might take to track down the issue?

I'm using Windows 7, Visual Studio Community 2015 and the latest Monogame Build. My project references Farseer Physics, Lidgren, Json .Net, and my own Utility class library.

Edit: I tried creating a brand new Monogame project and run it without debugging in VS and it hangs the same way running from the .exe does. Also the project runs when placed on my laptop which also has monogame installed so it's nothing wrong with the project.

sentences:
how does server communication work in a flash game with a php backend I am trying to create a browser game using actionscript/flash. Currently, I'm trying to understand how I would go about creating a back-end which interfaced with my MySQL database.

As far as I understand, If I create a php file on a webserver called test.php and then navigate to a webpage hosted on the server eg. www.example.com/test, the php script will run and display the result in my browser.

This would use http. Is this how communication between client and server usually works in a flash game? for example, if the game needed to query the db. Would actionscript have to essentially invoke the url of the php script that would execute the query? it could then parse the data and use it.

If this is the case, then is JSON considered a good way to transfer data over http?

sentences:
Is it possible to retrieve shader function names associated with a technique pass using the DirectX Effect API? For example, given the pass

pass p0
{
    SetVertexShader(CompileShader(vs_4_0, VSFunction()))
    SetPixelShader(CompileShader(ps_4_0, PSFunction()))
}

Ss it possible to retrieve the names VSFunction and PSFunction? It doesn't look like any of the associated shader descriptors actually contain the name of the entry point.

sentences:
How can i detect if the player is inside an explosion radius? I'm making a driving game, there are enemies which spawn on the side of road and when my player car gets close, they fire a rocket in front of the player. I need to detect if the car is within a certain radius of the explosion center. So when I can detect that I'm assuming I can then use rb.AddExplosiveForce to make the car fly a bit or something.

What is the recommended way to get the blast radius collider (or equivalent) and detect if the player is inside it?

sentences:
How can I defer the initialization of my level's entities until I need them? I intend to use a level-entity-components hierarchy in my C++ game engine where a "level" is just a container for entities. However, since I'd like to setup all the levels at once (and thus all entities and components) I've stumbled upon a memory management dilemma: since only one level can be run at a time I need somehow to delay an initialization of other level's entities. How can I accomplish that?

I've considered a solution where all the levels derive from some Level base class and are initialized in the constructor when needed, but that would require creating a class with just the constructor in it for each level.

sentences:
How do I load an asset bundle? I am trying to load a bunch of prefabs from an asset bundle.  I am building the asset bundles for StandaloneWindows64:

BuildPipeline.BuildAssetBundles(BuildPath, BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows64);

I load my asset bundle using Unity's new web request system:

var www = UnityWebRequest.GetAssetBundle(Url);
yield return www.Send();
if (www.isError)
{
    Debug.LogError(www.error);
    yield break;
}
var bundle = ((DownloadHandlerAssetBundle)www.downloadHandler).assetBundle;

However, my bundle does not have my asset bundle in it.  It only has the manifest:

//Output:  "1 asset: bundlemanifest"
Debug.Log(bundle.GetAllAssetNames().Length + " asset: " + bundle.GetAllAssetNames()[0]);

If I look at my manifest, I can see my asset bundle names "structures" does exist:

ManifestFileVersion: 0
CRC: 3317959940
AssetBundleManifest:
  AssetBundleInfos:
    Info_0:
      Name: structures
      Dependencies: {}

I tried retrieving it from my AssetBundleManifest:

var manifest = bundle.LoadAsset<AssetBundleManifest>("assetbundlemanifest");

But the AssetBundleManifest only has functions which return strings and Hash128s.

How can I instantiate the prefabs in my asset bundle named "structures"?

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:
Collision detection between axis-aligned bounding box and bitmap (pixel perfect) terrain Working on a Worms-type game, I have my objects in bounding boxes and they sit on the pixel terrain.

Currently I am able to successfully do the collision detection for objects when they enter the game by checking the middle-bottom pixel of the bounding box, if it is solid, reduce the x and y velocity to 0, other wise keep moving down at a value of gravity.

The trouble comes in when I start to move the "player sprites" as they can walk into walls and I'm not sure how to approach how to detect collision if moving into pixels, and finally how to resolve these collisions.

I need to be able to detect solid walls I cannot pass, and gradient hills where the player should "walk up".

Could you help point me in a way to do this or how it has been done in the past?

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:
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:
Determine if AI can traverse a given spline I have some AI Agents that I want to navigate along a spline. The agents have a speed and a maximum turning radius. For some splines the curvature is too tight for the AI agents to navigate around and they end up shooting of the spline and then turning, which looks weird. How can I take a given spline and find the segments that are too tightly curved for a given agent to traverse without shooting off?

I thought about just taking the angle between control points, but that alone won't account for the speed limitations that I want to impose as well. Can someone point me in the right direction?

I am using Curvy for my spline implementation but using my own agent movement system to walk along the splines. http://www.fluffyunderware.com/pages/unity-plugins/curvy.php

sentences:
Unity - Convert Camera Gyroscope Attitude to World Space Canvas rotation Suppose you have a worldspace canvas parallel to a camera that is rotated by the gyroscope.
How do you convert from the camera's gyroscope attitude to get the world space canvas rotation?

sentences:
How do I draw 2D sprites from a sprite sheet in DirectX 11 without ghosting/artifacts I'm new to DirectX and I am trying to get my feet wet by making a simple 2D game. I chose DirectX 11 and am using the DirectX ToolKit helper library which recommended I start with DX11 and not DX12.

The guide I am following to create an animating sprite is working great except for when attempting to draw a single sprite from the sprite sheet I am seeing "ghosting" of other sprites behind it. I created the sprite sheet and saved it as a PNG and also as a BMP and it seems to happen either way.

Here is the sprite sheet I am using:

It is 336px width, 48px height, in 48px x 48px square sprites. If I render the entire sprite sheet, or if I render the first sprite (0,0,48,48), it looks fine, but if I attempt to render the 2nd, 3rd, 4th, etc. this is how it renders:

Here is the code I am using to load the PNG file as a texture:

ComPtr<ID3D11Resource> ponyIdleResource;

DX::ThrowIfFailed(
    CreateWICTextureFromFile(_D3dDevice.Get(), L"assets/pony_idle.png",
        ponyIdleResource.GetAddressOf(),
        _Texture.ReleaseAndGetAddressOf())
);

ComPtr<ID3D11Texture2D> ponyIdleTexture;
DX::ThrowIfFailed(ponyIdleResource.As(&ponyIdleTexture));

CD3D11_TEXTURE2D_DESC ponyIdleDesc;
ponyIdleTexture->GetDesc(&ponyIdleDesc);

and here is the code I am using to draw:

_SpriteBatch->Begin();

RECT sourceRect;
sourceRect.left = 48;
sourceRect.top = 0;
sourceRect.right = 96;
sourceRect.bottom = 48;

_SpriteBatch->Draw(_Texture.Get(), _ScreenPos, &sourceRect, Colors::White, 0, _Origin);

_SpriteBatch->End();

If I pass the RECT in as 0,0,48,48, it looks fine. Is there some special way I need to format my image? I've tried it as both PNG and BMP.

sentences:
small independent game development on a virtual machine I've been learning about OpenGL and SFML  with c++ now for about 6-8 months, and would like to work on a small little personal game to put some of my skills to the test.

Now I want to kill two birds with one stone, and also increase my knowledge of Ubuntu and linux development in general by developing this project in Ubuntu. Currently my main computer runs Windows 7 while I have an older computer than runs Fedora 18, so I set up an ubuntu 12.04 LTS virtual machine on my main computer. The problem is, what effects does this have graphics wise? I know windows virtual machines running games can often have some graphical and input bugs, should I not use a virtual machine? Or this fine and I'm simply over thinking the subject? Thanks!

Note**

I am using VM VirtualBox on my windows 7 desktop.

sentences:
LibGdx Input data in a textfield I have a textfield using scene2d but don't know how to save user input. this is what i have and it just draws the textfield.

     txtUsername = new TextField("", mSkin);
     txtUsername.setMessageText("test");
     txtUsername.setPosition(30, 30);
     mStage.addActor(txtUsername);

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: 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:
libgdx images go out of proportion on some devices I'm trying to develop a simple game using libgdx. The game works perfectly on emulator ( Nexus 5x API 26 x86 ). But when I generated its apk and tested on my phone(Samsung J7), the images somehow seem to go out of proportion.

I dont know if the problem is libgdx-specific or something else is causing the problem. I suspect that the issue is about the different screen sizes or resolution.

This is how I want it to be.

This is how it appears. The images appear to be enlarged.

The app seems to work as expected on larger mobile screens but the images do not scale well to smaller screens.

Does libGdx or the android not automatically resize images according to the hardware being run on ?

Any help would be highly appreciated.

Edit :

boy = new Texture("boyfinal.png");
batch.draw(boy, Gdx.graphics.getWidth()/4 - boy.getWidth()/2, boyY  );

sentences:
Rotation matrix from OpenGL to DirectX I have an application which uses openGL and i have to port it to DirectX.
To sum up my issue : How can I port rotation matrix based on a right-handed coordinate system to a left-handed coordinate system ?
I hardly found some documentation on the internet.

This is what i found on MSDN:

Flip the order of triangle vertices so that the system traverses them
clockwise from the front. In other words, if the vertices are v0, v1,
v2, pass them to Direct3D as v0, v2, v1.
Use the view matrix to scale world space by -1 in the z-direction. To    do this, flip the sign of the _31, _32, _33, and
_34 member of the    D3DMATRIX structure that you use for your view matrix.

This is work fine except i can not flip easily my vertices because i got an 3D model from CATIA which is not a primitive, so i can't use it.

(I'm aware of row-major and column-major difference, it does not matter)

Do you know how i can port my rotation matrix from openGL to DirectX ?

Thanks a lot

sentences:
How can i instantiate empty gameobject to be position to existing already gameobject? When i click on keyboards for example dfrg i want that if i click on space it will add empty gameobject right after the letter g like a space for example: drg hello So there is a space after the letter g and before the hello I want that the empty gameobject will be like space. So if i click space it should be always position after the clone. But not sure how to do it.
The problem is that i instantiate the clone object after if i click on space key. And i also want the space to work for both side/cases if i first click on space before i clicked and did any clones it should be for example: dfrg There are many spaces before the dfrg

using System.Collections;
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
 using UnityEngine;

 public class Test : MonoBehaviour
 {
     public GameObject[] prefabs;
     public int gap = 50;
     public int offset = 0;

     private GameObject go;

     void Start()
     {
         prefabs = Resources.LoadAll("Prefabs", typeof(GameObject)).Cast<GameObject>().ToArray();

         foreach (GameObject prefab in prefabs)
         {
             if (prefab.name == "testing")
             {
                 go = prefab;
             }
         }
     }

     void Update()
     {
         if (Input.anyKey)
         {
             if (Input.GetKey(KeyCode.Space))
             {

             }
             foreach (Transform child in go.transform)
             {
                 if (Input.inputString == child.name)
                 {
                     Transform clone = Instantiate(child);
                     clone.parent = transform;

                     clone.transform.eulerAngles = new Vector3(0, 0, 0);
                     offset += gap;
                     clone.transform.position = new Vector3(-offset, 0, 0);
                 }
             }
         }
     }
 }

sentences:
How can I develop and publish a game when I don't have the money to buy a brand new computer? I'd like to complete and publish a game made with Unity, but given the fact that the cost of a brand new computer represents a significant part of my yearly income, I don't have enough money to buy one.

My ultimate goal is to publish the game on iOS.

Aside from generating more revenue upfront, what are my options?

Notes from the moderators: We've made this question canonical, so we're looking for non-specific options (e.g. please avoid targeting specific regions, or suggesting to buy specific models, etc.); we'd like to help future visitors coming from all over the world, for the years to come.

sentences: Looking for an example of glass with XNA or DirectX 9 Any good pointers on how to get the refractive look of glass? I'm looking to create a think piece of glass type of look, sort of the type that you'd have on bathroom shower doors.

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:
Calculate min number of moves (no path involved) I'm looking to implement an algorithm that will calculate the minimum number of moves based on the rules below.
Let's say that we have a grid (NxM), as exampled in the image below.

Each cell will be the sum based on the row and column and I can subtract 1 unit from one cell and add it to a neighbour. For example, on the image above, the minimum number of moves on Initial will be 2 and on Initial - 2 will be 4.

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:
Dynamically save an assetbundle during run time I'm wondering if it is possible to dynamically save / amend a current asset bundle during the running of my Unity application.

I've been looking into this for a few hours, but can't find anything about how to do this. I know you can download / stream assets from a server at run time, but I'm interesting in knowing if it's possible to do the same but in the opposite direction.

Has anyone ever attempted this before? Is there any good examples of how this could be done?

sentences:
How should I pause a rotation when my character collides with a gameObject? My character always moves forward and when he enters a turn(Trigger) this is what happens:

if(other.CompareTag("TurnLeft"))
{
    // Rotates the character in 90 degrees in 6 seconds.
    MoveObject.use.Rotation(transform, Vector3.down * 90.0, 6);
}

But when he contacts with the ("StageColliders"), he keeps rotating, even though he doesn't change his position. I practically need him to pause rotating when he hits ("StageColliders") and continue when he's free of collision.
Something like this would be ideal.

if(other.CompareTag("StageColliders"))
{
    // Pause the rotation above.
}

I found the MoveObject script here http://wiki.unity3d.com/index.php?title=MoveObject
in case someone's curious.

sentences:
Most efficient way of drawing a lot of cubes OpenGL ES I have to draw a lot of cubes in my OpenGL programme for android. All the cubes have the same size but different colors. I know that calling glDrawArrays is expensive operation so I should call it less as possible. But as I know I have to call it 6 times (one per each side) and since I have more than 500 cubes it's not efficient at all. Does anyone have the idea what to do?

Btw, I am using OpenGL ES 1.0.

I saw that I can use one big VBO but I don't know how to do that.

sentences:
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:
Determining my playable area/field of view Contrary to what I found searching for the answer, I'm not trying to see whether a character is in view of another character. What I need to find out is the size of the field of view. This is because I'm using Mercury Particle Engine in a 3D space, and while MPE emitters take parameters ranging from (0,0) being the upper left corner of the screen to (graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight) being the lower right corner of the screen, the positioning of enemy ships use Vector3 values, where (0,0,0) would be the exact center of the screen. Since my ships don't move along the Z axis, this isn't a problem. What is a problem, however, is translating their coordinates in 3D space to the correct particle emitter positions when I need to show them exploding. This is what I'm currently using to create the perspective field of view:

projectionMatrix = Matrix.CreatePerspectiveFieldOfView(
  MathHelper.ToRadians(45.0f),
  GraphicsDevice.DisplayMode.AspectRatio,
  1250.0f,
  1450.0f);

And this is how I'm attempting to obtain the X and Y values for the particle emitter from the enemy ship position (however, the positions are not quite right with my math because I have the wrong constants):

x = ((float)graphics.PreferredBackBufferWidth/2) + (((float)graphics.PreferredBackBufferWidth/1700) * enemy[i].position.X);

y = ((float)graphics.PreferredBackBufferHeight / 2) + (((float)graphics.PreferredBackBufferHeight / 1100) * enemy[i].position.Y);

That being said, how do I calculate the proper constants from the information on hand?

sentences:
jBullet Collision/Physics not working as expected Below is the code for one of my objects in the game I am creating (yes although this is a cube, I am not making anything remotely like MineCraft), and my issue is I while the cube will display and is does follow the physics if the cube falls, it does not interact with any other objects in the game.  If I was to have multiple cubes in screen at once they all just sit there, or shoot off in all directions never stopping.  Anyway, I am new to jBullet, and any help would be appreciated.

    // Constructor
public Cube(float pX, float pY, float pZ, float pSize)  {
    posX = pX;
    posY = pY;
    posZ = pZ;
    size = pSize;
    rotX = 0;
    rotY = 0;
    rotZ = 0;

    // physics stuff
    fallMotionState = new DefaultMotionState(new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), new Vector3f(posX, posY, posZ), 1)));
    fallRigidBodyCI = new RigidBodyConstructionInfo(mass, fallMotionState, fallShape, fallInertia);
    fallRigidBody = new RigidBody(fallRigidBodyCI);
}

sentences:
How to draw a 3D world with lines, more like a sketch drawing or cartoon Consider making an ink drawing, with no shading and all lines having equal weight - such as you see in a strip comic like Dilbert. This represents an active 3 dimensional world, but objects do not have textures, yet you don't see tessellated triangles either.

For the sake of an example consider drawing the surface of the moon. The lines you might draw would be along the top edge of hills, down to where they meet the general level of the surface. Behind those you would do the same for larger hills, into the distance, and behind that what was visible of the horizon. For craters, you might draw a near circle for the outer edge, and partly masked, a circle for the lower edge. Boulders would have a line around the edge, and along major visible edges. The astronauts would have a line along their outer edge, and along major features of their space suit.

I'm an experienced programmer but new to 3D programming. I can't offhand think of a game that looks like this -- has it been done? And how would one do it? Two problems come to mind -- finding the significant edges, and drawing it. Would it need an "engine" coded from matrices up, based on lines, rather than a regular 3D engine?

sentences:
Libgdx actor bounds are wrong The Actor's boundaries are not centered at the ButtonText but I used the setBounds() method. The higher the Y position is, the less centered is the boundary. The weird thing is that i only created and added to the Stage one button but the screen shows two. When i click the top button, the bottom one is the one highlighted.

How can i fix that?

import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;

public class MyGame extends Game {
    Stage stage;
    @Override
    public void create() {
        stage=new Stage();
        FileHandle skinFile = new FileHandle("data/resources/uiskin/uiskin.json");
        Skin skin = new Skin(skinFile);
        TextButton sas=new TextButton("dd",skin);
        sas.setBounds(0, 500, 100, 100);
        stage.addActor(sas);
        Gdx.input.setInputProcessor(stage);
    }

@Override
public void dispose() {
    super.dispose();
}

@Override
public void render() {
    super.render();
    stage.act(Gdx.graphics.getDeltaTime());
    stage.draw();
}

@Override
public void resize(int width, int height) {
    super.resize(width, height);
}

@Override
public void pause() {
    super.pause();
}

@Override
public void resume() {
    super.resume();
}

}

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

This is my world so far:

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

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

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

this.mScene.setBackground(autoParallaxBackground);

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

this.mScene.registerUpdateHandler(this.mPhysicsWorld);

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

sentences:
Game maps with "counties" that are split along lines that aren't necessarily straight I want to create a game environment that supports a 2D map.  This is a really basic map, but must be split along lines that are not necessarily straight.  So imagine a country with county boundaries.  I then want to be able to detect drag / drop events within these counties.

What I'm really looking for here is a pointer to where to start on this (how it has been done before - any existing libraries out there), as I'm sure that what I'm trying to do is not new - although I can't find a beginners guide for this anywhere.

sentences:
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:
Bright colors versus duller colors I was talking to a friend the other day and we got onto the discussion about colors in videogames, relating to actual in-game graphics/art. He told me that even though it's easy to see things when everything's brightly colored, sometimes it's better to use dulled or faded colors, especially for things that you might see all the time (like walls or crates or rocks.)

The question I have is, does it matter too much if I have a lot of bright, lively colors for game graphics/art? Or should I tone it down to less lively, dull colors? Does it even matter too much, or can something like this only be evaluated on a game-by-game basis?

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:
Deferred shading - g-buffer positions, world or view space? So, i am doing this for the first time. I have a lodded terrain that i would like shade deferred. I have built the g-buffer with positions/normals/albedo/depth and render vertices like  I did before with forward rendering. World positions are calculated in the vertex shader from offsetting and scaling nodes (CDLOD after P. Strugar). I pass on world positions multiplied with  view-projection-matrix and after rednring the position texture looks like this:

For reference, the normals are like this:

All textures are RGB 16bit floats. The normals look all right. In positions, just like one would expect the quadrants move with the camera movement, the cross staying in the center. I have not yet started with the lighting pass, so my question is: does this look right ? I expected smoother transitions and not really white. Or should i use world positions (then everything is white in the position texture) and divide by world size to stay in clamped 0..1 land ?
Again, I haven't changed the vertex shader from forward rendering, and the fragment is trivially rendering to the g-buffer.

sentences:
MVC or Components, or both? I'm an experienced developer but recently I've been wanting to get into game programming but as you know game development is an entirely different beast from most other forms of programming (perhaps only bested by operating system development).

That being said I've been reading Game Coding Complete (ISBN 978-1-58450-680-5) by Mike McShaffry.

Originally I was going to try developing with a component model with the assortment of usual components (e.g. SpacialComponent, VisualComponent, EntityLogicComponent, etc..) however Mr. McShaffry recommends using the MVC model which looks very attractive but I'm not sure how I can make it work with the component model if at all possible, but, without components, the MVC model looks sort of the evil monolithic inheritance monster and not very flexible, which I'm not really interested in.

I'm really confused about where to go from this point.

Do you more experienced game coding voodoo experts have any thoughts or recommendations?

Thank you so much!

sentences:
Collision in PyGame for spinning rectangular object.touching circles I'm creating a variation of Pong. One of the differences is that I use a rectangular structure as the object which is being bounced around, and I use circles as paddles. So far, all the collision handling I've worked with was using simple math (I wasn't using the collision "feature" in PyGame). The game is contained within a 2-dimensional continuous space.

The idea is that the rectangular structure will spin at different speed depending on how far from the center you touch it with the circle. Also, any extremity of the rectangular structure should be able to touch any extremity of the circle. So I need to keep track of where it has been touched on both the circle and the rectangle to figure out the direction it will be bounced to.

I intend to have basically 8 possible directions (Up, down, left, right and the half points between each one of those). I can work out the calculation of how the objected will be dislocated once I get the direction it will be dislocated to based on where it has been touch. I also need to keep track of where it has been touched to decide if the rectangular structure will spin clockwise or counter-clockwise after it collided.

Before I started coding, I read the resources available at the PyGame website on the collision class they have (And its respective functions). I tried to work out the logic of what I was trying to achieve based on those resources and how the game will function. The only thing I could figure out that I could do was to make each one of these objects as a group of rectangular objects, and depending on which rectangle was touched the other would behave accordingly and give the illusion it is a single object. However, not only I don't know if this will work, but I also don't know if it is gonna look convincing based on how PyGame redraws the objects.

Is there a way I can use PyGame to handle these collision detections by still having a single object? Can I figure out the point of collision on both objects using functions within PyGame precisely enough to achieve what I'm looking for?

P.s: I hope the question was specific and clear enough. I apologize if there were any grammar mistakes, English is not my native language.

sentences:
CenterContainer makes my button too small I get the perfect width for my buttons, but CenterContainer overrides that value of theirs to make the button as wide as the biggest text length of the buttons when I put the buttons inside of the container

godot 3.1

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:
Alternatives to the GPL I made a game, and I am currently making a game engine. I want them both to be completely free and open source. What license should I choose? I was reading a bit on GPL, but that seems to be more suited for system code and libraries, AFAIK, as it doesn't permit the use of code for proprietorial software - which, in turn, implies that the code can be used in the first place. I can see that, obviously, game engines can be considered libraries, and therefor be used, but what about game code?

Is there an alternative to GPL?

sentences:
Triggering State Changes with Health Counter I'm developing a game where the player changes states as their health decreases. Below 50, it should trigger animation1. Below 30, it should trigger animation2.

The problem is, I only want to trigger animation1 once. But my game timer is checking every "frame", so it's triggering animation1 every cycle below 50. I only want it to trigger once, then not again until it's gone over 50 and then naturally decreased back to below 50.

Are there any tried and true strategies for triggering state changes as a timer counts down (without the over-triggering problem)?

I thought I could say:

if (health == 50)
 animation1.play();

but sometimes, health never equals exactly 50, so it will skip right past that statement.

sentences:
How to figure out which tiles are within view, and where to draw them in the grid? I know there are a few questions on here similar to mine, but none of them seem to fit my needs.

I'm using PyGame to implement a tile based game similar to Final Fantasy or Zelda from the early Nintendo and Super Nintendo generation consoles.

The issue I'm running into is that I can't figure out how make a general way to render and position the tiles within view of the player camera. Once the camera starts moving, finding how much of an image is present in the camera view is very difficult, and then positioning it correctly is more complicated.

Any suggestions on how I can figure out a general way to create the grid correctly?

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:
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:
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:
Specular intensity not imported from Blender into Unity For my current project I'm using diffuse materials for my models in Blender but I do not want any Specular Intensity so I've set that to 0. Yet in Unity there is still a specular highlight and the material has a Smoothness of 0.5. Does Unity actually read Specular Intensity or am I missing some crucial detail?

I haven't been able to find any details on what the .blend-import actually reads and I can see a setting called Glossiness in the .mat-files created by Unity is set to 0.5.

sentences:
GPU Spatial Clustering I have a around 100k points on the screen (that might update). 2D points.

The goal is to cluster them into groups, by a constant distance. Meaning, finding groups of points that the distance between them is less than this distance. Instead of drawing those points, a big point will be drawn there with a number on it.

The problem is the calculation time.
Tried many algorithms on CPU, but didn't get the performances i wished for.

I'm trying to find an algorithm to solve this problem in the GPU using WebGL-GLSL, when texture contains all my locations.

Can be single draw phase or multiple.. as long as i achieve better calculation time than i get with the CPU.

sentences:
How 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:
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:
Why does PIX suggest my frames are rendering out of order? When my application goes into a fullscreen state my movement is not smooth. It seems like frames are not rendered in the correct order, doing something like: 1, 3, 2, 4, 6, 5, ...
making the movement flicker.

For my PIX test, I draw really a low number of primitives (1140 triangle exactly) inside six vertex / index buffers. I clearly see a difference in the GPU frame "ordering" in PIX. Here is the result when in windowed mode:

PIX screenshot1 http://www.s33m3.be/PIX/PIX2.png

You can see that the GPU time needed for the frame is nearly in sync with the CPU time needed to generate it.

But in the fullscreen state here is what I got (same scene, without camera movement):

PIX screenshot2 http://www.s33m3.be/PIX/PIX.png

You can see that each GPU frame processing is split into at least two parts, and the GPU doesn't wait the end of a frame before starting another one.

What could cause this?

sentences:
Polygon draw order issue I'm working on a software and I'd to move the rendering API from SlimDX to SharpDX. I've done that but I noticed that the solid polygon are not drawn correctly i.e., even if the polygon is at the back side of another polygon, part of it is visible, also part of the polygon lie inside terrain that is also visible. Below are the images from SlimDX implementation and SharpDX implementation for reference:

I tried to set the Stencil & ZBuffer but there are not working as expected. I've already applied DepthBias to it which worked fine with SlimDX but not with SharpDX.
Please let me know if, I'm missing something or I'm doing something wrong.
Update 1 (Polygon rendering):
// set the render state to device
device.SetRenderState(RenderState.AlphaTestEnable,
                      true);
device.SetRenderState(RenderState.AlphaBlendEnable,
                      true);
device.SetRenderState(RenderState.SourceBlend,
                      Blend.SourceAlpha);
device.SetRenderState(RenderState.SeparateAlphaBlendEnable,
                      true);
device.SetRenderState(RenderState.DestinationBlendAlpha,
                      Blend.One);
device.SetRenderState(RenderState.SourceBlendAlpha,
                      Blend.InverseDestinationAlpha);

// set the render state to the device
device.SetRenderState(RenderState.DepthBias,
                      -1E-06f);

this.effectVectoring.Begin(FX.None);

// binds the vertex buffer to device data stream
device.SetStreamSource(0,
                       this.vertexBuffer,
                       dataGeometry.FillVertexOffset,
                       stride);
// pass 1 to shader as a pass if it is 3D mode else 0
this.effectVectoring.BeginPass(is3D ? 1 : 0);
// renders the non-index geometric primitives using the data from current input stream
device.DrawPrimitives(SharpDX.Direct3D9.PrimitiveType.TriangleList,
                      0,
                      primitiveCount);
// end the pass
this.effectVectoring.EndPass();

this.effectVectoring.End();
device.SetRenderState(RenderState.AlphaBlendEnable,
                    false);
device.SetRenderState(RenderState.AlphaTestEnable,
                    false);
device.SetRenderState(RenderState.DepthBias,
                    0);
device.SetRenderState(RenderState.FillMode,
                    FillMode.Solid);
device.SetRenderState(RenderState.SeparateAlphaBlendEnable,
                    false);

Update 2 (Terrain rendering):
device.SetRenderState(RenderState.AlphaBlendEnable,
                      false);
device.SetRenderState(RenderState.AlphaTestEnable,
                      false);
device.SetRenderState(RenderState.CullMode,
                      Cull.Counterclockwise);

device.Indices = this.terrainIB;
device.SetStreamSource(0,
                       this.terrainVB,
                       0,
                       12);
device.VertexFormat = VertexFormat.Position;

// Set texture in effect...

effect.Begin(FX.None);

effect.BeginPass(pass);
device.DrawIndexedPrimitive(PrimitiveType.TriangleStrip,
                            baseVertexIndex,
                            0,
                            vertexCount,
                            startIndex,
                            primitiveCount);
effect.EndPass();

effect.End();
device.SetRenderState(RenderState.FillMode,
                      FillMode.Solid);
device.SetRenderState(RenderState.CullMode,
                      Cull.None);

sentences:
c++ static only classes for subsytems and Engine From the book Game Engine Architecture

  In C++, global and static objects are constructed before the program’s
  entry point (main(), or WinMain() under Windows) is called. However,
  these constructors are called in a totally unpredictable order. The destructors
  of global and static class instances are called after main()
  returns, and once again they are called in an unpredictable order. Clearly this
  behavior is not desirable for initializing and shutting down the subsystems
  of a game engine, or indeed any software system that has interdependencies
  between its global objects.

The book suggests to implement the subsystems as singelton objects with empty constructor and destructor and add explicit Init() and Dispose() methods, such that the construction and destruction order can be manually specified.
The question is now whether this can be done using global static classes instead of singelton objects, like this:

//Renderer.h
class Renderer
{
public:
    static void Init()
    {
        //init logic
    }

    //Some static, global fields

    static void Dispose()
    {
        //Disposing logic
    }
private:
     //some more static, not global fields / methods
};

//Engine.h
class Engine
{
public:
  static void Init()
  {
    Renderer::Init();
    //etc
  }
  //other stuff

  static void Dispose()
  {
      Renderer::Dispose();
      //etc
  }
};

//Main.cpp

int main()
{
    Engine::Init();
    //some work
    Engine::Dispose();
}

Will this kind of approach also solve the initialization order problem described in the book?

sentences:
photon unity why error GO:Networking Manager appears when trying to make the scene not restart / reload when another clients join the room photon unity why error
Debug.LogError("Illegal view ID:" + view.viewID + " method: " + methodName + " GO:" + view.gameObject.name);
appear
the code
 private void OnJoinedRoom()
{
    Debug.Log("OnJoinedRoom");
    PhotonNetwork.automaticallySyncScene = true;
    if (PhotonNetwork.isMasterClient)
    {
       GoToGame();
    }
    else
    {
        StartCoroutine(ReloaSceneCor());
    }
}

IEnumerator ReloaSceneCor()
{
    //send RPC to other clients to load my scene
  //  mainplayer.GetComponent<PlayerScript>().photonView.viewID = 1;  i added this but not working perfectly, it
    mainplayer.GetComponent<PlayerScript>().photonView.RPC("LoadMyScene", PhotonTargets.Others, "SampleScene");
    yield return null;
    PhotonNetwork.isMessageQueueRunning = false;
    //PhotonNetwork.LoadLevel(SceneManager.GetActiveScene().name); //restart the game
    PhotonNetwork.LoadLevel("SampleScene"); //restart the game
}
[PunRPC]
public void LoadMyScene(string sceneName)
{
    Debug.Log("REcieved RPC " + sceneName);
    PhotonNetwork.LoadLevel("SampleScene"); //restart the game
}

sentences:
Should a bowling game use a 2d or a 3d physics engine? I'm creating a bowling game in flash+as3. I'm new to physics engines, so, to start I've begun to learn Box2D since I've heard it's one of the most popular physics game engines.
Currently, I'm not sure if it's the best solution. I'm not sure even if I should use a 2D physics engine or if I should move to 3D physics engine.
As you can see in the attached screenshot of my game, the ball should move on the lane until it hits the pins. The game has some amount of 3D behavior.
Please advise.

sentences:
Efficiently rendering tiled map on OS X I'm writing an original (top-down) SimCity clone in Swift and attempting to use SpriteKit as the basis for the game. However, I am running into performance issues when rendering and animating the tile map which represents the city map.

I'm rendering a 44x44 tile map with each tile being 16x16 pixels. Tile animation could happen on any arbitrary tile and is implemented by having a separate image for each frame of the animation. The map is dynamic (naturally) since the player will draw on it and tiles can be animated (roads, etc). I have tried several implementations to render the map the screen and each has had its own performance issues.

What I've tried:

Each tile is an SKSpriteNode with its texture loaded from a texture atlas. Textures were swapped for tiles that were dirty (needed redraw). I disabled physics simulations and physics bodies on the nodes.

Pros:

Minimal draws (due to the Texture atlas)
Code wasn't very complex

Cons:

Redrawing the entire map destroyed performance
Swapping textures to animate was inefficient

Map was rendered using NSView, drawRect, etc.

Pros:

Drawing was relatively efficient
Dirty rectangle drawing was easy to implement

Cons

Not really suitable for animation (really bad performance)

My question is: What is the most efficient way of rendering/animating my tile map? Is there an optimization I can make to SpriteKit to speed this up? Or do I need to use something lower level (OpenGL/GLSL) to draw/animate the map efficiently?

Any help would be greatly appreciated!

sentences:
How to make a cell shader like BOTW in Unity? It seems most cell shader tutorials focus on individual shaders for materials, but the effect used in BOTW seems to be more like a filter, that is applied to everything.
I've researched multiple examples that have been done in UE4 like here and here but nothing in Unity.
How would I apply something like this in Unity?

sentences: Setting up Lightprobes Moving around lightprobes requires using the movetool and all you really can do is move them along global axes and copy paste. There are no functions to scale, rotate, Snap to a surface, not even shift border select is possible. Is there a way to be more efficient setting up lightprobes?

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:
Should I use a database to store ~10 000 names in a sports game? I'm working on a single player sports game for a year or so and this doubt came up: how should I treat/store big amounts of data, like player names.
Let's take an arbitrary number as example: 10000 names, 5000 first names and 5000 surnames. These names would be equally divided between 100 countries, which give us 50 first names and 50 surnames per country.
Should I have a local database with these names (or even these countries) considering this data will be needed to generate new players names during the course of the game? Would that introduce limitations, considering I want to make my game moddable by players, as much as possible?
These doubts can be extended to other, more complex game entities, such as:

Players - each one with their own face, attributes, team etc...
Teams - each one with its own crest, kit, squad etc...

In my previous research about that, the SQLite popped up as a seemingly viable solution. It happens that I have almost no experience with DB's (specially in games) and would like to know if this is a good direction before start to study and try to implement it.

sentences:
The view matrix finally explained I must say that I am really confused by how a view matrix is constructed and works.

First, there are 3 terms: view matrix, lookat matrix, and camera transformation matrix. Are those 3 the same, or different things. From what I undestand, the camera transformation matrix is basically the model matrix of the camera, and the view matrix is the inverse of that. The lookat matrix is basically for going from world space to view space, and I think I undestand how it works (doing dot products for projecting a point into another coordinate system).

I am also confused by the fact that sometimes, it seems like the view matrix is built by translation and dot products, and some other times, it is built with translation and rotation (with cos and sin).

There are also quaternions. When you convert a quaternion to a matrix, what kind of matrix is this?

Can someone explain to me how it really works, or point me towards a good resource.

Thank you.

sentences:
Texture artifacts depending on texture size I get some strange artifacting with textures depending on their size. I run OpenGL 3.3 with an GTX 580 so it should definitely support non power of two textures. I've narrowed down the problem specifically to the texture's size, I've tried checking if transparency had anything to do with it, color channels etc.

As you can see, the 512x512 and 300x300 textures look just fine but the 437x437 is all distorted. What could be the cause of this and how can it be fixed? I could of course just stick to power of two textures which seem to work fine but since this is an personal educational project I really want to understand what's going on.

sentences:
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:
Gamemaker vs Unity2d - Speed of Development I know coding, so programming is not a problem
Money is not a problem at all, I can get both GameMaker Master
Collection and Unity Pro

I want to make a 2d game.

So which one is better for speed of development? On which one would I be able to finish my project earlier?

sentences:
Sorting a vector using array version of quick sort I'm coding  a simple rendering engine using OpengGL and I wrote a class that manages a particle system. The class creates the particles and pushes them into a vector to be used by a renderer to draw them on screen. I need to order the particles from the farthest to the nearest to the camera (in order to solve problems with alpha blending and depth, having disabled depth testing for transparency), so I tried with the following code:

void ParticleRenderer::render()
{
    // prepare renderer
    .....
    // update particle state (position,ecc..) and remove it if necessary
    // update returns a bool indicating if particle is still alive
    while (it != mParticles.end())
    {
        if (!(*it)->update())
        {
            delete *it;
            it = mParticles.erase(it);
            if (it == mParticles.end())
                break;
            else
                continue;
        }
        it++;
    }
    if (mParticles.size() > 0)
        sortParticles(&mParticles[0], 0, mParticles.size() - 1);
    for (Particle *particle : mParticles)
    {
        .....
        // render particle
        .....
        std::cout << getCameraDistance(particle) << std::endl;
    }
    std::cout << "*************************************" << std::endl;
    mShader.unuse();
    glDisable(GL_BLEND);
}

void ParticleRenderer::sortParticles(Particle **particles, int low, int high)
{
    if (low >= high)
        return;
    Particle *temp = particles[low];
    while (true)
    {
        while (compareParticles(temp, particles[high]) >= 0 && low < high)
            high--;
        if (low == high)
            break;
        else
            particles[low++] = particles[high];
        while (compareParticles(temp, particles[low]) < 0 && low < high)
            low++;
        if (low == high)
            break;
        else
            particles[high--] = particles[low];
    }
    particles[high] = temp;
    int middle = high;
    sortParticles(particles, low, middle - 1);
    sortParticles(particles, middle + 1, high);
}

double ParticleRenderer::compareParticles(Particle *particle1, Particle *particle2)
{
    return  getCameraDistance(particle1) - getCameraDistance(particle2);
}

double ParticleRenderer::getCameraDistance(Particle *particle)
{
    glm::vec3 distance = mCamera.getPosition() - particle->getPosition();
    return glm::length(distance);
}

but what I get on the console are all unsorted particles (the cout statement) and of course I have problems when the particles are rendered on screen.
Am I missing something?

I know I could use std::sort and the STL algorithms, but since I'm learning I would like to know what I am doing wrong.

sentences:
Converting time of day into a smooth day/night variable? I'm trying to make a smooth day/night cycle for a game project that I've been working on. I've already set up a clock that adds deltaTime to seconds, wraps seconds to gameMinutes, etc. The issue that I'm having is that I want a signed normalized float to represent day (+1) and night (-1), and I'm not exactly sure what the most effective way of doing that is.

Here's my time class in pseudocode:

class GameTime {

    float snDayNight; //signed normalized

    float seconds;
    int gameMinutes;
    int gameHours;
    int gameDays;
    int gameMonths;

    //Omitted consts used for wrapping (SEC_PER_MIN, HR_PER_DAY, etc.)..

    //Per-frame update..
    public void Update(){
        seconds += Timer.GetDeltaTime();
        WrapTimeValues (); //Wraps sec to min, min to hr, etc.
        UpdateDayNightCycle ();
    }

    private void UpdateDayNightCycle(){
        //?????
    }

    //...//
}

So, my GameTime has been tested and seems to be working fine; when the value in seconds is >= the value of SEC_PER_MIN it adds another minute and stores the leftover fraction of a second. It then goes on to check minutes, hours, days, etc.

I've been a little bit stuck at UpdateDayNightCycle() though. I want to be able to convert my time into a smooth decimal value where -1 represents absolute night and 1 represents absolute day. I've normalized values between 0~1 and -1~1 before, but I've never tried to use a normalized value to represent a repeating/periodic value like night~day before..

I tried drawing a simple graph where time of day is on the x-axis and daynight value is on the y-axis. What I get is essentially a graph of a triangle wave. Sadly my math skills are a little bit underdeveloped and even after looking into formulas for triangle waves, I've been having trouble implementing it in my code..

So, am I even on the right track? How can I smoothly convert my game world's time into a single decimal value between -1 and 1?

sentences: How do fps games do ironsights for weapons How do games like Call of Duty, Battlefield and Wolfenstein: the New Order do their ironsights? Do they just align the model or is it an image?

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:
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: Do Java and Actionscript use OpenGL? As far as I know there are only 3 base graphics libraries on Windows, the GDI, OpenGL and DirectX, is that correct, so that means that Java, Actionscript and all language use one of these 3 libraries if they are to display graphics, or maybe Java has it's own graphics library/API?

sentences:
How to change the virtual joystick Input direction depending on camera rotation so the player moves to its current forward direction? I have a scene set up where the player moves and rotates with Virtual Joystick Input. I have button which rotates the camera to the back of my player at that point I want to change the joystick input direction so it moves my player to towards its current forward direction.

  The joystick Scripts:

1) script to handle events:

public class joystickEvents extends EventSystems.EventTrigger{
  var position:Vector2=Vector2.zero;

  public var joyStickHolder:Transform;
  private var pointerUp:boolean=false;

  function Update(){
    if(position!=Vector3.zero && pointerUp){
       position=Vector3.Lerp(position,Vector3.zero,5*Time.deltaTime);

    }
  }
   public function OnDrag(data:EventSystems.PointerEventData){
      position=data.position-joyStickHolder.position;
   }
   public function OnPointerUp(data:EventSystems.PointerEventData){

     pointerUp=true;

    }
  public function OnPointerDown(data:EventSystems.PointerEventData){
     pointerUp=false;
  }

}

2) script for joystick movement:

   public class joystick extends MonoBehaviour{
    var joystickEvents:joystickEvents;
    var joystickHolder:RectTransform;
          var dir:Vector3;
    private var maxDist:float;
    private var direction:Vector3;
    private var magnitude:float;

     function Start(){
        maxDist = joystickHolder.sizeDelta.x;
        maxDist=maxDist/2.5;
     }

     function OnGUI () {

        if(joystickEvents.position.magnitude>(maxDist))
              magnitude=maxDist;

        else{
          magnitude=joystickEvents.position.magnitude;

        }
        direction=joystickEvents.position.normalized;

      transform.localPosition=direction*magnitude;
        dir=direction*(magnitude/maxDist);
    }
  }

The player controller script takes the variable dir to move around the world. I think this value must changed somehow to so that move the player moves towards its current forward based on joystick input when camera is rotated.

  Here some part of playerController responsible for player movement:

public class charcterController extends MonoBehaviour{
 private var controller  : CharacterController;
 private var moveDirection : Vector3 = Vector3.zero;
 var speed : float = 6.0;
 var joystick:joystick; //reference to the joystick script
  function Start(){
       controller = GetComponent.<CharacterController>();
    }
  function Update() {
        var joyInput:Vector3=joystick.dir; //the dir in joystick script
        dir=Vector3(joyInput.x,0,joyInput.y);
        if (controller.isGrounded) {
        moveDirection = dir;

        moveDirection *= speed;
        controller.Move(moveDirection * Time.deltaTime);
         rotate();
      }
  function rotate(){
      if(dir!=Vector3.zero)
          transform.rotation = Quaternion.LookRotation(dir);
      }
 }

sentences:
Center directional light shadow to the cameras eye I'm currently drawing my directional light shadow using this view and projection:

XMFLOAT3 dir((float)pitch, (float)yaw, (float)roll);
XMFLOAT3 center(0.0f, 0.0f, 0.0f);

XMVECTOR lightDir = XMLoadFloat3(&dir);
XMVECTOR lightPos = radius * lightDir;
XMVECTOR targetPos = XMLoadFloat3(&center);
XMVECTOR up = XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f);

XMMATRIX V = XMMatrixLookAtLH(lightPos, targetPos, up); // This is the view

// Transform bounding sphere to light space.
XMFLOAT3 sphereCenterLS;
XMStoreFloat3(&sphereCenterLS, XMVector3TransformCoord(targetPos, V));

// Ortho frustum in light space encloses scene.
float l = sphereCenterLS.x - radius;
float b = sphereCenterLS.y - radius;
float n = sphereCenterLS.z - radius;
float r = sphereCenterLS.x + radius;
float t = sphereCenterLS.y + radius;
float f = sphereCenterLS.z + radius;
XMMATRIX P = XMMatrixOrthographicOffCenterLH(l, r, b, t, n, f); // This is the projection

Which works prefect if the center of my scene is at 0.0, 0.0, 0.0. What I would like to do is move the center of the scene relative to the cameras position. How can I do that?

sentences:
How should I check if a player has completed an achievement? I'm making an MMO game and I just got to a point where I need to implement achievements... How do I do that? The most straight forward thing to do would be to run this once every 100ms,:

for a in achievements
    for p in players
        if a.meetsRequirements(p) then p.completeAchievement(a)

But that just raises even more complications. For example, how do I check if the achievement has actually been completed? Do the players have custom properties on themselves just for a specific achievement? I did this kind of thing with quests, because they are mainly "collect 100 wood", so active quests on a player check that. Also, there must be a better time to check it, this would periodically slow my server down, I think.

sentences:
How do I implement GPU-based dynamic geometry LOD in OpenGL? I'm trying to implement LOD to boost my game's performance. I found a very nice tutorial.

The basic concept that I think I understand is: Get the distance from the camera to the object, check for the right LOD-level and then render the object with the "right amount of instances".

How do I implement that?  The provided example code is a mystery to me...

Some questions:

Is this a good method to implement LOD?
Can someone please explain me detailed, how I have to implement it, with the queries and so on...
I'm rendering all of my objects with

GL11.glDrawElements(GL11.GL_TRIANGLES, model.getRawModel().getVertexCount(),
                    GL11.GL_UNSIGNED_INT, 0);

The example code uses GL_POINTS. Can I implement it also with GL_TRIANGLES?

sentences:
How to calculate the viewing cone radius at a distance in raymarching? I'm "raymarching distance fields" (proper lingo: sphere-tracing) in GLSL. To implement cone-marching atop of it (and also to minimize the number of raymarching steps regardless of whether cone-marching is added or not), I need to estimate the radius of the ray cone at any given distance.

Recall with raymarching distance fields, a "hit" is recorded when the distance to an object is smaller than a threshold value, often in code named nearLimit or epsilon. This threshold can be seen as equivalent to the ray-cone radius if we increase it exponentially with distance traveled -- this way, we don't shoot straight thin ray lines into space but cones expanding in accordance with perspective projection. This more accurately covers catching the "right" distant objects (at this point let's ignore the issue of blending materials and filtering normals of all intersected objects in the viewing cone at distance t for now...).

At step 0, this radius can be approximated by something such as

float fInitialRadius = 1 / min(screenwidth, screenheight);

This can then be increased at each step exponentially by applying the starting radius to the distance:

fNearLimit = fTotalDist * fInitialRadius;  // after each raymarching step

This works OK but still has artifacts. If I use fInitialRadius*fInitialRadius (resulting in a smaller number since initial radius for a 640px framebuffer and a unit-width view-plane is 1/640) I get less artifacts and a more accurate result. But both approaches are inaccurate, the first is too eager (increases radius too much too early), the latter too lazy (increases radius too little too late).

The most accurate factor to increase fNearLimit / the cone radius at a given distance must most likely take into account my current field of view and will vary depending on whether field-of-view is 45° or 60° or 90° or...

TL;DR: I want to know what's the proper calculation or most acceptable approximation of the cone radius at a given distance given the initial pixel radius at step 0 and the field of view angle?

sentences:
LibGDX: Colllisions between bullets and enemies in arrays I am writing a "Gauntlet" style game. So far I have managed to successfully detect collisions between my player object and my ghost enemy objects, and when they collide they drain the player's energy.

The Ghosts are stored in an ArrayList. I now have bullets which the player can fire, these are instantiated from the Player class and added to another ArrayList called bullets.

I typically have around 50 ghosts on the screen dotted around the map.

ArrayList<Ghost> ghosts = new ArrayList<Ghost>();
ArrayList<Bullet> bullets = new ArrayList<Bullet>();

The ghosts and bullets are added to these lists when spawned/fired

I have tried to implement a method as per below, to try and determine whether a ghost's bounding rect and a bullet's bounding rect overlap, as follows:

/**
 * Check if a ghost has been hit by a bullet
 */
public void checkGhostsHit() {

    Iterator<Ghost> iterEn = ghosts.iterator();

    while ( iterEn.hasNext() ){
        Ghost g = iterEn.next();

        //initialise the bullet iterator each time here
        Iterator<Bullet> iterBul = Player.bullets.iterator();

        while ( iterBul.hasNext() ) {
            Bullet b = iterBul.next();

            if ( b.getBoundingRect().overlaps( g.getBoundingRect() ) ) {
                Gdx.app.log("Enemy", " Hit");
                iterBul.remove();
                iterEn.remove();
            }
        }
    }
}

This method is being called from my main render loop but I cannot get it working for love or money. I have tried various forms of the above method, including 'For' loops etc.

Am I performing the check in the correct place? Should the Bullet class instance iteself be checking for a collision, or is the above approach the correct idea.

As you can tell I'm a noob to this and I am still struggling with working out which activities should be undertaken by particular game Classes.

sentences:
Box2D: Asteroids-Like Spaceship Physics I'm new to Box2D (JavaScript) (and the world of physics/mathematics) so I'm having a hard time working out the methods I need to use to make a spaceship act like it does in the classic arcade game Asteroids. I've tried varying methods and nothing works quite right (as I obviously don't understand what I'm doing).

For example, in Asteroids you can rotate the ship but it turns at a constant rate and won't continue to spin after you let go of the key, unlike the rest of the ship's physics. So I tried SetPositionAndAngle(position, angle-0.1) as an example to make the ship turn without having it rotate after key up, however when I then press the up key to make the ship go forward, it turns left as well as going forwards (via ApplyForce).

Can anybody give some tips on how I should be dealing with Asteroids-type spaceship physics?

sentences:
How to devise an algorithm for a person being on a walk? The game is an isometric RPG. The map is tile based.

I'm creating a town for this game. And I want one of the characters to roam the town randomly, because she is on a walk with her children.

I tagged the tiles she can go on. And I created a simplistic algorithm that I, in my naiveness, thought would be enough. Here it is:

If the character is blocked out and can't move in any direction she waits 1s before checking this again. If she can move in only one of the 4 directions, she moves that direction. If there is more than one possibility: If she can go forward, she always has 50% chance of going forward; if she can go both to her left and to her right there is an equal chance she chooses either of those two directions; and finally, if she can turn back, that chance is 2x smaller than turning to her left and 2x smaller than turning to her right. So, if she can choose from all 4 directions, she will have 50% chance to go forward, 20% chance to go to her left, 20% chance to go to her right, and 10% chance to go back. Repeat the above every step.

This algorithm fails beautifully. The character mostly moves randomly in one place. If she gets on a square she almost can't leave it.

I thought the solution would be to increase the chance of her moving forward. So I made the chance to go forward 5 times bigger than doing anything else. But this proved to hardly improve things.

COuld you give me some hints, point me to the correct direction? Or at least tell me that this is not worth it and I should instead resort to giving her a predefined path? (Are there no algorithms to make a character roam a given set of walkable tiles?)

sentences:
Dot based light mask with shader on sprites So I have a scene, completely based on 2D sprites. I want to render "light sources" into a seperate frame buffer (so mostly dots around, for example, the centre of a flame) and then render that frame buffer with my "lighting" shader above my whole scene, causing the light sources to "tint" the surrounding pixels, mostly by blending a pixel with the light source's color dependant on it's distance to the nearest light source.

The question:
What concepts should I apply here to get the results I want?
What am I doing wrong right now?

I have here a few concept drawings:

The scene without lighting:

The framebuffer of the scene containing the light source (the top yellow pixel of the flame):

The result of rendering the framebuffer as a texture with the glow shader. I also "simulated" a 2nd buffer with a smaller radius and a yellow light at the same position.

Alternatively, and closer to my first approach to the idea, imagine the whole framebuffer of the 2nd pixel transparent but the dot at the center.

What I wasn't able to mock up quickly was a gradient of the lighting, dimming it at the edges and having it brighter at the center.

The current idea needs to conform this fragment shader's layout:

#version 400
uniform sampler2D color_map;
layout(std140) uniform Sprite {
    vec2 position;
    vec2 size;
    vec2 position_in_texture;
    vec2 size_in_texture;
    float rotation;
};
in vec2 texture_coordinate;
layout(std140) uniform Color {
    vec4 color;
};
layout(location = 0) out vec4 out_color;
void main(){
    vec4 tex_color = texture2D(color_map, texture_coordinate);
    vec2 diff;
    vec2 norm;
    vec2 sample_coordinate;
    out_color = tex_color;
    int radius = 4;
    int count = 1;
    norm = vec2(radius/size.x, radius/size.y);
    for(int i=-radius; i < radius; i++){ //Sample each pixel around the one rendered right now and add it's color to the current one with a certain gradient factor
        for(int j=-radius; j < radius; j++){
            diff = vec2(i/size.x, j/size.y);
            sample_coordinate = texture_coordinate + diff;
            if(0.0 <= sample_coordinate.x && sample_coordinate.x <= 1.0 && 0.0 <= sample_coordinate.y && sample_coordinate.y <= 1.0){
                tex_color = texture2D(color_map, sample_coordinate);
                if(tex_color != vec4(0.0,0.0,0.0,0.0) && sample_coordinate != texture_coordinate && length(diff) <= length(norm)){
                    out_color = (out_color * count + tex_color * (1.0 - (length(diff) / length(norm)))) / (count+1);
                    count++;
                }
            }
        }
    }
}

I am planning on making the radius variable by passing it as another uniform element.
With what I am doing there, I don't get the results I am looking for.

Though through experimenting I got this glow-shader, which I like, but the edges of the logo are still a bit too dark though (left the passed frame above the original, that is right):

sentences:
Getting ParticleSystemRenderer in inspector I have a component that manipulates the sorting order of a given renderer, for the sake of managing UI layering. It looks something like this:
public class ManipulateSortingOrder : MonoBehaviour
{
    public Renderer Renderer;

    public void DoManipulation ()
    {
        // Renderer.sortingOrder = some value
    }
}

Now I want to plug a ParticleSystemRenderer into the Renderer field via drag and drop. I know I can get it via script using GetComponent, but whenever possible I like to supply dependencies using the inspector for the sake of testability, looser coupling, and generally writing as little code as possible.
That said, I can't seem to find the actual ParticleSystemRenderer component in any GameObject with a ParticleSystem. Dragging the "renderer module" (which I assume is some editor trickery disguising the actual underlying component?) doesn't seem to work. I've also tried looking at the ParticleSystem GameObject in debug mode in the inspector, but haven't seen a ParticleSystemRenderer component attached.
Is there a way to grab the ParticleSystemRenderer using the inspector, or is GetComponent the only way to go?

sentences:
My bullet keeps going up So I have a bullet script that fires a bullet straight in the Y direction that gets called as the bullet is instantiated. The plan is to always shoot in the same direction, straight in the Y, but to just rotate the bullet upon instantiation so that the straight is the right kind of straight if that makes sense? What i really want to know i think is how to work out the value for the 3rd property of the instantiate based on the key pressed before the fire, what makes it worse is that i dont even know how to create a rotation variable.

Instantiate(Resources.Load("P1Bullet"), transform.position, transform.rotation);

this is how i move my bullet in the bulletmove script

void Update () {
    Vector3 pos = transform.position;
    Vector3 vel = new Vector3(0, speed * Time.deltaTime, 0);
    pos = pos + transform.rotation * vel;
    transform.position = pos ;
}

sentences:
How to make an authoritative multiplayer game deterministic for all clients? I'm starting to create a multiplayer online game, with an authoritative server. As it is, the clients send inputs to the server which do the simulation and then send back to clients the updated state. The game is a top-down shooter, so it's fast-paced and input lags are not allowed here, so to avoid this I'm doing the simulation on the client too, and when the server update come back I compare the local simulation with the server response. If they are compatible everything is fine, otherwise, the client version is corrected.

I was expecting that the client simulation desync at some point, because of all of the variables on physics, floating points, network etc... But this happens much more than I thought.

Just by sending the inputs and simulating on the server, the results are very different, even on simple movements, like forwards and backwards on a clear space.

Green is local, red is server response

I need help on this step, a way of keeping, at least this kind of simple movement, consistent on the server and the clients.

sentences:
unity onCollisionEnter does not work I know this question has been asked several times but none of the answers solved my problem.

I made an sphere and gave it rigidbody. then I draged the sphere on to a new made prefab.

on mouse-click Instances of this prefab are made and shot. the spheres collide with things in the scene but the onCollisionEnter function is not called.
all things in the scene have colliders.

I would be grateful if you could tell me what's wrong

edited: it works if either the sphere or the other object's collider is trigger and I use onTriggerEnter.

sentences: How Many Entities can the Unity Game Engine Handle Before it Starts to Lag? I am building a player model for my game, the model is very complicated due to its ability to be customizable. A single player entity can have 70 + entities including the head, parts to the face, arms, legs, shoes, and the clothes and armor it wears, and the weapons it has equipped. I just need to know, at what point does the unity game engine start lagging due to too many entities? Also, the game is low poly, there are many entities, but each one is block based, or very simple in design.

sentences:
Possible legal pitfalls in font licensing for mobile games? As I start to look into finding a the right font for a new mobile game I'm developing, I'm noticing that license agreements for fonts are pretty varied.  Looking on advice for what pitfalls to avoid in choosing a distinctive font for a mobile game that will initially be free, but which we eventually plan to monetize.

My main concern is with a license that may not cover our intended uses, and lead to penalties.

We're willing to spend a little money in order to COA ("cover our butts")

sentences: Using the AssetManager in LibGDX I am trying to use the AssetManager class in LibGDX and I understand how it works but I am trying to implement a loading screen. I have followed the AssetManagerTest.java file here, but I am having a hard time trying to figure out how to get it to work correctly. Can someone point me in the right direction? My goal is to load the assets (textures, sounds, fonts, ... etc) and update a bar with the percentage complete on the screen. I don't understand the ResolutionFileResolver and the Resolution[] in the link I provided. What are they for? My goal is to support a static class that can give me access to all of the assets I need in my game from any screen. Is there a preferred method to do this? Thanks.

sentences:
Casting a Matrix4 class to float* glUniformMatrix4fv(glGetUniformLocation(program, "projMatrix"), 1, false, (float*)&projMatrix);

projMatrix is a an object of type Matrix4 where the first variable declared is a float array. Does (float*)&projMatrix therefore somehow retrieve this array? What does the casting appear to be doing?

sentences:
What is a "Projectile"? I don't know what a Projectile os.

I'm not sure whether a Projectile is a spawn point which spawn a number of object or a number of multiple objects.

I'm referring to this website.

How do I use Projectiles and what does it mean?

sentences:
corona sdk scale images How to scale images to full screen on all devices, i want to use %

The method I've seen so far is to define pixels

image_variable_name = display.newImage( "testimage.jpg", 100, 300 )

I want to do something like

image_variable_name = display.newImage( "testimage.jpg", 100%, 100% )

But that won't work, I want something like fluid CSS, the image will maintain the size no matter what is the size of the screen. Is it possible?

sentences:
How much does it cost to produce a major video game? I asked this same question here, but was closed and told to ask it on this site instead.

How much would it cost to develop a video game. I mean like a major PS3/360 video game. I know there really is no set price; but there has to be a pall bark, 100 grand, 10 mil, etc.

I am asking how much the games cost to make, (studio cost, developer salaries, etc.)

Examples would be nice.

sentences: Data-driven animations Say you are using C/SDL for a 2D game project. It's often the case that people use a structure to represent a frame in an animation. The struct consists of an image and how much time the frame is supposed to be visible. Is this data sufficient to represent somewhat complex animation? Is it a good idea to separate animation management code and animation data? Can somebody provide a link to animations tutorials that store animations in a file and retrieve them when needed. I read this in a book (AI game programming wisdom) but would like to see a real implementation.

sentences:
Create an atlas texture in photoshop to use in unity To create a button in NGUI looks like we need to create something called Atlas that is a material that contains a lot of little images called Sprites.

I created a set of 40 sprites (for 20 buttons needed in game, normal state and clicked state) in photoshop in a 2048x2048 image file. When i tried to use NGUI atlas maker i realized that atlas maker requires each sprite in a separate file and wants to merge them in the atlas itself!

Well, i already have them in one file, should i slice all these buttons and save them in 40 other  separate files and let the atlas maker merge them again for me? (Sounds very stupid!)

Isn't there any way to give the merged 2048x2048 file to atlas maker (or any other equivalent plugin/software) and then tell the software "Hey! I have 40 sprites in this image, let me tell you where they are! The first one is in (3,3) with size of (150px, 150px), The second one is..."?

UPDATE: I found a part of solution, unity could identify my 40 sprites in texture using sprite editor tool, but NGUI cannot still find them.

I created a material using "Unlit/Transparent Colored" shader and referencing the atlas to it, then i created a new empty game object, added UI Atlas component to it and referenced the material in it, but it says there are no sprites. If i make a prefab out of this game object then NGUI can use it as an atlas and my problem will be solved

sentences:
Creating a voxel world with 3D arrays using threads I am making a voxel game (a bit like Minecraft) in C++(11), and I've come across an issue with creating a world efficiently.

In my program, I have a World class, which holds a 3D array of Region class pointers. When I initialize the world, I give it a width, height, and depth so it knows how large of a world to create. Each Region is split up into a 32x32x32 area of blocks, so as you may guess, it takes a while to initialize the world once the world gets to be above 8x4x8 Regions. In order to alleviate this issue, I thought that using threads to generate different levels of the world concurrently would make it go faster.

Having not used threads much before this, and being still relatively new to C++, I'm not entirely sure how to go about implementing one thread per level (level being a xz plane with a height of 1), when there is a variable number of levels.

I tried this:

for(int i = 0; i < height; i++)
{
    std::thread th(std::bind(&World::load, this, width, height, depth));
    th.join();
}

Where load() just loads all Regions at height "height". But that executes the threads one at a time (which makes sense, looking back), and that of course takes as long as generating all Regions in one loop.

I then tried:

std::thread t1(std::bind(&World::load, this, w, h1, h2 - 1, d));
std::thread t2(std::bind(&World::load, this, w, h2, h3 - 1, d));
std::thread t3(std::bind(&World::load, this, w, h3, h4 - 1, d));
std::thread t4(std::bind(&World::load, this, w, h4, h - 1, d));

t1.join();
t2.join();
t3.join();
t4.join();

This works in that the world loads about 3-3.5 times faster, but this forces the height to be a multiple of 4, and it also gives the same exact VAO object to every single Region, which need individual VAOs in order to render properly. The VAO of each Region is set in the constructor, so I'm assuming that somehow the VAO number is not thread safe or something (again, unfamiliar with threads).

So basically, my question is two one-part:

How to I implement a variable number of threads that all execute at the same time, and force the main thread to wait for them using join() without stopping the other threads?
How do I make the VAO objects thread safe, so when a bunch of Regions are being created at the same time across multiple threads, they don't all get the exact same VAO? Turns out it has to do with GL contexts not working across multiple threads. I moved the VAO/VBO creation back to the main thread. Fixed!

Here is the code for block.h/.cpp, region.h/.cpp, and CVBObject.h/.cpp which controls VBOs and VAOs, in case you need it.

If you need to see anything else just ask.

EDIT: Also, I'd prefer not to have answers that are like "you should have used boost". I'm trying to do this without boost to get used to threads before moving onto other libraries.

sentences: Using XBOX controllers on PC for an XNA game Does anybody know how to do this? I have been trying to figure this out with no luck.

sentences:
Level Selector with possible future levels? [Unity] I have a level select screen which is a simple grid layout of my levels. The level data comes from a scriptable object for each level.

The problem I have is what is the best method for populating the grid of levels that use the scriptable object and is able to add more levels to the grid layout if let's say I add an asset bundle in the future?

My thought was that I use a levelDB which holds a list of all of the scriptable objects. Then when an asset bundle is used then it adds the content to the levelDB. The UI would then just use this levelDB to populate the screen.

NOTE: I have very little to no knowledge of how asset bundles work and what you can, and cannot do with them.

sentences:
What is the physical interpretation of Input.GetAxis("Horizontal")? Actually I want to edit my previous question titled What is the geometrical interpretation of Input.GetAxis("Mouse X") and add a related question "What is the physical interpretation of Input.GetAxis("Horizontal")?" to it.

However, I was asked to create a new question about it.

The longer I press the key, the greater the value returned by Input.GetAxis("Horizontal"). If I don't press, it returns 0. The value seems to be a function of time interval the key is pressed. What is the empirical relationship between the relevant quantities?

sentences:
Design question: How to handle input more efficiently? I'm designing a system to handle the keyboard input for my game. To get it more simple, I have a class that has two methods, KeyUp and KeyDown which tell me which key has been pressed, this is already implemented by the library I'm using, now I want to have a way to send that information to the classes that are handling input (I'm using an MCV pattern, those would be the controllers). I've thought of two ways of doing that, both seem valid to me, and I don't know which is better, so I'm asking which would be the best way, in terms of object-oriented design, and if it has any significant impact, also efficiency.

The first way I thought of is having the class which receives the input hold references to all the controllers, and then call some methods of those controller classes in an event-like fashion when a key event is triggered in this class.

The other method is the other way round, the controllers hold a refference to the input handler class, which in this design has some kind of data structure (I was thinking of an EnumMap) that holds the status of all the relevant game keys, and then the controller classes might query the input handler for a key with some getters (just to encapsulate the data structure).

So, that's it, I'd like some help on how to do this. Any comments on which of both is better, or a new design that might be better than this are more than welcome.

Thanks in advance.

sentences:
External gui within a render loop I was wandering how easy is to interface existing Java programs/GUIs inside a game loop. Sorry if my question is a bit vague. I'll try to explain.

I am currently designing a simulation environment for a work-station. We have the actual programs running in the real compunters (which have a java GUI and run on linux virual machines). We also have 3D models of the room, chairs, monitors, etc. We can render those in Unreal engine. Currently, I have hard-coded very simple monitor textures that represent the programs running on the computers, but ideally, the player should have have the same experience as being in the actual control room, meaning that he should be able to use the programs in the same or almost the same manner.

My question is if it is possible to interface the I/O of the actual programs within the simulation. More specifically, if it possible to render the java awt as textures for the monitors, as well as taking the player actions and feeding them in the program as inputs. The actual program code may run inside or outside the game loop (preferably outside, in its native virtual machine).

Can you please direct me to the right path, since I am only remotely familiar with game development. Thank you in advance!

Edit: Just to clarify one thing: Running the program on an external machine (virtual or physical) and feeding this machine's display to a local texture is acceptable, but I was wandering if it could be possible to use Java's GUI library output directly into the game loop (instead of the host machine). I suppose this has to be supported by the game engine (eg. having support for an in-game desktop-environment/window-manager). Unreal engine was just chosen for testing. Any engine recommendation is welcome.

sentences: How can I programmatically change a sprite's pivot without it affecting a game objects current position and rotation? Because of the complexity of positions, I am using the centre pivot for my game objects sprite. Can I possibly change the pivot without it affecting the game objects current position and rotation? or in other words, can I change the pivot while the sprite remains unchanged visibly? I would preferably like to do this using c# script.

sentences:
Purpose of Displaying Loading Screen Is it necessary for a game developer (on Android, game consoles, online, or desktop) to display the loading screen to cover unfinished rendered game environments and prevent users from thinking that this game is either lagging or freezing ?

I'm thinking if the game runs seamlessly, then, I don't need to add loading screens since it appears to be too showy or takes long for making animated presentations before the game.

Or, if displaying loading screen is a general standard required for each published game, was it okay to "cheat" by displaying a fake loading screen with any certain length of time even though the game renders smoothly? I would like to know why game developers added the loading screen during when the gameplay is started.

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:
JWJGL Multi-threading to separate update and render Introduction:

I am currently designing a game in Java using the LWJGL 3.0, with Gradle. I have quite an advanced knowledge on multi-threading, and I am aware how GLFW does/doesn't implement multi-threading from this guide. Currently, I have one class Updater with a loop for updating, and another class Renderer for rendering, each extending Runnable with their own loops and time calculations. Below is a diagram showing the structure of the classes and update and render methods. I have also set up a lock system, using the Java Lock class (again below).

My Problem:

Despite setting each thread as the current context before each loop executes its window call, and setting the current context to null at the end, I still get the error Exception in thread "RENDERER" java.lang.IllegalStateException: GLFW error [0x10008]: WGL: Failed to make context current: The requested resource is in use. Any idea as to why? Been at this for a few hours now.

Loop class:

private void threadLoop() {
    try {
        lock.lock();
        locked = true;
        loop();
        TPS++;
    } catch (InterruptedException e) {
        e.printStackTrace();
    } finally {
        lock.unlock();
        locked = false;
    }
}

@Override
public void run() {
    init();
    long lastTime = System.nanoTime();
    double ns = SECOND / (MAX_TPS/2);
    double delta = 0;
    long timer = System.currentTimeMillis();
    while (running) {
        long now = System.nanoTime();
        delta += (now - lastTime) / ns;
        lastTime = now;
        while(delta >= 1) {
            threadLoop();
            TPS++;
            delta--;
        }
        if(System.currentTimeMillis() - timer > 1000) {
            finalTPS = TPS;
            timer += 1000;
            TPS = 0;
        }
    }
    stop();
}

Thread Manager:

public void update() {
    if (window == null) return;
    window.setThread();
    window.update();
    window.nullThread();
}

public void render() {
    if (window == null) return;
    window.setThread();
    window.render();
    window.nullThread();
}

Renderer:

@Override
protected void loop() {
    if (state != null) state.render();
    threadManager.intermediateCode();
    threadManager.render();
}

Updater:

@Override
protected void loop() {
    if (state != null) state.update();
    threadManager.intermediateCode();
    threadManager.update();
}

Window:

public void setThread() {
    glfwMakeContextCurrent(getID());
}

public void nullThread() {
    glfwMakeContextCurrent(NULL);
}

public void render() {
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glClearColor(0.0f, 0.3f, 0.8f, 0.0f);
    glfwSwapBuffers(ID);
    System.out.println("Rendered window");
}

public void update() {
    glfwPollEvents();
    System.out.println("Updated window");
}

sentences:
How do I hide the bug image once it's hit by a bullet? I have almost solved my problem. I am able to shoot a bullet and hit a bug and it then draws a collision bitmap. but then it redraws a bug, I want to clear the bug bitmap after the collision happens.

public Form1()
{
    InitializeComponent();
}
public void Form1_Load(object sender, EventArgs e)
{
    timer1.Interval = 20;
    timer1.Start();
    timer2.Interval = 100;
    timer2.Start();
    this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer, true);
}
int x = 0, y = 0;
Bitmap bug_one = new Bitmap("bug_one.bmp", true);
Bitmap ship = new Bitmap("ship.bmp", true);
Bitmap bullet = new Bitmap("bullet.bmp", true);
Bitmap coll = new Bitmap("coll.bmp", true);
Bitmap black = new Bitmap("black.bmp", true);
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
    if (e.KeyCode == Keys.Left)
    {
        x-=5;
        if(x<=-350)
        {
            x = -350;
        }
    }
    if(e.KeyCode == Keys.Right)
    {
        x+=5;
        if(x>=375)
        {
            x = 375;
        }
    }
    if (e.KeyCode == Keys.Space)
    {
        if (y <= -530)
        {
            y = 0;
        }
    }
}
int count = 102;
public void Form1_Paint(object sender, PaintEventArgs e)
{
    e.Graphics.Clear(Color.Black);
    e.Graphics.DrawImage(ship, 350 + x, 530);
    e.Graphics.DrawImage(bullet, 375 + x, 520 + y);
    e.Graphics.DrawImage(bug_one, 350, 0);
    if (y <= -510 && x >= -15 && x <= 15 && count > 0)
    {
        e.Graphics.DrawImage(coll, 350, 0);
        count = 0;
    }
}
public void timer1_Tick(object sender, EventArgs e)
{
    y -= 5;
    Invalidate();
}
public void timer2_Tick(object sender, EventArgs e)
{
    count--;
    Invalidate();
}

This attempt almost works: when a bullet hits a bug it draws a collision image, but then all the bugs are cleared. I only want one bug to be cleared at a time.

    public void Form1_Paint(object sender, PaintEventArgs e)
    {
        e.Graphics.DrawImage(ship, x-25, 530);
        e.Graphics.DrawImage(bullet, x, y);
        if (collision)
        {
            return;
        }
        foreach (Bug bug in bugs)
        {
            e.Graphics.DrawImage(bug_one, bug.px, bug.py);
        }
        foreach (Bug bug in bugs)
        {
            if (x >= bug.px && y >= bug.py && x <= bug.px + bug.width && y <= bug.py + bug.height)
            {
                e.Graphics.DrawImage(coll, bug.px, bug.py);
                collision = true;
            }
        }
    }

sentences:
Updating children nodes in a game engine I am writing my own small game engine (thin layer based on SDL2) in C++. My base class is Node (contains information on an entity's position, scale, rotation, etc.), And I've got two special subclasses, Layer and Scene.

Node
|_SpriteNode
|_RectNode
|_...
|_Layer
  |_Scene

A layer can have Node children. Each time the loop runs, I call the update(int timeInterval) method on the scene being rendered, and the method loops through the vector<Node*> field containing my children. Layers propagate that call to their children, etc.

This works well until I start adding/removing children during the update. My first implementation of Layer had those two methods:

void Layer::addChild(Node* child)
{
    if(!child) return;
    _children.push_back(child);
}

void Layer::removeChild(Node* child)
{
    _children.erase(child)
}

This is, of course, stupid, since removing a Node from the vector would cause a null pointer error when the update loop ( for (auto child: _chidren) ). Using an iterator instead could fix this, but when a Node calls _parent.removeChild(this), it does not know about the iterator being used for that frame.

The solution I use at the moment is having an addition and a deletion buffer in the Layer, to which new and deleted nodes are added during the frame update. Once the frame has been rendered, the Layer performs the actual insertions and deletions from its children array. It works, and I've made a Game Jam game with this, but is seems more than sketchy to me.

I have looked through Cocos2D-X source code, and they use a simple push_back() or erase() call, which makes me think I'm missing a bigger point, or some trick that prevents the iterator issue. Is there something obvious (or not) that I missed?

Sorry if the question is dumb or missing a point. I hope I documented everything enough :)

sentences:
Game objects all blue underneath I have an empty scene with a single object in it, a cube.

The cube renders initially as pink, when it has no material attached.

When I attach a material though.  Any material.  Odd things happen.

I have created some extremely basic materials, which are just colours.  Some metallic, some not.  If I apply when of these the cube does not go the colour expected.  The exception of this is the Green and Blue materials, although I suspect they're the wrong shade.

Please see below:

Why could this be happening?  My settings look pretty standard on the cube...

If I create a brand new cube and set the materials up the exact same thing happens.

I have downloaded some sample materials from the asset store, and they behave strangely too.  A brown wood/bark texture does the following:

And here is that texture, definitely no sign of blue.

There are no lights set up, and the cube is the only item live on the scene, everything else is switched off.

I have also added a camera and rendered the scene.  Same thing.

Is there some sort of ambient light setting or something I am missing quite obvious?  Really not sure what to do here.

sentences:
How do I use depth testing and texture transparency together in my 2.5D world? Note: I've already found an answer (which I will post after this question) - I was just wondering if I was doing it right, or if there is a better way.

I'm making a "2.5D" isometric game using OpenGL ES (JOGL). By "2.5D", I mean that the world is 3D, but it is rendered using 2D isometric tiles.

The original problem I had to solve was that my textures had to be rendered in order (from back to front), so that the tiles overlapped properly to create the proper effect. After some reading, I quickly realised that this is the "old hat" 2D approach. This became difficult to do efficiently, since the 3D world can be modified by the player (so stuff can appear anywhere in 3D space) - so it seemed logical that I take advantage of the depth buffer. This meant that I didn't have to worry about rendering stuff in the correct order.

However, I faced a problem. If you use GL_DEPTH_TEST and GL_BLEND together, it creates an effect where objects are blended with the background before they are "sorted" by z order (meaning that you get a weird kind of overlap where the transparency should be).

Here's some pseudo code that should illustrate the problem (incidentally, I'm using libgdx for Android).

create() {
    // ...
    // some other code here
    // ...

    Gdx.gl.glEnable(GL10.GL_DEPTH_TEST);
    Gdx.gl.glEnable(GL10.GL_BLEND);
}

render() {
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
    Gdx.gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);

    // ...
    // bind texture and create vertices
    // ...
}

So the question is: How do I solve the transparency overlap problem?

sentences:
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:
Format for storing quest data Are there any format for storing quest data that can be processed independently by third-party tools? I don't want to code quests in code, because it will be hard to update and extend them, so I just thinking about generic system that allows to submit to a task, track its stages and rules necessary to fulfill some quest conditions and completion of a quest by player.

Basically, I'd like a simple text file for the start, so that errors in description can be easily edited and committed to repository. But I also want to be able run complex queries against quest DB, such as - "for which quests this quest is prerequisite" or "in which quests this component is used" or "what quests are available for a given environment". So the structure of the field in the format is important. I can of course invent my own, but it would save me a lot of hours to start with something workable.

Is there something generic like that?

sentences:
How can I minimize visual clutter in an ASCII rougelike game? I'm currently designing an old-school rouguelike, similar to games like Nethack or Dwarf Fortress. While I love the ASCII graphical style they employ (which my game will also employ), they also suffer from visual clutter, caused by the large amount of text usually present on the screen at any given time. The graphical style of my game without clutter-reducing improvements will effectively be identical to that of Dwarf Fortress's:

I've thought up a few things which could potentially alleviate this problem, but they're probably not enough:

Separate the UI rendering and game rendering into separate "layers".
Apply a unique color filter to each layer to visually separate them.
Tone down the use of ASCII characters, and instead opt for solid coloring in some places when possible.

How can I minimize this visual clutter?

sentences:
Real Time Cloud Algorithm I want to know how the algorithm works in this game:
http://www.gametrailers.com/user-movie/cloud-the-game/45068

Especially how the game generates the real time cloud, and be able to merge with other clouds dynamically.

I tried to google some info, but was unable to find the useful information.
Probably because I used to wrong keywords

sentences:
Disable lighting in DirectX10 I'm implementing a D3D10 version of my renderer (not porting to avoid losing Windows XP support). I didn't go straight to D3D11 because MSDN and other sources recommend upgrading to 10 and then to 11.

From what I've read so far, what used to be done with IDirect3D9::SetRenderState is done in D3D10 with ID3D10RasterizerState, ID3D10BlendState and ID3D10DepthStencilState. You declare and fill a descriptor structure, tell the device to create a state object, and then bind it to the device. For example:

//D3D9
m_pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );

//D3D10
//This defines the ID3D10RasterizerStatePtr type used below
_COM_SMARTPTR_TYPEDEF(ID3D10RasterizerState, __uuidof(ID3D10RasterizerState) );
//...
ID3D10RasterizerStatePtr pRasterState;
D3D10_RASTERIZER_DESC rasterDesc;
rasterDesc.CullMode = D3D10_CULL_NONE;
if( !CheckErrorCode( m_pImpl->pDevice->CreateRasterizerState( &rasterDesc, &pRasterState ), "InitDevice", "CreateRasterizerState" ) )
    return false;
m_pImpl->pDevice->RSSetState( pRasterState );

However, now that I have to "port" the line...

 m_pd3dDevice->SetRenderState( D3DRS_LIGHTING, FALSE );

... I cannot find a related property in any of the descriptors. From what I've seen, most  examples implement lighting in HLSL, so perhaps I don't need to explicitly disable lighting, because my shaders don't do it?

This is a desktop app, no fancy Metro stuff. Using unmanaged C++.

sentences:
How can I return a Dragged Object From a Layer Group to its Original Position? I'm trying to work on a card system, I have a drag system going nicely and the cards are setup on a horizontal layer group, however, when the player drops the card outside of the "casting area" I would like it to return to it's original position before it was dragged. Because of the layer group, even though I'm storing the original position having it go back to it produces funkiness and going below the "card hand" area.

I've tried Update and Coroutine approaches using something like this:

 IEnumerator CardReturn(Transform card, Vector3 destination, float speed)
 {

     while (transform.position != destination)
     {
         card.position = Vector3.MoveTowards(
             card.position,
             destination,
             speed * Time.deltaTime);

         yield return null;
     }

transform is the object transform and destination is the original position of the object placed at the start method.

Just to be clear, I want the card to physically move back, not just snap back.

Any help greatly appreciated!

Update: I have tried swapping a place holder in the position, here are images of what happens in that case: 1. Starting hand, 2. Placeholder in position for the card when pulled, 3. What happens when the card attempts to return to that position.

sentences:
What time to display in text messages in multiplayer game? Say I'm having a multiplayer RTS game. There's a main server for each individual game and several clients connected to it. All packets are sent to server first and then server retransmits them back to clients.

Say Server is located in one time-zone and all of the clients are in different time-zones.
ClientA send a text message in chat at 12:03, what times should be stamped for other clients? Should his message be uniformely timestamped by Server (12:02) or each client should timestamp the message whenever it is recieved (12:04, 16:04, 03:03, etc..). Bear in mind, that all the messages are to be in the same order on all clients, server takes care of that.

So thats the question - use local time for each client or use global server time to timestamp chat messages?

sentences:
OpenGL 3.3 tilemap rendering techniques? I'm trying to draw regular 2D tiles to the screen from a single texture but there are a few ways to accomplish this and I don't feel like I know enough about rendering to assess the trade-offs properly.

First of all, I have potentially a lot of tiles to render. Each tile is 8-32px (depending on zoom factor) and on a Full HD monitor that's over half a million tiles (and over a million triangles) per layer, and I have two layers. While I'm not going to go out of my way to support massive screens that are zoomed all the way out, I do want a solid reliable experience for players with screens up to 2048x2048px at any zoom, which ends up being about a quarter of a million triangles (before non-tile sprites, effects, and HUD elements are added on top).

I've been getting a lot of conflicting advice on what is good and what is bad to do with regard to tilemapping... What's been the nicest method so far to work with is instancing 6 points, two triangles in a square configuration, and giving each instance a position and texture position. But now I'm told instancing with less than 100 vertices creates a lot of overhead... Using a geometry shader to produce vertices is also crazy expensive and impracticable for hundreds of thousands of triangles, apparently. Sometimes I'm told triangle strips are the say to go, but you have to add in messy degenerate triangles when you have tilemap gaps. Other times triangles are said to be better.

Do all roads lead back to a static baked in array of all corners of each tile for efficiency?

Also, when you move left, right, up, down... you need to add in more tiles to the side... but how? Is there a way to do this that isn't messy and complicated?

sentences: What is "terrain mesh generation" exactly? I'm new to computer graphics and need to know and understand what the "terrain mesh generation" is? I read about "terrain", "mesh", "terrain generation" but can't find an article named "terrain mesh generation". So is there anyone can explain "terrain mesh generation" ?

sentences:
How do I create a maze without drawing each individual line or using sprites? I am currently trying to create a maze game by following some online tutorials, and putting my own spin on them. I found a pretty good tutorial at pythonspot.com, but I am not sure what some of the code means, and if I have to use images and sprites to create this maze.

The piece that is confusing me is this:

class Maze:
    def __init__(self):
       self.M = 10
       self.N = 8
       self.maze = [ 1,1,1,1,1,1,1,1,1,1,
                     1,0,0,0,0,0,0,0,0,1,
                     1,0,0,0,0,0,0,0,0,1,
                     1,0,1,1,1,1,1,1,0,1,
                     1,0,1,0,0,0,0,0,0,1,
                     1,0,1,0,1,1,1,1,0,1,
                     1,0,0,0,0,0,0,0,0,1,
                     1,1,1,1,1,1,1,1,1,1,]

    def draw(self,display_surf,image_surf):
       bx = 0
       by = 0
       for i in range(0,self.M*self.N):
            if self.maze[ bx + (by*self.M) ] == 1:
               display_surf.blit(image_surf,( bx * 44 , by * 44))

           bx = bx + 1
           if bx &gt; self.M-1:
               bx = 0
               by = by + 1

I know that you can make a maze with 1s and 0s to print to the screen, and this is easier for me to make levels with, because I can visualize them in the 1s and 0s.

Do I have to use images like the tutorial is (display_surf.blit(image_surf)), or can I use pygame.draw to create a square for use multiple times as a wall?

I was also wondering what the self.M,  self.N, bx and by variables do

I have tried looking at other mazes, on the Internet, but they tend to either draw all of the walls as lines in individual draw statements without using 1s and 0s, or they use sprites to create the player and walls. This leads me to believe that I have to use sprites for this drawing method, but I thought I would check here to make sure. I would ask the creator of the tutorial, but I can not create an account for the website, and can not ask questions or leave comments without an account.

sentences:
Delta time causing comparison issues due to floating points I am working on a game in Game Maker Studio: 2 and am using Delta Time for the time. I understand what it is, how to get it, and how to use it, but I am running into issues when I need to make comparisons that contain values that have been modified by Delta Time.

Example: an item from my game is moving along the x-axis at 2 pixels-per-sec. at 60 frames. The speed the item is moving is then modified by Delta Time, with the x-coord of the item effectively being 'x = 2 * delta'.

Now, I want to check for when the x-coord of the item has reached a certain spot, i.e. 'if(x = "specific spot on axis") {do something}.

The "specific spot on axis" that I am looking for is an integer (no digits after the decimal), but when using delta time, the x-coord is always off by usually miniscule amounts due to adjusting its position relative the speed of change of each frame. Instead of 'x = 12', it is 'x = 12.00387562' or 'x = 11.99943345'.

Right now, I'm thinking that just rounding 'x' at end of each step is all I have to do to fix this, but I also have a nagging feeling that I am possibly missing something right in front of my face. One reason being that, If I round the x-coord at every frame, does that not make a lot of the adjustments made by Delta Time pointless? Is there a (preferably easy and/or concise) way to do comparisons looking for values inside a certain range of digits after the decimal?

All help and insight is appreciated.

sentences:
glGenerateMipmap confusion I'm trying to get a grip on mipmaps with OpenGL. I believe I understand the concept, but when trying to have OpenGL generate them I wonder how it determines how many mipmaps to generate?

Here's what I'm running with right now to initialize a 2d texture:

    glGenTextures(1, &mTexture);
    glBindTexture(GL_TEXTURE_2D, mTexture);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA , textureWidth, textureHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, &textureData[0]);
    glGenerateMipmap(GL_TEXTURE_2D);
    glBindTexture(GL_TEXTURE_2D, 0);

Nowhere do I specify how many mipmap levels to generate. How many mipmaps are generated in this case? Where do you specify this number?

I've also seen another technique from http://www.opengl.org/wiki/Common_Mistakes where you use glTexStorage2D to specify all the mipmaps levels instead - but how many levels can you specify and what is a reasonable number for quality?

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:
How can I move an object diagonally on Windows Phone? I want to pull a sprite from point A(vector2) to point B(vector2) in my Windows Phone XNA game. GestureType.HorizontalDrag moves it horizontally and GestureType.VerticalDrag moves it vertically, how can I move the sprite diagonally?

The player should be able to pull the sprite in every direction if he touches the sprite with his finger. The sprite can't be moved if the player's finger isn't on the sprite.

How can I do that? How can I move an object diagonally on Windows Phone?

sentences:
“Play Now” via website vs. download & install I've spent some time looking over the various threads here on GDSE and also on the regular Stackoverflow site, and while I saw a lot of posts and threads regarding various engines that could be used in game development, I haven't seen very much discussion regarding the various platforms that they can be used on.

In particular, I'm talking about browser games vs. desktop games.

I want to develop a simple 3D networked multiplayer game - roughly on the graphics level of Paper Mario and gameplay with roughly the same level of interaction as a hack & slash action/adventure game - and I'm having a hard time deciding what platform I want to target with it. I have some experience with using C++/Ogre3D and Python/Panda3D (and also some synchronized/networked programming), but I'm wondering if it's worth it to spend the extra time to learn another language and another engine/toolkit just so that the game can be played in a browser window (I'm looking at jMonkeyEngine right now).

Is it worth it to go with engines that are less-mature, have less documentation, have fewer features, and smaller communities* just so that a (possibly?) larger audience can be reached? Does it make sense to even go with a web-environment for the kind of game that I want to make? Does anyone have any experiences with decisions like this?

(* With the exception of Flash-based engines it seems like most of the other approaches have downsides when compared to what is available for desktop-based environments. I'd go with Flash, but I'm worried that Flash's 3D capabilities aren't mature enough right now to do what I want easily. There's also Unity3D, but I'm not sure how I feel about that at all. It seems highly polished, but requires a plugin to be downloaded for the game to be played -- at that rate I might as well have players download my game.)

For simple & short games the Newgrounds approach (go to the site, click "play now", instant gratification) seems to work well. What about for more complex games? Is there a point where the complexity of a game is enough for people to say "OK, I'm going to download and play that"?

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:
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:
Problem with Update(GameTime) Methods and Pause implementation I have the pause function implemented and it works correctly in that it dims the player screen and stops updating the gameplay.

The problem is that GameTime continues to increase while it is paused, so my method that checks gameTime versus previousSpawnTime before spawning another enemy gets messed up and if the game is paused too long it is noticeable that the next enemy draws far too early.

Here is my code for the enemy update.

private void UpdateEnemies(GameTime gameTime)
    {
        // Spawn a new enemy every 1.5 seconds
        if (gameTime.TotalGameTime - previousSpawnTime > enemySpawnTime)
        {
            previousSpawnTime = gameTime.TotalGameTime;

            // Add an Enemy
            AddEnemy();
        }
...

I also have other methods that depend on gameTime.  I've tried getting the total pause time and subtracting that from the total game time, but I can't seem to get it to work correctly if that is the way I should go about solving this.

If you need to see any other code let me know.  Thank you.

sentences:
How to render polygons of arbitrary shape? I am trying to render a plane with nodes.

FYI : Nodes know what other nodes it is being attached to.

I can think of a way to render them as long as they are aligned in a circular pattern; have a center and draw triangles. However I want the shape to be not necessarily circular.

I have a picture below to enhance my description. Attempting to draw such a vertices with my previously stated method will result into an undesired shape, like the third picture.

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:
Remove bullets from sprite Group I'm having an issue with removing objects from a sprite Group.  What is happening is I have a bullet class and every time the user presses  the player shoots a bullet.  I have 'alive = bool' code and all works great so long as only one instance of bullet is in the list.  If multiple are in the list however only the last one gets removed.  Does anyone know how I can fix this?

elif event.key == pygame.K_SPACE:
                # Fire a bullet if the user clicks the mouse button
                bullet = Bullet()
                bullet.bullet = bullet
                # Set the bullet so it is where the player is
                bullet.rect.x = player.rect.x + 9
                bullet.rect.y = player.rect.y
                # Add the bullet to the lists
                bullet_list.add(bullet)
                all_sprites_list.add(bullet)
                print(len(bullet_list))

    if bullet.alive == False:
        bullet_list.remove(bullet)
        all_sprites_list.remove(bullet)

#In the class
# If the bullet goes off the screen remove it
    if self.rect.y < 200:
        self.alive = False

I have it set to 200 at the moment for testing purposes.

Any help or a better way of doing this would be very much appreciated.  Thank you in advance.

sentences:
Large Scale GIS in a AAA-Quality Game Engine? (Unreal, Cryengine, Unity, Etc.) I am working on a new simulation project that requires large scale, real-world terrain and imagery (GIS).  By large scale, I mean that I would like to support databases that cover something on the order of 10,000 square miles that include at least height data and satellite imagery.  Using data of this size also means that the engine must be capable of managing the coordinate systems/projections such that some reasonable precision can be maintained.

To my knowledge OpenSceneGraph is the only graphics engine out there that makes this easy (via paged terrain support, osgEarth, etc.)  However, it would be nice to be able to leverage many of the other great features AAA-quality game engines bring to the table.  (OSG is just a graphics engine, really.  I've been using it for over a decade, but I don't want to be fixed only to what I know.)

I've seen many tutorials online for importing small postage-stamp sized bits of terrain into Unreal.  I haven't seen anything on this scale.

Asked here: "Very large terrains in Unreal-4" there is a link to Unreal's "World Composition" feature.  This seems to shift coordinates around and also doesn't seem geared towards using real-world data.

How can I represent real-world terrain data on these scales in a mainstream game engine?

sentences:
Dynamic entities using classes and objects I'm trying to create a program which involves the creation of several characters/entities.

At the moment I have a Base Entity class an Entities class and a Main class. I can handle one entity alright, however I am trying to create each one editable through a standard function call.

Main Class: http://pastebin.com/AjgEBSke
Entity Class: http://pastebin.com/5y2wD3Qc
BaseEntity Class: http://pastebin.com/VfqRgeng

I feel a little confused on how to dynamically call and edit each specific character without limiting myself to lots of 'if' statements. I have tried to restart this project several times...

Basically I'm creating a private object in a class. That class will be used to talk to that private object, Save, load and edit etc.

Then in a seperate Entities class I create an instance of that object, this is where I think im getting caught up. As far as I know, I need to handle everything I want to do in that entity in this entity class.

I give the entity/object an ID, and a default name which I want to be able edit later. I also want to eventually be able to call that entity from other classes to 'draw' it, have it return the values I need to draw it, Name, body type etc (other variables in the object).

I have managed to interact with a specific instance of the object class by checking if the String is equal to an objects ID and then doing something, this however I feel is not dynamic and I'll just get into a bigger mess.

Ideally I think I want to be able to enter the object's class' instance name as a string and have it handle everything.

Sorry this has been rather long, if you know of any articles or information on how I'd learn to create dynamic entities to do what I need to do, that'd be great.

Im probably looking more for an explanation of the concept of what I'm trying to do as i've only just really sketched up this code. So this code might be a little pointless at the momemnt. Ive attempted it a few times, trying to set things up better each time, however ultimately fail when I try to make things behave dynamically. If i'm going about this completely the wrong way then please tell me as I'm still learning and don't want to get into the habit of doing things badly.

sentences:
Problem to change window view dragging the mouse I'm having a bad time trying to change the window view by dragging the mouse. I can precisely do that with the method:

void PlayScreen::MenuView(sf::RenderWindow& window)
{
    while (sf::Mouse::isButtonPressed(sf::Mouse::Left))
    {
        old_mouse_position = new_mouse_position;
        new_mouse_position = sf::Mouse::getPosition(window);

        game_view.move(new_mouse_position.x - old_mouse_position.x, new_mouse_position.y - old_mouse_position.y);
    }
}

The problem is that the view is updated, (when I release the mouse, it's drawn in the correct position) but it's not drawn as I move the mouse. My gameLoop only draw after all the updates are made, and I was trying to keep the logic that way. Everytihng works fine if I draw inside MenuView while.

my Gameloop is quite simple:

while (main_window.isOpen())
{
    while (main_window.pollEvent(event))
    {
        GameOptions(event);
        DrawGame();
    }
}

Inside the GameOptions(event) there is a:

if (event.type == sf::Event::MouseButtonPressed)
{
    new_mouse_position = sf::Mouse::getPosition(window);
    if (sf::Mouse::isButtonPressed(sf::Mouse::Left))
    {
        MenuView(window);
    }
    break;
}

I've tried without the while inside the MenuView, but it just don't work.

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:
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:
Race condition implementing World Boss System in Web Browser MMO using PHP I am trying to create a world boss system using PHP. But I am having a problem with how to account for all the damage while updating the health of the boss in real-time.

The current damage process is as follows:

Get boss' current HP from database.
Reduce the HP based on the calculated damage.
Update the boss' HP to database.

Example:

Player 1 (P1) attacks the boss. Calculated damage is 10.
The boss' current HP is saved to variable $boss_hp which is 100.
It will now be $boss_hp -= 10. Which is 90.
The boss' HP in database is then updated.

Now, imagine two player attack the boss simultaneously...

P1 attacks the boss. Calculated damage is 10.
The boss' current HP is saved to variable $boss_hp which is 100.
It will now be $boss_hp -= 10. Which is 90.
Before P1 updates the boss_hp in database, P2 also damages the boss.
P2 saved the boss' current HP to his/her own $boss_hp variable which is 100 at the moment.
P2 also performs step 2. $boss_hp -= 10. Which is also 90.
P1 now updates the boss_hp in database (=90).
P2 also updates the boss_hp in database (=90).

The boss_hp should be 80 but the damage of P1 has been neglected since P2 updates the boss_hp last.

How to avoid this problem?

sentences:
Getting position of a coordinate on the surface of a sphere So I want to create a object B close to another object A, but I'm trying to avoid that A covers B:

I have thinking how to achieve that. Take a look of the following drawing:

I have been thinking in a solution in a math - geometry way before searching for some Unity3D function to solve the problem. I have realise A and B would be on the same surface if the camera is within a sphere with radius c-A. So I guess the solution can be related to get a point at a B at a distance A-B from A on the surface of the sphere with radius c-A. Does it has sense? Any other idea? How to do it with maths and Unity?

sentences:
Civilization 4: time in own scenario runs up too quickly In Civilization 4 (Beyond the Sword) I started making a scenario that focuses on the colonization of North America. For added realism, I set the StartYear=1780.
Everytime I run the scenario, the time runs up far too quickly–probably because I set Era=ERA_ANCIENT and GameTurn=0–so that after just twenty turns the clock nears present day.

I'm not really sure how to go fix this, other than by playing an actual marathon game from the start up to the year 1780 and copy over the values.

Is there any way to calculate/know the right values for my scenario?

sentences:
FSM AI design with no accept states I'm new to game development and design, I've been looking forward to doing FSM AI design as it seems interesting to me, but I have a question that I see no answer for in the internet.

I've seen FSM diagrams from, for example, Pac-Man, and I noticed that the FSM has no accept states, it makes sense because the enemies are always active and in their different states (Wandering, chasing Pac-Man, running from Pac-Man, recovering in their house) What obviously stops the FSM of the enemies in Pac-Man is either Pac-Man dying or the level ending, but that seems more like brute force than a design decision.

I can imagine some FSM where the enemy just "dies" and that would be an acceptation state as it ended it's process, but again, in many sources I see that some designs just have no accept states. Could someone explain why is this?

Also, what would you do to prevent no-accept states FSM?

sentences:
Using fixed timestep and interpolating states makes physics fall behind one frame. Does that affect responsiveness? The title says it all, but let me build more into the question:

I suppose everyone by now knows the Fix Your Timestep article, and its proposal to free your physics engine steps from your rendering steps. Which you can accomplish by accumulating time generated by the renderer and consuming it in fixed step sizes.

The interesting part is that Glenn Fiedler tells you to interpolate the previous and the current frame, which lead me to the following question:

Doing such will make the rendering lag one frame behind the physics. Won't that affect my input responsiveness? Since I'll take one more frame to see the results of my actions.

One may be inclined to say that one frame doesn't make that much of a difference, but then, these three articles of Mick West, one of the founders of Activision and former programmer of "Tony Hawk's Pro Skater" series says otherwise:

Pushing Buttons
Measuring Responsiveness in Games
Programming Responsiveness

So again, the question: Interpolating the previous and current frame, will make me lag one frame behind. Will that hurt my input responsiveness?

sentences:
Unity IAP through Google Play is forgotten after a day without internet connection I am trying to make a NonConsumable IAP purchase persist without internet connection.

I have implemented the IAP system from Unity 5.6 through Google Play for a NonConsumable item and it is working. From a previous question I learned how to avoid using Unity's PlayerPrefs to remember purchases in favor of checking the receipt from the Unity storeController that initializes with Unity's API code below.

   public void OnInitialized (IStoreController controller, IExtensionProvider extensions)
        {
            this.controller = controller;
            this.extensions = extensions;
        }

What I have observed is that the OnInitialized will run without internet connection as long as it has recently been initialized. This seems to be cached somewhere within Android because clearing the cache on my app will not force the purchase to be forgotten. The problem is after about half a day without internet connection the controller cannot initialize. Therefore I cannot check the item receipt in the controller with the code below.

Product product = storeController.products.WithID(productId);
 if (product != null && product.hasReceipt)
 {
     // Owned Non Consumables and Subscriptions should always have receipts.
     // So here the Non Consumable product has already been bought.
     itemBought = true;
 }

What strategy or method should I use to persist a NonConsumable purchase during times without internet connection as it is recommended to not use Playerprefs on numerous guides.

sentences:
LibGDX Game vs ApplicationAdapter When I create a new LibGDX project the main class of Core project extends ApplicationAdapter.
Here is how it looks like.

package com.marimba.apptest;

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;

public class AppMain extends ApplicationAdapter {
    @Override
    public void create () {

    }

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

    }
}

So I have to change the ApplicationAdapter to Game if I want to call setScreen method in order to switch between Screens. So what is the use of ApplicationAdapter ? When shall I use it ?

sentences:
Collision detection for an arc of a circle So how do I implement the collision detection for an arc of a circle? Will I have to use the Box 2D collision or can I do it some other way using Rectangle or stuff like that?

BTW I hate box2d because I don't understand most of the things in it, so if there is a solution that excludes the box2d, it will be very much appreciated.

The yellow arc keeps on rotating over the black circle. How do I implement collision detection in here?

sentences:
How important do you find exception safety to be in your C++ code? Every time I consider making my code strongly exception safe, I justify not doing it because it would be so time consuming. Consider this relatively simple snippet:

Level::Entity* entity = new Level::Entity();
entity->id = GetNextId();
entity->AddComponent(new Component::Position(x, y));
entity->AddComponent(new Component::Movement());
entity->AddComponent(new Component::Render());
allEntities.push_back(entity); // std::vector
entityById[entity->id] = entity; // std::map
return entity;

To implement a basic exception guarantee, I could use a scoped pointer on the new calls. This would prevent memory leaks if any of the calls were to throw an exception.

However, let's say I want to implement a strong exception guarantee. At the least, I would need to implement a shared pointer for my containers (I'm not using Boost), a nothrow Entity::Swap for adding the components atomically, and some sort of idiom for atomically adding to both the Vector and Map. Not only would these be time consuming to implement, but they would be expensive since it involves a lot more copying than the exception unsafe solution.

Ultimately, it feels to me like that time spent doing all of that wouldn't be justified just so that the a simple CreateEntity function is strongly exception safe. I probably just want the game to display an error and close at that point anyway.

How far do you take this in your own game projects? Is it generally acceptable to write exception unsafe code for a program that can just crash when there is an exception?

sentences:
Modern techniques for spriting I would like to know the flow for making modern 2D game artwork.

How are the assets made nowadays? Bitmap? Vector-based? Hand-drawn and painted? Drawn digitally? Modeled in 3D and exported to bitmaps?

I would like some information on programs as well, for fine looking art.
Why does Flash's vector art style look good in most games? How do I make equivalent graphics with external tools? Or equaly good and not vector-based, anyway.

Any special hints for animating?

An answer oriented towards a one-man-army indie developer with little experience but some artistic sense would be appreciated! Not a complete dummy with paint programs, but also not a master at all, just need efficient ways to achieve results.

Thanks.

NOTE: Pixel art is not the goal of this question, nothing related to direct pixel manipulation should be brought up here, but you're free to do exactly that :)

sentences:
Fixed timestep with interpolation in AS3 I'm trying to implement Glenn Fiedler's popular fixed timestep system as documented here:

http://gafferongames.com/game-physics/fix-your-timestep/

In Flash. I'm fairly sure that I've got it set up correctly, along with state interpolation.

The result is that if my character is supposed to move at 6 pixels per frame, 35 frames per second = 210 pixels a second, it does exactly that, even if the framerate climbs or falls.

The problem is it looks awful. The movement is very stuttery and just doesn't look good.

I find that the amount of time in between ENTER_FRAME events, which I'm adding on to my accumulator, averages out to 28.5ms (1000/35) just as it should, but individual frame times vary wildly, sometimes an ENTER_FRAME event will come 16ms after the last, sometimes 42ms.

This means that at each graphical redraw the character graphic moves by a different amount, because a different amount of time has passed since the last draw. In theory it should look smooth, but it doesn't at all. In contrast, if I just use the ultra simple system of moving the character 6px every frame, it looks completely smooth, even with these large variances in frame times.

How can this be possible? I'm using getTimer() to measure these time differences, are they even reliable?

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:
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: Random generation of realistic human faces What would be a practicable way of generating huge numbers of realistically looking human faces? Randomizing 3D-models and rendering them would require a lot of computing power, especially as I'm needing them on an ad-hoc basis. Layering individual 2D-drawn parts requires some artistic talent, which I'm definitely lacking. Also, I'd like to parameterize as many aspects of the generational process as possible. Do you have any suggestions how to go about this?

sentences:
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:
How can I prevent a GameObject within a ScrollView from moving? I have a ScrollView.  It has children, most of which I want to scroll, but some of which I want to remain still.  Think of something along the lines of a spreadsheet where the title rows/columns don't move.

I have somewhat succeeded, as the GameObjects I want to stay in their place do, but they are fighting the ScrollView to move.  It forces them to jitter every time I scroll.  Here is my current code:

private Vector3 originalPosition = Vector3.zero;

private IEnumerator Start()
{
    yield return new WaitWhile(() => transform.position == Vector3.zero);
    originalPosition = transform.position;
}

private void OnGUI()
{
    if (originalPosition == Vector3.zero)
    {
        return;
    }
    transform.position = originalPosition;
}

What is causing it to jitter?  And how can I fix it?

(The reason I am waiting to start updating is because my GameObject originally thinks its position is (0, 0, 0)...not sure why.  Maybe its related?)

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

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

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

        NetworkServer.RegisterHandler<PlayerInfo>(CreateLobbyCharacter);
    }

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

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

        conn.Send(info);
    }

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

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

        NetworkServer.AddPlayerForConnection(conn, gameobject);
    }
}

sentences:
Vector out of range (Batch rendering & opengl) So ive (tried to) implement a batch rendering system, and at the for loop the error pops up and I'm not shure what ive done wrong. Any suggestions to improve the system would be much appreciated. (It's my first time trying to implement this)

#include "masterRenderer.h"

masterRenderer::masterRenderer() {
    quad = vector<Quad>(1000);
    numOf = 0;
}

void masterRenderer::addQuad(Quad quad) {
    masterRenderer::quad[numOf] = quad;
    numOf++;
}

void masterRenderer::init(GLuint shader, string texPath) {
    vector<GLfloat> vertex((3 * 4) * (numOf + 1));
    vector<GLfloat> normals((3 * 4) * (numOf + 1));
    vector<GLfloat> color((3 * 4) * (numOf + 1));
    vector<GLfloat> uv((2 * 4) * (numOf + 1));

    int nv = 0, nn = 0, nc = 0, nu = 0;

    GLfloat sizeV = 0, sizeN = 0, sizeC = 0, sizeUv = 0;

    for (int i = 0; i < numOf; i++) {      // The error seems to pop up over here.
        for (int j = 0; j < 3 * 4; j++) {
            vertex[nv] = quad[i].g_vertex_buffer_data[j];
            sizeV += quad[i].g_vertex_buffer_data[j];
            nv++;
            normals[nn] = quad[i].g_normal_buffer_bata[j];
            sizeN += quad[i].g_normal_buffer_bata[j];
            nn++;
            color[nc] = quad[i].g_color_buffer_data[j];
            sizeC += quad[i].g_color_buffer_data[j];
            nc++;
        }

        for (int j = 0; j < 2 * 4; j++) {
            uv[nc] = quad[i].g_uv_buffer_data[j];
            sizeUv += quad[i].g_uv_buffer_data[j];
            nc++;
        }
    }

    TextureID = glGetUniformLocation(shader, "textureSampler");
    texture_handle = Util::loadTexture("test.png");

    glGenBuffers(1, &normalbuffer);
    glBindBuffer(GL_ARRAY_BUFFER, normalbuffer);
    glBufferData(GL_ARRAY_BUFFER, sizeof(sizeN), &normals[0], GL_STATIC_DRAW);

    glGenBuffers(1, &colorbuffer);
    glBindBuffer(GL_ARRAY_BUFFER, colorbuffer);
    glBufferData(GL_ARRAY_BUFFER, sizeof(sizeC), &color[0], GL_STATIC_DRAW);

    glGenBuffers(1, &uvbuffer);
    glBindBuffer(GL_ARRAY_BUFFER, uvbuffer);
    glBufferData(GL_ARRAY_BUFFER, sizeof(sizeUv), &uv[0], GL_STATIC_DRAW);

    glGenBuffers(1, &vertexbuffer);
    glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
    glBufferData(GL_ARRAY_BUFFER, sizeof(sizeV), &vertex[0], GL_STATIC_DRAW);
}

void masterRenderer::draw(glm::mat4 Model, glm::mat4 View, glm::mat4 Projection, GLuint MatrixID) {
    glPushMatrix();
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, texture_handle);
    glUniform1i(TextureID, 0);
    glEnableVertexAttribArray(0);
    glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
    glEnableVertexAttribArray(1);
    glBindBuffer(GL_ARRAY_BUFFER, colorbuffer);
    glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
    glEnableVertexAttribArray(2);
    glBindBuffer(GL_ARRAY_BUFFER, uvbuffer);
    glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 0, (void*)0);
    glEnableVertexAttribArray(3);
    glBindBuffer(GL_ARRAY_BUFFER, normalbuffer);
    glVertexAttribPointer(3, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
    for (int i = 0; i < numOf + 1; i++) {
        Model = glm::translate(glm::mat4(1.0f), glm::vec3(quad[i - 1].pos.x, quad[i - 1].pos.y, quad[i - 1].pos.z));
        Model = glm::rotate(Model, glm::radians(quad[i-1].yrot), glm::vec3(0.0f, 1.0f, 0.0f));

        glm::mat4 mvp = Projection * View * Model;
        glUniformMatrix4fv(MatrixID, 1, GL_FALSE, &mvp[0][0]);
        glDrawArrays(GL_QUADS, 4 * i - 1, 4 * i);
    }
    glDisableVertexAttribArray(0);
    glDisableVertexAttribArray(1);
    glDisableVertexAttribArray(2);
    glDisableVertexAttribArray(3);
    glPopMatrix();
}

masterRenderer::~masterRenderer() { }

sentences:
Terrain Destruction Accuracy I am making a game in unity that allows you to destroy terrain, The problem I am having is that the farther away that I get from the origin (0,0), The more inaccurate the point where the destruction occurs is. Is there a way to make it more accurate?

// Use this for initialization
void Start ()
{
    //The width and height of the heightMap
    xRes = TerrainMain.terrainData.heightmapWidth;
    yRes = TerrainMain.terrainData.heightmapHeight;

    //Getting the heightMap points
    saved = TerrainMain.terrainData.GetHeights(0, 0, xRes, yRes);
    heights = TerrainMain.terrainData.GetHeights(0, 0, xRes, yRes);
}

void TerrainDestruction()
{

    Vector3 actualPosition;

    actualPosition.x = MyPosition.x;
    actualPosition.y = MyPosition.y;
    actualPosition.z = MyPosition.z;

    //Getting the x and y position of the player
    int xPosition = (int)(actualPosition.x);
    int zPosition = (int)(actualPosition.z);

    Debug.Log("x: " + xPosition);
    Debug.Log("z: " + zPosition);

    heights[zPosition, xPosition] -= 0.001f;

    TerrainMain.terrainData.SetHeights(0, 0, heights);

    TerrainMain.terrainData.SetHeights(0, 0, heights);

}

void OnApplicationQuit()
{
    TerrainMain.terrainData.SetHeights(0, 0, saved);
}

// Update is called once per frame
void Update ()
{
    //Getting the actual Position of the player with respect to the terrain
    MyPosition = MyMouse.mousePosition;

    if (Input.GetMouseButtonDown(0))
    {
        TerrainDestruction();
    }
}

sentences:
C# Unity - Getting which function affects a GameObject I have this little code that moves a GameObject over time:
 public void Move(Transform from, Transform to, float overTime)
     {
         StartCoroutine(_Move(from, to, overTime));
     }
     IEnumerator _Move(Transform from, Transform to, float overTime)
     {
         Vector2 original = from.position;
         float timer = 0.0f;
         while (timer < overTime)
         {
             float step = Vector2.Distance(original, to.position) * (Time.deltaTime / overTime);
             from.position = Vector2.MoveTowards(from.position, to.position, step);
             timer += Time.deltaTime;
             yield return null;
         }
     }

Which is easy as it is, I plan to use it for UI animations. However, things get interesting when I wish to use this for a bit more complex animations, or I want it to stop upon restart.
More complex animations:
I click a button which then moves to the side and bounches back. For this I need to know when the exact same method finished moving the button so I can restart it to bounce back.
Stop upon restart:
Say I hover my mouse over a button which moves then. However, if it's still moving, I want its current animation to stop, and a new one to start. For both of these I need to know which function affects which GameObject so I can manage that. Question is, how? Shall I use one script on each of the animated components which affects only that one? Or if I could use only one script on the whole Canvas, then how?

sentences:
Everything is set to Bounciness 0 - Why am I still bouncing? I am creating a platformer where rather than manipulating the character to get them from the beginning of the level to the end, you manipulate the world.  Thus, when you want to make the character 'jump' over a gap, you actually use the land like a slingshot and 'fling' them.

This is all working well and good save for one thing - whenever I pull my land down and my player falls into it again, it begins to bounce - aggressively so!

I have made EVERYTHING out of a new physics material with 0 bounce, and I set my default physics to 0 bounce.

My player is a rigidbody2D that is moving itself along on top of other rigid bodies.

What gives? Why, even though EVERYTHING is set to 'no bouncing allowed' does my game turn into a bouncy-house whenever i start to play?

EDIT: Here is a video of the behavior:

FlingyJump - Bouncing Issues

EDIT: I have noticed a correlation to the bounce occurring and the spring being active.  It have noticed that two things are happening:

1) The spring is for some reason transferring force through to the ground piece while being stretched out.

2) The player is bouncing before even ever hitting the ground.  I don't know quite how that is possible but it seems like as soon as it is enters the original position of the rigidbody2D for the ground piece it bounces.

sentences:
Approaches on detecting if a car should steer left or right considering a next direction I'm developing the A.I. of my racing game, and I'm having an unforeseen problem. I manage to get the bot to drive by itself by accelerating in the direction of an angle that is returned using the atan2 trig function considering the position of previously-defined waypoints on the track data structure. Here's the code for ai.py:

import math
import pygame

class Bot:

    def __init__(self, player, track):
        self.player = player
        self.track = track
        self.current_waypoint = 1
        self.player.states[0] = True
        self.track.choose_waypoint_path()
        self.number_of_waypoints = len(self.track.waypoint_positions.keys())
        self.get_waypoint_angle()

    def get_waypoint_angle(self):
        self.dx = self.track.waypoint_positions[self.current_waypoint][0] - self.player.car.pos[0]
        self.dy = self.track.waypoint_positions[self.current_waypoint][1] - self.player.car.pos[1]
        self.ratio = math.atan2(self.dy, self.dx)
        self.angle = -self.ratio * (180/math.pi)

    def think(self):
        if pygame.Rect(self.player.car.pos, self.player.car.dimensions).collidepoint(
            self.track.waypoint_positions[self.current_waypoint][0],
            self.track.waypoint_positions[self.current_waypoint][1]
        ):
            self.track.choose_waypoint_path()
            self.number_of_waypoints = len(self.track.waypoint_positions.keys())
            if self.current_waypoint == self.number_of_waypoints:
                self.current_waypoint = 0
            self.current_waypoint += 1
        self.get_waypoint_angle()
        self.player.car.angle = self.angle
        self.player.car.rotate()
        self.player.move()

The thing is, when I set the car angle based on the return of the atan2 function, self.player.car.angle = self.angle, the car rotates/turns in an extremely unrealistic fashion. It works, but it means that I have to gradually steer the car, and then I face this problem. I don't know when to steer left or right, because the angle can be negative. If I do this, for example:

        if self.player.car.angle > self.new_angle:
            self.player.car.angle -= self.player.car.steering_speed
        else:
            self.player.car.angle += self.player.car.steering_speed

The bot drives to the next waypoint destination by weirdly driving in circles.

So, I know the direction in which the bot should drive, but based on its previous angle, I don't know whether it should steer left or right to reach that direction.

sentences:
How are Spot It cards generated? Spot It is a card game 55 cards. Each card has exactly 8 symbols on it (though the total number of different symbols used in the 55 card set is 57). For any two cards in the deck, they share exactly one symbol. For example:

What is the algorithm behind building this deck? Intuitively I think there is a formula for creating a deck of N cards, with I symbols per card and using J total symbols.

For the life of me I cannot figure it out.

Can it be done?

sentences:
Preload scene in unity I have a game with two scenes, menu and maingame. I have uploaded the game to googleplay. However when I open the game and click on the play button in the menu scene, the next scene (maingame) takes about 4-5 seconds to load. Is there any way to load the maingame along with the menu so that there is no delay in loading?
EDIT
I have added code to the MainMenu.cs file so that when the game starts the LoadSceneAsync function is called and allowSceneActivation is set to false. Once the "play" button is pressed, the activation is set to true. The first time the game loads, there is still a bit of delay however if the player dies and I go the main menu and press play again, there is no delay.
AsyncOperation async;

void Start()
{
    async = SceneManager.LoadSceneAsync(1);
    async.allowSceneActivation = false;
}

public void PlayBtnPressed()
{
   async.allowSceneActivation = true;
   AudioManager.audiomanager.Play("PlayButton");
}

sentences:
Efficient communication between entities using ECS via entt To avoid confusion about the ECS terms I'll use, I explain them here quickly. I use entt terminology and set-up my architecture like this:

Entity: is only an id (entt::entity)
Component: is a struct holding plain data (int, floats, etc.)
System: is a function looping over a family of components (using entt::registry.view)

In my game, I model a space ship that can have multiple engines. The engines apply a force on the ship each frame so the ship accelerates. I implemented it like the following:
Ship is an entity, Engine is an entity. Ship has the components AppliedForces, Mass and Velocity. Engine has the components Parent and Thrust. Parent is a component containing the parent's id of the engine (in this case a ship entity).
I have two systems: ThrustSystem goes through all entities that have the components Thrust and Parent. It looks up the AppliedForces component of the parent and adds the thrust vector to it. Then the AccelerationSystem runs through all entities with the components AppliedForces, Mass and Velocity. It adds the applied forces to entity's velocity. In code, it looks like this:

void ThrustSystem::update(entt::registry& entities)
{
  auto view = entities.view<Thrust, Parent>();
  for (auto [thrust, parent]: view)
  {
    auto& applied_forces = entities.get<AppliedForces>(parent.id);
    applied_forces.vector += thrust.vector;
  }
}

void AccelerationSystem::update(entt::registry& entities, dt)
{
  auto view = entities.view<AppliedForces, Mass, Velocity>();
  for (auto [applied_forces, mass, velocity]: view)
  {
    velocity.vector += applied_forces.vector * mass * dt;
  }
}

This works perfectly for me, the systems are decoupled and work independently from each other and I don't experience any performance issues (I model max. 1000 ships with an average number of 4 engines each). So I will stick to this implementation in my current game.
But I am actually curious and I would like to learn more about the "correct" usage of ECS in game code: is this a recommended approach to gain high performances and avoid cache misses? This is my first project with ECS and I am not an expert in CPU stuff at all but naively-thinking I would say there are two "bottlenecks" in my code:

Look-up time for the AppliedForces component of the parent entity in ThrustSystem
The AppliedForces is probably further away from Thrust and Parent in memory. So I introduced a cache miss.

At first, are my assumptions correct? And if yes, how would one avoid these bottlenecks?

sentences:
Which collider to use on "island" situation? I have a 2d-top-down-unity game where the player is on an island. The shape of the island is random generated and he is not able to "escape" from the island.

So which Collider should I use for realizing this?

Is there some form of an "inverted" collider? Are colliders able to have a hole in them? Or should I create a polygon collider with a small gap (This could be quite difficult if the polygon bends the wrong way)?

sentences:
How to calculate vector of projectile initial velocity There are point A (origin) and point B (target). And also there is gravity vector G.
I need compute initial velocity of projectile (throwing arc trajectory from point A to point B).

Also I need to control speed of projectile (Speed) and flexion of throwing arc.

How compute this?

sentences:
multipass shadow mapping renderer in XNA I am wanting to implement a multipass renderer in XNA (additive blending combines the contributions from each light).  I have the renderer working without any shadows, but when I try to add shadow mapping support I run into an issue with switching render targets to draw the shadow maps.  When I switch render targets, I lose the contents of the backbuffer which ruins the whole additive blending idea.

For example:

Draw()
{
    DrawAmbientLighting()
    foreach (DirectionalLight)
    {
        DrawDirectionalShadowMap() // <-- I lose all previous lighting contributions when I switch to the shadow map render target here
        DrawDirectionalLighting()
    }
}

Is there any way around my issue?  (I could render all the shadow maps first, but then I have to make and hold onto a render target for each light that casts a shadow--is this the only way?)

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: Game map for platformer megaman-style game I want to make platformer game that would be sort of like megaman. I'm using SFML library for it. I have a problem with creating a map. Should I hardcode every single platform, add it colliders and so on? I've heard that 2d array of segments would be better, but I would still have to manually fil an array that's like 1000x1000 segments. Is there an easier way to approach this?

sentences:
MultiTexturing by neighbouring points textures Visual example:

I've been trying to understand multitexturing for a while now, I've created a terrain generator but have no need for height just yet and I still want one texture to blend over to another texture nicely.

I think Blau said that you only need 4 textures per vertex. My only guess then is that each point in a terrain has 4 neighbours - right? And that point is the main texture to sample from / blend from. Because it can't mean that 4 textures are all you get on a whole map in a game.

My idea is to have an "TextureID" for each point and whenever this point comes up, you load the textures in the effect with that neighbours textures.

Example (for each point):

effect.Parameters["MainTexture"].Setvalue(Content.Load<Texture2D>("MainTexture"))
effect.Parameters["TextureTopOfPoint"].SetValue(Content.Load<Texture2D>(textureID));
effect.Parameters["TextureRightOfPoint"].SetValue(Content.Load<Texture2D>(textureID));
effect.Parameters["TextureBottomOfPoint"].SetValue(Content.Load<Texture2D>(textureID));
effect.Parameters["TextureLeftOfPoint"].SetValue(Content.Load<Texture2D>(textureID));

/*
   Now the Pixel and Vertex Shader can calculate a blend effect
   from Center point to it's neighbouring points
*/

and somehow in the Effect file, blend from "Center point" to all it's neighbours. I also guess this would be a "slow" process.

Problems are:

Is this possible? I can't accept 4 textures for a whole map, so how do I manage to have multiple textures at the same time? And I don't want a solution with colors (like this) or heightmap, because I want it to be possible to have 4 or more textures on a flat surface.
How do I access each point's neighbour and when do I know when to set them?

My map contains Areas, each Area has it's own VertexBuffer and IndexBuffer.

(Example: MapWidth=4096, MapHeight=4096, each square = 128x128 = (32 * 128 x 32 * 128 grid)

public class Area
{
    public VertexPositionTexture[] Vertices { get; set; }
    public int[] Indexs { get; set; }

    public VertexBuffer GetVertexBuffer() { /* create a vertexbuffer */ }
    public IndexBuffer GetIndexBuffer() { /* creates a indexbuffer */ }
}

Edit (still not optimal)

Implemented some kind of method, but this method still relies on colors and I have no blendmap. I just use the color in the Vertex to check for a value (r, g, b, a)

Effect Code:

float4 PixelShaderFunction(VS_OUTPUT input) : COLOR
{
   float4 colour = float4(0,0,0,0);

   colour += tex2D(GroundText0Sampler, input.TexCoord) * input.Color.r;
   colour += tex2D(GroundText1Sampler, input.TexCoord) * input.Color.g;
   colour += tex2D(GroundText2Sampler, input.TexCoord) * input.Color.b;
   colour += tex2D(GroundText3Sampler, input.TexCoord) * input.Color.a;

   return colour;
}

sentences:
Genetic Algorithms - Fitness Function simple maze game Trying to lay out the best fitness function for my simple game. I'm just trying to make bots go through a bunch of obstacles in order to reach a point. If they touch an obstacle, they die, they have 10 seconds max to solve the parkour.

I'm wondering which data I should track to make the best fitness function possible.

I thought of tracking:

Time

Distance to exit from position of death or timeout

And my Fitness score would be:

Fitness = Time / (Distance + 1)

But if a bot manages to get to the end of the maze in 10s, I'm scared the following generations will all take 10s or close to it to go through the maze and not try to do it in 3 or 4s for instance.
Because he'll get the best fitness score, so he'll be the parent of most cross-overs.

Yet I didn't manage to get a working example so perhaps I'm worrying for nothing but I'd like some advice on generally how to determine such fitness functions.

sentences:
How does a subpass dependency guarantee the layout transition of a swapchain image happens after presentation engine finish reading the very image? I'm going through vulkan-tutorial:
https://vulkan-tutorial.com/Drawing_a_triangle/Drawing/Rendering_and_presentation
And I found something weired:

How does this subpass dependency guarantee the layout transition(from UNDEFINED to COLOR_ATTACHMENT_OPTIMAL)of swapchain image happens after present engine finish reading(or working on) this swapchain image?i.e.Layout transition of this swapchain image bewteen external and subpass0 guarantees to happen after the imageAvailableSemaphores is signaled.
I did find some explanations on this topics from this blog:
http://themaister.net/blog/2019/08/14/yet-another-blog-explaining-vulkan-synchronization/

External subpass dependencies Render passes in Vulkan have a concept
of EXTERNAL subpass dependencies. This is arguably the most
misunderstood aspect of Vulkan sync. I’d like to dedicate a section to
this, because too many developers are lured into using it in cases
where it’s not terribly useful and very likely to cause bugs.
The main purpose of external subpass dependencies is to deal with
initialLayout and finalLayout of an attachment reference. If
initialLayout != layout used in the first subpass, the render pass is
forced to perform a layout transition.
If you don’t specify anything else, that layout transition will wait
for nothing before it performs the transition. Or rather, the driver
will inject a dummy subpass dependency for you with srcStageMask =
TOP_OF_PIPE_BIT. This is not what you want since it’s almost certainly
going to be a race condition. You can set up a subpass dependency with
the appropriate srcStageMask and srcAcessMask. The external subpass
dependency is basically just a vkCmdPipelineBarrier injected for you
by the driver. The whole premise here is that it’s theoretically
better to do it this way because the driver has more information, but
this is questionable, at least on current hardware and drivers.
There is a very similar external subpass dependency setup for
finalLayout. If finalLayout differs from the last use in a subpass,
driver will transition into the final layout automatically. Here you
get to change dstStageMask/dstAccessMask. If you do nothing here, you
get BOTTOM_OF_PIPE/0, which can actually be just fine. A prime use
case here is swapchain images which have finalLayout =
PRESENT_SRC_KHR.
Essentially, you can ignore external subpass dependencies. Their added
complexity give very little gain. Render pass compatibility rules also
imply that if you change even minor things like which stages to wait
for, you need to create new pipelines! This is dumb, and will
hopefully be fixed at some point in the spec.
However, while the usefulness of external subpass dependencies is
questionable, they have some convenient use cases I’d like to go over:

Automatically transitioning swapchain images Typically, swapchain
images are always just used once per frame, and we can deal with all
synchronization using external subpass dependencies. We want
initialLayout = UNDEFINED, and finalLayout = PRESENT_SRC_KHR.
srcStageMask is COLOR_ATTACHMENT_OUTPUT which lets us link up with the
swapchain acquire semaphore. For this case, we will need an external
subpass dependency. For the finalLayout transition after the render
pass, we are fine with BOTTOM_OF_PIPE being used. We’re going to use
semaphores here anyways.
I also do this in Granite.

sentences:
What would be a good sport game for a beginner/intermediate game dev to make for practice? I'm interested in making a sport game for practice, but giving it some fun twists sort of like nintendo does, (super strikers charged, mario golf.)  I'm planning on using unity, but since I am by no means an expert I'm trying to figure out a sport that will be reasonably easy to create.  I'm aware that its not going to be easy, but, for instance I'm not going to make a game like madden, which would have a ton of difficult stuff like play calls which involve predetermined paths and intelligence on both sides, in general way to difficult.  What would be a good sport to try a stylized version of?
I'm aware that this is a subjective question, but it isn't a question where any answer is as good as another, so I think it's allowed according to the guideline, but correct me if I'm wrong I guess.

sentences:
Moving a platform left to right with continuous movement I made a 2D game with Unity, and I am trying to create a platform that will move from left to right continuously, but I don't know how to make the platform move a greater distance then -1 to 1 units because I use the Mathf.Sin function. I can only control the speed of the platform.

Here is my code:

private Vector2 startPosition;
private int speed;

void Start ()
{
    startPosition = transform.position;
    speed = 3;
}

void Update()
{
    transform.position =
        new Vector2(startPosition.x + Mathf.Sin(Time.time * speed), transform.position.y);
}

Here is what the code actually does:

How can I control the distance that the platform can move to each side? For now, it can only move 1 unit to each side.

sentences:
How to improve the charactercontroller for jumping? I have an issue with my character controller, when I jump, it sometimes lands on surfaces it shouldn't be able to land on, like very steep slopes etc (even though my max slope is 45 deg). In this case, Controller.isGrounded() still is true. The controller doesn't fall off the steep slopes either, it just stays there and the controller can jump again.

I also notice that the controller sometimes can climb heights very awkardly (after jumping), like it is barely touching the elevated ground surface yet it can "push move" to climb it's way up

These problems both occur in the standard implementation given by unity https://docs.unity3d.com/ScriptReference/CharacterController.Move.html

See also: https://i.imgur.com/AD6dVy2.png (here it can jump on the steep slope and stay there, UCC is the example script from unity copy pasted)

How can I fix these things? Are there any existing solutions or guides for better character controllers?

sentences:
Should I calculate in meters or pixels In my car sim I am doing my calculations in Standard Units, except for the distance which is in pixels. Is this still correct (my guess is no) or should I use Meters ?

If I should use meters what is the best way to go about it?
should I just pick a scale 10px = 1m or is there a better way to do this ?

thanks in advance.

Some additional info: I'm using Unity3D and using its physics engine.

sentences: Getting warning after importing plugin to unity5 project I am getting following warning when I import any plugin to my unity5 project.Whats the solution for this warning? Is there any problem with that which will affect my project.

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:
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 can I make a rectangle to an irregular shape? I used masking for breaking an image into the below pattern. Now that it's broken into different pieces I need to make a rectangle of each piece. I need to drag the broken pieces and adjust to the correct position so I can reconstruct the image. To drag and put at the right position I need to make the pieces rectangles but I am not getting the idea of how to make rectangles out of these irregular shapes. How can I make rectangles for manipulating these pieces?

This is a follow up to my previous question.

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: 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:
Forcing Non-Pitch Preserving Audio in HTML5, Construct 2 I'm working on a simple game built in HTML5 using Construct 2, in which a circle eats other circles; nothing fancy. The idea is that a song plays during the game, starting at a low pitch, and rising as more circles get eaten (which along with increasing movement speed, makes it pretty manic). Construct 2 has a way to set the playback speed for audio tracks (using the .ogg or aac formats for browser support), but passes the actual implementation of setting the speed to the browser used.

Since some browsers use a pitch-preserving algorithm, and others do not, the same HTML5 game may have the desired low to high pitch transition in one browser, but a artifact filled pitch-preserving version in another. I was wondering, then, is there a way to force the playback speed of the audio to act equivalently to a pitch setting, regardless of the browser used?

sentences:
Game class and main function I have a Game class with my main game functions and instances of game objects like screen, etc. My game is made using C++ and SDL.

I was wondering, though, should main be a function of my class? Or should I do "Game game;" from "int main();" and have the loop inside main?

My doubt is - if I do it from an outside-main, then most of my stuff will have to be public, and that is kinda bad, isn't it?

Any ideas? Thank you!

sentences: How can I hide the touch-screen joysticks in the main menu? I am a Unity beginner trying to make an app/game. How do I hide the touch-screen joysticks from showing on-screen in the main menu before the game/app actually starts?

sentences:
Shot em up! Vertical or Horizontal "side scrolling"? Question it’s about "Shot em up" style game (For example: Tyrian) also known as Top-Down shooters.
These games in the past mostly exist as top down concept, it means player object can move from the left to the right and enemies start appearing from the top of the screen and moving down to the screen.
This concept was probably picked due to the monitors aspect ratios in the past where was most spreaded 4:5.
Also this concept are very popular on mobile phones, because is sometimes more user friendly not using landscape mode when playing.
There was a very little titles, when the concept Top-Down are changed Right-left It means, player object is on left screen side and moving Top and Down, and the enemies moving from right to the left.  Also, there is almost no titles on desktops when current aspect ratios are mostly 16:9. Even if some new “Modern” Shot em up is released, mostly pick the Top Down concept.
And my question is, is there any reason for that on Desktops target platform?
I think for the current monitor aspect ratios 16:9 “Right-Left” better fit the gameplay and user experience. Or Am I missing something?

sentences:
Adding Color to button after cloning public GameObject button;

public void Start()
{
       GameObject button1 = Instantiate(button) as GameObject;
       button1.transform.SetParent(canvas.transform, false);
       button1.transform.position = new Vector3(7, 0, 2);
}

I have cloned the button game object now want to add color to that game object how can i do it ?

sentences:
Interactive map designer I've made a simple game in pygame/pymunk. Currently my maps consists of lists with functions, e.g

ground_segments = [ground(position, size, shape...), ...]

I have equally built up lists for planks, stones, trees etc. And althoug it works, it is a bit tideous to work with.

I tried first tried making a tile-based map editor and .txt files to read/write to, but having a grid of letter felt limiting to wha I could add. Since I had a working concept of importing lists with the information I tried to build on that, but stopped once I realised I couldn't edit the contents of map.py fromlevel_editor.py. Is there a workaround for that or do I need anothter concept? If so, any suggestions?

sentences:
Touchable Hud with Actors in Libgdx I am writing a Tower Defense for Android.
Right now my LevelScreen contains a Background-Actor which is pan-able and some zones to buy Towers - after buying them you can upgrade them further.
When you click a Zone or a Tower, a small overlay on the bottom appears (another actor) - click it to buy.
My main Problem was that the overlay stayed where you clicked and didn't move when you pan the Screen.
I solved this by changing the overlay's draw method to

batch.setProjectionMatrix(game.batch.getProjectionMatrix());
batch.draw(texture,actorX,actorY);
batch.setProjectionMatrix(levelScreen.stage.getCamera().combined);

I set it backwards for further Actors who should stay where they are - Towers for example - but I kinda don't know what I am really doing.

I am now only able to fire the touchDown Event on these actors when I pan to the bottom left of the Screen and click where the Actor's Icon is.

I tried a few things:

-Adding another Stage as a HUD(I couldn't Access the lower stage anymore or the other way around)

-Moving the actor.x and actor.y along (I was unable to even find where the actor went)

-Adding another camera (led to nothing)

-Updating the actors Position using

stage.getCamera().unproject(myPoint)

(same as when I tried to move the actor)

So, which is a good way to implement what I look for? Basically,
TL;DR:
I am looking for a way of letting some Actors stay relative to Screen while moving some Actors with the world while panning around.

I am pretty sure there a similar questions but None of them really helped me and I have restricted Internet-Access (for example I can't Access badlogicgames.com).

sentences:
Why is my sine based scale animation not changing? I followed the code at this YouTube channel: https://www.youtube.com/watch?v=OR0e-1UBEOU&t=4178s, and did some modification on the code so that the scale of the bird will change during projectile using the absolute sine function under the if statement.
I'm using the scale (16/20)*|sin(distance)| for my x and y component. However, when I launch the game, the scale stays as 0 along the path. Why is my scale staying as a constant zero?
using UnityEngine;
using UnityEngine.Assertions.Must;
using UnityEngine.SceneManagement;

public class Bird : MonoBehaviour
{
    Vector3 OldPosition;
    Vector3 DistanceDifference;
    float TotalDistance = 0;
    Vector3 _initialPosition;
    private bool _birdWasLaunched;
    [SerializeField] private float _launchPower = 500;

    void start()
    {
        OldPosition = transform.position;
    }

    private void Awake()
    {
        _initialPosition = transform.position;

    }

    void Update()
    {
        if (_birdWasLaunched && GetComponent<Rigidbody2D>().velocity.magnitude > 0.1)
        {
            DistanceDifference = transform.position - OldPosition;
            TotalDistance += DistanceDifference.magnitude;
            OldPosition = transform.position;
            transform.localScale = new Vector3((16/20)*Mathf.Abs(Mathf.Sin(TotalDistance/5)), (16/20)*Math.Abs(Mathf.Sin(TotalDistance /5)) , Mathf.Sin(TotalDistance /5));
        }

        if (transform.position.y > 15.00 || transform.position.y < -15.00 || transform.position.x > 18 || transform.position.x < -18)
        {
            string currentSceneName = SceneManager.GetActiveScene().name;
            SceneManager.LoadScene(currentSceneName);
        }
    }

    void OnMouseDown()
    {
        GetComponent<SpriteRenderer>().color = Color.red;
    }

    private void OnMouseUp()
    {
        GetComponent<SpriteRenderer>().color = Color.white;
        Vector2 directionToInitialPosition = _initialPosition - transform.position;
        GetComponent<Rigidbody2D>().AddForce(directionToInitialPosition * _launchPower);
        GetComponent<Rigidbody2D>().gravityScale = 1;
        _birdWasLaunched = true;
    }

    private void OnMouseDrag()
    {
        Vector3 newPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        transform.position = new Vector3(newPosition.x, newPosition.y);
    }
}

sentences:
How can I know how difficult a question is? I'm making a "Who Wants to be a Millionaire" style of game. I'm really stuck at the part where I should arrange questions from easy to hard.

Isn't this subjective? How can I tell how hard/difficult a question is?

sentences:
Character doesn't move anymore after gameover and clicked play When my character died it displays gameover and goes back to main menu, then if I clicked play I can see my character however I can't make it move anymore. Any suggestions?

For game over:

#pragma strict
import UnityEngine.UI;
private var StopGame: boolean=false;
private var showGUI: boolean=false;
var GUIstop: GameObject;
var StopMenu;

private var canvas : Canvas;

function Awake()
{
    canvas = GetComponent.<Canvas>();
    canvas.enabled = false;
}

function Update ()
{
    // If the player has run out of health...
    if(HealthControl.LOVES==0)
        Pause();
    //  }
}

public function Pause()
{
    canvas.enabled = !canvas.enabled;
    Time.timeScale = Time.timeScale == 0 ? 1 : 0;
    StopGame=true;
}

public function Quit()
{
    #if UNITY_EDITOR
    EditorApplication.isPlaying = false;
    #else
    Application.Quit();
    #endif
}

For character movement:

   function Update () {

       transform.rotation.z=0;

       if(Input.GetKey(KeyCode.UpArrow)){
           transform.position.y+=moveSpeed*Time.deltaTime;
       }
       else if(Input.GetKey(KeyCode.RightArrow)){
           transform.position.x+=moveSpeed*Time.deltaTime;
       }

sentences:
Add parabola curve to straight MoveTowards() movement I have some units shooting arrows, right now they move in a straight line to the target. I want them to move like a real arrow, i.e using a parabola curve. However I don't want to use physics.

The math I need to do seems to be beyond me, I've tried to convert 2d solution I found online and other semi-similar solution with no luck.

My current straight movement:

private void Update()
{
    var nextPos = Vector3.MoveTowards(transform.position, target, speed * Time.deltaTime);
    transform.LookAt(nextPos, transform.forward);
    transform.position = nextPos;

    if (Vector3.Distance(nextPos, target) < .1f)
        Arrived();
}

An example of a 2d version I tried to replicate: Here.

sentences:
How Do I Save A Value In c# Unity using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class AttemptCounter : MonoBehaviour {

    public Text AttemptText;
    public int Attempts = 1;
    public int AddAttempts = 1;

    public void AddAttempt()
    {
        Attempts = Attempts + AddAttempts;
        AttemptText.text = ("Attempts: " + Attempts.ToString(""));
        Attempts = PlayerPrefs.GetInt ("Attempts");
        PlayerPrefs.GetInt ("Attempts");
    }

    void Update()
    {
        AttemptText.text = ("Attempts: " + Attempts.ToString(""));
        PlayerPrefs.SetInt ("Attempts", Attempts);
    }
}

I Am Trying To Add a Attempts System In My Game, Every time a user will restart a level the game will add one attempt, however because when restarting the level it uses the code

SceneManager.LoadScene (SceneManager.GetActiveScene ().name);

It doesnt save the int meaning that its keeping the attempt counter on 1, can anyone help, Thanks.

sentences:
DirectX 11 - Depth Stencil not working I'm currently working on a game for university in DirectX 11.

I have tried to add in a depth buffer to my project, but since adding it in none of my objects show.

//Describe the Depth/Stencil Buffer
D3D11_TEXTURE2D_DESC db;
db.Width = Width;
db.Height = Height;
db.MipLevels = 1;
db.ArraySize = 1;
db.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
db.SampleDesc.Count = 1;
db.SampleDesc.Quality = 0;
db.Usage = D3D11_USAGE_DEFAULT;
db.BindFlags = D3D11_BIND_DEPTH_STENCIL;
db.CPUAccessFlags = 0;
db.MiscFlags = 0;

//Create Depth View
hr = g_pd3dDevice->CreateTexture2D(&db, NULL, &g_depthBuffer);
if (FAILED(hr)) {
    MessageBox(NULL, L"Error.", L"Error", MB_OK);
}
g_pd3dDevice->CreateDepthStencilView(g_depthBuffer, NULL, &g_depthView);
//g_pd3dDevice->CreateDepthStencilState(&db, &g_depthStencil); //When uncommented, the '&db' shows the following error.
//argument of type "D3D11_TEXTURE2D_DESC*" is incompatible with parameter of type "const D3D11_DEPTH_STENCIL_DESC*"

//Set Render Target
g_pImmediateContext->OMSetRenderTargets( 1, &g_pRenderTargetView, g_depthView );

    void Render()
{
    //Update our time
    static float t = 0.0f;
    if ( g_driverType == D3D_DRIVER_TYPE_REFERENCE )
    {
        t += ( float )XM_PI * 0.0125f;
    }
    else
    {
        static ULONGLONG timeStart = 0;
        ULONGLONG timeCur = GetTickCount64();
        if (timeStart == 0)
            timeStart = timeCur;
        t = (timeCur - timeStart) / 1000.0f;
    }

    //
    // Animate the cube
    //
    //g_World = XMMatrixRotationY( t );

    //
    // Clear the back buffer
    //
    g_pImmediateContext->ClearRenderTargetView( g_pRenderTargetView, Colors::MidnightBlue );
    //g_pImmediateContext->ClearDepthStencilView( g_depthView, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0 );

    //
    // Update variables
    //
    ConstantBuffer cb;
        //cb.mWorld = cube1;
    cb.mWorld = XMMatrixTranspose( cube1 );

    cb.mView = XMMatrixTranspose( g_View );
    cb.mProjection = XMMatrixTranspose( g_Projection );
    g_pImmediateContext->UpdateSubresource( g_pConstantBuffer, 0, nullptr, &cb, 0, 0 );

    //
    // Draws first square
    //

    g_pImmediateContext->VSSetShader(g_pVertexShader, nullptr, 0);
    g_pImmediateContext->VSSetConstantBuffers(0, 1, &g_pConstantBuffer);
    g_pImmediateContext->PSSetShader(g_pPixelShader, nullptr, 0);
    g_pImmediateContext->DrawIndexed(36, 0, 0); //36 vertices needed for 12 triangles in a triangle list

    ConstantBuffer cb2;
        //cb2.mWorld = cube2;
    cb2.mWorld = XMMatrixTranspose(cube2);

    cb2.mView = XMMatrixTranspose(g_View);
    cb2.mProjection = XMMatrixTranspose(g_Projection);
    g_pImmediateContext->UpdateSubresource(g_pConstantBuffer, 0, nullptr, &cb2, 0, 0);

//  g_pImmediateContext->VSSetShader(g_pVertexShader, nullptr, 0);
//  g_pImmediateContext->VSSetConstantBuffers(0, 1, &g_pConstantBuffer);
//  g_pImmediateContext->PSSetShader(g_pPixelShader, nullptr, 0);
    g_pImmediateContext->DrawIndexed(36, 0, 0);

    //cube1 = XMMatrixIdentity();

    //
    // Present our back buffer to our front buffer
    //
    g_pSwapChain->Present( 0, 0 );
}

void Update()
{
    rot += 0.0005f;
    if (rot > 6.26f)
        rot = 0.0f;

    cube1 = XMMatrixIdentity();

    XMVECTOR rotaxis = XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f);
    Rotation = XMMatrixRotationAxis(rotaxis, rot);
    Translation = XMMatrixTranslation(1.0f, 1.0f, 0.0f);

    cube1 = Translation * Rotation;

    cube2 = XMMatrixIdentity();

    Rotation = XMMatrixRotationAxis(rotaxis, -rot);
    Scale = XMMatrixScaling(0.5f, 0.5f, 0.5f);

    cube2 = Scale;
}

From what someone else had mentioned, that I'm either not creating a D3D11DepthStencilState or not clearing the depth stencil view.
I've tried to fix the problem, but no luck so far.

sentences: Does game development have its own types of modeling? In general computer science there are modeling "languages" (read: standardized diagramming techniques) such as UML 1,2, in databases there are things like ERD3, in business there are other types such as BPMN4,5. Is there anything like these that are Game Design specific?

sentences:
Spawning words based on screen size I'm creating a typing game where the words fall from the top of the screen to the bottom. How do I set the words to spawn so that they adjust to the screen size of the device. This is the code that I have:

Vector3 randomPosition = new Vector3(Random.Range(-2.5f,2.5f), 7f);
GameObject wordObj = Instantiate(PrefabWord, randomPosition, Quaternion.identity, Canvas);

But this doesn't scale properly with the size of the device.

Edit:

When I change the randomPosition to "new Vector3(Random.Range(0,Screen.width), 7f);", the words spawn all over the screen and not just within the bounds of the camera or canvas.

I have also switched the platform to android and selected 480x800 resolution. And in the old script where the random values were hardcoded from -2.5f to 2.5f, some of the words were getting clipped depending on the resolution selected.

sentences:
Is it normal in skeletal animation to NOT consider the translation component in bone transform matrices? I'm using assimp to load a model, and DirectX11 and DirectX ToolKit to render it.

In the document of DirectXTK's IEffectSkinning, it says:

  As an optimization, SkinnedEffect and DGSLEffect assume that all the
  matrices are affine transformations, and that the final column is (0 0
  0 1). This means that the value of the last column is effectively
  ignored when set into the constant buffer containing the bone
  transformations (i.e. the shaders use float4x3)

Is this the convention when implementing skeletal animation ?

Does it have negative repercussions ? If it does, what are they ?
Do some animated models require the translation components to be considered?

sentences:
iOS - pass UIImage to shader as texture I am trying to pass UIImage to GLSL shader. The fragment shader is:

varying highp vec2 textureCoordinate;

uniform sampler2D inputImageTexture;
uniform sampler2D inputImageTexture2;

void main()
{
  highp vec4 color = texture2D(inputImageTexture, textureCoordinate);
  highp vec4 color2 = texture2D(inputImageTexture2, textureCoordinate);

  gl_FragColor = color * color2;

}

What I want to do is send images from camera and do multiply blend with texture. When I just send data from camera, everything is fine. So problem should be with sending another texture to shader. I am doing it this way:

- (void)setTexture:(UIImage*)image forUniform:(NSString*)uniform {

  CGSize sizeOfImage = [image size];
  CGFloat scaleOfImage = [image scale];
  CGSize pixelSizeOfImage = CGSizeMake(scaleOfImage * sizeOfImage.width, scaleOfImage * sizeOfImage.height);

  //create context
  GLubyte * spriteData = (GLubyte *)malloc(pixelSizeOfImage.width * pixelSizeOfImage.height * 4 * sizeof(GLubyte));
  CGContextRef spriteContext = CGBitmapContextCreate(spriteData, pixelSizeOfImage.width, pixelSizeOfImage.height, 8, pixelSizeOfImage.width * 4, CGImageGetColorSpace(image.CGImage), kCGImageAlphaPremultipliedLast);

  //draw image into context
  CGContextDrawImage(spriteContext, CGRectMake(0.0, 0.0, pixelSizeOfImage.width, pixelSizeOfImage.height), image.CGImage);

  //get uniform of texture
  GLuint uniformIndex = glGetUniformLocation(__programPointer, [uniform UTF8String]);

  //generate texture
  GLuint textureIndex;
  glGenTextures(1, &textureIndex);
  glBindTexture(GL_TEXTURE_2D, textureIndex);
  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);

  //create texture
  glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, pixelSizeOfImage.width, pixelSizeOfImage.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, spriteData);

  glActiveTexture(GL_TEXTURE1);
  glBindTexture(GL_TEXTURE_2D, textureIndex);
  //"send" to shader
  glUniform1i(uniformIndex, 1);

  free(spriteData);
  CGContextRelease(spriteContext);
}

Uniform for texture is fine, glGetUniformLocation function do not returns -1. The texture is PNG file of resolution 2000x2000 pixels.

PROBLEM: When the texture is passed to shader, I have got "black screen". Maybe problem are parameters of the CGContext or parameters of the function glTexImage2D

Thank you

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:
How can I set up potentially dozens of cameras rendering to targets without killing performance? I'm thinking through how I'd do a particular trick for playing cards with animated 3D faces. Setting up a single card is pretty trivial. I would create another camera somewhere, maybe restrict some layers so it'll only show what I want it to show so I don't have to worry what's behind it, put an object in front of it that is the basis of the card, have the camera render to a texture, and put that texture on a quad (the card) with the same aspect ratio. Now whenever the main camera views the card, regardless of angle, the card displays what the other camera sees.

I don't believe this approach would scale well as I'd have to duplicate everything for every card. The way I imagine it, there could be dozens of cards visible at once so every frame would require rending all of them. Even at low qualities that sounds bad for performance. Also the main reason I want to animate cards is to have them respond to input and actions happening to the cards so two instances of the same card won't show exactly the same thing. Another thing is where would I place all these cameras and their models in the 3D space so that they won't see each other? I could put them on top of each other and use layers to only capture what I want but something doesn't feel right about having dozens of layers.

How would I begin to pull this off on a scale of dozens of cards?

sentences:
Ways to improve player retention I've recently released my first free to play game on Android and I've spent a few £ on advertising to try and get players involved and see what happens.

Below are my retention stats courtesy of Google. Judging by the colour coding 50% is good <30% is not so good, but in reality I have no real idea what these numbers should look like. So this question has two parts really.

What are ok/good numbers for Days 1, 2, 7 and 30? So I know what I should be targeting, and what are good ways to increase my numbers to get the to that level. There are the obvious things such as notifications, but what are the less obvious strategies that a novice is unlikely to think of?

sentences:
Help with Javascript touch button I tried many buttons but I can't connect them with the (Java)Script.

So I made 2 gui buttons: one for jump which was easy because I have an if statement and if it's true then jump.

But I have problems with the crouch button. Bellow is my script but I can't figure out how I can do this from Update in function Gui.

(Or if you know how to connect buttons with JS functions, please tell me: it's always a better option :D )

This is my script:

#pragma strict
private var tr: Transform;
private var dist: float; // distance to ground

function Start(){
   tr = transform;
   var ch:CharacterController = GetComponent(CharacterController);
   dist = ch.height/2; // calculate distance to ground
}

function Update()
{
  var vScale = 1.0;
  if (Input.GetKey("s")){
     vScale = 0.5;
  }

  var ultScale = tr.localScale.y;
  tr.localScale.y = Mathf.Lerp(tr.localScale.y, vScale, 5*Time.deltaTime);
  tr.position.y += dist * (tr.localScale.y-ultScale);
}

function OnGUI ()
{
  if(GUI.Button(new Rect(15, 330, 200, 100), "Shrink"))
  {
  }
}

sentences: Started work on a time based business game- one similar already exists... What should i do? Yeah so like i said, i started to work on a time based game that involves business investments, and as it turns out, there is a game called adventure capitalist that has pretty much the same idea about it. I planned to greenlight my game on steam and i found that adventure capitalist is on steam. Im not sure what i should do. Should i continue but make changes to the game (and if so, what sort of changes) or should i give up and work on something else. I should have mentioned this earlier but in the game, you make investments in the electronic industry, and each type of investment will have a different payout per second and a different base investment price to other types. For example, investing in computers will cost you £500 and have a payout of £5/second but investing in smartphones will cost only £100 and have a payout of £1/second. When you can afford it, you can level up your investment. I havent really added any more to the game than that so any advice would be appreciated, thanks.

sentences:
Fundamental physics component(s) in component-based game engine What are the "smallest" physics components in your component-based game engine?

Would it make sense to create something like Positionable, Rotatable, Movable, Collidable and combine them the way you want or is it better to use one unified component like PhysicsInteractable?

sentences:
Options for UDK and version control repositories? Another developer and I have begun to experiment with the Unreal Development Kit and have installed the UDK to our local computers. He's been toying around and experimenting and has some basic code and assets already developed. We want to set up a VCS repository so we can collaborate on development of a UDK project.

Some things we've noticed:

Source code goes in Development/Src/GameName/.
Binary Content and other assets go in UDKGame/.
The rest of the folders in the root directory are for the core UDK installation.

In terms of repositories, we've already come up with several options:

Commit everything (even the core UDK code).

Pro: Easy
Con: We're committing lots of code that, while a dependency of our project, isn't technically part of the project.

Commit the two folders we contribute to in two separate repositories.

Pro: Isolates versioned code to stuff we create.
Con: Slightly more difficult to set up, commits for one fix span multiple repositories, and we're committing a lot of binary content.

Change the config so both the src and the assets live in one folder, then commit that.

Pro: Isolates versioned code, commits for changes are in one repo.
Con: Committing binary content.

Commit SRC to one repo, use another solution for assets (FTP, Dropbox, etc)

Pro: Isolates versioned code, no extra overhead in versioning binary content.
Con: Changes span multiple places and manual updates to a remote storage solution are needed.

As we assess the best way to go about this so we don't back ourselves into a corner later, I'm wondering if there are other options and what their pros and cons are. I realize we could easily just pick a solution and change it up once we ran into scaling issues, but version control has always been one of those things I like to do once upfront and then forget about when I work on projects.

sentences:
How to project a foam trail on dynamically changing mesh I am trying to create water, and right now I got it through dynamically generating waves on a mesh. But now I want to make my boat manipulate these waves, and cause a Kelvin Wake on top of this.

Fact is I generate the water using different tiles, repeating the same pattern dynamically. So How would I generate this on top of a dynamically generated mesh(plane)? Without also manipulating the other tiles (planes)?

sentences:
How Do I Do Alpha Transparency Properly In XNA 4.0? Okay, I've read several articles, tutorials, and questions regarding this.  Most point to the same technique which doesn't solve my problem.  I need the ability to create semi-transparent sprites (texture2D's really) and have them overlay another sprite.

I can achieve that somewhat with the code samples I've found but I'm not satisfied with the results and I know there is a way to do this.  In mobile programming (BREW) we did it old school and actually checked each pixel for transparency before rendering.

In this case it seems to render the sprite below it blended with the alpha above it.  This may be an artifact of how I'm rendering the texture but, as I said before, all examples point to this one technique.  Before I go any further I'll go ahead and paste my example code.

    public void Draw(SpriteBatch batch, Camera camera, float alpha)
    {
        int tileMapWidth = Width;
        int tileMapHeight = Height;

        batch.Begin(SpriteSortMode.Texture,
            BlendState.AlphaBlend,
            SamplerState.PointWrap,
            DepthStencilState.Default,
            RasterizerState.CullNone,
            null, camera.TransformMatrix);

        for (int x = 0; x < tileMapWidth; x++)
        {
            for (int y = 0; y < tileMapHeight; y++)
            {
                int tileIndex = _map[y, x];

                if (tileIndex != -1)
                {
                    Texture2D texture = _tileTextures[tileIndex];

                    batch.Draw(
                        texture,
                        new Rectangle(
                            (x * Engine.TileWidth),
                            (y * Engine.TileHeight),
                            Engine.TileWidth,
                            Engine.TileHeight),
                        new Color(new Vector4(1f, 1f, 1f, alpha )));
                }
            }
        }

        batch.End();

    }

As you can see, in this code I'm using the overloaded SpriteBatch.Begin method which takes, among other things, a blend state.  I'm almost positive that's my problem.  I don't want to BLEND the sprites, I want them to be transparent when alpha is 0.  In this example I can set alpha to 0 but it still renders both tiles, with the lower z ordered sprite showing through, discolored because of the blending.  This is not a desired effect, I want the higher z-ordered sprite to fade out and not effect the color beneath it in such a manner.

I might be way off here as I'm fairly new to XNA development so feel free to steer me in the correct direction in the event I'm going down the wrong rabbit hole.

TIA

sentences:
Are loading screens more important than they appear to be? I am creating a game in Unity that is really low poly and uses few resources on mobile. It runs quite fast on old, low end phones so the new, high end phones have no problems running it. There are no load times between scenes which makes the game load each scene instantly, yet this gives a sense of simplicity and that the game is really cheap.

So here is my question: would the implementation of a "fake" loading screen give the player the feeling that the game is complex and create that transition between scenes? Or should I stick with the fact that everyone hates loading screens and therefore should leave the game as it is? What other options could I use to convey the feeling to the user of complexity despite the low graphics?

sentences:
Texture coordinate into texel form? How do I convert a texture coordinate, like 1,0 into a texel form(a single value?). Like in the image below, what is the value of Q22 in texel?

I'm in directx 11.

sentences:
How do I ensure a piece of code runs only once? I have some code that I only want to run once, even though the circumstances that trigger that code could happen multiple times.

For example, when the user clicks the mouse, I want to click the thing:

void Update() {
    if(mousebuttonpressed) {
        ClickTheThing(); // I only want this to happen on the first click,
                         // then never again.
    }
}

However, with this code, every time I click the mouse, the thing gets clicked. How can I make it happen only once?

sentences:
How can I spawn an object where I clicked in a 3D space, but spawn it in a 2D location? I have a game where I have an object sat on a 3D plane and I want to click above it to drop an object.  Wherever I click I want the object to drop where I clicked on the Z-axis, but on a fixed position on the X and Y axis.

Please see the below image:

I am using the following code to do that, which I have attached to my long cube (the platform).

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

public class clickBehaviour : MonoBehaviour
{

    public GameObject GameCube;
    Ray ray;
    RaycastHit hit;

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

        ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        if (Physics.Raycast(ray, out hit))
        {

            if (Input.GetButtonDown("Fire1"))
            {
                GameObject obj = Instantiate(GameCube, new Vector3(-75, 9, hit.point.z), Quaternion.identity) as GameObject;
                Debug.Log(hit.point);
            }

        }

    }
}

GameCube refers to the GameObject of the smaller cube on top of the platform.

What seems to be happening, is that when the user clicks a block appears.  If the mouse is low down the screen on click then it appears where it should be.  If it is higher up the screen it appears off in one direction away from where it should be.

I believe this is because Unity is picking up the click way in the background, but I'm dropping the new cube in the foreground.  Because of this the Z coordinate is then quite a way off.  The further in the background I click the further off it is.

How can I have the cubes always appear in the correct position, above the platform?  I'm guessing this is a common requirement, but struggling to work out how to do it, or what to Google to find out more info.

Thanks

sentences:
Using delta time for movement I'm currently involved in a college assignment where we must create a game with our own game engine. In my game, we have an enemy moving around with paths constructed with a A* algorithm. Every frame I update his position but this is too dependent on the computer. Can you guys help to figure out how to solve this?

I tried to make him move only in even frames but, again, it's too time dependent and it's not smooth.

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:
How to add isometric (rts-alike) perspective and scolling in unity? I want to develop some RTS/simulation game. Therefore I need a camera perspective like one knows it from Anno 1602 - 1404, as well as the camera scrolling.
I think this is called isometric perspective (and scrolling).

But I honestly have no clue how to manage this. I tried some things I found on google, but they were not satisfying.

Can you give me some good tutorials or advice for managing this?

Thanks in advance

sentences:
Distributed Rendering in the UDK and Unity At the moment I'm looking at getting a game engine to run in a CAVE environment. So far, during my research I've seen a lot of people being able to get both Unity and the Unreal engine up and running in a CAVE (someone did get CryEngine to work in one, but there is little research data about it).

As of yet, I have not cemented my final choice of engine for use in the next stage of my project. I've experience in both, so the learning curve will be gentle on both. And both of the engines offer stereoscopic rendering, either already inbuilt with ReadD (Unreal) or by doing it yourself (Unity). Both can also make use of other input devices as well, such as the kinect or other devices. So again, both engines are still on the table.

For the last bit of my preliminary research, I was advised to see if either, or both engines could do distributed rendering.

I was advised this, as the final game we make could go into a variety of differently sized CAVEs. The one I have access to is roughly 2.4m x 3m cubed, and have been duly informed that this one is a "baby" compared to others.

So, finally onto my question:

Can either the Unreal Engine, or Unity Engine make it possible for developers to allow distributed rendering? Either through in built devices, or by creating my own plugin / script?

sentences:
Converted XWM(A) files get silence at the end I am writing a playback mechanism for looping background music with XAudio2 and SharpDX.

I converted some perfectly looping WAV files to XWM(A) with the xWMAEncode command line utility (from the DX SDK of June 2010), but as soon as I play back the XWM file in a looping audio buffer, I notice a significantly noticable silence before it loops over.

I found out that when filling an XAudio2 audio buffer manually with a synthesized vibrato sound, no looping bug occurs. To further support this, I decoded the XWM file back into WAV, and the WAV file had exactly the same amount of silence at the end as I noticed in the playback, which turns out to be of 0,06 seconds length:

My first question is if anyone noticed the same behavior of the xWMAEncode utility, and if it is either a bug of the utility or even of the XWMA format itself.

I'd love to know some workaround for this if it can't be fixed by the encoding of the WAV itself.

I thought of setting the LoopLength sample of the audio buffer to exactly before the silence occurs. But for that I'd need to pray that such a silence isn't dynamic depending on the sample rate. Has anyone fixed it like this before and can provide or link me to details about this?

Head-shaking corner: MP3 adds silence to the start of each file, so XWM likes to put it at the end? Do we live in times were only OGG gets stuff looping correctly?

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:
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:
Sprites don't become lit when installing Universal RP package I want to implement 2D lights in Unity. So, I downloaded the Universal RP package from the Package Manager.
I created renderers as shown here, then I created a light object (Point Light 2D) in a new project.

What should happen: After this last step, the scene should become black.
What happened in my case: There scene is same as before plus a warning message popped up in the other project, and when I place any object from my game, only that object appears black.

WARNING:
FlowerM_03 material was not upgraded. There's no upgrader to convert Unlit/Transparent shader to selected pipeline
UnityEditor.Rendering.Universal.UniversalRenderPipelineMaterialUpgrader:UpgradeProjectMaterials() (at Library/PackageCache/com.unity.render-pipelines.universal@7.4.1/Editor/UniversalRenderPipelineMaterialUpgrader.cs:25)

Videos I took reference from:-
https://www.youtube.com/watch?v=nkgGyO9VG54
https://www.youtube.com/watch?v=F5l8vP90EvU

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:
When creating quick prototypes, is it better to use the language you are going to use in the end? I have been working with SFML(C++) and Flash(AS3) and usually creating prototypes for some ideas I have.

Is it better to use the language you are going to use in the end (C++ usually) or use something simple and quick (AS3, Python, etc) to get it working and then start from scratch when you start on the main product?

sentences:
Bevel outline algorithm in 2D I'm writing a program that creates animated blobs in 2D, to simulate cells. In order to beautify these objects, I'd like to give them a 3D look by adding a bevel-effect. How can this be achieved?

Program as it looks now (the blobs are animated, move, change shape etc):

And this could be a potential desired outcome:

I underscore that I'm not using anything else than GDI+, so I'll have to write the implementation myself. Virtually every graphics program has some kind of beveling filter, but I've looked high and low online to find examples of such code.

Edit:

I was testing a few theories, and this one could work. However, it's not my most optimal solution (even though Gaussian blurs can be made linear using separable kernels) and I have another in the working. Anyway, this could be a first attempt at a fast beveling algorithm:

The result in the picture I created above is the direct outcome of the steps of the algorithm, but I suspect it might run too slow for 25fps.

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

Separate member variables:

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

    // methods

}

A multi-dimensional array:

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

    // methods

}

An array of vectors

struct Mat4 {
    Vec4[4] m;

    // methods

}

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

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

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

So that's one vote for method one.

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

sentences:
Fbx animation without bones or single skeleton SkinnedModel sample nicely shows how to import single root bone skeleton and run in XNA.

My question are:

Is it possible to have animations played in XNA if there no bones are used in model (which can easily be done in 3dmax with auto key frames)?
Is it possible to have multiple independent bones laying around, connected to independent meshes and animated, all played in XNA?
Can SkinnedModelProcessor be downgraded to this level ?

sentences:
Game development and research Game development is currently a largely non-academic enterprise.  There are a lot of commercial developers of games, as well as a large hobbyist community.  The academic community focusing on games seems to be small, and new.  [Or so it appears to me].

Having said all that, are there some must read papers/books on game development from academics?

sentences:
Memory allocation strategy for the vertex buffers (DirectX 10/11) I'm writing a CAD system. I have a 3D scene and there are many different objects (walls, doors, windows and so on). The user can add or delete objects.
The question is: How do I keep track of all the vertices for all my objects?

I can create vertex buffer for every object. But I think drawing/switching from one buffer to another would have performance penalty.

Another way - I can create several big buffers for every object type. But I don't understand how to update such buffers. It is too big to update whole buffer (for example buffer for all walls). What would I do if I wanted to delete an object that's in the middle of the buffer?

I have the similar question here on Stack Overflow.

Most examples I've found work with static models. Therefore, they tend to create a single vertex buffer with their list of points, and then are just manipulated by matrix transformations. I, on the other hand, will be updating the scene very often. So what's the best way to keep track of and store this information?

sentences:
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:
balancing a building game I'm working on a building game (the usual, build house X to produce resource A, which then lets you build house Y...) and I am now in the stage of balancing the various resource needs and productions.

Since I'm by far not the first person doing this, but couldn't find much practical advise on how to actually do it, I'm asking around: How to do the balancing math?

I thought about using a spreadsheet, but the main issue is not in the pure numbers but in the dependencies - if A then B. How many X are needed for Y to become available and does that fit to the stage of the game I want it to happen?

Which better ways than just playing for hours and tweaking the numbers exist? What approaches do you use to balance your economics games?

Additional details:

The game is a static build-your-village game. "static" means that time is not a factor - buildings provide a fixed amount of resources, not "x per minute". So a house provides housing for some peasants and a farm needs some peasants to work it, providing food.

So the things to balance against each other are resources. One trivial example: Farms need to provide more food than the peasants working on the farm plus the lumberjacks required to provide the wood for building the farm eat.

The goal of the game is resource-optimization. Doing the most with the resources available on the map. It is closer to a puzzle than to a clicker game.

Trivial early-game elements (see farm example) are easy to balance. But once you get into dependency trees (e.g. a 3rd level house needs A and B which are provided by X and Y, who need resources created at X2 and Y2, etc.) my intuition fails. Is X2 and Y2 balanced correctly or should they produce less? more?

I am not looking for specific answers, but for methods to approach this problem in general.

sentences:
Binding C++ and V8 Javascript from Google The examples are quite challenging to grasp if you are still getting your head around other things, so the simplest example would be great.

Is there a simpler example?

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:
Stuttering movement when approaching boundary I'm trying to limit my movement in the y-axis by checking if the position will be within the boundaries after the Translate. If it is, only then do I translate the Player.

public class Player : MonoBehaviour {

    private float speed = 5.0f;
    private float bottomY = -4.37f;

    void Start () {
        transform.position = new Vector3(0, -4, 0);
    }

    void Update () {
        Movement();
    }

    void Movement () {
        // vertical movement
        Vector3 yTranslateVector = Vector3.up * Input.GetAxis("Vertical") * speed * Time.deltaTime;
        float newYPos = (transform.position + yTranslateVector).y;
        if (newYPos > bottomY && newYPos < 0) {
            transform.Translate(yTranslateVector);
        }

        // horizontal movement
        Vector3 xTranslateVector = Vector3.right * Input.GetAxis("Horizontal") * speed * Time.deltaTime;
        transform.Translate(xTranslateVector);
    }
}

However, when I do this, the Player kind of pauses when approaching the boundary and then stutters forward towards the absolute limit upon releasing the key. I tried putting the Movement function in the Update and FixedUpdate method, but neither made any difference. Can anyone give me any insight into this?

sentences:
What is a good way to determine if a vector is between two other vectors in 2D? I could operate with the angles, but I do not have the angles calculated yet (and would like to avoid having to do that). It would be possible to calculate and cache the local-coordinate-frame angles, though.

This is a routine that is run on every vertex of every convex polygon within the convex decomposition of every physically simulated object, so it should be as fast as possible.

I've got a corner of a convex polygon, so I have a vector from vertex to vertex-1 and another vector from vertex to vertex+1. It is easy to see that for a convex polygon, the interior of the polygon lies in the direction of the average of these two vectors.

I want to determine given any vector whether it points into that region or outside of it. Can I accomplish this using only cross products and dot products and similar fast operations? I am thinking about eventually offloading these calculations to a vertex shader, but as it changes the number of vertices required depending on an object's velocity, I imagine the logic could get dicey. Either way, before I attempt a vertex or geometry shader implementation I had better get a CPU solution working correctly first.

Here's an example: I want to find if N is between A and B. A points right at -10 (=350) degrees, B is at 15 degrees. So it looks somewhat like the < symbol. Function should return true only if N is between -10 and 15, between 350 and 375, etc. This was just to paint a mental picture, the input to the function are vectors: I want to avoid operating on angles because I do not want to call atan2.

It may help if it is known that A cross B is always positive. This is the case because my polygon is CCW winded and convex.

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

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

Check if the animation is finished:

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

Code for setting the animated tile:

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

I did find this in the Animated Tile script:

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

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

sentences:
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:
Assigning valid moves on board game I am making a board game in unity 4.3 2d similar to checkers. I have added an empty object to all the points where player can move and added a box collider to each empty object.I attached a click to move script to each player token. Now I want to assign valid moves. e.g. as shown in picture... Players can only move on vertex of each square.Player can only move to adjacent vertex.Thus it can only move from red spot to yellow and cannot move to blue spot.There is another condition which is : if there is the token of another player at the yellow spot then the player cannot move to that spot. Instead it will have to go from red to green spot. How can I find the valid moves of the player by scripting.

I have another problem with click to move. When I click all the objects move to that position.But I only want to move a single token. So what can i add to script to select a specific object and then click to move the specific object.Here is my script for click to move.

var obj:Transform;

private var hitPoint : Vector3;

private var move: boolean = false;

private var startTime:float;

var speed = 1;

function Update ()
{
if(Input.GetKeyDown(KeyCode.Mouse0))
{
var hit : RaycastHit; // no point storing this really
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
if (Physics.Raycast (ray, hit, 10000))
{
hitPoint = hit.point;
move = true;
startTime = Time.time;
}
}

if(move)
{
obj.position = Vector3.Lerp(obj.position, hitPoint, Time.deltaTime * speed);
if(obj.position == hitPoint)
{
move = false;
}
}
}`

sentences:
Procedurally placing buildings on noise-field So, I have a procedurally generated planet. In my case it's 3D (hexagon/pentagon globe) but for simplicity let's assume it is a 2D grid.

I have distributed resources over this planet, using Simplex Noise, with a cut-off value, giving me a binary distribution.

One of the things I generate in this way, are fields of wheat, shown in yellow below.

After the wheat-fields are generated, I want to procedurally place farms on the planet.

If I would just randomly pick a "yellow tile" (tile with wheat on it) then I run the danger of having them poorly distributed, as shown on the left.

What I want, is a nice distribution where farms favour large wheat areas that are still unoccupied by other farms, as shown on the right.

Is there a simple algorithm that can do this placement?

NOTE: I want to use this approach for other buildings like mines, quarries, lumberjack operations, etc. So I want to avoid placing first, and then growing resources around it. I want the noise field to drive the placement, not the other way around.

NOTE: Farms will not consume the wheat. I've made wheat fields binary wheat/no-wheat but also have scaled distributions with "potency" for e.g. forests, where the number of trees per tile can vary.

sentences:
XNA C# How to draw fonts in different color I'm doing a simple chat system with XNA C#. It is a chatbox that contains 5 lines of chat typed by the users. Something like a MMORPG chatting system.

[User1name] says: Hi
[User2name] says: Hello
[User1name] says: What are you doing?
[User2name] says: I'm fine
[System] The time is now 1:03AM.

When the user pressed 'ENTER', the text he entered will be added inside an ArrayList

chatList.Add(s);

For displaying the text he entered, I used

for (int i = 0; i < chatList.Count(); i++)
{
spriteBatch.DrawString(font, chatList[i], new Vector2(40, arr1[i]), Color.Yellow);
}

*arr1[i] contains 5 y-axis points to print my 5 line of chats in the chatbox

Question1: What if I have another type of message which will be added into ChatList (something like a system message). I need the System Message to be printed out in red color.

And if the user keeps on chatting, the chat box will be updated according: (MAX 5 LINES) The newest chat will be shown below, and the oldest one will be deleted if they reached the max 5 lines.

[User2name] says: Hello
[User1name] says: What are you doing?
[User2name] says: I'm fine
[System] The time is now 1:03AM.
[User1name] says: Ok, great to hear that!

I'm having trouble to print each line color according to their msg type. For normal msg, it should be yellow. For system msg, it should be red.

Question2: And for the next problem, I need the chat texts to be white color, while the names of the user is yellow (like warcraft3 chat system). How do I do that?

I have a hard time thinking of a solution for these to work. Advise needed.

sentences:
Simple 2D hair simulation/manipulation I would like to simulate very simple hair in a 2D environment, and will need to be able to "brush" the hair.

What I want to do:  A 2D character is facing squarely towards the player.  The player can then brush the character's hair.  Think of a little girl brushing her doll's hair into different styles.

In my preliminary Google searches, I found many 3D, super-optimized hair simulations for tens of thousands of hairs, which are far more complicated than I need.  I only need 100-500 hairs, and they only need to react to "brushing" by the player.

How might I do this?

sentences:
Direct3D11 Depth buffer problem Encountered a strange error when using Direct3D11, feature level 10.0.

If the depth buffer texture is created with the format DXGI_FORMAT_R24G8_TYPELESS, bind flag D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_SHADER_RESOURCE and the depth stencil view format DXGI_FORMAT_D24_UNORM_S8_UINT, everything is correct.
Also, there are no problems when the depth buffer texture format is DXGI_FORMAT_R32G8X24_TYPELESS and the depth stencil view format is DXGI_FORMAT_D32_FLOAT_S8X24_UINT.

However, when the depth buffer format is DXGI_FORMAT_R32_TYPELESS,
and the depth stencil view format is DXGI_FORMAT_D32_FLOAT, the whole geometry is not rendered at all, only the clear color is visible. I used Visual Studio 2015's Graphics Debugger to check if the geometry is rendered as desired, but during the Output Merger stage the whole geometry is discarded because it failed the depth test. Every Direct3D function call returns no error and the Direct3D debugging output reports no error (only INFO messages about creation/destruction of resources). I do not use the stencil functionality at all, and it is disabled.

I use a Windows 7 virtual machine as a developer machine and using DXGI_FORMAT_R32_TYPELESS and DXGI_FORMAT_D32_FLOAT worked flawlessly before I switched from a Windows 7 host to an Arch Linux host, because the old hard-drive started to fail and the operating system was unable to read its own files during boot. After I switched the host operating system, this problem started to occur inside the virtual machine.

Is it possible to have a bug somewhere else in my code?

Is there a limitation when using DXGI_FORMAT_D32_FLOAT and sometimes it may not be possible to use DXGI_FORMAT_D32_FLOAT or the other depth formats on every machine (considering D3D11 feature level 10.0 is available)?

Or is this a bug somewhere else, possibly in VMware player or Linux or Bumblebee (Optimus - Intel HD 4000 + GeForce GTX 650M)?

sentences:
Resolution problems when porting a Unity game to Android So, I'm porting a game to the Android for the first time in Unity3D. And I've run in to a few problems along the way. My current problem is the resolution doesn't seem to be right, it cuts off the edges of the screen and my scrolling stops for scrolling the screen left/right are no longer in the right place.

After doing a bit of research, a lot of people say you need to make your game Resolution Independent to be able to run on all Androids/Iphone/Ipad. Is this true? If so, how do I go about doing that? If not, how can I help fix the resolution so when I port to mobile devices it looks right?

EDIT:
I still don't really have what I need, resolutions still aren't working properly even with the code and tricks listed below. I need some way for the resolution to adjust based on the device. For some reason when I try to retrieve the resolution of a device using Mungoid's code it returns 0x0

sentences:
Farseer: How can I calculate the needed velocity in this case? I have two platforms and one ball. The ball should fly from the red platform to the blue platform. The ball should land somewhere in the purple rectangle of the blue platform.

How can I know how fast the linear velocity of the ball should be to accomplish the jump of the ball?
Is there a mathematical formula to calculate the linear velocity(x,y) which should be added to the ball so that the ball can jump to the blue platform?
The ball should always land in the purple area.
Distance(width) from the ball to the target: 212 pixel
Distance(height) from the ball to the target: 52 pixel
The distances were measured from the center of the ball to the center of the purple rectangle.
The gravitation of my world is world(0,3).
Upadte
I use the following formula for the impulse:

impulse = Vector2(distance.x / time * mass + gravity.x / 2 * time * mass, distance.y / time * mass + gravity.y / 2 * time * mass);

mass: mass of the ball
It's working with this formula, but only if the value of the time is not too low. time = 2.0f(or higher) is working but if I use time = 1.0f, then the ball is touching the left side of the blue platform.
Why is the formula not working with low time values? I don't understand that.

sentences: What counts as a "game studio" I am registering a game on a site so that I can sell it, and it needs me to put in my game studio.  I work on my games in c++ and I dont't have a team, or a company.  Can I throw out a name and be done with it? or do I need to have a registered company?

sentences:
How to put a "mask" in front of the camera in Ogre? Is there any easy way to put kind of a "mask" in front of the camera in an Ogre 3d application, so that parts of the scene are always covered by that mask? The idea is that I want to have an effect as if you would look through a keyhole, or as if you would look through a tube. There should be a black border around the center of the screen, so that the user only sees that center.

Ideally, I would be able to dynamically change the diameter of this circle through which the user looks on the scene. Thus that black border on the sides of the scene would become wider or narrower.

Any ideas how to implement that in Ogre?

sentences:
Stop Unity from smoothening out images In Unity, low-resolution images are "smoothened out". Is there a way to keep them pixelated?

For your information, the images that I'll be using are in PNG format.

sentences: Pleasing isometric hexagons What angles and long-side/short-side ratios give the most aesthetically pleasing and graphically regular isometric (squashed and flat side up) hexes, that additionally resolve to whole pixel sizes for several sizes when rendered?

sentences: What are some famous games developed with .NET and/or XNA? Are there famous games written in .Net and/or XNA?

sentences:
What technology is best for building my first game I have started a few game projects in the past, but have never finished anything.  I decided that it was probably because I was writing everything thing from scratch, and just ended up dropping the project once development started taking too long.

I've decided that I want to finish my first game now, and needed some opinions on what sort of middleware would be good to use.  I was hoping that with an engine provided for me, I'd be able to finish the game.

I am most familiar with C++, but do know quite a few other languages as well.

sentences:
Libgdx and ParticleEffect with scene2d not showing the same way as in the Particle Editor I am developing a new game with libgdx and trying to implement ParticleEffect in scene2d (using actor). I am creating a ParticleEffect with Particle Editor in which I would like to
add to a stage.

From some reason, the effect appears horizontally only (objects appear from left to right but not up and down) and is not appearing the same as in the Particle Editor (X and Y axis).
Does anyone have an idea what could be the reason for that?

Snapshot of the horizontal effects (desktop run):

Particle Editor effect:

sentences: How does UVW texture mapping work? I'm trying to understand the mathematical theory behind UVW mapping. Can anyone explain me how UVW mapping works? Or at least provide me a pointer?

sentences:
How can I insert and remove blocks quickly in a Minecraft-style world? I currently have volume data for the world stored as an array of booleans.  I then check each empty block and if it has non-empty neighbors the faces get drawn.  This prevents me from sending a bunch of faces to the graphics card using OpenGL.

I'm now working on inserting and removing blocks but I'm not sure how to do this quickly.  It is simple enough to change the volume data but I don't want to recompute all the vertices from the volume data each time someone inserts or removes a block.  It occurred to me just to add the block to the vertex buffer at the end of the existing vertex data but then I don't have a good way of destroying it as I have no way to correlate between the volume and vertex buffer data.

Any thoughts on how I can fix the mess I'm in?

sentences:
What benefits does a game design degree have for a hobby game programmer? I am interested in studying game design, not because I want a job in the games industry, but because I am interested in the subject itself. I read the following questions, but they mostly deal with the effects on your career in game industry.

Should I consider a graduate degree in game development?
Game Development Degree vs Computer Science Degree

First I thought a game development degree could be beneficial. But from the websites of colleges that offer such degrees, I feel like its more about basic programming with examples from games.

This college offers game design degrees, for example.

My question is, can I benefit from such a degree when I already have a degree in Computer Science, I already know programming, I'm already developing a game and finally, I have this site to help me when I get stuck?

sentences:
How do I initialise levels sequentially? I have been learning opengl and I have made good progress over past few months.  However I still struggle to understand game logic in C++, I am new to C++ too.
Say I have this program.
#include <headers>

int main()
{
    #Step 1
    VAO_VBO_EBO_inits();

    while(!glfwWindowShouldClose(window))
    {
        glClearColor(.2f, .2f, .3f, 1.f);
        glClear(GL_COLOR_BUFFER_BIT);

        #Step 2
        DrawCalss();

        glfwPollEvents();
        glfwSwapBuffers(window);
    };
    return 0;
};

For OpenGL programmers this should be clear.
With this structure, I have to load all levels and then draw part of them like so.
Step 1 feeds the gpu the vertex data and its attributes.
Step 2 binds shader programs and draws the vertices
Say I have A, B, C, D levels, within  VAO_VBO_EBO_inits(); function I have to load all A, B, C, D levels then within DrawCalss(); function will draw only related levels.
DrawCalss(); function is dynamic but  VAO_VBO_EBO_inits(); invoked only once.
What I want to do is create separate game loops for each levels and be able to switch between levels, and as I switch levels preceding level should be unloaded and next level reloaded.
Since I am new to C++ I don't know what way would be the most efficient, that's why I have not tried anything.
How do I achieve it? what is the best practice for such scenarios?

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:
Synchronizing clients I have a server-client setup where each client has a number of screens attached, and the screens together form the display. As such, the visuals displayed by each client needs to be roughly in sync. Luckily the domain is not high speed, so I don't have to have them all perfectly in sync, but obviously more in sync is better.
The physical network: About 10 clients need to be synced together. All clients that need to be synced are on the same gigabit LAN, latency is sub 1ms.
The network protocol: Clients are running 100ms behind real time (so there is a 100ms buffer for the server to send out updates).
The digital environment: Realistic environments moving at generally a slow speed (think rate of turn in the order of 10 degrees/minute generally, however it's possible to increase up to maybe 720 in extreme circumstances).
Requirements: There should be as little visible lag between clients as possible.
Requirements for answers: A concept is enough, pointing out the limitations or advantages to different methods would be appreciated. It would be great if it's something you've tried and had failures or successes with in the past, but spit-balling is ok too.
What a good answer would look like: "Using NTP is fine up to X ms or syncing Y clients, but if you need more accuracy than that you should look into doing Z". It doesn't need to be crazy in depth!

sentences: How to make a collider the follows all the animations of a prefab? I have attached a capsule collider with my player(prefab) and made a script so that when Space key is down it does the jump animation in Unity. But because of the collider not jumping with the player, the player gets stopped by obstacles though he visually passed it. How can I make a collider that moves with my animations attached to a prefab?

sentences:
HTML5 clicking objects in canvas I have a function in my JS that gets the user's mouse click on the canvas.

Now lets say I have a random shape on my canvas (really its a PNG image which is rectangular) but i don't want to include any alpha space.

My issue lies with lets say i click some where and it involves a pixel of one of the images. The first issue is how do you work out the pixel location is an object on the map (and not the grass tiles behind).

Secondly if i clicked said image, if each image contains its own unique information how do you process the click to load the correct data.

Note I don't use libraries I personally prefer the raw method. Relying on libraries doesn't teach me much I find.

sentences:
Creating Blender-like cavity shader I'm trying to achieve in Godot something similar to cavity effect from Blender (this can be enabled in viewport options; cube on the left is displayed by viewport with this option enabled):

How would you replicate this?

sentences:
How to prevent/"reverse" displacement from a collision? In my game I can throw a hammer. The hammer moves based on physics in Unity.
The hammer destroys the first object it touches. I want it to continue moving as though it didn't touch anything when this happens.
To try and achieve this, I made it destroy objects using a separate, larger trigger collider, intending to destroy the object before the physical collision occurs.
However, when moving at very high speeds (as in the GIF), both colliders hit at once, so the hammer moves and the object deletes.

How can I prevent the hammer from moving when/before the trigger occurs, or (I suppose more realistically) "reverse" the movement such that there's no perceptible collision?

I tried using the impulses from each of the contacts in the collision to apply forces in reverse, but didn't really understand what I was doing and ultimately failed.

NOTE: I cannot simply disable the physics collider, because it doesn't destroy everything.

sentences:
Really simple video games, how to design games for the non-gamer market? With the boom of mobile and social games reaching more and more people and new technologies like the wii, kinect and geolocation hardware and gadgets appealing to a bigger market than the hardcore gamer, the indie game development has a new challenge: create simple games.

This might seem easier, but I think its really way harder. Game developers are usually fans of RPGs, FPSs, massively complicated games with complicated goals, mechanics and stories. That is not what the usual casual player is looking for, and getting into the mind of a unknown market is really hard.

So, how to design games for the casual, non gamer market?

I know its a very broad question, but I would love to know how people design, playtest and deliver this sort of games.

A very big point for me is that somethings while trying this exercise of designing simple games I get a feeling that it is TOO simple or even non challenging when it might be complicated and challenging enough for that market.

sentences:
How to use an array of y values to render a 2D top-down Java game? I'm fairly new to the world of coding, and there's probably a simple solution here. I made this array (the actual one is more complex since it includes everything I have so far) for the y values of every object that needs to be rendered, but I don't know how to use it to keep track of which y values correspond to which object in order to draw them from lowest y value to highest y value.

int [] yValues = {deer.getY(), sprite.getY(), tree.getY()+150};
    Arrays.sort(yValues);

The deer just randomly walks around, and the player (sprite) is controlled by arrow keys. I added to the y value of the trees so that characters that walk around would stay behind them.

Right now I've hard-coded the layering, depending on when the sprite is in front of or behind the tree (hair and skin y positions are dependent on the y position of the sprite, which is why I didn't include them in the yValues array).

//Printing order
    if (sprite.getY() < tree1.getY()+150) { //if the player is behind the tree

        g2d.drawImage(deer.getImage(), deer.getX(), deer.getY(), this);

        g2d.drawImage(sprite.getImage(), sprite.getX(),
            sprite.getY(), this);
        g2d.drawImage(skin.getImage(), sprite.getX(),
                sprite.getY(), this);
        g2d.drawImage(hair.getImage(), sprite.getX(),
                sprite.getY(), this);

        //the tree is drawn after everything else
        g2d.drawImage(tree.getImage(), tree.getX(), tree.getY(), this);
    }

    if (sprite.getY() >= tree1.getY()+150) { //if the player is in front of the tree

        //the tree is drawn before everything else
        g2d.drawImage(tree.getImage(), tree.getX(), tree.getY(), this);

        g2d.drawImage(deer.getImage(), deer.getX(), deer.getY(), this);

        g2d.drawImage(sprite.getImage(), sprite.getX(),
            sprite.getY(), this);
        g2d.drawImage(skin.getImage(), sprite.getX(),
                sprite.getY(), this);
        g2d.drawImage(hair.getImage(), sprite.getX(),
                sprite.getY(), this);
    }

From here, how would I use the yValues array to order the drawing?

[I found this post helpful to what I'm trying to do] (Java Slick2d image depth/layering).

sentences:
Frame Buffer Objects vs calling TexCoord2f? I'm learning the basics of OpenGL with lwjgl currently, and following a guide I've got textured quads that can move around a scene.

I've been reading about Frame Buffer Objects, and I'm not really clear on their purpose and their benefit.

My understanding is that I'll create a FBO with the texture I'd like, load the FBO, draw a quad, then unload the FBO. What would the technique I'm currently doing for texture management be called, and how does it differ from using FBOs?

What are the benefits to using FBOs? How does it fit into the grand rendering scheme of things?

sentences:
Why is is so hard to develop a game console emulator? I have always found emulators rather fascinating. I would seriously like to create an emulator for an older ganeration console or handheld. It would help me gain a greater appreciation of the hardware and the games which were created for that hardware. However, people are always saying how hard it is and that I should not even try. I would like to know why that is.

Also, I would like some suggestions on a good place to start and where can I find the information I need?

sentences:
How do open-world game saves work? (Sorry if this shouldn't be asked here, I'm unsure if it's appropriate based on what's allowed here.)

I'm not developing a game, but I'm very curious about this. I've played some large open-world games recently (Dishonored, for example), and it boggles my mind how much information must be stored for save files. If I pick up a bottle from where it spawned and throw it, then save while it's in mid-air, the save file needs to contain a) what type of bottle it is, b) where it is right now, c) what orientation it's currently in, and d) what its current trajectory is. This is the case for every non-fixed asset in the current level. Pathing NPCs have to have their current state tracked as well.

So, in general, how do games accomplish this? I'm sure the implementation varies, I'm not asking for any specific game, but the overall concept must be similar across games. Even more impressive to me is that quick saves often seem to be instant, with no delay whatsoever after pressing the key.

sentences:
Modular weapon in UE4 editor I want to create a modular weapon system. I already got most of it working, but I wonder how to make an improvement.

Weapons in my game have different firing modes (semi and auto) and "bullet" modes (projectile and hitscan). Each weapon is it's own blueprint, and there I can select proper one in editor, so for example an Uzi would be auto / histcan, while a rocket launcher would be semi / projectile. (the firing mode actor gets created at spawn from the class selected in editor).

I want to make it easier to edit by giving the weapon some variables, like spread and projectile blueprint. But not all of the variables apply to all the types of weapon...

TLDR:
Can I create / show different variables in the editor, depending on other variables? If I choose projectile type of weapon, can I also select the projectile type, but not show the option if I chose hitscan?

sentences:
How does one get sprites to hide/unhide using OnMouseDown() in Unity? I'm right now using Unity for a school project and I need to be able to hide and
unhide sprites for "expansions".

I've looked all over the internet for this and I can't seem to find an answer.

Here is the script so far:

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

[DisallowMultipleComponent]
public class addBlock : MonoBehaviour{

  void OnMouseDown()
  {
     Debug.log(gameObject.name);
  }
}

sentences:
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:
Increasing chance of good loot after multiple tries I'm looking for a way to make chances of getting better loot increase the more you've looted. I do not want it to be possible to get a rare item the first 5 times and not being able to get an epic item the first 10 times.

However, the more the player loots, the better chance he should have of getting better items/less chance of getting nothing, normal, ...

This is my current code, but it is, as you can see, completely static. I know this might not be of much help, but at least it shows an overview of the items and the %-chance I have in mind.

var rand = random(100); // Random number 0-100
if(rand < 40){
    return LOOT_NOTHING;
}else if(rand < 70){
    return LOOT_NORMAL;
}else if(rand < 90){
    return LOOT_UNCOMMON;
}else if(rand < 99){
    return LOOT_RARE;
}else{
    return LOOT_EPIC;
}

The project is written in GML, but pretty much any language will suffice as an answer as it's not very language-specific.

sentences:
Axis Aligned Spatial Division : Divide space into random rectangles? I need a method to divide 3d space into random axis aligned box shapes. For now
I am currently dividing the 2d space for testing purposes. The most immediate approach I came up with was to define a rectangle of size (1, 1) and then recursively split all existing rectangles to two uneven rectangles alternating between axis X and Y.

The problem here is obvious. This approach results in long stretching lines (marked in red)

What I would like is something more organic looking (I included an example)

See, no long straight lines from top to bottom or left to right.

The only constraint is that I may wish to limit the minimal size of the rectangle without affecting the granularity of the sizes. i.e. if the smallest rect is 1 square centimeters than the seconds smallest room should not be 2 square units.

So ideally the algorithm should meet all three following constraints:

Rectangles are not infinitesimally small.
Rect sizes aren't discrete multiplication of the smallest rect size. i.e. if the smallest rect is 3 square unit than larger rects are not constrained to be 6, 9, 12 and so forth square units and instead could be 3.2 or 4.7 for that matter).
The algorithm runs in polynomial time (needs to compute fast).

sentences:
Line of Sight with Bresenham I have a simple function to determine whether an entity can see another, in a top-down tile-based game (this is actually a tiny bit more complex in my game, to determine whether to see the first block, but I simplified it for this example):

public static boolean canSee(int x, int y, int x2, int y2, Area area) {
    Array<Tile> blocks = new Array<>();
    Utils.Bresenham.Plotter plotter = (x1, y1) -> {
        Tile t = area.getTileAt(x1, y1);
        if (t.blocksView()) {
            blocks.add(t);
        }
    };

    Utils.Bresenham.line(x, y, x2, y2, plotter);

    return blocks.size == 0;
}

// Example below:

P = player, E = enemy, B = block

.....
.....
.....
P.B..
B...E

Now the problem I have is that in this position, the enemy can see the player, but the player cannot see the enemy (because the most top 'B' blocks the Bresenham).. and I'm not sure what's a good way to fix this.

sentences:
OpenGL App not setting cursor position appropriately I have written a small application using OpenGL, and have implemented some rudimentary camera controls. Unfortunately, I cannot get the application to set my cursor position correctly. The cursor is never set to where I tell it to go, so my application just reacts to where the cursor is on my entire screen.

I first attempted to use GLFW, and when I saw that I couldn't set the cursor appropriately, I decided to try SFML. Neither one works.

I'm on an Arch Linux install with a Gnome desktop. I've been trying to figure this out for a few days now to no avail.

The relevant code is as follows:

sf::Vector2i cursor_pos = sf::Mouse::getPosition(*window);
sf::Mouse::setPosition(sf::Vector2i(1280/2, 720/2), *window);

This gets called every frame inside a function that messes with some matrices.

I also set the cursor position at initialization.

Any hints or advice would be greatly appreciated.

sentences:
How to create skeletal animation data for a skirt? Please think of this in an engine-agnostic way first, and then we can talk about specific engines.

In my game, I have a 3D character which is wearing a hakama (think of it as a long pleated skirt). This character will be doing a lot of dancing, which I'm getting a lot of motion capture data for. This is how my character is rigged right now (view from Unity):

This character has a standard 3D Studio Max humanoid rig, plus a bunch of bones for the "dangling" stuff such as the skirt, the sleeves, the long hair and other parts.

Unfortunately, motion capture can only give me data for the humanoid part, not for the additional parts, so I need a way to animate these. For now, let's focus on the hakama (skirt). I have a few ways of doing this:

Removing the additional bones, and rig the cloth directly to the leg bones: This is my last resort, but one that I'd like to avoid, as the hakama will move directly with the legs as if it were a tight fit, losing a lot of realism.
Keep the bones and animate them manually. There are just too many frames and too many characters for it to feasible to do this manually, so this is out of the question.
Simulate the leg and cloth interaction in some way. Fortunately, the dancing is static (just for cutscenes), so I can do this offline, export the resulting bone transforms for each frame, and apply this to the character during playback.

Since Unity has a pretty mature physics engine, I am trying to hack an offline physics simulation that exports the resulting bone transforms for each frame, which I can then playback in real time in the actual game (which by the way is not Unity-based). So far, the sleeves and hair have shown some pretty good results, but the hakama is much more difficult, and I haven't gotten it to work even close to decently.

I have tried:

Setting colliders in the legs and the skirt, so when the legs push the skirt, the skirt moves. I can set a bunch of joints to set some constraints, but setting a correct shape and position for the skirt colliders is not trivial, since the leg colliders eventually find a hole between the skirt colliders, which leads to the leg intersecting with the skirt.
Instead of colliders, set spring joints between the leg bones and the skirt bones. Unfortunately, springs don't have a concept of "pushing" vs "pulling", and I can visualize a lot of cases where the simulation will lead to the leg intersecting the skirt.

Notice that I can't use Unity's cloth simulator, since this acts on polygons directly, and I need to be able to export the results of the simulation in terms of bone matrices.

It's not mandatory to use Unity. I just need to find a way to simulate the leg-cloth interaction and export the results in a series of bone transforms.

Any ideas on how to solve this problem?

sentences:
OpenGL object load in reverse I am trying to load a model and it is loading it in reverse. When I am trying to rotate it 180 degrees it changes the lightning as well.
I am not sure what I need to do to change the position that eh model is facing when is being loaded.

This is the object loader:

if (!submarineShader->load("BasicView", "glslfiles/basicTransformations.vert", "glslfiles/basicTransformations.frag"))
{
    cout << "failed to load shader" << endl;
}
glUseProgram(submarineShader->handle());  // use the shader

glEnable(GL_TEXTURE_2D);

cout << " loading model " << endl;
if (objLoader.loadModel("submarine_/submarine v2/submarine5.obj", model))//returns true if the model is loaded, puts the model in the model parameter
{
    cout << " model loaded " << endl;

    model.calcVertNormalsUsingOctree();

    model.initDrawElements();
    model.initVBO(submarineShader);
    model.deleteVertexFaceData();

}
else
{
    cout << " model failed to load " << endl;
}

sentences:
Finding a point between 2 moving points colinearly , given 2 moving points and distance P/S: The engine I work on doesn't have grouping integration. That's why I need a formula to change the position.

A------B---------------C

A and C are moving points that can move anywhere

A = (xa, ya), C = (xc, yc)

B (xb, yb) is a point between A and C colinearly

With one condition that distance of AB = constant = r, distance of AC can be varied.

How to find xb and yb?

Asked from Mathematics StackExchange:

  Deepak says:

  The locus of all possible points B is a circle centred on A and of
  radius r. The intersection between this circle and line AC will give
  you point B (and another point opposite it on the circle which you can
  neglect).

  Try to write down the relevant equations and solve them?

Example: http://www.mathopenref.com/collinear.html

sentences:
How would I balance a multiplayer competitive game I'm looking at my first foray into developing a game, and would love to know whether you guys have any thoughts on game balancing on limited multiplayer games.

The game I have in mind involves a neutral player that has to achieve a goal, with two supporting "deity" players who are one of 'good' and 'evil' - One of the deity players would try to help the player achieve their goal, while the other would try to thwart them.

Any thoughts or pointers on how I can ensure the deities are balanced?

If you want me to expand, I will, just didn't want to give away too much of the game play before I finish it.

sentences:
Do I have to re-assign localized text every time the game loads? I am trying to build a localization system for games. And I have stumbled upon a problem where in Unity you basically have to change all the text in Text components / any other references like audio - when loading a game every time.

To better explain it - if the default language is English and user decided to change language to any other. Even if you localize all the files used in the game via code, later on you will have to do it again, when user loads the game after quiting it. Because components don't persist data changed via code in run-time.

How do I make it so that user would be able to change the language once, and all of those references and text... would persist and didn't require re-set up every time the game is loaded? Is that even possible in Unity?

Or should I just localize after the game has been made. And just allow people to download different language versions. But then again, it makes it difficult for people who want to change their language.

sentences:
Skyrim Creation Kit with Xbox 360 I posted this on stackoverflow but was advised to post here (here is a link to the stackoverflow question). I'm hoping for constructive feedback on its plausibility.

Update on progress: It looks like there are ways to stuff files back onto the console (horizon, modio, xplorer360, etc) and they do require some form of signing.

As of now, though, I've had no luck. I was hoping I could get away with just placing the ".esp" into the directory containing marketplace downloads for Skyrim, along with the signed ".bsa" file (basically a zipped up file containing any extra content the .esp will need to refer that doesn't exist in the basic game).

This doesn't work, at least not in the ways I've tried, so next I'm going to try install the entire game to my flash drive (if possible) and attempt to traverse through the game's directory (this is probably unlikely).

If anyone else has suggestions or luck or wants more detail on my failures comment/answer away.

Here is the question:

  I'm thinking about buying the PC version of Skyrim to get the Creation
  Kit (I already own a copy for the Xbox). I have read the faq and
  scoured plenty of forums to see if there was some way to mod Skyrim
  for a console (Xbox 360, in particular), but they are generally coming
  up negative.

  I realize the CreationKit is on the PC, but I was wondering if there
  was a way to set up the '.esp' (hopefully I'm interpreting this
  correctly) files to be placed on the Xbox 360 file system in a similar
  manner to how game add-ons are downloaded from the Xbox Live
  Marketplace.

  I believe it is possible to transfer saves between the console and the
  PC (e.g. google: 'skyrim mod xbox360'), but these are referencing
  items that already exist in the game (e.g. a console command for
  maximum carry weight does not require reference to new animations or
  models).

  It would probably be easier if one could navigate through the xbox's
  file system to see where the games' files are placed, but with the
  current setup, the file system is abstracted away.

  Any help or insight on the matter would be much appreciated. I would
  love to work on a project that would make it possible to let console
  gamers experience and enjoy all the great mods available to the PC
  community.

sentences:
Unity3D Android - Move your character to a specific x position I want to move my character (which is a cube for now) to a specific x location (on top of a flying floor/ground thingy) but I've been having some troubles with it. I've been using this script:

var jumpSpeed: float = 3.5;
var distToGround: float;

function Start(){
    // get the distance to ground
    distToGround = collider.bounds.extents.y;
}

function IsGrounded(): boolean {
    return Physics.Raycast(transform.position, -Vector3.up, distToGround + 0.1);
}

function Update () {
    // Move the object to the right relative to the camera 1 unit/second.
    transform.Translate(Vector3.forward * Time.deltaTime);

    if (Input.anyKeyDown && IsGrounded()){
        rigidbody.velocity.x = jumpSpeed;
    }
}

And this is the result (which is not what I want):

https://www.youtube.com/watch?v=Fj8B6eI4dbE

Does anyone have any idea how to do this? I'm using UnityScript (Javascript).

sentences:
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:
Does Unity3D custom shader use its default GPU or CPU skinning automatically? I'm writing my own shader in mobile, but was wondering if it uses default GPU or CPU skinning feature in Unity3D?

I'd like to use GPU skinning and already enabled GPU skinning. Is there any way to determine which (GPU or CPU) was actually used?

My shader is as below:

 Shader "Mobile Custom/Specular Map" {
 Properties {
     _ShininessColor("Shininess Color", Color) = (1,1,1,1)
     _Shininess ("Shininess", Range (0.03, 1)) = 0.078125
     _MainTex ("Base (RGB)", 2D) = "white" {}
     _SpecMap ("Specular Map", 2D) = "white" {}
 }
 SubShader {
     Tags { "RenderType"="Opaque" }
     LOD 250
     Cull Back

     CGPROGRAM
     #pragma surface surf MobileBlinnPhong exclude_path:prepass nolightmap halfasview interpolateview noshadow nofog nometa nolppv noshadowmask

     inline fixed4 LightingMobileBlinnPhong (SurfaceOutput s, fixed3 lightDir, fixed3 halfDir, fixed atten) {
         fixed diff = max (0, dot (s.Normal, lightDir));
         fixed nh = max (0, dot (s.Normal, halfDir));
         fixed spec = pow (nh, s.Specular * 128) * s.Gloss;

         fixed4 c;
         c.rgb = (s.Albedo * _LightColor0.rgb * diff + _LightColor0.rgb * spec) * atten;
         UNITY_OPAQUE_ALPHA(c.a);
         return c;
     }

     sampler2D _MainTex;
     sampler2D _SpecMap;
     uniform float4 _ShininessColor;
     half _Shininess;

     struct Input {
         float2 uv_MainTex;
     };

     void surf (Input IN, inout SurfaceOutput o) {
         fixed4 tex = tex2D(_MainTex, IN.uv_MainTex);
         o.Albedo = tex.rgb;
         o.Gloss = tex2D(_SpecMap, IN.uv_MainTex) * _ShininessColor;
         o.Alpha = tex.a;
         o.Specular = _Shininess;
     }
     ENDCG
 }

 FallBack "Mobile/VertexLit"
 }

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:
How can Highscores be more meaningful and engaging? I'm developing a casual Android game in which the player's success can very easily be represented by a number (I'm not more specific because I'm interested in the topic in general).

Although I myself am not a highscore person at all, I was thinking of implementing a highscore for that game, but I see at least 2 problems in the classical leaderboard approach:

very soon the highscore will be dominated by hardcore players, leaving no chance for beginners, who are then frustrated. This is very severe especially in casual games.
there is no direct reward for being a loyal player who plays the game over and over again

My current idea is to "reset" the highscore every 24 hours (for example) and each day nominate the "player of the day" who then gets a "star".
Then there would be some kind of meta-highscore of players with the most stars.

That way even beginners might have a chance to be "player of the day" once and continued or repeated play is rewarded much more.

The idea is still very rough and there are many problems in the details and the technical implementation but I have a feeling it is a step in the right direction.

Do you have creative and new ideas on how to implement highscores?

Which games are doing this well / what types of highscores do you find most engaging?

sentences:
Checking if player is grounded using tilemap collision detection beginner here just trying to learn the basics. I was following this tutorial but I ran into some trouble. Heres a screenshot of unity

So the tutorial calls for tagging the terrain with "Grounded" and essentially checks if the 2D collision box for GroundCheck collides with anything with a "Grounded" tag using the Move2D and Grounded scripts below. Note that the Move2D script is a component of the Player gameobject.
Move2D
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Move2D : MonoBehaviour
{
    public float movespeed = 5f;
    public float jumpforce = 10f;
    public bool isGrounded = false;
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        Jump();
     Vector3 movement = new Vector3(Input.GetAxis("Horizontal"),0f, 0f);
     transform.position += movement * Time.deltaTime * movespeed;
    }
    void Jump(){
        if (Input.GetButtonDown("Jump") && isGrounded == true){
        gameObject.GetComponent<Rigidbody2D>().AddForce(new Vector2(0f, 5f), ForceMode2D.Impulse);
        }
    }
}

Grounded.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Grounded : MonoBehaviour
{
    public GameObject Player;
    // Start is called before the first frame update
    void Start()
    {
         Player = gameObject.transform.parent.gameObject;
    }

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

    }

    private void OnCollisionEnter2D(Collision2D collision)
    {
        if(collision.collider.tag == "Ground")
        {
            Player.GetComponent<Move2D>().isGrounded = true;
            Debug.Log("test");
            print("GROUNDED");
        }
    }

    private void OnCollisionExit2D(Collision2D collision)
    {
        if(collision.collider.tag == "Ground")
        {
            Player.GetComponent<Move2D>().isGrounded = false;
        }
    }
}

The error I'm running into is that it appears unity isn't recognizing that the player has collided with the tilemap collision box, so the bool isGrounded is just perpetually false and the player is unable to jump. Any help would be appreciated!
EDIT: below are screenshots of configs of Grid, gound, and GroundCheck in that order

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:
Where can I find resouces for developing an "Intro to Game Development" class at a Community College? I am an adjunct professor at a technical College in South Carolina.  I currently teach courses in .Net programming and Oracle PL/SQL.  We’ve noticed an influx of students who want to learn more about computer programming and game development in particular.   Their main interest stems from their experiences with video games.  I am a pretty good programmer and have done some simple 2D games in the past.

Now I have been asked to look at possibly developing an "Intro to Game Programming".  The state actually allows the topic to be covered as an accredited course, just hardly any of the schools offer or have faculty that can instruct in the class.
So, I am looking for advice/resources on how to structure the class.  My initial outline is the following.

I plan to use Visual Studio Express C# Edition with XNA Game Development.  The XNA platform is very popular and allows a familiar environment for students and it is FREE!  I am personally a fan of Torque, but my students will all have been introduced to Visual Studio (via prerequisites) by the time they take this class, and I believe Torque will incur extra fees for them if they want to take work home and work outside the lab.
Keep it simple – Input with Controls, 2D side scrolling, character and object animation,  pong type games, basic sound effects and simple collision detection problems.  Being an Intro class and students having to learn C# as they go, I can’t see trying to make this too intensive.

So, now the heart of my question – has anyone done this?  What is the best book to use to teach XNA in a class room setting?

Should we try to write from scratch at the very beginning or go with a basic working game and teach the parts and then have them modify and improve as the semester goes along?

I also feel I need to make it team oriented and make the teams compete with a final demonstration of their games to be voted/reviewed by random selection of students and faculty.

Also, does anyone know of a program/business partnership where I could possibly be lent or given free hardware to use?  Over 90% of my students are full financial aid (Cheraw, SC is very economically depressed) so I need access to game controllers, etc.  Also, the computers we currently have (and budgets keep getting trimmed ) currently run Windows XP and not looking to be upgraded for at least another 2 years.  So an opportunity to borrow some higher end machines would be great along with maybe and Xbox 360!

Also, I am open to using a platform other XNA, but I don’t want to get technically deeper than XNA – therefore going straight against DirectX with C++ is out of question.  Also, it has to be free at least for educational usage.

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:
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:
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:
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:
Really weird peaks when profiling a simple scene with Unity3D I need some help optimizing my game. I have spent last 3 days digging around with no luck. I have noticed really odd results in the unity profiler so, I have created a simple scene with just a cube and a camera, and again, really odd results. Could anybody have a look at this screenshots?:

You will see some significant peaks that make the frame time too high (30fps sometime or less). Scene hasn't any script, no coliders, no rigid bodies (notice the Physics simulate % in one of the shots).

Could anybody explain what is happening?

PD. Target platform is Android. This are taken from a Nexus 4 device.
PD2. Somebody can argue that this is not a real scenario, but I have had this problems in a real game myself and wanted to show a simple example to expose the problem.

Thanks in advance.

sentences:
How to Fill the Gap Between Camera Clip Plane And Skybox? I'm talking about the brown-greyish area i marked with blue. How can i fill it with something that does fit the environment?

I'm looking for a solution like this plugin.

sentences:
Dot product not working as expected Recently I am learning dot product,

While below code works from Unity's documentation,
http://docs.unity3d.com/ScriptReference/Vector3.Dot.html

 public Transform other;
    void Update() {
        if (other) {
            Vector3 forward = transform.TransformDirection(Vector3.forward);
            Vector3 toOther = other.position - transform.position;
         var dot = (Vector3.Dot(forward, toOther);
         Debug.Log(dot);

        }
    }

But it doesn't work when I change direction of "other".It keeps giving same value no matter how much I rotate other unlike when I rotate transform,it does change values.

For example,
transform is at 0 0 0 and other is at 0 0 10 both has 0 rotation so facing straight in Z axis.

The desiire out put I get is negative.

Now suppose I change rotation of transform to 180 then the output gets positive as expected.

I undo the rotation of trasnform and rotate other to 180 i.e., facing transform, then the output doesn't get change and show negative value only.Which is not correct as other is facing player..

Why is that the case? I am not able to get around it.

sentences:
How do I create indoor scene lighting? I'm building the inside of a space ship in Unity as POC. I need info on scene lighting.
Rooms, corridors or just in general how to make an enclosed scene look great with lights.

Keep in mind this is indoors and I can't really use the Directional Light and have to
rely on realistic light sources.

Thanks!

sentences:
Help me understand this vbo/rotation, and how its done opengl c++ Im pretty new to opengl, and I just cant figure out how to rotate this vbo/vao in 2d space. This is how I bind my coordinates:

float points[] =
{
    0.0f,  0.10f,  0.0f,
    -0.10f, -0.10f,  0.0f,
    0.10f, -0.10f,  0.0f
};

glGenBuffers(1, &points_vbo);
glBindBuffer(GL_ARRAY_BUFFER, points_vbo);
glBufferData(GL_ARRAY_BUFFER, 9 * sizeof(float), points, GL_STATIC_DRAW);

I place the vbo at vao[0]

glBindBuffer(GL_ARRAY_BUFFER, points_vbo);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, NULL);

And I enable the array

glEnableVertexAttribArray(0);

and call to draw in the cpu, with

glDrawArrays(GL_TRIANGLES, 0, 3);

In my shader, I load the array by:

//glsl shader
layout ( location = 0 ) in vec3 vertex_position ;
void main()
{
 gl_Position = vec4(vertex_position, 1.0);
}

Ive edited out the coloring/fragment to save space, but this is my problem:
I can make a uniform to move my triangle around, but idk how to apply a transformation matrix to a vec4.

It seems the shader reads my vertex_position VAO one vec/element at a time, and trying to apply any matrix just gives an error.

How do you make or apply a rotation matrix on vao, am I inputting it wrong? All the uniforms I apply seem to only stretch, zoom, or move the overall triangle.

Sorry if the question is bad, or partially confused, shading is new to me overall, so thanks in advance.'

my shader:

#version 410 core
layout ( location = 0 ) in vec3 vertex_position ;
layout ( location = 1 ) in vec3 vertex_colour ;

out vec3 colour;
uniform vec3 fade=vec3(0.0,0.0,0.0); //fade
uniform float zoom=1.0;
uniform mat4 transform = mat4(vec4(1.0,0.0,0.0,0.0),
vec4(0.0,1.0,0.0,0.0), vec4(0.0,0.0,1.0,0.0), vec4(0.0,0.0,0.0,1.0));

void main()
{
colour=vertex_colour+fade;
gl_Position=transform*vec4(vertex_position,1.0);
}

this example https://open.gl/transformations and the answer made it doable.

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

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

model is partially transparent
hidden surfaces are visible.

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

 This is how the rendering should look

sentences:
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:
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:
Programatically Build List of Custom Class Objects (prefabs) This seems like it should be a simple thing, but I cannot seem to figure out a method.

Currently, I have a public List<MapGraphItem> roomList variable, and in the inspector, I add prefabs from Tiled2Unity for a given biome - currently a list of nine tiles for my test biome.  Map generation works great via this method. MapGraphItem is a custom class that is applied to these prefabs via script.

I'd like to programmatically build the list so that I can build it appropriately based on the biome that's being called (dungeon, forest, desert, et cetera).  I seem to be having trouble getting unity to put together a list of the items anyhow (they are in a specific assets folder and also have a specific prefix, in this case "dng_").

I tried this and some variations on it:

List<GameObject> _obj = GameObject.FindObjectsOfType(typeof(GameObject)).Select(g => g as GameObject).Where(g => g.name.StartsWith("dng_")).ToList();

But it seems the objects need to be loaded first (plus, I'd need to convert it to a List<MapGraphItem> before using it).

I could add another field to the MapGraphItem class for biome type and basically load ALL of the assets, but that's a huge waste of resources.  Manually adding these for each biome is really not ideal, and really not efficient.

Thanks!

sentences:
Unable to create a blueprint containing multiple actors I'm having some trouble in Unreal 4.23. According to the documentation, if I select a bunch of Actors and hit the Blueprints button in the toolbar, I should get an option to "Convert Selection To Blueprint Class," which then gives me a choice of three options of what to do with the different objects before creating the blueprint. Instead, I get "Convert Selected Components To Blueprint Class," the dialog asking me what to do with the objects does not show up -- it goes straight to the one asking where to save the blueprint -- and the blueprint it generates is a mess: textures get changed, the names of the actors are lost, and all of the objects are "dropped on the ground" rather than being positioned where they had been relative to each other!
The objects in question are a character (Skeletal Mesh) and several sub-objects representing the character's clothing (also skeletal meshes, attached to the character as sub-objects in the World Outliner hierarchy.) I basically want to do the same thing you can do in Unity: take this character and save it as a prefab so I can make copies of it easily in different maps. From researching the documentation and various forum posts, it seems like making them into a Blueprint using the Harvest Components option is the best way to do that, but that option is never showing up! This problem persists even after closing and restarting Unreal.
Anyone have any idea why the editor is not behaving as documented, and what I can do about it?
(And yes, I know about Prefabricator.  This is supposed to be for Marketplace content, though, where third-party dependencies are discouraged.)

sentences:
Unity: Dimensions of color surface does not match dimensions of depth surface I am receiving the error, "Dimensions of color surface does not match dimensions of depth surface" whenever I attempt to use my screenshot code, without any callstack or anything further insight of what I am doing wrong.

I have a separate camera from my main camera, whose purpose is to take screenshots at different angles.  Hierarchy as such:

The main camera captures the 3D scene just like a normal main camera would, including post-processing components.  No HDR or MSAA.

The GUI camera captures just the UI layer.  Nothing enabled except MSAA.
The canvas and image are simply a watermark, rendered by the GUI camera.

I point both the main camera and GUI camera to the same target render texture.  When ready to take a screenshot, I enable the camera components, thus Unity takes over and tells them to render the frame.  In the OnRenderImage callback, I disable the camera so it can be used again, I remove the render texture I previously assigned, extract the pixels, and save it as a PNG.

In a separate test, this all seems to work as intended.  No error messages.  However, when playing the full game, suddenly I receive the dimensions errors upon each screenshot.

I have read that RenderTexture.IsCreated will test if the render texture is still available.  Supposed, it will be set to false due to a large variety of events, such as window changes.  I have made it impossible to even get the reference to the render texture without it checking if the IsCreated bool is true.  I have also tested if the render texture matches its Descriptor property, out of paranoia.  All of these checks succeed.

I don't know what to look at next.

What is SUPER strange is I have a GIF generator, using quite similar code, that's much more complicated, and it does not suffer from this problem.

Has anyone dealt with this error before?  Any hints at all?

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:
Why is RK4 better than Euler integration? At the end of these great slides, the author compares all the different integrators presented. One way or another, they all fall short except for Improved Euler Integration and Runge Kutta 4 Integration, which both pass all tests.

I suppose I should mention that I am working on a 2D game that isn't very physics intensive. I'm just curious as to where Improved Euler Integration would fall short and RK4 would have to be used instead.

My game consists mostly of simple gravity (jumping and falling), movement along the X and Y axes, and bounding box collision. Is it worthwhile to implement RK4 or would Improved Euler be sufficient? I see many discussions where Euler Integration's users are chastised, but from what I can see, Improved Euler is quivalent in simple 2D matters. I imagine it'd also be faster.

sentences:
Add oceans to an earth model with only continents? I have the following earth model, it only has continents:

I wanted to add water but as you can see, some of the continents are now hidden due to the water sphere being more round than continents:

I tried the following:

downscale water sphere, kinda works but only when it's significantly smaller, overall result is then unconvincing.
change shader and render queue offset, does not do anything actually.

I was hoping that maybe there could be a way to render transparent parts of this earth model as a specific color or eventually another material.

Please do not suggest to use another earth model, I wouldn't have asked the question otherwise :)

sentences:
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:
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:
Why does my value increase a ton when the tab switches from inactive to active? I basically have a lerp function similar to this one: Client interpolation for 100% serverside game when a new server update is received, the update frequency is added to a variable (msAhead) and the delta is subtracted from it every client frame. But when I do it the variable msAhead increases a lot when the tab is switches from inactive to active. Here is my code:

msAhead += updateFrequency; //when new update is received.

(function loop(now) {

var now = Date.now();
delta = now - Time;

Time = now;

msAhead -= delta;

console.log(msAhead);

requestAnimationFrame(loop)

    })(0);

How can I fix my issue?

sentences:
Can I replace the source image of slices by script? I have a Unity2D prefab that uses several slices from a single PNG. (in it sprite renderer, and in its animation clips). If I replace that PNG in the Finder, all slices taken from that PNG are automatically updated, which is great.

But I want to do this by script: just replace the PNG where all slices are taken from, with another PNG. This is so that each of my prefabs instances can all use a different spritesheet PNG source for its slices.

Is this possible in Unity?

sentences:
What does mean the float value in a voxel data? We know that a voxel can be represented by a three dimensional array of boolean or float values. There is an answer that demonstrates this perfectly: the difference between binary/boolean or floating-point voxel.

If we use the binary way, we probably use a byte[,,], so we have 256 slots. They can be used to represent the content. For example, 0 can be air, 1 grass, 2 stone, 3 water.

By this way, we can define what is solid or not and which colour where.

But what about the floating-point way? So my question: What does the float value mean in a floating-point voxel context? Is there a way to use it as the binary way to describe the content and keep the terrain smooth?.

What I've experimented & What I get it?

I've tried to build a mesh with Marching Cube, filled with "random" 3d fractal from Perlin Noise. The result looks very good, but now how I am supposed to define what is what? (Air, Stone, ...)

I am pretty sure the solution was already answered in this answer. Unfortunately, even if I read the answer 5-6 times, I don't get it.

I understand there is a threshold which defines what is solid or not.

Giving me 3 for-loop pseudo code to fill with floating-point the three dimensional array would probably be helpful.

sentences:
Prime31 Plugin Error : "Plugin 'P31RestKit.dll' is used from several locations" I got the following error, when i tried to install "Prime31: MicrosoftAds_2015-04-22" plugin in Unity 5

Plugins colliding with each other
Plugin 'P31RestKit.dll' is used from several locations: Assets/Plugins/P31RestKit.dll would be copied to /P31RestKit.dll, Assets/Plugins/WSA/P31RestKit.dll would be copied to /P31RestKit.dll .Please fix plugin settings and try again.

Thank you

sentences:
Collision Detection in a big map? So I've been wondering lately... on games like pokemon (on ds and gba), How did they handle the collision of all those tiles in the map? Should all those collision checks running in the background slow down the game? Do they have it where the collision activates from a certain distance? Do they have a player event where the player is next to a tile that is not able to be walked on? If it is not possible to know the answer, could you give me a solution to that problem?

I guess what I am really asking is how to handle collision of almost every tile in a big map.

sentences:
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:
How to create a Ghost Replay feature in a game? When you set a personal best lap time in a console racing game, you have the option
to compete against your ghost.

How can this feature be created for a single player casual type game?

sentences:
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:
2D pathfinding - finding smooth paths I was trying to implement a simple pathfinding, but the outcome is less satisfactory than what I intended to achieve. The thing is units in games like Starcraft 2 move in all directions whereas units in my case only move in at most 8 directions (Warcraft 1 style) as these 8 directions direct to next available nodes (they move from a tile to next neighboring tile). What should I do in order to achieve the result as in Starcraft 2? Shrink the tile size?

On the picture you can see a horizontal line of rock tiles being obstacles, and the found path marked as green tiles. The red line is the path I want to achieve.

sentences:
What are the most common AI systems implemented in Tower Defense Games I'm currently in the middle of researching on the various types of AI techniques used in tower defense type games. If someone could be help me in understanding the different types of techniques and their associated advantages.

Using Google I already found several techniques.

Random Map traversal
Path finding e.g. Cost based Traversing Algorithms i.e. A*

I have already found a great answer to this type of question with the below link, but I feel that this answer is tailored to FPS. If anyone could add to this and make it specific to tower defense games then I would be truly great-full.

How is AI most commonly implemented in popular games?

Example of such games would be:

Radiant Defense
Plant Vs Zombies - Not truly Intelligent, but there must be an AI system used right?
Field Runners

Edit: After further research I found an interesting book that may be useful: http://www.amazon.com/dp/0123747317/?tag=stackoverfl08-20

sentences:
How do I get to the Terrain Tools and Advance option in Package Manager in Unity? I am not able to find the Terrain Tools option in Package Manager when I search it. I am new to Unity and that's why I was following a tutorial. The video was about building a terrain and there he told to get the terrain tools first.
For the terrain tools we need to go: Window > Package Manager > Packages > All Packages and then search it
But in the Packages I don't have the All packages option and also I don't have the Advance option as told in the video. I am sure that the Unity editor in the video is of an old version. Currently I am using 2020.3.8 version of Unity.
If there are some major changes between that version(used in the video) and my version(2020.3.8) then where do I find the Terrain Tools and the Advance option?
Screenshot From My Computer -

[NOTE: If there are any confusions, please refer the video]

sentences:
Character Controller + Lag = Massive Teleportation Through Walls I'm working on a fairly robust game with another developer and we've been having a really serious issue with (I believe) the character controller. Specifically, if there's ever a large lag spike (as there are somewhat frequently - the code's not well optimized in some parts) there's a chance that the character controller will wing right through all nearby colliders and fall out of bounds.

It happens pseudo randomly, but I've noticed that it seems to be somewhat predictable, such as standing next to certain objects (nothing weird about them - just tables with colliders).

The lag often is a cause of large chunks of a level having SetActive(true) called on them in one frame or multiple objects being instantiated in one frame. These objects sometimes have colliders/rigidbodies attached but don't seem to be in any direct contact to the character controller.

I can very consistently make it happen by moving towards certain walls (again, very normal walls) and alt-tabbing while my character is still moving also seems to cause the issue predictably, which is VERY strange.

Has anyone ever experienced anything like this with the character controller? I'd give a code sample but honestly not even sure where from the codebase would be pertinent other than

if (Time.deltaTime < 0.15f)
{
    if (applyGravity && noClip == false)
        moveDirection.y -= gravity * Time.deltaTime;

    controller.Move(moveDirection * Time.deltaTime);
}

Which seems awfully straightforward to me. Obviously moveDirection gets changed elsewhere in the function too but it's all similarly bland. I'm pretty experienced with this sorta' stuff and it doesn't ring wrong to me at all.

Some other stuff.

Checked that moveDirection isn't a huge number

Tried eliminating Time.deltaTime from the equation

Fairly sure colliders aren't ending up inside of the player while a lag spike happens (again, alt-tabbing will do it too)

Geometry surrounding the player is clean (box colliders, mesh colliders on well-developed meshes)

Nothing strange like rapidly setting any components on or off is happening to my knowledge.

Anyone have any experience with this sort of issue?

sentences:
Incorrect results for frustum cull Previously, I had a problem with my frustum culling producing too optimistic results- that is, including many objects that were not in the view volume. Now I have refactored that code and produced a cull that should be accurate to the actual frustum, instead of an axis-aligned box approximation. The problem is that now it never returns anything to be in the view volume.

As the mathematical support library I'm using does not provide plane support functions, I had to code much of this functionality myself, and I'm not really the mathematical type, so it's likely that I've made some silly error somewhere. As follows is the relevant code:

class Plane {
public:
    Plane() {
        r0 = Math::Vector(0,0,0);
        normal = Math::Vector(0,1,0);
    }
    Plane(Math::Vector p1, Math::Vector p2, Math::Vector p3) {
        r0 = p1;
        normal = Math::Normalize(Math::Cross((p2 - p1), (p3 - p1)));
    }
    Math::Vector r0;
    Math::Vector normal;
};

This class represents one plane as a point and a normal vector.

class Frustum {
public:
    Frustum(
        const std::array<Math::Vector, 8>& points
        )
    {
        planes[0] = Plane(points[0], points[1], points[2]);
        planes[1] = Plane(points[4], points[5], points[6]);
        planes[2] = Plane(points[0], points[1], points[4]);
        planes[3] = Plane(points[2], points[3], points[6]);
        planes[4] = Plane(points[0], points[2], points[4]);
        planes[5] = Plane(points[1], points[3], points[5]);
    }
    Plane planes[6];
};

The points are passed in order where (the inverse of) each bit of the index of each point indicates whether it's the left, top, and back of the frustum, respectively. As such, I just picked any three points where they all shared one bit in common to define the planes.

My intersection test is as follows (based on this):

bool Intersects(Math::AABB lhs, const Frustum& rhs) const {
    for(int i = 0; i < 6; i++) {
        Math::Vector pvertex = lhs.TopRightFurthest;
        Math::Vector nvertex = lhs.BottomLeftClosest;
        if (rhs.planes[i].normal.x <= -0.0f) {
            std::swap(pvertex.x, nvertex.x);
        }
        if (rhs.planes[i].normal.y <= -0.0f) {
            std::swap(pvertex.y, nvertex.y);
        }
        if (rhs.planes[i].normal.z <= -0.0f) {
            std::swap(pvertex.z, nvertex.z);
        }
        if (Math::Dot(nvertex - rhs.planes[i].r0, planes[i].normal) < 0.0f) {
            return false;
        }
    }
    return true;
}

Also of note is that because I'm using a left-handed co-ordinate system, I wrote my Cross function to return the negative of the formula given on Wikipedia.

Any suggestions as to where I've made a mistake?

Edit: I changed my intersection test somewhat. No change, though.

sentences:
UniRx: Subscribing to ReactiveProperty condition I'm trying to track a cold source with a contiguous range, and every example I've seen involves discrete increments or events that are already handled, so I'm vague on how to apply it.

Here's what I have:

ReactiveProperty<float> CurrentAlpha = new ReactiveProperty<float>(msg.GetComponent<CanvasRenderer>().GetAlpha());
CurrentAlpha.Where(x => x <= 0.0f).Subscribe(x =>
{
    Debug.Log($"CurrentAlpha == {CurrentAlpha} Observed");
    img.transform.SetParent(null);
    Destroy(msg);
});

I verified the alpha value, but never received notice when it reached 0. What have I mistaken?

EDIT: Found that it's actually subscribing to the value returned, which will always be 1. The value it receives is outside managed code, so there's no object property to observe, and CanvasRenderer itself doesn't observe it.

Is it possible to observe a method's return value?

sentences:
stats or profit give away result of game Think of a coinflip game, whose logic looks as follows:

Server sends websocket message (RESULT_MESSAGE) to frontend with result of a game (won/lost)
Server sends websocket message to frontend with updated aggregated stats (STATS_MESSAGE) (think all-time profit after the new coin flip, or updated all-time stats)
Frontend reacts to RESULT_MESSAGE by playing an animation (coin flipping). It also updates the all-time stats and profit in response to STATS_MESSAGE

The problem with this logic is, responding to STATS_MESSAGE (updating profit and stats) gives away the result of the coin flip before the animation finishes.

Solutions I cannot use:

Merging RESULT_MESSAGE and STATS_MESSAGE together, and only updating the  stats/profit after animation finishes. Because those 2 messages are produced and sent by different services.
Linking a particular RESULT_MESSAGE to a STATS_MESSAGE and only reacting to a STATS_MESSAGE when its corresponding RESULT_MESSAGE has been processed and its animation completed. Because in reality I have several kinds of STATS_MESSAGES (trophies updated, stats updated, profit/balance updated, etc), and it's just not practical for the frontend to hold onto all those messages until their respective RESULT_MESSAGE is processed

Solutions I've tried successfully before, but I'm trying to avoid:

Having the backend send STATS_MESSAGE with a delay, to make sure it doesn't reach the frontend before the coinflip animation has finished. This sort of encodes frontend behavior (animation) on the backend.

All ideas and suggestions appreciated. Thanks a lot!

EDIT: I made the coin-flipping example for simplicity, but it's not precisely con-flipping. It's a multiplayer game where dozens of games/animations per user per seconds are going on. So queuing a bunch of stuff on the frontend might be less than ideal (I'm still looking into performant versions of this solution though).

Pulling the STATS data via an API call when the animation finishes (instead of using websockets data) is another alternative that I've considered, but for the same reason described above it might not be feasible (dozens of API calls per user per second). Plus there's a chance that an API call is triggered by game-1 finishing, but while game-2 animation is still going on, giving away the result of game-2

sentences:
Why RaycastAll misses some objects? Update 2 (see below)
I'm writing a turn-based game. During setup phase time scale modifier equals to 0, what prevents running of any physics-based code and FixedUpdates. User have freezed action and may make decisions.
The problem is that sometimes I cannot select objects during the setup mode. I'm doing selection in the following way:

I obtain mouse position ray
I run RaycastAll against this ray without limitations
I check for hit objects, which has Selectable script on them. Then rest of the logic happens.

Mouse handling looks like following:
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

(...)

RaycastHit[] hits = Physics.RaycastAll(ray);

// DEBUG
string debug = "Raycast all gave " + hits.Length + " hits:";
for (int i = 0; i < hits.Length; i++)
    debug += hits[i].collider.gameObject.name + "; ";
Debug.Log(debug);
// END DEBUG

Sometimes though I'm not getting valid results from RaycastAll. Take a look at the following example:

I clicked top-left blue ship. You may see a small sphere on it - I wrote a debug code, which generates a series of spheres along the ray to make sure, that it is valid. Since you see only one sphere here, it seems like everything's OK (note that I added this code to diagnose the problem. Spheres surely aren't causing it)
The scene view looks like following:

It should be clear on this image, that ray hits the ship's box collider. In this specific case, a couple of units next to ship is an explosion, which has bigger sphere collider.

You can also see debug log from the session, which clearly says, that RaycastAll only hit explosion and it missed the ship, which is just next to it.
Now the question is: why RaycastAll doesn't return the ship along with the explosion?
Note, that this problem happens more often and without near objects with colliders, sometimes I just cannot select a ship and all I have to do is to move camera, such that object is closer to center of the screen.

Edit: Now this gets interesting!
I added some debugging. After the RaycastAll, I manually go over all colliders in the scene and verify the raycast. The code now looks like following:
        RaycastHit[] hits = Physics.RaycastAll(ray);

        // DEBUG
        string debug = "Raycast all gave " + hits.Length + " hits:";
        for (int i = 0; i < hits.Length; i++)
            debug += hits[i].collider.gameObject.name + "; ";
        Debug.Log(debug);

        var colliders = GameObject.FindObjectsOfType<Collider>();
        foreach (var collider in colliders)
        {
            RaycastHit temp;
            if (collider.Raycast(ray, out temp, float.PositiveInfinity))
            {
                Debug.Log("Manually verified, that ray hits " + collider.gameObject.name);
            }
        }

        // END DEBUG

And when I try to click the "un-raycastable" object, I get:
Raycast all gave 1 hits:MissileExplosion(Clone);
Manually verified, that ray hits MissileExplosion(Clone)
Manually verified, that ray hits Falcon(Clone)

A bug in Unity engine?

Edit: Yup, a bug in Unity engine.

Hey,
We have been able to reproduce this bug and have sent it for resolution with our developers.
Regards,
Unity QA

sentences:
Unity 5 - Time Remaining displaying in scene but not in Game I'm currently learning game development in Unity from this course on Lynda.com. Currently I'm trying to displaying the time remaining in the game after it has been set to 5 minutes initially. When I look at the scene, I can see the text for the timer displayed in the top left corner of the canvas, but when I run the game, I'm not seeing it at all.

I made a script for a game manager which is derived from a Singleton class. The game manager contains a private variable (and an accessor method) for the time remaining. I have another script that accesses the value for the time remaining and displays it on screen. In the Unity editor, I  added a UI game object for the text box and then added the text box to the GUI representation of the timer label attribute. It seems like everything should be working but since  I'm still very new to this, I'm probably missing something simple. Here is the code for both scripts:

GameManager.cs

public class GameManager : Singleton<GameManager> {
    private float _timeRemaining;

    public float TimeRemaining
    {
        get { return _timeRemaining; }
        set { _timeRemaining = value; }
    }

    private float maxTime = 5 * 60; // In seconds.

    // Use this for initialization
    void Start () {
        TimeRemaining = maxTime;
    }
    // Update is called once per frame
    void Update () {
        TimeRemaining -= Time.deltaTime;
        if(TimeRemaining <= 0)
        {
            //Now Deprecated
            //Application.LoadLevel(Application.loadedLevel);
            SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
            TimeRemaining = maxTime;
        }
    }
}

UpdateUI.cs

public class UpdateUI : MonoBehaviour {

    [SerializeField]
    private Text timerLabel;

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {
        timerLabel.text = FormatTime(GameManager.Instance.TimeRemaining);
    }

    private string FormatTime(float timeInSeconds)
    {
        return string.Format("{0}:{1:00}", Mathf.FloorToInt(timeInSeconds / 60), Mathf.FloorToInt(timeInSeconds % 60));
    }
}

EDIT:

Canvas Settings in the inspector

Image of the Time Remaining displayed in the scene

sentences:
How to prevent Unity3D generates unnecessary changes after saving scene with no actual changes I was having trouble where Git shows a lot of changes (for my case, about ~3000 diff change since I have many objects in the scene) after saving scene (.unity file) in Unity3D, even though there are no changes made on the scene file (.unity file).

Upon checking, I noticed Unity3D recompiled the scene file and some values are just in a different order.
How do we prevent this from happening?
Steps to reproduce:

Open the scene file.
Disable and enable back any GameObject (just to trigger Unity to think there're changes, so you can save the scene file).
Save the scene file.

sentences:
NULL REFERENCE EXCEPTION Object reference not set to an instance of an object So I have 3 scripts:

first for my player movementscript
second for my speed powerup speedscript
third for my obstacle box script i

I'm trying to get the component of box script in speed script, to get the function 'added' (which is in box script) into speed script but it keeps giving me nullreferenceexception error

Here are those scripts:

public class box : MonoBehaviour
{

    [SerializeField]
    GameObject effect;

    public int damage = 1;
    [SerializeField]
    float Speed =10f;
    [SerializeField]
    GameObject audioexplosion;

    void Update()
    {

        transform.Translate(Vector2.left * Speed* Time.deltaTime);

    }

    void  OnTriggerEnter2D(Collider2D col)
    {
        if(col.CompareTag("Player"))
        {
            Instantiate(audioexplosion, transform.position, Quaternion.identity);
            Instantiate(effect, transform.position, Quaternion.identity);

            movment tmp = col.GetComponent<movment>();

                tmp.health -= damage;
            Destroy(gameObject);
        }
    }
    public void added(float spd)
    {
        Speed += spd;
    }

}

And here is my speed script.

public class speedscript : MonoBehaviour
{
    [SerializeField]
    GameObject effect;
    [SerializeField]
    GameObject speedaudio;
    //[SerializeField]
   public float speed;
    public float add_v = 5;
    private float timeindue;
    //[SerializeField]
 //  public box io;

    void Start()
    {

     //  io= GetComponent<box>();
       // Debug.Log(io);
    }

    void Update()
    {
        transform.Translate(Vector2.left * speed * Time.deltaTime);
    }

    void OnTriggerEnter2D(Collider2D sp)
    {
        if (sp.CompareTag("Player"))
        {
            Instantiate(speedaudio, transform.position, Quaternion.identity);
            Instantiate(effect, transform.position, Quaternion.identity);
            box io = GetComponent<box>();
                Debug.Log(io);
                io.added(add_v);

                Destroy(gameObject);
        }
    }
}

sentences:
Screen coordinates to isometric coordinates? I know this has been discussed here before, but I couldn't find an easy solution for my particular problem. I have a tile system and I'd like to convert screen coordinates into isometric tile coordinates. Here's an image to explain what I need:

As you can see, the coordinates are between 0 and 1. I can't figure out a formula for the conversion though. Can you guys help me?

sentences:
Need help choosing the right networking approach/platform for an RTS I have been thinking for a while about making an online 2D RTS-like game. (2-6 players in a match, up to 50-60 units, no AI). The key thing here is that I want the game to be playable in a browser, so it'll have to be either flash or java applet, both using TCP sockets. At first I was entirely focused on flash because of a higher market penetration and accessibility. However, after reviewing different networking approaches I am unable to make a choice.

I really liked lock-step simulation approach where server and every client are running the exact same simulation, until I realized that it's going to be tough as hell (if not impossible) to implement exactly the same logic in two different languages, one of them being actionscript. This is where java comes in. With java client and server can share simulation related code - that may as well cut the development time in half.

But then there is another approach, where clients try to simulate (or rather extrapolate) the game state correctly as long as possible, but they don't have to do it right - at some point they are going to receive the full state snapshot an adjust accordingly. Flash looks like a viable option again, but still, lock-step simulation seems so much more straightforward, as there is no "adjusting" part.

So are my assumptions correct? What would you suggest?

sentences:
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:
Is Unity 5.6 NavMesh Data Available to Gizmos/Editor? I have a script from Dungeon Architect that basically draws Gizmo lines along all connections between neighboring waypoints, which is nice.  However, I'd like to draw a secondary line the follow the lowest cost path on the NavMesh between two points (in the scene view as a gizmo, preferably).  There's a sample I'm trying to work from here:

https://docs.unity3d.com/ScriptReference/AI.NavMesh.CalculatePath.html

However, if I debug through it, path never gets any values.  I created agents on the objects at the two points, thinking maybe that would make a difference (I'm not sure why I thought that).  Does this script need to be attached to one of those points?  With a NavAgent?  Or am I missing something completely obvious?

sentences:
How to write shaders that can be compiled for DirectX, OpenGL, and Vulkan I recently finished writing the DirectX renderer for my game engine.
Now I have an OpenGL, DirectX as well as a not yet finished Vulkan renderer.
Well, the majority of the renderers work perfectly now but I have a problem: I need a shader programming language.
The problem is that OpenGL and Vulkan use GLSL but DirectX uses HLSL (and Apple's Metal API uses MSL). So I searched for a High Level Shader Language and found only C for graphics from NVIDIA. But since this project was deprecated I looked for something else: Without success.
It's a bit annoying to write for 3 shader programming languages at the same time, so I'm looking for a language that can be translated into the native language immediately when the game starts (or is simply compatible with a lot of rendering APIs)
After several weeks of finding nothing, I decided to write my own language for it. But before I invest too much time I want to know if there is another solution to this problem.

sentences:
Design pattern on class level, how to do separation of concerns through mvc or alike? Say i had a Monster class

public class Monster {

}

Now this class has a set of properties like

int health
int speed
int weaponDamage

which details the core information about the monster.

in addition it also needs gui information stored in the model. probably something like this:

int positionX;
int positionY;
int positionZ;
int rotation;

So let's say those are the main properties in our Monster definition. Now we have a couple of methods that do things (besides data getters and setters).

For example:

public void move(){
  //do changes to position.. and rotation variables
}

public void eventIncomingDamage(Projectile p){
  //Incoming projectile did damage to monster
}

public void doDamage(Target aTarget){
  //fire off an damage event on target.
}

So, my question is, how should one go about separating the different data types and methods in such a way it conforms to separation of concerns? Should i have one MonsterController which has the move,eventIncomingDamage and doDamage methods, a Monster class which only has the core information (health,speed,weaponDamage) and what about a MonsterRenderer class (view), how should it fit into all this?

In my example "solution" im thinking along the lines of the MVC pattern. But are there other patterns that should be used in combination or instead?

How would you go about organizing this code into managable and separated blocks?

I hope this can start a good discussion around structuring data, actions and events.

sentences:
Hierarchical "Select GameObject" Dialog or names with prefixes? I am attempting to connect a series of teleporters with entrances inside a single scene. Once the player touches a teleporter he is moved to another place. I am doing this by simply connecting two game objects as shown in the following screenshot. The particle system in the center of the upper side is used as teleporter, the red line indicates the game object where the player will be transported to.

Sadly, this results in an utter mess when attempting to select a new entrance the teleporter should link to. There is no way to guess which entrance corresponds to which side and dice:

So the tl;dr of my problem would be this: The name of the object that should be selected is meaningless when isolated. It's the path to the object (or in other terms: the name of some parent) that is relevant.

I would see three possibilities to solve this, but sadly I haven't gotten around to find out how to do any of them.

Switch the "Select GameObject" Dialog to use the same hierarchical view as used in the scene viewer. Is there a hidden option somewhere in Unity that I overlooked?
Somehow prefix the names of my entrances programatically. Is there a way to include the path to a certain game object in its name?
My whole approach is backwards and I am doing something in a not Unity friendly way. But what would be the "correct" way to do this?

sentences:
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:
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:
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:
can i show logs in unity with different colors or different icon signs? I'm working on a project that has a lot of logging messages that pass very fast.

I can use error logs or warning logs but is there any way to log something with different colors so it is easier to find?

Right now, I just use something like this:

Debug.LogError("show missing gold popup accepted");

sentences:
How to update vertices and indices in OpenGL I want to change and update the vertices and indices of the 3D object.
I am new to openGL and I do not know if this the right place to ask this question.
I searched and read about that, and I found that I should bind the VAO and VBO and make that, but nothing changed in vertices and indices.
The vertices vector class type has the position, normal and uv coords and the vertices vector class type is int. I wonder how I can make changes to these two vectors when I translate or scale the model.
here is the code:
// Create buffers/arrays
glGenVertexArrays(1, &this->VAO);
glGenBuffers(1, &this->VBO);
glGenBuffers(1, &this->EBO);

glBindVertexArray(this->VAO);
// Load data into vertex buffers
glBindBuffer(GL_ARRAY_BUFFER, this->VBO);
// A great thing about structs is that their memory layout is sequential for all its items.
// The effect is that we can simply pass a pointer to the struct and it translates perfectly to a glm::vec3/2 array which
// again translates to 3/2 floats which translates to a byte array.
glBufferData(GL_ARRAY_BUFFER,this->vertices.size() * sizeof(vertex), &this->vertices[0], GL_STATIC_DRAW);

glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, this->EBO);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, this->indices.size() * sizeof(int), &this->indices[0], GL_STATIC_DRAW);

// Set the vertex attribute pointers
// Vertex Positions
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(vertex), (GLvoid*)0);
// Vertex Normals
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(vertex), (GLvoid*)offsetof(vertex, normal));
// Vertex Texture Coords
glEnableVertexAttribArray(2);
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, sizeof(vertex), (GLvoid*)offsetof(vertex, uv));

glBindVertexArray(0);

sentences:
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: Unity crossplatform native plugins I need to create a c++ native plugin for my game. If I want to support macOS and Windows, do I need to write my plugin twice - one in XCode with a bundle project and another in VS for windows or is there a way to support both with one codebase?

sentences:
Texture being stretched when using D3DTADDRESS_CLAMP I'm trying to create a skybox using a cube and using one of this textures: http://forum.unity3d.com/threads/mundus-skybox-pack-01-released.202748/

I've got it working well, but I noticed there are some bugs on the edges of the cube, as it can be seen here:

I found that this could be fixed using clamping, so I set D3DSAMP_ADDRESSU and D3DSAMP_ADDRESSV to D3DTADDRESS_CLAMP. This, however, produced the following result:

Half of the cube wasn't being shown and the other half was only showing a one-pixel wide texture region.
I saw this similar question (which uses wrapping though), but I'm already using 4 vertices per face.
So, what could be causing this?

sentences:
Who should be contacted to request permission, for commercial songs (and cost ballpark) While playing to Fifa, it occurred to me that there is probably a license that EA pay to musicians to play their songs in their game.

Does anyone know if there is a standard license for indie games, to be able to play commercial songs in the game? Either for the intro and for the game itself, like FIFA does.

I did a brief search and the suggestion is to contact the publisher of the specific group/singer; but 90% of the time they probably won't even read such email. Is this the only way?

Of course this won't apply for free music that is distributed to be freely used for any use; my question is specifically for commercial music from decently known artists.

sentences:
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:
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:
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: '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:
Screen effects and antialiasing I have been working on a game for a while using glut for basic window creation.
I was rendering to an offscreen buffer so that I could implement various effects like screen bulging, motion blur, refraction, etc. I also used the screen texture with antialiasing (fxaa).

Now I have changed from glut to sfml. I switched on the in-built antialiasing and it looked much better than my version, but now I don't have the screen in a texture so I can't use the screen effects.

So my question is, how to people normally deal with this issue? Can I take advantage of sfml's antialiasing functionality and retain my effects? I thought about using glReadPixels, but that seems way too slow. Does sfml do offscreen rendering behind the scenes and can I access that texture?

This is not specific to sfml. How do AAA games do it? Do they always implement their own antialiasing techniques?

sentences:
Unity Profiler - How do I correct Audio (WASAPI) Feeder issues? I've got the following data after running the Unity Profiler:

If I'm reading this correctly, the thing that's driving me down to ~1 FPS is the CPU Audio. I can't understand what's going on here, though, because there isn't any audio in my game right now.

sentences:
Why can't I use C routines to load files in Android NDK? I have successfully rendered a triangle with a hard coded shader using NativeActivity of Android NDK. Now I have the requirement to load a shader file. I tried to use fopen but it is returning NULL.

I have researched a little bit and found out there's an AAssetManager which I can use.  I want to know why fopen didn't work and why should I use AAssetManager to load files?

sentences:
Sync bullets node.js phaser.io i am currently having a struggle thinking about syncing bullets.
I am using node js and phaser.io and I am creating top-down shooter.

I would do it like this:
Player shoots a bullet.
Player sends information where that bullet is
Player2 gets information and updates their bullet.

But the problem is, when client window is out of focus. Physics are paused and so are bullet movement, which is horrible for multiplayer game.

How can I achieve synced bullet across two or more clients .

I tried searching for information about server sided physics for node,  but I really couldn't find any.

Thanks

sentences:
2D Topdown Shooter - Line of sight based purely on angle and rotation In a game I'm working on, enemies constantly rotate around as they move around the map. I want them to only shoot the player if they're within a field of view.

This is the function header:

bool inLineOfSight(float playerX, float playerY, float enemyX, float enemyY, float enemyRotation);

Enemy rotation is in degrees not radians. Picture kind of shows what I'm looking for. An enemy should not be able to see the player unless they're within field of view. Should mention that raycasting isn't necessary as I've already sorted that out.

How would I make sure that the player is within an enemies field of view based on angle and position only?

sentences:
Is it possible to use an image, sound or font without importing them externally? [SDL2] It's hard to explain my question, but I will try my best.

When loading sounds, images or fonts in SDL2 (with SDL_image, SDL_mixer, SDL_ttf) you need to load them from an external source path. For example, res/image.png - the issue I have with this is that the user can edit this file which changes the look of the game.

Is there a way in loading the asset internally? (If that's the right term?) So that it cannot be edited by other people.

Thanks.

sentences:
Draw text in OpenGL ES 3D game? I am making a game using OpenGL ES 1.0 and I want to keep player score. So I need to draw text dinamically. What is the best approach? Some library, textures, bitmaps?
I tried to use TextView but when I want to update text I need to do that from main thread, and there is an obvious lag in the game.

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:
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:
An object twice as close appears twice as big? So I was thinking about creating a 2D game where you can also move along the Z-axis, by changing in which layer you are. Depending on the depth I want to scale my 2D sprites.

Once, someone had shown me a demo in which he had a lot of 2d sprites, and by scrolling he could change the depth of the camera. So when zooming in, the objects would come closer to the player, and appear bigger. Then I wondered, how much bigger should an object be when it gets 1 unit closer. How would you calculate that?
So the guy told me: There is one basic rule I am using: "objects twice as close, appear twice as big."

Now, by testing it myself, I know that rule doesn't apply in the real world ;)
But is there some constant that is used in real world calculations for perspective or something? Or a formula?

I know this might not be the best place to ask such a question,
but since this is the only site I use for game-related questions, and my context is a game, I thought I'd give it a try. Also, I am kind of expecting that there is this person here that knows everything about 3D perspectives and matrices or something, since it might relate to 3D games ;)

tl;dr:

"an object twice as close, appears twice as big"
That is not true in the real world.
But which constant or formula is correct?

sentences: How to load a custom SpriteFont? Is there any possible option where you can open a custom SpriteFont? Because I need to add to my game a font that is not in Windows already. I saw this page Custom Sprite Fonts and it's like I want it, but there's no explanation on how to do it...

sentences:
How do I set angular velocity/torque so that it's pointing to velocity/direction? Right now, when I spawn a shootable object, it goes like this:

Because I just set it's angle to this:

float aimAngle = (float) Math.atan2(velocity.y, velocity.x);
bullet.setBodyAngle(aimAngle);

I want it to be like this:

I think I should use angular velocity or torque, but I have no idea how. I can't just set it's angle like in previous code every frame, because it makes physics collisions glitch.

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

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

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

How can I implement it?

EDIT

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

This is what I tried:

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

}

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

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

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

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

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

sentences:
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:
UE4 Blueprint OnActorBeginOverlap not working I am following the tutorial here entitled "Making a Pickup". I have created a Blueprint class from the Statue SM:

I have set the SM Collision Preset to OverlapAll per the instructions. In the Event Graph I have the following:

When I run the simulation and run into the statue, nothing happens. If I monitor the Blueprint I see no triggering. I have wired the everything to trigger from EventBeginPlay and it all works as expected, but the ActorBeginOverlap node never triggers.

What am I missing?

sentences:
C++ map isn't finding key even though it exists I am in the process of learning C++ for the Unreal engine.
I am trying to figure out why when I use the [] operator on a map<Vector2, ControlNode> with a value that I know is in the map, it returns nullptr.
Here are the relevant pieces of code:
Vector2
**Vector2.h**
class MAGICGAME2D_API Vector2
{
public:
    Vector2(float x, float z);
    Vector2();
    float X;
    float Z;

public:
    friend bool operator< (const Vector2& c1, const Vector2& c2);

};

**Vector.cpp**
bool operator< (const Vector2& c1, const Vector2& c2)
{
    return (c1.X < c2.X ||
        c1.Z < c2.Z);
}

Creating the map:
for(auto values : *data->getAutomata()) {
    auto pos = values.first;
    shared_ptr<ControlNode> node = make_shared<ControlNode>(pos,values.second);
    controlNodes.emplace(pos,node);
}

And this is the place I make the call to check if the value is in the map:
shared_ptr<ControlNode> node = (*(*data).getControlNodes())[pos];

The data variable is a pointer, that points to an object that holds a shared_ptrstd::map<Vector2,shared_ptr<ControlNode>>. So that is why I am double dereferencing that part of the code.
This call to retrieve from the map acts a bit odd. Sometimes it will work. For example, where pos = Vector2(0,0). But then it will fail where pos = Vector2(0,25), and it will return a nullptr. The weird thing is that I have confirmed that pos = Vector2(0,25) is already in the map.
Is there something I am doing wrong with the call to retrieve the shared_ptr<ControlNode>?

sentences:
How can I reverse engineer an old MMO? I want to revive an old MMO.

Only the old client exists from the game, so I would have to write a whole server for it.

I'm not sure how to start editing things in the already made client. Most likely I will need catch requests and somehow change those to my own.

How do I go about actually working/editing that client? What should I use, having only .dlls on some other already compiled files?

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:
Trouble with speed and vectors I'm working on adding bullets to my game.  Right now I can shoot bullets in the direction that I would like from a ship by getting the ship's angle:

int speed = 5;
int dx = -(cos(degreesToRadians(ship.angle)) * speed); // rate of change in the x direction
int dy = -(sin(degreesToRadians(ship.angle)) * speed); // rate of change in the y direction

bulletPosition.addX(dx); // addX(dx) is simply bulletPosition.x += dx
bulletPosition.addY(dy);

The ship is pretty much the exact same thing, except I use the += operator:

int dx += -(cos(degreesToRadians(angle)) * 0.15)
int dy += -(sin(degreesToRadians(angle)) * 0.15);

shipPosition.addX(dx);
shipPosition.addY(dy);

I would like to be able to add the ship's velocity to the bullet's velocity, but I'm a little confused as to how should get the speed from the ship's vector.  I thought that adding the ship's dx to the bullet's dx like int dx = -(cos(degreesToRadians(ship.angle)) * speed * dx) would work because I'm adding the rate of change of the ship to the rate of change of the bullet, but that doesn't work.  So here's the final question: How can I get the speed of my ship and apply it to my bullet's speed?

Thanks in advance for all help :)

sentences:
How to import a NET .dll newer than 2.0 into Unity? I'm trying to build one of the simple EventBus libraries from Github and import them into Unity. Here are the libs:

TinyMessenger and
RedBus

It's that simple - I take the source code, build it through the VS2015 and place the .dll into the Assets/Plugins folder.

Then, I have no way to use the lib's namespace (Unity doesn't read the file).

Both of these libraries are written in NET 3 or 4 and this is the failure's reason.
I've recompiled the second one (removed the System.Linq code, changed the project's version) to NET 2.0 and it worked, but that's not the point. I need the first library and it ain't easy to rewrite the entire 4.0 code to 2.0 without Linq.

As I remember, you can use System.Linq in Unity (at least, I did it once). This means that Unity uses some kind of trickery/magic, as always.

What's the problem here? Is there any way to get this working?

sentences:
Create an infinite scroll using CCParallaxNode in Cocos2D-X I'm trying to create an infinite scroll using two images in a CCParallaxNode, making one move to the end of the scroll when it gets off the screen. I have tried several implementations but none has worked. The method setPosition is not available for the sprites once they have been added to the parallaxnode, and the array where the offset positions are stored is not documented so I don't know how to handle it.

Given that you cannot add the same child twice because the program crashes, I have tried to add a new sprite at the end whenever the old one dissappeared from screen. But the getPosition methods for either the sprites or the scroll doesn't seem to give accurate positions to calculate when a sprite is outside the screen. I ended up implementing a loop that added N sprites in a row and then "breaking" the program.

I was using a scaled image for the sprite with 512 width, scaled times 5. Screen size 1024x768

EDIT FOR CODE SNIPPET

init

voidNode = CCParallaxNode::node();
parta = CCSprite::spriteWithFile("backg.png");
parta->setScaleX( 5 );
parta->setAnchorPoint(ccp(0,0));
parta->setPosition(ccp(0,0));
voidNode->addChild(parta, -1, ccp(0.4f,0.5f), ccp(0,0));

maxscroll = parta->getContentSize().width*5;

CCMoveBy* moveRight = CCMoveBy::actionWithDuration(0.1f,ccp(-600, 0));
CCRepeatForever* repeat =
        CCRepeatForever::actionWithAction((CCSequence *)CCSequence::actions(moveRight,0));
voidNode->runAction(repeat);

update

// I tried with voidNode->getPos() and voidNode->m_tLastPosition.x too
int newPos = parta->getPosition().x;
if (maxscroll - abs(newPos) - initPos) < level->getContentSize().width*5){

// 1st: parta->setPosition wont work, even when goten as child
// 2nd: I dont now how to access the m_pParallaxArray to alter the offset positions

// 3rd implementation
parta = CCSprite::spriteWithFile("backg.png");
parta->setScaleX( 5 );
parta->setAnchorPoint(ccp(0,0));
voidNode->addChild(parta, -1, ccp(0.4f,0.5f), ccp(maxscroll,0));
maxscroll += parta->getContentSize().width*5;
}

sentences:
Animation conversion failed: transform for bone not found? I'm trying to animate my first humanoid, and the animations in the Standard Assets pack (HumanoidIdle etc) work really well right out of the box. However, when I try to use other fbx files, like those in Unity's "Raw MoCap Data" pack, I get errors.

I import the animations, select one, go to "Edit…" and go to "Rig", select "Humanoid", copy the avatar definition from the character I'm trying to animate (e.g. Robot Kyle), and under "Animations" I will get an error like "Imported file RunBackward conversion failed: Transform 'Left_Thigh_Joint_01' for human bone 'LeftUpperLeg' not found". When I compare the avatar of the character I'm trying to animate with the avatar that comes with the animations, they have the same bones defined, just with different names (which shouldn't matter, right?), so it's not that bones are missing. Using the animation with the default avatar also doesn't work, I get no error but my character goes into the first frame of the animation but then freezes. I've tried this with the standard models Ethan and Robot Kyle to the same effect.

Does anyone know how to handle this import error?

sentences:
How can a NodeJS server be used from Game Maker HTML5? I want to create a client-server game that runs on Game Maker HTML5-NodeJS. The NodeJS server will be an AI server - a bot that acts like a human opponent and plays against the human player at a front-end game client that is coded in GM HTML5.

How can a NodeJS server be used from GM HTML5. Are there any examples of such a system?

I already got an iOS game that can talk to a remote AI server (coded in Lua) using TCP sockets. Can this be done with Game Maker HTML5 and NodeJS.

sentences:
Gun clipping through arm during third-person animation I have been setting up a Blend Tree for motion animation in Unity. I'm using Root Motion for now. I parented the gun to the root of the player and then I use OnAnimatorIK to lock the two hands in position.
The overall looks and feel is great by my standards. The only thing I am disappointed about is the butt of the gun clips through the character's upper arm when running.

Is there a way to crop this in the game? I'd like to avoid going into a 3d Editor and making it two separate meshes which I could then I guess somehow disable. I'm hoping there is a better way to handle this situation.
Also I wonder if the gun being parented to the Root player object is wise. I had tried parenting to the 'right-hand' bone but this made the gun point upwards about 45° and looked silly.

sentences:
Level selection view - similiar to Angry Bird's I am making game and need to prepare view for level selection. Could you recommend me some opensource library which could I use? I need icons to vibrate after long pressing one of them, some callbacks after choosing them, possibility to prepare custom icon's view, page control and horizontal scrolling. I was trying to use OpenSpringBoard but weirdly couldn't see scrollview and pagecontrol working in this project - it seems that there's possibility to use only one page. On the other hand, myLauncher(https://github.com/dlinsin/myLauncher) isn't so easy to include in project, as I need a seperate view with some delegate methods.

I need to be compatible with >iOS 4.2

sentences:
Does gimbal lock occur only when a combination of local and world rotation axis are used? In all the explanations I've seen of gimbal lock, they always refer to the fact that when performing a series of rotations on all axes, it is possible that one rotation might end up aligning an axis with another which causes us to lose a degree of freedom. This never made sense to me since a rotation around e.g. the LOCAL_RIGHT axis will rotation the whole LOCAL_BASIS, no alignment happens. The only explanation I've seen that made sense was this one by DMGregory where it clearly explains that gimbal lock occurs when we e.g. change the yaw using the local basis and the pitch using a world basis.
My question is: Is that the only scenario where gimbal lock occurs or am I missing something? I also thought that quaternions help avoid gimbal lock but again, I'm missing something here because it seems to occur regardless of the rotation representation method (euler/quaternion).

sentences:
How do I implement efficient collision avoidance in 100 enemies I am developing a libgdx game. It is a top down shooter and I am trying to make a good AI. I have tried to implement A* from the AI library from libgdx and it works fine but when i have a lot of enemies it starts to slow down the game. Have tried implementing a Pathfinding manager to manage threads and path requests but I have trouble implementing it and still slows down.

Also I know A* is a bit overkill for my game, which is a big open zone mostly (see pic of my map)

So I tried to implement this collision avoidance Steering Behaviors: Collision Avoidance but it doesn't go well when the player is inside houses.

My question is, does exists some type of algorithm that fits perfectly for what I am asking? There are a lot of games with hundreds of enemies going to kill you so I bet there is a way, just I cant find out

pd: Any doubt ask and I will provide more information if necessary

sentences:
Sticky Conveyor Belt I'm working on having a sticky conveyor belt, so that objects can also go around it. But my objects currently get stuck half way, as seen in the picture.

This is the movement code of the conveyor belt.

private void HandleCargo()
{
    var _speed = speed * Time.deltaTime;
    foreach (var cargo in _cargo)
    {
        var change = cargo.Key.transform.right * _speed;
        cargo.Key.transform.Translate(change);
    }
}

And the code taking care of the rotation to the surface.

private void Update()
{
    Debug.DrawRay(transform.position, -transform.up, Color.black);

    if (!Physics.Raycast(transform.position, -transform.up, out var hit, _distance)) return;
    var normal = hit.normal;

    transform.up -= (transform.up - hit.normal) * 0.05f;
}

If someone has pointers as to why this happens, that would be great. I kind of have an idea, since the transform right of the conveyor code is pointing inwards at this angles so the movement doesn't happen around the belt anymore, but I exhausted my attempts to fix it...

Edit: After DMGregory answer a new issue appeared. As soon as the cube starts to adjust to the spheric surface it is not exactly on the mesh anymore, which triggers my on collision exit code and stops movement on the object. I have some code that is supposed to stick the object to the belt, but that doesn't seem to work?

The sticky code

private void Update()
{
    Debug.DrawRay(transform.position, -transform.up, Color.black);

    if (!Physics.Raycast(transform.position, -transform.up, out var hit, _distance)) return;

    transform.rotation = Quaternion.FromToRotation(transform.up, hit.normal) * transform.rotation;
    transform.position = new Vector3(transform.position.x, hit.point.y + 0.5f, transform.position.z);
}

sentences:
How can I make trailing ghost effect (3d game)? I'm trying to draw previous frame of animation on screen
you can see this effect here: https://youtu.be/WNL_KJNl6pU
Mortal Combat X (left) , Street Fighter Alpha 2 (right):

This effect also found in animation software and called onion skinning:

I've implemented this by spawning object every second but I think It is possible with shader.

Update
I could make this effect by using RenderTexture for capturing previous frame , but I can't remove background color :(
I tried with Blending and grab pass but don't work(it was rendered normally)!!
sources :
https://github.com/smkplus/TrailingFX
https://unitylist.com/r/4tp/unity-fluid-2d-blur-image-effect

sentences:
Different ways to mark the status of an enemy I have a 3D game with a "eagle view", I have enemies and I have magics that will affect the status of the enemies.

I want to show the status of the enemies( frozen, on fire(dot damage), slowed...etc)

I think about two possibilities

Put a 2D image in the enemy that show status
Change the color of the enemy with vertex shaders

Is there other,or correct way?
In case of use vertex shader, how I change the color of enemy without losing all details(Something like a filter)?
shaders

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

sentences:
Why am I not getting stuck in the loop I'm new to Unity. I was learning coroutines and I wrote this.

private void Fire()
{
    if(Input.GetButtonDown("Fire1"))
    {
        StartCoroutine(FireContinuously());
    }
    if(Input.GetButtonUp("Fire1"))
    {
        StopAllCoroutines();
    }
}

IEnumerator FireContinuously()
{
    while(true)
    {
        GameObject laser = Instantiate(LaserPrefab, transform.position, Quaternion.identity) as GameObject;
        laser.GetComponent<Rigidbody2D>().velocity = new Vector2(0, 10f);
        yield return new WaitForSeconds(firetime);
    }
}

When the button is pressed the coroutine is called and it enters the 'while' loop. When I leave the button it stops the coroutine. Shouldn't it get stuck in the 'while' loop as it is an infinite loop ? Why?

sentences:
assigning values to shader parameters in the XNA content pipeline I have tried creating a simple content processor that assigns the custom effect I created to models instead of the default BasicEffect.

[ContentProcessor(DisplayName = "Shadow Mapping Model")]
public class ShadowMappingModelProcessor : ModelProcessor
{
    protected override MaterialContent ConvertMaterial(MaterialContent material, ContentProcessorContext context)
    {
        EffectMaterialContent shadowMappingMaterial = new EffectMaterialContent();
        shadowMappingMaterial.Effect = new ExternalReference<EffectContent>("Effects/MultipassShadowMapping.fx");
        return context.Convert<MaterialContent, MaterialContent>(shadowMappingMaterial, typeof(MaterialProcessor).Name);
    }
}

This works, but when I go to draw a model in a game, the effect has no material properties assigned.  How would I go about assigning, say, my DiffuseColor or SpecularColor shader parameter to white or (better) can I assign it to some value specified by the artist in the model?  (I think this may have something to do with the OpaqueDataDictionary but I am confused on how to use it--the content pipeline has always been a black box to me.)

sentences: What is the best way to debug and profile a web application on an iPod in Mobile Safari? I've built a web app that makes heavy use of JavaScript and HTML5 canvas. It's easy to debug in Chrome, but on a mobile device the developer tools are much less robust. Is there a tool or technique that will enable me to easily debug and profile my application on an iPod in Mobile Safari?

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: How to make a car follow a path? I have a 2D game and my goal is to make a car follow a path (the road in the picture) and rotate in the same time. I tried a plugin in the assets store but it didn't work well for me and i had difficulties making work as intended. If you have any suggestions, i ready to listen. Thanks for help in advance.

sentences:
How to move gameobject with touch on Android I'm trying to make a game where you control a character via touch on Android devices.

The player will have two degrees of movement.

When you touch the touch screen and move your finger, the game object should move to your finger's location and follow your finger as you move it.

Here is an example of what I'm trying to do: http://www.youtube.com/watch?v=OoqRC8QptzM#t=01m01s (@ 1:02).

I already know I need to use Input.touches.

I've tried using Transform.translate and Vector3.Lerp, neither gave me the results I wanted.

Here is some of the code I've tried using:

#pragma strict

var speed : float = 1;

function Start () {

}

function Update () {
    if (Input.touchCount > 0 &&
        Input.GetTouch(0).phase == TouchPhase.Moved) {

        // Get movement of the finger since last frame
        var touchDeltaPosition:Vector2 = Input.GetTouch(0).deltaPosition;

        var touchPosition:Vector3;

        touchPosition.Set(touchDeltaPosition.x,
                           transform.position.y,
                           touchDeltaPosition.y);

        // Move object across XY plane
        transform.position = Vector3.Lerp(transform.position,
                                                touchPosition,
                                                Time.deltaTime*speed);
    }

}

sentences:
What is the easiest and shortest way to draw a 2d line in c/c++? I am fairly new to c/c++ but I do have experiance with directx and opengl with java and c#. My goal is to create a 2d game in c with under 2 pages of code. Most of what I have seen requires 3 pages of code to just get a window running.

I would like to know the shortest code to get a window running where I can draw lines. I believe this can be done in less lines with opengl versus directx. Is there maybe an api or framework i can use to shorten it more?

Also, it would be nice if the solution were cross platform compatible.

sentences: Distant objects remain fully lit at sunset, when they should be in the mountain's shadow I'm trying to make dynamic sunrises and sunsets in my game but I have some problems. My scene is surrounded by mountains and when the sun tint is still hot the sun is not visible but, the trees that are far from the player (Around 100 meters) are lighted like if the mountains are not casting shadows, and when I get closer to theses trees they become black as they should be. If I extend the shadows distance it changes nothing. Also, when the sunrise, even if it should not be visible it should do some ambient lighting, but everything is totally black except some trees.

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:
Breaking ocean waves simulation I am working on a project where I have to approximately simulate the ocean waves. Currently, I am using a mesh modification approach. I am able to simulate low amplitude waves using the following equation:

yVal = Mathf.Sin(180 * Mathf.Deg2Rad / freqUpdated + Time.time * speedOFWave) * halfWaveHeight;

Now, I want to extend this equation to simulate breaking waves for a high value of "wave height".

Approach tried:

I tried creating code similar to this plugin but the smooth transition between low amplitude waves to these breaking waves is not possible with that approach.

I have the following questions:

What kind of modification can be done to the above sin wave equation to simulate breaking waves?
Are there any other mathematical techniques that can simulate low amplitude and breaking waves?
Is it feasible to do this type of ocean simulation using water particles?

I would appreciate any suggestions and thoughts on this topic. Thank you.

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:
How can I destroy particles on collision with specific a GameObject? I wrote a script to manage my Particle System emission. The starting lifespan is set to infinite so that the particle never dies until it reaches a specific collider. I didn't find any method to destroy a specific particle in the Unity Manual.
How can I do this?
Here's the code (updated to show the partial fix)
using UnityEngine;
using System.Collections.Generic;

public class PlayerDamage : MonoBehaviour
{
    private ParticleSystem ps;
    public List<ParticleCollisionEvent> collisionEvents;
    public int attackValue = 1;

    //
    [Range(0.0f, 100f)]
    public int maxParticles;
    public float particleLife;
    public bool neverDies;
    public float particleSpeed = 8.0F;

    void Start()
    {
        ps = GetComponent<ParticleSystem>();
        collisionEvents = new List<ParticleCollisionEvent>();
        //
        var collision = ps.collision;
        collision.enabled = true;
        collision.type = ParticleSystemCollisionType.World;
        collision.mode = ParticleSystemCollisionMode.Collision3D;
    }

    void OnParticleCollision(GameObject other)
    {
        int numCollisionEvents = ps.GetCollisionEvents(other, collisionEvents);

        Rigidbody rb = other.GetComponent<Rigidbody>();
        int i = 0;

        while (i < numCollisionEvents)
        {
            if (rb.CompareTag("Enemy"))
            {
                BaseHealth baseHealth = other.GetComponent<BaseHealth>();

                if (baseHealth != null)
                {
                    Vector3 pos = collisionEvents[i].intersection;
                    Vector3 force = collisionEvents[i].velocity;// * 10;
                    rb.AddForce(force);
                    baseHealth.TakeDamage(attackValue);
                }
            }
            i++;
        }
    }

    void Update()
    {
        var collision = ps.collision;
        collision.maxKillSpeed = particleSpeed;

        Debug.Log("Particles Alive Count: " + GetAliveParticles());

        ps.Emit(maxParticles);
        var main = ps.main;
        main.maxParticles = Mathf.RoundToInt(maxParticles);
        main.startLifetime = particleLife;

        if (neverDies)
        {
            particleLife = float.PositiveInfinity;
        }
        else
        {
            particleLife = 5f;
        }
    }

    int GetAliveParticles()
    {
        ParticleSystem.Particle[] particles = new ParticleSystem.Particle[ps.particleCount];
        return ps.GetParticles(particles);
    }
}

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: How should a programmer get started with creating 2D Sprites? I am a programmer. Given a sprite sheet, I can code game as per the requirements. But I do not know how to create these sprites. I use Cocos2D. And I do not know where to begin. I have never done anything art-related before. I am aware of TexturePacker. But it only packs already created sprites. So how do I get started with creating 2D sprites? Are there any dedicated softwares for this purpose? Main main concern is about creating assets for Retina Displays.

sentences:
What is an achievable way of setting content budgets (e.g. polygon count) for level content in a 3D title? In answering this question for swquinn, the answer raised a more pertinent question that I'd like to hear answers to. I'll post our own strategy (promise I won't accept it as the answer), but I'd like to hear others.

Specifically: how do you go about setting a sensible budget for your content team. Usually one of the very first questions asked in a development is: what's our polygon budget? Of course, these days it's rare that vertex/poly count alone is the limiting factor, instead shader complexity, fill-rate, lighting complexity, all come into play.

What the content team want are some hard numbers / limits to work to such that they have a reasonable expectation that their content, once it actually gets into the engine, will not be too heavy. Given that 'it depends' isn't a particularly useful answer, I'd like to hear a strategy that allows me to give them workable limits without being a) misleading, or b) wrong.

sentences:
How do I build games with scripted actors? The idea

I have an idea for a game. A few games, actually, that can built on top of the same general design.

There is a game world that the player and the other actors exist in. The player can get information from the world about his surroundings. The player can also interact with the world, picking up an object for example.
Now, I would like the same thing to be possible for other, scripted actors. They are the player's competition. Instead of navigating the world and performing actions based on human input, a script should decide what they do.

An example

I want to do this using a 2d world eventually, so I might as well give the example I want to build:

There is a 2d world with objects of various sizes and shapes. Every actor has their own field of view. They get information from the world about the objects in their field of view. For the player, this information is displayed on the screen of the user. The player navigates the world by user input.

Scripted actors navigate the world in a scripted way. They walk in a general direction, they follow a wall or things like that. Their scripts should be able to get the information about the objects in their field of view and act on it. If an other actor is detected in their field of view, they should walk in that direction for example.

All of this should happen in pretty much real-time.

The information gotten from the world (showed to the player, and given to the scripted actors) in this case would be something like a collection of "what", "where", and "in what orientation".

The question

My question is: how I can program this effectively and efficiently?

I am thinking to build this with C and Lua. C++ is also an option.
I would store the game state and display the graphics using C.
The part that I don't know how to handle is the interaction between C and Lua.
Not programming-wise, but design-wise. The interaction between the world and the scripted actors.

Should C provide the Lua actors with information, and then have the Lua actors call C functions that change their direction, move a step forward, etc? Will this work in real-time?

I realize that this question is broad, but I think it's not unreasonable. There are obviously ways to do this and I would like to know some.

sentences:
Bounding box of a rotated rectangle (2d) I can see this has been asked before in various ways. I am struggling to work it out though hence asking again.

2d sprite that moves and rotates. I'm looking to contain it in a bounding box as it appears that is the most efficient way to do collision detection.

I had no problems getting it to work without rotation but that is simple! Now the sprite rotates I can't seem to find the right way of writing the code.

To create a bounding box for the sprite, my understanding is I need to work out the 4 corners of the sprite after rotation and use these to work out the width + height of the correctly sized bounding box.

I've used the article here - http://msdn.microsoft.com/en-us/library/dd162943(v=vs.85).aspx - specifically the formula:

x' = (x * cos A) - (y * sin A)
y' = (x * sin A) + (y * cos A)

The code I'm currently using:

x1 = (positionX * Math.cos(rotation)) - (positionY * Math.sin(rotation));
y1 = (positionX * Math.sin(rotation)) + (positionY * Math.cos(rotation));

x2 = (positionX+width/2 * Math.cos(rotation)) - (positionY+height/2 * Math.sin(rotation));
y2 = (positionX+width/2 * Math.sin(rotation)) + (positionY+height/2 * Math.cos(rotation));

positionX and positionY is the current top left hand corner position of the sprite.

rotation is the radians the sprite has been rotated by (and rotation is from the centre).

width and height are of the sprite.

I thought the code above would give me the co-ordinates of the top left and top right corners of the rectangle, rotated appropriately. However, on my canvas, I'm drawing a line from x1,y1 to x2,y2 and it doesn't follow the sprite at all!

Any suggestions? Sorry for the long post!

Cheers!

sentences:
What is the term for making an object transparent when it blocks the player's view? In many games if your camera gets too close to certain objects, or the object starts to block your screen, the game turns it transparent so you can still see.
What is the name for this effect? It is not  occlusion culling. The model does not reduce its polygons, it simply just gets transparent so that you can look through it.

sentences:
How can I render 3d objects over uGUI? I have a scene with 3d objects but need uGUI as background.

How can I achieve this?

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:
Libgdx rendering problems Have problems with rendering moving character using ShapeRenderer, it twitches while moving, and I don't understand where from comes the problem - bad game structure (do I need to override draw method from my actor,or just draw all entities in Stage's draw method) or troubles with movement logic.I'll add information if needed.

MainClass:

public class MFightGame extends Game {

@Override
public void create() {
    setScreen(new GameScreen());
}

@Override
public void render() {
    super.render();
}}

GameScreen:

public class GameScreen implements Screen {

private GameStage stage;

@Override
public void show() {
    stage = new GameStage();
}

public GameScreen() {

}

@Override
public void render(float delta) {
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    stage.draw();
    stage.act(delta);
}

@Override
public void resize(int width, int height) {
    // TODO Auto-generated method stub
}

@Override
public void pause() {
    // TODO Auto-generated method stub
}

@Override
public void resume() {
    // TODO Auto-generated method stub
}

@Override
public void hide() {
    // TODO Auto-generated method stub
}

@Override
public void dispose() {
    // TODO Auto-generated method stub
}}

GameStage:

public class GameStage extends Stage {
private Creature creature;
private final float TIME_STEP = 1 / 300f;
private float accumulator = 0f;
private ShapeRenderer renderer;
private OrthographicCamera camera;

public GameStage() {
    creature = new Creature(100,100);
    addActor(creature);

    camera = new OrthographicCamera(800, 600);
    camera.position.set(camera.viewportWidth / 2f,
            camera.viewportHeight / 2f, 0);
    camera.update();
    renderer = new ShapeRenderer();
    renderer.setProjectionMatrix(camera.combined);
    Gdx.input.setInputProcessor(new InputHandler(creature));

}

@Override
public void act(float delta) {
    super.act(delta);
    accumulator += delta;
    while (accumulator >= delta) {
        accumulator -= TIME_STEP;
    }
}}

sentences:
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 can I cast light onto a sprite in 3D environment? I'm making a 2.5D game, where 2D sprites are in a 3D environment. I'm using URP and I have a problem with lighting the sprites. The sprites are lighting up from behind, and not front. I tried with directional, spot and point lights but the result is the same no matter what official shader I use they only light up when they receive light from behind. Front light has no effect whatsoever on the sprites.
I spent the entire day looking for a solution but I've got almost nothing. Only solution I saw someone else mention is making the game object with the "sprite renderer" on, a child of another gameobject and rotate it 180 degrees on Y. But that is not an option for me cause I'm using custom scripts to rotate that game object already.
So can there be a custom shader? Can one be created using shadergraph maybe? I know some others have faced the same problem but did anyone really solve it?
Thanks.

sentences:
Unity raycast equivalent in Unreal I've been moving from Unity to Unreal and I'm finding it difficult to grasp the Raycast (Trace) logic of Unreal.

The use case I'm trying to implement at the moment is to trace a ray and check if I hit a specific set of objects or if there are other objects blocking the line of sight.

In Unity, I would use Raycast, define a new specific Layer, set the object layer to it, create a LayerMask with that Layer and Raycast. I consider this method to be performant as the use of layer masks provide a form of optimization and most importantly I'm guaranteed that if the ray hits an object than it's because its layer is part of the layer mask and if I'm using multiple layers I could simply check which layer the hit object has.

In Unreal it's been harder to understand what are the solutions that offer better performance and are easier to use. The C++ documentation for Line Trace (channel or object type) is very poor when comparing to Unity's.

Can anyone shed some light on how to move from the Unity logic to Unreal using the above use case as an example?

sentences:
Tilting a game object left/right/forward/back with gyroscope, regardless of player's heading I'm working on a mobile game in Unity and using the gyroscope to rotate an object along the x and y axes.

float x = Input.gyro.attitude.x;
float y = Input.gyro.attitude.y;

This code give me the rotation I want when pointed in a certain direction along the z-axis. I want the rotation to not depend on the z-axis. I want the rotation to act the same no matter what direction I'm pointed in the real-world.

Here is a 12 second clip of what I get using a mobile gyroscope when pointed at 1 or North on the z-axis:

I want the rotation to be the same no matter what direction I am pointed on the z-axis with the gyroscope. Is there some way to rotate the whole coordinate system?

sentences:
Questions about the obj file format I'm wirting my first OpenGL Application for Android at the moment and now I get stuck on the ObjectLoader for obj files. I have some qestions to this file format and I can't an answer on the internet for this. Maybe it is easier if we go throught all these questions with an example file:

#Cube file - has no texture
mtllib dice_material.mtl

v 0.475013 0.999999 -0.066651    # 1
v 0.457026 0.999999 -0.067220    # 2
v 0.439582 0.999999 -0.067505    # 3
...
vn 0.000000 1.000000 0.000000    # 1
vn 0.000000 0.999969 0.000000
vn 0.000000 0.778466 0.627674
...
f 1//1 11//1 14//1 2//1          # the first 1 references to the first v right?
f 2//1 14//1 15//1 3//1          # the first 2 references to the second v right?
f 3//1 15//1 16//1 4//1

Can I assume that allways the verticies v are on the head of the document (after some comments) followed by the texture coordinates (tv) and the normales (vn)?
If an object has a texture does the obj file allways have the texture coordinates? If not how can I calculate them on my own?
If the object has a texture is it required that the object has a material too or can an object have a texture without a material?
If the file contains the texture coordinates do the polygons (f) must contain the texture coordinates? Or is f 1//1 a valid polygon too if the file contains the texture coordinates?

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:
Unity - Post process foreground, but leave background as is I am using Unity 2019.3.5f1 and I am using the Universal Render Pipeline (URP).

I am trying to use the post processing in URP for the foreground only (in my case, the players), and I want the leave the background (which in my case, is just a quad with a texture), as is.

I have tried using the Camera Stack but it wont work for me because the overlay camera can't have post processing effects according to the documentation.

The only solution that I could come up with is create the some sort of custom render which:

Render the background to buffer A.
Render the foreground to buffer B, and save the depth.
Combine the two using a shader that gets both textures, and the depth texture, and based on the depth, takes buffer A or buffer B.

The problem with this I believe is that I cant use it with the post processing for Unity.

Any idea what I can do?

EDIT:

I tried another thing in Unity which seem to not be working (might be a bug):

I created 3 cameras: Foreground Camera, Depth Camera (only render the foreground), and a Background Camera.
I set up the Depth camera so it will render to a render texture and, indeed now I have a render texture with the proper depth I need.

Now, from here everything went wrong, there seem to be odd things happening when using Unity new Post processing (the built in one):

The Foreground Camera is set to Tag=MainCamera, and when I enable Post Processing and add an effect, indeed we can see it. (as expected)
The Background Camera is essentially a duplicate of the Foreground one, but with Tag=Untagged, I use the same options (enabled Post).

Now, the expected thing is we see the Background Camera with effects like Foreground, but no:

When using Volume Mask on my background layer, the Post processing just turns off, no effect at all no matter what (and I have set my background the Background layer).
When I disable the Foreground Camera (or remove its tag) and set the Background Camera to MainCamera, still nothing changes, the post still wont work.
When I set Volume Mask to Default (or everything), the result is shown ONLY in the scene view, I tried rendering the camera to a RenderTexture but still, you clearly see no effect applied!

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:
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:
How do I go about hiring Level Designers from the Modding community? The company I'm working for is growing fast and there's been talk of trying to hire level designers from the modding community. My question is simply, where would be good places to look for this, and how would we go about vetting who to hire?

Does anyone have any experience of this?

sentences: What is an expected conversion rate in a free to play game? I understand that there's a lot of factors at play that decide how much free users will become paid users. What can be expected from different marketing strategies such as selling non-gameplay impacting items, selling gameplay impacting items, selling subscriptions, etc? An ideal answer would have statistics showing numbers from different games?

sentences:
Game Server on Windows Azure What do you guys think of using Windows Azure for deploying a custom built game server. It's being built in C#, and I want to get a few things down before stretching too far into the project.

I like the idea of being scalable, but I also know that I will never get to the scale of anything to the scale of WOW, or something quite as big. It will just be an interesting journey to test something like this.

So, will Windows Azure work for that, or is there any other services that can provide something like that?

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:
OpenGL ES 2.0: 2D game rendering, no performance gain with glDraw call batching I just did a small benchmark. To my surprise batching sprites into a single draw call doesn't give any significant performance boost. Following are my results:

Hardware: iPod touch 4

Extra info: OpenGL ES 2.0. 1 sprite (64x64) having some transparency (smiley face with drop shadow). NO rotation, NO scale. (Texture is bound only once at the start in the init function). Compiled in "Release" mode.

The first column labeled 'N' shows number of sprites being tested. Second column shows FPS when sprites are batched in a huge vertex array (only 1 draw call). Third column shows FPS on multi draw calls, eg: 5000 draw calls for 5000 sprites.

Benchmark 1: Alpha blending off

Benchmark 2: Alpha blending ON

Smiley image used:

Source code:

For single draw call:

Vertex hugeArray[SPRITE_COUNT*6];
GLsizei stride = sizeof(Vertex);
int drawCallCount = 0;

const GLvoid* pCoords = &hugeArray[0].Position[0];
const GLvoid* pColors = &hugeArray[0].Color[0];
const GLvoid* pTexCoords = &hugeArray[0].Texture[0];

glVertexAttribPointer(positionSlot, 2, GL_FLOAT, GL_FALSE, stride, pCoords);
glVertexAttribPointer(colorSlot, 4, GL_FLOAT, GL_FALSE, stride, pColors);
glVertexAttribPointer(textureSlot, 2, GL_FLOAT, GL_FALSE, stride, pTexCoords);

GLsizei vertexCount = sizeof(hugeArray) / sizeof(Vertex);
glDrawArrays(GL_TRIANGLES, 0, vertexCount);
drawCallCount++;

cout << "DrawCall Count: " << drawCallCount << endl;

For multiple draw calls:

Vertex hugeArray[SPRITE_COUNT*6];
GLsizei stride = sizeof(Vertex);
int drawCallCount = 0;

for(int i = 0; i < SPRITE_COUNT; i++){

    const GLvoid* pCoords = &hugeArray[i*6].Position[0];
    const GLvoid* pColors = &hugeArray[i*6].Color[0];
    const GLvoid* pTexCoords = &hugeArray[i*6].Texture[0];

    glVertexAttribPointer(positionSlot, 2, GL_FLOAT, GL_FALSE, stride, pCoords);
    glVertexAttribPointer(colorSlot, 4, GL_FLOAT, GL_FALSE, stride, pColors);
    glVertexAttribPointer(textureSlot, 2, GL_FLOAT, GL_FALSE, stride, pTexCoords);

    GLsizei vertexCount = 6;
    glDrawArrays(GL_TRIANGLES, 0, vertexCount);
    drawCallCount++;
}
cout << "DrawCall Count: " << drawCallCount << endl;

I thought that batching sprites into a huge array resulting in a single draw call would give a HUGE performance gain but benchmarks show otherwise. Any ideas what is going on here?

Thanks for reading the question :)

sentences:
Is a 3D renderer with 1000 FPS possible? Okay, for my phD Thesis, I need to make a simple 3D game, like towers of hanoi or whatever but there is a condition:
I need it to have high FPS, as in, the highest FPS achievable, atleast a 1000FPS. I need to have a high FPS to measure reaction times. We achieve this with 1ms monitors BUT on the programming front, here is the problem,

I'm confused if I should code an entire specially made engine with only the features I need (using Vulkan), and if I did would it be faster than already available engines like Unity or Unreal? Would it be worth the time and effort or can these engines be customised themselves and is that easier than doing it from scratch?

Or is it only achievable with specialized hardware? So I'd be better of using an available engine and going hard on the hardware?

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:
What's next to learn? I am self-learning programming for video games. I have learned:

Basics (variables, loops, branching, etc.)
Object Oriented (classes, objects)
Functions
Dynamic Memory Allocation
Operator Overloading
Aggregation
Inheritance and Polymorphism
Swallow Copy And Deep Copy
STL Libraries

and I am learning I/O Files. What is next? Thanks for the help.

sentences:
How are win conditions handled in a turn based game? Turn based games sometimes have different win conditions for different maps and mission.

For example, control some structure for X turns, last X turns without losing a single soldier.

They usually also have standard win conditions across all maps like eliminate all enemy units and structures, etc.

How would I implement map/mission specific win condition checks?

My current implementation utilizes a finite state machine that loads the play state. The play state has objects and logic for gameplay. I could write custom play states for each mission, but I feel like that is not the best way to go as I would have large portions of duplicate logic and code.

Ideally I would like to tie in win conditions into my map/mission file data. When I load a map, the win conditions are loaded also, but am not sure how I would achieve that.

Any suggestions?

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:
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:
Game loop delta, factoring execution time? Was thinking this morning, I 99.9% of the time, only see a main game loop, looking like this, just as much so where the delta is passed into update():

while running
getDeltaTime()
...
f(deltatime)
---

Now the question I was thinking to myself was what if between getDeltaTime() and f(deltaTime), the code in the middle took 1 second (large value to be easy). That means f(deltaTime) would have moved whatever object less distance than it was supposed to. This would of course be solved by grabbing the delta time directly before it is used.

Should this be a factor to be concerned with in any case?

sentences:
Rotate model using quaternion Currently I have this to rotate my 3D model that rotates on it's local axis independent from the world's axis:

// Rotate model with Right Thumbstick
modelRotation -= pController.ThumbSticks.Right.X * mRotSpeed; // float value

What I'm trying to do is rotate the model using quaternion and not by a matrix.

I've searched for tutorials, but have found none that explains thoroughly on how to achieve this. Does anyone know how to I can use quaternions to rotate my model or a complete tutorial?

sentences:
Why is my OpenGL enabled Java game not detected by Fraps? Recently I found out that I could enable OpenGL hardware acceleration in my Java game with the line

System.setProperty("sun.java2d.opengl", "True");

Initial tests showed a big boost in performance. However, several days later I wanted to make a small test video using Fraps but I found out that it didn't recognize my application (as in the  FPS counter did not show and I could not record anything). After I removed the earlier mentioned line of code (thus disabling OpenGL hardware acceleration) it recorded just fine.

Is there any way to use Fraps while I have OpenGL enabled in my Java game?

sentences:
Bullet Physics ignore collision from bottom I'm currently using BulletSharp a wrapper for Bullet physics.
I'm using Bullet Physics for a 2D project.

Many platform games allow the player to pass through a platform as they jump upwards, and then have it magically become solid so they can stand on it from above.

Can this be done in Bullet Physics? In pre solve or something?

sentences:
Rotate arrow on canvas I need to draw a flow dynamically based on some user choices. In that flow I want to draw the choices (blue circles with number) and the directions of that choices (line and arrow). For example: node 1 to node 2.

JSFiddle Example

To draw the direction I draw a arrow in the end of the line but I can't make the arrow rotate around itself.

JS code

$(document).ready(function () {
    drawOnCanvas();
});

function drawOnCanvas() {
    var canvas = document.getElementById('myCanvas');

    if (canvas.getContext) {
        var ctx = canvas.getContext("2d");

        var circle1 = {
            x: 75,
            y: 75,
            r: 15
        };

        var circle2 = {
            x: 225,
            y: 50,
            r: 15
        };

        var arrow =
            {
                h: 5,
                w: 10
            };

        drawCircle(ctx, circle1, "1");
        drawCircle(ctx, circle2, "2");

        var ptCircle1 = getPointOnCircle(circle1.r, circle1, circle2);
        var ptCircle2 = getPointOnCircle(circle2.r, circle2, circle1);
        var ptArrow = getPointOnCircle(circle2.r + arrow.w, circle2, circle1);

        drawLine(ctx, ptCircle1, ptCircle2);
        drawArrow(ctx, arrow, ptArrow, ptCircle2);
    }
}

function drawArrow(canvasContext, arrow, ptArrow, endPt) {

    var angleInDegrees = getAngleBetweenPoints(ptArrow, endPt);

    canvasContext.beginPath();
    // first save the untranslated/unrotated context
    canvasContext.save();

    // move the rotation point to the center of the rect
    canvasContext.translate(ptArrow.x, ptArrow.y);
    // rotate the rect
    canvasContext.rotate(angleInDegrees);

    canvasContext.moveTo(endPt.x, endPt.y);
    canvasContext.lineTo(endPt.x - arrow.w, endPt.y + arrow.h);
    canvasContext.lineTo(endPt.x - arrow.w, endPt.y - arrow.h);
    canvasContext.closePath();
    canvasContext.fillStyle = "rgb(72,72,72)";
    canvasContext.stroke();
    canvasContext.fill();

    // restore the context to its untranslated/unrotated state
    canvasContext.restore();
}

function drawCircle(canvasContext, circle, text) {
    canvasContext.beginPath(); //começa ou reinicia o desenho de algo
    canvasContext.fillStyle = "rgb(43,166,203)";
    canvasContext.arc(circle.x, circle.y, circle.r, 0, 2 * Math.PI, false); //cria arcos
    canvasContext.fill(); //atribui estilos

    drawText(canvasContext, circle, text);
}

function drawText(canvasContext, circle, text) {
    canvasContext.font = '8pt Calibri';
    canvasContext.fillStyle = 'white';
    canvasContext.textAlign = 'center';
    canvasContext.fillText(text, circle.x, circle.y + 3);
}

function drawLine(canvasContext, startPt, endPt) {
    canvasContext.moveTo(startPt.x, startPt.y);
    canvasContext.lineTo(endPt.x, endPt.y);
    canvasContext.stroke();
}

function getPointOnCircle(radius, originPt, endPt) {
    var angleInDegrees = getAngleBetweenPoints(originPt, endPt);

    // Convert from degrees to radians via multiplication by PI/180
    var x = radius * Math.cos(angleInDegrees * Math.PI / 180) + originPt.x;
    var y = radius * Math.sin(angleInDegrees * Math.PI / 180) + originPt.y;

    return { x: x, y: y };
}

function getAngleBetweenPoints(originPt, endPt) {
    var interPt = { x: endPt.x - originPt.x,
        y: endPt.y - originPt.y
    };

    return Math.atan2(interPt.y, interPt.x) * 180 / Math.PI;
}

I think the problem is in drawArrow() method in the lines

canvasContext.translate(ptArrow.x, ptArrow.y);

canvasContext.rotate(angleInDegrees);

I already tried every possible values for the rotation and the translation but arrow still don't rotate properly around itself. Can anyone help me?

sentences:
setting a time delay between two frame when animation a sprite sheet this is my jsfiddle :http://jsfiddle.net/Z7a5h/

As you can see the animation of the sprite sheet when the player is not moving is too fast so i was trying to make it slow by declaring two variable lastRenderTime: 0,RenderRate: 50000

but my code is not working and it seem i have a misunderstanding of the algorithm i am using so can anyone lay me a hand to how can i fix it ?

 if (!this.IsWaiting) {
                    this.IsWaiting = true;
                    this.Pos = 1 + (this.Pos + 1) % 3;

                }
                else {
                    var now = Date.now();
                    if (now - this.lastRenderTime < this.RenderRate) this.IsWaiting = false;
                    this.lastRenderTime = now;

                }

sentences:
Unity facebook sdk 'Didn't find class "com.facebook.FacebookContentProvider"' any more fixes / workarounds for this? How to replicate this error...

Create a new Unity project.

Import the facebook sdk unitypackage

Set your App Id for facebook via Facebook\Edit Settings

Using Assets\External dependency manager\Android, press 'Resolve dependencies', then press 'delete resolved libraries' (otherwise the build will fail at the gradle stage)

Build and run.

When the app tries to run I immediately get the error message on my phone 'app has stopped working'
and see this error in the logs ...
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.FacebookContentProvider" on path: DexPathList[[zip file "/data/app/com.SandwichGeneration.MakeASquare--nLEHpzOYlwW6XKmGzPfIw==/base.apk"],nativeLibraryDirectories=[/data/app/com.SandwichGeneration.MakeASquare--nLEHpzOYlwW6XKmGzPfIw==/lib/arm64, /data/app/com.SandwichGeneration.MakeASquare--nLEHpzOYlwW6XKmGzPfIw==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]]

Suggested fixes I've tried from here

I've tried different combinations of old or new facebook sdks and old or new versions of Unity.

I've tried building from a few different machines to different Android devices.

I've deleted the external dependency manager included with the facebook sdk and used this one instead. In order to get this one to resolve I had to set a 'Custom Gradle Properties Template'in the player setting under publishing settings.

I've set a Custom Proguard file'in the player setting under publishing settings, and I added the following two lines to the file..
-keep class com.facebook.internal.* {*;}
-keep class com.facebook.* {*;}

So I've tried all the suggested fixes and various combinations thereof. I dont know what more I can do. Can anyone suggest anything else to try?

sentences:
Texture with Transparent background has black background in Unity please see the below image. I made a model in Blender that has eye meshes with UV mapped Pupils. But trying to import all this into Unity is causing tons of weird visual errors...

The pupil png has a Transparent background but that background shows up as Black in Unity. Googling says to fix it by choosing 'Transparent' shader but all the ones I try end up cutting out the Eye mesh beneath it.

Any help appreciated.

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:
Simple Terrain Grid (not working) I know yall are probably going to hate me.....but I can't figure out what im doing wrong, im trying to make a SIMPLE Vertex Grid (for Terrain) but I get a black screen for some reason And I can't figure out why. It does run, but I just get a black screen afterwards....I hate posting such huge code on this site but I figure if anyone can explain what the heck I did wrong i'd be able to understand a little bit better.

I think the problem....may be in the matrix, but my code is simple and im 100% sure im doing the Grid right because I took it from a working tutorial that does grids (but it's large and VERY confusing for a beginner, so I just took the appropriate code).

I know it's alot to look at (vars.h is very small) and main.cpp is pretty small too but I know it's still alot.....but im just completely stuck.

vars.h
http://pastebin.com/SupcqB8N

main.cpp
http://pastebin.com/vAnSUTpp

shaders.hlsl

cbuffer ConstantBuffer
{
    float4x4 matFinal;
}

struct VOut
{
    float4 position : SV_POSITION;
    float4 color : COLOR;
};

VOut VShader(float4 position : POSITION, float4 color : COLOR)
{
    VOut output;

    output.position = mul(matFinal, position);
    output.color = color;

    return output;
}

float4 PShader(float4 position : SV_POSITION, float4 color : COLOR) : SV_TARGET
{
    return color;
}

sentences:
What are the pros and cons of incorporating Lua into a C++ game? I have a C++ game programming book and it has a Lua section in it. I've started to read the Lua section, and it sounds interesting, but I can't determine the pros and cons of using Lua in my C++ game. The only benefit I can currently think of is that you can make some coding updates, via Lua, without having to recompile. Other than that, I can't think of anything. So what are the pros and cons of adding Lua to a C++ game?

Examples would be appreciated.

sentences:
How do Action RPGs make different weapon types feel unique? I'm getting feedback on my game which has Action RPG elements (think Diablo, Torchlight, etc.) but you control a team of heroes.  When you kill enemies sometimes new weapons will drop.  In my game the DPS of the weapon will be randomized but stronger the further you get.  Each weapon type has a hard coded range and rate of attack, but it differs between types.  As an example, every Pistol will attack once per second and every Machine Gun will attack 5 times per second.

A common complaint I'm getting is:

  The weapons needs more variety, there's not really many reasons to change weapons because they all have the same speed and small damage differences.

I'm struggling to achieve this.  I can vary speed and range for each type, and this seems like an "ok" solution but it's not good enough.  This just feels like a sliding scale that looks like this:

range <-----|-----------------> rate of attack
dps: 10

Here you can change the range and the rate of attack, but the DPS is still going to be based on the level of the enemies.  In the end, it's still not going to matter which weapon you choose because they'll all have about the same DPS.

If I make it so they don't have the same DPS, then yeah, there will be reasons to change weapons, but it'll be because some weapons suck and some weapons are good.  I don't think this puts me in a better place.

I want the player to feel like weapon type X has pros and cons over weapon type Y.  How can I achieve this?

sentences:
Implementing Multiplayer: entire world ticks or just changes? i'm working an a very simple multiplayer experience (for now node.js, later will probably remake all in c++, but my question is more about theory).

All guides and tutorial i saw about making something multiplayer Always speak about sending all the "world" information, once per tick, deciding optimal tickrate, making smooth movements on client side with interpolation or stuff like that.

Honestly i thought of another way, and i really cant see why its never mentioned.
My idea would be the following:

Client sends to server when input happens; eg if you move with arrows, you send to the server a message only when your moving status changed. If you was moving right and then start moving upright, then you send a message about you changing your movement.
Server recives the messages, sets variable on player object for its movement, and sends to all other clients information about the change. Also sends current time and current position in the server at the moment of movement change.
Clients recive a movement status update, place the player object in recived coordinates moved by the new movement * ping delay. That way position in all clients should Always be up to date with the server.

Why should i send hundreds of positions to each client per each player every x milliseconds when i can just send the changes?

I feel like its about polling vs interrupt... (yeah i know its not polling anyway, but the concept is sending the change vs keep sending everything)

sentences:
Is there a way to set a range on a case argument in a switch statement in Game Maker: Studio? Okay so I am making a tower defense game in GML and I came across a small problem when making a switch statement, I want to have anything from 1-10 to result in a variable changing to 1, anything from 11-20 result in the variable changing to 2, and anything 21-30 to change to 3. It would look something like this. Yes I know I'm new to coding..

switch(test)
{
    case (1-10):
        test = 1;
        break;

    case (11-20):
        test = 2;
        break;

    case (21-30):
        test = 3;
        break;
}

Except for the fact that that does not work and to actually do something like that, in my knowledge you'd have to make a case for every single number in the range which would take ~3 years. Help?

sentences: Can I count all the allocated textures in D3D11? Is it somehow possible to get the count of all texture objects on a device?

sentences:
C++ OpenGL trouble trapping cursor in window I am using OpenGL and I try to trap my cursor inside my game window (using both        SetCursorPos
and
    ClipCursor)

But, these conflict with my camera rotation code as my camera is rotated with my mouse. If there is a way to do it, please let me know. If possible, I would be willing to make it so that when the cursor reaches an edge of the screen, it jumps to the opposite edge (though I fear that would also conflict with my camera code).

EDIT: My camera code:

float heading;              // Also Y rotation, hard to explain
GLfloat yrot;               // Y Rotation
GLfloat lookupdown = 0.0f;
float mouseX, mouseY, oldMouseX, oldMouseY;

    case WM_MOUSEMOVE:
    {
        // save old mouse coordinates
        oldMouseX = mouseX;
        oldMouseY = mouseY;

        // get mouse coordinates from Windows
        mouseX = LOWORD(lParam);
        mouseY = HIWORD(lParam);

        // these lines limit the camera's range
        if (lookupdown < -90)
            lookupdown = -90;
        if (lookupdown > 90)
            lookupdown = 90;

        if ((mouseX - oldMouseX) > 0) {     // mouse moved to the right
            heading -= 3.0f;
            yrot = heading;
        }
        else if ((mouseX - oldMouseX) < 0) {     // mouse moved to the left
            heading += 3.0f;
            yrot = heading;
        }

        if ((mouseY - oldMouseY) > 0) {     // mouse moved up
            lookupdown += 3.0f;
        }
        else if ((mouseY - oldMouseY) < 0) {     // mouse moved down
            lookupdown -= 3.0f;
        }
    }

sentences:
Recognize that user has traced a path of vector points with mouse How can I check if a player has traced a closed vector shape from an arbitrary starting point all the way around to the beginning?

Setup

Given are the vector points A through E, which form a closed path. The created shape can be convex or concave and even have sharp elongated corners. P1 is the point where the player decides to start tracing. The point can be anywhere on the path and will be set as soon as the mouse or touch is first close to the path.

Requirements

The player starts moving along a visual representation and traces the entire shape until he reaches P1 again. If his mouse path differs too greatly, misses a point or goes outside of a given margin, I want to start over. The player may either have to trace around in the direction from which he first starts without backtracking or just have to fill the entire path even if going back and forth on the path.

How can I approach this problem? Ideally, I would like to implement a vector-math solution. I don't have any pixel data to sample from and it would be rather cumbersome in my real world implementation to generate a suitable image and map world space coordinates to it.

My Attempt

Consider each corner a waypoint with a collision area.
Track each entered collider and when all were hit, solve.
While valid colliders are pending, project mouse position onto the closest point on the path.
If the distance between projected point and mouse is too great, abort.

This approach however doesn't give me perfect results. Firstly, it's not entirely what I want, since in my ideal case the user "draws" or traces the path with the mouse, not just hits the corners. Also, when moving around a sharp corner, the project point will snap from one line segment to the next, giving me ugly visuals, when showing progress.

Possibly Better Solution

As soon as player comes close to path start sampling points from mouse.
Build up a user drawn vector path every time step or distance step.
Check if the draw vectors are similar to the given path.
Problem: user drawn path needs some sort of processing or more complex algorithm until it is comparable to given path.

Thank you for any suggestions! I will post some of my own code as soon as my implementation gives me good results.

sentences: Show Camera Inside Object Bounds I'm making a mobile game, and I want have secondary camera that shows another part of the scene within a box. I'm able to do this easily enough by setting the camera's viewport settings, but the issue I'm having is when you change the screen size, the camera size changes with the screen no longer looking like it shows in the box (The box doesn't expand/contract with the device's screen size). Is there a way to set the camera's size an position relative to a game object? This is what I'm trying to do:

sentences:
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:
How to pick a 3D object with known mouse coordinates if the camera is rotated 60 degrees? I am making a simple game engine for a simple RTS game and would like to be able to pick a cube and move it around with the mouse coordinates. The problem is that my camera is rotated 60 degrees just like any RTS game and I am not sure how to use gluUnProject..

Thanks in advance!!

sentences:
Triggers are not detecting colliders from other game objects in Unity version 5.2.2f1? I was working on a basic slots game, and I came across a hiccup with the 2D Physics engine. Currently I'm letting the reels spin for three seconds. Once it has finished spinning, it will go to the reel stop that the RGN picked out. Also, when it has reached the end of the reel I had it so that reel would "wrap around" to the firs reel stop continuing displaying the stops as it before.

I'm using a edge collider as a trigger on each reel (I'll call it a symbol trigger for short). The symbol trigger is a child of the reel but the actual symbols (which are game objects in screen space) are procedural generated and attached to the actual reel. All the symbols have a rigidbody2D and are kinematic. For some reason the triggers do no respond with on enter, on stay, or on exit, and that is with putting debug logs.

Now I have taken the reels and triggers to and out of world space and screen space, switched from rigidbody2D to 3D along with, messed with the sleep options, and switched it from discreet to continuous and still have get no response from the collider. If anyone knows why this is happening, your insight would be highly  appreciated!

Thanks for reading about my issue and have a good day.

sentences:
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: Implementing top view physics using box2D How can top view physics games be done in box2D? One idea I have is to set the linear velocity of an object manually or to alter the linear and angular damping as my object moves over different surfaces. For example if my object is over a wet surface it'll have less linear damping and if it is over rough surface it'll have more damping. And to see if my object has fallen over an edge I'll try to use an AABB and check if its still inside or manually see if object.x > boundary.x etc. Is there any better way?

sentences:
Writing Logic behind card games I'm not a dev noob, but definitely never done anything in game dev. There is a trump based card game we play in town that I plan on coding. I'll be either using python/ajax/pyqt or c++/qt.

My question is as follow, what kind of advice would you give to writing card based games?

sentences:
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:
Inter Quake Model IQM render Directx9 I'm trying to render an Inter Quake Model(http://lee.fov120.com/iqm/) in DirectX9 that I exported from blender.

I want to display animations which IQM supports and my model format does not.

The model is a cylinder.

It loads fine in the iqm sdk opengl viewer but when i try to render it in directx9 using for example(this is just to render the vertices):

IDirect3DDevice9 * device;
HRESULT hr = S_OK;

for(int i = 0; i < nummeshes; i++)
{
    iqmmesh &m = meshes[0];

    hr = device->DrawIndexedPrimitiveUP(D3DPT_TRIANGLELIST, 0,
    3*m.num_triangles, m.num_triangles ,&tris[m.first_triangle] ,D3DFMT_INDEX32
    ,inposition ,sizeof(unsigned int));
}

It renders like this:

Incorrect

The light grey bit that looks like two triangles in the middle is what is rendered(ignore the other stuff).

Whereas it is meant to look like this(using a custom importer which I designed which matches what is displayed in blender):

Correct

Anyone have any suggestions on what might be going wrong?

sentences:
Save-security with MD5 hash I'm working on a flash game that saves your progress locally. These saves can easily be hacked. My solution is to add an md5 hash of all the variables saved into the save file itself. When loading the save, the game would check if the hash is valid.
Is this a good solution? Are there better solutions?

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 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:
Trying to rotate a point around another point and it's not working I am trying to make a function to rotate a point around another point. My maths are very rusty but i did some research and i just dont understand why my function is not working.

public void rotatePoint(int pX,int pY,int angle) {
    int newX = 0, newY = 0;
    int centerX = 400, centerY = 300;

    angle *= Math.PI / 180; // convert angle from deg to rad

    double rotatedX = Math.cos(angle)*(pX-centerX)-Math.sin(angle)*(pY-centerY) + centerX;
    double rotatedY = Math.sin(angle) * (pX-centerX) + Math.cos(angle) * (pY-centerY) + centerY;

    newX = (int)Math.round(rotatedX);
    newY = (int)Math.round(rotatedY);
}

On the image i just provide my original point is in grey. After a rotation of 90 or 180deg i would expect the point to arrive where the green ones are. They arrive where the red points are.

sentences:
Strange javascript error when using Kongregates API In the hopes of finding a fellow unity3d developer also aiming for the Kongregate contest..
I've implemented the Kongregate API and can see that the game receives a call with my username and presents it ingame. I'm using Application.ExternalCall("kongregate.stats.submit",type,amount);
where type is a string "Best Score" and amount is an int (1000 or something).
This is the error I'm getting:

You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.
callASFunction:function(a,b){if(FABrid...tion, can be used as a workaround.");

I'm wondering, has anyone else had this error or am I somehow doing something stupid?
Thanks!

sentences:
How can I replace an object with a prefab so the prefab will be at the same position of the gameobject? I have some doors in the scene, each door at another position.
I took one of the doors added to it a light and made a prefab of the door.

Now I want to replace all the other doors with the prefab.

Example of the door with the light I added and this door is also a prefab:

And this is example of another door that is not yet replaced by the prefab door with the light:

I want to replace this door with the prefab door with the light at the first screenshot. The question is if there is a easy way to do the replace ?

I have more doors that I want to replace.

sentences:
Scaling world - projection, view or separate matrix? I am currently writing a simple 3D space visualisation program.
Things get loaded into it from a simple XML file, which contains positions and sizes of objects in space, so you can put basically any numbers into the XML and it will show you what the things look like in 3D.

My problem is that when I try view for example a solar system, using real numbers as they really are in space (e. g. earth-moon distance = 3.844e8 m), my objects loose their form and textures get detached from faces due to limited floating position precision. I simply can't make users to scale the scene themselves, because with 10 planets or so it's too much work, and sometimes calculations little bit more complex.

Because of this, I decided to add an option that would make it possible for one to scale whole scene automatically.

My question is rather simple:
If I want to scale world/scene, which matrix should I use? Projection matrix, view matrix, or a completely new matrix (please, not this one, I'm running out of uniforms)?

Thank you.

sentences:
Is quake3/ioquake's OOP good to do a large game? Everybody heard about the release of the Quake3 source code.

But since it's plain C but uses OOP a little, isn't it too complex to decipher or to use for large projects such as a 3rd person shooter/hack&slash with smooth camera movements ?

Would it be a good idea to use it instead of Ogre, I want to be sure it's really harder to use since it's only an engine dedicated to FPS.

Ogre seems to be a standard OSS, especially when thinking about OOP, but since I'm not looking for complex effects and since the rendering quality of quake3 seems to be good enough to me, I wanted to ask what did the release of the quake3 engine changed for open source developpers (except the infamous invsqrt method).

I heard Carmack released it for students or people alike, but C++ is here: is quake3's code obsolete compared to Ogre's when it comes to learning ?

sentences:
How do I move a game object instead of the entire scene in Unity? I'm trying to move GameObject between scenes but when I do it moves my whole scene instead of just that one game object. How do I move just the game object and not the whole scene?
I have tried SceneManager.MoveGameObjectToScene(UIRootObject, sceneToLoad); and DontDestroy but it keeps moving my whole scene new scene.

sentences:
Collision Detection - point hitting a rotating rectangle Im developing a game which has a flying chopper and an enemy firing bullets at it.
Whats the best way to detect when the bullet hits the bounds of the chopper. The chopper is placed to the left of screen, continously rotating around its center. Bullet is fired from the right, always in a straight line. Im using Marix post rotate and translate for the choppers rotation.To make it simpler, I just want to consider the chopper to be a rectangle. Lets say im not bothered about any more precision in terms of specific hit points.

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:
LIBGDX: Translate grid drawn with ShapeRenderer with an OrthographicCamera I am trying to draw a grid for my "world" that may or may not extend beyond the screen. What I would like to do right now is draw the entire world (which is relatively small) and then use the orthographic camera to translate the view to where the player is inside the "world." Currently I'm just trying to translate the "world" by 100 on the x and y axis to test. What am I doing wrong? Can I use the Shaperenderer with the OrthographicCamera?

public class WorldRenderer implements Disposable{

    private static WorldRenderer worldRenderer;
    private Color gridLineColor = Color.LIGHT_GRAY;
    private OrthographicCamera camera;

    private int worldX;
    private int worldY;

    public WorldRenderer(WorldController worldController) {

        init();

    }

    public void init() {

        worldRenderer = this;
        camera = new OrthographicCamera();

        worldX = 0;
        worldY = 0;

    }

    public void render() {

        //Set the background color to white.
        Gdx.gl.glClearColor(255, 255, 255, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        renderBackground();

    }

    public void renderBackground() {

        ShapeRenderer renderer = new ShapeRenderer();

        //Draw vertical lines.
        for(int i=0;i<=Constants.WORLD_WIDTH * Constants.GRID_WIDTH;i+=Constants.GRID_WIDTH) {

            renderer.begin(ShapeType.Line);
            renderer.setColor(gridLineColor);
            renderer.line(i, 0, i, Constants.WINDOW_HEIGHT);
            renderer.end();

        }

        //Draw horizontal lines.
        for(int i=0;i<=Constants.WORLD_HEIGHT *          Constants.GRID_HEIGHT;i+=Constants.GRID_HEIGHT) {

            renderer.begin(ShapeType.Line);
            renderer.setColor(gridLineColor);
            renderer.line(0, i, Constants.WINDOW_WIDTH, i);
            renderer.end();

        }

        camera.translate(100, 100);

    }

}

sentences:
Unreal Engine 4.25.4 - CreateDefaultSubobject inside a child component attached to an actor loses values in blueprint editor I have the following actor:
UCLASS()
class X_API AMoveableRigidBodyActor : public AActor
{
    GENERATED_BODY()

public:

    // Sets default values for this actor's properties
    AMoveableRigidBodyActor();

public:

    UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "Custom")
        USceneComponent* SceneComponent;

    UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "Custom")
        UMoveableRigidBodyComponent* MoveableRigidBodyComponent;

};

This Actor makes a reference to a UMoveableRigidBodyComponent and a USceneComponent which I run CreateDefaultSubobject on and attach in the following fashion in the constructor:
AMoveableRigidBodyActor::AMoveableRigidBodyActor()
{

    SceneComponent = CreateDefaultSubobject<USceneComponent>(FName("AMoveableRigidBodyActor_SceneComponent"));
    SetRootComponent(SceneComponent);

    MoveableRigidBodyComponent = CreateDefaultSubobject<UMoveableRigidBodyComponent>(FName("AMoveableRigidBodyActor_MoveableRigidBodyComponent"));
    MoveableRigidBodyComponent->SetupAttachment(SceneComponent);

}

So far, so good.
Now inside my UMoveableRigidBodyComponent I instantiate a few components that are relevant to that component. I expect these components to be visible and manageable from within my blueprint:
UCLASS()
class X_API UMoveableRigidBodyComponent : public USceneComponent
{
    GENERATED_BODY()

public:

    // Sets default values for this component's properties
    UMoveableRigidBodyComponent();

override;

    UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "Custom")
        USceneComponent* SceneComponent;

    UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Custom")
        UStaticMeshComponent* StaticMeshComponent;

};

Here I use CreateDefaultsuboject to attach everything to this component:
UMoveableRigidBodyComponent::UMoveableRigidBodyComponent()
{
    SceneComponent = CreateDefaultSubobject<USceneComponent>(FName("UMoveableRigidBodyComponent_SceneComponent"));
    SceneComponent->SetupAttachment(this);

    StaticMeshComponent = CreateDefaultSubobject<UStaticMeshComponent>(FName("UMoveableRigidBodyComponent_StaticMeshComponent"));
    StaticMeshComponent->SetupAttachment(SceneComponent);
}

So, all of this feels pretty normal so far. So I go into my editor, create a blueprint that's based off of the AMoveableRigidBodyActor and I assign a static mesh to my component:

Still good. But then I hit the compile button:

The selected static mesh has now vanished from the editor but still seems to be filling the value correctly.
Furthermore, if I put this into the game world you can see that the static mesh sure enough isn't there in the instance:

What am I misunderstanding here?

sentences:
How to implement 2 cameras in a unique stage using LibGDX I am quite new to LibGDX. I am trying to make a game, where the character is an Actor, and it's controlled by a Touchpad(included in the main Stage as an Actor too).

My problem is that I am trying to put the stage's camera to be always centered on the character, but I have no idea of how to solve this, I've been searching and it seems I have to use 2 cameras, 1 to show the controllers (the touchpad), and another to show the actors and that stuff, so while the actors are moving, the touchpad will keep on the screen, but I do not really know how should I do this, my code is this:

public class GameScreen extends BaseScreen {

    Stage stage;
    Character character;//it extends from actor
    Touchpad joystick;
    int screenWidht, screenHeight;
    Skin joystickSkin;

    public GameScreen(AwesomeTanks game) {
        super(game);
        screenWidht = Gdx.graphics.getWidth();
        screenHeight = Gdx.graphics.getHeight();

        joystick = new Touchpad(0,getTouchPadStyle());
        joystick.setColor(joystick.getColor().r, joystick.getColor().g, joystick.getColor().b, 0.5f);
        joystick.setBounds(10, 10, screenHeight / 2.5f, screenHeight / 2.5f);

        character = new Character();

        stage = new Stage();
        stage.addActor(character);
        stage.addActor(joystick);

        Gdx.input.setInputProcessor(stage);
    }

    @Override
    public void hide() {
        stage.dispose();
        joystickSkin.dispose();
        character.detach();

    }

    @Override
    public void render(float delta) {
        Gdx.gl.glClearColor(1f, 1f, 1f, 1f);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        character.moveBy(joystick.getKnobPercentX() * character.velocity * delta, joystick.getKnobPercentY() * character.velocity * delta);

        if(joystick.isTouched())
            character.setRotation((float) ((180/Math.PI)*Math.atan2(joystick.getKnobPercentY(),joystick.getKnobPercentX())));

        stage.act(Gdx.graphics.getDeltaTime());
        stage.draw();
    }
}

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:
Make enemy move diagonally in 2D I'm making the enemy follow the player only straight or diagonally e.g.(1,1)(1,0)(0,1)(-1,1).
I expected the problem that I have, but I don't really know how to fix it. When my enemy is placed diagonally (relative to the player but not exactly), It will alternate rapidly between going diagonally and straight, causing it to appear like its vibrating.

here is the simple script returning the Vector2 to follow:
        Vector2 direction = (player.position - goblinTr.position).normalized;
        direction.x = Mathf.Round(direction.x);
        direction.y = Mathf.Round(direction.y);

        return direction;

sentences:
how to set volume of sound depending on the impulse a body receives in Libgdx / Box2d? I am trying to set the volume of a bouncing sound of a ball depending on how hard the ball hits something. so the harder the ball hits a wall or a ground the more loud the bounce sound.
I couldn't find anyway to get the impulse of a body other than the postSolve(Contact contact, ContactImpulse impulse)  method inContactListner class.
But i then realized that unlike the beginContact(Contact contact) method, postSolve(Contact contact, ContactImpulse impulse)  gets called repeatedly until the contact ends. so it repeatedly plays the bouncing sound making it sound stalked and buggy.
I cant use the beginContact(Contact contact) method because there is no way to get the impulse that the ball is receiving from this method. I tried to to use the velocity of the ball instead of impulse inside beginContact(Contact contact)but that didnt yield good results and found it very complicated as i had to consider both horizontal and vertical speeds.
so my question is how can I make the sound play only once if i am using the postSolve(Contact contact, ContactImpulse impulse)  method or is there any other solution to achieve what i am trying to do here?

sentences:
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:
What's the proper practice to organize relationship between components in an ECS pattern? I'm new to ECS concept and trying to refactor my app with an ECS manner.
After reading some articles, I still don't get a sense about how to organize hierarchy for such pattern. My questions are

Is a component allowed to have another component inside? For example I saw a RenderComponent that contains a Mesh inside. Is the mesh also a component or the raw data of it, which should be stored inside the RenderComponent?
What happens when an instance of component needs to be shared by two entities?
If an entity should be just an integer, how do you organize the relationship between entities? Should it have a parent/child/linked entity or should all these relationship be managed by the system?

Thanks!

sentences: Game loop with multithreading I have learned how to create and manage threads in C++. Now I'm trying to create game loop based on multithreading but I can't imagine how should I split whole game to tasks. I mean, should rendering be separated from updating physics?

sentences:
Same name and copyright / fanfiction question OK, so this is still about a game... only a web-based browser game, in this case NationStates, a political/social role-playing game that's text/image-based, interactive fiction.

It's a political/social satire, basically.

I'm creating fictional magazines for a fictional nation, and they're being hosted on a flipbook site. My question relates to titles and same names.

I obviously can't call my fictional newspaper relating to the nation The Times or my fictional car magazine Auto Trader, as they're trademarked - I checked on ipo.gov.uk,  but if I was to call them The Anytown Express The Times or The Anytown Express Auto Trader (with different logos than the original to avoid copyright infringement, as well), would that fall under copyright infringement / trademark infringement, and is adding an affix sufficient enough to differentiate themselves?

I don't actually have anything yet on the site about my fictional nation's media... so am OK for now, but when I actually do, what's the right way to go about it?

Since this game is a parody/satire/social commentary, what's the right way to do a parody successfully?

All help is gratefully appreciated.

sentences:
Synchronization problem with Visual Studio 2017 and Unity 2017.1.1f Sometimes I need to change a lot of files and Clean and Rebuild the Solution to get the changes on Unity, am I missing some configuration on Visual Studio or Unity? I uninstalled everything and make a clean install and few days later I'm getting the same problems.

Sometimes if I create a stardard MonoBehaviour script from Unity and I try to attack it to a gameObject I get the error: "Can't add script component XXXXXX because the script class can't be found"(see image: screenshot). The class name and file name are the same, with no syntax errors.

Some times opening a file with an external editor changing the encoding, cleaning and rebuilding the project solves the problem, but just sometimes and I'm tired of do that for test any change, now I have a lot of Debug.Log just to check if Unity is getting my code changes.

Any suggestion will be very greatful

sentences:
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:
How can I make the cursor avoid something completely? I wrote some code for a UI button that causes the mouse to avoid it. I realize this is kind of a weird thing to do in a game design-wise, but this is a really weird game. I need a button that is not only unclickable, but also unhoverable. I got it mostly working, but I cannot seem to change the position before the mouse is drawn, probably because mouse movement is handled by the OS, unless there is a problem with my code that I missed. As a result, pushing the mouse against the button boundaries results in a stutter. The mouse briefly appears over the button before I can move it, so it is still possible to click the button.

A demonstration of the button avoidance and stutter: https://youtu.be/7tgIrJ_vMDg

[DllImport("user32.dll")]
public static extern bool SetCursorPos(int X, int Y);
[DllImport("user32.dll")]
public static extern bool GetCursorPos(out Point pos);

...

void Update () {
    var mousePos = Input.mousePosition;
    if (Application.isFocused && isOver) {

        //Get the current mouse position from OS so we can change it;
        Point cursorPos;
        GetCursorPos(out cursorPos);

        if (oldMousePos.x > xMin && oldMousePos.x < xMax)
        {
            //Coming from above or below. Figure out which one
            //and move mouse accordingly
            if (oldMousePos.y > uiPos.y)
                cursorPos.y -= (int)(rt.rect.height / 2 - (mousePos.y - uiPos.y));
            else
                cursorPos.y += (int)(rt.rect.height / 2 - (uiPos.y - mousePos.y));
        }
        else
        {
            //Coming from either left or right.
            if (oldMousePos.x < uiPos.x)
                cursorPos.x -= (int)(rt.rect.width / 2 - (uiPos.x - mousePos.x));
            else
                cursorPos.x += (int)(rt.rect.width / 2 - (mousePos.x - uiPos.x));
        }
        //Give new coordinates to OS to update mouse position
        SetCursorPos(cursorPos.x, cursorPos.y);
    }
    else
    {
        //track the old position to know what direction
        //they moved their mouse from so we can put it back
        oldMousePos = mousePos;
    }
}

I tried using the Cursor API to force it to software mode thinking that might fix it, but it still stutters, and I would prefer to use the default cursor anyway, and hardware mode if possible. Is there any way to work around this or remove the stutter?

sentences:
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:
How to quickly create meshes that have cutouts of other meshes? I have a mesh and I would like to quickly create planes (or boxes) that have cutouts in the shape of the silhouette that mesh, but rotated at various angles. I would like to have a system to which I can feed any mesh and it will output these cutout planes, either for random or predefined rotations of the mesh.

In the game I'm making, you have a 3D object, like a chess piece, that you rotate and translate to try to fit it in a hole in a wall that has the shape of the object. But the hole can be in the shape of any rotation of that object. For instance, in the case of a pawn, the hole can look like an upright pawn, so you wouldn't have to rotate the pawn at all; or it could just be a circle the size of the base of the piece, so you would have to rotate the pawn so it either goes in feet or head first. I want a program to procedurally generate walls with these kinds of holes for any mesh I give it.

sentences:
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:
Special Effects in a 3d game I am creating a 3d game ( a car racing game) using opengl ES.
i know the rendering concept and also using a physics engine for all the physics stuff.
All modeling is done using 3d modeling softwares.

Now my question how to do the special effects within a game.

For example like when a car collides and toggle how to slow down all the environment effects which i saw in other available games.
OR
Nitrogen gas effects in a car race game.

Any suggestions will be of great help.
I guess my question is clear, if not feel free to ask anything.

sentences:
Build Unity from C# script I'd like to build and package all the ports of my Unity game through a scripting system. Linux and Windows work fine through the Unity command line options, but there is none for WebGL.

For WebGL, the only existing solution seems to be its BuildPipeline. There is a gist with some sample code that has been referenced quit a few times. I changed its content to look like this:

BuildPipeline.BuildPlayer(scenes, "./WebGL-Test", BuildTarget.WebGL, BuildOptions.None);

and call it with unity-editor-beta -executeMethod WebGLBuilder.build  (Btw, is there a way to call this method from within Unity? It doesn't help I have to restart Unity each time I want to test if the script works). It will fail with the following error:

Assets/Scripts/WebGLBuilder.cs(18,3): error CS0103: The name `BuildPipeline' does not exist in the current context
Error building Player because scripts had compiler errors

I also tried to use the BuildPlayerOptions class instead but no success. How do I get WebGL to build automatically?

sentences:
How do I find out at runtime if Vulkan and/or OpenGL support is available? I'm building an engine, which has Vulkan for its primary rendering engine. But to have at least some backwards compatibility with devices that don't get drivers for (Mainly mobile) it I want to implement an OpenGL fallback. Now, how do I check what API's are available in the current system?

I want to check if Vulkan support exists, if not then if GL support exists and if not that then crash.

sentences:
Blurred sprite in Scene view The thread between the tree and the spider here is a LineRenderer.

When the BackgroundLandscape or the Tree objects are selected it has this blur around the thread between the tree and the spider.

When anything else is selected, it renders correctly.

It always renders correctly in the Game view.

What's causing this?

sentences:
What is the difference between .obj files and Collada files? I am currently making a game in java using LWJGL 2.9 and I am wondering what the difference between the .obj format and .dae format is. Currently I can load .obj files and would like to load .dae files as well.

Any information on .dae files would be great.

sentences:
2d Procedural universe generation I want to create a flat universe, where at first the whole universe is blank.

That would be represented by a parallax scrolling nebula background image.

What I want to do is represent the planets as disc shaped objects in the universe.
They can be of various sizes.

The inside of the discs will consist of a landmass, then outside that will be a body of water and after that air.

what would be the best way to go about creating those tiles procedurally as for example the air would consist of various gases and the land of various minerals and resources.

My first thought is to create texture images and then stamp out the circles out of those textures, but problem is that those textures would have to wrap horizontal and vertically. Is there a fully procedural way of doing this?

sentences:
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:
Texture object and texture unit in GL As I understand texture usage consist of two parts

How to store this discrete data about texture internally. How much dimensions, channels, etc.
How to fetch/sample/filter

The question relative to OpenGL are:

q1: What parameters are stored in texture object (glGenTexture) and what parameters are store in texture unit (glActiveTexture) ?

q2: Does glTexParameter perform setup per texture object or per texture unit?

sentences:
Pros and cons of randomised item stats? I'm working on an old-style isometric RPG like the early Diablo or Fallout games. It has a central story with branching paths, and a lot of player freedom to explore the open world. The combat system is pretty integral to the game as well, considering the number of spells, attacks and enemies I'm hoping to add.

Currently I'm wondering whether I should have fixed item stats, or have them randomised within a given range (say, +-0-10% from a given value). But I can only see disadvantages with the randomised stats system. If the range is too large it'll become grindy, and if it's too small it'll become irrelevant.

Could someone give me a list of the pros and cons for each approach?

sentences:
Algorithmically fracture a mesh in Unity3D? I want to create a plugin which shatters/fractures meshes, so I can make every object destructible if I want to. Like in Unreal's built-in feature.

My quick approach to this problem is randomly generating cuts (planes):

every cut divides the mesh into 2 groups: left side of the cut and right side of the cut,
at the points where it intersects the mesh, I add vertices to both groups.
and add 1-1 face to each group with these new vertices.
create the new mesh.

Is there a better way? What do you recommend? Is my way even possible? If yes, what API methods should I use?

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:
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:
Does the standard lighting equation ever allow objects to be brighter than their textures? It occurred to me that the standard lighting setup you see in all the tutorials doesn't allow lights to actually make an object appear brighter than its texture.  The light value is always clamped between 0 and 1.  Which means at maximum brightness, the resulting color will be exactly the same as the value from the texture.  Even if you didn't clamp it manually, in a deferred renderer, the graphics card/driver will end up clamping it for you.

This seems very unusual to me.  Do AAA games actually use lighting like this?  Or is there a solution?  My thought was maybe this is what HDR "fixes" but the only thing I've noticed HDR doing is that rather annoying light-transition effect.

sentences:
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:
Programmatically creating sprite animations in Unity Some background: I have a set of animated gifs which I've converted to spritesheets, which are then imported into Unity as multiple sprites. The end result is that each spritesheet in the Unity editor contains a list of sprites named xxxxxxx_yyy_zzz -- for example:

1313000_000_000 to 1313000_000_014, followed by
1313000_001_000 to 1313000_001_008, followed by
1313001_000_000 to 1313001_000_031,
and so on.

Now, I would like to make simple sprite animations out of this spritesheet. In the example above, 1313000.anim should contain all sprites beginning with 1313000 played in numerical order, 1313001.anim should contain all sprites beginning with 1313001, etc. etc.

This isn't hard to do by hand -- highlight desired range of sprites, drag and drop -- but we're talking about a lot of animations. Creating an editor script which lets me right-click a spritesheet and generate a series of .anim files seemed the best solution, but I'm turning up conflicting info on the subject. Getting a sprite array from the spritesheet is simple enough, but programmatically creating an animation is something very few people seem to have discussed.

Essentially, is it possible and practical to create and populate sprite animations from an editor script?

sentences:
How do I add an "offset" to LookAt? I have created a Third Person Controller.
The camera is behind the player:

I would like to make it so that the player aims at the mouse pointer position.
To do that, I use the following code to rotate the chest towards the position:
        var mousePos = Input.mousePosition;
        mousePos.z = 10; // Make sure to add some "depth" to the screen point
        var aim = Camera.main.ScreenToWorldPoint(mousePos);
        Chest.LookAt(aim);

The hands do not perfectly straightly point forwards, so I need to add an "offset" to the LookAt.
I tried this approach:
var mousePos = Input.mousePosition;
mousePos.z = 10; // Make sure to add some "depth" to the screen point
var aim = Camera.main.ScreenToWorldPoint(mousePos);
aim += new Vector3(ChestAimCenterOffsetForLookatBecauseChestIsNotStraightForward, 0, 0);

Chest.LookAt(aim);

Of course I do all rotation patching in LateUpdate(). In Update(), it would simply be erased by the animation itself.
It does work, but when the model is rotated around the Y axis, something goes wrong: The offset is "wrong", it doesn't have the same effect.
This surprises me because all I do is rotate the entire model.
So I think this line is not correct:
aim += new Vector3(ChestAimCenterOffsetForLookatBecauseChestIsNotStraightForward, 0, 0);

Is this not the way to offset the LookAt results?

sentences:
Looking for games in environments similar to a pinball table I'm on a team of students working on a third-person adventure game that takes place inside a pinball machine (like, small scale, on the surface, avoiding pinballs, etc).

One of my responsibilities on the project is to find games that are similar to this concept in appearance and/or gameplay for reference.

So, does anyone know of games (other than pinball) that takes place in a pinball-like environment?  Or, adventure games that take place in small, cramped environments with multiple paths around the world?  Or games in which the player is often bombarded with balls (or other similar unintelligent obstacles)?  Or games that take place on a small scale?

sentences:
How to add a bolt into my unity project In my game, one of the character you pick as a special ability called the dash. It allows the player to quickly move forward. Included below is the code. It just throws up a bunch of errors. This is a 3d scene

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

public class PlayerJump : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
        {
            if (Input.GetKeyDown("q"))
            {
                transform.Translate(Vector3.KeyDirection * 260 * Time.deltaTime, Space.World);
            }

        }
    }
```

sentences:
UDK or Unity Dynamic Runtime Mesh Boolean subtraction (or alternative) I'm new to 3D game dev and was wondering if anyone could help me out.

I'm planning to use UDK and would like to have deformable items in the world.

So a projectile strikes a target, and a dent or hole is inflicted.

At first I thought there might be a way to load a mesh at the impact point and then "subtract" that mesh from the target mesh. Is this possible? This would allow me to have different "impact effect" - like thin and deep, or wide and shallow. (Similar to this, but without requiring DX11)

I've searched for this but not sure what to call it (deformable meshes, boolean mesh operations, etc), but if it already has an answer then that would be great.

If my approach is wrong, could you point me to any alternatives? Don't really want to go down the chunks route.

Or, if Unity etc. supported it, then it's not too late for me to change engine.

Thanks very much,
Martin

sentences:
Basic DirectX app creates whistle noise I'm in the process of learning DirectX and in the book examples they have a very basic application which sets up DirectX and displays a blank screen. When I run this app however my computer starts making a whistling noise and I'm really curious as to why it does this.

If I maximize the screen the noise stops and this is the only time the noise happens. When I play normal games, run apps in XNA or do anything that doesn't involve directly using DirectX it doesn't happen.

The FPS is going up to 3000-4000 when the app is running and drops down to 1000 when the window is made to stretch the screen (and the noise stops). I'm taking a guess and saying it's something to do with that?

Anyway, does anyone have any ideas on what is creating this noise?

Thanks

sentences:
Collision checking problem on a Tiled map I'm working on a pacman styled dungeon crawler, using the free oryx sprites. I've created the map using Tiled, separating the floor, walls and treasure in three different layers. After importing the map in libGDX, it renders fine. I also added the player character, for now it just moves into one direction, the player cannot control it yet. I wanted to add collision and I was planning to do this by checking if the player's new position is on a wall tile. Therefore as you can see in the following code snippet, I get the tile type of the appropriate tile and if it is not zero (since on that layer there is nothing except the wall tile) it is a collision and the player cannot move further:

final Vector2 newPos = charController.move(warrior.getX(), warrior.getY());
if(!collided(newPos)) {
    warrior.setPosition(newPos.x, newPos.y);
    warrior.flip(charController.flipX(), charController.flipY());
}

[..]

private boolean collided(Vector2 newPos) {
    int row = (int) Math.floor((newPos.x / 32));
    int col = (int) Math.floor((newPos.y / 32));

    int tileType = tiledMap.layers.get(1).tiles[row][col];
    if (tileType == 0) {
        return false;
    }

    return true;
}

The character only moves one tile with this code:

If I reduce the col value by two it two more tiles. I think the problem will be around indexing, but I'm totally confused because the zero in the coordinate system of libGDX is in the bottom left corner of the screen, and I don't know the tiles array's indexing is similair or not.
The size of the map is 19x21 tiles and looks like the following (the starting position of the player is marked with blue:

sentences:
Recap on how a camera works in 3d Space? This may be marked as a duplicate, but I have been trouble thinking about a camera.

I understand that there is a "camera transform," or view matrix. However, this is multiplied with every vertex in the scene when the camera is looking towards the negative Z axis at the origin. Do I move the camera around and then find a translation, rotation matrix to transform the camera to the origin, looking at the negative Z axis and multiply each point by this matrix (in addition to the camera transform later)? Or do I simply always keep the camera at the origin looking towards the negative Z axis, and "move" the world around it? If this is the case, how do I move the world around it? I am looking for the most efficient one.

NOTE: NOT USING OPENGL OR DIRECTX OR ANY OTHER API OUT THERE

sentences: Why does interactive cloth not appear in game view in unity5 Pro? I used interactive cloth fir flags in unity5 Pro version and it appears in scene view but does not appear in game view while playing. What can I do for that please somebody help me out?

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:
What is the best way to learn Cocos2D? I've messed around with iPhone development for a couple years now. I've done some contract work. I want to get into Cocos2D to develop a game idea that I have.

I was wondering what might be the best/quickest way to get up in running in cocos2d?

I've thought about a book, but I wondering if that is needed? I'm the type of guy that just wants to know what everything does and is suppose to be used for.

Any ideas?

sentences:
What are my options other than game engines? I'm a programmer. I've experience in Java, python, and c++.
I see that some big games are built using game engines (Crysis uses Cryengine).
However, other don't (Bayonetta for example).
what's their approach ?
Do they start coding from scratch using OpenGL or Directx ?
is this approach feasible considering time, cost, porting to many platforms ?

I want to know what's the options before I start

sentences:
How can i change the Camera component height in FirstPersonCharacter? The player looks very short. I changed his scale to 2,2,2 but the camera is in the middle it's like the player head is in the middle and not near the top.

In the screenshot in the Hierarchy i have a FPSController and the FirstPersonCharacter with the Camera is child of it. The FPSController scale set to 2,2,2 like the two soldiers. But you can see when i'm getting closer to the soldiers it looks like i'm looking at them from the ground.

I need to move the camera only up somehow.

And this is the camera and the firstpersoncontroller before running the game:

sentences:
Projecting grid textures to select parts of the terrain (Unity) So I'm trying to be smart and not use 500+ some tile prefabs to make a grid, and so far the back-end portion has gone swimmingly. I initially used a dedicated mesh to represent the grid, but as I'm now opting for 3D terrain (and not tilemapping), I figured that was a lot of unnecessary vertices - especially if I want to have the grid conform to the terrain.

My shader inexperience, on the other hand, is causing me to stop and overthink this.

Using FE as inspiration, I'm thinking about projecting the transparent grid texture onto a base terrain layer.

If I wanted parts of the terrain to not be covered by the grid (such as the water area in the picture), would I simply use the world coordinates to tell the shader don't do anything there?

The most confusing part for me, however, is how to go about highlighting tiles. I want movement and attack tiles to also be 'painted' onto the terrain in specific colors, but obviously they only affect an even smaller portion than the terrain than the grid.

Would I simply be using the same shader to grab world coordinates once again and more or less start/stop overlaying the movement/attack texture over the grid/terrain? And if I'm really being efficient, those textures belong to the same png and I just use UV's to switch between them like a sprite sheet?
Is this even a good practice for shaders in the first place? Redrawing and adding textures to only parts of a material? Should I be redrawing and updating the whole texture instead?

I guess I get thrown off because I'm only familiar with a 1:1 mesh to material design, so the so the thought of a single mesh but multiple textures on discrete parts that may or may not overlap makes somewhat sense on paper -- but implementation in Unity is just above me atm.

Thanks!

sentences:
Software/Hardware options for game music I have some friends who want to make the music for a game I'm developing. We have no idea where to start. I've seen software like Reason (way too expensive at $450). I've also seen stuff like GarageBand for $15. I'm happy to pay up to $50 for software, and I've seen some good quality free software like lmms. I just have no idea what each of them are good for. I'm also thinking of getting a cheap midi keyboard, since that'd be a million times easier than clicking a mouse trying to get the right notes in the right places. So,

1) What hardware is recommended for simple background music

2) What software is recommended for simple background music

3) Where can I direct my friends for learning more about music creation on a computer

I know that I'm being really general, and some people might want to know the "type" of music or what instruments will be used. I have no idea, so I'm just speaking basically.

sentences:
How to make planets "stay together" on collision I working on a 2D planetary orbit simulator and I've encountered a problem regarding the collision of planets. Currently, here is what I have

if self._dist_between(p1.pos, p2.pos) <= p1.radius + p2.radius:
    pass

I detect the collisions but I don't know how to resolve them. I don't want the planets to bounce or do anything fancy, I simply want them to not pass through one another. I have tried disabling their movement completely on collision but this fails to work when more than 2 planets are active in the simulation, as when 2 planets collide they freeze in time rather than continue to be affected by the other planets.

This is the code that manages the movement

 def update(self):
    for p1 in self.planets:
        for p2 in self.planets:
            if p1 != p2:

                # Calculate and apply force
                temp_force_vector = [
                    self._gravitational_force(p1.mass, p2.mass, self._dist_between(p1.pos, p2.pos)),
                    self._radians_between(p1.pos, p2.pos)
                ]

                if self._dist_between(p1.pos, p2.pos) > p1.radius + p2.radius:
                    p1.apply_force(temp_force_vector)

                p1.update_pos()

Any suggestions?

sentences:
How to make a stack stable? Need help for an explicit resting contact scheme (2-dimensional) Previously, I struggle with the sequential impulse-based method I developed. Thanks to jedediah referring me to this paper, I managed to rebuild the codes and implement the simultaneous impulse based method with Projected-Gauss-Seidel (PGS) iterative solver as described by Erin Catto (mentioned in the reference of the paper as [Catt05]).

So here's how it currently is:

The simulation handles 2-dimensional rotating convex polygons.
Detection is using separating-axis test, with a SKIN, meaning closest points between two polygons is detected and determined if their distance is less than SKIN.
To resolve collision, simultaneous impulse-based method is used. It is solved using iterative solver (PGS-solver) as in Erin Catto's paper. Error-correction is implemented using Baumgarte's stabilization (you can refer to either paper for this) using
J V = beta/dt*overlap,
J is the Jacobian for the constraints, V the matrix containing the velocities of the bodies, beta an error-correction parameter that is better be < 1, dt the time-step taken by the engine, and overlap, the overlap between the bodies (true overlap, so SKIN is ignored).

However, it is still less stable than I expected :s I tried to stack hexagons (or squares, doesn't really matter), and even with only 4 to 5 of them, they would swing! Also note that I am not looking for a sleeping scheme. But I would settle if you have any explicit scheme to handle resting contacts.

That said, I would be more than happy if you have a way of treating it generally (as continuous collision, instead of explicitly as a special state).

Ideas I have tried:
Using simultaneous position based error correction as described in the paper in section 5.3.2, turned out to be worse than the current scheme.

If you want to know the parameters I used:

Hexagons, side 50 (pixels)
gravity 2400 (pixels/sec^2)
time-step 1/60 (sec)
beta 0.1
restitution 0 to 0.2
coeff. of friction 0.2
PGS iteration 10
initial separation 10 (pixels)
mass 1 (unit is irrelevant for now, i modified velocity directly<-impulse method)
inertia 1/1000

Thanks in advance! I really appreciate any help from you guys!! :)

EDIT

In response to Cholesky's comment about warm starting the solver and Baumgarte:
I forgot to mention! I do save the contact history and the impulse determined in this time step to be used as initial guess in the next time step.

As for the Baumgarte, here's what actually happens in the code. Collision is detected when the bodies' closest distance is less than SKIN, meaning they are actually still separated. If at this moment, I used the PGS solver without Baumgarte, restitution of 0 alone would be able to stop the bodies, separated by a distance of ~SKIN, in mid-air! So this isn't right, I want to have the bodies touching each other. So I turn on the Baumgarte, where its role is actually to pull the bodies together! Weird I know, a scheme intended to push the body apart becomes useful for the reverse.

Also, I found that if I increase the number of iteration to 100, stacks become much more stable, though the program becomes so slow.

UPDATE

Since the stack swings left and right, could it be something is wrong with my friction model?

Current friction constraint: relative_tangential_velocity = 0

sentences:
Camera follow while dragging object I am working on Bowlingball game. And when I move the ball left and right by touching or clicking the camera moves, but it also makes ball keeps moving in the same direction even though I just moved the mouse once in that direction.

The code for moving ball left and right by touching and dragging.

void TouchInput()
{
    if (Input.GetMouseButtonDown(0))
    {
        Ray ray = RayGenerator();
        RaycastHit hit;

        if (Physics.Raycast(ray.origin, ray.direction, out hit))
        {
            if (hit.transform.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 distance = 0.0f;
                objPlane.Raycast(mRay, out distance);
                ballTouchOffset = obj.transform.position - mRay.GetPoint(distance);
            }
        }
    } else if (Input.GetMouseButton(0) && obj)
    {
        Ray mRay = Camera.main.ScreenPointToRay(Input.mousePosition);
        float distance;
        if (objPlane.Raycast(mRay, out distance))
        {
            obj.transform.position = new Vector3(mRay.GetPoint(distance).x + ballTouchOffset.x, obj.transform.position.y, obj.transform.position.z);
        }
    } else if (Input.GetMouseButtonUp(0) & obj)
    {
        obj = null;
    }
}

And the code for camera follow

public Transform bowlingBall;
public Vector3 offset;

private void LateUpdate()
{
    transform.position = bowlingBall.position + offset;
}

sentences:
How to choose a success and failure sound I create a math game where the user has to solve an equation. If the user is right, the application plays sound A. If he's wrong, it plays sound B.

What criteria should I use to choose sounds for A and B?

sentences: How to access coordinates of objects in bullet physics (libGDX)? I need to access the x, y and z coordinates of a bullet physics object. I'm assuming this is done via the transform matrix, but I have no idea which values mean what. There doesn't seem to be any information about it on the internet. How is this done? Is there a better was of doing it that I'm not aware of?

sentences:
How to make AI detect a target behind a wall, who is only partially exposed? I'm making an FPS game where, even when a target's whole body is behind a wall or box, but its finger or foot exposed, the AI should be able to detect it and shoot its finger.

So far the way I've thought of to implement this it so traverse all the targets, find who is near a wall, and compare their position with the corner of wall. But I don't know how to check whether its finger is exposed.

I could use a raycast forward from the AI's gun, but would I need to add a collider to every small body part of every target?

sentences:
Want event to occur when button is held but not when clicked I'm wondering if there is a way to have an event occur when the left mouse button is held down, but not to occur when it is initially clicked. I think you can do something like...

if (Input.GetMouseButtonDown(0))
{
    // do stuff
}
else if (Input.GetMouseButton(0))
{
    // do other stuff
}

It looks at first like this would work because when left click is clicked it would execute the first if statement and not test for the second. And if left click is held it would fail the first if condition. But, does this in fact work? Do you actually enter the second if statement when attempting to click because you actually hold it down for slightly longer than a true click since this is happening in Update?

Now, I want to do this in one condition. Something like...

if (!Input.GetMouseButtonDown(0) && Input.GetMouseButton(0))
{
    // do the stuff that should happen when mouse is held but not clicked
}

but I don't think this works either. Any pointers?

For Context, I want to have something happen in every case when mouse button is held down, and only happen in some cases when mouse button is clicked.

if (Input.GetMouseButtonDown(0) && !UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject()
|| !Input.GetMouseButton(0) && Input.GetMouseButton(0))

This doesn't work though

sentences:
Unity Ajax and json data sending once again i need your help! with help from here i managed to make a function that sends a formated json text to a subscription service.the format is this
{
    "profiles":
    [
        {
            "email":"example@example.com"
        }
    ]
}

that works fine and great from my pc but once i upload the game it gets blocked by cors. Now i have cors enabled so i contacted klaviyo which handles the data and they told me their api does not accept data from the front end and i could use ajax to make it happer, an example of which is this:
var settings
=
{

"async"
: true,

"crossDomain"
: true,

"url"
:
"https://manage.kmail-lists.com/ajax/subscriptions/subscribe"
,

"method"
:
"POST"
,

"headers"
: {

"content-type"
:
"application/x-www-form-urlencoded"
,

"cache-control"
:
"no-cache"

},

"data"
: {

"g"
:
"LIST_ID"
,

"email"
: "email@address.com",

/
/
pass
in
additional fields (optional)

"$fields"
:
"$source, $first_name, $last_name"
,

"$source"
:
"Account Creation"
,

"$first_name"
: firstname,

"$last_name"
: lastname

}

};

$.ajax(settings).done(function(response) {

console.log(response);

})

now my code which is working from my pc is this :
public class testing : MonoBehaviour
{
    public InputField field;
    private string URL = "https://a.klaviyo.com/api/v2/list/YeXzKp/members?api_key=pk_ec448e1bdab7504c143466ca5eeabc5e95&profiles=[]";

    public void SaveData()
    {
        string data = JsonUtility.ToJson(
      new EmailApiData()
      {
          profiles = new EmailApiProfileData[]
          {
             new EmailApiProfileData() { email = field.text }
          }});
        StartCoroutine(SaveIntoJson(URL , data));
    }
    IEnumerator SaveIntoJson(string url, string data)
    {
        var request = new UnityWebRequest(url, UnityWebRequest.kHttpVerbPOST);
        request.SetRequestHeader("Content-Type", "application/json");
        request.SetRequestHeader("Access-Control-Allow-Origin","*");
        request.SetRequestHeader("Access-Control-Allow-Credentials", "true");
        var jsonBytes = Encoding.UTF8.GetBytes(data);
        request.uploadHandler = new UploadHandlerRaw(jsonBytes);
        request.downloadHandler = new DownloadHandlerBuffer();
        yield return request.SendWebRequest();
        if (request.isNetworkError || request.isHttpError)
        {
            Debug.Log(request.error);
            Debug.Log(request.downloadHandler.text);
        }
        else
        {
            Debug.Log("Form upload complete!");
        }
        Debug.Log(data);
    }
}
[Serializable]
public class EmailApiProfileData
{
    public string email;
}
[Serializable]
public class EmailApiData
{
    public EmailApiProfileData[] profiles;
}

how can i put those two together?? i know im way out of my waters here but i want to learn it!Thank you once more!

sentences:
How can I make a gradual slope with Unity Terrain tool? As the question title states, I am trying to make a gradual slope in Unity Terrain. I want it to be many 100's metres long for a golf course and it will slope in a few directions hopefully in places.

How could this be done with Unity Terrain?

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 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:
How to model muscle contraction force acting on two bones connected by joint in Unity/PhysX? I'm trying to understand what is a correct way to model a muscle contraction in a physics engine like PhysX (Unity3D). Muscle that I'm modelling is connected to a bones in 2 points A and B.

Having a total force for the muscle fTotal, I'm trying to apply two forces in points A and B on corresponding bones, where magnitude of each force is a half of the total force. And of course force vectors are lying on the same AB line and pointing to the opposite directions towards the center of the muscle.

fTotal = ||fA|| + ||fB||

One thing that bothers me is a situation when one bone is fixed in space. Intuitively, all contraction force should be applied only to a single attachment point, however, my model will apply only 1/2 of a force. Can you suggest a better way to implement this?

sentences:
How to handle pathfinding on a non-grid/non-node terrain map I'm not sure if this is even  path-finding. All I have is a 3D map that has hills, etc. I'd like the enemy to flock an object, but also walk around other objects. These blocking objects may be added after the path is calculated, which would cause a re-calculation of the path.

What algorithm am I looking at here?

sentences:
Saving data in games? I'm soon going to make a game for the iPhone as a school project.

My idea was to make a TLOZ remake, with Tiled Maps.

However, I'm not quite sure how save the data.
In TLOZ you have a lot of sub-quests, treasures, items, and much more.
I want the user to only be able to open a treasure once.

Therefore I have to save this information somehow.
However, I'm not sure how to assign the data to that certain object, for example that treasure that Link has opened.

I thought about making id's for every object, but I'll have multiple maps, and it doesn't seem like the right solution.

Are there any standards for this?

Or does anyone have another idea?

sentences:
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:
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:
Raycast drawing and hitting limited to inside cylinder I'm trying to get a very basic "radar" system to work. Right now, I'm not even scanning, just looking at a known target location.

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

public class RadarScript : MonoBehaviour {

    public GameObject radar;
    public GameObject target;

    private bool found = false;

    void Update () {

        Vector3 lookLocation = target.transform.position - radar.transform.position;

        RaycastHit hitInfo;

        if (found == false) {

            Ray ray = new Ray (radar.transform.position, lookLocation);

            Debug.DrawRay (ray.origin, ray.direction, Color.red);

            if (Physics.Raycast (ray, out hitInfo, 10000.0f, 0)) {
                if (hitInfo.collider.tag == "Target") {

                    printHitInfo (hitInfo);

                    found = true;
                }
            }
        }
    }

    private void printHitInfo(RaycastHit hit) {
        Debug.Log ("TARGET FOUND!");
        Debug.Log ("Distance: " + hit.distance);
    }
}

So, here's the result can be seen here: https://gfycat.com/FloweryBraveCockroach

There's 2 problems here.

The Debug.DrawRay call is only drawing the ray inside the cylinder (radar).
The target is never being hit.

What's going wrong here ?

sentences:
How can I avoid duplication of jBox2D physics attributes? I'm using jBox2D for physics and collision detection in a game engine with an entity-component system. It works, but I'm unsure how to structure my code with respect to the values represented in the Physics World and in my Pixel world.

Initially, I had these vectors on my Entity class:

public Vector position;
public Vector acceleration;
public Vector velocity;

public Body body; //this is jBox2D's physics body object.

Duplication is bad. How can I reduce the duplication of entity values in jBox2d's physics body?

sentences:
Path finding algorithm for (x,y) coordinates in c++ I am trying to code a path finding function in c++ . It should work like that, you supply the start point (x1,y1) and the end point(x2,y2) and it returns a list of points for the shortest path.

Assume that i want to go from the red tile to the blue one, however the grey tiles can not be walked on (like walls) .

sentences:
Simulating flight dynamics in two dimensions I have decided that in order to improve my math skills and game programming skills I am going to work on a two-dimensional space simulator. The view of the player or camera will be from inside the cockpit of a spaceship. This presents quite a few challenges which I am looking to the gd.net community for help with. I'm not asking for any code or any specific answers, just suggestions on what subjects to research.

My first challenge is going to be related to perspective correction. Since I'm only working with two-dimensions I need to fake flight dynamics. If you imagine that you are sitting in a cockpit of a spaceship, when you move the flight stick to the right or left the ship would yaw in either direction. Simulating this in two dimensions is much more difficult than in three dimensions, as you have to apply some sort of perspective correction.

The same is true if you were to pitch the nose of the spacecraft up or down. Simply moving the camera along the x / y axes won't be enough. I need to correct the perspective of my camera so that it appears that the aircraft is actually yawing / pitching in the desired direction and not just panning upwards / to the side.

What is the basic mathematical formula for applying this kind of perspective correction? If a formula is too much to ask for, where can I read about examples of this being done / read about the basic concepts I need to understand to accomplish this?

Thanks!

sentences:
Are there any command line swf packing tools? I want to packing image files(png, jpg) into swf, then game can load files easily. But I want to do this by a Makefile, not FLASH CS.
Do you know any command line swf tool set can do that? And can I packing XML files into it as well?

sentences: What maps sizes did old 2D RTS games like C&C and WarCraft support? I'm looking for the size (in tiles) of the maps for the old 2D games Command and Conquer and Warcraft 1 and 2.

sentences:
Handling creation of entities on level creation I'm currently working on a 2d physics based plat former, kinda in the style of super meat boy. In super meat boy, you have multiple levels and I want a similar sort of thing but is there a general way of handling creating entities at the start of a level. Since I'm using an entity-component design and using tiled editor to load levels (and even lua script do to some more config/level related logic), how would I handle creating entities?

Currently, I parse my tiled xml map and do something like

if("MovingPlatform"){
   createMovingPlatform(mapObject)
}elseif("SomeOtherEntity"){

} //... so on so forth

But this will soon become a really long branch of if statements just to load my entities. Is there a cleaner design pattern or way of doing this. I was thinking to use a map or strings to classes that create that entity like so:

 //in constructor of level loader
 entityCreatorMap["MovingPlatform"] = MovingPlatformEntityLoader()

//somewhere later creating my entities by parsing xml
entityCreatorMap[mapObject.getName()].create(mapObject)

But that will be lots of lines initialising these kind of objects. Any ideas?

sentences:
Generating a particle effect on top of a GUIElement (Unity) I am working in Unity on a 2D project which is using C#.

I have a number of guitextures which are hearts in order to create a sort of life meter. I would like when the player loses a heart for the heart to change into a skull in a puff of smoke. I currently have the hearts correctly turning into skulls, and a puff of smoke is generated, however the smoke is created in the wrong location.

The smoke is currently generated by:

GameObject smokeObj = (GameObject)Instantiate (smoke, transform.TransformPoint(transform.position), Quaternion.identity);

I have also tried:

GameObject smokeObj = (GameObject)Instantiate (smoke, transform.position, Quaternion.identity);

I know that the reason that the smoke is created in to wrong location is due to GUIElements using a different coordinate system than other gameObjects.

How can I create the smoke in the correct location?

This is a 2D project and I am currently using Unity 4.5of6, with windows 8.1.

Thank you for your assistance, if you have any questions please do not hesitate to ask.

EDIT:
I have also tried the following, yet it also works incorrectly:

Vector3 worldPos = cam.ViewportToWorldPoint(transform.localPosition + Vector3.forward);
        worldPos.z=0;
        GameObject smokeObj = (GameObject)Instantiate (smoke, worldPos, Quaternion.identity);
        Debug.Log(worldPos);
                //smokeObj.layer = 5;
                smokeObj.transform.parent = this.transform;

sentences:
Centralized User database for multiple Systems I was wondering, how do large companies handle user accounts and allow different applications to access them.

One example that comes to mind is Riot, their game League of Legends has a global user account that allows you to login to forums and the game client itself.

What sort of method would they be using to allow multiple systems to access this database.

sentences:
Which gesture recognizer should I use to handle multiple simultaneous flicks? So, if you can picture a game with little ninjas running down at you, and a bunch of shurikens at the bottom of the screen, you're picturing the set-up I'm addressing.

I want the player to be able to flick the shurikens up at the ninjas, but I want them to be able to do it with both thumbs at the same time. Gesture recognizers seem to be the way to do this, but I'm not sure which is the most appropriate. The main ones that seem to fit are the pan gesture and the swipe gesture.

Does anyone have insight into the pluses and minuses of each, or even if a better one exists?

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:
Monetizing an Android library? I'm developing a library ( i.e. a JAR file that you put into the libs folder in eclipse ) which would extend surfaceView, which other people would hopefully use to make games.

I guess the best way to make any money off it would be to show banners on that surfaceview, right?

Maybe someone had similar experience? What advertising company would you suggest? admob, leadbolt? would they agree that I would integrate their sdk into my library ( not a finished app )?

Thanks!

sentences:
How to delete a score after collecting all collectibles I'm making a small game for my English class, and in the beginning, you have to collect rocks. I already have the code for counting how many rocks have been picked up, and the GUI to display while the game runs. After the player collects all 9 rocks I would like for the GUI to disappear or delete itself since it won't be used anymore throughout the game, and for new text to appear at the top of the screen saying "Go To The Lottery"

I'm still very new to Unity so posting the code, and then following up with a brief explanation as to what does what would be majorly appreciated (but not at all demanded)

Both codes are in JavaScript

#pragma strict

static var currentScore : int = 0;
var offsetY : float = 40;
var sizeX : float = 100;
var SizeY :float = 40;

function OnGUI () {
GUI.Box (new Rect (Screen.width/2-sizeX, offsetY, sizeX, SizeY), "Rocks Collected: " + currentScore);

}

^^ This is my GameMaster script, which is in a empty game object galled "_GM" ^^

#pragma strict

function OnTriggerEnter (info : Collider)
{
    if (info.name == "Player")
    {
    GameMaster.currentScore += 1;
    Debug.Log ("Picked stone up");
    Destroy (gameObject);
    }
}

^^ This is my RockCollection script and it's what actually tells the GameMaster script to add 1 to the score and then delete the rock so you can't continuously pick it up

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:
In Unity (2017) is there a way to set the buttons used by Input.GetAxis() programatically? The buttons used for keyboard axis inputs can be set manually via Negative and Positive Button fields for the axis at Edit > Project Settings > Input Manager. However I'd like to make this a user configurable option which I think means needing to set the button values from a script.

I've been looking for a method along the lines of:

Input.SetAxis("Vertical").positveButton

But so far I'm striking out. Is there a way to do this?

sentences:
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:
What's the difference between Canvas and WebGL? I'm thinking about using CAAT as a part of a HTML5 game engine. One of it's features is the ability to render to Canvas and WebGL without changing anything in the client code. That is a good thing, but I haven't found precisely: what are the differences between those two technologies?

I would specially like to know the differences of Canvas and WebGL in the following regards:

Framerate
Desktop browser support
Mobile browser support
Futureproofability (TM)

sentences:
Speed dependent arc question I'm currenlty working on an assignment and would appreciate any sort of help on the following implementation

The question follows

We are tasked to  implement some heuristics but one of them is really confusing to me.

  The following are a set of heuristics widely used by game developers
  for the movement of human characters while trying to reach a target

  A. If the character is stationary or moving very slowly

  If it is a very small distance from its target, it will step there directly, even if this involves moving backward or sidestepping
  Else if the target is farther away, the character will first turn on the spot to face its target and then move forward to reach it.

  B. Else if the character is moving with some speed

  If the target is within a speed-dependent arc (like a narrow perception zone, or a cone of perception) in front of it, then it will
  continue to move forward but add a rotational component to
  incrementally turn toward the target**
  Else if the target is outside its arc, then it will stop moving and change direction on the spot before setting off once more.

B2 I'm not entirely sure what a speed dependent arc is. I googled it and it bring it back to the textbook( Artificial Intelligence for video games). My question is : what is a speed dependent arc?

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:
Dynamic Sort order For walking in front and behind stuff I'm using tile maps, and I'm having a difficult time with the concept of walking both in front of things, and behind things and having the layers sort order show properly. Take the image below, I need it to behave like #1 AND #2, so that if you walk behind it, you get that nice layering. However, I also need it to act like #2 when infront of it without looking like #3. Is there some sort of way to make the top of the barrels sort order change depending on if the player is in front of it, or behind it?
I was looking at rule tiles, but that's something else, unless there is some feature about it I do not know of.

sentences:
Can't rotate object after using transform.forward I'm using above code to rotate object pointing where it moves:

transform.forward = m_Rigidbody.velocity;

It works fine, however the problem is that I can't rotate this object anymore after set direction.

transform.forward = m_Rigidbody.velocity;
transform.Rotate(0, 0, m_RotateSpeed * Time.deltaTime * 500); // Not Working

Code is simple, first rotate the object to point where it goes and then rotate z axis. But when I ran the game, it just shaking little bit and didn't rotate at all.

Why it doesn't work even rotating code after the transform.forward? Any advice will very appreciate it.

sentences:
How to design a character damage system with ECS architecture? I am developing an game with ECS architecture and trying to design a character damage system.
Does the following design fits into ECS conception and will it be extendable in future?

I have an Actor component with health percent attribute and ActorsDamage system.

I also have an inventory system, so actors can use some food to increase their health.

When actors use inventory items, their Lua handlers executes and generates ActorHit event.

ActorDamage system receives this event and increases or decreases the actor's health.

Other game systems link actors' AI system or actors' keyboard control systems can also trigger hit events.

So, is this an appropriate design conception, or is there something I need to correct or improve?

sentences:
Stuttering when using movetowards in a coroutine I have the following problem with a WebGL project I'm working on:

I have an object which I want to zoom out and move to a specific position at the same time, for this, I've created a coroutine which is called on click. On my computer, everything works perfectly fine, but whenever I try this function on a not that high-end computer, this coroutine stutters a bit.

I've tried deactivating every single shader or sprite that this object is using in order to discard high graphic usage, but the problem persists even if the object is a blank circle.

This is the coroutine I'm using:

  IEnumerator restorePosition() {
    float counter = 0;
    while(counter < duration) {
      counter += Time.deltaTime;

      if (counter > duration) {
        counter = duration;
      }

      float framesPerTime = Vector3.Distance(zoomedTransform.position, storedPosition) / (duration - counter) * Time.deltaTime;
      zoomedTransform.position = Vector3.MoveTowards(zoomedTransform.position, storedPosition, framesPerTime);

      float framesPerTimeZoom = Vector3.Distance(zoomedTransform.localScale, storedScale) / (duration - counter) * Time.deltaTime;
      zoomedTransform.localScale = Vector3.MoveTowards(zoomedTransform.localScale, storedScale, framesPerTimeZoom);

      //restore solar system to original position
      float solarSystemFrames = Vector3.Distance(solarSystem.position, solarSystemStartPOS) / (duration - counter) * Time.deltaTime;
      solarSystem.position = Vector3.MoveTowards(solarSystem.position, solarSystemStartPOS, solarSystemFrames);
      yield return null;
    }

    //zoomedTransform.position = storedPosition;
    zoomed = false;
    spriteMask.frontSortingLayerID = originalFrontLayerID;
    spriteMask.backSortingLayerID = originalBackLayerID;
    zoomedTransform.localScale = storedScale;

    foreach(SpriteRenderer s in spriteChildren) {
      s.sortingLayerName = originalLayer;
    }

    foreach(OrbitController o in planets) {
      o.restartAnimation();
    }
    inTransition = false;

    //set moon layer  values back to original
    if (moon != null) {
      moon.gameObject.GetComponent<SpriteMask>().isCustomRangeActive = true;
      moon.gameObject.GetComponent<SpriteRenderer>().sortingLayerName = moonLayerName;
      foreach (Transform child in moon) {
        child.GetComponent<SpriteRenderer>().sortingLayerName = moonLayerName;
      }
      moon.GetComponent<MoonBehaviour>().zoomOut();
      //reset null transform and layer names
      moon = null;
      moonLayerName = null;
    }
    yield break;
  }

Could you give me an idea of what I'm doing wrong? , I've also tried Lerp and that didn't solve the problem.
Thank you!

sentences: Stitch a collection of images into a tileset I have a number of tiles as standalone files that I would like to stitch together into a single tileset. Are there any tools that can quickly do this?

sentences:
Accessing a char array from another class I'm working on a crossword puzzle game. In order to set the letters in my tiles, I have a script attached to text components that accessing a char array that stores my letters. It looks like this:

First class:

  public class GenerateBoard : MonoBehaviour
  {
    public static char[,]gameBoard = new char[15,15];
    void Start()
    {
        gameBoard[0, 0] = 'W';
    }

Second class:

public class SetLetter : MonoBehaviour
{
    Text letter;
    public int x;
    public int y;
    // Start is called before the first frame update
    void Start()
    {
        letter = GetComponent<Text>();
        letter.text = GenerateBoard.gameBoard[x,y] + "";
    }

    // Update is called once per frame
    void Update()
    {
        Debug.Log("glitch: " + GenerateBoard.gameBoard[0, 0]);
    }
}

I would expect Debug.Log to print 'W' but it appears to be empty. Why isn't it accessing the letter 'W' from the first class? When I use Debug.Log in my first class it properly prints 'W'.

sentences:
3D Menu Attached to an Object? So I'm gathering information for my project, and one of the things I want to achieve is to create a very sophisticated crafting system and weapon modification but I want the weapon customization to look in a specific manner.

A very good reference would be Crysis weapon attachments system, where if you open it, your character tilts the weapon and there are few menus popping up, all attached to the weapon, so you can see the menus moving around as your weapon is moving (due to you breathing for example, or walking).

Here is a quick image reference:

So 1st thing comes to my mind is, how in the name of god should I approach this? Pardon if this is quite easy thing to do, I'm just completely new to Unity. (I have solid C++ background so programming isn't the obstacle)

Edit 1: To be precise, I'm wondering how to work out the positioning of the menus in relation to the weapon. So the menu is moving with the weapon and eventually even turn slightly to give that 3D'ish effect.

sentences:
Can I position a player avatar behind the camera based on rotation? I'm currently reverse engineering a video game where what's rendered on the screen depends on the proximity of the player avatar to the camera. As such, for my freecam to work properly, I need to bring the player avatar along with the camera.

Since I can't yet find how the player avatar is rendered to the screen, the next best thing I can think to do is to place the player avatar behind the camera at all times (I suppose essentially like making the player avatar orbit the camera, but always be behind it).

I just can't quite pin down how to make this happen.

The values I have are as follows:

Player Avatar:

X
Y (Up/Down)
Z

Camera:

X
Y (Up/Down)
Z
Pitch (In degrees natively, but converted to radians for my calculations)
Yaw (In degrees natively, but converted to radians for my calculations)

World Orientation:

To get my camera to move forward in the direction I'm pointing my mouse when pressing the Y key, these are the calculations I'm using (code is in Lua):

--//Camera XYZ values
local camCoordX = readFloat("[cameraBase]+990") --Camera X
local camCoordY = readFloat("[cameraBase]+994") --Camera Y
local camCoordZ = readFloat("[cameraBase]+998") --Camera Z

--//Camera pitch and yaw
local pitch = math.rad(readFloat("[cameraBase]+1540")) --Pitch
local yaw = math.rad(readFloat("[cameraBase]+1544")) --Yaw

--//Sine and cosine calculations
local sinOfYaw = math.sin(yaw) --Sine of Yaw
local cosOfYaw = math.cos(yaw) --Cosine of Yaw
local sinOfPitch = math.sin(pitch) --Sine of Pitch
local cosOfPitch = math.cos(pitch) --Cosine of Pitch

--//If Y key is pressed, write new camera XYZ values accordingly
if isKeyPressed(VK_Y) then
    writeFloat("[cameraBase]+990", camCoordX + (sinOfYaw * speed))
    writeFloat("[cameraBase]+994", camCoordY - (sinOfPitch * speed))
    writeFloat("[cameraBase]+998", camCoordZ + (cosOfYaw * speed))
end

Based on that information, is it feasible for me to accomplish placing the player avatar behind the camera at all times based on rotation? I'm open to other suggestions or options as well. Thank you for any help you can offer!

sentences:
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:
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:
Is there a way where we can verify if certain image is 3D or not I wanted to understand - Is there a way where we can verify if certain image is 3D or not
So basically I want to automate the process where we can detect if certain given image is of 3D or not
Problem: In my application - I often detect few 3D images are showing as plain black image or sometimes 3D images are broken
So if I can find a way where I can check that certain image should not be completely black and should be 3D model and not 2D image
My Application is in C# - but I am open for any solution irrespective of language!!
Thanks in advance

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:
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:
Implementing a hook (Like pudge in Dota) I'm coding a new game, which involves hooking.

Ive been testing a couple of ideas now and im quite stuck.

The player can throw a "hook" which fires away in the aimed direction, until it hits something, it will bounce on some obstacles and will return to the player if hitting other obstacles. While the hook is in the air, the player can move as he/she wishes, and hook will after a certain time be pulled back to the player.

I don't know if you guys have played pudge wars, but that is the kinda hook I'm after.

What do you think is the best approach in simulating this?

Should i save points a long the way?

Edit: Yes the bounce thing is a from pudge wars.
And yes the length, not time, that is true!

sentences: 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:
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:
Rendering a dynamically sized box So in games where there are textboxes with different sizes appearing, how does one actually render them efficiently? Games like Final Fantasy IX have dynamically sized speechbubbles for example, each with a size so it exactly matches the rendered text.

I know the basic idea is to render the frame around the bounding box of the text and with different images for each component of a box: corners, edges, center. Though how should one design that rendering if the edges aren't of 1 pixel in size when one has to compute how often an edge piece needs to be drawn next to each other to form the whole edge of the box.

Here is my naive implementation of a hopefully good enough abstracted method:

public void drawBox(Renderer renderer, int x, int y, int width, int height){
    int es = this.components.getEdgeSize();
    renderer.renderSprite(this.components.getTopLeftCorner(), x, y);
    /* Render top edge of box */
    int i;
    for(i = es; i < width - es; i += this.components.getTop().getWidth()){
        renderer.renderSprite(this.components.getTop(), x + i, y);
    }
    renderer.renderSprite(this.components.getTopRightCorner(), x + i, y);
    /* Render left edge of box */
    int j;
    for(j = es; j < height - es; j += this.components.getLeft().getHeight()){
        renderer.renderSprite(this.components.getLeft(), x, y + j);
    }
    renderer.renderSprite(this.components.getBottomLeftCorner(), x, y + j);
    /*Render bottom edge of box */
    for(i = es; i < width - es; i += this.components.getBottom().getWidth()){
        renderer.renderSprite(this.components.getBottom(), x + i, y + j);
    }
    renderer.renderSprite(this.components.getBottomRightCorner(), x + i, y + j);
    /*Render right edge of box */
    for(j = es; j < height - es; j += this.components.getRight().getHeight()){
        renderer.renderSprite(this.components.getLeft(), x + i, y + j);
    }
    int k = i;
    int l = j;
    for(i = es; i < k; i+= this.components.getCenter().getWidth()){
        for(j = es; j < l; j += this.components.getCenter().getHeight()){
            renderer.renderSprite(this.components.getCenter(), x + i, y + j);
        }
    }
}

I feel that some loops did not have to be done and the loop filling the center feels like it could potentially kill the framerate.

sentences: There any way to insert images inside the code (just for comprehesion) in any IDE compatible with Game Engine Unity3D (Monodevelop for example)? My code has a lot of geometry codes, thinks that shouldn't be represented just by comments I don't know if it exists, but should be fine to insert images like png in the middle of codes explaning that math behind, just in case I forget what any classes/method/lines do in future. Thanks.

sentences:
SDL2 and OpenGL: flickering with double buffering, what am I doing wrong? I'm currently fiddling with SDL2 and OpenGL to get an understanding on how they work and, moreover, how shaders are done and work.
Right now, I'm following this tutorial, using SDL instead of glfw; and in a SDL window I render 2 triangles via shader and change their color dynamically, but an obnoxious flickering effect shows, even though I'm sure double buffering is active.

Now, to the code:

    //Here they are SDL attributes for OpenGL
    SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, 3 );
    SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, 1 );
    //Double buffer should be on by default, but I set it anyway
    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
    SDL_GL_SetAttribute( SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE );

    //SDL window creation
    mWindow = SDL_CreateWindow( "Window Title",
                            SDL_WINDOWPOS_UNDEFINED,
                            SDL_WINDOWPOS_UNDEFINED,
                            mWidth,
                            mHeight,
                            SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE );

    // Use Vsync
   if( SDL_GL_SetSwapInterval( 1 ) < 0 )
   {
         SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Warning: Unable to set VSync! SDL Error: %s\n", SDL_GetError() );
  }

    //OpenGL initialization
    glClearColor(0.f, 0.f, 0.f, 1.f);

    glEnable( GL_TEXTURE_2D );

    glEnable( GL_BLEND );
    glDisable( GL_DEPTH_TEST );
    glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );

while one of the shaders (no point in pasting the other one, too, as the issue is the same) I use is:

vertex shader:

#version 330
layout (location = 0) in vec3 position;
layout (location = 1) in vec3 color;
out vec3 LSampleFrag;
void main()
{
    gl_Position = vec4(position, 1.0);
    LSampleFrag = color;
}

fragment shader:

#version 330
out vec4 color;
uniform vec4 LSampleFrag;
void main()
{
    color = LSampleFrag;
}

Binding of vertex data to the shader:

    glClearColor(0.f, 0.f, 0.f, 1.f);

    //VBO data
    GLfloat vertexData[] =
    {
        0.5f, -0.5f, 0.0f,
        0.5f, 0.5f, 0.0f,
        -0.5f,  0.5f, 0.0f
    };

    glGenVertexArrays(1, &gVAO);
    glGenBuffers(1, &gVBO);
    // Bind the Vertex Array Object first, then bind and set vertex buffer(s) and attribute pointer(s).
    glBindVertexArray(gVAO);

    glBindBuffer(GL_ARRAY_BUFFER, gVBO);
    glBufferData(GL_ARRAY_BUFFER, sizeof(vertexData), vertexData, GL_STATIC_DRAW);

    // Position attribute
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(GLfloat), nullptr );
    glEnableVertexAttribArray(0);

    glBindVertexArray(0);

and its render function is this one, where I change, everytime is called shade of green:

GLfloat timeValue = SDL_GetTicks();
GLfloat greenValue = (sin(timeValue) / 2) + 0.5;
GLint vertexColorLocation = glGetUniformLocation(mProgramID, "LSampleFrag");
glUniform4f(vertexColorLocation, 0.0f, greenValue, 0.0f, 1.0f);

glBindVertexArray(gVAO);
glDrawArrays(GL_TRIANGLES, 0, 3);
glBindVertexArray(0);

//in the main render function, after rendering the shader
SDL_GL_SwapWindow( window_->getSDLWindow());

As I've already said, double buffering is active but flickering is still an issue: am I missing something? I really don't understand why it is happening.

sentences:
Cinemachine third person camera movement causes misalignment I'm working on third person movement using CinemachineFreeLook as the player camera. At first I thought it was working fine but I've noticed that moving left/right actually moves the character with a curve instead of straight left/right. This behavior can be observed in the following video: https://imgur.com/sLGIia8
As you can see when trying to make the character move left/right the character doesn't stay on the grid but instead curves a bit to the left/right.
I'm inclined to believe that this occurs because of cinemachine camera but I am unsure what exactly is going on and how to fix this. I feel that this is a bit over my head and am thus asking for help in figuring this out.
The simplest form of movement code is as follows (the exact code that moves the character in the video)
private void FixedUpdate()
{
    Vector2 input = playerInput.MoveInput;

    bool hasInput = Mathf.Abs(input.x) > float.Epsilon || Mathf.Abs(input.y) > float.Epsilon;
    if (hasInput)
    {
        // get camera direction
        Transform cameraTransform = Camera.main.transform;
        Vector3 cameraForward = cameraTransform.forward;
        Vector3 cameraDirection = Vector3.Scale(cameraForward, Vector3.right + Vector3.forward);

        // transform camera direction vector to a quaternion
        Quaternion cameraRotation = Quaternion.LookRotation(cameraDirection);

        // transform input vector2 into x/z vector3
        Vector3 inputDirection = new Vector3(input.x, 0f, input.y);

        // create desired velocity from input and current camera rotation
        Vector3 desiredVelocity = cameraRotation * inputDirection * settings.Speed;
        Vector3 delta = desiredVelocity - body.velocity;
        delta.y = 0f;
        Vector3 acceleration = delta / Time.deltaTime;

        if (acceleration.sqrMagnitude > settings.SqrMaxAcceleration)
        {
            acceleration = acceleration.normalized * settings.MaxAcceleration;
        }

        body.AddForce(acceleration, ForceMode.Acceleration);
    }
}

sentences:
A* in 2D game. corner pathfinding issue the issue I'm having will be best described with pictures more so than with code, so lets have a look if you will.

So all the mobs followed the player and started attacking him, but as soon as 4 spots to the E, S, W, N were taken, mobs 1 and 2 are no longer able to find the path.

When mob from E/S/W/N spot dies they can of course find a way to the player.

My question therefore is what is the way to implement this so that mobs can get to the player when only corners are free?

Diagonal movement is not allowed and  i'm using Euclidean distance.
I've read this How do I avoid pathfinding characters getting stuck in corners? and other questions, but they dont quite cover what I need here. I'm sorry if this isnt specific enough, happy to clarify.

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:
Get range of hexagon based on specified center I have this method to get the cells inside a given N range:

public function getRadius($range, $center) {
    // $center[0] = X or Q
    // $center[1] = Y or R
    $cell = array();
    for ($dx = -$range; $dx <= $range; $dx++)
    {
        for ($dy = max(-$range, -$dx - $range); $dy <= min($range, -$dx + $range); $dy++)
        {

            $ddy = $dy + $center[0];
            $ddx = $dx + $center[1];

            $cell[] = array($ddx,$ddy);
        }
    }
    return $cell;
}

But it returns bad coordinates by adding the offset on the delta X and delta Y.

sentences: Separate data tables for different item types? I have two types of items in my game, consumables, and equipment. For my database, should I store them in two different tables, or all in one big items table?

sentences:
Roatating a Game Object downward In my game I have a rocket which is traveling horizontally across the screen.

What I am trying to do is when the player runs out of fuel, the rockets engine stops (already coded) and then the rocket will slowly rotate to point at an almost 45 degree angle and fall down off the screen as gravity takes its affect.

How do I do this?

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:
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:
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:
How can I create the correct player object based on a type in a network message? I am using lidgren as a networking library for a small XNA game. I am using a client/server architecture for the game. Currently, I have the client and server connecting but I would like to be able to pass an enum with a character type when the client requests to join the server. Here is a sample of my code:

while ((inMsg = networkManager.ReadMessage()) != null)
        {

            switch (inMsg.MessageType){
                case NetIncomingMessageType.StatusChanged:
                    switch ((NetConnectionStatus)inMsg.ReadByte()){
                        case NetConnectionStatus.Connected:
                            if (!this.isHosting)
                            {
                              //Extract player info from message and create a local player
                            }break;
                        case NetConnectionStatus.RespondedAwaitingApproval:
                            pType = (PlayerType)inMsg.ReadByte();
                            playerManager.AddPlayer(pType);
                            //Then I will send the player information to the client
                            inMsg.SenderConnection.Approve();
                            break;
                    }
                    break;

            }

            this.networkManager.Recycle(inMsg);
        }

When server gets a message with RespondedAwaitingApproval flag, I would like to be able to read the message, extract the type and create an instance of a player of that type. How can I accomplish that?

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:
Blender rigid body physics animation into Unity? I'm stuck trying to get these cube objects to explode into chunks when destroyed in Unity. I've set up a physics sim in Blender of the effect I want, originally planning to replace the unbroken GameObjects with this fragmented one coupled with the explosion animation upon destruction. I guess it's not that simple.

I've tried "Bake to Keyframes" in blender and exporting as an FBX, but Unity imports each individual fragment with its own Animator/Avatar and a crazy amount of animations, which is almost useless. Any better ways to go about this?

sentences:
Disposing only certain resources in XNA? The ContentManager in XNA 4.0 only has one Unload() method that Unloads all Assets.

I want to have some "global" Assets that are always loaded, but then I want per-Level Assets which should be Unloaded when the level is changed.

Should I create a second Instance of the ContentManager as part of the Level.cs Class? Or should I use Game.Content and then call .Dispose on the Assets I load? Or should I create my own ContentManager on top of the ReadAsset function as outlined here?

sentences:
Huge procedurally generated 'wilderness' worlds I'm sure you all know of games like Dwarf Fortress -  massive, procedural generated wilderness and land. Something like this, taken from this very useful article.

However, I was wondering how I could apply this to a much larger scale; the scale of Minecraft comes to mind (isn't that something like 8x the size of the Earth's surface?). Pseudo-infinite, I think the best term would be.

The article talks about fractal perlin noise. I am no way an expert on it, but I get the general idea (it's some kind of randomly generated noise which is semi-coherent, so not just random pixel values).

I could just define regions X by X in size, add some region loading type stuff, and have one bit of noise generating a region. But this would result in just huge amounts of islands.

On the other extreme, I don't think I can really generate a supermassive sheet of perlin noise. And it would just be one big island, I think.

I am pretty sure Perlin noise, or some noise, would be the answer in some way. I mean, the map is really nice looking. And you could replace the ascii with tiles, and get something very nice looking.

sentences:
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:
XNA boundingbox 2d rectangle I'm checking to see if the ray that I've created is intersecting with a rectangle. I'm using the boundingbox class to pass the rectangle into the intersect method in the Ray class, but unfortunately it isn't working I'm wondering if it has something to do with how I constructed either the boundingbox or the Ray.

The code is below, any help with this would be great.

  Ray bulletRay = new Ray(new Vector3(lensPosition, 0.0f), (new Vector3(lensPosition, 0.0f) - new Vector3(level.Player.Position.X, level.Player.Position.Y - 32.0f, 0.0f)));

Rectangle tileBounds = Level.GetBounds(x, y);
                        BoundingBox box = new BoundingBox(
                        new Vector3(tileBounds.Left, tileBounds.Top, 0), // Front = 0
                        new Vector3(tileBounds.Right, tileBounds.Bottom, 0)); // Back = 0

                        float? output;

                        bulletRay.Intersects(ref box,out output);
                        if (output.HasValue)
                        {
                          wallInWay = true;
                        }

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:
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:
My GameObject keeps spawning when it shouldn't I'm trying to instantiate a new gameObject when the current gameObject gets to a select point. The problem comes when the program gets to the second if() statement. It sets the floorsSpawned to 1 and when it does, the game object instantiates a bunch of times. Shouldn't the floorSpawned be set to 2 in the first if() statement and only instantiated once?

public class FloorMovement : MonoBehaviour
{

    public GameObject floor;
    [SerializeField] int speed = 10;
    public int floorsSpawned = 1;
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        transform.Translate(Vector2.left * Time.deltaTime * speed);

        if (transform.position.x <= -18.0 && floorsSpawned == 1)
        {
            floorsSpawned = 2;
            Instantiate(floor, new Vector2(11.5f, -2.0f), Quaternion.identity);
        }

        if (transform.position.x <= -40.25 && floorsSpawned == 2)
        {
            floorsSpawned = 1;
            Destroy(floor, 3);
        }
    }
}

sentences:
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:
Tile collision detection Right. So I was making this simple game. The player is two tiles wide, and four tiles high. My current code is really buggy (it was better before my rewrite)

Here it is:

    float newx = position.x + velocity.x;
    float newy = position.y + velocity.y;

    int tx = (int) newx;
    int ty = (int) newy;

    Tile tile = WorldHandler.currentWorld.getTile(tx, ty);
    Tile ground = WorldHandler.currentWorld.getTile((int) position.x, (int) position.y-1);

    if (tile.type == 0) {
        position.x = newx;
        position.y = newy;
    }
    if (ground.type != 0) {
        grounded = true;
        //position.y = Math.round(position.y);
    }

    if (grounded) {
        velocity.x = 0.0f;
        velocity.y = 0.0f;
        //position.y = Math.round(position.y);
    } else {
        velocity.x = velocity.x * (1.0f - Math.min(0.1f, 1.0f));
        velocity.y += 0.0f;
    }

it basically uses the indices for performance.

But I need a decent collision detection system that wouldn't be painful to implement, would AARBs be of use here? Also, the game loop is a tick based one, it runs at 30 ticks/s.

sentences:
Sphere turns to ellipsoid further away from origin (OpenGL ES 2, Android) I'm not even sure what code to share, but maybe someone's been in a similar situation or has a good suggestion.

I'm basically rendering a sphere in the middle of the screen (placed at (0, 0, 0)) and it looks fine. However, if I choose to render the same sphere further away from the origin, it gets an egg shape. I think the egg shape is in the direction of the translation. Here's the code that sets up the model matrix:

Matrix.setIdentityM(mModelMatrix, 0);
Matrix.scaleM(mModelMatrix, 0, 0.15f, 0.15f, 0.15f);
Matrix.translateM(mModelMatrix, 0, 0, 0, distance);

When distance = 0, the sphere shows up normally, however if distance = -1.5f, then the sphere is sort of stretched on the z axis. Any suggestions for fixing this behavior?

sentences:
Should we avoid a padding of transparent pixels around an image when creating Assets to be used in 3D Space? Assuming we are creating Assets to be used on iOS in order to create textures that are then mapped to the surface of Quads in 3D Space, is below recommendation and its reasoning appropriate?

  Try to avoid unnecessary* transparent pixels whilst ensuring a Power of
  2 texture size.

  Since the texture will occupy the same amount of RAM
  whether it has its content spread across its entire surface or not,
  try to use as much of the available surface for the content as
  possible. This will improve visual quality when downsizing the texture
  (e.g. to generate Mipmaps).

  Example (for illustrative purposes,
  transparency is represented by a Gray color):

  *e.g.: a padding of transparent pixels around an image could be considered unnecessary if the texture will be resized anyway.

sentences:
Multiplayer Replication Unreal Engine 4 I have variable=count(integer) in a Character Blueprint.
I want to increment the variable when user presses the 'R' key.
What do I so in the Blueprint that variable remains the synchronized between the server & client?
For example:
In server- 'R' key pressed 3 times so count value should be 3.
In client-'R' key pressed 4 times, so then the value should be 7.

sentences:
Problem when trying to use rb.MoveRotation in Unity OK so I learned that rb.MoveRotation is different from rb.transform.Rotate(). But I am having trouble using it and hoping you can help me.

I usually use transform.translate(Vector3.forward)  (after using transform.Rotate(x,y,z)) , so that I know that will always make object move in the direction its facing. But this isnt working when I use rb.MovePosition. The object rotates when i remove the MovePosition line, but then for some reason doesn't when its there. I've tried multiple things as you'll see in the code.

I cant understand also why, if I use the bottom commented attempt in my code, and then press D in game, it will go in the direction its facing and then get
stuck. I've commented in my code to try to explain whats happening.

What is the correct way to move the position of the player now I am using MoveRotation? I want to base my movement of the direction that the object is facing and not in world coordinates.

Thanks

    void HandleKeys()
{
    if (Input.GetKey(KeyCode.A))
    {
        if (!facingLeft)
        {
            rb.MoveRotation(Quaternion.Euler(0,-90,0));
            facingLeft = true;
        }
        //rb.transform.Translate(Vector3.forward * speed * Time.deltaTime); // if I remove this line, the character does turn and face left . But when its in he doesn't and both keys make him move right (and face right)
        // also tried:
        //rb.MovePosition(transform.position += Vector3.forward * speed * Time.deltaTime); // this results in it going Vector3.forward in world coords
        //**rb.MovePosition(transform.position += rb.transform.forward * speed * Time.deltaTime); // this makes him go RIGHT>?? and the objects facing RIGHT why????
    }
    if (Input.GetKey(KeyCode.D))
    {
        if (facingLeft)
        {
            rb.MoveRotation(Quaternion.Euler(0f, 90f, 0f));
            facingLeft = false;
        }
        rb.transform.Translate(Vector3.forward * speed * Time.deltaTime); // if i leave this in, and the one marked * above, then it works but only once, so if I press A then, D he heads right but wont turn round, if I press D first he just goes right
    }
    if (Input.GetKeyDown(KeyCode.Space) && IsGrounded())
    {
        rb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
    }

}

sentences:
Using real football (soccer) names from the past? Is it legal to use really old names in a manager style game?
It there an expiration on name license rights?

sentences:
AS3 > Mouse Event not happening? Background: Trying to make a ball appear in the same location the mouse is positioned. Using Box2D Library. Working on a class file (.as)

Issue: The mouse event does not work (I click but nothing happens) . No output errors whatsoever. :(

Mouse Event:

   private function _clicked(e:MouseEvent)
            {
                sim.addCircle({x:mouseX, y:mouseY, radius:0.25, density:5});
                sim.start();

Full Code:

package  {

    import flash.display.MovieClip;
    import com.actionsnippet.qbox.*;
    import flash.events.MouseEvent;

    [SWF(width = 350, height = 600, frameRate = 60)]

    public class MouseTest extends MovieClip {

        public var sim:QuickBox2D;

        /**
         * Constructor
         */
        public function MouseTest()
        {
            sim = new QuickBox2D(this);
            sim.createStageWalls();

            addEventListener(MouseEvent.CLICK, _clicked);
        }

        /**
         * ..
         * @param e MouseEvent.CLICK
         */
        private function _clicked(e:MouseEvent)
        {
            sim.addCircle({x:mouseX, y:mouseY, radius:0.25, density:5});
            sim.start();

        }
    }

}

Download Project (BOX2D Included)

http://gabrielmeono.com/download/BOX2D-Mouse_Test.zip

sentences:
Stop mouse joint from dragging current rigidBody without mouse-up? I have a hero, I drag him with-mouse joint attached to his rigidBody. But I want to stop dragging him when he hits a trap.
I want the mouse-joint stop working without event "touch-end" being fired.
But I've tried to remove even the mouseJoin-Component from the hero node without luck.
Please any one with any suggestion ?
I'm using Cocos Creator with JS
Thanks!

sentences:
Entity Component System - Physics Animation Matrix Calculation? The problem is how many times the matrices representing the bones (for animation and rendering) of an entity get calculated.

If i have these components:

Position
Skeleton (holds matrices for bones)
Physics
Animation

When the physics get's updated, the position is changed to move the entity. This sends a message, that position has changed. The skeleton takes note and updates the matrices for the changed position (and potentially rotation). The animations are then updated in a separate system, the skeleton then gets updated and changed again. So essentially the matrices are being updated twice (unnecessarily) instead of just once.

Am i going about this the wrong way? Is this just the price of having everything disjoint?

sentences: Can I publish a non-commercial game that uses assets from a 30 years old Konami game on Steam, Google Play and App Store? Do major platforms like Google Play, App Store, and Steam allow apps to use assets without owner permission in case of 100% non-commercial releases? Do companies like Konami care?

sentences:
How to stop car from slipping backwards on a slope? I am trying to simulate a car in Unity, the slope of the road is high so the car slips backwards. Is there any physics property which can stop this from happening?
Thanks in advance.

sentences:
How to calculate a normalized direction of two rotations? In Vector math and translations we can do:

dir = (v1 - v2).norm

and then v1.translate(dir * 50) so v1 moves to the v2's direction.

What about rotation and eulerAngles?

Here's my attempt, but it doesn't work, probably from some obvious reasons.

Vector3 initial = ob1.transform.rotation.eulerAngles; // get it's initial rotation
ob1.Rotate(new Vector3(0,0,90)); // rotate
Vector3 after = ob1.transform.rotation.eulerAngles; // store new rotation
ob1.Rotate(new Vector3(0,0,-90)); // rotate back to initial

// here I need to calculate the direction so I can do rotate(dir * 50); or something similar

I need to get the rotation direction, so I can rotate the object continously with direction, not with a fixed desired angle value.

To be super clear, I need to get this blue line direction:

The object is initially rotated by (0,0,57).
I need to rotate it around it's center (green axis).

I know I can do logo1.transform.RotateAround(logo1.transform.position, logo1.transform.up, 80); and it works, but I need the direction from this, so I can use it in Tweening.

sentences:
How to perform alpha blending on saved raw argb videos(a image and a video will also work) using direct3d9 , direct3d10 or direct3d11? I'm trying to perform alpha blending on videos using direct3d11. I've wrote the code snippet below to achieve this. I've tried to read the video file out2.argb frame by frame and store it in the rawData. Later, I passed that rawData to CreateTexture2D but pTexture remained null after the execution of the API. So I tried passing NULL to the CreateTexture2D and passing rawData to the UpdateSubresource but again the pTexture remained NULL.

HRESULT result;
    FILE * fp = NULL;
    int size = 1280 * 720 * 4 ;
    void * rawData = NULL;
    D3D11_TEXTURE2D_DESC desc;
    desc.Width = 1280;
    desc.Height = 720;
    desc.MipLevels = 0;
    desc.ArraySize = 1;
    desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
    desc.SampleDesc.Count = 1;
    desc.Usage = D3D11_USAGE_DYNAMIC;
    desc.BindFlags = D3D11_BIND_SHADER_RESOURCE| D3D11_BIND_RENDER_TARGET;
    desc.CPUAccessFlags = 0;
    desc.MiscFlags = D3D11_RESOURCE_MISC_GENERATE_MIPS;

    D3D11_SHADER_RESOURCE_VIEW_DESC shader;
    shader.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
    shader.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
    shader.Texture2D.MipLevels = -1 ;
    shader.Texture2D.MostDetailedMip = 0;

    fp = fopen("../Engine/Data/out2.argb", "rb");
    rawData = malloc(size);

    D3D11_SUBRESOURCE_DATA data;
    data.SysMemPitch = 1280 * 4;
    data.SysMemSlicePitch = 1280 * 720 * 4;

    if (NULL == rawData)
        return -1;
    int row_pitch = (1280 * 4) * sizeof(unsigned char);
    if (fp)
    {
        /*while (!feof(fp))
        {*/
            fread(rawData, size,1, fp);
            //D3D11_SUBRESOURCE_DATA *sSubData = new D3D11_SUBRESOURCE_DATA[1];
            //for (int i = 0; i < 1; i++) {
            //  sSubData[i].pSysMem = rawData;
            //  sSubData[i].SysMemPitch = (UINT)(1280 * 4);
            //  sSubData[i].SysMemSlicePitch = /*(UINT)(1280 * 720 * 4)*/0;
            //}

            //data.pSysMem = rawData;
            // GOT FRAME
            device->CreateTexture2D(&desc, NULL, &pTexture);
            deviceContext->UpdateSubresource(pTexture, 0, NULL, rawData, row_pitch , 0);
            result = device->CreateShaderResourceView(pTexture, &shader, &m_texture);
            if (FAILED(result))
            {
                return false;
            }

    /*  }*/

        fclose(fp);
        fp = NULL;
        free(rawData);
        return true;
```

sentences:
How to design AI Manager I am currently building a AI system for a game. I am familiar with State design pattern and implemented different states for each agent in my game.

Different states are like Running, Attack, Idle, Cover, Support etc.

In this game, I have around 10 agents which have mainly two behaviours - Defender and Attacker.

I made a class AIManager which have reference of all agents in the game. This class decides which agent will do what but I am facing issues in managing this class. There are many rules in the game like -

There will be two teams.
Each team will have 2 defender and 3 attackers.
Attacker will attack attackers and defenders.
Defender only attack to defenders.
At a time only two agents can attack a single agent.
If defender is in cover, it will not go to support state.
If defender is attacking, it will not go to run state.
If attacker is attacking, it can run away on specific condition.
... etc

To make these rules applicable, my AIManager class is totally mess, contains lots of if/else, need to check every possibilities, for loops. I am sure I am not doing right in implementing these game logic because when I need to change some rules or need to add another state, I need to go through all my game logic. This manager code is totally unstable.

I want to know how to tackle this situation, Is there any design pattern which I should follow or any suggestion would be of great help.

sentences:
How to scale smaller values more Hello it seems like it should be easy and i am missing something but i really couldn't find a solution as i am fairly new to programming.
So basically i want to rotate a object faster when its closer to another object. My code is below and i want the rotationSpeed to be a higher value when its closer.

rotationSpeed = Mathf.Sqrt(
        Mathf.Pow(sphere.center.X - playerSphere.center.X, 2)
        + Mathf.Pow(sphere.center.Y - playerSphere.center.Y, 2)
        + Mathf.Pow(sphere.center.Z - playerSphere.center.Z, 2));

eg: 10 * x = 50,
    5  * x = 100

sentences:
Sprite batching in OpenGL I've got a JAVA based game with an OpenGL rendering front that is drawing a large amount of sprites every frame (during testing it peaked at 700). Now this game is completely unoptimized. There is no spatial partitioning (so a sprite is drawn even if it isn't on screen) and every sprite is drawn separately like this:

graphics.glPushMatrix();
{
    graphics.glTranslated(x, y, 0.0);
    graphics.glRotated(degrees, 0, 0, 1);

    graphics.glBegin(GL2.GL_QUADS);

    graphics.glTexCoord2f (1.0f, 0.0f);
    graphics.glVertex2d(half_size , half_size); // upper right

    // same for upper left, lower left, lower right
    graphics.glEnd();
}
graphics.glPopMatrix();

Currently the game is running at +-25FPS and is CPU bound. I would like to improve performance by adding spatial partitioning (which I know how to do) and sprite batching. Not drawing sprites that aren't on screen will help a lot, however since players can zoom out it won't help enough, hence the need for batching. However sprite batching in OpenGL is a bit of mystery to me. I usually work with XNA where a few classes to do this are built in. But in OpenGL I don't know what to do.

As for further optimization, the game I'm working on as a few interesting characteristics. A lot of sprites have the same texture and all the sprites are square. Maybe these characteristics will help determine an efficient batching technique?

sentences:
Triple buffering causes input lag? Consider some time in between two vsyncs. Suppose the first display buffer is being used to display the current image, and suppose the game was really fast and computed and rendered the next image to the second display buffer and the next one after that to the third display buffer. That is the rendering to the second and third display buffer happens so fast that it occurs before the next vsync.

Suppose input from the user comes in now. What you would like is for the results of the input to show up on the next vsync or (probably more typical) the vsync after that. However, with the third display buffer already rendered the input can only effect the image after that. Meaning the input will only take effect at best 3 vsyncs later.

I wish i had an image to show the exact timings of what I mean.

sentences:
Nested transform.position in Unity The following code works  so good , but it is so long.

How can I use a for loop to write a short script for any number of prefabs?

public GameObject prefab1;
public GameObject prefab2;
public GameObject prefab3;
float timCounter = 0f;

void FixedUpdate()
{
  timCounter += Time.deltaTime;

  float[]  r = {3,2,1};
  float[]  f = {3,2,1};

  //motion on a circle

  float x = r[0] * Mathf.Cos(f[0] * timCounter);
  float y = r[0] * Mathf.Sin(f[0] * timCounter);

  float x1 = r[1] * Mathf.Cos(f[1] * timCounter);
  float y1 = r[1] * Mathf.Sin(f[1] * timCounter);

  float x2 = r[2] * Mathf.Cos(f[2] * timCounter);
  float y2 = r[2] * Mathf.Sin(f[2] * timCounter);

  float z = 0;

  //position of a any prefab_n = position of prefab_(n-1) + Vector3(x,y,z)

  prefab1.transform.position = new Vector3(x,y,z);

  prefab2.transform.position = prefab1.transform.position + new
  Vector3(x1,y1,z);

  prefab3.transform.position = prefab2.transform.position + new
  Vector3(x2,y2,z);
 }

sentences:
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:
How to test a network game on a mobile device I am looking to test a network game with say, 10 or more users, on a mobile device. Think of it like an MMO with a lot less users. (Assuming I can get 10 running, I'd test for more users later)

The test is for two reasons :

To see if and how the server will handle that many users
To see the performance on the client side (seeing how it has to update/render all these objects on a mobile device)

How would I go about testing 10 or more users? Unfortunately I do not have 10 devices to test on, only one. I've seen a few MMOs available on Android/iPhone. How do these developers go about test their game on devices?

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:
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:
Beyond "Novice" Game Projects I was reading this answer on the type of math a game developer should know and this part really stood out at me:

How do I move my game object? The novice might say:

"I know! I'll just do:" object.position.x++.

That is how I would think to do it so I guess that shows my skill level. At least for the types of 2D side-scrolling, arcade-style games that I've made in the past, that's all I needed.  That and a bit of trigonometry.

In fact, I haven't used much linear algebra or even heard of quaternions before reading that post.  Is it because these math don't show up until you work with 3D or is it because my 2D games are fairly simple that I got away with naive implementations.

Follow up question: If I want to get familiar with that type of math, what type of projects should I undertake? IE: write a game engine, work on a 3D game, etc.

sentences:
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:
Valve Source Engine / UDK and CUDA Do any games use the GPU for more game tasks than just rendering, as a way to reduce the game's load on the CPU?  I'm most interested in games which use either Valve's Source engine or the UDK.

Is it possible/effective to even do such a thing?

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:
2d vector flips during rotation I have a 2d game (C++ and SDL) and I want the player object rotate to follow the mouse. The player object and the mouse location are both stored in 2d vectors.

In order to have the player's rotation look nice, I applied this lerp code between the "current" and "future" angle.

This is the function i'm using below, it should be straightforward:

void Vector2D_LerpAngle(const Vector2D& future, const float& dt, Vector2D& current)
{
    float a = 0.0f, b = 0.0f, c=0.0f;

    Vector2D_GetAngleDegrees(future, a);
    Vector2D_GetAngleDegrees(current, b);

    c = (a*t + b * (1.0 - t) - b);

    Vector2D_RotateByDegrees(c, current);
}

This actually works great - until the player rotates past 0 degrees. Then, it suddenly rotates in the opposite direction for almost an entire circle.

The only way I've been able to find to fix this is adding logic to catch the special case of being within 0-360 degrees, but to do that properly I'm going to have to take the velocity of the mouse into account, and that's just going to be a pain. I feel like I'm probably missing something obvious here or else I'm doomed to failure with this particular method.

edit:

It turns out lerping the vectors themselves rather than the angle works. I should have just trusted the math.

void Vector2D_Lerp(const Vector2D& future, const float& t, Vector2D& current)
{
    current = future*t + current*(1.0f - t);
}

sentences:
Implementing beat detection algorithm on mobile So, I've been looking for a way to detect beats on a streamed song on mobile(like listening on Spotify or Youtube etc.) I've found the most used methods are either using already known songs or using spectral flux analysis, which would require knowing all the song in advance.

Since both my audio and my programming knowledge are limited I'm struggling both in implementing this algorithm (I've tried Allan Pichardo's  Beat detection algorithm ) and in thinking of another way of detecting onsets in an unknown song.

My goal is to be able to detect if the player moves "in sync" with the beats of a song, with a given margin of error such as in Crypt of the NecroDancer .

I've also given thought to a machine learning approach, where a trained model could tell if a given piece of a song is or not an onset, but don't know if it can be implemented on mobile, and if there is a dataset available to train on.

The final question would be, is the spectral flux analysis still the way to do this or would there be easier, more efficient methods?

sentences:
DontDestroyOnLoad() doesn't work in Unity I have a problem with DontDestroyOnLoad() in Unity. It does not work!

My code:

private static PlayerSpawningScript instance;

public void Awake()
{
    Debug.Log ("PlayerSpawningScript awake");
    Debug.Log ("Instance: " + instance);
    if (instance == null) {
        Debug.Log ("Initializing PlayerSpawningScript instance");
        instance = this;
        DontDestroyOnLoad (gameObject);
    }
    if (instance != this) {
        Debug.Log ("PlayerSpawningScript instance exists. Destroying new copy.");
        Destroy (gameObject);
    }
    Debug.Log ("PlayerSpawningScript instance: " + instance);
}

public void OnDestroy()
{
    Debug.Log ("Destroying PlayerSpawningSceript instance: " + instance.ToString ());
}

Basing on the console output, I successfully create an instance in scene1, but when I change the scene, it gets destroyed - I know this because I get "Destroying PlayerSpawningScript (...)" before the new scene is loaded, and the same script set up in scene2 does not find an existing instance (which held data saved in scene1) and sets up itself as the instance instead of getting Destroyed. What am I doing wrong?

sentences:
Capitalizing on JavaScript's prototypal inheritance JavaScript has a class-free object system in which objects inherit properties directly from other objects.  This is really powerful, but it is unfamiliar to classically trained programmers. If you attempt to apply classical design patterns directly to JavaScript, you will be frustrated. But if you learn to work with JavaScript's prototypal nature, your efforts will be rewarded.
...
It is Lisp in C's clothing.
-Douglas Crockford

What does this mean for a game developer working with canvas and HTML5?  I've been looking over this question on useful design patterns in gaming, but prototypal inheritance is very different than classical inheritance, and there are surely differences in the best way to apply some of these common patterns.
For example, classical inheritance allows us to create a moveableEntity class, and extend that with any classes that move in our game world (player, monster, bullet, etc.). Sure, you can strongarm JavaScript to work that way, but in doing so, you are kind of fighting against its nature.  Is there a better approach to this sort of problem when we have prototypal inheritance at our fingertips?

sentences:
Reward volatility of League of Legends matchmaking system According to this article in league of legends matchmaking there's an average of 50/50 chances of winning or loosing a game based on how system ranks a specific account (player skill). However this implies that a player is expected to loose at least half of his games (provided that he's not a student of the game) or at most he'll win 75% of the games (that's ranked top rated guys and the highest win rate I've seen in my region, so should be a feasible boundary).

However, the latter is rather rare since not so many people actually achieve that skill level (that can also be observed by going through ranked statistics) and the former is also not a constant since a) it's also in the algorithm and a queue of 1 min is most likely not a 50/50 and b) there are situations where it is extremely obvious that a player was placed against a way stronger team or vice verse.

An example from my practice is that I had a win rate of 88% which severely dropped after about one ore two weeks (to around 71%) and it rose again in a week or so with me learning nothing (I literally didn't). So, during such drops a player reward expectation is not met which results in negative attitude (taken to extreme in some cases, as was also observed). Some people were literally saying: "I hate the game" and they kept playing.

So the question is: why? why is it that with such reward volatility people still keep playing? (please, give a rigorous proof, if any, supplied with references presumably from behavioral psychology)

P.S.: I do not have any empirical data, so I realize this might be only a feeling as well as the fact that mostly I observed it through my account (not even lvl 30) and in my region. I also understand that most likely they are using statistical learning algorithms which obviously require data and will put a player to his actual rating as number of games grows (theory of big numbers).

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:
LibGDX - button change image on hover over time As we all know, LibGDX has a TextButtonclass which has a TextButtonStyle and ButtonStyle. The style has some parameters:

up - an image which is shown normally as a button background
down - shown when the button is being 'pressed'
over - on hover

My question is:
Is there any way to implement the 'hovering' / changing the background image IN TIME? So for example it takes 2 seconds and it's smooth?

I tried with actions and tween engine, but honestly, I really have no idea how I should implement this. Maybe some alpha operations?

If you have any ideas, I would be grateful :)

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: Direct3D and OpenGL Matrix representation As I read in OpenGL matrices are column major. It means that if I create a 16 element array first four elements are the first column in matrix. Is it the same for Direct3D or any transformation's required.

sentences:
Unity 3D C# - Shifting beetween worlds? Let's say I want to replicate Planeshifting from Legacy of Kain: Soul Reaver in Unity.

There are 2 realms: Spectral realm and Material realm.

The Spectral realm is based on the Material realm, only has the geometry distorted and certain objects fade out/become non-interactive.

In Soul Reaver, it is used as means to go to areas where you normally wouldn't be able to in Material (distorting geometry), to use other powers (such as going through grates).

My question is: Is it even possible at all to implement this in Unity 3D? (I would need the Scene(level) or the objects to have 2 states somehow that I could switch beetween/distort to real-time.)

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:
Hill-jumping game mechanic like Tiny Wings I'm a huge Tiny Wings fan and I'd like to understand the game mechanic at a deeper level. What are some good resources for the basic Box2d (or similar) physics behind the hill-jumping game mechanic?

I've used some basic features of Box2d. I imagine the flying character is just a circle, tapping the screen increases the downward force on the character, and the hills are some sort of curve object from the physics engine.

Edit #1 Here's more info: I'd like to understand which objects from the Box2d physics library are used to create the bare-bones hill-jumping mechanic. This mechanic would look like a "curvy" horizontal line that just scrolls across the screen. The most basic shape for this line that comes to mind is a sine wave so that's probably a good starting point.

Then there's the character that moves around. Note the character's horizontal position is fixed while the vertical position moves up and down. I'm curious about which Box2d body shape, type etc is used for this character. What are some values for the coefficient of friction that work well? How about the density etc.

I've searched around the web for tutorials that ideally will answer the above questions and perhaps provide additional resources regarding efficiency, camera motion and so on.

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:
Unity Placing a UI on top of Cinemachine I have cinemachine set up. I just need to place the UI on top of it. I can easily manage to make the canvas appear when there's only the main camera alone. However with Cinemachine, it appears that the virtual camera prevents the loading screen to be seen. The canvas in my hierarchy is named loadingPanel which is disabled until I trigger an event. Everything in the hierarchy has their layers set to Default, except canvas (UI) and the player (Player)
I can trigger the event and set loadingPanel to active as well as load the next level but I can't see the loading screen. I could only see my tilemap/level before I switch to the next scene. I need to see my canvas / user interface.
This is my hierarchy

Inspector

How do I see the loadingPanel when cinemachine is present?

sentences:
How to do Chromatic Aberration on a transparent background? I have a problem with a chromatic aberration shader effect...

If I produce the effect on a white background I get exactly what I want:

But if I do the same effect on a transparent background I get this:

In my code I use the following shader to produce the chromatic aberration effect:

// Chromatic Aberration

float DisplacementX = 5;
float DisplacementY = 5;

sampler TextureSampler : register(s0);

float4 main(float4 position : SV_POSITION, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
{

// Offset the main texture coordinates.
float2 texCoord2 = float2(texCoord.x + DisplacementX, texCoord.y + DisplacementY);

float2 texCoord3 = float2(texCoord.x - DisplacementX, texCoord.y - DisplacementY);

float4 color1 = tex2D(TextureSampler, texCoord);
float4 color2 = tex2D(TextureSampler, texCoord2);
float4 color3 = tex2D(TextureSampler, texCoord3);

float alpha = color1.a + color2.a + color3.a;

// Look up into the main texture.
return float4 (color1.r, color2.g, color3.b, alpha);

}

technique RGBSplit
{

pass Pass0
{

PixelShader = compile ps_2_0 main();

}
}

This works great when I set the whole screen to a render target and apply the effect but I want to be able to apply this effect only to the foreground so I can choose which sprites it effects and then draw the background behind the transparent space.

My thinking so far is that I could create a white layer of the foreground image and blend it with the chromatic layer to produce the correct effect like this:

return float4(1, 1, 1, alpha); // Produces white version of layer

But I've unsuccessfully managed to blend it and I always end up with the same result as the second image.

I know this is possible because Teleglitch uses the same effect on bullets etc without effecting the background.

Perhaps someone with better blending knowledge than myself can help point me in the right direction?

sentences:
Why aren't there game and physics engines with double precision? Choice of game design and other human psychological factors aside

is the present hardware not capable of working with double precision floating point calculations with reasonable performance? It can ease all the complicated tricks involved to get large worlds working seamlessly in current single precision float setup.

Correct me if I'm wrong but shouldn't modern x64 processors more suited to this kind of task?

For the problem with gpu performance it should still be easier to work in double precision and translate co-ordinates to float on camera space

sentences:
Making an indie with friends: Legal considerations I am close to finishing a game I am making with 3 friends. 1 other coder, and 2 graphic designers. We agreed from the start to split revenue (40/40/10/10).

However we have no contract, and I know that I don't own the graphics/sounds in my game just because "my friend made it". What steps should we take to make sure that all graphics/sounds that were provided by my friends, are actually owned by me (the company).

We have a budget of $0 so hiring a lawyer is not an option, should we draft our own contract regarding the revenue share?

sentences:
Detect when any part of a collider leaves a trigger zone on Unity 3D I've searched all over for a simple solution on this, and found posts as old as 2011, with a bunch of hackish ways to badly work this out.

I want to detect when ANY part of a collider leaves a trigger area.

Some solutions I found and why they won't work on my case:

Using onTriggerExit will only trigger when the collider is COMPLETELY out of the trigger area, making it not ideal for boundaries of maps.

Calculating using bounds may work, but a bit complex when using a polygon collider with convex shapes.

I'm new to Unity and I'd guess this would be a pretty simple, default behaviour for many games.. Really surprised me that I found zero good answers for this on the web (both in stack exchange and Unity forums). Any help would be appreciated.

sentences:
How do I generate a smooth random horizontal 2D tunnel? I'd like to create a smoother version of the navigable and quite natural-looking random tunnel found in this classic helicopter game.

It should ideally be...

infinite, so more can be generated as the player progresses;
parametrised, allowing control of its thickness over time;
made of smooth curves, not rectangles as in the above game;
precomputable, as knowing its bounds in advance allows collision detection for e.g. positioning powerups inside the tunnel.

I'm looking for a generic method I could implement myself.
Further parameters and optimizations are welcome.

Asking here was suggested on StackOverflow. I think this fits in both places, as it's as much about the algorithm as about gamedev.

sentences:
Difference between putting shaders in "Always Included Shaders" vs "Preloaded Assets" I am developing an mobile AR application with Unity AR Foundation. After a successful android build, I was told one of the shaders was not found.

ShaderNotFoundException: GLTF/PbrMetallicRoughness not found. Did you forget to add it to the build?

I realized I forgot to include one of the shaders that is only loaded at runtime.
I searched the internet and was taught to include the shader under Project Settings -> Graphics -> Always Included Shaders. That totally made sense but I was faced with the same problem everybody faced, the building takes ages as it compiles all my shader variants.
I stopped the build and opted for a method that was not mentioned by the internet, I went to Project Settings -> Player -> Optimization and included the shader under Preloaded Assets. The build was much faster and the shader was loaded correctly in my application.
At this point, my build error is solved but I can't help wondering if it is correct to do so. I am not seeing anyone mentioning about this method and there is not official documentation recommending including shaders under Preloaded Assets.
Could anybody help me out by explaining (hopefully) what these 2 methods actually do to my build, and what is considered the best practice to include the shaders?
I am using Unity 2020.3

sentences:
Elegant way to simulate large amounts of entities within a game world Assume you have a game in which there are many (many many) entities serving some functions, not all of which are constantly needed or need to be considered in every frame. The concrete problem I am working on in which this issue is present is a detailed simulation of a body including its organs.

In the game each creature has its own body which is separated into smaller parts (torso, legs etc.) and sometimes these parts contain organs, which serve a specific function within the body. Whether or not an organ currently serves a purpose or is active is never actually clear. After all, an animal might have an empty stomach which therefore does not need to digest anything. It would be quite ridiculous to check or simulate every object in each frame and very costly as soon as you have many creatures in the world. So I was thinking about a way to smartly differentiate between objects that need to be updated and those that don't.

What I came up with seems like an at least ok solution. It creates a simple queue/stack (essential is that each element gets removed as soon as it's read; the order is irrelevant) called the "attention stack" where objects that need to be simulated reside. Objects that need attention would simply put themselves onto the stack or are put there by other objects. These objects would probably implement a simple interface with a simulate()-function.

Applied to my previous digestion example this would mean:

The player chooses something to eat (assume it's bread) from the inventory and puts it into the mouth of his character and the mouth is put onto the attention stack. In the next frame the the mouth is taken from the stack and its simulate()-function is called. Since it's a mouth it would be reasonable to simulate chewing here. This could go on for a few frames in which the mouth keeps putting itself onto the stack until it decides the food is ready to be swallowed. In this case the mouth puts the chewed bread into the stomach (I know it doesn't go there directly, but the esophagus is left out for simplification), which is then also put onto the attention-stack. In the next frame the simulation of the digestion-process is started. And so on for the rest of the necessary organs.

A foreseeable problem with this are idling objects. A sleeping animal is a good example of this. It could be done as previously described by keeping the sleeping animal on the stack and checking each time if it needs to wake up, but that seems wasteful since that's the only thing being done. To make idling objects more efficient I was planning to add a sort of schedule which stores jobs to be performed at a specific time. If an animal goes to sleep it would put a job on that schedule which would be scheduled for a certain amount of time after the animal went to sleep. This job would then take care of putting the sleeping animal onto the attention stack again. Now, you could say that a sleeping animal that isn't on the attention stack could miss being attacked by something because its A.I. is not simulated, but this is prevented if the attacking object takes care of putting that animal onto the stack again.

Now, I honestly don't know if this is even close to an elegant solution to this problem due to a lack of experience. Am I close to something usable? How is this usually done or does anybody have any suggestions or better solutions?

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:
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:
Gamemaker display orientation detection I am making a game that needs to detect when the device gets turned over in landscape mode to landscape-flipped to change some game mechanics when the player does so. The project is already set to work only in those two orientations.

I am using an object instantiated in the room with the following code in Step :

show_debug_message("Orientation : " + string(display_get_orientation()));

But I always get the same input - either "landscape" or "landscape-flipped" and it doesn't seems to change the output in runtime, although if I press the power button on the phone and the game goes in pause, if I flip the phone and I return to the game I get the opposite status, but it keeps repeating itself, as it could not read the real orientation of the phone.

Anyone has faced this problem before?

Cheers!

sentences:
Player collision with object I have an FPS controller and I want to change the camera when it collides with a box collider. I think I did it properly but it didn't work. Here's my code:

using UnityEngine;
using System.Collections;

public class change_camera : MonoBehaviour
{
  public Camera Playercamera;
  public Camera Topcamera;

  void OnCollisionEnter(Collision col)
  {
      if (col.gameObject.name == "FPSController")
      {
          Playercamera.enabled = false;
          Topcamera.enabled = true;
      }
  }
}

Thanks in advance.

sentences:
Cylinder scrolling / wrap-around world using shaders? I am making a 2D game using OpenGL ES 2.0 (libgdx), where the world will wrap-around itself on Y-axis.

Apart from implementing the "modulo" method in my rendering code, I'm wondering whether it's possible to render such a world using only shaders?

How would I go about handling the edge case in GLSL?

EDIT: Basically, I want to move this part of the code to the GPU, if possible.

sentences:
What is a reasonable bandwidth usage for a RT multiplayer game? My game uses UDP communication only.
Meaning: after the lobby connect (performed by Google Play Services), not a single TCP transmission is made. Only unreliable messages are used.

The game is currently one versus one, and the players transmit a little over 16Kbit/sec in datagrams in a steady stream. (2 kbyte/sec.)
It also receives the same steady 16kbit/sec from the other party of course.
These numbers do not include packet headers.

The player experience is pretty good, even with players between continents.

What I would like to know: is 16Kbit/sec considered normal, high or low?

I intend to add a 2vs2 mode, which would triple both the send and receive network volume. Could I get away with that? Where can I find references to typical bandwidth use in real time games?

sentences:
What does "{ get; set;}" in Unity mean? I am coming back again into hobby game development after about 6 months away. I'm just trying to learn some kind of basic things again. I'm at the very start of making a very simple boxing management simulator. Later, I will be trying to re-learn using databases and might ask for more help.

But for now, I'm making a Boxer class which will hold all the data on each boxer (eg. Name, height, number of wins, punch power etc etc). I've used private variables for those and then have made my own methods for each variable called Getxyz().

I have seen people doing things like 'public int xyz { Get(); }' but i dont understand how that would work.

Is the way I'm doing ok (it does seem long-winded to me) or should I investigate these Getter Setters some more? Here's what I am doing right now:

public class Boxer : MonoBehaviour {
// generic boxer details:
int id;
string nameA, nameB;
int weight;
int height;
float age;
float reach;
// career info:
int wins, loses, draws, winsByKO;
// boxing attributes/stats:
float power, speed, agility, koPunch, stamina, toughness;

public int GetId()
{
    return id;
}
public string GetNameA()
{
    return nameA;
}
public string GetNameB()
{
    return nameB;
}

}

sentences:
Pixel Buffer Object (PBO) does not work correctly I've written a very simple OpenGL application. Its goal is to load a texture and draw it on a plane using a PBO. If I use the function 'glTexSubImage2D' the plane is not textured and the function 'glGetError' returns the error '1281' (invalid value). However if I use the function 'glTexImage2D' my plane plane is textured correctly (and I have no error).

Here's the code for the texture loading :

#define OFFSET_BUFFER(offset) ((char*)NULL + offset)

void core::RootDevice::LoadTexture(char const *pFileName)
{
    SDL_Surface *pSurface = IMG_Load(pFileName);
    char *pPixels = reinterpret_cast<char*>(pSurface->pixels);
    uint32_t bytePerPixel = pSurface->format->BitsPerPixel;

    glGenTextures(1, &textureId);
    glBindTexture(GL_TEXTURE_2D, textureId);
    {
        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);

        glGenBuffers(1, &pboID);
        glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pboID);
        {
            unsigned int bufferSize = pSurface->w * pSurface->h * 3 * sizeof(unsigned char);

            glBufferData(GL_PIXEL_UNPACK_BUFFER, bufferSize, 0, GL_STATIC_DRAW);
            glBufferSubData(GL_PIXEL_UNPACK_BUFFER, 0, bufferSize, pPixels);

            glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, pSurface->w,                //NOT OK : ERROR 1281
                pSurface->h, GL_RGB, GL_UNSIGNED_BYTE, OFFSET_BUFFER(0));

            /*glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, pSurface->w,               //OK : NO ERROR
                pSurface->h, 0, GL_RGB, GL_UNSIGNED_BYTE, OFFSET_BUFFER(0));*/
        }
        glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
    }
    glBindTexture(GL_TEXTURE_2D, 0);
}

And the rendering code :

void core::RootDevice::Render(void)
{
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, textureId);
    {
        glBegin(GL_QUADS);
            glTexCoord2f(0.0f, 0.0f);
            glVertex3f(-1.0f, -1.0f, 0.0f);
            glTexCoord2f(1.0f, 0.0f);
            glVertex3f(1.0f, -1.0f, 0.0f);
            glTexCoord2f(1.0f, 1.0f);
            glVertex3f(1.0f, 1.0f, 0.0f);
            glTexCoord2f(0.0f, 1.0f);
            glVertex3f(-1.0f, 1.0f, 0.0f);
        glEnd();
    }
    glBindTexture(GL_TEXTURE_2D, 0);
}

And the result is the followings:

I'm really lost. Does anyone can help me, please ?

Thanks a lot in advance for your help.

sentences:
C++ and SDL resource management for 2D game My first question is about stateManagers. I do not use the singleton pattern (read many random posts with various reasons not to use it), I have gameStateManager which runs the pointer cCurrentGameState->render(), etc. I want to make a transitioning game, this engine should ideally cover both a platformer and a bird's eye RPG (with some recoding, I just mean the base engine), both of which will load different levels and events, such as world map, dungeon, shops, etc. So I then thought, rather then having to store all this data within all the states, I would break the engine into gameStates, and playStates... when gameState reaches gameStatePlay(), gameStatePlay simply runs the usual handleInput, logic, and render for the playStates, just as the low level gameStateManager does. This lets me store all the player data within the base playstate class without storing useless data in the gameStates. Now I have added a seperate mapEditor, which uses editorStates from gameStateEditor. Is this too much usage of the gameState concept? It seems to work pretty well for me, so I was wondering if I am too far off a common implementation of this.

My second question is on image resources. I have my sprite class with nothing but static members, mainly loadImage, applySurface, and my screen pointer. I also have a map pairing imageName enums with actual SDL_Surface pointers, and one pairing clipNumber enums with a wrapper class for a vector of clips, so that each reference in the map can have different amounts of clips with different sizes. I thought it would be better to store all these images, and screen within one static body, since 20 different goblins all use the same sprite sheet, and all need to print to the same screen, and of course, this way I do not need to pass my screen reference to every little entity. The imageMap seems to work very well, I can even add the ability to search through the map at creation of entity type to see if a particular image at creation, creating if it doesnt exist, and destroying the image if the last entity that needs it was just destroyed. The vectored clip map however, seems to take too long to initialize, so if i run past the state that initializes them to fast, the game crashes ><. Plus, the clip map call is half of this line =P

SPRITE::applySurface( cEditorMap.cTiles[x][y].iX,
    cEditorMap.cTiles[x][y].iY,
    SPRITE::mImages[ IMAGE_TILEMAP ],
    SPRITE::screen,
    SPRITE::mImageClips[IMAGE_TILEMAP]->clips.at( cEditorMap.cTiles[x][y].iTileType ) );

Again, do I have the right idea? I like the imageMap, but am I better off with each entity storing its own clips?

My last question is about collision detection. I only grasp the basics, will look at per-pixel and circular soon, but how can I determine which side the collision comes from with just the basic square collision detection, I tried breaking each entity into 4 collision zones, but that just gave me problems with walking through walls and the like ><. Also, is per-pixel color collision a good way to decide what collision just occured, or is checking multiple colors for multiple entities too taxing each cycle?

sentences:
How to rotate (YAW) aircraft in XNA? I'm developing a flight simulator based on Riemer's Blog tutorial (XNA C#). To control the aircraft, I use the following code:

Quaternion additionalRotation = Quaternion.Identity;
additionalRotation *= Quaternion.CreateFromAxisAngle(Vector3.Forward, roll);
additionalRotation *= Quaternion.CreateFromAxisAngle(Vector3.Right, pitch);
model_ROTATION *= additionalRotation;

This only executes pitch and roll. I wanted to add code so that if the aircraft is rolling, then it should rotate to right or left (yaw) so I changed the code to the following:

Quaternion additionalRotation = Quaternion.Identity;
additionalRotation *= Quaternion.CreateFromAxisAngle(Vector3.Forward,roll);
additionalRotation *= Quaternion.CreateFromAxisAngle(Vector3.Up, yaw);
additionalRotation *= Quaternion.CreateFromAxisAngle(Vector3.Right, pitch);
model_ROTATION *= additionalRotation;

This behaviour is not so realistic; when I roll the aircraft rotates to right/left (yaws), but at the same time it loses altitude and I must pitch up (pull handle) to avoid crashing.

Is there any solution to make slew rotation (yaw) without losing altitude.

sentences:
How to find and send data about on-screen players to a client in a real-time multiplayer game? I'm surprised I couldn't find much information on this.

I am making a top-down browser game in which the players see a small section around their player (see the image). Since the player doesn't need to render the players far away that they can't see, it would be unnecessary to send data about them. I want to know how the server should calculate who is near enough to the client that they appear on their screen and therefore receive data from the server about those players.

The way my problem differs from what I have found is that I need to track many players (at least 50 and preferably up to 100) and many can be on screen at one time (assume a maximum of 10 on screen at any one time).

Some assumptions/considerations that are made:

The players are always moving and positions constantly changing
Must handle at least 50 players at one time (preferably up to 100)
Players can drop in and out at random locations so should be able to adapt to this quickly
Screen sizes vary
Player input is just movement (but there should be scope for other simple actions)
Data sent over TCP as will be browser based
Node.js server

Initially I thought about sending data for all the positions of the players to each player but this seems like a terrible idea with so much unnecessary data being sent - from what I understand the server should be sending as little as possible.

My current strategy (shown in the image) is to have the server periodically (every second for example) calculate the distances between all players to determine those near enough to each other to appear on screen. For the next second, data will only be sent to the client regarding those near it. After the next second, new distances are calculated to decide what to send (and render) for each player.

Some problems to take into account:

A lot of calculations must be performed by the server for all the players
Extra information would need to be sent about players just outside the screen to account for any movement between updates
Interpolation would probably be required
Different screen sizes will mean that some players can see more than others (the fairness isn't the issue here, but tracking to what distance to let players see)

The main issue is the ability of the server to process all of this with everything else that it must already do.
I am not convinced this is a very good way.

This is trivial for off screen entities in a single player game, however for multiplayer games with many players moving at once this becomes much more difficult.

How can I figure out what players are on screen efficiently and what data should be sent regarding this?
Or please point me to where I can find information on this.

sentences:
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:
Load Texture From Image Content In Runtime Basically I wrote a world editor for a game I'm working on. Looking ahead, I was brainstorming ways to save the created world including the tile-sets (this game will rely on a tile engine).

I was hoping to save the image data of each tile-set in the same file containing the tile positions, etc. and load the image data into a Texture with XNA.

Is it possible? Something like this is what I'm going for.

Texture2D tileset = Content.LoadFromString<Texture2D>("png tileset data");

sentences:
Competing with C++ for games programming I'm curious as to why C++ is so popular for games development, and not other languages instead. I know you can create very fast code with it, but what exactly is it that makes it popular?

Is it just because it's fast?
Is it some other feature in the language, like the OO paradigm or the portability?
Is it because of all the libraries that have been created over time?
Or some combination of all these (and other) reasons?

If someone could fill me in on this, I'd be very happy. :-)

sentences:
Script not working (Function not changing value) I have this script that I made for an FPS character.
public class Player_Movement : MonoBehaviour

{
public CharacterController controller;
public Transform camera;
public float gravity = -9.81f;

public Transform groundCheck;
public float groundDistance = 0.4f;
public LayerMask groundMask;
bool grounded;

public GameObject joystick;
public bool isMoving;
public float speed = 12f;
public float turnSmoothTime = 0.1f;
float turnSmoothVelocity;

public float jumpHeight;
public Vector3 yPosition;
public bool jumpAble = true;

// Update is called once per frame
void FixedUpdate()
{
    grounded = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask);

    if (grounded)
    {
        yPosition.y = -2f;
        jumpAble = true;
    }

    Vector3 direction = new Vector3(joystick.GetComponent<Joystick>().inputDirection.x, 0f, joystick.GetComponent<Joystick>().inputDirection.y);
    isMoving = direction.magnitude != 0 ? true : false;

    if (isMoving)
    {
        controller.Move(direction * speed * Time.deltaTime);
    }

    yPosition.y += gravity * Time.deltaTime;
    UnityEngine.Debug.Log(yPosition);
    controller.Move(yPosition * Time.deltaTime);
}

public Vector3 Jump()
 {
     UnityEngine.Debug.Log(jumpAble);
     UnityEngine.Debug.Log(grounded);
     if (jumpAble && grounded)
     {
         jumpAble = false;
         yPosition.y = Mathf.Sqrt(jumpHeight * -2 * gravity);
         UnityEngine.Debug.Log(yPosition.y);
         UnityEngine.Debug.Log(yPosition);
         return yPosition;
     }

     return yPosition;
 }

}
The game operates on mobile touch controls, and the Jump() is called when the jump button is pressed. However, the character does not jump when I press the button, even though the function is being called, and the yPoisition is being changed in the function. I know that changing the yPosition should make the player jump, as when I add this code to the Update:
if (Input.GetKey(KeyCode.Space) && jumpAble)
         {
             fallDown.y = Mathf.Sqrt(jumpHeight * -2 * gravity);
         }

Everything works fine.
Why is the new yPoisition value not being passed to Update, and why is this happening?

sentences:
Need to use trig to make a ship point in the right direction I'm making a 2D spaceship-shooter game that moves in all directions, (i.e. ( -x, +x ),( -y, +y ) ).

I'm trying to make the spaceship face the direction of the movement according to a virtual joystick. The virtual joystick has it's x and y coordinates working correctly and they are normalized (ie. between -1 and +1) in both x and y.

I'm able to set the angle of the image I'm using by a call to

SetSpriteAngle(spriteNum, angle)

where the angle is in degrees. The problem I'm having is with the trigonometry involved.

I know from trig that calculating the angle is radius*cos(x), and I could be wrong on that, so I tried this:

x = GetVirtualJoystickX(1)
y = GetVirtualJoystickY(1)
r = sqrt(x*x + y*y)

angle = r * cos(x)

SetSpriteAngle(1,angle)

Problem one is, there's no account for the Y direction, so I tried:

angle = r*cos(x) + r*sin(y)

Still a problem, just not working correctly, so I tried arcsine and arccosine:

angle = r*aCos(x) + r*aSin(y)

Now the image is just flipping in what seems like a random direction, and just in case it was calculating, instead of the total angle, perhaps it was the angle from the x intercept, so I tried:

if GetVirtualJoystickX(1) > 0 and GetVirtualJoystickY(1) > 0
    //angle = angle
elseif  GetVirtualJoystickX(1) < 0 and GetVirtualJoystickY(1) > 0
    angle = angle - 180
elseif  GetVirtualJoystickX(1) < 0 and GetVirtualJoystickY(1) > 0
    angle = angle - 270
elseif  GetVirtualJoystickX(1) > 0 and GetVirtualJoystickY(1) < 0
    angle = angle - 360
else
    angle = 0
endif

Now it's only flipping as if angle is close to 0 and moving occasionally in a certain 270 degree position  I believe,

So I guess I'm going to have to admit that my trigonometry skills aren't what they used to be and ask you guys for some help, by the way sin(x) is where x is in degrees and sinr(x) is where x is in radians, so I might be missing it there too, frankly I'm just too confused to get any farther right now.

Thanks guys!

sentences: HaxeFlixel, Font gets fuzzy android upscale I made a simple game for android with a small native resolution (320x480). When text gets upscaled it loses its sharpness. Tried having anti aliasing on and off and both results were fuzzy. The size of the text is 16 (read that with some fonts the size should be dividable by 8). Also tried different fonts, but had the same result. Any solutions to that?

sentences: Monogame [Linux] cannot resize screen While working on a Monogame project on Linux (Arch to be exact), I found that I could not change the screen height away from the default 800 px, while I could easily, perfectly change the width to whatever I want. Has anyone ever had this issue, and is there a fix for it? I am going to try the solution that @Jon explained in this post, but I doubt it will work since this seems to be a Linux-only problem. I have installed the latest version of OpenTK and built the latest build of Monogame as of a few days ago, and have looked through the source for the Monogame OpenTKGameWindow and GraphicsDevice classes, as well as the GraphicsDeviceManager. I don't see the issue in any of those, but I might be missing something.

sentences: Unity immediate mode I have some existing C++ 2D game code that draws using immediate mode (i.e., each frame is drawn bottom-up one sprite at a time by my game code -- not using a scene graph or other retained mode concepts). I'm wondering if I can port this code to Unity without having to rework the game code to operate in terms of retained mode (adding objects to a scene, removing objects, etc.). I have read that Unity has an immediate mode GUI option. But in my case I want to use this for the game sprites themselves, not just the UI elements. I realize that for a 2D game there isn't a big difference between UI elements and game sprites. But I need to be able to do things like rotation and render-to-texture, so I wasn't sure if I'd run into trouble "misusing" the immediate mode GUI mechanism to handle the whole game. Alternatively, does Unity have a more general immediate mode option? (I did search for it and didn't see anything aside from the immediate mode GUI stuff.)

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:
Monogame/SharpDX - Shader parameters missing I am currently working on a simple game that I am building in Windows 8 using MonoGame (develop3d). I am using some shader code from a tutorial (made by Charles Humphrey) and having an issue populating a 'texture' parameter as it appears to be missing.

Edit I have also tried 'Texture2D' and using it with a register(t0), still no luck

I'm not well versed writing shaders, so this might be caused by a more obvious problem.

I have debugged through MonoGame's Content processor to see how this shader is being parsed, all the non 'texture' parameters are there and look to be loading correctly.

Edit This seems to go back to D3D compiler.

Shader code below:

#include "PPVertexShader.fxh"

float2 lightScreenPosition;

float4x4 matVP;

float2 halfPixel;

float SunSize;

texture flare;

sampler2D Scene: register(s0){
    AddressU = Clamp;
    AddressV = Clamp;
};

sampler Flare = sampler_state
{
    Texture = (flare);
    AddressU = CLAMP;
    AddressV = CLAMP;
};

float4 LightSourceMaskPS(float2 texCoord : TEXCOORD0 ) : COLOR0
{
    texCoord -= halfPixel;

    // Get the scene
    float4 col = 0;

    // Find the suns position in the world and map it to the screen space.
        float2 coord;

        float size = SunSize / 1;

        float2 center = lightScreenPosition;

        coord = .5 - (texCoord - center) / size * .5;
        col += (pow(tex2D(Flare,coord),2) * 1) * 2;

    return col * tex2D(Scene,texCoord);
}

technique LightSourceMask
{
    pass p0
    {
        VertexShader = compile vs_4_0 VertexShaderFunction();
        PixelShader = compile ps_4_0 LightSourceMaskPS();
    }
}

I've removed default values as they are currently not support in MonoGame and also changed ps and vs to v4 instead of 2. Could this be causing the issue?

As I debug through 'DXConstantBufferData' constructor (from within the MonoGameContentProcessing project) I find that the 'flare' parameter does not exist. All others seem to be getting created fine.

Any help would be appreciated.

Update 1
I have discovered that SharpDX D3D compiler is what seems to be ignoring this parameter (perhaps by design?). The ConstantBufferDescription.VariableCount seems to be not counting the texture variable.

Update 2
SharpDX function 'GetConstantBuffer(int index)' returns the parameters (minus textures) which is making is impossible to set values to these variables within the shader. Any one know if this is normal for DX11 / Shader Model 4.0? Or am I missing something else?

sentences:
How were cartridge-based games programmed? I'm thinking of like the SNES, N64, Atari... even the DS today, I suppose.

SNES games did not usually take up more than 4 MB of space, and N64 games were usually 32 to 64 MB worth of data.

These days, you can barely compile a "hello world!" program without the resulting compilation generating 1.21 gigabytes!! of data. (Joking aside, files today do take up tons and tons of space compared to some of the technology back then.)

So... how did they do it?

What did they program these games in? ASM? The entire thing in ASM?!
How were graphics created? What technology did they have to create sprite sheets and, in some cases (like the N64), 3D models?
How did they fit so many levels, characters, quests and items on these cartridges? I mean, Super Mario World on the SNES clocks in around 1 MB, and it has 96 exits! Ocarina of Time, Banjo-Kazooie, DK64 and a few other games take up less than 64 MB and had huge worlds, tons of content and 3D models!

Sorry if my questions seem a little out-there, I'm just amazed that a lot of great titles out there managed to fit in such a small storage space.

It's fascinating to me because even tiniest and most trivial of files and games manage to take up at least a few MB, so imagining that huge levels like those in GoldenEye 007 managed to take almost no data at all is mind-blowing.

sentences:
Write alpha channel into SurfaceFormat.Single rendertarget in XNA/HLSL I need to initialize a rendertarget ('SurfaceFormat.Single' format) drawing sprites into it.
I would like the alpha channel of the sprite to be written into the rendertarget, so that regardless of the sprite texture, i end up with sprites silhouettes in the rendertarget. But XNA doesn't support alpha blending when using SurfaceFormat.Single, and from the pixel shader in which i handle the rendertarget for further calculations, i have all 0 readings.
I find documentation of this features to be sparse and partial, so, could anyone suggest some source where i can check the sanity of my code?

sentences:
Ideas for refactoring regarding simple state management in entities and level I'm actually developing a very simple 3D game, Arkanoid/Breakout style, with very simple mechanics, and it's progressing while I learn the game dev domain own concepts and techniques (My background is C/C++ middleware/low-level systems programmer).

I've advanced to a functional game loop, input, movement, collision checks, all it's working, but I reached to a day where the code was a mess, e.g: my Level class was doing too much. So I partitioned, OOP style, the code in several classes.

My intention is to get ideas from more experienced programmers regarding how Game state and substates relate with entities. My general picture is:

A game object which contains the main loop
A level object which contains a World instance with a list of all entities.
A renderer class which does Direct2D and Direct3D rendering.

Prior to the major refactoring, I was doing something like

Level::Update(float clockMs)  {
  switch (m_state)
    case (LevelState::Preloading) { ... }
    case (LevelState::Load) { ...}
    case (LevelState::Playing) {
        UpdateBallPosition ( ... )
        CheckCollisions( ...)
    }

}

Level contained references to ball, game bricks, etc. Now  I create the entities in the Level startup and add them to the World instance. (World is a member of Level).

Now I want to move all state-related code to the entities themselves. Suppose "Ball", it shouldn't do anything until Level is in LevelState::Playing. Where do you store typically state for the current Level (suppose a closed-level game)? It's correct to store entities with a pointer to the World and the World to mantain a pointer to the Level containing it? It's a tightly coupled architecture but I want to discuss how to relate world/level states with entities, and how the entities acknowledge in which higher-level states they are.

Keep in mind that I accept good procedural or data-driven approaches. I'm not an OOP fanatic, I think good designs can be built upon several paradigms. Thanks.

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 do I get a popup menu to block clicks from hitting UI elements beneath it? You can see in the picture that I have a Canvas with a popup menu in it. I just enable this, and it covers the main menu stuff. Clicks go through it and hit stuff in the main menu.

I've tried adding an EventTrigger to the PopupRoot object, and adding an event to listen for PointerClick events, but it doesn't fire.

EventTrigger trigger = m_popUpRoot.GetComponentInChildren<EventTrigger>();
EventTrigger.Entry entry = new EventTrigger.Entry();
entry.eventID = EventTriggerType.PointerClick;
entry.callback.AddListener((eventData) => { PopupClickBlocker((PointerEventData)eventData); });
trigger.triggers.Add(entry);

I'm open to other suggestions. My current system is horrible; button click events query the Popup to see if it's enabled or not, then return doing nothing if it is. This doesn't work for sliders very well, so I want to do this the right way.

sentences:
Is there any heuristic to polygonize a closed 2D raster shape with n triangles? Let's say we have a 2D image black on white that shows a closed geometric shape.

Is there any (not naive brute force) algorithm that approximates that shape as closely as possible with n triangles? If you want a formal definition:

  Approximate the shape with a polygon that when rendered into a new 2D
  image will match the largest number of pixels possible with the
  original image.

sentences:
Melee Range trigger collider does not detect object with Player tag In my 2D game, I have a Player which has:

a BoxCollider2D with isTrigger=false
a dynamic Rigidbody2D
a Player script

...tagged as "Player" and in the "Player" Layer.
Also I have an Enemy in the scene which has:

a BoxCollider2D with isTrigger=true
an EnemyMelee script

... tagged as "Enemy" and in the "Enemy" Layer.
The Enemy has its own collider because when to handle taking damage or changing colors when shot by the Player's bullets.
The Enemy has an empty child game object following it where it goes, called MeleeRange and it has:

a BoxCollider2D with isTrigger=true
a kinematic Rigidbody2D
an EnemyMeleeAttack script

...tagged as "MeleeRange" and in the "MeleeRange" Layer.
What I want is: When Player is inside of the MeleeRange area, the EnemyMeleeAttack script will detect this and call the Coroutine from the EnemyMelee script.
I want my Enemy to trigger its "attackMove" animation and attack my Player every 1.5 seconds. It has an exit time to the idle animation, and because the Player is still in the MeleeRange collision area, the attack will start again and return to idle again.
The problem is: MeleeRange simply cannot see the Player tag in the area. I put Debug.Log if it detects the player but nothing happened.
EnemyMeleeAttack script:
public class EnemyMeleeAttack : MonoBehaviour {
    public EnemyMelee enemyMeleeScript;

    void OnTriggerEnter2D(Collider2D coll)
    {
        if(coll.tag == "Player")
        {
        Debug.Log("MeleeRange Collision Reached!");
        enemyMeleeScript.anim.SetBool("isRunningBool", false);
        enemyMeleeScript.StartCoroutine(enemyMelee.attackStance());
        }
    }
}

EnemyMelee script:
public class EnemyMelee : Enemy {
    #region Variables
    public bool inRange;
    #endregion

    #region Attack
    public float attackTime;
    public float timeBetweenAttacks;
    #endregion

    #region Movement with AI
    public bool isRunningBool;
    public AIPath aipathScript;
    //public EnemyMeleeAttack emeleeattackScript;
    #endregion

    public override void Start()
    {
        base.Start();
        anim = gameObject.GetComponent<Animator>();
        aipathScript = gameObject.GetComponent<AIPath>();
        aipathScript.OnTargetReached();
    }

    private void FixedUpdate()
    {
        //Code for if Enemy dies, disable all functions attached to Enemy.
        if (health <= 0)
        {
            GetComponent<AIPath>().enabled = false;
            StopCoroutine(attackStance());
        }

        DamageColorUpdate();

        //Reference from A*Pathfinding for following player and running animations when following occurs.
        if (aipathScript.reachedEndOfPath == false)
        {
            anim.SetBool("isRunningBool", true);
            inRange = false;
        }
        else
        {
            anim.SetBool("isRunningBool", false);
            inRange = true;
            //StartCoroutine(attackStance());
        }
    }

    public IEnumerator attackStance()
    {
        if (Time.time >= attackTime)
        {
            anim.SetBool("isRunningBool", false);
            player.GetComponent<Player>().TakeDamage(damage);
            attackTime = Time.time + timeBetweenAttacks;
            anim.SetTrigger("attackMove");

            yield return null;
        }
    }
}

sentences:
Prevent keyframe interpolation in imported model animation in Unity I made first person model in blender. It also has animations in it.

Most of animation works fine, but in some cases, Unity's keyframe interpolation makes wrong result.

Note that animation was made by 60 frames per second in Blender.

To explain my problem, you have to see my model:

As you can see there are two magazines. Each named Mag1 and Mag2 and Mag1 is the magazine that attached to the gun.

Mag2 is always located very bottom of the screen so that it is impossible to see, except reloading animation.

While reloading, first pull out the mag1 from the gun and put in the mag2 to the gun. And here is the trick, after mag2 is attached to a gun, hand put the mag1 somewhere, maybe magazine pouch.

Anyway as soon as mag1 disappeared from the screen, it switches mag1 and mag2 immediately at only single frame. So mag1 is now move back to the gun and mag2 is also reloated to bottom.

In Blender, it seems nothing wrong but in Unity is quite different. As soon as mag1 disappeared, it doesn't switched immediately and it moves smoothly animated so I can see that magazines were moved. I'm pretty sure that this happens maybe Unity interpolates keyframes.

I already turned off Animation Compression option and resample curves, but still won't worked.

This is the video that I made to explain my situation:
https://www.youtube.com/watch?v=7aew959ejL4&feature=youtu.be

Is there a way to "turn off" that interpolation? I want to disable it only that frame. Unity doesn't allow me to edit animation clip, so I just duplicate animation clip and change the option(I don't know what it called) to "Flat" and use that clip instead, but still have same problem. (Note that it wasn't easy because Unity doesn't show me the animation if I duplicate and modify it)

I struggled this issue almost a year and still figuring out how to fix it, and I think it's time to solve it. Any advice will very appreciate it.

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

An example of my enemy shooting a projectile.

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

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

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

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

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

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

ublic class MultiBullet : MonoBehaviour {

    public float speed = 1f;

    private Rigidbody2D rb;

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

    }

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

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

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

sentences:
VSSetConstantBuffers1 does not appear to be working I'm experiencing something very strange here when using VSSetConstantBuffers1.

I have a projection * world matrix that I'm sending to a constant buffer to rotate a triangle on an axis.  When I do this, I follow this pattern:

Frame #1

Set offset to 0, count is always at 64 (4 * float4)
Map Constant Buffer using Discard.
Write matrix to constant buffer
Unmap
Call VSSetConstantBuffers1(0, 1, new []{ cbuffer }, new []{offset }, new []{ count })
Draw

Frame #2

Set offset to 64, count remains same.
Map constant buffer using NoOverwrite
Write matrix.
Unmap
Call VSSetConstantBuffers1(0, 1, new []{ cbuffer }, new []{offset }, new []{ count })
Draw

Etc... When I fill the constant buffer completely, I reset offset to 0, and start again by using discard on my map.

Now here's my problem:  Nothing shows up on the screen.  Well, that's not 100% true, the very first frame, where offset = 0 and count = 64, that shows up perfectly.  The next frame, and subsequent frames do not.

I used the Visual Studio 2017 graphics debugger to confirm that my constant buffer did indeed have data in it.  And it did, and the values were correct.

It's really weird. I should be mapping the constant buffer to the next matrix element with my 2nd call to VSSetConstantBuffers1, but it doesn't actually look like it's going anywhere near that element.

Also, I tried forcing it to just use the 0, and 64 offset/count and only updating that portion of the buffer, and it works just fine.

I've tried my best to dig up info about constant buffer offset/count, but it's pretty sparse out there (my own searches on this site gave me 0 for VSSetConstantBuffers1, same with GameDev.net).  What little I did scrounge up on Nvidia's website, makes it appear as though this pattern should work.

Since my hardware might come into question here, I have a GeForce 1080 GTX running on Windows 10 (latest update), and according to the D3D11.1 options, it does indeed support constant buffer offsets, and my feature level is at max.

Anyone have any ideas? Given the lack of info, I'm guessing the offset/count versions of constant buffers aren't too popular?

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:
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:
Moving/spilling water inside a cup of glass I made a glass of water but there are somethings i didnt know how to do well, what i did is i put a mesh on the top of the glass to represent the surface of the water but it doesnt really work well with glass because if you look from the sides you wont really see that there is water in there, this is what i did :

the glass from the side :

as you can see it doesnt really work well in my case.
I also tried putting an object that has the same shape as the cup inside to represent water but that would make it difficult for what i want to do next, because my next step would be to make the water rotate in the opposite rotation of the cup and make it spill if it reaches the top of the cup, and that is my second question how do i make the water spill from the cup?

Any help is very much appreciated.

sentences:
Can I embed a game in a PDF document? I was thinking that it could be cool to have an interactive game in a digital resume. For the sake of this question, and scope of this site, let's ignore whether or not this is a good idea.

Is it possible to embed a game or some sort of interactive window inside of a PDF document? This could be using any sort of language or framework. For example, having a small area of the PDF with a CAPTCHA in it.

sentences:
How would I make a bullet shoot from my player to my mouse. So far I've created an object called obj_mouse. And my plan is whenever the player left clicks, it spawns a bullet from him toward where ever the mouse is pointing. I've got the concept down, but I'm struggling getting it to work.

Extra bits of code I'm messing around with to try and get it to work:

    bullet=instance_create(x,y,obj_bullet)
with (bullet) {
move_towards_point(mouse_x,mouse_y,5)
image_angle=direction
}

point_direction(obj_mouse,obj_mouse,obj_mouse,obj_mouse)
image_angle=direction

(In the above code, I havent attempted to specify to the program that I want the bullet to go in the direction of obj_mouse, or rather, just the mouse. The above code works, and bullets do shoot, however the player must have the mouse on the players sprite for it to work.)

Thank you in advance for any advice given.

sentences:
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:
Lerping character moving up and down slope tiles So, when interpolating position against a standard 'horizontal' platform, everything works great. What happens is something like this..... (Question continues after graphic)

Now, the question I have is, how do we correctly interpolate the player's sprite (blue circle) against a 45° tile? When I attempt to do this, what happens, is that when the player is going up the slope, it is slightly embedded in the tile and when coming down the slope, it floats slightly above the tile.

In the example above, the sprite effectively 'stops' moving along the Y Axis, so therefore, interpolation along that axis stops, however when interpolating the position against a slope, the sprite moves in an X and Y direction, so never stops.  I think this is causing the issue, if my logic is correct, some more graphics follow to illustrate what I mean....

What am I doing wrong?  How do I interpolate my sprite while making sure it's 'on' the slope at all times?

For moving up a slope

When moving down slope

Summary

When interpolating against a horizontal platform, although the sprite isn't rendered on the platform in the frame straight after collision has been resolved, it is rendered on the platform during subsequent frames because the difference between the old and new positions has become 0 as it is no longer moving. However against a slope, again, the initial frame is incorrect but then the sprite moves again, so the next frame is also wrong etc so it never 'settles'. Note it does move at the slope's angle just not on the slope.

I'm trying to work out how to get my two points along the 45°  slope and interpolate between them (ie, along the slope)....

sentences:
(web game) text-based combat system shows progress to client instead of give a report at the end I am developing a text-based multiplayer-RPG using React and dotNet core. The fight logic is handled on server side. Basically what fight() does is:

a while loop that iterate 100 times; in each iteration the characters attack each other; actions are stored in a string list
a winner is determined either at the end of the while loop or one's hp is below 0
write the fight result and rewards into database
send response back to client with the combat log (that string list)

This is what the fight() basically does. Players clicks fight and get the result and the report instantly. I would like to make the fight more engaging to the players by showing the fight's progress in each round (and add time interval between rounds).
I don't know how to achieve this. I would appreciate any ideas you share.
I could let the client side see a "replay" of the fight using the response from the server, but that's not what I want. Maybe this is something other idle games are doing. I don't know since I don't have much experience of game developing.

sentences:
Why am I seeing unbounded memory usage in my WP8 game? I recently upgraded to VS2012 and tried my game out on the new WP8 emulators. I was dismayed to find out the emulator now crashes and throws an out of memory exception during my sprite loading procedure (it still works in WP7 emulators and on my WP7).

Regardless of whether the problem is the emulator or not, I want to get a clear understanding of how I should be managing memory in the game.

My game consists of a character that has 4+ different animations. Each animation consists of about 4 to 7 frames. On top of that, the character has up to 8 stackable visualization modifications (eye type, nose type, hair type, clothes type, et cetera). Prior to my memory issue, I preloaded all textures for each animation frame and customization  and created animate action out of them. The game then plays animations using the customizations applied to that current character.

I revisited this implementation when I received the out of memory exceptions and have started playing with RenderTexture instead, so instead of pre-loading all possible textures, it on loads textures needed for the character, renders them onto a single texture, from which the animation is built. This means the animations use 1/8th of the sprites they were before. I thought this would solve my issue, but it hasn't.

Here's a snippet of my code:

var characterTexture = CCRenderTexture.Create((int)width, (int)height);

characterTexture.BeginWithClear(0, 0, 0, 0);
// stamp a body onto my texture
var bodySprite = MethodToCreateSpecificSprite();
bodySprite.Position = centerPoint;
bodySprite.Visit();
bodySprite.Cleanup();
bodySprite = null;
// stamp eyes, nose, mouth, clothes, etc...

characterTexture.End();

As you can see, I'm calling CleanUp and setting the sprite to null in the hope of releasing the memory, though I don't believe this is the right way, nor does it seem to work.

I also tried using SharedTextureCache to load textures before stamping my texture out, and then clearing the SharedTextureCache with:

CCTextureCache.SharedTextureCache.RemoveAllTextures();

But this didn't have an effect either.

I used VS to do a memory profile of the emulation causing the crash. Both WP7.1 and WP8 emulators peak at about 150mb of usage. WP8 crashes and throws an out of memory exception.

Each customisation/frame is 15kb at the most. Lets say there are 8 layers of customization (120kb) but I render then onto one texture which I would assume is only 15kb again. Each animation is 8 frames at the most. That's 15kb for 1 texture, or 960kb for 8 textures of customization. There are 4 animation sets. That's 60Kb for 4 sets of 1 texture, or 3.75MB for 4 sets of 8 textures of customisation.

So even if its storing every layer, its 3.75MB. That's nowhere near the 150mb breaking point my profiler seems to suggest.

WP 7.1 Memory Profile (max 150MB)

WP8 Memory Profile (max 150MB and crashes)

Why might I be seeing this behavior?

sentences:
Optimize a vertex buffer and generate its associated index buffer I need to generate a 64*64 grid with each cell being 32*32 wide.

The following code works perfectly but I was wondering whether it can be further optimized when creating the index buffer for it.

I've been searching the web for an algorithm that would generate indices and optimize a buffer but without much success ...

var vector3s = new[]
    {
        new Vector3(0, 0, 0),
        new Vector3(1, 0, 0),
        new Vector3(0, 1, 0),
        new Vector3(1, 1, 0),
    };

List<VertexPositionTexture> positions = new List<VertexPositionTexture>();
for (int y = 0; y < 64; y++)
{
    for (int x = 0; x < 64; x++)
    {
        foreach (var vector3 in vector3s)
        {
            var translation = Matrix.CreateTranslation(new Vector3(x, y, 0));
            var transform = Vector3.Transform(vector3, translation);
            var multiply = Vector3.Multiply(transform, 32.0f);
            VertexPositionTexture vpt = new VertexPositionTexture(multiply, new Vector2(vector3.X, vector3.Y));
            positions.Add(vpt);
        }
    }
}

Output sample :

{Position:{X:0 Y:0 Z:0} TextureCoordinate:{X:0 Y:0}}
{Position:{X:32 Y:0 Z:0} TextureCoordinate:{X:1 Y:0}}
{Position:{X:0 Y:32 Z:0} TextureCoordinate:{X:0 Y:1}}
{Position:{X:32 Y:32 Z:0} TextureCoordinate:{X:1 Y:1}}
{Position:{X:32 Y:0 Z:0} TextureCoordinate:{X:0 Y:0}}
{Position:{X:64 Y:0 Z:0} TextureCoordinate:{X:1 Y:0}}
{Position:{X:32 Y:32 Z:0} TextureCoordinate:{X:0 Y:1}}
{Position:{X:64 Y:32 Z:0} TextureCoordinate:{X:1 Y:1}}

For instance, positions at 1 and 4 are identical but their texture coordinates are not.

What are the options for optimizing it and how does one generate the associated index buffer ?

Should positions be separated from texture coordinates and each have an index buffer ?

EDIT

Actually texture coordinates are wrong but it's not really relevant for the question.

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:
AdMob Rewarded Video Ads always shows same ad I have integrated AdMob rewarded video ads in my iOS game. Currently, the game is in development stage and not released on the store. Currently, the fill rate is around 30%-40% and I always see the same rewarded video ad. I have following questions:

Why the fill rate is such low? I am testing the game in India and the US.
Why the game is receiving the same ad from AdMob? Are there any settings that can allow different ads from the network?

I would appreciate any suggestions and thoughts on this topic. Thank you

More information:

The test ads gives 95%-98% fill rate. Hence, I think there is no problem with the AdMob SDK configuration. Previously, I tried using AdMob mediation and the ads were coming other ads networks (NO ADS FROM ADMOB).

Is there a AdMob policy where they don't provide enough ads to "under development" game/application?

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

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

sentences:
What 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:
calculate the offset between a quad and the mouse position Opengl I am working on a very simple "GUI framework" for my game.

As you can see from the GIF, i have a window object that can be selected when the mouse is inside of it and dragged, when the left mouse button is being pressed.

I tried to solve the problem this way:

Basically i calculate the x and y component of the distance between the center of the window and the mouse cursor. I then add the component values to the window function, which looks something like:

//mousePosition is a Vector2() that stores the mouse position
//x_component is a float, calculated by doing:
//float x_component = mousePosition.x - window.getPosition().x;
//same for the y_component variable.

window.setPosition(Vector2(mousePosition.x + x_component, mousePosition.y + y component));//set position takes in a Vector2

But for some reason, this is not working. I think that it's because we are not taking in consideration the fact that the x or y component could be negative, in relation to where we press the mouse inside the window.

Can someone help me?

sentences:
Collision Responses with many different types I'd like to write an efficient Collision Response code, that does not use instanceof/type checks that often (if  possible)

my current implementation is something like this:

GameObject.collidesWith(GameObject other)
{
    if(other instanceof ConcreteType1)
    {
        //do response with Concrete Type 1
    }else if (other instanceof ConcreteType2)
        // do response with Concrete Type 2
    }
}

GameObject is the base class of everything.
Is there a possibility to avoid instanceof and type checks?

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:
Re-using one texture for multiple OpenGL Quads I've been looking over my code and I'm just wondering, when I set a texture for say, 20 quads that need to use the same texture, it seems as though I'm creating a new texture each time...... surely this isn't efficient?

How can I make sure that 20 quads that use the same texture do just that, use only 1 rather than creating 20 copies of it?

I just can't work out how I can do this.  I know I can change the texID after applying the texture so that all quads that use the same texture, will have the same Texture ID, but this isn't really the issue I'm facing.

Of course, I may be completely misunderstanding how OpenGL deals with textures and my code may be OK :-/

Code:

    public void setTexture(GLSurfaceView view, Bitmap imgTexture){
        this.imgTexture=imgTexture;
        //Create program from Utils class
        iProgId = Utils.LoadProgram(strVShader, strFShader);
        //Return location of u_basemap
        iBaseMap = GLES20.glGetUniformLocation(iProgId, "u_baseMap");
            //Return location of attribute variables
        iPosition = GLES20.glGetAttribLocation(iProgId, "a_position");
        iTexCoords = GLES20.glGetAttribLocation(iProgId, "a_texCoords");
        //Return usable texture ID from Utils class
                texID = Utils.LoadTexture(view, imgTexture);

}

And....

public static int LoadTexture(GLSurfaceView view, Bitmap imgTex){

    //Array for texture
    int textures[] = new int[1];
    try {
        //Return texture name in textures Array
        GLES20.glGenTextures(1, textures, 0);
        //Bind textures
        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textures[0]);
        //Set parameters
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);

        //Apply the texture to the image loaded
        GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, imgTex, 0);

        //clamp the texture
        GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T,GLES20.GL_CLAMP_TO_EDGE);
    } catch (Exception e){
    }
    //Increase texture count by one
    textureCount++;
    return textures[0];
}

Edit

I've attempted the suggestion below (just calling glBindTextures()) however, I'm not having any luck.  Clearly I'm not understanding this correctly.

Lets say I have 2 sprites, Object1 and Object2.

I call the following:

object1.setTexture(this, myAtlasTexture); //Calls setTexture (See above)

This works and sets the texture on this sprite, so I can now draw it.

Now I want object2 to use the same texture.  So I don't want to call this again and create a new texture (I believe this is a bad idea) - I simply want to use the texture that was previously created when I called setTexure on object1.

So, instead of calling setTexture on object 2, I do the following:

GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureIDOfObject1);

(Note textureIDOfObject1 is just that, I just query object1 to obtain its texture ID).

sentences:
How does the SNES' Mode 7 sprite perspective projection work? I've always wanted to know how to replicate the old Mode 7 graphics mode of the Super NES. It was frequently used for a pseudo-3D effect in racing games like Top Gear (gameplay video).

Top Gear ⓒ Gremlin Graphics. Image credit: Phil at tasvideos.org.

Every explanation I can find seems a little too complex for me.

In simple terms, how does Mode 7 work?

sentences:
Error rendering map android I'm trying to read this text file and render the corresponding tiles on the screen.

The code for reading the map is as follows:

private void loadMap(InputStream is) throws IOException {
    ArrayList<String> lines = new ArrayList<String>();
    int width = 0;
    int height = 0;

    BufferedReader reader = new BufferedReader(new InputStreamReader(is));
    while (true) {
        String line = reader.readLine();
        if (line == null) {
            reader.close();
            break;
        }

        if (!line.startsWith("!")) {
            lines.add(line);
            width = Math.max(width, line.length());
        }
    }
    height = lines.size();

    for (int j=0; j < 18; j++) {
        String line = (String) lines.get(j);
        for (int i=0; i < width; i++) {

            if (i < line.length()) {
                char ch = line.charAt(i);
                Tile t = new Tile(i, j, Character.getNumericValue(ch));
                tiles.add(t);
            }
        }
    }

}

The first problem I have is with Character.getNumericValue(ch) as this does not seem to be doing anything, resulting in a NullPointerException. When I remove it and replace it with either a 1 or a 2 I'm able to render the tiles onto the screen but somehow the spaces in between the digits are interpreted as tiles, resulting in a continuous block of tiles eg in the second line with 1s results in tiles beginning from the left margin up until the last 1. How can I fix this?

sentences:
How would I make my player controls respond quicker? I'm working on this game in Unity 2D where the user swipes to make a game object move in the direction that the user swiped in. Currently, when the user swipes it takes about a quarter of a second for the game object to respond and move in the new direction. What should I do to make the controls respond quicker? I know that with Input.GetAxis, I could make it Input.GetAxisRaw to make it more responsive. Right now it's like Input.GetAxis but I'm trying make it like Input.GetAxisRaw. (I can't use Input.GetAxisRaw because this is for a mobile game). Thanks.

private Rigidbody2D rb;
private Vector2 moveVelocity;

in void Update():

if (Mathf.Abs(lp.x - fp.x) > Mathf.Abs(lp.y - fp.y)) {   //If the horizontal movement is greater than the vertical movement...
                    if ((lp.x > fp.x)) {   //Right swipe
                        if(moveVelocity != Vector2.left) {
                            moveVelocity = Vector2.right;
                        }
                    }
                    else {   //Left swipe
                        if(moveVelocity != Vector2.right) {
                            moveVelocity = Vector2.left;
                        }
                    }
                }
                else {   //the vertical movement is greater than the horizontal movement
                    if (lp.y > fp.y) {   //Up swipe
                        if(moveVelocity != Vector2.down) {
                            moveVelocity = Vector2.up;
                        }
                    }
                    else {   //Down swipe
                        if(moveVelocity != Vector2.up) {
                            moveVelocity = Vector2.down;
                        }
                    }
                }

And void FixedUpdate():

void FixedUpdate() {
    rb.MovePosition(rb.position + moveVelocity * speed * Time.deltaTime);
}

sentences:
Fire an event while the mouse is down within my box 2d collider in Unity The method OnMouseDown() is called once when the mouse presses my box 2d collider.

Is there a method that keeps firing while the mouse is still holding the button down inside the collider? Something like WhileMouseDown().

I could use Input.GetMouseButton(0) in the Update() method. However, this does not check if the mouse is pressing the collider.

sentences:
How to create a Update function in Java I have recently started using Java, but have been programming in javascript, and actionscript 3 for a while.

I am used to the language giving me the ability to simply do something like:

private function Update(){
//stuff
}

or something similar to that.

I am looking for something similar in Java, and I want to make sure I am doing it correctly.

I started following a tutorial, and they said to do something like this:

 long lastTime = System.nanoTime();
        double amountOfTicks = 60.0;
        double ns = 1000000000;
        double delta = 0;
        long timer = System.currentTimeMillis();
        int frames = 0;
        while(running){
            long now = System.nanoTime();
            delta += (now - lastTime) / ns;
            lastTime = now;
            while(delta >= 1){
                tick();
                delta--;
            }

            if(running)
                render();
            frames++;

            if(System.currentTimeMillis() - timer > 1000){
                timer += 1000;
                System.out.println("FPS: " + frames);
                frames = 0;
            }
        }

This seems to be every second calling the tick() function, not the same as every frame though, and while things tend to happen in less time than a second, I would much rather use the same old frame by frame method i was using. (Unless someone can give me a reason not to, always up for an opinion)

So I am wondering, why not just do something like:

while(running){
Update();
}

I believe this would call every frame. Am I doing something completely crazy here? is there a much better method?

Thanks in advance

sentences: Radial/circle placement of meshes How to place 10 static meshes in circular pattern so they are equaly aligned from the center ?

sentences: Help with modifying a geometry grass shader to allow removing areas? So I have this geometry grass shader from a roystan tutorial I followed but it applies the grass effect to the entire mesh at once. I need to find a way to only apply grass to set areas much like how the unity painting vegetation tools work. I had an idea of using a "guiding" texture that the shader would follow which would only apply grass onto set areas on the texture e.g areas that are green but I'm not sure how to implement it. I would appreciate any advice!

sentences:
How do I implement deceleration for the player character? Using delta time with addition and subtraction is easy.

player.speed += 100 * dt

However, multiplication and division complicate things a bit. For example, let's say I want the player to double his speed every second.

player.speed = player.speed * 2 * dt

I can't do this because it'll slow down the player (unless delta time is really high). Division is the same way, except it'll speed things way up.

How can I handle multiplication and division with delta time?

Edit: it looks like my question has confused everyone. I really just wanted to be able to implement deceleration without this horrible mass of code:

else
    if speed > 0 then
        speed = speed - 20 * dt
        if speed < 0 then
            speed = 0
        end
    end
    if speed < 0 then
        speed = speed + 20 * dt
        if speed > 0 then
            speed = 0
        end
    end
end

Because that's way bigger than it needs to be. So far a better solution seems to be:

speed = speed - speed * whatever_number * dt

sentences:
BitmapFont - where is getBounds method in new 1.6 libGDX I download newest libgdx version 1.6 and i cant solve problem with center my BitmapFont text. Earlier in version 1.54 i used getBounds() method to find out width of text.

Share your solutions, thanks

sentences: Can I sell Windows Phone 7 games on the marketplace from India? I am a developer from India working on a game in WP7. I need to know, can I sell my game in Windows phone apps marketplace or is it like Android market where only free/ad-based is allowed?

sentences:
Canvas UI elements out of place in Unity3d I placed all elements in the places I want to show in the Game mode,
nevertheless, when I go to Game Mode they are shown in the wrong place as it was shown in the pictures (they go to the center). I tried different modes of render mode but no one seems to work in this case. I want the elements to be fixed in the window no matter monitor size.

sentences:
Should our group try to make a game? I am a second year, learning C/C++ and Java.

In our first year of university we did basic C++, no classes. This year we have been introduced to classes and inheritance. We have not yet done pointers, virtual functions, abstract classes, operator overloading, exception handling, linked lists, stacks, queues, binary trees, graphs, etc.

I am very curious, so I like to teach myself some things that we haven't yet done. I enjoy the technical side of things a lot, my friends think I am weird to want to learn more than I have to..

But heres my problem:

Our C++ lecturer has decided to take a different approach this term to learning. He said, form a group, think of a project you would like to do and implement it over the year.

Let me give you a break down of our group:

Theres five of us in the group. Myself and another member are much more experienced than the other three and we like the technical side of things, and are quite motivated to do something with an interesting challenge. Then we have a group member who has been extremely hard to motivate, and he was very unsure why he wanted to be a programmer. He did some thinking and decided he wanted to work towards becoming a game programmer. The next member of ours is not the most reliable and has let us down a few times. Finally we have a new member that is keen to learn, but his programming needs work, as do the previous two members.

We are all friends, of course -- which probably isn't the ideal solution to a good group.

The project idea:

Our lecturer gave us an initial idea for a project: a timetable scheduler. Of course this is no trivial task, but most of our members were not really interested in the project at all. So, then I thought -- one member wants to be a game programmer (the hardest member to motivate), most of us would probably enjoy the experience of doing a game, as it would be a big challenge, so why not give it a go?

So what is my question?
Do you think that we should take on the task of making a game, or aim for something else?

Initially we thought of a 2D, top-down, ARPG. Then it became a 3D ARPG.

Obviously 3D would be harder, but as we have time to learn, it wouldn't be such a bad idea would it?

Personally I think that the learning will be the most fun part of this project, even if we don't end up with a great game, we should have learned  a lot (including being forced to learn and implement new C++ topics).

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:
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:
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: Sprite detect background color I have read somewhere that sprites can detect the background color, but I don't remember where and how it's working. What I'm trying to do is just a function to detect if the sprite is on a special surface, that has a special color, instead of using collision dedection between objects. Help is preciated! Thanks!

sentences:
Issue with tangents/bitangents generation for normal maps I'm generating tangents and bitangents for a normal mapping effect and while using the same method as several tutorials, I get tangents that are not very continuous.

Here, we can see on the sphere especially that the tangents are very weird.

Also, my normal are totally correct and don't have this issue.

And when using these tangents with my normal mapping shader they "work", but create a very harsh "break" in the surface.

Here is the code used to generate the tangents and bitangents :

for (size_t i = 0; i < out_vertices.size(); i += 3)
{
  const auto& v0 = out_vertices[i];
  const auto& v1 = out_vertices[i + 1];
  const auto& v2 = out_vertices[i + 2];

  const auto& uv0 = out_uvs[i];
  const auto& uv1 = out_uvs[i + 1];
  const auto& uv2 = out_uvs[i + 2];

  const auto& dd_v0 = v1 - v0;
  const auto& dd_v1 = v2 - v0;

  const auto& dd_uv0 = uv1 - uv0;
  const auto& dd_uv1 = uv2 - uv0;

  float r = 1.0f / (dd_uv0.x * dd_uv1.y - dd_uv0.y * dd_uv1.x);
  glm::vec3 tangent = glm::normalize((dd_v0 * dd_uv1.y - dd_v1 * dd_uv0.y) * r);
  glm::vec3 bitangent = glm::normalize((dd_v1 * dd_uv0.x - dd_v0 * dd_uv1.x) * r);

  out_tangents.push_back(tangent);
  out_tangents.push_back(tangent);
  out_tangents.push_back(tangent);

  out_bitangents.push_back(bitangent);
  out_bitangents.push_back(bitangent);
  out_bitangents.push_back(bitangent);
}

I'm not sure if I need to average the (bi)tangents that share the same vertices/uvs, but I'm also not sure how to do it.

Thanks for any help.

sentences:
How does a game like Minecraft handle block and entity updates? I am not asking how Minecraft loads chunks or generates chunks, I am asking about individual blocks and entities and their behaviours.

Suppose you have a dirt block: dirt block can be converted to a grass block if there is a grass nearby. The game can have thousands of dirt blocks loaded at the same time, each checking if there is grass nearby.

Now add some monster spawners which have to spawn monsters periodically and keep track of how many monsters it spawned.

Then there is your large field of wheat, potatoes, carrots and saplings which the game also has to check and update every so often.

Then you have your furnaces that smelt your ores.

Then add into the mix all of the animals, monsters, villagers and their behaviours and pathfinding.

All of these actions are happening simultaneously and the game somehow keeps running smoothly on a decent computer.

How do the games generally handle this many block updates and entity behaviours? Does the game keep a list/collection of all the "updateable" blocks and just iterates every so often through that list and simply calls the ".update()" method? How are games with many updateable blocks/entities structured? Updating in a separate thread?

There are so many questions... Any clue is appreciated. Thank you.

sentences:
Top down tile based game render order I'm making a simple top down (like this) tile based game (using JavaScript, for reference)

I use Tiled for making maps. I have sprites that are more than one tile high, and so whenever they are in front or behind of some objects more than one tile high tiles will be displayed in front of the player. I am looking for a way to give certain tiles 'height' such that only characters of that height could appear in front of those tiles.

Here is a screenshot showing my problem (the sprite is doge because it was the first image I found):

The same tiles don't always equate to the same height, so I can't give tiles set height. I've thought of one way to give tiles height, and that is to have a (hidden) layer that describes the height level certain tiles are at.

However, that solution would be slow and painful to implement. I'm wondering if there's a better way to do it.

A few other potential ideas I've had: Have a tile layer for each height, hackily guess the height of a tile at runtime based on tiles below (would be buggy) but I think that there would surely be a better way to do it.

sentences:
How to load values into a script from a file? I have a prefab of a "generic unit;" each one has a script with some public variables: name, health, and attack.

Currently, I am manually making copies of that prefab and editing their names, health and damage values in the inspector. This seems unwise to me.

I would rather be able to make a simple file for each unit type, containing its important information, like this:

name = "Archer"
health = 3
attack = 1

And so on. Then, I would like to be able to turn that into actual GameObjects in Unity, presumably by instantiating the prefab and filling in its values with values from the file.

I could then make a script that runs when the game begins and iterates through, making all the objects I need.

However, I do not know the proper way to go about doing this. Is there some way to read files and slot values into variables of a script?

To be clear, I would like to be able to tell Unity to make an Archer, then have it read the Archer file, look up its values for health and attack, then instantiate a copy of the Generic Unit prefab and slot the values that it read into the public variables of a script component of the newly-created game object.

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:
Setting up an "Oct-Tree" Instead of spam the same hard question like my previous one that Is difficult to get a minimum verifiable example for, I have decided to rework my path-finding and I can fix a lot of my issues with an oct-tree, not a true one but rather just subdividing my world into 8 or however many i specific in the function as this is all thats needed.

I already know what i need to do the stage after this, but I'm a not sure the best way to approach the subdivision so i get the right vector points of the subdivided cubes.

div = the number of cubes I want to create.

If I already have my 8 points,

    worldspace(Vector3 origind, float sized)
{
    //  face1
    ca = Vector3{ origin.GetX() + sized,origin.GetY() + sized, origin.GetZ() - sized };
    cb = Vector3{ origin.GetX() + sized,origin.GetY() - sized, origin.GetZ() - sized };
    //-----------------------------------------------------------------------------
    cc = Vector3{ origin.GetX() - sized,origin.GetY() - sized, origin.GetZ() - sized };
    cd = Vector3{ origin.GetX() - sized,origin.GetY() + sized, origin.GetZ() - sized };
    //  face 2
    ce = Vector3{ origin.GetX() + sized,origin.GetY() + sized, origin.GetZ() + sized };
    cf = Vector3{ origin.GetX() + sized,origin.GetY() - sized, origin.GetZ() + sized };
    //-----------------------------------------------------------------------------
    cg = Vector3{ origin.GetX() - sized,origin.GetY() - sized, origin.GetZ() + sized };
    ch = Vector3{ origin.GetX() - sized,origin.GetY() + sized, origin.GetZ() + sized };
};
~worldspace();

I can define my worldspace as worldspace(0,0,0,25) so thats a cube of 25 units, but then I want to divide it in the most efficient way into 8 = cubes lets say or so and make them into a vector.

I'd like the function to be able to specify how many subdivisions i want, I don't want a dynamic one, so I think. So I'm thinking I could do something along the lines of

semi pseudocode

createoct(div)
int divisions = div
for (int i = 1; i =< div; i++)
{
  dist of ca to cb / div ?
  store the new point
  do the same for the other points ?
}

Am I going about this the right way ? what would be the best way to calculate the subdivisions and store their 4 seperate points as one object ? perhaps a new class ?

sentences:
POST HttpRequest doesn't send any data I've some trouble for sending a post request to my nodejs server.
I can receive data from the server with GET method, but when I try to send data with POST, I've an empty bracket on return on this function:
func _on_request_completed(result, response_code, headers, body):
    var json = JSON.parse(body.get_string_from_utf8())
    print(json.result)
    print(response_code)

And empty bracket on my JSON console.log on the server too.
My code:
extends CanvasLayer

func _ready():
    $HTTPRequest.connect("request_completed", self, "_on_request_completed")

func _on_Button_pressed():
    var data = {"name": "Godette"}
    _make_post_request("http://localhost:8080/", data, false)

func _on_request_completed(result, response_code, headers, body):
    var json = JSON.parse(body.get_string_from_utf8())
    print(json.result)
    print(response_code)

func _on_HTTPRequest_request_completed():
    pass

func _make_post_request(url, data_to_send, use_ssl):
    # Convert data to json string:
    var query = JSON.print(data_to_send)
    # Add 'Content-Type' header:
    var headers = ["Content-Type: application/json"]
    $HTTPRequest.request(url, headers, false, HTTPClient.METHOD_POST, query)

And this code return this in my console:
{}
200
Thanks for help :)

sentences:
Despite the connect() method returning 0 (enum), the function specified in the connection is not called The subject script:
    extends ColorRect

onready var subject = get_parent().get_node('Page1')

func _ready():
    var error = subject.connect('set_timer', self, 'ad')

func ad():
    print('signal connected')

sentences:
Move Camera is an order so that the background doesn't move fast I have created a game where I am moving my player on a platform. The car moves fine on the platform and the camera follows the car as well. My problem is that I wanted my background to move slowly. I am using a perspective camera and I am moving camera away to create a zoom out effect when my player jumps. Do you suggest I should move my background towards right so that it creates a simple slow effect? As currently it moves very fast.

here is my video demonstration : https://www.youtube.com/watch?v=xO_mEXo6mNA

sentences:
Monogame sprite rotation issue I'm having interesting problem with rotating a sprite in MonoGame. Here is how origin, destination rectangle and scale are created:

  Vector2 origin = new Vector2(tx.Width / 2, tx.Height / 2);

  Rectangle dstRectangle = new Rectangle((int)e.Xpos, (int)e.Ypos, (int)(tx.Width), (int)(tx.Height));
        dstRectangle.X += (tx.Width / 2);
        dstRectangle.Y += (tx.Height / 2);

  Vector2 scale = new Vector2(tx.Width * (float)TxScaleFactor, tx.Height * (float)TxScaleFactor);

And here is the draw function:

 Editor.spriteBatch.Draw(texture: GlowWhite, destinationRectangle: dstRectangle, color: Tint * (Alpha * 0.6f), rotation: rotation, scale: scale, origin: origin);

Now, with angle 0.0f, everything is fine but any additional rotations become weird:

Zero rotation, white background is WinForms picturebox, below is MonoGame

90 deg

And 180 deg

Its like there is some kind of offset - I've tried to change 0 to 90, and back 0 and next to 180 - result is always the same (apparently, there is no adding). I'm guessing that problem is related to origin, destination rectangle or scale. Sprites are rotated in place as you can see (no issues with that) but something with rotation isn't right. Any ideas?

sentences:
How should I load/change/activate scenes? Scenes are confusing the hell out of me and I'm pretty sure they should be simple to understand.

When the game loads, only the current scene has a buildIndex != -1. In order give it a 'real' build index I need to load it by path or name (because there's no build index).

The scenes are ten game scenes, one title scene and one persistent scene (which has the player and the status bar with the score etc.).

Should I load a scene every time I change scene and then load additive afterwards or should I be using Set Active Scene?

All the scenes are ticked in the Build Settings.

I'm looking at the index with this:

private void Start()
{
    var sceneName = "Persistent";
    var sceneBeforeLoading = SceneManager.GetSceneByName(sceneName);
    Debug.Log($"Scene {sceneBeforeLoading.name}, BI = {sceneBeforeLoading.buildIndex}");
    SceneManager.LoadScene(sceneName);
    var sceneAfterLoading = SceneManager.GetSceneByName(sceneName);
    Debug.Log($"Scene {sceneAfterLoading.name}, BI = {sceneBeforeLoading.buildIndex}");
}

Which outputs:

----------------------------------------------
Scene , BI = -1
UnityEngine.Debug:Log(Object)
Title:Start() (at Assets/Scripts/Title.cs:10)
----------------------------------------------
Scene Persistent, BI = 1
UnityEngine.Debug:Log(Object)
Title:Start() (at Assets/Scripts/Title.cs:13)
----------------------------------------------

sentences: How to destroy particles system after its work is over How can i stop particle system after player get destroyed

sentences:
The Correct Usage of DLLs with a DirectX Game? I'm using DirectX 10 (in C++) to make a game engine, and a test driver program on top of it.

Now that I've written many messy rough drafts of an engine, I want to make the final (or sorta final) clean version. I choose to follow how I've seen other engines do it, and that's to have all the core nasty messy crap in a DLL, and then you can create games with just a few functions (well, not really :D).

However, I'm unsure of what nasty messy crap to put in that DLL. I don't know about speed restrictions with DLLs. What I've done is put my winproc in the DLL, and have a class that takes the messages, and sends them through to the program using the DLL. Then that program does what it needs to do, and calls a rendering functions back in the DLL that renders everything.

Only problem is it gets very low FPS (2, to be exact...). I've looked through everything, and I don't know if the way I'm using DLLs in causing this, or its something different.

Whether it's the DLLs or not, I still want to know how to use a DLL correctly with a game engine. I like being neat, I hate having to see all those long names of DirectX classes. I use typedef a lot.

sentences:
2D HUD over 3D scene I'm trying to create a 2D Heads up Display for my players in a 3D OpenTK environment. How I'm doing it is by drawing my 3D elements and then running this code.

GL.MatrixMode(MatrixMode.Projection);
GL.Ortho(-0.5, 0.5, -0.5, 0.5, 1, 100);
GL.LoadIdentity();
GL.MatrixMode(MatrixMode.Modelview);
GL.LoadIdentity();
//Disable all depth stuff
GL.DepthMask(false);
GL.Disable(EnableCap.DepthTest);
GL.Disable(EnableCap.CullFace);
//Pass texture to shaders
GL.ActiveTexture(TextureUnit.Texture0);
GL.BindTexture(TextureTarget.Texture2D, TextureImg.Handle);
GL.Uniform1(GL.GetUniformLocation(Game.pgmID, "texUnit"), 0.0);
GL.Uniform1(GL.GetUniformLocation(Game.pgmID, "texture"), 1.0);
//Enable vertex attributes
GL.EnableVertexAttribArray(Game.attribute_vpos);
GL.EnableVertexAttribArray(GL.GetAttribLocation(Game.pgmID, "texcoord"));
GL.EnableClientState(ArrayCap.VertexArray);
GL.EnableClientState(ArrayCap.TextureCoordArray);
//MVP matrix is only translation of HUD position
Matrix4 c = Matrix4.CreateTranslation(new Vector3(Position.X, Position.Y, 0)) * Matrix4.CreateScale(0.1f);
GL.UniformMatrix4(Game.uniform_mview, false, ref c);
//Send vertices and uvs to shader
GL.BindBuffer(BufferTarget.ArrayBuffer, vbo);
GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(verts.Length * Vector2.SizeInBytes), verts, BufferUsageHint.StaticDraw);
GL.VertexAttribPointer(Game.attribute_vpos, 2, VertexAttribPointerType.Float, false, 0, 0);

Vector2[] uvs = new Vector2[]
{
    new Vector2(0,0),
    new Vector2(1,0),
    new Vector2(1,1),
    new Vector2(0,1)
};

GL.BindBuffer(BufferTarget.ArrayBuffer, vbo);
GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(uvs.Length * Vector2.SizeInBytes), uvs, BufferUsageHint.StaticDraw);
GL.VertexAttribPointer(GL.GetAttribLocation(Game.pgmID, "texcoord"), 2, VertexAttribPointerType.Float, false, 0, 0);
//Draw
GL.DrawArrays(PrimitiveType.Quads, 0, 4);
GL.UseProgram(Game.pgmID);
//Make sure I can render 3D again
GL.BindBuffer(BufferTarget.ArrayBuffer, 0);
GL.DepthMask(true);
GL.Enable(EnableCap.DepthTest);

It works exactly how it's supposed to, except the quad that I draw to the screen is slightly stretched out. It's annoying the absolute heck out of me, and I have no idea what I'm doing wrong.

Edit: Picture

sentences:
Cannot convert bitmap to texture I'm doing a little C# / OpenGL project and I can't manage to load textures properly.

So here is my texture class :

public class Texture
{
   public String Filepath;
   private int TextureID;

   public Texture(byte[] Filename)
   {
        Stream s = FileManager.FindTexture(Filename);

        if (s == null) return;

        Bitmap b = new Bitmap(FileManager.FindTexture(Filename));

        b.MakeTransparent(Color.FromArgb(255,0,255));

        //b = BitmapEx.Resize(b, b.Width * 2, b.Height * 2);

        //b.Save(DateTime.Now.ToFileTimeUtc().ToString() + ".png");
        //GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Nicest);

        GL.GenTextures(1, out TextureID);
        GL.BindTexture(TextureTarget.Texture2D, TextureID);

        BitmapData data = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

        GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba8, data.Width, data.Height, 0, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, data.Scan0);

        b.UnlockBits(data);

        GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
        GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
        GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureWrapMode.Repeat);
        GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureWrapMode.Repeat);

        if(!GL.IsTexture(TextureID))
        {
            throw new Exception();
        }

    }

    public void Apply()
    {
        if (TextureID != 0)
        {
            GL.BindTexture(TextureTarget.Texture2D, TextureID);
        }
    }
}

As you can see, my bitmap loads well from the stream. I tried to save it after it loaded into a my debug folder and every texture loaded saves. So I'm pretty sure this part is not the problem. But everytime I try to do GL.IsTexture it returns false, I tried to apply my textures either it doesn't work.

I've used a similar method in another project where it was working.

        Bitmap bitmap = new Bitmap("Data/UI/" + File);

        GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Nicest);

        GL.GenTextures(1, out Texture);
        GL.BindTexture(TextureTarget.Texture2D, Texture);

        BitmapData data = bitmap.LockBits(new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height),
            ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

        GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, data.Width, data.Height, 0,
            OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, data.Scan0);
        bitmap.UnlockBits(data);

        GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
        GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
        GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureWrapMode.Repeat);
        GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureWrapMode.Repeat);

I can't see why it is not working right now.

My textures are loaded way after OpenGL is initialized.

I'm using C# .NET framework 3.5 with OpenTK 1.1 ( Runtime 2.0.5, fresh out of their websites ).

Can someone give me a hint on why it is not working, please ?

Warm regards, Chaussette.

sentences: What is an axis aligned integer bounding box? In this paper, in the Distance field computation section, it says that an axis aligned integer bounding box of a Prism has to be calculated. Can someone explain what an axis aligned integer bounding box is and how can it be calculated for a Prism?

sentences:
XNA's SetData in a SharpDX Texture2D object in DirectX 11? I'm trying to load a texture given a swap chain, and then populate that texture with data. I already have some bitmap data (although not sure if it is in the correct format) that I want to populate the texture with.

However, XNA's SetData method of the Texture2D object is obviously not present in SharpDX. What do I do to populate my texture with data? I load the texture using the following code.

var texture = Resource.FromSwapChain<Texture2D>(swapChain, 0);

sentences:
An odd performance problem rendering a simple scene (less than 14k vertices) in OpenGL using two vbos with LWJGL Problem

I have been having a strange degrading performance issue rendering a simple scene containing two "chunks" of 4x4x4 cubes each.

Video of problem

This is a screen capture showing my console output, look specifically at the FPS dropping (which is the issue).

http://assets.cognitive.io/bugconsole.swf

Details about problem

My machine (a mid-2009 mbp 15") is on average using something like 10% cpu, but the machine is getting very hot to touch so I believe the graphics card is working very hard.

Someone else tested this code on another machine and experienced 100% cpu usage on a quad-core AMD cpu (on one core) and the same kind of performance problem.

I can't quite figure out what's going on, multiple people have looked at this and we are not getting any smarter.

Currently there is no frustum culling or any other sort of culling. I do not think that is the problem, I should be able to render a much much higher number of vertices without experiencing problems.

I have a list of chunks (ArrayList) that is created on start, not within the render loop, that generates a vbo and all that.

In my renderer I loop through the list of chunks and for each one I bind the vbo, setup some uniform variables and such before calling glDrawArrays().

I have a version of this where I only have one vbo (but then also only one cube per vbo/glDrawArrays call, very inefficient) where everything is working fine.

Thoughts and ideas

I believe the problem is something related to either VRAM filling up or me doing something incredibly wrong.

I've tried looking at my project with OSX's OpenGL profiler application, which has given me two different results:

First I was just using glBufferData each frame to pass the data, which resulted in 90% of the gl time spent being spent on CGLFlushDrawable().

After some advice from someone on #opengl on Freenode, it was suggested I should setup the vbo once with glBufferData, and then call glMapBuffer to pass the data after that.

This results in the same performance problem but 99% of the gl time being spent on glMapBuffer().

I was hoping someone had some advice for me, I would really like to just be able to continue learning opengl instead of being stuck debugging this performance issue for weeks.

Code on GitHub

The code is available at https://github.com/flexd/Game/tree/chunkrenderer (specifically the chunkrenderer branch!, you can see that the lighting2 branch works without the same performance issue).

The main game class is Game.java which contains the main method and it's also where I setup OpenGL.

Chunk.java, Cube.java, Renderable.java and ChunkRenderer.java are also of interest. Shader.java is where the shader class lives, but I doubt that has anything to do with the issues, it's basically the same shader as before.

Thanks in advance, I hope to be able to find the issue soon :)

Looking forward to being able to learn more of this.

PS: Let me know if I am posting this in the wrong place, I don't know if there's a opengl category that's better suited for this.

sentences:
Are commercial javascript games sensible? So I love javascript as a language and how it is able to be run anywhere. I'm gonna enumerate my concerns:

Does it make sense to make money from javascript? I mean, the second I publish my game online, people can download it, and post it on their own site and put their own ads into the game.
There are rumors that Facebook is working on an HTML5 platform. Still, even if you require the use of secret keys with your online part of the game, people can still just download the source code and implement their own online version. It's a little inconvenient, but the game itself didn't lose any value. They just need to build their own community now - which should be easy with a great game.
I don't have a smartphone, can someone explain if it's possible to view the source if I publish my game as a javascript application? (maybe it's wrapped into native code by the marketplace, I would appreciate the information)

I know Flash is somewhat similar, but it's my understanding that good obfuscators can effectively make the source code so ugly that it would be a mountain of work to modify.
Native games can be cracked too of course, but that doesn't mean they have the source code. They'll still rely on my online part and my updates to the game.

Tell me I'm not paranoid :)
How can someone justify spending resources on a javascript game?

sentences:
Unity custom camera projection only working in scene editor I've found this article on Gamasutra on a custom camera projection to make 3D look more 2D and decided to implement it to make some gameplay tests.
I had to make some changes to make it work on URP(on unity 2019.3.6f1) but it "worked" with the following code:
using UnityEngine;
using System.Collections;
using UnityEngine.Rendering;

// This script is meant to be attached to your main camera.
// If you want to use it on more than one camera at a time, it will require
// modifcations due to the Camera.on* delegates in OnEnable()/OnDisable().

[ExecuteInEditMode]
public class CustomProjectionTest : MonoBehaviour {
    private void OnEnable(){
        RenderPipelineManager.beginFrameRendering += ScenePreCull;
        RenderPipelineManager.endFrameRendering += ScenePostRender;
        //Camera.onPreCull += ScenePreCull;
    }

    private void OnDisable(){
        RenderPipelineManager.beginFrameRendering -= ScenePreCull;
        RenderPipelineManager.endFrameRendering -= ScenePostRender;

        GetComponent<Camera>().ResetWorldToCameraMatrix();
    }

    private void ScenePreCull(ScriptableRenderContext context, Camera[] cam){
        // If the camera is the scene view camera, call our OnPreCull() event method for it.
        OnPreCull();
    }

    private void ScenePostRender(ScriptableRenderContext context, Camera[] cam){
        // Unity's gizmos don't like it when you change the worldToCameraMatrix.
        // The workaround is to reset it after rendering.

        foreach(var camm in cam)
            camm.ResetWorldToCameraMatrix();
    }

    private Camera _cam;
    private void Start(){
        _cam = GetComponent<Camera>();

        // Set the camera this script is attached to to use orthographic sorting order.
        // Instead of using the euclidean distance from the camera, objects will be sorted based on their depth into the scene.
        _cam.transparencySortMode = TransparencySortMode.Orthographic;
    }

    public Vector4 up = new Vector4(0, 1, 0, 0);

    // This is a Unity callback and is the ideal place to set the worldToCameraMatrix.
    private void OnPreCull(){
        var cam = !Application.isPlaying? Camera.current : _cam;

        // First calculate the regular worldToCameraMatrix.
        // Start with transform.worldToLocalMatrix.
        var m = cam.transform.worldToLocalMatrix;

        // Then, since Unity uses OpenGL's view matrix conventions we have to flip the output z-value.
        m.SetRow(2, -m.GetRow(2));

        // Now for the custom projection.
        // Set the world's up vector to always align with the camera's up vector.
        // Add a small amount of the original up vector to ensure the matrix will be invertible.
        m.SetColumn(2, 1e-3f*m.GetColumn(2) - up);

        cam.worldToCameraMatrix = m;
    }

    public static Matrix4x4 ScreenToWorldMatrix(Camera cam){
        // Make a matrix that converts from screen coordinates to clip coordinates.
        var rect = cam.pixelRect;
        var viewportMatrix = Matrix4x4.Ortho(rect.xMin, rect.xMax, rect.yMin, rect.yMax, -1, 1);

        // The camera's view-projection matrix converts from world coordinates to clip coordinates.
        var vpMatrix = cam.projectionMatrix*cam.worldToCameraMatrix;

        // Setting column 2 (z-axis) to identity makes the matrix ignore the z-axis.
        // Instead you get the value on the xy plane.
        vpMatrix.SetColumn(2, new Vector4(0, 0, 1, 0));

        // Going from right to left:
        // convert screen coords to clip coords, then clip coords to world coords.
        return vpMatrix.inverse*viewportMatrix;
    }

    public Vector2 ScreenToWorldPoint(Vector2 point){
        return ScreenToWorldMatrix(_cam).MultiplyPoint(point);
    }

    private void Update(){
        if(Input.GetMouseButtonUp(0)){
            Debug.Log(ScreenToWorldPoint(Input.mousePosition));
        }
    }
}

Well, kinda. For some reason, it only works in the scene editor, but not in the game. I just have no clue why
With Scene Editor:

In Game

sentences:
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:
Blender support for Android I want to design 3D games for my android smart phone. Though I that two powerful game development software like Blender (under Linux) supports 3D game development. My question is:

How can a game developed under Blender can be exported to Android devices?

sentences:
Shader - Calculate depth relative to Object I am trying to calculate depth relative to the object.Here is a good solution to retrieve depth relative to camera : Depth as distance to camera plane in GLSL

varying float distToCamera;

void main()
{
    vec4 cs_position = glModelViewMatrix * gl_Vertex;
    distToCamera = -cs_position.z;
    gl_Position = gl_ProjectionMatrix * cs_position;
}

With this example the depth is relative to the camera.But I would like get the depth relative to the object. I would like the same depth and value if I am near from the object or if I am far.

Here is an example of what I am trying to achieve. On the left you can see that the depth is relative to the camera. And on the right even if the camera moves back from the object, the depth remains the same because it is dependant to the object.

sentences:
Procedural texturing with opengl I have a hexagonal grid of fields, each field has a certain terrain type. I assign every vertex of hexagon with terrain type and pass it as attribute to vertex and then fragment shader. Then I use the extrapolated value to blend terrain textures together.

For instance: 1 is grassy, 2 is desert.

Vertex shader:

varying vec2 vUv;
attribute float terrainType;
varying float vTerrainType;

void main()
{
   vUv = uv;
   vTerrainType = terrainType;
   vec4 mvPosition;
   mvPosition = modelViewMatrix * vec4( position, 1.0 );
   gl_Position = projectionMatrix * mvPosition;
}

Fragment shader:

uniform vec3 diffuse;
uniform float opacity;
varying vec2 vUv;
varying float vTerrainType;
uniform sampler2D map;
uniform sampler2D map1;

void main()
{
   gl_FragColor = vec4( diffuse, opacity );
   vec4 texelColor = texture2D( map, vUv ) * (2.0 - vTerrainType) + texture2D( map1, vUv ) * (vTerrainType - 1.0);
   gl_FragColor = gl_FragColor * texelColor;
}

Implementation is WebGL, if it makes any difference.

The result looks really unnatural, so is there any way to make it smoother and rounder?

sentences:
Jelly ground collision For fun I am trying to replicate the mechanics from The Floor is Jelly. So far I have successfully created "jelly islands/blocks" which are represented by an array of points and then drawn by using quadratic curves between the points. I am also able to get the jelly effect by having each point hold a velocity value as well as a relationship with its neighboring points to allow the springyness effect.

The above works well and gives a good representation of how the actual game seems to do it.

The part that I am kind of stuck on is how to resolve collisions with the character. I can successfully detect when my character (currently just a square represented by 4 points) comes into contact with the jelly island. However, I cannot think of an efficient way to make it "stick" to the ground and then smoothly interpolate along the curve once a force is applied to the jelly that causes it to move. Also, I want the character to stick to the ground unless the user "jumps" which means that the character should follow the ground through it's wobbles rather than go up into the air.

I could pass the character controller the array of points representing the island that it is currently colliding with, but then iterating through all of the points and finding the points closest to the character seems like a lot of work to do on each frame. In addition I am still not sure how I would get the correct position of the character along the curved ground (particularly when it is wobbling).

Any suggestions are appreciated

Update

Clarification as I fear that I wasn't clear enough above. What I mean when I say that I can successfully detect when my character comes into contact with the jelly island is that I am currently using the Point in Polygon algorithm to detect when the jelly island is not moving/wobbling this breaks of course once the jelly island has a force applied to it.

To fix this I have been looking into breaking the island into many line segments along the curves (how collisions with quadratic/bezier curves are usually handled), but I'm afraid that this will be too much work to do on each frame. In addition I am still stuck on the problems described above.

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:
Box2d Fixed Timestep and Interpolation I am using libGDX and I have problems implementing the box2d fixed timestep with interpolation.

This is my code:

private void updateWorld() {

    accumulator += Gdx.graphics.getDeltaTime();

    while (accumulator>= step) { // The step is 1/10

        copyCurrentPosition();

        world.step(step, 8, 3);
        accumulator -= step;
    }

    interpolate(accumulator / step);
}

private void copyCurrentPosition() {
    prevPosition = new Vector2(player.body.getPosition().x, player.body.getPosition().y);
}

private void interpolate(float alpha) {
    player.body.setTransform(player.body.getPosition().x * alpha + prevPosition.x * (1.0f - alpha), player.body.getPosition().y * alpha + prevPosition.y * (1.0f - alpha), 0);
}

sentences:
Minimap Around Perimeter of Screen, Code Provided What I'm essentially trying to do is what a lot of FPS's nowadays do in regards to their HUD.  When an objective is off-screen, a small icon / symbol is shown on the perimeter of the screen, basically pointing towards the objective.

I'm working in 2D and I'm trying to get offscreen enemies (top-down) to show their positions via small points around the perimeter of the screen (a rectangle view, pretty standard).

Simply put, I'm trying to find the value of the red point when everything else is known:

Here's my code, and while it seems to be half functioning, sometimes it'll do funny things.

// Scan through enemiesRef list, and update dots to draw.
// ------------------------------------------------------
Enemy enemyRef;
float a, b, x, y;
float screenRatio = frustumWidth / frustumHeight;
float minX = topLeft.x;
float maxX = topLeft.x + frustumWidth;
float minY = topLeft.y;
float maxY = topLeft.y + frustumHeight;

// Loop through each enemy.
// ------------------------
for (int i = enemiesRef.size() - 1; i >= 0; --i)
{
    enemyRef = enemiesRef.get(i);

    // Get x and y distance to the enemy.
    // ----------------------------------
    x = enemyRef.position.x - center.x;
    y = enemyRef.position.y - center.y;

    // Check if the enemy is on-screen and skip.
    // -----------------------------------------
    if (Math.abs(x) < halfFrustumWidth && Math.abs(y) < halfFrustumHeight)
        continue;

    // Determine the known variable and derive the unknown.
    // ----------------------------------------------------
    float ratio = Math.abs(x) / Math.abs(y);
    if (ratio >= screenRatio)
    {
        // The a is known, the dot is on either the left or right.
        // -------------------------------------------------------
        if (enemyRef.position.x < center.x)
            a = minX;
        else
            a = maxX;

        // Calculate b.
        // ------------
        b = a * (enemyRef.position.y / enemyRef.position.x);
    }
    else
    {
        // The b is known, the dot is either on the top or bottom.
        // -------------------------------------------------------
        if (enemyRef.position.y < center.y)
            b = minY;
        else
            b = maxY;

        // Calculate a.
        // ------------
        a = b / (enemyRef.position.y / enemyRef.position.x);
    }
}

It seems the code accurately detects whether the point should be on the top / left / bottom / right, but if the object is far enough off screen (as in, it's both past the upper boundary of the view and the left boundary view at the same time, for example), the dot on the map just flies off the screen (for example, to the left, it's x coordinates going into negatives).

I believe the error lies somewhere in calculating a or b:

a = b / (enemyRef.position.y / enemyRef.position.x);
b = a * (enemyRef.position.y / enemyRef.position.x);

Whether it be with the signs of the values, or if the values I'm calculating are just wrong, etc, I don't know.

sentences:
Looking for the name of the tap handle with four 'spokes' I am looking for the name of this sort of tap handle. This is a screenshot of it in the game Monument Valley. It has four spokes and can be rotated, behaving as one would expect of a similar design on a bathroom tap releasing water.
It was during a game design class, that I am no longer a part of, where the teacher told us that there was a specific name for that sort of tool. But I have forgotten the name and I was wondering if anyone might know.
I tried searching things like "tap handle name", "tap handle four spokes name game design", but couldn’t find the term for it. I was expecting it to not just be limited to game design, since, in that lesson, the teacher also mentioned the book The Design of Everyday Things by Don Norman and I was thinking that it might be used as a general term for those types of tap handles. (He mentioned the book for the term "affordances" (which I had heard of before), in the context of the tap handle looking like what it does, and relying on that familiarity of users likely having seen those sorts of tap handles in their everyday lives before). But I also couldn’t find the name when I added the term "affordances" to the search.

sentences:
Game logic in mvc: model or controller? Sorry if the title is too broad, I'll try to explain this in a more specific way down here.

We need to create a board-game in Java for an University project and we have to use the mvc pattern for it.

We found helpful to view this board game as a Finite State Machine, so we implemented a slight variation of the State pattern, where the context is the Controller and each state manipulates the model in different ways using commands from the Command pattern.

The states are also responsible to get the user input needed to perform their logic from the view, by displaying widgets and getting the user selection.

So for now, the Model is just a "box", a stateless container of data without any game-logic in it. We had a discussion with our tutor and he frowned us upon because he said we were deviating from the OOP approach.
For example, we have cards in the game which give different effects; in our implementation, we have an "Effect State" which is handling the different effects by controlling their type:

if (effect.type == RESOURCE){
    Command c = new GiveResources(player, effect.resources);
    c.execute();
}else if (effect.type == BONUS_ACTION){
    controller.state = BONUS_STATE;
}...

Whereas he would so something like:

effect.execute(controller);

By passing the controller as a "callback" (forgive me the improper usage) to get inside the effect the input needed to perform its execution.

Now, I understand that our approach is violating in some way the Separations of Concerns principle, by putting game logic in the controller and outside the effects. But, considering that the set of effects is limited (that's why we chose the enum approach), isn't going back and forth between model and controller introducing way too much overhead? Or should the model "own" the game-logic (relating to this question, substituting the boolean with a State field) and call the Controller every time it needs user input?

sentences:
matrices and nesting hierarchy with game objects Let's say we have some game objects and they are nested to form a tree:

- A
  - B
    - C
  - D

If each of those have a matrix for the scale, rotation and translation, is it then easier that they inherit the properties from the parent as well or not?

If I do make them inherit from the parent then:

+ If I wan't to test if a point is inside C then I can get the inverse matrix and do a test.
  No need to worry about the matrices of A and B.

+  I can draw C directly for example without the need of applying the matrix of A and B.

If I don't make them inherit:

+ rotating C is more easy for example, cause there is no need to subtract from the parent to get correct values.

+ translating one specific entity is more easy cause there is no need to update the children.

- Testing if a point is inside for example is harder, cause all the matrices up to the root of the be applied.

What is more common / recommended? I'm guessing it makes more sense that children don't inherit from the parent but just start with a identity matrix instead.
If someone knows how blender is doing this then please tell me.

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:
Client-side physics simulation I am trying to create a very simple client-server based physics game, using box2d library. A simple football game.
Obviously, the server runs only the box2d world.
My question is:
is it correct to state that the client should run not only the needed rendered simulation but another box2d world as well?

I ask this because I know that the client should receive state information of the elements that have a changing state. And this information is received in packets every few ticks. And between every packet received, there's a time gap where I need to run the world like "nobody did nothing", and then correct the world state if somebody did something after I received the next packet.
That is why I need to run the box2d world in the client as well, but I feel it's kinda awkward and assymetrical.

Is this right? Is box2d prepared for this?

sentences:
How to calculate rect-moving-in-a-curved-path collision detection I'm trying to find the best way to use collision detection for a rect moving in a curved path:
here is example of what i have

I found few methods and I have hard time to find what is the best way.
I have the pure calculation method that is here:
http://devmag.org.za/2009/04/13/basic-collision-detection-in-2d-part-1/
and I also have the pixel perfect method that is here:
http://blog.muditjaju.infiniteeurekas.in/?p=1

I'm using cocos2d-x but it can be in any engine or language.  What is the best method for this?

sentences:
Game Maker not recognizing variable Attempting to set up a targeting array for a MMO-style game in GameMaker8 Pro, I have this code in the create event for the player's character, which is and has been running perfectly fine:

j = 0
i = 0
g = 0
for (i=100000; i<1000000; i+=1) if instance_exists(i) {if i.object_index = enemy         {global.ttarget[j] = i j+=1}  if i.object_index = rk or i.object_index = sage    {global.etarget[g] = i g += 1}}
global.rmtargets = j
global.etargets = g

Then running this code in the step event for the player character:

h = 0
g = 0
i = 0
for (i=0; i<global.rmtargets; i+=1) global.target[i] = 0
global.target[0]=101139
for (h = 0; h<global.rmtargets; h+=1){hv = -1
for (g = 0; g<global.rmtargets; g+=1){if global.ttarget[g].range > hv {hv =    global.ttarget[g].range}}
global.target[h] = hv
global.ttarget[h] = -1}

Returns this error message:

ERROR in
action number 1
of  Step Event
for object rk:

Error in code at line 8: for (g = 0; g hv {hv = global.ttarget[g].range}}
at position 61: Unknown variable range

Even though I have this in the create event for the enemy:

range = 0
range = distance_to_object(rk)

And I've used this sort of syntax all over:

global.target[target].threat[s] += damage

Help? Any ideas why Game Maker won't recognize the variable?

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:
save a particular area of the scene as screenshot in unity I need to save a particular part of the scene as screenshot. I have done a sample to show the particular part of the scene.

When I click on the rectangular area the selected area will being shown on the screen on a texture (marked in red rectangle):

But when I save, the whole scene is getting saved but not the selected part:

Here is code:

Texture2D screencap;
Texture2D border;
bool shot=false;
public string path;

void Start () {
     screencap=new Texture2D(300,200,TextureFormat.RGB24,false);
     border=new Texture2D(2,2,TextureFormat.ARGB32,false);
     border.Apply();
}

// Update is called once per frame
void Update () {
    if(Input.GetKeyUp(KeyCode.Mouse0))
    {
        StartCoroutine("Capture");
    }

}
string fileName(int width, int height)
{
    return string.Format("screen_{0}x{1}_{2}.png",
                         width, height,
                         System.DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss"));
}

void OnGUI()
{
    GUI.DrawTexture(new Rect(200,100,300,2),border,ScaleMode.StretchToFill);
    GUI.DrawTexture(new Rect(200,300,300,2),border,ScaleMode.StretchToFill);
    GUI.DrawTexture(new Rect(195,100,2,200),border,ScaleMode.StretchToFill);
    GUI.DrawTexture(new Rect(500,100,2,201),border,ScaleMode.StretchToFill);

    if(shot)
    {
        GUI.DrawTexture(new Rect(50,10,60,40),screencap,ScaleMode.StretchToFill);
        //Application.CaptureScreenshot(myFolderLocation+myFilename);
    }
}

IEnumerator Capture()
{
    yield return new WaitForEndOfFrame();
    screencap.ReadPixels(new Rect(198,98,298,198),0,0);
    screencap.Apply();
    shot=true;

    byte[] bytes=border.EncodeToPNG();
    string filename=fileName(Convert.ToInt32(screencap.width), Convert.ToInt32(screencap.height));
    Application.CaptureScreenshot("D:"+filename);
}

How can I save only the particular part in unity,can anybody please help me out.

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:
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: Accessing the child sprites of a sprite sheet in unity? I have a spritesheet set up with the individual sprite regions named in unity. I haven't been able to find out how to access these sprites by name?

sentences:
Finding shortest path on a hexagonal grid I'm writing a turn based game that has some simulation elements. One task I'm hung up on currently is with path finding. What I want to do is move each turn an AI adventurer one tile closer to his target using his current x,y and his target x,y.

In trying to figure this out myself I can determine 4 directions no problem by using

dx = currentX - targetY
dy = currentY - targetY

but I'm not sure how to determine which of the 6 directions is actually the "best" or "shortest" route.

For example, the way it's setup currently, I use East, West, NE, NW, SE, SW but to get to the NE tile I move East then NW instead of just moving NW.

I hope this wasn't all rambling. Even just a link or two to get me started would be nice. Most of the info I've found is on drawing the grids and groking the weird coordinate system needed.

sentences:
How to model vehicle driving physics? How to model the physics of a car in a racing game?

In real life, vehicle movement is inherited from the wheels. But after reading a few articles on the subject (a lot of which are 10 years old), I realize that the 'real world' physics is in fact often faked with various equations and constants.

I want to create custom driving model to learn about it mostly, but I don't want to start wrong so that's why I am here.

sentences:
Unity sidescroller with 3D objects/environment. Should I create a 2D or 3D project? I'm looking to make a side-scroller in which the camera and all objects can only move in the x and y directions.  However, I'm going to have all objects and environments as actual 3D models.

Is it better to create a 2D project and just use 3D models, or should I create a 3D project and mess with the scripts to only allow x/y movement of objects and the camera?

Or does it not really matter?

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:
Does Unity Pro Play Nice With 'Small' Teams Does anybody know how well Unity Pro plays well with-in small teams?
Our team makeup is 2 programmers, 1 audio, and 2 graphics peps.

How easy is it for somebody to mess up a Unity project? The graphics and audio people will likely only have a simplistic knowledge of Unity, and mainly in regards to only there area.

Do the graphics/audio even need access to the Unity editor?

I've seen the Asset Server and it seems like a very bare bones versioning system.

Before people start telling me that they should just learn it (as I agree) this is a rather last minute student prototype project.

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:
Hiding UIs behind a custom image shader Is there a way to hide UIs such as text, images etc. behind another transparent image? The problem is that I am using the latest Unity version and these custom shaders have no effect on hiding the UI shaders. The two custom shaders I have applied for testing are:
Shader "Custom/DepthReserve"
{
    Properties
    {
    }
    SubShader
    {
        Tags { "RenderType" = "Opaque" "Queue"="Geometry-1" }
        LOD 100

        Blend Zero One

        Pass
        {

        }
    }
}

Shader "Custom/InvisibleMask" {
  SubShader {
    // draw after all opaque objects (queue = 2001):
    Tags { "Queue"="Geometry+1" }
    Pass {
      Blend Zero One // keep the image behind it
    }
  }
}

So is there a way to use a transparent image to hide text, images and even gameobjects?

sentences:
Unreal installation and storage space requirement I am a new user of Unreal. I installed the program on Windows 7, and after using it for awhile I noticed that the C:/ partition was filling up very fast as I worked on my projects. I store my projects on a storage device different than the one with Windows- does Unreal nevertheless write files related to a project to C:/ and if it does, can such a setting be changed?

I am upgrading to Windows 10. Is there any difference in the behavior explained above between the two Windows versions? Is there any rule of thumb about how much there should be free space on the C:/ partition for Unreal to work with, regardless of where projects are stored?

sentences:
Why doesn't glBindVertexArray work in this case? From my understanding of what glBindVertexArray does and how it works, the following code should work fine:

First init:

    glGenVertexArraysOES(1, &_vertexArray);
    glBindVertexArrayOES(_vertexArray);

    glGenBuffers(1, &_buffer);
    glBindBuffer(GL_ARRAY_BUFFER, _buffer);
    glBufferData(GL_ARRAY_BUFFER, kMaxDrawingVerticesCount*sizeof(GLKVector3), NULL, GL_DYNAMIC_DRAW);

    glGenBuffers(1, &_indexBuffer);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, kMaxDrawingVerticesCount*1.5*sizeof(GLuint), NULL, GL_DYNAMIC_DRAW);

    glEnableVertexAttribArray(GLKVertexAttribPosition);
    glVertexAttribPointer(GLKVertexAttribPosition, 3, GL_FLOAT, GL_FALSE, sizeof(GLKVector3), BUFFER_OFFSET(0));

    glBindVertexArrayOES(0);

And later add new geometry:

glBindVertexArrayOES(_vertexArray);
glBufferSubData(GL_ARRAY_BUFFER, 0, (GLintptr)_data.vertices.length, _data.vertices.bytes);
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, (GLintptr)_data.indices.length, _data.indices.bytes);
glBindVertexArrayOES(0);

However, it doesn't work (there is screen output, but it looks like the buffers were changed between each other). Binding the vertex array is not enough for the vertex/indices buffer to get bound? Because, if I do this:

glBindVertexArrayOES(_vertexArray);
glBindBuffer(GL_ARRAY_BUFFER, _buffer); <-- note this line
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer); <-- note this line

glBufferSubData(GL_ARRAY_BUFFER, 0, (GLintptr)_data.vertices.length, _data.vertices.bytes);
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, (GLintptr)_data.indices.length, _data.indices.bytes);
glBindVertexArrayOES(0);

Everything works/looks as expected. I find it strange, since the vertex array should have taken care of the buffer binding. Otherwise, what's the purpose to have a vertex array if you still have to bind all the buffers?

sentences:
Tool for creating complex paths? I want to create some fairly complex 2d predefined paths for my AI sprites to follow.

I'll need to use curves, splines etc to get the effect I want.

Is there a drawing tool out there that will allow me to draw such curves, "mesh" them by placing lots of points along them at some defined density and then output the coordinates of all of those points for me?

I could write this tool myself but hopefully one of the drawing packages can do this?

Cheers!

sentences:
How to avoid assigning the same GameObject individually for every prefab? In many times, prefabs that share the same script may require the same GameObject in the script. For example, in my game I want to make a series of card prefabs. Each card has their own image when shown, but has the same back image when hidden. My script for card is:

public class DraggingCard : DragAndDropItem
{
    public Sprite secretSprite; //This is the same for every card
    Sprite oringinalSprite; //This is individual for every card
    Image image;

    public void Awake()
    {
        image = GetComponent<Image>();
        oringinalSprite = image.sprite;
    }

    public void Activate()
    {
        image.sprite = oringinalSprite;
    }

    public void Hide()
    {
        image.sprite = secretSprite;
    }
}

But if I write this, I'll have to assign the secretSprite in the inspector for every DraggingCard prefab. I tried to set secretPrefab to be static or const but neither worked.

I believe there must be a clever way to avoid the repeat work. Could anyone tell me that? Thank you!

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:
How to create a MessageBox in OpenGL using C++ I have a game that needs results displayed upon exit with a messagebox. I have the following code that works but I need to add an integer variable to the text.
This works:

MessageBox(NULL, L"Description\nline2", L"Info", MB_OK | MB_ICONEXCLAMATION);

But I need to say: "Description:" + num

I tried to pass a string but it won't compile:
MessageBox(NULL, L(string), L"Info", MB_OK | MB_ICONEXCLAMATION);

sentences:
Limit rotation angles for Quaternion I have a short snippet that's rotating the meshes of the wheels as I'm driving forward, but it's also rotating wheels to match the direction I'm turning, and I wish to turn this off completely.

        Quaternion quat;
        Vector3 position;
        m_WheelColliders[i].GetWorldPose(out position, out quat);
        m_WheelMeshes[i].transform.position = position;
        m_WheelMeshes[i].transform.rotation = quat;

How would I lock what angles I don't want the wheel meshes rotating?

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 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:
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:
How can I change existing hierarchy in Unity regarding animations? I made a bunch of animations in Unity.  Now I need to adjust the hierarchy.  For example:

My animator used to change things in this tree, where the head, legs, and arms were animated:

Player
-->Torso
----->Head
----->Arms
----->Legs

Now I added another layer in my hierarchy so that it is:

Player
-->Body
----->Torso
-------->Head
-------->Arms
-------->Legs

And it cannot find the existing animation, since the hierarchy path is different.  How can I insert the body in my animation hierarchy so that I can keep my new hierarchy without having to redo all of the animation?

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: How much memory does a texture take up on the GPU? A large png on disk may only take up a couple megabytes but I imagine that on the gpu the same png is stored in an uncompressed format which takes up much more space. Is this true? If it is true, how much space?

sentences:
Why do these textures tile rather than just overlap? It might help to provide all the details, so here is the YouTube tutorial which sparked my question.

There's a prefab of the background tile called "Tile Background." This prefab has the default settings, except that Pixels Per Unit is set to 512, and that it has a script attached to it called BackgroundTile which hasn't even been opened. It's just there for the other script to reference.

An empty object was created called Board, which has Tile Background as its tile prefab. It also has a script, Board.cs, the contents of which are here:

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

public class Board : MonoBehaviour
{
    public int width;
    public int height;
    public GameObject tilePrefab;
    private Backgroundtile[,] allTiles;

    // Start is called before the first frame update
    void Start()
    {
        allTiles = new Backgroundtile[width,height];
        Setup();
    }

    private void Setup() {
        for(int i = 0; i < width; i++) {
            for(int j = 0; j < height; j++) {
                Vector2 tempPosition = new Vector2(i, j);
                Instantiate(tilePrefab, tempPosition, Quaternion.identity);
            }
        }
    }
}

Width is set to 4. Height is set to 7.
Other than that, the camera position is X:1.5,Y:3 and the aspect ratio is 9:16.

My question is this: why, when this is run, does Vector2(i,j) get interpreted as tiling the sprites, rather than placing the sources of the sprites in a 4x7 pixel grid, where they overlap almost entirely? There's no place where their positions get multiplied by the size of the tiles, right? Halving the pixels per unit doesn't even just halve the height of the board - it stays a constant size and looks really weird, despite the board not having set dimension attributes.

What's going on here?

sentences:
Configure unreal engine to run faster I don't have a dedicated GPU on my laptop and would like to know which settings to change in order to get semi decent performance. I don't care if the 3D camera will render everything pixelated.

At this moment when I try and run the First person shooter demo it will run around 40fps and when shooting the gum the  frame rate drops to around 25fps.

I think my CPU is pretty descent for an laptop. Its an i7-3667U & I have 16gb ram. Intel HD Graphics 4000. Also I already have unreal installed on my SSD.

My goal is development only and I will use low poly models when 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:
Special moves using mouse movement? Recently, I accidently broke my PC controller and I was forced to play Skullgirls using the keyboard. Needless to say, it sucked. Fighting games are the kind of games where a controller is (almost objectively) better to use than a keyboard, just like how keyboard + mouse is better to use for FPS games than a controller. Keyboards just don't allow the same freedom a controller offers for fighting games, especially because of the analog stick.

So while I was getting my *** kicked and (of course) blaming only my keyboard instead of myself, I had an idea: why don't fighting games use the mouse, too? Couldn't the mouse movements be used as the directional input for the special moves instead of the arrow keys? Examples:

Hadouken - quick flick with the mouse into the direction you're facing
Shoryuken - a steep upward curve towards the direction you're facing
Roundhouse kick - a quick circle motion

What are the advantages and limitations using the mouse in such a way? Are there any examples out there? Maybe there are some limitations I'm not seeing right now? To me, this looks like a way to give players the same freedom in fighting games with keyboard + mouse as a controller would provide, so I'm surprised I don't see more fighting games with that control option.

sentences: How can I set up a loading screen in Panda3D? How would I go about using Double Buffering (to create a loading screen) in Panda3D using C++? I've searched Google and found some forums that talk about the concept of swapping buffers, but I haven't seen any that show any type of source code (specifically Panda3D/C++). I'd like to try and stay away from using pure OpenGL code and work it through Panda3D, but if I have no other choice, then I'll have to go with OpenGL coding.

sentences:
Isometric Map with different Z-axis values I want to create a isometric tile map editor just like the one shown in the images ( pictures are from the game Zoo Tycoon ).
I know how to render the tiles when there is only one Z value ( zero ), but I have no clue how I could archieve something like in the pictures where you can raise certain tiles in 1/2 unit steps, either creating a sharp edge/cliff or a smooth transition.

Can anyone give me some good reference materials or help me out here? Thanks in advance :)

Oh yea and you can also rotate the view by 90 in any direction like this:

EDIT :

I am using SFML with C++ for this project. There I am creating an array of vertices, 4 of which represent an quad/tile in the map. In SFML each vertex has two main properties, a position in space and a position in the texture mapped to it. I adjust the first one based on the simple projection formula. The textures are represented in a simple tileset. I simply calculate the corresponding 4 edges of a tile in the texture based on a level data array that contains the number of the tile in the texture, starting from 0.

Here's a very very simple tileset that I made myself

Here's how this looks so far:

Oh yea and this is how far I come with rendering different z values. The 4 tiles on the top right are raised 1 unit. But as you can see the faces of the blocks are incomplete. I don't know how I draw them yet.

UPDATE :
I managed to display sharp edges correctly now, even though it's really unoptimised (I am drawing every front-facing face of the blocks, even the ones that are covered by others. Any tips on how I can prevent this?)

sentences:
coloring box2d body in LibGDX I want to color polygon of box2d in LibGDX. Found below useful class for that.

http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/glutils/ShapeRenderer.html

But, it is not coloring the body instead making colored shapes. I want colored bodies having all the property like gravity, restitution etc. In brief, I want to make colored ball and surface.And i don't want to attach sprite on bodies. Want just fill color in bodies.

Need some guidance????

sentences:
How to calculate the vector of an interception? Given are a twodimensional space, and 1 friendly spaceship standing still, one foe is moving NOT directly to the friendly ship with known actual position, speed and direction.

The friendly ship wants to get itself into firing range to battle the foe.

Actually I am setting just a direct vector to the actual position moving ship, and recalculate it every frame, resulting in some kind of "round" flightpath.

What I want is to set a direct and straight path to the position that the foe will (presumably) will have when firing distance will be reached, assuming that foe will not change course until then.

As a first and "simple" implementation it would be enough if we assume the friend can speed up from 0 to max in no time.

Preffered implemantation would be one that considers the acceleration capabilities of the friend, and knows when interception is impossible because of the speed. It should work for every starting speed, not only from stand still. A plus would be if it even considers braking (battling at lightspeed is very energy inefficient in the given universe)

sentences:
How can I get a list of sprites which are being drawn in the current viewport using XNA? Just starting out using XNA to draw 3D scenes and have a question about determining which objects are currently visible.

If I load many thousands of sprites and shapes in a scene, then render the current view from a camera, is it possible to actually find (e.g. list to a text file) the IDs of those visible objects?

I guess another way to ask this is to say: how can I get a list of objects (e.g. sprites) which are being drawn in the current viewport?

sentences:
Scripting Language for Java and its uses? So I am going to work on a Java game and recently my friend suggested I use a scripting language to help development go smoother/faster.

so far I used XML as data storage and to make the HUD/UI but he recommended I learn Ruby, Python, Groovy, and/or Lua.

he Strongly recommended Lua for the same thing i use XML for.

basically what my question is :

What are scripting languages, what are they for,, should I use a scripting language, whats the difference between said scripting languages and XML, and which one should I learn and use for my java game?

sentences:
Ground hitting system I want to know how to make character hit ground and lose health. For example: when character is falling of one meter he losing only a small part of his health, and when he's falling of 10 metters he dying.

I just want to know if it's about speed or distance or maybe even time? (If you can implement some code. please.)

P.S. I'm planning to use SFML and C++.

sentences:
How to simulate backspin or topspin in a box2d billiard game? I am designing a simple billiard game with box2d. I think I can easily simulate hitting left or right side of a ball. Since box2d is not 3D, however, I am not sure how to simulate hitting upper or lower part of ball with a cue.

In case you are not familiar with the game. If the ball is hit on its upper part, it's still going forward after hitting another ball. But when cue hit on its lower part, it should backspin as soon as striking another ball.

Is this simulation possible with box2d? If so, a hint or reference will be appreciated.

sentences:
What is eigenvalue decomposition and why would it be useful in games? In various math libraries developed for game engines, I see 2x2 and 3x3 square matrices having this function (along with some helper functions). I tried to find information regarding it but did not come across game specific material (wikipedia entry is quite heavy and does not relate to games).

It would be great if in your answer, you could provide an example or two on how it is used in games.

sentences: How to remove a scene after the another one has loaded ]2[]3I'm having this problem in Unity where I load a new scene, but the original is still overlapping it. How would you remove the original scene?

sentences:
Swinging a sword in Xcode with Sprite Kit I'm working on making an RPG in Xcode, and I'm having a major gameplay issue when it comes to having my character swing his sword in a way that is realistic and gameplay compatible.

Right now, when the player taps the screen and the sword is in one of the player's hand, it rotates the upright sword 90 degrees.  The sword which is a parent of the player floats in front of the player because of a collision issue

I'm looking for any advice anyone can give on how to add a sword to the game and have it swing in a way that looks somewhat realistic and can damage enemies that are more than a single pixel away from the player

sentences:
Collision physics error I am working on a game developed using Scenekit (iOS). I am facing some strange issues with collision physics.

I have added one 3D table (with a hole at its center) to the scene. I am setting physics shape of this 3D model using following code:

SCNBox* tableBody = [SCNBox boxWithWidth:(5*golf.scale.x) height:(0.5*golf.scale.x) length:(9*golf.scale.x) chamferRadius:0];

table.geometry = tableBody; //table geometry

//physics shape scale
NSValue *shapeScale = [NSValue valueWithSCNVector3:SCNVector3Make(table.scale.x, table.scale.y, table.scale.z)];

//physics shape options
NSDictionary *shapeOptions = [NSDictionary dictionaryWithObjectsAndKeys:shapeScale,SCNPhysicsShapeScaleKey,SCNPhysicsShapeTypeConcavePolyhedron,SCNPhysicsShapeTypeKey, nil];

//physics body
table.physicsBody = [SCNPhysicsBody bodyWithType:SCNPhysicsBodyTypeStatic shape: [SCNPhysicsShape shapeWithNode:table  options:shapeOptions]];

I am adding one 3D ball on top of this table.

Issue:
The Ball collides with 3D table mesh triangles and changes directions

Image showing 3D table's physics shape:

I have following questions:

How can I stop collision of ball with these lines?
Are there any modification to the physics can be done? I want the hole to be part of the physics shape so that the ball can fall into the hole.

I would appreciate any suggestions and thoughts on this topic. Thank you.

sentences:
Fastest 3D collision detection between two oriented bounding boxes (OBBs) I am at the point in my game where I need to add a collision system. I tried jBullet, and while it did work, it wasn't what I was looking for. I just want a simple way to test if two oriented bounding box (OBB) trees are colliding.

I was going to do collision by using the tree.  Make an AABB for broadphase, then if that passes test if each OBB in tree collide with the other tree.

I did find a few things on the internet, but I couldn't understand them completely. What I am asking for is a website or resource that explains 3D OBB collisions well?

I learned that GJK is faster than SAT, and it appears to be able to tell me how far the boxes penetrate each other. I found some GJK stuff, but they were not boxes; instead, more complex and confusing things.

I just want to be able to make an OBB from 3 vectors: center, size, and rotation of each axis. Then be able to test collisions with those. Thank you in advance for anything you post.

sentences:
Load the prefab in the array by name in Unity I'm using this line of code to select my level, and currently I have different scenes for each levels. I want to be able to reuse the same scene to change levels as well but I don't know how, here's the line:

button.GetComponent<Button>().onClick.AddListener(() => Levels("Level " + button.levelText.text));

Since I'm using string to load my scene with the function below:

void Levels(string value)
{
    SceneManager.LoadScene(value);
}

I really wish I could use prefab name instead the scene name and I don't want to have 20 scenes for it. Any help would be appreciated.

sentences:
Storing Type/Game Data Within A Unity 3D Game Using An Offline Flatfile Database I've read several documents on how to manage game type data:

Would it be better to use XML/JSON/Text or a database to store game content?

How to choose how to store data?

Im developing an offline RPG game in Unity3D. I've made online games before, but with online we had an edge for the database. For the online game we used a MySQL database each time the player loaded the game, they would download the database (JSON setup) and we would parse it on the client side and it would be good to go.

However for an offline RPG I don't have the luxury of storing my game type data online. To be clear when I say type data I mean things like:
-Monster tables
-Item tables
-Ability tables
etc

What I liked about the MySQL database was that it was tabluar and I could edit rows and columns easily and not need to create hundreds of classes/subclasses to manage the type data.

My question is how can I mimic the MySQL database in Unity3D?

I considered using an excel file but I feel that would be so easy for the user to hack. Just change the excel data and boom, you've hacked the game.

Is there a way I can create an offline (secure-ish) flatfile database that will let me avoid having to create tons of type data class files to manage all my game data?

sentences:
What would be a fast way of detecting collision between 2 2d rotated rectangles? Currently I am following this tutorial here for 2D collision detection:
http://www.gamedev.net/page/resources/_/technical/game-programming/2d-rotated-rectangle-collision-r2604

I have found that the way of converting the projected vectors to a scalar value doesn't seem to be correct and there are false reports of collision. I tried to only take the projected x value and using that as a scalar however this runs into the rare corner case of when the axis is pointing up the x values are all 0.

If there is a way to solve this problem it would be great. All help is appreciated.

sentences:
Button stays highlighted after being clicked - Unity3D 4.6 GUI Sometimes, after clicking a button created by unity's new UI Button, the button stays in its highlight state. Note that Button script has Color Tint set as it's Transition property and the Interactable checkbox is checked.

How can I solve this?

sentences:
How can I implement hexagonal tilemap picking in XNA? I have a hexagon tiled map in which I need to check when a hexagon is clicked. The hexagons aren't actually touching, rather they have a slight gap in between each of them.

Does anyone know how could I go about checking whether a hexagon is clicked without over complicating the whole thing?

sentences:
FixedUpdate or Subroutine So Update is called every frame while FixedUpdate is called on Physics time, which can be modified.

Is it better to depend on FixedUpdate to have optimized game loop so that everything doesn't get called so much.
OR
Is it better to write a coroutine to Update/FixedUpdate and set things there?

public void Start(){
   StartCoroutine(MyIntervalMethod());
}

 void MyIntervalMethod(){
   for(;;){
   yield return new WaitForSeconds(.2f/*or whatever time interval is suitable here*/);
   }
}

sentences:
Nested Entities in Entity Component Systems (ECS) Say I have an entity that has these components:

-Transformation

-Visual

Imagine that these components can nest:

If I have a parent transformation component, a child transformation relies on the parent transformation data.

Similarly, if I have a parent visual component, a child visual component may rely on the parent visual data.

Suppose we have two entities that both have a visual and transformation component. Say we have a concept of composing the entities themselves: which requires us to compose their respective Transformation and Visual components in some way.

Where would that logic go? Using pure ECS, these entities' components would be registered to their respective systems, but not amongst each other- Would I have to create a new system that houses the logic for composing entities that have certain sets of components?

One option would be to create a component along the lines of
VisualTransformation which gets added to an entity in addition to the visual and transformation components; This new component would have the transformation and visual components dependency injected into it:

The entity would then have

-Transformation

-Visual

-VisualTransformation

And then a system that operates on VisualTransformation components would have its own composition logic for entities that have both, and delegate some logic to the respective systems that compose them separately (TransformationSystem and VisualSystem).

This starts to exhibit a code smell reminiscent of extending deep inheritance hierarchies; clearly not an extendible solution.

My other idea is then to create a generic component-bag system that works on entities with certain component sets, and register those entities with the correct bag of components to a system. Is this the right approach? How would this be done?

sentences:
XNA 4.0: Blender .fbx File Won't Display 3D Model So I followed the basic 3D model display tutorial found here:
http://msdn.microsoft.com/en-us/library/bb197293%28v=xnagamestudio.31%29.aspx

And while I know this is for XNA 3.1, I can still get the screen to show and the background color to change fine.  The model file seems to be accepted in the method below:

protected override void LoadContent()
    {
        // Used to draw textures.
        spriteBatch = new SpriteBatch(GraphicsDevice);

        grudmud = Content.Load<Model>("Models\\Vikings_grudmud");

        aspectRatio = graphics.GraphicsDevice.Viewport.AspectRatio;
    }

The model was created in Blender, so perhaps I'm missing a step in creating a mesh or certain texture for it?  I have colored it in Blender and it's a simple blocky humanoid figure.  Is there a scaling I should check in Blender so the camera in XNA is not inside the object?

Here's where I actually draw the object and set out some basic properties:

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

        Matrix[] transforms = new Matrix[grudmud.Bones.Count];
        grudmud.CopyAbsoluteBoneTransformsTo(transforms);

        foreach (ModelMesh mesh in grudmud.Meshes) {

            foreach (BasicEffect effect in mesh.Effects) {
                effect.EnableDefaultLighting();
                effect.World = transforms[mesh.ParentBone.Index] *
                    Matrix.CreateRotationY(modelRotation)
                   * Matrix.CreateTranslation(modelPosition);
                effect.View = Matrix.CreateLookAt(cameraPosition,
                    Vector3.Zero, Vector3.Up);
                effect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f),
                    aspectRatio, 1.0f, 10000.0f);
                effect.PreferPerPixelLighting = true;
            }

            mesh.Draw();
        }
        base.Draw(gameTime);
    }

The initial camera and player model positions:

Vector3 modelPosition = Vector3.Zero;
    float modelRotation = 0.0f;
    Vector3 cameraPosition = new Vector3(0.0f, 50.0f, 5000.0f);

I haven't even attempted to implement the face texture yet.

It seems to have a wireframe/mesh, I've just colored in the faces.  The model is pretty much centered around the origin.

Am I exporting it wrong?  Do I need to specify lighting/camera angles any further?

sentences:
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:
Should I still display splash screens for middleware that has been discontinued? Usually, you would include splash logos at the beginning of a game to credit various middleware that you've used. Say the company has dissolved or for open source the supporting group has simply moved on and declared the project over. In the hypothetical situation where a middleware project has been discontinued and you still have the legal right to use it, wouldn't you still include the logo for that project at the beginning?

Only concerned with the opening splashes, since I'm pretty sure it would be polite to credit the individuals who worked on that piece in the text credits or at the end.

sentences:
What's a good method to update the U.I in Unity after a player scores a point? I'm practicing with making a Pong clone and I've decided I want 2 large empty gameObjects on either side off camera to act as triggers to reset the game and add a point to either player's score, but Unity's U.I system confuses me.

Any help would be appreciated.

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:
OpenGL Perspective Issue I'm trying to troubleshoot a problem with my simple OpenGL test program, which I've written in C. I've written some math routines to do the matrix manipulation, but even after copying known working perspective functions, I cannot get anything to appear on screen.

The program is simply:

The only geometry is a simple cube centered around the origin, here is the render loop:

int renderer_draw_frame(float delta_time)
{
    glClearColor(0.2f, 0.3f, 0.2f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glUseProgram(prog);

    /* bind textures */
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, tile_tex);
    glUniform1i(glGetUniformLocation(spo_prog(spo), "Tex1"), 0);

    vec3f eye = { 0.0f, 0.0f, 3.0f };
    vec3f target = { 0.0f, 0.0f, 0.0f };
    vec3f up = { 0.0f, 1.0f, 0.0f };

    mat4f model_mat = mat4f_translate(0.0f, 0.0f, 0.0f);
    mat4f view_mat = look_at(eye, target, up);
    proj_mat = mat4f_projection(45.0f, (float)win_width / (float)win_height, 0.1f, 100.0f);

    glUniformMatrix4fv(modelLoc, 1, GL_FALSE, &model_mat.f[0]);
    glUniformMatrix4fv(viewLoc, 1, GL_FALSE, &view_mat.f[0]);
    glUniformMatrix4fv(projLoc, 1, GL_FALSE, &proj_mat.f[0]);

    glBindVertexArray(VAO);
    glDrawArrays(GL_TRIANGLES, 0, 36);
    glBindVertexArray(0);
    return 0;
}

mat4f and vec3f is just this:

typedef struct mat4f mat4f;
struct mat4f
{
    float f[4 * 4];
};

typedef struct vec3f vec3f;
struct vec3f
{
    float x;
    float y;
    float z;
};

The math routines in question:

#define M4(m,i,j) m.f[mat4f_idx(i,j)]
#define PI 3.14159265359f

mat4f mat4f_projection(float fov, float ratio, float near, float far)
{
    float d2r = PI / 180.0f;
    float ys = 1.0f / tanf(d2r * fov / 2.0f);
    float xs = ys / ratio;
    float nf = near - far;
    mat4f r = { 0 };
    M4(r, 0, 0) = xs;
    M4(r, 1, 1) = ys;
    M4(r, 2, 2) = (far + near) / nf;
    M4(r, 2, 3) = -1.0f;
    M4(r, 3, 2) = 2 * far * near / nf;
    return r;
}

mat4f look_at(vec3f eye, vec3f center, vec3f up)
{
    vec3f zaxis = vec3f_normalize(vec3f_subv(eye, center));
    vec3f xaxis = vec3f_normalize(vec3f_crossp(vec3f_normalize(up), zaxis));
    vec3f yaxis = vec3f_crossp(zaxis,xaxis);

    mat4f trans = mat4f_id(1.0f, 1.0f, 1.0f, 1.0f);
    M4(trans, 0, 3) = -eye.x;
    M4(trans, 1, 3) = -eye.y;
    M4(trans, 2, 3) = -eye.z;
    mat4f rot = mat4f_id(1.0f, 1.0f, 1.0f, 1.0f);
    M4(rot, 0, 0) = xaxis.x;
    M4(rot, 0, 1) = xaxis.y;
    M4(rot, 0, 2) = xaxis.z;
    M4(rot, 1, 0) = yaxis.x;
    M4(rot, 1, 1) = yaxis.y;
    M4(rot, 1, 2) = yaxis.z;
    M4(rot, 2, 0) = zaxis.x;
    M4(rot, 2, 1) = zaxis.y;
    M4(rot, 2, 2) = zaxis.z;
    return mat4f_mul(rot, trans);
}

Finally, the simple vertex shader:

#version 330 core

layout (location = 0) in vec3 position; //attrib pos 0
layout (location = 1) in vec2 texCoord; //attrib pos 1

out vec2 TexCoord;

uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;

void main()
{
    gl_Position = projection * view * model * vec4(position, 1.0f);
    TexCoord = vec2(texCoord.x, 1.0f - texCoord.y);
}

Here is what I see:

If I change the shader as so:

void main()
{
    gl_Position = view * model * vec4(position, 1.0f);
    TexCoord = vec2(texCoord.x, 1.0f - texCoord.y);
}

I see:

Why does it completely disappear in projection view? I've tried changed the view look at parameter but I can't ever see anything through projection view. I've tried several different implementations, currently gluPerspective (the one above is pretty much that function copied).

I've been at this all night and I can't seem to get a grasp on what went wrong. Can someone gives me some pointers on where to go next?

sentences:
Why does my Window take a few clicks to actually close even though the event fires? I am pretty new to game dev (and libgdx + scene2d specifically), I am creating a dialog system for an rpg game and obviously a dialog window has a close button to close a dialog but for some reason it takes few clicks to close it (see video).

I have added System.out.println(Actor.class) to where the listener executes:

As you can see the events fired as planned!

Here is my listener code:

closeButton.addListener(new ChangeListener() {

  @Override
  public void changed(ChangeEvent event, Actor actor) {
    System.out.println(Actor.class);
    event.getListenerActor().getParent().addAction(Actions.hide());
  }
});

Please send help,  thank you

sentences:
How do I split my screen to include a JFrame and a lwjgl screen I a making a game and I'm going to make a little side GUI to create game items.

How can I have a window both include a Canvas element and an lwjgl window.

sentences:
How do I implement a selectable world map? I want to have a selectable map of the world, preferably zoomable, in a cocos2d project. When I tap on a country, I want that country to be selected so that I can perform some other operations with it. It seems that the best approach would be to use a vector world map, but I'm unsure how to implement this with cocos2d. Other options include using map tiles, but it seems that still would require the implementation of country polygons for tap/click detection.

Depending on user input, I want to add icons to various countries on the map.

What is a good way to approach the implementation of this type of map?

sentences:
Can COLLADA be used for partial animations / animation blending? I am making a game engine, using the COLLADA format for my models. Part of the requirement for my models is partial animations, for example if the model was a person, an animation could only affect the upper body and have no effect on the lower body.

I would guess this is accomplished by having a scalar value associated with each animation-bone pair that represents the weighting of the animation applied to the bone, but in the COLLADA documentation I didn't notice any such field. So is it possible to do this with COLLADA?

And as an ancillary question, is blender able to create and export such animations?

Basically, what all do I need to know to have this type of feature in my engine?

sentences:
How could an XNA game close with no exception being thrown? I've been messing with my game's network code recently (TCP/UDP sockets) and my game keeps shutting down with no exceptions being thrown at all.

It runs fine until the disconnection of a client, so I already know that it has to be related to the network.

My real problem is that no exception is thrown and the game silently exits on both the client and server sides. How's that even possible? What could end the runtime of an XNA game?

sentences:
openGL Vertex Projection does not work as expected I try to render a simple grid using glBegin(GL_LINES).
I have a class Camera, which provides values like this:

float farPlane = 100.0f;
float nearPlane= 0.1f;

float screenRatio = 1,42857; //width/height = 1000/700
float frustum = 70.0f;

glm::vec3 position = glm::vec3(3.0f, 3.0f, 3.0f);

glm::vec3 UP = glm::vec3(0.0f, 1.0f, 0.0f);
glm::mat4 view = glm::lookAt(position, position - glm::normalize(position), UP); // makes the lookAt vector always point towards (0, 0, 0)
glm::mat4 projection = glm::perspective(frustum, screenRatio, nearPlane, farPlane);

using the view and projection matrices, i transform every vertex from my Grid model and render it.

glm::mat4 viewProjectionMatrix = Graphic::camera->getViewProjectionMatrix(); // returns Camera::projection * Camera::view
glBegin(GL_LINES);
for (unsigned int i = 0; i < vertexNum; ++i) {
    glColor3f(vertexArray[i].normal.x, vertexArray[i].normal.y, vertexArray[i].normal.z); // normal vector is used for color in this case
    glm::vec4 translatedPosition(viewProjectionMatrix*gridTransformationMatrix*(glm::vec4(vertexArray[i].position, 1.0f)));
    glVertex3f(translatedPosition.x, translatedPosition.y, translatedPosition.z);
}
glEnd();

but this is what i see when i move the camera along the line: (0,0,0) + u*(1,1,1)
http://i.imgur.com/PrcDcLs.gifv
(you can see the camera cooridnates in the console)

sentences:
How to sort cards' on-screen positions by their suit? I have a 13 cards and sort button.

When I click that button, I want all the cards of each suit to be grouped-together on screen. So if I have 4 diamond cards in my 13-card hand, all 4 diamonds must be placed together in one part of the hand. If I had 4 spades then all 4 spades must be placed together in a separate part of the hand.

Here's an example of a sorted hand of cards - note how all the cards of each suit are placed together in a row:

So far I tried to Sort using Linq. When I inspect the sort order using Debug.Log it seems to be working fine, but I don't know how to position the cards on screen according to their suits.

Here is the code I'm using so far.
Note: UserServedcards is the collection of 13 cards dealt into the player's hand.

if (!SortCardOrder)
{
    List<GameObject> cardOrder = null;
    cardOrder = this.userServedCards.OrderBy(go => go.name).ToList();

    foreach (GameObject userServedCards in cardOrder)
    {
        if (!userServedCards)
        {
            Debug.Log("Sorting -->" + userServedCards);
        }
    }
}

sentences:
How to fake flipping a skeleton in Box2D? Imagine I have a skeleton — that is a set of bodies held together through various constraints and joints — and I want to flip it. Bodies cannot be flipped in Box2D, so how can I fake that?

Here's an example: I have a humanoid skeleton, made out of different Box2D bodies: the head, torso, upper arm, lower leg, etc. These Box2D bodies are held together by joints. Some of the joints have angle constraints, like the ones between the upper and lower arm, which do not allow the 'elbow' to twist unnaturally.

When I turn my character the other way around, I should flip the skeleton and its joints should be flipped as well. How can I achieve that in Box2D?

sentences:
How can I send a Base64 Image? I'm looking  to make a post request with a base64 image. When I make the request, I get an error called "ERROR_IMAGE_SIZE_0"

  import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import java.io.*;
import java.net.*;
import java.util.Base64;

public class Main {

    public static void main(String args[]) throws IOException {
        File originalFile = new File("sec_token.php.png");
        String encodedBase64 = null;
        try {
            FileInputStream fileInputStreamReader = new FileInputStream(originalFile);
            byte[] bytes = new byte[(int)originalFile.length()];
            fileInputStreamReader.read(bytes);
            encodedBase64 = new String(Base64.getEncoder().encodeToString(bytes));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

        System.out.println(encodedBase64);
        HttpURLConnection con = (HttpURLConnection) new URL("http://2captcha.com/in.php?key=61f5d7a6cccc2db4e7c503a59f4f7e&method=base64&imginstructions="+encodedBase64).openConnection();

        String USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0";
        System.out.println("User agent: " + USER_AGENT);
        //add request header
        con.setRequestMethod("POST");
        con.setRequestProperty("Host", "2captcha.com");

        con.setDoOutput(true);
        DataOutputStream wr = new DataOutputStream(con.getOutputStream());
        BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer response = new StringBuffer();

        while((inputLine = in.readLine()) != null){
            response.append(inputLine);
        }
        String res = response.toString();
        System.out.println(res);
    }
}

sentences:
How small should touch triggers be at minimum? Is there a known minimum physical size for reliable touch select triggers, considering  only selection (no long-press or drag). From personal experience, I would guess it to be about 5x5 mm (0.2x0.2 inch). Is there a canonical answer?

Context: I want to make my chess-like game board have as many cells as possible, but I still want users to be comfortable selecting cells, as it will be a frequent action.

sentences:
LOVE Physics - Joint Stretching After asking a similar question yesterday I've come across another problem with using joints in box2D / LOVE and trying to create a weighted chain.

Everything is set up as follows, I've tried to remove most of the fluff:

Each link is created as a body/shape pair then joined together and added to a links table.

    for i = 1, segments, 1 do

        link = {}

        link.body = love.physics.newBody(world, xpos, ypos, "dynamic")

        if (i == segments) then
            link.shape = love.physics.newCircleShape(endlink_radius) --Ending link
        else
            link.shape = love.physics.newCircleShape(link_radius)
        end

        link.fixture = love.physics.newFixture(link.body, link.shape) --Fix bodies to shapes

        table.insert(links,link)

        ypos = ypos + link_distance

    end

Links are joined together using rope joints to allow for some springy-ness:

    for i = 2, #links, 1 do

        x1,y1 = links[i-1].body:getPosition()
        x2,y2 = links[i].body:getPosition()
        links[i-1].join = love.physics.newRopeJoint(links[i-1].body, links[i].body, x1, y1, x2, y2, link_distance, true )

    end

The player controls the first element of the chain and holds the table of links, its created as follows:

local body = love.physics.newBody(world, 300, 100, "kinematic")
local shape = love.physics.newCircleShape(3)
local fixture = love.physics.newFixture(body, shape)
local chain = _chain.new(world)

Joined to the chain:

x1,y1 = body:getPosition()
x2,y2 = links[1].body:getPosition()
join = love.physics.newRevoluteJoint(body, links[1].body, x1, y1, x2, y2, true )

The player tracks the mouse cursor, determines a velocity and moves towards it by setting the linear velocity of the first chain element:

    body:setLinearVelocity(velocity.x, velocity.y)

And this very nearly works, you can pull the chain around quite nicely using the mouse (directing the top pink element), however if you keep spinning the chain it begins to stretch and pull away from the first element:

Any ideas on how to solve this?

I've tried using different joints and parameters, adding a reinforcing joint from the first link to the last, adjusting body weights and altering the update iterations but can't seem to find anything effective.

Many thanks.

sentences:
How 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:
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:
Apply new default transform values for gameobject I'm not sure if the title is correct. But how does one go about the following:

I imported a mesh created in blender.When i import the object it is at the desired rotation and scale, however, when i look at the properties of the transform the scale is 100 and the rotation is 89.9123xxxxxxx.

Is there any way i can rotate it to the desired rotation, scale it to the desired scale then tell unity that it should update the prefab and set this new rotation as 0,0,0 and the scale as 1,1,1.

Reason behind this, is i am tiling a few prefabs, and the rotations are being used.... after a couple of hundred tiles, there are floating point errors.

sentences:
Finding an angle between two bodies I am trying to find angle between vectors a and b. But the cosine for some reason is not within +/- 1, that means that it is not possible to find an angle between a car and a pedestrian...

Any help appreciated

EDIT I have rewritten my function in accordance with the answer below (I had to do some changes due to writing in Python, for example pedestrian.body.position is equivalent to body.GetPosition()

I also tried to normalize both vectors, but the cosine is still not within +/- 1
And the car can move in both direction, so I do not know how to get its other component...

    def detect_pedestrian(car,pedestrian):
        #Find a vector which connects pedestrian with a car
        pedestrian_position = pedestrian.body.position
        car_position = car.body.position

        #Find vectors a and b
        car_vector = Box2D.b2Body.__GetTransform(car.body).R.GetYAxis()
        pedestrian_vector = pedestrian_position - car_position

        #Calculate magnitudes of both vector
        pedestrian_vector_magnitude = np.linalg.norm(pedestrian_vector)
        car_vector_magnitude = np.linalg.norm(car_vector)

        #Normalize both vectors
        pedestrian_vector_normalized = pedestrian_vector/pedestrian_vector_magnitude
        car_vector_normalized = car_vector/car_vector_magnitude

        #Calculate angle
        magnitudes = pedestrian_vector_magnitude * car_vector_magnitude
        dot_product = b2Dot(pedestrian_vector_normalized, car_vector_normalized)
        cosine = magnitudes/dot_product
        arccos = np.arccos(cosine)

        print(cosine)

```

sentences:
What's a clean way to find (up to) 3x3 squares within a 6x6 grid? I have a 6x6 grid where every cell have a color property (simply integer value).

Player can change one cell at a time to form rectangles of the same color inside of the grid. New rectangles can only be 2x2, 3x2, 2x3 and 3x3 in size.

Is there a cleaner way to find those rectangles rather than having to manually search for [i][j], [i+1][j], [i][j+1] and [i+1][j+1] (et cetera) color matches?

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:
Autoscroll a TextArea to youngest/freshest row/line I want to use a TextArea UI widget as a UI integrated Logger.
Therefore the TextArea should always show the youngest message.

I browsed the whole API to find the proper method but could not find any.
TextArea$setCursorPosition while passing TextArea$getLines as its parameter did not worked as intended.

I read about TextArea$setPrefRows and used it with getLines but also no luck.

How can I use TextArea to get autoscroll behaviour down to the most recent line?

sentences:
2d raycast collision problem I am currently making a 2d top down game in unity and have stumbled upon a problem with my raycast collision. I want my green player to stop moving when colliding with a wall, therefore i made my player object cast a ray in the direction it is moving. Its velocity is nullified when the distance to the collision point is equal to zero, or below. What seems to be the case is that the player object stops moving way to late and ends up overlapping the wall object. I tried to make an offset such that the player stopped a bit earlier, but it seems that the offset needs to differ depending on the side of the wall block. It even feels like the point at where the player stops is arbitrary and differs from time to time.

I would really like to know why this happens and what i can do to fix it. BTW, I would also really like to be able to change the players speed and still have it work.

Here are some pictures of my problem:

The code i use for the player:

using UnityEngine;
using System.Collections;

public class Player : MonoBehaviour {

    [SerializeField]
    private float speed;

    Rigidbody2D body;
    bool justChangedDir;
    Vector2 moveDir;

    void Start()
    {
        body = GetComponent<Rigidbody2D>();
    }

    void MoveDirection()
    {
        Vector2 input = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));

        if ((input.x != 0 && input.y == 0) || (input.x == 0 && input.y != 0))
            justChangedDir = false;

        if (moveDir.x != 0)
        {
            moveDir = new Vector2(input.x, 0);

            if (input.y != 0 && !justChangedDir)
            {
                moveDir = new Vector2(0, input.y);
                justChangedDir = true;
            }
        }

        else if (moveDir.y != 0)
        {
            moveDir = new Vector2(0, input.y);

            if (input.x != 0 && !justChangedDir)
            {
                moveDir = new Vector2(input.x, 0);
                justChangedDir = true;
            }
        }

        else
            moveDir = input;
    }

    void CheckCollision()
    {
        RaycastHit2D hit = new RaycastHit2D();

        if (moveDir.x != 0)
        {
            hit = Physics2D.Raycast(body.position, Vector2.right * moveDir.x, 1);

            Debug.DrawRay(body.position, Vector2.right * moveDir.x, Color.yellow);

        }

        else if (moveDir.y != 0)
        {
            hit = Physics2D.Raycast(body.position, Vector2.up * moveDir.y, 1);

            Debug.DrawRay(body.position, Vector2.up * moveDir.y, Color.yellow);
        }

        if (hit.collider != null && hit.distance <= 0.5 )
        {
            body.velocity = Vector2.zero;
        }
        else
        {
            body.velocity = moveDir * speed;
        }

    }

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

        if (moveDir != Vector2.zero)
        {
            CheckCollision();
        }
        else
            body.velocity = Vector2.zero;
    }

}

Any help will be really appreciated :) Many thanks in advance!

Gusgus

sentences:
Model too small in Orthographic view This must be super-basic, but I don't know where the problem is, since I just started with 3D-Programming.

Why is my model "ballTest" so small on the screen?

private Model _model;
private Matrix view, proj;

//Initialize()
_model = Content.Load<Model>("ball test");
view = Matrix.CreateLookAt(new Vector3(0, 0, 10), new Vector3(0, 0, 0), Vector3.Up);
proj = Matrix.CreateOrthographic(800, 480, 0.1f, 30.0f);

//Draw
_model.Draw(Matrix.Identity, view, proj);

sentences:
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:
Blender->Unity Import Animation Failing by Overlapping Mesh Objects I'm new to both Unity and Blender. I created this penguin 3d model, rigged it up and animated it in Blender and all looked good.
When I imported it into Unity, I noticed that this idle animation did not appear to be working correctly. As the body moves, the body mesh overlaps the belly mesh and covers a portion of it.

This is not the case when viewing the animation from blender 2.9.

The belly uses a shrinkwrap modifier with the body as a target.
Is this a problem with Unity import, or how I modeled this penguin in Blender? Can anyone see what I have done wrong here? Any help is much appreciated!

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:
What are the basic systems used to implement a combat system like in Devil May Cry 5? My basic observations from playing DMC5 and other Character-Action games a lot are the following...

There are a lot of different Animations that blend into each other.
These Animations are triggered by input sequences of varying complexity.
Input to Animation time feels very responsive.

My question is what systems does one use to organize all these animations with their input sequences and make it responsive.

sentences:
Spritebatch drawing the other way I am drawing a rectangle using a emptytexture (1x1) and I use the following:
spriteBatch.Draw(EmptyTexture, new Rectangle((int)MyPosition.X + MyTexture.Width / 2, (int)MyPosition.Y + MyTexture.Height / 2, 100, 2000), null, Color.Red, MyDirection + MathHelper.ToRadians(180), new Vector2(0, 0), SpriteEffects.None, 0.0f);

which does this:

But now I am trying to make another rectangle next to that one which looks like this:

But when you rotate the ship it rotates like this:

I've done this by the following:
spriteBatch.Draw(EmptyTexture, new Rectangle((int)(MyPosition.X + MyTexture.Width / 2) + 100, (int)MyPosition.Y + MyTexture.Height / 2, 100, 2000), null, Color.DarkRed, MyDirection + MathHelper.ToRadians(180), new Vector2(0, 0), SpriteEffects.None, 0.0f);

But what I am trying to do is to make the point of rotation of the 2nd one at the middle of the ship like the other one but it's drawn the same.

sentences:
Assign player currentLocation based on array coordinates I wanted to incorporate changing location in an rpg, so I began by creating a class Location and assign every Location to a multi-dimensonal array, like so:

WorldMap[0, 0] = new Location("Majula");

I created two int variables named LocationY and LocationX set to the starting location. Now I got a command handler, when I type "Move South", I update the position with this dead simple code:

LocationY++;

Mind you, this is just for testing purposes, I just like to break a game into many small components that gets added as I get, or know better.

Now when I want to get my current location, I call it like this:

Console.WriteLine("He then headed south, until he arrived at {0}", WorldMap[PlayerLocationY, PlayerLocationX].Name);

That's cool and all, and it works, but I don't like typing too much if I can avoid it, so I wanted to change the call of WorldMap[PlayerLocationY, PlayerLocationX].Name to something more readable like currentLocation.Name.

So I tried this bit of code:

Location currentLocation = WorldMap[PlayerLocationY, PlayerLocationX];

Obviously, I get a NullReferenceException... I'm completely clueless, and I'm sure I'll probably say to myself "duh" when I'll get an answer.

And yeah, still learning, Console still rocks my socks!

sentences:
Forward Shading with multiple shadow-casting lights I am currently thinking about how to organize shadowing and lighting.
We use forward rendering and currently, our algorithm looks like this:

collect all items that are visible in the view
for each item, collect a list of lights where the item is in the attenuation radius (each item keeps a list of lights)
determine the shadow light by the distance of the main character (only one light can currently cast shadow)
render the scene by using a constant buffer of the currently processed item to shade it (each item is rendered with a constant buffer which contains light properties. the number of lights per item is predefined so we have a Light[16] and numLights in the constant buffer)

How would I do multiple shadow-casting lights in an organisatory way?
We do not want to go the deferred way, since we dont want to limit us to GBuffers.

sentences:
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:
How can I use Rectangle.Intersect() to resolve collisions in XNA? I have a 2D game written in XNA, and I've been trying to fine-tune my collision resolution. All of my game objects are squares, which means detecting a collision is easy - use the position and the size of each entity (which is already known) to craft a corresponding Rectangle, then compare the two with Rectangle.Intersect().

This works fine for the most part, but has been running into weird corner cases where the collision resolution doubles an entity's jump height, or gets caught between tiles when moving horizontally across a flat surface.

I have recently expanded my code to include a velocity for each game entity, and I thought it would be possible to avoid some of these problems by preventing the need for these resolutions in the first place.

The idea would be to use an entity's position + velocity to predict a collision, then reduce the velocity to prevent a collision from occurring in the first place.

I can still use Rectangle.Intersect() to determine if the entity is in a collision, but I'm horribly confused on how to go from the Rectangle returned by Rectangle.Intersect() to an appropriate velocity counter-vector to avoid the collision.

Is there a straightforward way to go from the intersection Rectangle to an appropriate counter-velocity?

sentences:
Moving Windows Mixed Reality main camera in Unity3D programatically I'm trying to programmatically move the main camera i.e. player's point of view/origin in a Windows Mixed Reality but for some reason it's not working for me (using newest latest stable Unity 2018 and HoloToolkit through which I've setup my WMR project)...
I've done the following:

m_MainCamera = Camera.main;
m_MainCamera.transform.position.Set(100f, 100f, 100f);
UnityEngine.XR.InputTracking.Recenter();

if (Input.GetKeyDown(KeyCode.A)) happens, but even though the code gets run, my VR view position remains unchanged, and I'm guessing at 0,0,0 (or whatever is set initially)...so how exactly do they do those movements in the WMR's UI cliff house when you use the motion controller to point to place you want to transport your view...do they actually move all of the objects showing instead?

Or am I missing something really trivial when I can't move except for by moving my own body inside of VR? Maybe HoloToolkit is disabling it somehow... But how do I reenable it then to move to a predetermined places within a large life sized 3D model objects please?

TIA

sentences:
client - server position syncronization in flash I trying implement client - server position syncronization. Every 20 game ticks i sending to flash client correction of player position... and it always wrong on client, flash always cant predict player position. I think it due to different frame rate or different time on server and client (server is running on 30 fps when client on 60 fps).

Take a look here. How can I implement so precise player movements like they did? Any suggestions?

sentences:
Trying to 'stamp' an arbitrary assortment of pixels to a texture2d that may be rotated at an arbitrary angle This one is hard to explain but I'll try to not to overcomplicate it. Engine is Unity, for reference.
I have a system where an object has a 2d texture to display a custom splat map. The user can 'paint' to this texture, which uses world space coordinates of the mouse to see which pixel should be painted to. They can also paint larger shapes, which are essentially just implementations of square / circle drawing algorithms that choose what pixel coordinates to paint to based off the starting world space coordinates.
This works fine while the object/texture are unrotated, but if I rotate the object an arbitrary amount of degrees (say, 45 for the most extreme result), like squares and circle etc are drawn to the texture with missing pixels. I assume this is because the 'grid' of the texture is now rotated, and because I'm still trying to 'stamp' the shape in the original world space orientation (without respect to the rotation), the pixel 'sizes' or coordinates aren't the same?
I can't post screenshots as I'm at work, but this is what my desired output would be (Ignore the pixelisation, had to use an online crappy paint program), where the first square is the object in its original rotation, with a red square stamped on to it as expected. The second square is after the object is rotated 45 degrees, and the yellow square stamped on it is what I want (and what is currently appearing with missing pixels in my implementation).

EDIT: And here is the actual result I'm getting, pixels per unit is 16. The first square was stamped, the rect then rotated 135 degrees, and then the second square was stamped (shown with the missing pixels):

Anyone have any idea how I would go about drawing onto a rotated texture like this without ending up with missing pixels? I can post code snippets / build images later.
EDIT:
This is the code executed on the object to register a single pixel draw (very loosely), which uses the RotatePointAroundPivot function to get the pixel on the original pixel grid location in world space by rotating the point against the transforms current rotation. This works perfectly for individual pixel draws from mouse position clicks, but with the larger shapes I end up with the issue described
void DrawToTex(Vector2 worldPos) {
    worldPos = RotatePointAroundPivot(worldPos, transform.position, transform.rotation.eulerAngles)

    (xPixelCoordinate, yPixelCoordinate) = GetPixelCoordinatesFromWorldPos(worldPos);

    pixels[xPixelCoordinate, yPixelCoordinate] = color;
}

public Vector3 RotatePointAroundPivot(Vector3 point, Vector3 pivot, Vector3 angles) {
    return Quaternion.Euler(angles) * (point - pivot) + pivot;
}

public void DrawSquare(Vector2 worldPos, int size) {

    (int startXCoord, int startYCoord) = GetPixelCoordinatesFromWorldPos(worldPos);

    // Literally just gets an array of the correct size
    int[,] squareMatrix = GetSquareMatrix(size);

    sizeHalved = size / 2;

    pixelWorldSize = 1f / pixelsPerUnit; // pixels per unit is 16 in my build

    for(int x = 0; x < size; x++) {
        for(int y = 0; y < size; x++) {
            int newX = startXCoord - sizeHalved + x;
            int newY = startYCoord - sizeHalved + y;

            Vector2 pixelWorldPositionToDraw = worldPos + new Vector2((newX - startXCoord) * pixelWorldSize, (newY - startYCoord) * pixelWorldSize);
            DrawToTex(pixelWorldPositionToDraw);
        }
    }
}

(int, int) GetPixelCoordinatesFromWorldPos(Vector2 worldPos) {
    float xMin = bounds.min.x;
    float yMin = bounds.min.y;
    float distFromStartX = worldPos.x - xMin;
    float distFromStartY = worldPos.y - yMin;
    float xScaled = distFromStartX * pixelsPerUnit;
    float yScaled = distFromStartY * pixelsPerUnit;
    int xPixelCoordinate = (int) xScaled;
    int yPixelCoordinate = (int) yScaled;

    return (xPixelCoordinate, yPixelCoordinate);
}

sentences:
Best practice child and parent script What is the best practice coming to where to place the code in this scenario.

I have a gamobject called player. It has lots of child objects. One of them is sword.
Like this:

Player

Body

Head

Torso

Sword

So i have code that controls the player in player. It controls movement and triggers an attack animation which swings the sword. The code that checks if the sword is swinging and if it has hit something is at the moment inside the sword. My question is, what model is best practice? I can think of some:

All code in player. player checks if sword is colliding and handles what happens to the enemy that was hit.
sword checks for collision but player handles it by polling sword and takes care of what happens with enemy and player after.
sword checks for collision but player handles it  by listening to an event that sword triggers and takes care of what happens with enemy and player after.
sword handles everything by handling what happens to enemy and player communicating with parent through a reference.

sentences:
In a 2D top-down game, how can I create projectiles that have a height? A 2D game called Deer Hunter has projectiles like this:

Are the projectiles 2D or 3D models? How could I implement something similar?

sentences:
Alternatives to a leveling system I'm currently designing a rough prototype of a mecha fighting game.

These are the basics I came up with:

Multiplayer (matchmaking for up to 10 people, for now)
Browser based (HTML5)
2D (<canvas>)
Persistent (as in, players have accounts and don't have to use a new mech each time they start a match)
Players earn money upon destroying another mech, which is used to buy parts (guns, armor, boosters, etc)
Simplicity (both of the game itself, and of the development of said game)
No "leveling" (as in, players don't get awarded with XP)

The last part is bothering me. At first, I wanted to have players gain experience points (XP) when destroying other mechs, but gaining two things at once (money and XP) seemed to be in conflict with my last point, which is simplicity. If I were to have a leveling system, that would require additional development. But, the biggest problem is that I simply couldn't fit it anywhere! Adding levels would require adding meaning to these levels, and most of the things that I hoped to achieve could already be achieved with the money mechanic I introduced. So I decided to drop leveling off completely.

That, in turn, removed a fairly popular and robust mean of progression in games from my game (not that I would use it well anyway). Is there another way of progression in games, aside from leveling and XP points, that wouldn't get rendered redundant by my money mechanic, would be somehow meaningful (even on a symbolic level), and wouldn't be in conflict with my last point, which is simplicity?

sentences:
Is it possible to customize the Scriptableobject inspector for Simple level data, without the use of PropertyDrawers? I've invented an innovative, new game mechanic for Bricker Breaker Quest and want to create a quick prototype to recruit a game development team. After wasting a week researching the best way to easily represent the simple level data, I reluctantly started using Scriptableobjects. Each level is defined as a List<Block>, where :

public class Block : MonoBehaviour, IComparer<Block>
{
    public int x;
    public int y;

    public int lives = 0;
    private int pastLife = 0;

    private SpriteRenderer spriteRenderer;
    private TextMeshPro text;

    private void OnCollisionEnter2D(Collision2D collision)
    {
        lives--;

        if (lives > 0)
            UpdateVisualState();
        else
        {
            gameObject.SetActive(false);
        }
    }

    private void Awake()...

    public void AddLives(int life)...
}

How do I properly serialize the Block object so that I can enter the X, Y, and Lives integers directly in the Inspector? As a quick hack, I created a List<Vector3Int> instead of the Block List and use the Z input field to enter the lives. Seems like overkill to create a PropertyDrawer just to relabel one field.

Any other advice is appreciated.

sentences:
Warp GameObject Size When Entering/Leaving Area Below I have an image describing the desired functionality I am going for. Let's say you control a square and when you move this square into a given area, any part of your rigidbody/model inside of the area will be magnified upon entering and shrunk upon leaving. So now you more or less are made up of two rectangles, one small and one large.

What would be an elegant approach towards achieving this effect?

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:
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:
What is the state of the art at shipping game graphics such as lots of small BMP files? We have lots of small BMP files which I think would be easier to copy if we had them combined in a big TAR/ZIP/whatever.

What is the state of the art at shipping game graphics?

We are using C# and are aware of zlib. Just brainstorming to see if there are any other solutions better than zlib.

sentences:
MoveTowards giving two different results for same input - Unity I have prefab and its hierarchy is as follows:

bird

-Outline

--mask

--filler

Now I am using this in Update to move the filler:

filler.gameObject.transform.position = Vector3.MoveTowards(
            filler.gameObject.transform.position,
            new Vector3(feedBar.gameObject.transform.position.x, -1.1f, filler.gameObject.transform.position.z),
            (1f / PlayerPrefs.GetFloat("timetofeedbird", 5)) * Time.deltaTime);

All the instantiated birds have movement in correct direction. But the last one has a movement in reverse direction.

Here is the GIF to explain the issue:

Any idea what the issue here?

sentences:
Hardware instancing for voxel engine i just did the tutorial on Hardware Instancing from this source: http://www.float4x4.net/index.php/2011/07/hardware-instancing-for-pc-in-xna-4-with-textures/. Somewhere between 900.000 and 1.000.000 draw calls for the cube i get this error "XNA Framework HiDef profile supports a maximum VertexBuffer size of 67108863." while still running smoothly on 900k. That is slightly less then 100x100x100 which are a exactly a million.

Now i have seen voxel engines with very "tiny" voxels, you easily get to 1.000.000 cubes in view with rough terrain and a decent far plane. Obviously i can optimize a lot in the geometry buffer method, like rendering only visible faces of a cube or using larger faces covering multiple cubes if the area is flat. But is a vertex buffer of roughly 67mb the max i can work with or can i create multiple?

sentences:
How can I Implement spin in billiard game? I'm not sure that you played billiard or snooker before.if you played you should know about spin.
but anyway if you don't know about it you can see it in this video

I want to Implement spin like this game

for example difference between Top spin and Back spin is:

Top spin

Back spin

Spin behaviour

if you aim behind the ball you can shoot the ball in all direction

if you aim closest to right you can just aim the right

if you aim closest to left you can just aim the left

I found a same Issue that used Torque in stackoverflow but I don't know why didn't work!

Top Spin

GetComponent<Rigidbody>().AddTorque(Vector3.back * cueStrength );
GetComponent<Rigidbody>().AddForceAtPosition(cueStick.forward * cueStrength,transform.position,ForceMode.Acceleration);

Back Spin

GetComponent<Rigidbody>().AddTorque(Vector3.forward * cueStrength );
GetComponent<Rigidbody>().AddForceAtPosition(cueStick.forward * cueStrength,transform.position,ForceMode.Acceleration);

I noticed that flyordie's snooker didn't use AddTorque.so I don't need answer that Implemented with AddTorque.

Update

What I tried

I add joystick to select spin angle

then I apply spin force ( It seems my spin works but sometimes didn't work that I attached video in end of my question).

this is my code:

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

public class MainBall : MonoBehaviour {

    private Vector3 FirstPos; // store first position as reset position
    public Transform SpinRoator; // spin rotator cylinder that show spin angle
    private Rigidbody rigidbody;
    public bool SpinUsed; // spin should use once
    private float v2;

    private void Start() {
        rigidbody = GetComponent<Rigidbody>();
        FirstPos = transform.position;
    }

    //After goal reset ball position
    public void ResetPos(){
        rigidbody.velocity = Vector3.zero;
        rigidbody.angularVelocity = Vector3.zero;
        transform.position = FirstPos;

    }

    void SpinForce(){
        SpinUsed = true;
        float F = ComebackForce(); // calculate comeback force
        StopBall(); // stop ball
        rigidbody.AddForce(SpinRoator.forward*F);// apply spin force
    }

    // calculating return force after hitting f = m.a
    float ComebackForce(){
        var m = rigidbody.mass;
    var v1 = rigidbody.velocity.magnitude;

    var a = (v1 - v2) / Time.deltaTime;
        var F = m * a;
        v2 = rigidbody.velocity.magnitude;
        return F;
    }

    //stop ball
    public void StopBall(){
      rigidbody.velocity = Vector3.zero;
        rigidbody.angularVelocity = Vector3.zero;
    }

private void OnCollisionEnter(Collision other) {
    if(other.collider.tag == "Ball" || other.collider.tag == "ColorfulBall"){
    if(!SpinUsed){
    SpinForce();
    }
    }
}
}

but What is Problem?!

It seems works correctly but My Problem is sometimes Spin don't work correctly you can see this video that demonstrate this problem.my ball goes wrong direction of spin!!!

1.Ball goes Wrong sometimes

as you can see in above gif ball goes wrong direction!!! ball should go along yellow cylinder but I don't know what is problem of my code!!!

1.Ball goes slow sometimes

another problem is comeback force is slow sometimes!!!
I calculate comeback force F = m.a but why is it slow?!

sentences:
Glowing Effect and Blending I am using C++ and SDL and I am trying to get lines with a glowing effect as provided by the image of the game Defcon on the continental outlines.

How could I achieve this glow and blend of the color in 2D? What are some algorithms that I can implement or built in functions that some other graphical frame work has?

I attempted my own solution by rendering lines around the bright center line and reducing its hue but I believe that such method is too expensive in rendering. I need something more efficient.

sentences:
How does the camera/UI know who the player is? I'm in a bit of a dilemma regarding how certain engine components — like camera and UI — know who to follow, whose health and other attributes to represent on the screen.

How do you architect a system where does communication between those components and the entities take place? I could have a separate entity that represents the player, but that seems a bit 'hard-coded'. What if I want to pan the camera? What if the player starts controlling another entity?

In other words, how do I abstract away the data sources for components like the camera and UI, such that they don't care what entity they represent?

An event system will do for a lot of cases, but that is more suited for propagating information that changes or is generated 'rarely' (like the death of the player). For something like entity health and position — which need to be known every frame — an event system isn't well suited.

sentences:
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:
How do I draw two lines of text in GMS and keep one static? I am making an intro sequence for my game, but I'm having some difficulty drawing two lines of text. The first line is "DEVELOPED BY:" referenced from a separate language file as "IntroSequence", "DevelopedBy". The next line (made by using + chr(13) + chr(10) +) is my name which I want to be kept static. I would essentially like the user to be able to make different language files being able to change the string reference "DEVELOPED BY:", but not the developer name. Now, I can get the text to draw if I use "DEVELOPED BY:#Mr.Mendelli" in the language file, or keeping both strings static in the script by declaring mytext = get_text("DEVELOPED BY:" + chr(13) + chr(10) +"Mr. Mendelli");. But If I use the second method, the DevelopedBy string cannot be translated in the language resource any more.

When I use the below script, GMS says two arguments are declared, but three are provided:

mytext = get_text("IntroSequence", "DevelopedBy" + chr(13) + chr(10) +"Mr. Mendelli");
image_alpha = 0;
statetime = 0;

How do I use my alias as an unchangeable separate line?

sentences:
Connecting smoothly N textures on terrain I started to create my own terrain in a quite common way, just like this:  http://www.rastertek.com/tertut18.html . It is infinite and automatically generated (by using coherent noise). The areas are determined by using Voronoi noise (http://www.ctvisualeffects.com/renderman/maya_pattern_animation/cellnoise.jpg .

I am using triangle list with shared vertices. I'd like to create areas textured differently that are connected smoothly with each other. I came up with something like giving every vertex the texture id, e.g.:

0 - grass
1 - snow
2 - sand

I was thinking about sending the texture ids (the 0, 1, 2) to the shader in the TEXCOORD semantic (the z value), however I have no further idea on how to use them there to actually blend the textures smoothly.

Could you give me any hints, please? I'd be really grateful.

// EDIT

I ended up giving each vertex weights of each texture. But this is completely not generic solution and quite heavy as I have to change vertex structure when adding another area which has another texture.

sentences:
Algorithm that cover one mesh by another mesh Suppose I have two meshes (Let call me  first MeshShirt and second - MeshBody)
Meshes are aligned (if i render both MeshShirt "covers" MeshBody). But some parts of the body are not "under" the MeshShirt (because MeshShirt shape differs from MeshBody)

How can i "pull up" parts of MeshShirt which are under MeshBody and hold other parts in their places? Of course i want  save shape of MeshShirt if it possible

I think about following algorithm

mark all points of MeshShire which under MehsBody by tracing
intersection of its normals and MeshBody.

But if MeshShirt "hidden" parts have complex shape normal tracing will not work. So some way to detect bad points is needed
move every marked
point to the plane of its nearest triangle of MeshBody.

But i afraid
that these algoritm may produce significant  deformation of MeshShirt.
So some shape preserved deformation is needed too.

Sorry for my poor English and fuzzy problem definition

sentences:
www.texture and www.LoadImageIntoTexture both just show red question mark I'm trying to use this code I found in the Unity docs to display a remote image on a plane.  However, no matter what URL I try, it only displays a red question mark.

using UnityEngine;
using System.Collections;

public class KnowledgeWall_WeatherMap : MonoBehaviour {

    // The source image
    //public string url = "https://radar.weather.gov/Conus/Loop/northrockies_loop.gif";

    public string url = "http://www.gstatic.com/webp/gallery/1.jpg";

    IEnumerator Start()
    {
        Texture2D tex;
        tex = new Texture2D(4, 4, TextureFormat.DXT1, false);
        using (WWW www = new WWW(url))
        {
            yield return www;
            www.LoadImageIntoTexture(tex);
            GetComponent<Renderer>().material.mainTexture = tex;
        }
    }
}

I also tried the code here, which is slightly different. It gave the same result.
Unfortunately this project is Unity 5.3.6.  How can I fix this so Unity 5 displays the remote image?

sentences:
How do I attach UI data to logic data? I'm attempting to write an inventory system(C++, doesn't need to be huge), that later on should be able to be drawn in a GUI.

In the file structure, I think it would be best to put both information about the item itself and references to graphics, etc. in one file.

But how does that translate into code? How should I tell the renderer, for example which sprite to draw for which item and where to do that. Should I only have the CInventory and the CItem class, containing both logic and sprite information, or should I create separate logic and GUI inventory(in this case meaning both CInventory and CItem) classes which are then linked by a common item-id for example?

Answers are always appreciated :)

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:
change widget's size through blueprints I want to change the size X of my 'Horizontal Box' widget's through blueprints but cannot figure out how to do that... the properties that I want to be able to control from blueprints are marked red below:

To give you some context, I need this to instantiate my widget dynamically. I first add a bunch of child widgets which works just great, but I also need to kinda resize the quad in the background to fit in size the child widgets that I am 'spawning'. Isn't there really any way to do this? Because this seems a super-basic thing to do as from my point of view but can't find it anywhere...

sentences:
Strategy for keeping a primitive facing the viewport? Using XNA, c#.

I'm writing a stellarium-type of program-- well, trying to :-) -- and I have a 'sun' texture that I'll be pasting onto triangle primitives. I'll also be floating some text above each node, which will probably be on the primitive as well.

My issue is how to force the primitives to always be facing the camera, despite rotations and movements of the viewport. I'm going through my XNA programming books, but there's no obvious solution. I'd appreciate a pointer in the right direction.

Note: I'm not using 3D models, so AFAIK there's no Matrix to work with. I have 3 vector3's that define a triangle, and I guess I have to modify their addresses on each update to face the camera. That seems pretty intensive, so I'm thinking I may be missing something obvious.

sentences:
Do programmers in the industry get to participate in the game design process? My main goal is to create games which is why I'm planning on studying IT so I can later on be a game developer/programmer.

My question is: does a game programmer get involved in the game designing process or is that only the game designer's job? Is a game designer always needed or can programmers work on game design some of the time?

Do programmers need to have game designing knowledge or do they just follow orders? Similarly, do game designers require programming knowledge?

I'm kind of confused over what I want to be which is why I'm asking here. Basically, do game programmers also get to be game designers?

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:
Unity move canvas slightly with smartphone acceleration I'm developing an AR-App with the Samsung-GearVR. To get a smooth UI, I thought about creating a UI, which is not completely fix, I thought it could be nice, when the UI is slightly behind my head movement, but still lerps to the correct position, when my head is not moving. (A lot of 2D-Sidescroller got this style of camera, which is not fixed on the character, but instead is following the character with a bit of delay, I want this effect for my canvas.)

First off I changed my canvas to World space, which works fine, then I was thinking about the Input.acceleration method, but it does not really give you the actual acceleration, but the actual rotation of the phone. Now I'm struggling, because I don't know, how to get the current acceleration. Is there some better way to achieve this effect or do I have to build something with the Input.acceleration method?

sentences:
A* : Partial recalculation when one node *changes* I have implemented an A* library. Its most interesting feature is that it is "interruptible"; for example, you can stop the calculation loop on a game frame, and resume it later on the following frame.

The library works by creating "Nodes". Each node holds information about a cell in a grid: what is the cost to get there, what is the cell's "parent" (from which it is cheaper to get to the cell) etc. This information is stored until manually released; it is available for other uses if needed.

The "bestNode" is a pointer to one of such nodes. When the search starts, it is the "origin", and it gradually changes until the destination is reached.

Now I'd like to use that information to "partially recalculate" the node information when a node changes; the typical example is a door which opens/closes, allowing new paths/cancelling existing paths. Since I have already calculated the path from the origin to the "changed" node, I'd like to conserve that info, instead of re-calculating everything.

So far my thinking is:

function update(location)
  If the modified location is not in a node, return // not affected
  let node = self.nodes[location]
  let parent = node.parent
  delete all nodes that where created after parent
  add parent to the open list
  bestNode = parent
end

So I have two problems:

I don't know how to select the "nodes created after parent". Would a "unique increasing integer", like in a database, be enough?
This looks kind of complicated and clumsy. Is there a simpler way to do it?

Are there any other "partially-re-calculable" A* algorithms out there? I could not find anything on the subject.

Regards!

sentences:
Defining an OpenGL unit I have read that you can define your OpenGL unit by using glViewport.
As far as I understood if you use something like glViewport(0,0,600,600) then 1 OpenGL unit = 600 pixels. Now my problem is what happens if the 2 sizes aren't equal? How do you calculate your OpenGL unit?

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:
Make transform.up face toward velocity while preventing transform.forward from rolling? I have been working on a personal project that is suppose to mimic Anthem. I am using a state machine for the character controller that I intend to integrate with the Unity's Animation state machine.
I am calculating a new velocity that makes the player follow the mouse when flying, and I am making transform.up = Velocity so that the player appears to be going head first towards its velocity.
The issue is that when you start to rotate in a circular way on the xz plane, the player will start to roll and its transform.forward moves from facing towards the ground (which is what I want) to facing the sky.

The core code is in public override Update():
public class s_MechFlyt : MechStates{

  float flySpeedPercentage;

  public s_MechFlyt(in MechController Master) : base(Master){
    flySpeedPercentage = 2.5f;
  }

  public override void Update(){
    if (_Master.SprintButtonHeld){

      Quaternion Rot = Quaternion.Euler(-_Master.DMouse.y , _Master.DMouse.x , 0);

      _Master.Velocity = Rot * Vector3.forward * _Master.Stats.Speed * flySpeedPercentage;
      Vector3 Rotation = _Master.Velocity;**
      //Rotation.y = Mathf.Clamp(Rotation.z, 0, 50);
      _Master.transform.up = Vector3.Normalize(Rotation);
      //_Master.transform.rotation = Rot;

      //_Master.transform.rotation = Quaternion.RotateTowards(_Master.transform.up, _Master.Velocity, 5);

      _Master._Controller.Move(_Master.Velocity * Time.deltaTime);

      if (_Master.JumpButtonHeld){
        _Master.ChangeStates("hover");
        _Master.transform.up = Vector3.up;
      }

    }
    else{
      _Master.ChangeStates("fall");
      _Master.transform.up = Vector3.up;
    }
  }

  public override void EnterState(){
    _Master.CamController.ChangeStates("flying");
  }
}

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:
algorithm to "explode" mesh i have a simple triangle mesh which i want to explode.
so i am looking for an algorithm that makes every triangle to move outwards from the centerpoint.
is there already something premade like this?

thanks!

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:
3D model editor manipulators I'm trying to make my own 3D model editor to better learn 3D programming. I have my translate manipulators and I'm trying to calculate the Vector2 that the mouse would have to move in order to move an object down a specific axis. This will obviously change based on the position of the camera, position of the object and the axis. I have the majority of it working, I'm just not sure on how to finish it. If the camera is completely horizontal to the object then the values come out correct, but once I start to move the camera above or below the object the values start to get less accurate. I figure I need to incorporate the camera's up vector into it, but I'm not sure how.

The code snippet is for the X axis.

Vector3 meshCameraDistance = meshPosition - cameraPosition;
Vector3 angleAxis = new Vector3(1, 0, 0);
float meshCameraAngle = Vector3.Angle(meshCameraDistance, angleAxis);
Vector2 mouseDragDirection = new Vector2(Mathf.Sin(Mathf.Deg2Rad * meshCameraAngle), Mathf.Cos(Mathf.Deg2Rad * meshCameraAngle));

if (meshCameraDistance.z < 0)
{
    mouseDragDirection = new Vector3(-mouseDragDirection.x, mouseDragDirection.y);
}

speed = (manipulatorSpeed.x * mouseDragDirection.x) + (manipulatorSpeed.y * mouseDragDirection.y);

sentences:
How to do perspective projection “parallax” but without changing the scale or offset of objects? Hello everyone I have this problem that I have tried everything I could think of. The problem: I am making a 2D game with parallax effect but I am using 3d space so am not simulating the parallax but letting the perspective projection take care of it for me. now the problem i have my own game editor where I design the levels, in this editor I use just images and I set a Z value for each layer. however I want the layers to show in the game engine exactly as I set them in the game editor, in short I want perspective projection to do parallax but without changing their scale or offset/position.

obvious solution is to scale them up and offset them but the problem how to calculate their offset? with scaling I tried object->Scale(object.Z/view.Z) and seems to return them to their real size but their positions are still wrong. I tried object->setPositionX(object->getPosition().x*(object.Z/view.Z)) and seems to be aligned except they all seems shifted.

I have tried unprojecting and tried to convert from world matrix to screen matrix and find some ratios and so on.

If anyone have any idea or anyway how this could be done in an elegant/mathematical way , I will be most grateful.

Thank you all in advance.

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

I use UnityScript:

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

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

sentences:
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:
What exactly are "tight controls"? I hear in many game reviews, how gamers complain about the controls of a game, when they hate it, or how they praise them when they work right. This expression comes up: "Tight controls".

It seems like when it comes to games, "controls" is a critic point for a game to succeed, so I was wondering if we could have a discussion about what exactly are tight controls.

What makes "controls" feel good?
What kind of things do gamers hate when it comes to "controls"?
What examples could be given?

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: Camera target point based on angles I'm working on a test project to learn some basic OpenGL. Right now I'm trying to work on a "camera" with gluLookAt. My camera object is really simple, I have two vectors, one for the position and the other for the rotation (x, y and z on both). I'm having trouble with the target point gluLookAt receives, how can I find a target point using only the position and camera angle?

sentences:
How does a wow server handle which player position to set to each nearest players? I already understood how game developers could create very large game levels, bypassing the floating point precision limit.

This was my very first mind boggling question, and I understood it when I read how some programmer told the story of some dungeon PC game.

My question is more related to game networking, more precisely wow.

There are no interruptions in the game level (apparently I think).

Since the viewing distance is much smaller than the world size, and since there are a lot of players, you can't send all players positions because it would require too much bandwidth; so you have to only send the nearest players positions, among a pretty big list of connected players.

Those servers are almost always online, with a large number of players (only doing quests or idling into cities, since I guess dungeons and raids must be hosted on dedicated servers), and they must find a solution to save as much bandwidth as possible.

So at one point the server has to determinate which players positions it has to send to which players, and when it has to stop sending it.

I was wondering about how the server does this, because to me it seems to have O(n^2) or even an O(2^n) complexity.
How do they do it ? Do they fragment into virtual tiles so they only check players in the nearest tiles ? Do they calculate this not so often so that the server can handle it ?

A continuous online persistent world is quite awesome, but technically I don't really know how they do it.

sentences: Creating a separate renderer for entities in a 2D game I'm making a 2D shooter game. As of now, every entity "draws itself", meaning every renderable entity has a draw function. I know it is better if rendering is handled separately, but how can I achieve this? What should I put into the Renderer class?

sentences:
How should I do my collision response? I'm making a small lockpicking simulator. Obviously I'll need the pick to not pass through the lock, and I'll need the pins to move when you tap or push them with the pick.

Here's what I have so far, just to give you an idea.

http://megaswf.com/serve/2433982

As you can see, the collision detection is pixel perfect. I've looked into a couple of different ways of doing collision response, but it seems like such a vast and complicated field. Any time I come up with a possible solution I start noticing flaws like what would happen if more than two objects collided and so on.

I've looked into physics engines like Box2D, but it seems like such overkill considering the, I think, simple nature of the game I'm trying to make. I don't like the idea of using a huge library that I don't even begin to understand just because I can't figure out how to do collision response.

But I just don't know where to begin. Maybe I will have to use a library. If anyone with experience could, based on that demo and what I'm trying to do, suggest a course of action, I'd really appreciate it.

sentences:
Make a light only affect one object I'm wondering if it's possible to make a light source only affect one object? I know that it's possible to use layers and culling mask, but then I would need one layer for every single object which is not possible.

Is there a way for example that I could make only children or siblings be affected by a light source? Or other solution?

Have a nice day!

Update #1:

sentences:
Mesh Generation In Code My camera looks like this:

I am trying to add 2D polygons to the screen based on the percentage that they take up of a 1920x1080 pixel canvas. Therefore, I calculate this and then use Camera.ViewportToWorldPoint() to determine the world point for the mesh vertices. Below you can see how I declare vertices and uvs (I am confident my triangles are correct) for the polygon.

foreach (var point in poly.path)
    {
        uv.Add(new Vector2((float)(point.X - envelope.left) / (envelope.right - envelope.left), (float)(point.Y - envelope.bottom) / (envelope.top - envelope.bottom)));
    }

I assume this is the correct way to calculate the uvs since they are basically the percentage that vertices lie within the bounds of the polygon's bounding envelope.

Here is what I am not so sure on. When I set the vertices like so (assume temp is the array of vertices used):

        var temp = new List<Vector3>();
    var envelope = GetEnvelope();
    foreach (var point in path)
    {
        var vect = new Vector3((float)(point.X - envelope.left) / (envelope.right - envelope.left),
            (float)(point.Y - envelope.bottom) / (envelope.top - envelope.bottom), 1.0f);

        temp.Add(camera.ViewportToWorldPoint(vect));
    }
    return temp.ToArray();

everything works and the polygon is displayed to my screen except it scales so that the polygon draws as though the viewport is the entire envelope. I expect this, however it is not the functionality I want. So instead I try and declare vertices like so in order to have the polygon displayed in its correct relative position on the screen:

var temp = new List<Vector3>();
    foreach (var point in path)
    {
        var vect = new Vector3((float)point.X/1920,
            (float)point.Y/1080, 1.0f);

        temp.Add(camera.ViewportToWorldPoint(vect));
    }
    return temp.ToArray();

however when I set the vertices this way, I no longer see the meshes being rendered. My goal with changing the code to this is to have the polygons be their true size on the screen as they are on the 1920x1080 canvas rather than being skewed as they are in the code that I said was working. Am I misunderstanding how vertices and uvs relate?

Thank for any help!

sentences:
How do I create a toggle button in Unity Inspector? I want to create a tool similar to Unity's Terrain tool, which has some nice toggle buttons in the inspector:

How can I achieve similar design to this? I know how to create normal buttons and other UI components in the inspector, but I can not find enough information to make the buttons toggle.

So far I have used normal toggles that produce a checkbox:

var tmp = EditorGUILayout.Toggle( SetAmountFieldContent, _setValue );

if ( tmp != _setValue )
{
  _setValue = tmp;
  if ( _setValue )
    _smoothValue = false;
}

tmp = EditorGUILayout.Toggle( SmoothValueFieldContent, _smoothValue );

if ( tmp != _smoothValue )
{
  _smoothValue = tmp;
  if ( _smoothValue )
    _setValue = false;
}

Setting the toggle GUIStyle to "Button" does not produce the wanted result. The text or image content goes on left of the button instead of inside.

var tmp = EditorGUILayout.Toggle( SetAmountFieldContent, _setValue, "Button" );

Also none of the options found in GUISkin does not seem to help.

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:
Java heart based health mechanic so I've made a basic game in java w/ LWJGL 2 and Slick. Right now Im working on the hud and health system. I'm kindof trying to get a minecraft like health system, 15 hearts for health,but I want the health to change from level to level.
Right now Ive got this:

    int z = (int) (Math.floor(hp/15)); // this is how many hearts are being drawn
    for(int k = 0; k < z; k++){
        if(z >= 15){
            z = 15; // here it says that it can't draw more than 15 hearts
        }
        g.drawImage(heart, x + k * 32, y); // it draws the hearts with some distance inbetween each heart
    }

I'd be happy if I get some suggestions on how could I add half a heart "mechanic", like if I have 30 max health and 15 hearts (allthought rightnow I have 200 hp, I wanna work with bigger numbers :P) that would mean that If I had 15 health it should draw 7 full hearts and 1 half heart. I don't exactly know how to do that. If you can please do help :D. Thank you

sentences:
How can I find the location of OpenGL object after rotation? I have a rotating object, a cube, which I rotate in OpenGL as follows:

gl.glPushMatrix();
gl.glTranslatef(400.0f, 300.0f, 1300.0f);
gl.glRotatef(m_x, 4.0f, 0.0f, 0.0f);
gl.glRotatef(m_y, 0.0f, 4.0f, 0.0f);
gl.glRotatef(m_z, 0.0f, 0.0f, 42.0f);
gl.glCallList(++shapeNumber); // cube 2
gl.glPopMatrix();

(m_x, m_y, and m_z are the change in the rotation each frame.)

I want to detect a collision between the camera and that rotating object, and to do that I need to get the coordinates of the rotated object in real time. How can I accomplish that?

sentences:
How to zoom image on Unity UI to particular point where mouse cursor is located? I have some RectTransform on Unity UI. I have already implemented some Zoom functionality but now I need it to zoom to the area where the mouse cursor is located. Currently, it zooms to the anchor point. How can I zoom to the mouse cursor?

Here are some screenshots from a hierarchy.

I have already implemented zoom itself.

public class ZoomableRect : MonoBehaviour
{
    [SerializeField] private RectTransform rectToZoom;

[SerializeField] private ZoomConfigs zoomConfigs;

private bool onObj = false;

[SerializeField] private ScrollRect scrollRect;
public ScrollRect ScrollRect
{
    get { return scrollRect; }
    set { scrollRect = value; }
}

private bool isZoomAllowed;
public bool IsZoomAllowed
{
    get { return isZoomAllowed; }
    set { isZoomAllowed = value; }
}

private bool isFullScreen;
public bool IsFullScreen
{
    get { return isFullScreen; }
    set { isFullScreen = value; }
}

void Start()
{
    if (!rectToZoom)
        rectToZoom = GetComponent<RectTransform>();

}

void Update()
{
    float scrollWheel = -Input.GetAxis("Mouse ScrollWheel");

    if (isZoomAllowed && scrollWheel != 0)
    {
        ChangeZoom(scrollWheel);
        SetPosition(Input.mousePosition);
    }
}

private void ChangeZoom(float scrollWheel)
{
    float rate = 1 + zoomConfigs.zoomRate * Time.unscaledDeltaTime;

    if (scrollWheel > 0)
    {
        SetZoom(Mathf.Clamp(transform.localScale.y / rate,
         zoomConfigs.minSize, zoomConfigs.maxSize));
    }
    else
    {
        SetZoom(Mathf.Clamp(transform.localScale.y * rate,
         zoomConfigs.minSize, zoomConfigs.maxSize));
    }
}

private void SetZoom(float targetSize)
{
    transform.localScale = new Vector3(targetSize, targetSize, 1);
}

public void SetPosition(Vector2 mouseInput)
{
    float rectWidth = rectToZoom.rect.width;
    float rectHeight = rectToZoom.rect.height;

    float mousePosX = mouseInput.x;
    float mousePosY = mouseInput.y;

    float widthPivot = mousePosX / rectWidth;
    float heightPivot = mousePosY / rectHeight;

    Debug.Log("widthPivot = " + widthPivot + " heightPivot = " + heightPivot);

    rectToZoom.anchorMin = new Vector2(widthPivot, heightPivot);
    rectToZoom.anchorMax = new Vector2(widthPivot, heightPivot);

    rectToZoom.transform.position = new Vector2(mousePosX, mousePosY);
    Debug.Log("MousePosX = " + mousePosX + " MousePosY = " + mousePosY);
}

public void SetAnchors(bool isFullScreen)
{
    if (!isFullScreen)
    {
        rectToZoom.anchorMin = new Vector2(1, 1);
        rectToZoom.anchorMax = new Vector2(1, 1);
    }
}

}

But anchors always snap to the bottom left corner. And widthPivot and heigtPivot values are always bigger than 1.

Actually, after testing, I see that anchors are less than 1 when the cursor is located in the bottom left part of the screen. And bigger than 1 when the cursor is in the top right part of the screen.

When zooming it always snaps to the bottom left corner.

It seems that mouse position connected to the current resolution at the same time canvas on which zoomableRect is potisioned has reference resolution of 1920 x 1080.

Changing a pivot in the same way instead of anchors doesn't have any effect. Same result.

sentences: 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:
How do I draw a point sprite using OpenGL ES on Android? Edit: I'm using the GL enum, which is incorrect since it's not part of OpenGL ES (see my answer). I should have used GL10, GL11 or GL20 instead.

Here's a few snippets of what I have so far...

void create()
{
    renderer = new ImmediateModeRenderer();

    tiles = Gdx.graphics.newTexture(
        Gdx.files.getFileHandle("res/tiles2.png", FileType.Internal),
        TextureFilter.MipMap,
        TextureFilter.Linear,
        TextureWrap.ClampToEdge,
        TextureWrap.ClampToEdge);
}

void render()
{
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
    Gdx.gl.glClearColor(0.6f, 0.7f, 0.9f, 1);
}

void renderSprite()
{
    int handle = tiles.getTextureObjectHandle();
    Gdx.gl.glBindTexture(GL.GL_TEXTURE_2D, handle);
    Gdx.gl.glEnable(GL.GL_POINT_SPRITE);
    Gdx.gl11.glTexEnvi(GL.GL_POINT_SPRITE, GL.GL_COORD_REPLACE, GL.GL_TRUE);

    renderer.begin(GL.GL_POINTS);
    renderer.vertex(pos.x, pos.y, pos.z);
    renderer.end();
}

create() is called once when the program starts, and renderSprites() is called for each sprite (so, pos is unique to each sprite) where the sprites are arranged in a sort-of 3D cube.

Unfortunately though, this just renders a few white dots...

I suppose that the texture isn't being bound which is why I'm getting white dots. Also, when I draw my sprites on anything other than 0 z-axis, they do not appear -- I read that I need to crease my zfar and znear, but I have no idea how to do this using libgdx (perhaps it's because I'm using ortho projection? What do I use instead?).

I know that the texture is usable, since I was able to render it using a SpriteBatch, but  I guess I'm not using it properly with OpenGL.

sentences:
Procedural generation of stars in the background with given random seed I want to generate stars (actually a 2d vector) in the background. The player is moving left and right endlessly. When the player moves the stars, which aren't in sight anymore, should be deleted from the ArrayList to keep things small. But when the player turns back in the other direction again, the same star(coordinate) should be there again. But the random generator gets a different number, which is normal. How can I do something like lastInt() like I do with nextInt() ? Or what is the proper way to do something like this?
Thank you very much.

sentences:
How to keep sprite on screen while increasing its width to screen width I have been able to increase the width of a sprite to the width of the screen size, but the sprite exceeds the borders of the screen width to the right or left when I try expanding it when it's not at the center. How can I scale the sprite in such a way that it's width increases on both sides till it occupies the screen width without exceeding it's bounds, regardless of the sprite's initial position? Please see my code below:

bool isScaling = false;

IEnumerator scaleToX(SpriteRenderer spriteToScale, float newXValue, float byTime)
    {
       if (isScaling)
         {
           yield break;
         }
       isScaling = true;

       float counter = 0;
       float currentX = spriteToScale.transform.localScale.x;
       float yAxis = spriteToScale.transform.localScale.y;
       float ZAxis = spriteToScale.transform.localScale.z;

       Debug.Log(currentX);
       while (counter < byTime)
        {
          counter += Time.deltaTime;
          Vector3 tempVector = new Vector3(currentX, yAxis, ZAxis);
          tempVector.x = Mathf.Lerp(currentX, newXValue, counter / byTime);
          spriteToScale.transform.localScale = tempVector;
          yield return null;
        }

       isScaling = false;
  }

sentences:
PS3 controller with Unity on Mac I am trying to use my PS3 Controller with Unity but it has been unsuccessful.

I followed this video to do so:
https://www.youtube.com/watch?v=LcettC1QHu4

I have done the same thing as the video but for some reason unity is not getting ANY input from the controller.

I have tested the controller with another commercial game on my Mac and it works perfectly, so my controller is well connect to my computer.

here is a screenshot of the input manager:

joystick button 0 is the X button

sentences:
Saving with PlayerPref problems I'm having troubles saving how much of an item I have in my game. Right now I have it so the price goes up the more items you buy, that works, but every time I reset the game, the count goes back to 0, while the price acts as if the count is at a higher number.

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

public class ItemManager : MonoBehaviour {

public UnityEngine.UI.Text itemInfo;
public GPS gps;
public Click click;
public float cost;
public int tickValue;
public int count = 0;
public string itemName;
private float baseCost;
private Slider _slider;

void Start()
{

    Load ();
    baseCost = cost;
    _slider = GetComponentInChildren<Slider> ();
}

void Update()
{
    PlayerPrefs.SetFloat ("Count", count);
    PlayerPrefs.SetFloat ("Cost", cost);

    itemInfo.text = itemName + " (" + count + ") " + "\nCost: " + cost + "\nGold: " + tickValue + "/s";

    _slider.value = click.gold / cost * 100;

    if (_slider.value >= 100) {
        GetComponent<Image> ().color = buyColor;
    }else{
        GetComponent<Image>().color = standard;
    }
}

public void BuyItem()
{
    if (click.gold >= cost)
    {
        click.gold -= cost;
        count += 1;
        cost = Mathf.Round (baseCost + Mathf.Pow (2f, count));
    }
}

public void Load()
{
    count = PlayerPrefs.GetInt ("Count");
    cost = PlayerPrefs.GetFloat ("Cost");
}
}

I've tried to figure this our for hours, and I just don't know what to do with this.

sentences:
How can I project a vector on another vector? I have a generic not normalized Vector3 v1 and I want to calculate its component along another Vector3 v2. I used to normalize the vector I want to be the direction and then multiplying the other vector's magnitude for it. I can't really understand if it would also work to multiply the other vector (not just its magnitude), but I want to know if there is a lighter way to do it, since compute the magnitude of a vector implies evaluating a square root.

In code I would say

Vector3 v1;
Vector3 v2; v2.Normalize();
Vector3 resulting_v = v1.Length() * v2;

the other case (I am not sure if can work) would be

Vector3 v1;
Vector3 v2; v2.Normalize();
Vector3 resulting_v = v1 * v2;

or, if there is a better solution, I'm listening

sentences:
How do I efficiently use 16 bit texture coordinates? While loading a model I get a big array of 32 bit floating point texture coordinates. I just upload that to a single vertex buffer (along with other data, such as vertices, normals, etc.) and use it while rendering via

glVertexAttribPointer(texcoordindex,2,GL_FLOAT,GL_FALSE,texcoordstride,texcoordoffset);

I use this format for all types of meshes.

However, 16 bit and the ~65000 possible values are more than enough to represent textures that are mostly smaller than 4096 in size per dimension.

Now I'm wondering how to most effectively switch to some 16 bit based texture coordinate format, with respect to maximizing performance, i.e. minimizing the bandwidth and storage used, as well as minimizing ALU operations. Mainly I'm wondering:

Should I use half floats or short integers?
How do I convert the 32 bit floats I get when loading the model safely to the respective 16 bit format and upload it to the vertex buffer? In C++ or other languages, by rolling some custom type conversion via bit twiddling, or use standard procedures provided by the language or libraries such as GLM?
How do I have to change the glVertexAttribPointer call to use that format, and does the input in the vertex shader stay a "vec2"?
Is there maybe another option to save space here? For example, most textures are in the range of 256x256 to 1024x1024 range. 16 bits are way too much for that, but 8 bit are not enough for most textures. Are there some other strategies to save space here?

sentences:
Changing the camera movement in unity I have a code that allows me to move the camera on the x-axis. I need it to move on the y-axis as well as the x.

    using UnityEngine;
using System.Collections;

public class orbit : MonoBehaviour {

    public float turnSpeed = 4.0f;
    public Transform player;

    private Vector3 offset;

    void Start () {
        offset = new Vector3(player.position.x, player.position.y + 8.0f, player.position.z + 7.0f);
    }

    void LateUpdate()
    {
        offset = Quaternion.AngleAxis (Input.GetAxis("Mouse X") * turnSpeed, Vector3.up) * offset;
        transform.position = player.position + offset;
        transform.LookAt(player.position);
    }
}

sentences:
Simple LibGDX Pong game drag player instead of getting x position I got a working pong game in LibGDX but when I touch the screen the player x automaticly jumps to the coordinates I touched. I wan't my game to detect I touched and then move the player to the left/right if I swipe my finger to the left or the right.

This is what I tried so far:

if(Gdx.input.isTouched() && Gdx.input.getY()>240*screenheight){
  if(tapped)TouchX = Gdx.input.getX();
    tapped = false;
    DragX = Gdx.input.getX();

    distance = player.getX() - TouchX;

    PlayerX = Gdx.input.getX() + distance;

    Gdx.app.log("PlayerX "+player.getX(), "Distance "+distance);
    Gdx.app.log("DragX ", ""+DragX);
}else{
    tapped = true;
}

Here I update the player X coordinates

player.setX(PlayerX);

Does anyone know how to make this work?

sentences: Is Update called based on screens refresh rate? MonoGame My game is running 60fps (Because I'm using a 60hz monitor) but if I would use a 85hz monitor it would be running 85fps. My question is if update is called based on the screens refresh rate or if its limited to 60 calls per second

sentences:
Low FPS on Java drawing in BufferStrategy I ran into a very strange problem while using BufferStrategy, I've tried searching for an answer but all I have found are non-relevant threads and discussions. So here is my query.

for (int i = 0; i < 10; i++){
    for (int x = 0; x < 10; x++){
        g.drawImage(enlImg(getImg(terrain, x), 4), i*40, x*40, null);
    }
}

(The parameter 'terrain' is a BufferedImage pre-loaded, which will be used to get a sub image from it.)

I'm trying to draw images to a Canvas, where 'g' is the buffer strategies, 'getDrawGraphics()' because that's how I am drawing to the BufferStrategy.
Anyway, straight to the point. I'm only getting ~3fps.

I know this is only drawing 100 images, but other games draw hundreds of thousands with no lag... Any ideas?

Is it maybe because of trying to enlarge, draw and get a sub image all at once, or is it because of my computer?

Extra

enlImg() code

public BufferedImage enlImg(BufferedImage image, int x){
    BufferedImage enlargedImage = new BufferedImage(image.getWidth() * x, image.getHeight() * x, image.getType());
    for (int a = 0; a < enlargedImage.getHeight(); a++) {
        for (int b = 0; b < enlargedImage.getWidth(); b++) {
            enlargedImage.setRGB(a, b, image.getRGB(a / x, b / x));
        }
    }
    return enlargedImage;
}

getImg() code

public BufferedImage getImg(BufferedImage img, int x){
    int y = 0;
    if (x >= 10){
        x=x-10;
        y++;
    }
    return img.getSubimage(x*10, y*10, 10, 10);
}

Computer Specifications (Windows):

AMD Athlon II X2 250 - 3.00GHz
 OS: 32bit
 4GB RAM,
 256GB HHD

sentences:
Per frame: Many draw calls with fewer total vertices vs fewer draw calls with more total vertices? Is there any chance draw calls like XNA's Graphics.DrawIndexedPrimitives has an extremely low overhead and performance issues are more than likely due to the complexity of the meshes?

If I had a million quads to render, how significant in XNA is it to pack the vertex buffer as full a possible before calling the draw (as an example)? I know many other methods of culling, vertex welding, etc to lower the count would probably have an even bigger impact if/when they are possible, but just for curiosity's sake lets not hit on those topics for this question.

My hope is that XNA indeed has a low overhead on most draw calls and pretty much buffers the 'transactions' necessary to the GPU in some kind of load balancing type way.

Thanks for any and all help.

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: Network Game testing via Wireshark How can i check/inspect the performance of my network game via Wireshark and specifically the Graphs available in Wireshark,i want to test the performance of my network game. which kind of graphs can be helpful and relevant  and give me the idea of network performance of my game? i m really newbie to networking so i m unable to decide.

sentences:
How should I implement multi-pass rendering in a game engine? I have done multi-pass rendering, before, and understand how it works. I made a simple example, which rendered a basic scene with shadows. This was all part of one file. Now, I am trying to figure out is how to put it into my game engine.

Currently, my game engine uses a single pass. It is in a hierarchical structure, and uses Direct3D 9. I have a graphics component, which will load and draw a 3D model. In my game loop, I update all of the entities in the world, then I call the draw function for each one. This draw function gets the vertex buffer, index buffer and texture or material, and draws the 3D model using a shader. This works fine.

To do multi-pass rendering, to allow for shadows, I will need to draw each model multiple times. It doesn't seem right, to me, that in each models draw function I should put the second pass code; this will then be completed before the next models first pass.

How should I implement multi-pass rendering in a game engine?

sentences:
Trying to use stencils in 2D while retaining layer depth This is a screen of what's going on just so you can get a frame of reference.

The problem I'm running into is that my game is slowing down due to the amount of texture swapping I'm doing during my draw call. Since walls, characters, floors, and all objects are on their respective sprite sheet containing those types, per tile draw, the loaded texture is swapping no less than 3 to 5+ times as it cycles and draws the sprites in order to layer properly.

Now, I've tried throwing all common objects together into their respective lists, and then using layerDepth drawing them that way which makes things a lot better, but the new problem I'm running into has to do with the way my doors/windows are drawn on walls. Namely, I was using stencils to clear out a block on the walls that are drawn in the shape of the door/window so that when the wall would draw, it would have a door/window sized hole in it.

This is the way my draw was set up for walls when I was going tile by tile rather than grouped up common objects.

first it would check to see if a door/window was on this wall. If not, it'd skip all the steps and just draw normally. Otherwise
end the current spriteBatch
Clear the buffers with a transparent color to preserve what was already drawn
start a new spritebatch with stencil settings
draw the door area
end the spriteBatch
start a new spritebatch that takes into account the previously set stencil
draw the wall which will now be drawn with a hole in it
end that spritebatch
start a new spritebatch with the normal settings to continue drawing tiles

In the tile by tile draw, clearing the depth/stencil buffers didn't matter since I wasn't using any layerDepth to organize what draws on top of what.

Now that I'm drawing from lists of common objects rather than tile by tile, it has sped up my draw call considerably but I can't seem to figure out a way to keep the stencil system to mask out the area a door or window will be drawn into a wall. The root of the problem is that when I end a spriteBatch to change the DepthStencilState, it flattens the current RenderTarget and there is no longer any depth sorting for anything drawn further down the line. This means walls always get drawn on top of everything regardless of depth or positioning in the game world and even on top of each other as the stencil has to happen once for every wall that has a door or window.

Does anyone know of a way to get around this? To boil it down, I need a way to draw having things sorted by layer depth while also being able to stencil/mask out portions of specific sprites.

sentences:
Godot C++ NativeScript version not rendering multimesh instance whereas GDScript version does I am new to Godot. I am aiming to create a RTS game with 10's of thousands of units and for it to run smoothly. So I'm looking to use GDNative C++ with the Visual Server to handle updating and moving the units and GDScript for everything else.
The following script in GDScript successfully renders a single multi mesh cube at the center of the screen.
extends Spatial

func _ready():

    var meshRid=preload('res://new_cubemesh.tres').get_rid()
    var multimesh = VisualServer.multimesh_create()

    VisualServer.multimesh_allocate(multimesh, 1, VisualServer.MULTIMESH_TRANSFORM_3D,
    VisualServer.MULTIMESH_COLOR_NONE, VisualServer.MULTIMESH_CUSTOM_DATA_FLOAT)
    VisualServer.multimesh_set_mesh(multimesh, meshRid)

    var instance = VisualServer.instance_create()
    var scenario = get_world().scenario

    VisualServer.instance_set_scenario(instance, scenario)
    VisualServer.instance_set_base(instance, multimesh)

I have implemented the alternative In GDNative (C++) and while it doesn't crash and does run the code, it does not render the cube. Camera is in correct position to observe the cube at 0,0. I've just re-purposed the GDNative C++ tutorial for now.
I really like the community here and the engine so far, so hopefully I am just misunderstanding something here and it is possible what I am trying to achieve.
Thank you for your time, c++ scripts below.
gdexample.cpp
#include "gdexample.h"

using namespace godot;

void GDExample::_register_methods() {
    register_method("_process", &GDExample::_process);
    register_method("_ready", &GDExample::_ready);
}

GDExample::GDExample() {
}

GDExample::~GDExample() {
    // add your cleanup here
}

void GDExample::_init() {
    // initialize any variables here
    base=5;
}

void GDExample::_ready(){

    visual = VisualServer::get_singleton();
    loader = ResourceLoader::get_singleton();

    Ref<Resource> meshResource = loader->load("res://new_cubemesh.tres");
    RID meshRid = meshResource->get_rid();

    multimesh = visual->multimesh_create();
    visual->multimesh_allocate(multimesh, 1, visual->MULTIMESH_TRANSFORM_3D, visual->MULTIMESH_COLOR_NONE, visual->MULTIMESH_CUSTOM_DATA_FLOAT);
    visual->multimesh_set_mesh(multimesh, meshRid);

    RID instance = visual->instance_create();

    Ref<World> world = get_world();
    RID scenario = world->get_scenario();

    visual->instance_set_scenario(instance, scenario);
    visual->instance_set_base(instance, multimesh);

}

void GDExample::_process(float delta) {
    return;
}

Let me know if you need gdexample.h or gdlibrary.cpp and I can add, the formatting gets messed up if I include them here for some reason. It's basically just the tutorial stuff though.

sentences:
How to pause and resume a game in XNA using the same key? I'm attempting to implement a really simple game state system, this is my first game - trying to make a Tetris clone.  I'd consider myself a novice programmer at best. I've been testing it out by drawing different textures to the screen depending on the current state.

The 'Not Playing' state seems to work fine, I press Space and it changes to 'Playing', but when I press 'P' to pause or resume the game nothing happens. I tried checking current and previous keyboard states thinking it was happening to fast for me to see, but again nothing seemed to happen. If I change either the pause or resume, so they're both different, it works as intended.

I'm clearly missing something obvious, or completely lacking some know-how in regards to how update and/or the keyboard states work.

Here's what I have in my Update method at the moment:

    protected override void Update(GameTime gameTime)
    {
        KeyboardState CurrentKeyboardState = Keyboard.GetState();

        // Allows the game to exit
        if (CurrentKeyboardState.IsKeyDown(Keys.Escape))
            this.Exit();

        // TODO: Add your update logic here

        if (CurrentGameState == GameStates.NotPlaying)
        {
            if (CurrentKeyboardState.IsKeyDown(Keys.Space))
                CurrentGameState = GameStates.Playing;
        }

        if (CurrentGameState == GameStates.Playing)
        {
            if (CurrentKeyboardState.IsKeyDown(Keys.P))
                CurrentGameState = GameStates.Paused;
        }

        if (CurrentGameState == GameStates.Paused)
        {
            if (CurrentKeyboardState.IsKeyDown(Keys.P))
                CurrentGameState = GameStates.Playing;
        }

        base.Update(gameTime);
    }

sentences:
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:
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:
How to set default pose of model from Blender? (Exported as FBX) I have a model that has lots of animation clips(actions).

Before export as FBX, I set the pose to named "default" pose and exported as FBX like this.

But in Unity, it's changed to first animation clip in animation list in Blender!

I try to fix it, but there is nothing I can do. I can't change the order of animations in Blender and Unity either.

This wasn't first time, I had same issues before but I just ignored because it's fine in game play, but I really want to fix it this time.

What I want is set "default" pose in edit mode in Unity(not play mode). How do I set "default" pose as default, not first animation clip in the list?

Using Blender 2.78, and Unity 2017.3.0f3.

sentences:
What are some programming design patterns that are useful in game development? I have a few books on Design Patterns, and have read some articles, but cannot intuitively figure out which programming design patterns would be useful in game development.

For example, I have a book called ActionScript 3 with Design Patterns that details several design patterns such as Model View Controller, Singleton, Factory, Command, etc.

As someone new to this, I cannot figure out which of these would be useful, or in fact if any of these are the design patterns I should be learning and trying to use.  Perhaps there are other, more game-programming-specific design patterns that I am not even aware of?

If you have experience using a certain design pattern in game development, I'd love to hear it.  Reasoning as to why it was used, code samples, or online resources would all be very helpful as well if you have them.  I am at the moment most interested in ActionScript 3 and C++ implementations, but could definitely benefit from experience and examples from any language.

Thanks!

sentences: Best collision algorithm for Axis Aligned Bouding Boxes I have a number of quads (suppose like 20-40) and i want to quickly check the collisions between any of them. I would like to know if there's a quick algorithm to do that 60 times per second without performance decrease

sentences:
Why when adding audio foot steps to the character using animation events only one foot play the sound? The animation in the Animator is HumanoidWalk In the inspector of the animation in the Animation tab at the bottom I clicked on the Events clicked to add event names the function as Step and moved the time slider to 0.67 moved the slider in the preview window of the character so the right leg foot will be close to the ground and clicked on apply:

Then I did the same but changed the time a bit more almost to 0.7 and called the function Step again and at the preview window now it';s the other leg foot close to the ground and clicked apply:

I added to the character in the hierarchy a Audio Source component and a script name Foot Steps:

And the script it self:

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

public class FootSteps : MonoBehaviour
{
    [SerializeField]
    private AudioClip[] clips;

    private AudioSource audioSource;
    private GameObject[] Foots;

    private void Awake()
    {
        audioSource = GetComponent<AudioSource>();
        Foots = GameObject.FindGameObjectsWithTag("Foot");
    }

    private void Step()
    {
        AudioClip clip = GetRandomClip();
        audioSource.PlayOneShot(clip);
    }

    private AudioClip GetRandomClip()
    {
        return clips[UnityEngine.Random.Range(0, clips.Length)];
    }
}

In the Hierarchy in the script in Clips I added same 8 audio clips just for the testing I could add only 1 it doesn't matter:

When running the game I marked with blue circle only this foot play the step/s sounds. And if I change the time to be the same 0.67 it will play two sound the same so it will sound like one or if the time is 0.67 and 0.7 it will hear two steps but only on the left leg foot.

The second leg foot never play the sound no matter how many times I changed the preview animation legs.

I tried to follow the instructions of this tutorial but no success:

Add foot steps tutorial

Should be simple but only one foot is working. I can't figure out what am I missing.

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:
Cube that turns every for example 5 seconds 90 degrees I want a cube to rotate 90 degrees every [Second/Counter should be setable]

Like in this video at 3.47 the spiky cube that turns 90 degrees
https://www.youtube.com/watch?v=bxWpsT4lKXU

I have tried to do it but it will not turn 90 degrees smoothly or even 90 degrees, it just turns kind of 90 degrees but I need help I guess.

Here is my script:

public class TurnCubeScript : MonoBehaviour {

public Transform turnCube;

public float turnSpeed;
//SETTING THE COUNTER FOR OBJECT TO TURN
public float setCounter;
public float counter;
//SETTING THE COUNTER TO SETCOUNTER AFTER COUNTER1 = 0
public float setCounter1;
public float counter1;

void Start ()
{
    setCounter = counter + setCounter;
    setCounter1 = counter1 + setCounter1;
}

void Update ()
{
    TurnTheCube();
}

void TurnTheCube()
{

    counter -= 1 * Time.deltaTime;
    if (counter < 1)
    {
        //SOME TRIES...
        //turnCube.transform.eulerAngles += new Vector3 (0, 0, 90 * Time.deltaTime * turnSpeed);
        //turnCube.Rotate(0, 0, 90 * Time.deltaTime * turnSpeed);
        //turnCube.rotation = Quaternion.Euler(0, 0, rotation);

        counter1 -= 1 * Time.deltaTime;

        //GIVES THE CUBE SOME TIME TO TURN
        if(counter1 < 1)
        {
            counter = setCounter;
            counter1 = setCounter1;
        }
    }
}

}

sentences:
What is the definition of "tiles?" When we talk of tiles, are we strictly talking about images or the underlying data structures?

For example, I read an article which explains that tiles are a data structure that holds your game data. Then I read this article which explains that tiles are images that fit together.

Which is correct? Should I infer that "tile-based games" use both systems concurrently?

sentences:
How can I have realistically bending/flexing paper? I am a new hobbyist to Unity and I working on a game where the player goes around picking up clues in the form of paper notes to solve a mystery.

So far, thanks to the help I got here, I was able to animate a note made from a UI canvas and an image in game world to fly and rotate to align itself in front of the first person camera.

Although, it looks nice, it still looks like a rigid plank of wood rather than a piece of paper. Is there a way I could bend/flew/distort the canvas to give the illusion of a piece of paper rather than piece of wood?

Is it possible to bend a canvas or should I go towards another solution, like using an actual plane or quad during the animation effect?

sentences:
UE4 - Want my landscape to be unlit BUT catch shadows from objects Here is my problem, I have a landscape that was created through photogrametry. I already has strong shadows on it's diffuse texture so I don't want it to be affected by my virtual sun. What I do want though is for objects added in my scene to receive shadows from the landscape, and for the objects to cast shadows onto the landscape. To do that I matched my virtual sun as close as I could with the shadows on the diffuse texture of the landscape.

How do I keep my landscape unlit yet able to receive and cast shadows from and to other objects?

sentences:
Smart terrain generation to avoid unconnected tiles To make this clear from the get go;

I'm not looking for HOW To randomly generate a terrain (I know I can use Perlins noise for that).

I'm looking for an algorithm that can help with the terrain generation.

Example;

Me and my friend are working on a flash game to be use as advertisement for an upcoming game (And to see if theres actually interest for the base game).

And I've been working on randomly making terrains, however!
When i generate the map, i have no idea how to make it so it connects properly.

The map is isometric and tilebased and after its been generated we're going to litter chest/traps and other gameplay elements on the map. However, theres no reason to put an item on a piece of that map thats not connected to the rest of the map.. Or worse yet, spawn a player on a tile thats unconnected to anything.

Does anyone know of a algorithm that helps with stuff like this?

Thanks in advance people.

~Etarnalazure

EDIT

What I'm looking for is an algorithm that makes sure theres no unconnected tiles,
thus no items or players may by accident get seperated from the rest of the walk-able tiles.

Hopefully this clears up what i mean.

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:
Unity crashes when opening a project Why does this happen?

I'm new to Unity development. I have installed Unity yesterday (2015-09-06). This is the error that I get:

sentences:
Tetris : Effective rotation I rotate each piece by rotation formula. More detail, because rotation angle is 90 so :

xNew = y;

yNew = -x;

But my method has met two problems :

1) Out of box : each type of pieces is fit in square 4x4. (0,0 at under left) But by this rotation, at some case they will out of this box. For example, there is a point with coordinate (5,6) So, please help me how to fit these coordinate into 4x4 box again, or give me another formula for this.

2) at I case : (4 squares at same row or same column), just has two rotations case. but in method above,  they still has 4 pieces. So, how to prevent this.

Thanks :)

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 set a static size for an object in GameMaker? I have many sprites with different sizes, and I have an object in which I set those sprites, but this object gets resized by the currently displayed sprite.

How can I set a fixed size for the object so that it can no longer change size?

Thanks for any help.

sentences:
How can I compare two quaternions for logical equality? I'm trying to write some unit tests and realize I don't know how to compare quaternions. I need to know if two quaternions represent the same orientation (the object would be facing the same way). With a vector like position I'd simply compare the parts and check they are close enough, but for quaternions the values can be very different.

How can I compare two quaternions?

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 to make dynamic DOF from mouse position in Unity 5? I found a video a while ago for how to make a dynamic DOF in unity. It fires rays from the camera and positions an empty at the location that the ray first hit. How can I change this so that it doesn't fire rays from my camera but rather from my mouse position, and then positions the empty from there?

Code:

public Transform origin; //Raycast origin
    public GameObject target;

    public CameraMovement cameraMovement;

    void Start () {

    }

    void Update () {
        Ray ray = new Ray(origin.transform.position, origin.transform.forward);
        RaycastHit hit = new RaycastHit();

        if(Physics.Raycast(ray, out hit, Mathf.Infinity)){
            Debug.DrawRay(Input.mousePosition, origin.transform.forward, Color.cyan);
            target.transform.position = hit.point;
        }else{
            Debug.DrawRay(Input.mousePosition, origin.transform.forward, Color.red);
        }
    }

sentences: Translating Objects in Worldspace Given the worldspace coordinates of a collection of arbitrarily positioned objects, how do I translate them while preserving their relative placement? For instance, I have a table and a few bowls that are placed on top of it at (x1, y1, z1) and wish to moved them to (x2, y2, z2).

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:
What's the difference between using hardware-accelerated APIs and the OS's drawing API? On Windows, I can do drawing with the OS API without OpenGL or D3D. The code I am writing will make calls to a device driver and tell the GPU what to do regardless, right?

How is using OpenGL different exactly? Do these libraries have code that will interact with the GPU differently than just the Windows API does?

sentences:
Getting Early User Feedback on Games Disclaimer: It may be that I'm already doing all the "right" things, but just don't have enough traffic for it to pay off with people giving feedback.

My question is: how do you attract early and quality feedback into games, from end-users? Ideally, I'm looking at a model where the seed of an idea comes from you (or from them, even) and you build it into a game, molding it along the lines that people tell you are best.

Because you're just one opinion. And game developers have a reputation for doing weird and sub-par quality stuff, sometimes.

I'm currently practicing the following:

VIP List: I have a "VIP" mailing list (mostly friends) who agreed to try out game releases and give me feedback. They seem hesitant to say anything negative, and most of them are not really gamers, just doing it because they know me and like my niche.
2-4 Week Releases: I use a form of agile and release iterations every two to four weeks. This means every release is functionally small, but somewhat polished.
Press-Releases: With every release, I also post a small "press release" post identifying the good, the bad, what's next, and screenshots (along with a link to play the latest release version).

I'm not getting that much feedback. What am I missing?

sentences:
How to achieve partial pathfinding? Let's say I already have an A* algorithm.

How can I handle the cases when the goal cannot be reached, and still attempt to get there?

For instance on the following example:

Notice the amazing GIMP skills!

The yellow unit needs to reach the green spot, but it's on island and can't actually reach it.

Yet, on a typical RTS, the unit will try to go as close as possible.

My problem is that I don't know how to tell A* that the closest tile to the goal is the square near the sea.

How can I have this partial pathfinding? Is A* still a good choice?

sentences:
Resetting variables when starting a new game What is the best practice when implementing a way to start a game when a previous game has been played and the game's variables have already some kind of values assigned to them?

The most naive answer would be to create a method that would set all the variables and objects the game uses to their default value.

However that would be obviously error prone in cases when some time later a new variable is added to the game and not added to the method where it's set to a default value - such cases could lead to impossible to track bugs when a game would work ok if started first time, but not thereafter.

This would also violate DRY principle as a variable would have a default value at two different places - in the place where it's used and in the method where it's reset.

sentences:
Recreating Common "Glowing Pillar" Effect in UE4 I've noticed a common "glowing pillar beacon" effect in a few games lately (Overwatch, Fortnite, etc). The effect provides a translucent glowing beam pointing upwards that tapers off towards the top and fades out.

I'm attempting to recreate the effect and was wondering if this is some form of particle emitter and what is involved in the effect?

Thanks!

Examples:

sentences:
HTML5 or Javascript game engine to develop a browser game I would like to start developing a MMO browser game, like Travian or Ogame, probably involving also a bit of more sophisticated graphical features such as players interacting in real time with a 2d map or something like that.

My main doubt is what kind of development tools I should use: I've a good experience with PHP and MySQL for the server side and Javascript (and jQuery) regarding the client side. Coding everything from scratch would be of course really painful so I was wondering if I should use a javascript game engine or not. Are there (possibly free) game engine you would recommend? Are they good enough to develop a big game?

Also, I saw a lot of HTML5 games popping up lately but I'm now sure if using HTML5 is a good idea or not. Would you recommend it? What are the pro and cons about using HTML5? If you'd recommend it, do you have any good links regarding game development with HTML5?

(PS: I know that HTML5 and a Javascript engine are not mutually exclusive, I just didn't know how to formulate a proper title since English is not my main language. So, please, answer addressing HTML5 and a game engine pro and cons separately)

sentences:
XNA `tex2Dlod` always returns transparent black I want to sample a texture in a vertex shader, so at first I just tried using

float2 texcoords = ...;
color = tex2D(texture, texcoords);

But apparently I cannot use tex2D in a vertex shader, and must use tex2Dlod. So then I changed the above code to

color = tex2Dlod(texture, float4(texcoords, 0, 0));

But now color is always float4(0, 0, 0, 0) (i.e. transparent black).

Why is this, and how can I fix it?

EDIT: I know for a fact that the texture does not contain just transparent black pixels.

sentences:
Unity Procedural Build/Exe Creation I want to export ingame items to seperate data files. Those files should also be "openable" to display information about the item. My idea is to create every item as an .exe that will open a small windowed unity app with and image and some texts/tabs.

How would I handle this "procedural building of .exes" from within another application? For exeample I have a game with an inventory. And when I press "export to file", the item is build to an "item data exe file", that is then portable and openable as a standalone "item previewer".

Thank you for help. For the start a general assessment of this idea could also be helpful.

sentences:
Difference between Arcade, P2 and Ninja physics in Phaser I am a beginner and trying to learn game development using Phaser. Currently Phaser is providing three physics systems namely Arcade, P2 and Ninja. But I don't know the differences between them and I would also like to know in which scenario we should use a particular physics system?

Please give me some insight for these physics systems.

sentences:
Unexpected scaling of UI elements after build [Unity Web] I have an unusual scaling of UI Elements after my build in unity for WebGL

Game in Unity Engine:

Game in Itch.io:

Has anyone seen this kind of behaviour? any suggestions on what I should look into?
Happy to provide more info on the matter.

Thanks!

sentences:
Variable number of light sources I'm going to be writing a very simple renderer, mainly for learning purposes (using OpengGL).
I've been wondering about how to implement support for dynamic number of light sources.
Two solutions that come to my mind are:

Define an upper limit for each kid of light source (point, directional etc) and pass an array of lights in an uniform.
Write a shader for each of the light source type, iterate over each light in the scene and invoke it's appropriate shader, giving it as input the gBuffer with positions, normals and etc. This seems inefficient for me, as we will loop n times through the fragments in the framebuffer, where n is the number of lights.

Are there any more solutions?

sentences:
2D sprite 360 degrees rotation according to the mouse I am trying to make my top down character rotate according to degrees between its position and the mouse. I'm using this code:

float xDiff = mouseState.X - (graphics.PreferredBackBufferWidth / 2);
            float yDiff = mouseState.Y - (graphics.PreferredBackBufferHeight / 2);

float angle = (float)(Math.Atan2(yDiff, xDiff)) * 180 / Math.PI);

But it's not working. At the place where I should get somewhere about 0 degrees - I get about -75.

sentences:
Designing a "Grid" like object that contains game objects I am working on a 2D game, where there's a game "board" on which other game objects are placed.

This this is 2D, my starting point was to design a class that will internally use a 2d array for the actual stored game objects.

This class could be simply accessed by 2 indices: (i, j) to get game objects on it.

My problem is that i have no idea how to make the game "board" "propagate" its data onto its children.

Design questions i ran into are:

Should the children placed on the board have display properties such as size, screen position?
Should the board itself dictate this information?
How to update children in case the board changes some of its properties? (position, etc).
Should the board be aware of the types of objects stored in it ?

I have no idea how similar things such as WPF or other UI frameworks go about organizing a "container like" object that can arrange or apply certain UI properties to its children.

sentences:
2D fighting bounding boxes I'm prototyping a 2D platformer/brawler game for uni and I'm having some trouble with creating collision/bounding boxes. This is most likely going to end up on a Vita so I do have some library constraints as well as performance implications.

None of this has yet been implemented but is all theory.

My idea was to have the artist create a sprite sheet for the character animation and then a second identical sprite sheet with the corresponding  collisions in a solid colour (e.g green for where the character can be hit and red for dealing damage, near the foot if kicking etc.)

With this, I would then parse the collision sheet and generate the various collisions required storing them in the character model. This is the point I feel would be most inefficient.

While I think this is a possible solution, I was wondering if there was a more standard way of doing this or a more efficient way as I feel this would have severe performance problems.

sentences:
Best way to implement mouse-based movement in MMOG I want to design an MMO where players click the destination they want to walk to
with their mouse and the character moves there, similar to Runescape in this manner.

I think it should be easier than keyboard movement since the client can simply send the server the destination each time the player clicks on a destination.

The main thing I'm trying to decide is what to do when there are obstacles in the way.
It's no problem to implement a simple path-finding solution on the client,
the question is if the server will do path-finding as well, since it'll probably take
too much Computation power from the server.

What I though is that when there is an obstacle the client will send only the
first coordinate it plans to go to and then when he gets there he'll send the next coordinate automatically.

For example if there is a rock in the way the character will decide on a route that is made of two destinations so it goes around the rock and when it arrives at the first destination it sends the next coordinate.

That way if the player changes destination is the middle he won't send unnecessary information.

Is this a good way to implement it and is there a standard way MMOGs usually do it?

EDIT: I should also mention that the server will make sure all movements are legal and there aren't any walls in the way etc. In the way I wrote it should be quite easy since all movements will be sent in straight lines so the server will just check there aren't any obstacles along that line.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

sentences:
Java - LibGDX low fps on completely empty project I started working on a really really small prototype and when I ran the application i noticed the FPS was only half of what it's supposed to be at. FPS stays at around 30-31 instead of 60 - even when I literally erased all code from running sitting with an empty project it's still 30. I even tried to import an old project which used to work fine with high fps but it also runs at 30.

I also tried importing a LWJGL project and it worked fine with 60 FPS.

I've tried restarting my computer as well and other games run fine on my computer. Note that I've developed in LibGDX for quite a long time and never encountered this before - any help is appreciated!

sentences:
1 Texture For Multiple Models, Or 1 Model Using Different Textures For Each I'm creating some voxel flowers that are exactly the same, just different colours.  Is it better to create 5 models and use 1 texture that has the 5 different colours, or create 1 model and use 5 different textures for each colour?

Am curious as to which is more efficient in regards to performance, as there could be quite a few flowers on screen.

I'm playing around with MagicaVoxel and Unity.

sentences:
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:
How to drag an object with mouse with collision? I want to drag a GameObject with the mouse but I need collision. The basic mouse dragging code simply sets the position of the object to the hit.point with an offset from the difference at the start of the drag.

As for collision, I've tried using kinematic rigidbodies and setting the position with rigidbody.MovePosition(uh) but that allows the object to rotate while pushing it up against a corner on one side.  With rotation constraints enabled, it flickers a lot and still intersects a lot. I also tried playing with collision detection and interpolation. None of the settings improved it.

I also tried Physics.ComputePenetration but that is extremely messy because some of the objects I'm dragging, have several colliders. The distance it calculates is per collider so it doesn't calculate the offset required to separate the entire object. I tried disabling all the colliders and then adding a single box collider sized to fit the bounds of the object. That had bad flickering problems.

The last thing I tried was box casts on each side that would find the closest point and offset the mesh in that direction. But if I moved the mouse too fast it would go inside the other mesh and would no longer register any colliders intersecting the box casts. It also suffered from flickering problems.

Ideally, I want to have fairly accurate detection. I don't want to approximate the other colliders (not the ones on the object I'm dragging). Assume the other colliders could be any type (box/capsule/sphere/mesh).

The image below shows the problem I'm having. The green dot shows approximately where the cursor was (also the hit.point from the raycast on the surface of the red cube). What I expect is that the couch should be offset so that it was close to the cursor but prioritizes not intersecting other meshes over sticking to the mouse.

sentences:
How to get the fingerID (Touch) that is pressing a specific UI button. (Unity) I want to displace a button along with the screen position that is pressing on it.

However, having multiple touches at the same time results in wanky behaviour.

So I want to limit the button's movement to the touch that started it.

I'm aware of the PointerEventData.pointerId but I couldn't figure out how to use it.

sentences: Detect android device rotation I am developing a game in android and I want to be able to use device rotation for moving. So, I am not sure what sensors should I use. I tried gyroscope, it will do, but there are not a lot of devices that supports gyroscope sensors. So, I want to use rotation around x,y,z axis not change like landscape/portrait mode. What sensors would be the best? I already tried to google it but I couldn't find anything.

sentences:
In ROBLOX, how can I check what is in front of me? In ROBLOX Studio I need to check what part is in front of the model Freddy.

I need to set the variable called thingInFront to the part that is in front of the model Freddy so that I can decide whether I should allow him to walk through or not. This is my current code:

thingInFront = nil
if thingInFront.BrickColor == BrickColor.new('Black') then
    script.Parent.Parent.CanCollide = true
else
    if not thingInFront.BrickColor == BrickColor.new('Black') then
        script.Parent.Parent.CanCollide = false
    end
end

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:
Object pooling with collisions in Unity I am trying to create doodle jump like game with object pool for platforms. I have created an empty object with box 2D collider attached to it. This object moves with player and should be gathering platforms which exit its collider, but it isn't.

public class PoolGrabber : MonoBehaviour {

[Tooltip("Field for game manager.")]
[SerializeField]
private GameObject gameManager;

private void Awake()
{
    gameManager = GameObject.FindGameObjectWithTag("GameManager");
}

private void OnTriggerExit2D(Collider2D collision)
{
    if(collision.tag == "PooledObject")
    {
        collision.gameObject.SetActive(false);
        gameManager.GetComponent<LevelGenerator>().objectPool.Add(collision.gameObject);
    }
}

It also doesn't work with OnTriggerEnter2D.

I have also tried

private void OnBecameInvisible()
{
    gameObject.SetActive(false);
}

on a platform. Doesnt work either.

I have discovered that for all those methods above object required to has Rigidbody2D component. But what if I don't want any phisycs calculations to be handled. I don't need physics on those platforms at all. Also, an object doesn't become invisible if you see it in the editor window. Isn't very convenient.

sentences:
Google Play Services Library not found. How can I get this? So this question is in relation to, but not the same as my previous question (How do I successfully implement Google Mobile Ads and Google Play Services into my Unity arcade game?). That is why I am making a new one. I am almost ready to publish my app now the I have ads working but in the process of implementing Unity Ads I was forced to re-implement Google Play Services. I did so with an updated version of Google Play Services and now I am receiving this error:

Does anyone know how to fix this?

sentences:
How are games created for different platforms? How are games created for different platforms?

For example, Call of Duty: Modern Warfare 3 is available on PS3, Xbox 360, Wii and PC.

Are they completely reprogrammed with no common code? Is there any intermediate code?

sentences:
How can I make the player slide when he does a 180 degree turn? I'm making a roller skating game and I would like to player to skid or stop moving skating when they try to move in the opposite direction of their current one. But I'm not sure how to go about this.

I tried computing the the dot product of the input of the current frame and the last and if the product was less than  or equal 0 that must mean the player did  a 180 and the player's velocity was stopped. But it did not work, the product was always greater than 0,

sentences:
directx render order / alpha blend rendering I have a question about how to proper render 3d objects in a good order.
I use blend states to render some 3d models with a transparent texture.
This works but if there are multiple alpha objects in the scene it gets messed up because of the seemingly random render order.

Now I ask myself how should I do it?

The first theory I have in mind would be:
When I render something I actually don't render it, I just save it in some sort of queue and sort it later at the final end call (expensive because I have to allocate / deallocate memory a lot and sort).

But even with this theory I still dont know how I should sort them.
I cant just look how they are positioned because at some times they are kind of in each other so looking for these values would produce in wrong results.

I already guessed that i have to order in the way the camera is positioned or some way.

Hope you can help me

sentences:
When I select one vertex it selects multiple vertices? I'm trying to do some kind of a face. When I select a vertex it selects two other vertices. However, when I try to select one of the two other vertices it doesn't select them.

I want to move only one vertex to make it right.

My model is an editable poly.

Link to my model so if you want to inspect it properly.

Front view :

Linked vertices :

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:
Very easy game builders? Possible Duplicate:
  What are some good game development programs for kids?

I want very easy game builder for a kid - somebody who knows nothing about programming games (how they work inside) and just wants to build some (I could teach him but I am not available all the time). She tried Adventure Maker and got confused. It has to be something very straightforward. Do You know about any? Thanks. :)

sentences:
Displaying Images Correctly So, I've been working on several smaller game project in past few months, and I've got the hang of game dev in java. Now I'm trying to optimize game performance. Is it ok to simply use g.drawImage();to display sprites and other images?

Note that I'm trying not to use any external libraries.

sentences:
What is the logic beyond cube collisions? I am trying to simulate a colliding of two cubes , I actually tried and read a lot for many days but i did not get the idea beyond it,I know how to detect when they collide.

Maybe my question is divided for many aspects, How to detect rotation and movement of these cubes after colliding , What is status of two cubes would be ?

Sorry if was not clear or dumb, I would thankful if you could help

sentences:
How to convert from frag position to UV coordinates when my viewport doesn't cover the screen? So, I'm implementing SSAO as part of my rendering pipeline using OpenGL/GLSL. It works pretty well when I have a camera that takes up the entire screen. However, when my camera is smaller than the full screen size, the SSAO texture doesn't get sampled correctly. Here is the relevant GLSL shader code:
// Convert from clip-space
vec2 fragCoords = (fragPos.xy/ fragPos.w); // fragPos is MVP * worldPosition
vec2 screenCoords = fragCoords * 0.5 + 0.5; // Convert from [-1, 1] to [0, 1] to sample UV coordinates

// Sample texture
float ssaoFactor = texture2D(ssaoTexture, screenCoords).r;

I know that there is some funkiness going on with the viewport, but the fixes that I've tried haven't worked. My first thought was to scale fragCoords by normalized size of my viewport (e.g. vec2(0.5, 0.5) for a viewport with half of the width and height of the screen), but that just produced a very strange result. Any thoughts?

sentences:
How do I tell the difference between tapping and holding the touchscreen? I have a problem with the Unity game engine. I am making an Android game. I want to move an object by a small distance every time the user taps the screen, but not when the user holds the screen.

This is my current code. When the user holds the screen, the object keeps moving. I want to only move the object once the user touches the screen and not move it again until they released it:

void Update () {
        if (Input.touchCount > 0) {
            transform.position = new Vector2(transform.position.x, transform.position.y+0.1f);
        }

sentences:
Streaming 3d model --> unity android I want to include a feature in my game that allows me to host raw 3d models (.fbx/ .obj/ etc., not AssetBundles) on a server.
The game should download these files, save them to the device and load them into a scene.
I want to support multiple file formats, so writing my own parser is not an option!

First idea:Use the WWW class to load the model data, save it as a String in the player prefs, and load it if requested.(the last part is the problem)

Second idea:Use the WWW class to load the model data, extract the jar file containing StreamingAssets folder to the sdcard. Writing the model data into a new file in this directory. Creating a new ZIP..ah...JAR archive from the folder and replacing the old .jar file.Of course I would need an Android Plugin and a archive java library for that. Then the Models will be loaded from the Ressources.(this is a pretty weird idea and cannot be the right way)

Do you know, if that works?Has anybody ever done something like that?

UPDATE 1:

I tried to use the obj loader from samed-tarık-Çetİn's comment, but I got this error:

ArgumentNullException: Argument cannot be null.
Parameter name: key
System.Collections.Generic.Dictionary`2[System.String,UnityEngine.Material].get_Item (System.String key) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:136)
GeometryBuffer.PopulateMeshes (UnityEngine.GameObject[] gs,     System.Collections.Generic.Dictionary`2 mats) (at Assets/OBJ/src/GeometryBuffer.cs:145)
OBJ.Build () (at Assets/OBJ/src/OBJ.cs:236)
OBJ+<Load>c__Iterator0.MoveNext () (at Assets/OBJ/src/OBJ.cs:63)

Replacing line 145 in GeometryBuffer.css with gs[i].GetComponent<Renderer>().material = new Material(Shader.Find("Standard")); did resolve the runtime error and a Material, OBJ (Mesh Filter) and Mesh Renderer Component have been added, but it still show a model.

UPDATE 2:
I am behind a proxy so loading the model from the web didn't work.
Loading .obj files from file:///<path to obj> works perfectly fine though.

sentences:
OBB vs OBB Collision Detection Say you have two Bounding Box Objects each of them storing the current vertices of the box in a vector with all the vertices of the object rotated and translated relative to a common axis.

Here is an image to illustrate my problem:

How can I work out if the two OBB's are overlapping any links to help explain the solution to the problem would be welcome. Nothing too convoluted please...

sentences:
How to implement trading card game's "special effects cards"? I am trying to write a kind of a trading card game here, in some way, it is similar to Magic The Gathering, or the Yu-Gi-Oh! card game.

For those of you who are not familiar with it, basically, in the game, there is a special kind of card (Spell cards/ Trap cards/ etc.), which have special effects that can bend the rules of the game. What I totally have no idea is, how to implement the logic of these cards. I have some idea of storing the card's data with some flags that can signal what kind of ability it has, but that would be very limited in what it can do (only some simple stats modification, maybe).

To give you an idea of what kind of effects these cards can have, here is some example of the spell card effects that are present in the Yu-Gi-Oh! card game:

Revive a creature that has been destroyed
Take control of the opponent's creature
Modify stats of the creature based on some conditions (e.g. Number of creature with certain names that have been
destroyed)
Special summon a certain creatures if the some conditions are fulfilled.
Fuse two or more creatures into a stronger creature.
Immunity to some of the special cards' effect.

Konami has made several video games of the game, complete with the AI and thousands of cards variety. I don't think it is actually possible to hard-code the entire database, is it?

Now, of course what I am trying to do is in no where as complex as those games, but I am curious, how do they implement these?

sentences:
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 get a job in the game industry if you live in a country where there are no game companies? You know not everyone of us is living in the US/Europe where there is potentially many more employers/opportunities than other countries, I live in a country where there is literally zero game companies (aside from a couple of companies that make HTML games), but I am sure there are many other people with the same situation, I am making some prototype games that will/might help.

But the real question is there any better way to get noticed (at least get an interview) by international companies, or given you are living far away will diminish their interest in hiring you?

-This question might be considered subjective or even a duplicate, but I feel am addressing an issue that might not have been addressed.

sentences:
Cascaded Shadow Maps: clipping against scene bounds I just implemented an initial version of CSMs based on the MSDN articles Common Techniques to Improve Shadow Depth Maps and Cascaded Shadow Maps.

I fit the shadow projection to the view frustum, and do not clip against the scene bounds, because in Common Techniques to Improve Shadow Depth Maps it is stated:

  It is also possible to clip the frustum to the scene AABB to get a tighter bound. This is not advised in all cases because this can change the size of the light camera's projection from frame to frame. Many techniques, such as those described in the section Moving the Light Texel-Sized Increments, give better results when the size of the light's projection remains constant in every frame.

However, in the paper from the Nvidia SDK the frustum is further clipped against the scene bounds to achieve a maximum used area for the shadow map.

This confuses me. Did the guys from MSDN miss something, is the Nvidia paper simply older or am I not understanding the Nvidia approach correctly?

Edit: I was right in not understanding the Nvidia approach, basically not at all. I confused the crop matrix with a clipping against scene bounds.

sentences:
Looking for a 2D spatial partitioning method for my top down browser game Hi I am currently using a modified version of spatial hashing algorithm written by Christer Bystrom. This algorithm is OK for collision detection. However when I use it for detecting entities in interested range it has its limits.

I use a huge map. (10000 x 10000 pixels) When I am moving my player, I expect to see what are around my player on the screen. Sometimes some entities are right in front of me or just behind me but I can't see anything on the screen until I get really close.

Here is a visual demo I created for that algorithm. I modified it to work with circle objects. In the demo picture I have already set the powerOfTwo attribute to 9, which is pretty big. The green circle is my mouse position. The red circles are those entities within my player's interested area. But this is not a good solution. The player should be able to see things on all directions around itself and stretch out further to about the same size of the rectangle area holding those red circles.

So I am looking for a better solution out there to implement in my game. I hope it is accurate and fast for detecting entities within interested area, and better not too hard to understand. It can be any other way (quadtree, dynamic tree, RTree or whatever fits the type of game I am making). I have also read about this, but not sure if those methods work well with interests management.

sentences:
Get MouseUp event outside of Sceneview scene window? So I have an editor script that uses a dragging operation which works quite nicely.  Except, if you release the button while OUTSIDE the Scene Window, the event doesn't register.
How do I detect mouseup outside of the scene window?
private static void OnScene(SceneView sceneview)
{
    Event e = Event.current;
    if (e.type == EventType.MouseDrag)
    {
        //do some drag stuff
        e.Use();
    }

    if (e.type == EventType.MouseUp && e.button == 1)
    {
        //is the Right Mouse button released?
    }
}

I suspect somehow it's due to my Event e being inside the OnScene making the mouse actions only existing in the context of the Scene Window perhaps?  I have no idea, very new to Editor scripting...

sentences:
Why does a unit vector show direction? If I have two objects, Person A and Person B, and I want to know if Person B is facing the same direction as Person A; once I have the vectors, how do I use the normalized vector to show direction?

I've read the math on vectors, but I'm still learning, and I am not understanding how the unit vector shows direction.  I know it does, but I don't know why.

One person said they imagine it on the unit circle. I understand how that can show a direction, but what I don't understand is how the normalized vector shows me a direction.

I have seen "What is a direction vector and why should it be normalized?", but I am still missing it.

sentences:
Bash script crashes when sourcing I have been following a tutorial about setting up vulcan on macOS and have been having trouble. I think it might have something with the versions. I am using 1.1.101.0 and the tutorial uses 1.1.73.0

here is my /.bash_profile

sentences:
Why don't C++ Game Developers use the boost library? So if you spend any time viewing / answering questions over on Stack Overflow under the C++ tag, you will quickly notice that just about everybody uses the boost library; some would even say that if you aren't using it, you're not writing "real' C++ (I disagree, but that's not the point).

But then there is the game industry, which is well known for using C++ and not using boost.  I can't help but wonder why that is.  I don't care to use boost because I write games (now) as a hobby, and part of that hobby is implementing what I need when I am able to and using off-the-shelf libraries when I can't.  But that is just me.

Why don't game developers, in general, use the boost library?  Is it performance or memory concerns?  Style?  Something Else?

I was about to ask this on stack overflow, but I figured the question is better asked here.

EDIT :

I realize I can't speak for all game programmers and I haven't seen all game projects, so I can't say game developers never use boost; this is simply my experience.

Allow me to edit my question to also ask, if you do use boost, why did you choose to use it?

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:
Is it possible to rent a server for my own game? I'm an independent game developer and I don't yet have a lot of money to buy myself a very cool high-speed and low-latency internet connection along with a powerful server machine to place somewhere in the world to host my very own game's server application for my fans to play on.

I know it's possible to rent a server for an existing popular game (for example, Team Fortress 2), but how about renting a server for my own game that I'm developing? Are there services specifically for that, or should I just rent some general purpose something and go from there?

Such a server should be:

Easy to update
With a low-latency for a specific region (I'm planning on renting EU and US servers)

sentences:
Libgdx box2d - what is the best approach to spawn an actor on a stage dynamically? I'm currently building a 2d sprite infinite runner game, but everytime I spawn new enemy(actor) and platform, I noticed that there's a delay on it. Any idea of what would cause this behavior? I'm using textureAtlas to animate each enemy, and I used the same approach of Drops game in LibGdx.

Here's my code on the stage class

private void update(Body body) {
  if(TimeUtils.millis() - lastSpawnTime > 3000){
    float y = (float) (Math.random() * ( 5  - 1 ));
    setUpGroundInfinite(50 , y );
    createEnemy(51, y +  3);
  }
}

private void createEnemy(float positionX, float positionY) {
  Enemy enemy = new Enemy(WorldUtils.createEnemy(world,  positionX,  positionY));
  enemies.add(enemy);
  addActor(enemy);
  lastSpawnTime = TimeUtils.millis();
}

If you see any other way to optimize my game, I'd like to know them!

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:
Are we supposed to be creating player prefab? This may seem like a dumb question, but I want a single player object for the entirety of my game. However when I load multiple levels obviously I need to reload the player so I would create a player prefab and instantiate him. However, it seems counterintuitive as prefabs are for objects you want to create multiple instances of easily, correct?
Also, I need values to be carried over accross levels for my player object therefore I guess I would need a static global singleton to store the player objects.

Hence the dilemna and confusion! Can anyone help me out here?

sentences:
Using AdMob with Games that use Open GLES Can anyone help me integrating Admob to my game. I've used the badlogic framework by MarioZencher ... and My game is like the SuperJumper. I am unable to use AdMob after a lot of my attempts. I am new to android dev...please help me..I went thru a number of tutorials but not getting adds displayed ...

I did the following...

get the libraries and placed them properly
My main.xml looks like this

android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>

My Activity class onCreate method:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

RelativeLayout layout = new RelativeLayout(this);
adView = new AdView(this, AdSize.BANNER, "a1518637fe542a2");
AdRequest request = new AdRequest();
request.addTestDevice(AdRequest.TEST_EMULATOR);
request.addTestDevice("D77E32324019F80A2CECEAAAAAAAAA");
adView.loadAd(request);
      layout.addView(glView);
      RelativeLayout.LayoutParams adParams =
              new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,
                              RelativeLayout.LayoutParams.WRAP_CONTENT);
      adParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
      adParams.addRule(RelativeLayout.CENTER_IN_PARENT);
      layout.addView(adView, adParams);
      setContentView(layout);

requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                     WindowManager.LayoutParams.FLAG_FULLSCREEN);
glView = new GLSurfaceView(this);
glView.setRenderer(this);
//setContentView(glView);

glGraphics = new GLGraphics(glView);
fileIO = new AndroidFileIO(getAssets());
audio = new AndroidAudio(this);
input = new AndroidInput(this, glView, 1, 1);
PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, "GLGame");

}
My Manifest file looks like this ....

    <activity android:name="com.google.ads.AdActivity"
      android:configChanges="keyboard|keyboardHidden|orientation|smallestScreenSize"/>

</application>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-sdk android:minSdkVersion="7" />

When I first decided to use the XML for admob purpose ..it showed no changes..it even didn't log the device id in Logcat...

Later when I wrote code in the Main Activity class.. and run ...
Application crashed ... with 7 errors evry time ...

The android:configChanges value of the com.google.ads.AdActivity must include screenLayout.

The android:configChanges value of the com.google.ads.AdActivity must include uiMode.

The android:configChanges value of the com.google.ads.AdActivity must include screenSize.

The android:configChanges value of the com.google.ads.AdActivity must include smallestScreenSize.

You must have AdActivity declared in AndroidManifest.xml with configChanges.

You must have INTERNET and ACCESS_NETWORK_STATE permissions in AndroidManifest.xml.

Please help me by telling what wrong is there with the code?
Can I write code only in xml files without changing the Activity class ...
I will be very grateful to anyone providing support.

sentences:
DevIL image library isn't loading my image This is the first time I've had this problem, my code just won't load the images I need it to.

Here is my first function for loading the image into data:

    void C_Resource_Loader::v_Create_Image(std::string filename,int nID)
{
    //create image and bind to it
    ilGenImages(1, &image[nID]);
    ilBindImage(image[nID]);

    //check if DevIL successfully loads the image
    success = ilLoadImage(filename.c_str());
    if(success)
    {
        success = ilConvertImage(IL_RGBA, IL_UNSIGNED_BYTE);
        if (!success)
            SDL_Quit();
        //create texture and bind to it
        glGenTextures(nID,&texture[nID]);
        glBindTexture(GL_TEXTURE_2D,texture[nID]);

        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);
        glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

        glTexImage2D(GL_TEXTURE_2D, 0, ilGetInteger(IL_IMAGE_BPP), ilGetInteger(IL_IMAGE_WIDTH),
        ilGetInteger(IL_IMAGE_HEIGHT), 0, ilGetInteger(IL_IMAGE_FORMAT), GL_UNSIGNED_BYTE,
        ilGetData());

        ilDeleteImages(nID, &texture[nID]);
    }
}

and here is my code for putting the image on the screen:

void C_Resource_Loader::v_Apply_Image(int nID, int pn_X, int pn_Y, int pn_Depth)
{
    glPushMatrix();

    //bind the image so it can be textured
    glGenTextures(1,&texture[nID]);
    glBindTexture(GL_TEXTURE_2D,texture[nID]);

    //move the image to the set x and y
    glTranslatef(pn_X,pn_Y,-600);

    glBegin(GL_QUADS);

    glTexCoord2i(0,0);
    glVertex3f(0,0,pn_Depth);
    glTexCoord2i(0,1);
    glVertex3f(0,32,pn_Depth);
    glTexCoord2i(1,1);
    glVertex3f(32,32,pn_Depth);
    glTexCoord2i(1,0);
    glVertex3f(32,0,pn_Depth);

    glEnd();
    glPopMatrix();
}

Is there a major problem with it, because this code should work, I've used it many times before...

sentences:
Wheels not facing right direction when car faces different directions I am creating a real time multiplayer driving game in Unity. I am using google play's real time multiplayer service. I am having an issue where the wheels of the cars that are over the network are not facing the right direction. What I am currently trying to do is just add the calculated steering angle to the current rotation of that particular player's car, but for some reason the wheels face the wrong way and rotate incorrectly if the car is facing certain directions. Logically I thought what I have is correct. Basically for each wheel I use this code:

car.transform.rotation = Quaternion.Euler(0, car.transform.rotation.y + steerAngle, 0);

So I find the rotation of that car and then I add the steer angle to it. Why wouldn't this work?

sentences:
How to 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:
Curved movement between two points What is a good technique to enable an object to move between to points in a nice curved motion?

The end position could also be in motion, such as the trajectory of a homing missile.

sentences:
Strategy/City Builder browser game - technical details I actually have multiple questions into one. Hopefully someone can hit all of them.

I wanted to give a try at a massively multiplayer web based game. Basically, the game would have similarities to Evony, or Eve Online (a much scaled down version). The idea is it would be a mostly real time city builder (like Evony) that allows complex actions between players (like Eve Online but without the graphics and much scaled down). It would sort of be like a database game. I want it to be able to support around 500 people simultaneously online off one server.

However, I have multiple issues that I want to pin down before I actually start writing the code.

Continuous database updating

The database has to be continuously updated on a small time interval to reflect the passage of time in the game verse. Furthermore, the effects of all actions will have to be calculated as well. Right now I'm thinking about using mysql with events using the innoDB engine to do this. Is there a better/faster approach to this?

Continuous graphical updating

Certain details (such as "time till completion" etc when building something) need to be continuously updated on the user interface. I'm thinking about having each page in the user interface continuously make ajax calls for the information. Again, is there a better/faster way?

Thanks

sentences:
Social Network Gaming on Windows, Linux and OS X I'm working on mobile platforms as Android, IOS... Many users of Moblox ask us a windows and an OS X version.
There is no difficulties to provide these versions, because we are developing on OS X C++ code but we miss global scores and social network part (facebook, twitter). Is there any library to implement these functions on Desktops plaforms ?

On mobile platforms, we have many SDK to provide theses functions as OpenFeint, ScoreLoop, Plus+. We have used cocoslive and uploaded scores with libcurl but it's very limited.

sentences: 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:
A panel to change 3d object properties when right click on it (Unity) I'm building a UI system to edit selected 3D objects. I have spheres on the screen and I want to be able to edit their proprieties (radius for example). In order to do that I want the user to be able to click on a sphere and then it show a panel next to the object. When the user changes slider value the radius of the sphere which as been clicked on change. Using the new unity event system, I think it's easy to achieve, but I'm a new to unity and even if I know the basic I don't know how to organize this properly.

At the end my goal would be to select multiple sphere, right click and edit the radius to all selected spheres. http://imgur.com/WgBCrmk Any tips on how to do that ? Sorry for my poor english. Thanks

sentences:
file:write restarts Corona app I am attempting to implement an auto-save feature into a mobile game.  I have the following code writing to the save file:

function saveFunc(input)
local saveData=input
local file = io.open( "saveFile.txt", "w" )

for i,val in ipairs(saveTable) do
    saveData=saveData.."\n"..val
end

file:write( saveData )
io.close( file )
end

This writes to the file correctly.  The problem is that after the function finishes, the whole app restarts.  Watching the output console, it re-prints the "Copyright (C)..." as if I had Relaunched the app.

I know it is this specific function because if I comment out the call for this function the game continues as normal.  I also tried commenting out the io.close(file) but the program still restarted.

How can I write to a file and not restart the app?

sentences:
Unity - Check if object is facing Vector3 coordinates I am having a hard time figuring this out, I want to have objects that move around randomly, and when they get new coordinates to move towards, face them, and then move.

Here's explained:

Target moves towards point A.
Target reaches point A.
Get new coordinates.
Rotate towards the new coordinates WITHOUT moving
When facing the new target coordinates, start moving

I am trying it with Raycast, but it doesnt work, it tells me it always looks at them...

if (Physics.Raycast(transform.forward, randomTargetCoords, out hit)) {
    Debug.Log("spotted");
}

I want to project the ray from the front of the object to the target coordinates (Vector3), and if true, do any code inside the if method.

How can I do it?

EDIT: Here is the code for moving and rotating the object

transform.position = Vector3.MoveTowards(transform.position, targetCoords, moveSpeed * Time.deltaTime);
transform.rotation = Quaternion.RotateTowards(transform.rotation, targetRotation, rotationSpeed * Time.deltaTime);

sentences:
Where in code to for collision? In object class? Mainline code? Making a simple game in Love 2D framework where if I click on an object then it disappears.

Do I check to see if I've clicked the enemy inside a function in the enemy object? Or just in my main.lua? Currently I have this code in my main.lua:

function love.mousepressed(x, y, button)
   if button == "l" then
      for i,b in ipairs(bugs) do
         if b:isClicked(x, y) then
            table.remove(bugs, i)
         end
      end
   end
end

Is there a standard design pattern on where this code should belong?

sentences:
What tools are available for game script writing? I'm looking to find some software options on OS X that are geared toward writing game scripts. Features like the ability to craft dialogue trees and other non-linear script formats would be appreciated.

I own Celtx and love its ability to store character information along with various other media assets, but it's very linear and straight, film-style script based which doesn't exactly work well for game applications.

Any dedicated or more appropriate software options out there?

sentences:
Instantiating prefabs by dragging in scene not working So I have this problem where I try to instantiate prefabs as in this video for example. I can take instantiate one prefab to the scene, but if I try to instantiate a second one to the scene (whether it's with the same prefab or a different one), instead of creating an instance of the second prefab, it brings the first instance I had created to my mouse and I'm in position to move it by dragging it around.

The only work around I have for this so far is to drop into the hierarchy instead of the scene (which works fine), but I have to carefully avoid the scene while dragging and dropping, otherwise the above-described issue happens instantly.

Am I doing something wrong, or is this a bug of some kind?

EDIT : I managed to reproduce the error in a consistent manner. I don't know why it happens, but it does every time. It doesn't involve code and it is very simple to reproduce (at least for me, perhaps not for you if you're not doing the wrong thing that I do...).

I created a new project. I created a cube and a sphere. I turned them both into prefabs and deleted the original instances (they have the .prefab extension in my folder, so I am sure). I drag-dropped the cube in, works fine. I drag the sphere in, and it appears as a cube which I have to position (by releasing the click), and my initial prefab instance of the cube is gone.

sentences:
Is it more efficient detect when audio clip ends with AudioSource.isPlaying or with AudioClip.length? In Unity, I want to trigger an event when an audio clip finishes playing. Would it be more CPU efficient to keep checking if the audio clip is playing with

WaitUntil(() => audioSource.isPlaying == false);

or would it be more efficient to use:
 WaitForSeconds(audioClip.length);
to simply wait a certain amount of time?

How can I run a test in Unity to see which one is more CPU efficient?

sentences:
OpenGL camera translate and rotate on cameras local axis How can I make rotation and translation on a local camera axis in OpenGL?
I want to make camera like "aeroplane" camera with a pitch yaw and roll.
I want to have good explanation on everything!

Can the solution be with gluLookAt maybe and be without gimbal lock?

sentences:
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:
A shader that casts shadows, doesn't receive shadows and doesn't render any textures/models at all? Bit of a strange one but I'm in the situation where i need a shader to essentially render nothing and cast a shadow!

I found this though some googling but sadly that casts shadows onto itself which is undesirable.

sentences:
Card Masking in Phaser Good Day,
I'm new to Phaser and still learning about it to.
I am challenging my self to create a simple animation of a card flip somewhat realistic
rather that making use of a scale.

This is something that I already started, But having trouble to attain what i need.

See this link http://sopronioli713.github.io/card_masking.

Here is my source code

    <title>Card Masking Flipping Card</title>

sentences:
Good basemap generator I am currently making a board game and cannot seem to find any vector world map creators where I can select a region of the world to capture and have it download that section. I just want a base map so no city names and preferably no borders.

The map doesn't have to be vector if it is of good enough quality.

sentences:
Jump function moves object horizontal after dash function I have a dash function in my game as well as a jump function. Both of them works completely fine all by themselves. The jump works find and the dash works fine, however, I want to be able to jump cancel from my dash. During my dash, when I try to hit the jump button, the charater object moves horizontally instead of vertically. It almost acts as a second dash.

What I want to happen is the character to be able to jump vertically out of my characters dash. Can someone guide me in the right direction to my desired results?

if (keyboard_check(ord("D")) && !place_meeting(x + 2, y, obj_hitbox_wall)) {
    x += 2;
    image_xscale =+1;
    directionFacing = "Right";
}
if (keyboard_check(ord("A")) && !place_meeting(x - 2, y, obj_hitbox_wall)) {
    x -= 2;
    image_xscale =-1;
    directionFacing = "Left";
}
///// WALL HIT DETECTION START /////
if (!place_meeting(x,y+2,obj_hitbox_wall)){
    gravity = .25;
    grounded = false;
} else {
    vspeed = 0;
    gravity = 0;
    grounded = true;
    jumpDash = false;
}
///// WALL HIT DETECTION STOP /////

///// DOUBLE JUMP PROPERTIES START /////
if (grounded == false && jumped == true) {
    if (keyboard_check_pressed(vk_space)) {
        vspeed = 0;
        vspeed -= 5;
        jumped = false;
    }
}

if (grounded == true) {
    if (keyboard_check_pressed(vk_space)) {
        vspeed -=5;
        jumped = true;
    }
}
///// DOUBLE JUMP PROPERTIES END /////

///// DASH PROPERTIES START /////
if (dashed == false && keyboard_check_pressed(vk_shift) && jumpDash == false) {
    if (directionFacing = "Right") {
        vspeed = 0;
        gravity = 0;
        speed += 8;
        dashed = true;
    }

    if (directionFacing = "Left") {
        vspeed = 0;
        gravity = 0;
        if (grounded == true) {
            speed -= 8;
        } else {
            speed+=8;
        }
        dashed = true;
    }

}

if (dashed == true && directionFacing = "Right") {
     speed -= .4;
     direction = 0;
    if (speed <= 0) {
        dashed = false;
        gravity = .25;
        speed = 0;
    }
}

if (dashed == true && directionFacing = "Left") {
    if (grounded == true){
        speed += .4;
        direction = 0;
    } else {
        speed -= .4;
        direction = 180;
    }
    if (grounded == true && speed >= 0) {
        dashed = false;
        gravity = .25;
        speed = 0
    } else if (grounded == false && speed <= 0) {
        dashed = false;
        gravity = .25;
        speed = 0
    }
}
///// DASH PROPERTIES END /////

///// JUMP DASH PROPERTIES START /////
if (grounded == false && dashed == true) {
    jumpDash = true;
}
///// JUMP DASH PROPERTIES END /////

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:
What does the graphics card do with the fourth element of a vector as the final position? From this question it appears you would want a four-element position vector, as it is simpler to modify its position with matrix multiplication.

On its own this would imply the fourth element should simply be ignored when considering it as a representation of a 3D point (assuming no transformation), but I know this is not true, as when I supply a vector4 to the GPU, if the fourth element is not one, it is not rendered - why?

What is the significance of the fourth element, once it is in the rasterizer?

EDIT: On review this question was somewhat poorly worded; it would be more accurate for the second paragraph to say: "if the value of the fourth element is not within a certain range, it is not rendered 'correctly'/'as expected'".

sentences:
samplerCubeShadow and texture offset I use sampler2DShadow when accessing a single shadow map. I create PCF in this way:

result += textureProjOffset(ShadowSampler, ShadowCoord, ivec2(-1,-1));
result += textureProjOffset(ShadowSampler, ShadowCoord, ivec2(-1,1));
result += textureProjOffset(ShadowSampler, ShadowCoord, ivec2(1,1));
result += textureProjOffset(ShadowSampler, ShadowCoord, ivec2(1,-1));
result = result * 0.25;

For a cube map I use samplerCubeShadow:

result = texture(ShadowCubeSampler, vec4(normalize(position), depth));

How to adopt above PCF when accessing  a cube map ?

sentences:
18.5:9 Android ratio force to 16:9 problem in Unity I want to my game build in devices with 18.5:9 ratio like Samsung S8 forced to be displayed as 16:9 ratio.
I already set Aspect ratio mode to Custom and set it to 1.86 in Player Settings.
I also overrided Android Manifest like this:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.unity3d.player" xmlns:tools="http://schemas.android.com/tools" android:installLocation="preferExternal">
    <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
    <application android:theme="@style/UnityThemeSelector" android:icon="@drawable/app_icon" android:label="@string/app_name" android:isGame="true" android:banner="@drawable/app_banner">
  <activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name" android:screenOrientation="sensorLandscape" android:launchMode="singleTask" android:maxAspectRatio="1.86" android:resizeableActivity="false" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density" android:hardwareAccelerated="false">
  <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
    <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
  </intent-filter>
  <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
  </activity>
  <meta-data android:name="unity.build-id" android:value="633a700a-7389-4a19-972c-ac1f177788f8" />
  <meta-data android:name="unity.splash-mode" android:value="0" />
  <meta-data android:name="unity.splash-enable" android:value="True" />
  <meta-data android:name="android.max_aspect" android:value="1.86" />

  </application>
  <uses-feature android:glEsVersion="0x00020000" />
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-feature android:name="android.hardware.touchscreen"
android:required="false" />
  <uses-feature android:name="android.hardware.touchscreen.multitouch"
android:required="false" />
  <uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false" />
  </manifest>

And as you see add attributes like android:maxAspectRatio & android:resizeableActivity to AndroidManifest manually.

But by installing the app on devices with that specific ratio, the game still running full screen and out of the bounds.
I am using Unity 2018.1.4f1 (64bit).

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:
Implementing a movement and collision system with Vectors and Area I've scoured gamedev for around 45 minutes, but I'm unable to find a detailed approach to implementing a movement and collision system for games - specifically, when to use which process, and what to do in them.
CONTEXT: I've made around 20 2-D games, most of which are physics simulators. I have a pretty good knowledge of AWT graphics (too deep into it to start javafx). My games are usually structured like this:
function 'move' inside a particular object:
    move the object
    if the object has collided into an immovable object like the ground:
        escape from the immovable object
        change velocity accordingly
    if the object has collided with a movable object:
        the current object should retrace its path to escape collision
        change both velocities accordingly and move each object with their velocity ONCE

call the function 'move' for each object

I'm completely uneducated in game development, and I've gotten a bit too comfortable with this flawed system because it has worked for almost every one of my games.

I've been studying a lot about game dev online, so I'm trying to make a system where every object moves freely once, then all their collisions are logged and resolved, in that order. But I'm still unsure how to resolve the collision.
This question: Collision Resolution is pretty much the same as mine, but I still can't understand when I should change positions and velocities. Should I change both at the same time on collision detection? What happens if you collide into an object, so you retrace your steps, but now you've collided with something else?
If anyone can link a more concrete question / answer, I'll be immensely grateful. I'm using vectors to store the position and velocity of each entity (player or npc), if that's helpful.
TL;DR
What property of an entity should I change on collision detection: velocity or position, or both? If the entity escapes the collision, but runs into a new one, should I resolve its new collision, or should I go on to solving the other collisions?

sentences:
Should my platformer have collectibles? By collectibles, I mean objects that you collect mainly for the sake of collecting them, not to power up. Think coins in Super Mario or bandages in Super Meat Boy.

I've seen a few platformers that do not have any collectibles and it's the platforming itself which is challenging (my platformer itself is challenging), but I think adding collectibles will add extra challenge and re-playability, especially if some of the collectibles are really well hidden. Tradition would dictate that you should have collectibles, as it's a way for players to gain extra lives or even gain points, but that would not be the only reason to have collectibles.

I'm not interested in making features for feature sake. I'm purely wanting an opinion on whether collectibles should be included in a game and what should the collectibles do when you collect enough? Is a simple +1 life fine? Should there be some cool object you get? Possibly should collecting really change something hectic, like collect 100 coins and your character is invincible?

How do I decide if my platformer should have collectibles?

Closed. While I disagree with the closing as according to the FAQ What should be asked game design (level design, gameplay, mechanics, etc). I got some nice pros and cons from everyone. I have updated the question slightly to be more specific.

sentences:
How can I use a data grid to make an isometric turn based game in GameMaker? I am making a Hero Quest clone. It is a turn based adventure game with an isometric view point. So far I have been able to turn a 2D map into an isometric view but I believe I need to use a data grid to achieve turn based movement, combat etc.

There are plenty of tutorials on data grids but none that I can find on how to translate a 2D grid to a psedo-3D isometric game.

How could I do it?

sentences:
Scoring and purchased hints? Curious about how developers approach the use of purchased hints and scoring.

Context:

I have a puzzle app that allows users to incrementally reveal an optimal solution via purchased hints. They can choose to ultimately reveal the whole solution or only pieces of the solution.

There are hundreds of puzzles in the app. The nature of each puzzle is not so memorable (many look similar). Each puzzle has multiple solutions and an optimal solution so a player can return to an already solved puzzle to improve her/his score and strive for the optimal solution. Scoring is based on the number of moves (lower is better). The app tracks the personal best score for each puzzle.

Question:

From a standpoint of user experience and better/longer gameplay...

Would it be a bad idea to somehow penalize (in scoring) the player for using hints? Is there precedence for this? I had the notion of adding a point (low score is better) for every hint used. The penalty would preclude reaching the perfect score. This way the player can use a hint when stuck but still return to try for the optimal solution without hints.

sentences:
Rotating a row of Rubik cube in response to mouse position and drag I made this cube in ue4..now I am able to rotate cubes separately without any problem.

But how do I move a row of cubes in response to mouse drag..

How do I detect what row is selected when my mouse is clicked and dragged on only one cube

sentences:
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:
2 Images, same object: tone difference and alignment I would like to know a software which helps in post-production to calculate the general color/tone difference of 2 images. The images contain the same object, but arn't shot from the same position. One image might be sunny, the other cloudy, so one is more orange/yellow, the other more grey/blue, but the same object.

How would you align the tone of the image?

Background info: i shoot a couple of hundreds of images to produce textures for my models, the objects are outside, so weather conditions can change at any time, shooting must continue. I do photogrammetry, so I use the images to project them on the geometry and bake them in a UV Map. So in general I have a chunk of images made in sunny condition and another in cloudy. I would like to apply a tone to all cloudy images, having similar tone like in the sunny images.

It's not about HDR.

sentences:
In HLSL script, why does random function produce negative values? I'm currently learning shader scripting with Unity HLSL language and this awesome resource: https://thebookofshaders.com

I created my random method and a zeroOrOne method which just return 0 or 1 according to a given and the worlposition

const static float randomMultiplier = 43758.5453123f;
const static float2 randomDotVector = float2(12.9898f,78.233f);

float random2d (float2 st) {
    return frac(sin(dot(st, randomDotVector)) * randomMultiplier);
}

float zeroOrOne (float probability, float2 pos) {
    float r = random2d(pos);
    return saturate(sign(probability-r));
}

In order to chase down little bug, I simplified my zeroOrOne method to:

float zeroOrOne (float probability, float2 pos) {
    float r = random2d(pos);
    return sign(r + 0.001f);
}

And here's what I can observe :

What I understand is: if some pixels remain black, the result of sign(r + 0.001f) is 0, or -1.
This means that r can be less or equal to 0.001. But r should be a frac of a sin, and frac is between 0 and 1!!

Is there some floating point black magic here?

Does it depends of the device architecture? (I'm on a macbook, no graphic card)

Does I miss something?

EDIT: I forced the random value to be positive only, and the strange pixels remains...

Here's the code, simplified to minimum.
https://gist.github.com/martinprot/f3071b6036ae9b72f17ef941c4734a48

EDIT: I tried on another computer, with a real CG. The bug does not occur on this machine!

sentences:
Modifying z axis position of a canvas and adapting it to camera I have a camera with y rotation of 0.

And i have a canvas with position value of (0f,76.29f,41.82f).
The size value of the canvas is (194.1f,307.8f).
I want to modify the z value of the canvas to -10.

public Canvas textcanvas;
void Start () {
textcanvas.anchoredPosition = new Vector3 (0f, 24.5f, -10f);
}

But i get an error "error CS1061: Type UnityEngine.Canvas' does not contain a definition foranchoredPosition' and no extension method anchoredPosition' of typeUnityEngine.Canvas' could be found. Are you missing an assembly reference?"

Also, when i succeed moving the canvas, does the size of it adapting to the camera automatically?

sentences:
Unity JSON parsing Array of Objects problem - error: JSON must represent an object type I'm trying to use Json to hold game dialog in a text asset file. I've tried to make a barebones project to test this and it is failing with the Error Message: ArgumentException: JSON must represent an object type.

I have a class called LineData which has a few properties each line of dialog contains. In the Json there are just two lines for now. When I import and parse it to try and make a reference to one of the lines of dialog it fails.

Here is all the code:

dialogJson.JSON:

[
{
    "lineID": "BEDROOM_DAVE_0001",
    "lineDialog": "Yaawwn, up i get for another fun packed day.",
    "lineDuration": 3
},
{
    "lineID": "BEDROOM_DAVE_0002",
    "lineDialog": "Well I think I need a cigarette before I get to work!",
    "lineDuration": 3
}
]

LineData.cs

using System;

[Serializable]
public class LineData
{
    public string lineID;
    public string lineDialog;
    public float lineDuration;
}

GameController.cs

using UnityEngine;

public class GameController : MonoBehaviour
{
    TextAsset Dialog_Data;

    private void Start()
    {
        Dialog_Data = Resources.Load<TextAsset>("txt/dialogJson");

        LineData line1 = JsonUtility.FromJson<LineData>(Dialog_Data.text);
        Debug.Log("line 1 dialog = " + line1.lineDialog);
    }
}

NOTE: I read here (https://answers.unity.com/questions/1503047/json-must-represent-an-object-type.html) that Unity "can't parse if the json consists of an array of objects". But I don't understand his explanation on how to get around this. Thanks

EDIT: I now have it without error, but the debug message is just empty didnt seem to get any data) . Here is the json now after the edits:

{ "LineData":
[
{
    "lineID": "BEDROOM_DAVE_0001",
    "lineDialog": "Yaawwn, up i get for another fun packed day.",
    "lineDuration": 3
},
{
    "lineID": "BEDROOM_DAVE_0002",
    "lineDialog": "Well I think I need a cigarette before I get to work!",
    "lineDuration": 3
}
]
}

I've also altered the GameController.cs like this (but now it says Index is outside array bounds:

public class GameController : MonoBehaviour
{
TextAsset Dialog_Data;

private void Start()
{
    LineData[] lines = new LineData[2];
    Dialog_Data = Resources.Load<TextAsset>("txt/dialogJson");
    lines = JsonUtility.FromJson<LineData[]>(Dialog_Data.text);
    Debug.Log("line 1 dialog = " + lines[0].lineDialog);
}
}

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:
Correct use of AttachActorToActor [ue4] I'm trying to stick some blocks together, but frankly I have no idea what I'm doing. I spawn 2 blocks during run time, and if they have an on hit event they're supposed to stick to each other.
It struck me that I'm not even sure if that's what attach does, and maybe it has some completely different meaning.
with the following blueprints, I'm getting all sorts of errors like "already attached" and "can't attach actor to actor, already attached"
https://imgur.com/a/16Zz2eS
Any help 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:
Can I give prizes based on sharing a WebGL game link on Facebook? I made a share to Facebook link for my WebGL Unity game and depending on when you share you get extra points. This is tied to a button which once pressed opens a new page to Facebook for sharing the link but at the moment when you press the button you get the extra points either way.
Is there a way to actually know when the content has been shared or not?

sentences:
How to keep track of (count) vertices processed so far in GL ES SL 2.0 vertex shader? I'm trying to learn how to use GLSL ES 2.0.

In OpenGL ES 2.0, there is no gl_VertexID keyword to obtain the number of vertices processed so far. So I was wondering if there's a way to make my own counter. I know the vertex shader is executed "per vertex," so if I can increase a counter which persists between executions then that will meet my case.

Now I know I can't use a uniform because by definition they cannot be altered.

So I thought about using an attribute, assuming the value will persist between vertex shader executions, but when I write

attribute int a_vertexCounter;

in my vertex shader, the shader compiler says that an attribute cannot have the type int.

So I thought maybe if I make a_vertexCounter a vec3 for example, and increment the first component of that vector instead... This works, except that when I try

gl_Position = u_MVPMatrix * u_canPos[int(a_vertexCounter.x)];

the compiler says

Error compiling shader: 0:23: S0027: Cannot modify an input variable

I also tried setting my attribute variable to be of type ivec3 but the shader says that's not allowed either.

Maybe there's no way to do this without ES 3.0, where I could simply use gl_VertexID ?

sentences:
How to scale a sprite with its center as origin? I'm trying to zoom-in a sprite gradually from 0% to 100% (a sprite called SelectionBox), so it zooms from the middle of the sprite, not from the upper-left corner. I'm almost there, but I'm having problems with the sprite origin - it's not positioning it in the spot I told it to.

What's wrong with this code?

SpritePosition_FirstBox = New Vector2(15, 50)
MiddleOrigin = New Vector2(CSng(Texture_SelectionBox.Width / 2), CSng(Texture_SelectionBox.Height / 2))

spriteBatch.Draw(Texture_SelectionBox, SpritePosition_FirstBox, Nothing, Color.White, 0, MiddleOrigin, ScaleValue, SpriteEffects.None, 0.94)

sentences:
Rotating a swinging sword in LWJGL gives wierd results I'm making a 2d top down game in Java using LWJGL(OpenGL, essentially). I recently tried adding a swinging sword mechanism. My coordinate system is set to the bottom left FOR ALL objects. The rotation worked, but it happens with respect to the bottom left corner of the Sword Quad. I want it to rotate with the center of the bottom line as the pivot for rotation. I tried a lot of solutions from the internet like:

translating the object to origin(0,0 of the screen), then rotating, then translate to the point of pivot.
translating object normally, then rotating, then again translating to the point you want it to pivot at.

But they all yield weird results.

Here's the code:

The Sword Class:

public class Sword extends GameObject {

    private static int speed = 5, deg = 0;;

    private Texture tex;

    public Sword(float x, float y, ObjectId id)  {
        super(x, y, id);

        //tex = ImageLoader.loadTexture(null, null);
    }
    protected void update(ArrayList<GameObject> objects) {
        if(deg < 360) deg += 1;
        else deg = 0;
    }

    protected void render() {
        Draw.rect(x, y, 10, 32, deg, 1, 0, 0);
    }

    public Rectangle getBounds() {
        return null;
    }

}

The Draw.rect method:

public static void rect( float x, float y, float width, float height,
                         float deg, float r, float g, float b) {
        glDisable(GL_TEXTURE_2D);

        glPushMatrix();
        {
            glTranslatef(0, 0, 0);
            glRotatef(deg, 0, 0, 1);
            glTranslatef(x + (width/2), y, 0);

            glColor3f(r, g, b);

            glBegin(GL_QUADS); // Specifies to the program where the drawing
                               // code begins. just to keep stuff neat.
                               // GL_QUADS specifies the type of shape
                               // you're going to be drawing.
            {
                glVertex2f(0, 0); // Specify the vertices. 0, 0 is on BOTTOM
                                  // LEFT CORNER OF SCREEN.
                glVertex2f(0, height); // 2f specifies the number of args
                                       // we're taking(2) and the type
                                       // (float)
                glVertex2f(width, height);
                glVertex2f(width, 0);
            }
            glEnd();
        }

        glPopMatrix();

        glEnable(GL_TEXTURE_2D);
    }

EDIT: Here is an image of what "weird result" is. In the pic, I'm translating first to origin[(0, 0) of the WORLD], then rotating(by 90 degrees), then translating to translating to [x - (width/2) , y]. As you can see, the red block that represents the sword is out of the "arena", even though I've set the x, and y of the sword to near the player. The image:

sentences:
How does pixel shading work for ambient occlusion volumes? I'm trying to understand the ambient occlusion technique described here, but I've trouble comprehending what exactly is the pixel shader doing.

Is the pixel shader invoked on points that belong to the surfaces of occlusion volumes? Can  anyone explain on a simple scene (like a cube corner seen from inside) how pixels get their AO values?

sentences:
Player disappears when it collides with a tagged object I am working on a simple game where the goal is to help a Player catch specific objects with a tag "Present".

After taking care of the models, animations I am now working on the collisions and counting UI.

For the collisions, on my Player Controller (I am using the ThridPersonUserController from the player Unity Standard Assets - which simplified the whole animation process), I added the following functions:

    void OnCollisionEnter(Collision other)
    {
        if (other.gameObject.tag == "Present")
        {
            Destroy(gameObject);
            count = count - 1;
            SetCountText();
        }
    }

    void SetCountText()
    {
        countText.text = "Count: " + count.ToString();
        if (count == 0)
        {
            winText.text = "Thanks to you the Christmas will be memorable!";
        }
    }

However, like this, when the Player hits an object with the tag "Present", even though the counting is working properly, the player disappears.

I have tried to change the OnCollisionEnter to an OnTriggerEnter, like this:

    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Present"))
        {
            Destroy(gameObject);
            count = count - 1;
            SetCountText();
        }
    }

However when the Player hits the objects with the tag "Present", they don't disappear.

My Player has a Capsule Collider and a Rigidbody.

The objects with the tag "Present" have a Box Collider and a Rigidbody.

Any guidance on how to make my Player stay in scene while removing the other objetcs and reducing the count is appreciated.

sentences:
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:
Mouse follow precision in flash I am trying to implement a simple movement for one of game objects in flash/ AS3. I am using mouseX, mouseY for my object to follow the mouse pointer. It works fine but the problem is the precision of the movement. If I move my mouse a little too fast then my game object stops following the mouse which means I have to re-focus the mouse pointer back on the game object to make it move again.

Here is the code that does this.

private function FootyMouseMove(shortestFooty : FootBall) : void {
            shortestFooty.x = stage.mouseX;
            shortestFooty.y = stage.mouseY;
            if (shortestFooty.x > stage.stageWidth - shortestFooty.width)
                shortestFooty.x = stage.stageWidth - shortestFooty.width;
            if (shortestFooty.x < shortestFooty.width)
                shortestFooty.x = shortestFooty.width;
        }

My question is, would it be possible to make the movement of my game object much more smoother and make sure that the game object is always following the mouse no matter how fast I move my mouse pointer?

sentences:
Data Driven Design and Game Screen Resolution So I have just begun studying Data Driven Design and implementing it into a project. I just encountered an issue and I have not be able to locate any material that suggests an elegant if not practical design to address it.

In my case I am using an XML file to assign game objects' member variables such as x/y coordinates, etc. My issue is that the values are still in a sense 'hard-coded', i.e. x="300" y="blah blah", but what if I want to offer different window resolutions? Beyond making X number of XML files for each individual resolution, I am unsure of how to couple DDD and a feature that effects the data in manner such as this.

Could someone please provide any good ideas on how to satisfy the issue? Documented or personal experience are welcomed.

sentences:
What exactly can shaders be used for? I'm not really a 3D person, and I've only used shaders a little in some Three.js examples, and so far I've got an impression that they are only being used for the graphical part of the equation.

Although, the (quite cryptic) Wikipedia article and some other sources lead me to believe that they can be used for more than just graphical effects, ie, to program the GPU (Wikipedia).

So, the GPU is still a processor, right? With a larger and a different instruction set for easier and faster vector manipulation, but still a processor. Can I use shaders to make regular programs (provided I've got access to the video memory, which is probable)?

Edit: regular programs == "Applications", ie create windows/console programs, or at least have some way of drawing things on the screen, maybe even taking user input.

sentences:
Performance overhead on Non-POT Texture in POT Atlas Using atlas, we can reduce memory and draw call. And the atlas is usally POT(Power of Two) Texture.

And I know non-POT texture have a lot of GPU and memory performance overhead. (link)

I have many rendering objects and they have also their non-POT textures.
And I packed the images into one 1024*1024 POT atlas and applied them to the objects.

(each textures is non-pot, and the atlas is pot texture)

In this case, Can I avoid non-pot texture overhead?
Are they treated as non-pot texture or not internally?

sentences:
What external 2d animation formats can I use in android? For an artist who won't be dealing directly with the code, what formats for 2d animation could they use that would be portable into an android game?

In my particular case there are no collision requirements or anything, just need to be able to place the animation on screen at a specific point.

sentences: In Pygame, how can I check if an object is touching a color? Is there a way to tell if a sprite is touching a specific color on the screen, maybe given as a hex code. I know you can do pygame.sprite.collide for sprites, but how can you do this for a specific color on the whole screen?

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:
TCP Slow Start in Network Games I'm getting latency issues in bandwidth intensive level transitions part of my game that are proportional to the distance to the server. I believe I'm hitting TCP Slow Start issues. It's also fine when I spam level transitions in quick succession but the problems re-appears. Note that I'm not breaking the TCP connection.

Effectively the transfer rate of my game is very bursty and remote users are experiencing a high latency (0.8 second) during these events. Some of the data I need to send during these bursts are dynamic so I can't pre-exchange it.

Is there anything I can do to mitigate the problem? Sending dummy data to keep the TCP window size is pretty much not a solution.

All the data needs to be received in-order so UDP isn't really appropriate here.

sentences: Does installing the DirectX SDK add project templates to Visual Studio? I have Visual Studio 2013 installed on my machine, and I have installed the latest DirectX SDK, but it doesn't seem to have added any DirectX project templates to VS. Should it have? Or do I need to get them separately?

sentences:
How do I calculate market share in an economic simulation? I want to make a game in which the players create different products (supply), and I give them a certain finite number of customers (demand). Players can choose the price and quality of their products (among perhaps other variables).

I've been trying to come up with an algorithm to decide on the market share of each product based on those variables. I could do something random, but thought I'd ask first!

sentences:
Moving an object around the the circle to the specific location in circumference Well I have run out of ideas how to approach this particular problem.See the picture below:

So the idea is that the object (dot in black) has to get to a point mark X (red X mark).However the limitation is that it has to get there without crossing the circle (i.e going in the straight line the the X mark).I was reading on some steering algorithsm but seems rather too complicated for this problem.Also I should mention that the object has the speed and velocity and position attributes which controls how its moving.

Now I was reading some ideas on how to move an object around a circumference here:

Here

However this doesn't entirely answer my question.The thing is I first need to get to the circle in order to be able to move around it.What I was thinking,was to allow the object to move towards  the position in a straight line until it hits the circle and then start moving along the circumference of the circle.Also the "X" mark can be anywhere on the circle even right in-front of it (not behind on the other side of the as in this example shown in the image)

I am not a game developer and thus never came across issues like so.The idea is that there will be more than one black object trying to get to their own "X" mark on the circle from random positions.(They idea is that they will be surrounding some objects in the middle). Here is an image to show what I mean,where each black object has an X position that they need to attend to without directly going through the circle.(Sorry for my bad drawings,was using laptop track-pad to do these images)

Anyway I am kinda lost with this and would to see different on tackling this particular problem.

sentences:
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:
Why the spotlight is working only in scene view window but not in game view? What i did is disabled in the Hierarchy the Directional Light.
The Spotlight is child of the character so it will move with it.

Then in Window > Lighting > Settings

In the Spotlight i just changed the range and rotation a bit.
It's strange since it's showing the light in the scene view but not in the game view not even when running the game.

And this is the Spotlight config:

sentences:
How do I set meshCollider.cookingOptions to MeshColliderCookingOptions.Everything in code? I'm procedurally generating some meshes for a project, and I need to add colliders to them. The meshes are generating fine, but after setting the shared mesh in the mesh collider, I need to be able to set the cookingOptions to Everything. In the inspector, I can do this fine and the colliders work correctly. Since I am generating these at runtime, I can't really do this after making a build. How do I go about doing this?

Works Correctly:

Does not Work Correctly:

sentences:
3D visual effects on videos I'm trying to get some hands-on experience with 3D visual effects on videos. Similar to those AR apps, I want to add a 3D model with effects, say a dragon, to a video. Something like this famous demo:
https://youtu.be/u5hQpRbHERg
But I don't really want to make it this fancy with camera tracking. I like to start with the simplest approach- probably just placing a dragon on the field (like its last scenes) with fixed camera.
What's the best way to do it? Some tutorials would be very helpful.

sentences:
Steamworks Networking with LibGDX / Java I have recently found out about Steamworks SDK and after reading through some of the documentation and information from other sources I was left with a few questions.

I found Steamworks because I was interested in how Steam handles multiplayer in games, like co-op games with the lobby creation and all.

This is because of a game I'm developing which is planned to be a 2-player co-op puzzle game.
When it comes to networking, how would I program the game to use Steamworks lobby creation? Would I just program it normally with a client server? Because normally that would require atleast one of the users to forward their ports but would the Steamworks work around that? Or do I implement the Steamworks right away?

This would be cruicial to know since adding networking late in to the development is very difficult.
Thank you in advance, any links or help is much appreciated!
Also, I'm progamming in Java(LibGDX).

sentences:
Collision detection - make sure the player touches the object exactly I know this is really something I should be able to figure out on my own, but a solution is evading me.

Okay, here are a few relevant parts of my code.

bool Game::Col(int x1,int y1,int w1,int h1, int x2, int y2,int w2,int h2)
{
    if(x1 > x2 + w2 || y1 > y2 + h2 || x2 > x1 + w1 || y2 > y1 + h1)
    {
        return false;
    }
    return true;
}

That's my collision detecting algorithm. Simple, for rectangles only.

        int bX = (player.getX() - 64) / 32;
        int bY = (player.getY() - 64) / 32;
        int tX = (player.getX() + 64) / 32;
        int tY = (player.getY() + 64) / 32;

        for(int a=bX;a<tX;a++)
        {
            for(int b=bY;b<tY;b++)
            {
                if(Col(player.getX(), player.getY(), 32, 32, a * 32, b * 32, 32, 32) && blocks[a][b] == 1)
                {
                    player.setX(oldX);
                    player.setY(oldY);
                    goto loopExit;
                }
            }
        }

        loopExit:

Here is my collision detection. This is performed right after the player x/y is manipulated(5 pixels in whatever direction every 1/60th of a second). Blocks is just a 2d array for my tile map. I know the way I have collision detection right now is not too optimized, but it took a few seconds to implement and is reasonably fast.

But the player can only get within 5 pixels of an object now. How do I solve that?

sentences:
How can I add a delay to my enemy spawning in Greenfoot? How can I add a delay between spawning my enemies in Greenfoot? I'm doing it from a class that is neither a world nor an actor, its made totally by me. I need to it spawn 3 enemies, 3 times, with a 1-second delay between each time. Here's what I've got now.

void attack()
{
    long beginTime = System.nanoTime();
    int i = 0;
    while(i < 3)
    {
        if ((System.nanoTime()-beginTime)/1000000000>1f)
        {
            for (int j = 0; j < 3; j++)
            {
                world.spawnEnemy();
            }
            i++;
        beginTime = System.nanoTime();
        }
    }
}

It's based off of this answer to this question. However, it does not at all give me the desired results. Instead, it entirely pauses everything else in the game (all of the actors, probably the world too, but I'm not sure) until the makeshift timer ends 1 second into it, and then spawns all 3 waves (all 9 enemies) at once.

sentences:
How to run 'Call in Editor' Functions that are implemented in Level Blueprints? I have a Blueprint Function within a Level Blueprint, marked as Call In Editor.

How can I run CallInEditor functions in Level Blueprints?

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 think about 2D scaling/rotation transformations This is a kind of embarassing question to me since I'm getting more in-depth with XNA but some times my way of thinking about things in my head contradicts an example and I need to re-think it to make it work.

So let's say I am just working with a sprite that is 10 wide and 10 high.

Scaling:

When I apply a scaling matrix, am I just shifting the points back or scaling the X-axis and Y-axis in the LOCAL coordinate space of that sprite? I ask because on this page:

http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series2D/Coll_Detection_Matrices.php

and

http://www.riemers.net/eng/ExtraReading/matrices_geometrical.php

It shows the X and Y of the local axis the sprite is in being scaled down. So in my head, I think that a scaling means that you scale down the local axis space where the sprite is located which makes it smaller.

Rotation:

When I do a rotation matrix, am I rotating the local x and y axis of the sprite around the world origin or rather do I think about it as rotating the local coordinate space entirely around the world origin?

Translation:

This to me is just moving that scaled image with those smaller x and y axis to some other point in the world.

sentences:
Rotate can I rotate an object to a target angle using Euler Angles? How do I rotate an object from its current angle to the desired angle in increments on 1 axis? The problem is the wraparound at 360 degrees
What I have so far (Note: pseudocode):

double MaxSpeed = 5;

double CurrentAngle = -170;
double DesiredAngle = 40;

double Distance = DesiredAngle - CurrentAngle; //How do I calculate this value considering angle wraparound?

CurrentAngle += Mathd.clamp(Distance, -MaxSpeed, MaxSpeed); //Caps the rotation speed

sentences:
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:
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:
Vertex shader in OpenGL/GLSL - transformation of the interior of a textured quad I have a LWJGL project and ran into a problem with a vertex shader I wrote.
In my scene I am rendering a map whose ground consists of rectangular tiles.
On top of that there are other objects (I used tiny white balls here).
Here is a screenshot of my scene:

screenshot of my scene http://110.imagebam.com/download/0-Ktu6XjdWSMpKytTr3Trg/34736/347358711/scene_static.jpg

You can also click here to see the image.

Each of the four larger rectangles at the bottom is one huge quad drawn in one piece.
Every one of them contains four coordinates (the corners: top-left, top-right, bottom-right, bottom-left).
Their interior is filled with a texture.

The small white balls on top are single game objects each drawn by itself.
Note that I aligned them with the vertical edges of the underlying rectangles.

I used the following vertex shader to render the scene:

/* default shader */
#version 120

void main()
{
    gl_TexCoord[0] = gl_MultiTexCoord0;
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}

Now imagine the scene getting covered with water.
I modified the shader adding a little water effect:

/* water shader */
#version 120

uniform float amplitude;
uniform float phase;

void main()
{
    gl_TexCoord[0] = gl_MultiTexCoord0;

    // transform x
    vec4 a_position = gl_Vertex;
    a_position.x = a_position.x + amplitude * sin(phase + a_position.x);

    gl_Position = gl_ModelViewProjectionMatrix * a_position;
}

An animated image of my scene can be found here or here.

You can see that the borders of the rectangles keep aligned with the white balls on top of them. However, vertices inside the rectangles (I marked the most distinct areas red) suffer a displacement relative to the white balls. In the last rectangle you can even see the balls cross the white line in the middle.

I need the interior of my textured rectangles to be transformed exactly like the white balls on top and move uniformly when being animated by my shader.
Please let me know if my problem is clear and if any other information is needed.

Thank you very much for your help.
Greetings Xoric

sentences:
Unity Hub 2.3.0 Buggy Setup? I recently downloaded the new Unity Hub 2.3.0 setup and since I hadn't used (or downloaded Unity Core) using the previous version of the Hub, I simply deleted the folder containing Unity Hub instead of uninstalling it like any normal person would. Now, every time I open the Unity Hub Setup and try and install it, it always shows the same "Installation Aborted, could not install successfully," error. I can't even uninstall the previous version from Windows Settings! I've tried changing the destination folder, but still doesn't work.

Any help is appreciated!

P.S. This error occurs when installing UnityHub, not the Unity Core Platform! I've also looked at all other similar posts.

Thanks.

sentences:
IL2CPP Vector.Dot inconsistency I get inconsistent results when I run this code as standalone Windows on Mono and IL2CPP backends.

var a = new Vector3(-1.26998901f, 0, -0.849998474f);
var b = new Vector3(20.0799999f, -1, 164.580002f);
var dot = Vector3.Dot(a, b);
var mydot = (float) ((double) a.x * (double) b.x + (double) a.y * (double) b.y + (double) a.z * (double) b.z);

+-------+----------------+-------------+
|       | Mono or Editor |   IL2CPP    |
+-------+----------------+-------------+
| dot   | -165.394135    | -165.394119 |
| mydot | -165.394135    | -165.394135 |
+-------+----------------+-------------+

Take a look at the dot result on IL2CPP backend in the table above.

My mydot implementation should be equivalent to Vector3.Dot(Vector3, Vector3) according to dotPeek in Rider.

Decompiled Vector3.Dot(Vector3, Vector3)

/// <summary>
///   <para>Dot Product of two vectors.</para>
/// </summary>
/// <param name="lhs"></param>
/// <param name="rhs"></param>
public static float Dot(Vector3 lhs, Vector3 rhs)
{
  return (float) ((double) lhs.x * (double) rhs.x + (double) lhs.y * (double) rhs.y + (double) lhs.z * (double) rhs.z);
}

Unity version: 2018.4.12f1

What causes Vector3.Dot(Vector3, Vector3) to give a different result on IL2CPP?

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:
Persisting high score table in flash game without a network. (Featuring: HttpListenerException) this question is very programming-centric, but it's for a game so I figured I might as well post it here.

I'm doing polishing work on a GGJ '11 game because it will be shown at an indie arcade tomorrow afternoon, and they're expecting our final build in the morning.

We'd like to have a high score table that displays during attract mode, but since it's Flash (Flixel) it would require some networking, Mochi, or something to keep a record of these scores. Only problem is the machine we'd be running on probably won't have network access.

As a quick solution, I thought I'd just write up a dinky little high score server in C#/.NET that could take basic GET requests for submitting scores and getting the score list. We're talking REAL basic, like blocking while waiting for an incoming request, run & forget console app, etc.

There's no guarantee that our .swf won't get reloaded, and we'd like the scores to persist, so this server would pretty much exists to keep a safe copy of the scores that the game can add to and request, and occasionally the server will write the scores to a flat text file.

But, HttpListener is giving me Error Code 87 'The parameter is incorrect.' Have any idea what I'm doing wrong? Or better yet, am I barking up the wrong tree and missing an obviously simpler solution?

This is all I've got so far in my Main():

HttpListener listener = new HttpListener();
listener.Prefixes.Add("http://localhost:66666/");
listener.Start();

The exception happens at listener.Start(); and the stack trace is:

   at System.Net.HttpListener.AddAllPrefixes()
   at System.Net.HttpListener.Start()
   at WOSEBCE_ScoreServer.Program.Main(String[] args) in C:\Users\Michael\Documents\Visual Studio 2010\VS2010 Projects\WOSEBCE_ScoreServer\WOSEBCE_ScoreServer\Program.cs:line 24
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

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:
How to limit and direct player's view in VR? We are making a VR game where the player will look at the world through the eyes of his character who sometimes moves on his own, so the player is only observer.

The character will rotate his body on his own and we need to change the orientation of player's camera to look where the character looks. For example, the girl takes his hand and leads her way. It would be very unrealistic if the player's head will be turned 180 from his body and he will walk backwards.

It'll allow us to avoid exhausting head rotations. Is it a good idea to guide his view by force by limiting camera euler angles relative to the direction of the body?

sentences:
OnTriggerEnter works...sometimes I was working on a small game in which you shoot projectiles towards various targets, now I decide to use OnTriggerEnter instead of OnCollisionEnter because OnCollisionEnter adds a slight force to the target during collision and I don't want that(btw, if anyone knows how to fix that, it'd be great), so I had to use OnTriggerEnter instead.

So the problem is that my code works just fine when the target is still or static. But when the target is in motion, sometimes the projectile works just fine as wanted(damages the target and disables itself afterwards) and other times, the projectile literally just moves through the target without causing any damage.

I say "sometimes" because this happens completely randomly.

Here's is my code:

public int m_DamageAmount;
public int speed;

private Rigidbody m_Rigidbody;

private void Awake()
{
    m_Rigidbody = GetComponent<Rigidbody>();
}

private void FixedUpdate()
{
    m_Rigidbody.AddForce(transform.forward * speed, ForceMode.Impulse);
}

private void OnTriggerEnter(Collider other)
{
    if (other.gameObject.layer == LayerMask.NameToLayer("Enemy"))
    {
        ObjectHolders._ImpactFX.Play();
        ObjectHolders._ImpactFX.transform.position = other.transform.position;

        EnemyBrain enemy = other.GetComponent<EnemyBrain>();
        if (enemy != null)
            enemy.Damage(m_DamageAmount);

        gameObject.SetActive(false);
    }
}

Here are other things I've tried:

1) I have changed both the target and the projectile's movements from transform to rigidbody.

2) I have tried changing my game time's Fixed Timestep value from 0.02 to 0.1.

These things did not have any visual effects on it.

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

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

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

sentences:
Unity: Terrain Texturing Roads The way I would texture a road within a given terrain is with a seperate mesh and a horizontally tileable texture such as this:

Then make sure the texture on the edge of the road and the terrain bordering the road looked kind of similar. That would however always create a visible seam such as in the image below taken from half life 2 episode 2:

Now the same game seems to blend in a horizontally tileable texture (the road) with a terrain made up of horizontally and vertically tileable textures (grass & dirt). How is this possible without a seperate mesh/material and without any visible seams, especially since the road is twisty meaning the texture has been rotated. I am completely baffled as to how this has been created, this is clearly beyond standard blend maps.

sentences:
Unity keyboard GUI navigation priority I noticed something strange while playing with my menu on keyboard.

I have four items arranged in a square (i.e. the top-left item should be able to navigate to the top-right and the bottom-left). If I hover over top-left, hold the right key, and then tap down, the cursor moves to the top-right and then to the bottom-right.

However, if I hold the down key and then tap right, it moves to the bottom-left and does not move to the bottom-right.

This also happens on the reverse side, so it seems as if vertical navigation is being given preference over horizontal. If a vertical key is being held, horizontal navigation is impossible.

How can I turn this off? My buttons are all set to Automatic navigation, and when I turn Visualize on, they all look like they're connected properly.

sentences:
Z rotation causing skew Android OpenGL ES 2.0 If I rotate about the X, or Y axis there is no skewing however for a pure 2D game that does not help me.  When I try to rotate about the Z axis however the quad I am rendering for the sprite starts to skew until it disappears at 90 degrees appearing again shortly after a slowly resuming a quad shape.  As far as I can tell I have written the code correctly, it is as I have written it before on 2D projects and it worked there I am either missing something stupid or OpenGL ES 2.0 does something different then what I expect, some excerpts of code follow:

Projection/View:

Matrix.setLookAtM(ViewMatrix, 0, 0, 0, 3, 0f, 0f, 0f, 0f, 1.0f, 0.0f);
Matrix.orthoM(ProjectMatrix, 0, -width/2, width/2, -height/2, height/2, 0 , 100);

Rotation/Scale/Translation(For in place set to identity first):

Matrix.translateM(Translation, 0, x, y, 1.0f);
Matrix.setRotateM(Rotation, 0, angle += 0.05f, 0.0f, 0.0f, 1.0f);
Matrix.scaleM(Scale, 0, 64,64,1.0f);

Multiplication of Matrices:

Matrix.multiplyMM(MVPMatrix, 0, ProjectMatrix, 0, ViewMatrix, 0);
Matrix.multiplyMM(MVPMatrix, 0, MVPMatrix, 0, Translation,0);
Matrix.multiplyMM(MVPMatrix, 0, MVPMatrix, 0, Rotation, 0)
Matrix.multiplyMM(MVPMatrix, 0, MVPMatrix, 0, Scale, 0);

Thanks for any help.

sentences:
How to detect a collision and collision impact? I would like to calculate "impact" of collision if its the right word for it.
My scenario is:
I have player, who is driving his vehicle. He then hits the wall while still in vehicle. I want to know if the collision happend and calculate the impact of collision, so later I know how much hp the player should lose depending how hard the hit was. I hope I made clear what I want to achieve.

What I'm currently doing is storing the previous vehicle speed and calculating the impact like this (previousSpeed - currentSpeed) / frameTime. It gives me some results but it's not consistent. Any other idea? It's in 3D so I have access to 3d vectors if it helps in any way.

sentences:
Negamax for turn based game I am working on a fast paced turn based game, each turn the player can move left, right or stay put and choose whether or not to fire. Each turn the shots move one block in the direction they are pointing.

I would like to implement NegaMax on this game for curiosity's sake.

Could anyone recommend a brilliant tutorial they tried and found satisfactory?

Thanks

sentences:
how to accurately select a sprite on a scene with a click? I have a scene with some sprite on it (added), the gamer has to select one of them and take the next action.

What is the simplest way to select one of the sprites accurately?

I am looking for a method that recieves a click coordinate and returns one of the sprites on the scene.

Since the sprites cant be well fitted in a bounding box I dont like to use a minimum bounding box approximation.

I was thinking of loading the sprites into a matrix and creating a scene matrix that each member belongs to a specified sprite, but it costs a lot( each pixel must be transformed using an affine transformation and it must be recalculated each time one of the sprites move)

Can someone show me a better way with a lower cost?

P.S I am using Swift and Apple's SpriteKit
There is a code for minimum bounding box but I am looking for an accurate method.

Inaccurate method if some interested is something like this :

     for touch in touches
     {
            var location : CGPoint = (touch as! UITouch).locationInNode(self)
            for asprite in self.viewIso.children
            {
                if (asprite.containsPoint(location))
                {
                    println("Selected : \(asprite.name as String)")
                    return
                }
            }
     }

Thanks
Iman

sentences:
Runescape Private Server - How does it work? I've seen a lot of Runescape private servers lately. How do they work? Most of them are based on the old Runescape, but a few look exactly like the real Runescape.

How do they make the servers? Has the source code of the game been leaked on several occasions, and is that used to make Runescape servers? Or have some people just replicated Runescape, and tried to make the same game themselves (and "stolen" the 3D objects and texture from Jagex to make it look the same, and written the code to be able to replicate most functions of Runescape)?

sentences:
how to calculate sky color hue in a specific way? I have a day cicle in my game.
I want to add a bluish hue to my terrain in the early morning and evening-night.
I want to start transitioning from 0 hue color to the full hue color at 20 PM and reach the full color at 0 AM, then start fading back and reach 0 hue color at 7 AM.

Given a time of day in hour and minute, or seconds, how can I write a function to calculate the hue color correctly?

sentences:
adventure game architecture I would like to make an adventure type game functioning similarly to machinarium or broken sword. The only way I can think of doing this is to draw an image as a background on a canvas and use some animated sprites that moves around and responds to touches on the screen.

But having a runnable that keeps re-drawing the canvas seems like a waste of memory to me, especially when it comes to larger images like the background.

I'm pretty new to game development and canvas animations and I was wondering if anyone could point me in the right direction? What would be good training for an adventure type game?

sentences:
Unity3D RigidBody adding force diagonally (x,y,0) results in two separate movements instead of one diagonal movement? The intentions of this function are to utilize the RigidBody component from a "target" object and clear its force while applying a diagonal force in the direction upwards and away from the side they are facing. I have omitted the portion in which detects the other direction for the sake of simplicity in reading the function as I've been testing this function while the user faces the right-hand direction.
Variables:

target refers to the other object currently in the scene
targBody refers to the RigidBody component of the target
object   damage refers to the current damage integer of the
object.      The damage used in this instance is from the target
object   facingRight refers to a bool in which is true
whenever the current object is facing the right-hand
direction.

    public void Damage() {
        targBody.velocity = Vector3.zero;
        if(facingRight) {
            Vector3 newVel = new Vector3(target.GetComponent().damage/16, target.GetComponent().damage/16, 0);
            targBody.AddForce(newVel, ForceMode.Impulse);
            print("Stuff");
        }
        target.GetComponent().damage+=3;
    }
For some reason, when I apply the force, the target object doesn't move diagonally. Instead, it moves horizontally before moving vertically; however, for some strange reason the horizontal speed is always greater than the vertical speed as it goes so fast that it nearly teleports!
I'm not sure if this error happens because of a coding problem on my part that I'm just not recognizing or if it's a problem with RigidBody in which I need to use a workaround for.Anyone have any ideas on what can make this function work the way I want it to?

sentences:
How can I create a copy of an object in Unity? I'm new to unity.

How can I make some copies of my GameObject in Unity by scripting?

I have tried this by the way:

public GameObject stone_3;

void Start ()
{
  for (int i = 0; i < 10; i++)
    Instantiate(stone_3, new Vector3(i * 2.0f, 0, 0), Quaternion.identity);
}

I can't really understand why it's not working.

sentences:
How can I prepare the different difficulty levels for my game? I've though about creating the game for the easiest difficulty level, and from there scale up and create the other, more difficult difficulty levels, but I'm not sure it's the fastest way to go.

How should I create the different difficulty levels for my game?

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:
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:
How can I implement a more realistic momentum system in Unity 4.5? I'm just starting out with Unity and am making a simple environment where there is a sphere and a ramp.  When the sphere approaches the ramp everything is fine.  As soon as the sphere hits the ramp is where I'm having trouble; the velocity is instantly reduced and when it goes off the end of the ramp, instantly returns to the velocity as though it were on the ground.

I'm not sure if this can be changed by some settings in Unity or I would have to write some code.

Here's the physics code I have so far (in C#):

public class PlayerController : MonoBehaviour {
    public float speed;

    void FixedUpdate(){
        float moveHorizontal = Input.GetAxis("Horizontal");
        float moveVertical = Input.GetAxis("Vertical");

        Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);

        rigidbody.AddForce(movement * speed * Time.deltaTime);
    }
}

sentences:
From Core Java Graphic Dev To JOGL I've been a java developer for 3 years, and I got one opportunity to explore  JOGL.

Is it a good idea to move into JOGL from being a core java developer  ?

sentences:
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: Can I publish games with adult content to Android Market? I have a very old adult (e.g. boobs and stuff) arcade game (think Delphi 7/DirectX 8 age), that currently is backported to Droid. Can the game be published to Android Market? Are there any age restrictions?

sentences:
How do i make a minecraft server mod? Possible Duplicate:
  Mods for Minecraft Server - how does it work?

I have made some minecraft client mods, but i've started a server a mounth ago and i want to make a mod for it, but i cant find any tutorial on the internet. How can then the other guys making those mods for minecraft server know how they are going to do? Do they try forward as i tryed or are they doing something else. I would be glad if someone could tell me how to do or find tutorials for me, couse I have tryed to find them in nearly a week of searching. But i guess im searching at the wrong spot of internet, what do i know :o

sentences:
Unreal virtual function causing unresolved external error I'm making a base gun cpp class that just has the stuff all the other guns will have.  I have a virtual function called PullTrigger that doesn't do anything, I just want to have it on the base gun so i can implement it on the derived classes without recreating it.  in my header file under private, I have this code
virtual void PullTrigger();

I tried adding override after the parantheses, but it gave me an error.  As is, VS is uncomplaining, but Unreal says the function has an "Unresolved external symbol".  I have no clue what that is.  How do i fix this?

sentences:
Isolate UI elements from 3D scene this might seem like a silly question but I'm raycasting on specific objects (Targets) in a scene and zooming in on them but i also have a few UI elements (buttons, toggles...) on the side of the screen that need to always be visible because they provide certain functionalities (isolate target, switch view...).

The problem is that sometimes when i want to click on a certain UI element I unintentionally send a Raycast that changes my target. Moving the UI elements is not helpful since the objects occupy the whole screen. What other ways do I have to make sure I'm only clicking the UI element? (especially for smaller screens)

sentences:
LookAt only in Z axis I'm fairly new to game development, like many of us asking questions here

Currently, I'm trying my luck working on a simple space shooter.

I'm trying to add some enemy ships with movement, they will only move forwards, but, at all time, will be facing the player ship´

I have that figured out, after playing with many options, LookAt was my saviour, but now, I'm having an issue, they do rate to face the player, but they also rotate on the Y axis

This is how they are in the editor looking

This is the position setting

Their properties

Their code

using UnityEngine;

public class AlienMovement : MonoBehaviour {

    public GameObject PlayerShip;
    public float speed;

    // Use this for initialization
    void Start () {
        GetComponent<Rigidbody> ().velocity = transform.up * speed * -1;
    }

    // Update is called once per frame
    void Update () {
        transform.LookAt (PlayerShip.transform, Vector3.up);
    }
}

And how they look once the game is running (frame still)

Transform properties for the one on the right

Any idea what I'm doing wrong?

sentences:
How to Prevent Entities Snapping Through Platforms I am using crafty.js to make a platformer. I assigned the main player entity the default jumping controls and movement with .twoway() and used .checkHits() against the obstacles ("obs") the player will jump on. The problem is that when the player jumps, if the top of the player entity hits the bottom of the obstacle, the player entity "snaps" to the top. How do I make it so that this movement does not happen? The intended effect is that the player entity will only land on the obstacle if the player entity lands on the top.

Here is the code:

window.onload = function() {

  Crafty.init(600, 400);
  Crafty.background('#07A6FF');

  // obstacle/platform entities
  // 'obs' means obstacle
  var obs = Crafty.e('obs, 2D, DOM, Collision, Color')
  .attr({ x: 100, y: 250, w: 400, h: 45 })
  .color('#E88D0C');

  var obs2 = Crafty.e('obs, 2D, DOM, Collision, Color')
  .attr({ x: 200, y: 150, w: 45, h: 45 })
  .color('#E88D0C');

  // player entity
  var player = Crafty.e('player, 2D, DOM, Color, Collision, Twoway, Gravity, Jumper')
  .attr({x: 50, y: 50, w: 60, h: 40 })
  .color('#0035AB')
  .twoway(200, 150)
  .checkHits('obs')
  .gravityConst(200)
  .gravity('obs');
}
<script src="https://github.com/craftyjs/Crafty/releases/download/0.7.1/crafty.js"></script>

sentences:
The way of avoiding branching for textured and not-textured objects I know that branching is an expensive operation on GPU (not as much as it used to be, but still).

The most common situation where I use branching is when I have both textured and non-textured models/objects rendered with single shader (switching between shaders is also quite expensive and it only differs in 1-2 small parts).

For example, here's some pixel shader for rendering 2D objects:

constbuffer constBufferPerObject{
    float4 textureCoordORColor; //hasTexture is true => it's texCoord(x,y), color otherwise
    bool hasTexture;
};

...

float4 PS(VS_OUTPUT input) : SV_TARGET{
    if(hasTexture){
        //input.TexCoord was calculated in VS (it's meaningless if hasTexture is false)
        return ObjTexture.Sample(ObjSamplerState, input.TexCoord);
    }else{
        return textureCoordORColor;
    }
}

What would be a smart way to re-write the PS in order to avoid branching here?

sentences:
How do I create a blob shadow under a character? I have a webgl based 2.5D platformer game, and I would like to add a simple blob shadow under the character to help the player with the platforming.

How is this normally done?
As you can see below, I do not need to worry about sloped terrain if that matters.

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:
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: GTA style camera - Unity I am wanting to make a 3d RPG with unity, and I'm in the planning phase. For the camera I decided to make it GTA style. I want the camera to be rotated around the player without effecting the movement of the player. If anyone can give any pointers on this, I would be very grateful.

sentences:
Create a website that lists all the game servers from a country I have seen some sites which shows servers(for online games) from various parts of world with there name and ip's. I am looking forward to develop something of same sort.

But the issue is how to get all the IP's of servers playing a certain game. Is there any criteria for the same. For eg: I want to list all online servers from US which are playing Counter Strike and also to get the players in it and other info.

sentences:
load all files out of folder as resources in lua and love2d If i use this code

-- some lua file
-- some code
local IMAGE_FILES = {"file1";"file2";"file3";"file4}
-- some code
function loadRes()
    -- some code
    -- load all images:
    for i,v in ipairs(IMAGE_FILES) do
        img[v] = love.graphics.newImage("data/img/"..v..".png")
    end
    -- some code
end

i have 2 problems!

If i have/want to rename a file, i have to rename it in the IMAGE_FILES table,too. (If i forget to rename it in one place, either in the .lua-file or in the folder, i run into problems)
If i need/want to add another file into the folder, i have to add its name to the variable,too.

For this reasons i want to load data(for example images, music, etc) out of a folder without having to let lua/love2d know the file names beforehand. In other words, is there a way to say to lua/love2d: load all files contained in this "data/img/" folder.

Secondly: Can you get the file type(file ending, like .png) with the solution for my first question?

I'm relatively new to lua and love2d, so i'd really appreciate any help. =)

sentences:
Using modified copyrighted music in non-commercial games Background: I'm making a retro style game for both fun, and an unofficial contest.

I have bought a song, song X. However, I then found notation for song X, and all the instruments. So basically, it's a program recreating song X in a sense.

I took the notation, and used another program to make it sound like a chiptune does (just for the fun of it, and it sounds good :P). However, I would like to use this in my game. It's non-commercial, but is this allowed? I would've said yes, because I'm not actually using the original, copyrighted song.

I think the main point is can I:

Use the music with no reference to the author
Use the music with a reference, since it's non-profit.
Not use the music at all since the melody and rhythm is copyright.

sentences:
How to minimize the repetitive creation of component in libgdx ashley? The below example is creation of character Entity. My problem is do I always need to call these engine.createComponent(...class) to create a component? Or should I wrap these to another class that handles the creation of entities?

PooledEngine engine = new PooledEngine();

...

CharacterComponent character = engine.createComponent(CharacterComponent.class);
TextureComponent texture = engine.createComponent(TextureComponent.class);
SizeComponent size = engine.createComponent(SizeComponent.class);
TransformComponent transform = engine.createComponent(TransformComponent.class);
PhysicsComponent physics = engine.createComponent(PhysicsComponent.class);

Entity entity = engine.createEntity();
entity.flag = Constants.CHARACTER;

entity.add(character);
entity.add(texture);
entity.add(size);
entity.add(transform);
entity.add(physics);

engine.addEntity(entity);

sentences:
Unity Editor equivalent of Playmode Start() I am attempting to draw gizmos for easy debug in the editor. The gizmos code uses an array that gets populated during the start function. The array only needs to be populated once and may cause issues if its modified during runtime. As such, I cant call the method to populate the array in the OnDrawGizmos() method.

I could possibly use a singleton populate the array but that would require many other things to be changed as well. I am looking for an equivalent to Start() for when it is in Editor Mode. Is there a method in editor mode that execute once or an attribute for the Start() method to execute in editor mode?

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:
Unity C# - My parameter 'campfireNew' does not exist (SetTrigger) I'm trying to set a SetTrigger parameter to call a different sprite animation on a campfire. I tried this also with a boolean, yet again the same error. parameter 'campfireNew' does not exist. Anyone familiar with this issue?

using UnityEngine;
using System.Collections;

public class WoodBehaviour : MonoBehaviour {

    bool campfire = false;
    private int count;
    public GUIText countText;
    public int startingValue = 100; // The amount of value the fire starts the
                                    // game with.
    public int currentValue;        // The current value the fire has.
    //public Slider valueSlider;    // Reference to the UI's health bar.
    bool inTrigger = false;
    public int increaseValue = 25;  // The amount of health taken away per attack.

    Animator anim;                  // Reference to the Animator component.

    // Use this for initialization
    void Start () {

        count = 0;
        setCountText ();
        currentValue = startingValue;
        anim = GetComponent <Animator> ();
    }

    void Update () {

        if (inTrigger){

            if (Input.GetKeyDown(KeyCode.E) && count > 0){

                count -= 1;                                 // Minus one log
                currentValue += increaseValue;              // adds value
                anim.SetBool ("campfireNew", campfire);
                //  delay("200");
                setCountText ();                            // Updates HUD

                SendMessage ("PressedKey");

            }
        }
    }

    // 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") {
            inTrigger = true;
        }

    }

    void OnTriggerExit2D(Collider2D other) {
        inTrigger = false;
    }

    void setCountText() {
        countText.text = "Count: " + count.ToString();
    }
}

sentences:
What are good alternatives to microtransactions? Recently, this question popped up on here, and it made me wonder if there was a better way to earn money from one's game without using microtransactions.

So, What are good alternatives to microtransactions?

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:
Phaser: Scaling to fill screen, maintain pixel ratio, but not aspect ratio I've used libraries in other languages before that provide different types of scaling via viewport types. The best example of what I want is from a library called libgdx for Java, their ScreenViewport.

  The ScreenViewport does not have a constant virtual screen size; it will always match the window size which means that no scaling happens and no black bars appear. A player with a bigger screen might see more of the game than a player with a smaller screen size.

Essentially what I want is to:

Fill the screen meaning that there's no black bars or the sides of the game

Maintain the pixel ratio meaning that every in-game pixel is equal to one pixel on screen, so no stretching

Not maintain aspect ratio meaning that it doesn't matter to my game what the aspect ratio of the game is. Its job is to forget about aspect ratio and follow the above two criteria

The way how I'm achieving this is by using Phaser's EXACT_FIT scaling type so that the canvas automatically resizes to fit the window. Then upon resizing, I update the size of the camera and the game's renderer so that they match the new canvas size.

Here's the code I have in my create function.

this.scale.scaleMode = Phaser.ScaleManager.EXACT_FIT; // Phaser.ScaleManager.SHOW_ALL USER_SCALE

    this.scale.pageAlignHorizontally = true;
    this.scale.pageAlignVertically = true;

    this.scale.setResizeCallback(function () {
        var width = window.innerWidth;
        var height = window.innerHeight;
        console.log('size: ' + width + ', ' + height);
        this.camera.setSize(width, height);
        this.game.renderer.resize(width, height);
    }, this);

It works fantastic in the horizontal axis, but when the window shrinks vertically, there is some vertical stretching of the pixels.

Here's a working example of my issue
http://shooty.us.to/scale/

And here's the code on GitHub, in case it's of any help.
https://github.com/qwertysam/space-game

Thank you for reading, any help is appreciated!

EDIT:

I've isolated the issue, it appears to be that when the game is initially created, the height that I specify is the initial height of the canvas. e.g.

var game = new Phaser.Game(16 * 80, 9 * 80, Phaser.AUTO, '');

Phaser's scaling method allows the canvas to grow in height, but not to shrink in height. The renderer is rendering to a much taller canvas (which goes off-screen) than expected, therefore causing the vertical stretching. Any thoughts on how I can shrink the canvas myself, or would that conflitch with Phaser's ScaleManager? Thanks!

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:
Emit particles from only some parts of a mesh I have a 3D mesh with 3 sub meshes in it, for 3 different materials.

I would like particles to spawn from the mesh, but only from location where one of the material is assigned.

How can I make this happen?

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: Jump function of player I'm developing game in marmalade sdk in c++. I have player in the area.and I wanna make him jump when i pressed a button.When I use this player.moveUp(5px); it just go up 5px, but he has to fall down back. so that when i use these: player.moveUp(5px); and player.movedown(5px); it do nothing.Because the fps is 30 and it's performing so fast. how i can fix that?

sentences:
Are there tools available for building hierarchical sprite-based objects in games like Vector Man or Gunstar Heroes? Possible Duplicate:
  Tools for 2D skeletal animation

I'm looking for a tool that would let me build multi-part sprite objects of the kind you can find in Sega Genesis games like Vector Man and bosses like Gunstar Heroes. Not only are they built with multiple sprites, but they're animated on a kind of really basic skeletal model.

Are there any tools out there that builds that sort of thing?

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:
Unity3D WWW get HTML displayed in browser I currently have in a web page, on a localhost server, some information that I want to use in Unity. My problem is that this information are stored in some js variables.

I tried to use the WWW class in a coroutine, but I only get the html source code. Is there a way to get the value of this variables inside Unity Editor ?

Thanks !

sentences:
I don't think my shaders are working, looking for help Using sharpdx(directx 11) developing on UWP.
This is a link to a previous question of not being able to compile the shader files(written in hlsl) How to compile shader files in UWP Later I have found some method to avoid the original exception(unable to open or find shader files) but still the shaders seem not to be working.
My method to "avoid the original exception" is to change the file path to
System.IO.Path.Combine(Windows.ApplicationModel.Package.Current.InstalledLocation.Path, "ProjectName")

If the method works, I would surely post it as an answer to the previous question
The current problem is no display on the screen(all black), while I can check the stored data in the vertex buffer using graphic diagnostics tools built in visual studio.

Here is my code for the shaders, problem may be going from here because this is the first shader file I've written. Please have a look and discuss may things go wrong.
pixel shader file Pixel_PS.fx
struct VertexOut
{
    float4 PosH : SV_POSITION;
    float4 Color : COLOR;
};

float4 PS(VertexOut pin) : SV_Target
{
    return pin.Color;
}

vertes shader file Transf_VS.fx
cbuffer dataBuffer : register(b0)
{
    matrix ViewProjection;
};

struct VertexIn
{
    float3 PosL : POSITION;
    float4 Color : COLOR;
};

struct VertexOut
{
    float4 PosH : SV_POSITION;
    float4 Color : COLOR;
};

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

where I compiled them
byte[] vertexShaderByteCode = ShaderBytecode.CompileFromFile(this.path + "\\Transf_VS.fx", "VS", "vs_5_0");
                this.vertexShader = new D3D11.VertexShader(
                    device,
                    vertexShaderByteCode
                    );
                this.inputSignature = new ShaderSignature(vertexShaderByteCode);
                this.pixelShader = new D3D11.PixelShader(
                    device,
                    ShaderBytecode.CompileFromFile(this.path + "\\Pixel_PS.fx", "PS", "ps_5_0")
                    );

data structure definition
public struct ScatterVertex
    {
        SharpDX.Vector3 Position;
        SharpDX.Color4 Color;
    }

inputlayout initialization
this.inputLayout = new D3D11.InputLayout(
                    this.device,
                    inputSignature,
                    new SharpDX.Direct3D11.InputElement[]
                    {
                        new D3D11.InputElement(
                            "Position",
                            0,
                            SharpDX.DXGI.Format.R32G32B32_Float,
                            0
                            ),
                        new D3D11.InputElement(
                            "Color",
                            0,
                            SharpDX.DXGI.Format.R32G32B32A32_Float,//I'm not very sure whether or why I should use this option
                            0
                            )
                    }
                    );

Here's the projection matrix in the camera class, which is later sent to the constant buffer
private Matrix View { get { return Matrix.LookAtLH(this.Eye, this.Target, this.Up); } }
private Matrix Proj { get { return Matrix.PerspectiveFovLH(this.Fov, this.Aspect, this.Near, this.Far); } }
public Matrix WorldViewProject
        {
            get
            {
                Matrix wvp = (this.View * this.Proj);
                wvp.Transpose();
                return wvp;
            }
        }

If you need anything else to solve this, just let me know and I'll manage to get it.
Thank you!

sentences: Does Unity have a built in pathfinding system? I know that there a lot of plugins available for pathfinding in unity but I was just wondering if unity has a built in pathfinding system ?

sentences:
How to create installer package with custom artstyle? When you publish a finished game you might consider making, for example, a Windows installer package.

I have found quite a few applications that can do that. But I couldn't find any that support changing the appearance of an installation process.

Many games support that, so I have been wondering where could I find an application like this? I doubt that every game studio creates its own one.

Preferably the one that supports Unity files.

EDIT:
Examples

sentences:
Respawn not working properly upon scene reload. Why is this? So I made a respawn function and what is supposed to happen is the script it supposed to load a saved checkpoint. However I need to reset the scene (and again this worked just fine last night which was odd...).

Essentially the checkpoint waits for a player and then when the player enters the current checkpoint is written to a .txt file. Upon reload or death the scene is restarted, the .txt file is read and grabs the checkpoint. Everything works fine without Scene scene = SceneManager.GetActiveScene(); SceneManager.LoadScene(scene.name); //Reload scene. but I need that in order to "refresh" the scene.

CheckPoint Code:

using UnityEngine;
using System.Collections;

public class Checkpoint : MonoBehaviour {

    public LevelManager levelManager; //Empty level manager.

    // Use this for initialization
    void Start()
    {
       //levelManager = FindObjectOfType<LevelManager>(); //Unnneeded
    }

    void OnTriggerEnter(Collider coll)
    {
        if (coll.tag == "Player")
        {
            //levelManager.currentCheckPoint = gameObject; //<-DISABLE WHEN ES2 is fixed!!!
            Debug.Log("Activated Checkpoint " + transform.position);
            ES2.Save(gameObject.name, "myFile.txt?tag=checkpoint"); //Saves checkpoint to file.
        }
    }
}

LevelManger Code:

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

    public class LevelManager : MonoBehaviour {

        [Tooltip("Note this will also serve as the spawnpoint for the player!")]
        public GameObject currentCheckPoint;
        private GameObject player;
        private int PHP;
        public int RespawnHP; //Amount of health to give player upon respawn.

        void Awake ()
        {

        }

        // Use this for initialization
        void Start ()
        {
            player = GameObject.FindGameObjectWithTag("Player");
        }

        // Update is called once per frame
        void Update ()
        {
            PHP = GameObject.Find("InventoryManager").GetComponent<InventoryManager>().PlayerHealth;

            if (PHP <= 0)
            {
                Debug.Log("Player HP has been depleted. Respawning.");
                RespawnPlayer();
            }

            if (Input.GetKeyDown("r"))
            {
                Debug.Log("Restarting level!");
                RespawnPlayer();
            }
        }

        public void RespawnPlayer()
        {
            Scene scene = SceneManager.GetActiveScene(); SceneManager.LoadScene(scene.name); //Reload scene.
            currentCheckPoint = GameObject.Find(ES2.Load<string>("myFile.txt?tag=checkpoint")); //Load saved checkpoint.
            Debug.Log("Player Respawning...");
            player.transform.position = currentCheckPoint.transform.position;
            GameObject.Find("InventoryManager").GetComponent<InventoryManager>().PlayerHealth = RespawnHP;
        }

        void RestartLevel()
        {
            //ToDo: Restart level, and reload last check point.

        }

        public static void SaveLevel() //Saves the current level to file.
        {
            //ES2.Save(SceneManager.GetActiveScene().name, "myFile.txt?tag=levelName"); //Saves level to file.
            //ES2.Save("none", "myFile.txt?tag=checkpoint"); //Overwrite checkpoint?
        }
    }

Does anyone have a clue what is wrong? Like I said earlier the problem seems to arise on scene reloading.

Response to comment(s):

  What behaviour are you observing at the moment? - Jack

Currently what happens is the player enters a checkpoint, the checkpoint is saved to a file, and upon respawn the checkpoint is loaded. After this I get spawned to the checkpoint that was saved but then immediately the level reloads itself and the player is not respawnd at the checkpoint. Here is a video to better demonstrate the issue (it will take a minute or two to finish up processing here as I've just pasted the link).

sentences:
Back-face culling in 2d OpenGL game I have a 2d game I've made using OpenGL ES. The game contains a large quad that fills the entire screen (as a background image) and many smaller quads that make up a number of balls that bounce across the screen.

To illustrate displaying a ball, I may have a single quad with vertices (0,0),(0,1),(1,1),(1,0). I then fill this quad with a texture (a colored ball).

I am wondering if I need to perform back-face culling (for performance reasons). Given these 4 vertices, I assume a polygon is drawn to connect them. Is it actually the case that two polygons are drawn? One facing forward and another one facing the back? I'm struggling to understand.

I have tried getting face culling working and I think I've succeeded, but I've not really noticed any difference in rendering times.

Not sure if relevant, but here is my environment setup code:

gl.glEnable(GL10.GL_TEXTURE_2D);
gl.glDisable(GL10.GL_DEPTH_TEST);
gl.glViewport(0, 0, width, height);
gl.glLoadIdentity();
gl.glMatrixMode (GL10.GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrthof(0, width, height, 0, 0, 1);
gl.glMatrixMode (GL10.GL_MODELVIEW);

sentences:
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:
Issues with importing bezier curve animation (curve does not distort?) Hi guys i'm pretty new to unity and having a frustrating issue; I've created a spear gun with an animation using a bezier curve grouped to the main gun shaft and distorted using a bone (bone relative) in blender. It works fine in blender, however when I export it into unity 5, the bezier curve does not distort and simple moves forward and back. I imported the blender model as a blender file.

I have tried pairing the model components in all the ways i can think of to see if that was the problem? I have attached the blender views and animations and what it looks like in Unity.

Is it an issue with unity being unable to animate bezier curve animations or the type of bone pairing i used??

unity animation, see the besiel curve simple moves forward and back instead of bending/distorting to look like a rubber fitted on a real gun!

sentences:
Blendshapes in Unity vs Blender I have a model from a package that has existing Blendshapes that work fine.  I'm a bit of a Blender newb, though. I'm trying to add a Blendshape for spikiness to a cube model.  It's early WIP, but it looks roughly the way I expect it to in Blender.  However, when exported and imported into Unity, the mesh with the blendshape applied isn't quite right - the spikes are sort of... plump, as if it isn't quite changing the vertices the same way.  Is there anything specific that needs to be done with this process?  Am I missing something, or is there some tuning I need to do in Blender prior to exporting the FBX?
Blender: http://www.labyrintheer.com/wp-content/uploads/2020/08/spike_bs_blender.mp4
Unity: http://www.labyrintheer.com/wp-content/uploads/2020/08/spike_bs_unity.mp4

sentences:
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:
Ability/Skill Data and Method Structure (C#, Unity3D) So I've come to design my game which players will be having a unique set of skill or ability to come with. I can store skill name, mana cost, cooldown, etc in database which each skill have in common, but as we gamer know, a skill is unique not just by its attributes, like the sequence of movement, the object will be instantiate in the world, it's just that very unique.

So the question is, where do I put this "unique", the skill sequences? Do I make skill1.cs, skill2.sc for every single skill? xml for sequence then make script to read and define myXml?

For example, in a game, the effect of each card is very unique for example card1 allow player to deal damage and draw card, card2 just deal damage, card3 deal damage to enemy and then draw a card, and so-on, where and how they store this sequences or method of each card effect?

sentences:
XNA / MonoGame - render transparent background using stencil buffer problem (3d) I'm trying to render 3d texture quads with the following properties:

With lighting (rule out "AlphaTestEffect").
Transparent background (no opacity levels, just binary opaque or transparent).
No ordering, eg, I don't want to sort objects by camera distance.

If I just try to render the quads regularly with their transparent background, the result is that even the transparent pixels are written to the depth buffer, which cause a background bug see picture:

So I try to do it with a different way, using the stencil buffer. What I do is the following:

Render just the transparent pixels on the stencil buffer, to create a mask.
Render the texture itself, again, using the stencil buffer I created before.

Now it works with the background renderings, but the problem is that different quads with transparent background hide each other in transparent pixels, as seen here:

I'm not sure if it's because the stencil buffer is not cleared between renders or maybe in one of my steps I mistakenly write to depth?

Anyway here's my code (at least the relevant parts of it):

// set effect and settings for the stencil mask phase
_alphaMaskEffect = new AlphaTestEffect(device);
_alphaMaskEffect.World = Matrix.Identity;
_alphaMaskEffect.AlphaFunction = CompareFunction.Equal;
_alphaMaskEffect.ReferenceAlpha = 0;
_alphaMaskEffect.VertexColorEnabled = true;
_alphaMaskEffect.DiffuseColor = Color.White.ToVector3();
_alphaRenderStencilMaskSettings = new DepthStencilState
{
    StencilEnable = true,
    StencilFunction = CompareFunction.Always,
    StencilPass = StencilOperation.Replace,
    ReferenceStencil = 1,
    DepthBufferEnable = true,
    DepthBufferWriteEnable = false,
};

// set settings for the regular rendering phase
_alphaRenderTextureWithStencilSettings = new DepthStencilState
{
    StencilEnable = true,
    StencilFunction = CompareFunction.Equal,
    StencilPass = StencilOperation.Keep,
    ReferenceStencil = 0,
    DepthBufferEnable = true,
    DepthBufferWriteEnable = true,
};

And here's the draw function itself:

// set settings for the stencil buffer rendering
device.DepthStencilState = _alphaRenderStencilMaskSettings;

// render stencil buffer
foreach (EffectPass pass in _alphaMaskEffect.CurrentTechnique.Passes)
{
    // draw current pass
    pass.Apply();
    device.DrawUserIndexedPrimitives
        <VertexPositionNormalTexture>(
        PrimitiveType.TriangleList,
        Vertices, 0, 4,
        Indexes, 0, 2);
}

// now render the quad with the stencil buffer
device.DepthStencilState = _alphaRenderTextureWithStencilSettings;

// render effect itself
foreach (EffectPass pass in _effect.CurrentTechnique.Passes)
{
    // draw current pass
    pass.Apply();
    device.DrawUserIndexedPrimitives
        <VertexPositionNormalTexture>(
        PrimitiveType.TriangleList,
        Vertices, 0, 4,
        Indexes, 0, 2);
}

tl;dr what's the right way to render 3d quads with transparent background, lighting and without sorting objects by distance from camera? And if it's the code I tried - how do I make the renderings stop hiding each other?

sentences:
Updating a game without the player having to start a new world So im building a game in GameMaker(A engine im good with), the development is going great and im making good progress. (Not going to go into detail about the game, its unrelated) but the problem i have is that when i do an update the player is required to start a new game as you cant load an old world into the new version (Not sure why, although i think i know) and i want a system that will just update the players current world with the new items, creatures etc. i have tried making the game use older versions of the save file, but it just loads the save file without the new items and creatures.

Edit i think i cant load a old world into the updated game because of it only having the save for the old items etc.(Not sure if this is correct though)
Edit 2.0 the version is the games version, say if i tried to update to version 2 and the save is version 1, it wont load version 1 with the updated stuff in version 2.

sentences:
Project rendering onto a polygon in the scene I have a function that renders a simple OpenGL scene. I want to display this scene on a polygon within another scene, without the function having to know about it. For example, to display the scene on the red polygon indicated:

I can set up the projection and modelview matrices to render to a small rectangle on the screen, but that doesn't work in a case like the image shown, where the target polygon is transformed and is no longer a rectangle on the screen. Is it possible to render to a non-rectangular target like this? The target is defined by four vertices, and I'm just not sure how to put those into the matrices.

I am aware of VBO/FBO functions that can render the sub-scene to a texture, which could then be mapped onto the polygon. However, this would be a bit more work as I'd have to add support for these functions to LuaGL, and I get the feeling it'd be slower than simply altering the display matrices - if it can even be done that way.

sentences:
Unity - Change base class variable to a derived class in inspector dynamically In an item system I'm trying to create I'm using prefabs to store an item's default values, and then grab that item from the prefab to use in runtime. It works well, but I was wondering if there was a way to dynamically change a variable with a base type to a derived type, probably with a custom editor, so that I wouldn't have to make separate classes for each derived type. This is the how I'm imagining it would be like:
public class ItemPrefab : Monobehaviour {
    public ItemTypes itemType;
    public Item item;
}

public enum ItemTypes {
    meleeWeapon,
    rangedWeapon
}

Item is an abstract base class, and MeleeWeapon and RangedWeapon are serializable derivatives. With that, I'm trying to do something to the effect of this:
switch (itemType) {
    case ItemTypes.meleeWeapon:
        item = item as MeleeWeapon;
        break;
    case ItemTypes.rangedWeapon:
        item = item as RangedWeapon;
        break;
}

I was wanting it to be the same as the below, just less scripts.
public class MeleeWeaponItemPrefab : Monobehaviour {
    public MeleeWeapon item;
}

public class RangedWeaponItemPrefab : Monobehaviour {
    public RangedWeapon item;
}

Edit: Here is my item system so far (I just included MeleeWeapon because I didn't want this to get too long).
public abstract class Item {

    [Header("Basic Info")]
    [SerializeField] private string name = "";
    [SerializeField] private Image icon = null;
    [SerializeField] private GameObject itemPrefab = null;
    [SerializeField] private float weight = 0;
    [SerializeField] private int maxStack = 0;
    private Guid gUID;

    public string Name => name;
    public Image Icon => icon;
    public GameObject ItemPrefab => itemPrefab;
    public float Weight => weight;
    public int MaxStack => maxStack;
    public Guid GUID { get { return gUID; } private set { gUID = Guid.NewGuid(); } }
}

public abstract class Weapon : Item {
    public abstract void Attack();
}

[System.Serializable]
public class MeleeWeapon : Weapon {

    [Header("Weapon Attributes")]
    [SerializeField] private MeleeWeaponTypes weaponType = default;
    [SerializeField] private float damage = 0;
    [SerializeField] private float chargeDamage = 0;
    [SerializeField] private float meleeSpeed = 0;
    [SerializeField] private float chargeTime = 0;
    [SerializeField] private float chargeCooldown = 0;

    public MeleeWeaponTypes WeaponType => weaponType;
    public float Damage => damage;
    public float ChargeDamage => chargeDamage;
    public float MeleeSpeed => meleeSpeed;
    public float ChargeTime => chargeTime;
    public float ChargeCooldown => chargeCooldown;

    public override void Attack() {
        // attack
    }
}

I have other stuff in Weapon and its derivatives but I removed it to keep the base idea more simple. Anyway, I then have prefabs with a MonoBehaviour that hold a derived type of Item, like I showed above, as data containers that I use to instantiate items during runtime.

sentences:
How to do camera follow without drag and drop in Inspector in Unity? How to do camera following an object with special tag without drag and drop into Inspector?
I have 2 prefab model they are not into hierarchy for the moment when player start play. To load selected model into scene I'm using the below code.

public GameObject[] players;
void Start ()
{
LoadPlayer ();
}
private void LoadPlayer()
{
GameObject player =Instantiate(players[PlayerPrefs.GetInt(MyModel")]);
}

Because in other scene I can change my player model but I can't follow it using in c# script for camera
public Transform cause of I can't drop it in that place in Inspector. So in what way I can find current player object when game start to follow it by camera?

sentences:
Creating VR Headset Video So I have a video stream of known resolution and I have a VR headset via HDMI at a known resolution.

Is there an existing library to create the slight fisheye and side-by-side layout for these single screen headsets? (It's a custom build, so no hardware locked API please)

Target: Win 7/8/10

sentences:
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: Actionscript 3: Which side of object is hit? I have a two objects colliding with each other. I am testing for the collision with if(ob1.hitTestObject(ob2)){//do something }. Is there a way to determine which side of the object was hit, i.e. if ob2 is a square, which side of the square was collided with?

sentences: How to discern boxes and spheres when importing from fbx I can import scene from FBX file into my engine, and i want spheres, boxes and capsules to be imported as colliders. So, how i can check if imported instance is one of them? Thanks.

sentences:
Spritesheets From Individual Images in Content Pipeline? My main goal is avoid using an external program like SpriteSheetPacker.

I would like to just use sequenced PNGs and have the sprite sheets be made, updated, and saved automatically when I build my game.

Edit: The old answers I upvoted, but I updated the question and specifically asked how to do this automatically with the Content Pipeline. Please do not give an answer that involves using an external program.

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

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

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

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

And finally my problem is:

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

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

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

And this is my animator:

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

sentences:
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:
Blending colors on Surfaces in PyGame? So I'm making a game in Python and PyGame.  I have aliens and blocks that each adopt one of several colors; rather than make several copies of them in different colors, I plan on making the sprite once in white, and recoloring individual aliens and blocks.

Problem is, with PyGame, I only know how to use PixelArrays to replace specific colors with other colors (e.g. pure white with pure red, or (255, 255, 255) with (25, 34, 255)).  The sprites aren't going to be super complex, but they will be shaded.

I could use the Python Imaging Library, but I'd kind of like to minimize dependencies.  If this is the best way then so be it.

What I'd like to know is this; how can I use color-blending in PyGame?  More than anything I'm concerned about color-blending algorithms (that ignore certain desired colors, e.g. black for outlines).  Alpha blending is not of concern.

sentences: What's the difference between Alpha and PreMulAlpha? I've seen videos comparing the two but it looks like there's no difference and they don't explain what's the difference

sentences:
Prefab Instantiates into scene, but when I store a reference to the instance it's null I am instantiating and parenting two objects - the first is a Unity primitive and the second is a prefab cube (literally nothing but a cube made into a prefab). The direct instantiation of the primitive works great, but when I try to instantiate the prefab I get NullReferenceException:Object reference not set to an instance of an object

Below is my script:

    Vector3 myPosition = new Vector3 (x, Rotator_Prefab.transform.position.y , z);
    GameObject ball = GameObject.CreatePrimitive (PrimitiveType.Sphere);
    ball.transform.parent = gameObject.transform; // no problems and gameObject.name gives me the right parent

    GameObject prefab = Instantiate (Rotator_Prefab, myPosition, Quaternion.identity) as GameObject;
    prefab.transform.parent = gameObject.transform; // this gives me an error

The error is coming from the prefab still being null after being instantiated. Still it shows up in the scene. Would anyone have any ideas ?
- Thank you!

Update: Where the prefab is coming from

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:
Sketchup for modelling, Blender for lightmaps, rendering in Xna Reach profile? This question moved from https://stackoverflow.com/questions/4319183/sketchup-for-modelling-blender-for-lightmaps-rendering-in-xna-reach-profile

Hello. I'm a programmer looking to add some 3D assets to my game. I have played around with both Blender and Sketchup, and for my limited 3D modelling experience I'm finding I can make far more interesting models/scenes in Sketchup than blender, but I couldn't find any free lightmap baking tools for sketchup, whereas my understanding is that this is available in blender for free.

So, my question is, how can I setup a workflow whereby I can do most if not all of my work in Sketchup, and only use Blender to create the lightmaps? Is there any way to define light information in Sketchup, but have blender render the light-maps? Otherwise I'm going to have to do all the modeling in sketchup and then add the lights manually in blender every time I make a change to the scene.

Also, I couldn't find information specifically about blender and the dual texture effect in Xna Reach. Does anyone have information/tutorial/etc.. for getting lightmaps calculated with blender into Xna and rendered using the dual texture effect in xna reach (i.e. on windows phone 7).

sentences:
Swapping a mesh from MCS female to a custom mesh I'm trying to swap a mesh from the MCS female CBJacket with a custom mesh that's supposed to be a lab coat. But it keeps turning in to a ball of spiky mesh! I made sure the avatar and armature for the custom fbx was the same as the official one but i'm not getting any where with this problem.

any help (as always) is greatly appreciated

sentences:
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:
How do I organize my game into multiple classes in C#? I've made two simple 2D games while following tutorials for the XNA libraries, and I wanted to make something myself, with only the knowledge I gained from these tutorials.

This will be my first serious attempt at game development, as well as my first C#/XNA project. I migrated from Java a week ago. Now, both of the tutorials I've followed made the whole game using only one class. And while it's possible, it isn't organized enough for me, and I want most of the functions to be organized in separate classes. So, I started with Input so I can have an easy way of exiting the game during testing right away.

Here's the important bits, I think:

From my Game1.cs:

protected override void Update(GameTime gameTime)
{
    Input input = new Input();
    input.PollInput();

    // TODO: Add your update logic here

    base.Update(gameTime);
}

From my Input.cs:

namespace MyFirst2DGame
{
    class Input
    {
        Game1 game = new Game1();

        public void PollInput()
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                game.Exit();
        }
    }
}

However, when I run the project, the Back button on the XBox 360 controller does nothing. My question, is am I missing something? I have no idea how to do anything with multiple classes, as all of my Java projects were quite small and had need for only one class.

sentences:
Is this specific server architecture okay for a multiplayer game? So I am making a game in Node.js / HTML5.

And I am really struggling to determine what an effective server architecture looks like?

Right now I have a server for a multiplayer game ( I plan on making servers instanced, so up to 80 people per instance).

So everybody in the instances location and health are shared.

And when an attack happens, i.e. a meteor is dropped from the sky, the x-value is the only data passed to the rest in the instance ( they all do the computations on their own computer locally).

When you are hit, you tell the server you were hit. (can't tell the server to hit other people, only yourself, becuase otherwise it's exploitable).

That's the kind of architecture I was going for, you can only tell the server about events that damage yourself.  ( I don't believe these events are overridable but I will try to determine that).

--

Do I have the right idea about how to go ahead with this server?

Do you have any tips or resources?

NOTE: It's under MMO but servers will hopefully top off at about 80. MMO in the same sense as Realm of the Mad God. = )

sentences:
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:
"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:
Get mouse/touch position for NGUI event Since I am using NGUI, to capture mouse events I use their methods such as

void OnPress (bool isDown) {

}

How can I check the mouse/touch position that corresponds to this particular OnPress event?

sentences:
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:
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: Should a wall be created as a plane or as a box? What are the benefits of a wall being as a plane or as a box? Should I use a plane with a box collider instead of mesh collider?

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:
Why is sin = Y and cosine = X? I'm new to game development in some phases and I want to understand everything I do (at least most of it) so I've started developing in MonoGames framework (XNA) and I saw a function like this.

rocket.angle = System.Math.Atan2(rocket.rocketdirection.X , -rocket.rocketdirection.Y);

I didn't understand this function (I was following a tutorial) and dove deeper into understanding sin, cos and tan. Now I have some understanding over it but one thing is unclear to me.

This was shown to me in a way to show how you calculate sin, cos and tan and I didn't understand it.

Why is the circle represented as 1,1 and -1,-1?
And why is Y = sin and X = cos?
And through this tan = cos/sin?

Can somebody explain this picture in a better way, in a way that is relatively easy to understand?

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:
Collision detection on a 2D hexagonal grid I'm making a casual grid-based 2D iPhone game using Cocos2D. The grid is a "staggered" hex-like grid consisting of uniformly sized and spaced discs. It looks something like this:

I've stored the grid in a 2D array. Also, I have a concept of "surrounding" grid cells. Namely the six grid cells surrounding a particular cell (except those on the boundries which can have less than six).

Anyways, I'm testing some collision detection and it's not working out as well as I had planned. Here's how I currently do collision detection for a moving disc that's approaching the stationary group of discs:

Calculate ij-coordinates of grid cell closest to moving cell using moving cell's xy-position
Get list of surrounding grid cells using ij-coordinates
Examine the surrounding cells. If they're all empty then no collision
If we have some non-empty surrounding cells then compare the distance between the disc centers to some minimum distance required for a collision
If there's a collision then place the moving disc in grid cell ij

So this works but not too well. I've considered a potentially simpler brute force approach where I just compare the moving disc to all stationary discs at each step of the game loop. This is probably feasible in terms of performance since the stationary disc count is 300 max. If not then some space-partitioning data structure could be used, however that feels too complex.

What are some common approaches and best practices to collision detection in a game like this?

Edit - More info: This current implementation has a few bugs like discs will sometimes stick over an occupied grid slot. Also it's too difficult to get discs into small spaces. These are all fixable. I asked here just to learn about alternative approaches.

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:
What would encourage a player to play the both the combat and building aspects of my game? I have been planning all of the features for my game idea. It is an RPG fantasy free roam game, in which the main focus of the game is on combat and adventure, though I also want to add in the ability to be a carpenter, shop keeper, brick mason, and/or cook.

Though this is all well thought out, another thought has cane to mind: Why would anyone actually follow through with the average life-style or even begin to think of living a normal life? I thought of how an experienced adventurer might "retire" and go into business for themselves, but what could be some other things that might make a player go for the worker's lifestyle?

sentences:
is there any different solution for different buildings different behaviours I'm trying to make different behaviours for workers of different buildings, let's say an agricultural worker would need to sow wheat seed and collect the wheat grain when it's grown. let's call that Behaviour0
For carpentry a worker would get wood and make arrows.
I have 2 different behaviours and I would like to implement them all in the simplest way possible.
 class agricultural{
     Workr Work
     void Working(Work W){
         Behaviour1();
     }
 }
 class Carpentry{
     Workr Work
     void Working(Work W){
         Behaviour2();
     }
 }
 template <tipename T> class BuildWork{
     T BW
     Work(){
         BW.Working();
     }
 }

I tried doing it with template so the behaviour would be inside agricultural and carpentry but problem occurred when I tried to declare template as only 1 can be inside it and getting it with ifs would make it the same as a non-templated version.
 class Workr{
     // here I would need to make it only for 1 is possible
     BuildWork <agricultural> BW
 }

So is this how I should use it?
The next thing occurred to me is this
 class Building{
     bool beh[2];
     void Work(Workr W){
         if beh[0]{
             if (beh[1]){
                 behaviour0(Workr W);
             }
             else{
                 behaviour1(Workr W);
             }
         }
         else{
             if (beh[1]){
                 behaviour2(Workr W);
             }
             else{
                  behaviour3(Workr W);
             }
         }
     }
 }

The last code is workable but I wonder if there is a better solution for this? here I can just change the bits in the beh[ ] and it's working
Each building has different behaviours and each worker in that specific building has same behaviour. Specific behaviour is always in the same building type.

sentences:
checking if an array rank is not equal to an int C# I'm creating an inventory system for a dungeon crawler, I've got world gen, and player controls down, and this is the only snag.`

public Transform[] items;

public bool[] usingitem;

public int usingitemnumber;

public void Update()
{
    if (Input.GetKeyDown("1"))
    {
        usingitemnumber = 1;
    }

    if (Input.GetKeyDown("2"))
    {
        usingitemnumber = 2;
    }

    if (Input.GetKeyDown("3"))
    {
        usingitemnumber = 3;
    }

    if (Input.GetKeyDown("4"))
    {
        usingitemnumber = 4;
    }

    usingitem[usingitemnumber] = true;
    if (usingitem.Rank != usingitemnumber)
    {
        usingitem[!= usingitemnumber] = false;
    }

}

`

i need to check if a rank on the transform[] usingitem array is not equal to the int usingitemnumber , and if it's not equal to it set it to false, and keep the on that is equal to it true

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 do i play mp3 files in Unity Standalone? I am making a game in Unity in which the player can select music files in their hard drive to use them in-game. I use the WWW class to load the sound files, but this only works for OGG, WAV and Tracker files. I use the following code:

WWW www = new WWW ("file:///" + soundPath);
while(!www.isDone){
    yield return 0;
}
GetComponent<AudioSource> ().clip = www.GetAudioClip(false, true);

I want to play audio files in mp3 format, which is the most widely used format for music in general, but when i try to play them, this gets printed to the debug log:

  Streaming of 'mp3' is not supported on this platform.

How can i easily achieve mp3 playback on desktop?

sentences:
Should the HUD be Entites in a ECS ? And how to handle Events if so? I'm building a GameEngine using Ashley and some how I can't figure out how.

I through I could use something like this. Or use the Signal/Listener from Ashley.
But how to Implement a interactive HUD? This is my current idea:

I have a System that only polls for inputs. If it detects an Input it would be a MouseClick so the PollySystem is sending out a MouseClickEvent witch the Coords. And a HUDClickedSystem will catch this event and checks if the click was inside a HUD Boundary and will Tag it with a clickedCompoment or not.
A Third system will look out for all entities with a clickedComponent and will react something like Respawn button clicked -> Respawn, Pause button clicked -> Pause etc.

This is a mix from the ideas here and here

I would love to have something like the Command pattern / Intent System  because I think it easy and straight forward but I can't figure out how to handle more than a flag ( Key pressed / Mouse pressed ).
But for this I need to know where the Mouse is pressed.

sentences:
How to create 3d picking ray with the cursor position I'm new here and I'm not sure how to go about doing this. I am creating an application that is supposed to use the cursor's position in the window to perform 3d picking. The tutorials I have found only explain casting a ray out of the center of the camera (like from a cross-hair), but this isn't helpful because the mouse isn't always in the center. I'm looking to understand how I could go about extruding the picking ray based on the mouse's x and y position over the window.

Also, it's not as much about the picking as it is casting the ray in the right direction. Picking will be handled by getting points in the ray and checking to see if the unit at that point is full or not.

Any help is greatly appreciated, please be respectful, and thanks in advance!

sentences:
Adding a feedback survey to a game So I am currently making a game that aims to help people with anxiety management. I , however, would like to ask them how they feel before playing the game and then again after playing the game. Would it be possible to do this directly on Unity? I would like for them to be able to log their entries much like an online journal. I have attached pictures from the daylio app. I would like to do something similar. At this point, I really do not know how to begin doing this on Unity. Any advice, or tutorial suggestions would be appreciated.

This far I have managed to do the following (in the picture below):
This is how the survey looks (its pretty rudimentary at this point):

And this is where the information is getting displayed (in the inspector):

So now, what I would like to know, is how would I go about sending this data to somewhere else i.e. as it is in the daylio app?

sentences:
Where does touch control logic go? I'm creating a game (or app, depending on how you would define it...) where I'm moving objects (with sprites) on the screen.

I've got this to half-work in both scenarios, but I can't seem to get it to work completely using only one...

My problem is, I don't know where the touches should be handled for the objects. I have a separate layer that has all the objects on that layer. I put all the touch logic on that layer and it works fine, but I can only move 1 object at a time (I have to declare a currentObject variable to keep track of what is moving) and I don't know how to see if a touch is handled on the layer without a currentObject variable. Here's my touch began method:

-(BOOL)ccTouchBegan:(UITouch*)touch withEvent:(UIEvent*)event{
       BOOL isTouchHandled = CGRectContainsBorder([current.sprite boundingBox], lastTouchLocation);

       return isTouchHandled;
}

I also tried to have all the touch control in the objects itself, which let me move all the objects separately, but I couldn't have the objects react to any of the layer variables or events (I can't figure out how to get the objects to see what the current states are of the variables on the layer). the code for that touch began is:

-(BOOL)ccTouchBegan:(UITouch*)touch withEvent:(UIEvent*)event{
       BOOL isTouchHandled = CGRectContainsBorder([sprite boundingBox], lastTouchLocation);

       return isTouchHandled;
}

The only difference between them is that the layer is accessing the instance variable of the object, and the object accesses its own variable.

Note: these functions aren't being implemented at the same time, I'm trying one and seeing if it works and then trying the other and seeing if it works...

So, how could I fix this? Is there a way to be able to move all the objects independently? I have events that moving the objects react to once the move over a certain point, but I want the objects to be able to be moved after all the events happen as well and I can either get them to react to the events and move the current to the next object (control of touch is on the layer) or I can move all the objects independently but I can't access the layer's events (control is with the object)...

sentences:
How do I draw a circular portion of a texture within LibGDX using an OpenGL ES shader? What is the simplest way to implement a shader to draw a circular portion of a full screen texture where the circle is dynamically resized as part of an animation using LibGDX?

Is a shader even the best place to do this kind of thing?

I'm sure you could do this in software using a Pixmap but that would be slow. In the end I managed to get something working using the OpenGL depth buffer, a ShapeRenderer to draw a circular mask and a SpriteBatch to draw the texture but it feels messy and awkward.

sentences:
What features should a moddable game have to make it easy to mod? One of the objectives I have for a tactical RPG I'm making is moddability. My hope is that anything can be replaced with custom code.

For example: you can replace the combat system I did with, say, rules from other systems, like the combat system in tabeltop RPGs like d20 or Pathfinder (with enough perseverance, coding the whole thing), and just let the game use that, even though I'm not really sure how to go about designing my game to support that.

I don't have much experience with mods, save for trying out a few in Oblivion and Skyrim (*ahem* caliente, ENB mods, etc.).

So, to modders out there, what are the features that's there in easy-to-mod games that you like, that make you think "wow if this didn't exist, making my mod would have been almost impossible". Stuff that just isn't there in games where you have a bad modding experience?

To start off, here are my initial thoughts:

I'm thinking of adding a Lua interpreter in my game, giving various objects in the game script access.
Resources will be saved in text format (in JSON). For example, behaviour trees will be serialized in JSON text files that can be edited. An in-game visual editor will also be provided.
A mod manager for the game will likely be good also (like BOSS in Oblivion).
The idea of "mod packages" for easy distribution.

sentences:
Collision filtering by object, team I am looking for a good method to determine which objects will be considered for collision with other objects.

My current idea is that each object has the following properties:

alwaysCollidesWith = [list of objects that will always trigger a collision check]
neverCollidesWith = [lost of objects that will never be considered]
teamCollidesWith = [list of objects that will be checked, provided they belong to a different team]

For example:
-projectiles never have to be checked for collisions with other projectiles
-players are always checked for collisions with players, regardless of team
-projectiles are only considered for collisions if they collide with another teams players

Does anyone see any weaknesses with this approach? Can anyone recommend a better approach?

sentences:
Why is the ownership fixed when synching objects? I'm creating a billiard game where one white ball will be controlled by two online players.

I have set my object photonview to ownership takeover.

When a player shoots the ball in one client, it is synced on other client.
Now when I update the ball on the other client, the other client is not updated.

Why is the ownership fixed?

Only one client is sending the updates to the other client, and not vice versa.

What should I do here?

sentences:
How to create old-school format music with small file sizes My friend and I have been working on a project recently, and because we are hard coding everything (other than the graphics library, Pygame), the total size for our project is super small. I feel like this is awesome and because the game has a retro feel to it I thought it was fitting. The whole project including art is about half a megabyte, which is pretty good when factoring the art and level design and such.

However one thing that is not accounted for in this size is the music. The music itself (around 6 or so tracks) plus the sound effects (4 or 5 currently) make up about 99% of the file size (not an exaggeration, 60mb / 60.5mb is a little over 99%), which I find a little ridiculous. In the old days when games had ridiculously lower memory and file sizes, how did they pull off music? Our game uses Chiptune music to give it a more retro feel, so using that style of music for small file sizes is perfectly acceptable.

Also I because I'm using Python and PyGame I don't know if this will be possible, but I still would like to know the process used anyways so maybe I can play around with it.

sentences:
How do I get roblox studio on a Chromebook? I have seen Youtube videos of people having roblox studio on their chromebook, but I have tried to install it and it didn't work.
How can I get it to work?

sentences:
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:
Repeat or wrap texture (DirectX 9) Sure there's something I'm missing about wrap/repeat textures in D3D 9.  I've tried setting the sampler in the shader, i.e. :

sampler DiffuseSampler =
sampler_state
{
    Texture = <DiffuseMap>;

    MipFilter = NONE;
    MinFilter = POINT;
    MagFilter = POINT;

    AddressU = WRAP;    // Repeat on X
    AddressV = WRAP;    // Repeat on Y.
};

, and I've also tried doing it in code before I render the object:

device->SetSamplerState(D3DVERTEXTEXTURESAMPLER0, D3DSAMP_ADDRESSU, D3DTADDRESS_WRAP);
device->SetSamplerState(D3DVERTEXTEXTURESAMPLER0, D3DSAMP_ADDRESSV, D3DTADDRESS_WRAP);
device->SetSamplerState(D3DVERTEXTEXTURESAMPLER0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
device->SetSamplerState(D3DVERTEXTEXTURESAMPLER0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
device->SetSamplerState(D3DVERTEXTEXTURESAMPLER0, D3DSAMP_MIPFILTER, D3DTEXF_NONE);

I thought there might be something screwy with my texture coordinates too, so I hard coded them to be 0.0, 0.0 on the left and 2.0, 2.0 bottom right.  I expected x 2 repeat but got a similar result to the screenshot, with the texture top left and then what looks like clamp across the rest of the image.

What mistake have I made here? (Note that the screenshot isn't the 0.0, 0.0 -> 2.0, 2.0 experiment I did, it's the general case I get as I'm panning my image around).

sentences:
2D Software Lighting Issues in Java I'm creating a 2D top-down tiled game in pure Java and by now I'm trying to implement a way to do lighting.

First, some details on how I render: there is a screen class which handles all the rendering. Pixels are put inside a int[width * height] array which is drawn on the actual screen using a BufferedImage and Graphics.drawImage().

The way I am doing lighting right now is by creating a second int[width * height] array which holds all the brightness that should be subtracted from the actual pixels. I try to use only floats ranging from 0f to 1f to represent RGB intensities.

So, as an example, there is the ambient lighting which is 0.3f. What I do is a pixel to pixel operation, where for each pixel that will be drawn, its RGB values are decomposed, decreased 70% (1f - 0.3f), recomposed back into a single int and stored inside the secondary int[width * height] array. When transferring the pixels to the BufferedImage, I subtract the corresponding value inside the secondary array and get a darker image, as expected.

That was an example of darkening the image and it works fine, the problem appears when actually lighting them up: I gave the player a lightRadius and 3 light color component floats (RGB). While rendering the player, I also render it's lighting inside the secondary array by doing the following:

int mask = subtractMask[xx + yy * width];

int mr = (mask >> 16) & 255;
int mg = (mask >> 8) & 255;
int mb = mask & 255;

mr -= (int) (dist * light.r * mr);
mg -= (int) (dist * light.g * mg);
mb -= (int) (dist * light.b * mb);

subtractMask[xx + yy * width] = mr << 16 | mg << 8 | mb;

Where dist is a number ranging from 0f to 1f which makes the light fade with the distance from the source and light.r/g/b are each of the components of the light that comes from the player.
What this piece of code does is basically to "give a little bit of the light that was taken out of a pixel back to it". As you can see, mr, mg and mb are made smaller (-=) and then composed back inside the number that will be subtracted from the corresponding pixel, thus making the result of the subtraction bigger (lighter).
For white light I get the desired result:
https://dl.dropbox.com/u/68532511/light1.png

The problem is when I only use the blue component (r = 0f, g = 0f, b = 1f), getting this: https://dl.dropbox.com/u/68532511/light2.png

Of course this can be explained by the fact that the tiles have very little blue values, making the ambient light take a little part of it away and making the lighting give this little part of it back (as you can see the biggest effect is on the player's pants, which are blue).
What I still couldn't think of is a way to make lighting independent of how much brightness was taken away from the pixels and something that simply looks good in any way I combine the components (the result I expected for the second image was luminance like in the first one, but colored blue). So how can I implement such an effect?

Also, for making the lighting circular, I simply compute something light x^2 + y^2 <= radius^2, where if this sentence is true, the pixel should light up, executing the code I've showed before. Is there a faster way to compute this? (I lost almost 50 FPS on this effect).

sentences:
Monogame/SharpDX Texture2D doesn't hold value The problem I have discovered is most likely between classes, so I dont really have much option but to post the whole code here:
https://www.dropbox.com/sh/smyw9t1ap3by2vd/pBX-aJJ-Qx

I have been having some trouble with spritebatches rendering textures recently using monogame for windows 8 with xaml where it throws an error after a few seconds of running. The error only occurs after a few seconds, though the less efficient or more textures i render, the quicker it crashes. After doing a git submodule update, the error message is entirely gone, but the textures still dissappear from the screen leaving just the cornflower blue.

The folks on GitHub have decided that this is a problem with my code and not theirs, which means I am definitely doing something wrong. For reference, here is the issue thread: https://github.com/mono/MonoGame/issues/1927. Thanks for any help!

UPDATE: I have identified the source of the problem. It has to do with declaring and holding the texture.

    protected override void LoadContent()
    {
        _spriteBatch = new SpriteBatch(GraphicsDevice);
        ContentManager myManager = new ContentManager(Content.ServiceProvider, Content.RootDirectory);
        terrainEngine.Load(myManager);
    }

    ContentManager content;
    public void Load(ContentManager content)
    {
        this.content = content;
        blockTextures = content.Load<Texture2D>("Graphics\\Blocks");
        spriteFont = content.Load<SpriteFont>("Graphics\\SpriteFont1");
    }

Now, if I call Load(content) from inside the terrainEngine class Update method, then the program works, otherwise, the textures disappear after a second.

sentences:
Player fatigue for tablets? I'm thinking about making games for tablets. Coming from a PC/console background, I'm keenly aware of the huge differences in the user interfaces, and that I need to design it with the target platform in mind.

One aspect I'm worried about is player fatigue. The input devices used on PCs and consoles - keyboards and game controllers - are optimized for extended play and have mature, ergonomic designs. Most seasoned players can easily use them for an hour, clocking in thousands of key/button presses, without suffering from fatigue. Designers can depend on this when designing the user experience, with consequences ranging from size/length of levels, steps required to execute commands, pace of the game and many more.

What about touch-screen tablets? Do players become fatigued faster, or are unable to execute as many taps/swipes per unit of time? If so, are there any resources or guidelines about this matter?

sentences:
How can I express the result of a percentage so that it is easy to understand by the user? I'm a professional game developer who has worked on a number of large titles but went indie a few years ago. I'm about to release my 3rd game, a real-time strategy game with a few RPG elements.

My problem is this: what is the best way to express the result of a percentage chance to a player? What I mean is, if the user has a 15% chance of succeeding at something, and the game engine uses a random number generator to generate a percentage, how would the result be shown to the user so that it is easy to understand?

The challenge I have is that if the player has a 15% of achieving something, if the random number generator generates a number between 1-15 (say, 4), then the player succeeds. But expressing this as, say, 4% / 15% just doesn't look right as conversely a lower number means success, where most players are used to "higher numbers = better".

I have thought about inverting the equation and expressing it some way as a chance of failure. So in the above example the player would have an 85% chance to fail, where the 4% would be converted to 96% and the result could be expressed as 96% / 85%, which "looks" more correct. But I just don't like the idea of expressing everything as a chance of failure, rather than a chance of success.

I have also thought of simply expressing the success chance (85%) and not showing the player the result of the random number generator, but I feel that most players would want to see the numerical result rather than simply the victory/failure condition.

I'm at a real loss here and would love to hear the views of players and other game developers alike. Even better if someone can point me to an example of a game which has solved this problem!

sentences:
Should I downgrade my Unity project to the latest LTS version? I created my Unity project with a 2020 version and now I'm using 2020.2.0f1. Recently, I realized that using the latest LTS version is the best choice for games that are in production or about to ship. I tried downgrading to the latest LTS (2019.4.18f1) but since Unity doesn't support downgrading, all my objects disappeared and I got a lot of weird errors in console. My question is:
Should I continue developing the game with the version that I'm using right now or downgrade to the latest LTS version?

sentences:
Texture atlas vs. array-texture: how differently are they handled by CPU and GPU and how that impacts performance? Unity 5.4 (currently in beta), will bring a much awaited feature (since 2013) that is array-textures - in the same vain as OpenGL's ArrayTexture. However, after doing some reading about arrays-textures and texture atlases, I still can't quite understand the technical differences on their usage by CPUs and GPUs.

So, to be more specific, I would like to ask for an explanation on the main differences between how texture atlas and texture arrays are dealt with by CPU and GPU and, most importantly, how such differences can impact on performance and memory handling (e.g. how texture arrays can be more performance than texture atlases, etc).

If technical details on Unity's implementation are lacking due to its unfortunate closed-sourceness, I would be happy enough with an answer regarding OpenGL.s ArrayTexture.

sentences:
Fixing collider for existing scene I'm trying to add collider to the 3D scene. I have added mesh collider to the floor but I see the character is still floating up when I play.

How can I edit this collider. I don't see any edit collider option here(like we see in case of box collider & other one's)

Question has been updated with further details:

The floor is not perfectly plane. It's raised from some place and down from other. So, I don't see any problem with character properties. The problem with mesh collider is that it tries to join lower & upper parts of plain with a straight line. It doesn't exactly take the size of plane

sentences:
What does the term 'photorealistic' really mean? I was wondering about the term 'photorealistic' in regards to rendering and was wondering how this is used.

Is it used to describe a shader (or set of) that have certain quantifiable features? Or any rendering thats not meant to be abstract, like the cartoon effect seen in Borderlands? Or is it just a subjective term meaning 'really really realistic'?

sentences:
Team matchmaking based on ELO score I'm looking for a very simple way to put up 2 teams out of unspecified amount of players. So its not actually a standard matchmaking since it only creates one match out of the whole pool of queued players.
I do have pretty much only single variable and it is the ELO score for each player, which means it's the only available option to base calculations on.

What I thought of is just simply go through every possible combination of a players(4 in each team) and the lowest difference between the average ELO of teams is the final rosters that get created. But it would be the most unoptimized way to do that.

So I decided to ask a question in here, maybe you can help me with that in some way.

sentences:
c++ text based duel game, buggy turn mechanic so ive checked this code 100 times for mistakes and everything checks out and should be working, I've tried everything I can think of but for some reason nothing works, this makes the movement super buggy and none of my attack works

this is a snippet from my initiation class

Frame();

Counter = 1;
//Player One's turn
while (Counter == 1)
{

    Map::Movement();
    Attack::Playerattack();
}
//Player two's turn
while (Counter == 2)
{
    Map::Movement2();
    Attack2::Playerattack();
}

part of my movement class

int ch;
switch (ch = _getch())
{
    //Player 1 movement
case KEY_W: //up
    if (Player::posy != 1)
    {
        Player::posy--;
        DisplayMap();
        Start::Counter++;
    }
    break;

case KEY_S: //down
    if (Player::posy != 20)
    {
        Player::posy++;
        DisplayMap();
        Start::Counter++;
    }
    break;

case KEY_A: //left
    if (Player::posx != 1)
    {
        Player::posx--;
        DisplayMap();
        Start::Counter++;
    }
    break;

case KEY_D: //right
    if (Player::posx != 20)
    {
        Player::posx++;
        DisplayMap();
        Start::Counter++;
    }
    break;

1st attack class

int ch;
switch (ch = _getch())
{
    case KEY_1:
        if (((Player::posx == Player2::posx) && (Player::posy == Player2::posy + Player::roa1)) || ((Player::posx == Player2::posx) && (Player::posy == Player2::posy - Player::roa1)) || ((Player::posy == Player2::posy) && (Player::posx == Player2::posx + Player::roa1)) || ((Player::posy == Player2::posy) && (Player::posx == Player2::posx - Player::roa1)))
        {
            Player2::hp = Player2::hp - Player::doa1;
            std::cout << "You have used: Attack 1" << std::endl;
            std::cout << "Player 2 HP is now: " << Player2::hp << std::endl;
            Start::Counter++;
        }

//if enemy is in range of attack 2 below the monster
    case KEY_2:
        if (((Player::posx == Player2::posx) && (Player::posy == Player2::posy + Player::roa2)) || ((Player::posx == Player2::posx) && (Player::posy == Player2::posy - Player::roa2)) || ((Player::posy == Player2::posy) && (Player::posx == Player2::posx + Player::roa2)) || ((Player::posy == Player2::posy) && (Player::posx == Player2::posx - Player::roa2)))
        {
            Player2::hp = Player2::hp - Player::doa1;
            std::cout << "You have used: Attack 2" << std::endl;
            std::cout << "player 2 HP is now: " << Player2::hp << std::endl;
            Start::Counter++;

2nd Attack class

int ch;
switch (ch = _getch())
{
    case KEY_K:
        if (((Player2::posx == Player::posx) && (Player2::posy == Player::posy + Player2::roa1)) || ((Player2::posx == Player::posx) && (Player2::posy == Player::posy - Player2::roa1)) || ((Player2::posy == Player::posy) && (Player2::posx == Player::posx + Player2::roa1)) || ((Player2::posy == Player::posy) && (Player2::posx == Player::posx - Player2::roa1)))
        {
            Player::hp = Player::hp - Player2::doa1;
            std::cout << "Player 1 HP is now: " << Player2::hp << std::endl;
            Start::Counter--;
        }

    case KEY_L:
        if (((Player2::posx == Player::posx) && (Player2::posy == Player::posy + Player2::roa2)) || ((Player2::posx == Player::posx) && (Player2::posy == Player::posy - Player2::roa2)) || ((Player2::posy == Player::posy) && (Player2::posx == Player::posx + Player2::roa2)) || ((Player2::posy == Player::posy) && (Player2::posx == Player::posx - Player2::roa2)))
        {
            Player::hp = Player::hp - Player2::doa1;
            std::cout << "player 1 HP is now: " << Player2::hp << std::endl;
            Start::Counter--;

if anyone has ANY ideas what im doing wrong or have overlooked please tell me and I will try it, I'm working in visual studio 2012.

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:
Best way to store NPCs, Monsters, Shops, etc for JavaScript game? OK, let's say I have a JavaScript game (preferably on jQuery framework) and its using HTML5 Canvas.

What would be your way of storing data to map out shops, monsters, and NPCs? I was thinking maybe JSON txt files on the website? Or maybe simple text files and simple delimiters? I am not sure. How would you store that kind of data?

sentences:
box2d's ApplyForce works wrong after cocos2d-x's replaceScene i'm practicing making a breakout game, using cocos2d-x 3.x and box2d, referencing here.

i create a ball in the scene's init function and apply force.

when ball hits bottom wall, if i touch screen then the game restart current scene.

after restart the scene, the ball's velocity is not same with the first ball's one. it's slower.

i can't find what's wrong in my code. i need help. here are my code, creating a ball and restart scene.

void GameScene::CreateBall() {

    // create ball texture
    ball = Sprite::create("ball.png");
    ball->setPosition(Point(100,100));
    ball->setTag(1);
    this->addChild(ball);

    // create ball body
    b2BodyDef ballBodyDef;
    ballBodyDef.type = b2_dynamicBody;
    ballBodyDef.position.Set(100/PTM_RATIO, 100/PTM_RATIO);
    ballBodyDef.userData = ball;
    b2Body *ballBody = _world->CreateBody(&ballBodyDef);

    // create circle shape
    b2CircleShape circle;
    circle.m_radius = 26.0/PTM_RATIO;

    //create shape definition and add to body
    b2FixtureDef ballShapeDef;
    ballShapeDef.shape = &circle;
    ballShapeDef.density = 1.0f;
    ballShapeDef.friction = 0.0f;
    ballShapeDef.restitution = 1.0f;
    _ballFixture = ballBody->CreateFixture(&ballShapeDef);
    b2Vec2 force = b2Vec2(1500,1500);
    ballBody->ApplyForce(force, ballBodyDef.position); // in here apply force
}

bool GameScene::onTouchBegan(Touch *touch, Event *event) {

    if(gameOver) {
        Director::getInstance()->replaceScene(GameScene::createScene());
        return true;
    }
}

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 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 to deal with race conditions on a game server between network and physics update loops? I am new to game networking.
In various articles on the internet, I found that there are usually two loops on the server: one for physics updates and the other for sending snapshots to the client (network updates). As I understand, loops can run in parallel, which makes me think they should run on different threads.
Now, in terms of concurrency, physics thread is the writer and the network thread is the reader. Given that the threads can run concurrently, there can be race conditions: reader thread can read inconsistent game state if the writer thread is currently modifying it.
How to deal with this race condition? The crude approach would be just to use lock on the game state, but it seems to me that this will introduce delays. For some reason I can't find anything on the web.

sentences:
How do I check if there is already an object in this scene with the same name upon reloading the scene? If the title wasn't clear enough (I don't really know how to explain it), basically I have an Audio Manager that is DontDestroyOnLoad. I also have a pause menu, that takes me back to the main menu, and in the main menu, I can reload the scene again. The problem is, upon reloading the scene, multiple copies of AudioManager is created in DontDestroyOnLoad, and I don't know how to solve it. My AudioManager script to give you a reference (only the important parts):

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

public class AudioManager : MonoBehaviour
{
    #region Instances
    private static AudioManager instance;
    public static AudioManager Instance
    {
        get
        {
            if (instance == null) //if instance doesn't exist, find an AudioManager
            {
                instance = FindObjectOfType<AudioManager>();

                if (instance == null) //if instance still doesn't exit, then it will create a new one
                {
                    instance = new GameObject("Spawned AudioManager", typeof(AudioManager)).GetComponent<AudioManager>();
                }
            }

            return instance;
        }
        private set
        {
            instance = value;
        }
    }
    #endregion

    #region Fields
    //the audio source can only play one looping sound at a time
    private AudioSource musicSource;
    private AudioSource musicSource2; //purpose of having 2 musicSources is that we can use them to achieve effects like CrossFade
    private AudioSource sfxSource;

    private bool firstMusicSourceIsPlaying;
    #endregion

    private void Awake()
    {
        //Make sure we don't destroy this instance
        DontDestroyOnLoad(this.gameObject);

        //Create audio sources, and make them as references
        musicSource = this.gameObject.AddComponent<AudioSource>();
        musicSource2 = this.gameObject.AddComponent<AudioSource>();
        sfxSource = this.gameObject.AddComponent<AudioSource>();

        //loop musicSource
        musicSource.loop = true;
        musicSource2.loop = true;
    }

If you are reading this, thanks for taking your time and try to help me!

sentences:
OpenGL setup on Windows I have been trying to use OpenGL for two days now. First on Mac, then on Windows. The problem with Mac is that it doesn't support the newer versions of OpenGL. I ran a tutorial that actually did get some things working, but it only works in XCode (i.e., I can't create a new file, paste in the same code, and get it to work). Because of these issues, I moved to Windows. My Windows 7 has OpenGL 4.3, which is the same that is used in alot of other tutorials. However, not one of these tutorials gives any instruction on how to set it up for the first time. I have come across some vague posts saying that some libraries need to be linked. But WHAT libraries, and HOW do I link them?

Please help. I am pretty desperate to set this up as this project is due for work soon. I have actually used OpenGL before at my university, but the computers already had everything set up. The project itself is very easy, but setting up OpenGL is not something I know how to do.

Edit: Using C++.

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:
Unity Anima2D - IK Limb for leg not working I'm having an issue getting an IK limb to work using Anima2D in Unity. If I place a limb IK for the neck joint, the head moves as expected, however trying to place one for the leg seems to have no effect.

A CCD IK seems to work, but only moving one bone of the leg, whereas I need both bones to move, like a real limb with a knee joint.

Is there anything obvious I'm doing wrong?

Thanks!

sentences:
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:
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:
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:
How do I keep my orbiting camera upright? I am working on code that rotates the camera around a point on the in-game map when dragging the mouse. I understand how to lock it so it stays above the map surface.

However, if I keep rotating the view up, the camera will go "up and over" and be upside-down. How can I fix the camera orientation to make sure my camera stays upright?

A representative bit of code:

x += Input.GetAxis("Mouse X") * xSpeed;
y -= Input.GetAxis("Mouse Y") * ySpeed;

// when mouse moves left and right, rotate around local y axis
transform.RotateAround(target.position,transform.up, x);

// when mouse moves up and down, rotate around the local x axis
transform.RotateAround(target.position,transform.right, y);

sentences:
Free movement in a tile-based isometric game Is there a reasonable easy way to implement free movement in a tile-based isometric game? Meaning that the player wouldn't just instantly jump from one tile to another or not be "snapped" to the grid (for example, if the movement between tiles were animated but you'd be locked from doing anything before the animation finishes). I'm a really beginner with anything related to game programming, but with the help of this site and some other resources it was quite easy to do the basic stuff, but I haven't been able to find any useful resources for this particular problem.

Currently I've improvised something close to this: http://jsfiddle.net/KwW5b/4/ (WASD movement). The idea for the movement was to use the mouse map to detect when the player has moved to a different tile and then flip the offsets, and for the most part it works correctly (each corner makes the player move to wrong location: see http://www.youtube.com/watch?v=0xr15IaOhrI, which is probably because I couldn't get the full mouse map work properly), but I have no illusions that it is even close to a good/sane solution. And anyway, it's mostly just to demonstrate what kind of a thing I'd like to implement.

sentences:
Determining which line to collide with I am making a platformer, where my player is represented as a circle and the ground is represented as lines. The actual collision detection and resolving works, it's just an edge case I can't find a solution for.

I check on which line the hero is by using the normal, and if the hero's center is between these normals I know he is on that line. That works except for the case in the image above.
When he get's in the 'Problematic Area' the algorithm will not detect any collision.

So how do I know which line to pick for the collision when the hero get's in this area?

Here is some code that shows how I test collisions (which again works, but does not consider the problem I actually have).

playerPointer:Vector2D = New Vector2D(position.x - line.x1, position.y - line.y1)
lineNormal:Vector2D = line.vector.Copy()
lineNormal.LeftHandNormal()
playerOnNormal:Float = playerPointer.ProjectionOn(lineNormal)
playerOnLine:Float = playerPointer.ProjectionOn(line.vector)

#Do we have a collision between the circle and the infinite line
If Abs(playerOnNormal) <= radius

  #Get the direction vector of the line
  Local directionVector:= New Vector2D(line.x2 - line.x1, line.y2 - line.y1)

  #Is the player inside the normals boundaries
  If (playerOnLine <= directionVector.Length) And (playerOnLine >= 0)

sentences:
Ray & Segment Intersection I'm writing some code to check intersection between all of a rectangles segments and a ray. It will sometimes use the Left and Right side of the rectangle as the closest face hit (face DA & BC) even when it is clearly on the top of the rectangle (face AB).

This is what the Rectangle v Ray collision looks like.

    // Ray intersections
    static public IntersectData IntersectRectRay(Rectanglef rect, Vector2 origin, float dir)
    {
        IntersectData data = new IntersectData();

        // Create segments for all the sides of a rectangle
        Segment topLeftRight = new Segment(rect.TopLeft, rect.TopRight);
        Segment leftTopBottom = new Segment(rect.TopLeft, rect.BottomLeft);
        Segment bottomLeftRight = new Segment(rect.BottomLeft, rect.BottomRight);
        Segment rightTopBottom = new Segment(rect.TopRight, rect.BottomRight);

        // Check collision with all the faces and use the closet one
        float smallestDepth = float.PositiveInfinity;

        IntersectData topLeftRightData = IntersectSegmentRay(topLeftRight, origin, dir);
        if (topLeftRightData.intersecting && topLeftRightData.depth.Length() < smallestDepth)
        {
            smallestDepth = topLeftRightData.depth.Length();
            data = topLeftRightData;
            data.face = "AB";
            data.dir = MathHelper.PI / 2f;
        }

        IntersectData leftTopBottomData = IntersectSegmentRay(leftTopBottom, origin, dir);
        if (leftTopBottomData.intersecting && leftTopBottomData.depth.Length() < smallestDepth)
        {
            smallestDepth = leftTopBottomData.depth.Length();
            data = leftTopBottomData;
            data.face = "DA";
            data.dir = 0f;
        }

        IntersectData bottomLeftRightData = IntersectSegmentRay(bottomLeftRight, origin, dir);
        if (bottomLeftRightData.intersecting && bottomLeftRightData.depth.Length() < smallestDepth)
        {
            smallestDepth = bottomLeftRightData.depth.Length();
            data = bottomLeftRightData;
            data.face = "CD";
            data.dir = MathHelper.PI / 2f;
        }

        IntersectData rightTopBottomData = IntersectSegmentRay(rightTopBottom, origin, dir);
        if (rightTopBottomData.intersecting && rightTopBottomData.depth.Length() < smallestDepth)
        {
            data = rightTopBottomData;
            data.face = "BC";
            data.dir = 0f;
        }

        return data;
    }

and this is the ray v Segment intersection

    static public IntersectData IntersectSegmentRay(Segment seg, Vector2 origin, float dir)
    {
        IntersectData data = new IntersectData();

        // Get vector between p1 and p2
        Vector2 q = seg.p1;
        Vector2 s = seg.p2 - seg.p1;
        Vector2 p = origin;
        Vector2 r = new Vector2((float)Math.Cos(dir), (float)Math.Sin(dir)) * 100000f;

        float t = MathHelper.Vec2CrossProduct(q - p, s) / MathHelper.Vec2CrossProduct(r, s);
        float u = MathHelper.Vec2CrossProduct(q - p, r) / MathHelper.Vec2CrossProduct(r, s);

        if (MathHelper.Vec2CrossProduct(r, s) != 0 && t <= 1 && t >= 0 && u <= 1 && u >= 0)
        {
            data.intersecting = true;
            data.depth = p + t * r;//q + u * s;
            data.dir = dir;
        }

        return data;
    }

Extra Info: My Vec2CrossProduct is V × W to be Vx Wy − Vy Wx

I imagine there is something wrong with the ray segment intersection because if I tried to replace that 100000f with float.PositiveInfinity() it won't work.

sentences:
How can I ensure character weapon is also included in collision detection? I have two models, my player character and her weapon. Each can be controlled independently (that is, I allow the player to aim the weapon). The object hierarchy is:

Character (with CharacterController)

Weapon

Block

The character collides with the block correctly (both behave as solid objects), but the weapon passes through the block. What components does the weapon (or block) need so that it also behaves as a solid object? (In other words, it must not pass through the block. The block should stop the weapon from moving.)

I have tried adding rigid bodies to both weapon and block, including enabling and disabling Kinematics on each, to no avail. When they do collide, they move through each other rather than behaving as solid objects. If I tick a few constraints, they behave as solid objects, but affect each other's movement and/or rotation. If I tick all the constraints, then they no longer behave as solid objects and move through each other again.

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:
How should I cycle my game to be more scalable? I'm trying to improve my game emulator so it can handle more users. I currently have one separate thread and execute all processing there.

The cycles processes players and rooms, rooms are individual maps that users can belong to, with other users where they can walk, talk and interact with each other

Currently my game server starts having issues where there are more than 2,000 users online, or when a single room has more than 60 users inside it.

Here is the main game cycle

private Task _gameCycle;
private int _cycleSleepTime = 25;

public Game()
{
    _cycleActive = true;

    _gameCycle = new Task(GameCycle);
    _gameCycle.Start();
}

private void GameCycle()
{
    while (_cycleActive)
    {
        Root.GetGame().GetRoomManager().OnCycle();
        Root.GetGame().GetPlayerManager().OnCycle();

        Thread.Sleep(_cycleSleepTime);
    }
}

RoomManager's OnCycle:

var sinceLastTime = DateTime.Now - _cycleLastExecution;

if (sinceLastTime.TotalMilliseconds >= 500)
{
    _cycleLastExecution = DateTime.Now;

    foreach (var room in _rooms.Values.ToList())
    {
        if (room.isCrashed)
        {
            continue;
        }

        if (room.ProcessTask == null || room.ProcessTask.IsCompleted)
        {
            room.ProcessTask = new Task(room.ProcessRoom);
            room.ProcessTask.Start();
            room.IsLagging = 0;
        }
        else
        {
            room.IsLagging++;

            if (room.IsLagging >= 30)
            {
                room.isCrashed = true;
                UnloadRoom(room.Id);
            }
        }
    }
}

PlayerManager's OnCycle:

if (_clientPingStopwatch.ElapsedMilliseconds >= 30000)
{
    _clientPingStopwatch.Restart();

    var toPing = new List<IGameClient>();

    foreach (var client in _clients.Values.ToList())
    {
        if (client.GetConnection().PingCount < 6)
        {
            client.GetConnection().PingCount++;

            toPing.Add(client);
        }
        else
        {
            lock (_timedOutConnections.SyncRoot)
            {
                _timedOutConnections.Enqueue(client);
            }
        }
    }

    var start = DateTime.Now;

    foreach (var client in toPing.ToList())
    {
        try
        {
            client.SendPacket(new PongComposer());
        }
        catch
        {
            lock (_timedOutConnections.SyncRoot)
            {
                _timedOutConnections.Enqueue(client);
            }
        }
    }
}

if (_timedOutConnections.Count < 1)
{
    return;
}

lock (_timedOutConnections.SyncRoot)
{
    while (_timedOutConnections.Count > 0)
    {
        IGameClient client = null;

        client = (IGameClient)_timedOutConnections.Dequeue();

        if (client != null)
        {
            client.Disconnect();
        }
    }
}

Each room has its own task (thread). It processes a lot, user movement, chat messages, items, status updates. I figured rather than waiting for each room to process in RoomManager's OnCycle, use a new thread and try to process multiple at the same time, after all the server is multi-core.

Room's ProcessRoom

public void ProcessRoom()
{
    if (isCrashed || mDisposed)
    {
        return;
    }

    try
    {
        if (GetRoomUserManager().GetRoomUsers().Count == 0)
        {
            IdleTime++;
        }
        else if (IdleTime > 0)
        {
            IdleTime = 0;
        }

        if (Promotion != null && Promotion.HasExpired)
        {
            EndPromotion();
        }

        if (IdleTime >= 60 && Promotion == null)
        {
            Root.GetGame().GetRoomManager().UnloadRoom(Id);
            return;
        }

        GetRoomItemHandler().OnCycle();
        GetRoomUserManager().OnCycle();
        GetRoomUserManager().SerializeStatusUpdates();
        GetWired().OnCycle();
    }
    catch (Exception e)
    {
        _logger.Exception(e);
        OnRoomCrash(e);
    }
}

sentences:
Java: refresh KeyInput to avoid sticky fingers during gameover state In short, I am trying to avoid my keys from sticking when its in the gameover state. The problem is if the player is holding down the right button for instance and dies, then he restarts the game moving right indefinitely until the player presses down the right button again. How can I prevent this from occuring? I tried setting up a boolean variable that detects if it's pressed or not but that isn't working.

else if(state == STATE.GAMEOVER)
    {
        gameover.tick();
        MouseInput.pressed = true;
        KeyInput.pressed = false;
    }

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

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

        if(tempObject.getId() == ID.Player && pressed == true)
        {
            if (key == KeyEvent.VK_W) handler.setUp(true);
            if (key == KeyEvent.VK_S) handler.setDown(true);
            if (key == KeyEvent.VK_A) handler.setLeft(true);
            if (key == KeyEvent.VK_D) handler.setRight(true);
        }
        if (key == KeyEvent.VK_ESCAPE && pressed == true)
        {
            Game.setState(Game.STATE.PAUSE);
        }
    }
}
public void keyReleased(KeyEvent e)
{
    int key = e.getKeyCode();

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

        if(tempObject.getId() == ID.Player && pressed == true)
        {
            if (key == KeyEvent.VK_W) handler.setUp(false);
            if (key == KeyEvent.VK_S) handler.setDown(false);
            if (key == KeyEvent.VK_A) handler.setLeft(false);
            if (key == KeyEvent.VK_D) handler.setRight(false);
        }
    }
}
public static boolean isPressed()
{
    return pressed;
}
public static void setPressed(boolean pressed)
{
    KeyInput.pressed = pressed;
}

    if(handler.isUp() && KeyInput.pressed == true) velY = -5;
    else if(!handler.isDown() && KeyInput.pressed == true) velY = 0;

    if(handler.isDown() && KeyInput.pressed == true) velY = 5;
    else if(!handler.isUp() && KeyInput.pressed == true) velY = 0;

    if(handler.isRight() && KeyInput.pressed == true) velX = 5;
    else if(!handler.isLeft() && KeyInput.pressed == true) velX = 0;

    if(handler.isLeft() && KeyInput.pressed == true) velX = -5;
    else if(!handler.isRight() && KeyInput.pressed == true) velX = 0;
}

sentences:
Is it legal to clone a character from other game? Is it legal to make a character very similar/exact from other game? E.g. take characters from Team Fortress 2 game, remake them in pixel art and use it in my game, but just change their names(with an intent to make money).

Would I get in trouble?

sentences:
Isometric ball moving in unity 3d. Ball moving in opposite direction I am making a game in unity 3d. It is a 2.5d game which mean it is in isometric. The game is quite simple. Player drags mouse and a trajectory will be shown just like in angry bird and when player release the mouse the ball will move to the direction. However I am having issue here that once mouse is released the ball moves in exact opposite direction. I am not able to understand what the real issue is. My code is as follows:
For Ball:
public class BallScript : MonoBehaviour

{
    public Rigidbody2D rbg;
    public CircleCollider2D col;

    public Vector3 BallPos{
        get {return transform.position;}
    }

    void Awake(){
        rbg = GetComponent<Rigidbody2D>();
        col = GetComponent<CircleCollider2D>();
    }

    public void PushBall(Vector2 force){
        rbg.AddForce(force,ForceMode2D.Impulse);
    }

    //to enable rigidbody so we can use projectile again
    public void ActivateRb(){
        rbg.isKinematic = false;
    }

    public void DeActivateRb(){
        rbg.velocity = Vector3.zero;
        rbg.angularVelocity = 0f;
        rbg.isKinematic = true;
    }
}

The code for my game manager is as follows:
public class Trajectory : MonoBehaviour
{
    [SerializeField] int dotsNumbers;
    [SerializeField] GameObject dotsParent;

    [SerializeField] GameObject DotsPrefab;
    [SerializeField] float dotSpacing;
    Vector2 pos;
    float timeStamp;
    Transform[] dotsList;

    void Start(){
        //hide trajectory in the start
        Hide();

        PrepareDots();
    }

    void PrepareDots(){
        dotsList = new Transform[dotsNumbers];
        for(int i=0;i<dotsNumbers;i++){
            dotsList[i] = Instantiate(DotsPrefab,null).transform;
            dotsList[i].parent = dotsParent.transform;
        }
    }
    public void UpdateDots(Vector3 ballPos,Vector2 forceApplied){
        timeStamp = dotSpacing;
        for(int i=0;i<dotsNumbers;i++){
            pos.x = (ballPos.x + forceApplied.x * timeStamp);
            pos.y = (ballPos.y + forceApplied.y * timeStamp)-(Physics2D.gravity.magnitude * timeStamp * timeStamp)/2f;
            dotsList[i].position = pos;
            timeStamp += dotSpacing;
        }
    }

    public void Show(){
        dotsParent.SetActive(true);
    }
    public void Hide(){
        dotsParent.SetActive(false);
    }
}

Here is the code for gamemanager
// using singleton pattern
Camera cam;
public BallScript ball;
public Trajectory trajectory;
public static GameManagerScript Instance;
void Awake(){
    if(Instance==null){
        Instance = this;
    }
}

[SerializeField] float pushForce = 4f;
bool isDragging = false;

Vector2 startPoint;
Vector2 endPoint;
Vector2 direction;
 Vector2 force;
float distance;

void Start(){
    cam = Camera.main;
    ball.DeActivateRb();
}

void Update(){
    if(Input.GetMouseButtonDown(0)){
        isDragging = true;
        OnDragStart();
    }
    if(Input.GetMouseButtonUp(0)){
        isDragging = false;
        OnDragEnd();
    }
    if(isDragging){
        OnDrag();
    }
}

void OnDragStart(){
    ball.DeActivateRb();
    startPoint = cam.ScreenToWorldPoint(Input.mousePosition);
    trajectory.Show();
}

void OnDrag(){
    endPoint = cam.ScreenToWorldPoint(Input.mousePosition);
    distance = Vector2.Distance(startPoint,endPoint);
    direction = (endPoint-startPoint).normalized;
    force = direction* distance * pushForce;

    trajectory.UpdateDots(ball.BallPos,force);

}

void OnDragEnd(){
    ball.ActivateRb();
    ball.PushBall(force);
    trajectory.Hide();
}

The ball moves in exact opposite direction where I wish to send it by dragging. Is it because of the isometric issue or I am missing something?P.S: have applied negative force as well as in case and have also made change in direction formula
rbg.AddForce(-force,ForceMode2D.Impulse);
direction = (startPoint-endPoint).normalized;

sentences:
Does indexing arrays with temporary objects leak memory? For example, if I have something like this:

Array = {}
RemoteEvent.OnServerEvent:Connect(function(Player)
    local Part = Instance.new("Part", workspace)
    Array[Part] = Player.UserId
    wait(10)
    Part:Destroy()
end)

Will that leak memory? Will it automatically remove the index for that part once it detects that it's been removed? Or do I need to manually set it to nil when removing it?

sentences:
LibGDX Tiled Map - how to get embedded objects I am using LibGDX to learn Game Development. I have reached the phase I am learning to use Tiled Maps.

In Tiled map editor, there is a feature where we can pick a tile in the tile set, go to View -> Tile Collision Editor, and add shape objects to a tile.

I can see that the shapes are saved in the tmx file and associated to the tile.

For testing purpose, I have also made the tile animated (similar option is available under view menu) and the OrthogonalTiledMapRendered automatically animated it (so this information is being accessed somehow).

I wanted to find out if there is anyway to retrieve other information embedded at tile level like the embedded shapes and objects.

Here is the sample xml from the tmx file.

<tile id="7">
    <properties>
        <property name="customProp1" value="customValue1"/>
    </properties>
    <image width="16" height="16" source="black_hole_swallow_4.png"/>
    <objectgroup draworder="index">
        <object id="0" x="0.25" y="0">
            <polyline points="0,0 15.625,-0.25"/>
        </object>
    </objectgroup>
    <animation>
        <frame tileid="5" duration="300"/>
        <frame tileid="7" duration="200"/>
    </animation>
</tile>

sentences:
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: Java Tile Collision Detection not accurate enough How can I make my isometric tile collision detection more accurate, I'm using the Rectangle class from java to detect collisions but because it's a rectangle it overlaps other rectangles which means clicking on a tile has a chance of selecting the tile next to it and I would like to know how to fix that.

sentences:
Adding Components (classes) to unordered_map in Entity? (Possible typeid as key issue) I've got a little test put together that has a couple simple Components that are supposed to be added to an Entity, but the addComponent function isn't working; I think it's got something to do with typeid/component class inheritance, but I'm not sure. It seems to add a single entry to the map of type Component, but nothing else. Any help is much appreciated, thanks!

#include <iostream>
#include <unordered_map>
#include <typeinfo>

using namespace std;

//----------------------------------------------------------------------

//the base component
class Component {
    public:
    Component() {cout<<"new Component created\n";}
};

//----------------------------------------------------------------------

//a "thing" component
class Thing : public Component {
    public:
    Thing() {cout<<"new Thing created\n";}
};

//----------------------------------------------------------------------

//a "what" component
class What : public Component {
    public:
    What() {cout<<"new What created\n";}
};

//----------------------------------------------------------------------

class Entity {
    public:
    void addComponent(Component* c);
    template <typename T> T* getComponent();
    int componentCount();

    private:
    unordered_map<const type_info *, Component *> components;
};

//----------------------------------------------------------------------

void Entity::addComponent(Component* c) {
    components[&typeid(*c)] = c;
}

//----------------------------------------------------------------------

template <typename T>
T* Entity::getComponent() {
    if(components.count(&typeid(T)) != 0) {
        return static_cast<T*>(components[&typeid(T)]);
    } else {
        return nullptr;
    }
}

//----------------------------------------------------------------------

int Entity::componentCount() {
    return components.size();
}

//----------------------------------------------------------------------

int main(int argc, char* argv[]) {
    Entity e;

    e.addComponent(new What());
    e.addComponent(new Thing());

    cout<<e.componentCount()<<endl;

    return 0;
}

sentences:
FPS drop after moved from Textures to TextureAtlas in LibGDX I've started using LibGDX some time ago and I was making a test project to get used to this library. I've created some images and added them to the assets folder and loaded each image as a Texture using the AssetManager. Everything was working fine and I had 60 FPS.

I wanted to work in a more efficient way so I packed all my images into an atlas using the TexturePacker tool. I loaded the atlas using the AssetManager again and started using TextureRegions instead of Textures.

After this change I've started to notice sudden drops in FPS from 60 to 50 and even 30 once. I've tried to change the pixel format to RGBA4444, I've made sure that the min and mag filter were both seth to Nearest, but still I see those annoying frame drops.

I'm not doing anything heavy in the game itself, it's currently some actors in a stage. I got some MoveActions and Animation, but nothing special yet.

Does anyone have a clue what can cause the FPS drop?

Thanks

sentences:
InvalidOperationException when peeking from a stack within custom editor I've got a simple state machine for handling game states which works using GameObjects that I enable/disable in order to switch the states. Since some states can be loaded additively (such as the pause menu), I'm using a stack to manage the currently active ones.

public class GameController : MonoBehavior {

    private readonly Stack<GameObject> _stateStack = new Stack<GameObject>();

    public GameObject ActiveState {
        get { return _stateStack.Peek(); }
    }

    public void SetState(GameObject newState, bool isAdditive = false) {
        if(newState = null || newState == ActiveState)
            return;

        if(!isAdditive) {
            while(_stateStack.Count > 0)
                PopState();
        }

        if(!newState.activeInHierarchy)
            newState.SetActive(true);

        _stateStack.Push(newState);
    }

    public void PopState() {
        var gameState = _statStack.Pop();
        if(gameState != null)
            gameState.SetActive(false);
    }

}

Now I'd like to have a custom editor which allows me to see and set the currently top-most active state.

What I did was this:

[CustomEditor(typeof(GameController))]
public class GameControllerEditor : Editor {

    public override void OnInspectorGUI() {
        DrawDefaultInspector();

        var controller = target as GameController;
        if(controller == null)
            return;

        var newState = EditorGUILayout.ObjectField("ActiveState", controller.ActiveState,
              typeof (GameObject), true) as GameObject;
        if (newState != controller.ActiveState)
            controller.SetState(newState);
    }

}

However, the custom editor is never visible and in the console, I see the following exception:

InvalidOperationException: Operation is not valid due to the current state of the object
System.Collections.Generic.Stack'1[UnityEngine.GameObject].Peek()

What does this even mean? What state? Is the stack not initialized? How does Unity instantiate MonoBehaviors when applying a custom inspector?

sentences:
Could I get in to trouble for "rickrolling" users in my commercial game? Not sure if this question is too stupid but, theoretically speaking...

Could you get into trouble for using something like Application.OpenURL in a commercial game to rickroll a player or would that be legally okay? (sorry this question is really stupid)

sentences:
Good ways to indicate enemy toughness Can you add any good ways to indicate enemy strength to this list:
 - physical size
 - equipment quality
 - narration or preview scene
 - demeanour

Background
I'm designing a spell-casting/stealth game where some enemies are cannon-fodder, others are decent fights, and some (initially) will be lethal - hence the stealth requirement.
It's a VR title so I don't want UI elements (like stars, health-bars etc) messing up the immersion.
At the moment my inclination is to avoid cartoony art style so it'll be as 'realistic' looking as I can manage while keeping 90fps.

sentences:
Are virtual calls worth it for game entity management? I have seen a lot of game programming tutorials doing this:

//our base class
class entity
{
   /*virtual methods and data common to all entities
   and a 4 Byte virtual pointer*/
};

//Some other class inheriting those calls and data
class Player : public entity
{
   //extra methods and calls specific to class a 4 Byte virtual pointer
};

and thousands of Gameobject classes doing the same thing. What it does that it allows us to make a list of all objects and update and render (and some other things) it in a single loop.

But I have problems with this approach when I want to do something with a single object. suppose we have a list of all entities...

list<entities*> entities = {
new Player0(its properties),
new Enemy0(its properties),
new Player1(its properties),
new Stone0(its properties),
.... and so on
};

and now I want to stop updating Player1 for some reason. Now Either I can assign an ID to each object so that I can use "if" condition to stop updating it or I can have a reference to that object before pushing it to the list which is messy because I cannot have refrences to all of objects. Also lets consider that 4 byte additional size for those objects because of virtual calls.

An Alternative can be to have only references to objects...but again its thousands of objects we are talking about here so It will be hard to manage.

How to handle this problem?

sentences:
XNA 2D Tile Map zooming to arbitrary point I'm working on a game in XNA with a 2D tilemap as the playfield. I'm using a spritebatch with a transformation matrix to provide movement and scaling of the playfield. I'm trying to add a zoom function, so the player can click anywhere on the screen and it will zoom in to that point. The issue is that when I increase or decrease the scale, the "focus" of the zoom is always at the top-left hand corner of the screen.

So unzoomed:

And when zoomed in (note the position of the chequered tile):

What I'd like to happen when the player zooms is that it zooms into the centre of the screen, like so: (I achieved this by moving the playfield around after zooming)

I realise that the way to do this is probably to add or subtract from the X/Y co-ordinates that get fed into the transformation matrix, and probably at a fraction of the scale, but I can't figure this out. Everything I try tends to result in crazy effects while zooming.

Ideally I'd like to be able to set any arbitrary point on the screen, and zoom to that point. Can you help?

The code of the Draw function:

   protected override void Draw(GameTime gameTime)
    {
        Matrix transformMatrix =
           Matrix.CreateTranslation(-baseX, -baseY, 0) *
            Matrix.CreateScale(baseR, baseR, 1) ;

        GraphicsDevice.Clear(Color.CornflowerBlue);

        // "World" spritebatch. Scaling applied.
        spriteBatch.Begin(SpriteSortMode.FrontToBack, null, SamplerState.PointClamp, null, null, null, transformMatrix);

        foreach (Vector3 Square in Squares)
            spriteBatch.Draw(Textures[(int)Square.Z], new Vector2(Square.X, Square.Y), null, Color.White, 0, new Vector2(0, 0), 1, SpriteEffects.None, 0.82f);

        base.Draw(gameTime);

        spriteBatch.End();

        // "UI" spritebatch. No scaling applied.
        spriteBatch.Begin(SpriteSortMode.FrontToBack, null, SamplerState.PointClamp, null, null);
        spriteBatch.Draw(Textures[0], new Vector2(ScreenMidX, ScreenMidY), null, Color.White, 0, new Vector2(0, 0), 1, SpriteEffects.None, 1f);

        SpriteFont aFnt = Content.Load<SpriteFont>("Font1");
        spriteBatch.DrawString(aFnt, "" + baseX, new Vector2(5, 0), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 1f);
        spriteBatch.DrawString(aFnt, "" + baseY, new Vector2(100, 0), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 1f);
        spriteBatch.End();
    }

Full code available here: https://www.dropbox.com/s/zft5b20st8o7jv7/ZoomTest3.zip

Thanks for any help!

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:
Repetition of move in Draughts game I am having a little problem in my draughts game. Lets say my red piece (moving through AI) has arrived at the border of black pieces and now it has become a king, lets assume it is at index 2. Now when its next AI's turn, this piece moves to index 5, thats ok. But on next turn it moves to index 2 and then this transition between index 2 and 5 continues in every turn. I can't figure out whats wrong. I have revised my generate_moves() and it seems ok. Any idea what can be wrong? – My evaluation function is as follows:

public double Evaluation(int type, int aBoard[]) {

  double reds, blacks, ret=0.0;
  int loop;

  for(reds=blacks=loop=0;loop<32;loop++) {
    switch(aBoard[loop]) {
                case 2: //redKingType:
                  reds+=1;
                case 0://redType:
                  reds+=1;
                  break;
                case 3://blackKingType:
                  blacks+=1;
                case 1://blackType:
                  blacks+=1;
                  break;
                default:
                  break;
    }
  }
  switch(type) {
              case 0://redType:
              case 2://redKingType
                if(reds==0) {
                  return 0.0;
                }
                if(blacks==0) {
                  return 24.0;
                }
                ret=reds/blacks;
                    return ret;
              case 1://blackType
              case 3://blackKingType
                if(reds==0) {
                  return 24.0;
                }
                if(blacks==0) {
                  return 0.0;
                }
                ret=blacks/reds;
                   return ret;
              default:
                break;
  }

  return ret;
}

Note: I know this a very simple evaluation function ,but please consider the fact that I am doing this for the first time, under a hard  deadline.

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:
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: 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:
Unity Items not being removed from list So I finally perfected my RTS multiple movement. The situation is that the game objects are added into a list in a script bound to the camera called UnitController they are added from a unit client script MultiselectClient, this client accesses the UnitController class and adds itself the gameObject into the list. Each time I do the drag select I want it to clear the list first before adding any more. But for some reason, it doesn't work?

This is in my UnitController (below):

void MultiSelect(RaycastHit hit)
{
    Debug.Log(SelectedUnits);
    if (SelectedUnits.Count > 0)
    {
        Debug.Log("Moving group to: " + hit.point);
        foreach(GameObject gameObject in SelectedUnits)
        {
            gameObject.GetComponent<NavMeshAgent>().SetDestination(hit.point);
        }
    }
}

This is in my client (below):

public bool Selected = false;
void Update()
{
    if (Input.GetMouseButton(0))
    {
        Vector3 camPos = Camera.main.WorldToScreenPoint(transform.position);
        camPos.y = Screen.height - camPos.y;

        //if inside the cameras drag selection area then mark player as selected
        Selected = UnitController.selection.Contains(camPos);

        Debug.Log("Selected");
        if(selected){
           addTo();
        }
    }

}

void addTo()
{

    UnitController.SelectedUnits.Remove(gameObject); //I have also tried .clear() which also hasnt worked.

    if (!UnitController.SelectedUnits.Contains(gameObject))
    {
        UnitController.SelectedUnits.Add(gameObject);
        Debug.Log("Added to list: " + UnitController.SelectedUnits);
    }
    else
    {
        Debug.Log("Im already in that list.");
    }
}

sentences:
Using multiple shaders I'm currently studying opengl shaders but I can't figure out something: how to apply different shaders to the objects, for example, a teapot rendered using toon shader and another one in the same scene using a very reflective surface and other distorted from a noise function, like in this video

http://www.youtube.com/watch?v=1ogg4ZfdBqU

Another one is applying a bloom shader in a scene and a motion blur shader afterwards. How to achieve those effects when you can only have one vertex shader and one fragment shader? Is there any trick such as using more than one shader program?

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:
Property replication vs RPC notifications I'm not talking about something such as an object position, which changes very often. I'm talking about some object state that may be changed infrequently, such as a door opening and closing.

Would it be better to send an RPC to saying "The door is opening/closing" or would it be better to replicated a property that tells us the objects state? Obviously this can be done both ways, but what are the advantages/disadvantages of each?

As far as I know any competent implementation will only consider replication for properties that have changed. This means when the property does actually change, it should have the same cost( assuming it must be reliably replicated ) as sending an RPC. The other advantage to doing this would be removing the need for more complex RPC buffering. If a client connects, they get sent the state, no need to buffer/unbuffer things.

All I can see is advantages for replicating over RPCs in this case. However, I always see suggestions to have as few replicating properties as possible.

sentences:
Unity override Coroutine Loop I have problem, when i override a Coroutine loop from the base code. But it seems that it only execute once. While on the base code it does what it suppouse to do and that is execute forever.

protected virtual IEnumerator OnThink(float interval)
{
    while (true)
    {
        yield return new WaitForSeconds(interval);
    }
}

protected override IEnumerator OnThink(float interval)
{
    Debug.Log("Execute");
    yield return StartCoroutine(base.OnThink(interval));
}

sentences:
Saving instances of classes, then recreating the instances I have many types of entities, each type has a lot of if instanceof Spider (for example ) then do this in the game code... Now I got to the part where I want to save each type.

They all are based on the same class, Entity but implement some of their own methods.
When I save them, lets say for now I just want their position and their health.

So I do write position the write health, to a file with all the entities.

Now here is the problem, When I want to load it, How will I know it's a spider and then create a Spider instance?

An easy fix is to create toString method then writing it before the position and health. But the problem with this is that when I load I will have to have this big switch statement for each type and I will have to manually add the case for a new type that I create. This is not very mod friendly.

What would be a way to read a name of a class and then create an instance of that class without having a big switch case?

sentences:
Why is the MaskBit maxed out Hi there for some reason the maskbit of my b2FixtureDef is being maxxed out and im not sure why

Here is the declaration of the items that are used in the game

enum PhysicBits {
    PB_NONE = 0x0000,
    PB_PLAYER = 0x0001,
    PB_PLATFORM = 0x0002
};

Basically what i want is the player to run along a surface is not slow down (i set platform & player friction to 0.0f)

I then setup my Contact Listener to print out the connections (currently only have 1 platform and 1 player)

Player Fixture Def

b2FixtureDef fixtureDef;
fixtureDef.shape = &groundBox;
fixtureDef.density = 1.0f;
fixtureDef.friction = 0.0f;
fixtureDef.filter.categoryBits = PB_PLAYER;
fixtureDef.filter.maskBits = PB_PLATFORM;

Platform Fixture Def

b2FixtureDef fixtureDef;
fixtureDef.shape = &groundBox;
fixtureDef.density = 1.0f;
fixtureDef.friction = 0.0f;
fixtureDef.filter.categoryBits = PB_PLATFORM;
fixtureDef.filter.maskBits = PB_PLAYER;

Now correct me if im wrong but these are saying the following:

Player Collides with Platform
Platform Collides with Player

Here is the printout of the fixtures colliding with each other

********    <-- Indicates new Contact
Platform
ContactA: 2
MaskA: 1
------
Player
ContactB: 1
MaskB: 2
********    <-- Indicates new Contact
Platform
ContactA: 2
MaskA: 1
------
Player
ContactB: 1
MaskB: 65535
********    <-- Indicates new Contact
Platform
ContactA: 1
MaskA: 65535
------
Player
ContactB: 1
MaskB: 65535

Here is where i am confused. On the second & third contact the player maskBit is set to 65535 when it should be 2 and there are 3 contacts when i am sure at most there should only be 2.

I've been trying to figure this out for hours and i can't understand why it is doing this. I would be very grateful is someone could shine some light on this for me

UPDATE:
**I printed out the class of the contacting objects. For some reason it seems to do the following:

First Contact: Correct Result.

Second Contact: Player b2Fixture Obtains a new maskBit.

Third Contact: Platform b2Fixture appears to be set to the same as the Player b2Fixture.
It would seem I have a memory race condition i think**

sentences:
Unity2D - How to leave and come back to the same scene properly? I am new to game development and for exercise I made endless runner where everything is generated randomly from prefabs and both player and obstacles are being destroyed once they are off the screen. There are two scenes - Start and Game. At the Start scene you can click on Play button which will take you to the Game scene and you can mute the sound.

When I start the game and I click on the Play button it loads the Game scene perfectly and game runs and works just fine. When player dies the game over window is shown. From there two options are available - either go to the Start scene or play the game one more time.

If I choose to play one more time everything works perfectly. But if I choose to go to the Start scene and then click on Play button to play the game then once the Game scene is loaded the player and the obstacle game objects are not being generated and floor and background Quads are not being resized properly to fit the screen. And I get the following error -

MissingReferenceException: The object of type 'RecycleGameObject' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
ObjectPool.NextObject (Vector3 pos) (at Assets/Scripts/ObjectPool.cs:28)

My question is  - what can I do so that every time I come back to the scene everything is being loaded just like the first time?

I am currently loading scenes with this code:

SceneManager.LoadScene("Start");

And this is the ObjectPool class:

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

public class ObjectPool : MonoBehaviour {

    public RecycleGameObject prefab;
    private List<RecycleGameObject> poolInstances = new List<RecycleGameObject>();

    private RecycleGameObject CreateInstance(Vector3 pos)
    {

        var clone = GameObject.Instantiate(prefab);
        clone.transform.position = pos;
        clone.transform.parent = transform;

        poolInstances.Add(clone);

        return clone;
    }

    public RecycleGameObject NextObject(Vector3 pos)
    {
        RecycleGameObject instance = null;

        foreach(var go in poolInstances)
        {
            if(go.gameObject.activeSelf != true)//here I get the error
            {
                instance = go;
                instance.transform.position = pos;
            }
        }

        if(instance == null)
        {
            instance = CreateInstance(pos);
        }

        instance.Restart();

        return instance;
    }

}

sentences: How would I use an object from another animation in Unity? So I have two different .blend files with two different animations. Let's call my aiming with a gun animation animation A, and my other .blend file with idle, run, and jump animations animation B. If I wanted to play the aiming clip from animation A with the Animation B animator, it just looks like my character wants to shake hands, since the gun doesn't appear in the animation. The aiming animation works if I play animation A with animation A's animator. How would I use the gun object from animation A when playing animation A in animation B's animator?  Here is an image of what the animation looks like in the import settings (what i want) and in the actual game (what is happening which I don't want.) The top image is what I want and the bottom image is what is happening. Thanks in advance.

sentences:
How can I separate entities from their actions or behaviours? I'm having a go at creating a very simple text based game and I'm wondering how I can design the entities (characters, sentient scenery) with regards to the actions those entities can perform.

As an example, I have an entity that is a 'person' with various properties such as age, gender, height, etc. This 'person' can also perform some actions such as speaking, walking, jumping, flying, etc etc.

How would you separate out the entity from the actions it can perform?

sentences:
How do you handle animations that are for transitioning between states? How does one usually handle animations that are for going between a game object's states? For example, imagine a very simple game in which a character can only crouch or stand normally. Currently, I use a custom Animation class like this:

class Animation{
 int numFrames;
 int curFrame;
 Bitmap spriteSheet;
 //... various functions for pausing, returning frame, etc.
}

and an example Character class

class Character{
 int state;
 Animation standAni;
 Animation crouchAni;
 //... etc, etc.
}

Thus, I use the state of the character to draw the necessary animation.

if(state == STATE_STAND)
    draw(standAni.updateFrame());
else if(state == STATE_CROUCH)
    draw(crouchAni.updateFrame());

Now I've come to the point where I want to draw "in-between" animations, because right now the character will just jump immediately into a crouch instead of bending down. What is a good way to handle this? And if the way that I handle storing Animations in the Character class is not a good way, what is?

I thought of creating states like STATE_STANDING_TO_CROUCHING but I feel like that may get messy fast.

sentences: Control the Transform component of an object while the animation is playing It seems the the animation controls the Transform component of the gameobject, hence making it not possible to control the transform properties while the animation is playing. Is there any way to control the Transform component of an object while the animation is playing, like rotating it for example?

sentences:
Why am I not getting an sRGB default framebuffer? I'm trying to make my OpenGL Haskell program gamma correct by making appropriate use of sRGB framebuffers and textures, but I'm running into issues making the default framebuffer sRGB.

Consider the following Haskell program, compiled for 32-bit Windows using GHC and linked against 32-bit freeglut:

import Foreign.Marshal.Alloc(alloca)
import Foreign.Ptr(Ptr)
import Foreign.Storable(Storable, peek)
import Graphics.Rendering.OpenGL.Raw
import qualified Graphics.UI.GLUT as GLUT
import Graphics.UI.GLUT(($=))

main :: IO ()
main = do
    (_progName, _args) <- GLUT.getArgsAndInitialize
    GLUT.initialDisplayMode $= [GLUT.SRGBMode]
    _window <- GLUT.createWindow "sRGB Test"

    -- To prove that I actually have freeglut working correctly.
    -- This will fail at runtime under classic GLUT.
    GLUT.closeCallback $= Just (return ())

    glEnable gl_FRAMEBUFFER_SRGB
    colorEncoding <- allocaOut $ glGetFramebufferAttachmentParameteriv
        gl_FRAMEBUFFER gl_FRONT_LEFT gl_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING
    print colorEncoding

allocaOut :: Storable a => (Ptr a -> IO b) -> IO a
allocaOut f = alloca $ \ptr -> do
    f ptr
    peek ptr

On my desktop (Windows 8 64-bit with a GeForce GTX 760 graphics card) this program outputs 9729, a.k.a. gl_LINEAR, indicating that the default framebuffer is using linear color space, even though I explicitly requested an sRGB window. This is reflected in the rendering results of the actual program I'm trying to write - everything looks washed out because my linear color values aren't being converted to sRGB before being written to the framebuffer.

On the other hand, on my laptop (Windows 7 64-bit with an Intel graphics chip), the program prints 0 (huh?) and I get an sRGB default framebuffer by default whether I request one or not! And on both machines, if I manually create a non-default framebuffer bound to an sRGB texture, the program correctly prints 35904, a.k.a. gl_SRGB.

Why am I getting different results on different hardware? Am I doing something wrong? How can I get an sRGB framebuffer consistently on all hardware and target OSes?

sentences:
Smooth input handling in Java I am writing a Java game.

My problem is to get a really smooth input. If I hit the key W the character has to go forwards, but if I hit A and release the W key, the character doesn't go left ways :( .

It isn't smooth. Which ways are given in common game developing for a smooth input?

My current source code
(Input.java): http://pastebin.com/9Z9qtXik
(MainLoop.handlingInputs): http://pastebin.com/Vx8BzSpL

sentences:
What's so different/complicated/useful about vectors? Forgive me if this isn't considered a real question, but it is something I am genuinely confused about.

I constantly hear other game developers talk about how using vectors are very useful, but also how everyone is intimidated by vector math and vectors can seem daunting. I have never got around to learning about them.

So, finally I looked Vector on Wikipedia, and I was surprised. Unless I am somehow mistaken, a vector(for sake of simplicity, say it's 2D), is just an x and y coordinate.  If I have misunderstood, please correct me.

So here is my question: doesn't that mean that any representation of two(or three) dimensional coordinates is a vector? If so, then a vectors and coordinates are the same thing. And it's pretty much impossible to create a game without using coordinates, so how are vectors confusing or new to someone who has done any amount of game programming?

This is something I could use some clarification on. Any help is appreciated.

sentences:
UNET start game with friend by finding their name, Android There is a game at the google play store called Fun Run 2- Multiplayer Race. I loved its feature to find friends by writing their names, and then to play with them. Is it possible to achieve that with UNET? How?

Another one is called Virtual Table Tennis. There I have a lobby full of people from whom I can choose. Can I achieve that with UNET? How?

sentences:
How to set parent for prefab in Unity I have a prefab of a button (btn) that I need to set parent (_canvos) for it after it spawned (online)...

I have try this code:

public Transform btn;
public Transform mkn;
public Image _canvos;

public void test ()
{
    Transform InTank = Network.Instantiate (btn, mkn.transform.position, Quaternion.identity, 0)as Transform;
    btn.SetParent(_canvos);
}

But it doesn't work.

  error: MissingReferenceException: The object of type 'Object' 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.
  what's the problem??

sentences:
How to build a bones animation engine? I want to develop a flash game. It would draw a stick man, and edit his pose.

I think what I need to learn are bones animation and physics engine.

Can anyone introduce some good resources to learn both?

sentences:
FBX model from Blender doesn't show it's surface in Unity3D I've create a model from Blender and exported it as .FBX file. However when I import this into Unity, the surface is missing.how can i fix?

Screenshot attached:

in Blender it look like this:

in Unity it look like this which only shows it inside:

sentences:
How 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:
How can I avoid texture stretching when adding high-resolution support via a mod? I am currently working on recreating the game engine for an old game (Sacred) using the original game assets I reversed-engineered the formats of.

The game had a fixed 1024x720 resolution, and I'm planning to support higher resolutions. How can I support them without having to stretch textures? I am hoping for results like D2MultiRes mod (Diablo 2) or G3 widescreen mod (Infinity Engine games) achieved.

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:
Entity component system, Communication between components I am trying to implement ECS for my simple 2D game. I would like to ask a question about how components should communicate between themselves and with entity.

I tried to implement few components, like SpriteComponent, MoveComponent, CollisionComponent, etc.. What is the appropriate way of communication between these components? E.g. my Sprite & Physics components need to know about current position, which is affected by Move component. I gave every single of my components handle that refers to the entity, which they can send to engine and call different functions, like updatePosition(EntityHandle handle, float x, float y). Is this the right approach?

sentences:
Is story more important or the gameplay more important? Read this Slate article. In particular, the following struck me:

When he looks at video games from a critical distance, Bissell is concerned mainly with their lack of narrative meaning. Games ask us to save the princess, save the country, save the world, save ourselves—but no one plays games to achieve those ends. We play for the puzzle, for the physics, for the sense of being embedded in a fully realized world. Indeed, for me, the "story" usually seems like filler, even in games like Grand Theft Auto and RDR [Red Dead Redemption], whose stories are smarter than the rest of the video-game pack. RDR begins and ends every mission with cleverly scripted movielike "cut scenes" that provide some explanation for why your character is doing what he's doing—but the game also lets you skip the scenes, which I usually elect to do. Thus I can't really explain why my character is doing what he's doing. The real answer is he's doing it because I am making him do it, and I am making him do it only because I am having fun.
"This is one of the most suspect things about the game form," Bissell writes. "A game with an involving story and poor gameplay cannot be considered a successful game, whereas a game with superb gameplay and a laughable story can see its spine bend from the weight of many accolades—and those who praise the latter game will not be wrong." What's the solution to this quandary? Should games invest more in story, in an attempt to bring us narratives that are on the level of those of the other popular arts? Or should games abandon story—is the video game, as a form, simply incompatible with traditional concepts of narrative, and must game designers instead find other ways to invest their creations with lasting meaning?

As if Bissell's uncertainty is echoing throughout the game industry, there has arisen a tendency to make many big-budget blockbuster games heavily story-driven. Even Starcraft II has a fairly story-driven campaign.
Is a game without a high-quality narrative bereft of true value and meaning? Must games have any meaning at all in the literary sense in order to be considered worthwhile forms of entertainment? What about emergent narratives, where the player has a decisive role in determining the plot (ideally much more decisive than we've seen in any games so far released)? If games do not need a higher literary meaning, do they at least need to have some lasting emotional significance for the player?
Those are just some thoughts that the article raised. The real question can be summed up like this: what is the true value of a video game? Is a game to be valued on its dynamic interaction with the player, on its ability to present a narrative in a way other mediums cannot, or on its ability to provide simple pleasure?

sentences:
Issues calculating frame independent movement I'm developing a Breakout style game in C++ using SDL. The problem so far is that the ball slows down and speeds up for no particular reason.

The slowdowns usually last a few seconds.

EDIT : When running fullscreen I noticed that the ball movement seems to be a tiny bit jerky as well. This leads me to believe that the timing should be more finely granulated. But at the same time, it shouldn't be necessary to have µs precision...

Here is my code for calculation the movement of the ball :

double deltaMovement = tick * speed;

rect.x += static_cast<int> ( deltaMovement * dirX );
rect.y += stnecessearyatic_cast<int> ( deltaMovement * dirY );

I tried changing it to help prevent float to in truncation, but this affects the speed to much, making the ball move only move horizontally or vertically ( which never happens with the above code. )

double movementX = ( deltaMovement * dirX );
double movementY = ( deltaMovement * dirY );

movementX += ( movementX > 0.0f )? 0.5f: -0.5f;
movementY += ( movementY > 0.0f )? 0.5f: -0.5f;

rect.x += static_cast<int> ( movementX );
rect.y += static_cast<int> ( movementX );

rect is an SDL_Rect and holds the ball's position. dirX and dirY are double and holds the direction of the ball, the values range from -1.0 to 1.0

I'm not sure if the issue is with the float to int conversion. I guess it could also be something with SDL internally, but I am quite sure SDL should be capable of smooth animation.

    Here's my main game loop ( I have removed some irrelevant parts of it )
    while ( !quit )
    {
        while ( SDL_PollEvent( &event ) )
        {
            // Handle input, move paddle, check if user pressed esc
            // Yes I have a means of escaping the outer while loop.
        }
        double delta = timer.GetDelta( );

    // Update the ball, check for collisions with wall/paddle/tiles
    UpdateBalls( delta );

    // Redraws everything
    UpdateGUI();
}

I'm quite sure the issue is not with my delta time, since it's fairly consistant at 1 - 4 msec. And even if it did change a lot, it shouldn't matter. But just in case, here's the code I use for calculating delta time :

double Timer::GetDelta( )
{
    timespec tmCurrent;
    clock_gettime( CLOCK_MONOTONIC_RAW, &tmCurrent);

    // Get current time in nanoseconds
    unsigned long long deltaCurrent = static_cast< unsigned long long > ( tm.tv_sec * 1000000000 + tm.tv_nsec );

    // Get diff. Delta is an unsigned long long that holds previous tick ( see below)
    unsigned long long diff = deltaCurrent - delta;

    // Convert into ms and assign to a double
    double deltaMSec = static_cast< float > ( diff / 1000000.0f );

    // Reset delta so that it can be used the next time delta is calculated
    delta = deltaCurrent;

    return deltaMSec;
}

What am I doing wrong?

sentences:
How does Component Entity System Manages Game Mode? I would like to create a simple game fire and shoot game using Component Entity System (CES). This game has two game modes(1): play mode and settings mode. The play mode is the actual game itself whereas the setting mode is where the player updates his sprite's settings, like type of weapon, inventories, etc.

Now, how does one implement game modes in CES? How would one switch to different game modes?

(1) The game mode i refer is something like the one implemented in Final Fantasy I, where it has four game modes (http://en.wikipedia.org/wiki/Final_Fantasy_(video_game)#Gameplay)

sentences:
How can I continue to rotate a 2D UI Object using OnPointerEnter when object is on its side? (OnPointerExit is triggered) I have been wracking my brain on this for days. I'm trying to create a nice looking hand of cards, when the card is hovered over, it bobs up and down and rotates. This is triggered by OnPointerEnter, however, whenever it turns on its side and out of the mouses path OnPointerExit triggers, I've tried MANY things, including a bool that triggers the hover effect OnPointerEnter but it is just toggled off when it's turned on its side.

Is it possible to use the collider on my card with OnPointerEnter? Because that would probably solve my problem but haven't found anything on this.

Since the card is on UI, I have some placeholder code in there in order the have the inspected card render on top and return to its place.

    void Update()
{
    if (inspect)
    {

        transform.localScale = cardUpscale;

        posOffset = transform.position;

        transform.Rotate(new Vector3(0f, Time.deltaTime * degreesPerSecond, 0f), Space.World);

        // Float up/down with a Sin()
        tempPos = posOffset;
        tempPos.y += Mathf.Sin(Time.fixedTime * Mathf.PI * frequency) * amplitude;

        transform.position = tempPos;
    }
}

public void OnPointerEnter(PointerEventData eventData)
{
    zoomPlaceholder = new GameObject();
    zoomPlaceholder.name = "zoomPlaceholder";
    zoomPlaceholder.transform.SetParent(this.transform.parent); //binds the placeholder to the hand
    zoomPlaceholder.transform.SetSiblingIndex(this.transform.GetSiblingIndex());

    LayoutElement cardProxy1 = zoomPlaceholder.AddComponent<LayoutElement>();
    cardProxy1.preferredHeight = this.GetComponent<LayoutElement>().preferredHeight;
    cardProxy1.preferredWidth = this.GetComponent<LayoutElement>().preferredWidth;
    cardProxy1.flexibleHeight = 0;
    cardProxy1.flexibleWidth = 0;

    zoomPosition = transform.parent;
    transform.SetParent(transform.parent.parent);
    inspect = true;
}

public void OnPointerExit(PointerEventData eventData)
{
    inspect = false;

    this.transform.SetParent(zoomPosition);
    this.transform.SetSiblingIndex(zoomPlaceholder.transform.GetSiblingIndex());

    transform.localScale = cardNormalScale;

    Destroy(zoomPlaceholder);

}

sentences:
Unity Profiler - What would cause PlayerEndOfFrame to have 10-16MB in GC Alloc? I can't find much documentation on what "PlayerEndOfFrame" does. Sure it is the end of a frame but what would cause the GC Alloc to go so high?

This is the profiler results from a debug build on a remote machine using the IP connect to unity profiler.

sentences:
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:
How can I add a transparent overlay to a UI in libGDX? I am attempting to use the following code

        shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
        shapeRenderer.setColor(3,3,3,.3f);
        shapeRenderer.rect(0,0,gameWidth,gameHeight);
        shapeRenderer.end();

So that when the menu is accessed, a transparent background appears. The problem I am facing is that when I try to do this the objects rendered by the SpriteBatch seem to misbehave. Upon further research i found that attempting to nest that code within SpriteBatch.begin() and SpriteBatch.end() is the cause of that. However, If I try to place the code after the SpriteBatch.end(), because the SpriteBatch has ended the objects rendered by it do not appear behind the transparent rectangle.
(I tried assigning SpriteBatch and Shaperender a different camera, however, that didn't fix the problem.) How can I fix this or find another way to implement the transparent background for the menu.

sentences:
8 directional movement - Maintain vertical position I have a top-down game that has 8 directions of movement (top/down/left/right/topright/topleft/bottomright/bottomleft).  There are sprites for each direction of movement.  This is just an example spritesheet:

The problem is when I want to retain the vertical position.  When I let go of the buttons on the keyboard, it polls the keys quickly and ends up facing the character in either left/right/up/down position depending on the last key that was released.

I added a delay for polling the keypresses, but I do not like this solution as it creates a noticeable lag.

Can anyone think of logic that would be able to allow my sprite to retain the proper direction when the keys are unpressed?  Here is the current code:

if (kbState.IsKeyDown(Keys.Up) && kbState.IsKeyDown(Keys.Left))
    character.ChangeDirection(Direction.UpLeft);
else if (kbState.IsKeyDown(Keys.Up) && kbState.IsKeyDown(Keys.Right))
    character.ChangeDirection(Direction.UpRight);
else if (kbState.IsKeyDown(Keys.Down) && kbState.IsKeyDown(Keys.Left))
    character.ChangeDirection(Direction.DownLeft);
else if (kbState.IsKeyDown(Keys.Down) && kbState.IsKeyDown(Keys.Right))
    character.ChangeDirection(Direction.DownRight);
else  if (kbState.IsKeyDown(Keys.Up))
    character.ChangeDirection(Direction.Up);
else if (kbState.IsKeyDown(Keys.Down))
    character.ChangeDirection(Direction.Down);
else if (kbState.IsKeyDown(Keys.Left))
    character.ChangeDirection(Direction.Left);
else if (kbState.IsKeyDown(Keys.Right))
    character.ChangeDirection(Direction.Right);

Edit

Settled for the following code:

float delay = 0.04f;
float DELAY = 0.04f;
....

//Get movement
delay -= (float)gameTime.ElapsedGameTime.TotalSeconds;
if (delay < 0)
{
      int vertical = kbState.IsKeyDown(Keys.Up) ? -1 : kbState.IsKeyDown(Keys.Down) ? 1 : 0;
      int horizontal = kbState.IsKeyDown(Keys.Left) ? -1 : kbState.IsKeyDown(Keys.Right) ? 1 : 0;
      movement = new Vector2(horizontal, vertical);
      delay = DELAY;
}

character.Update(gameTime, movement);

Seems I have to use a delay in order to get this to work.  Thanks for the feedback guys.

sentences:
Collision problem with multiple tiles (rectangles) I think that I found what the problem is, see below

So I'm working on a collision system and I use multiple tiles in my project, each with a collision box. The player also has a collision box.

I'm testing this collision method so it's not done yet (very basic). I had another collision method in the past but it only worked for one tile and used a lot of booleans so I decided to make a new method.

This is my collision method in my SpriteManager class:

public void Collision(List<PlayerMovement> playerCollision, List<TileSprite> tileCollision)
{
    // For each sprite in the tileCollision list
    foreach (TileSprite t in tileCollision)
    {
        // For each player (head, body, legs) in the playerCollision list
        foreach (PlayerMovement p in playerCollision)
        {
            if (p.collisionRect.Intersects(t.bCollisionRect))
            {
                // Collision methods
                player.CollisionPlayer(p, t);

                // TileBase collision method not used in this test version
                tileBase.CollisionBlock(t);
            }

            if (!(tileBase.bCollision.Any(c => player.collisionRect.Intersects(c))))
            {
                p.ground = false;
            }
        }
    }
}

I basically need to place the player outside the collision block of the tile (now with testing version only above the tile), but when there are multiple tiles next to each other, then the overlapping rectangle changes because it's a simple variable (see below).

This is my collision method in my PlayerMovement class:

public override void CollisionPlayer(PlayerMovement p, TileSprite t)
{
    rect2 = Rectangle.Intersect(p.collisionRect, t.bCollisionRect);
    p.position.Y = p.position.Y - rect2.Height;
    p.jumping = false;
    p.ground = true;
}

You can see that it's really simple (for now). I make a new rectangle that consists of the intersection of the tile rectangle and the player rectangle and then I subtract the rect2 (new rectangle) height from the player position.

This works fine when the player collides with one tile, but he rapidly jumps up and down one pixel (position - lag, not performance) when he collides with more rectangles at the same time. I think this is because the collision method makes a new rect2 and overwrites the old one because the rect2 is only an overlapping of 2 rectangles. But I do not know how to fix this.

Images:

(NOTE: These images are the lagging behavior of the player when he collides with two tiles at the same time. The right image is how it should be. (it is like this with one tile))

PROBLEM: I think the problem is that only ONE overlapping rectangle is being made because the collision saves the overlapping rectangles all in the same variable (not in a list or an array, so it is overwritten). The problem I have now is that I don't know how to expand the overlapping rectangle to two or more tiles OR how to make multiple overlapping rectangles for this collision method.

sentences:
Renderable object abstraction In my engine I have 2 types of 2D renderables: sprites and groups (and maybe primitives later). Sprites are just textured quads and groups are multiple renderables grouped in a single object. I have this drawcall system now:

struct Renderable
{
    virtual void Render(Renderer& renderer) = 0;
};

struct Sprite : public Renderable
{
    Texture& texture;
    // other sprite specific stuff
    void Render(Renderer& renderer) override { renderer.RenderSprite(...); }
};

struct Group : public Renderable
{
    vector<Renderable*> elements;
    // Other group related stuff like a transformation matrix
    void Render(Renderer& renderer) override
    {
        for (Renderable* r : elements)
            r->Render(renderer);
    }
};

Instead of sendig them straight to the renderer, I need an indirection. This makes rendering many (like 20K) sprites super slow. Is there a better design to avoid indirection (or even abstraction)?

sentences:
How can I render a semi transparent model with OpenGL correctly? I'm using OpenGL ES 2 and I want to render a simple model with some level of transparency. I'm just starting out with shaders, and I wrote a simple diffuse shader for the model without any issues but I don't know how to add transparency to it. I tried to set my fragment shader's output (gl_FragColor) to a non opaque alpha value but the results weren't too great. It sort of works, but it looks like certain model triangles are only rendered based on the camera position... It's really hard to describe what's wrong so please watch this short video I recorded:

http://www.youtube.com/watch?v=s0JqA0rZabE

I thought this was a depth testing issue so I tried playing around with enabling/disabling depth testing and back face culling. Enabling back face culling changes the output slightly but the problem in the video is still there. Enabling/disabling depth testing doesn't seem to do anything.

Could anyone explain what I'm seeing and how I can add some simple transparency to my model with the shader? I'm not looking for advanced order independent transparency implementations.

edit:

Vertex Shader:
// color varying for fragment shader
varying mediump vec3 LightIntensity;
varying highp vec3 VertexInModelSpace;

void main()
{
    //
    vec4 LightPosition = vec4(0.0, 0.0, 0.0, 1.0);
    vec3 LightColor = vec3(1.0, 1.0, 1.0);
    vec3 DiffuseColor = vec3(1.0, 0.25, 0.0);

    // find the vector from the given vertex to the light source
    vec4 vertexInWorldSpace = gl_ModelViewMatrix * vec4(gl_Vertex);
    vec3 normalInWorldSpace = normalize(gl_NormalMatrix * gl_Normal);
    vec3 lightDirn = normalize(vec3(LightPosition-vertexInWorldSpace));

    // save vertexInWorldSpace
    VertexInModelSpace = vec3(gl_Vertex);

    // calculate light intensity
    LightIntensity = LightColor * DiffuseColor * max(dot(lightDirn,normalInWorldSpace),0.0);

    // calculate projected vertex position
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;

}

Fragment Shader:
// varying to define color
varying vec3 LightIntensity;
varying vec3 VertexInModelSpace;

void main()
{
    gl_FragColor = vec4(LightIntensity,0.5);
}

sentences:
Rendering metallic look I would really like to get the same metallic reflection look as in CSR Racing for my game in the simplest way possible. It doesn't have to be top-notch, but right now my rendering looks horrible and is in need of some serious improvement. Metallic reflection rendering seems pretty complex (for instance looking at this), so I need some advice on what to try.

I realize CSR Racing renders using some type of environment mapping. Can I cheat using spherical env maps, or do I need cube maps? (Nonetheless I will use static images, it's too much work to generate on the fly, and I'll keep each level in the same "tone" so I think it will work well enough.) How should I map my UVs for the env map? Or should I use the normals? If so how to tranform 3D-normals to 2D? What texture transformation to use? I tried to use the camera transformation with the same UVs I'd have used for a diffuse texture (and using glEnable(GL_TEXTURE_GEN_S)), and there was some... result, but I think that's on the wrong track?

Do I need to use specular maps, even for a shiny, clean metallic surface? When I look at what specular maps are used for it seems like they hold information of what is matte and what is shiny. Any tips and tricks highly appreciated!

sentences: Where to start creating a 2d rain simulation with OpenGL ES 1.1? I'm using opengl 1.1 and i'm creating a 2d side scrolling game.How can i render a 2d rain simulation?What is logic for that?

sentences:
How to calculate best move in Match-3 game? I am having a hard time identifying how to approach this problem.
If you have a match 3 game and the objects can only be swapped horizontally and vertically, and only swapped if it will result in a match of 3 or more jewels, which will be removed, with each removed jewel adding +1 to the score.
How would I find the best possible move? I'm confused at where to start and been searching for a while now and getting nowhere.

Board  6x6 or 8x8
Matches  = 3 or more of same kind
write function to find best swap for maximum score.

Any help would be greatly appreciated !
EDIT: So I could iterate through the entire board with a nested for loop for the rows and columns, but im not sure what approach to take from here.
For example, say I start with top left which is "red" and I want to test if swapping this will result in a match. How would I go about searching and identifying all possibilities that would result in swapping this left equaling a match and score of 5.
**If I am being really unclear I apologies and will remove my question and possible reword.

sentences:
How can someone make 3D tiles not looking like perfect cubes? Here are the graphics an artist did for me:

While the texture is nice when seen as image file, I think the tile is somewhat flat.

The problem is:

If he bevel the cube, then there will be tiling problems (not to mention seams between cubes). How can he make tile looks less flat?

If he make the 3D model to act like 2D isometric Tiles (which have very irregular outline) there will be so much polygons that will be a nightmare for him to model dozen of Tiles.

Of course keep in mind that for occluding reasons (each cube project 6 planes that are used to occlude hidden geometry) the overall shape should be actually bigger than a cube volume, but not smaller (anyway I can loose the height requirement, cubes can be made of any height).

sentences:
How do you account for zoom in a top down viewport? I've been stumped on this for days so please forgive me if this question is in bad-form. I have a generic top-down RPG structure, and I want to create a zoomable Canvas viewport for it. I've read several tutorials and I guess I keep messing it up somewhere.

Current Codepen project here.

Relevant code from the project:

Camera:

function Camera(PARENT, CANVAS, SUBJECT, ZOOM)
{
  this.draw = function()
  {
    var refs = [];

    Rect.call(this, SUBJECT.x, SUBJECT.y, CANVAS.width*ZOOM, CANVAS.height*ZOOM, "cen");

    for(o in PARENT.objects)
    {
      if(this.overlapping(PARENT.objects[o]))
        refs.push(o);
    }

    while(refs.length>=1)
    {
      var obj = PARENT.objects[refs.shift()];

      if(obj.draw)
        obj.draw(
          this.context, //Drawing ctx
          this.left, //Offset left
          this.top, //Offset top
          ZOOM //Scale factor
        );
    }
  };
}

Drawing function called by the Camera:

this.draw = function(context, offsetX, offsetY, scale)
{
  context.fillStyle = this.color;
  context.fillRect((this.left-offsetX)*scale, (this.top-offsetY)*scale, this.width*scale, this.height*scale);
};

How can I resolve the math here so that the zoom is correctly figured in to the drawing offsets?

sentences:
Unity: why game app on Android takes up much more memory than Unity Profiler reports? We are profiling a game app on Android 4.4.2 device via Unity’s ADB profiling.

We have set up ADB profiling following the official guide: http://docs.unity3d.com/Manual/Profiler.html

The ADB profiling works fine, when the app is running, Unity Profiler reports its memory usage as following:

Used Total: 100.4 MB  Unity: 40.5 MB  Mono: 10.1 MB  GfxDriver: 34.9 MB  FMOD: 3.9 MB  Profiler: 14.8 MB
Reserved Total: 112.8MB  Unity: 47.0 MB  Mono: 15.4 MB  GfxDriver: 34.9 MB  Profiler: 15.5 MB

Meanwhile, we are also running another performance test tool (i.e. Emmagee, https://github.com/NetEase/Emmagee) to monitor the app, which can monitor CPU, memory, network traffic, battery current and etc. However, the memory usage of the app reported by Emmagee tool is much larger:

As shown above, Unity Profiler reported 112.8M memory is totally reserved for running the app, but Emmagee tool reported >200M PSS memory is used. Obviously, more than 90M memory taking up is happened somewhere by something that Unity Profiler does not take into account.

(We also tried other performance monitoring tool for Android apps, e.g. APT, and the result is similar to what Emmagee reported. The extra memory usage problem remains.)

We noticed that the Unity Profiler itself would take up ~15M memory, which is included in the profiler’s report. Also, we knew that PSS memory includes proportional shared libraries with other processes, but 90M+ extra is such large amount considering that Unity Profiler only reported 112.8M totally.

Our puzzle remained: Where does the 90M+ memory come from? How are they used by the app? Why Unity Profiler does not report the extra memory? What can we do for reducing the extra memory and the total PSS memory of the running app, and/or get it close to what Unity Profiler reports?

Any help could be appreciated!

sentences:
Texture Mapping to procedurally generated geometry How can I calculate texture coordinates of such geometry?

The angle shown in the image (89.90 degree) may vary, therefore the geometry figure is changing and is not always such uniform.(maybe like geometry in the bottom of image) and red dots are generated procedurally depends on degree of smoothness given.

sentences: 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: G-rated word lists in various languages for programming children's games I'm programming a word guessing game that uses large lists of words (no definitions, just words). Word length is configurable. Parents could set the word length to be very short and let small children play the game. I'd like to make sure there are no obviously obscene words in the list. For American English, the closest I've found was a Scrabble-like dictionary file that uniformly labelled questionable words with "obscene" so I can easily filter them out. Does anyone know of a better list in English, and/or any lists in other languages?

sentences:
Implementing Seperating Axis Theorem I'm trying to implement the Seperating Axis Theorem by following this article I found on MDN.
Unfortunately, I'm not too geometry savvy and I wasn't able to find any good, simple implementation examples around the internet. I've tried to search for the specific concepts that the article mentions, but I'm not sure that I'm on the right track and I've got several doubts about this.
Here's what I did so far:
export class Point {

    constructor(x, y) {

        this.x = x;
        this.y = y;
    }

    rotate(pivot, angle) {

        let s = Math.sin(angle);
        let c = Math.cos(angle);

        let p = new Point(this.x - pivot.x, this.y - pivot.y);

        return new Point((p.x * c - p.y * s) + pivot.x, (p.x * s + p.y * c) + pivot.y);
    }

    compare(point) {

        // todo
    }
}

import { Point } from "./Point.js";

export class Line {

    constructor(p1, p2) {

        this.p1 = p1;
        this.p2 = p2;
    }

    getSlope() {

        return (this.p2.y - this.p1.y) / (this.p2.x - this.p1.x);
    }

    getNormal() {

        let dx = this.p2.x - this.p1.x;
        let dy = this.p2.y - this.p1.y;

        return new Line(new Point(-dy, dx), new Point(dy, -dx));
    }

    getYIntercept() {

        return this.p1.y - this.getSlope() * this.p1.x;
    }

    getPointProjection(point) {

        let slope = this.getSlope();
        let yIntercept = this.getYIntercept();

        let slope2 = -1 / slope;
        let yIntercept2 = point.y - slope2 * point.x;

        let nx = (yIntercept2 - yIntercept) / (slope - slope2);

        return new Point(nx, (slope2 * nx) + yIntercept);
    }
}

import { Point } from "./Point.js";
import { Line } from "./Line.js";

export class Polygon {

    constructor(...points) {

        this.points = points;
    }

    overlaps(polygon) {

        let side = new Line(this.points[0], this.points[1]);

        let axis = side.getNormal();

        function findMinAndMaxProjectedPoints(polygon) {

            polygon.points.forEach(point => {

                let projection = axis.getPointProjection(point);

            });
        }

    }
}

Did I implement the various formulas correctly?
How should I "keep track of the highest and lowest values" for each polygon? How am I supposed to determine which projected points are the lowest and which are the highest?
How do I check for gaps between the highest and lowest projected point of the two polygons?

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:
Swap buttons in layout Say I have 4 buttons. I want to have button 2 always swap out with another button, randomly.
So, when the user taps button 2, it should swap with another button (randomly).

Now, button 2 is at the bottom right corner. So if the user taps button 2 again, it has the option to
swap with the other three buttons. How can I achieve this?

I have already tried to make an array of the four values:

top_right, top_left, bottom_right, bottom_left

And have successfully had them swap, but it was very memory inefficient, and took a while.

sentences: In a 2D game with an isometric camera (like Bastion) do I need to create a new animation for every angle the player is facing? For different actions like jumping, attacking, moving etc,  do I need to make new animations for every angle I am doing the action? Or is there a way to somehow run around that requirement?

sentences:
What is "simulated human operator" cutscene camera movement called? I have some questions related to the non-smooth camera movement in cutscenes of quite a few games which appears to try and simulate the nervousness of a human operator holding it. This is opposed to camera shake in general gameplay when some event takes place, i.e. explosions, though they do also occur in the cutscenes I'm talking about.

Examples of this effect are in many games, but the best example I have seen of what I am trying to describe is the opening cutscene (and many cutscenes) of Metal Gear Solid V: Ground Zeroes. Be sure to choose 60 FPS to make the effect clearer.

Is there a name for this "simulated human operator" effect, and do you know how this may have been achieved?

My guess would be that the camera is being offset in both axes by some kind of random deviation function, which is always slightly elastically moving towards the origin to stop it wandering off wildly. Perhaps Brownian motion?

sentences: What is the default audio bitrate in Unreal 4? Maybe I'm just googling the wrong thing but what's Unreal's default audio sample rate? 44.1kHz or 48kHz? Silly simple question but thanks for helping out!

sentences:
Is it possible to create a Facebook game that is a Windows executable? I'm thinking of trying to make a game, and I heard Facebook is good place to make it popular, but I don't want to make a sprite-based Flash game, I want to use OpenGL for rendering to get nice graphics and good performance with it.

I know there is Java which supports OpenGL (I think), but I would like to make my game closed-source so that people cannot make their own mods for it like what happened with Minecraft.

Another option I thought was to make OpenGL executable and a Flash version, but I think it might be too much work for one guy. Not to mention I have never done anything in Flash.

So, is there any way to develop closed-source game that can be also played through a browser? By closed-source I mean the people have no way of getting the source code by decompiling it in any way.

sentences:
Touch drawing in the dirt Which approach should I take for creating a game/app where the player, looking above the ground "canvas", would be able to "move" dirt (i.e. soil, or generally powder) around using fingers? I.e. similar to what you would achieve if you placed some dirt on a A4 white paper, and then move it around using palms/fingers?

I first thought it would be something similar to how painting apps work, but they more or less use a texture brush, and this doesn't seem to give me the desired effects. The ultimate experience would probably be to do it using a full-fledged physics particle system, but I am not sure a midrange device (Android, iOS) is capable of rendering something like that with satisfying detail in realtime? Admittedly, I am not trying to do what's shown in the video, but at least something that wouldn't look like moving "puzzles" around.

All other materials related to these search terms are merely using particles to simulate dirt flying around vehicle tires, so I am slightly stucked and I feel a nudge in the right direction might do wonders. Any algorithm/technology hints?

sentences:
GLSL to Cg fragment shader I have found very useful resource on the Swiftless website on OpenGL.

Unfortunately, I cannot manage to adapt a GLSL fragment shader to my project, which uses Cg. Here it is:

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

I have tried something:

struct fsOutput {
    vec4 color : COLOR;
};

uniform sampler2D detailTexture : TEXUNIT0;
uniform sampler2D bumpTexture : TEXUNIT1;

fsOutput FS_Main(float2 detailCoords : TEXCOORD0,
            float2 bumpCoords: TEXCOORD1)
{

    fsOutput fragm;

    float4 anorm = tex2D(bumpTexture, bumpCoords);
    vec3 normal = normalize(anorm.rgb * 2.0f - 1.0f);
    vec3 light_pos = normalize(vec3(1.0f, 1.0f, 1.5f));
    float diffuse = max(dot(normal, light_pos), 0.0);
    vec3 color = diffuse * texture2D(detailTexture, detailCoords).rgb;
    fragm.color = vec4(color, 1.0f);
    return fragm;
}

But it doesn't work. To debug, I have a function that catches Cg errors, and my program breaks at this point. I have identified the two texture IDs in the main program.
Can you suggest any improvement for this Cg shader?

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:
How can I draw a model with a color on WP7? How can I draw a model with a color (and still be aware of the lighting)?

This is really straight forward when you can use shaders, but on Windows Phone you can't.

sentences:
Why does my HTML5 game loop (with masking) run slowly? I have a game loop like so:

setInterval(function()
{
    context.save();
    context.rect(26, 144, 745, 400);
    context.clip();
    context.drawImage(myImage, 100, 100, 900, 900);
    context.restore();
}, 40);

As it runs the canvas gradually slows down to a stop. If I put the drawImage outside of the clipping then it runs indefinitely at the correct speed. Is there something I'm doing wrong?

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

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

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

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

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

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

    spriteInx = run_anim.length;

    currentImage = sprite_idle;

Here is my key event:

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

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

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

I add my images in the constructor of the player

And here you get the code for my startRun method.

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

}

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

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

If you need anything further, just tell me.

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

sentences:
Is there anyway to disable the script "gameplay" from running once you start the simulation? Was following the tutorial in this video https://oxmond.com/how-to-make-multiple-copies-of-a-gameobject/ on how to duplicate object.
I want to modify my code I learned from this tutorial https://www.youtube.com/watch?v=OR0e-1UBEOU&t=4178s so that the bird will increase its size proportion to the distance travel and when scale>certain value, it break into 2 identical bird object that possess the same properties as the first one. I already did the part size increase in proportion to the distance travel. Now I create an empty game object and attach the script "explode" together with prefab of the bird object to it but how to write the proper code to carry out the function if the main bird object is destroyed then it run the code "explode" to duplicate bird?
   using UnityEngine;
   using UnityEngine.Assertions.Must;
   using UnityEngine.SceneManagement;

   public class Bird : MonoBehaviour

{Vector3 OldPosition;
Vector3 DistanceDifference;
float TotalDistance = 0;
Vector3 _initialPosition;
private bool _birdWasLaunched;
[SerializeField] private float _launchPower = 500;

void start()
{
    OldPosition = transform.position;

}

private void Awake()
{
    _initialPosition = transform.position;

}

    void Update()
    {

    if (_birdWasLaunched &&
             GetComponent<Rigidbody2D>().velocity.magnitude > 0.1)
    {
        DistanceDifference = transform.position - OldPosition;
        TotalDistance += DistanceDifference.magnitude;
        OldPosition = transform.position;
        transform.localScale = new Vector3(0.2f * Mathf.Abs((TotalDistance * 0.2f)), 0.2f *Mathf.Abs(TotalDistance * 0.2f) , TotalDistance*0.5f);

    }

    if (transform.position.y > 20.00 ||
        transform.position.y < -20.00 || transform.position.x > 23 || transform.position.x < -23)
    {
        string currentSceneName = SceneManager.GetActiveScene().name;
        SceneManager.LoadScene(currentSceneName);

    }
    }

void OnMouseDown()
{
    GetComponent<SpriteRenderer>().color = Color.red;

}

private void OnMouseUp()
{
    GetComponent<SpriteRenderer>().color = Color.white;
    Vector2 directionToInitialPosition = _initialPosition - transform.position;
    GetComponent<Rigidbody2D>().AddForce(directionToInitialPosition * _launchPower);
    GetComponent<Rigidbody2D>().gravityScale = 1;
    _birdWasLaunched = true;

}

private void OnMouseDrag()
{
    Vector3 newPosition =    Camera.main.ScreenToWorldPoint(Input.mousePosition);
    transform.position = new Vector3(newPosition.x, newPosition.y);

This the 2nd script to duplicate the bird but i'm not sure what the correct codes I have to put in if the 1st game object destroy, then it duplicate 2 bird?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Explode : MonoBehaviour
{
 public GameObject Bird;

// Update is called once per frame
void Update()
{
    (if Destroy(Bird))
    GameObject BirdClone = Instantiate(Bird);
}
}

sentences:
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:
Unet, client is unable to control spawned units I am trying to create a simple table top game with Unet. Right now I am just trying to get simple spawn mechanics working. The issue I am having is that the host computer can spawn and control objects correctly. The object gets instantiated, it gets added as a child to the armylist gameObject correctly. The client is able to see the object move around. Etc. Everything is working correctly it appears from the host side.

The client however, can only instantiate a game object then they lose all reference to it. Also when it gets instantiated it does not become a child of the correct object, it is just its own object in the scene without a parent. The host computer can see the object be spawned.

I am not sure what I am doing wrong, I have tried reading the documentation but to no avail. Any help would be greatly appreciated.

public class PlayerManager : NetworkBehaviour {

[SerializeField]
GameObject tank;
[SerializeField]
Camera PlayerCamera;

[SerializeField]
GameObject[] ArmyList = new GameObject[50];

private Vector3 placePos;
GameObject currentUnit;

void Start () {

}

void Update () {
    if (Input.GetKeyDown (KeyCode.A)) {
        Cmd_place_initial_units ();
    }
    Rpc_PlaceUnit ();
}

[Command]
void Cmd_place_initial_units(){
    currentUnit = Instantiate(tank, placePos, Quaternion.identity) as GameObject;
    currentUnit.transform.parent = transform.GetChild(0);
    ArmyList [0] = transform.GetChild (0).GetChild (0).gameObject;
    NetworkServer.SpawnWithClientAuthority (currentUnit, connectionToClient);
}

void Rpc_PlaceUnit(){
    if (ArmyList[0] != null) {
        RaycastHit hit;
        if (Physics.Raycast (PlayerCamera.ScreenPointToRay (Input.mousePosition), out hit)) {
            if (ArmyList[0].tag == "ground") {
                placePos = new Vector3 (hit.point.x, 1f, hit.point.z);
            } else {
                placePos = new Vector3 (hit.point.x, 1.2f, hit.point.z);
            }
            ArmyList[0] .transform.position = placePos;
        }
    }
}
}

sentences:
Triangles in a C++ STL Vector as an Objective-C member sometimes draws incorrectly in OpenGL ES The polygons draw correctly 80% of the time. When it fails, a vertex is dislocated. The polygon is consistently drawn with the wrong vertex. I checked that the vector is correct during initialization, even when it's wrongly drawn.

I'm using Cocos2d.

The class member:

@interface Polygon : CCSprite {
  std::vector<float> triangleVertices;
}

The draw function called in [Polygon draw]:

+ (void)drawTrianglesWithVertices:(const std::vector<float> &)v
{
    //glEnableClientState(GL_VERTEX_ARRAY);
    glDisable(GL_TEXTURE_2D);
    glDisableClientState(GL_TEXTURE_COORD_ARRAY);
    glDisableClientState(GL_COLOR_ARRAY);

    glVertexPointer(2, GL_FLOAT, 0, &v[0]);
    glDrawArrays(GL_TRIANGLES, 0, v.size());

    //glDisableClientState(GL_VERTEX_ARRAY);
    glEnableClientState(GL_COLOR_ARRAY);
    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    glEnable(GL_TEXTURE_2D);
}

Any ideas?

sentences:
How do I cover a plane in a bumpy foam material effect? I need to fill a weapon bag with foam material.

This is what it should look lik:

The material in the upper part of the bag looks like this:

I'm using HDRP.

How could I do this?

Thank you!

Edit: I have played around with Parallax Occlusion mapping, and I got this result.

Edit2: I am not sure if I use the Pixel Displacement as it has been suggested to me.

Also, I'm not sure if I use it the correct way:

I have created a Height map and put it into the Height map slot.
This doesn't create any effect.
I have to put the same map into the Base map slot in order to see the effect.
If I put a black image into the Base map slot or if I choose Black as the Base color, no effect is visible.

I don't understand why this is so. I think even if my Base map is black, the Shader has pixels that it can move.

This is my height map:

Edit 3: It was suggested that I should use a normal map. This doesn't look at all what I expected. The normal map was created from the Height map using an online tool:

By Philipp's answer I found out that the normal map alone is not enough.

sentences:
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:
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:
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:
How/whether to pool bullets for a shmup in Unity? I'm working on my first Unity project, which (maybe naively) I decided to make a shmup.

I've been doing a lot of reading about Unity, and about object pools, and about using components to control behaviors of game objects.

Right now my idea for how a bullet works is that each bullet should be a game object, with a component that controls how it moves, and another component that controls what happens when it collides with something it can damage. Depending on the enemy or player shooting the bullet, however, the way it moves or how it deals with collisions may be entirely different, which means that a bullet from enemy A may need one component to control motion, but a bullet from enemy B may need a different type of component. (And the same for damage-dealing.)

If I want to pool bullets, since a shmup tends to need a lot of bullets all the time, I'm not sure how to handle "resetting" the bullets when I'm done with them and grab them out of the pool to use the next time.

So my question is, what is the ideal way to design a bullet system for a shmup in Unity, from the point of view of an expert in Unity instead of my beginner perspective? Am I going about using components wrong? Should I have a completely different pool for each possible type of bullet (which may not be feasible since I want a good amount of variety in the game)? Should I just have one monolithic motion control component that has a ton of code and can control every imaginable type of motion a bullet could ever need (I hope not)? Should I just forget about pooling and use Instantiate and Destroy? Is there a good way to reset what components are attached to a GameObject to the state of its prefab when I'm done with it?

I'm afraid my beginner-ness to this ecosystem makes it hard to even know what the right question is.

sentences:
XNA texture overlay with offset Is it possible to overlay one texture over another and make them into a new texture? It should also work with an offset.

Here's an example:

This texture

and this texture

should make this texture

It should be possible to change the position of one texture.

sentences:
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:
In game engine, how to get the vertices buffers of different vertex formats for render from the mesh file properly? I'm a fresher on engine programming. I have a question of how we can get the vertices buffers of vertex formats from the mesh file.

For example, in OBJ file or FBX file, we save the positions, normals separately. So the whole mesh file is a structure of different arrays which contain the different attribute of the vertices.

But when we offer those data to the graphics card, we'll offer an array of vertex structs, here the vertex struct contains the position, normal, UV... for one vertex.

So, suppose we want to generate different vertex buffers for different shaders from the mesh file(the struct of arrays), then I think we can use 2 solutions:

generate a different array of structs, here the different struct will be the different formats of vertices.
The problem is: It takes a lot of memory to save the different vertex buffers.
generate a general array of struct, here the struct contains all of the vertex attributes we can get from the mesh file, and use offset to get the correct data for different vertex format.
The  problem is: will it be slow for shader program to access the vertex data?

Which one is the better way to do? Or is there any better solution?
Again, I'm just a fresher, So I hope my description is clear enough for the problem :-)

Thank you all very much!

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

sentences:
What data structure to use to implement ocean currents and trade-winds I'm creating an RPG/simulation game which is similar to the Uncharted Waters Series. The game allows the player to control a fleet to explore and navigate the world on the world map. My Game stores the world map as a tiled map into a 2158 * 1080 2D array.

The problem I'm facing is I want to simulate the ocean currents and trade winds on the world map so when the player is sailing on the map, the speed of the fleet will be affected by the current and the wind. It does not have to be a really accurate simulation because this is not a high-detailed simulation game but it should resonably simulate the ocean currents and the wind.

Requirements:

Need to come up with a data structre to represent the ocean currents
For each point (x,y) on the map, the data structure should provide a fast way to look up what is the strengh and direction of the current at that particular point
The current can have 8 directions (N W S E NW NE SW SE).
The strengh of the current is represented as an Int
Same requirements for trade wind so I think the solution should be the same

My thoughts:

I'm thinking about dividing the world into several regions and each region can be subdivided into smaller regions like a quad tree. For look up I can do a contains(x,y) and find out which region the point is in and then for sub-regions to the same thing until it arrives a leave of the tree which stores the strengh and direction of the current.

Is that a reasonable solution or there are better ways to do this? What are the gotchas for implementing it?

Thank you for you answers!

sentences:
How to receive a Knock Back when the player touched the enemy I'm still new to C#, making my 2D game atm and my problem is how can I give my player a Knock Back when it touches the enemy. How to add it with this code?

public int health;

private void OnCollisionEnter2D(Collision2D collision)
{
    if (collision.gameObject.CompareTag("Enemy"))
    {
        health -= 20;
        //Check for death
        if (health <= 0)
        {
            gameObject.SetActive(false);
        }
    }
}

sentences:
Create Bezier curves with random heights that connect In unity, I am trying to create several curved platforms that connect using bezier curves, however I am having issues. I understand the basics of genertating a bezier curve and I have something working well

My goal is to generate a series of forward moving Bezier curves, that are all connected to each other, while also having varying lengths and points. I have something working, however I am having issues connecting the curves, while retaining random Y values for different heights in the 4 points.

Below is my attempt:

Below is a Sketch I did in MS Paint to help explain goal:

From the sketch you can see that there is a diffrence in height between gameobject 0 and 1 but they are still connected. How can I generate the next points with random Y values, while still accounting for the previous curve? Any help would be greatly appreciated,

Thank you for your time.

sentences:
What constitutes satire? For business reasons, I would like to know what constitutes satire in a game.

Also, is there a better place to ask questions like this on the business side of game development?

sentences:
Problem with stencil in directx 12 I'm trying to use stencil buffer in directx 12. I have problem that probably is really easy to solve.
So, it's look like dx12 ignore it, ClearDepthStencilView() affect only depth, writing to stencil doesn't work.

D3D12_DEPTH_STENCIL_DESC for PSO:

static D3D12_DEPTH_STENCIL_DESC const defaultDepthStencil =
{
    /*DepthEnable*/                         TRUE
    /*DepthWriteMask*/                      ,D3D12_DEPTH_WRITE_MASK_ALL
    /*DepthFunc*/                           ,D3D12_COMPARISON_FUNC_LESS
    /*StencilEnable*/                       ,TRUE
    /*StencilReadMask*/                     ,D3D12_DEFAULT_STENCIL_READ_MASK
    /*StencilWriteMask*/                    ,D3D12_DEFAULT_STENCIL_WRITE_MASK
    /*FrontFace.StencilFailOp*/             ,{ D3D12_STENCIL_OP_REPLACE
    /*FrontFace.StencilDepthFailOp*/        ,D3D12_STENCIL_OP_REPLACE
    /*FrontFace.StencilPassOp*/             ,D3D12_STENCIL_OP_REPLACE
    /*FrontFace.StencilFunc*/               ,D3D12_COMPARISON_FUNC_ALWAYS }
    /*BackFace.StencilFailOp*/              ,{ D3D12_STENCIL_OP_REPLACE
    /*BackFace.StencilDepthFailOp*/         ,D3D12_STENCIL_OP_REPLACE
    /*BackFace.StencilPassOp*/              ,D3D12_STENCIL_OP_REPLACE
    /*BackFace.StencilFunc*/                ,D3D12_COMPARISON_FUNC_ALWAYS }
};

DSV heap desc:

D3D12_DESCRIPTOR_HEAP_DESC dsvHeapDesc = {};
    dsvHeapDesc.NumDescriptors = 1;
    dsvHeapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_DSV;
    dsvHeapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE;

DSV desc:

D3D12_DEPTH_STENCIL_VIEW_DESC depthStencilDesc = {};
    depthStencilDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
    depthStencilDesc.ViewDimension = D3D12_DSV_DIMENSION_TEXTURE2D;
    depthStencilDesc.Flags = D3D12_DSV_FLAG_NONE;

Resource desc:

m_gBuffer[GB_Depth].Dimension( D3D12_RESOURCE_DIMENSION_TEXTURE2D );
m_gBuffer[GB_Depth].Width( m_width );
m_gBuffer[GB_Depth].Height( m_height );
m_gBuffer[GB_Depth].DepthOrArraySize( 1 );
m_gBuffer[GB_Depth].MipLevels( 1 );
m_gBuffer[GB_Depth].Format( DXGI_FORMAT_R24G8_TYPELESS );
m_gBuffer[GB_Depth].SampleCount( 1 );
m_gBuffer[GB_Depth].Layout( D3D12_TEXTURE_LAYOUT_UNKNOWN );
m_gBuffer[GB_Depth].Flags( D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL );

Then OMSetRenderTargets() and ClearDepthStencilView() with flags D3D12_CLEAR_FLAG_DEPTH, D3D12_CLEAR_FLAG_STENCIL.

Any idea what's missing?

sentences: which is more performant particles_system or animation_player let's say I wanna make an Aura+Thunder effect , I can achieve the result using the Particles System like this vid: https://www.youtube.com/watch?v=4eMZspcU5Is , or by using AnimationPlayer , but which is more performant if there will be like 15 instance of the Aura+Thunder effect + other effects?

sentences:
Using python as a controller in Blender Game Engine I'm trying to learn how to use BGE, and one of the things I'd like to do is programatically move the cube using a python script. I added a controller but no luck. See screenshot. I'm trying to run the python script at the top of the page, all it's supposed to do is move the cube a little. It works if I click "Run Script" but I want it to happen automatically when BGE is running. What am I missing?

http://i.imgur.com/7KsoiAd.png

sentences:
Handling scripted and "native" components in a component-based entity system I'm currently trying to implement a component-based entity system, where an entity is basically just an ID and some helper methods tying a bunch of components together to form a game object. Some goals of that include:

Components only contain state (e.g. position, health, ammo count) => logic goes into "systems", which process these components and their state (e.g. PhysicsSystem, RenderSystem, etc.)
I want to implement components and systems both in pure C# and through scripting (Lua). Basically I want to be able to define completely new components and systems directly in Lua without having to recompile my C# source.

Now I'm looking for ideas on how to handle this efficiently und consistently, so I don't need to use different syntax to access C# components or Lua components, for example.

My current approach would be to implement C# components using regular, public properties, probably decorated with some attributes telling the editor about default values and stuff. Then I'd have a C# class "ScriptComponent", which just wraps a Lua table internally with this table being created by a script and holding all the state of that particular component type. I don't really want to access that state much from the C# side, as I wouldn't know at compile time, what ScriptComponents with what properties would be available to me. Still, the editor will need to access that, but a simple interface like the following should suffice:

public ScriptComponent : IComponent
{
    public T GetProperty<T>(string propertyName) {..}
    public void SetProperty<T>(string propertyName, T value) {..}
}

This would simply access the Lua table and set and retrieve those properties from Lua and it could easily be included in the pure C# components as well (but use the regular C# properties then, through reflection or something). This would only be used in the editor, not by regular game code, so performance isn't as important here. It would make it necessary to generate or handwrite some component descriptions documenting what properties a certain component type actually offers, but that wouldn't be a huge issue and could be sufficiently automated.

However, how to access components from the Lua side? If I make a call to something like getComponentsFromEntity(ENTITY_ID) I'll probably just get a bunch of native C# components, including "ScriptComponent", as userdata. Accessing the values from the wrapped Lua table would result in me calling the GetProperty<T>(..) method instead of accessing the properties directly, like with the other C# components.

Maybe write a special getComponentsFromEntity() method only to be called from Lua, which returns all the native C# components as userdata, except for "ScriptComponent", where it'll return the wrapped table instead. But there'll be other component-related methods and I don't really want to duplicate all these methods both for being called from C# code or from Lua script.

The ultimate goal would be to handle all types of components the same, with no special case syntax differentiating between native components and Lua components - especially from the Lua side. E.g. I'd like to be able to write a Lua script like that:

entity = getEntity(1);
nativeComponent = getComponent(entity, "SomeNativeComponent")
scriptComponent = getComponent(entity, "SomeScriptComponent")

nativeComponent.NativeProperty = 5
scriptComponent.ScriptedProperty = 3

The script shouldn't care what kind of component it actually got and I'd like to use the same methods I'd use from the C# side to retrieve, add or remove components.

Maybe there are some sample implementations of integrating scripting with entity systems like that?

sentences:
The second double jump animation doesn't finish before the player touches the ground I have an issue with double jump for the player my code is working but I want the second double jump animation finish(idle Animation: anim.SetBool("Jump", false)] before he touches the ground can anyone help me on that here is my code :

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

public class PlayerMovement : MonoBehaviour
{
    private Animator anim;
    private float speed = 5f;
    private Rigidbody2D myBody;
    public Transform groundCheckPosition;
    public LayerMask groundLayer;
    private bool isGrounded;
    private bool jumped;
    private float jumpPower = 5f;
    private bool doubleJump;
    void Start()
    {
        myBody = GetComponent<Rigidbody2D>();
        anim = GetComponent<Animator>();
        isGrounded = false;
        jumped = false;
        doubleJump = false;
    }
    // Update is called once per frame
    void Update()
    {
        PlayerJump();
    }
    private void FixedUpdate()
    {
        CheckIfGrounded();
        PlayerWalk();
    }
    void PlayerWalk()
    {
        float h = Input.GetAxisRaw("Horizontal");
        if (h > 0)
        {
            anim.SetInteger("Speed", (int)speed);
            ChangeDirection(1);
        }
        else if (h < 0)
        {

            anim.SetInteger("Speed", (int)speed);
            ChangeDirection(-1);
        }
        else
        {
            anim.SetInteger("Speed", 0);
        }
        myBody.velocity = new Vector2(h * speed, myBody.velocity.y);
    }
    void ChangeDirection(int direction)
    {
        var temp = transform.localScale;
        temp.x = direction * (0.8f);
        transform.localScale = temp;

    }
    void CheckIfGrounded()
    {
        if (!Physics2D.Raycast(groundCheckPosition.transform.position, Vector2.down, 0.1f, groundLayer))
        {
            isGrounded = false;
        }
        else
        {
            isGrounded = true;
            doubleJump = false;
        }
        if (isGrounded)
        {
            jumped = false;
            anim.SetBool("Jump", false);
        }
    }
    void PlayerJump()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            if ((isGrounded && !jumped) || (!doubleJump && !isGrounded))
            {
                jumped = true;
                doubleJump = true;
                myBody.velocity = new Vector2(myBody.velocity.x, jumpPower);
                anim.SetBool("Jump", true);
            }
        }
    }

}//class

Edit

I have changed the code from that :

void Update()
    {
        PlayerJump();
    }
    private void FixedUpdate()
    {
        CheckIfGrounded();
        PlayerWalk();
    }

to that :

void Update()
{

}
private void FixedUpdate()
{
    CheckIfGrounded();
    PlayerJump();
    PlayerWalk();
}

I have changed it because FixedUpdate, we use it only for physics because it's not called every frame, unlike update function.

the problem is that the double jump doesn't work in this case can you explain me why?

sentences: Get SFML to report the version of OpenGL that is being used How can I get SFML to report the version of OpenGL that is being used by the render window?

sentences:
Efficient way to output/display debugging data in a window I'm writing a program in Visual Studio, C++ with OpenGL and for the first time, I think it will be beneficial to see some live data on top of my display/render window.

To give some scope, I'm developing a 3D world with a ball bouncing and it would be nice to see things like the current velocity and y-positions of various objects, amongst other things.

What method is a nice/effective way to display this type of information to a window?
Is there any libraries, vs settings or third-party implementations that can be useful? (please excuse my naivety, I'm used to just cout << some info, on a console).

sentences:
Unity c#: How to slow down rotation over time? I am making a space combat game, in which the player can press q and e to roll their ship. I did this by adding torque to the rigid body when the player press q or e. However, after they do so, they keep on rotating. How do i make the angular velocity slowly go back to zero?

I tried using angular drag, but that does not work.

public float TurnSpeed;

public Rigidbody rb;

float currentturn;

Vector3 turn;

float turnEnabler;

bool iszero;

public float dampener;

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

    rb.AddTorque(new Vector3(0, 0, turnEnabler));

    if (Input.GetKey("e"))
    {
        turnEnabler -= TurnSpeed;
    }

    if (Input.GetKey("q"))
    {
        turnEnabler += TurnSpeed;
    }

    rb.angularDrag = dampener;

}

}

sentences:
Start iTween MoveTo from a specific node? (Unity) I just started using iTween as part of my day/night cycle. I'm trying to move the sun and moon along a curve, but I want have the sun/moon start at a specific location depending on the time of day. That would mean beginning the MoveTo() function from, say, the 3rd node instead of the 1st node, but I can't figure out how to access specific nodes.

If that's not possible, is there some other workaround? I thought of making several paths of two nodes each and calling the next path once the first one finishes, but then the object has to move in a series of straight lines.

sentences:
Floodfill algorithm for GO The floodfill algorithm is used in the bucket tool in MS paint and photoshop, but it can also be used for GO and minesweeper.

http://en.wikipedia.org/wiki/Flood_fill

In go you can capture groups of stones, this website portrays it with two stones.
http://www.connectedglobe.com/mindy/cap6.html

This is my floodfill method in Java, it is not capturing a group of stones and I have no idea why because to me it makes sense.

public void floodfill(int turn, int col, int row){
    for(int a = col; a<19; a++){
        for(int b = row; b<19; b++){
            if(turn == black){
                if(stones[col][row] == white){
                    stones[col][row] = 0;
                    floodfill(black, col-1, row);
                    floodfill(black, col+1, row);
                    floodfill(black, col, row-1);
                    floodfill(black, col, row+1);
                }
            }
        }
    }
}

It searches up, down, left, right for all the stones on the board. If the stones are white it captures them by making them 0, which represents empty.

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:
Is component-based design an architectural pattern or design pattern? When using the component-based paradigm in game development with engines like Unity, is component-based design an architectural pattern, or a design pattern?

Can I even say that component-based design is my "main" architectural pattern for my game?

I see architectural patterns as being more high-level than design pattern. The component-based design in game development's context (like with Unity engine) seems to fit as an architectural pattern to me. However, on some sites, I read that component-based design is a behavioural pattern, much like other behavioural design patterns, and not so much like an architectural pattern like MVC.

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

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

What are the steps I need to follow?

sentences:
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 do I seperate my game and game engine into seprate projects? I am trying to separate my game from the game engine, both written in Java. Currently, they are in two separate packages, but I would like to separate them into different projects.

A main method in "Project B" starts a game loop in "Project A". This loop needs to call back to methods in "Project B". What is the best method to achieve this, without "Project A" being aware of the specific implementation of "Project B"?

"Project A" (Engine - Library):

public class Engine {

    public static void start() {
        init();
        // Call Game.getInstance().init() from Project B.

        while (true) {
            input();
            // Call Game.getInstance().input() from Project B.

            update();
            // Call Game.getInstance().update() from Project B.

            render();
            // Call Game.getInstance().render() from Project B.
        }

        cleanUp();
    }

}

"Project B" (Game - Executable)

public class Main {

    public static void main(String[] args) {
        Engine.start();
    }

}

public class Game {

    private static Game instance = new Game();

    private Game() {}

    public static Game getInstance()
        return instance;

    public void init()
        // Do Stuff

    public void input()
        // Do Stuff

    public void update()
        // Do Stuff

    public void render()
        // Do Stuff

}

sentences:
Touchscreen controls for a game I made a pc game recently (uni project) and now I want to put it on google market but I am having troubles changing original controls to touchscreen. The problem is that I don't really know what I can use for controls (tap, double tap, etc.) so the app is really easy to use. I will be incredibly grateful if you could share ideas for what types of controls can be used for my game.

The player controls a shield, which moves around the inner circle (originally the object follows mouse cursor). The player can also shoot with the shield to destroy obstacles, so the bullet is created inside the shield and then travels in the direction the shield was facing (the bullet is created on mouse click).

In the mobile version, the player controls the shield with his finger. It creates two problems: the player is not able to see some of the obstacles because his hand covers some parts of the screen. Also, it means I cannot use simple tap (or at least I don't know how) for shooting, which makes the controls unintuitive.
To shoot the player has to touch the screen with two fingers. It is not a common gesture, so people won't think of using it straight away unless told what to do. And the main point of my game is that there are no words at all and people are expected to understand controls without any tutorials.
Also, the game relies on quick reactions, so controls cannot be complicated.

Thank you!

sentences:
SteamVR locks position of dynamically created cameras I'm having trouble tracking down a problem with SteamVR. Here is a quick way to set up an MWE:

Create a new Unity project.
Import the SteamVR package from the Asset Store.
Create the following script:

using UnityEngine;

public class CameraCreator : MonoBehaviour {
    private GameObject cameraObject;

    private void Start ()
    {
        cameraObject = new GameObject("CameraObject");
        cameraObject.AddComponent<Camera>();
        cameraObject.transform.position = Vector3.one;
    }
}

Create an empty game object and add this script to it.

SteamVR seems to lock this object's position (and that of any other game object with a dynamically created camera component) to the origin. No matter what I try to do to change it (inspector; set it inside update; set it in a coroutine), it always ends up back at the origin at some point during the frame (I believe somewhere between LateUpdate and OnRenderObject, but I'm not entirely sure). Without data breakpoints I find this really hard to track down.

This behaviour isn't really a problem for my actual project, but I need to be able to create cameras and modify their positions in my unit tests, where I'm having the same issue.

Does anyone know what's causing this, or have any advice on how to track down the cause?

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:
How to show your game vision? I am developing a game and have a clear vision of how it works, what key features it has and how it should look alike.

But when it comes to introduce the designer I feel a little bit lost. I have no graphics talent so I try to pitch it with mockups and text.

But I guess there are better ways or methods to get it on paper - how would they look like?

sentences:
Simple 3D particle gravity in javascript? I'm trying to do some simple gravity handling in my 3D environment (I'm using three.js). I've got some code, but it doesn't work. I'm hoping it's just a silly bug somewhere. Note: This is a cross-question from stack overflow since I've got no responses

function handleGravity() {
    for(var j = 0; j < spheres.length; j++) {

        for(var i = 0; i < spheres.length; i++) {

            var r1 = new Array( spheres[j].position.x, spheres[j].position.y, spheres[j].position.z);
            var r2 = new Array( spheres[i].position.x, spheres[i].position.y, spheres[i].position.z);
            var r12 = new Array(r2[0]-r1[0], r2[1]-r1[1], r2[2]-r1[2]);
            var r12UnitVector = new Array( r12[0]/Math.abs(r12[0]), r12[1]/Math.abs(r12[1]),r12[2]/Math.abs(r12[2]) );

            var m1 = masses[j];
            var m2 = masses[i];
            var r12Squared = r12[0]*r12[0] + r12[1]*r12[1] + r12[2]*r12[2];
            var a12 = new Array( -(gravConst*m2/r12Squared)*r12UnitVector[0], -(gravConst*m2/r12Squared)*r12UnitVector[1], -(gravConst*m2/r12Squared)*r12UnitVector[2]);

            velocities[j][0] += a12[0]*timePassed;
            velocities[j][1] += a12[1]*timePassed;
            velocities[j][2] += a12[2]*timePassed;
        }

    }
}

If you can see anything wrong with it, or give me any tips on using JavaScript to simulate many particles in a 3D environment most efficiently (I'm very new to physics + simulation), that would be awesome!

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:
How do I draw lines to a custom inspector? I have a custom editor to which I want to be able to draw a basic line graph. I have much of the functionality down, but I have only been able to test as much via the debug. I am yet to figure out how to draw the actual lines to the inspector.

How do I draw lines to a custom inspector?

I have found plenty of online resources, in regards to custom drawing to the editor. However, everything I find pertains specifically to drawing in the scene view; nothing seems to work inside of an actual inspector.

The two general methods I have found involve using Handles.DrawLine and the GL library. Neither appear to work; however, I have only been able to test functionality with blind coordinates, so far. I can not find anything in regards to actually determining the local coordinates of the area on the inspector where I wish to draw. Perhaps I need to start with an initial "origin" position, Perhaps I need to start with a local area defined by a Rect. I simply don't know.

It has also been a while since I had to use OpenGL, directly. It is entirely possible I am simply doing it wrong, to begin with. Here is my current graph method:

private void DrawVelocityGraph(float[] velocityValues, float minimumVelocity,
    float maximumVelocity)
{
    float velocityValue = velocityValues[0];
    float increment = 0;
    Vector3 lineStart = Vector3.zero;
    Vector3 lineEnd  = new Vector3(horizontalIncrement, velocityValue * verticalIncrement);

    GL.Begin(GL.LINES);

    for(int i = 1; i < velocityValues.Length; i++)
    {
        if(velocityValue == velocityValues[i]
            && (velocityValue == minimumVelocity || velocityValue == maximumVelocity))
        {
            Handles.color = VelocityGrapherColours.outOfRangeColour;
        }
        else
        {
            velocityValue = velocityValues[i];
            Handles.color = VelocityGrapherColours.lineColour;
        }

        lineStart = lineEnd;
        lineEnd.x += increment;
        lineEnd.y = velocityValue * verticalIncrement;

        GL.Vertex(lineStart);
        GL.Vertex(lineEnd);
    }

    GL.End();
}

sentences:
Android/Java AI agent framework/middleware I am looking for an AI agent framework to use as a starting point in an Android game I have to create for a university research project. It has been suggested to me to use JADE, but, as far as I can tell, it's not a suitable framework for games (at least for my game idea) because it runs in a split-execution mode, and it needs an always-active network connection to a main host.

What I want is just a little something to give me a headstart. I am willing to adjust the game's features to the framework because it's more of a mockup game, and the purpose is to compare the performance of a couple of agents in the game world. The game will be very simplistic, with a minimal UI that displays various stats about the characters in the game (so no graphics, no pathfinding).

Thank you.

sentences:
Using pygame on mac, strange errors I am using pygame on a mac, and when the app runs, it draws a frame of the screen fine, and then crashes with the following error:

Assertion failed: (NSViewIsCurrentlyBuildingLayerTreeForDisplay() != currentlyBuildingLayerTree),
function NSViewSetCurrentlyBuildingLayerTreeForDisplay,
file /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.10.101/AppKit.subproj/NSView.m,
line 14480.

Everything was working fine, but I did switch to multi-threading, and I think this might be related.  Has anyone a clue as to what might be going wrong?

I call:

pygame.init()
pygame_size = 1280, 960  # image dimensions
pygame_screen = pygame.display.set_mode(pygame_size)

in the main thread, and then I have many pygame draw calls.

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:
How can I get the window associated with a SDL_Renderer? As the title says, is there a member or function to get this?

For example renderer->window? Or renderer.window? Or so?

sentences:
Steering and wall hugging problem What I'm hoping to achieve is that when the player steers into a wall the movement is smoothed out by hugging along the wall, moving only with the velocity parallel to the wall, zeroing out the normal force) rather than bouncing back from the wall using the "generic" avoidance method.

I want this: Not this:

The two images are actual behaviors from my code. One removes the velocity normal to the wall so it glides smoothly hugging the wall. The other steers away from the wall creating the bouncing effect. The latter case actually works quite reliably but I do not like the bouncing behavior.

Here's my design for the for handling this case:

The vertical wall is actually made up of many square tiles
The wall avoidance steering checks one unit ahead to see if it is in contact with a tile
The normal is determined by which edge on the tile I'm closest to
zero out the velocity of the player normal to the wall

However this is not reliable for several reasons:

in the gif above, if the look ahead ends up on the bottom edge of a tile, it gets the wrong normal (goes horizontal instead)
the player can get stuck if it happens to penetrate the wall to much (i.e. stay on track for 1 frame, then next frame gets the wrong/perpendicular normal, then both velocities are canceled out)
player can penetrate the wall quite easily if they pick the right spot (which I don't have an obvious sense why)

I am wondering if anyone has a better suggestion on how to handle this case? The only requirement that I prefer to keep is the tile based wall as I have a map editor that generates the map data. Also if there is a method that can be extended to sloped walls that would be even better!

Thanks!

sentences:
Translating ChainShape to world coordinates according to touch drag input I'm trying to draw a ChainShape according to touch screen coordinates, however the coordinates are slightly off from my touch coordinates. I translate the chain drawn on the screen to world coordinates but don't think I've done it correctly.

I tried setting the shape's position to the first vertex but it positions it even further from the original touch coordinates. Can someone please help me understand where I'm going wrong?

public class Play implements Screen {
    private static final float TIMESTEP = 1 / 60f;
    private static final int VELOCITYITERATIONS = 8, POSITIONITERATIONS = 3;

    private Box2DDebugRenderer debugRenderer;
    private OrthographicCamera camera;
    private PolygonSpriteBatch batch;
    private World world;

    private List<Float> chain_verts = new ArrayList<Float>();
    private float[] chain;

    @Override
    public void show() {
        world = new World(new Vector2(0f, -9.81f), true);
        debugRenderer = new Box2DDebugRenderer();
        camera = new OrthographicCamera();
        batch  = new PolygonSpriteBatch();

        InputProcessor input_0 = new GestureDetector(new Gesture() {
        }) {
            @Override
            public boolean touchUp(float x, float y, int pointer, int button) {
                if (chain_verts.size() != 0) {
                    chain = new float[chain_verts.size()];
                }

                for (int i = 0; i < chain_verts.size(); i++) {
                    chain[i] = chain_verts.get(i);
                    System.out.print(chain[i] + " ");
                }

                ChainShape chainShape = new ChainShape();
                chainShape.createChain(chain);

                Vector3 mouse = new Vector3();
                camera.unproject(mouse.set(Gdx.input.getX(), Gdx.input.getY(), 0));

                BodyDef bodyDef = new BodyDef();
                bodyDef.type = BodyType.StaticBody;
                bodyDef.position.set(mouse.x , mouse.y);

                FixtureDef fixtureDef = new FixtureDef();
                fixtureDef.shape = chainShape;

                world.createBody(bodyDef).createFixture(fixtureDef);

                chain_verts.clear();
                chainShape.dispose();

                return super.touchUp(x, y, pointer, button);
            }

            @Override
            public boolean touchDragged(float x, float y, int pointer) {
                chain_verts.add(x);
                chain_verts.add(Gdx.graphics.getHeight()-y);
                return super.touchDragged(x, y, pointer);
            }
        };

        Gdx.input.setInputProcessor(input_0);
    }

    @Override
    public void render(float delta) {
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        world.step(TIMESTEP, VELOCITYITERATIONS, POSITIONITERATIONS);

        camera.position.set(0, 20, 0);
        camera.update();

        batch.setProjectionMatrix(camera.combined);

        debugRenderer.render(world, camera.combined);
    }

    @Override
    public void resize(int width, int height) {
        camera.viewportWidth = 1200;
        camera.viewportHeight = 800;
    }

    @Override
    public void pause() {}

    @Override
    public void resume() {}

    @Override
    public void hide() {
        dispose();
    }

    @Override
    public void dispose() {
        batch.dispose();
        world.dispose();
        debugRenderer.dispose();
    }
}

sentences:
Fast Serialization for Multiplayer Gaming I wish to make a Java based multiplayer game. I am learning all about sockets and so forth. I have built a very basic UDP system that serializes an object with all the information about the game state and then sends that to the client. The client sends input which changes the game state.

My question is, is serializing an entire object an acceptable way to send game info over the internet.

It's super simple but my placeholder images are lagging quite a bit across the screen on a localhost. This could be for several reasons but I was wondering if serializing and then sending and then de-serializing was just too slow a method? This game will be fast paced and reflex oriented.

sentences:
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: Where can I meet other independent game developers? I live in a large urban area and suspect there are groups of independent game developers that meet to discuss games and just hang out.  Are there any clubs or groups or associations or whatever for indie devs?

sentences:
Is there a simpler way to simplify the if statement? The code below generate angle and radius based brightness gradient. As you can see I need to use 3 if statement to define 3 circle, wonder is there a single code that can create nth circle corresponding to brightness gradient, imagine I want to create 20 circle, using 20 if statement is very unpractical.
Shader "Unlit/testDisplay"
{
   Properties
  {
       _MainTex ("Texture", 2D) = "white" {}
 }
SubShader
{
    // Render with transparent objects, after the opaque pass.
    Tags { "RenderType"="Transparent" "Queue"="Transparent"}
    LOD 100

    // Don't write to the depth buffer.
    ZWrite Off
    // Additive blending (add light/glow).
    Blend One One

    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 = UnityObjectToClipPos(v.vertex);
            // Shift our texture coordinates so 0 is in the center,
            // and we go to -2 ... +2 at the edges.
            o.uv = (v.uv -0.5f) *4.0f;
            return o;
        }

        fixed4 frag (v2f i) : SV_Target
        {
            //Define boundary value for radius
            float radius=length(i.uv);
            if(radius>0&radius<0.5)
            radius=0.5;
            if(radius<1&radius>=0.6)
            radius=1;

            if(radius<1.5&radius>=1.01)
            radius=1.5;

            if(radius<2&radius>=1.51)
            radius=2;

            //convert to polar coordinates
            float angle=atan2(i.uv.y,i.uv.x);
            float angle1=frac(angle/(2*3.142f));
            float result=-4*radius+angle1+13*frac(_Time.x);
            return result;

        }
        ENDCG
    }
}

}

sentences: Why has it become commonplace for NPCs to have one weapon per class instead of variants? For instance, in Half-Life 2 you have Civil Protection, Combine Soldier and Combine Elite. Each class has a weapon. Is there a shift away from this at all, where the NPCs are matched with the player in the sense that the weapon they choose to use is based upon their advantage, while still maintaining some sense of competitiveness? Is there a reason this became the norm? Does it have to do with all the variables and complications that can arise from doing that?

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:
How can I make an instantiation random? I'm trying to do it so when I have an instantiated an item upon the game starting, it is random as to whether it actually instantiates or not. Here's the code I have so far:

public GameObject anyItem;
void Start()
{
    Instantiate(anyItem, new Vector3(0, 0, 0), Quaternion.identity);
    Instantiate(anyItem, new Vector3(11, 0, 0), Quaternion.identity);
}

How can I do it so these items (individually, not both together) are decided randomly as to whether they will actually be instantiated or not?

sentences:
How to share Lua script between instances? I'm doing an agent based framework with C++ and Lua. I want to use Lua to code the Agent behaviour having an AgentClass class that have the name and source code and an AgentInstance class that have the lua_State. I want to have a few AgentClass instances during execution but hundreds or thousands of AgentInstance objects.

Is there any way to share the same lua script with different lua_State? Or Is there a better way to get hundreds of agents without too much performance penalty?

¿Options?:

Having compiled Lua code in AgentClass.
Having lua_State only on AgentClass, setting a self variable in every AgentInstance update.
Other.

sentences:
Displaying text on a 3D plane I am busy with a pet project where I am trying to create a Collectible Card Game in 3D.

These cards have Hp and Damage etc. but I cannot find a way to neatly display these values.
I tried to use a TextMesh, but all the text just blends into each other if the cards happen to overlap (eg. when the cards are in the hand).

Currently, I am using a plane for each value, and then changing the Material used on that plane, to match the value (eg. a '3' Material if the Damage is 3). It works, but I can't help to think that there has to be a better way.

Is there a way to dynamically display values on a plane so that it looks like the value is a part of the card itself, without changing the materials every time a change occurs? Or suggest anything else that would suit my needs?

If I am taking a horrible approach, you're welcome to nudge me in a better direction.

Thanks in advance

sentences:
Rotate a point in 3D space with sine and cosine I got my camera controlled by the mouse. Now I want a sphere to be always in the center of my view(just for testing). I tried that by assigning the sine of the Y rotation of the camera times 10 as the X coordinate and the same for the Y coordinate but with cosine:

SphereX = 10 * math.sin(YRotation)
SphereY = 10 * math.cos(YRotation)

But now I would like to know how to set the Z position. I can set the proper height of the sphere by doing that:

SphereZ = 10 * math.sin(XRotation)

But the problem is, that the sphere is only moving up and down and the moving towards the camera is ignored. How can I fix that?

sentences:
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:
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:
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:
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:
No Support for UnityScript (JavaScript) on 2018.3 Hey I’ve been working on a project for over 3 years and yesterday I have updated the unity from 2018 to 2018.3 and lost support for JavaScript.
All of my scripts attached to gameobjects are there but not working while playing the game.
I’ve tried the UnityScript to C# website but didn’t work.
I’m a macOS user so couldn’t use the converter tool on git (because it’s been developed only for windows).
I’ll appreciate any suggestions.

sentences:
Getting fastest path on a grid How would I go about finding the fastest path to connect two points on a grid? I'm making a 2D game and the map is based around a grid.

I need to be able to account for any blocked tiles that the path need be able to go through.

Example: http://imgur.com/BbtnR
The blue line being what I need to figure out, and the red tiles being the blocked tiles.

Where should I start? Any advice be would great!

sentences:
How to use arrow keys to navigate between cells in a crossword puzzle I am making a crossword puzzle, using a canvas.

How do you get the keyboard arrows to interact with the screen so that when the user presses any of the arrow keys, the cursor will advance to the next available input block.

This is how I drew the blocks on the canvas, with css styles added, button 1 and button 2: The "names001" stands for each box in the puzzle, then each box is assigned a letter value:

var r = event.keyCode;
if (r == 13 && m003 == "c") {
    w003 = 1;
    document.getElementById("names003").value = "c";
}

then a variable checks to see if each word is right and places a checkmark beside clue:

var check001 = w010 + w011 + w012 + w013 + w014;
if (check001 == 5) {
    clue001.innerHTML = "✔"
}

Now, I want to know when the puzzle is drawn to the canvas, how do you get the keyboard arrows to interact with the canvas when the user presses one of the arrows(up, down, left, right and also the backspace to clear entry when guess is wrong; I want to move the cursor to advance to the next block.

sentences:
Rotate Object in world space - Raytracing I’m programming a C raytracing project.
I’ve been wanting to implement object rotations (square, cylinder) for several days but I can’t do it.
For each object I have its position (x, y, z) in the world space and its 3d normalized orientation vector.
For the moment I do nothing more than applying once of the three following functions on the 3d normalized orientation vector. I don’t know if I’m doing it right. Rotation doesn't work well.
For example I want to rotate my object left with the j key and right with the l key (x_rotation), up with the i key and down with the k key (y_rotation). I'm not sure how to use the z axis.
I'm starting to despair, can you please help me ?
I will be very grateful for your help :)
t_vec x_rotation(t_vec vec, float alpha)
{
    t_vec   res;

    res.x = vec.x;
    res.y = vec.y * cos(alpha) - vec.z * sin(alpha);
    res.z = vec.y * sin(alpha) + vec.z * cos(alpha);
    return (res);
}

t_vec y_rotation(t_vec vec, float alpha)
{
    t_vec   res;

    res.x = vec.z * sin(alpha) + vec.x * cos(alpha);
    res.y = vec.y;
    res.z = vec.z * cos(alpha) - vec.x * sin(alpha);
    return (res);
}

t_vec z_rotation(t_vec vec, float alpha)
{
    t_vec   res;

    res.x = vec.x * cos(alpha) - vec.y * sin(alpha);
    res.y = vec.x * sin(alpha) + vec.y * cos(alpha);
    res.z = vec.z;
    return (res);
}

sentences:
What is a good way to test demand for a new game platform? I'm working on a game platform that turns your iPhone, android or iPad into a steering wheel, for racing games (like need for speed and dirt 3) and flight simulators for example.

I'd love to figure out smart ways to figure out whether gamers would like something like this.

I originally asked this question over on the gaming SE and it was for getflypad.com. A lot of the tech is built and most of it is doable - the question here is how to test demand and know whether gamers actually want this.

sentences:
Open CryEngine console from lua script Is there a function in the CryEngine Lua API to open the ~ Console?
I cannot find it in the Lua (ScriptBind) API reference.

sentences:
Rotate Body From Corner I want to ask that how to rotate body from corner?

movableBeam.getBeamBody().setTransform(movableBeam.getBeamBody().getPosition(), angle);

The above line of code rotate the beam from center that I want rotate from one of the conner. Any member please help me.

EDIT :

            float beamCenterX = movableBeam.getX() + movableBeam.getWidth()
                    / 2f;
            float beamCenterY = movableBeam.getY()
                    + movableBeam.getHeight() / 2f;

            float cornerOffsetX = movableBeam.getX() - beamCenterX;
            float cornerOffsetY = movableBeam.getY() - beamCenterY;

            float bodyAngle = (float) Math.atan2(cornerOffsetY,
                    cornerOffsetX);

            float newAngle = imageAngle + bodyAngle;
            float newCornerOffsetX = (float) Math.cos(Math
                    .toDegrees(newAngle));
            float newCornerOffsetY = (float) Math.sin(Math
                    .toDegrees(newAngle));

            cornerOffsetX = movableBeam.getX() - movableBeam.getWidth()
                    / 2f;
            cornerOffsetY = movableBeam.getY() - movableBeam.getHeight()
                    / 2f;

            Vector2 postion = new Vector2(
                    (newCornerOffsetX - cornerOffsetX + movableBeam.getX())
                            / PhysicsConstants.PIXEL_TO_METER_RATIO_DEFAULT,
                    (newCornerOffsetY - cornerOffsetY + movableBeam.getY())
                            / PhysicsConstants.PIXEL_TO_METER_RATIO_DEFAULT);

            movableBeam.getBeamBody().setTransform(postion, newAngle);

sentences:
SpriteBatch.Draw has Padding on Monogame.Android I am using Monogame to create a small Android game.
I am trying to draw a sprite to the Android screen but it seems to have a padding of some pixels. The same game works fine on desktop.

How can I remove the padding?
The graphic itself has no borders etc; the problem is also reproducible with any other sprite.

I have created a new project in VS2019 with the Monogame templates for VS2017 and tried to reproduce this behavior in a new project.

It seems that the problem has something to do with the notch of my emulator.
In an emulator without a notch the problem seems to be non existent.
I found this thread on the Monogame community but it hasn't got any answers.

My source code looks in its simplest form now as follows:

    private Texture2D _texture;

    protected override void LoadContent()
    {
        spriteBatch = new SpriteBatch(GraphicsDevice);
        _texture = Content.Load<Texture2D>("BasicTV");
    }

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

        spriteBatch.Draw(_texture, Vector2.Zero, Color.White);

        spriteBatch.End();
        base.Draw(gameTime);
    }

The result of this code is this:

The Game is compiled for Android 8.1 and I use the Monogame framework 3.7.1.

sentences:
How to represent a map in a top-down perspective game with low algorithm complexity? This is the first time I develop a video-game, and I am kind of lost.

I would like to know about ways on representing 2D maps on a top-down perspective game...

(Like this one: vengadoravg.github.io/1/game.html btw, this is the first game I develop)

So far, I've found one way to represent a 2D map in a top-down perspective game:

Using a matrix. Where a normal floor place is represented by some number (or character), the obstacles are represented by a different number, and the enemies by another different number. This matrix would allow me to run graph theory algorithms and crazy things, but i think it would be, algorithmically, very complex, because the graph would be really populated and dense. Thus, all the sprites should be the same size, otherwise, the matrix would be really, really big.

Are there any other (better) ways?

In terms of algorithm complexity, which of them are the best to run graph theory algorithms?

I apologize if the question sounds subjective... but i think the superiority of an approach can be determined by its algorithmic complexity :)

sentences:
Creating a custom collider shape in unity, and performance concerns I want to create a custom chaped collider in unity to create point-defense triggers for objects. I have a spherical collider that triggers for attacking objects that enter it already. However I want cone-shaped colliders for point defense to detect and shoot down enemy projectiles in certain areas.

I can do this by creating a custom mesh and importing that for the collider. How much of a performance hit can this cause? If you have 1,000 of these colliders active in a scene with objects flying in and out of them, will I see significant performance reduction compared to just using a spherical collider and dropping the cone idea?

sentences:
OnMouseOver() alternative for iPhone (Unity3D/Unity2D) I am currently developing a game that uses the OnMouseOver() function of a MonoBehaviour object.

Is there a true alternative for iPhone? Would I be better of coding my own?

Thanks in advance

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:
Where can I publish my Windows Indie game? I've just finished an XNA game for the Windows Phone 7 and XBLIG.  At the moment, the game is a 'lite' version, so is free, but the next version will have a small price-tag.

I also did a Windows version.  Where's the best place to publish it?

sentences:
Software Design/Modelling method and tool for games? I've heard that UML is a great modelling language for software design. However, for software, such as game, that will certainly encounter major changes during the development, I doubt that UML will work effectively.

What are the common ways or models that the game programmers used? and is there any recommended tools for game designing process?

sentences:
libgdx - collision detection with tiled map java currently, I am working on a 2d rpg game which is similar to final fantasy 1-4. I can load up a tiled map and the sprite can walk freely on the map. However, I will like to create a wall for it to stop walking through it.

I created three tiled layer Background, Collision, Overhead and one  Collision object layer with rectangles only.

"How do I handle collisions with the object layer in the tiled map?"

"Do I have to create every single rectangle that is in the object layer with Rectangle rectangle = new Rectangle() and rectangle.set(x, y, width, height)in the code?"

Thank you very much in advance. Any help is greatly appreciated!

sentences:
Collision detection - formula for getting intersection point I need help with collision detection algorithm from this paper: http://www.peroxide.dk/papers/collision/collision.pdf

I assume I am colliding with sphere of radius 1, just to make everything not important easier...I am concerned with formula, which finds intersection point with plane (page 14):

planeIntersectionPoint = basePoint - planeNormal + t0 * velocity

where:
basePoint = center of Sphere

planeNormal = normalized normal vector to colliding plane

t0 = number from [0,1] interval, first moment from this interval during which collision happens, assuming we are moving with velocity vector

velocity = velocity vector

I think that this formula doesn't work... Assuming that I am already intersecting with plane at t0 = 0, I just get:

planeIntersectionPoint = basePoint - planeNormal

What gives me point which doesn't even belong to plane, what fails further parts of the algorithm, when I check if intersection point is in triangle...

I will be grateful for every answer... Is the algorithm wrong, or that's me misunderstanding something?...

sentences: How to set a directory to download assetbundles from? Hi I'm using unity and I've created an AssetBundle file containing two different sprites. I set it's path to my desktop and I can load my assets. But how to download the AssetBundle from a directory on the web. How can I set a directory for everyone to be able to download the AssetBundle?

sentences:
Image won't scale after click Despite being a long-time developer I've never played with JavaScript libraries or any sort of graphics development.  With my son we're trying to create something interesting and are using createjs/easeljs as our vehicle of choice.

That said, we are going through a number of tutorials and can't determine why this isn't working.  The ball image does display but the on-click method code does not cause the image to scale.  The onBallClick method is being called so we suspect the reference is simply wrong somehow.

        var preload = new createjs.LoadQueue();
        var stage = new createjs.Stage("demoCanvas");

        function loadImage() {
          preload.addEventListener("fileload", handleFileComplete);
          preload.loadFile({id:"ball", src:"assets/ball.png"});
        }
        function handleFileComplete(event) {
          document.body.appendChild(event.result);
          event.result.addEventListener("click", onBallClick)
        }
        function onBallClick(event)
        {
            var ballImage = preload.getResult("ball");
            var bitmap = new createjs.Bitmap(ballImage);
            bitmap.scaleX = 0.5;
            stage.update();
        }

There are no errors in the developer console so we're trying to determine what is the correct reference to the bitmap.

We tried to do createjs.Bitmap(event.result) in handleFileComplete but event.result has a type of [Node] so we're not sure what to do with that but it doesn't appear useful for purposes of the createjs.Bitmap() statement.

sentences:
Locking on to enemy, player can only move towards enemy, not away? I'm working on a lock on function and so far I can lock on to the nearest enemy, but my player can't move around the enemy, i can only move towards it. I have my project setup so that the camera is always at a fixed position/rotation, and the player moves independently of the camera.

Here's my move function:

public void Move(float h, float v) {
    if (!lockPlayerMovement) {
        Speed = 0;
        MoveDirection.y -= Gravity * Time.deltaTime;
        if (Mathf.Abs(v) > ThumbStickDeadZone || (Mathf.Abs(h) > ThumbStickDeadZone)) {
            var lookRotation = new Vector3();
            lookRotation.Set(h, 0, v);
            lookRotation = lookRotation.normalized;

            var rotation = Quaternion.LookRotation(lookRotation, Vector3.up);
            if (lookRotation.magnitude > ThumbStickDeadZone) {
                Speed = RunSpeed;
                transform.rotation = Quaternion.Slerp(Transform.rotation, rotation, Time.deltaTime * TurnSpeed);
            }
        }
        if (Controller.isGrounded) {
            MoveDirection = Transform.TransformDirection(Vector3.forward).normalized;
            MoveDirection *= Speed * Time.deltaTime;
            //if (Input.GetButton("Fire1"))
            //      MovementProperties.MoveDirection.y = JumpSpeed;
        }
        Controller.Move(MoveDirection);
    }
}

Lock On Function:

void Update () {
    playerPosition = transform;

    if (enemyLockedOn && enemyTarget != null) {
        transform.LookAt(enemyTarget.transform);
    }
}

void ScanForEnemies() {
    int numOfEnemies = 0;

    float distanceFromPlayer;
    GameObject closestEnemy;

    List<GameObject> enemies = new List<GameObject>();

    Collider[] cols = Physics.OverlapSphere(transform.position, radius);

    foreach (Collider col in cols) {
        if (col && col.tag == "Enemy") {
            ++numOfEnemies;
            enemies.Add(col.gameObject);
            //print(Vector3.Distance(playerPosition.position, col.transform.position));
        }
    }

    if (enemies.Count > 0) {
        distanceFromPlayer = Vector3.Distance(playerPosition.position, enemies[0].transform.position);
        closestEnemy = enemies[0];
        for (int i = 0; i < enemies.Count; i++) {
            if (Vector3.Distance(playerPosition.position, enemies[i].transform.position) < distanceFromPlayer) {
                distanceFromPlayer = Vector3.Distance(playerPosition.position, enemies[i].transform.position);
                closestEnemy = enemies[i];
            }
        }

        /* Set closest enemy as the player target and lock player to that enemy (while in range -- or scan pressed again) */
        enemyTarget = closestEnemy;

        if (enemyTarget != null) enemyLockedOn = true;

        print("Closest Enemy : " + closestEnemy + " | Distance From Player : " + distanceFromPlayer);
        print("Number of nearest enemies : " + numOfEnemies);

    }
}

sentences:
Pixelation shader explanation? I was looking for a pixelation shader for my postprocessing and came across this shader snippet - Works pretty well! - Not a whole lot of explanations on how it works except for "Pixelation is process when pixel at [x, y] is duplicated into [x + dx, y + dy] rectangle"

I re-wrote/formatted the shader a bit:

out vec4 FinalColor;
in vec2 FragUV;
uniform sampler2D Texture;

void main()
{
        float Pixels = 512.0;
        float dx = 15.0 * (1.0 / Pixels);
        float dy = 10.0 * (1.0 / Pixels);
        vec2 Coord = vec2(dx * floor(FragUV.x / dx),
                          dy * floor(FragUV.y / dy));
        FinalColor = texture(Texture, Coord);
}

My understanding: Messing with the 'Pixels' I found that the higher this number the more pixels there on the screen/the smaller the size pixels get thus a less pixelated effect. Then he's calculating some x and y offset values based on that number and using those offsets to get new texture coordinates to sample from.

My question: I have no idea how that's actually happening. I mean how does all that achieve "duplicating a pixel at [x, y] is into [x + dx, y + dy] rectangle"? What does 15 and 10 represent? (how much to offset on x and y?) - What happens when we actually multiply dx/dy with the result of the floor function and divide the texture coordinate by them? and why 'floor' in particular?

Any help or explanation is appreciated, thanks!

sentences:
How do I determine the forward/right direction when I have the "up" vector? - Unity I am trying to fix a gameobject for e.g. a cube (which i am using as a sensor) on my character. I need the cube to rotate (with orientation control from the inspector - I have a public quaternion rotation variable set). I have identified 3 vertices using ray cast to fix my sensor onto the character. I already have determined the normal of these vertices which will be the "up" direction of the cube. I am wondering how I can determine the forward/right vector to use in the LookRotation() function. I need to basically be able to rotate the cube ON the character even as the character moves on animation. This is my code, and as of now there is no rotation happening. I'm sure I am missing something and would really appreciate help. I really hope this is enough explanation.

using System.Collections;

using System.Collections.Generic;
using UnityEngine;

public class orientation : MonoBehaviour
{
    // importing from Vertex Finder Script to use InterpolatedNormalInWorldSpace value

private VertexFinder script;
public Transform target;

// to edit orientation of sensor in Unity Inspector
public Quaternion rotation_edit;

// Start is called before the first frame update
void Start()
{
    script = GetComponent<VertexFinder>();
}

Quaternion TurretLookRotation(Vector3 approximateForward, Vector3 exactUp)
{
Quaternion rotateZToUp = Quaternion.LookRotation(exactUp, -approximateForward);
Quaternion rotateYToZ = Quaternion.Euler(90f, 0f, 0f);

return rotateZToUp * rotateYToZ;
}

// Update is called once per frame
void Update()
{
    Vector3 relativePos = target.position - transform.position;

    // aligning axes of sensor to z axis and y axis respectively
    Quaternion rotation1 = TurretLookRotation(relativePos, script.interpolatedNormalInWorldSpace);

    // setting rotation of sensor to values entered in Inspector with respect to the above aligned axes
    transform.rotation = rotation1 * rotation_edit;

}

}

sentences:
What are pros and cons of Voronoi shatter? I have seen some Voronoi shatter videos on Youtube.

What is your experience with it?

What are the pros and cons in time complexity, resource complexity, implementation difficulty...?

Does it emulate how a real material would react?

sentences:
Procedurally generating terrain in dead time before buffer swap I'm using OpenGL/C++ in Windows, and my main loop looks like this:
    GLboolean done = GL_FALSE;
    auto_ptr l_world(new World);
    l_world->Init();

while (!done) {
    if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) {
        if (msg.message==WM_QUIT) {
            done = GL_TRUE;
        } else {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    } else {
        if (!world->Iteration() || keys[VK_ESCAPE]) {
            done = GL_TRUE;
        } else {
            LocalContext.SwapBuff();
        }
    }
}

where Iteration() is:

GLboolean World::Iteration() {
    DrawAll();
    MoveAll();
    CheckForCollisions();

    return GL_TRUE;
}

I've implemented the diamond-square algorithm to procedurally generate terrain, which I'm currently doing in World::Init(). Vertices, indices and textures are stored in buffers to be drawn every frame.

That's fine for a small area, but I want to make it much bigger if possible. To do that I'd like to generate on-the-fly as the camera moves, which would be done at the end of the iteration, after the drawing, moving and collision detection but before the buffer swap. It could be split over several frames, but I'd like to get as much done in a single frame as possible.

As I understand it, with vsync enabled SwapBuffers will block until the end of frame, so any time between the SwapBuffers call and the end of frame will be wasted. So that's my question: is there a way to tell how much time remains until the end of the frame, so I can keep generating terrain until the last possible instant but still maintain a consistent frame rate?

I've not found anything too helpful on the OpenGL Synchronisation page. I wondered if Triple Buffering might be the answer - if the other back buffer contains a completed frame, keep generating; if it's empty then SwapBuffers. It's not a great solution as it would make triple buffering mandatory, and how would you detect if one of the back buffers was free? Any better suggestions?

sentences:
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:
Change sprite angle on sloping ground I have a problem here with GameMaker built-in physics environment.My player is designed to be on a skateboard. I want my player to rotate its sprite, according to the kind of fixture(up or down slopes) he is moving on.I've tried everything i could and everything i could find, but it didn't help me much, because the object is rotating in a very strange way.I enabled some flags to see the mask. Also, I've been studying vector algebra and i know it the angle between vector x speed and vector y speed should be the direction. Please help. Here's what i have so far:

1 object which is the player
Information about object: obj_Player
Sprite: sprite7
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_Static_Parent
Children:
Mask:
Physics
Start Awake: true
Is Kinematic: false
Is Sensor: false
Density: 0.5
Restitution: 0.1
Group: 0
Linear Damping: 0
Angular Damping: 0
Friction: 0.2
Shape: Polygon
Points:
(76, 52)
(76, 60)
(0, 56)
(0, 52)
Create Event:
execute code:

///Initialize the tires
var half = sprite_width / 2;
var halfy = sprite_height / 2;
var tire = instance_create(x-half+12,y+halfy,obj_Wheel);
physics_joint_revolute_create(id,tire,tire.x,tire.y,0,0,0,0,0,0,false);
var tire = instance_create(x+half+12,y+halfy,obj_Wheel);
physics_joint_revolute_create(id,tire,tire.x,tire.y,0,0,0,0,0,0,false);

Step Event:
execute code:

//Code
facing = -point_direction(0, 0, phy_speed_x, phy_speed_y);
phy_fixed_rotation = true;
phy_rotation = facing;

//Move him
if(keyboard_check(vk_space)) {
physics_apply_impulse(x,y,0,-100);
}
if mouse_check_button(mb_left)
{
phy_position_x = mouse_x;
phy_position_y = mouse_y;
}

Information about object: obj_Wheel
Sprite: spr_Wheel
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_Static_Parent
Children:
Mask:
Physics
Start Awake: true
Is Kinematic: false
Is Sensor: false
Density: 0.05
Restitution: 0.1
Group: 0
Linear Damping: 0.1
Angular Damping: 0.1
Friction: 30
Shape: Circle
Points:
(8, 8)
(8, 8)
Create Event:
execute code:
Keyboard Event for  Key:
execute code:
            physics_apply_torque(-100);
Keyboard Event for  Key:
execute code:
            physics_apply_torque(100);

And here is the result:
  http://i.stack.imgur.com/sn1qh.gif

sentences:
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:
libGDX box2D not setting user data I am working about box2D.
Even if I set userData, when I retrieve it via getUserData(), it returns null. Using debugger, I noticed that object passed to setUserData() is not null, but on the next istruction: fixtureDef.shape.dispose();
Body user data returns being null, such as setUserData() set on a copy of body. I read on other topics that setUserData() must be called before body creation...but it throws an exception
      @Override
public void setPhysic(@Null Shape shape, BodyDef.BodyType bodyType, FixtureDef fixtureDef) {

    if(shape == null) {
        PolygonShape polygonShape = new PolygonShape();
        BoundingBox boundingBox = this.model.calculateBoundingBox(new BoundingBox());
        polygonShape.setAsBox(boundingBox.getWidth(), boundingBox.getHeight());
        fixtureDef.shape = polygonShape;
        fixtureDef.density = 1f;
    }else{
        fixtureDef.shape = shape;
    }

    BodyDef bodyDef = new BodyDef();
    bodyDef.type = bodyType;
    bodyDef.position.set(this.getPosition().x, this.getPosition().y);

    this.body = Game.world.createBody(bodyDef);
    this.body.setUserData(this); //<-- Add this line to fix the problem
    this.body.createFixture(fixtureDef).setUserData(this);

    fixtureDef.shape.dispose();
}

Here I get userData:
  if(body[0].getUserData() instanceof Block){
            if(button == Input.Buttons.RIGHT){
                ((Block)body[0].getUserData()).onBlockClicked(player);
            }else if(button == Input.Buttons.LEFT){
                player.onPlayerBlockDestroying((Block)body[0].getUserData(), mouseCords);
            }
        }

sentences:
Can't load model using ContentTypeReader I'm writing a game where I want to use ContentTypeReader. While loading my model like this:

terrain = Content.Load<Model>("Text/terrain");

I get following error:

Error loading "Text\terrain". Cannot find ContentTypeReader
AdventureGame.World.HeightMapInfoReader,AdventureGame,Version=1.0.0.0,Culture=neutral.

I've read that this kind of error can be caused by space's in assembly name so i've already removed them all but exception still occurs.

This is my content class:

[ContentTypeWriter]
public class HeightMapInfoWriter : ContentTypeWriter<HeightmapInfo>
{
    protected override void Write(ContentWriter output, HeightmapInfo value)
    {
        output.Write(value.getTerrainScale);
        output.Write(value.getHeight.GetLength(0));
        output.Write(value.getHeight.GetLength(1));

        foreach (float height in value.getHeight)
        {
            output.Write(height);
        }
    }

    public override string GetRuntimeType(TargetPlatform targetPlatform)
    {
        return
            "AdventureGame.World.Heightmap,AdventureGame,Version=1.0.0.0,Culture=neutral";
    }

    public override string GetRuntimeReader(TargetPlatform targetPlatform)
    {
        return
        "AdventureGame.World.HeightMapInfoReader,AdventureGame,Version=1.0.0.0,Culture=neutral";
    }
}

Does anyone meed that kind of error before?

sentences:
How to use vertex and fragment shaders without using VBOs and VAOs? Recently, I am trying to make a 3D game in LWJGL 2, not LWJGL 3, just because I am more familiar with LWJGL 2. Since LWJGL decided to shut down their legacy wiki website, I've been researching alot lately on adding shaders. The thing is, most of these tutorials use VBOs and VAOs to render objects.
I am trying to use vertex and fragment shaders to edit the objects. Yes, I am using the depreciated methods glBegin(); and those rendering methods to draw shapes. I am not sure if this affects the use of shaders or not, so that is why I am asking this question.
If anyone wants to know, I am using the depreciated methods because I don't want to really use VAOs and VBOs, I know it reduces performance to use the depreciated methods, but I am fine with this for now.

sentences: Is it legal to use the game mechanics of risk if I don't use their name? I'm currently developing an idea for a conquest-style board game similar to Risk. I was wondering if I would be legally entitles to use some game mechanics that appear in that game so long as I don't use Risk's title or logo or anything.

sentences:
libGDX - Why do I have to use camera.setToOrtho what does it do? I am very confused about camera matrices and I don't know where to start my studying. Maybe I have to study OpenGL, but I don't know C++ ...

Ok so I have a camera, Box2d world and a Box2d body.

private World world;
private Box2DDebugRenderer b2dr;
private OrthographicCamera cam;
private Body player;

@Override
public void create () {
    //Create the world without gravity
    world = new World(new Vector2(0, 0), false);
    b2dr = new Box2DDebugRenderer();
    //I create my camera
    cam = new OrthographicCamera();

    //Create the player
    BodyDef bdef = new BodyDef();
    bdef.type = BodyDef.BodyType.DynamicBody;

    //Sets the body position to the center of the screen
    bdef.position.set(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2);

    player = world.createBody(bdef);
    CircleShape shape = new CircleShape();
    shape.setRadius(2f);
    player.createFixture(shape, 1f);
}

@Override
public void render () {
    world.step(1f/60f, 6, 2);

    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    b2dr.render(world, cam.combined);
}

I am not seeing the player on the center of the screen, just a black void.

But if I add cam.setToOrtho(false); I see the player!
Why is that?

setToOrtho sets the camera to Orthographic projection WHY?

The camera is Orthographic what oder projection can it have?? Isn't the orthographic projection obvious?

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:
JBox2D simple example for Android? I'm starting to develop an Android game. I've already installed jBox2D but I can't find complete code to develop a simple application from scratch using this framework.
Thanks in advance!

sentences:
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:
Tile Map World Background I am making a 2D top-down game in Java using the Slick2D library. However, this question applies to all ways of making games of this nature.

My question is: How would I do a background for the world. Currently it looks like this:

Obviously, this isn't the best example, as the right side has an area that allows the player to walk into the 'background'. However, I am asking how this is done in other games, such as Pokemon.

sentences:
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:
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:
2D game with angled top-down camera perspective I want to create a game similar to binding of isaac, a slightly angled top-down 2D game. In binding of isaac, the character moves and shoots along a 4-way path, so when he is shooting towards East, the character is facing East, same for North, West and South. In my game I need to shoot at any given angle, so it will look pretty bad if the character is facing East but the bullet is going North-East, I considered creating 8 or even 16 sprites with the character facing at different at different angles. But I don't know if it will look good either.

I would like to know if anyone encountered this problem and if there is any solution beside switching to 3D, because is not a solution at this moment.

In this image(Binding of Isaac) it may look like the player shoots at any given angle but it's not, he moved to the left immediately ofter shooting.

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:
Triangle area selection using BVH raycasting Let's assume I'm already storing a BVH acceleration structure per mesh on my engine and I'd like start
making area selection like on many DCC tools out there, for instance, blender.
With blender you can do {rectangular, circle, lasso} selection to select faces and I'd like to understand the maths behind these algorithms. If I was using color picking techniques these sort of algorithms would be obvious but when using BVH+raycasting I'm still failing to understand the algo/maths behind it.
So, could you please explain the logic behind those? For instance, I assume rectangular selection should be easier to implement than circle/lasso, so how would you gather all screen projected triangles living inside the rectangular selection created by the mouse?

sentences:
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:
Collision detection with non-rectangular images I'm creating a game and I need to detect collisions between a character and some parts of the environment. Since my character's frames are taken from a sprite sheet with a transparent background, I'm wondering how I should go about detecting collisions between a wall and my character only if the colliding parts are non-transparent in both images.

I thought about checking only if part of the rectangle the character is in touches the rectangle a tile is in and comparing the alpha channels, but then I have another choice to make... Either I test every single pixel against every single pixel in the other image and if one is true, I detect a collision. That would be terribly ineficient.

The other option would be to keep a x,y position of the leftmost, rightmost, etc. non-transparent pixel of each image and compare those instead. The problem with this one might be that, for instance, the character's hand could be above a tile (so it would be in a transparent zone of the tile) but a pixel that is not the rightmost could touch part of the tile without being detected. Another problem would be that in different frames, the rightmost, leftmost, etc. pixels might not be at the same position.

Should I not bother with that and just check the collisions on the rectangles? It would be simpler, but I'm afraid people.will feel that there are collisions sometimes that shouldn't happen.

sentences:
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: Is Google's Protocol Buffer viable for the serialisation of game data? Simple yes it is suitable, no it is not suitable for communications between game clients and/or server clients.  Also is it suitable for serialising and storing game data or is a more customisable, minimisable solution recommended.

sentences:
The jumping height changes randomly, and it is not due to the fact that I press the space bar longer. It is just random Sometimes, the jump height will be so high, and sometimes it jumps normally. How do I solve this? Code:

using UnityEngine;

public class PlayerController : MonoBehaviour
{

    [SerializeField] private LayerMask platformsLayerMask;

    public Rigidbody2D rb;

    public float MovementSpeed = 100f;

    public float JumpingHeight = 100f;

    public BoxCollider2D bc;

    public float fallMultiplier = 2.5f;
    public float lowJumpMultiplier = 2f;

    public Animator anim;

    void Awake()
    {
        rb = transform.GetComponent<Rigidbody2D>();
        bc = transform.GetComponent<BoxCollider2D>();
    }

    void Update()
    {
        if (IsGrounded() && Input.GetKeyDown(KeyCode.Space))
        {
            rb.velocity = new Vector2(rb.velocity.x, JumpingHeight * Time.deltaTime);
            Debug.Log("Jumping");
        }
        HandleMovement();

    }

    private bool IsGrounded()
    {
        RaycastHit2D raycastHit2d = Physics2D.BoxCast(bc.bounds.center, bc.bounds.size, 0f, Vector2.down, 1f, platformsLayerMask);
        Debug.Log(raycastHit2d.collider);
        return raycastHit2d.collider != null;
    }

    void HandleMovement()
    {
        if (Input.GetKey(KeyCode.A))
        {
            rb.velocity = new Vector2(-MovementSpeed * Time.deltaTime, rb.velocity.y);
            Debug.Log("Going Left");
            transform.localScale = new Vector2(-1, 1);
        }
        else
        {
            if (Input.GetKey(KeyCode.D))
            {
                rb.velocity = new Vector2(+MovementSpeed * Time.deltaTime, rb.velocity.y);
                Debug.Log("Going Right");
                transform.localScale = new Vector2(1, 1);
            }
            else
            {
                //no keys pressed
                rb.velocity = new Vector2(0, rb.velocity.y);
                Debug.Log("No key pressed");
            }
        }
        if (rb.velocity.y < 0) //reponsive jumping and falling
        {
            rb.velocity += Vector2.up * Physics2D.gravity.y * (fallMultiplier - 1) * Time.deltaTime;
        }
        else if (rb.velocity.y > 0 && Input.GetKeyDown(KeyCode.Space))
        {
            rb.velocity += Vector2.up * Physics2D.gravity.y * (lowJumpMultiplier - 1) * Time.deltaTime;
        }

    }

}

sentences:
How to split login and game logic when writing servers? I'm building a poker like game server, I was going to have all logins and game logic to be handled on one server, but from my research on the web, I learn that this would not scale, and it would make sense to split the work into a login and game servers. But what I don't get is after I handled authentication in the login server, and have the client make a new connection to the game server, how would I know which client is which? Would I not have to re-login again and thus defeat the purpose of having a server for login? Is there some way to pass a connection across processes and machines that I don't know about?
Excuse my little knowledge of networking.

sentences:
Modularization in a project I'm writing a C# game in Mono, and I want the game to be as modular as possible.
I've started by writing the whole Item (inventory) System of the game in a seperate .dll library
But I've hit a problem. I want Items to have effects, so I've written a base Interface for this:

interface IBehavior
{
    bool ApplyBehavior(Player destinationPlayer);
}

I'm following guidelines from the answer on this post regarding the (Unit, Effect, Behavior, Ability [Lets call it UEBA]) structure. Problem is that Player is a class from like the main module in the game so I assume this breaks modularity in the code.
What would be the best solution to fix this conflict?
I'm considering writing another, separate module, of UBEA, that will use Player and then the Item System module will use that module instead of the main module, and then the UBEA module will break modularity.
Should I also move Player to another module?
Am I even able to create full modularity if this is the model of things I want to create?

Thanks for the answers!

sentences: Moving lights or scene objects in Unity seems to cause a second point light to shrink or dim Moving a Point Light in 2d space seems to be dimming lights around it. What is this and how can I solve it?

sentences:
How to dynamically create an UI text Object in Unity 5? I have been searching for something that should be simple, but Unity 5's documentation on that is fairly outdated. What I want to achieve is to be able to create UI Text totally from script, i.e. fully dynamically - in my real case application, I will do that in a loop of not pre defined number of iterations.

A search using Google will find quite many examples on how to do that, but all I saw either use methods that are already deprecated (are from before Unity version 5) or are simply wrong (no surprise here...). I already know that I should first add a Canvas to my project, then I should include using UnityEngine.UI in my C# code, and also that I could declare a UI Text like Text _guitext.

However, the code below does not work. I mean, it's not that it crashes, but rather that nothing is shown:

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

public class MyClass: MonoBehaviour {

Text _guitext;

// Use this for initialization
void Start () {
    _guitext.text = "testing";
}

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

Worse than that, it seems that while game is played, no new object appears in the object hierarchy list.

Could you please point me out in the right direction here? Thanks.

sentences:
Building dynamic bounding box hierachies I've been reading about collision detection and I saw that the first part was a coarse detection which generates possible contacts using bounding box hierarchies.

I understand the concept of splitting up your objects in groups, to speed up the detection phase, but I'm a little confused on how do you actually build the hierachy, more so on what criteria is used to group them together.

Do I iterate through all the objects in the scene, and check the distance between them to see where they should be inserted in the tree?

Do you know some resources that may shed some light on this topic for me?

sentences:
Math for 2d movement with max speed? I need some help with math in a 2d environment. I have a joystick that controls the acceleration vetor for the player figure.

Its suppose to look like the ground is slippery which makes the figure turn slowly and accelerate and decelerate slowly.

Now, I can do this without any problem if I remove the maximum speed, but Im having problem when using a speed cap.

This is my calculation:

func move() {
    if acceleration == CGPointZero && currentSpeed != 0 {
        direction *= 0.95
    }
    else {
        if self.currentSpeed > maxSpeed {
            // This is almost working, just a little buggy, please help here with quality mathamatics :)

            let angle = CGPointZero.angleToPoint(direction) // In Radians
            direction = CGPoint(cos(angle), sin(angle)) * maxSpeed
        }
        else {
            direction += acceleration
        }
    }

    self.center += direction
}

move() is getting called by a timer running at 32 fps. acceleration is a Vector pointing to the direction the user wants his figure to go. currentSpeed is calculated using Pythagorean theorem. direction is acceleration * speed. maxSpeed is a number. self.center is the centerpoint of the figure.

sentences:
Overlaying Menus with a State Machine I'm working on developing a game with C++, SDL, and OpenGL. I created the engine from scratch, and implemented my own state machine to handle menus and general gameplay.
Each State gets pushed into a stack and the last one gets updated and drawn, after initialization on entry. They also handle input on a per-State basis. Right now I have a State for entry point, a 'Press Any Key' prompt, a main menu, as well as a new game menu where the player enters their name.
I also batch my Sprites together for easy drawing. I simply pass a vector of Sprite pointers (as some animated sprites may be mixed in as well) to the drawing function which uploads the Sprites to a buffer and draws them. These vectors of Sprites are organized by batch type - mostly based on texture.

I'm moving on to the Exit Game menu, which displays a confirmation that the game will close and the player will be returned to their desktop. I wanted this menu to display on top of the Main Menu with a transparent black layer that darkens everything but the exit game prompt.
I can figure out the drawing part easily enough, but the problem is that the Sprites are local to the same State that created them. I am having troubles trying to decide how to 'share' the main menu sprites with the Exit Game State.
Likewise, I have the title screen background and logo. The logo animates as well. These two Sprites are visible to every title screen State. Which means I again need some way of continuously displaying a select few Sprites until further notice, such as on entry of the main game. When I get to cutscenes, I will typically need every Sprite used by the gameplay part of the game as well.

One idea I had was to store Sprites in the State Machine as opposed to the State itself. This would mean all Sprites are visible to every State, and the current State would decide which Sprites to delete and which to keep. This means that accessing the Sprites through the State would be a little more roundabout - some sort of access function through the State Machine.

EDIT: I've started implementing the first solution but putting Sprite batches into my Game Engine. The drawback is the scope of each Sprite is not so clearly defined per-State, they need to be directly deleted by the following State to determine which Sprites to keep and delete. It does also make identifying Sprites a little more difficult on transition, though I'm thinking of implementing a std::map of strings to Sprites as I'll need a naming system for cutscene scripting anyway.

I had another idea that would involve 'inheriting' Sprite batches from the previous State but that would also complicate identification of the Sprites.

ANOTHER UPDATE: I'm thinking of getting rid of AnimatedSprite as a distinct class. It just complicates the storage part. By merging it in with regular Sprites, Sprites can be animated but don't need to, and as for the extra storage needed for animations, I'm not too concerned as almost every one of my Sprites animates in some way. With this edit I store my sprites in a vector for batching, a map for naming, and a third optional pointer in my States that optimizes some menus by directly accessing Sprites rather than using map lookup. Going to try that and see how it works out.

sentences:
How do you determine where the user wants to place a block in a 3d scene? I am still in the think-ahead-and-plan stage of a project where I'll want the player to be able to drag-out blocks - tiles but a minecraft-like 3D block-world.

So my question is: how can you determine where the user wants to place a block?

Here's a random minecraft screenshot I found on the internet:

My game will not be first-person camera; the user will be able to click anywhere to place a block.

If the user clicks on the centre of that green cross I've marked, which just misses the stonework to its right, where should the block be placed?

Technically determining the ray under the mouse cursor is trivial.

Given a ray and computing its distance / intersection with all existing block faces, and knowing the blocks that have previously been placed e.g. the last placed block, how can you 'do the right thing' with regards ambiguous movement?  What rule set can you use?

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

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

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

sentences:
Accumulating rotations for camera It seems there are three ways to store a camera's rotation: in angles, view matrix or quaternion. I was using euler angles since when I used a matrix it had a tendency to accumulate rounding errors quickly that threw off everything and quaternions would have the same problem.

The problem I've run into is how do I accumulate the rotation? When the camera is rotated, it's rotated in local space about its local XYZ axes. How would you use the given angles in a rotation to rotate about these arbitrary axes? Usually this operation is done with a matrix but it doesn't make sense to try to extract the new angles out of it.

Or perhaps I should be just storing the rotation in a matrix or quaternion? But can this be done without errors eventually causing problems?

sentences:
Quadtree vs multiple resolution grids for terrain rendering I have been thinking about quad trees with regards to terrain rendering.

From my understanding the basic functionality of quadtree terrain rendering is to frustum cull the terrain in such a manner:

function render() {
    lod_threshold++;
    if(lod_threshold_reached || !has_children()) {
        draw_terrain_mesh();
        return;
    }
    for(child in children) {
        if(child.bounds.intersect(viewing_frustum)) {
            child.render();
        }
    }
}

where node.bounds is a 3d bounds calculated as containing the maximum heightmap value of the contained terrain

My questions are the following

If we are in fact testing a 2d portion of terrain with it's bounds calculated to include the maximum heightmap value against the 3d frustum, what is the preferred bounds calculation for generating the node.bounds in the quadtree?
That a tree is necessary because that one has to iterate every portion of a 3d scene to calculate frustum occlusion in a general way. Eg, there is no shortcut algorithm to calculate the set of 3d cells generated from a 2d grid that intersect the viewing frustum. As a more general question and to question the obvious, is there a way to calculate cells in a viewing frustum without having to iterate every cell in a scene? Presumably not otherwise you wouldn't need trees for culling

With regards to an alternative grid implementation:

Has this implementation been contemplated for general purpose terrain culling? I am presuming that some form of grid base terrain culling is certainly preferred in certain games, namely top down games where the possibility of terrain in the distance of being on camera is non-existent.

function calc_cells_in_quadrilateral(frustum_projection_onto_2d_terrain_grid) {
    //calculate cells in the resulting quadrilateral projection of the frustum onto the grid without having to bounds test every cell
    //at some point based on distance from camera, assign lod
}
retrieve lod for each cell in the calculated set from lod grids
have multiple (array2 or intmap) containing the terrain data at every lod for O(1) retrieval

Is there is a way to calculate cells in a quadrilateral without having iterate every cell in a grid? eg, from shaving off cells from slopes or something?
If there is, in what fashion should one assign the lod cell based on distance? I haven't contemplated this in detail because #1 may be impossible
The terrain would not be optimally culled in this 2d culling algorithm against the quadrilateral frustum projection onto the heightmap, because the height value at the edges may be outside the screen, correct?
http://www.olhovsky.com/2011/03/terrain-started/ In this post, he describes assigning lod from a grid and from a quad tree. The illustrations are confusing with regards to whether question #1 is correct and terrain rendering with quad trees serves to draw the terrain mesh against the frustum as opposed to just as a function of distance 360 around the camera as at appears to do with his grid implementation. Please specify whether it appears that he is infact not frustum culling in the grid implementation but is frustum culling the quadtree.

sentences:
GLSL Shader not compiling (Android & LibGDX) and no log available I'm trying to get a "ripple"-shader working for OpenGL ES 2.0+ (using LibGDX).

However, I can't get it to compile, and for some reason ShaderProgram.getLog() returns an empty string even though the Shader didn't compile.

I am 100% confident that the vertex shader is correct.. here's the fragment shader (not written by me, but I modified it a bit long time ago.. when I had a desktop project - and it worked back then):

                #version 120
                precision mediump float;
                varying vec2 v_texCoords;
                uniform float time;
                uniform float alpha;
                uniform float waveLengthMultiplier;
                uniform sampler2D u_texture;
                void main()
                {
                    vec2 center = vec2(0.5, 0.5);
                    vec2 tc = v_texCoords.xy;
                    vec2 p = -1.0 + 2.0 * (tc - offset);
                    float len = length(p) * waveLengthMultiplier;
                    vec2 uv = tc + (p / len) * cos(len * 12.0 - time * 4.0) * 0.03;
                    vec3 col = texture2D(u_texture, uv).xyz;
                    gl_FragColor = vec4(col, alpha);
                }

I'm still not very well-versed with shaders, as I've used them only a little.. Like I said, getLog() returns an empty string, so I'm hoping someone spots an error in the code.

sentences:
Wall-sliding Collision Response Only Works On One Axis (2D) "sprite" is the player object, velocity is a Vec2 that tracks movement (is set to -1, 1, or 0 at any given time), each sprite in "sprites" is a wall of the same size as the player (everyone is a block for testing purposes).

if (velocity != Vec2.Zero)
{
    Vec2 oldPos = sprite.Position;
    sprite.Position = sprite.Position + velocity;
    foreach (Sprite s in sprites.Except(new List<Sprite> { sprite }))
    {
        if (sprite.BoundingBox.Intersects(s.BoundingBox))
            sprite.Position = new Vec2(oldPos.X, sprite.Position.Y);
        if (sprite.BoundingBox.Intersects(s.BoundingBox))
            sprite.Position = new Vec2(sprite.Position.X, oldPos.Y);
    }
    velocity = Vec2.Zero;
}

So, this actually works quite well - except for some reason it only works in one direction. Collisions work in both, but when sliding against a wall by holding two direction keys it only works sliding along the Y axis.

The bounding box for "sprite" is updated whenever the "Position" variable is written to via an accessor, so the bounding box is always up to date. The walls do not move, so theirs are also up to date.

At first glance, it seemed that there were a few obvious spots to check - I am modifying the bounding box for the second check, and at the time I hadn't been doing it automatically, so I tried disabling that. Doing so broke the working parts, so it wasn't that. I get no change in behavior when I add "else" to the second if statement, confirming that the first block always runs and the second block never does. If I flip them around, the other axis works instead.

I tried separating them into two foreach loops (just to see) and the behavior still remained the same. I'm kinda confused as to why none of these changes produced any hints as to the issue - it's likely something I'm overlooking, so I was hoping someone else would see.

If you need me to post any other code, just ask.

I was trying to do this in 3D and had a very bad time, so I figured I'd make a 2D version of my engine and get things sorted there before moving the collision back into 3D, heh..

sentences: Pros and Cons of making geometry not only leaf in scene heirarchy I was wondering why most game and graphics engines prefer to make geometry/mesh class only as a leaf in the scene hierarchy; more precisely they are not allowed to have children. So what are the pros. and cons of making it able to have children from performance and software design point of view?

sentences:
Using DirectX9 within Visual Studio 2012 in Windows 8? Asking the question here simply because my PC is down for the count for a while and wasn't able to stave a curiosity before that happened.

I picked up a few books about programming Games in DirectX, specifically 9.0c.

I have a Windows 8 machine, and have Visual Studio 2012, and remember a massive headache about following some of the more simple DirectX tutorials on the web as everything I could find was prior to Windows 8 when all headers and such we're available, and DirectX wasn't merged into the WindowsSDK. (I think specifically it was the absence of a commonly used DX UTILITY that was causing issues).

Before my PC went down, I wasn't able to try simply installing previous SDK's.

.. Does this work? Can one, under a Windows 8 environment with Visual 2012, install the previous DX9 SDK's and it'd work out alright? Are there going to be conflicts? How can I set this up correctly?
I'm just interested in getting going with the basics of what can be followed by the majority of the resources available today, and not so much "bleeding edge" at the moment...

Thank you in advance!

sentences:
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:
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:
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 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 handle objects with a width and height in grid-based pathfinding? I'm using the Jumper library for Love2D to do grid-based pathfinding, which worked fine until I wanted to make larger enemies (with larger collision boxes). How do i do that?

My initial idea was to make a new map for each entity that needed pathfinding I could make a new map, with all the objects scaled up in size, but that seems way to complicated.

To give an example, I could have a wall with a passageway that is wide enough that my player has no trouble walking around it, but a giant ogre would have to walk around.

sentences:
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:
What does the identity matrix really do? I understand that multiplying by the identity matrix is like multiplying by 1. Why would you multiply a matrix that will only contain the same result?

Also, I'm experimenting with some OpenGL code and found some very interesting things. Like for example:

When you use setIdentity(), the image rotates slower:

Matrix.setIdentityM(mProjectionMatrix, 0);
Matrix.rotateM(mProjectionMatrix, 0, angleInDegrees, 0.0f, 0.0f, 1.0f);

But if you try to remove the setIdentity(), the image will rotate so fast...
first it will rotate clockwise so fast, and then it will become slower until it stops and then it will begin to rotate counter clockwise, and then will stop again, then rotate clockwise.

I really don't understand how the identity matrix affects them despite multiplying by 1.

Can someone explain to me what's going on?

Here is the tutorial I am following.

sentences:
How do I make an area in the screen clickable with XNA? I am programming a penalty shoout game, my question is how make an area in the screen clickable with XNA? I know that for seeing the mouse I have to use:

this.IsMouseVisible = true;

But I want this for the direction of the soccer ball? Any ideas?

I want something like this or this but I don't find anything about this in XNA.

sentences:
Model texture flipped? Im making a custom Wavefront .obj loader and the images loads but the texture is flipped. What is the problem? here is code and a image.

std::vector<UINT> vertexIndices, uvIndices, normalIndices;
std::vector<UINT> indices(4119);
std::vector< XMFLOAT3> temp_vertices;
std::vector< XMFLOAT2 > temp_uvs;
std::vector< XMFLOAT3 > temp_normals;
std::vector< XMFLOAT3> out_vertices;
std::vector< XMFLOAT3> out_normals;
std::vector< XMFLOAT2> out_uvs;
std::vector<Vertex::Basic32> vertices( 4119);
const char *path = "C:\\Users\\terry\\Desktop\\untitled.txt";

FILE * file = fopen(path, "r");
if( file == NULL ){
    printf("Impossible to open the file !\n");
    return;
}

while( 1 ){

    char lineHeader[128];
    // read the first word of the line
    int res = fscanf(file, "%s", lineHeader);
    if (res == EOF)
        break; // EOF = End Of File. Quit the loop.

    // else : parse lineHeader

    if ( strcmp( lineHeader, "v" ) == 0 ){
    XMFLOAT3 vertex;
    fscanf(file, "%f %f %f\n", &vertex.x, &vertex.y, &vertex.z );
    temp_vertices.push_back(vertex);
    }else if ( strcmp( lineHeader, "vt" ) == 0 ){
    XMFLOAT2 uv;
    fscanf(file, "%f %f\n", &uv.x, &uv.y );
    temp_uvs.push_back(uv);
    }else if ( strcmp( lineHeader, "vn" ) == 0 ){
    XMFLOAT3 normal;
    fscanf(file, "%f %f %f\n", &normal.x, &normal.y, &normal.z );
    temp_normals.push_back(normal);
    }else if ( strcmp( lineHeader, "f" ) == 0 ){
    std::string vertex1, vertex2, vertex3;
    unsigned int vertexIndex[3], uvIndex[3], normalIndex[3];
    int matches = fscanf(file, "%d/%d/%d %d/%d/%d %d/%d/%d\n", &vertexIndex[0], &uvIndex[0], &normalIndex[0], &vertexIndex[1], &uvIndex[1], &normalIndex[1], &vertexIndex[2], &uvIndex[2], &normalIndex[2] );
    if (matches != 9){
        printf("File can't be read by our simple parser : ( Try exporting with other options\n");
        return;
    }
    vertexIndices.push_back(vertexIndex[0]);
    vertexIndices.push_back(vertexIndex[1]);
    vertexIndices.push_back(vertexIndex[2]);
    uvIndices    .push_back(uvIndex[0]);
    uvIndices    .push_back(uvIndex[1]);
    uvIndices    .push_back(uvIndex[2]);
    normalIndices.push_back(normalIndex[0]);
    normalIndices.push_back(normalIndex[1]);
    normalIndices.push_back(normalIndex[2]);
    }
}

 for( unsigned int i=0; i<4119; i++ ){
     unsigned int vertexIndex = vertexIndices[i];
     XMFLOAT3 vertex = temp_vertices[ vertexIndex-1 ];
     out_vertices.push_back(vertex);
     unsigned int normalIndex = normalIndices[i];
     XMFLOAT3 normal = temp_normals[ normalIndex-1 ];
     out_normals.push_back(normal);
     unsigned int uvIndex = uvIndices[i];
     XMFLOAT2 uv = temp_uvs[ uvIndex-1 ];
     out_uvs.push_back(uv);

 }

 for( unsigned int i=0; i<4119; i++ ){
     vertices[i].Pos = out_vertices[i];
     vertices[i].Normal = out_normals[i];
     vertices[i].Tex = out_uvs[i];
     vertices[i].Tex.y = vertices[i].Tex.y * -1.0f;
     indices[i] = i;
 }

sentences:
Need help with my on collision restart program I tried using the program

using UnityEngine;

private void OnTriggerEnter(Collider other)
{
    if (other.tag == "setting_object_tag")
    {
        Application.LoadLevel(Application.loadedLevel);
    }
}

But the OnTriggerEnter command came up with an error saying "a namespace cannot directly contain members such as fields or methods".

And the Application.LoadLevel(Application.loadedLevel); program had an error saying "application.loadedLevel is obsolete, use sceneManager to determine what scenes have been loaded".

sentences:
3DS Max equivalent to vertex weight painting I'm working in 3ds max on models for an Iphone game project and finding that using the Physique modifier is to general for rigging. When working with so few vertices I want to be able to directly tell how much weight a bone should have on a specific vertex.

Is there a 3ds max equivalent to the Softimage XSI vertex weight painting? As this would be perfect for this job.

Many thanks

sentences:
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:
How to change pre-splash image for iOS? When I launched my game on my iPad, the screen first displayed a faulty splash image with a black lower half momentarily, before displaying the normal splash image.

No matter what I tried, I couldn't get rid of this faulty 'pre-splash image'. I have tried the following:

Entered my Plus package serial number and updated my seat in Unity.
Deleted and left all splash images blank in Unity.
Checked all the LaunchScreen-XXX.png images in Xcode.
Checked the files referenced by Images.xcassets in Xcode.
Changed all the above images to a completely black image. Still, the old faulty picture would appear.
Cleared all the data and installation files on my iPad.
Deleted General > Launch Images Source.

I wonder where Xcode kept the faulty image.

I am using Unity 5.5.1 and Xcode 9.2.

Could someone please help?

sentences: Best way to load multiple TextureRegion from multiple bitmaps in AndEngine I've seen a lot of examples of AndEngine usage where some bitmaps are mapped into some TextureRegions and loaded into an Atlas. But what if I have a lot of bitmaps, where each bitmap is a sprite sheet, with several sprites for a given entity? How can I extract multiple texture regions from each bitmap and load all that into a single Atlas?

sentences:
I need help with Admob in Unity this is my first Unity project and I'm getting desperate for answers.
I've been trying to get Admob to work using the official plugin. It's been giving me a ton of problems as I can't get the banner to show, despite me using nearly verbatim code as tutorials.

Here's my code:

  using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using GoogleMobileAds.Api;

public class AdMobTest : MonoBehaviour {

BannerView banner;
InterstitialAd fullAdmob;

// Use this for initialization
void Start () {
    RequestBanner();
    ShowBanner();
}

void RequestBanner()
{
    string bannerID = "Hiding my banner ID";
    banner = new BannerView(bannerID,AdSize.SmartBanner,AdPosition.Bottom);
    AdRequest adRequest = new AdRequest.Builder().Build();

    banner.LoadAd(adRequest);
}

public void ShowBanner()
{
    banner.Show();

}

public void RequestFull()
{
    string idFull = "hiding my banner ID";
    fullAdmob = new InterstitialAd(idFull);
    AdRequest adRequest = new AdRequest.Builder().Build();

    fullAdmob.LoadAd(adRequest);
}

public void ShowfullAds()
{
    if (fullAdmob.IsLoaded())
    {
        fullAdmob.Show();
        RequestFull();
    }
    else
    {
        RequestFull();
    }
}

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

}

I have a new 2D project setup with an empty scene and an "ad" game object, and a script added to that game object. I'm expecting something to show up on my phone's screen, but nothing is showing up.
I know this may be a stupid question, but I've spent a ton of time on this, and I'm pretty new to this stuff. So please help me out!

sentences:
What kind of data structure to use for planetary populations? I am in the process of building out the prototype for my space strategy game, which is focused on empire building type gameplay.

One of the most important elements of the game are the various planets and the population groups on them. I have looked at Unity and Amazon Lumberyard before settling on Unreal Engine 4 to build the prototype on, but I am not sure what the best way to store information about the populations and planets are.

For now, planets are a class of object and store their characteristics as variables (no issue there). The problem arises with the populations, as each distinct group of population will have unique characteristics (i.e. species traits, faction alignment, education level) and game objects that they have possession of (weapons, armor, industrial machinery, trade goods).

What would be the most efficient way to tie the objects owned by the population to them, and to tie the population group to their planet of residence, such that I could compute things like:

For Faction X, on Planet Y, what is the product of their population's (Education x Industrial Machinery x Planet Mineral Rating)?

I considered implementing Population as a struct stored inside the Planet class, but that seemed problematic if I needed to move the population to a transport ship and then to a different planet, or add new groups of population during runtime.

sentences:
How does creating 2d game assets differ from regular 2d art? I've done some digital paintings and concept sketches in the past, and I was thinking about employing those skills in my game making efforts.

From an artists standpoint, what does he have to do differently/additionally to make his artwork "game ready" or "game friendly"?

Mostly I'm interested in using 2D in Unity, perhaps with an isometric view (so called 2.5D)

sentences:
How do you rotate all the objects around the camera? If I'm correct, the way that you can "look around" in an environment is that you rotate all the objects around the camera. This is the code that I've created using JavaFX 3D. So what's the algorithm?

package com.rtek.main;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.PerspectiveCamera;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.paint.PhongMaterial;
import javafx.scene.shape.Box;
import javafx.scene.transform.Rotate;
import javafx.stage.Stage;

public class Walk extends Application {
    private Group root = new Group();
    private PerspectiveCamera camera = new PerspectiveCamera();
    private CameraGroup cameraX = new CameraGroup();
    private CameraGroup cameraY = new CameraGroup();
    private CameraGroup cameraZ = new CameraGroup();
    private static final double CAMERA_INITIAL_DISTANCE = -450;
    private static final double CAMERA_NEAR_CLIP = 0.1;
    private static final double CAMERA_FAR_CLIP = 10000.0;

    public void start(Stage primaryStage) throws Exception {

        Scene scene = new Scene(root, 800, 600, true);

        buildScene();
        buildMouse();

        loadMouse(scene);

        primaryStage.setTitle("Walk Around");
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    private void loadMouse(Scene scene) {
        scene.setOnMouseMoved(event -> {
           ???
        });
    }

    private void buildMouse() {
        root.getChildren().add(cameraX);
        cameraX.getChildren().add(cameraY);
        cameraY.getChildren().add(cameraZ);
        cameraZ.getChildren().add(camera);

        camera.setNearClip(CAMERA_NEAR_CLIP);
        camera.setFarClip(CAMERA_FAR_CLIP);
        camera.setTranslateZ(CAMERA_INITIAL_DISTANCE);
    }

    private void buildScene() {
        PhongMaterial material = new PhongMaterial();
        material.setDiffuseColor(Color.RED);
        material.setDiffuseColor(Color.GREEN);

        Box cube = new Box(100, 100, 100);
        cube.setMaterial(material);

        root.getChildren().add(cube);
    }

    private class CameraGroup extends Group {
        private Rotate x = new Rotate();
        private Rotate y = new Rotate();
        private Rotate z = new Rotate();

        public CameraGroup(){
            x.setAxis(Rotate.X_AXIS);
            y.setAxis(Rotate.Y_AXIS);
            z.setAxis(Rotate.Z_AXIS);

            getTransforms().addAll(x, y, z);
        }
    }
}

sentences:
How to use quaternion on another referential I'm new on Three.js and despite a mechanical background, I can't find how quaternion works: it's like it always refers on local part referential and not the global one.

I've illustrated it here : http://jsfiddle.net/ehsktuj2/13/

function applyRotation(){
    var redRotationQuaternion = new THREE.Quaternion();
    redRotationQuaternion.setFromAxisAngle( new THREE.Vector3( 0, 1, 0 ), control.rotationSpeedRedY );
    applyQuaternion(_cubeRed, redRotationQuaternion);

    var greenRotationQuaternion = new THREE.Quaternion();
    greenRotationQuaternion.setFromAxisAngle( new THREE.Vector3( 0, 0, 1 ), control.rotationSpeedGreenZ );
    applyQuaternion(_cubeGreen, greenRotationQuaternion);
}

function applyQuaternion(cube, quaternion){
    var cubeQuaternion = cube.quaternion;
    cubeQuaternion.multiplyQuaternions(quaternion, cubeQuaternion);
    cubeQuaternion.normalize();
}

The rotation quaternion of the green box is via the vector (0,0,1) but it's not in the global referential, it's the one of the projected referential of the green cube.

How can I project the quaternion back on the global referential? So that the green cube rotates via the (0,0,1) vector of the scene?

sentences:
Map displacement transformation to texture space? I am trying to displace geometry in object space without giving the appearance of texture warping.

My idea is to displace the UV lookup by a relative amount to the geometry displacement.

Any ideas on how I can do this?

sentences:
How to capture the screen in DirectX 9 to a raw bitmap in memory without using D3DXSaveSurfaceToFile I know that in OpenGL I can do something like this

glReadBuffer( GL_FRONT );
glReadPixels( 0, 0, _width, _height, GL_RGB, GL_UNSIGNED_BYTE, _buffer );

And its pretty fast, I get the raw bitmap in _buffer.
When I try to do this in DirectX. Assuming that I have a D3DDevice object I can do something like this

if (SUCCEEDED(D3DDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackbuffer))) {
   HResult hr = D3DXSaveSurfaceToFileA(filename, D3DXIFF_BMP, pBackbuffer, NULL, NULL);

But D3DXSaveSurfaceToFile is pretty slow, and I don't need to write the capture to disk anyway, so I was wondering if there was a faster way to do this.

EDIT: I am targeting only DirectX applications. Actually DX9 apps. I am doing this through a hook to Present. (I am using Detours if that is relevant), and I am doing this for every frame. I don't need (or want) a particular bitmap format like BMP PNG JPEG etc, and a colorspace of RGB24 is OK. Getting it as YUV480p would be better but definitely not necessary. Thanks everyone for the very helpful answers

sentences: EXE-ifying custom levels/scripts/graphics/music My game is pretty much just a game-builder, where you create your own levels, scripts, graphics, music etc. and the game just loads them from a file you tell it. But how would I make it so the user could generate an exe that would just load the game files and act like a standalone game but actually be made with the game-builder thing? I'm using C++.

sentences:
3D vector graphics - maintaining correct Z 'length' So I'm trying to build myself a 3D display 'engine', or whatever it ought to be called. I've been experimenting with PyGame, as it's familiar to me.

In a way this has almost been more an excuse to learn the math than to actually build a 'game engine' or anything like that, though ultimately that's why we're all programmers right? To code the next Super Mario Brothers. :) Anyway, this isn't that, it's a learning project, but unfortunately I seem to have hit a wall and I'm not entirely sure how to proceed or what to look for.

I'm unsure of how to move items smoothly on the Z-axis. 0 is the 'closest' a point gets to the screen, whereas N is the 'furthest' it could go. In the interest of (hopefully) keeping my math similar across calculations, I've set HEIGHT, WIDTH, and DEPTH all to an arbitrary value of 600.

It would appear that moving objects along the Z-axis is not quite the same as moving them along X and Y. Whereas X and Y are just addition and subtraction, Z is apparently only really effective as a percentage. Unfortunately I can't seem to find a method of incrementing Z in any way that doesn't stretch the shapes as if they're going into Warp when I move them closer to the horizon point. Likewise they squash nearly flat as they move closer to the screen.

I believe that the two most likely code candidates for weirdness are the following two snippets; one is the model's "move all the points" method, the other is a view method. Hopefully the code I'm not sharing is self-evident; Zpt is a class that contains x, y, z coordinates, and so on.

def move_pts_to_pt(self, newX=None, newY=None, newZ=None):
##This is how the model moves its points
    oldCtr = self.center
    if newX is not None:
        deltaX = newX - oldCtr.x
    else: deltaX = 0
    if newY is not None:
        deltaY = newY - oldCtr.y
    else: deltaY = 0
    if newZ is not None:
        deltaZ = newZ
    else: deltaZ = 1
    for zpt in self.zpts + [self.center]:
        zpt.x += deltaX
        zpt.y += deltaY
        zpt.z *= deltaZ

def zshape_draw(shapelist, objcolor=(255, 0, 0), objwidth=2):
##This is the view's drawing method for points with a z coordinate
    for shape in shapelist:
        drawnpoints = []
        for zpt in shape:
            z = zpt.z
            horzoff = z / DEPTH
            invhorz = 1.0 - horzoff

            newX = (zpt.x * invhorz) + (WIDTH * HOR_X * horzoff)
            newY = (zpt.y * invhorz) + (HEIGHT * HOR_Y * horzoff)
            drawnpoints.append((newX, newY))

        pygame.draw.polygon(SCREEN, objcolor, drawnpoints, objwidth)

I apologize if I've left any code out; I'm happy to re-edit my post. In any event, I cannot suss out what it is I need to do to prevent the z-values that are closest to the 'back' of the screen from increasing much faster than those closer to the screen, while still maintaining their intended 'shape' -- that is, generally looking like they aren't changing in depth as they move from z=0 to z=600 (or, whatever ends up being 100% 'away' from the screen).

sentences:
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: What makes a path finding heuristic Monotonic vs. Non-monotonic? I am currently working on an algorithm that solves a path through the maze. So far I have implemented a Manhattan and Pythagorean Heuristic. I was wondering what makes a heuristic monotonic and how would one go about making a heuristic non-monotonic.

sentences:
What is the difference between PBR and SSR? I am very new to game development and I have been trying to understand the difference between Screen Space Reflection and Physically Based Rendering.

I have read about PBR, and from what I understand, it tries to mimic how light reflects in real life, which is it usually gets split to two components, specular and diffuse depending on the type of material.

As for SSR, pls correct me if i am wrong, it is how reflections look on a surface.

If my understanding of SSR is correct, then aren't they in a way the same? I mean, isn't the way reflections look on a surface dependent on the surface roughness and etc. This will then affect how much light is specularly reflected and how much is diffusely reflected. Again, please correct me anywhere I am wrong.

sentences:
Godot tween animation playing order I'm making a three in line game with godot, but i'm having an issue.
First time when swapping cells, the animation of swapping and the elimination of cells (in the case of making 3 or more cell aligned in a line) played both at the same time.
So i refactored a bit the code, now i have queue for each cell that manages the animation to be played one by one.
Now my problem is this, the cells that the player swaps, they do fine, the play the swap animation then the elimination animation. the problem are the other cells in the line, those get removed as the first cells are playing the swap animation first and then elimination animation.
| *              | Step 1           | Step 2          |
| cells in line  |  remove animation|   nothing       |
| swaped cells   |  swap animation  | remove animation|

in case i didn't explained well i left a more graphic description of the flow of the animation steps.
this is how i want the animation to be played
| *              | Step 1           | Step 2            |
| cells in line  |  nothing         |   remove animation|
| swaped cells   |  swap animation  | remove animation  |

I'm not sure how to solve the problem, each cell manages their animations in the queue.

sentences:
DirectX Tessellation Cracks I have the following simple patch function in DX11, but I keep getting rips, and when I look at the wireframe its clear that adjacent edges are not getting the same tessellation factor. The CalcTessFactor() function just does a distance from the camera to the point passed, so should always give the same value for the same edge center that I pass in.

PatchTess patchFunction_Far(InputPatch<VertexToPixel_Far, 3> patch, uint patchID : SV_PrimitiveID)
 {
  PatchTess pt;

 // Compute midpoint on edges, and patch center
  float3 e0 = 0.5f*(patch[0].WorldPosition + patch[1].WorldPosition);
  float3 e1 = 0.5f*(patch[1].WorldPosition + patch[2].WorldPosition);
  float3 e2 = 0.5f*(patch[2].WorldPosition + patch[0].WorldPosition);
  float3  c = (patch[0].WorldPosition + patch[1].WorldPosition + patch[2].WorldPosition) / 3.0f;

 pt.EdgeTess[0] = CalcTessFactor(e0);
  pt.EdgeTess[1] = CalcTessFactor(e1);
  pt.EdgeTess[2] = CalcTessFactor(e2);

 pt.InsideTess = CalcTessFactor©;

 return pt;
 }

My patches are triangles.

Is there something I'm doing trivially wrong here (like assuming that EdgeTess[0] is correctly assumed to be edge 0-1, rather than edge 2->0 for instance ? - its a wild guess..

sentences:
How do I make 2 players from one Class? I am teaching myself XNA and only started a few days ago. I am making a clone of Pong and have made a class for the Paddle:

I am wondering how I can create 2 paddles one for each player from the one class.

Thanks,

TeaBelliedTitch

sentences:
Can a rules engine produce manageable and complex AI? I am currently in the middle of creating an AI village simulation in Java. Having implemented a simple rules engine for dialog, I am wondering if this DSL can be extended for AI. I have previously implemented both GOAP and behavior trees, but considered GOAP to be confusing for the average user. Behavior trees may still be an option.

In this case, I expect the AI to be able to control interactions between villagers (covered within the rules system already) and to manage the goals/daily actions of both individual villagers and the village as a whole. Actions could range from gathering resources, to deciding what to build on a broader scale.

However, I have concerns about whether a rules system will be able to manage hierarchy or many complex situations. There may also be some interaction with non technical users, so understandability is important.

The rules engine as it stands currently takes in a number of facts on an event, matches it to the best rule and executes a number of actions.

The outcome of the AI needs to be sufficiently complex as to be believable; for example, there may be many competing desires to relax, work on a pressing task etc. This needs to be able to be managed and prioritized as tasks come up. A village wide AI can assign tasks to individual villagers based on their abilities and the urgency of the task. There are randomized events that can change the priority of certain tasks. My main concern is whether the rules engine will be performant, be able to schedule tasks well and be responsive to dynamic conditions.

Is a rules based engine desirable for this kind of AI?

sentences: Why calculate A* Pathfinding F Cost? I just made an A* Pathfinding system in unity that doesn't calculate the f cost (g cost + h cost) and I wondering why do u actually have to calculate the f cost? I mean my pathfinding system that works perfectly fine. Any ideas?

sentences: detect asset change while running in unity editor? Is it possible to detect asset change while running in the unity editor.  When I update my model, I see it change but the xml data associated with it does not change.  So it would be nice to detect that and reload the xml data while running in the unity editor.

sentences:
Rotate 3D object relative to the camera I really need the help of an expert. I'm trying to rotate an object in all 3 axes relative to the camera in response to the gamepad sticks. I have succeeded but with an unexpected error, depending on its orientation, the object can rotate in the opposite direction of the stick direction.
For example, if the object is on its back, when I move the stick to the left the object rotates to the left. But, when the object is facing the camera, when I move the stick to the left the object rotates to the right. The same happens in all 3 axes, on each axis I have 180 degrees with the correct stick orientation and 180 degrees with inverted sticks. Also, both the camera and the object can freely move adding more complexity to this problem.
I would like to find a way where the orientation of the rotation always follows the direction of the stick. This is solved with a minus sign applied to the angle according to the object orientation (relative to the camera) but I can't find out how.
This is the code I'm using, it works fine except for the orientation problem. Can anyone find the solution to this problem?
public void ObjectRotate(int dir, float angle) // Object is defined elsewhere
{
    var rotate = 360 * Time.deltaTime * angle;
    var target = Object.transform;

    if(dir == 1) { target.RotateAround(target.transform.position, Camera.main.transform.right,  rotate ); }
    else if(dir == 2) { target.RotateAround(target.transform.position, Camera.main.transform.up, rotate); }
    else if(dir == 3) { target.RotateAround(target.transform.position, Camera.main.transform.forward, rotate); }
}

sentences:
Replacing assets in Unity real-time but keeping the references intact I'm looking forward to adding mod support into my game by allowing users to easily replace some assets with their own versions.
The way I want it to work - if there's, say, a certain texture in some folder in my compiled game, I replace the texture with the same name in my resources, but I keep references intact. That means that the texture will be replaced for every material using this texture. I don't want to change materials themselves to reference the new texture, mainly because I'll have to keep a list of materials for each texture, and because materials might be replaced by potential modder as well. It's also important to note that I want to give people the ability to change basically anything (but scripts). Sounds, music, textures, meshes, materials, fonts, localization files, shaders, so the list of references might be absolutely changed upside down and that is absolutely not the solution.

sentences:
How do you convert angle with velocity to x velocity and y velocity? This question can be simplified to:  If you lean a pencil of a certain length at a certain angle what is the x and y position of the tip?
So, basically, I am making a game that plots a balls path through the air as it travels.  I want the user to enter an angle and velocity to launch a ball at and get the program to convert that to an x and y velocity so that it can work out how to plot the balls movement across the screen.  The x velocity doesn't change through the simulation but the y velocity will decrease constantly until the ball touches the ground again.  This is why I referenced to a pencil because it relates to turtle graphics calculations.

sentences:
Efficient per-frame constants in shaders I have some variables that stay the same during the entire frame and will be used by a large number of the various shaders I use (several dozens). These include things such as the various transforms of the camera, light source data, etc.

The main options to provide this data to all the shaders (at least that I can think of) are:

Just give each shader uniforms for the data and set all uniforms manually when they're required
Use buffers, such as

Uniform Buffer Objects
Shader Storage Buffer Objects
Buffer Textures

Which of these options is generally the most performance efficient, and why?

sentences:
Are there still favored of using bluetooth devices today in modern games for multiplayer gameplay? I was wondering. Most multiplayer gameplay always favored by Wi-fi during team-up or to compete each other. I know that when in comes in huge groups (say 100 to 500 players or more online) in online games whether it's cooperation or battle, most players relying on Wi-fi to play in very huge group.

What if some persons wants to play in small groups and can be played offline (like in racing games or fighting games for example) using smartphones via bluetooth? The question is that are there most game apps for multiplayer gameplay still favored or popular of using bluetooth when playing in a very few no. of players (let's say only two players) on a certain game?

Also, is it possible to create a game app for iPhone or any smartphones that run on Android that features bluetooth for multiplayer via Unity 3D game development software?

sentences:
How to quickly calculate the sight area in a 2D tiled game? I have a matrix of tiles, on some of that tiles there are objects. I want to calculate which tiles are visible to player, and which are not, and I need to do it quite efficiently (so it would compute fast enough even when I have a big matrices (100x100) and lots of objects).

I tried to do it with Bresenham's line algorithm, but it was slow. Also, it gave me some errors:

----XXX-        ----X**-     ----XXX-
-@------        -@------     -@------
----XXX-        ----X**-     ----XXX-
(raw version)   (Besenham)   (correct, since tunnel walls are
                              still visible at distance)

(@ is the player, X is obstacle, * is invisible, - is visible)

I'm sure this can be done - after all, we have NetHack, Zangband, and they all dealt with this problem somehow :)

What algorithm can you recommend for this?

For my needs, I'll define visible like this: tile is visible when at least a part (e.g. corner) of the tile can be connected to center of player tile with a straight line which does not intersect any of obstacles.

sentences:
What do auto handles do in AngelScript? I'm trying to figure out the purpose of the '@+' token in Angelscript, near the bottom of the page lists then as auto handles, and if I'm reading it right, then this in action would look like this:

Obj@+ ChooseObj(Obj@+, Obj@+);

void main()
{
    Obj@ A, B;

    {
        @A = new Obj();
        @B = new Obj();
    }

    // at this point A and B have a refcount of 1.
    Obj@ C = ChooseObj(A, B);
    //Let C = B, so A got decref'd and was deleted

    // this should be false, because the object's refcount was deleted,
    // but the pointer wasn't reassigned.
    if(A !is null)
    {
    //this should crash from an invalid pointer
        A.doMethod();
    }
}

Meanwhile, B got decref'd and incref'd, so it has a refcount of 1 when it gets returned, then gets addrefed again when it gets assigned to C. So C/B correctly has a value of 2, but that seems to be more a coincidence than anything.

In short I feel like I must be reading this wrong. What is it talking about?

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:
Include deprecated OpenGl "immediate mode" context in OpenGl 4? I'm working on an app that uses immediate mode in all of it's draw routines and I'd like to keep those functions intact when updating our graphics drivers to OpenGl 4.

My intention is to get the app functioning on 4.x and then convert the code to use VBOs.

I've read there's a way to load a more "full" context that includes deprecated libraries but I have not found an actual implementation to base mine off of.

sentences:
When a sprite is rotating to follow an angle, how to prevent it from reversing direction after a point? Below is a section of my code which handles a player's sprite rotating towards an angle after a user touches the screen:

touchState = TouchPanel.GetState();
Vector2 touchPosition;

if (touchState.Count > 0)
{
   touchPosition = new Vector2(touchState[0].Position.X, touchState[0].Position.Y);
   targetPosition = Math.Atan2(player.Position.X - touchPosition.X, player.Position.Y - touchPosition.Y);

if (angle_radians < targetPosition)
{
    angle_radians += 2 * fps;
}

if(angle_radians > targetPosition)
{
    angle_radians -= 2 * fps;
}

player.Angle = angle_radians * -1;
}

The problem I'm having is that when the angle goes past a certain point (I believe 3.15 radians?), the logic no longer functions correctly and the sprite reverses direction in a 360 circle until it meets the target position again.

I know there is something I'm missing from this logic, and I can see the problem, but I'm not sure how to approach handling it.

How would I prevent the sprite from reversing direction?

Thanks

EDIT: I tried the solution below but I only receive a positive number from 0-6 for angle_distance, what have I done wrong?

            if (touchState.Count > 0)
            {
                touchPosition = new Vector2(touchState[0].Position.X, touchState[0].Position.Y);
                targetPosition = Math.Atan2(player.Position.X - touchPosition.X, player.Position.Y - touchPosition.Y);
                angle_distance = targetPosition - angle_radians + Math.PI;
                angle_distance = angle_distance - Math.Floor(angle_distance / 2 / Math.PI) * 2 * Math.PI;

                if (angle_distance < 0)
                {
                    angle_radians -= 2 * fps;
                }

                if (angle_distance > 0)
                {
                    angle_radians += 2 * fps;
                }

                player.Angle = angle_radians * -1;
            }

EDIT: I now realise my mistake, correct solution is below

if (touchState.Count > 0)
                {
                    touchPosition = new Vector2(touchState[0].Position.X, touchState[0].Position.Y);
                    targetPosition = Math.Atan2(player.Position.X - touchPosition.X, player.Position.Y - touchPosition.Y);

                    angle_distance = targetPosition - angle_radians + Math.PI;
                    angle_distance = angle_distance - Math.Floor(angle_distance / 2 / Math.PI) * 2 * Math.PI;

                    if (angle_distance < Math.PI)
                    {
                        angle_radians -= 2 * fps;
                    }

                    if (angle_distance > Math.PI)
                    {
                        angle_radians += 2 * fps;
                    }

                    player.Angle = angle_radians * -1;
                }

sentences:
Why are the vertices from a mesh not transforming using a camera? I am able to use a camera class to change the view and rotation of a simple quad, so I know it works, but when I move on to a more advanced geometry, such as a mesh, I am unable to affect the transform of the object at all.  The WVP matrix does change in the mesh example (using print statements), but no movement or rotation is observed.

My camera first calls

camera.SetLens(0.33f * (float)Math.PI, Width / Height, 0.5f, 1000.0f)

on initialization, where width and height is the width and height of the window, SetLens is defined here:

public void SetLens(float fovY, float aspect, float zn, float zf)
{
  FovY = fovY;
  Aspect = aspect;
  NearZ = zn;
  FarZ = zf;

  NearWindowHeight = 2.0f * NearZ * (float)Math.Tan(0.5f * FovY);
  FarWindowHeight = 2.0f * FarZ * (float)Math.Tan(0.5f * FovY);

  Proj = Matrix.PerspectiveFovLH(FovY, Aspect, NearZ, FarZ);
}

Every frame I call Draw, and it updates the view matrix of the camera. (Draw is on the bottom of this code snippet)

public void UpdateViewMatrix()
{
  var r = Right;
  var u = Up;
  var l = Look;
  var p = Position;

  l = Vector3.Normalize(l);
  u = Vector3.Normalize(Vector3.Cross(l, r));

  r = Vector3.Cross(u, l);

  var x = -Vector3.Dot(p, r);
  var y = -Vector3.Dot(p, u);
  var z = -Vector3.Dot(p, l);

  Right = r;
  Up = u;
  Look = l;

  var v = new Matrix();
  v[0, 0] = Right.X;
  v[1, 0] = Right.Y;
  v[2, 0] = Right.Z;
  v[3, 0] = x;

  v[0, 1] = Up.X;
  v[1, 1] = Up.Y;
  v[2, 1] = Up.Z;
  v[3, 1] = y;

  v[0, 2] = Look.X;
  v[1, 2] = Look.Y;
  v[2, 2] = Look.Z;
  v[3, 2] = z;

  v[0, 3] = v[1, 3] = v[2, 3] = 0;
  v[3, 3] = 1;

  View = v;
}

private void Draw()
{
  camera.UpdateViewMatrix();
  Matrix view = camera.View;
  Matrix proj = camera.Proj;
  Matrix world = Matrix.Identity;
  Matrix WVP = world * view * proj;
  d3dDeviceContext.UpdateSubresource(ref WVP, worldViewProjectionBuffer);
  ...
 }

For the camera to make changes, I call the following functions on keypress/mouse movement

public void Strafe(float d)
{
  Position += Right * d;
}

public void Walk(float d)
{
  Position += Look * d;
}

public void Pitch(float angle)
{
  var r = Matrix.RotationAxis(Right, angle);
  Up = Vector3.TransformNormal(Up, r);
  Look = Vector3.TransformNormal(Look, r);
}

public void Yaw(float angle)
{
  var r = Matrix.RotationY(angle);
  Right = Vector3.TransformNormal(Right, r);
  Up = Vector3.TransformNormal(Up, r);
  Look = Vector3.TransformNormal(Look, r);
}

In my vertex shader I just set the position of the vertex like this:

output.position = mul(worldViewProj, position);

So again, I can get it working with a simple triangle or quad, but I need to load triangles and their connectivity from a TIN and I am able to draw the mesh on the screen but my camera operations are not translating the mesh at all. Any clues on what I might be doing wrong?  For clarification, the whole mesh should be considered one object.

sentences:
Set parent by property In the editor's hierarchy, if I drag and drop one object onto another, the second becomes the parent of the first, and moving the parent will cause the child to move. I see I can set this relationship in code by setting the transform.parent property. So I wrote a component to help with doing that from code:

public class ParentTo: MonoBehaviour
{
    public GameObject _parent;

    public GameObject Parent {
        get { return _parent; }
        set {
            this.transform.parent = value.transform;
            this._parent = value;
            Debug.Log("Set parent");
        }
    }
}

So to test it, I have 2 cubes in the scene. On cube 2 I put the ParentTo script, leaving it with no parent set, then start the game and use the editor to drop Cube 1 on that field in the inspector. According to the inspector, it seems to have been set right, but the debug statement doesn't appear in the console and moving Cube 1 doesn't move Cube 2. What am I doing wrong?

sentences:
Is my skeletal animation algorith/representation correct? I'm representing a rig (skeleton) as:

A root pivot point, with a position (Vector3) and a direction (Vector 3).
A tree of bones, where each bone is a struct with a rotation (Quaternion) and a length (Float).

I'm projecting the positions of the joints by:

Start with the root pivot point and the root bone, rotate it by bone.rotation and project it by bone.length across its new direction. The new pivot is a pair of position, direction.
Repeat for each child bone.

Is that correct?

sentences:
Why do these DirectXMath functions seem like they return column-major matrics? I know these questions have been asked a million times in various formats, but I'm getting weirdly skeptical about some of the row-major vs. column-major claims about the DirectXMath library.

If I run the following code to get a translation matrix for example:

DirectX::XMMATRIX a = DirectX::XMMatrixTranslation(1.0f, 1.0f, -1.0f));

I would expect the memory layout to look like the following (with rN indicating some row, but all the numbers contiguously in memory):

r1: 1.0   0.0   0.0   1.0      r2: 0.0   1.0   0.0   1.0     r3: 0.0   0.0   1.0  -1.0     r4: 0.0   0.0   0.0   1.0

This would correspond to the following matrix (in standard notation) where each row is stored as a contiguous array:

1.0   0.0   0.0   1.0
0.0   1.0   0.0   1.0
0.0   0.0   1.0  -1.0
0.0   0.0   0.0   1.0

Except when I look at the memory, it's the transpose of the above (i.e. the last array in memory is the last column above) which I'm to understand is "column-major" order. So, in memory, what I'm actually getting is this:

r1: 1.0   0.0   0.0   0.0     r2: 0.0   1.0   0.0   0.0     r3: 0.0   0.0   1.0   0.0     r4: 1.0   1.0   -1.0   1.0

This leaves me thoroughly confused with all the commentary and documentation around DirectXMath matrices needing to be transposed before putting them into HLSL constant buffers (of which I'm using the default column-major order). Everything states that DirectXMath matrices are stored in row-major order, but when I actually look at the memory (either as an XMMATRIX or a more direct XMFLOAT4X4) I find myself staring at a translation matrix that looks like it's been stored in column-major order.

So my confusion then lies in the fact that my transformations actually work when I don't transpose the matrices prior to putting them into the constant buffer.

Am I missing something here?

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:
Game resource timers - general implementation I'm interested in understanding how resource generation timers work on many of the mmorts type games out there. I can't wrap my head exactly around how the timers are synched with servers, especially with multiple users. If I need to provide more details, please let me know.

Thanks!

sentences:
Generating circular bounding volume / AABB for bone animated object I have the animated bounding boxes for the individual bones of an object which comes from a pre-computation of the bone's bounding boxes multiplied with the bone matrix. In this question I'm referring to the surrounding aka overall BB for the model. I get it by looping through the precomputed bounding boxes of the bones.

I'm able to get an OBB but not an AABB or circular volume because I can't get into the correct "space" for the center of the volume. I thought that getting an AABB would be very easy, but since I have the min/max points in bone space (?) I need to do some operation to disable rotation. All I can get is OBB :(

I figure that the aabbV4 vector is in "bone space". So, I have to take the inverse of that space somehow, but since I have the combined value of each bone, I need the AABB / circular volumes to follow tutorials on collision detection and not just OBB that I have now.

So, each object has multiple bones which have a bounding box which animate each frame according to a bone matrix. Then, the mvpGet() function creates the MVP matrix which moves / rotates / scales the whole thing.

I render the OBB / surrounding volume of the bones like this:

for (auto &i : myAbj.allObj)
{
    if (i->bb->val_b && i->anim->val_b)
    {
        i->aabbV4.clear();

        for (auto &j : i->bbSkelAll)
        {
            for (auto &k : i->aiGbones)
            {
                if (k.name == j.name)
                {
                    i->obbMVP = glm::transpose(k.animatedXform) * j.obbMVP; // precomputed obbMVP

                    //AABB - STEP 1 - GATHER / STORE
                    glm::vec4 bbSkelXformMin = glm::transpose(k.animatedXform) * glm::vec4(j.min, 1.f);
                    glm::vec4 bbSkelXformMax = glm::transpose(k.animatedXform) * glm::vec4(j.max, 1.f);
                    i->aabbV4.push_back(bbSkelXformMin);
                    i->aabbV4.push_back(bbSkelXformMax);

                    break;
                }
            }

            i->mvpGet();
            i->render();
        }
    }
}

 //AABB - STEP 2 - MIN / MAX
for (auto &i : myAbj.allObj)
{
    if (i->bb->val_b && i->anim->val_b)
    {
        glm::vec4 aabbMin = (i->aabbV4.empty()) ? glm::vec4(0.f) : i->aabbV4[0];
        glm::vec4 aabbMax = (i->aabbV4.empty()) ? glm::vec4(0.f) : i->aabbV4[0];

        for (uint j = 0; j < i->aabbV4.size(); ++j)
        {
            aabbMin = glm::min(i->aabbV4[j], aabbMin);
            aabbMax = glm::max(i->aabbV4[j], aabbMax);
        }

        glm::vec3 aabbSize = aabbMax - aabbMin;
        glm::vec3 aabbCenter = .5f * (aabbMin + aabbMax);
        i->aabbMVP = glm::translate(glm::mat4(), aabbCenter) * glm::scale(glm::mat4(), aabbSize);

        i->aabbTgl = 1;
        i->mvpGet();
        i->render();
        i->aabbTgl = 0;

        cout << "aabbCenter = " << glm::to_string(aabbCenter) << endl;
    }
}

sentences: How to check if two normals/directions "look at" each other? I need to flip polygons in my application. How do I determine if two vectors face each other, like in the second image below? Note that the origin of the vectors is also important, in addition to the direction.

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:
XNA 2D line-of-sight check I'm working on a top-down shooter in XNA, and I need to implement line-of-sight checking.  I've come up with a solution that seems to work, but I get the nagging feeling that it won't be efficient enough to do every frame for multiple calls (the game already hiccups slightly at about 10 calls per frame).

The code is below, but my general plan was to create a series of rectangles with a width and height of zero to act as points along the sight line, and then check to see if any of these rectangles intersects a ClutterObject (an interface I defined for things like walls or other obstacles) after first screening for any that can't possibly be in the line of sight (i.e. behind the viewer) or are too far away (a concession I made for efficiency).

public static bool LOSCheck(Vector2 pos1, Vector2 pos2)
    {
        Vector2 currentPos = pos1;
        Vector2 perMove = (pos2 - pos1);
        perMove.Normalize();

        HashSet<ClutterObject> clutter = new HashSet<ClutterObject>();
        foreach (Room r in map.GetRooms())
        {
            if (r != null)
            {
                foreach (ClutterObject c in r.GetClutter())
                {
                    if (c != null
                        &&!(c.GetRectangle().X * perMove.X < 0)
                        && !(c.GetRectangle().Y * perMove.Y < 0))
                    {
                        Vector2 cVector = new Vector2(c.GetRectangle().X, c.GetRectangle().Y);
                        if ((cVector - pos1).Length() < 1500)
                            clutter.Add(c);
                    }
                }
            }
        }

        while (currentPos != pos2 && ((currentPos - pos1).Length() < 1500))
        {
            Rectangle position = new Rectangle((int)currentPos.X, (int)currentPos.Y, 0, 0);
            foreach (ClutterObject c in clutter)
            {
                if (position.Intersects(c.GetRectangle()))
                    return false;
            }
            currentPos += perMove;
        }
        return true;
    }

I'm sure that there's a better way to do this (or at least a way to make this method more efficient), but I'm not too used to XNA yet, so I figured it couldn't hurt to bring it here.  At the very least, is there an efficient to determine which objects may be in front of the viewer with greater precision than the rather broad 90 degree window I've given myself?

sentences:
How to update libgdx scene2d Label text dynamically? I display a BitmapFont on the screen, update its text and the font is updated dynamically on the screen as well.
I seem to fail to do the same with a scene2d Label added as actor to a Stage.
The act(delta) and draw() methods are being called in the render() method.
My code basically looks as follows:

public void init() {
    Label label = new Label(text, labelStyle);
    stage.addActor(label);
}

public void update() {
    updateText(text);
}

@Override
public void resize(int width, int height) {
    /* do some resizing */
    label.setPosition(newPositionX, newPositionY);
}

@Override
public void render(float delta) {
    /* do some rendering */
    stage.act(delta);
    stage.draw();
    update();
}

Do I need to do anything other than setting the Label text, adding it to the Stage as actor, and then updating the text elsewhere? The label displays its original text, though the text updating works fine.

Thanks.

sentences:
Store and create game objects at positions along terrain I have a circular character that rolls down terrain like that shown in the picture below.

The terrain is created from an array holding 1000 points. The ground is drawn one screen width infront and one screen width behind. So as the character moves, edges are created infront and edges are removed behind.

My problem is, I want to create box2d bodies at certain locations along the path and need a way to store these creator methods or objects.

I need some way to store a position at which they are created and some pointer to a function to create them, once the character is in range. I guess this would be an array of some sort that is checked each time the ground is updated and then if in range, the function is executed and removed from the array. But I'm not sure if its even possible to store pointers to functions with parameters included... any help is much appreciated!

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:
Old Age: Decreasing stats/attributes as characters level up I just had an off the cuff idea of decreasing stats (strength/speed/stamina) as players level up.  After all, higher level characters should have higher level of challenge!  (And it's not hard to rationalize as a character aging & weakening process)

I would put a minimum on the decrease, of course, and provide items, armor, and skills to provide increased offense and defense by active actions.

I haven't seen this done in any game I can remember, though.  What are the downsides that I'm probably missing? (apart from player dis-incentivizing).

sentences:
Call code on interrupting Unity animator sub-FSM I'm trying to find a way to execute a code when one of two outcomes happens in Unity animator controller:

When animator's sub-FSM finishes or
When animator's sub-FSM is "interrupted" by a transition originating from "Any state" node at the parent FSM.

The concrete setup is next (but that is probably not super important):

The parent FSM have a transition from "Any state" to Damaged state and that can "interrupt" an attack sub-FSM: Parent FSM

The attack sub-FSM consists of three states that run in succession PreAttack -> Attack -> PostAttack: Attack sub-FSM

At the end of the attack sub-FSM a method is called. It can be through:

Animation even at the end of PostAttack animation in the sub-FSM, or
StateMachineBehaviour.OnStateExit() at the PostAttack state , or
StateMachineBehaviour.OnStateMachineExit() at the sub-FSM.

The problem is that none of these 3 is called when the sub-FSM is "interrupted" by the "Any state" transition in the parent. Is there any way to call code when a sub-FSM is "interrupted" by "Any state" transition in the parent FSM?

sentences:
Unity RTS Single Selection Problem I am trying to build an RTS game and I have managed to form a way to select a unit using Raycast and the tag system. I made it so that if the object the ray falls onto is of tag "TankUnit" Make so and so variable true and allow it to move to another place. However, Units of the same tag even when not selected also move. How do I fix this problem? The script is bound to each unit.

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

public class UnitController: MonoBehaviour { bool clicked = false; //public float speed = 10f; //public float rotationSpeed = 10f;

 public LayerMask groundLayer;
 public NavMeshAgent playerAgent;
 // Update is called once per frame
 void Update()
 {
     if (Input.GetMouseButton(0))
     {
         Debug.Log("Clicked");
         FindClickPos();
     }
     if (Input.GetMouseButton(1) && clicked == true)
     {
         Debug.Log("I clicked right mouse");
         Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         RaycastHit hit;
         if (Physics.Raycast(ray, out hit))
         {
             MoveTo(hit);
         }
     }
 }
 private void FindClickPos()
 {
     RaycastHit hitInfo = new RaycastHit();
     bool hit = Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hitInfo);
     if (hit == true)
     {
         Debug.Log("I hit " + hitInfo.collider.name);
         if (hitInfo.collider.tag == "TankUnit")
         {
             Debug.Log("I hit" + hitInfo.collider.tag + "!");
             clicked = true;
         }
         else
         {
             Debug.Log("I didnt hit a unit :/");
             clicked = false;
         }
     }
     else
     {
         Debug.Log("I didnt hit anything...");
         clicked = false;
     }
 }
 void MoveTo(RaycastHit hit)
 {
     Debug.Log("Position: " + hit.point);
     playerAgent.SetDestination(hit.point);
 }

}

sentences:
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: 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: So, I need to create varied animal textures for my game. How would I go about doing that? For example, one of the creatures planned is an isopod like animal. Would I need to get pictures of real animals and adjust them to my needs?

sentences:
Elements of a widget blueprint do not appear if I click on simulate I made a widget that contains 2 minimaps and 2 texts related to a character's variables.

When I click the play button (Selected Viewport) everything happens fine:

Focus where I circled in pink.

It turns out that when I click the Simulate button, these two texts do not appear, but the minimaps do:

I did a test by first clicking the play button (Selected Viewport) and then I ejected the character (which for me is the same thing as simulating, except without closing and opening the game) and the texts appeared, so my problem is only when I'm done start simulating.

I would like to know how to make these 2 texts appear even if I click on simulate instead of play.

sentences: libgdx collision/picking I am trying to make something with java libgdx (2D). One thing that I can't figure it out is how to check mouse intersection with (fore example) isometric textures that are not rectangle shaped images. I found something about pickingColorPicking algorithm in libgdx, but I can't find any docs about how to use it. Any ideas?

sentences:
Smooth movement from point A to point B in a tile-based game I'm currently very new to XNA, and I'm trying to get a grasp on movement. Currently, I have a function that checks for keypresses, and moves my character from point A to point B instantly:

private KeyboardState currentKeyboardState;
private KeyboardState previousKeyboardState;

...

public void CaptureKeyboardInput()
{
    currentKeyboardState = Keyboard.GetState();

    // Move the character's sprite to the left on the screen. The movement
    // distance is determined based on the scale of the sprite texture.
    if (currentKeyboardState.IsKeyDown(Keys.A) && previousKeyboardState.IsKeyUp(Keys.A))
    {
        Position += new Vector2(-Scale.X, 0);
    }

    // Move the character's sprite to the right on the screen. The movement
    // distance is determined based on the scale of the sprite texture.
    if (currentKeyboardState.IsKeyDown(Keys.D) && previousKeyboardState.IsKeyUp(Keys.D))
    {
        Position += new Vector2(Scale.X, 0);
    }

    // Move the character's sprite upwards on the screen. The movement
    // distance is determined based on the scale of the sprite texture.
    if (currentKeyboardState.IsKeyDown(Keys.W) && previousKeyboardState.IsKeyUp(Keys.W))
    {
        Position += new Vector2(0, -Scale.Y);
    }

    // Move the character's sprite downwards on the screen. The movement
    // distance is determined based on the scale of the sprite texture.
    if(currentKeyboardState.IsKeyDown(Keys.S) && previousKeyboardState.IsKeyUp(Keys.S))
    {
        Position += new Vector2(0, Scale.Y);
    }

    previousKeyboardState = currentKeyboardState;
}

While this works, it looks very unclean, and feels unnatural as well. Ideally, I'd like to move it from point A to B at a certain speed. I've already looked around, and I've found this question, but I couldn't figure out how to implement it correctly. How can I implement smooth movement from point A to B in my tile-based game with what I have?

sentences:
How can I determine the first visible tile in an isometric perspective? I am trying to render the visible portion of a diamond-shaped isometric map.
The "world" coordinate system is a 2D Cartesian system, with the coordinates increasing diagonally (in terms of the view coordinate system) along the axes. The "view" coordinates are simply mouse offsets relative to the upper left corner of the view.

My rendering algorithm works by drawing diagonal spans, starting from the upper right corner of the view and moving diagonally to the right and down, advancing to the next row when it reaches the right view edge. When the rendering loop reaches the lower left corner, it stops.

There are functions to convert a point from view coordinates to world coordinates and then to map coordinates.

Everything works when rendering from tile 0,0, but as the view scrolls around the rendering needs to start from a different tile. I can't figure out how to determine which tile is closest to the upper right corner.

At the moment I am simply converting the coordinates of the upper right corner to map coordinates. This works as long as the view origin (upper right corner) is inside the world, but when approaching the edges of the map the starting tile coordinate obviously become invalid.

I guess this boils down to asking "how can I find the intersection between the world X axis and the view X axis?"

sentences:
Batch blit vs separate blit A tutorial that I have followed had me collect and blit all of my sprites with the following lines:

allsprites = pygame.sprite.RenderPlain((l_sprites))
allsprites.draw()

At the moment, this is fine for me, as all of my sprites make use of the same base image.
However, I find myself in need of having various sprites animated, some changing, and some going to a basic colored rectangle.

My question is if this batch drawing method is still viable when all of my sprites are in flux.  My previous experience has been in straight C with SDL, and normally I would simply roll my own update loop.

sentences:
How to not render what is behind object? I am working on a 3d project using openGL. I am looking for a way to optimize my renderings.
Is there a way to tell if an object is behind another object and thus not visible to not waste time rendering it ?
I am already working on a frustrum culling implementation to not display what is not visible because out of the viewing frustrum, but I didn't find a way to know if an object in located behind another object.
Can any of you help me about this, please ?

sentences:
Robust Architecture for Flash Games? What's a good architecture for Flash games? I've read that MVC is great, with symbols just used purely for views (set states, use the class to manage which state/frame to show).

I would presumably then stick all my code in one or more .AS files, use object-oriented programming, try to unit test whatever I can, and make my art and symbols purely view-state stuff with no code.

Has anyone tried this? On anything other than a small game? How do these big flash RPGs and MMORPGs architect their games?

sentences:
Rotate/Translate object in local space I am just trying to create a movementcontroller class for game entities. These class should  transform the entity affected by the mouse and keyboard input. I am able to calculate the changed rotation and the new globalPosition. Then I multiply:

 newGlobalMatrix = changedRotationMatrix * oldGlobalMatrix;
 newGlobalMatrix = MatrixSetPosition(newPosition);

The problem is that the object rotates around the global axis and not around the local axis.

I use XNAMath for the matrix calculation.

sentences:
Letter game board creation I currently have a game concept similar to the mobile app Alphabetty where you are given a grid of letters and are tasked with spelling words. When you use a letter in a word, it disappears and new letters fall in from the top to replace the used ones.

I have been playing around with ways of making the new letter spawning more "interesting" so that players can get more complex words. I tried making it so each letter spawns based on how common it is, kind of like scrabble but didn't get great results. I have also tried representing each grid tile as a Boggle die which re-rolls each time its used, which was better but far from perfect.

The main issues are:

Vowels and consonants often end up grouped together, creating unusable areas on the board. This also goes for letters of the same type (i.e. 3 s letters side by side)
With Boggle dice it's very hard to spell words like "Blizzard" as only 1 or 2 dice have rare letters such as z, v, and k etc
For the sake of a game mode, I need to be able to seed the grid with words of my choosing slowly (i.e. as new letters fall in) so that players have the ability to spell these special words if they are particularly careful

Are there any solutions, theories or discussions out there that could help?

Thanks!

sentences:
Discrete movements in Phaser What is the best approach to let a Phaser.Sprite do discrete movements?

It should continue moving along all possible values, but at the end of a move it must end up on a certain position which will have the following property: position.x % SOME_FIXED_VALUE = 0 and position.y % SOME_FIXED_VALUE = 0

sentences:
OpenGL: Attempt to allocate a texture too big for the current hardware I'm getting the following error:

  java.io.IOException: Attempt to allocate a texture to big for the current hardware
    at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:320)
    at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:254)
    at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:200)
    at org.newdawn.slick.opengl.TextureLoader.getTexture(TextureLoader.java:64)
    at org.newdawn.slick.opengl.TextureLoader.getTexture(TextureLoader.java:24)

The image I'm trying to use is 128x128.

System.out.println(GL11.glGetInteger(GL11.GL_MAX_TEXTURE_SIZE));

I get: 32.

32??!! My graphics card is AMD Radeon HD 7970M with 2048 MB GDDR5 RAM, I can run all the latest games in 1080p and 60fps with no problem, and those textures sure as hell doesn't look like they are 32x32 pixels to me!

How can I fix this?

--

Edit: Here's the chaos code I use to init OpenGL:

Display.setDisplayMode(new DisplayMode(500,500));
Display.create();
if (!GLContext.getCapabilities().OpenGL11) {
    throw new Exception("OpenGL 1.1 not supported.");
}
Display.setTitle("Game");
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
GLU.gluPerspective(45, 1, 0.1f, 5000);

Mouse.setGrabbed(true);

glMatrixMode(GL_MODELVIEW);

glLoadIdentity();
glEnable(GL_TEXTURE_2D);
glClearColor(0, 0, 0, 0);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glEnable(GL_POINT_SMOOTH);
glEnable(GL_LINE_SMOOTH);
glEnable(GL_POLYGON_SMOOTH);
glEnable(GL_POLYGON_OFFSET_FILL);

glShadeModel(GL_SMOOTH);

Display is a LWJGL thing, it makes the OpenGL context and the window.

Anyway, I don't think there's anything in the init code that can help me but you never know...

sentences:
How should I handle different aspect ratios in a fullscreen game? I am creating a game using C#, GDI+ and Raster images (2D images).  For performance sake, I believe that I should have the game change the user's resolution to 800 x 600 and run the game in that setting.  However, the graphics look distorted in a wide screen since the aspect ratio for 800 x 600 is different than from a wide screen.  I cannot figure out how to determine the aspect ratio.

How is game programming normally handled on different resolutions?  Should I even change the user's resolution?  If I dont change the resolution, the game slows down a lot.

Also, some wide screens will "maintain the aspect ratio" when changing the resolution to 800 x 600 (thus creating black bars on the right and left) and some wide screens will fill up the entire screen.  How do people handle that situation??

sentences: Do you have to rewrite Corona SDK apps for different devices? I am using the trial windows edition of Corona, but I want to develop for iOS - the windows version only supports android, so my question is will I have to rewrite any parts of my application for iOS based devices?

sentences:
When and where and how to turn on back the Player first person when loading a scene on button click ? In the Build Settings I have two scenes at index 0 and index 1:

Then in the Hierarchy I have the two scenes:
The active scene is the MainMenu:

In the StartGameButton I added to it a script component.
In the script:

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

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

And this is the StartGameButton Inspector:

I dragged the script on the OnClick
I selected the function LoadSceneOnClick
And set the index to 1

When the game start and I click on the button it stay on the Main Menu scene and not loading anything.

The problem I guess is that I'm getting error in the game No cameras rendering:

The problem is that when I'm running the game and it start from the main menu scene in the space station scene I'm enable false the Player and the Player is a first person character with a camera:

You can see in the Inspector that the Player is unchecked the Player is not enabled. If I will enable the Player and even if the main menu scene is the active one it will show me the player and the player camera and not the main menu. So I had to turn off the Player.

The question now is where by script do I enable back the Player when it's loading the scene ?

Inside the LoadSceneOnClick script ?

sentences:
How do I avoid pathfinding characters getting stuck in corners? I used A* pathfinding to return a list of Tiles to get from an enemy to the player. After that, I wasn't sure how to actually move the enemy.

What I ended up doing was get the first Tile in the path. Then, check all 8 directions from the enemy's current tile. If the path tile is in the enemy tile's adjacent bottom square, move like this. If it's the right square, do that, etc. When the tile of the enemy is the same as that tile in the path, remove it from the path, and repeat for the next one.

This works, except my character sometimes gets caught around corners. This is because it thinks it should be moving horizontally (the next tile in the path is above it) when it's actually more of a diagonal movement to actually get to it.

I need to know two things:

Is there a better way I should do the movement after calculating the tiles in the path?
What are some ways to deal with the corners and diagonals? I was thinking perhaps some sort of random movement, but it's kind of janky. In the end, don't care how silly it is as long as the enemy doesn't get stuck!

Really new to all of this, so would appreciate some advice!

sentences: How can I remove Unity Hub in Ubuntu? I installed Unity Hub 1.4.0 and it works well. For now I want to update the version of Unity. I need to install hub 2.0.0. But when I download the 2.0.0 hub and intsall it always link to 1.4.0 and I want the version Unity 2019.1.10f1. I can't find some uninstall files. How can I remove Hub 1.4.0?

sentences:
How do I implement a flashlight in SDL2? I'm a beginner trying to implement a flashlight in SDL2, but can't figure out a good way to do it.

I've found a way to manipulate the background's color; changed it to dark and back to its normal colors, but this isn't the whole solution.

My main goal is a flashlight that follows the player around the map.

I thought about per-pixel drawing, but I think it will result in poor performance. Drawing a black pixel for every pixel on screen, then changing back the to the normal color to all of the pixels surrounding the player.

How do I do this correctly?(BTW, I'm using a 'SDL_Renderer', not 'SDL_Surface', i realized this can be a problem when dealing with pixels.)

sentences:
How to draw a diagonal sine wave line renderer I'm trying to use a LineRenderer component to draw a sine wave from point A to B and I'm using mouse position. However what I did so far is not working as expected, it just draws a sine wave along the x-axis and it's not diagonal.

private void Update()
{
    if (Input.GetMouseButtonDown(0))
    {
        Vector3 newPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        newPos.z = 0;
        CreatePointMarker(newPos);
        GenerateNewLine();
    }
}

private void CreatePointMarker(Vector3 pointPosition)
{
    Instantiate(linePointPrefab, pointPosition, Quaternion.identity);
}

private void GenerateNewLine()
{
    GameObject[] allPoints = GameObject.FindGameObjectsWithTag("PointMarker");
    Vector3[] allPointPositions = new Vector3[allPoints.Length];
    var pointList = new List<Vector3>();
    for (int i = 0; i < 50; i ++)
    {
        var dir = allPoints[0].transform.position - allPoints[1].transform.position;
        float x = dir.x * i;
        float y = Mathf.Sin(x * Time.time);
        var sine = new Vector3(x, y, 0f);
        var tangentLine = allPoints[0].transform.position + sine;
        pointList.Add(tangentLine);
    }
    SpawnLineGenerator(pointList.ToArray());
}
private void SpawnLineGenerator(Vector3[] linePoints)
{
    GameObject newLineGen = Instantiate(lineGeneratorPrefab);
    LineRenderer lRend = newLineGen.GetComponent<LineRenderer>();

    lRend.positionCount = linePoints.Length;
    lRend.SetPositions(linePoints);
}

sentences:
How to apply toastr notifications when user get leveled up? This question is about when user get leveled up the toastr will pop up.

What I want to do is i want to put the toastr.js inside my script but I don't have idea how to implement.

** Link and Script **

<link rel="stylesheet" href="{{ asset("css/toastr.min.css") }}">
<script src="{{ asset('js/toastr.min.js')}}"></script>

** Profile.blade **

 <script>
   @if(Session::has('success'))
    toastr.success("{{ Session::get('success') }}")
   @endif
 </script>

** Controller **

         use Session;

          while($user->curr_exp >= $user->exp_needed){
             if($user->level == 10 || $user->level == 15 || $user->level == 20)
               {
                  $user->reward_token += 1;
               }
                  $user->curr_exp -= $user->exp_needed;
                  $user->prev_exp = $user->exp_needed;
               if($user->level <= 19){
                   $user->exp_needed = $user->prev_exp * 1.4;
               }
               elseif($user->level >= 20 && $user->level <= 39){
                   $user->exp_needed = $user->prev_exp * 1.1;
               }
               elseif($user->level >= 40 && $user->level <= 59){
                   $user->exp_needed = $user->prev_exp * 1.05;
               }
               elseif($user->level >= 60 && $user->level <= 79){
                   $user->exp_needed = $user->prev_exp * 1.04;
               }
               elseif($user->level >= 80 && $user->level <= 99){
                   $user->exp_needed = $user->prev_exp * 1.03;
               }
               elseif($user->level == 100){
                   $user->exp_needed = $user->exp_needed * 0;
               }
                   $user->level += 1;
                   Session::flash('success','You leveled up!');
                   $user->save();
               }

I'm using laravel framework 5.4.36 version. I'm confused how to display a live notifications on the user's profile every time they leveled up.

Any ideas? Thank you

sentences:
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: Is there a way to make GUI.SelectionGrid expand horizontally I am working on an inventory system, And I want to be able to make a Selection Gird that expands horizontally rather than vertically, is there an easy way to do this? Or will I have to create my own version of SelectionGrid?

sentences:
GraphicRaycaster on the child object containing buttons blocks Raycast from the parent object containing GraphicRaycaster. How to solve it? What I'm trying to achieve is to detect clicks on buttons in UI. Here is the tree:
I have a parent object SlotMachineScreen containing GraphicRaycaster with a script detecting clicks attached to it:
if (Input.anyKeyDown)
        {
            //Set up the new Pointer Event
            m_PointerEventData = new PointerEventData(null);
            //Set the Pointer Event Position to that of the mouse position
            m_PointerEventData.position = Input.mousePosition;

            //Create a list of Raycast Results
            List<RaycastResult> results = new List<RaycastResult>();

            //Raycast using the Graphics Raycaster and mouse click position
            m_Raycaster.Raycast(m_PointerEventData, results);
            foreach (RaycastResult result in results)
            {
                Debug.LogWarning("Hit " + result.gameObject.name);
            }
        }

And there are a bunch of child objects with a GraphicRaycaster (red ones) with buttons in it, that I want to detect a click on. But there is no response from my sprit at all when I click on them.
I found one solution so far, but its not what I need: the solution is to move all buttons from child containers to SlotMachineScreen.
Are there any different ways to solve this problem?

sentences:
How can I create a tunnel/parallax/depth effect based on mobile device tilting? I would like to create applications similar to what's displayed in these videos:

VR Tunnel Live Wallpaper for Android
The parallax view Part 1

These mobile application are supposed to react to tilting of the phone, so I created a few 3D objects for this purpose in Blender (one similar shape - 2nd link), but I do not know how to move the back of this object in Unity because I am a beginner.

Can you give me some tips on how to figure this out? I’m not talking about a ready solution or something, I just do not know how to ask a specific question and I do not know what to do next.

sentences:
Storing a List to PlayerPrefs Not Working I have a test database of 37 records and I have stored each column into a list and I am storing each record into PlayerPrefs.

void storeStarData()
{
    // Code to store star data in PlayerPrefs...
    PlayerPrefs.SetInt("totStars", NumOfStars);
    int i = 0;
    while (i < NumOfStars)
    {
        PlayerPrefs.SetString(("starID" + i), StarIDID[i]);
        PlayerPrefs.SetString(("starName" + i), StarName[i]);
        PlayerPrefs.SetString(("starHIP" + i), StarIDHIP[i]);
        PlayerPrefs.SetString(("starHD" + i), StarIDHD[i]);
        PlayerPrefs.SetString(("starHR" + i), StarIDHR[i]);
        PlayerPrefs.SetString(("starGL" + i), StarIDGL[i]);
        PlayerPrefs.SetString(("starBF" + i), StarIDBF[i]);
        PlayerPrefs.SetString(("starRA" + i), StarRA[i]);
        PlayerPrefs.SetString(("starDec" + i), StarDec[i]);
        PlayerPrefs.SetString(("starMag" + i), StarMag[i]);
        PlayerPrefs.SetString(("starCI" + i), StarCI[i]);
        PlayerPrefs.Save();
        i++;
    }
    PlayerPrefs.Save();
    Debug.Log(PlayerPrefs.GetString("StarID0"));
    Debug.Log(PlayerPrefs.GetString("StarID1"));
    Debug.Log(PlayerPrefs.GetString("StarID2"));
    Debug.Log(PlayerPrefs.GetString("StarID3"));
    startSimulation();
}

First record in list StarIDID[0] = 1
Last record in list StarIDID[36] = 37

At the end, I've added 4 Debug.Logs that return the IDs of the first 4 stars. For some reason, only the first StarIDID is being stored into Player prefs.

Here is the output of the Debug.Log:

As you can see, StarID0 is the only PlayerPref with a valid value stored, the other ones don't have any values stored in them for some reason.

Is there a way to fix this and am I doing anything wrong here?

sentences:
How to debug Android App Eclipse? Ok. So while this isnt a programming question. I wanted to know how do people debug apps? How do you view log cat, and where these exceptions are thrown etc? And do I need to run the app on the emulator to see all the stuff, or is there a way to view this after running the app on my phone(while not being connected to the computer)

Links to plugins and tips would be really helpful, as im gonna start work on my next game, and while the first one works fine, had a lot of problems while debugging.

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

How can I render them as a Texture with transparency?

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

sentences:
storing game options in java I'm making a game using java. I'm wondering what would be the best way to store games options (like screen height and width, full screen boolean and many other similar options the user can select) at run time?

Currently, I read the options from a text file so everything that comes out of the reader is a string. I would like to add the value of the string to the appropriate variable in as few steps as possible. I would also avoid having to code getters and setters for all variables there is and have a general getter and setter that takes the name of the option as a parameter.
ex:

    public void set(String name, Object value){
        options[name] = value;
    }

    public Object get(String name){
        return (Object options[name]);
    }

I was thinking about a hashmap of variable names and values but the problem is: not all variables are of the same type, I'll have ints and doubles and booleans. so what would be the best way to store all those different variable types and access them with general calls? Should I leave them as Object and cast them as I need to use them? Or do i really have to set them all manually in my code (which would be quite the hassle should i decide to add more options down the line)?

UPDATE: So, here's the code i got so far for serialization but still not working:

Options.java:

public class Options implements java.io.Serializable{

//Final variables declaration
static transient final String SAVE_DIR = System.getProperty("user.dir") + "\\res\\saves\\";
static transient final String OPTION_FILE = "options.ser";

//Static variables declaration
public int s_width;
public int s_height;
public float fov;
private static transient Options instance;

private Options()
{
    this.s_width = (this.s_width == 0)? 800 : this.s_width;
    this.s_height = (this.s_height == 0)? 600 : this.s_height;
    this.fov = (this.fov == 0)? 60 : this.fov;
}

public static Options GetInstance()
{
    if(instance ==  null)
        instance = new Options();
    return instance;
}

Serializer.java:

public class Serializer {
private static Options o = Options.GetInstance();

    public static void loadOptions()
    {
        File dir = new File(Options.SAVE_DIR);
        if(dir.exists())
        {
            File file = new File(dir + "\\" + Options.OPTION_FILE);
            if(!file.exists())
            {
                saveOptions();
            }

            try {
                FileInputStream fileIn = new FileInputStream(file);
                ObjectInputStream in = new ObjectInputStream(fileIn);
                o = (Options) in.readObject();
                in.close();
                fileIn.close();
            } catch (IOException | ClassNotFoundException e) {
                e.printStackTrace();
            }
        }
        else
        {
            dir.mkdir();
            saveOptions();
        }
    }

    public static void saveOptions()
    {
        File dir = new File(Options.SAVE_DIR + "\\" + Options.OPTION_FILE);
        try {
            if(!dir.exists())
            {
                dir.createNewFile();
                o = Options.GetInstance();
                System.out.println("otpion.ser created and initialised succesfully!");
            }
            FileOutputStream f = new FileOutputStream(dir);
            ObjectOutputStream out = new ObjectOutputStream(f);
            out.writeObject(o);
            out.close();
            f.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

sentences:
OpenGL Fragment Shader Interpolation Vs Inverse Calculation I have found openGL fragment shader tutorials on the web, some that use use inverse calculations to revert the fragment coordinate back to the world space and others that interpolate the position.  With that said...

Is there a difference between interpolated world-space position and the actual world space position calculated using inverse matrices and the fragment window space coordinates?
Does anyone know of any resources that would help me understand the mathematical differences between these two things, if they are different?
If they aren't different, then why would anyone use inverse matrices instead of interpolating, which seems less expensive?

I wrote a shader to test 1, but I cannot tell if rounding errors are to blame for the differences or not.

Thanks!

sentences:
How to change transform.position code to Rigidbody.AddForce? 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;

That's how i do my movement, but i need to change it to Rigidbody.AddForce 'cause the way that i use right now makes my character doesn't collide with objects perfectly.

Note: What i mean with "perfectly" is, if you walk to the corner of walls, you can pass through it and that's the thing that i want to prevent.

sentences:
Simple networking, now that UNet is deprecated I'm prototyping a two-player typing game in Unity. I don't have any experience making multiplayer games, so I'm not sure how to best approach the netcode.

For this game all I think I really need is an API for sending messages to and from a server - the two clients only care about what the other one is typing, and there isn't any gameplay that's even remotely related to physics. Looking into UNet, it seems like the parts based on synchronizing game objects do more than my game needs, but the messaging stuff from the HLAPI seems like a good fit. That said, this is a real time game, so low latency is ultimately more important than any API style considerations.

The wrench, however, is that Unity is deprecating UNet without shipping any replacements. I'd start working with HLAPI, but I don't want to have to replace all of the networking code down the line or even have to shut down the game when Unity's servers go down, if that's what will happen after using HLAPI.

So as a beginner to multiplayer development, with relatively low API requirements, where do I go when Unity multiplayer is in flux? Should I learn the DOTS-Netcode mentioned in this recent blog post? Should I go with a third party solution like Photon? Or will the HLAPI be sufficient, even post-deprecation?

sentences:
Vector math to calculate the rotation and drift of a tectonic plate? I've been following the excellent Experilous procedural planet generation post, trying to recreate it in Java using libGDX. My planet is simpler, as it lacks any distortion of the mesh. It's just hexagons and 12 pentagons right now. However, I've been running into trouble at the part:

The next step was to take the motion of plates and calculate the type and degree of stress at each point along the boundaries between the plates. For each point, I calculated the movement of each plate at that particular position. Subtracting the two gave me the relative movement. I then determined the component of that movement that exactly perpendicular to the plate boundary at that location. This corresponded to the amount of relative movement that was directly pushing the plates into each other or pulling them directly away. This I classified as pressure, and it could be either positive (collision) or negative (separation). I also determined the relative movement that was parallel to the boundary and stored this as shear. (Only the magnitude of this movement was relevant, so shear was strictly non-negative.)

The picture is the example of each tile's motion following this calculation of drift and spin for the tectonic plates. However, the math to actually calculate this completely escapes me. Given that I have the tiles grouped into tectonic plates, a random center (of a tile) for each plate, the center of every tile, and the normal vector of every tile, how could I achieve the same effect depicted here?
Thank you.

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:
NavMesh - Changing Mesh by Jumping upwards I have been playing around with the NavMesh and I have seen that there are different situations where an agent has to change meshes.

When it works:

Everything seems to work alright with links, if I try to make the agent jump from a mesh to another one, tweaking the "Jump distance" paramenter

Another scenario is when the agent needs to fall to another mesh to reach the target. This one also works, when I tweak the "Drop height" parameter.

When it does NOT work

But there are 2 different scenarios, where the agent cant reach the target. The first one is when the agent must jump upwards instead of dropping.

And the other scenario is when the agent needs to fall to another mesh that is not directly below the one he is standing on.

How could I do so that the agent jumps either to move upwards, or to land in a lower mesh?

sentences:
Getting scene normals in Unity When I get the depthnormals with the shaderreplace script, it just replaces all the shaders in the scene and uses the meshes geometry to calculate the normals, ignoring the normalmap textures applied on them.

How can I get the final rendered scene normals to a rendertexture like it appears in the editor windows normal debug mode that is used for deferred light calculations and ambient occlusion and such ?

sentences:
Adding Animation to Object—Unexpected Behavior I've been following the Unity 2D roguelike tutorial and I'm a bit confused about something. When he drags a series of sprites to his player object, a dialog box appears that prompts him to name and choose a location for his animation. I have seen this behavior in a couple video tutorials now.

When I do this, it simply creates the animation and animation controller in the sprite folder and nothing more. This becomes a bit tedious after a while and I'm not sure these animations are being associated with the object correctly.

What am I doing wrong?

sentences:
Loading texturecube using DirectXTK DDSTextureLoader I've been trying to implement a skybox for some time now and there's probably only a tiny problem left to solve. When I load a texture using DirectXTK's CreateDDSTextureFromFileEx with a TEXTURECUBE flag, the resulting shader resource has its view dimension set to Texture2D and not TextureCube, which means I can't treat it as a TextureCube in HLSL. Also the file I'm loading contains all six faces. Here's the code where the texture is loaded:

// Loading the texture
HRESULT hr = DirectX::CreateDDSTextureFromFileEx(device, filename, 0, D3D11_USAGE_IMMUTABLE, D3D11_BIND_SHADER_RESOURCE,
    0, D3D11_RESOURCE_MISC_TEXTURECUBE, false, &texture, &mSkyboxSRV);

This is the error message being output by DirectX:

D3D11 ERROR: ID3D11DeviceContext::Draw: The Shader Resource View dimension declared in the shader code (TEXTURECUBE) does not match the view type bound to slot 0 of the Pixel Shader unit (TEXTURE2D).  This mismatch is invalid if the shader actually uses the view (e.g. it is not skipped due to shader code branching). [ EXECUTION ERROR #354: DEVICE_DRAW_VIEW_DIMENSION_MISMATCH]

I've also tried this:

ID3D11Texture2D* texture = nullptr;

HRESULT hr = DirectX::CreateDDSTextureFromFileEx(device, filename, 0, D3D11_USAGE_IMMUTABLE, D3D11_BIND_SHADER_RESOURCE,
0, D3D11_RESOURCE_MISC_TEXTURECUBE, false, (ID3D11Resource**)&texture, nullptr);

D3D11_TEXTURE2D_DESC texDesc;
texture->GetDesc(&texDesc);

D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;

srvDesc.TextureCube.MipLevels = texDesc.MipLevels;
srvDesc.TextureCube.MostDetailedMip = 0;
srvDesc.Format = texDesc.Format;
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE;

hr = device->CreateShaderResourceView(texture, &srvDesc, &mSkyboxSRV);

But that gives me an error message saying the texture's view dimension and the srv's view dimension are not the same:

D3D11 ERROR: ID3D11Device::CreateShaderResourceView: Resources created without D3D11_RESOURCE_MISC_TEXTURECUBE may not be treated as cubemap ShaderResourceViews. [ STATE_CREATION ERROR #126: CREATESHADERRESOURCEVIEW_INVALIDDESC]

Does anyone have any ideas on what to do? Any help is much appreciated!

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:
Cocos2d-x how to draw in specific free form area Here https://github.com/mikeccy/cocos2dx-finger-paint/blob/master/Classes/HelloWorldScene.h and https://github.com/mikeccy/cocos2dx-finger-paint/blob/master/Classes/HelloWorldScene.cpp you can see how a Sprite is being rendering in RenderTexture. What I want to add to this to make visible only the specific part in RenderTexture (canvas). I.e. I should apply a free form mask on it to be able to draw in a specific free form area.

How to do this in cocos2d-x 3.2?

sentences:
To what extent are video game bots & NPCs “artificial intelligence”? Wikipedia says:

  In video games, this usually means a character controlled by the computer through artificial intelligence.
  ~https://en.wikipedia.org/wiki/Non-player_character

  In video games, a bot is a type of weak AI expert system software which for each instance of the program controls a player [...]
  ~https://en.wikipedia.org/wiki/Video_game_bot

However as far as I know such bots & NPCs are way too hard-coded or explicitly coded to be accurately called "artificial intelligence".

Mainly most often they lack the ability to learn dynamically from the player. Arthur Samuel calls "artificial intelligence" The "field of study that gives computers the ability to learn without being explicitly programmed" (1959).

So to what extend can bots and/or NPCs be called "artificial intelligence" if they (or a subset of them) can be designated as such?

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:
How can one implement a 3D Grid-based Line of Sight algorithm? I'm creating a grid based Tactical RPG game in XNA.

Image below kinda explains the idea. But if you've played Dwarf Fortress before, I'm basically trying to create that 3D line of sight and you can ignore my explanation.

(Also I don't care about how efficient the algorithm is at this time.)

Currently I am drawing a Bresenham line to each square within a radius, and each square I visit I check in the direction I am headed if I run into any walls.

The code below is my check for if a position is visible. sx, sy, sz is the change in the grid. For instance, if the line is traveling north east, sx = 1, sy = -1, sz = 0. if I'm headed straight up it would be sx=0, sy = 0, sz = 1; etc.

    private bool IsVisible(APoint Cur, int sx, int sy, int sz)
    {
        bool Visible = true;
        if (ValidCoordinates(Cur))
        {
            int newsx = -1;
            int newsy = -1;
            int newsz = -1;
            switch (sx)
            {
                case -1:
                    newsx = 3; //west
                    break;
                case 0:
                    newsx = -1;
                    break;
                case 1:
                    newsx = 1; //east
                    break;
            }

            switch (sy)
            {
                case -1:
                    newsy = 0;// north
                    break;
                case 0:
                    newsy = -1;
                    break;
                case 1:
                    newsy = 2; //south
                    break;
            }

            switch (sz)
            {
                case -1:
                    newsz = 4; // down
                    break;
                case 0:
                    newsz = -1;
                    break;
                case 1:
                    newsz = 5; // up
                    break;
            }
            if (ValidCoordinates(Cur.X + sx, Cur.Y + sy, Cur.Z + sz))
            {
                if (newsx != -1 && newsy == -1 && newsz == -1) // X only.
                {
                    if (TileArray[Cur.X + sx, Cur.Y + sy, Cur.Z + sz].AllowSight(newsx))
                        Visible = true;
                    else
                        Visible = false;
                }

                if (newsx == -1 && newsy != -1 && newsz == -1) // Y only.
                {
                    if (TileArray[Cur.X + sx, Cur.Y + sy, Cur.Z + sz].AllowSight(newsy))
                        Visible = true;
                    else
                        Visible = false;
                }

                if (newsx != -1 && newsy != -1 && newsz == -1) // X and Y only
                {
                    if (Visible && TileArray[Cur.X + sx, Cur.Y + sy, Cur.Z + sz].AllowSight(newsx))
                        Visible = true;
                    else
                        Visible = false;

                    if (Visible && TileArray[Cur.X + sx, Cur.Y + sy, Cur.Z + sz].AllowSight(newsy))
                        Visible = true;
                    else
                        Visible = false;
                }

            }
            return Visible;
        }
        return false;
    }

The Allow sight function is here:

        public bool AllowSight(int i)
    {
        if (i == -1)
            return true;

        if (i >= 0 && i <= 3)
        {
            if (TileCreateCliff && HDifferenceUp > 0)
            {
                return false;
            }
        }

        if (i == 4)
        {
            if (TileVoid)
                return true;
            else
                return false;
        }
        if (i == 5)
        {
            if (TileVoid)
                return true;
            else
                return false;
        }
        return true;
    }

This works fine when my character is on the base level, but looking up at higher elevations, or looking down just causes everything to break.

How should I implement this?

sentences:
Game Logic Update Order Is there a commonly-accepted general approach to the order of processing logic updates?

My current 2D platformer has objects that implement different concerns, including the following:

Notifiable - can be event-driven and scripted
Collidable - can interact with solid tiles (eg NPCs)
Intersectable - exists in 2D space and can intersect with the player (eg doors)

In general the order of events in a game loop is:

Get input
Act on input and update stuff
Render

I'm not sure what order to do things in point #2. I've concluded moving things like moving platforms that the player can stand on first is a good idea, but I don't know when to consider scripting. The scripting in my game can give NPCs behaviours (walk between here and there), suspend player input for 'cutscenes', show dialog screens, and move the player to a new level.

sentences:
How import and draw a tiledmap with slick2d How I can import and draw a tilemap with different layers? I have the next code and send me error if the tilemap have more than one layer.

public class Map {

    private TiledMap map = null;

    private int bg,level,extras;

    public void init(GameContainer container) throws SlickException {

        map = new TiledMap("assets/levels/default.tmx", false);

    }

    public void render(int type, GameContainer container, Graphics g) {

//      map.render(0, 0, 0, 0, 19, 13);

    }

    public void update(GameContainer container, int delta) {}

}

I was thinking to save each layer in a different variable for later draw each layer. But Im not sure how I can do it. I have been looking for tutorials, and the slick2d API. And this is the error.

Fri Feb 06 22:18:30 GMT 2015 ERROR:For input string: ""
java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at org.newdawn.slick.tiled.TiledMap$ObjectGroup.<init>(TiledMap.java:1008)
    at org.newdawn.slick.tiled.TiledMap.load(TiledMap.java:688)
    at org.newdawn.slick.tiled.TiledMap.<init>(TiledMap.java:106)
    at gameEngine.Map.init(Map.java:54)
    at states.Play.init(Play.java:26)
    at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:171)
    at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:393)
    at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:317)
    at gameEngine.Main.main(Main.java:31)
Fri Feb 06 22:18:30 GMT 2015 ERROR:Failed to parse tilemap
org.newdawn.slick.SlickException: Failed to parse tilemap
    at org.newdawn.slick.tiled.TiledMap.load(TiledMap.java:695)
    at org.newdawn.slick.tiled.TiledMap.<init>(TiledMap.java:106)
    at gameEngine.Map.init(Map.java:54)
    at states.Play.init(Play.java:26)
    at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:171)
    at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:393)
    at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:317)
    at gameEngine.Main.main(Main.java:31)
Caused by: java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at org.newdawn.slick.tiled.TiledMap$ObjectGroup.<init>(TiledMap.java:1008)
    at org.newdawn.slick.tiled.TiledMap.load(TiledMap.java:688)
    ... 7 more

sentences:
Matinee movement track on multiple actors I have some different actors (all spheres) that i want to move along a path (circular) and they also need to roll when they are moving, so i tried this using matinees movement track and attached all spheres to one parent (the first sphere), but all the the other spheres move relative to the first one so if i rotate the childs will rotate on the axis of the parent and not around there own axis. and also they wont follow a path.

would this be possible using matinee? or what would be the best way to achieve this?

i thought of making a parent in the middle of the circular path and rotate around that axis but then the wont roll when moving, so maybe i should make a rolling animation separately. which will triggered when they move?

the spheres will not constantly move, what i want to make is sort of a 3d gallery where the focus is on one sphere and if you want to see the next one, roll that sphere toward you and the other one away towards the background.

sentences:
What system could I use to identify my entities, when sending data over network or storing them in file? I have a game engine using an entity-component system (ECS). I serialize the data contained in the ECS by having a system that registers serializers for different component types. I want to create networking,= using authoritative peer-to-peer, where I still have a server, but it acts only as the traffic center, and does not run the game logic. The idea is that specific entities are synchronized across client instances.

However, there is a problem with this. While I can easily serialize my data, I don't know how to synchronize it over a network, or load it from a file. The problem lies in how my system communicates; how do I tell which entity is which, on the other end? How do I let the receiving side know which entity the sent data was meant for?

My entity ids are currently generated as sequential numbers, but it feels very unreliable to use them, as there could be a time when the numbers are not synchronized. For example, one might create a decal entity sooner, or the order in which they are created could be different. This also makes seeded random GUIDs unusable.

What system could I use to identify my entities, when sending data over network or storing them in file?

sentences:
How do I detect a destroyed object in Unity? I have an object in unity which is spawn through a script. Upon detecting that the object has taken substantial damage, objectDestroy is called and the object is removed.

However, I would like for a message to appear upon having this object destroyed. The code I posted below doesn't work.

hudText.Add ("Use Mouse 1 to fire !", Color.red, 2f);

while(trigger==false){
    if(enemy==null){

        Debug.Log ("Gone");

        yield return new WaitForSeconds(1);
        hudText.Add ("Nice work!", Color.green, 3f);

        trigger = true;
    }
    Debug.Log (trigger);
    yield return null;
}

I suspect that this has to with the fact that the object is destroyed at the end of the frame, but the while loop here never allows the loop to test for the following frame.

How do I do this?

sentences:
OpenGL GLSL vector of sampler2D If im trying to create an obj. file loader in c++ and draw it with opengl i need to use multiple textures in the fragment shader.I know i can just use:

`uniform sampler2D Texture1`
`uniform sampler2D Texture2`
`uniform sampler2D Texture3`
`uniform sampler2D Texture4`

But i think there must be an elegant way to do it.Like a vector of samplers or something.Im asking this because i dont want to declare n textures in my fragment shader and type n if's where i test which texture i should use for the current fragment.It just looks ugly.

sentences:
Convert a modified Transform.forward to world space I am trying to make an electricity system, where it is given the start and end points, and it works out a random sequence of points in the rough direction of the end point. These points are set as vertices on a line renderer, and it should end up joining up as a bolt of electricity. My problem is that it needs to move 'forward' from start to end. The easy solution is that the electricity comes from a game object, which is set to LookAt the end point. Then, every time it sets a 'nextPoint', it adds to the transform.forward.

nextPoint = new Vector3 ((startingPoint.forward.x + divergence.x),
        (startingPoint.forward.y + divergence.y), distance);

divergence is a Vector3 containing a random increase on the x and y axis, and 1 on the z axis.

This works, in a way. The problem is that it then assumes these are world-space coordinates. So the line will go from starting point, to (eg. 0.3, 0.75, 1), and then back to the end point. I can't find a localToWorld conversion for a vector though, so I am not sure how to get the transform.forward + whatever, converted from local to world space.

sentences:
How to account for speed of the vehicle when shooting shells from it? I'm developing a simple 3D ship game using libgdx and bullet.

When a user taps the mouse I create a new shell object and send it in the direction of the mouse click. However, if the user has tapped the mouse in the direction where the ship is currently moving, the ship catches up to the shells very quickly and can sometimes even get hit by them - simply because the speed of shells and the ship are quite comparable.

I think I need to account for ship speed when generating the initial impulse for the shells, and I tried doing that (see "new line added"), but I cannot figure out if what I'm doing is the proper way and if yes, how to calculate the correct coefficient.

public void createShell(Vector3 origin, Vector3 direction, Vector3 platformVelocity, float velocity) {
    long shellId = System.currentTimeMillis(); // hack
    ShellState state = getState().createShellState(shellId, origin.x, origin.y, origin.z);
    ShellEntity entity = EntityFactory.getInstance().createShellEntity(shellId, state);

    add(entity);
    entity.getBody().applyCentralImpulse(platformVelocity.mul(velocity * 0.02f)); // new line added, to compensate for the moving platform, no idea how to calculate proper coefficient
    entity.getBody().applyCentralImpulse(direction.nor().mul(velocity));
}

private final Vector3 v3 = new Vector3();
public void shootGun(Vector3 direction) {
    Vector3 shipVelocity = world.getShipEntities().get(id).getBody().getLinearVelocity();
    world.getState().getShipStates().get(id).transform.getTranslation(v3); // current location of our ship
    v3.add(direction.nor().mul(10.0f)); // hack; this is to avoid shell immediately impacting the ship that it got shot out from
    world.createShell(v3, direction, shipVelocity, 500);
}

Edit - I switched to:

    v3.set(direction);
    v3.nor().mul(velocity);

    if (platformVelocity != null)
        v3.add(platformVelocity);

    entity.getBody().setLinearVelocity(v3);

And it seems to work (so adding the velocities and setting them on the body).

However, I'm not sure what the drawbacks are and why the tutorial application used impulses instead of setting velocities.

I also think that while this is physically correct it leads to strange results (gun range is two times further when shooting forward than when shooting sideways).

The root cause is because really the shells are indeed too slow, but I like them slow as otherwise the gameplay is too fast-paced, and they travel too far.

I think I need some compromise between physics-realistic and ignore-platform-velocity.

sentences:
Why does Assimp appear to be loading vertices in the incorrect order in this code? I'm getting a weird bug in my code that is reading in the vertices from an .obj file.

The .obj file is just a cube, hence there are eight vertices. When I print out the vector it seems to work perfectly up until the 5th vertex, and then it seems to read the last 3 backwards.

This is the file:

# Blender v2.69 (sub 0) OBJ File: ''
# www.blender.org
mtllib cube.mtl
o Cube
v 2.000000 -2.000000 -2.000000
v 3.000000 -3.000000 3.000000
v -4.000000 -4.000000 4.000000
v -5.000000 -5.000000 -5.000000
v 6.000000 6.000000 -6.000000
v 7.999999 7.000000 7.000001
v -8.000000 8.000000 8.000000
v -9.000000 9.000000 -9.000000
usemtl Material
s off
f 1 2 3 4
f 5 8 7 6
f 1 5 6 2
f 2 6 7 3
f 3 7 8 4
f 5 1 4 8

This is my code:

m->vertices = new glm::vec3[m->numVertices];
for (GLuint i = 0 ; i < m->numVertices ; i++) {
    const aiVector3D* pPos = &(mesh->mVertices[i]);
    m->vertices[i] = glm::vec3 (pPos->x, pPos->y, pPos->z);
    std::cout << "X:" << m->vertices[i].operator[](0) << " Y:" << m->vertices[i].operator[](1) << " Z:" << m->vertices[i].operator[](2) << std::endl;
}

However this is what is stored in the vector (what the above code prints out):

X:2 Y:-2 Z:-2
X:3 Y:-3 Z:3
X:-4 Y:-4 Z:4
X:-5 Y:-5 Z:-5
X:6 Y:6 Z:-6
X:-9 Y:9 Z:-9
X:-8 Y:8 Z:8
X:8 Y:7 Z:7

As you can see the last three lines are messed up, I have no idea how this is happening in the loop.

sentences:
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:
How do I make an actor move to the foreground temporarily in LibGDX scene2d? I have an inventory UI which is a table in scene2d. Then the table had a bunch of Containers which are basically inventory slots. They have a transparant grey background color. Then in each container is an ItemStack with a picture of an item and a stacksize. When I pull this ItemStack over a container that was created later, it moves behind the container and the transparant grey background will be in front of the item picture. How do I temporarily (or permanently) move it to the foreground so it doesn't matter in front of which container I drag the item?

Example of what happens:
https://i.imgur.com/yq4njex.gifv

This is how I create the containers:

// Create inventory slots
table.row();
inventorySlots.clear();
for (int i = 0; i < inventory.getInventorySize(); i++) {
    if (i % SLOTS_PER_ROW == 0) table.row();

    Container cont = new Container();
    cont.fill();
    cont.background(Utils.createDrawable(1, 1, new Color(0, 0, 0, 0.4f)));

    inventorySlots.add(cont);
    table.add(cont).prefHeight(50).prefWidth(50).pad(5);
}

After that I add each ItemStack to the list of containers/inventoryslots like this:

// Add ItemStacks from Items to their respective slot
ArrayList<Item> items = inventory.getItems();
for(Container slot : inventorySlots) {
    Item item = items.get(inventorySlots.indexOf(slot));

    if(item != null) {
        ItemStack itemStack = new ItemStack(item);
        addInventoryEvent(itemStack, items);
        slot.pad(5);
        slot.setActor(itemStack);
    }
}

sentences:
When scene loaded up, Position player at a start point. (Unity2D) If pointName and player.startPoint are true, shown by the inspector, why doesn't the player's position go to the start point with a pointName of "ToNeighborhood". Note: The code runs if pointName == player.startPoint. It isn't running even when they both contain the same string shown by the inspector

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

public class PlayerStartPoint : MonoBehaviour {

    private PlayerController player;
    private CameraController theCamera;

    public string pointName;

    // Use this for initialization
    void Start () {
        player = FindObjectOfType<PlayerController>();
        theCamera = FindObjectOfType<CameraController>();
        if (pointName == player.startPoint)
        {
            Debug.Log("Changing");
            player.transform.position = gameObject.transform.position;
            theCamera.transform.position = new Vector3(transform.position.x, transform.position.y, theCamera.transform.position.z);
        }

     }

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

    }
}

sentences: 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:
Set up indie game studio (UK) - how? I am UK based and am looking to set up my own game studio - essentially, just myself working from home, looking to build casual game apps. I want to ask you guys what steps or process i need to go through and do to make this happen, specifically the legal side of things. Will be great to hear from those who have been through this themselves! Need to register with HRMC as self employed is the only thing i know i have to do but what else?:

Do i need to register/trademark my own company/studio name? If so, where do i do this and does it cost money? Or can i just simply start using a name as is?
Do i need to also do this for any games/apps IP i make? Or is copyright automatically assumed?
I gather acting as sole trader is more appropriate at this stage? At what point, if ever, should i consider moving to an actual limited company setup?
Is it wise to open a new bank account solely for this business?

I think my plan was simply to:
1. Find a suitable domain name and create website based on my company name - assuming available and different enough from similar competitor names
2. Register as self employed with HRMC
3. Sell my game on app store

And thats it! Is this ok or do i need consider other stuff as well such as the questions above?

Thank you for reading and any advice you have!

sentences:
melonJS: Entity and solid block on collision layer Actually I have my player entity with 64x64 sprite animation and 18x60 hitbox also the map is made by 16x16 tiles.
When my player goes some way he can pass through blocks (but not all of them).
For example there are 4 situations:

Good (player can't pass the tile with isSolid property on collision layer)

Good (player can't pass the tile with isSolid property on collision layer)

Bad (player pass the tile with isSolid property on collision layer)

Bad (player pass the tile with isSolid property on collision layer)

Looks like melonJS checks only corners of hitbox instead of whole rectangle.
Can anyone help me in this situation.

UPD: my PlayerEntity.

var PlayerEntity = me.ObjectEntity.extend({
    init: function(x, y, settings) {
            settings.image = "player";
            settings.spritewidth = 64;
            settings.spriteheight = 64;
            this.parent(x, y, settings);
            this.setVelocity(3, 10);
            this.updateColRect(23, 18, 4, 60);
            me.game.viewport.follow(this.pos, me.game.viewport.AXIS.BOTH);
            this.direction = 'stand2';
            this.addAnimation("run", [0,1,2,3,4,5,6,7,8,9]);
            this.addAnimation("stand", [33]);
            this.addAnimation("stand2", [44]);
            this.addAnimation("jump", [29,29,29,29,29,29,29,29,27,27]);
            this.addAnimation("jump2", [26,27,27,27,29,29,27,27,26]);
    },
    update: function() {
            hadSpeed = this.vel.y != 0 || this.vel.x != 0 ;
            if(hadSpeed)
                this.animationspeed = me.sys.fps / 10;

            if (me.input.isKeyPressed('left')) {
                this.jumping ? this.setCurrentAnimation('jump2') : this.setCurrentAnimation('run');
                this.flipX(false);
                this.vel.x = -this.accel.x * me.timer.tick;
                this.direction = 'left';
            }
            ...
            right/jump etc goes here
            ...
            updated = this.updateMovement();
            if (!hadSpeed) this.setCurrentAnimation('stand');
            if (updated) this.parent(this);
            return updated;
    }
});

sentences:
How do some mobile games scale graphics so beautifully? I'm working on my first Android game and have been struggling a bit with scaling.

I've got 3 test devices 800x480, 1920x1080 and a 2560x1600 tablet. Some games look near perfect on all of them - many other games don't, including mine.

I'm really struggling with images looking blocky when scaling. I'm using the libdgx library, and have turned on linear filtering for everything. Almost always scaling down. Fonts are something I'm really struggling with.

I've been dissecting the apk's of various games for tips but can't see anything in particular that they're doing. In one game I examined (Candy Crush Saga) there's only 1 set of images, they only use 1 font. They also have a ttf in there, but I can't work out where that's used. The main font in a pre-created bitmap font.

Does anyone else have any tips or tricks. Ho do others manage it, especially the font scaling?

sentences:
Creating a 3D map for XNA? Is anyone aware of a nice 3D map tutorial (how to import and use the map) using XNA without any engine but not limited to an external application (like Tiled for 2D maps) ?

I did a search arund here but have'nt found anything towards xna 3d maps only 2d.

PS: I am looking for material that can be read online with no cost if possible.

I would be very interested in knowing any other contents related to this subject other then what  Ricket contributed.

Best regards.

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:
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:
Continous Movement and Gravity Switch With 1 button I have a sphere with a rigidbody on it, and it moves to the right continously as I need it, but as it moves I want the space bar to be able to switch the gravity (so it either rides on the ceiling or on the floor), as it moves along to the right.

Please help, have been googling consistently for the past 3 hours.

Here is the code I have so far:

public class movement : MonoBehaviour {

    public float movementSpeed = 10;
    private bool haspressed;

    void Start()
    {
    }

    void FixedUpdate()
    {

        transform.Translate(Vector3.down * movementSpeed * Time.deltaTime);

        if (Input.GetKeyDown ("space") && haspressed == true) {
            transform.Translate (Vector3.right * movementSpeed * Time.deltaTime);
            haspressed = false;
        } else if (Input.GetKeyDown ("space") && haspressed == false) {
            transform.Translate (Vector3.right * movementSpeed * Time.deltaTime);
            haspressed = true;
        }
    }
}

Thank you sooo much!

sentences:
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:
Skeletal Animation: No initial bone rotation I am currently trying to implement animations in my game. I am having an issue where the bones do not rotate properly.

In my program, I apply an inverse bind pose to each bone to move them to bone space. Then I recursively calculate the transformations for each bone for the keyframe.

The bone transformation looks like this:

bone.Transform = InverseRootGlobal * Global * bone.InversePose

InverseRootGlobal is the inverted root node transformation
Global is the recursively calculated transformation
bone.InversePose is the inverse pose matrix

It appears that all is correct apart from the bones initial rotation. When I move the bones to bone space, they loose their rotation from the bind pose and 'point up'. Here's what it looks like:

If it helps, I am using Assimp to import the data.

Thanks in advance.

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

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

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

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

However this information was collected from western websites.

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

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

sentences:
Is there a way to rotate an Ellipse in libGDX for collision detection purposes? I'm trying to avoid having multiple overlapping Circles for a UFO-shaped sprite.

Two Ellipse objects will perfectly cover the shape of my UFO, but I want to tilt/rotate the UFO when flying left and right, while still maintaining collision areas that match the locations of the graphics.

The Ellipse reference page doesn't have anything listed for rotation options, just wondering if anyone has ever tried to do this before (and succeeded).

sentences:
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 do I determine which side of the player has collided with an object? I have some static bodies (platforms) and a dynamic body (the player) in my world. The collision between them works great, but I would like to know which side of the player (rectangle) collides with the platform. How do I get this information?

sentences:
Generate different types of enemies with different randomness What I want - I want to have some magic function getEnemyType(currentLevel), which will return, for example, a number. Number is enemy type, let's say, there are ten (10) types. 1 - the easiest, 10 - the hardest.
I can't even find the idea, where to dig, to get such algorythm: I give this magic function current level number and it calculate suitable enemy type with increasing and decreasing chanse of getting hard or easy enemy.
Example:

Level 1: function will generate random type from array of one
element: [1], okay
Level 2: generating random types from such set: [1,1,2], reason is to
have more easy and less hard enemies.
Level 3: [1,1,1,2,2]
...
Level 50: [1,7,7,9] (more 7s, less 9s for challenge, and little
number of 1s for fun)
Level 10000: [1, 10, 10, 10, 10, 10, 10]

Ideally game must be infinite, so I can just add enemy types to suit increasing difficulty.
Is this real? :)

sentences:
Overlapping Vertex in DynamicVertexBuffer draw priority? I am creating a voxel game, and I have recently run into an issue. My world is drawn by a DynamicVertexBuffer, which just consists of vertices for the blocks themselves. On top of that, I switch vertex buffers to my  "Selected" vertex buffer which draws a white outline of a block for now. (This includes alpha but I have it turned off until I figure this glitch out).

This issue I run into is here:

Rather than the selected buffer overwriting my world block, it sort of does depending on the angle. Sometimes I see no overlap, sometimes weird glitches like shown above.

I was wondering, what can I do to prioritize the "Selected" buffer so that it is drawn on top of anything else sharing coordinates? Note that I did have this working, when everything used a basic effect. After switching to my own custom effect.fx (which supports fog and lighting, if that has anything to do with it), I run into this issue.

Any help is appreciated, thank you!

EDIT:

Just got the "flickering" of sorts to stop, I changed the DepthStencilState of the buffer to:

GraphicsDevice.DepthStencilState = DepthStencilState.None;

The only downside here is that it draws all 6 sides of the selected block now and it overlaps the world completely, again I don't know if this would be the right way to do it but any help would be appreciated:

The above picture is flat with the rest of the terrain around it, as you can see it draws the two sides that wouldn't actually be visible as well.

sentences: What should I use to handle input? What should I use to handle input? I am wanting to use OpenGL so that my games are cross platform. DirectX provides input libraries, and OpenGL does not. Because my games need to be cross platform, I cannot use DirectX's libraries. What should I do, or what is the common solution to this type of problem?

sentences:
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:
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:
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: Any ad network for XNA games on the PC platform? There's a lot of press about the ad controls included on the new 7 phone, but I'm looking for candidates for the PC platform.

sentences:
Detect when item has been dragged & dropped onto an inventory slot In my inventory system I want to be able to drag and drop items into inventory slots.
I managed to make it work, but only in a weird way:

When the player starts dragging, it picks up the item and it follows the mouse's position.

When they release the button outside the inventory, the item's position is restored to the slot from which it was picked up.
I use GameObject mouseReleasedObject = eventData.pointerCurrentRaycast.gameObject; to detect whether the drag was released over an inventory slot.

The problem is that when the player drops it on a possible inventory slot, the same "restore to previous slot" behaviour happens.
That's because the mouse is top of the dragged item and the slot as well but the item is rendered above everything else.

How can I make the dragging ignore the item itself, and detect the slot underneath?
Start dragging:
    public void OnBeginDrag(PointerEventData eventData)
    {
        GameObject draggedObject = eventData.rawPointerPress;
        if(draggedObject.GetComponent<RectTransform>() is null) return;

        if(draggedObject.tag == "InventoryItem")
        {
            Debug.Log("InventoryItem drag has started!");
            dragStartSlot = draggedObject.transform.parent.gameObject;
            draggedItem = draggedObject;
            draggedItem.transform.SetParent(canvas.transform);
            draggedItem.transform.SetAsLastSibling();

        }
    }

End dragging:
    public void OnEndDrag(PointerEventData eventData)
    {

        GameObject mouseReleasedObject = eventData.pointerCurrentRaycast.gameObject;
        if(draggedItem is null) return;
        Debug.Log("Released at: "+mouseReleasedObject.gameObject.name);
        if(mouseReleasedObject.transform.tag == "InventorySlot")
        {
            if(mouseReleasedObject.transform.childCount < 1)
            {
                //  the inventory slot is empty, we place here the item!
                draggedItem.transform.SetParent(mouseReleasedObject.transform);
                draggedItem.GetComponent<RectTransform>().localPosition = Vector3.zero;
            }
            else
            {
                //  the inventory slot is taken, we swap the items!
            }
        }
        else
        {
            //  the item is not released on a proper slot, we restore it's position!
            draggedItem.transform.SetParent(dragStartSlot.transform);
            draggedItem.GetComponent<RectTransform>().localPosition = Vector3.zero;
        }
    }

sentences:
Character blocking when walking on cube edges I have my character walking on a ground made of cube. (scale 1,1,1). There is no space between them.  Also, I have a RigidBody with 15 drag and I'm moving with AddForce.

When I walk, my character sometimes block when trying to pass over the place where the 2 box meet. Like if my player collider was hitting the collider under him. Any fix for that?

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:
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:
What does glMultiDraw* do? I'm having trouble understanding exactly what glMultiDraw* does, and when it should be used.

Is it to be used if I have one VBO with multiple objects in it or do I use it with many VBO's?

It would be great if someone could give a real example of how to use this is a VAO/VBO as all the stuff I've found on google just explain what the function does rather that how to use it practically.

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

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

typedef unsigned int ID;

class GameObject
{
public:

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

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

    virtual void update() = 0;

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

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

protected:

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

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

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

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

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

sentences:
Game Loop design that is speed hack proof I'm not sure if this is possible, but it's worth a shot asking. How does one design a game loop in such a way that hooking and enabling a speed hack app to the game(dx11) doesn't matter?
I found this in stackoverflow:

I think the reason why i does not work in some applications (mostly games) is because some games link the in game clock to the frames per second. Therefore your game will either tank or crash altogether if you try to speedhack it
ref: https://stackoverflow.com/questions/17512906/how-does-cheatengines-speed-hack-work

sentences:
How to render sprites without using SpriteRenderers I'm creating a component that lets you write text, like the UI Text component, but using sprites as letters.

I already have the mapping for characters->sprites, and now was going to draw the text using the sprites.

My first idea, was to just create one children for each letter, each child having a sprite renderer.

But it feels like a pretty poor approach, since a transform and a sprite renderer component have to created or destroyed, when the text changes size.

Then I thought about using a Mesh renderer and mesh filter, and define the mesh when the text changes, creating a quad for each letter. But what I don't like about this idea is having 2 extra components in my gameObject, as I would like to keep it as clean as possible.

Is there a way to achieve this keeping all the necessary components inside my own class? Defining my own quads, UVs and such is just fine, but I just don't know how to render them through script. Is it even possible without adding more components to the gameObject?

Don't know if its relevant, but I want to use World Coordinates, not screen coordinates.

sentences: How do I efficiently determine what objects are visible to a camera? I want to call the rendering methods of only the game objects that are visible. How can I efficiently determine which objects or tiles are within the camera's rendered region?

sentences:
Why large builder classes rather than separate clases in component-based entity systems? I was reading about component-based entity systems and I was wondering why there is usually a large EntityBuilder class with methods like CreatePlayer(), CreateEnemySpaceship(), and CreatePowerup(), all creating an entity, attaching some components, and returning the entity.

The class has the potential to get quite large given enough different entities and having to search this large code-file can eventually become quite cumbersome. Also, with this system, since all entities are of type Entity, to determine what something actually is, you would have to add some sort of TypeComponent to the entity which may contain a string like "Player", "Enemy", and "Powerup". Now you lose some benefits of strong typing and have to rely on personal memory more (bad in my opinion).

Another problem with this setup is the inability to use function overloads based on what type the entity is. Instead one would have to use hashtables based on some identifying component which is a bit ugly.

I was wondering, instead of having these large builder classes and cumbersome ways of determining what an entity really is, why not just have separate classes for each entity? Well, that is what we were doing but they resulted in large and complex hierarchies, right? Well, I'm not advocating large hierarchies. Rather, move every method from this monolithic builder class to a separate class deriving from Entity and place that code in the constructor. No multiple-inheritance. No large trees. Example: Both Ship, Spaceship, and EnemySpaceship would all derive from Entity and only Entity.

This could be useful for determining the types of entities when a collision occurs and how to proceed with handling the event. The classes themselves would basically be empty except for the constructor logic in how to construct the entity (attaching components and whatnot). This solution seems to be a lot more extendable as well, considering if one would ever need to modify the creation process of an EnemyEliteFighterSpaceship, rather than searching through some large builder class, just go to that class file.

Am I missing something here? I suppose, if all else, my real question would be of an elegant way to determine what an entity is when it collides with another entity so some action could be taken (increase score, play sound, etc.). I initially tried setting up some sort of TypeComponent but it just seems a bit hackish as opposed to simply deriving from the base Entity class. Also, deriving from a base entity class gives strong-typing and type-safety support, gets rid of the public static builder class, and allows for polymorphic behavior and ease of determining an entity's type.

So I'm wondering, with all these positives and no perceivable negatives (other than .. more files? organization trumps file count in my opinion), why do most component systems favor these large builder/factory classes rather than my proposed approach?

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:
Player moves in a jerky way when riding on a moving platform I have a moving platform script that travels between three positions. This works fine.

I have a script that holds the player to a platform, and this works fine too.

But when I parent my platform that holds my player to an object with the moving platform script, the player's movement is jerky and uneven.

Here are the scripts I'm using:

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

public class MovingMultipalPoint : MonoBehaviour
{

    public Vector3 pointB;
    public Vector3 pointC;
    public float Second = 5.0f;
    public float Speed = 3.0f;
    //public float HoldSecond = 5.0f;

    IEnumerator Start()
    {
        Vector3 pointA = transform.position;
        while (true)
        {
            yield return new WaitForSeconds(Second);
            yield return StartCoroutine(MoveObject(transform, pointA, pointB, Speed));
            yield return new WaitForSeconds(Second);
            yield return StartCoroutine(MoveObject(transform, pointB, pointC, Speed));
            yield return new WaitForSeconds(Second);
            yield return StartCoroutine(MoveObject(transform, pointC, pointB, Speed));
            yield return new WaitForSeconds(Second);
            yield return StartCoroutine(MoveObject(transform, pointB, pointA, Speed));
        }
    }

    IEnumerator MoveObject(Transform thisTransform, Vector3 startPos, Vector3 endPos, float time)
    {
        float i = 0.0f;
        float rate = 1.0f / time;
        while (i < 1.0f)
        {
            i += Time.deltaTime * rate;
            //newRotation *= Quaternion.Euler(0, 90, 0);
            //transform.rotation = Quaternion.Slerp(transform.rotation, newRotation, 20 * Time.deltaTime);
            thisTransform.position = Vector3.Lerp(startPos, endPos, i);
            yield return null;
        }
    }
}

This script holds the player to the platform.

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

public class HoldPlayer : MonoBehaviour
{
    private GameObject target = null;
    private Vector3 offset;
    void Start()
    {
        target = null;
    }
    void OnTriggerStay(Collider col)
    {
        target = col.gameObject;
        offset = target.transform.position - transform.position;
    }
    void OnTriggerExit(Collider col)
    {
        target = null;
    }
    void LateUpdate()
   {
        if (target != null)
        {
            target.transform.position = transform.position + offset;
        }
   }
}

(1st Image) Here is how the moving platform is configured in the Inspector:

(2nd Image) And the holding script:

Also here recorded video of issue

Any ideas how I can keep the movement smooth in this case?

sentences:
Are javascript MVC model implementations too slow for games? I wanted to implement a game in javascript with an MVC design pattern, with each entity's state stored in a model.
So for example,
In an update loop we iterate over all models and apply the velocity attribute to the position attribute of the model.
A view associated with each entity/model would then receive a position changed event,
and update the representation of the entity.
This would happen independently of the views render method being called in a requestAnimationFrame callback.
What I found though, through a possibly naive implementation, is that setting attributes of a model is simply too slow.
As much as I prefer the architecture of this code, the framerate was significantly lower.
Should I give up on using MVC for frequently updated attributes like position?
Below, I've included some code to test aspects of setting attributes of an object.
The most minimal model-like behaviour, in which an attribute is set only when the new value differs from the current,
and a "changed" update event is triggered, is about 10x slower than just setting attributes directly.
Output:

> test(1000, 100, 10)
object[key]: 163 ms
object[key] if changed: 172 ms
object[key] if changed & emit backbone event: 953 ms
Backbone.Model: 4043 ms
eventsBackboneCount: 100000

var test = function(creations, iterations, keyCount){
  var eventsBackbone = _.extend({}, Backbone.Events);
  var eventsBackboneCount = 0;
  eventsBackbone.on('all', function(){
    eventsBackboneCount = eventsBackboneCount + 1;
  });

  var looper = function(label, create, set){
    var start = (new Date()).getTime();

    var data = {};

    for(var i = 0; i < creations; i++){
      data[i] = create(i);
    }

    for(var j = 0; j < iterations; j++){
      for(var i = 0; i < creations; i++){
        var key = ''+(j % keyCount);
        set(data[i], key, Math.random());
      }
    }

    var end = (new Date()).getTime();

    console.log(''+label+': '+(end - start)+' ms');

    return data;
  };

  looper(
    'object[key]',
    function(id){
      return {};
    },
    function(datum, key, value){
      datum[key] = value;
    }
    );

  looper(
    'object[key] if changed',
    function(id){
      return {};
    },
    function(datum, key, value){
      if(datum[key] !== value){
        datum[key] = value;
     }
    }
    );

  looper(
    'object[key] if changed & emit backbone event',
    function(id){
      return {id:id};
    },
    function(datum, key, value){
      if(datum[key] !== value){
        datum[key] = value;
        eventsBackbone.trigger('changed:'+datum.id, datum, key);
     }
    }
    );

  looper(
    'Backbone.Model',
    function(id){
      return new Backbone.Model({});
    },
    function(datum, key, value){
      datum.set(key, value);
    }
    );

  console.log('eventsBackboneCount: '+eventsBackboneCount);
};

sentences:
SDL_Init segfault on linux I am using Manjaro linux and SDL 2. However, when I build the application in debug mode and use gdb or something like qtcreator with gdb, to debug it, it gives me a segfault, when the function SDL_Init() is called.
The code I am trying this with:
#include <iostream>
#include <SDL2/SDL.h>

int main(int argc, char *argv[])
{
    if (SDL_Init(SDL_INIT_VIDEO) < 0)
    {
        printf("SDL Init error: %s", SDL_GetError());
        return -1;
    }

    SDL_Window *window = SDL_CreateWindow("window", 10, 120, 800, 640, 0);

    SDL_Renderer *ren = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);

    bool running = true;
    while (running)
    {
        SDL_Event e;
        if (SDL_PollEvent(&e) != 0)
        {
            switch(e.type)
            {
                case(SDL_QUIT): running = false;
            }
        }

        SDL_RenderClear(ren);

        SDL_RenderPresent(ren);
    }

    SDL_DestroyRenderer(ren);
    SDL_DestroyWindow(window);
    SDL_Quit();
    return 0;
}

I then recompiled SDL for debugging and went into the source, to find out this function in SDL.c is actually the cause:
        if (SDL_PrivateShouldInitSubsystem(SDL_INIT_VIDEO)) {
            if (SDL_VideoInit(NULL) < 0) {             <- this here is causing the segfault
                return (-1);
            }
        }

I don't know what to even do with this. None of the SDL versions work anymore. I've tried installing older ones, compiling from source.

sentences:
Physics Loop in a NodeJS/Socket.IO Environment I'm developing a 2D HTML5 Canvas Game, and I am trying to think of the most efficient way to implement a Physics Loop on the server-end of things, running NodeJS and Socket.IO.

The only method I've thought of is using setTimeout/Interval, is there any better way? Any examples would be appreciated.

EDIT: The Game is a top-down Game, like Zelda and older Pokemon Games. Most of the physics done in the loop will be simple intersects.

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:
Alpha blending, transparence and z-ordering I'm making some tests with alpha blending in a projet and I don't understand something.

In my tests I've done something like that and everything look good:

Draw blue box first (depth test: true, blend alpha: none, color: 1, 1, 1, 1)
Draw left Mario (depth test: false, blend alpha: true, color: 1, 1, 1, 0.8)
Draw red box (depth test: true, blend alpha: none, color: 1, 1, 1, 1)
Draw right Mario (depth test: false, blend alpha: true, color: 1, 1, 1, 0.8)

Every tutorial say that we should:

Draw opaque object first
Order transparent object back to front then draw them.

Here is the result:

So, I'm not sure to understand how it work/what is wrong (I've read this document).

Thanks!

sentences:
Change value of uniform for each VAO I've heard from several sources that it's a better approach to pass the model matrix to a shader via a uniform rather than an attribute.

I also know that the idea of a uniform is, that it has the same value for each frame.

If so, how can i change the uniforms value for each object i have in the scene?

sentences: 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:
OpenGL get the outline of multiple overlapping objects I just had an idea for my on-going-game made with opengl in c++: I'd like to have a big outline (5-6 pixel) on multiple overlapping object when the player win something.

I thought the best way is to use stencil buffer but it's few hours that I' trying to do some off-screen render of the stencil buffer and I can't achieve any kind of result so probab. there are some other techniques!

This is what I want to get:

Any ideas?

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:
Is using camera and viewport in Libgdx always necessary? I understand that camera and viewport are important to keep virtual measurement units and handle different aspect ratios and resolutions when building games with worlds bigger than the screen (e.g. side-scrollers / map based games).

I am not sure whether it is the proper way to go for a simple game that fits on the screen entirely - like a puzzle or card game for example.

Is it still better to use camera and viewport in this case, or is it more simple, effective (and hence better) to use directly screen absolute coordinates for these types of games?

Or to put it in other way - what are the advantages to use camera and viewport for games that fit on the screen entirely?

sentences:
What is the Xbox360's D3DRS_VIEWPORTENABLE equivalent on WinXP D3D9? I posted this on StackOverlow, but of course it should be posted here.

I am maintaining a multiplatform codebase for Xbox360 and WinXP. I am seeing an issue on the XP side that appears to be related to D3DRS_VIEWPORTENABLE on the Xbox360 version not having an equivalent on WinXP D3D9. This article had an interesting idea, but the only way to construct an identity matrix is to supply negative numbers to D3DVIEWPORT9::X and D3DVIEWPORT9::Height, but they are unsigned numbers. (I tried to put in negative numbers anyway, but nothing interesting happened.)

So, how does one emulate the behavior of D3DRS_VIEWPORTENABLE under WinXP/D3D9?

(For clarity, the result I'm seeing is that a 2d screen-aligned quad works fine on Xbox360 but is offset/stretched on WinXP. In fact, the (0, 0) starts in the center of the screen on WinXP instead of in the lower-left corner like on the Xbox360 as a result of applying the viewport transform.)

Update: I didn't have an Xbox360 devkit at the time I wrote up this question, but I've since gotten one. I commented out the disabling of the D3DRS_VIEWPORTENABLE state, and the exact same behavior resulted on the Xbox360 as on the WinXP build. So, there must be some DirectX magic to bridge the gap here for emulating D3DRS_VIEWPORTENABLE being turned off on WinXP.

sentences:
Which game engine to use for Android TV? I am trying to tinker a bit on Android TV game development and I am trying to figure out which would be the best suited 2D/3D game engine for this purpose or, alternatively, which are the main aspects I should consider when choosing one. Could you give me some basic hints?

Note: I am not a professional game developer, I have experience in C++ and only entry-level Java and Android development.

Thanks in advance!

sentences:
Recursively find neighbors I'm making a Bubble Shooter game in Unity. I came to the point where I can hit another bubble and it destroys all of its neighbors.

Now I'm trying to use recursion to destroy all of its neighbors neighbors and it causes a stack overflow.

private List<Bubble> FindAllRecursiveNeighbors(Vector2Int originPosition)
{
    List<Bubble> allNeighbors = FindNeighbors(originPosition);
    List<Bubble> result = new List<Bubble>();

    foreach (Bubble bubble in allNeighbors)
    {
        if (result.Contains(bubble)) { continue; }
        result.Add(bubble);
    }

    // Recursion starts here.
    foreach (Bubble bubble in result)
    {
        List<Bubble> neighbors = FindAllRecursiveNeighbors(FindPositionOfBubble(bubble));
        foreach (Bubble neighbor in neighbors)
        {
            if (result.Contains(neighbor)) { continue; }
            result.Add(neighbor);
        }
    }
    return result;
}

sentences:
Implementing Browser in Unreal Engine 4.10 I am looking to add some oauth to a game I am working on. I can get the user auth to work in the browser that comes with UE4, however there is not any capability to detect changes to the currently loaded URL so I can grab the token after the user loggs in. So I'm trying to create one. I created a new C++ class that extends UWebBrowser, added this line to the Build.css file

PublicDependencyModuleNames.AddRange(new string[] {"Http", "UMG"});

And I have this in my browser .h file so it will be available to use in blueprints

virtual const FText GetPaletteCategory() { return FText::FromString("Oauth Browser");

Now I just need to be notified of when the URL changes so I can grab to auth token but I can't seem to find a way to implement for that. I have read that it can be done though. Can anyone shed more light on this subject for me? I'd appreciate it.

sentences:
Multiple render targets and gamma correctness in Direct3D9 Let's say in a deferred renderer when building your G-Buffer you're going to render texture color, normals, depth and whatever else to your multiple render targets at once.

Now if you want to have a gamma-correct rendering pipeline and you use regular sRGB textures as well as rendertargets, you'll need to apply some conversions along the way, because your filtering, sampling and calculations should happen in linear space, not sRGB space. Of course, you could store linear color in your textures and rendertargets, but this might very well introduce bad precision and banding issues.

Reading from sRGB textures is easy: just set SRGBTexture = true; in your texture sampler in your HLSL effect code and the hardware does the conversion sRGB->linear for you.

Writing to an sRGB rendertarget is theoretically easy, too: just set SRGBWriteEnable = true; in your effect pass in HLSL and your linear colors will be converted to sRGB space automatically.

But how does this work with multiple rendertargets?
I only want to do these corrections to the color textures and rendertarget, not to the normals, depth, specularity or whatever else I'll be rendering to my G-Buffer. Ok, so I just don't apply SRGBTexture = true; to my non-color textures, but when using SRGBWriteEnable = true; I'll do a gamma correction to all the values I write out to my rendertargets, no matter what I actually store there.

I found some info on gamma over at Microsoft:
http://msdn.microsoft.com/en-us/library/windows/desktop/bb173460%28v=vs.85%29.aspx

  For hardware that supports Multiple Render Targets (Direct3D 9) or Multiple-element Textures (Direct3D 9), only the first render target or element is written.

If I understand correctly, SRGBWriteEnable should only be applied to the first rendertarget, but according to my tests it doesn't and is used for all rendertargets instead.

Now the only alternative seems to be to handle these corrections manually in my shader and only correct the actual color output, but I'm not totally sure, that this'll not have any negative impact on color correctness. E.g. if the GPU does any blending or filtering or multisampling after the Linear->sRGB conversion...

Do I even need gamma correction in this case, if I'm just writing texture color without lighting to my rendertarget? As far as I know, I DO need it because of the texture filtering and mip sampling happening in sRGB space instead, if I don't correct for it.

Anyway, it'd be interesting to hear other people's solutions or thoughts about this.

sentences:
How to move rigidbodies Have i understood this correct: If i want to use a rigidbody for physics then

i should not move an object through its transform.position.
I should never move it by riigidbody.velocity since i then affect the physics.
So what is left is moving it using addForce. I guess its like mimicking how in the real world everything that moves has something that drives it.

sentences:
Why do some videogame sequels become bigger? Sometimes I'm wondering why sequels in games usually strive to have new features, making them more complex, taking much longer to finish and also sounds much harder to keep motivated into it.

I understand that it's needed because gamers don't want to buy the same game with just a different story. but occasionally these features seem to make the original intention of the game more complex than I think it should be.

If a developer is always with the thought to make his next game bigger than the previous, then that means that they'll become overly cluttered with tons of features that a gamer may or may never use. That sounds like a waste of effort to me.

Maybe it's just that I prefer a simple style from indie games,
but when I look at the larger companies, then sometimes I've a feeling
they're trying out a lot (if not too much) to sell well.

Just take a look at Mario Kart 8, Breath of the Wild and Super Mario Odyssey as example.
They're all so complex compared with what the series used to be.
Now imagine how large their next game has to be in order to top that, if that's even possible.

So my question is: what leads game developers to focus on making the next game even bigger? And are there viable ways to avoid this trend?

I'm used to the phrase 'less is more', but I wonder if that also fits in this situation.

sentences:
C++: Setup the basic Update function in different classes which all derive from GameObject Im working on a little game-framework in c++. Currently i have a (base)class called "GameObject" from which all future in-game objects will derive from.
Class enemy will be class Enemy : public GameObject and class Player will be class Player : public GameObject

This way, i can store all my gameobjects in an array of type GameObject and manage them easily and they will all have the basic game-object variables such as x/y/z coordinates, scale, etc. So what i eventually want is to be able to quickly create a new game-object by creating a new class and then simply inheriting from GameObject.

Know how in Unity every game-object monobehaviour script has a start function and an update method? That's what im trying to recreate, and my teacher has been able to recreate in the past using Java. (except he simply used the constructor instead of a "Start" method)

Here is where my problem comes in: I can't find a way to call the Update() method from all those classes that derive from GameObject. My teacher was able to get this working in a small java framework by putting this for-loop in the main-loop of the program:

if(_gameObjList.size() != null){
   for(int i = 0; i < _gameObjList.size(); i++)
   {
     _gameObjList.get(i).Update();
   }
}

Now im pretty sure that this is the correct c++ equilavent of that code:

if(_gameObjList.size() > 0){
   for(unsigned int i = 0; i < _gameObjList.size(); i++)
   {
     _gameObjList[i].Update();
   }
}

In the GameObject class of that java program there's an empty Update() method, which, if removed will break everything, and offcourse in every class that derives from GameObject there's also their own Update() method which for some reason gets called too, but does not give an error if removed. So this way all Update() methods from all classes that derive from GameObject get called even though from the code, it looks like it's just calling that Update() method from the GameObject class itself and not the classes that derive from it.

So now i wish to use this magic in my c++ program but it doesn't work. It just calls the Update method from the GameObject class and does nothing else :/ It won't call the Update functions of the classes that derive from it.
So perhaps there are any sorcerers online on this forum who can explain this magic to me and how to use it? Or perhaps another way of executing all Update functions without calling all of them specifically?

Sidenote: if in the java program, i change the name of the Update() function in one of the classes that derive from GameObject, it won't be called/executed but doesn't give me any errors either. That specific object just won't be updated anymore.

Sorry for writing all this text, i just want to be as clear as possible.

sentences:
How to create a smooth rotation with a constant angle? I am trying to make a game where the player can only rotate to 4 angles. Something like this

I cannot use Quaternion.Rotatetowards because the player's position is not constant, but I don't have the problem with movement. The problem I am having is that when I use transform.Rotate of 90 degrees it creates a sudden rotation. I would like to have that rotation smooth. I have tried using Slerp but I don't think I quite get the syntax I need to use.

Both Vector3.Slerp, and Quaternion.Slerp interpolate between two different positions, when my player turns I would like him to keep his current position, and only turn his "face" towards the desired position. I would appreciate the help. Thanks.

sentences:
Deferred Rendering with SFML I've been looking to implement a deferred rendering system in SFML.

I've read the tutorials on OGLdev for it, and I was wondering how to draw a scene built in SFML (sprites, text, etc) to the multiple render targets needed for the deferred shading process.

Basically, I need to be able to get SFML to draw every object to the GBuffer's MRTs, so I can have the parameters needed to do what I want.

Is this possible, or will I have to build my own rendering backend from scratch?

sentences:
Deterministic Procedural Wave Function Collapse I've been looking into the Wave Function Collapse algorithm and was wondering if there is a way to make it (appear) deterministic regardless of starting position.
I can see how this is trivial if the starting position remains the same. We can simply always collapse the tile with the lowest entropy and use a seeded pseudo random number generator or a noise function to decide which is next whenever there isn't a clear winner.
Now what would be the best solution if I wanted to procedurally generate a world around the player? Say I generate the world in chunks. If a player moves far enough away distant chunks get unloaded and new chunks are generated.
This works perfectly fine until the player starts to backtrack. Since tiles depend on their neighbors, a revisited chunk might very well look completely different if approach from a different direction.
I can think of two possible solutions:
a) Always generate the world from a set starting position.
This doesn't seem feasible in big worlds, as it would require more resources the further away from the starting position the player is.
b) Only generate chunks once and then save them.
I don't really like this approach, because it could potentially require a lot of disk space. It's also not really deterministic, because the order in which the player explores the world would still influence what individual chunks look like.
Is there a solution I'm overlooking or is this simply not possible because of how the algorithm works? Keep in mind that I don't care if the algorithm itself is actually deterministic regardless of starting position. The result just has to appear that way, so that already visited chunks can be recreated unchanged.

sentences:
How to securely submit a score? We have an app with several mini-games in it and in each a highscore can be achieved. The score gets submitted by requesting an endpoint and passing the score as a json in the body. How can we be sure that the client is sending us the correct score? Our current solutions:

we're using wss, so man in the middle should be not possible
the client can access the endpoint only after authenticating with his device (over gamesparks)
at least on Android we're obfuscating the code
we're saving each score in two different variables and comparing them before sending one of them

Is there anything more we can do to secure the game? It seems to be quite effective to just submit the player interactions and calculate the scores server-side, but that seems - because of our several completely different games - to complicated in our case. What is about creating a hash of the score and comparing it on the server?

sentences:
Cubic bezier for easing? I would like to find out what Y is if X is a certain number from a cubic bezier curve to make a custom easing function, like it's done on this site: http://cubic-bezier.com/
Does anyone know a formula or a function to find Y if X is something of a cubic-bezier? (Coding in C#/XNA)

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:
How can I assign disabled Text ui to array in the Inspector? using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class BlendShapesController : MonoBehaviour
{
    public Text[] texts;
    public bool startTalking = false;
    public float talkTime;
    public float duration;
    [Range(0, 100)]
    public float valueRange;
    private SkinnedMeshRenderer bodySkinnedMeshRenderer;
    private bool isTalking = true;

    // Start is called before the first frame update
    void Start()
    {
        bodySkinnedMeshRenderer = GetComponent<SkinnedMeshRenderer>();
    }

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

        if (startTalking && isTalking)
        {
            StartCoroutine(AnimateMouth());
            StartCoroutine(TalkTime());

            isTalking = false;
        }

        if (startTalking == false && isTalking == false)
        {
            isTalking = true;
        }
    }

    //Lerp between startValue and endValue over 'duration' seconds
    private IEnumerator LerpShape(float startValue, float endValue, float duration)
    {
        float elapsed = 0;
        while (elapsed < duration)
        {
            elapsed += Time.deltaTime;
            float value = Mathf.Lerp(startValue, endValue, elapsed / duration);
            bodySkinnedMeshRenderer.SetBlendShapeWeight(0, value);
            yield return null;
        }
    }

    //animate open and closed, then repeat
    public IEnumerator AnimateMouth()
    {
        while (startTalking == true)
        {
            yield return StartCoroutine(LerpShape(0, valueRange, duration));
            yield return StartCoroutine(LerpShape(valueRange, 0, duration));
        }
    }

    public IEnumerator TalkTime()
    {
        yield return new WaitForSeconds(talkTime);

        startTalking = false;
    }

    public void StartTalking()
    {
        for (int i = 0; i < texts.Length; i++)
        {
            if (texts[i].text != "")
            {
                startTalking = true;
            }
        }
    }
}

I want that if one of the ui texts is not empty and not disabled to start talking by calling the StartTalking method. The game start when all the ui texts are disabled one of them is not empty but they are all disabled. And during the game they are turning disabled enabled in the game and get empty not empty.  On the ui text is not empty.
The problem is in the Inspector I can't drag disabled ui texts to the array of the script.
All the ui texts are childs under their own parents that are childs of the prefab name Game UI Texts.

This are the ui texts in the screenshot that should be dragged to the sccript on the right in the Inspector :
Scene Text , Description Text , and Long Distance Description Text
The main goal is to use one script to control automatic the talking with the text in the game.
When there is a text in the game on the screen StartTalking and stop talking when there is no text on the screen.

sentences:
Render 3d object to 2d surface (embedded system) i am working on an embedded system of a sort, and in some free time i would like to test its drawing capabilities.

System in question is ARM Cortex M3 microcontroller attached to EasyMX Stellaris board. And i have a small 320x240 TFT screen :)

Now, i have some free time each day and i want to create rotating cube.
Micro C PRO for ARM doesnt have 3d drawing capabilities, which means it must be done in software.

From the book Introduction to 3D Game Programming with DirectX 10 i know matrix algebra for transformations but that is cool when you have DirectX to set camera right.

I gues i could make 2d object to rotate, but how would i go with 3d one?

Any ideas and examples are welcome. Although i would prefer advices. I'd like to understand this.

sentences:
Why would the same script attached to multiple scenes not work the same way in some of the scenes? I have 4 scenes in my Unity Project. And in each scene I have identical sliders, what I want to do when Advance_Trial is called via a button press, the sliders' value resets to 0. However, this only works for two of the scenes. For remaining two it doesnt work, I checked if Advance_Trial is attached to the button gameobject which calls it and it is (in all scenes).  There are no errors messages in the console either.
How do I correct it?
Also, when the else portion is executed the sliders are not inactive meaning, the sliders are still visible. This happens for the same two scenes for which the sliders do not reset.
Am I missing something? Or do I need to check something in individual scenes?
Please see my code below.
public Slider[] sliders;

    public void Start()
        {

            sliders = FindObjectsOfType<Slider>() as Slider[];

            for (int s = 0; s < sliders.Length; s++) //Resets the sliders
            {
                sliders[s].gameObject.SetActive(false);
            }
    }
     public void Advance_Trial()
        {
            for (int s = 0; s < sliders.Length; s++)
            {
                sliders[s].value = 0;
            }

            int stimIndex = UnityEngine.Random.Range(0, signals.Count + 1);
            string text = stimIndex.ToString();
            byte[] data5 = Encoding.ASCII.GetBytes(text);
            client.Send(data5, data5.Length, remoteEndPoint);
            Debug.Log("<color=yellow>Signal played is:</color>" + stimIndex);
            Debug.Log("<color=magenta>NUMBER sent to MAX is:</color>" + text);

            Debug.Log("<color=magenta>Index removed was :</color>" + signals[stimIndex]);
            signals.RemoveAt(stimIndex);

            if (signals.Count > index)
            {

                Debug.Log("<color=orange>Yay! Keep Listening!</color>");
                index++;
            }

            else
            {

                Debug.Log("<color=green>All Trials finished</color>");

                for (int s = 0; s < sliders.Length; s++)
                {
                    sliders[s].gameObject.SetActive(false);
                }

                EndSessionPanel.gameObject.SetActive(true);
            }

        }

sentences:
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:
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:
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:
Why would I want to set a minimal OpenGL version before creating the context? Typical GLFW applications have these lines after glfwInit():
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);

And similarly:
glfwMakeContextCurrent(window);

I get that glfwMakeContextCurrent is needed before sending calls to the OpenGL API, but the doc says

You can require a minimum OpenGL version by setting the GLFW_CONTEXT_VERSION_MAJOR and GLFW_CONTEXT_VERSION_MINOR hints before creation

But why would I want that? Why would I cut options for OpenGL versions? I did not understand that, if I am interpreting it correctly in the first place

sentences: Materials when rendering geometry When specifying the material (ambient/diffuse/specular) for use in lighting calculations, what level of detail is the material specified at? Per vertex, mesh, bone?

sentences:
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:
Create sprite renderer using custom material I have done following thing.

Create Material
Attach sprite with texture type as Texture
Add sprite renderer component to game object
Assign material to it that I create in last steps

There is no sprite available for selection. Following image illustrate my problem correctly.

So my question in how to create sprite renderer with custom material?

sentences:
Deserializing component array using JSON I have a collection of serialized components in JSON format:

{
    "components": [{
        "class": "com.package.component.PositionComponent",
        "x": 100,
        "y": 100
    }, {
        "class": "com.package.component.VelocityComponent",
        "x": 4,
        "y": 2
    }]
}

I want to load this into a collection of base Components in Java, specifically into an Entity. I am currently using YAML (parsed using SnakeYAML) to achieve this. The following file (which is virtually identical to the JSON one) is parsed and the components are stored in an ArrayList:

components:
- ==: com.package.component.PositionComponent
  x: 100
  y: 100
- ==: com.package.component.VelocityComponent
  x: 4
  y: 2

Is there any way I can achieve this using the JSON parsing facilities provided by LibGDX? I am currently using the following code to parse the components, but I have no idea how to get it to construct the correct appropriate object for each component:

JsonReader reader = new JsonReader();
JsonValue base = reader.parse("components.json");

for (JsonValue component : base.get("components")) {
    System.out.println(component.getString("class"));
}

sentences:
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:
Overlay partially transparent texture onto another, but not the background I'm using XNA and C#.
I have two shapes (texture2ds), and I want to overlay shape 2 (50% transparent square) over shape 1 (opaque circle), but I want to get Option B, not Option A.

I basically want to render only the part of the square that's over the circle, without rendering the rest of the square over the background.

EDIT: Let me clarify why exactly I want to do this. I'm essentially using something like this as cheap shadows on top-down 2d planets. When a moon, planet, and sun are all in a 180 degree line, the moon is expected to be completely shaded. So I want to put a shadow behind the planet that won't cover the background, but when the moon passes under it, it gets shaded black.

sentences:
Do I need a rendering system in my engine? I am planning to create a cRPG game engine that would allow to easily create games like Baldur's Gate. I already tried to do that once, but my knowledge was vastly insufficient at the time. I settled for C++, SFML and TGUI (a GUI library), as this is what I have most experience with. I've read this article on game engine architecture, and I have decided to follow that system's architecture (event/message driven), because I know how much of a unworkable hairball my previous attempt was.

I am mindmapping the concept and its architecture for the past few days now (something I didn't do at all previously); and I came up to the point of how I want to divide (or do I?) the gameplay and rendering. The rendering part is actually very simple, as SFML does bulk of the job. I concluded that I don't even know what I could place in the rendering system apart from drawing sprites. I also can't seem to find more resources about game engine systems, because every time I search for that I get system requirements for unity and unreal.

If I decide to go with the rendering system, what would be the best way to store and send sprites? I suppose that I need to make a sprite resource manager. If so, how is the best way to send them to the render system without coupling things too much? Or perhaps the sprite resource manager should reside in the render system itself?

EDIT:
As of current, the planned architecture is divided into 6 systems (Input, Audio, Logging, GUI, Gameplay, Render). I will use Events for decoupling. The problem with this design is that i will have at least 3 direct connections between GUI, Gameplay and Render. Those are:

Between GUI and Render. The TGUI library introduces a TGUI Window class that inherits from SFML one, and can be used as one. In my case, it will be a part of the Render system. Hovewer, the GUI system will need to have a pointer to the Window to register GUI widgets.
Between Gameplay and Render. Where applicable, Actor class will have a AnimatedSprite, which i will implement on my own. It will be a part of the Gameplay system, and will have a pointer to the sprite in resource manager (in the Render system); it will just cut it depending on animation/frame. In some cases, when animations are not required, the Actor class will just have pointer to a normal sprite. To get those pointers a function in resource manager will be called from the Gameplay system.

The latter of two is the major problem; as the function could be called at any time. But, it would be a simple function like sf::Sprite * getResource(std::string name) so i think it wont present all those big bad problems of coupling.

sentences:
Rendering up close, OpenGL performance issues I have been developing a massive RTS during the past 18 months, which is comming together nicely!

Now i have an issue i can't really wrap my head around.

If i render 100 models from a distance where the camera can see them all, everthing works perfectly. If i then render them when there camera is up close, my GPU goes to 100% and of course everything starts to lag. I don't really get the difference, the math is the same.

Works on Nvidia m1000m and burns on AMD RX5700.
OpenGl version 4.1.

CPU, memory and GPU memory stays the same so i don't suspect any leaks.

I have tried debugging with glGetError() and CodeXL, no luck.

Am i missing something simple in OpenGL?

sentences:
How to handle player slowness while moving up and down in a Top Down game with angled ortho camera and angled sprite due to stretching of ground? So i'm making a 2D top down game setup in 3D using tilted Sprites and angled orthographic camera.
My camera setup is as shown.
In my game I have the floor flat on the X/Z plane with walls/characters rotated +45 degrees about the X axis. The orthographic camera is pointing down also at 45 degrees about the x axis, parallel with my walls/characters.
As a result, I dont see any distortion for players/characters since they face the camera directly on, while the ground however sees a distortion of sqrt(2) shorter. This makes sense considering how an orthographic camera works. To fix this, I've made my Tilemap set up with X:1 Y:1 Z:Sqrt(2) so that each tile is stretched on the Z axis by Sqrt(2) to compensate for this distortion.
All looks well with only one problem now... foreshortening with regards to movement: Forward and backwards movements of objects/characters along the z axis are perceived to be slower than movements left/right on the x axis. This makes sense because while each tile is perceived to be a square in the camera view thanks to scaling Z on the tilemap by sqrt(2), the real world tile is, well, sqrt(2) times taller than its width, so obviously it takes longer to travel forwards / backwards.
How do i correct this?

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: what is the difference between CCSprite and a PhysicsSprite? I am new to Cocos2D and I've realized that most of the codes written before the Cocos2d update used CCSprites. Recently I realized a lot of more recent codes after the update are using PhysicsSprite. What is the difference? What advantages does one have over the other, if any?

sentences:
How can I implement 3D textures using webgl? I went through the google I/O video but did not get exactly how to do it. If somebody could point me to a simple 3D texture implementation using webgl, it would be helpful.

i basically have a volume, a cube, i want to fill it up with pixel data, which comes from a stack of images along the x-y axis. How do i do that?

sentences:
how to make weapon charge up behavior using composition I am trying to design different weapon behaviors.

Right now, there are 3 different types of weapon behaviors that i would like to implement.

When not pressing anything, weapon fires at a regular slow interval. When mouse Pressed, weapon fires at a rapid interval
when not pressing anything, weapon does nothing.  when mouse pressed, weapon charges up.  when mouse released, weapon fires
when not pressing anything, weapon charges up automatically.  when mouse Pressed, weapon fires, and then automatically the weapon charges up.

I'm sure there are more to add, but I'm just starting to learn about composition.  Can someone explain to me how I might generally write such behaviors for the weapons in a composition over inheritance manner?  I'd like to be able to simply swap out one weapon behavior for another just to see how the game might change, and I don't want to have to keep copying and pasting code which is what I seemed to be doing.

I'm guessing that I should use an interface (I'm using Java)  called WeaponBehavior perhaps?  So then should every base weapon implement this interface?  And then i put that interface somewhere within my weapon.run() loop that I have made?  (Heroes have weapons, and when heroes run, they run their weapons).  Or is it that there is a behavior object instead?  I think this is what I'm confused about.

I'd just like to know what skeleton code might look like as opposed to what I am currently doing, which is making the behaviors for each specific weapon that inherits from some base weapon.

abstract Class Weapon //implements WeaponBehavior??
{
// should I have an object called WeaponBehavior instead of implementing an interface?
Weapon()
{
}

void run()
{
  update();
  //behavior somewhere here?
  render();

}
void update()
{
  //does behavior go in here?
}
abstract void render();//how does the weapon look
abstract void fire(); // this has to be called at some point
abstract void handleMousePress(); //

}

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:
Loop through multidimensional array in C#(Unity) I have this data

As you can see there's a 2nd board there.

Now what i want is something like this

PSEUDO CODE

If the first boards table[1,1] is not `NULL` then I will need to find out
now if table[0,1] and table[0,0] has the same length as table[1,1] and
table[1,0]

then display in the 2nd board a blue circle if it is the same in length if
not red circle

But if the table[1,1] is `NULL` then I need to know compare 1st column and
2nd column if they have the same length

then display in the 2nd board a blue circle if it is the same in length if
not red circle

END PSEUDO CODE

I tried doing the following

//COLUMN
    for(int col = 0; col < table.GetLength(0); col++)
    {
        int sum = 0;
        //ROW
        for (int row = 0; row < table.GetLength(1); row++)
        {
            if (table[col, row] != null)
            {
                Debug.Log("Column 1 has this value : " + table[col, row]);
            }
        }
        //Debug.Log("table column: " + col + " has " + sum + " data");
    }

For now I can only get the whole Row and Column but I don't know how to do that pseudo code.

sentences:
How to represent ray and line segment in parametric form?(Visibility) I am trying to implement this algorithm but am not sure how I am supposed to represent my ray and my line segments(walls).
For the r_px/r_py do I just use the position of the light? For the r_dx/r_dy do I just use the normalized vector pointing from the light position to the direction of the ray?
For the s_px/s_py do I just use the location of one of the two points of the line segment. Finally for the s_dx/s_dy do I just use the normalized vector pointing from the first point, to the second point?
Thanks!

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:
Going from point a to b through a curve using "gravity" I have enemies and when they die they spawn an energy ball with a given velocity. I want to move this ball to the player using "gravity" to create a curved path. I have a version of the function but it is not arriving correctly to the end point without tweaking gravity force (if gravity is low, the velocity vector is not changed fast enough to get to the target position). Has anyone done this previously? I prefer to use gravity than a function curve like a bezier.

We can assume player will be stand still. So, it does not move. Target position will remain the same.

Here the code I'm using right now, I'm using unity3d:

    float gravityMultiplier = 100;

    _gravity = (targetPosition - _t.position).normalized*gravityMultiplier;
    _gravity.z = 0;

    velocity += _gravity * Time.deltaTime;

    _t.position += velocity*Time.deltaTime;

What I'm doing here is just modifying the velocity of the object to make it be attracted by a point at targetPosition. _t is just the gameobject transform.

Thanks in advance.

sentences:
Integer linear program solver based AI Is Integer Linear Programming a viable solution for a turn based game AI?

My current AI solution uses an ILP solver. If you are unfamiliar with ILP, it uses a collection of Booleans to find most optimal solution to a linear problem.

I'm concerned about fluctuations in performance and I"m also thinking of portability. I am using C++ to prototype. I have access to an ILP solver that works well with it. I don't know if I"ll find one that I can use on portable devices. I'm unsure if can rely on the computation time being reasonable with an N large enough to get the results I"m planning for.

I am wondering if anyone used this technique (ILP based AI) and would advice against it or in favor of it. Also are there any other (portable and effective) optimization tools that could be used for a similar result? I read about NegaScout but I did not find a book or tutorial that could provide me with a deep understanding of it.

I also read this question which did not help: Implement Negascout Algorithm with stack

sentences:
Billboarding restricted to an axis (cylindrical) I have succesfully created a GLSL shader for a billboarding effect. I want to tweak this to restrict the billboarding to an arbitrary axis, i.e. a billboarded quad only rotates itself about the y-axis. I use the y-axis as an example, but essentially I would like this to be an arbitrary axis. Can anyone show me how to modify my existing shader below, or if I need to start from scratch, point me towards some resources that could be helpful?

precision mediump float;

uniform mat4 u_modelViewProjectionMat;
uniform mat4 u_modelMat;
uniform mat4 u_viewTransposeMat;

uniform vec3 u_axis; // <------------ !!! the arbitrary axis to restrict rotation around

attribute vec3 a_position0;
attribute vec2 a_texCoord0;

varying vec2 v_texCoord0;

void main()
{
    vec3 pos = (a_position0.x * u_viewTransposeMat[0] + a_position0.y * u_viewTransposeMat[1]).xyz;
    vec4 position = vec4(pos, 1.0);

    v_texCoord0 = a_texCoord0;

    gl_Position = u_modelViewProjectionMat *  position;
}

EDIT - The modified shader for cylindrical billboarding.
Its very straight forward! Just swap out the up vector for the axis to restrict rotation about.

precision mediump float;

uniform mat4 u_modelViewProjectionMat;
uniform mat4 u_modelMat;
uniform mat4 u_viewTransposeMat;

uniform vec3 u_axis; // <------------ !!! the arbitrary axis to restrict rotation around

attribute vec3 a_position0;
attribute vec2 a_texCoord0;

varying vec2 v_texCoord0;

void main()
{
    vec3 pos = (a_position0.x * u_viewTransposeMat[0] + a_position0.y * vec4(normalize(u_axis), 0.0)).xyz;
    vec4 position = vec4(pos, 1.0);

    v_texCoord0 = a_texCoord0;

    gl_Position = u_modelViewProjectionMat *  position;
}

sentences:
Generating a set of islands in real time With thismethod I can create multiple separated islands just by randomly choosing a point as the center for a gradient. Now what I want to do is to have a system of real time generation like the one in Minecraft.

When I generate a new chuck, some random points inside of it are chosen to be the center of a gradient. However, if one of these points gets positioned near the border of the chuck, the gradient will cross the border and affect the other chunk. But if that other chunk was already generated and visited by the player, I couldn't update that chunk to include the new gradient, so I would end up with something that looks like this:

What could be a method to avoid this?

sentences:
Cardboard on iPhone 5 doesn't render on stereo Has anyone ran into this?

I'm on Unity 5.1.1p3, Cardboard Unity Integration v0.5 (5/28/2015) and an iPhone 5 running iOS 8.3 (12F70).

I made a game that uses Cardboard and on an iPhone 6 the screen renders as expected: two offset cameras. On an iPhone 5 however, while the screen does show the 2 viewport masking and the distortion correction, it's actually a single camera that is being rendered, defeating the purpose of Cardboard.

Here's what I mean. This is the iPhone 6, as expected:

And this is the iPhone 5, which is wrong:

Any ideas?

Some extra info:

The iPhone5 can only use GLES2. It doesn't support ES3 or Metal. But what I did notice is that if I make a build for GLES2 the first time the app runs on the device (be it iPhone 6 or 5), when the Cardboard camera gets enabled, the app crashes:

If then I quit the app and start it again from the phone without it being hooked up to Xcode, on the iPhone5 I get the wrong rendering I've shown while in the iPhone 6 the app just crashes again. And if instead I make my build with automatic graphics API detection, what happens is that on iPhone6 it goes to Metal mode and so it works fine and on the iPhone5 it goes to GLES2 mode which, as stated before, crashes if attached to Xcode but otherwise just runs only that with the wrong rendering.

sentences: How to move an object in a heart shape pattern in javascript? How can I move an object in a heart shaped pattern? I have a move(x, y) function that I can use to move the object, but how to I make a function that will move the object in a heart shaped pattern, with something like a setInterval?

sentences:
Unity Collision Difficulties (How do I make a ground in unity with lots of pieces that doesn't have poor collision?) So I'm working on this game that I came up with the idea for while watching the Unity Roll-a-ball tutorials. So it's probably important to note that I'm extremely new to game design and I don't have a whole lot of experience in programming.

So the game idea that I had is a lot more complex than what it should be for someone who's pretty much completely new to game design, so I guess I'm trying to break it down into smaller bits until I have enough experience to build it into a cohesive game.

Currently what I want to work on is a game where you play as a sphere rolling down a plane with open edges so you can fall off. There are walls that you have to avoid, and if you run into them it will take away from the space between the walls and the edge of the plane. I guess I was sort of thinking of having a sort of similar visual style as bastion in that sense.

The way I thought I would go about this is to break the plane up into smaller squares and then do some programming so that when you run into the walls the smaller squares at the edge of the plane fall off. Though before I could even get to programming I ran into a big problem. Because of the way Unity physics work and the way I built the ground, the player collision with the ground is god awful. When I was just testing it with some basic controls the ball would roll all choppy and if I picked up enough speed it would start to jump. I assume this is because it's colliding with all the edges of the grid system that I built.

Does anyone know of any way I can program the edges to not interact with the player? Or if there's a better way to go about doing this?

sentences:
The state that is synced when a window is broken in a FPS game In order to better understand how state syncing works in games, I wanted to pose a specific example. Say you are in a FPS game with multiple players and someone breaks a window in some building. Wondering what happens in terms of state syncing. For example, there are these aspects:

Someone else is watching the player break the window in the game. So it should probably be a real-time update.
Someone isn't watching but they hear the sound of the window breaking.
Someone is out of range of hearing or seeing the window break, so wondering if it still updates their game world, or it somehow lazily picks up the changes when they go to the area with the broken window.

Wondering how it generally works in these different scenarios. Any FPS game is fine. For example, in (1), if they are sending each individual particle of broken glass over the internet, or somehow they just send the generic action "user x threw object y at window z" and it replays the action on everyone's computer who is watching. In which case somehow the game world is broken up into macro chunks rather than being composed of particles. In (2), maybe they divide the level into zones of seeing and hearing range, and somehow send just the right amount of state then (wondering what kind of state, and how much). Then in (3), if it is lazily picked up, then what sort of queue is kept on the backend. If the data is compressed when it is sent, etc.

sentences:
Reading text from file changes the text? I'm currently trying to load a simple text file and filter it by a certain string. In the text file I'm using a new line for each value and sometimes use a "--" to make things easier to read for me when viewing the .txt-file.

Now, when I load the file and split it by new lines I end up with a list of substrings, each representing a value I need. Plus, all the "seperators" I put into the file.

My goal is to clean the list from all the seperators and basically just remove them from the list. However, RemoveAll does not work and I found out that the strings containing "--" are not really "--", but something else, because using string.Equals("--") fails on them.

Somewhere when reading the data or splitting it, something happened to those parts, but I can't figure out what's happening.

Here's the code:
void Awake() {

    _fileLines = new List<string>();

    TextAsset txt = Resources.Load<TextAsset>("SubjectPages/test");
    _fileLines = new List<string>();
    _fileLines = txt.text.Split(new string[] { "\n" }, System.StringSplitOptions.None).ToList<string>();

    _fileLines.RemoveAll(x => ((string)x) == "");
    _fileLines.RemoveAll(x => ((string)x) == "--");

    for (int i = 0; i < _fileLines.Count; i++) {
        Debug.Log(_fileLines[i] + " | " + (_fileLines[i].Equals("--")) + " | " + (_fileLines[i] == "--"));
    }
}

Removing empty lines with RemoveAll seems to work fine.

sentences:
LWJGL Determining whether or not a polygon is on-screen Not sure whether this is an LWJGL or math question. I want to check whether a shape is on-screen, so that I don't have to render it if it isn't. First of all, is there any simple way to do this that I am overlooking? Like some method or something that I haven't found? I'm going to assume there isn't.

I tried using my trigonometry skills, but it is hard to do this because of how glRotate also distorts the image a little for perspective and realism. Or, is there any way to easily determine if a ray starting from the camera, and going outward in a straight line intersects a shape? (I can probably do it with my math skillz, but is there an easier way?)

By the way, I can easily determine the angle at which the camera is facing around the x and y axis.

EDIT: Or, possibly, I could get the angles of a vector from the camera to the object, and compare those angles to my camera angles. But I have a feeling that the distorts from glRotate and glTranslate would be an issue. I'll try it though.

sentences:
What are the typical day-to-day tasks of an entry level games programmer? What I would like to know is: What are the daily duties of a graduate programmer in the games industry workplace? Is it mostly coding, analysing, designing, or what?

Thank you.

P.S. I am in my second year of University at the moment and am working towards specialising in games programming, specifically gameplay, tools or UI programming.

sentences:
How to store an array of prefabs together with configuration parameters I have attached the following script to a number of weapon prefabs:

public class WeaponScript : MonoBehaviour {

    public enum Direction {Right, Straight, Left};
    public Direction weaponDir;

    void Start () {
        prepareDirection (weaponDir);
    }

    void prepareDirection(Direction dir)    {
        if (dir == Direction.Straight)  {
            transform.localEulerAngles = new Vector3 (0, 0, 0);

        }

        else if(dir == Direction.Left)  {
            transform.localEulerAngles = new Vector3 (0, 0, -30);
        }

        else if(dir == Direction.Right) {
            transform.localEulerAngles = new Vector3 (0, 0, 30);

        }
    }
}

I also added the following script to an empty game object SetupWeapon:

public class SetupWeaponsScript : MonoBehaviour {

    public GameObject[] weaponPrefabs;
    public GameObject[] weapons;

    void Start ()
    {
        weapons = new GameObject[weaponPrefabs.Length];

        for (int i = 0; i < weaponPrefabs.Length; i++)
        {
            weapons[i] = Instantiate(weaponPrefabs[i]) as GameObject;
        }

    }
}

When I select my SetupWeapon object, I am able to populate the weaponPrefabs array with the weapon prefabs I want to use, but I can't directly alter their parameters in that same inspector view. I want to be able to override the direction of each weapon prefab in the list, rather than use the value that's stored on the prefab itself.

How can I create the weaponsSetupScript in such a way that I can set the direction enum for each weapon entry at the same time that I set select the prefab in the editor? I believe it might have something to do with inheritance, just not too sure how to go about it though.

sentences:
Delta Time FPS with SDL 2 in C++ I have tried achieving a good delta time and fps counter over the last few days, read and watched a lot about it, but still can't seem to get it to work.
Here is an example:
#include <iostream>
#include <SDL.h>
#include <SDL_image.h>

int main(int argc, char* argv[]) {

    if (SDL_Init(SDL_INIT_VIDEO) != 0) {
        printf("error initializing SDL: %s\n", SDL_GetError());
    }

    SDL_Window* window = SDL_CreateWindow("Title", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1000, 900, SDL_WINDOW_SHOWN);

    if (!window) {
        printf("error creating window: %s\n", SDL_GetError());
    }

    Uint32 renderFlags = SDL_RENDERER_ACCELERATED;
    SDL_Renderer* renderer = SDL_CreateRenderer(window, -1, renderFlags);
    if (!renderer) {
        printf("error creating renderer");
        SDL_DestroyWindow(window);
        SDL_Quit();
    }

    SDL_Surface* surface = IMG_Load("dot.bmp");

    if (!surface) {
        printf("Error creating surface: %s\n", SDL_GetError());
        SDL_DestroyRenderer(renderer);
        SDL_DestroyWindow(window);
        SDL_Quit();
    }

    SDL_Texture* texture = SDL_CreateTextureFromSurface(renderer, surface);
    SDL_FreeSurface(surface);
    if (!texture) {
        printf("error creating texture: %s\n", SDL_GetError());
        SDL_DestroyRenderer(renderer);
        SDL_DestroyWindow(window);
        SDL_Quit();
    }

    SDL_Rect dest;

    dest.x = 0;
    dest.y = 0;

    SDL_QueryTexture(texture, NULL, NULL, &dest.w, &dest.h);

    Uint64 NOW = SDL_GetPerformanceCounter();
    Uint64 LAST = 0;
    double deltaTime = 0;

    while (true) {
        LAST = NOW;
        NOW = SDL_GetPerformanceCounter();
        deltaTime = (double)((NOW - LAST) / (double)SDL_GetPerformanceFrequency());

        SDL_RenderClear(renderer);

        dest.x += 50 * deltaTime;
        dest.y += 50 * deltaTime;

        SDL_RenderCopy(renderer, texture, NULL, &dest);

        SDL_RenderPresent(renderer);

        std::cout << "Delta Time: " << deltaTime << std::endl;
        std::cout << "FPS: " << 60.0 - deltaTime << std::endl;

        SDL_Delay(1000.0f / (60.0 - deltaTime));
    }

    return 0;
}

I used the suggestion from this post: How to calculate delta time with SDL?
I print out "delta time" and "FPS" to the console and, while the deltaTime is slightly different each time, the FPS is stable 60 (which is the same value that I use in SDL_Delay to calculate delay in ms).
But the test image is clearly moving not smoothly, it stutters and moves at inconsistent speed, and I can't understand why.
Please help me understand what I am doing wrong. I just can't understand it even after looking through many examples.

sentences:
How can I read from multiple textures in an OpenGL ES 2 shader? How can I enable more than one texture in OpenGL ES 2 so that I can sample from all of them in my shader? For example, I'm trying to read from two different textures in my shader for the player's car.

This is how I'm currently dealing with the texture for my car:

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, this->texture2DObj);
glUniform1i(1, 0);
glBindBuffer(GL_ARRAY_BUFFER, this->vertexBuffer);
glEnableVertexAttribArray(0);

int offset = 0;
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, this->vertexBufferSize,(const void *)offset);

offset += 3 * sizeof(GLfloat);
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, this->vertexBufferSize, (const void*)offset);

glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, this->indexBuffer);
glDrawElements(GL_TRIANGLES, this->indexBufferSize, GL_UNSIGNED_SHORT, 0);
glDisableVertexAttribArray(0);
glDisableVertexAttribArray(1);

sentences:
Unity - GameObject jumps to wrong point at start In Unity, I have this problem where the Game Object this script is attached to jumps to Z position 0 as soon as the game runs. In the Editor, I have the Game Object set as Z position -50. I want startPos to read this position (-50) and use it when newPos is updated.

Why does startPos get updated immediately to 0?

using UnityEngine;

public class MoveOutScript : MonoBehaviour {

    public float speed = 10f;
    float startPos;
    Vector3 newPos;
    float changePerSecond2;

    public void Start()
    {
        startPos = transform.position.z;
        changePerSecond = speed * Time.deltaTime;
    }

    public void Update()
    {
        #region Move sprite away steadily

        newPos.z += changePerSecond;
        newPos.z = Mathf.Clamp(newPos.z, startPos, 15f);
        transform.localPosition = newPos;

        #endregion
    }
}

sentences: When tracing how do I tell if I hit a wall or floor? I perform a trace and when it hits the world I get a location and the surface normal.  Does anyone have a good way to find out if I hit a wall or a floor?

sentences:
Has the Geometry Shader been abandonded? Advice says to either limit use or not to use it at all.

Friday Facts #251 - A Fistful of Frames | Factorio:

We tried it, and it worked great. We got some speedup due CPU needing to prepare less data, but when doing research how different APIs work with geometry shaders, we found out that Metal (and therefore MoltenVK) on macOS doesn’t support geometry shaders at all. After more digging, we found an article called Why Geometry Shaders Are Slow. So we tested using the geometry shader on a range of PCs in the office, and found that while it was faster on PCs with new graphics cards, the older machines took a noticeable performance hit. Due to the lack of support on macOS and the possible slowdown on slower machines, we decided to drop the idea.

Geometry Shader Debugger · Issue #2110 · baldurk/renderdoc · GitHub:

Geometry shaders are inefficient especially when expansion is used like that and that's the case that GPU vendors explicitly recommend against.

I just wanted to let you know that geometry shaders have been virtually abandoned, since with them still being in the API not everyone is aware of that.

GPU Programming Guide - GeForce 8 and 9 Series (Chapter 4):

But in general, the potential for wasted work and performance penalties for using a GS makes it an often unused feature of Shader model 4.

OpenGL - geometry shaders

Can someone give me a list of geometry shader usages? : gamedev

Geometry shaders can be used for Level-of-Detail subdivision of geometry, and people did expect to be able to use them for that. But AFAIK it turned out that their performance in that scenario is horrible, which is why we now have tesselation shaders for that purpose.

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:
Unity detecting edge of mesh or end of mesh I'm trying to create procedurally generated tiles and I've reached a point where I need to figure out the boundaries of the mesh or the outer vertices of the mesh.

    RaycastHit hit;
    if (Physics.Raycast(bound[ i ].v2, Vector3.forward, out hit)) {
    if (hit.distance > 2) {

I've tried raycasting all the vertices, but still can't get the vertices of the edge. The mesh does have a collider. any help on how i would go about this is appreciated, Thanks.

sentences:
Whats the least expensive way to play video in unity? Alright, Ive asked this various ways but my situation is I have several (over 100) objects that have screens that need to play animated videos on them. There does not need to be sound, but this is for VR so performance is an issue.

So far, after trying render textures and video materials and seeing that fps dropped, Ive been using this script to flip through sets of pngs and put them in the diffuse slot of a material:

public class VideoPlayerRawImage : MonoBehaviour
{
    public Texture[] frames;
    public int framesPerSecond = 60;

    public bool isEmissive = false;

    void Update()
    {
        int index = (int)(Time.time * framesPerSecond) % frames.Length;

        this.GetComponent<Renderer>().material.mainTexture = frames[index];
        if(isEmissive)
        {
            this.GetComponent<Renderer>().material.SetTexture("_EmissionMap", frames[index]);
        }

        if(index >= frames.Length-1)
        {
            index = 0;
        }

    }

Is this the most efficient way to play videos? What would be a drawback to this method/is there a better way?

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:
How do I make a shaped fluidSurfaceActor in UDK? I'm trying to make a fountain for my level in UDK. I've made the base of a fountain by using a Cylinder build and now I'm trying to put water in it. I want to use the fluidSurfaceActor but I notice that it's square, while my fountain is a cylinder!

Is there a way I can change the shape of the fluidSurfaceActor to fit the builder brush shape or is there another way to do this?

Here is a picture of what I'm talking about:

sentences:
JMonkeyEngine display a spatial in a Nifty GUI interface I want to display a spatial (or the rendering of a spatial/scene) in my HUD interface. I'm really not sure how to go with this. I have search the documentation, but all the queries I search yields no result, and all I could find about images is that one can specify one with the setBackgroundImage method in the builder and setImage from the ImageRenderer class. The latter takes a String or a NiftyImage, but I'm not sure how to create one without loading an image file.

Any help to understand this (if even possible) is appreciated. Thanks!

sentences:
Why is my call to SetDisplayMode not supported? I have some legacy DirectX code that always returns DDERR_UNSUPPORTED.

I originally developed the code using DirectX3, and I am porting it to DirectX7 after spending years away from programming.

The following line is returning DDERR_UNSUPPORTED rather than DD_OK:

hrRetVal = pDDraw->SetDisplayMode(dwWidth, dwHeight, dwBPP, 0, 0);

Could someone please take a quick peek and respond if you see why this might be the case? This is not a commercial application... just something to do for fun.

Based on the Microsoft on-line documents, the SetDisplayMode method is not deprecated, and should work. A compiled version of my legacy program written with DirectX3 renders graphics on newer OS's such as Windows 10, without issue. I am interested in making some changes.

This Video compilation unit:

Sets the video mode to 1024 X 768
Create a DirectX instance, set the cooperative level.
Which when destroyed will Restore video to original mode, and flip to GDI

void Video::Initialize(void)
{

  TRACE("Video::Initialize invoked\n");

  hrRetVal = {0};
  DWORD dwDefaultRefreshRate = 0x0;
  DWORD  dwWidth = 1024, dwHeight = 768, dwBPP = 8, dwRefreshRate = dwDefaultRefreshRate, dwFlags = 0x0;

  try
  {
    Check(hrRetVal); // check for DD_OK

    TRACE("Video: using emulation mode, no hardware\n"); // debugging
    TRACE("Video: DirectDrawCreateEx invoked\n");
    hrRetVal = DirectDrawCreateEx((GUID*)DDCREATE_EMULATIONONLY, (LPVOID*)&pDDraw, IID_IDirectDraw7, NULL);

    Check(hrRetVal); // TRACE value of hrRetVal
    if (DD_OK == hrRetVal)
    {
      TRACE("Video SetCooperativeLevel invoked\n");
      hrRetVal = pDDraw->SetCooperativeLevel(hwnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
      Check(hrRetVal);
      if (DD_OK == hrRetVal)
      {

        // Lets see if the video is supported
        hrRetVal = QueryVideoCapability();
        Check(hrRetVal);

        if (DD_OK == hrRetVal)
        {

          TRACE("Attempting to set video resolution to: %d %d \n", dwWidth, dwHeight);

          hrRetVal = pDDraw->SetDisplayMode(dwWidth, dwHeight, dwBPP, 0, 0); // this line always returns DDERR_UNSUPPORTED

          // hrRetVal == DDERR_UNSUPPORTED after call to SetDisplayMode

          Check(hrRetVal);
          if (DD_OK != hrRetVal)
            throw (VIDEO_EXCEPTION); // with throw an exception since hrRetVal == DDERR_UNSUPPORTED
        }
      }
      else
      {
        Check(hrRetVal);
        throw (VIDEO_EXCEPTION);
      }
    }
    else
    {
      Check(hrRetVal);
      throw (VIDEO_EXCEPTION);
    }
  }

  catch(int exception)
  {
    TRACE("%Xh exception caught by Video::Initialize\n", exception);
    Video::Check(hrRetVal);

    if (exception == VIDEO_EXCEPTION)
    {
      char message[80];
      strcpy_s ( message, "Unable to initialize video. ");
      strcat_s ( message, "\nApplication will now terminate.");
      FatalMessageBox( message );

      TRACE("APP_EXCEPTION thrown by Video::Initialize\n");
      throw (APP_EXCEPTION);
    }
  }
}

I'm using Visual Studio 2017 Pro v15.7.2, on Windows 10 Build 1803.

sentences:
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: 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:
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:
Render sprites onto a virtual 640x480 "screen" I'm making a game, and in part of it, the player uses a computer terminal. I want to draw to a virtual 640x480 screen with pixel precision, and then draw that "virtual screen" to the player's real screen. The end result will not be "pixel perfect" because 99% of people won't play the game at 640x480 -- and, in fact, I want to then go on and add further effects on top of this so it looks more like a CRT display -- but trying to figure out how to do pixel rendering in Unity has proven pretty difficult so far.

Basically I want to render something that looks like this:

onto the screen, where I draw all of the text characters myself (using Sprites? subsections of a Texture?), and then I want to render this "virtual screen" out onto the player's screen. I know RenderTextures are a thing, and maybe that's part of it? I've tried a lot of different things so far and got nowhere, hence why I'm posting here.

Sorry if this is too nooby of a question, I'm an experienced programmer who is relatively new to Unity.

sentences:
NavMesh.SamplePosition() fails after rebaking NavMesh? So today I was refurbishing a scene when this happened. After baking a new Navmesh the SamplePosition() returned only infinity. I tried a lot of things out but eventually went back to an older version of my project. Sooner or later I will have to bake a new Navmesh though, so I'd really like to know what happened there.

Here is the part of the code that appears to cause trouble:

Vector3 randomDirection = Random.insideUnitSphere * roamRadius;
NavMeshHit hit;
NavMesh.SamplePosition(randomDirection, out hit, roamRadius, 1);
direction = hit.position;

And of course this, since it tries  to look into infinity I suppose:

transform.LookAt(transform.position - direction, Vector3.up);

Again, this code works fine. Only after baking a Navmesh this fails horribly.

sentences:
How to do one-way collision? I would like to know how can I do one way collision. It's the collision common in mario's games and many platforms. I try to do an code but I cannot post because it's part of a paid game.
Basically I have two rectangles like this:

struct Rect {
  int x, y; // positions in the world
  int w, h; // width and height
};

The rect A moves and the rect B is fixed with the world.
Someone has a idea of how to do this?

sentences:
How to return reference from BlueprintImplementableEvent? I've got a C++ component and I want to have function which will be implemented in Blueprint like this:

UFUNCTION(BlueprintImplementableEvent)
Stats& GetStats();

But this doesn't compile, I get the following error:

  overload function differs only by return type from

and Unreal generates function inside .gen.cpp looking like this:

Stats Component::GetStats()
{
// ...
}

Stats is USTRUCT

sentences:
Unity: Import a mesh that only has vertex and edge data but no faces I am working on a game that requires meshes that only have edges and vertices but no faces.
In blender, you can make a mesh with only edges and vertices, but if you export it to FBX or OBJ, once it is imported into Unity, the resulting prefab has no mesh data linked to it. The prefab has no MeshFilter. It's as if I imported an mesh with absolutely no mesh data.

For example, if I create a plane in Blender and then delete the face but leave the edges and vertices, and then export as OBJ, I can open the OBJ in a file editor.
This is a square with no faces:

# Blender v2.78 (sub 0) OBJ File: ''
# www.blender.org
mtllib egdes.mtl
o Plane
v -1.000000 0.000000 1.000000
v 1.000000 0.000000 1.000000
v -1.000000 0.000000 -1.000000
v 1.000000 0.000000 -1.000000
l 3 1
l 1 2
l 2 4
l 4 3

So it appears that OBJ actually does export with the correct mesh data, however, it seems that Unity does not know how to import an OBJ if there are no faces.

Does anyone know if anyone has come up with a solution to this problem yet?
If not, I guess I'll just have to write my own parser. If that's the case, does anyone know if there is a way to extend or override Unity's built-in OBJ parser?

sentences:
Fix latency when sending state I have a multiplayer game done with Phaser, which runs in the browser and on a node.js server.

The server is authoritative, every 50ms or so it sends the game state object to all clients. The clients receive the state and update all instances accordingly. The game runs at 60fps, and the physics and AI are the same on clients on server, so if there is no user interaction the game will evolve exactly the same (the next frame on the server will be equal to the next one on the client). This should make sync much easier, but I have a problem:

When the client receives the state from the server, the state is no longer up to date (as there is the latency between server and client).

Here is a drawing:

Server: State1 -> State2 -> State3 -> State4 -> State5
................................................*-------------------V
Client : State1 -> State2 -> State3 -> State4 -> State5State3

So, when the client receives State3, it is no longer usable as it has already been at State3. This makes the game always rewind a few frames when it receives the update from the server. How can I solve this, taking in account that the same game engine runs on both client and server (so prediction is much easier).

I would try "rendering the game in the past" as I have seen in other cases, but I do not really think I can break Phaser physics/render loop connection.

sentences:
How to draw or translate into world space? I've been hacking around with OpenGL, but there's a few concepts which I can not find the answer on.

I want to draw three GL_QUADS next to eachoter like so:
1[2][3]

I know GL_QUADS are deprecated, but for this question i'd like to use them nonetheless.
Each quad will have its own color, the first being red, second green and the third blue.
[r][g][b]

my code:

void display()
{
  glClear(GL_COLOR_BUFFER_BIT);

  GLfloat vertices[] = {
    -1, -1,  1, -1,  1, 1,  -1, 1,
     1, -1,  3, -1,  3, 1,   1, 1,
     3, -1,  5, -1,  5, 1,   3, 1
   };

   GLfloat colors[] = {
    1, 0, 0,  1, 0, 0,  1, 0, 0,  1, 0, 0,
    0, 1, 0,  0, 1, 0,  0, 1, 0,  0, 1, 0,
    0, 0, 1,  0, 0, 1,  0, 0, 1,  0, 0, 1
  };

  glLoadIdentity();
  glEnableClientState(GL_VERTEX_ARRAY);
  glEnableClientState(GL_COLOR_ARRAY);

  glVertexPointer(2, GL_FLOAT, 0, vertices);
  glColorPointer(3, GL_FLOAT, 0, colors);

  glMatrixMode(GL_PROJECTION);
  glTranslatef(-1, 0, 0);

  glDrawArrays(GL_QUADS, 0, 12);

  glDisableClientState(GL_COLOR_ARRAY);
  glDisableClientState(GL_VERTEX_ARRAY);

  glFlush();
}

result being:

I'm confused as which to which matrix I should apply the translation matrix and in which order.
I'm almost certain I should not use glMatrixMode(GL_PROJECTION)
What are the initial values of a matrix?
I'm not certain which coords to pass in the vertex array at this point, model space or world space?

I hope you can shed some light in my confusion.

sentences:
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:
Why can a certain DirectX mode produce display lag? I have written two small test games using DirectX 9. One uses

presentParams.Windowed = false;

presentParams.PresentationInterval = D3DPRESENT_INTERVAL_ONE;

and the other one uses

presentParams.Windowed = false; // same results with true

presentParams.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;

Both use exactly the same window position, size and style. Both are written to cover the screen completely, even when using "Windowed = true".

In the latter game, to vsync and avoid tearing, my code waits until a certain scan line is passed. My tests showed: On different PCs it has to wait for different scan lines to avoid tearing completely. This is a drawback, since it has to be tweaked individually by the user. Is this technique used in any games?

And, compared to this technique, why does DirectX produce a display lag when "Windowed = false" is used with D3DPRESENT_INTERVAL_ONE?

To clarify where the lag occurs:

Windowed = false + INTERVAL_ONE => LAG

Windowed = false + ...IMMEDIATE    => no lag

Not mentioned in the question but tested:

Windowed = true;  + INTERVAL_ONE  => no lag, tearing

Windowed = true; + ...IMMEDIATE     => no lag

sentences:
Rendering artifacts on edges in Cardboard VR OpenGL ES 2 Unity beginner here. I've encountered this weird rendering artifacts in my Cardboard VR app on Android OpenGL ES 2: https://youtu.be/uJm4d3MwbRo
It doesn't occur in WebGL build: http://senovsky.wz.cz/virtualab/index.html
Does someone at least know how to call this artifact? Already tried searching for a solution, but I don't even know what keywords to use.

The app was build using the HelloVR scene from GVR SDK for Unity v1.130.1 https://github.com/googlevr/gvr-unity-sdk/releases and no default settings were changed. I tried changing the default overall quality settings to Ultra and Very High, didn't help.

sentences:
How to create a wavy beam? I want to implement a wavy laser beam similar to the Proton Backpack in Enter the Gungeon.

https://youtu.be/wl-o6gbMqFM?t=58

It's easy enough to draw a line from one point to another, but how to get the undulating curviness and the lighting effects?

I am working in Godot, but I could easily adapt techniques from Unity, if you know them, since Godot has similar resources.

I asked a version of this question in a Godot forum, but am also asking it here

sentences: Implementing an efficient method of server-side checking I'm making a web-based action RPG game. I don't want players to cheat, but I also don't want the game to constantly pause to wait for the server to respond. I made it so the game is played on the client-side (for responsiveness) and the server does routine checking to validate the game state. But the system is very cumbersome. The server has to calculate every single frame and compare the entire game state to the game state sent from the client. If anything in the game states are different form each other, the server kicks the player off. However, this means the game has to send 30 requests a second, and the server must calculate it all in time. If many people are playing the game, I don't think my one free Heroku dyno can handle that. How do I implement an efficient and elegant way of validating players' moves on the server side?

sentences:
How 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: I installed Linux Build Support, but I need an archive to build, how can I get this? I`m building a game for Mac, Windows and Linux, I builded the Windows and Mac game, but in Linux, says that need a x86_64 archive, like the image shows, what do I do?

sentences:
How can I rotate a Transform over a specified time in a single line of code? How can I rotate a Transform over a specified time in a single line of code?

I have had a lot of trouble with this in the past.  I wrote a script which rotates a Transform by a specified rotation over n seconds, or rotates a Transform towards a Vector3 over n seconds, in a one liner.  I hope it helps others in the future.  See below.

sentences:
How to animate a model in WebGL? I created a human model in Blender, exported the vertices and indices into a JSON file and render the model in a browser using WebGL. Now I created a walk and jump animation in Blender and would like to do the same with WebGL.

I saw examples that use a list of vertices for every frame of the animation. Is this the way to go? Do I need to export the vertices for every frame for every animation?

sentences:
Low complexity shader to indicate the sides of a polyline I have a bunch of polylines that I draw using GL_LINES. They can have thousands of points. They actually represent the separation of land and water on a map. I don't have complete polygons, just the ordered set of points.

I'm looking for a neat but efficient way to visually convey Side A and Side B as being different. For example I could offset the polyline in one direction a few times and fade it out (but every offset is doubling the number of points), or offset it once to make a "ribbon" and give one side a 'glow' like effect to mimic the outer glow or shadow of a polygon).

This is for a mobile application and I'm using OpenGL ES 2. I'd like to keep the effect as simple as possible from a complexity stand point. I'm looking for some additional ideas; maybe there's a clever shader technique out there or a visual effect I haven't considered.

sentences:
How do i make a list of generic classes? First of all, I want mods in my game, as stated in a previous question, I want to do that via registries. Users make content known to the game in the form of 'Registering' it, then it can be used in several other stuff. Registering a block to have it appear on the terrain is one example.

Registering is done in the form of events, where each registry has an OnEntryCollection event with a list where other classes subscribe to in order to add Entries, and then it gets invoked to gather said entries.

Basically I have a registry system, where there's a large meta-registry(The Game-registry) that has a list of smaller Registry<T> registries, each dedicated to a type (a block, an item, etc). I want to be able to add to these registries via a Registry.Add(T obj) method, but I'm not exactly sure how to do that because in order to store them I had to use an empty interface I made (IRegistry).

This is meant to be a way for me to add Entries in through code, from specific files I parse in, while also allowing modders to add in custom content through registry events I will add later. Nothing is meant to be added in through the inspector, rather registered in through events.

My code:

Game-Registry:

[SerializeField] List<IRegistry> registries = new List<IRegistry>();

Registry :

public class Registry<T> : IRegistry where T : IRegistryEntry {
    Dictionary<ResourceLocation, T> EntryDictionary = new Dictionary<ResourceLocation, T>();

    public delegate void registryAdditionHandler(List<T> entries);
    public event registryAdditionHandler OnRegisterAddEntries;

    ResourceLocation keyName;

    public Registry(ResourceLocation keyName) {
        this.keyName = keyName;
    }

    public void Register(T entry) {
        EntryDictionary.Add(entry.GetRegistryName(), entry);
    }
    public void Remove(ResourceLocation loc) {
        EntryDictionary.Remove(loc);
    }

    public T Get(ResourceLocation key) {
       return EntryDictionary[key];
    }
    public int Count() {
        return EntryDictionary.Count;

    }

    public bool ContainsEntryKey(ResourceLocation key) {
        return EntryDictionary.ContainsKey(key);
    }
    public bool ContainsEntryValue(T value) {
        return EntryDictionary.ContainsValue(value);
    }

    public bool TryGetValue(ResourceLocation key, out T value) {
        if (EntryDictionary.TryGetValue(key,out value)) {
            return true;
        }
        return false;
    }

    public ResourceLocation getRegistryName() {
        return keyName;
    }
}

IRegistry interface:

public interface IRegistry  {
}

sentences:
Using PhysX, how can I predict where I will need to generate procedural terrain collision shapes? In this situation, I have terrain height values I generate procedurally. For rendering, I use the camera's position to generate an appropriate sized height map. For collision, however, I need to have height fields generated in areas where objects may intersect.

My current potential solution, which may be naive, is to iterate over all "awake" physics actors, use their bounds/extents and velocities to generate spheres in which they may reside after a physics update, then generate height values for ranges encompassing clustered groups of actors. Much of that data is likely already calculated by PhysX already, however.

Is there some API, maybe a set of queries, even callbacks from the spatial system, that I could use to predict where terrain height values will be needed?

sentences:
How do I set up a depth buffer in SharpDX? I draw some instanced cubes, but when i rotate the camera (or the world) some cubes that should be behind other cubes are drawn before the cubes.

I already had this issue a long time before and i remembered that is was because the depth buffer.

I don't know how to set up a depth buffer in SharpDX.

My current trial:

DepthStencilView depthStencilView;

Init

var zBufferTextureDescription = new Texture2DDescription
        {
            Format = Format.D16_UNorm,
            ArraySize = 1,
            MipLevels = 1,
            Width = this.RenderWindow.ClientSize.Width,
            Height = this.RenderWindow.ClientSize.Height,
            SampleDescription = new SampleDescription(1, 0),
            Usage = ResourceUsage.Default,
            BindFlags = BindFlags.DepthStencil,
            CpuAccessFlags = CpuAccessFlags.None,
            OptionFlags = ResourceOptionFlags.None
        };
using (var zBufferTexture = new Texture2D(Device, zBufferTextureDescription))
  depthStencilView = new DepthStencilView(Device, zBufferTexture);

DeviceContext.OutputMerger.SetTargets(depthStencilView, RenderTargetView);

Draw

//ClearRenderTargetView
DeviceContext.ClearDepthStencilView(depthStencilView, DepthStencilClearFlags.Depth, 1f, 0);
//DrawInstanced(...);

My question: what steps do i have to do, to set up a depth buffer correctly?

(I don't use SharpDX.Toolkit)

sentences:
How to properly format classes for JSON deserialization with JSON.net for Unity? **UPDATE: This answer has been solved and this post updated to **

I am creating an inventory system and decided to keep a master list of all the items.  The goal is to use Newtonsoft's JSON.net to parse the item list and populate the database of items. The JSON item list looks like:

JSON

{
"Ingredients":
    [

    ],
"Consumables":
    [
            {
            "ID" : "TP_Small",
            "Icon" : "Sprites/porridge.png",
            "Name" : "Small Tan Pill's Porridge",
            "Consumable" : true,
            "Cooldown": 0,
            "Duration": 3,
            "Effect Description" : "Restores 100 health.",
            "Description" : "A hearty drinkable meal from everyone's favorite hypercellulose gelatin timelord!!!",
            "SFX": "{eb4e9ad8-c6ac-414f-8d5e-c3d012ca6ae6}",
            "Bonuses" : {
                "HP": 100,
                "Stamina": 100,
                "Tolerance": 20,
                "Attack": 4
                }
            }
    ],

"Concoctions":
    [

    ],
"Equipment":
    [

    ],
"Abilities" :
    [

    ]
}

And this is the structure of the classes we are using to match the JSON:

Classes

[System.Serializable]
public class Items
{
    public List<ItemBase> Ingredients;
    public List<ItemBase>Consumables;
    public List<ItemBase>Concoctions;
    public List<ItemBase>Equipment;
    public List<ItemBase>Abilities;
}

[System.Serializable]
public class ItemBase
{
    public string ID;
    public string Icon;
    public string Name;
    public bool Consumable;
    public int Cooldown;
    public int Duration;
    public string EffectDescription;
    public string Description;
    public string SFX;
    public StatBonus Bonuses;
}

[System.Serializable]
public class StatBonus
{
    public int HP;
    public int Stamina;
    public int Tolerance;
    public int Attack;
 }

The deserialization code:

TextAsset json = Resources.Load<TextAsset>(path);

    itemList = new Items();

    itemList.Abilities = new List<ItemBase>();
    itemList.Concoctions = new List<ItemBase>();
    itemList.Consumables = new List<ItemBase>();
    itemList.Equipment = new List<ItemBase>();
    itemList.Ingredients = new List<ItemBase>();

    itemList = JsonConvert.DeserializeObject<Items>(json.text);

This code now works as intended!

sentences:
Special Pathfinding Algorithm I need help with following pathfinding Task:

I have a grid (7x7 squares) and the starting square is always on the far left side (column 0) and its target is to reach the far right side (column 6).
Between col 1-5 are some walls where the path should "walk" around.

The special thing about the task is, the path can only walk straight,diagonal up, diagonal down, so its column increases += 1 for each movement.

For Example: (row/col)
Start:(1/0)
Path:(1/1) straight
    :(2/2) daigonal down
    :(3/3) diagonal down
    :(3/4) straight
    :(4/5) diagonal down
    :(4/6) straight (reached col 6 , finish)

I'm not sure about A*, maybe its also working for my task?
can anyone help me to find a good algorithm for this task?
I would prefer C++ as code.

sentences:
Understanding ticksPerSecond and duration with skeletal animations That's my first question here so i hope to do all correctly. From various weeks i started surfing the net about Skeletal animation aiming to add a simple animation controller into my small game engine. After following a video tutorial by ThinMatrix, i successfully added skeletal animation into my engine (i used Assimp to load a .dae file from Blender with one animation in it). Once finished all the base stuff i started thinking about how to change animations speed by a factor (like x2 x3 etc...) and here i found some problems. As i think i understand every animation is measured by a duration field (in ticks) that, as i suppose, should be at least something like 25fps (to obtain some kind of smooth animation) times animation's length in seconds. Then for every animation there is also another field called ticksPerSecond that (as the name says) is the amount of ticks in every second.

Into my engine i've a data structure called Animator that contains an array of Animation objects and for each one it has a ticks_per_second and duration array. The following code shows how i took data from assimp.

animator->ticks_per_second[animation_index] = scene->mAnimations[animation_index]->mTicksPerSecond != 0 ?
    scene->mAnimations[animation_index]->mTicksPerSecond : 25.f;
animator->duration[animation_index] = scene->mAnimations[animation_index]->mDuration;

If i print the two variables i get this result:

DEBUG: ticks per sec: 1.000000
DEBUG: total ticks: 0.833333

So here is my question: Why do these variables take on these values?
I am trying to explain it to myself and the idea I found is that if ticks is equal to 1 the animation would go at the same mainloop's frame rate but, at the end, I am not sure about it and I would appreciate your help.

sentences:
Math for Game Developers Possible Duplicate:
  What math should all game programmers know?

How many need know(learn) Math for Game Developer? for 2D and 3D games?
And where best learn Math for game development? in Wikipedia or maybe Books?

Thanks for answers.

sentences:
Unity - IsTouchingLayers problem I'm experimenting with 2d physics, and the problem is this: The IsTouchingLayers function reveals that the object is touching a layer, but only if I use the-1 parameter which is equivalent to Physics2D.AllLayers.

These are the tests done on Visual Studio in debug in the immediate control window:

?Physics2D.AllLayers
-1

?GroundCheck.IsTouchingLayers(-1)
true

?GroundCheck.IsTouchingLayers(0)
false
?GroundCheck.IsTouchingLayers(1)
false
?GroundCheck.IsTouchingLayers(2)
false
?GroundCheck.IsTouchingLayers(3)
false
?GroundCheck.IsTouchingLayers(4)
false
?GroundCheck.IsTouchingLayers(5)
false
?GroundCheck.IsTouchingLayers(6)
false
?GroundCheck.IsTouchingLayers(7)
false
?GroundCheck.IsTouchingLayers(8)
false
?GroundCheck.IsTouchingLayers(9)
false
?GroundCheck.IsTouchingLayers(10)
false
?GroundCheck.IsTouchingLayers(11)
false
?GroundCheck.IsTouchingLayers(12)
false
?GroundCheck.IsTouchingLayers(13)
false
?GroundCheck.IsTouchingLayers(14)
false
?GroundCheck.IsTouchingLayers(15)
false
?GroundCheck.IsTouchingLayers(16)
false
?GroundCheck.IsTouchingLayers(17)
false

These are the layers I have in the project:

If I use the -1 parameter it works correctly, the character jumps when it touches the ground and does not jump when it is in the air, but it will definitely jump by touching any layers.  And anyway I want to understand why.

What am I doing wrong ?

Thank you

sentences:
How can I achieve the realtime clouds/sky effect of Lumion? Does anyone know how they do this? They're not truly volumetric - you can't fly through them - it's still a texture.

http://vimeo.com/16534222

It looks like it's a perlin based solution, but I really can't work out how they get the fantastic lighting! How can I achieve this effect?

To be clear, I'm not talking about the sky (which would be a variation on CIE/Preetham) or sun shafts or any other effect - i'm talking purely about the clouds, which are rendered straight to the skybox texture.

sentences:
Unity 5 light reflection on the water surface How to adjust reflection in Unity 5 to show up it on the water surface. So I have few light elements in the scene. So I want my water pro to reflect this lights.

As example you can see red and yellow lights from the Shanghai's build on the water, that's what I am trying to achieve:

I've added water pro and setup flare:

Looks liker here some small reflection on the rect I market as red. But if comparing with real reflection it's more vertical reflection I've marked it as red well:

If you can see it unity example does not look natural. So if we compare distance from sun to the beach border on real photo, there is a huge sun line over the water surface, but there is not the same line on water pro in unity.

Here is a video link with what I did:
http://screencast.com/t/bq8Ocl24ZAJH

sentences:
Frame Buffer Object (FBO) is not working. What is the right way to use? I am trying to use FBO but i am living some problems. I will show you my steps but first i will show my running screen ,so we can compare them. Like before fbo after fbo.

My running screen and Draw() function code:

glClearColor(0.5,0.5,0.5,1.0);
glLoadIdentity();
glTranslatef(0.0,0.0,-3.0);
glRotatef(0,0.0,1.0,0.0);
glUniform3f(glGetUniformLocation(mainShader->getProgramId(),"lightPos"),0,1,2);
mainShader->useShader();
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    scene->draw(mainShader->getProgramId());
mainShader->delShader();

After I tried to add FBO :

Create FBO texture function:

unsigned int createTexture(int w,int h,bool isDepth=false)
{
    unsigned int textureId;
    glGenTextures(1,&textureId);
    glBindTexture(GL_TEXTURE_2D,textureId);
    glTexImage2D(GL_TEXTURE_2D,0,(!isDepth ? GL_RGBA8 : GL_DEPTH_COMPONENT),w,h,0,isDepth ? GL_DEPTH_COMPONENT : GL_RGBA,GL_FLOAT,NULL);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_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);

    int i;
    i=glGetError();
    if(i!=0)
    {
        std::cout << "Error happened while loading the texture: " << i << std::endl;
    }
    glBindTexture(GL_TEXTURE_2D,0);
    return textureId;
}

Init() function :

void init()
{
    glClearColor(0,0,0,1);
    glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        gluPerspective(50,640.0/480.0,1,1000);
    glMatrixMode(GL_MODELVIEW);
    glEnable(GL_DEPTH_TEST);
    mainShader=new shader("vertex.vs","fragment.frag");
    quadRenderShader=new shader("quadRender.vs","quadRender.frag");
    scene=new meshLoader("test.blend");

    renderTexture=createTexture(640,480);
    depthTexture=createTexture(640,480,true);
    glGenFramebuffers(1,&FBO);
    glBindFramebuffer(GL_FRAMEBUFFER,FBO);
    //GL_COLOR_ATTACHMENT0
    //GL_DEPTH_ATTACHMENT
    glFramebufferTexture2D(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT0,GL_TEXTURE_2D,renderTexture,0);

    glFramebufferTexture2D(GL_FRAMEBUFFER,GL_DEPTH_ATTACHMENT,GL_TEXTURE_2D,depthTexture,0);

    int i=glCheckFramebufferStatus(GL_FRAMEBUFFER);
    if(i!=GL_FRAMEBUFFER_COMPLETE)
    {
        std::cout << "Framebuffer is not OK, status=" << i << std::endl;
    }
    glBindFramebuffer(GL_FRAMEBUFFER,0);

}

And Draw() function:

void display()
{
    //rendering to texture...
    glClearColor(0.5,0.5,0.5,1.0);
    glLoadIdentity();
    glTranslatef(0.0,0.0,-3.0);
    glRotatef(0,0.0,1.0,0.0);
    glUniform3f(glGetUniformLocation(mainShader->getProgramId(),"lightPos"),0,1,2);
    mainShader->useShader();
    glBindFramebuffer(GL_FRAMEBUFFER,FBO);
        glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
        scene->draw(mainShader->getProgramId());
    glBindFramebuffer(GL_FRAMEBUFFER,0);
    mainShader->delShader();

    glClearColor(0.0,0.0,0.0,1.0);
    //render texture to screen
    glLoadIdentity();
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    quadRenderShader->useShader();
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D,depthTexture);
    glUniform1i(glGetUniformLocation(quadRenderShader->getProgramId(),"texture"),0);
    quad->draw(quadRenderShader->getProgramId());
    quadRenderShader->delShader();

}

and Result only drawing last setup color (glClearColor) so black :

Result should be like in tutorial :

Note: I know tutorial monkey is purple but it is not problem.

sentences:
Building a shape out of two rectangles I would like to build a body with Farseer out of two rectangles so it looks like this:

I am a real beginner, so please describe it carefully.

Thanks in advance!

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:
Is it efficient to use colliders on UI canvas in Unity? Basically I have a task where the player will be able to drag an object (as UI Image), and place it inside a bag (another UI image).

What's the best optimized way to do so? As I researched, I do not think that using colliders for images is the "best" way to do it.
Additionally, I was thinking about  checking if the position of the image while dragging overlaps an element; however, I do think that would be performant as that would require checking the position on each frame instead of "OnTriggerEnter".

What would be the best way to implement such function?

Thanks & Regards,
HurpaDerpa

sentences:
How can I get my Android camera system working more like Google Earth's? I'm implementing a touch screen interface whereby the user dragging their finger on the screen will rotate the camera in a sphere around the central point.

My code works well for the horizontal swipe (rotation around the y axis), but only covers a smaller angle from the vertical swipe (rotation around the x axis) instead of the full 360. I used the article - Spherical coordinate system form Wikipedia (http://en.wikipedia.org/wiki/Spherical_coordinate_system), specifically the Cartesian Coordinates section, to do this. I've posted my code below. Can anyone help get this working through the full 360 degrees on both axis? See how Google Earth works when you swipe the globe for what I want.

This must have been done a billion times, but Google searches confuse with the phone built in camera, gps and the like. Thanks!

//Get current position
oldX = getPosition().x;
oldY = getPosition().y;
oldZ = getPosition().z;

//convert to inclination/azimuth
camRadius = Math.sqrt((oldX * oldX) + (oldY * oldY) + (oldZ * oldZ));
inclinationTheta = Math.acos(oldZ / camRadius);
azimuthPhi = Math.atan2(oldY,oldX);

.
.
.

//use touch screen changes (deltaTouchX and Y)
inclinationTheta = (inclinationTheta + deltaTouchScreenX) % (2 * pi);
azimuthPhi = (azimuthPhi + deltaTouchScreenY) % (2 * pi);

//get new co-ordinates
newX = camRadius * Math.sin(inclinationTheta) * Math.cos(azimuthPhi);
newY = camRadius * Math.sin(inclinationTheta) * Math.sin(azimuthPhi);
newZ = camRadius * Math.cos(inclinationTheta);

//set new position
setPosition(newX, newY, newZ);

sentences:
Handling Back Button in Android without implementing InputProcessor Please advice/clarifyon below issue in libgdx while handling back button in Screens.

I have already gone through these 2 threads,

https://stackoverflow.com/questions/7223723/in-libgdx-how-do-i-get-input-from-the-back-button

Is there a way to capture back button twice in same activity libgdx game

As per suggestion in above two threads, I have done something like this in 2 Screen of my Game,

public class MainMenuScreen implements Screen{
    //omitted unnecessary code
    @Override
    public void render(float delta) {
    if (Gdx.input.justTouched()) {
        game.setScreen(game.STS);   //Setting 2nd Screen
    } else if (Gdx.input.isKeyPressed(Keys.BACK)) {
        System.out.println("mms back");
        //if(Gdx.input.isKeyJustPressed(Keys.BACK))
        Gdx.app.exit();            // Exiting
    }
}

public class StageScreen implements Screen{
    //omitted unnecessary code
    @Override
    public void render(float delta) {
        if (Gdx.input.isKeyPressed(Keys.BACK)) {
        System.out.println("backed to mms in android");
        //if(Gdx.input.isKeyJustPressed(Keys.BACK))
        game.setScreen(game.MMS);  //going back to Main screen
    }
}

Above code works fine, when I press BACK in Stage Screen to call Main Screen, it exits the app immediately, without stopping in my Main screen, which is as per my expectations because I am using Gdx.input.isKeyPressed(Keys.BACK) instead of Gdx.input.isKeyJustPressed(Keys.BACK).

But my problem is, when I use Gdx.input.isKeyJustPressed(Keys.BACK) method in my Screens, it does not (return true) catch BACK key.

I have already set Gdx.input.setCatchBackKey(true) for my Game.

Any idea, why does isKeyJustPressed not responds while isKeyPressed does?

Thanks in Advance.

sentences:
How do I make a scrolling background out of a sequence of images? I am new to AndEngine and trying to code a basic sidescroller game using the ParallaxLayer class from this example. (I followed the example and it works.)

How would I display multiple images sequentially? For example, I'd like 3 images (Sun_Stage.png, Moon_Stage.png and Dark_stage.png) to form the scrolling background. (First the background scrolls through Sun_stage.png then when it's finished scroll through Moon_Stage.png, et cetera.)

I basically just want to code a never-ending sidescroller with a changing scrolling background.

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:
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:
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:
Workaround for Texture2D.GetData I’m converting a game from XNA to iOS with Monogame.
In the code snippet below, smallDeform is a Texture2D on which I call the GetData method.

smallDeform = Game.Content.Load<Texture2D>("Terrain/...");
smallDeform.GetData(smallDeformData, 0, smallDeform.Width * smallDeform.Height);

I’m having some problem with Monogame because the feature in iOS has not been implemented yet because it returns this exception.

#if IOS
   throw new NotImplementedException();
#elif ANDROID

I tried to serialize the data in a XML file from Windows to load the whole file from iOS. The serialized files weight more than 100MB each, that is quite unacceptable to parse.

Basically, I’m looking for a workaround to get the data (for instance a uint[] or Color[]) from a texture without using the GetData method.

PS: I'm on Mac, so I can't use the Monogame SharpDX library.

Thanks in advance.

sentences: Electricity effect using XNA and Shaders I'm looking for a shader or sample that does an electricity or lines-of-force effect between two points that can be used with XNA 3.1.

sentences:
Maya - Black triangles when viewing model from a distance Everything was fine while working on a model in Maya, until randomly, numerous black triangles started appearing all over my model. They seem to go away when I zoom in closely with the camera:

This issue seems to be associated with my particular project, I am able to open and view my other models without any problems. Opening this file on another machine has an error message in the Output Window:
"Maya binary file parse error:  : (6) corrupted file structure"

I've tried Googling around and tried (without success):

Normals -> Set To Face
Normals -> Unlock
Normals -> Reverse
Changing various renderer settings

Here's a download link to my .mb:
http://www.filedropper.com/herocharacter

Thanks in advance!

sentences:
Unity C# order of execution for multiple start functions? I have a scene in my project where a lot objects need to access different objects to share data with.

Some objects have functions that need to be executed only once during the void Start function. These call a predefined function in a different class.

So now you know a bit what is happening I am experiencing an issue. During the Start function they call a method that only works when the Start function of that class has already been progressed.

Example:
Class A has certain values to calculate and set. Once this has happened function A will work.
Class B, C and D have a function B that is called at the last line of the Start function. Function B does some magic and then calls function A from Class A. The problem here is however that the void Start from class B, C and D executes before the Start from Class A. This results in not all values being set properly. I only discovered this through debugging and tracking timings of when each function was executed.

Is it possible for Class A to make the void Start execute before the void Start from the other classes? For example is the order of execution based on alphabetical values or something awake (per class) -> start (class A) -> start (class B) -> update (per class)? So that start A would happen before start B with a simple change of class name?

If I put this code in the awake call I will have the same issues since the awake in other classes might happen before or after the current awake will be executed.

To clarify, they all happen at the same time, but line 12 gets executed before line 13. Which is fairly logical, but how do you know which Start gets executed before the other Start? Or am I simply completely wrong?

I do realize that this might be a confusing read so please don't hesitate to ask questions so that I can explain my issue better.

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:
How to optimize two-pass operations on an array with Unity Coroutines I am working on simulating vacuum decompression in a 2D top down environment.
I have 2 2-dimensional arrays: one that stores the pressure at a location, and one that stores the vector of fluid flow.

The algorithm looks likes this:

private void Flow()
{
    Diffuse();
    Vectorize();
}

private void Vectorize()
{
    for(int x=0;x<xRange;x++)
    {
        for(int y=0;y<yRange;y++)
        {
            float myPressure= pressure[x,y];
            [...]
            Vector2 flowVector=calculate_the_resultant_vector_from_the_pressure_differentials //O(1) op
            [...]
            vector[x,y]=flowVector;
        }
    }
}

private void Diffuse()
{
    for(int x=0;x<xRange;x++)
    {
        for(int y=0;y<yRange;y++)
        {
            float myPressure= pressure[x,y];
            [...]
            float newPressure=calculate_the_new_pressure_from_the_pressure_differentials //O(1) op
            [...]
            pressure[x,y]=newPressure;
        }
    }
}

The problem is that as the area of the simulation space increases, the performance continues to drop off as the iteration steps block the update loop.

I want to convert these to Coroutines in such a way that both yield but more or less maintain a lockstep appearance. Since flow is dependent on pressure differential, and pressure differential is partially dependent on flow, if an order has to be enforced, then Diffuse should take precedence.

My initial attempt followed the following form:

IEnumerable Flow()
{
    StartCoroutine(Diffuse());
    yield return null;
    StartCoroutine(Vectorize());
}

IEnumerable Vectorize()
{
    for(int x=0;x<xRange;x++)
    {
        for(int y=0;y<yRange;y++)
        {
            float myPressure= pressure[x,y];
            [...]
            Vector2 flowVector=calculate_the_resultant_vector_from_the_pressure_differentials //O(1) op
            [...]
            vector[x,y]=flowVector;
            yield return null;
        }
    }
}

IEnumerable Diffuse()
{
    for(int x=0;x<xRange;x++)
    {
        for(int y=0;y<yRange;y++)
        {
            float myPressure= pressure[x,y];
            [...]
            float newPressure=calculate_the_new_pressure_from_the_pressure_differentials //O(1) op
            [...]
            pressure[x,y]=newPressure;
            yield return null;
        }
    }
}

This tended to cause a jittery simulation. Even on a small 20x20 simulation field, there was noticeable difference between the first and second solutions.

Are there any tricks to coroutines that will allow a more lockstep simulation that scales well? Any suggestions on optimization is welcomed as well.

sentences:
Compute normal based on Voronoi pattern I am applying a 3D Voronoi pattern on a mesh. Using those loops, I am able to compute the cell position, an id and the distance.

But I would like to compute a normal based on the generated pattern.
How can I generate a normal or reorient the current normal based on this pattern and associated cells ?

The aim is to provide a faced look for the mesh. Each cell's normal should point in the same direction and adjacent cells point in different directions. Those directions should be based on the original mesh normals, I don't want to totally break mesh normals and have those points in random directions.

Here's how I generate the Voronoi pattern.

float3 p = floor(position);
float3 f = frac(position);
float id = 0.0;
float distance = 10.0;

for (int k = -1; k <= 1; k++)
{
    for (int j = -1; j <= 1; j++)
    {
        for (int i = -1; i <= 1; i++)
        {
            float3 cell = float3(float(i), float(j), float(k));
            float3 random = hash3(p + cell);
            float3 r = cell - f + random * angleOffset;
            float d = dot(r, r);

            if (d < distance)
            {
                id = random;
                distance = d;
                cellPosition = cell + p;
                normal = ?
            }
        }
    }
}

And here's the hash function :

float3 hash3(float3 x)
{
    x = float3(dot(x, float3(127.1, 311.7, 74.7)),
        dot(x, float3(269.5, 183.3, 246.1)),
        dot(x, float3(113.5, 271.9, 124.6)));

    return frac(sin(x)*43758.5453123);
}

sentences:
Is it possible now to make something for android in Unity3d without buying any licenses? I was just talking to a game dev who said its possible, that it involves downloading the android sdk and few other things. If this is possible can someone tell me how?

Also is it possible to build a .apk file and install on your device? Is it possible to release something developed this way on the play store?

sentences:
Drawing game objects that are bigger than tiles Problem:

I have 32x32 world tiles, and a 64x64 object. I am only drawing visible tiles around the player.
The object has its x and y coordinates in the tile world. I am drawing the object after I've drawn the visible area.

I'm drawing the object like this :

for (int y = firstY; y < lastY; y++) {
        for (int x = firstX; x < lastX; x++) {
            if (object.visible(x, y))
                object.draw();
            }
        }
    }

The visible(x,y) method :

public boolean visible(int x, int y) {
    if (this.x == x && this.y == y) {
        return true;
    }
    return false;
}

Now what happens is this :

Image 1.
Character stands alongside the object, everything is ok.

Image 2.
Character triggers screen move left, half of the object gets drawn outside the map.

Image 3.
Character triggers screen move right, half of the object should be visible but its not.

I know that this happens because I'm checking only if the upper left corner of the object is visible. I'm stuck. What should I do to remedy this?

Thank you for any ideas.

sentences:
Unity aircraft physics I want to make a simple aircraft controller, what looks like little realistic in unity. I watch some video from airplane physics. and make a simple script in unity, but if I start, my plane cant move or if I change drag to zero, it cant lift. I tried to use real data and get it from wiki(F22 Raptor). To my game object, I gave the rigidbody component mass = 19670 kg.
Engine thrust = 2 * 116000.0f Newton.

    private void calculateEnginePower()
    {
        EnginePower = engineThrust * ThrottleInput;
    }

    private void calculateForces()
    {
        angleOfAttack = Vector3.Angle(Vector3.forward, rb.velocity);
        angleOfAttack = Mathf.Clamp(angleOfAttack, 0, 90);

        coefficient = Mathf.Pow(1225.04f * rb.velocity.magnitude, 2) - 1; //M^2-2 where: M is mach.

        if (coefficient > 0.0f)
            coefficientLift = (4 * angleOfAttack) / Mathf.Sqrt(coefficient);
        lift = 1.2754f * 0.5f * Mathf.Pow(rb.velocity.magnitude, 2) * coefficientLift * 78.04f; // densy1.2754 kg/m3, speed m/s , (F22)Wing area: 840 ft² (78.04 m²)

        coefficientDrag = 0.021f;
        rb.drag = coefficientDrag * 0.5f * Mathf.Pow(rb.velocity.magnitude,2) * 1.2754f * 78.04f;

        rb.AddForce(transform.up * lift);
        rb.AddForce(transform.forward * EnginePower);
    }

roll, pitch... inputs from keyboard and mouse, EnginePower, RollInput... are simple properties and I call the Move function in a controller inside void Update.

Move(float roll, float pitch, float yaw, float throttle)
{
// transfer input parameters into properties.s
RollInput = roll;
PitchInput = pitch;
YawInput = yaw;
ThrottleInput = throttle;
AirBrakes = false;
calculateEnginePower();
calculateForces();
calculateRotation();
}

used these formulas:

for Lift force:
Lift formula
for Lift coefficient:
Cl formula
for Drag:
Drag formula
and for Drag coefficient: I used data from wiki too (0.021f).

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:
Any social gaming services for JavaScript games? I'm currently planning on building a HTML5/JavaScript game for the various platforms (Browser, iOS, Android, and WinMo7). I, obviously, would like there to be simple multiplayer (1v1, asynch), leaderboards, etc.

Finding a service that provides this for native applications is easy (Scoreloop, Gree, etc.) but I have yet to find one that allows access through JavaScript. So with that said, does such a service/platform exist or am I looking at creating my own (probably with node)?

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:
3D objects with animated bones Monogame in the year 2017, is it possible? I've been working on a game for quite some time now and suddenly it seems that I've hit the great wall of..

In the earlier XNA there were possibilities to use animation exported with the 3D object .fbx files, but this was in the old XNA with SkinningData and AnimationPlayer etc.

I can't use these old samples that I've found on the Internet.
How can I in the year 2017 animate an animated 3D object exported from Blender .fbx animate it in Monogame by the use of them bones?

I'm using Monogame in C# VS2017 but the Microsoft.Xna.Framework.Content.Pipeline.Processors and everything else doesn't exist.

The closest thing to an animation that I've made is to split up my object into pieces in Blender and animate each part with CreateTranslation and CreateRotation.. But that's old school to do it that way.

Or, I misunderstood the whole thing?

I'm not going to use Unity.

sentences:
What animation technique is used in 'Dont Starve'? While playing a few games in my personal time off development I've stumbled across a survival 2D/3D survival game. The game was apparently made in SDL and GLUT (Dont starve) but what really amazed me was the animations in the game.

The animations are extremely smooth and fluent. There is no distortion while animating, what usually happens in hand-made animations is that pixels get removed, animations are jaggy and they simply aren't as smooth. That got me thinking on how they managed to accomplish such a quality of animations. Were they really handmade (If they were, then it must've taken a very talented artist), is it bone animation or are they using another technique?

sentences:
Only apply Advanced Graphics on high FPS Dynamically I wonder why not prevent lags by only appying advanced optional graphics stuff when the FPS are high at time. So The game could use simpler or even no shaders and skip decorative models some time.

It there an approach of dynamically calculating more or less each frame for higher FPS yet?

Is there a project using this approach yet?

sentences:
Godot _on_Area2D_area_entered not detecting In my Scene I have a Node2D. I then Instanced the Player and Area2D nodes. The Area2D has a signal pointing to itself that prints test when run.

Here is the Code For the Area2D. Nothing happens when an object enters the Area2D.

extends Area2D

# Declare member variables here. Examples:
# var a = 2
# var b = "text"

# Called when the node enters the scene tree for the first time.
func _ready():
    pass # Replace with function body.

# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
#   pass

func _on_Area2D_area_entered(area):
    print('test')

Level Scene

Player

Area 2D

Google Drive Link to Project:
https://drive.google.com/drive/folders/1OG3BBqKJzC3Je_r5eQdqiFUp7PzzBmt1?usp=sharing

sentences:
Stage3D: Camera pans the whole screen I am trying to create a 2D Stage3D game where you can move the camera around the level in an RTS style. I thought about using Orthographic Matrix3D functions for this but when I try to scroll the whole "stage" also scrolls.

This is the Camera code:

    public function Camera2D(width:int, height:int, zoom:Number = 1) {
        resize(width, height);
                    _zoom = zoom;
    }

    public function resize(width:Number, height:Number):void {
        _width = width;
        _height = height;

        _projectionMatrix = makeMatrix(0, width, 0, height);

        _recalculate = true;
    }

    protected function makeMatrix(left:Number, right:Number, top:Number, bottom:Number, zNear:Number = 0, zFar:Number = 1):Matrix3D {
        return new Matrix3D(Vector.<Number>([
            2 / (right - left), 0, 0, 0,
            0, 2 / (top - bottom), 0, 0,
            0, 0, 1 / (zFar - zNear), 0,
            0, 0, zNear / (zNear - zFar), 1
        ]));
    }

    public function get viewMatrix():Matrix3D {
        if (_recalculate) {
            _recalculate = false;

            _viewMatrix.identity();
            _viewMatrix.appendTranslation( -_width / 2 - _x, -_height / 2 - y, 0);
            _viewMatrix.appendScale(_zoom, _zoom, 1);

            _renderMatrix.identity();
            _renderMatrix.append(_viewMatrix);

            _renderMatrix.append(_projectionMatrix);
        }

        return _renderMatrix;
    }

And the camera is send directly to the GPU with: c3d.setProgramConstantsFromMatrix(Context3DProgramType.VERTEX, 0, cameraMatrix, true);

And these are the shaders:

------Vertex Shader------
m44 op, va0, vc0
mov v0, va1.xy
mov v0.z, va0.z

------Fragment Shader------
tex ft0, v0, fs0 <2d,linear,nomip>
mov oc, ft1

Here is a example and here are two screenshots to show what I mean:

How do I only let the inside of the stage3D scroll and not the whole stage?

sentences:
How to create a Raining Effect(Particles) on Android? I am developing a 2d android strategy game, it runs on SurfaceView, so I can't(or can I?) use LibGdx's particle system. And I would like to make a raining effect, I am aiming for something like this( http://ridingwiththeriver.files.wordpress.com/2010/09/rain-fall-animation.gif ), I don't need the splash effect in the end (although that would be superb, but probably would take up a lot of system resources).
How could I achieve that raining effect? Any ideas?

Thank You a lot in advance!

sentences:
Unity 4.6 UI Replace Images on selection in List of buttons[i] I made a list containing all the buttons in the UISelectionCanvas and would like to change each image as it is being selected. The problem is once the selection selects a new type of unit it will change all the buttons sprites in the list to the new selection instead of just changing the one selected.

     for a example imagine I have 10 units 9 peasants and 1 warrior

as each peasant is selected the sprite adds the peasant icon to the button. if 8 peasants are selected and then the 9th selection is a warrior it changes all 9 buttons to a warrior icon then if I selects the 10th peasant it changes them all back to peasant.

        for (int i = 0; i < buttons.Count; i++)
        {
            for (int c = 0; c < SelectedUnits.Count; c++)
            {
                if (i <= c)
                {
                   buttons[i].SetActive(true);

                  foreach (var unit in SelectedUnits)
                 {
                   if(unit.tag == "Peasant")
                 {
                    buttons[i].transform.GetComponent<Image>().sprite = peasant as Sprite;
                 }
             else if(unit.tag == "CityGuard")
            {
               buttons[i].transform.GetComponent<Image>().sprite = warrior as Sprite;

          }
        }

      }
      else
      {
      buttons[i].gameObject.SetActive(false);
    }
 }

}

sentences:
Pygame array; keeping list items constant I have an array in python(pygame):

Grid=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]]

I have written a program that changes some of the values of the array to 1 if certain variables are true. How can I ensure that the first item and the last item in all 3 lists will always remain as 0?

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:
neon effect to textures libgdx I am working on a live wallpaper with Libgdx .
I am wondering if I can give neon glow to my textures , at runtime .
Is this possible? If yes can anybody give me any pointers?

sentences:
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:
How can I make natural rain drops on screen? I'm trying to make rain effect drop with metaballs and trail on screen.I find a clue in shadertoy but I didn't understand how implemented:
https://www.shadertoy.com/view/ltffzl
unfortunately it have many math calculations and i can't use it in unity because it produces a lag.obviously I should use textures but how can I have trail effect?!

my idea is using a texture and trail renderer for droping but how can I have metaballs effect?

Update
I could Implement Metaballs by This Article
https://github.com/smkplus/RainFX/tree/master
but I haven't Idea about trail

sentences:
How can I grab the script component of a collided object without knowing what script it is? CalculateDamage() is an animation event called at a point during the character's animation in my 2D game. The commented out code is before I realized that not all of my pirates will be of class MeleePirateUnit, so I'm trying to do things more generically here. My order of inheritance is like so:

MonoBehaviour > Unit > MeleePirateUnit, RangedPirateUnit.

So sometimes, the collidedobj is a MeleePirateUnit, sometimes it's a RangedPirateUnit, etc etc. How do I set pirateUnit to the correct type of the script component of my gameObject? I thought just getting component of type monobehaviour would work since RangedPirateUnit and MeleePirateUnit both derive from monobehaviour but I'm getting an error of

Assets/Scripts/Combat Scene/RangedPirateUnit.cs(72,56): error CS1061: Type UnityEngine.MonoBehaviour' does not contain a definition forhealth' and no extension method health' of typeUnityEngine.MonoBehaviour' could be found (are you missing a using directive or an assembly reference?)

public void CalculateDamage(){
        if (!isDestroyed){
            var pirateUnit = collidedObj.GetComponent<MonoBehaviour>();
            //MeleePirateUnit pirateUnit = collidedObj.GetComponent<MeleePirateUnit>();
            pirateUnit.health = pirateUnit.health - (damage - pirateUnit.defence);
            if (pirateUnit.health<=0){
                Destroy(pirateUnit.gameObject);
                isDestroyed = true;
                didAttack = false;
            }
        }
    }

sentences:
Unity: Retrieve animation names from imported blend file I am just trying to generate a list from all animations within my Blender Asset file (see image)

This is what I have so far:

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

public class DropDown : MonoBehaviour {

    public GameObject character;
    public Dropdown dropdown;

    // Use this for initialization
    void Start () {
        PopulateList();
    }

    void PopulateList(){
        // TODO: Read values from character
        List<string> names = new List<string>() { "idle", "cheering" , "jump" };
        dropdown.AddOptions(names);
    }
}

The character is the actual blender asset (base_character_29).
The List names needs to be replaced with an array of my animations so I can populate a dropdown.
I am using a humanoid rig so I am only having an "Animator" Component on my GameObject.

I appreciate any kind of help,
thanks in advance!

sentences:
2D Physics: What happens with torque when center of mass changes? Novice programmer and explorer of simple 2D physics, here.

I have a simple 2D object made up of two rigid bodies connected at a fixed joint.

The two rigid objects can rotate freely about that fixed joint, causing the center of mass and moment of inertia of the whole object to change(but not adding extra energy to the system).

If my 2d object is rotating about it's center of mass, and then the center of mass changes (because one of its components rotates), what happens with the torque?

Since my torque was applied at the initial center of mass, and now the center of mass has changed, it would seem that I could not just preserve the torque for the new object orientation?

One possibility in my head is that some of that initial torque will be converted to linear velocity, but I can't visualize this in any consistent way.

So does the torque value remain the same when center of mass changes or does it need to be recalculated?

What key information am I missing here?

If there's a simple enough answer that could be expressed in some python or pseudo code (in terms of what to do with the torque), that would be appreciated.

EDIT:

I'll try to be more clear.  There's no friction there's no gravity, and no ability for either of these objects to collide with anything (they are in vacuum too).  The two components themselves are connected at a joint but they are effectively rigid (in the sense that torque force does not cause them to change their orientation to joint).  Linear velocity starts at nothing and we apply a  one time (impulse?) torque through the center of mass.  The whole object  rotates in the expected way when all of the sudden one of the components of the object changes its orientation(without adding any additional forces to whole object).  This changes the objects center of mass and moment of inertia. Since the only force applied to this object was torque, what happens in such a hypothetical situation? I'm mostly interested in how to apply the existing energy to the new orientation.  Does the object gain linear velocity and lose torque? If so how do i calculate that.

(I suppose if I were spinning in outer space and stuck out my arm, that might be along the same line?)

sentences:
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:
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:
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:
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:
Deferred decals normal problem I've been working on a deferred decal system. So far I have finished the projection part, meaning I can click something in the scene and it will properly project a decal onto the surface of the object.

There are a couple other things I wish to add to this system: normal clipping and normal mapped decals. Normal clipping is when I discard fragments that are stretched across a sharp angle. Seen here. A way to solve this is to  discard fragments that have a large difference between the normal in the G-Buffer and the decal's normal. This would require reading the G-buffer's normal texture.

In order to do decal normal mapping, I need to blend the decal's normal (from a normal map) with the G-buffer's normal. The requires writing to the G-buffer's normal texture.

I hope it's clear that in order to support these two features, I need to read and write to the normal texture in the same shader pass. Sadly, this is undefined behavior, so I'm wondering if there is some other way to implement these features.

sentences:
XNA/C# Shadows look strange in orthographic I have implemented shadows in to my game engine. They look fine when rendered in projection mode as a projected light, however I get a strange "blocky" look when they are put into orho'. I will be rendering much bigger scenes (MMO size maps, for example) and Ive heard that rendering in orthographic for the shadow map will give a better result, and it does in some ways. I dislike rendering with projective perspective as you can see the view frustum, whereas this doesnt happen with orthographic.

Here is the code I have for rendering every update:

    public void UpdateLightData()
    {
        Matrix lightsView;
        Matrix lightsProjection;
        ambientPower = 0.2f;
        lightPower = 2f;

        cameraFrustum.Matrix = player.view * player.projection;
        lightPos = new Vector3(0, 30, 0);
        lightsView = Matrix.CreateLookAt(lightPos, new Vector3(-2, 3, -10), new Vector3(0, 1, 0));
        lightsProjection = Matrix.CreateOrthographic(Globals.device.Viewport.Width, Globals.device.Viewport.Height, 0.1f, 100f);
        //lightsProjection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver2, 1f, 5f, 100f);

        lightsViewProjectionMatrix = lightsView * lightsProjection;
    }

Here is a screenshot of ProjectionPerspective:
https://www.dropbox.com/s/yen671frsft4kdl/Screenshot%202015-03-07%2016.00.32.png?dl=0

Here is what it looks like in orthographic:
https://www.dropbox.com/s/jj6h4zgodda38fe/Screenshot%202015-03-07%2016.01.19.png?dl=0

sentences:
share distribution question I just developed a facebook game(mifia like), but the graphics I made are not good, because it is reference with some existing photo, trace with AI, and coloring it.

Therefore, I invited my friend to join me, he is a graphic designer, owns a company with his friend (I know both of them), for the shares, I expect at least 70% for me, and at most 30% for them (both of them want to join).

Therefore, they give me a counter offer, 60% for me and 40% for them, of course, I feel their counter offer is unacceptable because they only build the image in part time, and all the other work just like coding, webhosting...etc, is what I do in full time. Why they said they worth 40% is that they will make a good graphic, they can provide a advertise channel(on local magazine), etc... Actually, I don't think the game need advertisement on local magazine because the game is not target for local...

Please give me some comments on this issue (is the share fair? what is the importance of the image of the game, is it worth more than 30%), or can anyone share the experience on this.

sentences:
Unity - moving an object around a radius I'm trying to move a 2D object around the mouse position, However, i want to constrain the object from rotating unnaturally around itself, i want it to basically rotate around a radius, similar to how a boat moves. I've provided the boat example below of what i am trying to achieve, the game is called battleboats.io and their rotation around the mouse will not skid, it looks natural like propellers pushing from behind.

Here's my code for achieving this in unity:

public Camera camera;
public Rigidbody2D rigidbody;

private float rotationSpeed = 200f;
private float acceleration = 4.4f;

Vector3 GetMousePosition(Camera c)
{
    return c.ScreenToWorldPoint(Input.mousePosition);
}

void Update()
{
    Vector3 direction = GetMousePosition(camera) - transform.position;
    direction.Normalize();
    float rotationAngle = Vector3.Cross(direction, transform.up).z;

    //rotation
    rigidbody.angularVelocity = -rotationAngle * rotationSpeed;

    //forward momentum
    rigidbody.velocity = transform.up * acceleration;
}

Any help is appreciated.

What i currently have and the result of my code is illustrated in the below gif.

sentences: Monte Carlo Tree Search for simultaneous multiplayer game I am developing AI for bomberman and i want to implement monte carlo tree search. I read that MTCS can be applied for simultanous multiplayer game. Problem i have is that i dont know how to implement it. For instance, how to store all possible moves in one game state or how to apply UTC selection. Should i call utc selection for all players and final state to select will be combination of their moves? Has anybody any literature to read or article? Thanks

sentences:
Code Logic's execution with respect to time Events I have to show complete 24 hours cycle in Unity3d Scene. Where different kind of task will be executed in different Times.

Suppose

at 2pm I have to move a car,
at 6pm An Aeroplane will land on airport
at 07:07pm I have to open the door of Market's Buildings
and so on different task/works execution at different timing.

Now, I have some basic animation e.g., car, Aeroplane and door etc.,. Now I am confuse that how to play and stop my animation according to the time. And time can also be
changed manually using GUI. If currently 6pm (animation working) then user can switch to 8am to view 8am time's animation (or code execution). And User can also fast the timing to view complete hours in a single minutes or in an hour.

I can use if/else in Update Events but I guess this is not the right way to do and will be very difficult if I require to show significant number of works
in different time duration (which means significant number of if/else statements).  Just like below

void Update(){
if(time =1){
//logic
}
if(time =2){
//logic
}
if(time =3){
//logic
}
...//so on, tedious way
...//and also not possible if time require between the hours, suppose 06:06pm
}

What to do ? How to handle this?

sentences:
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:
What are "socialist core values" or "Chinese Government Approved" for games to run in China? Noticed this recently on the Street of Rogue changelog Alpha 37 - Even More Downtown Work:

Internal
Did a bunch of work on a “Chinese Government Approved” Chinese version of the game

Now news outlets are reporting PUBG will change for China and align with ‘socialist core values’:

But, in a statement from Tencent translated by Reuters, the gaming giant says that it will go a step further and alter Battlegrounds to better align with “socialist core values, Chinese traditional culture and moral rules.”

While also mentioning:

It’s not entirely clear what that means.

and

Reuters points out that Tencent’s competitor NetEase has accomplished something similar by adding actual government propaganda to the game, adding “red banners into its battleground ... with slogans such as ‘safeguard national security, safeguard world peace.’”

Steam user ytivarg asked Streets of Rogue developer Madguy

ytivarg 3 Nov @ 4:38am
So what did you have to do to make it "Chineese Government Approved"?

to which he replied:

Madguy  [developer] 3 Nov @ 5:16am
@ytivarg I'm a little wary of getting into specifics, but it's basically some text and art that might be seen as objectionable. You can draw your own conclusions (or sift through the localization folder)

So what exactly does it take to make a game "Chinese Government Approved" or sticking to "socialist core values"?

sentences:
LibGDX - Image width is not set to resetting to zero when full width I am making a progress bar for showing the players current experience. However I have come around to a bug, which appears when the player is maxing out his experience and then is getting a new level. In the ideal world my code should reset the progress bar image width (which is a Scene2D image btw), but for some reason it is not setting the image width to zero, but is setting it to its full width instead, which I can't seem to understand why. I hope anyone can help me.

I have provided my code below, and also uploaded a video on youtube with my bug - Video of the bug

The method below is the one I use to change the experience progress bar width as well as the experience.

public void changeLevelExperience(int gainedExperience) {
    float maxExpDividedInPixels = 131f / this.GAME.gameScreen.getGameManager().maxExperience;

    this.GAME.gameScreen.getGameManager().currentExperience += gainedExperience;

    if (this.GAME.gameScreen.getGameManager().currentExperience >= this.GAME.gameScreen.getGameManager().maxExperience) {
        this.GAME.gameScreen.getGameManager().currentLevel++;
        this.currentLevelLabel.setText(this.GAME.gameScreen.getGameManager().currentLevel + "");
        //TODO: Another arrangement for the experience needs to be made.
        this.GAME.gameScreen.getGameManager().maxExperience += 35;
        this.GAME.gameScreen.getGameManager().currentExperience = 0;
        Gdx.app.debug(TAG, this.GAME.gameScreen.getGameManager().currentExperience + "");
    }

    this.levelProgressBar.setWidth((int) (maxExpDividedInPixels * this.GAME.gameScreen.getGameManager().currentExperience * this.scaleFactor));
}

sentences:
Design of a turn-based game where actions have side-effects I am writing a computer version of the game Dominion. It is a turn-based card game where action cards, treasure cards, and victory point cards are accumulated into a player's personal deck. I have the class structure pretty well developed, and I am starting to design the game logic. I'm using python, and I may add a simple GUI with pygame later.

The turn sequence of the players is governed by a very simple state machine. Turns pass clockwise, and a player can't exit the game before it is over. The play of a single turn is also a state machine; in general, players pass through an "action phase", a "buy phase", and a "clean-up phase" (in that order). Based on the answer to the question How to implement turn-based game engine?, the state machine is a standard technique for this situation.

My problem is that during a player's action phase, she can use an action card that has side effects, either on herself, or on one or more of the other players. For example, one action card allows a player to take a second turn immediately following the conclusion of the current turn. Another action card causes all other players to discard two cards from their hands. Yet another action card does nothing for the current turn, but allows a player to draw extra cards on her next turn. To make things even more complicated, there are frequently new expansions to the game that add new cards. It seems to me that hard-coding the results of every action card into the game's state machine would be both ugly and unadaptable. The answer to Turn-based Strategy Loop does not go into a level of detail that addresses designs to solve this problem.

What kind of programming model should I use to encompass the fact that the general pattern for taking turns can be modified by actions that take place within the turn? Should the game object keep track of the effects of every action card? Or, if the cards should implement their own effects (e.g. by implementing an interface), what setup is required to give them enough power? I have thought up a few solutions to this problem, but I am wondering if there is a standard way to solve it. Specifically, I'd like to know what object/class/whatever is responsible for keeping track of the actions that every player must do as a consequence of an action card being played, and also how that relates to temporary changes in the normal sequence of the turn state machine.

sentences:
How to add the concept of entities and components into an isometric tile map? To get some practice with SpriteKit, entities and components I built a little demo.

I created a SKNode subclass (IsometricMapNode) which renders an isometric map. It does so by adding SKSpriteNode (TileSpriteNode) subclasses to itself.

The data of the map is stored in a platform agnostic class IsometricMap which manages IsometricLayers and Tile objects. The map can do things like loading a TMX file and generate tiles which carry information (type of tile, texture name, ...).

The map is then passed to aforementioned IsometricMapNode and displayed.

All is working fine but then I read about GKEntity and I wonder if I can introduce the concept of entities into my code. I was wondering if every tile in my map should be an entity which would then get a render component and maybe a physics component or a particle component.

What I don't understand though: Would my model class Tile become a GKEntity, or its visual cousin TileSpriteNode? Or is it just philosophical?

If Tile is the entity, users of my map would add new entities to it, hopefully with a render component attached to them.

If I keep my Tile model class, the map would internally create entities from this class, add some standard components (mainly rendering) and allow the user to change those components later.

Is this making sense at all? :-)

sentences:
What should I wear to a job interview with a game development company? Many game development companies are less formal in terms of workplace attire than other types of software development houses. For example, I know that one place at which I will be interviewing soon has a predominant workplace culture of jeans and polos or t-shirts.

Should I wear a suit? Shirt and tie? Shirt and sport jacket, with or without tie? I want to show that I'm serious about the job, but that I understand the culture, too.

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:
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:
What LuaJit threading archietecture should I use? I am in the process of designing my own Game Engine for use in a real time CRPG - think Baulder's Gate. I know most of my specifications right now, and I am currently in a planning phase.

I chose Lua for a good number of reasons.

Fast and real time iteration.
Easy to lay out data and serialize tables.
Easy to learn for other programmers.
Can design tools to automatically write scripts for certain entities

For the first reason, I decided to have as much of my game code handled inside Lua as possible. With the exception of low level systems being handled inside of C++: Audio, physics, animation, rendering, resource managers(?).

But I came to a problem when it came to threading. I settled on using a job system. But I am not sure how to approach this with a heavy emphasis on Lua.

My Update look will look something like...

Local dt {}
While Game.isRunning() {
    dt = timer.delta();
    PreUpdate(dt);           //Delayed Raycasts for AI, Physics Triggers
    UpdateLogic(dt);         //AI, UI, Event Handling, etc.
    UpdateAnimations(dt);    //State Machines, Blending, framed scripts
    UpdatePhysics(dt);
    Render(dt);
}

How should I approach threading this?

My first thought is that I have only one VM of Lua, and set it on the main thread; then, the worker threads will work only in C++. Lua will have C++ API callbacks. When Lua calls this callback, it returns to C++. The C++ will create a job to be dispatched. The job is placed inside a qeue and processed on other threads in native code. I was thinking of following this idea. Most games seem to handle Game Logic in a serial manner -UpdateLogic(dt)-, then asynchronously updates lower level systems, multi-thread rendering, or handle events that are needed to fire immediately.

My Second thought is to use a job system with all threads using a Lua instance. I guess with this system I would be able to update entities in a threaded manner. But I can quickly see the problem. Because an entity's data is mutable, this can quickly cause logical errors. Even if I decided to defer updates to data, I can still see this becoming a problem with math errors.

Any guidance would be helpful here.

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:
"The associated script cannot be loaded", how can I see what script is associated? I have a couple objects that are throwing errors in the warning log:

  The referenced script on this Behaviour (Game Object 'myObject') is missing!

Here is what they look like in the inspector:

How can I see what script is (or was) associated?

sentences:
How do I create interactive grass like this? I would really like to create grass that reacts to the player's movements, so when they walk through, it moves away from them, just like this:

https://www.youtube.com/watch?v=5Gc-Ue9_xgk
https://www.youtube.com/watch?v=tFgyc8iykLk

The problem is, I'm not sure if this is a case of animation, combined with some form of physics, or controlled by a script. The grass looks like 2 planes that are crossing each other and originally I was going to try a LookAtPlayer script, however that would just make the planes spin around to face the player, instead of swaying in the wind, or swaying away from the player when they walk past them.

Any advice on how to create something like this with grass?

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:
Interpolation on Rigidbody2D not working I'm trying to achieve smooth movement for a ball. I seem to be failing to achieve this and now I've created a sample scene, which shows my setup from the game and the problem exists in that sample scene, as well.
I've uploaded the sample project to github: https://github.com/iQew/PhysicsTesting (open Assets/Scenes/SampleScene)
Here's a recording of the problem. It's a bit more extreme here than it is in the editor, but it shows the problem even better because of it: https://imgur.com/a/ByzwKlg
Scenario:
I have a 2D mobile game (android) using Unity 2019.4.14f1 with URP. The camera does not move and will always have the same settings. The playfield consists of a certain area, which is blocked in by walls, which have a BoxCollider2D on them. The ball is a simple sprite with a CircleCollider2D, RigidBody2D and a Trail Renderer.
I have deleted all quality settings except the "Low" one, which has VSync Count set to "Don't Sync". In the Awake block of a controller script I set the Application.targetFrameRate to 60. In the Start block I use BallRigidBody2D.AddForce(new Vector2(1f, 10f), ForceMode2D.Impulse) to make the ball move.
The RigidBody2D of the Ball has the following settings:

Body Type: Dynamic
Material: DefaultBall (a Physics2D material with friction: 0 | bounciness: 1)
Simulated: true
Use Auto Mass: false
Mass: 0.025f
Linear Drag: 0
Angular Drag: 0
Gravity Scale: 0
Collision Detection: Continous
Sleeping Mode: Start Awake
Interpolate: Interpolate

All other project settings are at default.
When I launch the game, the ball starts moving as expected. Most of the time the movement is smooth, but there is stuttering every now and then. I am wondering, if there is a way to make this stuttering go away. The tutorials I found on the internet, which solve this exact problem set the Interpolation mode of the RigidBody2D to "Interpolate", but I did that and there's no change.
There are no other scripts interfering with the physics calculation at all. So, I assume this has to do with some kind of project settings? Using a smaller Fixed Timestep does not help, in fact it gets a lot worse, if I use 1/120 for example.
Any help would be greatly appreciated!

sentences:
Game "Hocus": How to do the path finding? I rebuild popular apps to get good at Godot. This game Hocus poses a challenge in terms of path finding. I have a solution, but as the illusions scale, it becomes ridiculously time-consuming to set up. I set destination, to which the cube can go, but then you have to set up possible connections for every destination, because there're supposed to be constraints. This can lead to something like 100 variations to be set up for one level, which is of course ridiculous if you want to do 100 levels like the creators. Any idea?

This is a video, where you can exactly see the pathfinding mechanism. Short description:
Whenever you're at one corner of the bars of the illusion graphic (it's just a 2D graphic), you have to set up ways, where the player can go next, because some ways are invalid in this illusion, logically. This is what I intended with setting up an array of numbers, which represent the possible next points for each point. However, this is extremely time-consuming if levels reach even slightly more complexity. I highly doubt the creators did it that way.

sentences:
Help Understanding Cameras/View Matrices in DirectX11 (C#) So I'm designing a soft game engine in C# on top of the SharpDX API (a C# wrapper for DirectX). As I'm designing the camera, though, I'm running into some issues getting the 3D perspective correct. I've read through a few tutorials and articles, but I can't seem to find what I'm doing explicitly wrong.

This is my current understanding: The world matrix is the identity matrix (of the world...) times the translation matrix of the model, times the rotation matrix of the model, times the scale matrix of the model, which should then give me the transformed location of each vertex in "world space." The view matrix would then be the output matrix of LookAtLH(cameraPositionVec, targetPositionVec, upVec);. Finally, the projection matrix seems to be the output of the PerspectiveFovLH(fov, aspectRatio, nearDist, farDist); So, I then took the transpose of each of these matrices, multiplied world * view * projection and I should be left with the final transformed vertex coordinate.

Here's the code I have so far. I've left the world matrix untouched by just setting the translation to the origin, the rotation of the model to the identity matrix, and the Scale to 1, which should mean I don't have to actually perform any world matrix calculations for the sake of simplicity right now.

// Setup and create the projection matrix.
projectionMatrix = Matrix.PerspectiveFovLH((float)(Math.PI / 4.0f), ((float)GameWindow.WIN_WIDTH / (float)GameWindow.WIN_HEIGHT), 0.1f, 100.0f);

// Initialize the world matrix to the identity matrix.
worldMatrix = Matrix.Identity

...
//camera class
public Camera(Vector3 _position, Vector3 _target, Vector3 _rotation)
{
    position = _position;
    target = _target;
    rotation = _rotation;
}
public Matrix GetViewMatrix()
{
    //convert degrees to radians
    float pitch = rotation.X * 0.0174532925f;
    float yaw = rotation.Y * 0.0174532925f;
    float roll = rotation.Z * 0.0174532925f;

    //get rotation matrix and the relative up vector
    Matrix rotationMatrix = Matrix.RotationYawPitchRoll(yaw, pitch, roll);
    Vector3 up = Vector3.TransformCoordinate(Vector3.UnitY, rotationMatrix);

    return Matrix.LookAtLH(position, target, up);
}

....

//set the view matrix
viewMatrix = camera.GetViewMatrix();

...
//Transpose the matrices
worldMatrix.Transpose();
viewMatrix.Transpose();
projectionMatrix.Transpose();

From there they are fed to the vertex shader, which is below. If I comment out the projectionMatrix multiplication though, the image shows up. If It's not commented out though, nothing renders to the screen, which leads me to believe that may be the issue.

//vertex shader
cbuffer MatrixBuffer
{
    matrix worldMatrix;
    matrix viewMatrix;
    matrix projectionMatrix;
};

struct VertexInputType
{
    float4 position : POSITION;
    float2 tex : TEXCOORD0;
};

struct PixelInputType
{
    float4 position : SV_POSITION;
    float2 tex : texCoord0;
};

PixelInputType main(VertexInputType input)
{
    PixelInputType output;

    // Change the position vector to be 4 units for proper matrix calculations.
    input.position.w = 1.0f;

    // Calculate the position of the vertex against the world, view, and     projection matrices.
    output.position = mul(input.position, worldMatrix);
    output.position = mul(output.position, viewMatrix);
    output.position = mul(output.position, projectionMatrix); //<-- If I comment this line, it renders to the screen
    // Store the texture coordinates for the pixel shader.
    output.tex = input.tex;

     return output;
}

I feel like I'm missing something really basic, because I think I'm pretty close. Thanks for any help you can provide.

sentences:
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:
Need an ideal opensource 3D engine for building Golf simulation game I'm looking for a open-source 3D graphics and physics engine specialized in golf simulation.

The preferred engine would be have short learning curve, supports Windows platform and Java or C++ and Lua/Python support for scripting, also prefer something like outdoor golf plane scene with weather system support, I'm new to this area and would love to hear all of your advice.

I'm just come from stackoverflow site, @mikera there recommends jMonkeyEngine, it sounds a fit, but I'm not sure if there's other ideal candidate engine?

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: Should I use the pathfinding client side or server side? I'm developping a game where the user can walk in a room (with the others players). There are some obstacles that blocks the user. I'm using a Javascript pathfinding library to find where the user can walk. But the question is: Should I use the pathfinding library Client side or server side? Why?

sentences:
Complex layout in Unity I need ScrollRect, but at startup I don't know how many elements it should keep. Moreover this elements should be kept in categories that can fold/unfold.

The problem is that height of content doesn't updates after folding/unfolding. This worked in Unity 5 with ContentSizeFitter in content and each category, but this doesn't work with Unity 2017.

Items are added at runtime with instantiating from prefab in a certain category.

Is there any solutions without additional scripting?

EDIT

Additional screenshots

When unfolded can't scroll anything because content size is too small

This is script part for instantiating items inside categories.

sentences:
Creating Slide-In Text I want to make my text slide like so:

This is from the game "Crossy Road". The movement is normally smoother that in the .GIF

Here are some more frames from the GIF to make you understand what I mean:

I'm sorry for the bad formatting, I need at least 10 reputation to post more than 2 links.

The text and the orange background seem to "expand" while moving smoothly to the right.

sentences:
Best physics engine for OpenGL ES (different implementations)? Can you recommend a good physics engine which is easily portable between WebGL and other OpenGL ES implementations like in Android and iPhone?

I don't want a game engine. Only the physics part.

sentences:
Famous games written in Python I've seen a couple of these, namely Java and C#/XNA...and I've recently been picking up Python. Which kind of made me think.

What (famous) games have been written in Python, with Pygame/Pyglet/Pyopengl?

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:
Rendering a scene or prefab in a gallery style view in Unity3D? I'm working on a project that is a bit like YouTube where someone browses some content, clicks on one and sees it in the youtube player while still seeing the rest of the content.

In my case the content is a Unity prefab that runs with interactions and gameplay, a bit like an interactive YouTube.

Is there a way to load these prefabs in a scene or something and have them displayed in a view port of some sort which substitutes the position of the player?

sentences:
What's wrong with my HLSL depth shader? I'm trying to render depth texture in XNA 4.0. I'm read few different tutorials several times and realy cannot understand what I'm doing wrong.

Depth shader:

float4x4 WVPMatrix;

struct VertexShaderOutput
{
    float4 Position : position0;
    float Depth : texcoord0;
};

VertexShaderOutput VertexShader1(float4 pPosition : position0)
{
    VertexShaderOutput output;
    output.Position = mul(pPosition, WVPMatrix);
    output.Depth.x = 1 - (output.Position.z / output.Position.w);
    return output;
}

float4 PixelShader1(VertexShaderOutput pOutput) : color0
{
    return float4(pOutput.Depth.x, 0, 0, 1);
}

technique Technique1
{
    pass Pass1
    {
        AlphaBlendEnable = false;
        ZEnable = true;
        ZWriteEnable = true;

        VertexShader = compile vs_2_0 VertexShader1();
        PixelShader = compile ps_2_0 PixelShader1();
    }
}

Drawing:

this.depthRenderTarget = new RenderTarget2D(
    this.graphicsDevice,
    this.graphicsDevice.PresentationParameters.BackBufferWidth,
    this.graphicsDevice.PresentationParameters.BackBufferHeight);

...

public void Draw(GameTime pGameTime, Camera pCamera, Effect pDepthEffect, Effect pOpaqueEffect, Effect pNotOpaqueEffect)
{
    this.graphicsDevice.SetRenderTarget(this.depthRenderTarget);
    this.graphicsDevice.Clear(Color.CornflowerBlue);
    this.DrawChunksDepth(pGameTime, pCamera, pDepthEffect);

    this.graphicsDevice.SetRenderTarget(null);
    this.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Opaque, SamplerState.PointClamp, null, null);
    this.spriteBatch.Draw(this.depthRenderTarget, Vector2.Zero, Color.White);
    this.spriteBatch.End();
}

private void DrawChunksDepth(GameTime pGameTime, Camera pCamera, Effect pDepthEffect)
{
    // ...

    this.graphicsDevice.RasterizerState = RasterizerState.CullClockwise;
    this.graphicsDevice.DepthStencilState = DepthStencilState.Default;

    // draw mesh with pDepthEffect
}

Result:

As I see output.Position.z always equals output.Position.w, but why?

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:
Hero made of parts 2d rotation I have a problem with rotation of my hero in 2D space.  The hero is made of body parts such as: head, arms etc.  Every part is a separate sprite. When I want to rotate the hero, I have to rotate all of its parts.
I know the hero position, and I save the parts positions as:
head = (heroPosition.x+20, heroPosition.y+20)

In other words I know the positions of all parts while the hero was not rotated.  After rotation I know only the hero position and the rotation angle(Grades).
How can I calculate the new position for each part?

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:
Animation via AnimatorController created in script does not play in Unity I have created an empty GameObject and assigned it a script: Main.cs.

public class Main
{
    [MenuItem("Custom workflow/Initialize")]
    static void Initialize()
    {
        // Place a text mesh on the scene
        var obj = new GameObject("Sample");
        obj.transform.position = new Vector3(0, 0, 0);
        var text = obj.AddComponent<TextMesh>();
        text.text = "Hello world";

        AnimationClip clip1 = CreateAnimationClip();
        AnimatorController sm = CreateSimpleAnimatorController(clip1);

        var animator = obj.AddComponent<Animator>();
        animator.runtimeAnimatorController = sm;
        animator.applyRootMotion = true;
    }

    private static AnimationClip CreateAnimationClip()
    {
        var translateX = AnimationCurve.Linear(0.0f, 0.0f, 2.0f, 25.0f);
        var animationClip = new AnimationClip();
        animationClip.SetCurve("", typeof(Transform), "position.x", translateX);

        AssetDatabase.CreateAsset(animationClip, "Assets/procanim.anim");

        return animationClip;
    }

    private static AnimatorController CreateSimpleAnimatorController(
      Motion motion1 = null, Motion motion2 = null)
    {
        // Creates the controller
        var controller = AnimatorController.CreateAnimatorControllerAtPath(
          "Assets/SimpleStateMachineTransitions.controller");

        // Add parameters
        controller.AddParameter("GoToB", AnimatorControllerParameterType.Bool);
        controller.AddParameter("GoToA", AnimatorControllerParameterType.Bool);

        // Add StateMachines
        var rootStateMachine = controller.layers[0].stateMachine;

        // Add States
        var stateA1 = rootStateMachine.AddState("stateA1");
        stateA1.motion = motion1;
        var stateB1 = rootStateMachine.AddState("stateB1");
        stateB1.motion = motion2;

        // Add Transitions
        var transitionAB = stateA1.AddTransition(stateB1);
        transitionAB.AddCondition(AnimatorConditionMode.If, 0, "GoToB");
        transitionAB.duration = 0;

        var transitionBA = stateB1.AddTransition(stateA1);
        transitionBA.AddCondition(AnimatorConditionMode.If, 0, "GoToA");
        transitionBA.duration = 0;

        return controller;
    }
}

The problem

As I invoke the menu item, I get all assets in place. When I hit play, nothing happens. I can see state stateA1 is on, but the animation does not run. If I click on the text object in the scene...

...this is what I see in the animation window:

I think the problem might be here:

animationClip.SetCurve("", typeof(Transform), "position.x", translateX);

Because, when I remove the code generate Transform.position property from the animation timeline and manually add one via UI, it works once I hit play again.

sentences: Should I use scenes in Unity for menus? I assume scenes are for different levels, but should I use them for menu screens or is there a specific tool for menu screens?

sentences:
How to I rotate a triangle by dragging the mouse in libGDX? More specifically, I have rotation working in a way I don't like as follows:

    //Draw the triangle using this draw method
    //batch.draw(texture, x,                            y,                                          originX,                 originY,                                        width,               height,      scaleX, scaleY, rotation, srcX, srcY, srcWidth,   srcHeight, flipX, flipY)
    batch.draw(triangle, 240 - triangle.getWidth() / 2, (float) (400 - triangle.getWidth() * .289), triangle.getWidth() / 2, (float) ((double) triangle.getWidth() * 0.288), triangle.getWidth(), triangle.getHeight(), 1, 1, rotate, 0, 0, triangle.getWidth(), triangle.getHeight(), false, false);

    batch.end();

    //Touch input
    if(Gdx.input.isTouched()){
        Vector3 touchpos = new Vector3();
        touchpos.set(Gdx.input.getX(), Gdx.input.getY(), 0);
        camera.unproject(touchpos);
        rotate = touchpos.x;
    }

This rotates the triangle around the center of the triangle that is at the center of the screen (the 0.289 corresponds to the height of the middle of an equilateral triangle according to its side length).

The rotation will be equal to the touch position on the screen which works great when the finger is dragged. However, what this code does is moves the rotation to the specific location whenever I touch the window with the mouse. What I would like it to do is to rotate the triangle when the mouse is dragged, but only based on its previous rotation, not its absolute rotation. For example, if I click and drag the mouse from the left side of the window to the right, the triangle will rotate accordingly. When I lift the mouse then click and drag it the same way a second time, I don't want it to reset it's position to my 2nd click, I want it to move the amount I dragged my mouse from it's previous rotation.

Can anyone help with this? I've been trying to wrap my head around it for hours. Let me know if you need any clarifications.

sentences:
front and back face detection I am trying to implement a dynamic shadow system for a 2d game using this tutorial :

http://www.gamedev.net/page/reference/index.html/_/technical/graphics-programming-and-theory/dynamic-2d-soft-shadows-r2032

but I am stuck at the point where I need to determine which face is front facing or back facing the light source.

Is there a simple technique to apply in order to find out which face is in front and which one is in back?

sentences:
Spreadsheets in Game Design? There have been two instances from the past two weeks that I've heard from well known successful game developers that they use spreadsheets when designing games.

The first being David Whatley in this GDCVault video: From Zero to Time Magazine: App Success

The second being the guys that do Walled Garden Weekly.

David said he models everything out and uses excel models to see how everything plays out. What on earth is he talking about? Is it seeing how the game mechanics react to each other?

Is there somewhere where I can learn more about how to do this?

sentences:
How to initiate manually an animation in Unity? I have a prefab and I want to control when an animation is initiated. I can't seem to figure out how to do that. I have already created the animation clip, the animator component for the prefab, and the animator controller. The animation works, when I enter play mode in the unity editor (it plays automatically), but I want to control when the animation occurs when providing input (such as pressing on the space bar or clicking on the prefab).

How would I go about doing that?

sentences:
Issue with implemented Minesweeper algorithm So I'm attempting to learn Python by way of Minesweeper.  I've got experience with SDL, so I figured playing around with PyGame sounded like a fun way to learn the syntax of the language.

Anywho, I'm having an issue in uncovering adjacent open squares as you would in a normal game of Minesweeper.  I click on a cell with 0 neighboring mines, and attempt to scan the top, left, right, and bottom to see if those also have 0 neighboring mines, and I do this recursively.

Here is the error that I receive:

RuntimeError: maximum recursion depth exceeded in cmp

And here is my algorithm:

#open up blank mines
def open_blank_cells(mines, cr, cc):
  #top
  if (cr > 0):
    t_mine = mines[cr-1][cc]
    t_mine.switch_state(3)
    if (t_mine.neighbor_mines == 0):
      open_blank_cells(mines, cr-1, cc)

  #right
  if (cc < 9):
    r_mine = mines[cr][cc+1]
    r_mine.switch_state(3)
    if (r_mine.neighbor_mines == 0):
      open_blank_cells(mines, cr, cc+1)

  #bottom
  if (cr < 9):
    r_mine = mines[cr+1][cc]
    r_mine.switch_state(3)
    if (r_mine.neighbor_mines == 0):
      open_blank_cells(mines, cr+1, cc)

  #left
  if (cc > 0):
    l_mine = mines[cr][cc-1]
    l_mine.switch_state(3)
    if (l_mine.neighbor_mines == 0):
      open_blank_cells(mines, cr, cc-1)

  return

where mines is my 2D array of cells, cr is the index of the current row (first array index), and cc is the index of the current column (second array index).

I thought that my algorithm was decently solid (but please tell me if I'm wrong there!!!), so I turned to the Internet and found that the default Python recursion limit of 1000 could be to blame.  However, when I bump it higher with the call to sys.setrecursionlimit the game either exhibits the same behavior, or simply crashes as the system kills it.

When I comment out 2 of the 4 recursive checks in the function, it will open up blank cells without any problem.  3 or more however breaks the algorithm.

Edit

As requested....

Calculation of neighbor_mines

# if not a mine, figure out how many surround it
  for i in xrange(10):
    for j in xrange(10):
      if (mines[i][j].is_mine == False):
        #check top 3
        if (i > 0):
          if (j > 0):
            if (mines[i-1][j-1].is_mine == True):
              mines[i][j].neighbor_mines += 1

          if (mines[i-1][j].is_mine == True):
            mines[i][j].neighbor_mines += 1

          if (j < 9):
            if (mines[i-1][j+1].is_mine == True):
              mines[i][j].neighbor_mines += 1

        #check left and right
        if (j > 0):
          if (mines[i][j-1].is_mine == True):
            mines[i][j].neighbor_mines += 1

        if (j < 9):
          if (mines[i][j+1].is_mine == True):
            mines[i][j].neighbor_mines += 1

        #check bottom 3
        if (i < 9):
          if (j > 0):
            if (mines[i+1][j-1].is_mine == True):
              mines[i][j].neighbor_mines += 1

          if (mines[i+1][j].is_mine == True):
            mines[i][j].neighbor_mines += 1

          if (j < 9):
            if (mines[i+1][j+1].is_mine == True):
              mines[i][j].neighbor_mines += 1

Switch_state

 def switch_state(self, newstate):
    self.state = newstate

    #marked as mine
    if (newstate == 1):
      nf = "sq_mine_marked.png"
    elif (newstate == 2):
      nf = "sq_mine_question.png"
    elif (newstate == 3):
      nf = "sq_mine_open.png"
    elif (newstate == 4):
      nf = "sq_mine_mine.png"
    else:
      nf = "sq_mine.png"

    oldrect = self.rect #save old rect as load_image overwrites it
    self.image, self.rect = load_image(nf, (255,0,255))
    self.rect = oldrect

sentences:
OpenGL/C++ Rotate relative to shooting gun I'm trying to make a 2D game where I have a gun that i use to shot things in the direction of the mouse resulting in an angle that I can get. I have some problems with the trajectory of the bullet because I don't know what to put in the Transpose and Rotate function.
For example Point 1 has x = 20 and y  = 30. I want to shot in the direction of Point 2  at x = 50 and y = 50. To do that i get an angle 't' which I use in the rotate function. But the reality is that I get the animation that I presented in the photo. I increase the x coord of the bullet because I can only shot in right side so only positive x. The bullet is moving on the 0x axis rotated at an angle t but at the same y as the gun.

What I want is something like

I'm sorry if this is a duplicate I couldn't find a solution to my problem. I think the resulting Matrix should have the form : Translate * Rotate * Translate but I can't find the right x and y.
Sorry if this seemed dumb and thank you for your time!

sentences: Better ways of handling the server for a Multiplayer Browser Based Game I am looking to create a multiplayer browser based game, similar to tribal wars and such, and i'm trying to think of better ways of handling the server, for example when troops and buildings are completed and the landing of troop movements

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: how to use a mask texture? A texture pack for a sponza model contains mask textures (black and white). I guess that I should read only a red channel from that texture, right ? I use deferred rendering and for  shading calculations I use additive blending. A result is first save in a texture (for some post-process operations), so doesn't go directly to the default framebuffer. How to use a mask texture ?

sentences:
What are the correct angles in the Top-down perspective? In the following picture it says that in the Top-down perspective the angles are 90°, but if it would be 90° then you shouldn't see the front of the building and the roof at the same time...

So what are the correct angles to get such an perspective?

sentences:
Creating an Array of 1s and 0s (with all 1s touching) I am a novice programmer trying to add an unnecessary and complicated element to a text adventure!  ...and I've run into a question I am not sure how to research further (I suspect due to lack knowledge of the proper terminology).

I am working on a small text adventure that uses an 11x11 array. Player is capable of moving into spaces with a 1 and incapable of moving to a 0. I need to a) retain the outer boundary 0s, b) randomize the content inside the border, and c) ensure that there is a linked path of 1s that will eventually connect to a 2 (the exit):

0 0 0 0 0 0 0 0 0 0 0
0 1 1 0 0 0 0 1 0 0 0
0 0 1 1 1 1 1 1 1 1 0
0 0 1 0 0 0 0 0 0 1 0
0 0 1 1 1 1 1 1 1 1 0
0 1 1 0 1 0 1 0 0 0 0
0 1 0 0 1 0 1 0 0 0 0
0 1 1 1 1 0 1 1 1 2 0
0 0 0 1 0 0 1 0 0 0 0
0 0 0 0 0 0 1 1 0 0 0
0 0 0 0 0 0 0 0 0 0 0

I'd appreciate any pointers here - not sure what direction I should be looking in. Thinking of scrapping this feature so if it's not viable I don't mind hearing that :) Thanks for reading.

sentences:
Low-level GPU code and Shader Compilation Bear with me, because I will raise several questions at once.  I still feel, though, that overall this can be treated as one question that may be answered succinctly.

I recently dove into solidifying my understanding of the assembly language, low-level memory operations, CPU structure, and program optimizations.  This also sparked my interest in how higher-level shading languages, GLSL and HLSL in particular, are compiled and optimized, as well as what formats they are reduced to before machine code is generated (assuming they are not converted directly into machine code).

After a bit of research into this, the best resource I've found is this presentation from ATI about the compilation of and optimizations for HLSL.  I also found sample ARB assembly code.

This sort of addressed my original curiosity, but it raised several other questions.  The assembler code in the ATI presentation seems like it contains instructions specifically targeted for the GPU, but is this merely a hypothetical example created for the purpose of conceptual understanding, or is this code really generated during shader compilation?  If so, is it possible to inspect it, or even write it in place of the higher-level syntax?  My initial searches for an answer to the last question tell me that this may be disallowed, but I have not dug too deep yet.

Also, along the same lines, are GLSL shader programs compiled into ARB assembly code before machine code is generated, and is it possible to write direct ARB assembly?

Lastly, and perhaps what I am most interested in finding out: are there comprehensive resources on shader compilation and low-level GPU code?  I have been unable to find any thus far.

I ask simply because I am curious :)

sentences:
How do I make sure everyone sees the same distance across different resolutions? Hello game dev community. I have recently got into making games in a browser window, and me and a friend ran into a common problem. Let's say I have a game like diep.io, where users can control their tank and move across a large grid. Each player can only see a certain distance, even if they moved the window to a larger monitor, like from 1080p to a 4K monitor.

I've created a game in HTML5 canvas, but the problem is that it depends on the browser's window.innerWidth and innerHeight properties. I can tell that this is an issue, because if I drew a grid, one player on a 1080p monitor could only see x distance but a player on a 4K monitor with a larger width and height could see x * 2 distance (or how much larger it actually is), meaning that the player on a 4K monitor has an advantage, by seeing players in a larger distance.

How exactly could I tackle this problem? My friend has the same issue, and I hope this answers it.

sentences:
What is the correct formula for penalty forces? I am trying to add penalty forces between two hard body objects, so when they collide they move in a realistic way. What I have so far is this:
var totalMass = aMass + bMass;
var temp = (aMass / totalMass * aVelocity) + (bMass / totalMass * bVelocity);
newVelocityB = (bMass / totalMass * bVelocity) + (aMass / totalMass * aVelocity);
newVelocityA = temp;

Originally I thought this was correct and it seems to work for the most part. However, this doesn't seem to be flawless. For example, if the collided object is a vertical wall (represented with a mass of infinity), the wall's velocity of (0,0) will be the final result. So, for an object moving diagonally with a velocity of (10,10) and hitting the wall, will result in a velocity of (0,0). In my case I would expect that the y component of the velocity remains 10, and it keeps sliding up the wall.
Can anyone tell me if I'm on the right path, and how I can modify my formula to make sure that the y-velocity does not become 0?
I have considered that the collision normal of the wall could be important (in this example [-1, 0]), or the perpendicular of the normal, however I still have not figured out how to apply it in this formula. Multiplying by the perpendicular of the normal was my first idea, but this isn't the correct answer.

sentences: Unity IOS game restart when you press the home button Why does my unity IOS game restart when i press the home button on the device? The same game worked fine on Android device and did not restart on pressing the home button. Thanks

sentences:
Touch Gesture Map Movement I really dig the way that the map is moved in Clash of Clans (https://itunes.apple.com/ca/app/clash-of-clans/id529479190?mt=8)...

I can recognize the pinch and finger movement needed for the zooming and the swiping around the map, what I'm looking for is a tutorial in any language that reveals how to test for the map going out of bounds when moved or scaled.

My google fu has failed so far on this one, any hints?

Right now I can perform the scale operations and the movement operations, but I can't figure out how to stop the map from going out of bounds when pinched or scaled.  My code is a crazy mess and makes me think I'm missing the fundamental logic of how this is done.

(I am using Starling with AIR, but a tutorial in any language if you have a link).

Update: this is what I'm basing what I have currently so far:
https://github.com/PrimaryFeather/Starling-Framework/blob/master/samples/demo/src/utils/TouchSheet.as

sentences:
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:
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:
texture size of characters and geosets I am a 3D artist, not a game developer but I am interested in dabbling none the less.
Would anybody know the texture sizes currently used for games like WOW or Guild Wars 2?
Don't worry, I'm not trying to make a massive game that takes teams of hundreds, I'm simply interested in the efficiency of MMO type games. From what I can find on the net, it's roughly 512k x 512k textures for the base character although its surprisingly hard to find the information and I don't have the games installed anymore to see if I can check.
And...
If anybody can explain Geo-sets to a noob like me that would be great. My general understanding is that the model is separated into pieces such as head, hands, legs etc then the model with textures swapped some how to show new models and textures for say a new pair of gloves.
Many thanks.

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:
Can I use PBOs for textures in iOS? As far as I can see, there is no GL_PIXEL_UNPACK_BUFFER. Also, the OpenGL ES 2.0 specification (and as far as I know, no iOS device currently supports OpenGL ES > 2.0) states that glMapBufferOES() can only use GL_ARRAY_BUFFER as a target, yet glTexImage2D() and glTexSubImage2D() only seem to use PBOs if GL_PIXEL_UNPACK_BUFFER is bound.

The OpenGL documentation for glBindBuffer() also states that:

  GL_PIXEL_PACK_BUFFER and GL_PIXEL_UNPACK_BUFFER are available only if the GL version is 2.1 or greater.

So, can I use PBOs for textures? Am I missing something obvious?

sentences:
Canvas isometric translations to integer coordinates I'm creating a canvas based game with an isometric playing board. I use the following transformations to get my square tiles to render on the screen:

'applyViewportTransformation' : function() {
    context.translate(this.settings.camera_x, this.settings.camera_y);
},
'applyIsometricTilt' : function() {
    context.scale(1, this.settings.tilt_ratio);
    // Rotating the grid around it's center.
    context.translate(this.settings.pixel_grid_width / 2, this.settings.pixel_grid_height / 2);
    context.rotate(Grid.degreesToRadians(45));
    context.translate(-this.settings.pixel_grid_width / 2, -this.settings.pixel_grid_height / 2);
},

My issue is I would now like elements rendered on specific tiles that aren't translated like this. I also need to be able to map mouse clicks to isometrically drawn elements etc.

So as far as I can tell I need a formula to go into the grid and a formula to go out of the grid.

Mathematically I'm lost and also a little stunned the 2d context doesn't have a public way of simply applying these transformations to a set of coordinates.

Help would be much appreciated.

Edit, if anyone wants a peek at the source or would like to suggest some edits you can view the source on github.

sentences: Can names of abilities or spells within a game be trademarked/copyright? Okay, say I want to create an RPG similar to and takes inspiration from such games as Final Fantasy, The Elder Scrolls, Shin Megami Tensei, Pokemon, etc. and I would like to use familiar names in some cases because the names simply fit from a design perspective (like from anything as mundane-but-aptly-named as "Water" or "Waterfall" to something like "Ultima" or "Souleater"). For the sake of the question I want to make it clear I'm not attempting a parody or the sort (it's going to be its own franchise), just most ability/spell names I can think of tend to come from video games or board games I've played.

sentences:
How do I calculate hex coordinates from a ring and index? I am trying to implement field of view (FOV) in a hex grid. I am using the cube coordinate system from here. Then, I am using shadow casting to find FOV as from here.

I have a system like in the image, below. The numbers at the corners are coordinates. The numbers in the center are formatted as [Ring index],[Hex Index].

I need to used both ring index and hex index to calculate angles used for shadow casting. I spent several days on it, but I still cannot find a way to make these two sets of numbers convertible.

How do I calculate hex coordinates from a ring and index?

sentences:
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:
Networking middleware I'm looking for a networking middleware that may be suitable for a medium-sized MMO.

I don't care in which language it's written, just that it's high-level, stable and has many of the features that can ease my development. I am making a 2D real-time action game.

Come to think of it... I'd be happy with "just" a high-level networking framework that has a few handy features to ease the development of a general networked game.

sentences:
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:
Game build in unity3d project transfer from a previous developer Can someone help or give me some idea what are the necessary deliverables from a previous developer that I need to ask regarding the game project transfer?

The situation is, there is a company that is developing our game in unity3d and it is already available in Apple store and Playstore. They developed it from scratch and on our part, we are just doing the game testing process. So now, we are going to ask them to transfer the entire project development to us. The company is in another country so we are just communicating thru emails, and we never done the communication by video calls.

And That's it. what are the things they need to transfer to us?

Thanks in advance.

sentences:
D3D11/C++ Inaccuracies in uv interpolation in pixel shader. How to avoid? I'm trying to draw a quad with a texture onto the screen such that texels and pixels perfectly align. Sounds pretty easy. I draw 2 triangles (as TRIANGLE_LIST, so 6 vertices) using these shaders:

struct VSOutput
{
    float4 position     : SV_POSITION;
    float2 uv           : TEXCOORD0;
};

VSOutput VS_Draw(uint index : SV_VertexId)
{
    uint vertexIndex = index % 6;
    // compute face in [0,0]-[1,1] space
    float2 vertex = 0;
    switch (vertexIndex)
    {
        case 0: vertex = float2(0, 0);  break;
        case 1: vertex = float2(1, 0);  break;
        case 2: vertex = float2(0, 1);  break;
        case 3: vertex = float2(0, 1);  break;
        case 4: vertex = float2(1, 0);  break;
        case 5: vertex = float2(1, 1);  break;
    }
    // compute uv
    float2 uv = vertex;
    // scale to size
    vertex = vertex * (float2)outputSize;
    vertex = vertex + topLeftPos;
    // convert to screen space
    VSOutput output;
    output.position = float4(vertex / (float2)outputSize * float2(2.0f, -2.0f) + float2(-1.0f, 1.0f), 0, 1);
    output.uv = uv;
    return output;
}

float4 PS_Draw(VSOutput input) : SV_TARGET
{
    uint2 pixelPos = (uint2)(input.uv * (float2)outputSize);
    // output checker of 4x4
    return (((pixelPos.x >> 2) & 1) ^ ((pixelPos.y >> 2) & 1) != 0) ? float4(0, 1, 1, 0) : float4(1, 1, 0, 0);
}

where outputSize and topLeftPos are constants and expressed in pixel units.

Now for outputSize = (102,12) and topLeftPos = (0,0) I get (what I would expect):

But for outputSize = (102,12) and topLeftPos = (0,0.5) I get:

As you can see there is a uv-discontinuity where the two triangles connect and interpolation of uv is inaccurate. This basically happens (in x and y) only at positions around the .5 (actually below .49 it correctly snaps to texel 0 and above .51 it snaps correctly to texel 1, but in between I get this artifact).

Now for the purpose I need this for it is essential to have pixel perfect mapping.
Can anyone enlighten me why this happens?

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:
Creating stable tentacle structures I am using verlet integration to simulate some tentacles. So far it works great and I am satisfied with how it looks in general. Here is how a tentacle is built:

The very stiff sticks are colored red, in addition I added angular constraints of 180° in order to keep everything together.

But still, sometimes this happens:

When forces are too big at the peak, it flips around and gets stuck in a very ugly state.

Of course I could increase the number of iterations for satisfying the constraints, but then the tentacles get too stiff and the performance suffers.

What can I do about this? Some ideas:

add more points at the peak
more constraints overall
limit possible forces
maybe rethink my tentacle design completely?
detect flip over and undo it

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:
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:
How to enable Unity related syntax highlighting with VSCode? I'm using VSCode, not VisualStudio for Unity scripting. VSCode has syntax highlighting for C#, which works fine, but all the Unity related stuff like Vector3 doesn't get any highlights. I know, that you can change somehow the files, but I can't even find the C# folder in my extensions folder (There is everything else like cpp, css etc. just no c#). Would be great if someone could lead me to the folder location and how to add keywords for the highlighting.

Here is a screenshot, where you can see that float is highlighted, but Transform not.

sentences:
How to interpolate colors around the spectrum of hues? I wanted to generate a 7 segment display whose color brightness varies with time, this can be done by just using linear relationship.
Color activeColour2 = new Color(1, DateTime.Now.Millisecond*0.001f, DateTime.Now.Millisecond*0.001f);

So in 1 complete second, it produce color in the range of (1,0,0) to (1,1,1) as in the code below:
using System;
using UnityEngine;

public class ClockDigit2 : MonoBehaviour
{
    static readonly bool[,] SEGMENT_IS_ACTIVE = new bool[,] {

        {true,  true,  true,  true,  true,  true,  false}, // 0
        {false, true,  true,  false, false, false, false}, // 1
        {true,  true,  false, true,  true,  false, true }, // 2
        {true,  true,  true,  true,  false, false, true }, // 3
        {false, true,  true,  false, false, true,  true }, // 4
        {true,  false, true,  true,  false, true,  true }, // 5
        {true,  false, true,  true,  true,  true,  true }, // 6
        {true,  true,  true,  false, false, false, false}, // 7
        {true,  true,  true,  true,  true,  true,  true }, // 8
        {true,  true,  true,  true,  false, true,  true }  // 9
    };

    public Color32 inactiveColour = Color.black;

    public SpriteRenderer[] segments = new SpriteRenderer[7];

    public void Display(int number)
    {
        Color activeColour2 = new Color(1, DateTime.Now.Millisecond*0.001f, DateTime.Now.Millisecond*0.001f);
        var digit = number % 10;
        if (digit < 0) digit *= -1;

        for (int i = 0; i < 7; i++)
        {
            if (SEGMENT_IS_ACTIVE[digit, i])
            {
                segments[i].color = activeColour2;
            }
            else
            {
                segments[i].color = inactiveColour;
            }
        }

    }

    void Update()
    {
        Display(DateTime.Now.Second);
    }
}

However, now I want to interpolate through all the colors in the circle above over 1 second.
I don't know how to express this as a formula for R, G, and B. The RGB value is not linear relationship: as you spin the selected color in the chart, you can notice the RGBA components vary together in a nonlinear form.
I considered using Lagrangian interpolation. However, this will not be accurate or might fail greatly because if you take a reference point at the circle and assume in 1sec, it made a complete revolution, you will notice there is a certain period of time where the RGB value is constant along the path: either 0 and 1.
So is there any method to get a formula that perfectly fits the color chart with respect to time?

sentences:
OpenGL texture2d/image sampling issue. Strange artifacts in texture I have an issue when using textures in OpenGL, strange artifacts occur where geometry overlaps, but not always.
Video Reference. I am using a GL_TEXTURE_2D with GL_ARB_image_load_store to make a custom depth test shader that stores material data for opaque and transparent geometry. The video given shows the artifacts occur where the support structure for a table is occluded behind the top of the table, but strangely, not occurring where the base of the table is occluded by the support.
#version 450 core

in VS_OUT {
    vec3 Position;
    vec3 Normal;
    vec2 TexCoords;

    mat3 TanBitanNorm;
} fs_in;

// Material data
uniform sampler2D uAlbedoMap;
uniform sampler2D uNormalMap;
uniform sampler2D uMetallicMap;

// Material info out
layout(rgba16f) coherent uniform image2D uAlbedoDepthOpaque;
layout(rgba16f) coherent uniform image2D uNormalMetallicOpaque;
layout(rgba16f) coherent uniform image2D uAlbedoDepthTransparent;
layout(rgba16f) coherent uniform image2D uNormalAlphaTransparent;

// Depth info in/out
layout(r8) uniform image2D uDepthBufferOpaque;
layout(r8) uniform image2D uDepthBufferTransparent;

void main() {
    vec3 n_tex = texture(uNormalMap, fs_in.TexCoords).xyz;
    n_tex = n_tex * 2.0f - 1.0f;

    ivec2 tx_loc = ivec2(gl_FragCoord.xy);
    const float opaque_depth = imageLoad(uDepthBufferOpaque, tx_loc).r; // Stored depth of opaque
    const float trans_depth = imageLoad(uDepthBufferTransparent, tx_loc).r; // Stored depth of transparent

    // Depth processing
    if (gl_FragCoord.z > opaque_depth) {
        bool tran = false;
        if (trans_depth > opaque_depth)
            tran = trans_depth > gl_FragCoord.z;
        else
            tran = true;

        // Transparent
        if (texture(uAlbedoMap, fs_in.TexCoords).a < 1.0f && tran) {
            imageStore(uDepthBufferTransparent, tx_loc,
                vec4(gl_FragCoord.z));

            imageStore(uAlbedoDepthTransparent, tx_loc,
                vec4(texture(uAlbedoMap, fs_in.TexCoords).rgb, gl_FragCoord.z));
            imageStore(uNormalAlphaTransparent, tx_loc,
                vec4(abs(length(n_tex) - 1.0f) > 0.1f ? fs_in.Normal : normalize(fs_in.TanBitanNorm * n_tex), texture(uAlbedoMap, fs_in.TexCoords).a));
        }

        // Opaque
        else {
            imageStore(uDepthBufferOpaque, tx_loc,
                vec4(gl_FragCoord.z));

            imageStore(uAlbedoDepthOpaque, tx_loc,
                vec4(texture(uAlbedoMap, fs_in.TexCoords).rgb, gl_FragCoord.z));
            imageStore(uNormalMetallicOpaque, tx_loc,
                vec4(abs(length(n_tex) - 1.0f) > 0.1f ? fs_in.Normal : normalize(fs_in.TanBitanNorm * n_tex), texture(uMetallicMap, fs_in.TexCoords).r));
        }
    }

    if (opaque_depth == 0.0f) {
        imageStore(uDepthBufferOpaque, tx_loc,
            vec4(0.125f));
    }

    else {
        imageStore(uDepthBufferOpaque, tx_loc,
            vec4(0.125f + opaque_depth));
    }
}

Render with overlapping geometry shows that artifacts still occur outside of reading from the texture. Also in the video, I move the camera back and forth (with orthographic projection) and the artifacts become brighter and darker. Render with overlapping geometry w/out depth processing shows that the brighter/darker values were from the depth test.
Any ideas on why this occurs, and how can I fix it?

sentences:
Can I export animated models from Unity? Into what formats? I have an animated 3D model from the Unity Asset Store that I would like a new animator to touch up (the license allows this). But they need it in a format they can use (in Maya or... something else?). All I have been able to find so far is:

how to export from the Editor into Unity Package format
scripts to export the mesh (only?) into OBJ format [1]

Is it possible to export a textured and rigged model from Unity? If so, into what formats and how?

[1] ObjExporter and ExportOBJ

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:
What is the process for getting a dev-kit for Xbox 360 to allow native coding I'm curious about the process of getting a Xbox 360 dev-kit.

What are the requirements? Do you have to have a track record in game development. Can indie gamers get one. How much does it cost? Is there special hardware?

sentences:
How can I stop explodable objects from creating new ones during cleanup? I have a problem with the handling of explosions in my game.

Currently, I have an entity create an explosion when it is destroyed (in the destructor). The issue with this is that when I change states, all my game objects are deleted. This causes explodable objects to create explosions when my EntityManager is already deleted.

I'm still pretty new to game development and I believe my design is very poor. How can I solve this problem?

sentences: How 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:
How can I structure my ASCII terrain object? So I have this object which represents a simple ASCII "overworld". Note the code is broken, but it's for demonstration purposes...

var TerrainObj = {
    w: { name: 'water', glyph: 'w' },
    g: { name: 'ground', glyph: 'g' },

    terrain: [[w, w, w, w],
              [w, g, g, w],
              [w, g, w, w],
              [g, g, w, w]],

    generate_display: function(terrain) {
        ...
        Code that returns an array the same as terrain but containing
        the glyphs from the objects in terrain
        ...
    }
}

So as you can see, the object contains the data for different types of terrain cell, the overworld itself, and a method to covert the terrain info into an array of glyphs for printing to the screen. But of course the problem with this code is that in the terrain array, there will be an reference error to each object.

I want to be able to write out the terrain array without using more than a one-letter name, because presumably to get this to work I'd have to do something like

terrain: function() {
    var map = [[this.w, this.w, this.w, ...],
               ...
               ...
               ];
}

So is there a nicer way I can produce my "semantic" terrain layer that references objects but without me having to write lengthy references to them in my array declaration?

sentences:
Create BoundingBoxes on a Model I am trying to create multiple BoundingBoxes on a Model by following this tutorial:

https://electronicmeteor.wordpress.com/2011/10/25/bounding-boxes-for-your-model-meshes/

However, I keep getting this error: Requested range extends past the end of the array. on this line:

part.VertexBuffer.GetData(part.VertexOffset * stride, vertexData, 0, part.NumVertices, stride);

I can't figure out why it is giving me that. I load my model and try to create the boxes like this:

Model model = this.Content.Load<Model>("Cube");
MeshModel box = new MeshModel(model);

Instead of passing a String path of the model, I just pass the Model itself (I changed the constructor to accept Model model).

Any help would be appreciated!

Here's what the debugger says (the vertexStride and VertexBuffer has 24 which is the same size as the vertexData so it should be ok):

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:
What early design decisions are important for creating "performant" multiplayer games? I want to create online games and focus on the performance from the beginning.

I searched on the internet, but didn't find any an particular answer concerning the design level or development level aspect, such as

Design Patterns,
Protocols,
Techniques,
Data transfer(games state) ,
Formats(JSON/serialization)

;

which are crucial to create high performance online games can most of the articles are talking about hardware consideration,  but you know that is not what I am looking for.

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: 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:
Unreal Engine Niagara Write to Texture or Data Structure In the Niagara system, is there any way to write to a texture? I want to write the position of each particle into a texture. So the 2d grayscale texture has its intensity as the number of particles in the pixel.

Or, is there any data structure that I can use to store the particle positions? Something like 2d or 3d array?

sentences:
How to achieve a dynamic soft see-through hole effect in a wall with shaders? I'm looking for a way to create a dynamic soft see-through hole effect for room walls. I know a few ways how to do it (for example multitexturing with second layer being the hole mask in screenspace), but all involve rendering walls with blending on which is too expensive for the mobile project I'm working on. Is there any way to do this without using blending on the whole geometry (the hole can appear in any place on any wall). Please see the attached image for a better illustration of the effect:

Also, I'm very open to any links to papers/tutorials that might not be solving the exact problem but doing something close that might get me on the right tracks. Thank you!

sentences: Unity 3D engine for Ubuntu? Is there any way to get Unity 3D to run on Ubuntu. I am currently running Ubuntu 12.04 64bit edition. I also have Wine installed.

sentences:
How to rotate an object to face another in Unity? I'm having an issue where I can't seem to rotate my bullet appropriately whenever I spawn one. I currently have a capsule prefab I am testing with. I spawn it with the following code.

        GameObject b = (GameObject)Instantiate(Resources.Load<GameObject>("Prefabs/Bullet"));

I am using the following code to try and orient the bullet so that it lays along the imaginary ray between it's spawn location and the centre of the target.

    void Start() {
    go = InputController.instance.hit.transform.gameObject;
    transform.position = new Vector3(transform.parent.position.x, transform.parent.position.y - 5, transform.parent.position.z);
}

void Update () {
    transform.LookAt(go.transform.position);
    Vector3 rotation = transform.eulerAngles; //THIS IS THE LINE I NEED TO ALTER
    transform.rotation = Quaternion.Euler(rotation);
    transform.position = Vector3.MoveTowards(transform.position, go.transform.position, SPEED * Time.deltaTime);
    Debug.DrawRay(transform.position, transform.forward * 10000000, Color.red); //DEBUGGING
    Debug.DrawRay(transform.position, transform.up * 1000000, Color.green); //DEBUGGING
}

Essentially the issue I am having is how I can calculate the rotation of the object based on the two I have available.

As you can see the line that I can't seem to calculate is the second line of the Update method, what it needs to do is orient the Vector3.up direction of the object to run along the Vector3 created by linking its position with the target location.

Interestingly the bullet is already laying horizontally but the LookAt method changes its rotation so I just need to fix it but I'm not sure on the math to do that.

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:
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:
How do I get pygame to work on intel processor? I downloaded Python 3.4 64 bit IDE and pygame but whenever I tried installing pygame it would say "Not supported on Intel".
So are there version of pygame available for Intel processor or are there any other ways to install pygame on an Intel processor?????

sentences:
How to show NGUI menu in the upper of a Game Scene? I am new to Game Development. I made a menu with NGUI plugin. I have a background image in the behind of this menu. Now, I want to place my Game Scene in place of the background image. I have tried in several ways. But, Failed. Any suggestions will be highly appreciated.
Thanks

sentences:
Pygame surface rotation, rect rotation or sprite rotation? i seem to have a conceptual misunderstanding of the surface and rect object in pygame.

I currently observe these objects this way:

Surface

Just the loaded image

rect

the 'hard' representation of the ingame object (sprite). Used for simplifying object moment and collision detection

sprite

rect and surface grouped together

What i want to do is rotate my sprite. The only available method i found for rotation is  pygame.transform.rotate.

How do i rotate the rectangle, or even better, the whole sprite?

Below is the image of how i visualize this problem.

sentences:
Should I use procedural animation? I have started to make a fantasy 3d fps swordplay game and I want to add animations. I don't want to animate everything by hand because it would take a lot of time, so I decided to use procedural animation.

I would certainly use IK (starting with simple reaching an object with hand ...).
I also assume procedural generation of animations will make less animations to do by hand (I can blend animations ...).
I want also to have a planner for animation which would simplify complex animations; those which can be split to a sequence - run and then jump, jump and then roll - or which are separable - legs running and torso swinging with sword -.

I want for example a character to chop a head of a big troll. If troll crouches character would just chop his head off, if it is standing he would climb on a troll. I know that I would have to describe the state ("troll is low", "troll is high", "chop troll head" ..) which would imply what regions animation will be in (if there is a gap between them character would jump), which would imply what places character can have some of legs and hands or would choose an predefined animation.

My main goal is simplicity of coding, but I want my game to be looking cool also. Is it worthy to use procedural animation or does it make more troubles that it solves? (there can be lot of twiddling ...)

I am using Blender Game Engine (therefore Python for scripting, and Bullet Physics).

sentences:
Facebook link gives "This game is not available for your phone" I am developing a game in Unity and have connected to FB using the plugin.
I am able to login and send a request to another user with no problems.

However, when I click on the notification I get the message "This game is not available for your phone".

Everything is set up as it should be and both users are defined as developers for the app.

The only thing is that I have not yet published the app in FB. Is that a requirement?

sentences:
Unity - X axis back to front I'm using Unity 2018 and its really confusing me. I generate a plane mesh in code and when it comes to positioning (transform.position.x) it on the X axis I can't understand why moving it further to the right the X value decreases (into the negatives) and the X value increases to the left??

The Y axis works as expected, up increases the value (positive), down decreases (negative).
The Z axis, away from camera = negative and towards = positive.

(Just creating a basic 3D cube game object using the Unity Create tool, the same issue applies.)

I need to figure if this is how Unity is set up now? Or I'm doing something wrong.. But I'm stuck on this!!

//create mesh code:

Mesh CreateMesh(float width, float height)
    {
        Mesh m = new Mesh();
        m.name = "ScriptedMesh";
        m.vertices = new Vector3[] {
         new Vector3(0, 0, 0.01f),
         new Vector3(width, 0, 0.01f),
         new Vector3(width, height, 0.01f),
         new Vector3(0, height, 0.01f)
     };
        m.uv = new Vector2[] {
         new Vector2 (0, 0),
         new Vector2 (0, 1),
         new Vector2(1, 1),
         new Vector2 (1, 0)
     };
        m.triangles = new int[] { 0, 1, 2, 0, 2, 3 };
        m.RecalculateNormals();

        return m;
    }

//build our first wall mesh obj

                    var wallObj = new GameObject("Wall-" + wallc.WallLengthCM + " (" + wallIndex + ")");
                    var _wallMesh = (MeshFilter)wallObj.AddComponent(typeof(MeshFilter));
                    _wallMesh.mesh = CreateMesh((float)wallc.WallLengthCM, (float)wallc.WallHeightCM);
                    MeshRenderer wallRenderer = wallObj.AddComponent(typeof(MeshRenderer)) as MeshRenderer;
                    wallRenderer.material = ShedWallMat;
var wallMesh = Instantiate(_wallMesh,
                new Vector3 { x = 0, y = ((float)wallc.WallHeightCM * 2 * wallIndex) + vertSpace, z = 0 },
                new Quaternion { w = 0, x = 0, y = 0, z = 0 });

sentences:
Balancing game difficulty against player progression It seems that the current climate of games seems to cater to an obvious progression of player power, whether that means getting a bigger, more explosive gun in Halo, leveling up in an RPG, or unlocking new options in Command and Conquer 4.

Yet this concept is not exclusive to video or computer games -- even in Dungeons and Dragons players can strive to acquire a +2 sword to replace the +1 weapon they've been using.

Yet as a systems designer, the concept of player progression is giving me headache after headache. Should I balance around the players exact capabilities and give up on a simple linear progression? (I think ESIV:Oblivion is a good example of this) Is it better to throw the players into an "arms race" with their opponents, where if the players don't progress in an orderly manner, it is only a matter of time until gameplay is unbearably difficult? (4th Edition DnD strikes me as a good example of this) Perhaps it would make most sense to untether the core gameplay mechanics from progression at all -- give them flashier, more interesting (but not more powerful!) ways to grow?

sentences:
How to achieve selection of a tile from a tile sheet based on an ID? Let's say I have a tile sheet that contains 8 sprites per sheet. Each sprite is a tile of 30x30.

I wrote my own custom map parser/map loader however I'm having trouble extracting a certain tile sprite from the file. I'll describe my problem better in order for everyone to understand.

I wrote an enum of materials, each material has a value according to it's location relative to the tile sheet. For example void is 1, grass is 2, rock is 3, etc. So in my tile sheet they are represented as such:

+---+---+---+---+---+
| 1 | 2 | 3 | 4 | 5 |
+---+---+---+---+---+

Which is equivalent to:

+------+-------+-------+
| void | grass | stone |
+------+-------+-------+

Basically when rendering, I created a tile class, each tile has 2 coordinates: X and Y (They are calculated automatically) and a material which can be represented either as a number, either as a value (ID). When rendering, I have a vector of sprites which are all taken from 1 file called tilesheet.png, however each of them must only draw a certain portion of the tile sheet, for example say I have something like this:

tile coordinateBounds(topLeftX, topLeftY, tileWidth, tileHeight);

During the initialization of the map I calculate an array of tiles, and I give each of them their position, their materials based on the values in a map file and a few other variables such as collision. I need to apply the coordinateBounds to each of them according to their material value. For example if the material is grass it should only take the grass sprite from the tilesheet. I must also mention I'm using SFML, and there are no borders or spacing between the tiles.

sentences:
Tilemap Object Placement I am looking for a way to select tiles within a bounding box for object placement within a scene/world, similar to Roller Coaster Tycoon and other simulation games.

(source: tumblr.com)

In the above screenshot of Theme Parkitect you can see that a 4x4 grid is used as the footprint for the object being placed. Given the bounding box and location of the mouse, how can I suitably determine the neighbouring tiles which fall into the bounding box?

I have implemented a graph like structure of tiles, corners and edges by following Amit's fantastic articles on Red Blob Games. As of such, I have a graph of all  tiles and their neighbours as well as associated tile edges and corners. These tiles are laid out diagonally against the world axis so simply selecting all tiles within a rectangular region isn't as simple (or maybe it is?) as i'd expected. This layout can be changed if necessary however.

The main source of information used to steer my implementation has been from Amit's Thoughts on Grids and the graph structure implemented in his article about Procedural Map Generation

As a bonus, I would like to implement a way to rotate the object being placed such that a footprint of 1x5 could be rotated to instead be 5x1. I would imagine that once the basics of multiple tile picking has been implemented this should be reasonably simple.

Unfortunately, Amit's articles don't seem to cover this topic and the approaches I have found and tried so far haven't quite yielded the correct results. Any help that fits in with the graph like structure for connected tiles, edges and corners would be greatly appreciated.

I have tried to implement the approach outlined in Raytracing on a Grid with a mixture of both Broad-Phase collision and A* Path Finding but neither of these two approaches cover selection of multiple surrounding tiles.

I am not concerned with the viability of tiles for placing objects at this point (i.e.: sloped edges of tiles or obstructions from other objects). The ideal solution for now would simply be to find the tiles included within the bounds.

My initial forays into this have resulted in incorrect results whereby the bounding rect doesn't include all neighbouring tiles (sometimes missing entire rows/columns) or returning neighbours outside of the bounds. I was pretty sure that I was close to a winning implementation but my vector math isn't strong enough to validate my findings.

sentences:
What are the alternatives to OpenGL arrays for deferred rendering? I'm trying to build a deferred rendering technique in an OpenGL engine, but I can't figure how I could get more than the limit of 32 lights.

I use an array in my shader, feed light properties into this array then loop through it and compute lightning, but I can't get more than 32 items into my array.

What is a better alternative to this?

sentences:
OpenGL : Blending & feedback effect I'm struggling on a simple project, as an example/sandbox, I'm rendering a small oscillating rectangle on my output. I'm not using glclearcolor() but instead, on every frame I draw a black rectangle before anything else, blending with: glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
My goal is to see as I play with the alpha of this black rectangle feedback of previous frames, slowly fading, some kind of trail, and it's more or less working.
My main problem though, the trail never really disappears, and the longer I try to get the trail, the worse it gets. Also, I have to quite crank the alpha before seeing any trail, I don't really understand why.

sentences:
How to make a door stay open if the player is inside the trigger zone? I've been struggling with this for all day long, I want to make a door to stay open when the player is inside the trigger zone, but I cannot make it happen...

Here is what I did:

A basic animations and animator (Open, Close, Idle/Default)
Default transitions between states (with and without "Exit Time")
A basic script to check if the player is inside the trigger:

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

public class DoorScript : MonoBehaviour
{
    Animator _animator;
    bool doorOpen;

// Use this for initialization
void Start ()
{
    doorOpen = false;
    _animator = GetComponent<Animator>();
}

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

} */

void OnTriggerEnter(Collider other)
{
    if (other.tag == "Player")
    {
        doorOpen = true;
        DoorController("isOpen");
    }
}

void OnTriggerExit(Collider other)
{
    if (other.tag == "Player")
    {
        doorOpen = false;
        DoorController("isClosed");
    }
}

void DoorController(string trigger)
{
    _animator.SetTrigger(trigger);
}
}

And my result is the same, the animation of the door repeats itself even when the player is in the trigger zone, I tumbled upon some other resources (here... here... here... here I tried to copy what this person did, but is the same... here... and here) about doors and triggers, and I still don't know how I am wrong or what am I doing wrong, I tried everything in those links

The door goes through all animations regardless the script, and the parameters, when I move my player inside the trigger zone loops between open and close animations no matter what

Could some one help me with this?

Thanks in advance

EDIT:

Here are some screenshots of my animator and updated code, for this update I followed this tutorial, just a little difference, I'm using a FPS Controller from the Unity standard assets

Updated code:

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

public class DoorScript : MonoBehaviour
{
    Animator _animator;
    bool doorOpen;

    // Use this for initialization
    void Start ()
    {
        doorOpen = false;
        _animator = GetComponent<Animator>();
    }

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

    } */

    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Player")
        {
            doorOpen = true;
            DoorController("isOpen");
        }
    }

    void OnTriggerExit(Collider other)
    {
         //These lines were modified
        if (doorOpen)
        {
            doorOpen = false;
            DoorController("isClosed");
        }
    }

    void DoorController(string trigger)
    {
        _animator.SetTrigger(trigger);
    }
}

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:
Should the level design be in Unity scenes (GameObjects) or in 3D programs (mesh) I am wondering what is the most common and best way to design a game in Unity from the point of view of best practice and performance and the most easily maintainable?

Is it really performant to design the level in Unity editor using a GameObject for each part of the level? or should the whole world of the level be designed in any 3D software and then exported to Unity as a on GameObject?

sentences:
What version of OpenGL should I target for Steam? I'm planning on developing a game (targeting towards PC and Linux) and putting it up on Steam in the future but I am not sure of what version of OpenGL to target so that the majority of steam users can be able to play my game.

I know Steam has a hardware survey but I'm still not sure of what OpenGL to use but a lot of people recommend OpenGL 3.0 and to make sure not version OpenGL 3.x since 3.x != 3.0.

sentences:
Unity: Efficient way to get the average pixel color for a portion of the camera viewport At it's core, the problem I'm trying to solve is this:
I have a camera (not main) that I would like to project to a 2 pixel RenderTexture. I would like the first pixel to be the average color of all pixels in the left portion of the camera viewport (or a close approximation). And the second pixel to be the average color of all pixels in the right portion of the camera viewport.
So far I've looked into doing this via OnRenderImage(src, dest) but I'm open to any suggestions. Same goes with camera resolutions, 256x256 seems like a good starting point but open to suggestions here too. It's worth mentioning that I just threw together a brute-force non threaded approach that works but totally tanks FPS (nothing surprising)
Any help would be greatly appreciated. This doesn't seem like an incredibly weird downscaling approach but I can't seem to find anything regarding it. There might be a clever way of dealing with this via a shader but I have yet to find it. Bilinear downscaling (which I think is what unity uses by default) sadly does not give the appropriate result.
System compatibility is not an issue, Win 10, DX 12.

sentences:
Get GameObject to bounce of colliders I am making a Atari Breakout game with unitys 2d tools and I need to get the ball to bounce of colliders in the scene. If you havent played the game before how it works is if the ball hits the wall at 45 degrees it will bounce of the wall at the same angle (diagram bellow)

How can I get the ball to move at a continues speed and when it hits a collider to bounce back the way the image shows?

sentences:
Originating direction of shots in an FPS problem Recently I have been asked on the interview about a maybe simple task to solve a problem.

We have a player, that looks in some direction, and a shooter, who already is shooting the player. I must find out whether the shots come from the left or right in the same way Counter Strike does when you get hit: the game shows from which direction and it looks like a red half-circle.

I know the vectors of players and enemies position. I tried different answers f.e. to build a line from the player see's and solve a linear system equation or rotate the player vector and then find out the angle of scalar product, but he says there's a better way to do it. I don't need the answer to this particular question, but a 'way' to find out the answer. F.e. any books related to this problems, some similar problems, etc.

sentences:
Cloth tool and Skeletal Bone Weight Paints in Unreal Engine Just a quick question:
I've got my 3rd person rigged and skinned, but I have some hanging fabric around the characters waist which drapes down to the characters legs. Should this fabric be weighted so that it is affected by the characters legs as they are animated, or just the bones around the waist area?
My thinking is that I don't want the cloth to be affected by the legs, as the cloth simulation will take care of that for me. Instead the aim should just be to make the cloth orientate with the bones in the waist area, mostly "spine" and "spine1". As such I should just skin the cloth to the lower spine bones, and ignore the legs.
If I am incorrect, I'd appreciate any correction, and my apologies for any incorrect terminology, I am still learning.
Cheers!

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:
Impulse resolution for purely rotational collisions (relative linear velocity = 0) I've been writing a basic physics engine, (loosely) following Randy Gaul's online tutorial. I have been using this equation that he derives:

$$j=\frac{-(1+e)((V^A-V^B)*t)}{\frac{1}{{mass}^A}+\frac{1}{{mass}^B}+\frac{(r^A\times t)^2}{I^A}+\frac{(r^B\times t)^2}{I^B}}$$

(https://gamedevelopment.tutsplus.com/tutorials/how-to-create-a-custom-2d-physics-engine-oriented-rigid-bodies--gamedev-8032)

This equation works well for the majority of all collisions. However, if two objects collide through rotation and rotation alone (that is, their relative linear velocity is 0), an impulse of 0 will be applied since VA - VB is 0. This results in one object clipping into another, passing through as if it were never there. While less noticeable, this can also be a problem for collisions where relative linear velocity is non-zero, but angular velocity is much greater than relative velocity.

This is clearly not how objects would interact with real-world physics. That being said, how would I determine the "effective" relative velocity used in the equation for rotating bodies? I have already tried adding the linear velocity of the collision contact point to the center of mass velocity for both objects, but have gotten unsatisfactory results.

sentences:
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:
Farseer - Difference between Position, GetLocalVector, and GetWorldVector I have used Box2D extensively, and am used to just calling body.GetPosition(). But Farseer does not have this. Instead it has a property Position, as well as methods GetLocalVector and GetWorldVector. Farseer seemingly has a complete lack of documentation, and I have been unable to figure out what the difference is.

Also, though I feel a bit dumb about it, I don't really get what GetWorldVector means as opposed to GetLocalVector. They take a localVector and a worldVector as their respective arguments, but what does that mean? What is the difference between local and world vectors?

Any help is appreciated.

sentences:
Cube worlds, instancing vs mesh generation For a Minecraft type game, what are the pros and cons of hardware instancing the terrain vs generating a mesh of vertices based on what's visible?

The terrain is dynamic so cubes will be added/removed frequently. Also each side of a cube is the same texture.

sentences:
How to rotate a direction I'm working a spotlight for my deferred renderer and I'm having trouble with matching the mesh to the visual representation of the light. Right now my mesh is a cone, the apex of the cone is at (0,0,0), it has a height of 1 and a radius of 1. The direction of this cone is (0,-1,0) when the rotation is (0,0,0).

The relevant GLSL code:

float spot_alpha = dot(-l,normalize(vec3(0,-1,0) )); // <------
float inner_alpha = cos(light.falloff);
float outer_alpha = cos(light.radius);
float spot = clamp((spot_alpha - outer_alpha) / (inner_alpha - outer_alpha),0.,1.);

As you can see, the GLSL code uses a direction to define the area to be lit, so I could get this direction as a uniform, but I would need to find a rotation from that for the mesh to follow, or I can get the rotation and find a direction, but I don't know how to do either of these things.

Can I rotate a direction? How do I do it? If I can't, is there another solution for this problem?

sentences:
Unity: how do I edit a second scene when my objects are still in the first? I have my game set up so that objects like the Canvas and the main character are set to DontDestroyOnLoad; they're only initiated in the first scene. However, this means that when I load my second scene in the editor, those objects aren't there yet.

I could copy and paste them over, but then the objects in the second scene will be duplicates of the ones in the first.

This is a problem because I can't, for instance, create a public variable on the character controller and attach an object from the second scene to it. The character doesn't exist in scene 2 yet and the object doesn't exist in scene 1.

sentences: How to make enemies randomly choose a path and then come back if wrong one? So I'm making a 2D Tower Defense-game in Unity with C# where the enemy has to go to the base, but can go to the wrong path randomly and then turns around when the road ends. How can I achieve this?

sentences:
How to create realism similar to scenes rendered in Vray? I am tasked to make a game which requires very realistic interior scenes. Unity's bedroom demo(http://blogs.unity3d.com/2015/11/10/bedroom-demo-archviz-with-ssrr/) really caught my eye. See I know how to code but I am not good at modelling in 3DS. I see some amazing images only generated in 3DS using vray. But those are static images and the moment the same models are imported into Unity, they end up looking unrealistic. But somehow in the demo, Unity managed to create a very realistic looking scene. So here are my questions :

How do I create realistic game scenes like the ones rendered by vray in 3DS Max? Is it possible to bake the image rendered by vray into a UV map? I couldnt find how to do this.
Also, pls refer to the image in this link, from evermotion http://www.evermotion.org/files/tutorials_content/uploads/nr_AI44_002_cam_001_pp_051.jpg and also this image : http://www.evermotion.org/files/tutorials_content/uploads/nr_ae44s02__0041_Layer_2_022.jpg. The second pic is very unrealistic but the first pic after vray rendering looks amazing. I am sure the bedroom demo assets looked the same and assuming the answer to my first question is it cannot be done, then how do I go about creating the same level of realism as in the first pic?

Guys this is a really long question and might not be clear. So sorry, tried to describe it the best I can. Appreciate any answer, tips or advice. Thanks guys

sentences:
making special blocks in a voxel game OpenGL I'm making a voxel game and it looks quite good but then i thought of special blocks like minecrafts grass leaf blocks, and translucent water. I had the idea for the grass blocks to put them in a seperate VAO and render them after the blocks because they might look like an X from above.

How could you do water? I know you could enable blending in OpenGL and render from back to front and you could sort their distances each frame with a map.

My problem is how to render all of these waters, I could use instanced rendering but then i would have to update the buffers every time the player moved or i could draw them all individually but that would involve thousands of draw calls ex. 8000 draw calls for 20*20*20 blocks (each draw call sends a whole cube)

what would be a fast method of doing this?

sentences:
Collisions and Colliders Does anyone know how to prevent a gameobject from colliding with another gameobject but can still register collisions?
Like a ball that can bounce off of the wall or ground and can pass through the player himself.
What I have tried:
Creating two Colliders on the ball(which has a rigidbody component) and making one of them bigger than the other (and turn on "Is Trigger" on the bigger collider). Then write code in the OnTriggerEnter and the OnTriggerExit functions to disable/enable the smaller collider so that the ball could fly right through the player. But that is completely useless when the ball is not in motion and the player walks over it(because it'll fall straight down through the ground).

sentences:
How to avoid banding with raymarched fog? I have a raymarching shader for fog.
It works well but It creates artifacts in the form of banding:

I understand the problem: The step size is too large and the sample points above the ground are not hitting the floor until the distance is bigger again.
However, How can this be reduced/ avoided?
My Shader looks like this:
float4 PS(PixelShaderInput input) : SV_TARGET {
    float3 rayStart = input.WorldPos.xyz;
    float3 viewDirection = normalize(input.WorldPos.xyz-CamPositionWS.xyz);
    float depth = linearize_depth(DepthTexture.Sample(DepthSampler, input.UV).x, NearPlane, FarPlane);
    float4 result = float4(FogColor, 0);
    float stepSize = 300;
    float stepAmount = ((NoiseTexture.Sample(Sampler, input.UV * 64).x)) * 64;
    [unroll(96)]
    while (stepAmount < depth) {
        float3 samplePos = rayStart + (viewDirection*stepAmount);
        stepAmount += stepSize;
        float fogDist = distance(samplePos, FogCenter);
        if (fogDist > FogRadius)
            continue;
        result.a += density(fogDist,FogRadius)*FogDensity;
        if (result.a >= 1) {
            result.a = 1;
            break;
        }
    }
    result = saturate(result);
    return result;
}

sentences:
A* pathfinding for grid with direction-dependent nodes? I'm trying to understand if the A* algorithm is a possible pathfinding solution for my game.

I have a simple grid of nodes that an enemy can move around on, but the nodes represent traversable terrain at different heights in my game world. So although an enemy might be able to "jump down" from Node A to Node B (where Node A is much higher than Node B), it could not do the reverse and "climb up" from Node B to Node A. In other words, whether the A* algorithm can travel from one node to another depends on the direction of travel. It may be possible in one direction but not the other.

Can A* handle a situation like this, or do I need a different pathfinding algorithm?

sentences:
How to produce interreflections in Unity3d? Notice how the "door" shown below appears multiple times in the reflections, both vertically and horizontally. These "extra" reflections are called interreflections. I am trying to reproduce this effect in Unity3d.

There are docs for interreflections, but following the provided steps does not produce any additional reflections. I spoke to a few others who also had a similar problem--it seems that increasing the bounce count alone does not produce interreflections.
So how can I do it? What are the additional steps required to do this? Is this effect not called an interreflection? If so, what is it, and how can I produce it?

sentences:
How do I implement a AABB-Sphere collision i have been trying to implement an aabb-sphere collision.

This is what I tried

@Override
public boolean collides(Sphere other) {
    Vector3f axis = Vector3f.sub(Vector3f.sub(max, min, null), other.getCenter(), null);
    float dist = axis.length();

    return dist < (other.getRadius() * other.getRadius());
}

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:
How can i put a skybox on a new layer with a new camera and then move the skybox? I want to create a moving start effect. For example the space station is moving around the star or moving to the star. But instead moving the space station i think it will be better to make effect of the skybox moving.

I have in the Hierarchy a RigiBbodyFPSController and a child MainCamera.
Now i added a new Camera to the Hierarchy.

Now how do i make the rest  ? Moving the new camera and the skybox to new layer and move the skybox ? Or it's more logic to say to move the new camera that the skybox is with in it in the new layer.

Not sure if my idea is logic or if there are a better ways to do it.
The general idea is to make movement effect like the space station is moving around the star or to the star. Star i mean the skybox.

The skybox is on the right.
I can't see the skybox in the scene view i see it only when running the game in the game view.

This is a screenshot when the game is running then i can see the skybox in scene view and game view:

sentences:
Unity: Model Construction on the fly So, forgive me if some of the terminology is wrong, I am just getting started with Unity again and I can't remember the proper names. I'm also on my phone, so I didn't have unity in front of me when I posted this question.

I am beginning work on a voxel based game. Everything in the game will be models constructed of 64 by 64 cubes. I would like to, with the code given, say, a 4096 bit array, be able to construct a model in the game with those cubes. I know that you can programmatically add models that you have imported into unity, but I want to make contiguous meshes programmatically, with highest performance being the goal. I do not want a certain amount of little 1x1 cube meshes positioned right next to each other, but specifically one model.

Is this possible?

sentences:
Calculating the inverse mesh of a 2D mesh inside a bounding box If I have a mesh (drawn in red below)

How can I calculate the inverse of the mesh (drawn in red below), given that the mesh is always constrained by the same four vertices of the encompassing bounding box?

My mesh is drawn using a series of clockwise wound triangles.

Is there possibly any easy way to do this in a shader?

I wish to draw the triangles, and therefore each pixel, of the inverse mesh rather than draw the original mesh with color of the mesh and the background swapped to give an inverse effect.

sentences: How are dynamic blending shadows like this created? I would like to know, how dynamic shadows, that 'blend' onto other objects, are created.

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:
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:
Unity Export Package Taking Too Long I'm trying to export a Unity Package and it's taking far too long (it just keeps counting, and doesn't end). I'm not sure why it continues to count in the PackageImporter.Tick but I'm wondering if others have noticed performance issues.
Unity Version: 2020.2.3f1
OS: Windows 10

sentences:
XNA Calculate two points of triangle with given Z I want to calculate the two points of a 3D triangle that have a specified Z coordinate. I guess the way to do this would be to somehow create a plane which is perfectly flat with my given Z coordinate and then calculate where the triangle intersects with it (or is this wrong).

If you know how to do this in any way please help. I have searched for but have not really found anything that seems to work.

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:
Sprite collision with color? Is this possible?

To elaborate, I am making a PacMan offshoot. Essentially it is a "zoomed in" version of the game, but the board is randomly generated. I have 11 .png files each to be used as a background for different hallway shapes. You have your straightaways, corners T junctions and cross intersection. They are very simple, each has a black background and the walls are blue. What I am looking for is a way to stop the player from walking on the blue parts of each image. Is that possible?

My current set-up is that I have a Piece class that holds the image, Entry points as bools (up down left right) for when I randomly select the image to be used so that a path can be created, size, etc. I then have a Board class that holds a list of Pieces (size 11 (One for each image))) and then 2D an array "board" (currently 9x9) that randomly but intelligently generates the map. When it comes to player pathing, I was manually going to add to the Piece class code that adds invisible rectangles over the blue walls and then have the Player class, or some other class, check for collision. This would take a ton of extra code because each image is different so each would need to be manually done.

I was just thinking there must be an easier way to do this, and the whole color idea occurred to me. If i could just check if it intersects the blue and then change its position back that would be much easier.

I am at work currently, but if there is any code you would need to see, or any other helpful information let me know and I will add it as soon as I get home!

TL;DR Is there a way to check collision via color, or add rectangle automatically over a specific color.

sentences:
How to correctly export UV coordinates from Blender Alright, so I'm just now getting around to texturing some assets. After much trial and error I feel I'm pretty good at UV unwrapping now and my work looks good in Blender.

However, either I'm using the UV data incorrectly (I really doubt it) or Blender doesn't seem to export the correct UV coordinates into the obj file because the texture is mapped differently in my game engine. And in Blender I've played with the texture panel and it's mapping options and have noticed it doesn't appear to affect the exported obj file's uv coordinates.

So I guess my question is, is there something I need to do prior to exporting in order to bake the correct UV coordinates into the obj file? Or something else that needs to be done to massage the texture coordinates for sampling. Or any thoughts at all of what could be going wrong?

(Also here is a screen shot of my diffused texture in blender and the game engine. As you can see in the image, I have the same problem with a simple test cube not getting correct uv's either)

Edit -

Added my geometry pass shader source code to show how I'm rendering and sampling the diffuse texture. I'm simply using the UV coordinates provided by the obj file and an anisotropic sampler.

Texture2D    diffuseTexture : register(t0);
SamplerState textureSampler : register(s0);

cbuffer ObjectTransformBuffer : register(b0) {
    float4x4 worldTransformMatrix,  // Translates to world space.
             cameraTransformMatrix; // Translates to camera space. (not including rotation)
};

cbuffer ScreenTransformBuffer : register(b1) {
    float4x4 viewProjectionMatrix; // Rotates to camera space and then projects to screen space.
}

cbuffer MaterialBuffer : register(b2) {
    float3 materialDiffuseAlbedo;
    float  materialSpecularExponent;
    float3 materialSpecularAlbedo;
    bool isTextured,
         isLighted;
};

struct vsInput {
    float3 positionLS : POSITION;
    float3 textureLS  : TEXTURE; // Input signature uses a uvw coordinate but w is 0 and not needed for any geo pass textures.
    float3 normalLS   : NORMAL;
};

struct vsOutput {
    float4 positionCS : SV_POSITION;
    float2 textureLS  : TEXTURE;
    float3 normalWS   : NORMAL;
    float3 positionWS : POSITION;
};

struct psOutput {
    float4 positionWS : SV_Target0;     // Surface positions.
    float4 normalWS   : SV_Target1;     // Surface normals.
    float4 diffuseAlbedo : SV_Target2;  // Surface diffuse albedo.
    float4 specularAlbedo : SV_Target3; // Surface specular albedo.
};

vsOutput VS( in const vsInput _in ) {
    vsOutput _out;

    _out.positionCS = mul(float4(_in.positionLS, 1.0f), mul(cameraTransformMatrix, viewProjectionMatrix));
    _out.positionWS = mul(float4(_in.positionLS, 1.0f), worldTransformMatrix).xyz;
    _out.normalWS   = mul(float4(_in.normalLS, 0.0f), worldTransformMatrix).xyz;
    _out.textureLS  = _in.textureLS.xy; // w coordinate is 0 and not needed.

    return _out;
}

psOutput PS( in vsOutput _in ) {
    psOutput _out;

    // Use the alpha channel to indicate specular light intensity.
    _out.normalWS = float4(normalize(_in.normalWS), materialSpecularExponent);

    float _lightEffectModifier;
    if (isLighted)
        _lightEffectModifier = 1.0f;
    else _lightEffectModifier = 0.0f;
    // Use the alpha channel to indicate whether the surface is affected by light for the light pass.
    _out.positionWS = float4(_in.positionWS, _lightEffectModifier);

    _out.diffuseAlbedo = float4(materialDiffuseAlbedo, 1.0f);
    if (isTextured)
        _out.diffuseAlbedo *= diffuseTexture.Sample(textureSampler, _in.textureLS.xy);

    _out.specularAlbedo = float4(materialSpecularAlbedo, 1.0f);

    return _out;
}

sentences:
Client/Server state synchronization for RTS How can I perform state synchronization using client/server networking in an RTS similar to Starcraft 2 and Planetary Annihilation?
I'm assuming the server has to do some sort of rewinding time to apply the updates received by each of the clients. But for an RTS game, that sounds like a lot of separate copies of the game world. How do you resolve interactions between units belonging to different players who have different latencies?
For the clients, do they need to use their latency (RTT) in order to know how far behind the server they are, to apply future updates that arrive from the server at the right time?
How do you keep time in sync when latency could fluctuate and server updates may not arrive at fixed intervals?

sentences:
Efficient Way of Creating Menus in XNA I'm a hobbyist and I've just finished implementing the "game" part of a game I'm developing, and I feel as if it finally matured enough to be worth adding a menu to start a new game, exit, edit options, etc., and so I tried to find sources online with tips for creating menus in XNA (first time creating a game in XNA).

So far, I haven't really found any good solutions.  I guess I'm looking for a solution that isn't ad hoc so that I could easily reuse it for future games I decide to make.  Is there any such built in XNA functionality I'm unaware of?  Any XNA libraries out there that would prove useful?  Or do you guys have any tips in general for easy/robust/reusable implementation of menus in XNA?

Thanks in advance!

sentences:
How to make a world-to-player inventory system? I am running into an issue of trying to implement an inventory system within XNA (doesn't really matter, could be any platform) but so far. Here is the issue I am trying to wrap my head around:

How can I get an item from the world (think when you kill a monster it drops armor) and get it into my player's inventory?

If an inventory is just a list of items, technically, how could I get Steel Sword from the world into my player's inventory without having a class do more than one thing?

I currently have an item struct, which contains a unique hex value, a count of how many items there are (for stackables, like arrows) and a Texture for rendering within the inventory, and some other unimportant properties (name, description, etc).

It would be bad design if I had to modify my existing item class to house a world position, along with collision detection (don't want the item falling through the earth).

Thanks for any considerations!

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 can I replicate the look of Zelda: BotW in my own shaders? At the moment I really want to develop a game with a similar shading technique that is used in Zelda BOTW however I do not know how I can achieve that look?

To me it looks like they are using a cel shading technique with rim lighting, however I do not know is how to design textures or use them to achieve similar results. Or even if I’ve got the right basic idea.

I would really like to know how these kind of aesthetics could be replicated and if it would be possible using a tool like Substance Designer (using a PBR workflow) or not.

sentences:
SpriteRenderer not Rendering Sprite Edit: I've slightly edited this question because I've found the symptom for my problem, but not why the actions I've noticed cause the issue.

I have what appears (via the inspector) to be two identical 2D objects containing only a transform and a Sprite Renderer.

One was created by dragging a png from a folder onto the screen, and it displays normally.

The other was created by going to the hierarchy and right click > 2D Object > Sprite, and dragging the desired picture into the object's 'Sprite' Field.

Both objects appear in the development view, but only the first one appears in the game view. Why does the second object not appear?

All other settings for Unity (environment, camera, etc) are the default for a 2D project.

Here are the inspectors for...

The sprite that is displaying:

The sprite that is not displaying:

And my Camera:

sentences:
moving object on game background after scaling it based on screen size I am creating a game using Corona SDK, I have a map with a ball and another other object that moves on the map.

I use the the ultimate config.lua file for scaling background based on device screen resolution.

My problem is that I want to arrange some objects on this map.  I have created specific assets for a specific device resolution, but on devices with aspect ratio lower than 1.72 the map is stretched horizontally so that appears wider than other assets.

Also when I want to arrange an object to a specific location on top of the map the result is that things don't line up right because of the scaling issue.  For example, when i set myobject.y=100 on a device with aspect ration more than 1.72 it set on the right place but when I do the same thing on device with aspect ratio less than 1.72 my object is off the map.

I tried to convert my pixels to inches using device DPI but it's still the same.

sentences:
Do UDP game clients/servers block for receive calls? One way to implement a client/server relationship is to have the server simulate the whole game based on the clients input and send updates back to each client, while the client is is simulating the game for the player and sending back input and game state messages that the server can use to process the whole state of the game.

My question is, since a ReceiveFrom() call blocks till it receives data and a Select() call blocks for a set period of time, does that mean all clients and servers block for a certain amount of time each frame?  I am aware that a call to Select() can be set to zero which would be an effective poll to the read write states of the current sockets, but wouldn't you miss out on new data if it comes in just microseconds later?  How is this problem solved now a days?  Pro select() method handling? Asynchronously? Separate thread completely? Other?

I may be over thinking this, but I would like to know more information so I can write an effective client/sever relationship.
-Haywire

sentences:
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: Web-based interactive fiction engine? Are there any web-based interactive fiction engine that allow you to script a game and have it run from a website?

sentences:
Draw trajectory arc predictor in game I found this tutorial on youtube and it works pretty well, but I want to add more to it.

How can I draw a smooth arc path in the game view (right now the path is only visible in the editor)?

Here is the code:

public class BallLauncher : MonoBehaviour
{

    public Rigidbody ball;
    public Transform target;

    public float h = 25;
    public float gravity = -18;

    public bool debugPath;

    void Start() {
        ball.useGravity = false;
    }

    void Update() {
        if (Input.GetKeyDown (KeyCode.Space)) {
            Launch ();
        }

        if (debugPath) {
            DrawPath ();
        }
    }

    void Launch() {
        Physics.gravity = Vector3.up * gravity;
        ball.useGravity = true;
        ball.velocity = CalculateLaunchData ().initialVelocity;
    }

    LaunchData CalculateLaunchData() {
        float displacementY = target.position.y - ball.position.y;
        Vector3 displacementXZ = new Vector3 (target.position.x - ball.position.x, 0, target.position.z - ball.position.z);
        float time = Mathf.Sqrt(-2*h/gravity) + Mathf.Sqrt(2*(displacementY - h)/gravity);
        Vector3 velocityY = Vector3.up * Mathf.Sqrt (-2 * gravity * h);
        Vector3 velocityXZ = displacementXZ / time;

        return new LaunchData(velocityXZ + velocityY * -Mathf.Sign(gravity), time);
    }

    void DrawPath() {
        LaunchData launchData = CalculateLaunchData ();
        Vector3 previousDrawPoint = ball.position;

        int resolution = 30;
        for (int i = 1; i <= resolution; i++) {
            float simulationTime = i / (float)resolution * launchData.timeToTarget;
            Vector3 displacement = launchData.initialVelocity * simulationTime + Vector3.up *gravity * simulationTime * simulationTime / 2f;
            Vector3 drawPoint = ball.position + displacement;
            Debug.DrawLine (previousDrawPoint, drawPoint, Color.green);
            previousDrawPoint = drawPoint;
        }
    }

    struct LaunchData {
        public readonly Vector3 initialVelocity;
        public readonly float timeToTarget;

        public LaunchData (Vector3 initialVelocity, float timeToTarget)
        {
            this.initialVelocity = initialVelocity;
            this.timeToTarget = timeToTarget;
        }

    }
}

I found a way to Instantiate projectile along the path. Now I just need to know how to convert that line in debug mode to make it visible in game mode

sentences:
How do I decrease the scale of an instanced node or scene? I'm trying to decrease size of instanced RigidBody2D scene, through code. With scale(), I'm trying to decrease the size of the image/sprite that's attached to the RigidBody2D. The problem is, it's not working.

No matter how much I try to scale down, the size of the blood drop circle remains the same.

const blood_druple_scn = preload("res://Scenes/blood.tscn")

func spawnBlood():
    var newBlood = Blood_druple_scn.instance()

    rotationAdd = rotationAdd + 30

    if(switchBloodSize == 0):
        set_scale(Vector2(2,1)) //This part is my problem
        print("blood size: ", newBlood.get_scale())
        add_child(newBlood)
        switchBloodSize = 1

    elif(switchBloodSize == 1):
        newBlood.scale(Vector2(0.5,0.5)) //This part is my problem
        print("Blood size: ", newBlood.get_scale())
        add_child(newBlood)
        switchBloodSize = 0

    newBlood.set_pos(Vector2(100,100))
    rotate(rotationAdd)

As you can see, I have two different if conditions, each with a different scale() and size. Sadly, both remain the same size. The strange part is that it does display the scale values as been altered, yet the newBlood instance is not visually changing. Why is this?

sentences:
Circular fighter motion algorithm Is there an algorithm to make ships take semi-circular patterns? I need something like the below image:

Big Blue- Command Ship
Small blues - fighters
Red lines - path of movement

I want the fighters to zip around the command ship while avoiding obsticles such as space debris and eachother. I need at most a dozen fighters zipping around each ship and there would be up to a dozen command ships zipping around at a slower pace. All the fighters should return to the ship every once in a while for repair and rearming.

I chiefly need the circular path and I need to keep the path centered constantly on the command ship despite any movements. Are there any circular path finding algorithms? (and a better question; is there an official term for this kind of algorithm/path?)? Also note that I am developing this as an RTS for mobile, so the least expensive the operation the better.

sentences:
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:
SDL Mixer Strange Error Message I have a Visual Studio C++ project. I've just started out with SDL, and I've already rendered images, text, and now I'm trying to play audio. This will be done with the SDL_Mixer extension library.

However, I'm having the following issue. When I run my code with the SDL_Mixer library included, I get the following popup error message:

The procedure entry point SDL_AudioStreamFlush could not be located in the dynamic link library...

What the heck does this mean? Did I do something wrong with the installation? I got SDL mixer from here:
https://www.libsdl.org/projects/SDL_mixer/

Any help would be greatly appreciated!

sentences:
What single word could be used to describe city adventures? I am developing an urban racing simulator in a very "underground" stylized setting. It's name is The Underground King and you have the ability to either:

A) Race in a 2d side view.
B) Do something in the city.

Doing either of A or B will pass the day since it's assumed it takes all day to perform that action.
My issue is that while racing levels are caled Racing, the city action/adventure is called Event which is both too generic, and conflicts with my game engine's internal event systems.

I have tried to find a relevant replacement that is descriptive enough on what it is, whithout relying to medieval fantasy type tropes such as "Adventure" or cyberpunk's very own "Run".

What I could think of / narrow down are: Buisness or Biz, Happening, Venture, Risk, Encounter.
Here are some examples of the kind of things you can find:

You accidentally bump into a drunk thug who wants to start a fight.
A dog has something shiny and valuble looking in its bouth and wants to run away to bury it.
A suspicious-looking woman dropped a package in a trash can.
You get a tip about an abandoned but heavily locked garrage.
A rich businessman wants to put a bet on your next race but wants a guarantee.
While driving with your crew, you smell something burning (with random consequences):

Somebody is playing with matches.
The engine is burning.
Somebody tried to sabotage your car for the next race but it shortcircuited.
A rusted part finally started spinning again. The car has higher stats now.

I am looking for a single word term that can apply to any sort of event as written above which is generic enough to encompass anything you can potentially gain from, but specific enough to represent its something you can pursue or happen to you while you are present in the city.

Thanks!

sentences:
Who kept a blog for a year with a new game idea every day, and where is it? There's this indie game developer who tried to come up with a new original idea for a game every day for a year - and he put all his thoughts on his website. +200 ideas so far, if I remember correctly.

I don't remember the URL to his site, or the name of the author. Anyone know what I'm talking about?

[Delete this post if it doesn't belong here! Just wanted to add it to the blog thread if I managed to find it]

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:
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:
Breaking up a 2d shape into small triangles I have a "piece of cloth" (2d shape) that I'm applying soft-body physics to.  This works great when the shape is a square and I can create a regular grid of vertices between which are hung the cloth's "springs."  However, now I'm trying to get this to work with non-square piece of cloth, so I'd like to be able to break the polygon down into thousands of tiny triangles.  I've seen lots of libraries to tessellate or triangulate polygons, but they all seem to minimize the number of triangles created, which is exactly the opposite of what I want.

Does anyone know of a library (optimally in JS!) that breaks up a polygon into arbitrarily small chunks?  Preferably as regular as possible (i.e., creating a grid-like layout where possible), but not required.

Alternatively, does anyone know if there's a name for this, so I can just look up the algorithm and implement it myself?

sentences:
watching for changes in object state I'd like to know what others do to watch for changes in object states while the game is running.

Say you have an object and that object has a timer. The timer completes. What is the best way to know that the timer has completed?

something like?
- add all timers to a vector.
- set a bool when the timer completes
- loop over the vector continuously or at a short interval and watch for the bools?

Seems simple, but is it really that simple? What is the best way to loop over the vector continuously? C++11 thread and detach it from the main?

sentences:
Can't show an object in a tapped coordinate So hi, I have a problem. I want to show an object (Texture2D) in an area tapped by user. This is my fields :

List<Texture2D> list = new List<Texture2D>();
List<Vector2> list2 = new List<Vector2>();
List<int> list3 = new List<int>();

list, is used to store the object. list2, used to store tapped coordinate. and list3, is used to store object timeout (after 100ms, the shown object vanishes)

This is my update method

protected override void Update(GameTime gameTime)
{
    TouchCollection touchState = TouchPanel.GetState();

    foreach (TouchLocation t in touchState)
    {
        if (t.State == TouchLocationState.Pressed)
        {
            list.Add(Content.Load<Texture2D>("base_grass"));
            list2.Add(new Vector2 { X = t.Position.X, Y = t.Position.Y });
            list3.Add(100);

            System.Console.WriteLine("added : " + t.Position.Y + "," + t.Position.X);
        }
    }

    for (int i = 0; i < list3.Count; i++)
    {
        list3[i]--;

        if (list3[i] <= 0)
        {
            list.RemoveAt(i);
            list2.RemoveAt(i);
            list3.RemoveAt(i);
        }
    }
    base.Update(gameTime);
}

(base_grass is the name of my object. It is a plain rectangle image)

The "for" statement is to remove the object when the time expires.

And this is my draw method

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

    _spriteBatch2.Begin();

    for (int i = 0; i < list.Count; i++)
    {
        _spriteBatch2.Draw(list[i], list2[i], new Rectangle(0, 0, 64, 64),
                Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 1);
    }
    _spriteBatch2.End();

    base.Draw(gameTime);
}

Nothing shown when I clicked on the screen.

But if I change the _spriteBatch2.Draw into this

 _spriteBatch2.Draw(list[i], new Vector2((64 * 0),(64 * i)), new Rectangle(0, 0, 64,64), Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 1);

It worked, but shown vertically, not on the tapped / clicked coordinate.

Anyone know where my problem is? Thanks

sentences:
Unity: scaling and animations In my Unity project I have a script that programmatically changes the scaling of an object during the game.

Recently I wanted to add a spawning animation clip to my object, which modifies the object's scaling (but only during a short delay). So I added an animation controller to the object, containing the spawning animation clip.

I can now successfully run the spawning animation but the in-game programmatic scaling changes don't work anymore, even when my animation is not running.

Any idea?

sentences:
How to display top-down 2D online game I'm new to game development (but not new to software development). As a personal/learning project, I'm designing an overhead-view 2D online RTS game (static, no scrolling). The first cut will pretty much only require simple sprites, with typical menus, text, and buttons.

Most of the game logic will happen server-side, with unit positions and other vitals sent to the browser at about 30 fps. The client won't do much, aside from the display and UI.
The server stuff is easy for me, but I need a little guidance on the browser display.

Having read up on several new browser technologies/HTML5 libraries, I'm getting more overwhelmed by the options, not less! I don't necessarily need the absolute best tool; what I want is a technology that will make it easy to implement a simple sprite-based game, and do a decent job of it.

I know JS itself well enough, but not any of the fancy graphics/game libraries. I know Flash/AS3 (doing what I want in Flash would be easy enough, but the mobile browser support concerns me--should I steer clear if I want iOS support?). I have the entire Adobe suite (subscription), if that helps. I'm not averse to learning a new language/API/tool, of course, but the more I can put what I know to good use, the better.

So, my question (yes, there is one in here somewhere!) is, what are my (best) options today for implementing the in-browser (display) part of said 2D online browser-based game, based on the above goals and stated skillset/available tools? Since it may be difficult to be completely objective, please do include a little rationale on why you believe your answer is the right tool for this job. I'm not asking for a doctoral thesis, here, just a paragraph or two. :-)

sentences:
unity3d nullreferenceexception i want to display a mesh sequence so i imported my obj files and found a script and partially edit it a bit.My project looks like this:

the script is this:

using UnityEngine;
using System.Collections;

/**
 * Animate a mesh by cycling through different meshes.
 * @author bummzack
 */
public class MeshAnimation : MonoBehaviour {

public Mesh[] Meshes;
public bool Loop;
public float FrameDuration;

private int _index;
private bool _playing = true;
private float _accumulator;
private MeshFilter _meshFilter;

public void Start()
{
    _meshFilter = GetComponent<MeshFilter>();
    _index = 0;
}

public void Update()
{
    _accumulator += Time.deltaTime;

    if(_accumulator >= FrameDuration){
        _accumulator -= FrameDuration;
        _index = (_index + 1) % Meshes.Length;

        if(_index == 0 && !Loop){
            Stop();
            return;
        }

        _meshFilter.mesh = Meshes [_index];
        print ("Hello World");
    }
}

}

the line that causes the problem is this:

_meshFilter.mesh = Meshes[_index];

and the problem shown in the console is this:

NullReferenceException
MeshAnimation.Update () (at Assets/MeshAnimation.cs:43)

i know it has something to do with Meshes[_index} being null but i cant find the solution because i think the Meshes array is properly filled.Can anyone suggest a solution?
Thank you all in advance.

sentences:
Passing Gameobject to another script in unity 3d I'm trying to pass a gameobject from one script to another runtime attached script. My fisrt script is attached to the FirstPlayerController and the gameobject is not dragged in the editor, but is picked up and carried in the script. All i want is to pass the gameobject to the CameraController class to as make the second camera follow that object. Below is what i've tried so far. I dont want to access the gameobject with the tag, because there are more gameobjects that can be picked up. I want to access the carried object to the cameracontroller class.

Thanks!

Pickupobject.cs

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

public class pickupobject : MonoBehaviour
{
    GameObject mainCamera;

    bool carrying;

    public GameObject carriedObject;

    public float distances;

    public float smooth;

    float speed = 1000f;

    new Camera camera;

    // Use this for initialization
    void Start()
    {

        mainCamera = GameObject.FindWithTag("MainCamera");

        camera = GameObject.FindWithTag("secondCamera").GetComponent<Camera>();

        camera.enabled = false;

    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.T) && carrying)
        {
            carrying = !carrying;

            ThrowBall();
        }
        if (carrying)
        {
            carry(carriedObject);

        }
        else
        {
            pickup();
        }

    }

    private void pickup()
    {
        if (Input.GetKeyDown(KeyCode.E))
        {

            int x = Screen.width / 2;

            int y = Screen.height / 2;

            Ray ray = mainCamera.GetComponent<Camera>().ScreenPointToRay(new Vector3(x, y));

            RaycastHit hit;

            if (Physics.Raycast(ray, out hit))
            {
                pickupable p = hit.collider.GetComponent<pickupable>();

                if (p != null)
                {
                    carrying = true;

                    carriedObject = p.gameObject;

                    //camera.enabled = true;

                   // camera.gameObject.AddComponent<CameraController>();

                    //carriedObject.AddComponent<MovingBall>();

                }
            }
        }
    }

    void carry(GameObject o)
    {
        o.GetComponent<Rigidbody>().isKinematic = true;

        o.transform.position = mainCamera.transform.position + mainCamera.transform.forward * distances;

    }

    //void CheckDrop()
    //{
    //    if (Input.GetKeyDown(KeyCode.U))
    //    {
    //        Drop();
    //    }
    //}

    //void Drop()
    //{
    //    ThrowBall();

    //}
    void ThrowBall()
    {

        mainCamera.SetActive(false);

        camera.enabled = true;

       // carriedObject.AddComponent<CameraController>();

        camera.gameObject.AddComponent<CameraController>();

        carriedObject.AddComponent<MovingBall>();

        carriedObject.GetComponent<Rigidbody>().isKinematic = false;

        carriedObject.GetComponent<Rigidbody>().AddForce(0f, 0f, speed);

     }

}

CameraController.cs

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

public class CameraController : MonoBehaviour {

   public GameObject icosphere;

    public GameObject abc;
    Vector3 offset;

    // Use this for initialization

    void Start () {

        icosphere = GameObject.FindWithTag("purpleball");

        offset = transform.position - icosphere.transform.position;
        }

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

            transform.position = icosphere.transform.position + offset;
    }
}

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: How does the double-buffered canvas know when to swap the buffer? How does the HTML5 canvas know that all the drawing operations are complete and it's time to swap the buffer ? Program can have multiple draw calls at different places so how will it know when is the right time to swap the front and back buffers ?

sentences:
Grid Pathfinding with known points What is the best way to, in a grid, to find a path (not necessarily shortest) from a start point to an end point (for both of which the coordinates are known)?

The grid is approximately 60x60, and has some obstacles in it. The coordinates of the start point, the end point, and all of the obstacles are known and easily accessible. Searches such as Breadth-first and A* work, however they seem to do an unnecessarily large amount of "searching" when you should already know where you are going.

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: How do I combine two HTML levels? If I have two levels that I have made separate in HTML5 how may I combine them so one comes after another?.

sentences:
Storing quests for an online RPG in a MySQL database I'm creating an online RPG game and I've been looking around for a way to save players' progressions in quests in MySQL. I've been looking at Pim Jager's answer answer for a while and I've come to the conclusion that this could work, but then my question would be:

Where/how do I store if a player currently has a quest accepted? How do I keep track of at which step of the quest the player currently is? This has to be saved somehow but I can't seem to figure out how I would do that. Let me know if you can help me out.

Thanks!

sentences:
AABB to AABB collision response I am currently trying to resolve collision between two AABBs. I already have a function that can detect if the the two boxes are colliding and returns true if the two boxes are colliding.

The problem is that I do not know what to do next. All I want to do is make sure the boxes do not penetrate each other. Where do I start?

I am really confused about how to start and any help would be great. I also cannot use any libraries as this is an assignment

sentences:
Calling a function from Super is getting an error I am following GameDev.tv's unreal C++ course, but I am getting an error that is causing my compiler to fail.  I'm coding a player controller, and I think I followed all the steps right but when I call the GameHasEnded() function from Super in the playercontroller.cpp, It gets an error saying: anything followed by '::' must be followed by a class or namespace.
Here is my .h file which has no known compiler errors.
    #pragma once

#include "CoreMinimal.h"
#include "GameFramework/PlayerController.h"
#include "ShooterPlayerController.generated.h"

/**
 *
 */
UCLASS()
class SIMPLESHOOTER_API AShooterPlayerController : public APlayerController
{
    GENERATED_BODY()
public:
    virtual void GameHasEnded(class AActor *EndGameFocus = nullptr, bool bIsWinner = false) override;
};

Here is my .cpp file with the problem.
// Fill out your copyright notice in the Description page of Project Settings.

#include "ShooterPlayerController.h"

void GameHasEnded(class AActor *EndGameFocus, bool bIsWinner)
{
    //this is the problem super
    Super::GameHasEnded(EndGameFocus, bIsWinner);
}

I have a lot of other scripts, but I don't think they're related to the problem.  I'm using Unreal 4.26, and Visual Studio 2019. I have no idea why this is getting an error, the code is exactly the same as the instructor’s code.

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:
How can I use collision lines to implement line-of-sight in GameMaker? I am making a GameMaker game that involves the enemies having line of sight so that they don't target the player through a wall. I have this code that uses collision line to detect whether there is a wall between the enemy and the player, then sets CanSee to 1 if true.

if collision_line(x, y, obj_parent.x, obj_parent.y, obj_wall_parent, false, true)
    global.CanSee = 1;

However, this code does not ever affect the value of CanSee. Am I using this code wrong?

Edit:
Here is my room setup. The walls all have obj_wall_parentas their parent.

Here are some of the objects:

sentences:
How can I create the arriving/ engaging in combat movement like in StarCraft 2? I currently have two armies (smaller scale) crashing into each other. They will usually form a line of units fighting. I have no idea how to handle a unit coming from behind the line to properly go around its allies to reach the enemies. Like in this position, where a new unit approaching from the green army needs to navigate around the battle front to reach the red enemies:

StarCraft 2 handles this beautifully, as seen here:

I've read that SC2 uses steering for local avoidance and A* and some other methods to plan out the paths. Which all is perfectly clear, but I haven't found anywhere any details on engaging the enemy.
This is what I have, it's been a month and I still haven't solved this specific issue.

How is it possible to do continuous checks of possible destinations before engaging the enemy, wouldn't it be too costly? To clarify, in the video of the Zerglings vs Zealots, they first engage each other and form a line, all the other units that come after them will go around the line, but, if space opens in the line they will immediately go towards it. This kind of arrival behaviour is briefly explained in their GDC talk, they have a cone of vision in which they do checks. The only ideas I had was

Have a cone of vectors (in the direction of Velocity) and do checks for each vector to see if it could provide a favorable position to move to
issue: Cannot figure out the math to create offsetted (by an angle) vectors, but it seems like a pretty decent solution

Have a spatial query in a rectangle to where the unit is moving
issue: How do I check for an empty space? I can get all entities in that rectangle but how can I check for empty places and score them (how favorable are they)? Are they even reachable, I'd still need some kind of raycast like with the first option

I have circlular collision shapes, seperation and goal following in place. I somewhat have introduced a goal system that should further spread the units, but as it stands I still lack the arrival behaviour described in the GDC talk.

sentences:
Unity - Transforming horizontal distance between two spriteRenderers to set UnityEngine.UI.Button width to this distance In my Unity scene, I have a couple of spriteRenderers and a UnityEngine.UI.Button called thisButton. The spriteRenderers are spread horizontally across my scene. I want to change the button width to span from the leftmost spriteRenderer to the rightmost spriteRenderer.
To do this, I have subtracted the x-Coordinate of the rightmost spriteRenderer (fRightEndingPosition) from the x-Coordinate of the leftmost spriteRenderer (fLeftStartingPosition).
float fLeftStartingPosition = leftmostSpriteRenderer.transform.position.x;
float fRightEndingPosition = rightmostSpriteRenderer.transform.position.x;
float fButtonTargetWidth = fRightEndingPosition - fLeftStartingPosition;

Then, I try to set the width of thisButton to the value of fButtonTargetWidth by doing
RectTransform buttonSize = thisButton.GetComponent<RectTransform>();
buttonSize.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, fButtonTargetWidth);

However, when I try to use this as the width of my button, the result is not correct. I am pretty sure this has something to do with different types of coordinates being used for the spriteRenderers and the button (world, screen, viewport, etc.), but I haven't been able to figure this out on my own.
In one specific example fLeftStartingPosition is -1.1, and fRightEndingPosition is 1.1. In my scene, a button that spans this distance has a width of roundabout 40 on its RectTransform. So clearly, setting the width of this RectTransform (buttonSize) to fButtonTargetWidth (2.2) in code results in a button that is way to narrow. In fact, after setting it's width to 2.2, it is not visible at all.
How do I transform this distance of 2.2 to the desired width of roundabout 40, in a way that this distance would be transformed correctly, no matter what the actual value of fButtonTargetWidth is?

sentences: How Can Create Line Renderer Runtime When Player in Gravity I want to Create functionality Like Rock Runner Game.when player into the gravity and hold the button then generate line and player hold the line and move forward. After So many Research i couldn't find anything in google and also in YouTube then i post the question. I put some snippets to very well understand what i want actually. if any one have idea how to do this then tell me. thanks in advance

sentences:
Game loop with fixed timestep gives strange result So I've read the famous article at http://www.koonsolo.com/news/dewitters-gameloop/comment-page-2/#comments which describes different methods of implementing a game loop. I've tried to implement the final method that is described in the article in Javascript (ignoring interpolation for the time being):

var Timer = {
        pastTime : 0,
        currentTime : 0,
        started : false,
        //starts the timer
        start: function(){
            if(!this.started){
                this.started = true;
                this.pastTime = new Date().getTime();
            }
        },
        //gets the time in MILLSECONDS
        getTime: function(){
            return new Date().getTime() - this.pastTime;
        },
        //stops the timer but does not reset it (i.e. getTime() can still be
          called to get the time between start() and end())
        end: function(){
            if(this.started){
                this.currentTime = new Date().getTime();
                this.started = false;
                return this.currentTime - this.pastTime;
            }
        },
        //resets the timer
        reset: function(){
            this.pastTime = 0;
            this.currentTime = 0;
            this.started = false;
}

var maxFrameSkip = 5;
var nextTick = new Date().getTime();
var TICKS_PER_SECOND = 25;
var tickTimeMillis = 1000 / TICKS_PER_SECOND;

var ticksPerSecondReal = 0;
var ticksCounter = 0;

var timer = Object.create(Timer);

var loops = 0;

 function gameLoop(){
    loops = 0;

    timer.start();

    while(new Date().getTime() > nextTick && loops < maxFrameSkip){
        update();
        ticksCounter++;
        nextTick += tickTimeMillis;
        loops++;
    }

    draw();

    if(timer.getTime() >= 1000){
        ticksPerSecondReal = ticksCounter;
        ticksCounter = 0;
        timer.reset();
    }

    console.log(ticksPerSecondReal);

    window.requestAnimationFrame(gameLoop);
}

 gameLoop();

So the problem that I'm having is that the console.log(ticksPerSecondReal) should always be giving me 25 because that's the constant ticks per second that I want and have set up. What I end up getting is an alternating number that is 25 and 26. So periodically (~1 second) it will be 25 and then 26 and then 25 and so on. And sometimes (much less frequently) it will even give a result of 27. It keeps switching back and forth when it should be constant at 25. What is the issue here?

sentences:
How to change player objects when switching scenes? I have a scene for lobby. When player connects to server he gets a lobbyCharacter, which is an empty gameobject with a script on it that create UI element with the players name. In lobby players can select character they want to use.
Now when starting game, i would like to switch scene to the game scene when all players are ready. I have been reading the API, documentation, and different stack questions, but i cant seem to find any info on how this should work. On NetworkManager i can do scene schange which will be changed on all clients. But how do i persist data over multiple scenes? And if the lobby characters are destroyied how are the game characters instansiated according to the choises made in lobby? How does the client connection persist between multiple scenes?
Do i just manage the character locally and use syncHooks to synchronize over the server? Do i need to create somesort of container gameobject that holds the player connection information and some extra stuff?
EDIT
Reading the soruce code of mirror i fouind that NetworkManager holds the connection of the client, sort of. So now the issue has come down to replacing the prefab for the connection.
I have the following code:
 public void switchScene()
    {
        GameObject obj = NetworkClient.connection.identity.gameObject;

        NetworkServer.ReplacePlayerForConnection(NetworkClient.connection, Instantiate(shipPrefab));

        NetworkServer.Destroy(obj);
        ServerChangeScene(gameScene);
    }

This should switch the prefab for connection and then switch scene, but i keep getting error
InvalidCastException: Specified cast is not valid.
Mirror.NetworkIdentity.SetClientOwner (Mirror.NetworkConnection conn) (at Assets/Mirror/Runtime/NetworkIdentity.cs:362)
Mirror.NetworkServer.InternalReplacePlayerForConnection (Mirror.NetworkConnection conn, UnityEngine.GameObject player, System.Boolean keepAuthority) (at Assets/Mirror/Runtime/NetworkServer.cs:837)
Mirror.NetworkServer.ReplacePlayerForConnection (Mirror.NetworkConnection conn, UnityEngine.GameObject player, System.Boolean keepAuthority) (at Assets/Mirror/Runtime/NetworkServer.cs:697)
LobbyManager.switchScene () (at Assets/LobbyManager.cs:51)

And i dont understand why this is happening. New prefab has networkIdentity and networkTransform. Old prefab only has network transform. Up until this point everything wors, but once i want to switch scenes, it breaks.

sentences:
How to create simple acceleration in a 2D sprite? So here's what I thought might work but half the time I press the 'Right' key, it results in a crash and the rest of the time seems to produce no acceleration at all.

if (KeyboardState.IsKeyDown(Keys.Right))

            while (motion.X < 1)
                motion.X += 0.001f + motion.X;

I want to know why exactly it won't work, and any possible alternate algorithms.

sentences:
Optimal way to find point D that lays at the perpendicular line between point A and line BC I am trying to write a script in C# to find the position of point D in 2D space in a specific scenario.

I know the (X,Y) position of point A, which never happens to be on the line that contains the line-segment BC. I also know that point D lies on the perpendicular line that passes through A and crosses BC at a point that we can call P. Also, I know the distance that D is from P. Se the image below:

Can anyone shed some line on which is the most optimal way of achieving that?

sentences:
Unity Animator not properly following animation transitions I have an Animator that has 3 different states. Walking, Climbing, and End of Climb.
The diagram is shown below:

I have 2 bools, isClimbing and isWalking. When isClimbing is set to false it transitions to End of Climb. Then when I set isWalking to true, it transitions to Walking. However, when I do this, for some reason the animator starts back at Climbing then moves to End of Climb then moves to Walking.
It seems everytime I change a parameter, it completely  restarts the state machine back to the default Climbing state and then moves forward.
I do not have code, and have been triggering this through the UI.
What am I doing wrong?

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'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:
Maze or puzzle algorithm for something similar to noodles Not sure if anyone has played Noodles at all https://itunes.apple.com/gb/app/noodles!/id967624193?mt=8 but it is a simple puzzle game, that involves rotating tiles until they link up. The tiles are either 4-sided or 6-sided and each tile can have 1 of a set number of 'pipes' including end pipes. There's only one solution which you reach by joining all the pipes together to a special 'starter' pipe which can take the form of any of the other pipes. There's also no loops.

What type of algorithm would someone use for this? I thought it could perhaps be a maze algorithm, but I'm struggling to understand how you would go about this.I think it's because in essence there aren't any walls, just different styles of connectors. But is this in essence a perfect maze? Does anyone have an idea of a starting point for an algorithm to accomplish something similar?

I'm not specifically looking for code, but a help in the right direction to identify a relevant algorithm or how someone might go about this. Though I have tagged this 'ios' as that's what I would ultimately be targetting

sentences:
align local Y to be parallel with global Y during or after slerp I am using the following function to have a globe rotate a point on its surface to face the global Z toward the camera. This works fine, but after each rotation  the Y axis seen as a green line is not vertically aligned.

I believe this is how slerp between two unit vectors works, it takes the shortest path.

I would like to know how can I achieve this rotation whilst getting the globe to rotate itself so that Y is at least parallel to the global Y?

        function rotateToHub(continent){
            var speed = 2000;
            var z = new THREE.Vector3(0, 0, 1);

            point = continent.position.clone().normalize();

            var q = new THREE.Quaternion();
            q.setFromUnitVectors(point, z);

            var duration = {t: 0};
            var tween = new TWEEN.Tween(duration)
                .to({t: 1}, speed)
                .onStart(function(){
                    slerp = true;
                })
                .onUpdate(function(){
                    earthContainer.quaternion.slerp(q, this.t);
                })
                .onComplete(function(){
                    slerp = false;
                    update();
                })
                .start();
        }

sentences:
What types of matrices are needed for game and graphics programming? I am writing a 3D math library for general game development and want to know what type of matrix classes I should include. Is just a 4x4 matrix enough, or must I provide 3x4 and dedicated rotational matrices?

According to this

  In order to use the vector registers of modern CPUs (SSE, Altivec, SPUs) you have to pass 4x 32 bit floats anyway (its a 128 bit register), plus you have to take care of the alignment, usually 16 bytes. So you don't have the chance to safe the space for the 4th component anyway.

and from Game Engine Architecture

  The rightmost column of an aﬃ ne 4 × 4 matrix always contains the
  vector  [ 0 0 0 1 ]T . As such, game programmers oft en omit the
  fourth column to  save memory. You’ll encounter 4 × 3 aﬃne matrices
  frequently in game math  libraries.

Since 4x3 matrices are just created for convenience and since you need 128 bits to use the vector register, would it be best to just have a single 4x4 matrix class handle all needed matrix operations?

sentences:
Problems exporting meshes to Unity 5 After creating a tree (Scots Pine) in SpeedTree Cinema v7.1.1 I exported it as a .FBX ascii file to Unity 5 and I encountered a problem; the leaf material, while viewing it in Unity 5, can only be seen when I view the tree from the top, but when I view the tree from the bottom or the side, the leaves dissapear, they're not visible anymore, but on the other side, I can view the leaves of the tree from any angle in SpeedTree Cinema v7.1.1.

I don't know if the problem is one of the following:

The way I export the tree (.FBX ascii)
The way the texture is saved (.tga, .jpg, .png)
The material settings (in SpeedTree or Unity)

So you can better understand, i'll show the following images:
Description of images is below

(Image 1.) Here are the setting of how I export the tree and you can also see the clearly see the leaves from all angles.

(Image 2.) Here is my tree (the tall one, Scots Pine) and you can't see the leaves from underneath and the material displayed on the right belongs to the leaves of my tree (the tall one, Scots Pine). The tree to its side(the small one) is how I would like the leaves to look ( i didn't make the small tree).

(Image 3.) In here you can see the leaves of my tree (tall one, Scots Pine) from the top, and next to my tree is another one (not my tree) which is how i would like my trees leaves to look. The material displayed on the right are from the small tree (not my tree).

Any help is appreciated, thank you.

sentences:
Making video from 3D gaphics in OpenGL What are some of the preferred methods or libraries for creating video from an OpenGL graphics simulation?

For example, I want to create a visualization(video) of an N-Body gravity simulation by rendering non-real-time OpenGL frames.

The simulation is already coded, I just don't know how to convert it to video.

EDIT:
I am also interested in providing the described functionality: The user can adjust parameters including the time step between captured frames and then initiate the simulation.  The user waits for the simulation to complete, and then can watch the results.  The user is able to increase or decrease the playback speed of the simulation whereas in slow motion, more frames are used i.e., you see higher resolution time steps, and when the speed is increased, you see lower resolution time steps at a higher rate, but the frames per second flashing on the screen is constant.

sentences:
issue with ray/physics collision detection All,

I am trying to pick object using ray collision and bullet physics

I am initializing my projection and view matrix only once, here is the code

projectionMatrix = glm::perspective(90.0f, 4.0f / 3.0f, 0.1f, 100.0f);

float horizontalAngle = 3.14f;
float verticalAngle =0.0f;/// problems here

glm::vec3 direction(
    cos(verticalAngle) * sin(horizontalAngle),
    sin(verticalAngle),
    cos(verticalAngle) * cos(horizontalAngle)
);

glm::vec3 position = glm::vec3( 0.0, 10.0, 32.0 );

glm::vec3 right = glm::vec3(
    sin(horizontalAngle - 3.14f/2.0 ),
    0,
    cos(horizontalAngle - 3.14f/2.0 )
);

// Up vector
glm::vec3 up = glm::cross( right, direction );

viewMatrix =  glm::lookAt(
                            position,           // Camera is here
                            position+direction, // and looks here : at the same position, plus "direction"
                            up                  // Head is up (set to 0,-1,0 to look upside-down)
                       );

See below screenshot with actual object in the world

when I click on red area - it does not pick up object, but when i am click on green one - it does.

SMALL DETAIL:
I've used this tutorial http://www.opengl-tutorial.org/miscellaneous/clicking-on-objects/picking-with-a-physics-library. While I've applying constant change to view and projection matrix throug my mouse move and keys - detection work perfect, but once I've stooping doing it - it does not work.

Can someone help me out what I am doing wrong ?

sentences:
unity rts on mobile : how can units find each other as simple as possible Situation:

I have a grid of 100 by 100 tiles.
each tile has a list of units that are currently standing ontop of it.
in this grid 500 units of team 1 and 500 units of team 2 are randomly walking around.
while they are walking around they place themselves in the unitlist of each tile they are on.

problem:
Each unit has to check lets say a square of 6 by 6 tiles around the tile he is on, to check
if there is an enemy nearby.

my solution.
each unit checks on top of what tile he is and only when it changes tiles it will check the 36 tiles around its current tile and check all their unitlist to check for nearby enemies...

Question.

isn't there a better way to do this? Because when I need my units to have a bigger line of sight of lets say 15tiles it needs to check 1000units * 15tiles *15tiles = a gazillion...
Does there exist a very inexpensive way of using somekind of a basic circle collider in unity without the need for rigid bodies etc...?

sentences:
Should an object in a 2D game render itself? I'm making a 2D street fighter-like game that is not tile based. Usually people recommend that entities be given to a renderer that render them, not them render themselves, but it seems the inverse is better,

Why is one better over the other?

Thanks

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:
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:
Movement appears to be frame rate dependent, despite use of Time.deltaTime I have the following code to calculate the translation required to move a game object in Unity, which is called in LateUpdate. From what I understand, my use of Time.deltaTime should make the final translation frame rate independent (please note CollisionDetection.Move() is just performing raycasts).

public IMovementModel Move(IMovementModel model) {
    this.model = model;

    targetSpeed = (model.HorizontalInput + model.VerticalInput) * model.Speed;

    model.CurrentSpeed = accelerateSpeed(model.CurrentSpeed, targetSpeed,
        model.Accel);

    if (model.IsJumping) {
        model.AmountToMove = new Vector3(model.AmountToMove.x,
            model.AmountToMove.y);
    } else if (CollisionDetection.OnGround) {
        model.AmountToMove = new Vector3(model.AmountToMove.x, 0);
    }

    model.FlipAnim = flipAnimation(targetSpeed);
    // If we're ignoring gravity, then just use the vertical input.
    // if it's 0, then we'll just float.
    gravity = model.IgnoreGravity ? model.VerticalInput : 40f;

    model.AmountToMove = new Vector3(model.CurrentSpeed, model.AmountToMove.y - gravity * Time.deltaTime);

    model.FinalTransform =
        CollisionDetection.Move(model.AmountToMove * Time.deltaTime,
            model.BoxCollider.gameObject, model.IgnorePlayerLayer);
    // Prevent the entity from moving too fast on the y-axis.
    model.FinalTransform = new Vector3(model.FinalTransform.x,
        Mathf.Clamp(model.FinalTransform.y, -1.0f, 1.0f),
        model.FinalTransform.z);

    return model;
}

private float accelerateSpeed(float currSpeed, float target, float accel) {
    if (currSpeed == target) {
        return currSpeed;
    }
    // Must currSpeed be increased or decreased to get closer to target
    float dir = Mathf.Sign(target - currSpeed);
    currSpeed += accel * Time.deltaTime * dir;
    // If currSpeed has now passed Target then return Target, otherwise return currSpeed
    return (dir == Mathf.Sign(target - currSpeed)) ? currSpeed : target;
}

private void OnMovementCalculated(IMovementModel model) {
    transform.Translate(model.FinalTransform);
}

If I lock the game's framerate to 60FPS, my objects move as expected. However, if I unlock it (Application.targetFrameRate = -1;), some objects will move at a much slower rate then I would expect when achieving ~200FPS on a 144hz monitor. This only seems to happen in a standalone build, and not within the Unity editor.

GIF of object movement within the editor, unlocked FPS

http://gfycat.com/SmugAnnualFugu

GIF of object movement within the standalone build, unlocked FPS

http://gfycat.com/OldAmpleJuliabutterfly

sentences:
What problems could occur if you make use of both the MonoGame API and the underlying graphics API? What kinds of problems could one run into if they were making a game with MonoGame and started making calls to the underlying graphics API as well?

For example, if I wanted to do something in a MonoGame project that MonoGame didn't necessarily support, or I just couldn't find the proper documentation / example for but I could find an example of how to do it in OpenTK, am I setting myself up for trouble if I implement it using OpenTK directly while using the MonoGame API everywhere else? Specifically I'm looking to find out if there are any big issues that are known that might result of this and not something obscure that will happen in very rare cases.

I tried doing a little research via Google and the GD.SE site itself and I couldn't find much. Maybe MonoGame has really covered most of its bases, but what if I manually wanted to work around one of it's outstanding issues or a feature that is not yet implemented?

If so what sort of problems might arise and are there any ways to help mitigate these issues?

sentences:
Potion effect never wears out I am writing a mod for Minecraft (in Java, duh) and want to apply a random potion effect like this:
    private static Effect[] poss_effects = new Effect[]{
        Effects.SPEED,
        Effects.SLOWNESS,
        Effects.HASTE,
        Effects.MINING_FATIGUE,
        Effects.STRENGTH,
        Effects.INSTANT_HEALTH,
        Effects.INSTANT_DAMAGE,
        Effects.JUMP_BOOST,
        Effects.NAUSEA,
        Effects.REGENERATION,
        Effects.RESISTANCE,
        Effects.FIRE_RESISTANCE,
        Effects.WATER_BREATHING,
        Effects.INVISIBILITY,
        Effects.BLINDNESS,
        Effects.NIGHT_VISION,
        Effects.HUNGER,
        Effects.WEAKNESS,
        Effects.POISON,
        Effects.WITHER,
        Effects.HEALTH_BOOST,
        Effects.ABSORPTION,
        Effects.SATURATION,
        Effects.GLOWING,
        Effects.LEVITATION,
        Effects.LUCK,
        Effects.UNLUCK,
        Effects.SLOW_FALLING,
        Effects.CONDUIT_POWER,
        Effects.DOLPHINS_GRACE,
        Effects.BAD_OMEN,
        Effects.HERO_OF_THE_VILLAGE
    };

    private long prev_milli = System.currentTimeMillis();

    @Override
    public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) {
        if (System.currentTimeMillis() - this.prev_milli >= 60000) {
            Effect to_apply = poss_effects[(int) (Math.random() * poss_effects.length)];
            int duration = (int) (Math.random() * 15 * 20);
            int amplifier = (int) (Math.random() * 2);
            playerIn.addPotionEffect(new EffectInstance(to_apply, duration, amplifier));
            this.prev_milli = System.currentTimeMillis();
        }
        return super.onItemRightClick(worldIn, playerIn, handIn);
    }

However, when the timer ticks down to zero on the potion effect, the effect stays there with the timer at 0:00. The first time I right-click it, I get two potion effects: one that works properly and only lasts for the given amount of time and one that has the problem described previously. All subsequent right-clicks produce the latter.
When I do this:
    @Override
    public boolean hitEntity(ItemStack stack, LivingEntity target, LivingEntity attacker) {
        target.addPotionEffect(new EffectInstance(Effects.WITHER, 60, 2));
        target.setHeadRotation((float) (Math.random() * 360), (int) (Math.random() * 180 - 90));

        return super.hitEntity(stack, target, attacker);
    }

the effect applies normally and runs out normally every time I hit an entity.
What's wrong?

sentences:
Terrain does not show up in distance in play mode, but does in editor I'm trying to make a big landscape with high mountains but the terrain doesn't show in the distance in play mode.
Which settings should I change, or what can I do?
My terrain is divided in many pieces - do I have to change all of these terrains or is there any other option?

sentences:
How can I convert a model's rigging from standard bones to a biped in 3DS Max? I've purchased a rigged 3D model from Turbosquid. Unfortunately the model has been rigged using standard bones instead of a biped.

Is the a way I can automatically converting the skinning from bones to biped?

sentences:
What's the difference between bloom and emission? In my engine, I've implemented bloom but I also want to implement emission because some models that I have come with an emission map. It sounded to me like something adjacent to bloom but I guess it's different since other engines differentiate the two like here:

Unity Emission: https://docs.unity3d.com/Manual/StandardShaderMaterialParameterEmission.html
Unity Bloom: https://docs.unity3d.com/Manual/PostProcessing-Bloom.html

and also because it seems like it's something that is done in the material shader and not in any post-processing.

What is the difference (i.e not a part of post-processing) and how could I go about writing emission into my standard material shader (I'm using a deferred rendering technique)?

UPDATE:

Alright, I've seen that emission is just something that you add on top of the fragment after you've sampled the emission map. How then, would someone get that light appear to be glowing off the surface like in Unreal and Unity and also seemingly lighting other surfaces? Is that then to do with global illumination (I currently have a baked G.I solution for static scenes)?

sentences: How do I measure a string that will be drawn with SpriteBatch? Is there a way to measure width and height of an ever-changing string (a player's score, specifically)?

sentences:
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:
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:
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:
Is Orthogonal in LWJGL 2D or 3D? I'm attempting to develop an orthogonal game with lwjgl 3 and OpenGL in Eclipse, but I can't find an answer for rendering objects in 2D or 3D. Are both applicable? And if so what are the advantages of either one?
I would also like to rotate my camera if that changes your answer.

sentences:
image editor to create texture atlas While I am slowly learning how to build an android game, I would like to build images for a game, especially texture atlas.

But the only image handling system I am familiar with is Photoshop. And I am not sure it is a good tool to organize images and to get coordinates for game dev.

Is there any good tool for this purpose? If photoshop is still good for this, any reference to show how to do it would be appreciated.

UPDATE: the second question was answered by this But still want to hear more options.

UPDATE2: In case you are using libgdx, I found it does the packing for 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:
Memory Leak in SharpDX one Thing I found out: Windows 7 produces a memory leak while using certain methods to access rendertargets. Why doesn't Windows 8 leak at this method?

public class Game : SharpDX.Toolkit.Game {
    GraphicsDeviceManager gdm;
    RenderTarget2D target;
    public Game() {
        gdm = new GraphicsDeviceManager(this);
    }
    protected override void LoadContent() {
        target = RenderTarget2D.New(GraphicsDevice, 1000, 1000, PixelFormat.R8G8B8A8.UNorm);
        base.LoadContent();
    }
    private Color GetColor(int x, int y) {
        using (Image image = target.GetDataAsImage()) {
            PixelBuffer buffer = image.PixelBuffer[0];
            Color color = buffer.GetPixel<Color>(x, y);
            buffer = null;
            return color;
        }
    }
    protected override void Update(GameTime gameTime) {
        GetColor(5, 5);
        base.Update(gameTime);
    }
}

The memory consumption with this on Windows 8 is around 25 MB, Windows 7 uses up full memory.
Any idea why Windows 8 handles memory/graphics in another way than Windows 7 (and how to fix it)?
For clarification if it was a memory leak:

The drop is caused by closing the application.

sentences:
Memory allocation patterns used in game development I have been researching creating my own allocator methods (that will support things such as a memory pool and profiling), however, as I continue my research I have been looking for how this was done in game development.

What memory allocation technique could I use, and why is it a good technique?

sentences:
Creating a curve path for gameObject which reacts to Triggers I am trying to create a path for a gameObject which will bounce off other gameObjects if it hits them. Can I get an idea on how I could possibly get this curve path set up.

Stuck on ideas. I don't want to use ITween and I can't simply define the entire path via ITween either. I need to account for whether it hit another gameObject and cause it to carry on the path or just fall through.

Attached the image below for clarification. I need the circle(purple) gameObject to bounce along the white path provided the rectangle(green) gameObject is in place to cause a Trigger and let the path carry on or the circle gameObject just simply falls through.

There is only 1 green gameObject at any point of time which moves to one of the 3 possible positions. Placed 2 just for clarification.

sentences:
What does distance divided by acceleration mean? I'm reading a book named "Programming Game AI by Example". Here's a method to help an autonomous character to slow down when it's getting closer and closer to its target:

Vector2D SteeringBehavior::Arrive(Vector2D TargetPos, Deceleration deceleration)
{
    Vector2D ToTarget = TargetPos - m_pVehicle->Pos();

    //calculate the distance to the target
    double dist = ToTarget.Length();

    if (dist > 0)
    {
        //because Deceleration is enumerated as an int, this value is required
        //to provide fine tweaking of the deceleration..
        const double DecelerationTweaker = 0.3;

        //calculate the speed required to reach the target given the desired
        //deceleration
        double speed =  dist / ((double)deceleration * DecelerationTweaker);

        //make sure the velocity does not exceed the max
        speed = min(speed, m_pVehicle->MaxSpeed());

        //from here proceed just like Seek except we don't need to normalize
        //the ToTarget vector because we have already gone to the trouble
        //of calculating its length: dist.
        Vector2D DesiredVelocity =  ToTarget * speed / dist;

        return (DesiredVelocity - m_pVehicle->Velocity());
    }

    return Vector2D(0,0);
}

For this line:

//calculate the speed required to reach the target given the desired
//deceleration
double speed =  dist / ((double)deceleration * DecelerationTweaker);

The Deceleration is an enum like this.

//Arrive makes use of these to determine how quickly a vehicle
//should decelerate to its target
  enum Deceleration{slow = 3, normal = 2, fast = 1};

I just don't understand how can it get a speed by dividing a distance by an acceleration (deceleration)? Did I misunderstand anything?

sentences:
How do I randomly generate a top-down 2D level with separate sections and is infinite? I've read many other questions/answers about random level generation but most of them deal with either randomly/proceduraly generating 2D levels viewed from the side or 3D levels. What I'm trying to achieve is sort of like you were looking straight down on a Minecraft map. There is no height, but the borders of each "biome" or "section" of the map are random and varied. I already have basic code that can generate a perfectly square level with the same tileset (randomly picking segments from the tileset image), but I've encountered a major issue for wanting the level to be infinite: Beyond a certain point, the tiles' positions become negative on one or both of the axis. The code I use to only draw tiles the player can see relies on taking the tiles position and converting it to the index number that represents it in the array. As you well know, arrays cannot have a negative index. Here is some of my code:

This generates the square (or rectangle) of tiles:

    //Scale is in tiles
    public void Generate(int sX, int sY)
    {
        scaleX = sX;
        scaleY = sY;

        for (int y = 0; y <= scaleY; y++)
        {
            tiles.Add(new List<Tile>());

            for (int x = 0; x <= scaleX; x++)
            {
                tiles[tiles.Count - 1].Add(tileset.randomTile(x * tileset.TileSize, y * tileset.TileSize));
            }
        }
    }

Before I changed the code after realizing an array index couldn't be negative my for loops looked something like this to center the map around (0, 0):

for (int y = -scaleY / 2; y <= scaleY / 2; y++)
for (int x = -scaleX / 2; x <= scaleX / 2; x++)

Here is the code that draws the tiles:

            int startX = (int)Math.Floor((player.Position.X - (graphics.Viewport.Width) - tileset.TileSize) / tileset.TileSize);
        int endX = (int)Math.Ceiling((player.Position.X + (graphics.Viewport.Width) + tileset.TileSize) / tileset.TileSize);
        int startY = (int)Math.Floor((player.Position.Y - (graphics.Viewport.Height) - tileset.TileSize) / tileset.TileSize);
        int endY = (int)Math.Ceiling((player.Position.Y + (graphics.Viewport.Height) + tileset.TileSize) / tileset.TileSize);

        for (int y = startY; y < endY; y++)
        {
            for (int x = startX; x < endX; x++)
            {
                if (x >= 0 && y >= 0 && x <= scaleX && y <= scaleY)
                    tiles[y][x].Draw(spriteBatch);
            }
        }

So to summarize what I'm asking: First, how do I randomly generate a top-down 2D map with different sections (not chunks per se, but areas with different tile sets) and second, how do I get past this negative array index issue?

sentences:
How do I create a closed beta on the App Store? After months of hard work, much to my surprise I'm about to unlock the "feature complete" and "production ready" achievements with the game I'm working on, so it's time to ask my colleagues and Facebook acquaintances if they'd like to help me by playtesting the game.

This is going to be my first game, and I'm wondering if I can somehow upload it as a "closed beta" to the App Store and generate a couple of keys/tokens, so I could hand these to my playtesters? This way they wouldn't have to install unsigned developer versions, so they'd also be testing the real installation process, and of course paying customers wouldn't even be seeing the product until I make it public.

Is this how a closed-beta testing goes at all?

sentences:
Libgdx draw a sprite in top of an isometric tile I have this isometric map and im using IsometricTiledMapRenderer to render the map I have a OrthographicCamera. I know where each tile is in the isometric map, but the isometric map is kinda rotated?

So I was wondering how to convert Map Coordinates to Isometric and viceversa?

Here I tried to draw a color cube in each tile coordinates....

Thanks in advance, I have been struggling with this for 2 days, and my lack english vocabulary isnt helping with the research, please some one point me to something

sentences: 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:
Why does Unity's Application.Quit() take so long? When a user clicks a button in my game, I call Unity's native Application.Quit() to close my game. The call is directly on the button press, with no coroutines or intermediate processes that sit between the press and the call.
In a standalone build of my game, after the button press, it takes around 2 seconds for the window to close. Ideally, I'd like the window to close near immediately, as it does in other Unity games I've played.
Why might Application.Quit() take so long to close the window, and how can I speed it up so that the window closes immediately?
For what it's worth, I am running Windows 10 on a Razer Blade 15 w/ 10th gen core i7. The game is a simple platformer w/ no networking or external integrations.

sentences:
Frustum culling issue at oblique angles I am using the following algorithm to test if my camera frustum contains an axis-aligned bounding box:
float plane_dot(XMVECTOR plane, XMVECTOR point)
{
    return XMVectorGetX(XMVector3Dot(plane, point)) + XMVectorGetW(plane);
}

bool is_box_visible(XMVECTOR planes[6], XMVECTOR center, XMVECTOR extents)
{
    for (size_t i = 0; i < 6; i++)
    {
        XMVECTOR plane = planes[i];
        float aabb_radius = fabs(XMVectorGetX(plane) * XMVectorGetX(extents))
                          + fabs(XMVectorGetY(plane) * XMVectorGetY(extents))
                          + fabs(XMVectorGetZ(plane) * XMVectorGetZ(extents));
        to_center = plane_dot(plane, center);
        if (to_center <= -aabb_radius)
            return false;
    }
    return true;
}

Usage code:
    XMMATRIX to_view = XMLoadFloat4x4(&debug_cam->m_view);
    XMVECTOR center = XMVectorSet(0.5f, 0.5f, 0.5f, 0.f);
    XMVECTOR extents = XMVectorSet(0.5f, 0.5f, 0.5f, 0.f);

    center = XMVector4Transform(center, to_view);
    extents = XMVector4Transform(extents, to_view);

    XMVECTOR vs_far_plane = XMVector4Transform(XMLoadFloat4(&debug_cam->m_far_plane), to_view);
    XMVECTOR vs_near_plane = XMVector4Transform(XMLoadFloat4(&debug_cam->m_near_plane), to_view);
    XMVECTOR vs_top_plane = XMVector4Transform(XMLoadFloat4(&debug_cam->m_top_plane), to_view);
    XMVECTOR vs_bottom_plane = XMVector4Transform(XMLoadFloat4(&debug_cam->m_bottom_plane), to_view);
    XMVECTOR vs_left_plane = XMVector4Transform(XMLoadFloat4(&debug_cam->m_left_plane), to_view);
    XMVECTOR vs_right_plane = XMVector4Transform(XMLoadFloat4(&debug_cam->m_right_plane), to_view);

    XMVECTOR planes[6] = {vs_left_plane, vs_right_plane, vs_bottom_plane, vs_top_plane, vs_far_plane, vs_near_plane};

    extents = XMVectorAbs(extents);
    center = XMVectorAbs(center);

    is_visible = is_box_visible(planes, center, extents);

It works correctly in most situations, as can be seen here (notice the is_visible checkbox is correctly checked):

But when looking from certain angles the function returns incorrect results:

Is this a limitation of this particular algorithm or is there a bug in my code?

sentences: Best way to do headshot decapitation? I'm using UE4 and blender. I was wondering what the process is of preparing in the 3D software and then making a head burst animation upon headshot. I don't want to do destructible meshes because they are sharp jagged fragments... I want it to literally burst and splash blood. How can I do this? Any support is appreciated.

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:
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:
Calculating the flavour of a dish in a cooking game I'm currently working on a game that sees players cook dishes and are scored on their performance. To determine whether a dish is good or not, I will be looking to see if these elements are balanced:

Salt
Fat
Acid

A dish is made up of multiple ingredients and each ingredient will have its own salt, fat and acid levels. Adding too much or too little of an element (e.g. over-salting) results in a weaker score for the player.
There are also a few other factors that affect the salt, fat and acid balance:

The number of ingredients (adding more ingredients should reduce saltiness, fattiness and acidity)
Acid can reduce the saltiness and fattiness of a dish.
Salt can reduce the acidity of a dish.

This idea comes from Samin Nosrat's book Salt, Fat, Acid Heat. Below is an image from her book where she breaks down 4 popular salads and shows how each of the ingredients affects each element. If the player was to recreate "The Caesar" salad, they should get a perfect score for balancing all those ingredients but if they created a salad with just bacon and anchovies it should be considered too salty.
Texture is another element that the player needs to balance but this won't need to be calculated in the same way as the other elements. My plan here is to check if the player is making a salad it should have some crunch to it, whereas if they are making a roast the meat should be tender.

Given a set of ingredients, I would like to calculate whether the dish is balanced or not. The game will probably have 100s of ingredients and I would like some advice on how to best calculate these elements, score the player and balance the many ingredient combinations a player can come up with.

sentences:
Simulate movement towards the screen in a 2D world I need to create the illusion of someone kicking a ball to the screen. For that, I have a initial position of the ball (about the middle of the screen), and I put the sprite of the ball scaled at 0.2 of his original size. Then, I generate a random position on the screen, and move the ball sprite to it, and at the same time, I increment the scale of the ball, until I reach 1, the real size.

At this point, the ball "hit" the screen. All this works great, but the scale of the ball is not coordinated with the movement of the ball, and, because of it, I must always wait until the scale reaches zero, after the ball is arrived to his destination, or, I must wait until the ball reach his destination, after the ball is already scaled to 1.

The question is, how must I calculate the resize factor of the ball, so it gets to 1 at the same time that the ball reach the desirable coordinates in the screen? The speed of the ball is a random number between a given range, and, of course, I'm using only 2D sprites.

sentences:
Platformer AI Jump Calculation Thank you for taking the time to read my question, I will try to keep it as concise as I can.

I am making a 2D-platformer game. I am in the process of programming AI that can intelligently traverse their terrain. AI are able to jump, in a fashion similar to many other 2D-platformers:

When the AI jumps, it is given a fixed initial Y-Velocity.
The AI has a flexible time where it may ignore gravity to give it a variable jump height/air time. (This mimics the way that the player is able to jump, where the player character may jump higher if the player holds down the jump-button longer.)
After this time expires, or the AI "releases the jump button", gravity begins to affect the jump arc. The acceleration rate of gravity is also constant.
The velocity on the X-axis is constant.

Question: How would an AI find the minimum amount of time that it will have to "hold down its jump button" to clear an expanse between a starting jump point, and a desired target?

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:
Unity, errors when using Quaternion.Euler to copy rotations In the game I'm creating I have a square that rotates around a parent point, I want the square to always aim upright however (think of a rotating platform). What I've done is simply use
child.transform.rotation = Quaternion.Euler(0.0f, 0.0f, -gameObject.transform.rotation.z)
This rotates the child object in the opposite direction so that they're always aiming in the right direction. Except it doesn't, there is some error that piles up with bigger rotations. For example at 90º the child object will be rotated -90.77 instead which is very noticeable given that the game has a grid of sorts and when objects are not aligned to it they instantly pop out.

So my question is, is there any way to avoid this error?

sentences:
Calculating approximations of contact between two meshes I'm looking for ways to calculate the degree of contact between two objects in a scene. I was thinking that calculating the hausdorff distance would be a useful approximation if it is then normalized somehow using the surface area/volume of the objects. Does anyone have any experience calculating this in Unity? Or have any suggestions for other ways to approximate this?

Edit: For some context, I'm working on a project which involves looking at the relationship between geometric properties and relations of objects, and what language/words people use to describe objects and I am using scenes in unity to test this. The notion of 'contact' appears to be an important one and it would be useful to be able to quantify the amount of contact between two objects in a scene

sentences:
Retrieve the original prefab from a game object How would one proceed to retrieve the original prefab used for instantiating an object?

In the editor these two functions work :

        Debug.Log(PrefabUtility.GetPrefabParent(gameObject));
        Debug.Log(PrefabUtility.GetPrefabObject(gameObject));

But I need something that works in the release version.

I have objects that can be transported between scenes ands I need to save their data and original prefab to be able to instantiate them outside of the scene they have been originally instantiated.

ie:

Game designers create new prefabs.
Game designers create objects from prefabs and place them in scenes (50 to 150 scenes).
Game is played and objects are moved across scenes.
Game is saved and infos about objects which have moved are saved in the save streams (files or network).

This is where I got stuck. Currently, to palliate to the shortcomings, we're saving the name of the prefab in the prefab. But each time a prefab is moved, renamed or duplicated the string must be changed too, sometimes the objects created from the prefab keep the original name (game designer might have edited the prefabPath field).

Maybe there is a better way to achieve proper save games without having to access to the original prefab/name. But currently we keep the saves segmented on a per level basis (easier and safer to save/load to files and transfer the save games to/from servers)

sentences:
Shader that draws just vertex points The game I am developing is in unity and I want to make a shader which can be put on a mesh that only 'draws' color on each vertex point. I am not proficient with shaders, and out of all my searching I have come up empty handed; I unfortunately don't even know how to look up this question (I seem to only find results about point clouds, which only serves to confuse and scare me more ;P).

Any help or if you can point me in the right direction on what to search, I would be very much greatful.

sentences:
What's the fastest way checking if two moving AABBs intersect? I have two AABBs that are moving, what's the fastest way to check if they will intersect under a frame?

By moving I mean not just to check with the usual rectangle intersection method, I mean some kind of simple easy swept test that only returns a boolean, no hit time or anything else.

What I think is to simply do it like this:

But that Hexagon is quite complex and I don't know how to calculate an AABB - Polygon intersection, is there maybe an easier way?

Any programming language that you like the most, I can easily port it.

Thanks.

sentences:
Getting the angle between two objects? I have a set of boxes which create a sort of path, they don't intersect very smoothy and to help that process I'm trying ot find a way to get an angle between them that can make it easier to generate another box between the intersection points.

Here's a pic of what I mean, the crudely drawn yellow arrows are basiclaly the angles I'm trying to find to put boxes there:

sentences:
Unity Android Immersive mode leaving a black bar in the soft key area? The black bar is not hiding anything. Everything is drawn above it. But the black bar is there in place of the soft keys even when they are hidden.
I don't know how to hide it and render using whole screen.
The bar is only visible with device having soft keys not for device with physical keys.
 I have set the Screen.fullScreen = true.

Unity 2018.3.4f1

sentences:
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:
How to implement jump in a 2d game? I am trying to implement jump in a game I have written for android using canvas.
I have referred this tutorial for implementing jump.
My code is like
if(jumpKeyPressed){
    jumpVel = -initialMomentum;
    state = "jumping";
}
if(state == "jumping"){
    jumpVel += gravity * deltaTime / 2;
    loc.y += jumpVel * deltaTime;
    jumpVel += gravity * deltaTime / 2;
}

Even after tweaking gravity and initialMomentum, character is jumping too slow (seems like stuck at ground). I have read many posts but I am not able to figure out what am I doing wrong here?
Edit: Video

sentences:
How to code a 4x shader/filter which emulates arcade crt display behavior? I want to write a shader/filer probably in adobe Pixel Bender that will do the best job possible in emulating the fill of an oldskul monochromatic arcade CRT screen. Much like this here:

http://filthypants.blogspot.com/2012/07/customizing-cgwgs-crt-pixel-shader.html

Here are some attributes I know will exist in this filter:

It will take in a low res image 160 x 120 and return a medium res image 640 x 480.
It will add scanlines
It will blur the color channels to create that color bleeding effect
It will distort the shape of the image from a perfect rectangle into a rounder shape.

The question is, could you please provide any other attributes that are beneficial to emulating an arcade CRT feel and links and resources on coding these effects.

Thanks

sentences:
Keeping object a fixed distance from the ground, buggy behavior I'm trying to make a script that will keep my object exactly 1 meter from the ground. So far I've got the following code :
    using UnityEngine;
    using System.Collections;

public class HoverScript : MonoBehaviour {

    public Transform target;
    public float hoverDistance;
    void Start ()
    {

    }

    void Update ()
    {

    }

    void FixedUpdate ()
    {
        if (Physics.Raycast(transform.position, Vector3.down, hoverDistance))
        {
            RaycastHit hitInfo;
            Physics.Raycast(transform.position, Vector3.down, out hitInfo, hoverDistance);
            float correction = hoverDistance-hitInfo.distance;
            //Debug.Log(correction);
            //Debug.Log(target.position);
            target.position = new Vector3(target.position.x, target.position.y+correction, target.position.z);
            //Debug.Log(target.position);

        }
    }
}

Basically, if the raycast hits, then it finds the distance of the hit. If it's .9 and the hoverDistance is 1, it would push the object up by .1, and keep checking every update. It seems like it would work, but I get this result : http://www.gfycat.com/IllfatedMediocreAquaticleech

In case the link goes down, basically the object falls like normal because of gravity until the distance is reached, then it slows down dramatically and slowly sinks into the ground.

The objects are set up like this

gameObject(has hover script, rigidbody, the camera following script)
 |
 ----> mesh(just a mesh, mesh renderer, and collider)

The target of the script is the parent gameObject.

Any ideas why this script isn't working?

sentences:
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:
How to optimize SpriteBatch usage? From what I understand, SpriteBatch's purpose is to batch as many draw operations to send to the GPU. Each batch can handle one texture at a time, and changing SpriteBatch context/texture is expensive, so when you need to draw many different textures in one frame you use a texture atlas, putting sprites that are most likely to be drawn by the same component in the same page.

So my questions are:

Assuming there are numerous components using the same texture page, how am I supposed to group them together and issue their drawing method?
What is an efficient way to deal with a component that uses sprites from two different texture pages? Should I handle two different drawing methods for each texture page? or perhaps take the context texture page as parameter and draw only what's relevant for it?
What about dynamically generated textures?
What if you don't know which texture pages a component needs? (For example, a custom visual equipment where you can't possible put all the equips in the same texture page since there might be thousands of em, and it's determined only at runtime)

I've seen many articles on how SpriteBatches work technically but nothing meaningfull on how to actually make the best use out of them. Would a good solution be to somehow queue my draw operations sorted by texture? If so, what would be a good generic way to implement it?

sentences:
database structure for rpg items I am currently developing a multiplayer html5 game, and the game has rpg elements (levels, items and such)

I just started working on the database side of things, and now I have a mongodb server setup with a basic user table (email, nickname, password hash and salt etc)

Now, each user should aquire items, and I am wondering should each user get his own collection in the db, or should there be a single collection that stores all the items, and has a email field that links the item to a user?

sentences:
How to securely retrieve game stats from clients in a p2p game network? I'm working on a P2P game and I know I should never trust the clients. I my architecture, there is a "Master Server" that stores game room (host) informations. Players can create their own rooms (hosting) and play with together.

There is another server that is "Info Server", it stores character informations like inventory, level etc. Now, I need to make a stats table with kills/deaths and I have to get these kill/death events from host player (host player >> [event] >> master server). But I think host player can send a lot of kill events because it is authoritative, so master server will process/handle all events from the host player.

How can I trust these events? Can't a server just send fake kill/death events?

sentences:
Automating the process of creating a steam lobby (for dota) and inviting users to it I'm working on a Ruby on Rails web-application and I want to create lobbies and send invitations to users to join these lobbies. Simply, I want to achieve ISteamMatchmaking Interface functionality of Steam SDK but the problem is that sdk in written in C/C++ and I would have to write wrapper to integrate sdk in my application.

My question is that is there some easy and less time consuming approach to achieve ISteamMatchmaking Interface functionality in web-application?

I'm using RoR but I'm open to use other technologies too.

sentences:
Recursive dungeon maps as represented by an elastic 2d array I came up with a method for recursively generating simple dungeon maps by starting with one room and recursively connecting new adjacent rooms randomly to it.

Maps are represented as two dimensional arrays where each cell contains a value of 0-15. 0 represents no room while each direction is represented by north=1, east=2, south=4, west=8.

I wanted to start with a single non room ([[0]]) and then expand the 2d array as necessary to fit the generated map. The difficulty I face with this tree like recursion is that if the arrays have to be unshifted to add rows and columns to the left and top of the map, I have to adjust the current position of the function, what row and column it is at. This makes it so that separate branches are not aware of array index adjustments from other branches, only their child functions will know because they have the adjusted position passed to them as their row and column arguments.

Is there a way to do this? I tried storing row and column offset values outside of the recursion, but it did not work for some reason.

sentences:
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:
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 interpolate server updates on the client for multiplayer? I am implementing client-side prediction and an authoritative server multiplayer architecture. I am following along with the series of articles from http://www.gabrielgambetta.com/entity-interpolation.html

I am at a point of confusion and have a few questions.

Within my client game loop I have a sequence of actions that update the local state.

applyLocalUpdates(state, loopTime)
reconcileLastRemoteUpdate(state, loopTime)

applyLocalUpdates

This updates all the entities positions based on their local physics and game logic simulation.
reconcileLastRemoteUpdate

I am in the process of implementing this and is the point of confusion. My initial naive attempt takes the last received server state and sets each local entities position to that last remote one.

This produces a choppy update effect. When each server update comes in the entities jump to match that last server position.

This is where I am trying to add interpolation...

I have interpolation methods like vec3.lerp(a,b,t) and quat.lerp(a,b,t) which I use to update the position vector and rotation quaternion.

My unknown points are:

Which values do I pass for a and b in the interpolation?

Is this the most recent local state and the last server state?
What value do I pass in for t in the interpolation?

This I'm highly confused. Is this the difference of elapsed time between the last 2 server states?

Is it the difference of elapsed time between the last local update and the last server update?

Additionally, should I swap the order of execution between applyLocalUpdates and reconcileLastRemoteUpdate ?

sentences: Working with floats in OpenGL ES 2 Are there any reasons or situations one would use in their shader float(1) over just 1.0 ?

sentences:
How should I set camera in Blender for example to render a sprite which can be used in an isometric map? I am trying to render some 3D model in blender and use them as a texture sprite in a game which uses Apple’s SpriteKit.
I have an isometric map with tiles size : 32 as width and 24 as height, Since I use same size tile whole over the map (isometric) I need to use an orthographic projection I think! please tell me if I am wrong but I was pretty sure! anyway...

I am using Blender to render my sprites (3D models) but I can not set the camera direction to have the rendered image really fit with the map.
The attached picture shows the problem, take a look at the building.

I have also attached the geometric math that I have used to create my render script in Blender.

I found out that if I use a 32,24 tile I need to look at from 29Deg 29Min 28Sec but it seems not alright as the iOS simulator shows!

Can anyone help me on this? How do I have to prepare my sprite to fit well on my isometric map?

Those who have experience with isometric map games are welcome to answer and I really appreciate it.

Here is the code I wrote in python to render the 3D Model, I have also set the camera to Orthographic manually.

import bpy
cam = bpy.data.objects["Camera"]
def look_at(cam, point):
    loc_camera = cam.matrix_world.to_translation()
    direction = point - loc_camera
    # point the cameras '-Z' and use its 'Y' as up
    rot_quat = direction.to_track_quat('-Z', 'Y')
    # assume we're using euler rotation
    cam.rotation_euler = rot_quat.to_euler()
meshObj = bpy.data.objects["plate"]
meshObj.rotation_mode = 'XYZ'
#meshObj.rotation_euler = (0,0,0)
d = meshObj.dimensions
# Finding maximum dim of the object
objectScale = 1
if d[1] >= d[2]:
    objectScale = d[1] / 16
elif d[2] >= d[1]:
    objectScale = d[2] / 16
cam.rotation_mode = 'XYZ'
cam.location = (20.416*objectScale,20.416*objectScale,20.416*objectScale)
#cam.rotation_euler = (0.7853,0.7853,0.5147)
cam.rotation_euler = (0.7853,0.7853,0)
look_at(cam, meshObj.matrix_world.to_translation())
alamp = bpy.data.objects["Lamp"]
alamp.location = (17.416*objectScale/4,17.416*objectScale/4,20*objectScale/4)
print("Scaling ",objectScale)
bpy.context.scene.render.filepath = "/Users/iman/Documents/Render/ISOBUILDING.png"
bpy.ops.render.render(write_still=True, use_viewport=True, scene="Camera”)

sentences:
Implementing Screen Shake I'm looking to implement screen shake in a 2D top down game.
From an earlier Q on this exchange, I learned that noise values could be a good candidate, so I intent to try that.

But I wonder: is a screen shake more about rotating the 2D topdown camera, or about jittering the position of that camera?

Or does it really require both?

Additionally, I would like to know if a good screenshake would require motion blur? Something like rendering your world in 4 small micro-steps for each 60fps frame, maybe? Or can you shake the camera at 60fps with normal rendering and it still looks good?

The quality I am after is something like shown in this video. It's kinda hard to judge, but it seems that video does translational jitter only?

sentences: Unity shaders: best way of handling data structures I'm working on a shader in Unity that uses a Binary Tree to store some precomputed values, this binary tree should be available to the shaders and would ideally also be constructed on the graphics card (each node in this tree is based on 1 pixel) is there a good way of doing this?

sentences:
Score vs. Kills in a casual game I am making a simple phone game and having a conceptual argument with my partner. The argument might end up being inconsequential, but I would like to hear some opinions from actual devs who are making games.

This will be a pretty standard beat-em-up style game where you beat up lots of easy enemies and build up a huge kill count. There will be many different types of enemies. The question emerged when we had to put up some display on the UI.

Should the kill count be represented as a 1:1 number? For example, on your HUD, it will constantly show:

Kills: 15

--or--

Defeated: 31

Or, should it be represented by a score? For example: 1 enemy = 100 points and it will display something like this:

Score: 1200

This may be a matter of taste in the end. But, for the casual games market, what do you think a mainstream audience will enjoy more? I think people love big numbers, in general, what do you guys think?

sentences: how to draw a dashed curved line to a point in as3? How can I draw a dashed curved line to a x,y point in as3? Basically I'm creating a game where you have a turret, and I want the arc the turret would fire a projectile along to be displayed as a dashed/dotted line along the arc to wherever the mouse x,y is. Ideally it would use the drawing API, rather than using any bitmap manipulation.

sentences:
Animator from another gameobject keeps disappearing from script on play I am working on a gun script and it worked fine until earlier today when I made a change to the script and it stopped working. I put it back, but for some reason now the animator object attached to the script keeps disappearing.

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

public class RifleShooting : MonoBehaviour
{
    private float NextTimeToFire = 0f;
    private int CurrentAmmo;
    private bool IsReloading = false;

    [Space(10)]
    [Header("Floats")]
    public float Damage = 10.0f;
    public float Range = 100.0f;
    public float ImpactForce = 60f;
    public float FireRate = 15f;
    public float ReloadTime = 1.0f;

    [Space(10)]
    [Header("Others")]
    [Space(5)]

    [Space(10)]
    [Header("Others")]
    [Space(5)]
    public int MaxAmmo = 10;
    public Camera FPSCamera;
    public Animator GunAnimations;
    public ParticleSystem MuzzleFlash;
    public GameObject impactEffect;
    public bool AllowedToShoot = true;
// Start is called before the first frame update
    void Start()
    {
        GunAnimations = GetComponent<Animator>();
        if (CurrentAmmo == -1)
            CurrentAmmo = MaxAmmo;
    }

    private void OnEnable()
    {
       IsReloading = false;
        GunAnimations.SetBool("Reloading", false);
    }
    // Update is called once per frame
    void Update()
    {
        if (IsReloading)
        return;

        if (CurrentAmmo <= 0)
        {
            StartCoroutine(Reload());
            return;
        }

        if (AllowedToShoot == false) return;
        {
            if (Input.GetButton("Fire1") || Input.GetButtonDown("Fire1") && Time.time >= NextTimeToFire)
            {
                NextTimeToFire = Time.time + 1f / FireRate;
                Shoot();
            }
        }
    }

    IEnumerator Reload()
    {
        IsReloading = true;
        Debug.Log("Reloading...");
        GunAnimations.SetBool("Reloading", true);
        GunAnimations.SetBool("IsShooting", false);
        yield return new WaitForSeconds(ReloadTime - .25f);
        GunAnimations.SetBool("Reloading", false);
        yield return new WaitForSeconds(.25f);
        GunAnimations.SetBool("IsShooting", true);
        CurrentAmmo = MaxAmmo;
        IsReloading = false;
    }

    void Shoot()
    {
        //shooting script here
    }
}

Also if it helps here is what I see in the console when I try to fire:

MissingComponentException: There is no 'Animator' attached to the "M4A1" game object, but a script is trying to access it.

sentences:
How do I counteract FXAA blur? FXAA is a cheap post processing anti-aliasing method which works great with deferred pipelines where traditional MSAA may not be a viable option. It's also easier to implement than alternatives such as SMAA.

Unfortunately, as a quick Google search will show, a lot of PC gamers hate it because even when setting the shader to its best quality settings it still adds a slight blur to the outputted image. This is particularly noticeable when a scene has textures with fine detail and/or small specular highlights.

Is there a way to counteract this blur without reintroducing significant aliasing?

sentences:
Changing Unity Rigidbody.centerOfMass throws off AddRelativeTorque() calculations This is an odd one, that has me kind of stumped. If I execute the code:

void FixedUpdate()
{
    rigidbody.AddRelativeTorque(0, 1000, 0);
}

I get this:

Normal, expected behavior. The (car in this case) rotates fine around Y. But if I try and change the center of mass,

void Start()
{
    rigidbody.centerOfMass = new Vector3(0, -0.2, 0.9);
}
void FixedUpdate()
{
    rigidbody.AddRelativeTorque(0, 1000, 0);
}

The car spins on all 3 axis. AddTorque has the same problem. It is as if AddRelativeTorque/AddTorque are not accounting for the moved position of the center-of-mass. This was done in an empty Scene with the car floating at 0x 0y 0z.

sentences:
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:
Gradle generated LibGDX project does not work in NetBeans I have to do rework of Worms (game) and I've chosen LibGDX. So, I've installed Gradle and generated a new project in LibGDX app - as they have in the documentation. But when I'm trying to load it as a project in NetBeans, it does not work. NetBeans sees it as a pure folder, not a project folder. I've also tried to manually create a project and paste there just the main that was generated and as expected, I've got errors with the imports (it does not know those imports).

What do I have to do? Thanks for any advices.

sentences:
Making a radial gradient visual range I am currently working on a project in p5JS.
So lets say i've got a texture and top of it, i've got a radial gradient that is overlapping on the texture. I want to make this like a cool vision range effect in 2D. I believe you can imagine this stitation.
So how am i able to start this thing?
Should i use another framework to do this?

sentences:
How To Get Current Selected Tiles and Neighbour I've 2D array that store each planes that instantiate using code.

Tile[][] map;

Then in Update()function, I try to Raycast and i can get the tile from RaycastHit game object.

How to get which Tile in my 2D array map is hovered base from RaycastHit without loop each tiles in array and check it ?

sentences:
Why do I get these errors in VS when I use OGRE_NEW? I am trying to get more experienced with Ogre 3D and I am following the basic tutorials on the website. All the code samples compile just fine.

The first time I encountered an "error" was in Basic Tutorial 3.

The code line where Visual Studio says something is not right is

mTerrainGroup = OGRE_NEW Ogre::TerrainGroup(mSceneMgr, Ogre::Terrain::ALIGN_X_Z, 513, 12000.0f);

Visual Studio compiles this line but it shows an ugly red line beneath it and on mouse hover it says

  #define OGRE_NEW new (__FILE__, __LINE__, __FUNCTION__) Error: no instance of overloaded 'operator new' matches the argument list" or if I mouse hover over Ogre::TerrainGlobalOptions() it says "Error: expected a type specifier

I searched on Google but couldn't find my answer. I got about a year C++ experience but that was mainly with the WinSock libary.

Thanks in advance.

sentences: How can I map regions on a world map image? I am trying to use a map of the real world, but I need to have a way to break it down by countries and regions.  Ideally down to a province level.  I figure that I'd need to be able to define polygonal regions on the image and export the points that represent the bounding polygon, so that I could check for clicks inside, and do other things with it.  I'm having a hard time finding a tool that will let me do this, that is, load in an arbitrary image and start defining polygons on it to be exported.  Or am I going about this the hard way?  Using XNA/Monogame currently if that matters in your answer.  Thanks

sentences:
what should the size of a flash game in Facebook be I'm developing a flash game and i want to put it in Facebook
,My question is the Proper maximum  size for it.
500 KB
1 MB ??

sentences:
Font loads with artifacts I've recently come on to an error when loading fonts in my game, some letters show up perfect while others have artifacts around them. Here's an example of this:

While some letters are perfectly normal, others are being unstable.

My options menu:

This is what my loader method looks like. (Yes i've tried other fonts)

private static int loadTexture(BufferedImage image) {
        int BYTES_PER_PIXEL = 4;
        int[] pixels = new int[image.getWidth() * image.getHeight()];
        image.getRGB(0, 0, image.getWidth(), image.getHeight(), pixels, 0, image.getWidth());

        ByteBuffer buffer = BufferUtils.createByteBuffer(image.getWidth() * image.getHeight() * BYTES_PER_PIXEL);

        for(int y = 0; y < image.getHeight(); y++){
            for(int x = 0; x < image.getWidth(); x++){
                int pixel = pixels[y * image.getWidth() + x];
                buffer.put((byte) ((pixel >> 16) & 0xFF));     // Red component
                buffer.put((byte) ((pixel >> 8) & 0xFF));      // Green component
                buffer.put((byte) (pixel & 0xFF));             // Blue component
                buffer.put((byte) ((pixel >> 24) & 0xFF));     // Alpha component. Only for RGBA
            }
        }
        buffer.flip();

        int textureID = glGenTextures();
        glBindTexture(GL_TEXTURE_2D, textureID);
        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_RGBA8, image.getWidth(), image.getHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
        return textureID;
    }

sentences:
Canvas slowly degrades in performance after a while I was creating a simple game and was shocked to see how the performance started to degrade. It never happened to me before, most probably because I use images and not the context drawings. So I used this function and the whole game becomes so slow, it just cannot be played after 30 seconds.

Office.prototype.draw = function(){
 for(var i = 0; i < this.tables.length; i++){
  for(var j = 0; j < this.tables[i].length; j++){
   Canvas2D.ctx.rect((373 * j) + 75, (370 * i) + 250, 170, 20);
   Canvas2D.ctx.fillStyle = 'green';
   Canvas2D.ctx.fillRect((373 * j) + 75, (370 * i) + 250,
    this.moneyBar[(i*4)+j], 20);

   // Draw the experience bar.
   Canvas2D.ctx.rect((373 * j) + 75, (370 * i) + 270, 170, 20);
   Canvas2D.ctx.fillStyle = 'yellow';
   Canvas2D.ctx.fillRect((373 * j) + 75, (370 * i) + 270,
    this.expBar[(i*4)+j], 20);

   // Draw the tables.
   Canvas2D.drawImage(sprites.items[0], new Vector2(
    (250 * j) + 50, (250 * i) + 200));
  }
 }
}

So as you can tell from the code, there is the multidimensional array table which has bars on top displaying moneyBar and expBar.
If I am to use Canvas2D.ctx.stroke() inside the for loop, the game performance drops right away. Outside of the loop, it keeps up a bit, then it degrades. If I don't use stroke at all, works better, but degrades anyway. So I am really confused as to why this degrades so fast. Also am using requestAnimationFrame and have used the same engine in previous games and performance never degraded.

If I was to remove fillStyle, keeps up 3-4 seconds more.
There are 8 tables in all, which means the for loops run 8 times per draw.

Vector2 function.

function Vector2(x, y) {
    this.x = typeof x !== 'undefined' ? x : 0;
    this.y = typeof y !== 'undefined' ? y : 0;
}

sentences:
How to design rating (leaderboard) I have a quiz online game. For each game there is a prize (number of scores). Now I have three ratings: top for the last day, top for the last week, total top (based on the sum of scores). Sum is not bad, but there is an issue: the more you play (even with bad results), the higher you are because more games leads to more points. I want to build a new rating, that takes in account not only sum of scores, but performance in games to. Just an average prize is not a good idea for me, because it means that winner of a single game will be higher, than a person who won 9 games and got not-maximum score in the last one.

Do you have any ideas/experience, what formulas could be used?

Thanks.

sentences:
How to show a canvas text when i click an UI button on Android I am trying to show a text when i click on a ui button but i don't know how to implement this. On PC platform I have a collider per object and when the player stay and click the E button, a canvas text appear on screen, but i don't know how to do this on Android. I want something like Resident Evil old style action button, opening doors and getting object description. How could i do this?

The Script

public class readingNote : MonoBehaviour {

    public AudioSource audio;
    public AudioClip collectSound;
    public  bool playerNextToKey = false;
    bool hasCollided = false;
    public GameObject pic;
    public GameObject text;
    public GameObject notePad;
    private Collider other;

//  void Start () {
//      pic.SetActive(false);
//      text.SetActive (false);
//
//  }

    public Button yourButton;

    void Start()
    {
        pic.SetActive(false);
        text.SetActive (false);
        Button btn = yourButton.GetComponent<Button>();
        btn.onClick.AddListener(TaskOnClick);
    }

    void TaskOnClick()
    {
      //can't text.SetActive(true); because when i get out the scene, text is showing up (I use the same button to open doors and get text description).
    }

    void OnTriggerStay ( Collider other) {

        if(other.gameObject.tag == "Player") {
            //if(Input.GetKeyDown(KeyCode.E)) {
                text.SetActive (true);
                pic.SetActive(true);

                AudioSource.PlayClipAtPoint(collectSound, transform.position);
            //}

        }
    }

    void  OnTriggerExit ( Collider other  )
    {
        if (other.gameObject.tag == "Player")
        {
            //enter = false;
            //print("close");
            playerNextToKey = false;
            hasCollided = false;
            pic.SetActive(false);
            text.SetActive (false);

        }
    }

}

sentences:
Using two shaders instead of one with IF statements I've been working on porting a relatively large opengl ES 1.1 source to ES 2.0.

In OpenGL ES 2.0 (which means, everything uses shaders), I want to draw a teapot three times.

The first one, with a uniform color (ala the old glColor4f).
The second one, with a per-vertex color (the teapot has its array of
vertex color as well)
The third one, with per-vertex texture
And maybe a fourth one, with both per-vertex texture and color. And
then maybe a 5th one, with normals as well..

There are two choices I have with implementation, as far as I know. The first is to make a shader that supports all of the above, with a uniform that is set to change the behavior (e.g use the singular color uniform, or the per-vertex color uniform).

The second choice is to create a different shader for each situation. With some custom shader preprocessing, it's not that complicated to do, but the concern is the performance cost in switching shaders between drawing objects. I've read that it's not trivially small.

I mean, the best way to go about this is to build both and measure, but it'd be good to hear any inputs.

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:
Is there a name for this technique to put the tiles on the corner of a level? A very common approach in development of old games is to put the tile set on the corner of a level, to use it as a reference. For example:

On this level, the developers put a set of tiles in the upper left corner.

But is there a name for this technique? I'm writing a manual about that and I would like to name it.

sentences:
How to make camera smooth when following player When my character moves through my cameras 'FollowPlayer' script, the background just looks really glitchy and bad Is there anyway to fix this?

This is my script:

using UnityEngine;
using System.Collections;
public class FollowPlayer : MonoBehaviour {
    Transform bar;

    void Start() {
        bar = GameObject.Find("PlayerMovingBar").transform;
    }

    void Update() {
        transform.position = new Vector3(
            bar.position.x, transform.position.y, transform.position.z);
    }
}

sentences:
LibGDX Shader that converts sprite to single colour with blurred edges I made a shader which turns all the colours of the texture to black but I also want it to be blurred at the edges where the opaque sprite turns transparent.
Original texture with desired output.

#ifdef GL_ES
    precision mediump float;
#endif

varying vec4 v_color;
varying vec2 v_texCoords;

uniform sampler2D u_texture;

void main() {
  vec4 c = v_color * texture2D(u_texture, v_texCoords);
  gl_FragColor = vec4(0,0,0, c.a);
}

A simple gaussian blur with good performance is what I want.
This shadertoy shader looks ideal: https://www.shadertoy.com/view/Xltfzj
I managed to convert the above mentioned shadertoy to GLSL which works fine, but I don't know how to make it first turn the texture black before blurring.
#ifdef GL_ES
    #define PRECISION mediump
    precision PRECISION float;
    precision PRECISION int;
#endif

varying vec4 v_color;
varying vec2 v_texCoords;

uniform sampler2D u_texture;
uniform vec2 resolution;

void main() {
    float Pi = 6.28318530718; // Pi*2

    // GAUSSIAN BLUR SETTINGS {{{
    float Directions = 16.0; // BLUR DIRECTIONS (Default 16.0 - More is better but slower)
    float Quality = 4.0; // BLUR QUALITY (Default 4.0 - More is better but slower)
    float Size = 8.0; // BLUR SIZE (Radius)
    // GAUSSIAN BLUR SETTINGS }}}

    vec2 Radius = Size / resolution.xy;

    // Normalized pixel coordinates (from 0 to 1)
    vec2 uv = v_texCoords;
    // Pixel colour
    vec4 Color = texture2D(u_texture, uv);

    // Blur calculations
    for( float d=0.0; d<Pi; d+=Pi/Directions) {
        for(float i=1.0/Quality; i<=1.0; i+=1.0/Quality) {
            Color += texture2D( u_texture, uv+vec2(cos(d),sin(d))*Radius*i);
        }
    }

    // Output to screen
    Color /= Quality * Directions - 15.0;
    gl_FragColor =  Color;
}

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:
Unity transform.position question Looking at example code for mesh deformation in unity

https://answers.unity.com/questions/746673/sine-wave-mesh-deform-with-different-directions.html

And i see theyve used

 public Transform Target1;
 public Transform Target2;

 void CalculateWaves ()
 {
     waves[0].Direction = Target1.position - transform.position;
     waves[1].Direction = Target2.position - transform.position;

And i dont understand the difference between Target1.position and transform.position without any reference to an instance.

Arent they the same thing. And how does transform.position function without a reference.

sentences:
How to get the Javascript equivalent of GameMaker's `hspeed` and `vspeed` given only `direction` and `speed`? I'm using a NodeJS server to control NPC movement in a multiplayer game, and when they get too close to the edge of the room I need to reverse either the horizontal or vertical components of their velocities (how to decide which, is a bridge I'll cross when I get there).

The problem is I already have their direction and speed, and am able to convert it to hspeed and vspeed, but not back again.

I need the inverse of this function:

function velocityToSpeeds(direction, speed) {
  return {
    x: -speed*Math.sin(Math.toRad(direction - 90)),
    y: -speed*Math.cos(Math.toRad(direction - 90))
  };
}

sentences:
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:
2d Rectangle Collision Resolution My Journey...

I've long struggled with rectangle to rectangle collision resolution. I've been making games for almost 10 years and still have yet to find a foolproof, reliable strategy.

When doing research on 2d, rectangle to rectangle collision resolution, I find myself digging through piles of collision detection, or other topics that have nothing to do with my search for truth (circle to rectangle, other detection methods...)  For me, detecting collision has never been the issue...

if player.x + player.width > box.x and
   player.x < box.x + box.width and
   player.y + player.height > box.y and
   player.y < box.y + box.height then
     // A collision has been detected...
     // But now I am lost.....

Assuming both the player and box objects are positioned at their upper left corner

The Rectangular Paradox...

For those brave enough, there is the path of chaos, torture, and unknown horrors available... The road known as "creating your own". I have chosen to walk this path many times, never to find the answers I'm looking for. I'm sure I share some quarrels of this road with fellow developers.

At first you might think it a simple task: "Once you know the rectangles are overlapping, how difficult can it really be to push one out of the other?" Oh boy, how I miss that sweet innocence...

Let us say, the player in the above example is falling down on top of the box, and we want it to stop and be pushed back to the top of the box. Easy, right? We can just do a simple check if the player is above the box, and if so, push him up to the top.

// We know the player is overlapping with the box..
if player.y < box.y then
  player.y = box.y - player.height

Done. Tested and proven to work. But, let's say now we want the player to stop at the left side of the box as well..

if player.x < box.x then
  player.x = box.x - player.width

Looks like it should work fine right? But no. Upon testing you move the player to collide with the left side of the box, and bam. Suddenly, he has immediately moved to the top of the box.

Why? The player can be both above the box, and to the left of the box at the same time. So one seems to end up always being favored over the others. To mitigate this I have written 3 nested if statements, 50 line chunks of code for each side of the rectangle, and wasted near weeks of my life..

Conclusion

Although I walk my journey alone - I know there are others, battling the same demonic mystery of rectangle to rectangle collision resolution. And also.. Those who have conquered it...

I'm hoping someone can help me understand their solidified, proven methods of resolution. To help me and any other developers reading this right now, become level 100 devs.

I made a codepen for anyone who is interested to use as a playground for showcasing resolution methods.

sentences:
.rrr subscript for float type I'm a little confused with this construction:

float sdcolor = MyColor.r; // MyColor has float4 type
float rcolor = sdcolor.rrr; // .ggg or .bbb isn't working

return float4(rcolor , rcolor , rcolor , 1);

Hence the question: how it's possible to subscript anything from a float type? What is the meaning of the .rrr subscript?

sentences: Should I consider a graduate degree in game development? I am sure you guys can definitely help. Some universities, like NCSU, USC, UCSC for their master's, offer courses based on gaming and game development (some call it MS in Computer Science with an emphasis on game development). I am very interested in this field and I want to give it a shot. But since a master's degree is very costly I have to factor in the future prospects as well. I want to know if this a proper course when a career is also taken into account. Any opinions or ideas? Anyone who has followed this career line?

sentences:
Rotate a Crosshair around a sprite - 2d worms style game?? (LibGDX) I'm currently learning to code 2d games in Libgdx. Right now I'm making a kind of worms clone. I am using Box2d and have just my main sprite and a flat ground object so far.

What im stuck on is making the crosshair for the main character which I would like to rotate around him at a distance of say 90px when the player presses UP or DOWN key.

Here is the code I have so far but I havent even been able to attempt the rotation code at all:

package com.supermegabrobro.apoca.Sprites;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.BodyDef;
import com.badlogic.gdx.physics.box2d.CircleShape;
import com.badlogic.gdx.physics.box2d.FixtureDef;
import com.supermegabrobro.apoca.Screens.PlayScreen;

    public class ArmyDude extends Sprite {
PlayScreen playScreen;
BodyDef bodyDef;
Body body;
FixtureDef fixtureDef;

boolean crossHairShowing = false;

Texture crossHairTexture;
float crossHairDistance = 30f;
float crossHairAngle = 45f;
Vector2 crossHairPosition;

public ArmyDude(PlayScreen playScreen){
    super(new Texture("armydude.png"));
    this.playScreen = playScreen;
    bodyDef = new BodyDef();
    bodyDef.type = BodyDef.BodyType.DynamicBody;
    bodyDef.position.set(0,0);   // TODO: Make this random

    body = playScreen.world.createBody(bodyDef);
    CircleShape circleShape = new CircleShape();
    circleShape.setRadius(getWidth() / 2);
    fixtureDef = new FixtureDef();
    fixtureDef.shape = circleShape;
    body.createFixture(fixtureDef);

    crossHairTexture = new Texture("crosshair.png");
    crossHairPosition = new Vector2(0,0);

}

public void update(float dt){
    setPosition(body.getPosition().x - getWidth() / 2, body.getPosition().y - getHeight() / 2);

    if(Gdx.input.isKeyPressed(Input.Keys.UP)){
        crossHairShowing = true;
    }
}

@Override
public void draw(Batch batch) {
    super.draw(batch);
    if (crossHairShowing){

    }
}
}

Any help is massively appreciated thanks.
(nb. I have read up on, and implemented in previous projects, normal rotation of sprites. But I beleive this is very different since I am trying to not rotate the actual sprite but instead draw a texture (of a crosshair) that rotates around this sprite.

I'm really stuck though my poor brain can't figure it out alone :(

sentences:
Making AI jump on a spot effectively How to calculate, in 3D environment, the closest point, from which an AI character can jump onto a platform?

Setup

I have an initial velocity V(Vx,Vy,VZ) and a spot where the character stands still at S(Sx,Sy,Sz). What I'm trying to achieve is a successful jump on a spot E(Ex,Ey,Ez) where you have clicked on(only lower or higher spot, because I've in place a simple steering behavior for even terrains). There are no obstacles around.

I've implemented a formula that can make him jump in a precise way on a spot but you need to declare an angle: the problem arise when the selected spot is straight above your head. It' pretty lame that the char hang there and can reach a thing that is 1cm above is head. I'll share the code I'm using:

    Vector3 dir = target - transform.position;  // get target direction
    float h = dir.y;  // get height difference
    dir.y = 0;  // retain only the horizontal direction
    float dist = dir.magnitude ;  // get horizontal distance
    float a = angle * Mathf.Deg2Rad;  // convert angle to radians
    dir.y = dist * Mathf.Tan(a);  // set dir to the elevation angle
    dist += h / Mathf.Tan(a);  // correct for small height differences
    // calculate the velocity magnitude
    float vel = Mathf.Sqrt(dist * Physics.gravity.magnitude / Mathf.Sin(2 *a));
    return vel * dir.normalized;

Ended up using the lowest angle (20 degree) and checking for collision on the trajectory. If found any increase the angle. Here some code (to improve the code maybe must stop the check at the highest point of the curve):

Vector3 BallisticVel(Vector3 target, float angle)
    {
        Vector3 dir = target - transform.position;  // get target direction
        float h = dir.y;  // get height difference
        dir.y = 0;  // retain only the horizontal direction
        float dist = dir.magnitude ;  // get horizontal distance
        float a = angle * Mathf.Deg2Rad;  // convert angle to radians
        dir.y = dist * Mathf.Tan(a);  // set dir to the elevation angle
        dist += h / Mathf.Tan(a);  // correct for small height differences
        // calculate the velocity magnitude
        float vel = Mathf.Sqrt(dist * Physics.gravity.magnitude / Mathf.Sin(2 * a));
        return vel * dir.normalized;
    }

    Vector3 TrajectoryPoint(Vector3 startingPosition, Vector3 startingVelocity, float n )
    {
         float t = 1/60 ; // seconds per time step
      Vector3 stepVelocity = t * startingVelocity; // m/s
      Vector3 stepGravity = t * t * Physics.gravity; // m/s/s

      return startingPosition + n * stepVelocity + 0.5f * (n*n+n) * stepGravity;
    }

    bool CheckTrajectory(Vector3 startingPosition,Vector3 target, float angle_jump)
    {
        Debug.Log("checking");
        if(angle_jump < 80f)
        {
            Debug.Log("if");

            Vector3 startingVelocity = BallisticVel(target, angle_jump);

            for (int i = 0; i < 180; i++)
            {
                //Debug.Log(i);
                Vector3 trajectoryPosition = TrajectoryPoint( startingPosition, startingVelocity, i );

                if(Physics.Raycast(trajectoryPosition,Vector3.forward,safeDistance))
                {
                    angle_jump += 10;
                    break; // restart loop with the new angle
                }
                else
                    continue;

            }

                return true;
                JumpVelocity = BallisticVel(target, angle_jump);
            }

        return false;
    }

sentences:
How to deal with corner collisions in 2D? I'm writing a top down 2d XNA game. Since its my first I'm trying to write the physics and collision stuff myself to learn it.

Whenever my player sprite character attempts to move into a position where its bounds intersect with the edge of a wall, I figure out a bounce angle (angle of incidence = angle of reflection) and I make the player bounce off the wall and avoid the collision.

I'm having trouble figuring out how to deal with the situation of my sprite intersecting with two wall edges simultaneously though e.g. it hits a corner.

My code currently tells me that two wall edges have been intersected but not which edge it would have hit first and therefore which edge to bounce off.

What is the mathematical test to pick which edge to bounce off? It's plain to see when looking at it but I'm struggling to figure out the math test for it.

sentences:
Move camera around player while facing player My player has the following hierarchy:

Hero (GameObject)
      Model (child of "Hero", centered at 0-0-0)
      Camera (child of "Hero")

The camera should be allowed to

- change its position around the Model in a circle ("rotate around the
  center")
- rotate so that it always faces the Model
- move up and down
- move nearer and further from / to the Model

I know how to do that using Quaternions, but as I'm doing this in a coroutine and using Lerp, I found myself in situations where the camera would get right through the model as this was the shortest path between the destination and the target vector.

I would now like to use pure angles (Sin and Cos), preferrably without LookAt.
Can somebody share how I would position and rotate the camera according to the angle, perhaps even taking a camera height variable into account as the camera should also be able to move up and down, still facing the player?

That would be the bomb!

sentences: How can I divide a grid map into clusters for path finding algorithm? I am trying to implement HPA algorithm for finding the shortest path between two point. I came across the paper Near Optimal Path Finding Algorithm (by Botea, Müller & Schaeffer) but I am stuck at the clustering part. I have a 2 dimensional array and each index in the array is a node. Could anyone help me clustering my 2 dimensional array into clusters?

sentences:
Issues with 3dsmax and Unity3d scale I changed the units in Blender so they are identical to Unity 3d. If I make a 1m^3 box in Blender, it will import into unity as exactly the same size as the standard cube.

With 3ds max, I changed the unit setup to metric and made sure it was centimeters in the system unit setup tab. However, when I import an obj file made in Blender and used in Unity, it is absolutely tiny. I have to convert the model to meters on import and then, when exporting, I have to set the model scale to .01 otherwise it is enormous in the unity scene.

I've tried changing the max units to meters and nothing changed.

How do you change the max unit/grid setup so one grid unit is 1m^2 and exactly equivalent to unity's grid?

sentences:
Do you know any 3D engines written in Objective-C for iOS? In the next few weeks I will start a game for iOS, most of the action will happen in 2D but a 2D engine is not enough for our idea, therefore I'm doing a small research on available 3D engines for iOS written in Objective-C (we already looked on some engines written in C++).

Do you know 3D engines written in Objective-C?

I found this one http://nineveh.gl/ but is not yet ready :(.

later edit (1).......
I did a research on the engines written in C++, they are nice and probably I will go with one of them, but if there is any good engine written in Objective-C, than I will go with it, because its a matter of taste and I like very much the obj-c language.

later edit (2).......
nice presentation/teaser about what I'm looking for http://www.slideshare.net/rsebbe/designing-an-objectivec-framework-about-3d

sentences:
Unity Physics Trouble with Platform Objects Hi Game Development Community!
I'm new to designing in unity, and I'm having some issues with my player game object traveling through platform game objects. Several of my game objects (pink in pictured) are successfully acting as a surface for the ball (purple). But others (cylinders in white) are not. The ball goes straight through them. Yet I'm not seeing a difference in the cylinder and cube's physics settings I've set. Any advice or solutions to this problem are much appreciated!

sentences:
How to version control game balance data stored in spreadsheets Is there any good workflow/tooling for having good version control on spreadsheets for game data? Ideally something that supports branching or merging.

Google spreadsheets allow people to edit data live so it makes "merging" easy, but it gets really hard to link the data that's live in a spreadsheet with the current version of the game in source control (ie. your git repo or other)

Conversely, with a local tool like Excel you at least have actual files that can be stored in the repo, but there doesn't seem to be good tooling for merging different versions of them.

With all that in mind, how can we ensure that a specific branch in a game repo can be linked to a specific version of the game data, and how can we allow people to work on different "branches" of game data in parallel while still keeping the ability to source control?

sentences:
Transform.Rotate is jumping around Why is the parent that contains 4 children jumping around and then settling into a position instead of rotating once by 90 deg? I can't seem to get it to rotate a single time as expected.
using UnityEngine;

public class rotateparent : MonoBehaviour
{
    public Vector3 rotationPoint;
    void Update()
    {
        if (Input.GetMouseButton(0))
        {
            transform.Rotate(new Vector3(0, 0, 1), 90);
        }
    }
}

Object jumping when mouse clicked

sentences:
Sliding loose dirt shader/material/effect Im sure there is some sort of technique with a name I don't know or didn't think to search, but how would I go about making an effect similar to loose dirt sliding down the face of a slope when something disturbs it? I guess I think of it as a mini avalanche or something.

I have attempted it a couple times with pretty poor results, but some of the properties i tried to replicate was: the sliding dirt spreads out the further it gets from its start position depending on the surface shape, angle of repose, rocks or larger pieces of debris causing even more dirt to slide(quasi-recursion?), loose dirt 'sliding' over other dirt, etc. I assume id need to combine the right ratio of shaders, particles and textures to look right but I cant seem to find any real info on this type of effect. Would something like this be too intensive to do real-time?

sentences:
Math needed to create a very simple 2D side view car game I'm trying to create a 2D side view car game (something like Hill Climb Racing, but much more simpler), but I'm confused on the math and physics.

Most of the tutorials I found were about making a top-down view game. The rest referred to the Unity3D engine, which does all the math behind the scenes and uses complex objects, whereas I'd like to achieve my goal using simple objects, such as 2D vectors and abstract them on my own (that is, without any game engine).

The project I'm working on assumes that a car is a rectangle with 2 wheels, which are ellipses. It doesn't need to brake, turn back and speed up, it should just go straight ahead (and eventually stop in case it looses all of its velocity).

An example terrain the car would be driving on:

I can't figure out how to move the car on an irregular terrain, as well as how to rotate and move it when it falls from a hillock, etc.

Have you any idea how to move and rotate the car with respect to its current position and velocity?

sentences:
OpenGL ES 2.0: Controlling Transparency in Fragment Shader The following is the OpenGL ES 2.0 simple GLSL Fragment Shader, I use to place textures on polygons, to render 2D sprites.

varying mediump vec2 TextureCoordOut;
uniform sampler2D Sampler;

void main()
{
gl_FragColor = texture2D(Sampler, TextureCoordOut);
//gl_FragColor = vec4(texture2D(Sampler, TextureCoordOut).xyz, TextureCoordOut.w * 0.5);

}

The fragment shader places voxels with alpha information taken from the source 2D texutre(.png image). Apart from alpha information, I need to control overall polygon/sprite transparency to achieve Fade In/Fade Out effects.

Could you show me, please, how to modify the above shader to control the overall transparency, besides the alpha information?

Note: The commented out line is used for my attempts to achieve the transparency. I wish to combine both the alpha information with the overall polygon/sprite transparency.

Thanks.

sentences:
Where to start with game development? I asked this earlier in this thread at stackoverflow.com. One of the early comments redirected me here to gamedev.stackexchange.com, so I'm reposting here.

Searching for related questions I found a number of very specific questions, but I'm afraid the specifics have proved fruitless for me and after 4 hours on Google I'm no closer than I started, so I felt reaching out to a community might be in order.

First, my goal: I've never made a game before, although I've muddled over the possibility several times. I decided to finally sit down and start learning how to code games, use game engines, etc. All so that one day (hopefully soon) I'll be able to make functional (albeit simple) games. I can start adding complexity later, for now I'd be glad to have a keyboard-controlled camera moving in a 3D world with no interaction beyond that.

My background: I've worked in SEVERAL programming languages ranging from PHP to C++ to Java to ASM. I'm not afraid of any challenges that come with learning the new syntax or limitations inherent in a new language. All of my past programming experience, however, has been strictly non-graphical and usually with little or extremely simple interaction during execution. I've created extensive and brilliant algorithms for solving logical and mathematical problems as well as graphing problems. However in every case input was either defined in a file, passed form an HTML form, or typed into the console. Real-time interaction with the user is something with which I have no experience.

My question: Where should I start in trying to make games? Better yet- where should I start in trying to create a keyboard-navigable 3D environment? In searching online I've found several resources linking to game engines, graphics engines, and physics engines. Here's a brief summary of my experiences with a few engines I tried:

Unreal SDK: The tutorial videos assume that you already have in-depth knowledge of 3D modeling, graphics engines, animations, etc. The "Getting Started" page offers no formal explanation of game development but jumps into how Unreal can streamline processes it assumes you're already familiar with. After downloading the SDK and launching it to see if the tools were as intuitive as they claimed, I was greeted with about 60 buttons and a blank void for my 3D modeling. Clicking on "add volume" (to attempt to add a basic cube) I was met with a menu of 30 options. Panicking, I closed the editor.

Crystal Space: The website seemed rather informative, explaining that Crystal Space was just for graphics and the companion software, CEL, provided entity logic for making games. A demo game was provided, which was built using "CELStart", their simple tool for people with no knowledge of game programming. I launched the game to see what I might look forward to creating. It froze several times, the menus were buggy, there were thousands of graphical glitches, enemies didn't respond to damage, and when I closed the game it locked up. Gave up on that engine.

IrrLicht: The tutorial assumes I have Visual Studio 6.0 (I have Visual Studio 2010). Following their instructions I was unable to properly import the library into Visual Studio and unable to call any of the functions that they kept using. Manually copying header files, class files, and DLLs into my project's folder - the project failed to properly compile.

Clearly I'm not off to a good start and I'm going in circles. Can someone point me in the right direction? Should I start by downloading a program like Blender and learning 3D modeling, or should I be learning how to use a graphics engine? Should I look for an all-inclusive game engine, or is it better to try and code my own game logic? If anyone has actually made their own games, I would prefer to hear how they got their start.

Also- taking classes at my school is not an option. Nothing is offered.

sentences:
Lazy way to figure out the two sides of a border? We have a 3d model. There is a simple path on that model's surface graph G of the form:
<v_0, v_1 ... v_n-1, v_n> where if v_i == v_j then i == j

Great! now the simple question appears:
How do you programmatically tell in the human sense if v_orange and v_green are on the same side of the trail and if v_green and v_blue are on the same side or not?
My intuition is that you Dijkstra the shortest path between them and if it goes through the trail an even number of times their on the same side. However that is not defined if you don't know what goes through the trail computes to. If thinking if it was 2d and we could project these trail edges on some flat surface this would be made trivial.
My current solution is a lie. Each edge is normally shared by two faces unless it's an orbifold which is currently not interesting to this question's input population set. Also, in our world, each face has percisely three vertices.

Use Dijkstra to find the shortest path between them. If the path does not touch the trail, their relation to the trail isn't well defined or their on the same side (for now it outputs they are on the same side).
Assuming the path does go through the path, we pick one of the edges it went through.
Each edge belongs to two faces, each of these faces has precisely one vertex that is not on the edge trail. we now have two vertices that are supposed to be on different sides of the trail.
Dijkstra from each of the trail side vertices to the vertices in question.
If the shorter path to both vertices in question is from the same side then maybe they are on the same side. If it each vertex prefers a different side then maybe they are not.

Here is one fault in this solution:

Sometimes the two are on the same side and the other route is shorter.

Clarification
This is a clarification inspired by wondra that felt nothing can be on the right side or the left side of a trail, something that in my opinion people would disagree with as we have a good sense of left & right.
Lets "split" the model where the trail is and add more faces between the two new trails (lips) and get something like this:
Trail 1 is Blue, trail 2 Red and some epsilon wide faces between them. Now we use Dijkstra to find the shortest distance from both trails (Blue and Red). Some vertices are closer to the Red, some to Blue. Very few are (the same), closest simply to the last or first vertex in the original trail that are conjoined between the trails.

sentences:
First person camera with Bullet Physics Before integrating the Bullet Physics, the camera worked fine. But instead of using my own simple struct for transform data, I use rigid body structs provided by the physics library now.

There are two issue with the first person camera at the moment. First, it is stuck in the ground and when I try to move it, it slips back to it's position. Second, When I get the camera out of the ground, which sometimes happens, The applied rotation isn't in the way I move the mouse. When I move the mouse straight, the camera is moved in circles.

This is how the rigid body it set up.

float mass = 1.0f;
btCollisionShape* shape = new btBoxShape(btVector3(0.5f, 0.5f, 0.5f));
btDefaultMotionState* state = new btDefaultMotionState(btTransform(btQuaternion(0, 0, 0, mass), btVector3(0, 0, 0)));
btVector3 inertia;
shape->calculateLocalInertia(mass, inertia);
Body = new btRigidBody(mass, state, shape, inertia);

This is how I get and set rotations and positions of rigid bodies.

vec3 Position()
{
    btVector3 pos = Body->getWorldTransform().getOrigin();
    return vec3(pos.getX(), pos.getY(), pos.getZ());
}
void Position(vec3 Position)
{
    btTransform transform = Body->getCenterOfMassTransform();
    transform.setOrigin(btVector3(Position.x, Position.y, Position.z));
    Body->setCenterOfMassTransform(transform);
}
vec3 Rotation()
{
    vec3 rot;
    Body->getWorldTransform().getBasis().getEulerZYX(rot.z, rot.y, rot.x);
    return rot;
}
void Rotation(vec3 Rotation)
{
    btTransform transform = Shape->getCenterOfMassTransform();
    transform.setRotation(btQuaternion(Rotation.y, Rotation.x, Rotation.z));
    Shape->setCenterOfMassTransform(transform);
}

And this is how I calculate the view matrix of the camera.

const float pi = glm::pi<float>();
if      (Rotation().x < -pi) Rotation(vec3(Rotation().x + pi*2, Rotation().y, Rotation().z));
else if (Rotation().x >  pi) Rotation(vec3(Rotation().x - pi*2, Rotation().y, Rotation().z));

const float margin = 0.2f;
if      (Rotation().y < -pi/2+margin) Rotation(vec3(Rotation().x, -pi/2+margin, Rotation().z));
else if (Rotation().y >  pi/2-margin) Rotation(vec3(Rotation().x,  pi/2-margin, Rotation().z));

vec3 lookat(
    sinf(Rotation().x) * cosf(Rotation().y),
                         sinf(Rotation().y),
    cosf(Rotation().x) * cosf(Rotation().y)
);

cam->View = lookAt(Position(), Position() + lookat, vec3(0, 1, 0));

How can I move and rotate a rigid body to use it as camera?

sentences:
Spot lights - making narrow/broad spot lights give more/less intense light When I use "normal" spot lights as presented in tutorials such as  this (with the exception that I use inverse square fall-off and then gamma correction), the spot light doesn't behave like a real spot light would, because in real life I would expect a narrow spot light to cast a brighter light than a broad one. In my primitive understanding this is because the light that would be cast outside of the spot lights casting angle is reflected on the inside of the spotlight device (e.g. flashlight) and effectively cast inside spotlights cone.

The spotlights usually presented in tutorials do not account for this, because the light calculation is still based on a spot light that distributes all of its energy evenly in a 360 degree radius, and the light that isn't visible is simply "clipped away", thus removing energy from the system.

My question is this:

I plan on accounting for this by just multiplying the outgoing color by a factor that depends on the casting angle of the spot light. The function of this factor is just

f(x) = 360/x;

This means that the color will be multiplied by 4 when the spot light casts its light in a 90 degree angle.
This function makes the assumption that the energy received by the lit area of a 180 degree spot light is twice as much as the energy received by the lit area of a 360 degree spot light.

Is this assumption correct? If not, how does the energy distribution change with the width of the spot light? Are there maybe other ways to account for this more effectively?

sentences:
How can I position a sprite in the same spot across different screen sizes? Taking into account the multitude of screen sizes and resolutions, is there a way I can position a sprite so it's at roughly the same spot on every iOS device?

Doesn't matter if you are using SpriteKit or Cocos2D or just using UIKit. The principle for positioning a sprite is roughly the same.

sentences:
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:
OpenGL draw functions and multi-threading. How they work together? I want to apply multi-thread in a simple way to control and draw 4000 objects.
I am using SDL and OpenGL.

control : locations, collisions, calculations ... etc

draw : OpenGL draw functions glDrawArrays,glDrawElements etc

For 4000 objects i think like this:

do you think it works ?

sentences:
How to bounce a 2d point particle off of a circular edge In a prototype I'm building, a particle can spawn anywhere within a larger, confining circle. Important to note is that the particle will not spawn in the origin of the larger circle, but anywhere within it.

This particle will essentially be given a random x and y velocity and set on it's way.

When the particle hits the edge of the confining circle, I want it to bounce back inwards appropriately.

Unfortunately I'm extremely new to vector math, and have never really directly dealt with it before.

Given that I'm treating the particle as a point, and I don't care about any loss of force or friction, what should I ultimately do to the particle's x and y velocities after the bounce?

I will know the particle's x and y velocity, it's x and y coordinate when it hits the outer circle, the radius of the outer circle, and the x and y coordinates of the origin of the outer circle (since its origin will likely not be 0,0).

My brief research on vector math tells me I need to find the normal velocity at the point where the particle hits the outer circle and then negate that, but unfortunately I'm not sure how to do that exactly.

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:
libGDX best way to do Game States I'm making a JRPG in libGDX, and I'm working with Screens. I have a main Screen called GameScreen, a screen for battles called BattleScreen and I want to make a screen for managing party members and items, as well as for shops. My question is, how can I draw one of those 3 screens without having to reload the whole game when going back to GameScreen.

GameScreen loads everything when Show() is called, so I'll have to save all information everytime I call another screen, so I can continue when I go back to GameScreen. This of course isn't good, and I'm looking for another way to draw a Screen over another one so that all vars wont be lost, or another solution.

sentences:
Any reason not to combine an AO Map and Cavity Map into one texture? If an Ambient Occlusion Map is for mapping shadows based on closeness of neighboring geometry, and a Cavity Map is for mapping smaller shadows based on angle or distance, then is there any reason not to mix these into one unified shadow map? It seems desirable to do so for saving a game from having to load extra textures, but I ask in case I'm overlooking something.

This article gives an overview of the differences between the two types of maps, but it never mentions combining them. This made me wonder if there was some reason to keep them as separate images.

Thanks in advance for any insight.

sentences:
Updating Json files in a Unity game - What am I doing wrong? I am working in Unity, on my first project. I am working on a turn-based RPG, and I am having a hard time figuring out my back end.

I'm currently using JSON files to store my data, which are then converted into objects and processed in C#. So far so good, but I have reached a road block when trying to save data back into a JSON file.

For example, lets say I have a character file such as: [{"name":"John", "CurrentHP": 100, "MaxHP": 100},{"name":"Paul", "CurrentHP": 200, "MaxHP": 200}]. After a combat, John loses 30 hp. How do I save this data back to that JSON file, so it reads as [{"name":"John", "CurrentHP": 70, "MaxHP": 100},{"name":"Paul", "CurrentHP": 200, "MaxHP": 200}]?

The tutorials I've watched all talk about serializing the object back into a JSON file, but this would involve deleting the whole file and creating a new one with the new information. This sounds like a very ineffective approach, especially for some large 'tables' in my game. There needs to be a way to update just one attribute from one of the IDs in a given JSON file.

How do I efficiently update individual JSON rows?

sentences:
Which Unreal Engine 4 project files can I ignore in source control? I want to put an Unreal Engine 4 project under source control with git. (I know the editor has Perforce and Subversion support, but I don't care for those.)

What folder and files do I include in the repository and which can I ignore?

The way I see it, the following is needed: Config, Content, Source, *.sln, *.uproject

Things that I can ignore: Binaries, DerivedDataCache, Intermediate, Saved, *.suo, *.sdf, *.opensdf

Is this correct?

sentences:
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:
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:
Unity3D, How do I press one key and then cant press another key while the one is pressed? I am making a horror game, and I want to press a key to look up while I am idle, that i've done but if I press the W key it stands in idle but floating forward. How can I disable the W key while I press the F key to look up ?
Everything works fine I can press F and the LookUp Animation is being played and if KeyUp on F the Animation goes back to Idle.
My problem is if I am in LookUp Animation when I press F, I can also press W to go forward but its floating not walking. I want to deactivate this function so I can just press F when I am Idle.

Thanks for help.

my Script:

public float speed = 10f;
public Rigidbody rgb;
public Animator anim;
bool walk = false;

// Use this for initialization
void Start ()
{
    rgb.GetComponent<Rigidbody> ();
    anim = GetComponent<Animator> ();
}

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

    float move = Input.GetAxis ("Vertical");
    anim.SetFloat ("Speed", move);

    if (Input.GetKey (KeyCode.W) | walk == true)
    {
        rgb.transform.position -= new Vector3(0, 0, 1) * speed * Time.deltaTime;
        Debug.Log("Walking");
    }
    else
    {
        walk = false;
        Debug.Log("Idle");
    }

    if (Input.GetKey (KeyCode.F))
    {
        anim.SetBool("LookUpIdle", true);
        rgb.transform.position = transform.position;
    }
    else
    {
        anim.SetBool("LookUpIdle", false);
    }

}

}

sentences:
How can I once run For Loop in void OnGUI? I want once run GUI on screen same Initialization a number.
I try say my think In easiest way then please payattention to this code:

using UnityEngine;
using System.Collections;

public class guimanager : MonoBehaviour {
    public bool Isdone;
     void OnGUI()
    {
            for (int j = 0; j <= 100; j+=20) {
            if (Isdone == true) {
                break;
            }

            GUI.Box(new Rect(j, j, Screen.width/2, Screen.height/2), "This is a test");
                print (j);
            }
        }
    }

I want keep my GUI.Box When end loop,So I need a boolean that when finish stop loop.

my problem Is frequent loop:

0,1,2,3,4,5,0,1,2,3,4,5,0,1,2,3,4,5,0,1,2,3,4,5,0,1,2,3,4,5,......

GUI.Box will Show

but When I want break my loop:

0,1,2,3,4,5

GUI.Box won't Show!!!!

Can I show my GUI.boxes In my loop when finished?

using UnityEngine;
using System.Collections;

public class guimanager : MonoBehaviour {
    public bool Isdone;
     void OnGUI()
    {
            for (int j = 0; j <= 100; j+=20) {
            if (Isdone == true) {
                break;
            }

            GUI.Box(new Rect(j, j, Screen.width/2, Screen.height/2), "This is a test");
                print (j);
            }
Isdone = true;
        }
    }

Why when I stop loop GUI.Box won't show!!!

sentences:
How to control which polygons get rendered first in a batch (e.g. to draw leaves)? Sorting transparent objects is a well-known problem. If you send a bunch of transparent polygons (e. g. leaves and branches on a tree) into the GPU and render them with alpha blending enabled, the GPU will sort the polygons randomly.

But what I noticed is that although they get sorted randomly, the order of rendering is always the same. If it wasn't the leaves would flicker as their colors change, depending on which layer they are on.

How can I control which polygons get rendered when? Maybe their order depends on the index buffer?

[EDIT] To clarify things: I know that different Draw() calls execute precisely in the order they were issued. I am trying to figure out how to manipulate the polygon order inside a single Draw() call. If a tree has a hundred polygons it is a waste do draw evey single one separately and a pain in the artists'... behind. So what I need is to influence the order of rendering for a bunch of polygons in a single pair vertex and index buffers.

Yes and I am working with XNA 4.0.

sentences:
What is an efficient way to deal with large, scrolling background images? In my mobile game you basically you just fly up (infinite height) and collect stars.

I have many quite large background images, scaled down so that their width is the same as the device width. Then they are appended after each other during rendering.

Since I implemented these backgrounds, my game runs poorly. I've got about 20 background images with a size of 800x480 each; without backgrounds the game is quite smooth.

Does anyone have an idea how to implement this many backgrounds without making the game slow down?

The images are used as a 2DTexture.
If I leave the clouds out of the image and "just" display the blue part, the app still slows down. Showing some code is a bit difficult, because I got many many classes which will do the loading, rendering and display stuff. Basically its done as Google does it in there "spriteMethodTest" example here:
http://code.google.com/p/apps-for-android/source/browse/trunk/SpriteMethodTest

2 of these image set.

First: http://picbox.im/view/b7c8c86abb-01.png

Second: http ://picbox.im/view/3a8162314a-02.png

sentences: (Java + Slick) How to rotate the Graphics (g) around the X-Axis? I already tried it by using GL11.glRotatef(45, 1, 0, 0), but the result looks like this:

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:
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:
Is it possible to use one if statement for each level scene? I'm working on a platform game where you as a player have to collect logs, to keep on all the fires in the level. Each campfire has a timer, which ensures that every x number of seconds the animation of the fire is changed to a numb fire. The timer of a campfire is blocked by the script, when the player has received the fire at 100%. When all fires are 100% you won, if not you lose.

Know I use the following if statement to check if the player has won or lose:

if (Application.loadedLevelName == "Level 0") {

        if (campfireAmount == allCampfireFull) {
            // Do something
            print ("level 1 complete");
            Application.LoadLevel (6);
        }

        if (campfireAmount == allCampfireEmpty) {
            // Do something
            print ("level 1 failed");
            //Application.LoadLevel ("GameOver");
        }

    }

What I searching for is how I can make this if statement useful for each level, whiteout use for each level scene above if statement. Beside that, what I want is that after each level you get a win scene (if possible a reusable scene) and after clicking in that scene on a button, you should go to the next level scene. Is there a way to load the next level, whiteout set a hard number of the rang list of "Build Settings"?

sentences:
2D motion synthesis for a human character I want to make the player controlled character of my two dimensional sidescroller responsive to environmental forces, while still being controllable.

I read about the commercial software product Euphoria, which is used to synthesize the motions of characters for example in GTA IV.

I realize that three dimensional motion synthesis is so complex that I will not be able to use it in my games. Luckily I am creating a two dimensional sidescroller. I assume that it is a lot easier to synthesize motion in two dimensions.

Actually I found a relevant scientific paper from 1994 about exactly this topic. After a quick flip it is a rather complicated and not a fully complete (ready to be ported to C#) concept. But is it outdated? What are common approaches to solving this problem in the 21st century? Do you know 2D games using a motion synthesis concept?

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:
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:
How to create a color grading LUT for Unity URP? I'm watching a movie, and I would like to achieve the same colors in my game.

I think I have to use a Color Grading lookup table to achieve this in Unity with URP.

The best example I found example deals with Photoshop, but it didn't include any information or description, it was just a raw screen capture which I didn't really understand.

How can I create a LUT?

sentences:
How can I create a Killing Floor map? I'm trying to create a Killing Floor map and i have the latest Unreal Engine but i dont know how to export my map to Killing Floor.
Where can i find the correct version of Unreal Editor ?
How can i export my map with current version ?

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

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

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

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

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

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

sentences:
Drawing hexagonal grid on Android I'm trying to draw a hexagon grid in my Android application. I don't want to reinvent the wheel here, so I'm looking for some frameworks/libraries or just some basic ideas about how should one do this. Do you have some ideas?

What I found so far:

Some math but not for Android
Nice, but not for Java

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:
Port forwarding client and server? So, lets say i have a client and server sending information to each other. Do i have to port forward both the server and the client, or do i just port forward the server? If i have to do both, is there any way of not needing to port forward? Im using SFML to be specific.

This isnt on local networks and its using UDP.

sentences:
How to make "Events"/ Scripted Scenes I want to make cutscenes etc, in my game.

I thought of a similar System like in the RPG Maker:

If you enter a certain Area, a list of commands and arguments is played.

E.g. like this:

[Move Object: Right, right, right; Wait until done;]
[play Sound: sound.sfx]
[Show Message: Speaker: player, message]

I don't want to use external libraries.
Someone has a basic idea on how to implement this?

I thought of a "stack" for these kind of "events", but I'm not sure about it.

sentences:
How to align edge vertices of modular props snapped on a 2D grid? For a project I am working on I create some 3D props in Blender that can be put together in a modular way on a 2D grid in Unity. In Unity I generate the grid contents using these props. Now given these two simple shapes (imagine a pipe or railing in top view):

If they are put next to eachother on the grid like so (left):

I want to make a smooth transition between the two so that their edge vertices align nicely (snap together, see right image above). Note that the angle between the shapes is always the same. However there are variations like straight, left, right for each intersection and also numerous shapes.

How can I achieve this?

I have thought of the following possibilities:

Just model each possible variation in blender and use the matching prop when generating the grid (I hope I can avoid this since its a lot of effort, also it's not reusable)
Rig the shapes in Blender. In Unity move the bone transforms accordingly so that they align (I like this idea, but is it practical?)
(Somehow) mark the vertices on the edge of the shapes and move them to where they belong i.e. modify the mesh in Unity.

Are there other/better ways to achieve this? I appreciate any hints and tips.
I also know I am not the first one to try this so any guidance on where to look for resources and what terms to search for is also appreciated.

sentences:
How 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:
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: 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:
Move around the object using head tracking movement in Unity I am developing an app for Samsung Gear VR with unity.I have added a cube and made the cube move forward on the terrain.

Now I need to move around the cube using head tracking movement.I have referred the below link(Flyer VR movement) .But I am not able to understand the code used in it.

https://unity3d.com/learn/tutorials/topics/virtual-reality/movement-vr

Can anybody help me doing this in a simple way to move around the cube by head tracking

sentences:
Mesh fading to transparent I have a 2D Mesh object generated at runtime painted all with uniform color.
I want that mesh to have its color fade to transparent color close to the edges.

Despite I searched everywhere I could not find any solution. Unfortunately I'm not into Shader programming enough to build logically my solution.

EDIT:According to @wondra's reply my mesh is not fan shaped. It has a non regular hole in it.

How can I achieve this?

sentences: How to activate Xbox controller vibrations in Unity? Is there any way to toggle the XBOX controller vibrations in Unity ? I came across Handheld.Vibrate() but it seems like it's not meant for controllers.

sentences:
What are the possible techniques to optimize the lighting pass in a deferred shading renderer? I am toying around with "modern" OpenGL (this is my first attempt, I am new to this) and I have been developping my own deferred shading renderer as an exercise.

I am using an FBO with the following attachments:

DS : Depth/Stencil (GL_DEPTH32F_STENCIL8)
RT0: Position (GL_RGB16F)
RT1: Normal (GL_RGB16F)
RT2: Albedo (GL_RGB16F)
RT3: Postprocessing buffer 0
RT4: Postprocessing buffer 1

Depth + RT0, 1, 2 are filled first in one single geometry pass.

Then for each light source (point lights only for now, spheres are used as light volumes):

Stencil pass to limit light calculation to where it actually has an effect
Light pass: light contribution is accumulated in RT3

From this point on, I am only rendering a quad the size of the screen and fragment shaders are used to compute the next image.

Albedo (RT2) and Light (RT3) are blended into RT4: I now have my lit image.

I can enable more postprocessng shaders (FXAA, Depth of field, ...), in which case RT3 and RT4 are used for ping-ponging.

The thing is, even with no postprocessing, not that many lights (around 10) and a very simple scene (roughly 5k vertices), my frame rate drops like significantly as soon as I increase resolution or add more lights.

It looks like my light pass is responsible for most of this but how can I track down what exactly is slowing everything down? Are there any tricks to optimize it? Is there anything I am missing?

Thanks!

Light Fragment Shader for reference:

uniform sampler2D position;
uniform sampler2D normal;
uniform float screenw;
uniform float screenh;

uniform vec3 light_pos;
uniform vec3 camera_pos;
uniform vec4 diffuse;
uniform vec4 ambient;
uniform vec4 specular;
uniform float outer_radius;
uniform float inner_radius;

float specular_hardness = 100.0;

vec4 calc_point_light(vec3 p, vec3 n)
{
    vec3 light_dir = light_pos - p;
    float d_to_light = length(light_dir);

    light_dir = normalize(light_dir);

    vec3 eye_dir = normalize(camera_pos - p);
    vec3 half_vec = normalize(light_dir + eye_dir);

    float attenuation = (outer_radius - d_to_light) / (outer_radius - inner_radius);
    attenuation = max(min(attenuation, 1.0), 0.0);

    vec3 c = ambient.rgb * ambient.a;
    c += diffuse.rgb * max(dot(n, light_dir), 0.0) * diffuse.a;
    c += specular.rgb * pow(max(dot(n, half_vec), 0), specular_hardness) *
        specular.a;

    return vec4(clamp(c, 0.0, 1.0) * attenuation, 1.0);
}

void main(void)
{
    vec2 texcoord = gl_FragCoord.xy / vec2(screenw, screenh);
    vec3 p = texture2D(position, texcoord).xyz;
    vec3 n = texture2D(normal, texcoord).xyz;

    gl_FragColor = calc_point_light(p, n);
}

sentences:
Why is there such a problem to create realistic eyes in games? I mean, even the latest demo from ps4 possibilities or any demo, you can see that the person is not real if there are eyes involved. E.g. if you only see the skin, you may be mistaken, but not if you see the eyes.

Why is it so difficult to achieve believable eyes in game development?

sentences:
rotating an array of images in 90 degree-java In my java game,I have a stickSprite in vertical position.I want to rotate this stick in 90 degrees.so that it can hit the floor,once I press a key.
I used a an array of stick sprites to create a large stick.Why I am doing this because I want to increase the stick length differently at different times.

I am using this method to rotate the stick image:

public Image rotateImage(Image src, float angle) {

    int sw = src.getWidth();
    int sh = src.getHeight();
    int[] srcData = new int[sw * sh];

    src.getRGB(srcData, 0, sw, 0, 0, sw, sh);
    int[] dstData = new int[sw * sh];

    double rads = angle * Math.PI / 180.f;
    float sa = (float) Math.sin(rads);
    float ca = (float) Math.cos(rads);
    int isa = (int) (256 * sa);
    int ica = (int) (256 * ca);

    int my = -(sh >> 1);
    for (int i = 0; i < sh; i++) {
        int wpos = i * sw;

        int xacc = my * isa - (sw >> 1) * ica + ((sw >> 1) << 8);
        int yacc = my * ica + (sw >> 1) * isa + ((sh >> 1) << 8);

        for (int j = 0; j < sw; j++) {
            int srcx = (xacc >> 8);
            int srcy = (yacc >> 8);

            if (srcx < 0)
                srcx = 0;
            if (srcy < 0)
                srcy = 0;
            if (srcx > sw - 1)
                srcx = sw - 1;
            if (srcy > sh - 1)
                srcy = sh - 1;

            dstData[wpos++] = srcData[srcx + srcy * sw];

            xacc += ica;
            yacc -= isa;
        }
        my++;
    }

    return Image.createRGBImage(dstData, sw, sh, true);
}

and rotating the single stick(that is not an element of the array.Stick array elements are placed above this base stick.)like this.It worked well.

private void RotateBaseStick() {

    if (smashBool &&angleValue<90) {
        angleValue = angleValue + stickMovingSpeed;
        rotatedImage = rotateImage(stickImage, angleValue);
        stickSprite.setImage(rotatedImage, rotatedImage.getWidth(),
                rotatedImage.getHeight());

    }
    if (angleValue >= 90) {
        smashBool = false;
    }

    }

I am wondering how can I rotate the entire stickArray efficiently to make the feel of a long single stick hitting the ground?
Please help me.

sentences:
Can a sprite be rendered with thickness in Unreal Engine? Is there a convenient way to have a 2D pixel art image with clip transparency (not partial transparency) rendered with thickness in Unreal Engine? Paper2D does exactly what I want, except it's a flat plane.

I'm able to achieve the effect by making an SVG outline and using Blender to make a model and map UVs, then import that into Unreal, but it seems like a lot of steps for a somewhat simple model. I am new to both of these tools and models in general, so I may be missing something obvious.

sentences:
Portal 2 Authoring Tools: func_instance_io_proxy not working? I have a func_instance (which I made myself) of a door in my map. It is supposed to open when a cube is fizzled. I also put a checkmark indicator to make sure I had the cube's logic correct. When the cube is fizzled, the checkmark indicator lights up, but the door does not open. To make sure the door was working, I put a logic_auto into the prefab which opened the door when the map loaded. This worked correctly. I therefore think that there is something wrong with the func_instance_io_proxy, but I do not know what. Here are some screenshots:

The cube targets the openDoor relay's trigger input via the func_instance_io_proxy. It also targets the checkmark indicator, which properly lights up when the cube is fizzled.

My door func_instance. The relay on the left opens the door, and the one on the right closes it.

The logic_auto targets the closeDoor relay on startup, which does execute properly, as the door is closed when I go to test the map.

Finally, the func_instance_io_proxy targets the openDoor's trigger input. However, when I try and access it via the cube, it does not work, and the door does not open.

*By the way, I am running this on linux via wine, which is why it looks like windows 98

**Off-topic question, is this the right place to post this, since it is technically map making, not game development?

sentences:
Is triangle count so much cheaper on hard surface models that on animated meshes? I have a human character that consists of 40k triangles.
When I animated him, I noticed a huge impact on the frame rate.

Then I created a 10k tris version of the same model and animated him, and the frame rate was significantly higher.

I would like to ask if there is any formula or any other way to compare this situation with a high-poly model of a hard surface model against a low poly version of a hard surface model.

For example, I see some 3D model vendors that offer weapons for FPS games, and they call their weapons with 25k tris "lo poly".

Am I missing something here?

Is it really so cheap (for some reason that I haven't found out) to throw 25k of hard surface geometry to CPU or GPU, and it wouldn't make a noticable difference in comparision to a 3k tris hard surface model?

I'm working with Unity and HDRP, if that is important for an estimation.

Thank you.

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:
XNA 2D Rotated Rectangle Collision Response I am using Rotated Rectangles which collide using the Separating Axis Theorem and they work perfectly fine for collision detection using Intersects and Contains.

However, I am starting to use faster objects in my game now and there is the issue of the two object overlapping during collision due to their higher velocities. I would like to do a collision response where I find out how much they are overlapping in the X and Y and put position them outside of each other.

I would like to use something like this: http://go.colorize.net/xna/2d_collision_response_xna/index.html.

But I am having some issues trying to adapt this to handle the rotation of the bounds.

Is this possible? Are there any resources out there that I can look at?

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: Bring GameObject in front of GUI Texture I have a GUI Texture that dims the screen, however I want certain game objects to not be dimmed. I tried putting them in front of the GUI Texture, but it doesn't work. How can I do this?

sentences:
What interchange format should I use for e.g. subtitles and UI texts? Are there any standard formats that can be used as the source material for game texts (i.e. subtitles, UI texts, etc.)? I can think of the following constraints:

at least some style effects (e.g. bold, italics)
at least some format string support (e.g. you found %d gold, you found {count} gold)
be translator-friendly: either easy to grasp, or standard enough that translation companies may already have experience with it

I know about the following but none of them appear to support format strings. Are there any industry standards for that or does every game or engine roll their own format?

UE4 uses a custom rich text format (example: Hello <RichText.Emphasis>everyone</>!)
Unity uses its own HTML-like format (example: Hello everyone!)
the srt format uses HTML-like syntax, too (example: Hello everyone!)
BBCode is another popular format (example: Hello [b]everyone[/b]!)

sentences:
map the section of a procedurally generated surface on a plane I'll try to be as clearer as I can.

I have a surface on a 3D space which is not flat, it has hills and depths.

My goal would be intersect it with a plane so that I can map the section of the surface on it.

this is just an example with a tetrahedron, my surface is more complex:

My surface has just a set of vertexes so I was thinking that the solution would be theorically to map the intersection points of line segments bounding each vertex just above the plane with its corresponding one just below.
Then I could connect the points on the plane like if I was drawing triangles on a flat surface.

My concern is also on what structures can I use to achieve this result?
Does XNA give anything that could be of help? I saw the Plane structure and its explaination was quite clear. So next step would be to find the point belonging to a line segment laying on the plane, but sincerly I have no idea on how to proceed.

More than that, I also would like to be able to compute areas of "solid ground" mapped on the plane. But better to face one problem at time.

Hoping I made myself clar, I look forward to any suggestion

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:
How is console game development done? I'm curious what the process is for development for a game console such as Wii, Playstation, or Xbox. Do I need to use some game engine and compile for each platform?

What IDE is used? Any C++ IDE? Are all console games built in C++?

sentences:
How to set a specific face's texture color in Unity? First off, let me describe my situation...
So I'm building a voxel engine based on this tutorial. I'm using my own texture tilesheet. Most of the tiles have their own color except grass, leaves, and a few others. These specific ones are meant to be colored based on the temperature and humidity of the location.

AlexStv (the author of the tutorial linked above) said the mesh colors array could be set, but I tried that and nothing happened. I probably did it wrong though, not sure. But he also said "you may need a shader that render vertex colors, not sure if the standard shader does that anymore" so that could also be the issue.

So... Do I need a custom shader? If not how do set the face's colors?

EDIT, Note: I just tried a custom shader called UnityVC, it still didn't work so I guess I must be doing the color thing he suggested wrong.

sentences:
How could I expose the engine API for text-adventure games? While developing an engine for text-adventures I'm still unsure how to expose the API it provides to the developers/writers. My two concepts for now are:

Running a small JS engine which executes JS script files (in comparison to a full DSL) where devs/writers can access a well-defined subset of functions and classes.
Parsing XML files which define levels, objects, entities, ... so that no real programming knowledge is necessary if the devs/writers stick to the conventions concerning the structure of these files.

Which of these approaches (or even other ones I haven't thought about yet) is more likely to be recommended?

sentences:
IDE & Debugging of Official SDK for wii and ps3? I remember hearing that wii and the ds uses CodeWarrior as their IDE. I know xbox uses visual studios but i have no idea what ps3 uses.

What IDE do ps3 developers use and how do they debug? How do wii programmers debug? I always heard they use GDB but is that built into CodeWarrior or is that a separate application?

sentences:
AABB of rotated sprite? Say I have a sprite. Its AABB is easy to find since I know the width and height. Say I rotate it 45 degrees, I don't think the AABB would be big enough to cover it, so I need a new AABB. How can I calculate the bounding rectangle of a rotated rectangle (given a center point, an angle, and its width and height)?

Note that OpenGL does the rotation so I do not have access to the vertex information.

What I'm trying to do is get AABBs so I can do 2D culling for rendering.

Thanks

sentences: 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:
Why is everything lit by default? I am following the unity tutorial here and when i drag my environment into the Hierarchy everything i already lit up on my Game view, i noticed this was also the case in the Space Shooter tutorial that i followed before this but i ignored it. Does Unity5 automatically light up things for you if you don't have any lights? I tried setting the ambient Intensity to zero but it literally changes nothing. When i drag in the lighting prefab it also doesn't seem to do much because the scene was already lit up somewhat.

It is still dark but it isn't pitch black like it should be in the Game view.

sentences:
Scale DIV with tiles I am trying to create a repeating background. I have a main DIV with a grid of small 16x16 DIVs. I am trying to scale the main DIV in CSS; when the small DIVs simply have a red background color everything works great, but when there is a background image in the small DIVs then borders become visible between the tiles.

This image explains the problem:
http://cl.ly/FpNW/o

Check the HTML in these examples:

With BG-COLOR: http://jsfiddle.net/pTLXw/

With BG-IMG: http://jsfiddle.net/vkpuY/

Does anyone know what is causing this problem and how to fix it? If it is not possible to fix while using DIV, is there another way to do this?

Thanks you so much!

sentences:
How 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:
Calculating stopping distance while turning I need to calculate the movement of an object that is slowing down to approach its destination while turning. Calculating the linear stopping distance and deceleration is straightforward. However if the object is not pointing at the destination, and has a limited rotation speed, makes this more complicated. For example imagine it starts pointing 90 degrees off the target: its rotation will increase the distance to the target.

The turning circle increases the distance to the target, but decelerating makes the subsequent turning circle tighter, and I'm not sure how to take in to account both factors.

Basically I have the following information:

starting position, angle, and speed
target position
deceleration
rotation speed

and I need to calculate the distance (or time) to the target. What is the calculation for that?

I can also see that if the starting speed is too high, it may not be solvable - in which case it would be useful to also calculate the maximum possible speed.

sentences:
(LibGDX/JAVA) How can I get a rectangle to rotate with this pendulum so I can start detecting collisions? One of the objects in my game is a pendulum that swings in a semi-circle. This is done by having an update() method like this:

public void update() {
    angleAcceleration = +1.81 / length * Math.sin(angle);
    angleVelocity -= angleAcceleration * 0.1;
    angle -= angleVelocity * 0.1;
    // Update the animation and bounds check index
    pendRegIndex = (int) (pendulumRegions.length * ((0 + angle) / (angle * 2)));
    pendRegIndex = pendRegIndex >= pendulumRegions.length ? pendulumRegions.length - 1
            : pendRegIndex;
    pendRegIndex = pendRegIndex < 0 ? 0 : pendRegIndex;
}

where pengRegIndex is the index of the texture regions (used by my animator class) and pendulumRegions is the texture regions that bound a full swing of the pendulum. I also write this line in the draw method:

    public void draw(SpriteBatch batch) {
    batch.draw(pendulumRegions[pendRegIndex], getxPos() - sprite.getWidth()
            / 2, getyPos(), sprite.getWidth() / 2, 0, sprite.getWidth(),
            sprite.getHeight(), 1, 1,
            (float) (angle * MathUtils.radiansToDegrees));
    }

This class extends an abstract class GameObject which has a predefined method getRectangle() which is usually what I use for collision detection. However, the rectangle that gets drawn when I call the method for the pendulum is it's starting position rather than a rectangle that swings with the pendulum.

How can I test for collisions with this object? The line I use in draw() rotates the pendulum but I'm not sure how to rotate a rectangle to follow the same swing. Any ideas?

Grateful for any help.

sentences:
2D top down RPG animation architecture problem I have a problem with my sprite animations right now. I have different animations and sequences for each character so an specific archer might do a ranged attack in which he just plays one animation and shoots an arrow at the enemy. The other might be melee and has to move close to the enemy while having an animation for that and when he reaches the enemy do its attack animation and return back to its original position also having its own animation. And I could go on and on for maybe like bosses etc.

As you can see there are many possible animation sequences for quite a variety of characters. My question is what is the best way to program this into my game. Should I have a base class for the battler which has all the common methods and than inherent each character from that class with its own attack sequences? Because that is what I thought of first but I'm affraid its the wrong approach since I will have many classes doing the same kind of sequences. Or maybe should I create a sequence base class and each different animation sequence will inherent from that class. Than play the sequence on the base Battler class?

I'm developing the game in SFML C++ and here is a gif of the battle screen right now so you can get an idea of how a battle is in my game.

Battle scene of my game

sentences:
Appropriate use for prefabs in Unity in a coordinate based game? I am wondering how exactly to use prefabs in Unity for my discretely coordinate-based game. Should they only be for gameObjects that are exactly the same? Or can they have small variations?

Example: a treasure chest is interactable and it holds items, so I would make it an empty gameObject, add an interactable component and then an itemContainer component and then drag and drop it into my prefabs folder and delete the instance in the scene.

But the question remains, if I make this treasure chest a prefab, how do I edit the itemContainer component of this treasure chest? Moreover, how would I serialize it for later use, and organize my data? Would I have to use external data files and reconstruct the ItemContainerComponent, just for a treasure chest? That sounds like a lot of work.

If I edit the itemContainer component as a prefab, then all treasure chests will have the same items. Obviously this is not feasible.

Do I drag my treasureChest prefab from the prefabs folder and then simply drop it in the game? That's how most people use it, right?

I would prefer not to just drag and drop the prefabs, because I want a more industrialized approach, and I do want some way of saving what is in each treasure chest. I can't for the life of me figure out a good way. Help appreciated!

EDIT: I see the link provided that marks this as a possible duplicate. However, none of the answers in that link are clear enough to be useful to me, e.g., the "factory." It would be nice if someone could explain the factory idea in more concrete terms.

sentences:
Rotate to a set degree then reverse and repeat in Unity I'm making my first project in Unity, a simple game where touching objects adds points to the player's score.

I'd like the objects to have a pleasant back and forth swaying animation on the Z axis. Nodding to the right 30 degrees, then to the left 30 degrees, on and on.

Here's what I've got...

public class Rotator : MonoBehaviour
{
    void Update ()
    {
        transform.Rotate(new Vector3(0,0,12)*Time.deltaTime);
    }
}

This gives me a nice slow rotation. But I am clueless how to tell Unity to stop at +30 degrees, reverse to -30 degrees, rotate again to +30, stop and repeat, etc, etc.

I'd really appreciate any help. Maybe there is a thread like this that I was not able to find? I assume it will involve some kind of 'if then' function?

sentences:
Rect transform stretch of a child object is set to 0 after instantiation I have the following hierarchy of my prefab:
-PopupParent
--Popup
---ScreenDim

They all have Rect Transform set to Stretch. Anchor mins are set to 0 and Anchor maxes to 1. Left, top, right and bottom are set to 0. When I pull this prefab to a Canvas manually, all works as expected.
When I instantiate the prefab the problem I am encountering is, that the PopupParent is stretched as expected, to the full screen, but all its children are not.
PopupParent looks like this:

Children Popup and ScreenDim look like this:

The instantiation I am doing using the Spawn Prefab Node in the Event editor provided by the ORK Framework. I am Mounting the PopupParent to my UICanvas.
It could be, that the issue is caused by some Framework settings, but it might very well be related to how Unity works in general. I am not sure and can't find a way to figure it out.
SOLUTION: I got ORK support to reply and solve the issue for me: http://forum.orkframework.com/discussion/6465/spawning-a-prefab-with-a-stretch-property#latest
TL;DR: Regular mounting and UI mounting works slightly different.

sentences:
Generic multiple containers derived classes for Entity System I am working on an entity system for a game. I have read that cache is very important with the common operation of iterating over entities and their components.

Currently I have a class World that contains the list of entities, and a list of each component.

class World {
  vector<Entity> entities;
  vector<PositionComponent> position_components;
  vector<SpeedComponent> speed_components;
  ...
};

The idea of this, is to have entities and components contiguous in memory to be cache-friendly.

The problem is that you have to write specific code for each different component, as it is hardcoded in the source code. One solution could be to have a matrix of Component*, where the i-th row of the matrix are all PositionComponents, and so on. The problem with this, is that with the pointers you don't have the memory continuous and break with the cache-friendly.

What would the best way to write generic code and still have cache-friendly data?

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:
Turn-based JRPG battle system architecture resources The past months I've been busy programming a 2D JRPG (Japanese-style RPG) in C++ using the SDL library. The exploration mode is more or less done. Now I'm tackling the battle mode.

I have been unable to find any resources about how a classic turn-based JRPG battle system is structured. All I find are discussions about damage formula. I've tried googling, searching gamedev.net's message board, and crawling through C++-related questions here on Stack Exchange. I've also tried reading source code of existing open source RPGs, but without a guide of some sort it's like trying to find a needle in a haystack.

I'm not looking for a set of rules like D&D or anything similar. I'm talking purely about code and object structure design. A battle system asks the player for input using menus. Next the battle turn is executed as the heroes and the enemies execute their actions.

Can anyone point me in the right direction? Thanks in advance.

sentences:
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 can I create a "rain drops on camera lense" effect with the HDRP? I did follow this tutorial https://www.youtube.com/watch?v=OG7zyogrUTs&t=115s but I did not made it cause I am using HDRP and they are not using HDRP so the problem is I can't use the normal materials being in HDRP mode help me if there is any way to do so or if there is another good video please.

In picture 1 I want these white particles on camera lens looks like the second picture I want water texture on these white particles.

sentences:
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:
.md5mesh - multiple meshes with smooth normals I have a .md5mesh which contains multiple meshes and I want to calculate smooth normals. The normals are correct but they don't work with multiple meshes.

My first idea was to merge all meshes, then calculate the normals and then render them seperated again, but I'm afraid that something will go wrong with this.

I already tested merging the meshes with blender and it gives me correct normals, but breaks texturing because each mesh has it's own texture.

I need advice on what to do now.

sentences:
Multiple concurrent Tweens I'd like to be able to direct a game object to move to a new target position over a certain amount of time. There are lots of different easing functions available, but for now let's say I'm just planning to use a standard quadratic ease-in ease-out function and also a quadratic ease-out function.

For example

Math.easeInOutQuad = function (t, b, c, d) {
    t /= d/2;
    if (t < 1) return c/2*t*t + b;
    t--;
    return -c/2 * (t*(t-2) - 1) + b;
};

Now suppose while it is still in the process of moving to that target and I want to give it a new target. Rather than have it instantly change directions with a zero starting velocity, I'd like a smooth transition.

How is this done mathematically and programmatically?

I want to avoid keeping a dynamic array of tween commands for every parameter of each game object. (I want to tween all sorts of parameters besides position.) that could get really heavy and bloated. But that's the only thing that comes to mind that might work... Keeping an array of active tweens and averaging all of them.

Maybe some easing functions lend themselves better toward being interrupted? Or is there a way to recalculate the four inputs to the ease function when a new target is set, such that the same function can continue to be used once per frame without a jarring speed/direction change, and ending at the second target instead?

sentences: center point of a text? i'm drawing a text using a spritefont and the draw.string function of the spritebatch object. in some point, i need to augment the size of the text, so i use a variable to scale it. all this is working fine, but i need to find the center of the text to use as origin to make the effect look like i want. how can i find that center point of a text? when i use textures its easy because i just take half the texture width and height, but with a spritefont, i dont have any idea of how to proceed. Thanks.

sentences:
Monogame Startup Memory Spike I am currently porting a game from WP7 using XNA to WP8.1 using MonoGame. I have been putting considerable effort into optimizing my game to be under the 185MB memory limit for low-memory phones.

I was making headway until I discovered a memory spike on startup. I continued to reduce the quality of my assets until the memory usage (while the game is running) is at about 140MB. However, on startup, the memory usage spikes to 205MB, sits there for about 10 seconds, and then drops to standard operating memory usage. It does this every time. Increasing or decreasing the asset sizes only changes how high the spike goes and the usage in general, but it does not change the 10 second delay at all.

One idea I thought about was to delay the user with a longer splash screen, giving me time to load all the assets without blowing the hatch. But this seems to me like detracting from the user experience out of convenience.

Any ideas? Has anyone else had this problem?

sentences:
Rendering multiple RenderTargets to the screen Let's say I have a background and a set of entities.
I have managed to draw the background into a Texture2D using a RenderTarget
I have also managed to draw all my entities into another RenderTarget

Now I want to take these two Textures and render them on the screen as so:

// Top-level rendering
entitiesSystem.Process();
background.Process();
Texture2D entitiesTexture = entitiesSystem.EntitiesTexture;
Texture2D backgroundTexture = background.BackgroundTexture;

graphicsDevice.SetRenderTarget(null);
graphicsDevice.Clear(Color.Black);
spriteBatch.Begin();
spriteBatch.Draw(
    backgroundTexture,
    LevelManager.LEVEL_RECTANGLE,
    null,
    Color.White,
    0.0f,
    Vector2.Zero,
    SpriteEffects.None,
    1
);
spriteBatch.Draw(
    entitiesTexture,
    LevelManager.LEVEL_RECTANGLE,
    null,
    Color.White,
    0.0f,
    Vector2.Zero,
    SpriteEffects.None,
    0
);
spriteBatch.End();

Here is how the background system renders the background:

graphicsDevice.SetRenderTarget(BackgroundTexture);
spriteBatch.Begin();
for (int i = 0; i < 2; i++)
    spriteBatch.Draw(textures[i], positions[i], Color.White);
spriteBatch.End();

Almost the same thing happens for the entities: I set the render target to the relevant one (not the same as the one for the background), start the spritebatch (again, not the same one), draw the entities and end the spritebatch.

If I set BlendMode to additive, the result is correct (they blend together). However, if I set to to AlphaBlend, then I can only render one of them (depending on the SpriteSortMode).

I have come as far as understanding that the problem lies in not preserving... something, but I am not sure how to preserve it :P

By the way, I read that multiple render targets are not supported for the XBOX... Soooooooo... what is the alternative of doing what I am doing now?

sentences:
How to stop scrolling of text in OpenGL I want to set a time limit for scrolling text in OpenGL & GLUT. How can I stop scrolling at 250? Here is my code. I try with the if condition but it's not working. The scrolling is not stopping in 250, it scrolls infinitely.

#include<fstream>
#include<iostream>
#include<stdlib.h>
#include<glut.h>

using namespace std;
float yr = 0;
float translate =0.0f, angle = 0.0f;

//identifiers
void introscreen();
void screen();

void specialKey(int key, int x, int y) {
    switch (key) {
    case GLUT_KEY_UP:
        translate += 1.0f;
        break;
    case GLUT_KEY_DOWN:
        translate -= 1.0f;
        break;
    case GLUT_KEY_LEFT:
        angle += 1.0f;
        break;
    case GLUT_KEY_RIGHT:
        angle -= 1.0f;
        break;
    }
    glutPostRedisplay();
}
void SpeedText() {

    GLfloat y;
    GLfloat y2;
    GLfloat fSize[5];
    GLfloat fCurrSize;
    fCurrSize = fSize[2];
    for (y = 0.0f; y <= 250.0f + yr; y += 5.0f) {
        glLineWidth(fCurrSize);
        glBegin(GL_LINES);
        glVertex3f(-200.0f, y + translate, 0);
        glVertex3f(-180.0f, y + translate, 0);
        glEnd();
        fCurrSize += 1.0f;
        introscreen();
    }
    if (y + translate >= 50) {
        y == 50;
    }
    }
void renderbitmap(float x1, float y1, void *font, char *string) {
    char *c;
    glRasterPos2f(x1, y1);
    for (c=string; *c != '\0'; c++) {
        glutBitmapCharacter(font, *c);
    }
}

void introscreen(void) {
    glColor3f(0, 1, 0);
    char buf[10] = { '\0' };
    for (int row = 0.0f; row <= 250+yr; row +=5.0f) {
        sprintf_s(buf,"%d", row);
        renderbitmap(-220, (translate +row), GLUT_BITMAP_TIMES_ROMAN_24, buf);
    }
 }
int main(int arg, char** argv) {
    glutInit(&arg, argv);
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
    glutInitWindowSize(width, height);
    glutInitWindowPosition(50, 100);
    glutCreateWindow("HUD Lines");
    display();
    SpeedText();
    glutSpecialFunc(specialKey);
    glutMainLoop();
    return 0;
}

sentences:
How to serialize an XNA Rectangle I'm serializing a data structure to XML using the IntermediateSerializer class.  This data structure has an XNA Rectangle in it.  The rest of the data structure outputs fine, but the Rectangle part outputs as:

<Bounds>
  <Location>
    <X>15</X>
    <Y>0</Y>
  </Location>
  <Size>
    <X>16</X>
    <Y>13</Y>
  </Size>
  <X>15</X>
  <Y>0</Y>
  <Width>16</Width>
  <Height>13</Height>
</Bounds>

Instead of the condensed form:

<Bounds>15 0 16 13</Bounds>

Previous experience has shown me that I really want the condensed form so my other program can read in the Rectangle correctly.  How do I get the serializer to write it that way?

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:
How do I apply domain warping to my marching cubes voxel terrain in Unity? So, in GPU Gems 3 there is a cool warped terrain that I seek to replicate.
Currently, I'm generating the terrain fine, but I want to add that warp effect.

// Do this before using 'ws' to sample the nine octaves!
float3 warp = noiseVol2.Sample( TrilinearRepeat, ws*0.004 ).xyz;
ws += warp * 8;

Im wondering how to replicate the above code in C#. What does the above code do? What type of variable is noiseVol2.Sample(x,y).xyz?

I want to warp my own terrain, currently I have a system that creates octaves of perlin noise with certain frequencies and amplitudes.

It looks something like this:

var perlin0 = new Perlin3(0,baseFreq  * 4.03f, 0.25f);
var perlin1 = new Perlin3(1, baseFreq * 1.96f, 0.50f);
var perlin2 = new Perlin3(2, baseFreq * 1.01f, 1.00f);
var perlin3 = new Perlin3(3, baseFreq * 0.49f, 2.00f);
var perlin4 = new Perlin3(4, baseFreq * 0.24f, 4.00f);

return new Density(ws => {

        // start with plane
        float density = plane.Evaluate(ws);

        // add perlin noise to get density values at each ws co-ord.
        //3 octaves currently (3 perlin noise +=)
        density += perlin0.Evaluate(ws);
        density += perlin1.Evaluate(ws);
        density += perlin2.Evaluate(ws);
        density += perlin3.Evaluate(ws);
        density += perlin4.Evaluate(ws);
        return density;
    });

I've tried replicating it like so:

var q = new Vector3(perlin0.Evaluate(new Vector3(0,0,0)), perlin0.Evaluate(new Vector3(5.2f, 1.3f, 1.3f)));
var q1 = new Vector3(perlin1.Evaluate(new Vector3(0, 0, 0)), perlin1.Evaluate(new Vector3(5.2f, 1.3f, 1.3f)));
var q2 = new Vector3(perlin2.Evaluate(new Vector3(0, 0, 0)), perlin2.Evaluate(new Vector3(5.2f, 1.3f, 1.3f)));
density += perlin0.Evaluate(p + 4.0f*q);
density += perlin1.Evaluate(p + 4.0f * q1);
density += perlin2.Evaluate(p + 4.0f * q2);

I've read the article that Íñigo Quílez created, and implemented it like above. Am I doing something wrong? It looks the same without that, just using

density += perlin0.Evaluate(p);
density += perlin1.Evaluate(p);
density += perlin2.Evaluate(p);

I want to know what I'm doing wrong, what I misunderstood and how to implement it correctly.

This is all based off this lumpn's proceedural-generation on github
(I would link it, but I can't)

Thanks.

I would also want to know if there are any examples (I learn best from codebases) with this implementation using shaders. (Maybe it will run faster because it uses the GPU instead of the CPU?)

This is still unanswered on how to do it on the CPU
(and I'm still confused on how to do it on the GPU, do you have to do some vertex stuff? how do you pass in a noise texture through the shader?)

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

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

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

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

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

sentences:
Action-oriented AI: evasion-algorithm takes much time Evasion, the process of evading, is the opposite of chasing. Instead of trying to decrease the distance to the target we try to maximize it.

It takes much time while evading multiple objects simultaneously. I use BFS here. To make it faster what algorithms should I use?

sentences:
How to make blocks like "redstone" working in a minecraft-like game when the chunks are not loaded I'm working on a 2D minecraft-like game, I use chunks to save my world and each chunk has 128*128 blocks in it.
And infinite chunks can create an infinite world.

Memory should never be infinite and only several chunks near the character are shown on the screen and loaded into memory. How can I handle logic based blocks like red stone signals when they are in chunks far away and so not loaded in memory?

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:
Graphical Android game: Bad performance in some situations I am developing a simple graphical game for Android (Java and OpenGL ES). There is no high-end graphics involved, basically a few (less than 10) sprites and some (about 10) dynamically drawn primitives. The performance of the game is quite fine, I get about 50-60 FPS on my HTC Desire.

However, there is one specific performance issue. In my game I can fire a characters' gun, which then fires a laser beam that moves over the screen following its velocity vector. This beam is dynmically drawn. The thing is: when I fire the gut the first time, the laser beam is moving very unsteady (its "hopping" over the screen). But, after this first time, when I then fire the gun for how often I like, the laser beam is moving very smooth over the screen.

I first thought this might be an issue with Android's garbage collector. But I double-checked my code. Not one single new object is created within the main game loop, I solely use pre-created objects (i.e. class instances). I also doubt the problem is related to the dynamic drawing of my primitives (laser beam), because as said its working fine and very smooth for every gun shot after the first one. It is solely this first shot where I encounter this performance issue.

So my question is, does this behaviour sound familiar to anyone of you guys? I would appreciate any idea very much.

sentences:
Unity 2d overlapCircle melee combat issue I have an issue with my overlapCircle melee combat in the game. I'm not good at such things, so I just copied that code from some YouTube tutorial. But the thing is that if the enemy is behind the collider, I can still damage and kill him. And I don't want this. Is there a solution to this problem except recreating the melee combat system from the ground up? Maybe changing circle radius when close to collider?...
Here's a video clip that may help show the situation.
void Attack()
{
    Collider2D[] hitEnemies = Physics2D.OverlapCircleAll(attackPoint.position, attackRange, whatIsEnemy);
    foreach (Collider2D enemy in hitEnemies)
    {
        Debug.Log("Melee hit: " + enemy.name);
        if (enemy is BoxCollider2D)
        {
            CinemachineShake.Instance.ShakeCamera(3f, 0.2f);
            SoundManager.PlaySound("Knife_kill");
            if (enemy.tag == "Melee enemy")
                enemy.GetComponent<enemy_melee>().TakeDamage(attackDamage);
            else if (enemy.tag == "Gun enemy")
                enemy.GetComponent<enemy_gun>().TakeDamage(attackDamage);
        }
    }
    animator.SetTrigger("Melee_attack");
    animator.SetBool("IsCrouching", false);
    animator.SetBool("IsJumping", false);
}

sentences:
A Poker Game with XNA A customer of mine asked me to develop a Poker Game for him where they play poker with his friends online.

I have been looking for a good reason to start programming with XNA.  Would you implement it with XNA if you were developing a game like this ?

Is there any ebook/online tutorials/video trainings which has some similar sample applications?

sentences:
My "puck" model object falls right through the "table" model in jMonkeyEngine So I am trying to learn jMonkey, I have understood everything so far, and I thought I understood how to make objects solid, so things can't go through each other. When I create my Collision shapes, I turn on the debugger which shows the shapes, and they appear correct. But when I run the code the puck falls right through the table and I have no idea why? I have been trying to learn from http://wiki.jmonkeyengine.org/doku.php/jme3:beginner:hello_collision.

public class Main extends SimpleApplication {

    public static void main(String[] args) {
        Main app = new Main();

        AppSettings settings = new AppSettings(true);
        settings.setResolution(1024,768);
        settings.setFrameRate(60);
        app.setSettings(settings);

        app.start();
    }

    private BulletAppState bulletAppState;

    private RigidBodyControl    table_phy;
    private RigidBodyControl    puck_phy;

    @Override
    public void simpleInitApp() {

        bulletAppState = new BulletAppState();
        stateManager.attach(bulletAppState);
        bulletAppState.getPhysicsSpace().enableDebug(assetManager);

        DirectionalLight sun = new DirectionalLight();
        sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f).normalizeLocal());
        rootNode.addLight(sun);

        cam.setLocation(new Vector3f(0.0f, -2.0f, 7.0f));

        initTable();
        initPuck();
        initPusher1();
        initPusher2();

    }

  //My hockey table
    public void initTable() {
        Spatial table = (Node)assetManager.loadModel("Models/airTable/airTable.j3o");
        table.setLocalTranslation(0.0f, -5.0f, -2.0f);
        CollisionShape tableShape = CollisionShapeFactory.createMeshShape((Node) table);
        table_phy = new RigidBodyControl(tableShape,0.0f);
        table.addControl(table_phy);
        rootNode.attachChild(table);
        bulletAppState.getPhysicsSpace().add(table_phy);
    }

    //My puck
     public void initPuck(){
        Spatial puck = assetManager.loadModel("Models/puck/puck.j3o");
        puck.setLocalTranslation(1.0f, -3.0f, 0.0f);
        CollisionShape puckShape = CollisionShapeFactory.createMeshShape((Node) puck);
        puck_phy = new RigidBodyControl(puckShape, 0.05f);
        puck.addControl(puck_phy);
        rootNode.attachChild(puck);
        bulletAppState.getPhysicsSpace().add(puck_phy);
    }
}

sentences:
Blend trees does not get effect on some animations I have created generic animations in unity where bike rotate to its left or right depending on what axis user is pressed.

I have created several right turn animations though out of those animations,only couple of work when blend tree parameter gets changed.Other remain same and does not effect bike.

When I use "loop" to true in other animations ,it do work but loops continuously.

I am using only one right anim at a time.

Plz help in

sentences:
Designing AI in a 1 on 1 battle similar to Pokemon I am designing a game where the battle system is similar to Pokemon. That is, a 1 on 1 battle with only a few (4-6) moves to choose from.  As the game is taking shape, I'm starting to think about some of the more difficult coding areas such as enemy AI and I have a few questions.  I have already thought about some possibilities for designing the AI and wanted also to hear your feedback.

I am thinking of trying a universal AI for my game where all monsters will utilize the same logic for determining what move they will use.  It will be based around equations/values assigned to each move and determining which is the best to make.  For example, if the monsters move will be resisted (1/2 damage) by the opponent then it receives a lower effective value than the others and moves that do extra damage due to vulnerability will receive higher effective value.  Also, I was thinking of adding a variable that reduces the value if the move has been used repeatedly to avoid the computer always using the same move.  I feel that this is currently limited just to making the computer use the highest damage move.  Any suggestions?

SO for my questions.

How does designing AI logic for each monster/Pokemon vs having a general set of rules for all effect the size of my game in terms of code and effectiveness of the AI?
Are there any resources that discuss designing AI in this manner?  I found very little on the AI in Pokemon games and I'm unsure what other games might be similar in mechanics.

Thanks for your time!

sentences:
Different methods of item implementation - what are the differences? More often that not, when I see how item systems have been implemented in games, the items are retrieved using either a string or ID. Eg, GetItem("Sword") or GetItem(ID.Sword). Is there some advantage to this method that I am missing?

When I have made item systems in my games, I create a class for the item and get a new one that way - eg, new Item(Sword). At times I have also stored the items in a list of some kind, and retrieved them that way, eg GetItem(Sword).

So my question is - why do most of the systems I see use a name tag or id system? What's the problem with getting them directly by reference?

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:
How to spawn enemies within a minimum distance of each other randomly? 2D So I'm making an 2D infinite runner. So I try to spawn obstacles randomly in x-coordinate, but these just spawn most of the time in the same position and too frequently. generationPoint is just a small Empty a medium distance from the camera that's where the obstacles spawn. Even if I make them spawn at a small random rate It's still impossible to play.

{

public GameObject thePlatform;
public Transform generationPoint;
public float distanceBetween;

private float platformWidth;

public ObjectPooler theObjectPool;

public float randomEnemyThreshold;
public ObjectPooler enemyPool;

public float randomReindeerThreshold;
public ObjectPooler ReindeerPool;

void Start () {
    platformWidth = thePlatform.GetComponent<BoxCollider2D>().size.x;

}

void Update () {

    if (transform.position.x < generationPoint.position.x)
    {
        transform.position = new Vector3 (transform.position.x + platformWidth + distanceBetween, transform.position.y, transform.position.z);

        GameObject newPlatform = theObjectPool.GetPooledObject();

        newPlatform.transform.position = transform.position;
        newPlatform.transform.rotation = transform.rotation;
        newPlatform.SetActive (true);

        if (Random.Range (0f, 100f) < randomEnemyThreshold)
        {
            GameObject newEnemy = enemyPool.GetPooledObject();

            Vector3 enemyPosition = new Vector3 (-10f, 0.5f, 0f);

            newEnemy.transform.position = transform.position + enemyPosition;
            newEnemy.transform.rotation = transform.rotation;
            newEnemy.SetActive(true);

        }

        if (Random.Range (0f, 100f) < randomReindeerThreshold)
        {

            GameObject newDeer = ReindeerPool.GetPooledObject ();

            Vector3 reindeerPosition = new Vector3 (5f, 0.5f, 0f);

            newDeer.transform.position = transform.position + reindeerPosition;
            newDeer.transform.rotation = transform.rotation;
            newDeer.SetActive(true);
        }
    }

}

}

sentences:
Godot and getting files via HTTP So, I am wanting to use Godot to get a (binary) file using HTTP and then either save it or, even better, turn it into a Resource in memory that I can use.  It'll be WAV files that I'm getting in return (trying to implement MaryTTS, which is running as a server on localhost).  I had a look at the docs for HTTPRequest, but can't seem to get a working solution.

I do $HTTPRequest.request("http://...") when a keypress is made, and I have the _on_HTTPRequest_request_completed() function, but this never seems to be called.  I tried with the function in the same Node as the request (as per the docs' example), and I also tried putting it as part of a script for the HTTPRequest Node.  If I hit the triggering key fast enough, it gives an error ("HTTPRequest is processing a request"), but if I do it slower, it doesn't give that error, so it appears it is finishing.  It just doesn't do anything when it finishes.  HTTPRequest gives a return value of 0, which I assume means no error?  (Or should this give me HTTP status codes?)

Any idea what I'm doing wrong?  Can HTTPRequest handle binary files?  How do I get this working?

(Any suggestions on a better way to implement MaryTTS are also welcome).

sentences:
how do I tile this generated terrain infinitely around the player? i made a script that instantiates cubes with for loops and perlin noise. is there any way i can tile this infinitely around the player? here is the script for the generation of one tile

public GameObject grass;
public int mapSizeX = 50;
public int mapSizeZ = 50;

public float heightScale = 20f;
public float detailScale = 20f;

float seed;
// Use this for initialization
void Start()
{
    //if (instance == null)
    //   instance = this;
    for (int x = 0; x < mapSizeX; x++)
    {
        for (int z = 0; z < mapSizeZ; z++)
        {
            int y = (int)(Mathf.PerlinNoise((x + seed) / detailScale, (z + seed) / detailScale) * heightScale);

            GameObject g = Instantiate(grass) as GameObject;
            g.transform.position = new Vector3(x, y , z);
            g.transform.SetParent(this.transform);
        }
    }
}

sentences:
Some advice for settling on a map format for a tile game? I am using XNA 4.0 and am currently working on a simple tile game to pass the time. Basically, I'm using the tried and true method of having numbers refer to tile types, where in 0 would be an empty tile, 1 would be grass, et cetera.

This is all well and good and works fine but I was wondering how to incorporate other assets. For example, a map may have parallax backgrounds, background music, and of course the tileset from which the tile map refers to draw its textures.

Ignoring ambient music and gratuitous scrolling backgrounds, I am still unsure of how to implement just the joining of the tile map (text) and tileset (png image). I see several solutions:

1) Embed the texture data for the tileset directly within the map file. This could be extended to other assets as well and would allow for all map files to be together in a single file. Unfortunately, the file sizes quickly become massive as raw texture data is several times larger than compressed images. For this I'm using GetData and WriteBase64.

2) Somehow mention the directory or filename of the tileset from within the text map file. This is how I typically see it done, but because I am using the content loader and not simply loading off the hard drive, this may not be possible. Perhaps the asset name could be stored but this solution seems a bit error-prone.

3) Completely separate the textual map data from the tileset image. At runtime, first load the map tiles and then allow any sort of tileset image to be loaded afterwards. This has the advantage of different map files using the same assets without duplicated data and very small file sizes. However, with this solution the width of the tileset would still have to be known before hand in order to correctly offset tile values. Also, map files may become lost and more easily edited by the user.

4) Create some sort of ZIP derivative in which all map files are contained in this package. Then, the textual map file can refer to the assets within this container. I'm not exactly sure whether or not this would work with XNA's content loader or how to implement it either, so I'm not sure of the this solution.

How do most developers typically solve this problem with XNA?

sentences:
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:
What does a "video system not initialised" error in pygame mean? I'm trying to play music when a key is pressed in pygame, then print a message.

When I run this script:

import pygame
import time

pressedkeys = pygame.key.get_pressed()

pygame.init()                      #initialize pygame
pygame.mixer.pre_init(44100, -16, 2, 2048) # setup mixer to avoid sound lag

try:
    firstMusic = pygame.mixer.Sound("C:\(pathForMyMusicFile).wav")  #load sound
    secondMusic = pygame.mixer.Sound("C:\(pathForMy2ndMusicFile).wav")  #load sound

except:
    raise UserWarning, "could not load or play soundfiles"

if pressedkeys[pygame.K_SPACE]:
    firstMusic.play(-1)
    time.sleep(2)

I get this error:

pressedkeys = pygame.key.get_pressed()
pygame.error: video system not initialised
Script terminated.

What am I doing wrong?

I'm using Stani's Python Editor.

sentences:
Parallax camera is not independent from the stage camera I have a weird camera problem that I can't solve! I add my actors to the main stage and use its camera too. Actors are constrained within the screen viewport.
I also have a second camera that I use for the parallax background. I check for touchDragged and touchDown to move the actor to that position. So I do:
@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
    getStage().getCamera().unproject(touchPosition.set(screenX, screenY, 0f));
    player.moveTo(touchPosition);

    return false;
}

I can pan the parallax camera, and I do:
public void panBy(float x, float y)
{
    panTo.set((float)MathHelper.round(position.x + x, 0), (float)MathHelper.round(position.y + y, 0), 0);
    panning = true;
}

@Override
public void update() {
    if (panning) {
        position.x += (panTo.x - position.x) * panLerp;
        position.y += (panTo.y - position.y) * panLerp;

        Vector3 pos = new Vector3((float)MathHelper.round(position.x, 0), (float)MathHelper.round(position.y, 0), 0);

        if (pos.epsilonEquals(panTo)) {
            position.set(pos);
            panning = false;
        }
    }

    super.update();
}

The drawing is done:
public void draw(Batch batch)
{
    //Start batch
    batch.setProjectionMatrix(parallaxCamera.combined);
    batch.begin();

    background.draw(batch, 1f);

    //End batch
    batch.end();
}

Actors are handled by the stage right after the above draw call.
The above work fine individually. However when I pan and drag the actor the parallaxCamera follows the actor too. I the parallaxCamera to be totally independent and just keep scrolling.
Why do I have this behavior?

sentences:
Issue with 2d Angular Car Collision Response I am having trouble getting the angular collision response to work properly in my 2d car simulation. I have gotten the linear collision response to work between the vehicles, however, the angular collision response does not seem to be working. The problem seems to arise from my slip angle calculation for the car, and it seems to override the angular impulse. The slip angle is necessary to make the vehicle move realistically.
Here's the code to calculate the slip angle:
// Calculate slip angle for front/back wheel
this.wheels.front.slipAngle = -Math.atan2(this.localVelocity.y + yawSpeedFront, Math.abs(this.localVelocity.x));
this.wheels.back.slipAngle = -Math.atan2(this.localVelocity.y + yawSpeedRear,  Math.abs(this.localVelocity.x));

As can be seen in the following pictures, the car rotation response is correctly simulated when it hits the top of the car and rotates clockwise. On the other hand, when the car hits the bottom of the other car, the rotation should be clockwise, but actually still goes clockwise. It seems to me that the problem arises because the slipAngle overrides the angular rotation of the collision.

My project can be seen here: https://victorwei.com/projects/car-sim/ Feel free to take play around with the simulation and view the code to figure out the issue. If there are any suggestions on how to mitigate this problem, that would be greatly appreciated.

sentences: Enter Key press event detect from textbox - Unity3D - C# i am doing a project with Unity3D . in the interface there is a textbox. once user input some text and and press enter key then i want to read the text in text box. so please tell me how to  programmatically detect the key press event in unity3D - C# using MonoDeveloper.

sentences:
How can I implement large moving "colossus" characters that also act as environmental objects? I'm curious how enormous characters that act both as entities and environments are implemented.  I'm thinking of characters like in Shadow of the Colossus which move, but which the player can also move on.

It seems these objects would be created as characters, rigged like any character would be with their various animations, but they would also need to be usual physical surfaces that we can walk on. Considering the way characters are handled compared to how static environment is handled physically in most game engines, this could prove problematic, and added to that is the problem of size.

So, generalising over engine details (but assuming you have a generic physics/character engine, e.g. Unity/Unreal) what approach should be taken?

Also, screenshot:

As you can see in this screenshot, the colossus is really big, and the player can walk on it and climb on some parts of it (hairs mostly)

And a video of a boss fight here which really shows what this gameplay is all about

sentences:
fragment shader with SNORM textures I want to apply SNORM texture by using GL_TEXTURE_3D as a target, what will be the fragment shader for the same?
Also, what should be the data type of texture data?

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: In OpenGL, how can I discover the depth range of a depth buffer? I am doing a GL multi-pass rendering app for iOS. The first pass renders to a depth buffer texture. The second pass uses the values in the depth buffer to control the application of a fragment shader. I want to rescale the values in the depth buffer to something useful but before I can do that I need to know the depth value range of the depth buffer values. How do I do this?

sentences:
OpenGL - Understanding the relationship between Model, View and World Matrix I am having a bit of trouble understanding how these matrixes work and how to set them up in relation to one another to get a proper system running.

In my understanding the Model Matrix is the matrix of a object, for example a cube or a sphere, there will be many of these in the application/game.

The World Matrix is the matrix which defines the origin of the 3D world. the starting point.

And the View Matrix is the "camera" everything gets translated with this to make sure you have the illusion of an actual camera when in fact everything is moving instead of this matrix?

I am a bit lost here. So I was hoping someone here could help me understand this properly.

Does every modelMatrix get translated/multiplied with the world matrix and the worldMatrix then with the viewMatrix? Or does every modelMatrix get translated/multiplied with the viewMatrix and then that with the worldMatrix?

How do all these matrixes relate and how do you set up a world with multiple objects and a "camera"?

EDIT:

Thanks a lot for the feedback already. I did some googling aswel and I think I do understand it a bit better now, however would it be possible to get some pseudo code advice?

projectionMatrix = Matrix;
makePerspective(45, width, height, 0.1, 1000.0, projectionMatrix);

modelMatrix = Matrix;
identity(modelMatrix);
translate(modelMatrix, [0.0, 0.0, -10.0]);  // move back 10 on z axis

viewMatrix = Matrix;
identity(viewMatrix);
// do some translation based on input with viewMatrix;

Do I multiply or translate the viewMatrix with the modelMatrix or the other way around? and what then? I currently have a draw method up in such a way that it only needs 2 matrixes for arguments to draw.

Here is my draw method:

draw(matrix1 matrix2) {

            bindBuffer(ARRAY_BUFFER, cubeVertexPositionBuffer);
            vertexAttribPointer(shaderProgram.getShaderProgram().vertexPositionAttribute, cubeVertexPositionBuffer.itemSize, FLOAT, false, 0, 0);

            bindBuffer(ARRAY_BUFFER, cubeVertexColorBuffer);
            vertexAttribPointer(shaderProgram.getShaderProgram().vertexColorAttribute, cubeVertexColorBuffer.itemSize, FLOAT, false, 0, 0);

            bindBuffer(ELEMENT_ARRAY_BUFFER, cubeVertexIndexBuffer);

            setMatrixUniforms(shaderProgram, matrix1, matrix2);

            drawElements(TRIANGLES, cubeVertexIndexBuffer.numItems, UNSIGNED_SHORT, 0);

}

What are those matrixes suppose to be?
Thanks a lot in advance again guys.

sentences:
Why do I have to switch T(v) texture coordinates while importing OpenGL to Direct3D? I am importing my code from OpenGL to Direct3D. My D3DTS_PROJECTION uses D3DXMatrixPerspectiveFovRH, and my D3DTS_VIEW uses D3DXMatrixLookAtRH to set a view equal to OpenGL's view. My question is why do I have to switch all of my 1.0000 Tex(v) texture coordinates to "minus value" in D3D to get equal texture mapping as in OpenGL.

OpenGL:

//T(u)   T(v)
1.0000,  1.0000,
0.0000,  1.0000,
1.0000,  0.0000,
1.0000,  0.0000,
0.0000,  1.0000,
0.0000,  0.0000,

0.0000,  1.0000,
0.0000,  0.0000,
1.0000,  1.0000,
1.0000,  1.0000,
0.0000,  0.0000,
1.0000,  0.0000,
// ...

Direct3D:

//           T(u)     T(v)
D3DXVECTOR2( 1.0000f, -1.0000f)
D3DXVECTOR2( 0.0000f, -1.0000f)
D3DXVECTOR2( 1.0000f,  0.0000f)
D3DXVECTOR2( 1.0000f,  0.0000f)
D3DXVECTOR2( 0.0000f, -1.0000f)
D3DXVECTOR2( 0.0000f,  0.0000f)

D3DXVECTOR2( 0.0000f, -1.0000f)
D3DXVECTOR2( 0.0000f,  0.0000f)
D3DXVECTOR2( 1.0000f, -1.0000f)
D3DXVECTOR2( 1.0000f, -1.0000f)
D3DXVECTOR2( 0.0000f,  0.0000f)
D3DXVECTOR2( 1.0000f,  0.0000f)
// ...

Is it because Direct3D's origin (0.0) of texture coordinates lies in different place than in OpenGL?

sentences:
Trouble using Ray.Intersect method on bounding boxes in a 2D XNA game I am trying to use a ray and bounding box to determine if a box is between the player and the mouse pointer in 2D space.  When I try testing the code, the collision will return true when pointed at the box but it also returns true under other circumstances where it shouldn't.

For instance.  If I have a player on the left and a box directly to the right, I can put the mouse pointer a few hundred pixels above the box or a few hundred below and it will still return true.  Also, I can put my mouse pointer to the left of the player and in a certain area it will still return true.  Does anyone have any idea what might cause this?

I have left out definitions for some of my members and properties just to make this code sample easier to read.  The position property is just a Vector2 for where each object is located.

ray = new Ray(new Vector3(player.Position, 0), new Vector3(mouse.Position, 0);
box = new BoundingBox(new Vector3(box.Position, 0), new Vector3(
new Vector2(box.Position + box.Width, box.Position + box.Height), 0);

if (ray.Intersects(box) != null)
    collision = true;
else
    collision = false;

sentences:
How can zoom into my object when that object is being clicked? Suppose that I have the three game(cube,Quard,sphere) object. When I click on a particular game object suppose think I have clicked on the cube,the cube object should get zoomed in on the screen.

how can I do that?

How do I center and zoom into my cube game object after selecting the  cube? I think it has something to do with the camera but how do I center the view with the camera?

I have used the below code for zooming the object.For one object its working.But when I place different object and apply this code then when i click on one object all the three object is getting zoomed.

Can anyone help me out in solving this issue

Here is the code

  function OnMouseDown()
{
 OrthoZoom(1.5);
}
function OrthoZoom(size : float) {
 var cam = Camera.main;

 while (cam.orthographicSize != size) {
     cam.orthographicSize = Mathf.MoveTowards(cam.orthographicSize, size, speed * Time.deltaTime);
     yield;
 }

}

sentences:
How can I place a ProgressBar in Android using Cocos 2d? I want to place a horizontal progress bar in my Android application and I want to change its progress color. I used the following code, but the progress bar is not being displayed.

CCProgressTimer progressBar = CCProgressTimer.progress("progressbar.png");
progressBar.setType(kCCProgressTimerTypeHorizontalBarLR);
progressBar.setScale(5);
progressBar.setAnchorPoint(CGPoint.ccp(0, 0));
progressBar.setPosition(CGPoint.ccp(0,0));
addChild(progressBar);

sentences:
Calculate speed vehicle physics 2d racegame I am currently working on a 2d racegame where I am using physics to move a vehicle. On my form I would like to add a label containing the speed on the vehicle.

My physics knowledge is a little rusty, haven't done anything with it for a while, so I am asking the following question. Which of the calculations in my code represent the total velocity of my vehicle?

My relevant code:

    //our simulation object
    class RigidBody
    {
        //linear properties
        private Vector m_position = new Vector();
        private Vector m_velocity = new Vector();
        private Vector m_forces = new Vector();
        private float m_mass;

        //angular properties
        private float m_angle;
        private float m_angularVelocity;
        private float m_torque;
        private float m_inertia;

        public void Update(float timeStep)
        {
            //integrate physics
            //linear
            Vector acceleration = m_forces / m_mass;
            m_velocity += acceleration * timeStep;
            m_position += m_velocity * timeStep;
            m_forces = new Vector(0,0); //clear forces

            //angular
            float angAcc = m_torque / m_inertia;
            m_angularVelocity += angAcc * timeStep;
            m_angle += m_angularVelocity * timeStep;
            m_torque = 0; //clear torque
        }
   }

Hopefully someone will be able to help.

sentences: Is there any Lua API that works with C# for PC & XBox 360 Development? I am reading a book on Game Development in which they show you how to make scripts for your game in Lua. They program Lua and use it from C++, but I was wondering if there is a library or API to use Lua from C#: specifically from XNA to develop games for PC and XBox 360?

sentences:
Creating transparent image with localGraphicsConfig not always working I'm trying to use GraphicsConfiguration.createCompatibleImage to create transparent images.
This creates an empty image which I'm filling with a mosaic pattern later on in the code.

This seems to work like a charm on my iMac using the latest OSX.
When i switch (bootcamp) to Windows 7, the transparency doesn't work (just opaque images).
Is there something i'm missing?

I'm using Java 1.7.0_03 on Windows 7 (64)

I'm actually not quite sure if it's necessary to render the image using the localGraphicsConfiguration since the image/layer with the mosaic will never change. How can I solve this?

sentences:
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:
Should I send the entries using a tickrate? Netcode Authoritative Server I am developing a 2D platform and shooting video game in Unity 2D with authoritative logic / physics on the server (The physics server is also developed in Unity to be able to use the box2D library on both the client and the server).
Currently I am working on the basic communication functionality between the client and the server using socket to send the client's inputs to the server and executing the physics on it. And this is where I find myself with a question that I can't solve after searching a lot on google and forums.
When should you send the client's inputs to the server? Setting a delivery tickrate or each time the user clicks on the controls?
As I have analyzed on my own, what seems more efficient at first is to send the inputs to the server each time the client presses one of the game controls. And on the other hand that the server sends the clients the status of the game (player movements, changes in physics, etc.) using a tick rate.
This is a diagram of the communication and behavior that I am developing:

As you see this operation. Should I also set a tickrate on the client?
Thank you very much.

sentences:
How to implement behavior in a component-based game architecture? I am starting to implement player and enemy AI in a game, but I am confused about how to best implement this in a component-based game architecture.

Say I have a following player character that can be stationary, running and swinging a sword. A player can transit to the swing sword state from both the stationary and running state, but then the swing must be completed before the player can resume standing or running around. During the swing, the player cannot walk around.

As I see it, I have two implementation approaches:

Create a single AI-component containing all player logic (either decoupled from the actual component or embedded as a PlayerAIComponent). I can easily how to enforce the state restrictions without creating coupling between individual components making up the player entity. However, the AI-component cannot be broken up. If I have, for example, an enemy that can only stand and walk around or only walks around and occasionally swing a sword, I have to create new AI-components.
Break the behavior up in components, each identifying a specific state. I then get a StandComponent, WalkComponent and SwingComponent. To enforce the transition rules, I have to couple each component. SwingComponent must disable StandComponent and WalkComponent for the duration of the swing. When I have an enemy that only stands around, swinging a sword occasionally, I have to make sure SwingComponent only disables WalkComponent if it is present. Although this allows for better mix-and-matching components, it can lead to a maintainability nightmare as each time a dependency is added, the existing components must be updated to play nicely with the new requirements the dependency places on the character.

The ideal situation would be that a designer can build new enemies/players by dragging components into a container, without having to touch a single line of engine or script code. Although I am not sure script coding can be avoided, I want to keep it as simple as possible.

Summing it all up: Should I lob all AI logic into one component or break up each logic state into separate components to create entity variants more easily?

edit: I suspect there is some confusion about what I meant with the first and second situation. I have tried to explain it in the diagram below.

Note the relationship between the individual states and the entity. In the first situation, an AI component is pre-built before being put in the entity. A designer can only select from a distinct set of AIComponents made available by the programmer. The second situation has the different states on the same level as other components. A designer can now create an entity with unique AI without interference of a programmer.

The question is, are these the only two options for structuring AI in an component-based entity and, if so, what would give the maximum flexibility?

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:
Unity font API behaves differently in built game Specifically it's Font.CreateDynamicFontFromOSFont(), use this script attached to an empty GameObject in the scene.

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

public class TestFontTexture : MonoBehaviour {

    void Start ()
    {
        var font = Font.CreateDynamicFontFromOSFont("Consolas", 12);
        font.RequestCharactersInTexture("HelloWorld", 20);
        SaveTexture2PNG("./fontTexture.png", (Texture2D)font.material.mainTexture);
    }

    void Update ()
    {

    }

    void SaveTexture2PNG(string path, Texture2D tex)
    {
        byte[] bytes = tex.EncodeToPNG();
        System.IO.File.WriteAllBytes(path, bytes);
    }
}

After click play it should create a fontTexture.png file containing character glyphs in the Assets folder, but only in editor though. In the built game it just created a completely black image.

Since it's OS concerned, I'm using Windows 7 with font Consolas installed and Unity 5.6.5f.

How to make it work in a built game?

sentences:
Calculate random points (pixel) within a circle (image) I have an image that contains a circles at a specific location, and of a specific diameter. What I need to do is to be able to calculate random points within the circle, and then manipulate the pixels said points correlate to. I have the following code already:

private Point CalculatePoint()
{
    var angle = _random.NextDouble() * ( Math.PI * 2 );
    var x = _originX + ( _radius * Math.Cos( angle ) );
    var y = _originY + ( _radius * Math.Sin( angle ) );
    return new Point( ( int )x, ( int )y );
}

And that works fine for finding all the points at the circumference of the circle, but I need all points from anywhere in the circle. If this doesn't make sense let me know and I will do my best to clarify.

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: Add delay between player jumps I'm developing a platformer game and have implemented jumping for the player. The player is able to jump, but holding the up arrow causes the player to continuously jump. What would be the best way to add a small delay between jumps so that once the player lands on the ground; there is a small delay before the next jump is initiated.

sentences:
Design question: best way to model and visualize a long grid of data Perhaps some noob questions for a scientific application that you can assist with: I am trying to render a large, evenly spaced grid of data in 2D.  The full data set dimensions could be anywhere from 48x250,000 to 1000x15,000,000 points/pixels.

The data is evenly spaced, but I need to change the aspect ratio, and then render only a section of that data on the screen at a time.  I need the users to be able to smoothly scroll forward or backward along the long dimension with user input, or press the "play" button and have it move forward or backward at certain speed.

I am looking for advice on how to handle this via DirecX or OpenGL (probably using SharpDX or OpenTK).

The basic approach I am considering is to use textures that the application generates on the fly from the data and then map them to a very simple model. I would keep the graphics card supplied with a large enough scene so that as the user scrolls or moves around that they don't have to wait for the application.  Questions I have are:

1) does this approach make sense?  i am presuming this is way more efficient and faster than creating a bunch of primitives with discrete colors. true?

2) is there a particular texture format that is good to use and easy to create (or do i create it directly)?  I have the data in application memory as large arrays and it loads/unloads from disk as needed.  I would map the scalar values to a color as I create the image/texture blocks.

3) would mipmaps be useful? i could have an aspect ratio (or small enough window) that there are fewer screen pixels than data in the viewable range.  Or, would it just automatically subsample?

4) if mipmaps are used, most of the scaling is along the long dimension, so could i uses non-square subsamples?

4) does creating compressed images make sense?  or, would the compression overhead yield much benefit (or how might i determine this)

5) how would i go about finding an optimal texture size?

Any other general advice?

Hopefully this is a straightforward problem for the cool stuff y'all do in games!

sentences:
ASSIMP aiNode->mMeshes understanding I'm trying to use ASSIMP to load an fbx file with a skeleton and animations, but I'm stuck on something I'm misunderstanding and struggling to see it.

I've attached 2 images, one of the fbx file as rendered by Open 3D Mod which uses ASSIMP and looks correct. The second image is my renderer that does not look correct. The only thing wrong with mine is that the main body is rotated 90 degrees from what it should be.

For this fbx file, it has 3 nodes that contain a mesh to draw: "Mesh 1" is the main body and "Mesh 0" is an axe. The axe is referenced twice, once from each hand node. The main body mesh's vertices are tied to the bones, so Mesh 1 gets animated with the bones. The axe mesh's vertices are not tied to bones.

So I'm traversing the skeleton, and when I get to a node that references a mesh to draw, I transform to that node's position, then draw the mesh instance at that spot. This is how the axe meshes get animated: the axe mesh vertices are not tied to bones, but since the hand nodes reference them, I transform wherever the hand bone animation currently is then draw them.

My problem is when I do this same thing on the main body (Mesh 1), it ends up rotated 90 degrees as seen in the blue picture. The reason is because the node it is attached to has an mTransformation of -90 degrees about the x-axis.

Another note is that the mTransformation of the RootNode is the identity matrix, so the global inverse is identity.

There's too much code involved for me to realistically be able to post it here. However, the relevant logic follows what's shown in this tutorial: http://ogldev.atspace.co.uk/www/tutorial38/tutorial38.html
The one thing the tutorial doesn't mention is handling the mesh references at each node. If I ignore where the meshes are referenced from, the body works but the axes break (axes don't animate any more and simply draw at their bind position).

The model I'm using was a free one I grabbed from the unity store for testing:
https://assetstore.unity.com/packages/3d/animations/zombie-0-1-19254

My questions are:
Am I correctly interpreting the mesh references at a node by transforming to the node position prior to drawing?
If so, why does this get the axes to the correct place but not the main body?
If not, what am I missing?

 Open 3D Mod's render, looking down the Z axis
 My render, looking down the Z axis

sentences:
How do I use raycast to put a bullet hole on a curved surface? EDIT: As of yet I have not been able to find a way to make the bullet hole wrap around the corner of a gameobject.

I am working on a fps game that uses raycast for shooting and so far it works, but the problem is with the bullet holes. So the script will generate bullet holes (not going to explain everything it does) like it is supposed to.

The problem is that if I shoot the corner the bullet hole will just generate on whatever side the impact was closest to. How do I get the bullet hole to spawn on curves and corners? Here is the script:

public class HitFXManager : MonoBehaviour
{

    [Range(1, 200)]
    public int decalsPoolSizeForEachType;

    public GameObject concreteDecal;
    public GameObject woodDecal;
    public GameObject dirtDecal;
    public GameObject metalDecal;

    [HideInInspector]
    public GameObject[] concreteDecal_pool;
    [HideInInspector]
    public GameObject[] woodDecal_pool;
    [HideInInspector]
    public GameObject[] dirtDecal_pool;
    [HideInInspector]
    public GameObject[] metalDecal_pool;

    void Start()
    {
        DecalsPool();
    }

    public void DecalsPool()
    {
        concreteDecal_pool = new GameObject[decalsPoolSizeForEachType];
        var decalsParentObject_concrete = new GameObject("decalsPool_concrete");

        for (int i = 0; i < decalsPoolSizeForEachType; i++)
        {
            concreteDecal_pool[i] = Instantiate(concreteDecal);
            concreteDecal_pool[i].SetActive(false);
            concreteDecal_pool[i].transform.parent = decalsParentObject_concrete.transform;
        }

        woodDecal_pool = new GameObject[decalsPoolSizeForEachType];
        var decalsParentObject_wood = new GameObject("decalsPool_wood");

        for (int i = 0; i < decalsPoolSizeForEachType; i++)
        {
            woodDecal_pool[i] = Instantiate(woodDecal);
            woodDecal_pool[i].SetActive(false);
            woodDecal_pool[i].transform.parent = decalsParentObject_wood.transform;
        }

        dirtDecal_pool = new GameObject[decalsPoolSizeForEachType];
        var decalsParentObject_dirt = new GameObject("decalsPool_dirt");

        for (int i = 0; i < decalsPoolSizeForEachType; i++)
        {
            dirtDecal_pool[i] = Instantiate(dirtDecal);
            dirtDecal_pool[i].SetActive(false);
            dirtDecal_pool[i].transform.parent = decalsParentObject_dirt.transform;
        }

        metalDecal_pool = new GameObject[decalsPoolSizeForEachType];
        var decalsParentObject_metal = new GameObject("decalsPool_metal");

        for (int i = 0; i < decalsPoolSizeForEachType; i++)
        {
            metalDecal_pool[i] = Instantiate(metalDecal);
            metalDecal_pool[i].SetActive(false);
            metalDecal_pool[i].transform.parent = decalsParentObject_metal.transform;
        }

    }
}

sentences:
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:
Is this possible in cocos2dx 3.0? I have a number of five images (sprite1.png, sprite2.png, sprite3.png, sprite4.png, sprite5.png), these all I want to add as a sprite...

int rndSprtNum = (arc4random() % 5) + 1;
for(int i = 0; i < 5; i++)
{
    int rndSprtNum = (arc4random() % 5) + 1;
    CCSprite *first = CCSprite::create("sprite%d.png",rndSprtNum);

    rndSize = rndSize+(arc4random() % 20) + 15;
    int  width = rndSize + 125*(size.width/768);
    rndSize = rndSize + 90;
    first->setPosition(ccp(width,512 * (size.height/1024)));

    this->addChild(first,0);
}

Is this possible in cocos2dx v3.0?

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

How I see Entity System :

Components : A class with attributs, set and get.

Sprite
Physicbody
SpaceShip
...

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

EntityManager
Renderer
Input
Camera
...

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

What I've done :

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

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

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

My questions

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

sentences:
What Game mechanic can I implement to give players incentive to finish a race? I am essentially making deathrace the game. How do I give players incentive to finish or participate in the race instead of strictly deathmatching on the race track.

Edit More Detail:

General Race Rules:

Death during the race knocks you out of the race
Weapons  and defensive tools are picked by player at the start of the race where they are limited by the amount of "space" on the weapon and defensive system
Using a weapon increases the heat of the weapon system. certain weapons within a cars weapon system can only be used if the weapon systems temperature is below a certain threshold
Defensive systems are power based, where certain defensive tools can only be used if a cars power if above a certain threshold
Killing other players is fun but not required to win the race
Finishing the race or completing a lap or making progress around the track grants X

Where X is something I can't make appealing enough to dissuade player from just deathmatching on the race track.

sentences:
How can I optimise a Minecraft-esque voxel world? I found Minecraft's marvelous large worlds extremely slow to navigate, even with a quad core and meaty graphics card.

I assume Minecraft's slowness comes from:

Java, as spatial partitioning and memory management are faster in native C++.
Weak world partitioning.

I could be wrong on both assumptions. However, this got me thinking about the best way to manage large voxel worlds. As it is a true 3D world, where a block can exist in any part of the world, it is basically a big 3D array [x][y][z], where each block in the world has a type (i.e BlockType.Empty = 0, BlockType.Dirt = 1, etc.)

I assume that to make this sort of world perform well, you would need to:

Use a tree of some variety (oct/kd/bsp) to split all the cubes out; it seems like an oct/kd would be the better option, as you can just partition on a per cube level not a per triangle level.
Use some algorithm to work out which blocks can currently be seen, as blocks closer to the user could obfuscate the blocks behind, making it pointless to render them.
Keep the block object themselves lightweight, so it is quick to add and remove them from the trees.

I guess there is no right answer to this, but I would be interested to see peoples' opinions on the subject.  How would you improve performance in a large voxel-based world?

sentences:
How to prevent a sprite to move in an angle that will lead to collision I have two sprites that can move in any angle. The sprites are rectangular.

I created bounding boxes for both the sprites. These boxes rotate whenever the sprite rotates. They always surround the sprite and only the sprite. (Exact fit).

I have succesfully implemented collision detection for the two bounding boxes. I did this by checking wether box1 contains any of the vertices of the box2, and the opposite. (I know this way is not perfect, since it is possible for two rectangles to intersect without having each other's vertices inside themselves, but for my needs it's good enough).
So now I know when the two sprites collide.

But I have a problem with reacting when the two sprites collide.

When these sprites collide, I want to prevent them from overlapping each other (any more than a few pixels). In other words, upon collision, I want to allow the sprite to move only in a direction where it won't go deeper into the other sprite.

As I said, each sprite can move freely in any angle (the game is for two players, each controls a sprite).

EDIT:
To word it differently - Upon collision of two sprites, I need to find out the range of angles a sprite can move, that will allow it to to move out of the collision - this is so I can prevent the user from moving the sprite in any other angle, upon collision.

How can I do that? Thank you for your help

sentences:
Restrict render in Blender is not working I click "Restrict renderability", so that everything except the item I want to export is grayed out. However, it still exports lights and everything when I import it into Unity.

How can I fix this?

sentences:
How do I handle Isometric collision detection? I would like to make an isometric run-jump style platformer. The player should be able to jump on top of platforms above the floor, hit the side of objects etc.

I'll be using a 2D game engine so I wouldn't like to emulate full 3D collision for dimensions I'm not using.

I'm thinking objects in the game should be placed using: X, Y, width, height, and Z for depth.

Using those values, how should I detect collisions?

sentences:
Controlling Source Image From Script I am trying to make a health system where hearts display how much health you have. On each heart, I have an Image component. I am trying to control what source image the Image component uses from a script, but it is not letting me. I read the documentation for the Image component here and it has no sprite property. This is my code:

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

public class HeartScript : MonoBehaviour
{
    public GameObject heart1;
    public GameObject heart2;
    public GameObject heart3;
    public Sprite halfHeart;
    public Sprite fullHeart;
    public Sprite emptyHeart;
    private double playerHealth = 3;

    // Update is called once per frame
    void Update()
    {
        if(playerHealth == 2.5)
        {
            heart1.GetComponent<Image>().image = fullHeart;
            heart2.GetComponent<Image>().image = fullHeart;
            heart3.GetComponent<Image>().image = halfHeart;
        }
        else if(playerHealth == 2)
        {
            heart1.GetComponent<Image>().image = fullHeart;
            heart2.GetComponent<Image>().image = fullHeart;
            heart3.GetComponent<Image>().image = emptyHeart;
        }
        else if(playerHealth == 1.5)
        {
            heart3.GetComponent<Image>().image = emptyHeart;
            heart2.GetComponent<Image>().image = halfHeart;
            heart1.GetComponent<Image>().image = fullHeart;
        }
        else if(playerHealth == 1)
        {
            heart3.GetComponent<Image>().image = emptyHeart;
            heart2.GetComponent<Image>().image = emptyHeart;
            heart1.GetComponent<Image>().image = fullHeart;
        }
        else if(playerHealth == .5)
        {
            heart3.GetComponent<Image>().image = emptyHeart;
            heart2.GetComponent<Image>().image = emptyHeart;
            heart1.GetComponent<Image>().image = halfHeart;
        }
        else if(playerHealth == 0)
        {
            heart3.GetComponent<Image>().image = emptyHeart;
            heart2.GetComponent<Image>().image = emptyHeart;
            heart1.GetComponent<Image>().image = emptyHeart;
        }
    }

    public void RemoveHealth()
    {
        playerHealth = playerHealth - 0.5;
    }
}

How do I change the sprite the heart uses from a script?

sentences: 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:
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:
How can i save field member value of Scriptable Object when it changed on inspector at runtime? Class Foo(monobehavior) has a scriptableObject and it is exposed to Inspector.
When i change its value on inspector on runtime, it is saved.
but when i try to change its value by script on runtime, it is never saved.
what the different?

and is there a way to save changed value of scriptableObject on runtime? without using json.. or something.

Thanks and sorry for my bad english.

sentences: How do I implement space partitioning in entity component system? My systems work on components without needing to now anything about entities. I want to implement simple grid partitioning, so each entity will be given a cell based on its current position. But how will systems know which components to update and how? For example: CollisionSystem must check collision between each components within a cell, but CollisionComponents must be somehow attached to the grid for system to know what collision to test, which doesn't seem like a good solution. What should I do?

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:
Exporting WebGL For Mobile Browsers I was asked by a client to create a pretty simple 3D game that will be embedded on a website, a plain landing page that will contain the game and will be played on mobile devices.
The game itself has no complexity whatsoever, not in the functional aspect and not in the lighting/shaders aspect - the basic functionality is a simple finger swipe in order to "throw" a ball.
I have checked and concluded that opening a webGL game on mobile devices might cause issues and only high-end devices can run the game smoothly.
My question is -
Is there a go-to solution or any solution in which I can develop the game on Unity and build it for webGL in a way that it will be compatible with mobile devices?
Or my only option is to develop the game using plain JS?

sentences:
Is it possible to write a game with a HTML5+REST service architecture? As a side project I'd like to program a board game similar to Twilight Struggle. For this pet project I'd like to satisfy several non functional requirements:

The core logic must be written in Haskell
If I succeed, I'd like to sell it in platforms like Steam, Google Play and Apple Store.

The Haskell requirement limits me a bit about the range of frameworks to use and the Haskell+SDL2 route doesn't seem very mature when talking about porting to mobile platforms (maybe I'm wrong but I haven't found any easy tutorials on the topic).

So I've thought about an HTML5 Canvas talking to the Haskell core either through REST calls or websockets. The HTML5 canvas will be contained in a Cordova application or similar when in the mobile. What do you think about this approach in terms of:

feasibility
robustness
portability
software engineering
whatever other concern you might have

sentences:
Blocks / tiles aren't responding to clicks I've recently finished a tutorial, UE4 Slide Puzzle by Nicholas Thompson. Halfway through the second tutorial, I found out that the blocks / tiles wouldn't respond to my clicks. For example, when I clicked on a tile, it wouldn't print out a Hello message.
I have watched the tutorial so many times already, I've searched it up, looked at my code thoroughly, and I can't find any problems. Here are my blueprints:

Event Graph
Get Move To (Function)

After some debugging, I found out that the problem occured at the start of the function, Mesh Clicked in the Event Graph.
Please help, it would be greatly appreciated. Thank you!

sentences: Displacement Mapping opengl-es I need to do an application similar to this Morfo. And I posted a question here where the answer states the solution is "Displacement Mapping" . And I googled this to do it in opengles. I couldnt get how to start and implement this in opengles. Can someone give me some starter on this?

sentences:
Unity - Raw Image Size scaled to Photoshop I'm just a beginner in Unity, so basically, I want to find out the exact measurement unity of the raw image so that I can now design in photoshop. I tried in Pixels in photoshop but when I import it in unity, it seems that the image is stretched out. I also tried mm, cm, inch but none of these worked. How to scale it so that my designed image's dimensions in photoshop will be exactly the same as the dimensions in unity? How to scale it?

I tried pixels in photoshop but the image is stretched out indicating that it is not the right measurement unit.

sentences:
Brief pause after keypress After i press and hold the key it goes forward once then pauses for a second or less then goes forward on forever. My problem is the brief pause I cant locate the issue. Thanks for your help.

    while(game){
        while (SDL_PollEvent(&e)){
            mainChar.manageEvents(e);
        }
        background.renderChar();
        mainChar.renderChar();
        SDL_RenderPresent(ren);

    }
void Character::manageEvents(SDL_Event event)
{
    switch(event.type){
        case SDL_KEYDOWN:
            KEYS[event.key.keysym.sym] = true;
            printf("true");
            handleInput();
            break;
        case SDL_KEYUP:
            KEYS[event.key.keysym.sym] = false;
            printf("false");
            break;
        default:
            break;
    }
}
void Character::handleInput()
{
    if(KEYS[SDLK_a]) {
        dst.x--;
    }
    if(KEYS[SDLK_d]) {
        dst.x++;
    }
    if(KEYS[SDLK_w]) {
        dst.y++;
    }
    if(KEYS[SDLK_s]) {
        dst.y--;
    }
}

sentences:
2D Driving Game with Unity I'm trying to make a 2D car driving game in Unity and I'm having problems with my code.

I am able to move forward,backward,turn left/right using arrow key from my present code

using UnityEngine;
using System.Collections;

public class CarControll : MonoBehaviour {

// Use this for initialization
float speedForce = 15f;
float torqueForce = -200f;
float driftFactorSticky = 0.9f;
float driftFactorSlippy = 1;
float maxStickyVelocity = 2.5f;
float minSlippyVelocity = 1.5f;

bool move=false;
public bool forwardArrow=false;
public bool backwardArrow=false;

public bool rightTurn=false;
// Use this for initialization
void Start () {

}

void Update() {

    move=true;
}

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

    Rigidbody2D rb = GetComponent<Rigidbody2D>();

    float driftFactor = driftFactorSticky;
    if(RightVelocity().magnitude > maxStickyVelocity) {
        driftFactor = driftFactorSlippy;
    }

    rb.velocity = ForwardVelocity() + RightVelocity()*driftFactor;

    if( Input.GetButton("Accelerate") || Input.GetButtonDown("Forward") || Input.GetKeyDown(KeyCode.UpArrow)) {
        Debug.Log ("Uparrow....................................................");
        rb.AddForce( transform.up * 20);

    }

    if( forwardArrow==true) {

        rb.AddForce(transform.up*0.5f);
    }

    if(backwardArrow==true) {

    rb.AddForce( transform.up * -speedForce/25f );
    }

    if(Input.GetButton("Brakes") || Input.GetButton("Backword") || Input.GetKeyDown(KeyCode.DownArrow)) {

        rb.AddForce( transform.up * -speedForce/2f );
    }

        float tf = Mathf.Lerp (0, torqueForce, rb.velocity.magnitude / 2);
        rb.angularVelocity = Input.GetAxis ("Horizontal") * tf;

}

Vector2 ForwardVelocity() {

    return transform.up * Vector2.Dot( GetComponent<Rigidbody2D>().velocity, transform.up );
}

Vector2 RightVelocity() {

    return transform.right * Vector2.Dot( GetComponent<Rigidbody2D>().velocity, transform.right );
}

public void MoveForward()  //forward button
{
    forwardArrow = true;
    backwardArrow = false;
}

public void MoveBackward() backward button
{
    backwardArrow = true;
    forwardArrow = false;
}

public void RightTurn()  //right button
{

    rightTurn = true;
}

}

I have added four button(Forward,backward,right,left).Now I need to move the car using this button. The car is moving Forward,backward using the button but when Press the right/left button the car is not Turing left/right while move.But its working perfectly on key press.Can anyboady help solving this issue

sentences:
How can I generate isometric sprites based on a 3d model? I'm wondering about the following:

I'd like to create isometric sprites for a game that I'm currently developing.

Rather than asking an artist to draw numerous sprites (which will be quite costly), I'd prefer to purchase a 3d model, for a platform such as Blender or 3DS Max, in order to render these models at different angles in an isometric perspective.

Depending on the level of detail, for each angle (0-359 degrees), I would need a sprite. Is there a specific script or feature available in either Blender, 3DS Max or a similar tool, that would suit my purpose?

Thanks a heap!

sentences:
Apparent FPS drop despite clear CPU usage drop in profile window I have an unusual performance drop (or visual choppiness) that isn't showing in the profile window at all like I'd expect.

When using Vegetation Studio Pro and AQUAS together, I get what looks like a serious FPS drop when I look up at the sky (away from terrain) or back down at the terrain.

However, the moment always coincides with a major drop in CPU usage (seen in the following pic). I've never seen performance issues like drop cpu usage - usually they appear as major spikes, reaching higher (meaning lower FPS) on this chart.

I'm not used to the newer Unity profile window, so I may be missing some obvious clues, but what could cause such a perceived FPS drop when the cpu usage drops?

Why does the VSync category seem to disappear for a period of time?

I'm unable to reproduce the effects when I turn off VSPro or AQUAS. Whatever the real cause is, it seems related to them being used together. I don't see any indication of the same issue when I use them individually.

Edit1: The issue goes away when I disable the Caustics system in AQUAS. It's a projector system. I still don't understand what specific issue the profiler is communicating to me.

sentences:
How to share constant variables between Compute Shaders? So, I have two compute shaders A and B (using unity and HLSL). Right now, before every dispatch, I send my mouse coordinates to both of them every update.
So, from my understanding, you can actually determine which register the mouse coordinates go to like so:
 float2 mxy :register(c1); // at the top of the shader

And by declaring this in both shaders, you can actually avoid sending the mouse coordinates twice.
The problem is, that this does not work! I've tried making cbuffers as well, but to no avail. (I don't actually know how to work with cbuffers on the CPU side that said)
TLDR: why can't I share variables between two compute shaders using float2 mxy :register(c1); ?

sentences:
Can you run a websocket client in EU4 server mode? Is it possible to build a websocket client (eg using blueprints) and then package this into an EU4 server (like suggested here).
If so, would this mean that the EU4 server's websocket client could then connect to a different server app being run using say javascript or golang?

sentences: How can I use a custom payload name for my GameMaker game? I have finished compiling my GameMaker Studio .win file. I then copied the Runner.exe binary to the game's directory to run it. The issue I face is that unless I name the game's payload "Data.win" the launcher asks me to manually browse for the payload. How can I use a name other than Data.win and have the launcher run as if it uses the default name?

sentences:
AR Foundation video player in Unity without Vuforia I am trying to follow this mini tutorial and I can detect an image and replace it with my 3D object. The object is an AR Session Origin tracked image prefab, but when I try to add a Video Player instead, nothing happens.
I was using Unity 2019.2 and got an error when trying to put the video player on the object, then searched about it and Unity fixed that issue on 2019.3.
I am now using 2019.3 and don't get the error anymore, but there is also nothing on the screen when the image is detected.

sentences:
What are reasons for input polling vs. input events? I noticed people use both - but is there any empirical evidence when it's better to use one over the other?

This is related but not quite a 'why use either' or even 'why use both': Polling vs event driven input

sentences:
Agents going to the same position So more often than not I have a case where two agents get the same destination vector3.

This causes some hiccups because they won't be able to get to their target because they block for one another.

I was thinking that I am not the only one who has faced this issue and was wondering what you guys do to fix such an issue?

An example of this could be if I want my agents to go to the nearest tree and chop it down. Since both agents have the destination which is the trees transform they will go to the same position.

sentences:
How to play a sound by C# that is linked to the object with AudioSource? I trying to play a sound while the player is ontriggerenter. The sound is linked to the object with a AudioSource component. But notting happened.

using UnityEngine;
using System;
using System.Collections;

public class FloatBehavior : MonoBehaviour {

    Vector2 floatY;
    float originalY;

    public float floatStrength = 1;

    AudioSource triggerAudio;                                    // Reference to the AudioSource component.

    void Start () {
        this.originalY = this.transform.position.y;
        triggerAudio = GetComponent <AudioSource> ();
        Debug.Log (triggerAudio);
    }

    void Update () {
        transform.position = new Vector3(transform.position.x,
                                         originalY + ((float)Math.Sin(Time.time) * floatStrength),
                                         transform.position.z);
    }

    // OnTriggerEnter 2D
    void OnTriggerEnter2D(Collider2D other) {

        // If gameObject comes in contact with player
        if (other.gameObject.tag == "Player") {
            // Play the hurt sound effect.
            triggerAudio.Play ();
        }

    }

}

Trying to debug, but the triggerAudio object will retrieve: woodstump 3 (UnityEngine.AudioSource) UnityEngine.Debug:Log(Object) FloatBehavior:Start() (at Assets/C#/Objects/FloatBehavior.cs:17).

What am I missing in my script? Should I use AudioClip also?

sentences:
XNA - positioning after rotation I have a turret with a 2 gunbarrels. The turret rotates towards my mouse. So far no problem. When it creates a few bullets and positions them at the end of the gun barrels.

Here is the problem. It only works the moment the gun is point upwards. The moment it rotates the end of the gun barrels have moved ofcourse, thus the bullets don't spawn at the end of the gun battels, but at the place the where the gun barrels are when the turret is pointing upwards.

How can I check where the end of the gun barrels are the moment it rotates?

EDIT:
With the following code it positions the bullet next to turret, not at the end of the gun barrels.

To see what I mean:

    Vector2 _bulletPosition = new Vector2();
    _bulletPosition.X = (float)((Math.Cos(_rotation)) * _barrelLenght) + _position.X;
    _bulletPosition.Y = (float)((Math.Sin(_rotation)) * _barrelLenght) + _position.Y;

_rotation = the angle the turret is rotated at.

_barrelLenght = the length of the barrels.

_position = the position of the turret.

EDIT 2:
With this code I get the bullets right between the 2 gun barrels.

    _bulletPosition.X = (float)((Math.Cos(_rotation - (float)(Math.PI / 2))) * _barrelLenght) + _position.X;
    _bulletPosition.Y = (float)((Math.Sin(_rotation - (float)(Math.PI / 2))) * _barrelLenght) + _position.Y;

With this code I get the 2 bullets at the right end of the gun barrels, but only when the turret is pointing upwards.

    _bulletPosition.X = (float)((Math.Cos(_rotation - (float)(Math.PI / 2))) * _barrelLenght) + _position.X + bulletSpawn.X;
    _bulletPosition.Y = (float)((Math.Sin(_rotation - (float)(Math.PI / 2))) * _barrelLenght) + _position.Y + bulletSpawn.Y;

I have to get the bulletSpawn relative to the end of the gun barrels position.

EDIT: THE FIX I FOUND

I found a fix that worked

    //Create Matrix with rotation value
    Matrix rotationMatrix = Matrix.CreateRotationZ(_rotation);
    //Create Vector2 with offset from turret center to end of barrel.
    Vector2 _bulletPosition = point;
    //Do a transform with the bulletPosition Vector2 and the rotationmatrix
    _bulletPosition = _position + Vector2.Transform(_bulletPosition, rotationMatrix);

sentences:
How to implement a mechanic of entering a town I am planning a game played on a 2-D map, where some spots are "towns". When the player walks into a town, he enters a high-resolution map of this town; when he exits the town, he returns to the low-resolution map of the world (as in e.g. Ultima 4). My question is how to implement this enter/exit mechanism in Unity? I thought of two approaches:

The world map and each of the town maps is a different scene. Entering/exiting a town is implemented by loading the appropriate scene using the scene manager.
There is a single scene, but the maps are geographically separted. For example, the world map is in coordinates 1...256, town A map is in coordinates 301...364, town B map is in 401...464, etc. Entering/exiting a town is implemented by moving the player and the camera to the appropriate map.

Is there a better approach? What approach is commonly used to implement this mechanism?

sentences:
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:
Playing multiple sounds in Unity5 I have multiple AudioClips that I have attached to a GameObject and I'm trying to play them when certain conditions are met.  Each clip is in an array and I have each array item attached to a variable.  I'm also getting the GameObject's Audio Source.  My problem is, I can't get the clips to actually play, how do I get them to do so?

C#

private Rigidbody playerCar;
private AudioSource engine;
public AudioClip[] carSounds = new AudioClip[3];
AudioClip accelerate;
AudioClip toppedOut;
AudioClip idle;
private bool accelerating;
private bool idling;
private bool maxed;

void Start(){
    playerCar = GetComponent<Rigidbody>();
    engine = playerCar.GetComponent<AudioSource>();
    carSounds = playerCar.GetComponents<AudioClip>();
    idle = carSounds[0];
    accelerate = carSounds[1];
    toppedOut = carSounds[2];
    idling = true;
}

void Update(){
    if(idling){
        engine.PlayOneShot(idle);
        accelerating = false;
        maxed = false;
    }
}

Editor

For further clarification, here is the exact error Unity is giving me.

ArgumentException: GetComponent requires that the requested component 'AudioClip' derives from MonoBehaviour or Component or is an interface.
UnityEngine.GameObject.GetComponents[AudioClip] () (at C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineGameObjectBindings.gen.cs:100)
UnityEngine.Component.GetComponents[AudioClip] () (at C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineComponentBindings.gen.cs:183)
MoveCar.Start () (at Assets/Scripts/MoveCar.cs:28)

Line 28 is carSounds = playerCar.GetComponents<AudioClip>();

sentences:
Spawn rates and variable time steps How would I work a spawning algorithm into a sim engine with variable time steps?

If each engine step is, say, 1/30 of a second and I have some event occur with a 0.001 probability each step, how do I translate this to an engine with a variable time step? At the end of 1 second I could have nothing spawned or (in a very unlikely event) I could have as many as 30 spawned.

Now if the engine hasn't done an update for a full second, how can my spawner simulate the same behaviour and probabilites? What if my steps are much smaller, say 1/100 or 1/1000 of a second?

What algorithms can I use?

sentences:
Rotating and Translating a Node in Horde3D with Matrices and Quaternions I have been trying to learn how to use the Horde3D rendering engine for the past couple of days,
and so far I have managed to learn a decent amount and integrate Bullet Physics with it as well.

My problem is in my maths for rotating and translating a node in Horde3D to keep it in sync with Bullet Physics.

I have a terrain and a sphere, both of which are in the Bullet Physics dynamics world.
The sphere drops from the sky and hits the terrain and everything works fine and collides/moves around as it is supposed to.

The problem is that I can successfully translate the 3D model in Horde3D to stay in sync with the position of the sphere shape in Bullet Physics,
but as soon as I try to introduce rotation things start to go wrong.

It's a bit difficult to describe so I have uploaded a video of the problem to YouTube (below).
Basically, the green wireframe is the Bullet Physics sphere shape, and the brown sphere is the sphere at the Horde3D node.

Everything is fine while the sphere is falling, because there is no rotation, but as soon as it hits the terrain and rotation
is supposed to take place the Horde3D node moves in a completely different direction to the Bullet Physics wireframe.

You can see what I mean by watching the video here: http://www.youtube.com/watch?v=Yi_DJIWpxOo&feature=youtu.be

I assume this is probably a quaternion/multiplication/matrix/order of multiplication error of some kind, but I can't figure it out myself.

Horde3D provides two ways that I know of to set a node's position.

They are:

h3dSetNodeTransform (http://www.horde3d.org/docs/html/_api.html#h3dSetNodeTransform)
h3dSetNodeTransMat (http://www.horde3d.org/docs/html/_api.html#h3dSetNodeTransMat)

I could use h3dSetNodeTransform and set all of the Euler angles, but Bullet Physics provides a quaternion,
so I would rather try and use translation and rotation matrices instead of converting the quaternion to Euler angles etc.

For calculations I am using GLM, if that makes any difference, although I don't think it should do.

The code that handles the updating of the Horde3D node is as follows:

btTransform trans;

sphere_body->getMotionState()->getWorldTransform(trans);

// getOrigin() returns the absolute coordinates, so I am keeping
// track of them to make sure I translate the correct amount
glm::vec3 sphere_cur_pos = glm::vec3(
    trans.getOrigin().getX(),
    trans.getOrigin().getY(),
    trans.getOrigin().getZ()
);

glm::mat4 sphere_node_matrix, matrix_t, matrix_r;

const float *matrix_floats;
h3dGetNodeTransMats(sphere_node, 0, &matrix_floats);

sphere_node_matrix = glm::make_mat4(matrix_floats);

matrix_t = glm::translate(
    sphere_node_matrix,
    sphere_cur_pos - sphere_last_pos
);

// sphere_last_pos is declared earlier in the code
sphere_last_pos = sphere_cur_pos;

btQuaternion quat = trans.getRotation();

matrix_r = glm::rotate(
    matrix_t,
    quat.getAngle(),
    glm::vec3(quat.getAxis().getX(), quat.getAxis().getY(), quat.getAxis().getZ())
);

h3dSetNodeTransMat(sphere_node, glm::value_ptr(matrix_r));

The above code produces the behaviour you can see in the YouTube video.

If I remove the rotation matrix and just use:

h3dSetNodeTransMat(sphere_node, glm::value_ptr(matrix_t));

then everything works fine and the sphere node stays in sync with the Bullet Physics wireframe, but there is of course then, there is no rotation.

Can somebody point out what I am doing wrong?

If any more information is needed just let me know and I will update the question.

sentences:
Best practices of texture size I wanted to know how should I determine a good texture size ?
Currently, I always create UV texture that are 1024x1024px but if I create for example, a big house with a 1024px texture size, it will looks pretty bad.

So, should I create different texture size (512, 1024, ...) for different mesh size like this ? :

or is it better to always do high-resolution texture and then reduce it in the software (ie : increase the LODBias settings in UDK reduce the size of the texture) ?

Thanks for your answer.

ps : sorry for my english !

sentences:
How do you handle pathfinding for non-tilemap 2d games? What methods do you use to handle path finding in non-tiled 2D games?
Tilemap based methods can use A* and 3D has NavMesh available.
The only success I’ve had is with raycasts but it doesn’t seem like a great way to handle things with hand draw sprites or uneven terrain.

sentences:
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:
Having some trouble with my frustum checking code I'm trying to check if a bounding sphere is either within or intersecting my frustum. It mostly works but there are cases where it should and it doesn't. The frustum is made up of 6 planes which have a position, direction and normal vector. Sphere has a center and radius value. The frustum is created from translating the mouse coordinates into 3d. If anyone can point me in the right direction it would be greatly appreciated. I'm not great at Maths either.

static float DistanceFromPointToPlane(Plane p, DirectX::SimpleMath::Vector3 point) {
    float distance = p.normal.Dot(point - p.position);

    return distance;
}

static bool IsSphereInsidePlane(DirectX::SimpleMath::Vector3 sphereCentre, Plane p, float radius) {
    float d = DistanceFromPointToPlane(p, sphereCentre);
    return -d > radius;
}

static bool SphereIntersectsPlane(DirectX::SimpleMath::Vector3 sphereCentre, Plane p, float radius) {
        return fabs(DistanceFromPointToPlane(p, sphereCentre)) <= radius;
    }

sentences:
How to create a forest game scene in unity3d? I am pretty new to game development. I have started using unity3d.

I have created simple games for which I have used plane (3d gameObject). Now, I want to move a step forward I want to create a forest with mountain and trees. So, I went through few tutorials and concluded terrain (3d Object) will be best fit.

Issue: My player falls down from the terrain due to gravity and if i disable gravity then my player flies up in y axes when moved over mountains. What is the way i can create terrain with gravity and so that my player doesn't fall from the terrain.

Can anyone throw light on how do overcome above mentioned issue.

sentences:
Can I set the unity camera to have the same position in a real world? I have a problem about setting the camera in the unity to have the same extrinsic parameters as my real world camera to the origin. So let's me describe my problem step by step.

I have a camera in a real world and Its extrinsic to an aruco plane was calculated. So I use the Aruco plane(You can think as a plane reference) as an world origin(0, 0, 0).
The in my unity, I want to set my camera to have the same extrinsic as my real world camera. So I take an translation to set the Position in unity transform toolbox. And set the rotation by convert my rotation matrix from extrinsic to the euler's angle and set it to x, y, z rotation.
So I test this by use the unity properties named "camera.cameraToWorldMatrix". You can treat this as an extrinsic of the unity camera transform to the world coordinates(0, 0, 0). So this value should equal to my extrinsic since it's use the same rotation euler's angle. But unfortunately it's not.

So how can i solve this problem or there's a simpler way to set the cameraToWorldMatrix equal to my extrinsic parameters.

For more information : All of my coordinates system is respect to opengl (In Opencv coordinates system are negated in y and z axis from opengl)

1.Here's my extrinsic that i got from the solvePnp() function. This is an extrinsic from camera to my aruco plane. Then I use this [R|T] to get the euler's angle rotation and translation. And in my image also show my euler and translation. So this extinsic is also my expected extrinsic.

I use these euler's angle rotation and translation to set my camera in unity.

Here's my code to map from the camera coordinates to the aruco plane coordinates

def mapBallToArucoPlane(camera_coordinates, rvec, tvec):
  # Mapping ball in left camera_coordiantes to the camera_coordinates(Aruco plane coordiantes)
  # By using the inverse of [rvec|tvec]; Since [rvec|tvec] is the transformation matrix from Aruco->camera, but we need camera->Aruco
  R = cv2.Rodrigues(rvec)[0]
  # print(R.shape, cv2.Rodrigues(rvec))
  T = np.array(tvec)
  # print(R.shape, T.shape, np.hstack((R, T)).shape,
  # np.linalg.pinv(np.hstack((R, T))).shape)
  arucoPlaneToCameraMatrix = np.vstack((np.hstack((R, T)), np.array([0, 0, 0, 1])))
  cameraToArucoPlaneMatrix = np.linalg.inv(np.vstack((np.hstack((R, T)), np.array([0, 0, 0, 1]))))
  plane_coordinates = cameraToArucoPlaneMatrix @ camera_coordinates
  plane_coordinates = plane_coordinates/plane_coordinates[-1]

  return plane_coordinates, arucoPlaneToCameraMatrix

My output extrinsic. (Should be the same as above)

Thank you very much.

sentences:
How do you market assets that are niche but that those people definitely want? I just got done canvasing/surveying developers, and it is clear that there is a market for a few niche categories of audio assets that I suspected would be useful to them. While the overall category of assets is commonly desired, it can only be broken down into separate categories, which individually are completely niche due to the wide variety of games nowadays.

How can a niche but useful asset be effectively marketed to (mostly indie) game developers? It is known that there are people out there who want it, but the likelihood of a completely random individual wanting it is low. So if the asset was created, and there was low competition among asset producers for it, how could one ensure at least some of those people find it (without actually cold-calling them)?
I would explain in more detail, but I don't want to come off as though I'm trying to advertise anything here.

sentences:
Ways to describe resouces I have one way - xml and code like this:

<Texture file="file_name.jpg">
  <Sprite id="ID_SPRITE_1" coordinates="0 0 64 64"/>
  <Sprite id="ID_SPRITE_2" coordinates="64 0 64 64"/>
  <Sprite id="ID_SPRITE_4" coordinates="128 0 64 64"/>
</Texture>

then parse and load it, when application starts, then use resources by id.

What another ways to describe paths and propeties of resources used by developers and why?

sentences:
How should I plan the inheritance structure for my game? I am trying to write a platform shooter in C++ with a really good class structure for robustness. The game itself is secondary; it is the learning process of writing it that is primary.

I am implementing an inheritance tree for all of the objects in my game, but I find myself unsure on some decisions.

One specific issue that it bugging me is this:

I have an Actor that is simply defined as anything in the game world. Under Actor is Character. Both of these classes are abstract.

Under Character is the Philosopher, who is the main character that the user commands. Also under Character is NPC, which uses an AI module with stock routines for friendly, enemy and (maybe) neutral alignments.

So under NPC I want to have three subclasses: FriendlyNPC, EnemyNPC and NeutralNPC. These classes are not abstract, and will often be subclassed in order to make different types of NPC's, like Engineer, Scientist and the most evil Programmer.

Still, if I want to implement a generic NPC named Kevin, it would nice to be able to put him in without making a new class for him. I could just instantiate a FriendlyNPC and pass some values for the AI machine and for the dialogue; that would be ideal.

But what if Kevin is the one benevolent Programmer in the whole world? Now we must make a class for him (but what should it be called?). Now we have a character that should inherit from Programmer (as Kevin has all the same abilities but just uses  the friendly AI functions) but also should inherit from FriendlyNPC.

Programmer and FriendlyNPC branched away from each other on the inheritance tree, so inheriting from both of them would have conflicts, because some of the same functions have been implemented in different ways on the two of them.

1) Is there a better way to order these classes to avoid these conflicts? Having three subclasses; Friendly, Enemy and Neutral; from each type of NPC; Engineer, Scientist, and Programmer; would amount to a huge number of classes.

I would share specific implementation details, but I am writing the game slowly, piece by piece, and so I haven't implemented past Character yet.

2) Is there a place where I can learn these programming paradigms? I am already trying to take advantage of some good design patterns, like MVC architecture and Mediator objects. The whole point of this project is to write something in good style.

It is difficult to tell what should become a subclass and what should become a state (i.e. Friendly boolean v. Friendly class). Having many states slows down code with if statements and makes classes long and unwieldy. On the other hand, having a class for everything isn't practical. 3) Are there good rules of thumb or resources to learn more about this?

4) Finally, where does templating come in to this? How should I coordinate templates into my class structure? I have never actually taken advantage of templating honestly, but I hear that it increases modularity, which means good code.

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:
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:
Why is my Simplex Noise appearing in four columns? I'm trying to make a Texture out of Simplex noise, but it keeps appearing like this regardless of how big or small scale is:

The following code is used to produce the image's color date:

private Color[,] GetSimplex() {
    Color[,] colors = new Color[800, 600];

    float scale = colors.GetLength(0);

    for (int x = 0; x < 800; x++) {
        for (int y = 0; y < 600; y++) {
            byte noise = (byte)(Noise.Generate(x / scale, y / scale) * 255);
            colors[x, y] = new Color(noise, noise, noise);
        }
    }

    return colors;
}

sentences:
What is a trainer from a coder prospective? What steps usually takes or modify a trainer?

How a trainer can change the way a game behaves?

Edit:
with the word trainer I mean the applications, usually a single executable, that can unlock and give extra points and features during a gameplay, kind of a series of cheats that you can activate with this executable.

sentences:
Andengine Box2D Physics "disappearing"? I have problems with my PhysicsWorld in Andengine GLES20. Sometimes when i first load my app and level there is no velocity added to my bodies. they also rotate slower as it seems. This also happens in Game when I press the home button and then go back into the app.
Any ideas? Is this fixed in the AnchorCenter Branch?

sentences:
Realistically drivable car I want my car to be realistically drivable (like in real life...)

Unfortunately all I did so far is Rotate the whole vehicle using A and D; and AddForce in forward-backward direction using W and S (which didn't prevent it from moving sideways and yes, I am using Rigidbody)

I'm assuming I'd have to let front wheels rotate independently from the rest of the car, but how do I use them to move the car? And how do I force the car to move only in the direction of the wheels while still making drifting at high speeds possible?

sentences:
Game Maker - Create Instance When Health Is 0 I have five objects: obj_Boss, obj_bossHealth, obj_GameOver, obj_BtnOK, and obj_rec2.
This is what I want. When obj_Boss has no more health, obj_GameOver and obj_BtnOK will appear.
This is my first method:
In obj_bossHealth, I have these events:

Create Event: set var global.bossHealth to 100
Draw Event: draw_healthbar

In obj_Boss, I have these events:

Collision with obj_rec2: set var global.bossHealth relative to -1.5; destroy the instance (other)
No More Health: create instance of obj_GameOver; create instance of obj_BtnOK

This is my second method:
In obj_bossHealth, I have these events:

Create Event: set var global.bossHealth to 100
Draw Event: draw_healthbar
Step Event: if global.bossHealth is equal to 0 then create instance of obj_GameOver and create instance of obj_BtnOK

In obj_Boss, I have these events:

Collision with obj_rec2: set var global.bossHealth relative to -1.5; destroy the instance (other)

The result of both methods:
obj_GameOver and obj_BtnOK won't appear. How can I fix this? Please explain your answer. Thanks.
I add some images: method1 method2

sentences:
text wrapping on a texture applied to a 3D model How would I create and implement a texture of text that wraps around a 3D model? The texture will just be white and you should be able to add text to it, but I need to create this so that when the texture is wrapped around a model of a person, the person is then composed of lines of text and the lines should not be distorted.

In my head the way I would do it is to put the flattened texture in a file, and draw text on to it. Is this the best way? are there any issues that I'm unaware of that I might come across?

sentences:
Unity - Handling external data files I'm moving from an old game dev tool to Unity, and wondering how to go about handling external data files.
In my previous program I'd set up external (txt/ini) files like this:
[Group1]
Count=1
1=Hello

[Group2]
Count=2
1=lol
2=end

Then I would simply reference which group name and line I wanted to pull.
What's the equivalent to this in unity? I see I can import TextAssets but I can't find functions to pull select data from it. Do these exist?
Do I have to split by lines, loop through them all and convert it into groups (lists) manually? What is the standard method for doing this? Is it moving to xml files?

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:
Noise when using SSLR (Screen Space Local Reflections) When I tried to apply reflections to my scene, I ran into the problem of noise:

My fragment shader code:

#version 330 core

uniform sampler2D normalMap; // in view space
uniform sampler2D depthMap; // in view space
uniform sampler2D colorMap;
uniform sampler2D reflectionStrengthMap;
uniform mat4 projection;
uniform mat4 inv_projection;

in vec2 texCoord;

layout (location = 0) out vec4 fragColor;

vec3 calcViewPosition(in vec2 texCoord) {
    // Combine UV & depth into XY & Z (NDC)
    vec3 rawPosition = vec3(texCoord, texture(depthMap, texCoord).r);

    // Convert from (0, 1) range to (-1, 1)
    vec4 ScreenSpacePosition = vec4(rawPosition * 2 - 1, 1);

    // Undo Perspective transformation to bring into view space
    vec4 ViewPosition = inv_projection * ScreenSpacePosition;

    // Perform perspective divide and return
    return ViewPosition.xyz / ViewPosition.w;
}

vec2 rayCast(vec3 dir, inout vec3 hitCoord, out float dDepth) {
    dir *= 0.3f;

    for (int i = 0; i < 20; i++) {
        hitCoord += dir;

        vec4 projectedCoord = projection * vec4(hitCoord, 1.0);
        projectedCoord.xy /= projectedCoord.w;
        projectedCoord.xy = projectedCoord.xy * 0.5 + 0.5;

        float depth = calcViewPosition(projectedCoord.xy).z;
        dDepth = hitCoord.z - depth;

        if(dDepth < 0.0) return projectedCoord.xy;
    }

    return vec2(-1.0f);
}

void main() {
    vec3 normal = texture(normalMap, texCoord).xyz * 2.0 - 1.0;
    float depth = texture(depthMap, texCoord).r;
    vec3 screenPos = 2.0 * vec3(texCoord, depth) - 1.0;
    vec3 viewPos = calcViewPosition(texCoord);

    // Reflection vector
    vec3 reflected = normalize(reflect(normalize(viewPos), normalize(normal)));

    // Ray cast
    vec3 hitPos = viewPos;
    float dDepth;
    float minRayStep = 0.1f;
    vec2 coords = rayCast(reflected * max(minRayStep, -viewPos.z), hitPos, dDepth);
    if (coords != vec2(-1.0)) fragColor = mix(texture(colorMap, texCoord), texture(colorMap, coords), texture(reflectionStrengthMap, texCoord).r);
    else fragColor = texture(colorMap, texCoord);
}

Normal map:

Reflection strength map (only red chanel):

sentences:
Cleaner implementation of this draw call Simple static class that will write out a message that is passed in.  The SpriteSheet is 256x256 and the A-Z starts at line 240 and the 0-9 starts at 248.  Each character is 8x8.  I hate the if (ix >= 32) and wondered if there is a tidier way of doing this?  I'm pleased it's only one Draw call, but it looks ugly.

public static class Font
{
    private static String chars = "" + //
        "ABCDEFGHIJKLMNOPQRSTUVWXYZ      " + //
        "0123456789.,!?'\"-+=/\\%()<>:;     " + //
        "";

    public static void Draw(string msg, SpriteSheet sprites, SpriteBatch spriteBatch, int x, int y, Color color)
    {
        msg = msg.ToUpper();
        for (int i = 0; i < msg.Length; i++)
        {
            int ix = chars.IndexOf(msg[i]);
            int w = 0, h = 240;
            if (ix >= 0)
            {
                if (ix >= 32)
                {
                    w = 32;
                    h = 248;
                }
                spriteBatch.Draw(sprites.Sheet, new Rectangle(x + i * 8, y, 8, 8), new Rectangle((ix - w) * 8, h, 8, 8), color);
            }
        }
    }
}

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:
Component based game design and sharing mesh data Lets say you make a game engine, and you have several GameObjects and every GameObject have a list of components that you can add or remove.

Lets say there is a MeshComponent who has vertices, normals etc. If several GameObjects have the same MeshComponent, there will be a lot of memory waste. Of course there are many ways to implements this but I want some good advice how to solve this? How do components share data that is not going to be modified?

sentences:
Ridiculous Error on Unity 5.6.4p4 Method Name doesn't exists I am facing a strange issue on Unity version 5.6.4p4
The code compiles and runs just perfectly fine in editor but when I build it for android I see an error message saying that my method doesn't exists. I have checked many times but there is no such issue. I am not doing anything wrong. Can anyone suggest what could be wrong ?

sentences:
Angle between start and current rotation I'm facing problem of the operations on rotations. I have a wheel with a start rotation of (0, 0, 0). The player has to rotate wheel 270 degrees in Y axis either left or right.
During the rotation slider should indicate progress of the rotation. For example if player rotated 135 degrees in right direction, slider is 50% filled to the right.
The thing is that I'm not sure how to get the value of which the player rotate the object.
For example when I start rotating right my angle changes from (0, 0, 0) to (0, 359, 0). How can I resolve this issue so it knows that change from (0, 0, 0) to (0, 359, 0) means player rotated only +1 degree?

sentences:
How to trim a sprite? I have a spritesheet:

var spriteSheet = new createjs.SpriteSheet({
    // ...
    frames: { width:520, height:600, regX: 260, regY:300 }
    // ...
});

I am computing it's physics body as follows:

var bounds = entity.sprite.getTransformedBounds();
halfWidth = bounds.width / 2,
halfHeight = bounds.height / 2,
// ... Create the physics body

The result:

The ground is a solid body, and the sprite is dynamic. I would like the sprite's feet to touch the actual ground and get rid of the whitespace around the sprite (above, below and sides).

The problem is that there is whitespace in the spritesheet. Each frame is 520x600 in the sheet. I have lots of frames and I would rather not go through each of them to figure out each one's exact dimensions.

Is this possible? Also I'm new to game dev, it's very fun. Is this what applications like TexturePacker are for?

sentences:
How do I efficiently perform collision detection on an NxN rectangle grid? I have a simple level that is constructed from an NxN rectangle grid. Some of the rectangles are walls, and some of them are the path. The player is allowed to move only on the path they are on and also the path rectangles on the grid. So I have two kinds of rectangles in the grid:

"path"
"wall"

The player is a sprite above the grid. I want to efficiently find if the player is colliding with the wall. I want to loop through the rectangles, to see if they intersect. What is the best method?

sentences:
How do I zoom in and out in a fully tiled based game I am currently developing a tile based game in Java and trying to add the option of zooming. I do the zoom by reducing and enlarging the tiles, but the problem is that it creates spaces between the tiles.
The default form, in which I created all of these tiles from the beginning:

When zooming out - width -= 2 and height -= 2:

Bigger zooming out:

My question is very simple, how do I zoom in and out on a tile based world?

sentences:
Calculate the intersection depth between a rectangle and a right triangle I'm working on a 2D platformer built in C#/XNA, and I'm having a lot of problems calculating the intersection depth between a standard rectangle (used for sprites) and a right triangle (used for sloping tiles).  Ideally, the rectangle will collide with the solid edges of the triangle, and its bottom-center point will collide with the sloped edge.

I've been fighting with this for a couple of days now, and I can't make sense of it.  So far, the method detects intersections (somewhat), but it reports wildly wrong depths.  How does one properly calculate the depth?  Is there something I'm missing?

sentences:
Convert transform from world to local space I have a hierarchical node system. Given a world space transform, I need to obtain the transform for a specific node in local space.

My Node class has the following method.

public void worldToLocal(Matrix4 world, Matrix4 local) {
    if (dirty) update();
    local.set(worldInverse).mul(world);
}

worldInverse is the inverse of the node's world transformation matrix.

I'm using LibGDX, so this is equivalent to doing:

LOCAL = T^-1 * WORLD

T^-1 being the inverse of the node's world transform. However, this doesn't seem to be working correctly.

Let's say we have a node at (2, 4, 0) rotated 180 degrees along its Z axis.

    Node node = new Node();
    node.setPosition(2.0f, 4.0f, 0.0f);
    node.rotate(new Vector3(0.0f, 0.0f, 1.0f), 180.0f);

Now, the point (1, 7, 0) should be (2, 1, 0) in local space for that node.

    Matrix4 local = new Matrix4();
    Matrix4 world = new Matrix4();
    Vector3 pos = new Vector3();

    world.translate(1.0f, 7.0f, 0.0f);
    node.worldToLocal(world, local);
    local.getTranslation(pos);

However, I get (1, -3, 0).

I'm using this operation to translate from world space Bullet body transforms to local node transforms.

sentences:
How to handle data for a competitive multiplayer games I am kinda new to Multiplayer Games and I am really wondering how I should handle my data

Should each player send and update their data to the database (server) everytime one of their essential variables changes (like health or ingame currencies), or should they save the data as long as the game is running and then update the data all at once at the end of, lets say, each round?

I was thinking about using Firebase and Unity and here's a scenario:

Let's say 2 players connect to a game. Then one of them gets damage and the other one gets gold. Does the data change get sent to the FireBase Database immediatly or should I just update everything when the round ends/they disconnect?

sentences:
What approach would you take to develop an old school game? Possible duplicate: What technology should I use for a web-based game?

I have agreed to show my child how to develop software. He wants me to help him develop a game.

If you were me then what approach would you take to develop an old school game?

I was thinking about an old school game that you can pick up and play them straight away, where there is no "learning curve". This is because we prefer playing these types of games. On top of that I want to be able to say things like "I made the game engine, the AI, he did the scoring system and .. and .. and ..".

I intend to run it in a browser, to target a broad range of platforms. I was thinking to use mainly C# and Silverlight.

So, if you were me then what approach would you take to develop an old school game?

EDIT

Could I use XNA? Is it free? Does it plug into Visual Studio 2010?

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:
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:
How to make Unity game moddable with scripting in a friendly way? I am building a game in Unity using C# and visual studio. I want to make it possible for users to write code in some scripting (for modding purposes) without necessarily opening the source. What are my best options?

I'd prefer well-supported and battle-tested options that integrate well with Unity and visual studio, but I am willing to do a fair amount of work myself as long as it makes scripting as seamless as possible for future modders.

sentences:
2d Collision detecton axis aligned boxes I have recently run into some trouble with my collision detection. My game is composed of a map made out of axis aligned squares. The player has an x and y velocity, and I want to know how I can find out with which side the player is colliding. So if they move left, I want to know that if they collide with a square, and with which side they collide with it.

Edit: Basically, what I want to know is how to find out which face the player is colliding with.

sentences:
Where can I find fonts which I can distribute with an open source game? I want to be able to release my game as open source, and I need to be able to distribute font files with my game. Where can I find fonts which I can use in this way, and what font licenses should I be looking for?

Are there any further considerations if I want to release my game under GPL rather than a less restrictive open source license such as BSD?

Edit: In response to Olie saying that the question is unclear: My main problem is that fonts which I find on the Internet either do not clearly state their licenses, or have licenses which do not make it clear whether I can distribute the font with software. I know very little about font licenses, but I am looking for sources of fonts which guarantee that the fonts are basically open source / creative commons / public domain / some other font license which allows me to distribute it with a game without paying license fees.

sentences:
glUniformMatrix4fv OpenTK equivalent Very simple and quick question which surprisingly I couldn't find an answer to over the internet: what is the equivalent of glUniformMatrixfv for opentk? I've browsed all the 7 overloads of GL.UniformMatrix4 and none of them seems correct to me and/or I have found any example usage for.

E.g. if I have a

Matrix4[] matrices;

variable (properly initialized etc..) that I want to map on a

mat4 matrices[2];

in glsl, which GL.UniformMatrix4 overload should I use?

P.S. Using OpenTK.Next NuGet package version 1.1.1616.8959

sentences:
Performance Issues Using Lua in C++ I'm making an engine in C++ with Lua for its scripting language (using LuaBridge as the binding).
I have a lot of entities and those entities have components. One of the components on those entities is a script component. Every time I want to call a different function from a Lua script, I always have to call luaL_dofile. If I call this with more than 20 scripts, my game takes too much time per frame reducing it to 5 FPS on my machine. Every script has an Init, FixedUpdate, Update, and Shutdown function. For every script, I call all of these functions in order.
Is there a way to reduce the latency introduced in each frame from using Lua?

Some pseudo code of my usage of LuaBridge:

    // In Update function:
    for (int i = 0; i < scripts.size(); i++)
    {
        luabridge::LuaRef func = luabridge::getGlobal(L, "Update");
        if(func.isFunction())
          func(dt);
    }

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:
Is it possible to index different vertex attributes with different index buffers? Let's say I've got a vertex which is part of many triangles. I can just reference those with an index buffer.  But is it possible to share it's position but have different texture coords for each triangle?  e.g.

+--+--+
|\ |\ |
| \| \|
+--X--+
|\ |\ |
| \| \|
+--+--+

The center vertex, X, is shared. If I want each square to have a different texture then I would need to store four distinct UV coordinates for the centre vertex.  Is this only possible by creating it four times?

sentences:
What would cause my script generated buttons and text to show in Unity and not on my phone? I am using Unity 5 and the built in GUI tools.  My static GUI shows up just fine which makes me think it's not a text/font issue or some such. Again, it all looks good in the Unity editor when I hit Play.

I have tried the different canvas options as far as what space to work in and how to scale. I have messed with the build options.  I have tried turning batching off. I have tried building for Android 4 through 5. (Ice Cream, Jelly Bean, etc) I have tried turning dynamic text on and off.  I have ensured the Buttons and text are made to be children of the canvas. I have only uploaded the game onto my Galaxy Note 4. I moved my background texture out of screen space in case it somehow covered the buttons on Android.

https://www.youtube.com/watch?v=Hk1UjXwOR08

sentences:
How to get the maximum installed version of DirectX? Okay, So I would like my engine to detect weather or not it can use DirectX 10, if it can't it defaults to DirectX 9.0c but, the function DirectXSetupGetVersion() will only return Versions 5 through 9. Could someone point me to what could tell me the device capabilities?
Thank you for your time.

sentences: Can I use the 2d physics engine in a 3d game (or viceversa) in Unity? This is entirely for performance. The 2D physics are less expensive, but I require 3D for some scenes. I never need both at the same time. I know you can have 2D with an orthographic perspective in a 3D engine, but what I want is really the physics engine. Also, is there a way of turning off these engines? I´ve made most collisions from scratch and am only using  them for some raycasts at the beginning and for some collider/rigidbody.casts in not every, but a lot of frames (If I understand correctly, they are calculated from the physics engine in each FixedUpdate()).

sentences:
What C++ libraries can be used in game development I'm currently in the planning stage for my next game, and since I've been away from C++ for a while I have some questions about helpful libraries. I plan on making a 2D game with SDL, constructing my own simple 2D engine. I plan on making this game for the PC.

What libraries would you recommend to make this process easier?

What about unittests?

What about an enforce operator to throw exceptions?

int a = 1;
enforce(a == 2); //Throws an exception,

Specifically, i'm looking for general purpose libraries, that implement that make my life easier (like boost). Also, a helpful library for physics/collision, AI, XML file parsing (specifically working with the Tiled map editor), and any others that you guys have used that are useful in a 2D game.

sentences:
TouchPanel.GetState() Returns wrong touch locations XNA I am trying to make my Desktop game playable on IOS. I have a Button.cs class, which has this code in it:

   public bool IsPressed(TouchCollection touches)
    {
        for (int i = 0; i < touches.Count; i++)
        {
            if (TouchTriggerRect.Contains(touches[i].Position.X, touches[i].Position.Y))
            {
                return true;
            }
        }

        return false;
    }

Where TouchTriggerRect is a rectangle describing the button coordinates on the screen

I have noticed that the IsPressed method only works on some buttons (specifically, on all the buttons on the left side of the screen in Landscape orientation)

After some debugging, I understood that the IsPressed method doesn't work on the buttons placed on the right side of the screen because touches made there are getting offset by some random X and Y

Any suggestions on how to fix this bug? Or what can be causing this problem?

P.S I am using a Monogame.Extended.Camera2D in my game

P.S.S I have tried to build a simpler app, which draws red circles at all the touch locations it receives, and it workes perfectly. So, the problem is not in my devices

P.S.S.S This is how I get my touch Input: touches = TouchPanel.GetState();

UPD:

This is the code I use for my transformations:

var bounds = camera.BoundingRectangle;

Vector2 pos;

//The button is basically a rectangle, so I give it an X, a Y, a Width and a Height
JumpButton = new Button(bounds.Right - 80, bounds.Bottom - 74, 64, 64);
pos = camera.WorldToScreen(JumpButton.X, JumpButton.Y);
JumpButton.ScreenX = pos.X;
JumpButton.ScreenY = pos.Y;
//Same for all the other buttons

And this is the code for TouchTriggerRect

public Rectangle TouchTriggerRect => new Rectangle((int)ScreenX, (int)ScreenY, Width, Height);

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:
How to make progress bar in EditorWindow with Threading in Unity? I need to make a progress bar in EditorWindow. To do this, I perform the function of calculations in threads: Thread thread = new Thread (_worker.Work); thread.Start (); The class itself emitting calculations looks like this for me (Worker.cs):

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using System.Threading;
public class Worker
{
    private bool _cancelled = false;
    public void Cancel() {
        _cancelled = true;
    }
    public void Work() {
        for (int i = 0;i<=100;i++) {
            if(_cancelled)
                break;

            Thread.Sleep(50);
            Debug.Log("i="+i);
            ProcessChanged(i);
        }
        WorkCompleted(_cancelled);
    }
    public event Action<int> ProcessChanged;
    public event Action<bool> WorkCompleted;
}

The PlacementObjects: EditorWindow (PlacementObjects.cs) class looks like this:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEngine.UI;
using System.IO;
using System.Linq;
using System;
using System.Text.RegularExpressions;
using UnityEditor.IMGUI.Controls;
using UnityEngine.Profiling;
using Newtonsoft.Json;
using System.Threading;

public class PlacementObjects : EditorWindow
{
    private Worker _worker;
    bool pressedbool = false;
    float scaleSlider = 0;
    float scaleMinSlider = 0;
    float scaleMaxSlider = 100;
    [MenuItem("Window/PlacementObjects")]
    static void Init()
    {
        _windowPlacementObj = (PlacementObjects)EditorWindow.GetWindow(typeof(PlacementObjects));
        _windowPlacementObj.titleContent = new GUIContent("Работа с объектами и terrain");
    }
    ...
    void OnGUI()
    {
      DrawFooter();
    }
void DrawFooter()
{

    GUILayout.BeginArea(FooterSection);
        GUILayout.BeginVertical();

            if (!pressedbool)
            {
                GUILayout.Label("Выберите json");
                GUILayout.BeginHorizontal();
                    stringTextFieldURLjsonfile = GUILayout.TextField(stringTextFieldURLjsonfile);
                    if (GUILayout.Button("Обзор...", GUILayout.Width(100)))
                    {
                        stringTextFieldURLjsonfile = EditorUtility.OpenFilePanel("Выбрать json", "", "json");
                    }
                GUILayout.EndHorizontal();
                if (GUILayout.Button("Старт"))
                {
                    _worker = new Worker();
                    _worker.ProcessChanged += worker_ProcessChanged;
                    _worker.WorkCompleted += _worker_WorkCompleted;
                    pressedbool = true;
                    // ProcessJSONPlaceONmap();
                    Thread thread = new Thread(_worker.Work);
                    thread.Start();
                }
            } else {
                if (GUILayout.Button("Стоп"))
                {
                    pressedbool = false;
                }
                scaleSlider = EditorGUI.IntSlider(new Rect(3, 20, position.width - 6, 15), scaleSlider+"%", Mathf.RoundToInt(scaleSlider), scaleMinSlider, scaleMaxSlider);
                EditorGUI.ProgressBar(new Rect(3, 45, position.width - 6, 20), scaleSlider / scaleMaxSlider, scaleSlider+"%");
                Repaint();
            }

        GUILayout.EndVertical();
    GUILayout.EndArea();
}
private void _worker_WorkCompleted(bool cancelled)
{
    Action action = () =>
    {
        string messeg = cancelled ? "Процесс отменён" : "Процесс завершён!";
        Debug.Log("messeg=" + messeg);
        pressedbool = true;
    };

    // if (InvokeRequired)
    //     Invoke(action);
    // else
    //     action();
}
private void worker_ProcessChanged(int progress)
{
    Action action = () => {scaleSlider=progress;};
    // if (InvokeRequired)
    //     Invoke(action);
    // else
    //     action();
    action();
}
}

This code does not update the progress bar.

Found an example of Asynchronous tasks / methods
But here it is not clear how to call StartCoroutine (LoadingRoutine ()) from EditorWindow.

sentences: How do I use Ogre with CodeBlocks? I want to start writing games using ogre in combination with the CodeBlocks compiler but am struggling with the installation. I got the latest version of the compiler as well as the ogre engine from their respective websites. I have installed the compiler but cannot find my way in the integration of ogre though I read their installation guide, which I found confusing.I need clear step by step guide please.

sentences:
Atmospheric scattering sky from space artifacts I am in the process of implementing atmospheric scattering of a planets from space. I have been using Sean O'Neil's shaders from http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter16.html as a starting point.

I have pretty much the same problem related to fCameraAngle except with SkyFromSpace shader as opposed to GroundFromSpace shader as here:
http://www.gamedev.net/topic/621187-sean-oneils-atmospheric-scattering/

I get strange artifacts with sky from space shader when not using fCameraAngle = 1 in the inner loop. What is the cause of these artifacts? The artifacts disappear when fCameraAngle is limtied to 1. I also seem to lack the hue that is present in O'Neil's sandbox (http://sponeil.net/downloads.htm)

Camera position X=0, Y=0, Z=500. GroundFromSpace on the left, SkyFromSpace on the right.

Camera position X=500, Y=500, Z=500. GroundFromSpace on the left, SkyFromSpace on the right.

I've found that the camera angle seems to handled very differently depending the source:

In the original shaders the camera angle in SkyFromSpaceShader is calculated as:

float fCameraAngle = dot(v3Ray, v3SamplePoint) / fHeight;

Whereas in ground from space shader the camera angle is calculated as:

float fCameraAngle = dot(-v3Ray, v3Pos) / length(v3Pos);

However, various sources online tinker with negating the ray. Why is this?

Here is a C# Windows.Forms project that demonstrates the problem and that I've used to generate the images:
https://github.com/ollipekka/AtmosphericScatteringTest/

Update: I have found out from the ScatterCPU project found on O'Neil's site that the camera ray is negated when the camera is above the point being shaded so that the scattering is calculated from point to the camera.

Changing the ray direction indeed does remove artifacts, but introduces other problems as illustrated here:

Furthermore, in the ScatterCPU project, O'Neil guards against situations where optical depth for light is less than zero:

float fLightDepth = Scale(fLightAngle, fScaleDepth);

if (fLightDepth < float.Epsilon)
{
    continue;
}

As pointed out in the comments, along with these new artifacts this still leaves the question, what is wrong with the images where camera is positioned at 500, 500, 500? It feels like the halo is focused on completely wrong part of the planet. One would expect that the light would be closer to the spot where the sun should hits the planet, rather than where it changes from day to night.

The github project has been updated to reflect changes in this update.

sentences:
How to share values between different shader programs? I am using Unity but this might concerns all type of shaders. I would like to know if this is possible to share values between different shader pass.Let's imagine that I am computing something in the first pass and I would like to use this value in a second pass, is it possible ?

If this is possible, how can I do that ?

sentences:
How can I create a 3D point cloud in WPF? I need to render some 3D points with WPF. How can I do this?

I need an easy and fast solution to just render this point cloud. No lights, no texture, no sound, no physics, just colored 3D points in a space with rotating camera.

How can I do this without having to learn Direct3D/OpenGL/any complex 3D engine?

sentences:
Avoiding particle "pop in" affect for Unity2D starfield I've adapted a 3D starfield particle system for top-down 2D use. I'm aiming for what's shown in this video, which was based on this tutorial.

I've managed to reproduce the 3D particle system and I have a top-down view working correctly.

However, I'm trying to figure out what needs to change to achieve the effect in the first video. The difference for me is that this logic randomly spawns new particles within a radius around the camera, which in 3D seems fine, as if the stars are appearing as you travel towards them. But in "2D" this breaks because the player/camera can only move in two dimensions.

I need to find a way for stars to spawn off-screen, they can't "pop in" randomly as the player moves. Unfortunately I'm not sure how the developer of that video achieved it.

using UnityEngine;
using System.Collections;

public class Starfield : MonoBehaviour {
    private Transform tx;
    private ParticleSystem particleSystem;
    private ParticleSystem.Particle[] points;

    public int starsMax;
    public float starSize;
    public float starDistance;
    private float starDistanceSqr;

    void Awake() {
        particleSystem = GetComponent<ParticleSystem>();
        tx = transform;
        starDistanceSqr = starDistance * starDistance;
    }

    void Start() {
        points = new ParticleSystem.Particle[starsMax];

        for (int i = 0; i < starsMax; i++) {
            points[i].position = Random.insideUnitSphere * starDistance + tx.position;
            points[i].color = Color.white;
            points[i].size = starSize;
        }
    }

    void Update() {
        for (int i = 0; i < starsMax; i++) {
            if ((points[i].position - tx.position).sqrMagnitude > starDistanceSqr) {
                points[i].position = Random.insideUnitSphere.normalized * starDistance + tx.position;
            }
        }

        particleSystem.SetParticles(points, points.Length);
    }
}

sentences:
Limiting GIF animation rate to its frame delay in JME3 I've figured out how to render a GIF image using this library as follows:

@Override
public void simpleUpdate(float tpf) {
    if (bgFrameIndex > 0) {
        guiNode.detachAllChildren();
    }

    guiNode.attachChild(bgNodes.get(bgFrameIndex));

    if (bgFrameIndex < bgDecoder.getFrameCount() - 1) {
        ++bgFrameIndex;
    } else {
        bgFrameIndex = 0;
    }
}

where bgDecoder is a GifDecoder, bgNodes is an ArrayList of nodes that contain the GIF's frames, and bgFrameIndex is the current frame index to render. By default, the tpf (ticks per frame) variable is at around 0.01 seconds, when I want to limit it to the frame delay of the current frame without changing the FPS of the entire game. What's the best way to do this?

EDIT

My new code from the answer of @1000ml (I also fixed frame removal):

private float bgFrameDelay = bgDecoder.getFrameCount() > 0 ? bgDecoder.getDelay(bgFrameIndex) : 0;

@Override
public void simpleUpdate(float tpf) { // ticks per frame
     bgFrameDelay -= tpf;

     if (bgFrameDelay < 0F) {
         bgFrameDelay = bgDecoder.getDelay(bgFrameIndex) / 1000F;

         if (bgFrameIndex > 0) {
             bgNodes.get(bgFrameIndex - 1).removeFromParent();
         }

         guiNode.attachChild(bgNodes.get(bgFrameIndex));

         if (bgFrameIndex < bgDecoder.getFrameCount() - 1) {
             ++bgFrameIndex;
         } else {
             bgFrameIndex = 0;
         }
     }
 }

sentences: Best 3rd Party DRM Solutions What are the best 3rd party DRM solutions available from a user experience, development integration, and security perspective?

sentences:
How can I render a texture to a polygon in SDL2? A fake 3D problem I am working on a fake 3D game recently.  The game is based on the perspective principle and using angular perspective.  Here is a screen shot:

But the problem is that the walls and floor displayed are polygons, not exact rectangles.  I draw them preline.  Now I want to put some imgs on them.  How can I render a texture to a polygon?  How do I make texture exactly fill the area?  How do I give the plane a more 3D-like feel?

sentences:
Sound Management Help I just learned how to implement a Sound Manager and put sounds into it. The problem is, I'm making a platformer and I have a player, and two different types of enemies who all have footstep sounds. The main issue is that I'm playing all the sounds from the same sound manager and I made the footstep sounds of the player to play like this:
  public void PlayMoveSound()
{
    if(audioSrc.isPlaying == false)
    {
    randomMoveSound = Random.Range(0,5);
    audioSrc.PlayOneShot(moveSounds[randomMoveSound]);
    }
}

I don't know how else to make it NOT sound like its playing 100 times per second so I did this. This gave birth to the issue that the looping audio which is the player's movement sound now blocks me from doing the same thing for the other characters' footstep sounds since it uses the same "audioSrc" AudioSource. Any hints on how different I can create a system for semi-looping audio?

sentences:
How much mathematics is involved in video game development? I'm average at maths. Maybe a tad below average. If I was going into a normal career I'd be fine. But I want to create video games. Is a career in video game development still on the cards for me?

I want to be a creative director, but I don't just want to write screenplays, create 3D models and draw concept art (areas I excel at.). I want to actually touch the code. I've been learning web development now for 8 months, and I understand pretty in depth concepts such as serverside fragment caching, and it would damn depressing to throw all those skills away and just hire some programmers when I move into video games. I want to develop alongside them. Is developing video games (with a team) similar to web development, in that it's all OOP and logic but with relatively little arithmetic? I'm not on about creating a 3D engine, I'm sure that's filled with physics and theorems of momentum, I'm on about simply using a ready made 3D engine.

Do you need to be a substantially better at maths than most to develop video games?

sentences: Which image format is more memory-efficient: PNG, JPEG, or GIF? Which image format is more efficient to save memory? PNG, JPEG, or GIF?

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:
Generate random numbers without repetitions How to generate Random numbers without repeating any numbers in the given target like(1-5000) there should be no reparation and I should be able to get 5000 randomized numbers. I should be able to run the randomized as many times as the user wants,How to do with C#

For Sample
Target is (1-10)
No of times to run =2

First run:
5,4,6,8,3,1,2,0,7,10

second run
6,3,5,8,4,2,0,1,10,7

Like this I should be able to get the results as many times as I run..

sentences: Get collision time between two moving, non uniform Axis Aligned bounding boxes I have a problem finding the exact time of collision of two possibly moving or static objects. Both objects have AABB data (HalfExtents, Min, Max, Center vector and stuff) and a velocity vector. The objects, as I wrote, can move, but must not to. How can I get the exact collision time from now? Could you give me please a pseudo code, or at least some directions how can be this solved?

sentences:
Control stick map analysis I'm implementing this map of inputs (from the gamecube title Super Smash Bros. Melee) and translating it into code for my game:

The map is depicted using hardware coordinates (the square shape of the map) while the game itself limits the range of inputs to a circle (depicted by the gray circular outline).  If a hardware input is outside the range of the circular game input, then it is rounded down.  This is what causes the radial patterns.  Each colored section is a different output based on the input.  The gray square in the center is the deadzone of the stick.

The zones "fsmash", "usmash", and "dsmash" were easy to code in.  It was as simple as

if (pos.x > 0.80 || pos.x < -0.80) fsmash
if (pos.y > 0.66) usmash
if (pos.y < -0.66) dsmash

My question is how to incorporate the other 4 zones.  It's simple for "jab" as it is in the deadzone so it will be the else condition (when pos.x && pos.y == 0)
The inputs go out radially which seems to suggest it follows the same patterns as the larger zones.  When inputs are outside of the black circle I have drawn, they could be rounded down then I could simply do..

if (pos.x > 0) ftilt
if (pos.x < 0) jab
if (pos.y > 0) utilt
if (pos.y < 0) dtilt
else jab

However I'm not sure of how I could implement it since the cutoff point for the outer zones was the actual implemented radius of the stick in game.  Any help would be appreciated or ask if I need to clarify anything.  Thanks!

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:
What are your favourite game-specific coding gems? I'll start off with John Carmack's the Fast Inverse Square Root in Quake III:

float Q_rsqrt(float number) {

  long i;
  float x2, y;
  const float threehalfs = 1.5F;

  x2 = number * 0.5F;
  y = number;
  i = * ( long * ) &y;
  i = 0x5f3759df - ( i >> 1 );
  y = * ( float * ) &i;
  y = y * ( threehalfs - ( x2 * y * y ) );

  return y;

}

sentences:
Is it unethical to make a game AI that is secretly non-competitive? In several games the AI is designed to give the player an easy time without their knowledge. This can be having a 0% chance to hit the first time you appear, enemy letting you sneak up on them by not turning around, or the lowering of difficulty when the player is hurt or has restarted several times.

I would be offended if at the end of a board game or sport I was told that a human had not tried their hardest.

Does the same ethics exist for an AI?

edit
As in the title, my main concern was keeping the handicap hidden from the player, for example, when playing a shooter it is reasonable to expect the player knows the AI has an artificial reaction time and poor aim but my question was about games that hide things such as enemies not using the best weapon or lowering their difficulty when the player is inured.

sentences:
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:
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:
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:
Fragment Shader Code returns weird values i've implemented a shader that produces a simple Radar Ping given a uniform time input. ShaderToy Proof of concept

Now i implemented this into my real Opengl GLFW GLAD C++ Core4.5Profile NVIDIA GTX960 environment and recieve only weird ouput when i use my own function call.

Why do i recieve such a weird output if i use a function call in opengl glsl?

PS: I have a feeling this has something to do with the precision and the call by value standards of glsl.

Thank you very much for any response, or even a hint where to look for help.

EDIT: The problem was as Kevin van der Velden described.

Result Images:

This is my shader Code:

    #version 330 core

    in vec2 v_TexCoord;
    out vec4 FragColor;

    uniform float u_time;

    // Generates a BnW Ping on normalized 2d coordinate system
    float RadarPing(in vec2 uv, in vec2 center,in  float innerTail,
                   in float frontierBorder, in float timeResetSeconds,
                   in float radarPingSpeed, in float fadeDistance,
                   in float currentTime)
    {
        vec2 diff = center-uv;
        float r = length(diff);
        float timeMod = mod(currentTime, timeResetSeconds) * radarPingSpeed;

        float circle;
        circle += smoothstep(timeMod - innerTail, timeMod, r) * smoothstep(timeMod + frontierBorder,timeMod, r);
        return circle;
    }

    void main()
    {
        //normalize coordinates
        vec2 uv = v_TexCoord; //move coordinates to 0..1
        uv = uv*2.; // translate to the center
        uv += vec2(-1.0, -1.0);
        //uv.x *= iResolution.x/iResolution.y; //correct the aspect ratio

        float color;
        // generate some radar pings
        float fadeDistance = 1.0;
        float resetTimeSec = 5.0;
        float radarPingSpeed = 0.3;
        vec2 greenPing = vec2(0.0, -1.0);

        //WITHOUT FUNCTION CALL
        //vec2 diff = greenPing-uv;
        //float r = length(diff);
        //float moduloTime = mod(u_time, resetTimeSec);
        //color = smoothstep(moduloTime - 0.25, moduloTime, r) * moduloTime + 0.025, moduloTime, r);

        //WITH FUNCTION CALL
        color += RadarPing(uv, greenPing, 0.25, 0.025,  radarPingSpeed, fadeDistance, u_time);

        //OUTPUT
        FragColor = vec4(color, color, color,1.0);
    }

sentences:
Converting a Google Sketchup file to 3DS? I have a couple models that I've made or found in Google Sketchup, and I want to be able to use them in some programs I have that only support 3DS.  What is the best way to convert, without paying for Sketchup Pro?

Right now sketchup can export to .dae, so a .dae to 3ds would be just as helpful :)

sentences:
Are very long floating point numbers a problem? Very simple question, but important: I was using a floating point number ('float') in C++ to handle movement speed, and it suddenly ran crazy. It turns out the speed increased very fast to 259614846795304004193338175520768.0. That's 33 digits, on a typical (non-double) floating point number. How is that even possible, and can it cause the rest of my program to derail? Or will this number simply be cut down to the 23 bits of significant digits that floating point numbers usually have?

(edit: This is not a bug hunt. I am simply trying to understand how a float can hold such a large number with perfect precision (it's not an exponent, because that would just leave a trail of zeroes after a few significant digits). I am not looking for flaws in my code, just a better understanding of how floating point numbers work, and how this can happen)

EDIT: The solution seems to be a mix of bits from several answers, so I don't know whom to assign as the correct answer. Floating point values are apparently assigned by exponent, which means that some numbers can be amazingly huge without losing precision, as long as they are precise exponents of 2 somehow. Mine was. I thought the size was limited to 23 bits, flat out. As soon as I started using variations of the number that were NOT precise exponents of 2, everything went crazy. Sorry for the radio silence, I had to figure this whole thing out experimentally, once I learned that about floating point numbers from various answers.

I seem unable to close the question. Could someone with proper clearance close it down? And thanks to everyone for the help, I am now far more enlightened regarding floating point numbers!

sentences:
Why is it possible to encounter a texture coordinate greater than 1 or less than 0 I'm studying a text about texture mapping and in the preparing to draw session, I read:

Define the texture wrapping parameters. This will control what happens when a texture
coordinate greater than 1.0 or less than 0.0 is encountered:

glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,wrap);
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,wrap);

where wrap is:
GL_REPEAT : specifies that this pattern will repeat (i.e., wrap-around) if transformed texture coordinates less than 0.0 or greater than 1.0 are encountered.

GL_CLAMP : specifies that the pattern will “stick” to the value at 0.0 or 1.0.

But there's no explanation what is the reason of encountering such texture coordinates?
For example suppose that I have just drawen a rectangle and I want to apply an image as a texture on it, is it possible to encounter such coordinates?

sentences:
Are there still advantages to using gl_quads? OK, I understand that gl_quads are deprecated, and thus we're not 'supposed' to use them anymore. I also understand that a modern PC when running a game using gl_quads is actually drawing two triangles.

Now, I've heard because of that a game should be written using triangles instead. But I'm wondering if, due to the specifics of how OpenGL makes that quad into two triangles, it is ever advantageous to use quads still?

Specifically, I'm currently rendering many unconnected quads from rather large buffer objects. One of the areas I have to be careful is how large the vector of floats I'm using to make/update these buffer objects get (I have quite a few extra float values per vertex, and a lot of vertices in a buffer - the largest buffers are about 500KB).

So it strikes me that if I change my buffer objects to draw triangles this vertex data is going to be 50% larger (six vertices to draw a square rather than 4), and take 50% longer for the CPU to generate.

If gl_quads still work, am I getting a benefit here, or is the 50% extra memory and CPU time still being used on OpenGL's automatic conversion to two triangles?

sentences:
How AlphaBlend Blendstate works in XNA 4 when accumulighting light into a RenderTarget? I am using a Deferred Rendering engine from Catalin Zima's tutorial:

His lighting shader returns the color of the light in the rgb channels and the specular component in the alpha channel. Here is how light gets accumulated:

Game.GraphicsDevice.SetRenderTarget(LightRT);

Game.GraphicsDevice.Clear(Color.Transparent);

Game.GraphicsDevice.BlendState = BlendState.AlphaBlend;

// Continuously draw 3d spheres with lighting pixel shader.
...

Game.GraphicsDevice.BlendState = BlendState.Opaque;

MSDN states that AlphaBlend field of the BlendState class uses the next formula for alphablending:

(source × Blend.SourceAlpha) + (destination × Blend.InvSourceAlpha),

where "source" is the color of the pixel returned by the shader and "destination" is the color of the pixel in the rendertarget.

My question is why do my colors are accumulated correctly in the Light rendertarget even when the new pixels' alphas equal zero? As a quick sanity check I ran the following code in the light's pixel shader:

float specularLight = 0;

float4 light4 = attenuation * lightIntensity * float4(diffuseLight.rgb,specularLight);

if (light4.a == 0)
light4 = 0;

return light4;

This prevents lighting from getting accumulated and, subsequently, drawn on the screen. But when I do the following:

float specularLight = 0;

float4 light4 = attenuation * lightIntensity * float4(diffuseLight.rgb,specularLight);

return light4;

The light is accumulated and drawn exactly where it needs to be. What am I missing? According to the formula above:

(source x 0) + (destination x 1) should equal destination, so the "LightRT" rendertarget must not change when I draw light spheres into it!

It feels like the GPU is using the Additive blend instead:

(source × Blend.One) + (destination × Blend.One)

sentences:
Accessing 3D texture data without normalized coordinates directly, but with filtering texelFetch() exists to access texture data with texture coordinates in "image dimensions", but texelFetch skips filtering.

In case of 2D textures, it's possible to use a rectangle texture sampler to access textures without normalized coordinates with filtering, but the same equivalent doesn't seem to exist for 3D textures.

Is this somehow possible with 3D textures?

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:
How do I test for collisions between two concave shapes decomposed into collections of convex polyhedra? I am using convex decomposition with SAT (separating axis theorem) and I generate two arrays of convex pieces, How do I submit my arrays to my collision detection method which only takes two arguments.

public MTV testCollision(BroadPhasePair pair) {
    Entity entity = pair.getBody();
    Entity id1 = pair.getBody();

    List<Convex> entityConvex = ConvexDecomposer.decompose(entity);
    List<Convex> id1Convex = ConvexDecomposer.decompose(id1);
    return null;
}

private MTV testCollision(Convex body,Convex id1) {
    float overlap = Float.MAX_VALUE;
    Vector3f smallest = null;
    Vector3f[] axis1 = body.getAxis();
    Vector3f[] axis2 = id1.getAxis();

    for(Vector3f axis : axis1) {
        Projection p1 = body.project(axis);
        Projection p2 = id1.project(axis);

        if(!p1.overlapps(p2)) return null;
            float o = p1.getOverlap(p2);
            if(o < overlap) {
                overlap = o;
                smallest = axis;

        }
    }

    for(Vector3f axis : axis2) {
        Projection p1 = body.project(axis);
        Projection p2 = id1.project(axis);

        if(!p1.overlapps(p2)) {
            return null;
        }else {
            float o = p1.getOverlap(p2);
            if(o < overlap) {
                overlap = o;
                smallest = axis;
            }
        }
    }

    MTV mtv = new MTV(smallest, overlap);
    return null;

}

I want to be able to somehow submit my array into the testCollision method.

sentences:
Fix my Flow Field pathfinding I'm developing prototype of Tower Defense/RTS game and I've implemented simple Flow Field grid. Here is the example (link).

How to use example: First click on S50, this will spawn additional units, then wait till all of them clump together, click on SET_BASE button and click on a free space, this will move the base (red circle) and they'll move to the new location. The problem is that if you click to a relatevely diagonal position, they'll all go straight to the target, while if you give them new order at the same y coordinate, they'll start clumping.

If you click several times to move units around, you'll notice that they're moving pretty well when you order them to move diagonally and clump in a line when going horizontally or vertically.

I ran out of ideas what to do next to fix this, what are yours?

A bit more info about my flow field: I do one pass of "Dijkstra distance" and then do second pass of detecting lowest distance neighbor and assign "vector" to that neighbor.

Then, about units movement - every unit every update reads "desired movement vector" from it's current cell, predits its movement, then checks if it will hit the wall, updates movement vector, then checks if it will hit other units and finally updates movement vector.

EDIT: Here's the source code of movement logic.(link)

And source of flow field generation (link)

I'm sorry for shitty code and stupid comments, it's all "prototyp-ish" as possible.

What I want is to achieve less "diagonal-horizontal" difference, because at the current state it's really seem underwhelming and it's unaccetable that you can move all units faster by zig-zagging them to their destination.

sentences:
Tile-based multiplayer game: server and client load I'm developing a multiplayer tile-based game (imagine habbo) and having some trouble with the movement. The idea is to click on a tile (target tile) so your avatar moves there and everyone can see you moving there. In order to do that, there's a pathfinding function.

My first approach was: the pathfinding function was in the client and everytime the avatar moved a pixel (guided by the pathfinder) it sent a message to the server which broadcasted this update. This was obviously mad.

My second approach was to send to the server just the target tile. The server broadcasted this target tile, and each client ran the pathfinding function for each avatar in movement. I found problems with this because of synchronization: imagine two users moving that pass through the same tile at different times, maybe in one client with a little lag it happens that they pass through the same tile at the same time, so the pathfinder will stop one of them, as you can't walk over another avatar. This will lead to different positions in each client.

I've read some cases where the pathfinder runs in the server, the client just send the target tile and receives every x mseconds an update from the server with the pathfinding calculations for every avatar in movement (even himself). The problem I find here is how to set this "x mseconds" and that it might mean a lot of load to the server, handling all the pathfinding calculations...

What are the pros and cons of each approach?

sentences:
Do I have to use vertexArray in opengl GLuint VertexArrayID;
glGenVertexArrays(1, &VertexArrayID);
glBindVertexArray(VertexArrayID);

As you can see from the above code, some tutorials use this before using opengl. But a tutorial that I am following, directly uses glGenBuffers  method and it works just fine. Hence I am totally confused what glGenVertexArrays. It is sad that it defines how buffer is used, but noone says in what way. Can you help me understand ?

sentences:
Client-Server MMOG & data structures sync when joining / playing After reading a few articles on MMOG architecture, there is still one point on which I cannot find much information: it has to do with how you keep in sync server data on the client, when you join, and while you play. A pretty vague question, I agree. Let me refine it:

Let's say we have an MMOG virtual world subdivided into geographical cells. A player in a cell is mostly interested in what happens in the cell itself, and all the surrounding cells, not more. When joining the game for the first time, the only thing we can do is send some sort of "database dump" of the interesting cells to the client.

When playing, I guess it would be very inefficient to do the same thing regularly. I imagine the best thing to do is to send "deltas" to the client, which would allow keeping the local database in sync.

Now let's say the player moves, and arrives in another cell. Surrounding cells change, and for all the new cells the player subscribes, the same technique as used when joining the game has to be used: some sort of "database dump".

This mechanic of joining/moving in a cell-based MMOG virtual world interests me, and I was wondering if there were tried and tested techniques in this domain.

Thanks!

sentences:
How can I determine a budget for RAM used (LRU involving VRAM, in particular) After some profiling, I've determined that one of my most expensive functions involves drawing text. As a solution, I'd like to implement a LRU type of cache that will "remember" the vertices, tex coords (etc) for a given string. This is particularly complicated because some of the resources involved reside in VRAM (most do, actually; I take a given string and convert it into a long sequence of vertices / tex coords / indices), while some reside in plain RAM.

If I knew what my limits were (in both respects) I could write a decent LRU cache system and probably buy myself a substantial performance gain. The primary target for this app is the Android platform, and as I understand it, most such devices share RAM with the GPU.

I'd appreciate any answers to this, whether they directly answer my question or not.

sentences:
Mirror problems after building game in unity Hi I am facing a weird problem in unity when I build a particular scene.

Here is the screenshot of how the mirror looks when I play the game from inside the unity editor:

And here is how it looks once I build this scene and then play it:

The quality settings at Edit->Project Settings->Quality are these:

And the player settings at File->Build Settings->Player Settings are these:

So how do I fix this? What do I need to change or is there any other entity?

sentences:
How to automate baking pizza in Corona SDK? I'm writing a game about making pizza in Corona SDK. When you buy chefs, the new chef is supposed to make some pizzas on its own like automation.

I tried everything I knew about, I couldn't think of anything that would do what I'd like so I ask you guys to help me.

Here is the code I think is relevant:

local widget = require("widget")

local pizzeria = display.newImage("background.png")
pizzeria.x=160
pizzeria.y=230
pizzeria:scale(1,1)

local pizzas=0
local chefs = 0
local pizzatext = display.newText( "Pizzas:", 100, 200, display.contentWidth*0.6, display.contentHeight * 0.7, native.systemFont, 16)
pizzatext:setFillColor( 10, 0, 0)

local pizzacount = display.newText(pizzas,165,200,display.contentWidth*0.7,display.contentHeight*0.7,native.systemFont,16)
pizzacount:setFillColor(10,0,0)

local chefstext = display.newText("chefs:",320,200,display.contentWidth*0.7,display.contentHeight*0.7,native.systemFont,16)
chefstext:setFillColor(10,0,0)

local chefscount = display.newText(chefs,363,200,display.contentWidth*0.7,display.contentHeight*0.7,native.systemFont,16)
chefscount:setFillColor(10,0,0)

local function pizzamaker( event )
  if ( "ended" == event.phase ) then
    pizzas=pizzas+1
    pizzacount.text=pizzas
  end
end

local function addchef( event )
  if("ended" == event.phase) then
    if(pizzas>=5) then
      chefs=chefs+1
      chefscount.text=chefs
      pizzas=pizzas-5
      pizzacount.text=pizzas
    end
  end
end

local pizzamaker = widget.newButton
{
  left = 100,
  top = 400,
  defaultFile="button.jpeg",
  overFile = "button.jpeg",
  label = "Make Pizza",
  height = 50,
  width= 100,
  onEvent = pizzamaker
}

local addchef = widget.newButton
{
  left = 100,
  top = 100,
  defaultFile="pizzachef.png",
  overFile="pizzachef.png",
  height = 50,
  width = 50,
  onEvent = addchef
}

sentences:
Intersystem communication in a ECS game Apologies if this question has been answered before, but after relentless searching I couldn't find anything.

As many, I've recently jumped on the ECS-bandwagon, and I am currently killing some time by making a modest ECS-game. The game is a somewhat simple 2D-platform game. It is programmed in plain JS.

The layout of the game is essentially as following:

The core of the game is the Engine, the Engine runs the game-loop and holds an EventManager, responsible for raising events, and an EntityManager, responsible for containing all components of all entities.

All logic is done by systems. The systems registers event-handlers (i.e. member-functions) with the EventHandler for specific EventTypes, which gets called when an event of that type is raised.

For example:

this.eventManager.registerHandler(EventType.EVENT_RENDER, this.render, null, this);

I recently switched from calling all systems relevant functions explicitly in the Engine to this pattern.

But over to my problem and question.

For rendering I have a RenderSystem. This system contains references to several type of drawable/animatable-components which it, you guessed it, renders.

Until recently, this system also contained a reference to another system, MapSystem, which spatially indexes all entities. The reason for this reference was to be able to call a function along the lines of

mapSystem.search(frame_bound);

effectively pruning away all entities not needing to be rendered.

So I have a couple of questions regarding this:

Is it very bad practice for systems to communicate directly? Something about it just doesn't smell right to me.

I see how it might severely complicate your code if you have say 100 systems, and each system holds references to many of the other systems. Hello O(n^2).
If I am not to hold inter-system references, how do I perform communication like described above?

My initial thoughts was to create an entity whose primary purpose were to hold the necessary information (i.e. all entities currently in the frame). Then let MapSystem write to and RenderSystem read from this entity.

But this also seems to be rather unclean to me. Especially as MapSystems search function might be useful to call in many different contexts. Creating an entity per calling-context doesn't really seem like a good way to go about it either.

TL;DR: Is it bad for systems in a ECS-game to communicate directly and hold references to each other?

sentences:
How to calculate origin and position of a weapon which should be "in hands"? I'm currently stuck with my game, which is from the top perspective. I'm currently using these sprites for player: (using the second at the top):

And here's what I use for my gun

My problem is that I am not sure how to calculate origin & position to make sure that gun is always in player's hands. This is my code for drawing player and gun

spriteBatch.Draw(Textures.Load("player"), new Vector2(playerPosition.X, playerPosition.Y), new Rectangle(35, 2, 27,27), Color.White, player.rotation, new Vector2(playerWidth / 2, playerHeight / 2), 1f, SpriteEffects.None, 1f);
spriteBatch.Draw(Textures.Load("Guns/deagle"), new Vector2(playerPosition.X, playerPosition.Y), null,                   Color.White, player.rotation, new Vector2(playerWidth / 2, playerHeight / 2), 1f, SpriteEffects.None, 1f);

With rotation of 0, I'd need to move my gun to playerPosition.Y + 15 to make sure gun is in guy's hands, but when I do it, it looks fine but as soon as I rotate him, it's even more weird than now.

Here's how it currently looks like, with my specified code above.

https://dl-web.dropbox.com/get/capture-14.mp4?w=40052a2d

All I need is to make sure that gun will be always in guy's hands

sentences: How to program (architecturally/organize) a set of customizable changes to a game? The floor of my game (tower defense) is composed by a set of cubes. I wish to change these on some of the waves. I have a list of the changes that need to be made on each wave in a floorController class. However, in order to decide which floor cubes should appear or disappear on each round, I had to assign each cube a bool for each wave (if this is set to true the floor changes in that wave). However this process is tedious and not ease to change and customize in order to experiment with the level. From an architectural programming perspective how can I better structure this system?

sentences:
Sending block chunks through TCP I am creating a 'Minecraft clone' and the game is going to be only multiplayer. I currently have a limited world (it's not going to be infinite) that is 512 chunks.

Each chunk is 16(X) * 16(Z) * 128(Y) of blocks.

Each block is represented by a byte. This means I have a 3D array of bytes that represents which block is in which position in the chunk (0 means Air). I got to the part where I want to send the world though the TCP connection.

I am using KryoNet for my multiplayer needs. Currently what I do is I flatten the 3D array to the highest Y coordinate that is not air, making my (16 * 16 * 128) array into a (16 * 16 * less than 128) array. After doing this I take the 3D array and flatten it into a 1D array. After doing that I have a 1D array of size ~32,000. Obviously sending the entire 32KB of data through the connection at once is stupid and it also crashes KryoNet.

My question is how would I efficiently go about sending 512 chunks (512*32 KB of data) through the connection?

I thought about separating the 1D array (32,000 bytes) into 32 packets each of 1KB of data but it seems odd to send 512 * 32 packets to send the world (~16,000 packets).
Is there any way to compress this data or send it in a more efficient way through my TCP connection? Obviously this is done once per session but still 16,000 seems a lot.

Progress update:

I have separated the chunks into 33 packets each, and I send them one after the other. It seems to be working well, but I have a slight ordering issue that is unrelated. At the times that it works it loads quite quickly and with no problem! If there is a more efficient way of going about this please do post it here!

sentences:
How to have RTS units move along un-even terrain? My current world is a flat 2D plane.
I want to make the terrain 3D, like hills, bumps, etc. If I tell a unit to go to a position (x, y) in 2D, how do I make sure the unit is always at ground level?
For example, if x, y is above the current position in 3D?
I am defining terrain height using a height map, and generating a simple mesh from it. Path-finding will remain flat 2-d, and can project to 3-d.

sentences:
Procedural 3D Environment Generation I am concerning a 3D Scroller game which is like Subway Surf or Temple Run. The thing I am confused about is their way of generating 3D environment. For example for 2D games like Flappy Bird, there is a camera and player which have fixed positions respect to the X axis. And the environment is being generated, moved into camera's viewport, and finally gets destroyed after getting out of viewport. I mean, player and camera does not move in general, the environment does.

Is this approach efficient by means of performance for 3D scrollers? Do they use a box which covers the camera's viewport, and when objects get out of the box, destroy them? Or do they create the environment via code as the player goes further, then make the camera follow the player and they are moving both? Is this a valid approach and what are the advantages or disadvantages of these implementations?

Thanks in advance!

sentences:
per-pixel collisions using Libgdx Java (is there existing class for this??)? I am making a simple side scrolling space shooter game using Libgdx and everything is going nicely. However until now I haven't been testing collisions for my players ship with other ships. I have lasers colliding with baddie ships using simple rectangle overlap method that exists already in libgdx.

But the "white/transparent" space around the edge of many of my sprites is quite a lot and when i am now applying the code to check collision with my player it is happening from a long way off from actual collision.
In the past I used XNA Framework C# and there was quite a simple way to do a box collision and then within that test if both pixels in question where transparent and ONLY WHEN both pixels were NOT transparent would it return true as a collision.

I'm really struggling to find this method or how to implement this using LibGDX , can anyone help me out here??

Here is the code snippet in question, if you need the full games code please let me know:

        if (ship.getBoundingRectangle().overlaps(baddiePurple.getBoundingRectangle())){
        purpleDyingSound.play();
        KillPurpleSoloEnemy();
        game.setScreen(new MenuScreen(game));
    }

Of course I'm aware that I could just trim down all the images to have almost zero transparent edges but the problem with doing that is they are animated sprites in sprite-sheets and i can't get them into the right position if I try that. (Also, I plan on having LOTS of different enemies etc and trimming would be a major ballache)

THANKS IN ADVANCE FOR ANY HELP! peace out!

sentences:
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:
pass by reference a transformation I create a C # script in which I declare a transformation:
public Transform Origin;

When I put this script on an object of the hierarchy, in the Inspector a field Origin appears at the level of the script in which I have to drag and drop a transformation of a GameObject or a GameObject.

How does the Origin transformation deal with the GameObject transformation to move in this field?

Thank you for your help

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 XAudio2 to Process Microphone Input I am trying to come up with a solution to process microphone input for a game. Not entirely sure where to start. I was looking into using XAudio2, but it doesn't seem to have support for microphone processing? Is this correct? What do most companies in the industry currently use?

sentences:
(LibGDX) Set actor to fixed position on TiledMap How can I set an actor to an absolute / fixed position on my TiledMap, such that it does not follow the camera when I pan around?

Currently my code looks like:
camera = new OrthographicCamera();
rootGroup = new Group();

castleMap = new TmxMapLoader().load("castleMap.tmx");
isoMapRenderer = new IsometricTiledMapRenderer(castleMap, 1/32f);

...

final FitViewport fitViewport = new FitViewport(worldWidth, worldHeight);
stage = new Stage(fitViewport);
rootGroup.setSize(stage.getWidth(), stage.getHeight());
stage.addActor(rootGroup);

barracks = new Barracks(barracksIcon, self);
rootGroup.addActor(barracks);

From there, whether I try to position the barracks actor using
barracks.setPosition(x, y);

or using
Vector2 vector = new Vector2(x, y);
vector = stage.screenToStageCoordinates(vector);
vector = rootGroup.stageToLocalCoordinates(vector);
barracks.setPosition(vector.x, vector.y);

I get the same result.
I emphatically do not want to use Tables.
Thanks in advance!

sentences:
How 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:
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:
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:
What are the differences between EGA and VGA for MSDOS API? How different is the API for EGA and VGA for MSDOS applications? We're talking about the API that was used in games like Doom, Quest for Glory, Duke 3D, etc.

More specifically, how much work would be involved in changing an application's use of EGA APIs to VGA APIs? or SVGA even? They seem to be fairly similar in terms of interrupt strategies, registers used, etc. Looking for a little more definite answer though, if possible.

Forum post that suggests wrapping memory access may provide a partial solution:
http://www.allegro.cc/forums/thread/604334

Some basic information on using VGA, but nothing on EGA:

http://www.brackeen.com/vga/basics.html

http://www.wagemakers.be/english/doc/vga

sentences:
best way to compute vertex normals from a Triangle's list hi
i'm a complete newbie in computergraphics so sorry if it's a stupid answer.
i'm trying to make a simple 3d engine from scratch, more for educational purpose than for real use.

for now i compute only face normals. in this way:

i have a Surface object with inside a Triangle's list. i compute normals inside Triangle class, in this way:

triangle.computeFaceNormals() {
    Vec3D u = v1.sub(v3)
    Vec3D v = v1.sub(v2)
    Vec3D normal = Vec3D.cross(u,v)
    normal.normalized()
    this.n1 = this.n2 = this.n3 = normal
}

and when building surface:

t = new Triangle(v1,v2,v3)
t.computeFaceNormals()
surface.addTriangle(t)

and i think this is the best way to do that.. isn't it?

now.. this works, ok. but light it's not smoothed. i'm trying to compute also vertex normals. (i'm testing my engine with tubolar surfaces so i have almost all vertex shared with more then one triangles)

i've found this simple algorithm: flipcode vertex normal
but.. hei this algorithm has.. exponential complexity? (if my memory doesn't fail my computer science background..) (bytheway.. it has 3 nested loops.. i don't think it's the best way to do it..)

any suggestion?

sentences:
How to update void show? getMusicPlaying is set to false whenever someone touches the button, but libgdx runs show method only once, at the start of the game, hence the music will keep playing forever.

I tried to use the render and batch.begin instead of show() same result.

private boolean musicPlaying = true;

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

}
});
}

public void show() {
 if (getMusicPlaying ==true)
  music.play();
}

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:
moving ball on spawn I'm working on some special pick ups on an arkanoid-like game. Currently, I have one that should spawn several balls all in a row, right after the original ball hits the paddle. All the additional balls should spawn just above the paddle and then they are passed the vector from the original ball, in which case they should follow that vector, essentially causing a line of balls all traveling in the same direction. The problem I am having is the ball's spawn just above the paddle, but they are spawning in place. Gravity pulls them down, and when they hit the paddle, that seems to be when the vector becomes active and the ball takes off like it should have when it spawned. I'm not sure what I am doing wrong here to keep it from just taking off like that as soon as it spawns. Can anyone see anything here that could be causing this behavior?

This is the code for spawning a ball and setting the vector.

  Instantiate(newBall, new Vector3(paddle.transform.position.x, (paddle.transform.position.y + 1), 0), Quaternion.identity);
    newBall.GetComponent<Ball>().hasStarted = true;
    GameManager.pickUpManager.allBalls.Add(newBall.GetComponent<Ball>());
    newBall.GetComponent<Rigidbody2D>().AddForce(mainBallVector, ForceMode2D.Impulse);      //use the original ball's vector3 to follow it directly

Here is where mainBallVector gets set, it is a vector3:

  mainBallVector = mainBall.GetComponent<Rigidbody2D>().velocity;

sentences:
Loading dynamically created files with XNA I'm trying to implement a structured save/load functionality so if the user saves, it will take up one of 10 slots, and if the user loads, they would select one of these slots.

To do this, I need the game to load files from a predefined location, but I can't seem to find a good way to do this. I tried using TitleContainer, but this requires the files to be explicitly added to the project and their properties changed to copy to the output directory in the bin. I've also looked at User data loading, but all the examples I can find are for asynchronous file loading where the user selects a file.

Is there any way to load dynamically created files from a fixed location with XNA, such as save files?

sentences:
Canting of track in a racing game I am trying to create a small racing game in which the track would be modeled using a BSpline curve for the path's center line and directional vectors to define the canting of the track at each point.

My problem is that I don't know how to calculate the correct canting / slope of the curve, in such a way that it would be optimal or at least visually nice for a car to 'slant in the corner'.

My idea was to use the direction of the 2nd derivatives of the curve, however while this approach looks fine for most of the track, there are points in which the 2nd derivative makes sharp 'twists' / very quick 180 degree flips. I also read about 'knots' of bsplines, but I don't know if such 'twist' in 2nd derivatives is a knot or knots are something else.

Can you tell me that using a BSpline:
1. How could I calculate a visually nice canting of a track for a racing game?
2. Is it possible to do this by using some simple calculations of centripetal force / gravity?
3. Is it possible to do this by using 1st, 2nd and 3rd derivatives of the BSpline curve?

I am not looking for the 'physically correct' canting angle for the track, I would just like to create something which is visually pleasing in a simple game.

I am using a framework which has a built-in class for BSpline, including support for 1st, 2nd and 3rd derivatives of the curve.

sentences:
What new programming languages are being used to develop web-based games? I've got around 10 years behind me of casually creating AS1/2/3 games and have found myself wondering recently what other options are available for web-based games.

I have recently found haXe and will probably start coding in that, since it is largely based on AS3/ECMAScript, and I am also aware of JavaScript/jQuery etc and HTML5 being suitable for purpose, but what else is there?

What up and coming languages are being used to develop / are targeted at making web-based games?

sentences:
Basic plane kinematics I never did physics in my life and this is really hard for me. I am currently trying to implement movement in the X and Y axis of a plane, in a video game I am making.

What I want to do is, given a starting angle and a velocity, and the value of gravity, calculate in different points of time the current angle and the displacement in X and Y.

So, lets say, my current velocity is 4 units / second and my current angle is 30 degrees and my gravity is 9.8 u/s, I want to pass an argument in seconds and calculate the final angle, velocity, and the amount of X and Y the body moved.

sentences:
Coordinates different between Tiled editor and my game So I have been using Tiled map editor to create my map for my game. I'm using Libgdx to load and draw the map.

The problem is that the coordinate from objects placed in tiled do not seem to be the same when they are using in my game. It seems to be just the y value, as I have tried a few different positions and the x value seems to be okay.

I think it may be because Libgdx coordinate systems starts in the bottom left instead of the top left, but I'm not sure. And I'm not sure how to get around it.

In Tiled:

In game:

The black square is being drawn at the x and y values grabbed from the object.

I get the values from this function once the map loads:

    public Vector2 getStartingPosition()
{
    for (TiledObjectGroup group : map.objectGroups) {
        for (TiledObject object : group.objects) {
            if ("playerSpawn".equals(object.name))
                return new Vector2(object.x, object.y);
        }
    }

    //Was not found, return default spawn
    return new Vector2(0,0);
}

sentences:
CPU Usage and Available Ram in Unity 5 In Unity 5 I would like to be able to print out the CPU Usage and Available Ram left in MB. I followed the code posted on http://zamov.online.fr/EXHTML/CSharp/CSharp_927308.html and used it, however my CPU usage is always 100 and available ram is 0. According to the windows task manager CPU usage should be around 15-20% and available memory is around 4700MB. This is my first time using performance counters and further searching gives me the same code as below (from link):

public class ClientValues : MonoBehaviour {

PerformanceCounter cpuCounter;
PerformanceCounter ramCounter;
public float myCPU;
public float myRAM;

// Use this for initialization
void Start () {

    cpuCounter = new PerformanceCounter();

    cpuCounter.CategoryName = "Processor";
    cpuCounter.CounterName = "% Processor Time";
    cpuCounter.InstanceName = "_Total";

    ramCounter = new PerformanceCounter("Memory", "Available MBytes");
}

// Update is called once per frame
void Update ()
{
    myCPU = getCurrentCpuUsage ();
    myRAM = getAvailableRAM ();
    //UnityEngine.Debug.Log (myCPU);
}

public float getCurrentCpuUsage(){
    return cpuCounter.NextValue();
}

public float getAvailableRAM(){
    return ramCounter.NextValue();
}
}

What needs to change for this to give me the correct values?

sentences:
Setting object position in screen space - camera I'm trying to set an Image gameobject's transform.position. My canvas is "screen space - camera" because I needed to use a line renderer.

However, when I set the position, say to new Vector3(-320, -240); the object (in play mode) gets positioned at -16266.44, y: -15360, way off-screen.

I've tried to reset the localPosition and such based on some other answers but it doesn't help. What else could be translating my pixel coords?

var go = Instantiate(HexTilePrefab, this.transform);
go.transform.localPosition = Vector3.zero;
go.transform.localRotation = Quaternion.identity;
go.transform.localScale = Vector3.one;
go.transform.position = new Vector3(screenX, screenY);

sentences:
How to make a character in a Box2D world jump faster? I have a question about using Box2D to simulate a physics-platformer.
I manage to make the character move to the right and left, and jumping as well. However, jumping seems extremely slow when compared to most tile-based platformers.

Is there a way to speed up the jumping  and falling of the player? I of course know from my basic physics lessons that 'heavier' objects don't fall faster in the real world, but is there a way to simulate this in Box2D?

sentences:
How to make a dynamic frontline system for my game? My problem:
Basically the units, units meaning soldiers or vehicles, influence the frontline by moving into the opponents territory (See example image).
I'm trying to understand where to even start with this. I honestly have no idea what kind algorithm would be used to create this kind of system.
Example Image:

More info about the example:
https://www.eugensystems.com/steel-division-normandy-44-gameplay-dynamic-front-line/
This system is not node or tile based, but is fully dynamic (almost looks like a fluid simulation lol). I figured out I would render the line by using spline interpolation with points, but I don't understand the math behind the system itself (the part that controls how the line moves and creates points).
It's really cool and I would love to know where I would even start. Any free references would be highly appreciated.
Thank you!

sentences:
How can I apply UV mapping in parent space? I'm trying to apply UV mapping in parent space - ie. taking into account the object's own transformation matrix but no matrices further up the transformation hierarchy.

For example, I'd want to be able to transform a cube mesh (rotate/scale) and have UVs based on that, not the mesh vertices themselves. Then any transforms above that would not impact that object’s UVs.

What’s the best way to access the local transform matrix of an object in a shader in Unity?

I know that I can use objectToWorld to get access to the entire hierarchy’s flattened transform matrix, but I want to specifically access only the bottom most transform (the local one produced by the transform component on an object)

Do I have to pass this in as a custom variable each frame? Or is there a better method to use?

sentences:
Pixel Shader, YUV-RGB Conversion failing I am tasked with playing back a video hthat comes in in a YUV format as an overlay in a larger game. I am not a specialist in Direct3d, so I am struggling. I managed to get a shader working and am rendering 3 textures (Y, V, U). Sadly I am totally unable to get anything like a decent image. Documentation is also failing me. I am currently loading the different data planes (Y,V,U) in three different textures:

m_Textures = new Texture[3];
// Y Plane
m_Textures[0] = new Texture(m_Device, w, h, 1, Usage.None, Format.L8, Pool.Managed);
// V Plane
m_Textures[1] = new Texture(m_Device, w2, h2, 1, Usage.None, Format.L8, Pool.Managed);
// U Plane
m_Textures[2] = new Texture(m_Device, w2, h2, 1, Usage.None, Format.L8, Pool.Managed);

When I am rendering them as R, G and B respectively with the following code:

float4 Pixel(float2 texCoord: TEXCOORD0) : COLOR0
{
    float y = tex2D (ytexture, texCoord);
    float v = tex2D (vtexture, texCoord);
    float u = tex2D (utexture, texCoord);

    //R = Y + 1.140 (V -128)
    //G = Y - 0.395 (U-128) - 0.581 (V-128)
    //B = Y + 2.028 (U-128)

    float r = y; //y + 1.140 * v;
    float g = v; //y - 0.395 * u - 0.581 * v;
    float b = u; //y + 2.028 * u;

    float4 result;
    result.a = 255;
    result.r = r; //clamp (r, 0, 255);
    result.g = g; //clamp (g, 0, 255);
    result.b = b; //clamp (b, 0, 255);

    return result;
}

Then the resulting image is - quite funny. I can see the image, but colors are totally distorted, as it should be.

The formula I should apply shows up in the comment of the pixel shader, but when I do it, the resulting image is pretty brutally magenta only. This gets me to the question - when I read out an L8 texture into a float, with

float y = tex2D (ytexture, texCoord);

what is the range of values? The "origin" values are 1 byte, 0 to 255, and the forum I have assumes this. Naturally I am totally off when the values returned are somehow normalized. My Clamp operation at the end also will fail if for example colors in a pixel shader are normalized 0 to 1. Anyone an idea how that works? Please point me also to documentation - I have not found anything in this regard.

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:
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:
Can't understand these UV texture coordinates (range is NOT 0.0 to 1.0) I am trying to draw a simple 3D object generated by Google SketchUp 8 Pro onto my WebGL app, the model is a simple cylinder.

I opened the exported file and copied the vertices positions, indices, normals and texture coordinates into a .json file in order to be able to use it on javascript. Everything seems to work fine, except for the texture coordinates which have some pretty big values, like 46.331676 and also negative values. Now I don't know if I am wrong, but isn't 2D texture coordinates supposed to be in a range from 0.0 to 1.0 only?

Well, drawing the model using these texture coordinates gives me a totally weird look, and I can only get to see the texture properly when I am very close (not really me, the cam) to the model, as if the texture has been insanely reduced in it's size and repeated infinitely across the model's faces. (yeah, I am using GL_REPEAT on that texture wrap thing)

What I noticed is that if I get all these coordinates and divide them by 10 or 100 I get a much "normal" look, but still not in the 0.0 to 1.0 range.

Here's my json file: http://pastebin.com/Aa4wvGvv

Here are my GLSL Shaders: http://pastebin.com/DR4K37T9

And here is the .X file exported by SketchUp: http://pastebin.com/hmYAJZWE

I've also tried to draw this model using XNA, but still not working. Using this HLSL shaders: http://pastebin.com/RBgVFq08

I tried exporting the same model to different formats, collada, fbx, and x. All those yields the same thing.

sentences:
How can I avoid false positives with "blow" input? I’m working on a game which uses blow functionality to move an object in the game screen.
This screen also has background music in it.

The problem is that the microphone is detecting the BGM as blow input and the object is being moved without any actual user input.

How can I avoid this kind of false positive?

sentences:
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:
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:
Programmatically create a trigger within abnormally shaped room So I'm trying to create a trigger in each of my rooms. These rooms can be created by players. Basically, I need to know all the objects in a room. These rooms can be shaped in weird and wonderful ways. I'm struggling to figure out how to "fill" an area? The other problem is that some walls are curved.

My current thinking is:

Loop over all the walls in a scene. Do 4 raycasts from each side of the wall and see if we hit other walls. If we do, we are likely in a room.
From the offset, literally check each node adjacent to that until we fill the room. Once I have this though, Im not sure what to do with it.

How do I create bounds that I can check for collisions with this data?

Edit: Adding an image for clarity. Red and blue should be 2 different rooms and I want to get all items in each of these rooms

sentences:
Android cocos2d removing a sprite after animation I have an object going across the screen with an animation using the following code:

CCSpriteFrameCache.sharedSpriteFrameCache().addSpriteFrames("ninjastar.plist");
CCSpriteSheet projectileSheet = CCSpriteSheet.spriteSheet("ninjastar.png");
addChild(projectileSheet);
ArrayList<CCSpriteFrame> projectileSprites = new ArrayList<CCSpriteFrame>();

for (int i = 1; i <= 4; i++) {
    projectileSprites.add(CCSpriteFrameCache.spriteFrameByName("ninjastar" + i + ".png"));
}

CCAnimation projectileAnimation = CCAnimation.animation("throw", 0.1f, projectileSprites);
CCSprite projectile = CCSprite.sprite(projectileSprites.get(0));
CCAction projectileAction = CCRepeatForever.action(CCAnimate.action(projectileAnimation, false));
projectile.setPosition(CGPoint.ccp(winSize.width + (projectile.getContentSize().width / 2.0f), actualY));
    actionMove = CCMoveTo.action(actualDuration, CGPoint.ccp(-projectile.getContentSize().width / 2.0f + 320, actualY));
projectileSheet.addChild(projectile);
projectile.setTag(1);
_projectiles.add(projectile);
CCCallFuncN actionMoveDone = CCCallFuncN.action(this, "spriteMoveFinished");
CCSequence actions = CCSequence.actions(actionMove, actionMoveDone);
projectile.runAction(actions);
projectile.runAction(projectileAction);

I'm using "spriteMoveFinished" to remove the sprite once it is done going across the screen:

public void spriteMoveFinished(Object sender) {
CCSprite sprite = (CCSprite)sender;
_projectiles.remove(sprite);
sprite.stopAllActions();
removeChild(sprite, true);
}

However, when the sprite gets to the end of the screen it just stays stuck there on the last frame. How do I remove it completely?

sentences:
How to 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:
Locking frame rate to 60 in the editor My game runs at several hundred frames per second. I want to limit it to 60. So I used

    Application.targetFrameRate = 60;

This works on the iPhone. But in the editor it only reduced the frame rate to around 80-90. Am I missing yet another setting?

Mac OSX Mavericks.

sentences:
How much assembly is really used in modern game code? On average, how often is assembly used in modern game code?

Specifically on platforms that already have good C++ compilers, like x86, PPC, or ARM--because I assume games on embedded systems make extensive use of assembly.

sentences: How to tell if a fixture is being squeezed by two other fixtures in Box2D? Let's say I had a ground fixture, a player box, and a kinematic block moving up and down. If the player stands under the block, weird things happen. I want to simply play an event where the player dies. How can I detect when the player box is crushed by the block moving down on it?

sentences:
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:
How can I access the members of XMVECTOR? So I have been reading these articles, and I find implementing them a trouble. Currently, all I am trying to do is add two vectors together, leaving my question more specifically this: How can I add specific members of two given vectors together? An example would be this:

XMVECTOR v1 = XMVectorSet(1.0, 2.0, 3.0, 4.0);
XMVECTOR v2 = XMVectorSet(1.0, 1.0, 1.0, 1.0);

Then I would need to be able to lets say add v1's third member (3.0) and v2's second member (1.0). How can I pull this off? I tried using:

v1.z += v2.x;

To no avail. Any help is very much appreciated.

sentences:
GPU skinning weird issue I finally got my GPU skinning to work! (Mostly) I'm using MD5 format and this here tutorial

However the weird part is that I'm getting EXACTLY the same issue as this unanswered post: here

The animations are opposite. When the head is supposed to be rotation left/right it rotates up/down and the arm when it goes up seems to look like the vertices invert (backface culling proves it since i can see through the mesh and see the inside of the arm)

Any clues the what might be causing this? Questions?

sentences:
How would I edit .anim files in Blender? I absolutely cannot stand animating in Unity.
I am making an FPS game with many weapons, and each weapon has four animations: running, jumping, aiming, and shooting. I would like to create a .anim file in Unity with the keyframes of the character and the weapon, and then edit that .anim file in Blender. How would I edit .anim files in Blender?

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:
How to determine the demographics of a game after release? I am interested in demographics of people who actually play my game. Here are few assumptions I made:

Players, especially the younger ones, are often not the buyers (or downloaders in case of freemium) and I don't think I can get data about buyers anyway
Games targeted to a certain audience can be played by completely different group in the end (Pokemon vs. Call of Duty)

The closest I can get is to probably get a similar game that already has demographics data. But how did they get the data?

I have read the following questions:

Other than the ESA are there other sources for demographic data?
Casual gamer age distribution

These questions give me some data, but not the way how were the data obtained. Also some of the links are already invalid.

sentences:
How to apply Data Oriented Design with Object Oriented Programming? I've read lots of articles about Data Oriented Design (DOD) and I understand it but I can't design an Object Oriented Programming (OOP) system with DOD in mind, I think my OOP education is blocking me. How should I think to mix the two? The objective is to have a nice OOP interface while using DOD behind the scenes.

I saw this too but didn't help much: https://stackoverflow.com/questions/3872354/how-to-apply-dop-and-keep-a-nice-user-interface

sentences:
Algorithm to zoom a plotted function I'm making a game in android and I need plot a function, my algorithm is this:

    @Override
    protected void onDraw(Canvas canvas) {
        float e = 0.5f;
        //from -x axis to +x evaluate f(x)
        for (float x = -z(canvas.getWidth()); x < z(canvas.getWidth()); x+=e) {
                 float x1,y1;
                 x1 = x;
                 y1 = f(x);
                 canvas.drawPoint((canvas.getWidth()/2)+x1, (canvas.getHeight()/2)-y1, paintWhite);
        }
        super.onDraw(canvas);
    }

This is how it works. If my function is, for example f(x)=x^2, then z(x) is sqrt(x). I evaluate each point between -z(x) to z(x) and then I draw them. As you can see I use the half of the size of the screen to put the function in the middle of the screen. The problem isn't that the code isn't working, actually plots the function. But if the screen is of 320*480 then this function will be really tiny like in the image below. My question is: how can I change this algorithm to scale the function?. BTW what I'm really wanting to do is trace a route to later display an animated sprite, so actually scale this image doesnt gonna help me. I need change the algorithm in order to draw the same interval but in a larger space. Any tip helps, thanks!

Current working result

Desired result

UPDATE:
I will try explain more in detail what the problem is. Given this interval [-15...15] (-z(x) to z(x)) I need divide this points in a bigger interval [-320...320] (-x to x). For example, when you use some plotting software like this one. Although the div where is contain the function has 640 px of width, you dont see that the interval is from -320 to 320, you see that the interval is from -6 to 6. How can I achieve this?

sentences:
Switch axes and handedness of a quaternion? I have a quaternion, coming from a system with the following:(intertial sensor)

Right handed.
Forward direction: Y axis
Right direction: X axis
Up direction: Z axis

I need to convert this into a coordinate system that is: (Unreal engine)

left-handed.
Forward direction: X axis
Right direction: Y axis
Up direction: Z axis

I have tried negating the axis, and angle, I have tried switching values, i cannot get this to work. All help greatly appreciated! I am working in C#, with Microsoft.Xna.Quaternion.

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:
How to calculate new velocities between resting objects (AABB) after accelerations? lately I have been trying to create a 2D platformer engine in C++ with Direct2D. The problem I am currently having is getting objects that are resting against each other to interact correctly after accelerations like gravity have been applied to them.

Right now I can detect collisions and respond to them correctly (I think) and when objects collide they remember what other objects they're resting against so objects can be pushed by other objects (note that there is no bounce in any collisions so when objects collide they are guaranteed to become resting until something else happens). Every time the simulation advances, the acceleration for objects is applied to their velocities (for example vx += ax * t, where t is time elapsed since last advancement).

After these accelerations are applied, I want to check if any objects that are resting against each other are moving at different speeds than their counterparts (as different objects can have different accelerations) and depending on that difference either unlink the two objects so they are no longer resting, or even out their velocities so they are moving at the same speed once again. I am having trouble creating an algorithm that can do this across many resting objects.

Here's a diagram to help explain my problem

sentences:
Hide original video file in XNA game I want to play some videos in my XNA game. I have looked at this tutorial. I have tried it. It creates XNB file but also copies original WMV file into output content directory.

Is there some simple solution, how can I pack/hide original WMV file? I don't want user get it.

Thanks for any help.

sentences:
Why 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:
How to edit visual appearance of mod in Euro Truck Simulator 2(ETS2) Not sure if this is the right place, so here goes nothing...

I want to update my truck's appearance in-game, to make it more on par with it's real life counterpart. The part of the truck I want to edit, to be more specific, is the grill of the truck. The truck's looks are pretty outdated, and it seems it needs a facelift.

From what I found, all my sources tell me that I need to edit the base files of the game, and then I can alter the game mod itself. Is there a simpler way of updating the truck's appearance? Or am I better of just sticking with it's old looks?

sentences:
How to make a sprite face the player sprite (pygame 2d) Basically I have a sprite and I want its front/face to face the player sprite. All the sprites are rectangles/squares and use .get_rect().
I have a base class for the sprite here:
class Enemy(pygame.sprite.Sprite):
    def __init__(self):
        super(Enemy, self).__init__()
        self.surf = pygame.Surface((20, 10))
        self.surf.fill((255, 255, 255))
        self.rect = self.surf.get_rect(
            center=(
                random.randint(SCREEN_WIDTH + 20, SCREEN_WIDTH + 100),
                random.randint(0, SCREEN_HEIGHT),
            )
        )
        self.speed = random.randint(15,30)

    # Move the sprite based on speed
    # Remove the sprite when it passes the left edge of the screen
    def update(self):
        self.rect.move_ip(-self.speed, 0)
        if self.rect.right < 0:
            self.kill()

And the class for the player:
class Player(pygame.sprite.Sprite):
    def __init__(self):
        super(Player, self).__init__()
        self.surf = pygame.Surface((40, 25))
        self.surf.fill((255, 255, 255))
        self.rect = self.surf.get_rect()
    def update(self, pressed_keys):
        if pressed_keys[K_UP] or pressed_keys[K_w]:
            self.rect.move_ip(0, -10)
        if pressed_keys[K_DOWN] or pressed_keys[K_s]:
            self.rect.move_ip(-0, 10)
        if pressed_keys[K_LEFT] or pressed_keys[K_a]:
            self.rect.move_ip(-10, 0)
        if pressed_keys[K_RIGHT] or pressed_keys[K_d]:
            self.rect.move_ip(10, -0)
        if self.rect.left < 0:
            self.rect.left = 0
        if self.rect.right > SCREEN_WIDTH:
            self.rect.right = SCREEN_WIDTH
        if self.rect.top <= 0:
            self.rect.top = 0
        if self.rect.bottom >= SCREEN_HEIGHT:
            self.rect.bottom = SCREEN_HEIGHT

sentences:
How to fix Monogame WP8 Touch Position bug? Normally below code will result in X:Infinity, Y:Infinity

TouchCollection touchState = TouchPanel.GetState();

foreach (TouchLocation t in touchState)
{
    if (t.State == TouchLocationState.Pressed)
    {
        vb.ButtonTouched((int)t.Position.X, (int)t.Position.Y);
    }
}

Then, I followed this https://github.com/mono/MonoGame/issues/1046 and added below code at the first line in update method. (I still don't know how it's worked, but it fixed the problem)

if (_firstUpdate)
{
    typeof(Microsoft.Xna.Framework.Input.Touch.TouchPanel).GetField("_touchScale",System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static).SetValue(null, Vector2.One);
    _firstUpdate = false;
}

And then, when I randomly testing something, there are several area that won't read the user touch.

The tile with the purple dude is the area which won't receive user input (It don't even detect "Pressed", the TouchCollection.Count = 0)

Any idea how to fix this?

UPDATE 1 : The second attempt in recompiling

The difference is weird. Dunno why the consistent clickable area is just 2/3 area to the left

UPDATE 2 :
After trying to rotate to landscape and back to portrait to randomly testing, then the outcome become :

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:
How to force a line break before the last word of a line reach the edge? I'm printing a sliding text by adding each letter after a short period of time. My problem is that when the text multilines, the last word of a line starts on the current line and jumps to the next when it grows too big to fit, making for an ugly effect.

So I guess I need to determine the word where the line would break and replace the previous space with line break to force the break before the word reach the edge. I'm failing to see how to do that. In addition, if there is any way to make the libgdx BitmapFont calculate that I would love to learn.

sentences:
What makes game sound effects "good"? I'm making a small game, and I've found some free sound effects that I'd like to use.

The issue is that I can't get the sound effects to sound like they "belong" in my game. I don't know what to look for that can make sound effects match the rest of my game style.

I have some ideas on what affects the meshing of audio with graphics. For example, I have a feeling that the current SFX I may be too "realistic" for my graphical style, which is pretty cartoon-like. Also, is there a golden standard for what volume various SFX should be at? (for example, I am thinking that footsteps or other common sounds should be at barely audible volumes, while enemy deaths or something that is a "big deal" should be louder).

I found a similar question about graphics, I'm looking for a similar response with sound effects.

sentences:
Android - animating spritesheets I'm creating a basic endless runner game on Android using SurfaceView.

I have background that recreates itself constantly, which was simple enough.

One problem I've always had is getting my head around animating sprite-sheets, not just in Android but other platforms as well.

Based on the problem I'm stuck on right now.. I have a sprite sheet thats 9 images 2 rows, 5 columns, with an empty space at the end of the second row.  All of which is one single running animation.

I've made a Sprite Class.

public class Sprite {
    GameView gameView;
    Bitmap bmp;
    private int x, y, width, height;
    private int spriteColumns 5, spriteRows= 2;
    private int currentAnim = 1;

    public Sprite(GameView gameView, Bitmap bmp) {
        this.gameView = gameView;
        this.bmp = bmp;
        this.width = bmp.getWidth() / spriteColumns;
        this.height = bmp.getHeight() / spriteRows;
    }

    public void update() {
       // do something here with currentAnim, x and y;
    }

    public void onDraw(Canvas c) {
       update();
       canvas.drawBitmap(bmp, x, y, null);
    }

}

How do I go about doing this?  Am I on the right track so far?

sentences: Best practices for playing sounds in iPhone games What are the best practices for playing sounds in iPhone games? Specifically, what are the best practices while playing sounds simultaneously without affecting other processing much. Is there any recommendation about how sound files must be made to suit the processing?

sentences:
OpenGL object movement is not smooth and vibrating In my android NDK OpenGL C++ project, I have a render method which executes every frame on draw event so this is the algorithm:

void Engine::render() {
    deltaTime = GetCurrentTime() - lastFrame;
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    update();
    renderDepthMaps();
    renderMeshes();
    if (skybox != nullptr)
        shaders.drawSkyBox(skybox, camera, width, height);
    lastFrame = GetCurrentTime();
}

first I calculate the delta time between the last frame and the current frame, then I update all transformation and view matrices from input then render the scene so the game loop depends on the android draw frames, I have an object which moves over a terrain and a third person camera moves with it and rotates around it, so after the object moves for some distance it begins to flicker forward and backward, the update function for the object is:

double& delta = engine.getDeltaTime();
GLfloat velocity = delta * movementSpeed;
glm::vec3 t(glm::vec3(0, 0, 1) * velocity * 3.0f);
matrix = glm::translate(matrix, t);
glm::vec3 f(matrix[2][0], matrix[2][1], matrix[2][2]);
f = -glm::normalize(f) * velocity * 3.0f;
camera->translate(f);

If it is an interpolation issue I don't know how to make interpolation with using translate matrix to its forward vector.

sentences: Good game design books? I have some experience in creating, however I like to have some well written reference material to help me produce better products.  Are there any game design books that are not aimed at a particular programming language?

sentences:
GLSL Multiple Uniform Structs I'm developing a lighting system for my voxel game, and I have to send multiple (alot, say up to 200) lights to my shader program. Those lights contain the following data:

Position (vec3)
Color (vec3)
Radius (float)
Strength (float)

What is the most efficient way to send alof of those light structs to my shaders? I would like it to work with lower versions of OpenGL, like 2.1.

sentences:
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:
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: the difference between diffuse texture and ambient occlusion texture is there any difference between diffuse texture which used in diffuse lighting and ambient occlusion map, or this is the same texture just different naming, because i see it mostly it looked the same?

sentences: Procedural dungeon generation. No corridors, color key doors I am curious how dungeons like the one in Runescape dungeoneering skill are generated. They basicaly have a 10x10 grid. So theres 100 rooms total. There's starting room and exit room. And each one are conected by open doors or doors that require key of some color. Anyone have idea how to generate something like this? I mean how to place doors and keys to make dungeon doable?

sentences:
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:
Level loading philosophy in MMO games I've been working on project for quite a while, and I've returned to dilemma about level loading.
The problem is i trust the client with it's local level loading, when it's done loading it tells the server to join it to server room data stream and server start to send data.

My current setup

Client logs in, on login server sends the characters.
Client chooses the character and start to load level locally.
When client scene done loading, it request to add to room.
Client receives the data he needs.

I fear that user could hack the client and actually load other scene, that would result in players and characters going through props and models, it could also be an exploit to see hidden data and items.

Instead, after server sends the chosen character it could "wait" for user to send response that level has finished loading. After that, server joins the character to room and send data to the user. That way client doesn't know anything about rooms or it's names.

Any suggestions?

sentences:
Unity calculating the boundaries of camera in 2d game So im starting to learn Unity, working on a top down 2D game. I know I can use something like Cinemachine to clamp my camera to a 2DCollider, but I decided to try it to implement this manually as a exerciser.
Here is my plan:
1.) I put a BoxCollider2D around my map. I set collider to trigger mode to avoid collisions (although I guess I could just put it on another layer)
2.) I add that Box Collider to my camera object.
3.) In my camera object i put the following update code
        Vector2 min = (Vector2) roomColider.bounds.min + new Vector2(6,6);
        Vector2 max = (Vector2)roomColider.bounds.max - new Vector2(roomColider.offset.x / 2 + 1, roomColider.offset.y / 2 + 1);
        if(transform.position != target.position) {
            Vector3 targetPosition = new Vector3(target.position.x, target.position.y, transform.position.z);
            targetPosition.x = Mathf.Clamp(targetPosition.x, min.x, max.x);
            targetPosition.y = Mathf.Clamp(targetPosition.y, min.y, max.y);
            // Lerp for a smooth camera motion
            transform.position = Vector3.Lerp(transform.position, targetPosition, smoothing);
        }

However this seems to be off. It does clip the camera, but the boundingbox is some amount of units (~6 units) off in this case.

sentences: Using Blueprint to spawn objects at runtime in Unreal Engine 4 Using UE4's "Blueprint" visual scripting system, how can I dynamically spawn objects at runtime?

sentences:
Why do I get a "Value Cannot be Null" error on material.SetTexture? Probably a really noob question, but:

I'm following this tutorial here and, using the code in the tutorial, I'm getting an annoying error:

Here's the code in question, the error is referring to line 20 (highlighted in the comments):

public class RayTracingMaster : MonoBehaviour
{
    public ComputeShader RayTracingShader;

    public Texture SkyboxTexture;

    private RenderTexture _target;

    private Camera _camera;

    private void Awake()
    {
        _camera = GetComponent<Camera>();
    }

    private void SetShaderParameters()
    {
        RayTracingShader.SetTexture(0, "_SkyboxTexture", SkyboxTexture); // <- Line 20 is here
        RayTracingShader.SetMatrix("_CameraToWorld", _camera.cameraToWorldMatrix);
        RayTracingShader.SetMatrix("_CameraInverseProjection", _camera.projectionMatrix.inverse);
    }

    private void OnRenderImage(RenderTexture source, RenderTexture destination)
    {
        Render(destination);
        SetShaderParameters();
    }

    private void Render(RenderTexture destination)
    {
        // Make sure we have a current render target
        InitRenderTexture();

        // Set the target and dispatch the compute shader
        RayTracingShader.SetTexture(0, "Result", _target);
        int threadGroupsX = Mathf.CeilToInt(Screen.width / 8.0f);
        int threadGroupsY = Mathf.CeilToInt(Screen.height / 8.0f);
        RayTracingShader.Dispatch(0, threadGroupsX, threadGroupsY, 1);

        // Blit the result texture to the screen
        Graphics.Blit(_target, destination);
    }

    private void InitRenderTexture()
    {
        if (_target == null || _target.width != Screen.width || _target.height != Screen.height)
        {
            // Release render texture if we already have one
            if (_target != null)
                _target.Release();

            // Get a render target for Ray Tracing
            _target = new RenderTexture(Screen.width, Screen.height, 0,
                RenderTextureFormat.ARGBFloat, RenderTextureReadWrite.Linear);
            _target.enableRandomWrite = true;
            _target.Create();
        }
    }
}

I really can't see why it's telling me the value is null when I'm calling the name of an already defined Texture class. I have set the texture from the inspector. Any help would be appreciated.

sentences:
Create a stack driven coroutine based state machine for Unity I am working on a game where I am using a coroutine based state machine which is mostly a multi class implementation of this link. I am using it because it allows me to create multi frame sequences.

I wanted to know how would I go about making a stack based machine, so that I can overlay game states such as when I want to pause the game to show a menu i can run a pause menu state pausing the running game state, while still allowing the state objects to be rendered in the background

Here is the code I am using for a state:

public abstract class State {

[Inject]
MonoBehaviour gameObject;

[Inject]
public EventSystem eventSystem;

StateMachine parent;

public State(StateMachine p)
{
    parent = p;
}

public abstract IEnumerator Enter();

public abstract IEnumerator Exit();

public abstract IEnumerator Update();

public IEnumerator Run()
{
    yield return gameObject.StartCoroutine(Enter());
    while(parent.CurrentState.GetType() == GetType())
    {
        yield return gameObject.StartCoroutine (Update ());
    }
    yield return gameObject.StartCoroutine (Exit());
}
}

State machine run function

 State Current //The current state , the one at the top of the stack
 while(Current!=null)
        {
            yield return Component.StartCoroutine(Current.run());
        }

The problem with this approach is as soon as the state machine's current state changes (That is when i push it down the stack adding a new state on top) , the while loop in the Base state class's run method will end and will call the exit coroutine causing the state to end which is undesirable as according to the stack pattern the state should be paused

Moreover as coroutines work in unity, the yield return statement(in the state-machine) wont return until the previous started coroutine exits , which is currently as of now responsible for starting the states .

My question is how do i alter this code so as to pause the previous state (that will be pushed into the stack) instead of exiting it and starting anew state

this implementation works fine if there is to be only a single state in the memory

sentences:
2.5D game vector choice I'm developing 2.5D game (3D assets, 2D gameplay). Since gameplay takes place on horizontal plane, majority of game objects have y component equal to 0. Most of my algorithms work on Vector2s, since these calculations obviously make more sense (and are a little bit faster, I guess). This makes field for hard to catch bugs, since Unity allows transparent conversion from Vector3 to Vector2 via cutting off z component.

Since I'm still in a stage in which I can change calculations quite easily, my question is: which approach will cause me the least trouble?

Current: Gameplay on XZ plane, custom conversion from Vector3.XZ to Vector2.XY
Gameplay on XZ plane, calculations on Vector3.XZ (and making sure, that y is always 0 - otherwise some of calculations may be erroneous)
Gameplay on XY plane (that may cause some problems in editor I guess) and automated conversion from Vector3.XZ to Vector3.XY
Gameplay on XY plane, calculations on Vector3.XY (though I see no benefit over solution 2)

Or is there some other approach I may take?

sentences:
How to increase the difficulty setting as close as possible to maximum difficulty automatically? I have a simple 2D version of Mini-golf. The goal is to manage to clear each level in the least amount of shots, the ball is bouncing at most 3 times (stops on the 4th hit) from a wall but not reducing in speed, there is no out of bounds and no obstacles that would remove the ball. Now I would like to add some water/ instant death obstacle at the most annoying places.

How do I find those places?

The player can aim in a 360 radius, if I set the goal of managing a given level in 2 shots, there are 129,600 ways of how the player could shoot the ball. While it should be possible to simulate all of those shots fairly easy, I don't want to add randomly water and check if the level is still possible to clear, rather simulate the level, record all places the ball went over and place on the spots with the most hits water.

What is the best strategy/ a good algorithm to blockade the most ways but to guaranty that at least one way stays clear?

Does the strategy change significantly if moving obstacles (on a fixed path, same rule for bouncing as normal wall) are included?

sentences:
Finite State Machines for Enemies (AI vs. Entity States) Finite State Machines are a great tool for simplifying a system where an Entity has many states it can be in with different conditions that determine what state to transition to. This works well for representing a Player in a platformer, because the state machine can keep track of what state the Player is in based off of user input. This state machine would largely be based around animation states (running, jumping, attacking, etc...)

However, although this makes sense for handling Entity states and keeping track of animations, what about AI states? FSMs also provide a great framework for handling how enemies behave when interacting with the Player. My question is, what is the relationship between this FSM and the FSM that handles general entity states?

For example, in general, an enemy can be running, attacking, idling, jumping, falling, crouching, etc... In terms of AI, the enemy could be following, attacking, running away, patrolling, etc... As you can see, these states are mostly different with some overlap. I want to know how to handle these two different FSMs in code.

Questions:

Should I keep these FSMs separate and update the states separately or should I somehow combine them into one FSM?
If I keep the FSMs separate, how can I can I handle interdependence (behavior in the AI might change if suddenly the Enemy walked off a cliff and is now falling)?

sentences:
What are the steps to get sound from reality into a game? As we all know, the game is not only about gameplay, sound effects add a lot to the production value. The more unique, the better the result.

What are the steps to get a decent quality sound from reality into a game environment?

And some tips probably, as whether I should cover multiple cases of the "sound": normal, echo and other. Or this can/should be done within the engine itself, or post-processed after normal sound?

sentences:
How can I handle two collisions in the same frame? My problem is that I have a player with collisions, and enemy can collide with players collision and execute Hurt function in players script. But the problem is enemies can overlap and can hit the player in the literally same frame. So they both execute Hurt function.

In my Hurt function I change players collision layer for a 2 seconds, and he is no longer be able to seen by enemies. But it doesnt matter because of the same hit by two or more enemies in the same frame.

How can I solve this? I tried bool to check if Hurt function is executed but it doesnt work too...

Here is :

Code on Enemy:

 IEnumerator OnCollisionEnter2D(Collision2D collision)
{
    if (collision.gameObject.CompareTag("Player"))
    {
        //burası kediler üst üste bindiginde birden fazla kez calisabiliyor
        charMovementRef.StartCoroutine(charMovementRef.Hurt());

        Debug.Log("hasar yedi");
    }
}

Code on Player:

//Hurt should only works one at the same time
public IEnumerator Hurt()
{
    //layer değiştirerek düşman collisionlarından kaç
    gameObject.layer = 9;
    //canı azalt
    health--;
    HeartUI(); //show the new health on UI
    //karakter görüntüsü yanıp sönsün
    gameObject.GetComponent<SpriteRenderer>().color = new Color(1f, 1f, 1f, 0.5f);
    //playerı zıplat
    rb2D.velocity = new Vector2(rb2D.velocity.x, 0);
    rb2D.AddForce(new Vector2(0, jumpPower / 1.2f));

    //2 saniyeliğine colliderları kapalı kalsın, sonra eski haline çevir
    yield return new WaitForSeconds(2);
    gameObject.layer = 0;
    gameObject.GetComponent<SpriteRenderer>().color = new Color(1f, 1f, 1f, 1f);

}

sentences:
How do I identify mouse clicks versus mouse down in games? What is the most common way of handling mouse clicks in games?

Given that all you have in way of detecting input from the mouse is whether a button is up or down.

I currently just rely on the mouse down being a click, but this simple approach limits me greatly in what I want to achieve. For example I have some code that should only be run once on a mouse click, but using mouse down as a mouse click can cause the code to run more then once depending on how long the button is held down for. So I need to do it on a click!

But what is the best way to handle a click? Is a click when the mouse goes from mouse up to down or from down to up or is it a click if the button was down for less then x frames/milliseconds and then if so, is it considered mouse down and a click if its down for x frames/milliseconds or a click then mouse down?

I can see that each of the approaches can have their uses but which is the most common in games? And maybe i'll ask more specifically which is the most common in RTS games?

sentences:
Implement spherical mapping for texture coordinates I am using a texture of a world map and I am trying to put that image on a sphere made up of many triangles. Each triangle has points a,b,c with their own (x,y,z) coordinates.

I am trying to use the coordinate system conversions formula from Wikipedia. This is my world to spherical coordinates function:

function worldToSpherical(p) {

  const r = Math.sqrt(Math.pow(p[0],2)+ Math.pow(p[1],2) + Math.pow(p[2],2));
  const u = Math.atan2(p[1],p[0]);
  const i = Math.atan2(Math.sqrt(Math.pow(p[0],2)+Math.pow(p[1],2)),p[2]);

  const s =  r * Math.sin(i) * Math.cos(u);
  const t =  r * Math.sin(i) * Math.sin(u);
  return [s, t];

}

But this is what my output looks like:

It seems to be wrapping around twice. Am I using the wrong formula, or using it wrong?

sentences:
How do I organise the code for an episodic game? We're working on a game that's going to be split into three episodes, which we'll release one after another, as they get finished. I'm worried that our typical somewhat-monolithic architecture is not a good fit for this model.

The game code consists of basically three parts:

_Engine_: Renderer, physics, UI etc.
_Logic_: The concrete scenes and entities.
_Scripts_: Levels and dialogs.

_Engine_ and _Logic_ are native code, _Scripts_ are shipped with the game data and executed at runtime.

I think I can safely assume that:

_Engine_ will be the same for all episodes.
_Logic_ will be largely the same for all episodes. but have some specific parts.
_Scripts_ will differ significantly for each episode.

I see three options for organising this:

Create episode two by copying all the code from episode one, adjusting as needed. I believe this is how sequels are typically done; id Tech 4 appears to be part of the "Doom 3" code, not clearly separated.
Keep all the shared code in one place, making it possible for each episode to override parts of it.
Create a reusable engine, completely separating _Engine_ from _Logic_ and _Scripts_, to be used by all episodes. Shared _Logic_ will either be duplicated for each episode, or generalised and moved into _Engine_. This is how the folks behind "Penumbra" apparently did it.

The major drawback I see with the first approach is that I'll have to back-port any fixes and refactoring to episode one, manually.

The major drawbacks I see with the second approach is that it's more upfront work, and that I'll have to make changes to already released episodes, requiring me to keep testing them.

The major issue I have with the third approach is that it's a big amount of upfront work. and smells a bit like premature generalisation. I cannot fully predict what changes I'll have to make for episodes two and three; it depends on their unfinished design. On the other hand, it would probably give us more flexibility, and speed up development, later.

What is the typical way of organising the code for episodic games? Do I have options, other than the three I can think of?

sentences:
Linear search vs Octree (Frustum cull) I am wondering whether I should look into implementing an octree of some kind.

I have a very simple game which consists of a 3d plane for the floor. There are multiple objects scattered around on the ground, each one has an aabb in world space.

Currently I just do a loop through the list of all these objects and check if its bounding box intersects with the frustum, it works great but I am wondering if if it would be a good investment in an octree. I only have max 512 of these objects on the map and they all contain bounding boxes. I am not sure if an octree would make it faster since I have so little objects in the scene.

sentences:
libgdx - #iterator() cannot be used nested I'm getting this error when I try to check if any of the targets overlap each other:

iterTargets = targets.iterator();
while (iterTargets.hasNext()) {
    Target target = iterTargets.next();

    for (Target otherTarget:targets) {
        if (target.rectangle.overlaps(otherTarget.rectangle)) {
            // do something
        }
    }
}

So I can't do that? How am I supposed to check each member of an array to see if it overlaps any other member?

sentences:
Reuse and Interact With Multi-Layer Tile Maps I'm new to game development and try to make a game where buildings are created in tile maps. My problem is that I need to interact with these buildings and I want to reuse the buildings I created.
Now I would like to export these two layers to a single sprite or prefab to create multiple buildings and to make them clickable.
Is there a way to achieve this or do I have the wrong approach?
EDIT:
My current setup looks like this:
Two tile maps: One tile map contains the wall of the building. Another tile map contains decoration like door or window.
My problem is, that I am not able to export these tile maps as one prefab to reproduce it or to attach scrips.
I am looking for a way to combine these two layers into one resource (=The building with all its decorations, doors, windows), so that I can place them anywhere I want and make them clickable as a game object.

sentences:
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:
How should asset bundles be divided? The only way to load an asset from an asset bundle into memory is to load the entire thing, decompress and pull out the asset you want, then unload the entire thing, except the assets you want. This seems impractical for sharing assets between bundles. For example, if asset bundle A wants a single asset from asset bundle B, it must load all of B, pull out the asset, then destroy B. The alternative to this is to extract the shared assets and create a new bundle call asset bundle C. The problem with this is that B must have been designed this way before being built, which it won't be if it was built before A (it has to be since A depends on B).

Using the resources folder results in a huge blob of bytes that, from what I understand, cannot be changed after build, and is certainly not differ able for patches.

Putting the pros of asset bundles and the resource folder together, I figure that having an asset bundle for every asset is the best of both worlds. Is there problems with this? Is my understanding of asset bundles or the resource folder flawed?

sentences:
Checklist for finished game? I and a couple of friends are doing a game on our spare time and we've finished about 80% of the game.. so all the obvious stuff and core mechanincs. We've done a couple of games before and we always have problems finishing.

The problem isn't that we're not passionate enough about the game, it's rather that no one of us sees those last details that need to be added, we've become blind somehow with the game. It's really frustrating. It can be stuff like.. "maybe we should have a pause function?" "Uhh, yeah, of course, why didn't we think of that earlier?"

Sometimes even though it takes a long time to realise the need, afterwards it's really obvious that it needed to be done/added.

Do you use any kind of checklist to force a finish or do you rely on your keen senses to know when it's done?

A checklist would be nice to have when estimating project time as well..

sentences: Eclipse/LibGDXgame doesn't load textures Our LibGDX project doesn't load textures after building on PC/Android but when it's built from Eclipse using  Ctrl + F11 (Run/Debug) everything is fine. What could be causing that?

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:
Do complementary shadows make sense for games? According to color theory, shadows work better if they don't use pure blacks or grays, but instead use a color that's complementary to the color of the object casting that shadow.

That is, if you have a red apple, you should use a dark green shadow; for a yellow banana, a dark violet shadow.

But in many games, you cannot always predict what kind of background or environment the shadow will appear in, and you may not have the luxury of having dynamic shadow colors. In such cases, does it still make sense to use complementary shadows, or is a neutral black or gray acceptable?

sentences:
Moving a dynamically spawned object I would like to create an object dynamically when the player presses Q and use this object in Instantiate and in transform.Translate.

The problem is that the translation must be outside the if that checks for the Q press, but it applies to the cube that I created inside the if.

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

public class instancier_new_object : MonoBehaviour {

    public float moveSpeed=5f;

    void Update () {
        if (Input.GetKeyDown (KeyCode.Q)) {
            GameObject objet = new GameObject ("objet");
            GameObject cube = new GameObject ("cube");

            cube = Instantiate(
                       objet,
                       new Vector3(1, 2, 3),
                       Quaternion.identity
            );
        }

        cube.transform.Translate(
                 Time.deltaTime*moveSpeed,
                 0,
                -Time.deltaTime*moveSpeed,
                 Space.Self
        );
    }
}

sentences: How important is music to mobile phone (smart PDA) games? Specifically iPhone/iTouch, Droids, and the new Windows Phone 7? I don't know how to quantify this, or if any research has been done. I am wondering how important the music is to the gaming and what % of games come with music at all, if good music at that.

sentences:
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:
Strongly Typed Skills I am working on a skill system for use in a game project I'm chipping away at. The project is entirely in C# so I'm using .NET to its advantage.

In my preliminary implementation of a Skill Category -> Skill types system I'm using subclasses of ISkill and SkillCategory (base class with some virtuals) and using System.Type based reflection to generate a map of these at runtime (on demand).

The great thing about this implementation is that it entirely decouples specific skill types (such as Engineering / LaserWeapons from the SkillLibrary (the container for the generated skill mapping).

The goal is to remove the need to explicitly add each skill at some point as they are automatically detected by the library throughout the entire AppDomain.

Only game logic which relies on these skills use concrete types.

ISkill

public interface ISkill
{
  string GetName();
  string GetDescription();
  int GetSkillLevels();
  float GetMinutesOfTrainingForLevel(int level);
}

[SkillCategory(typeof(EngineeringSkills))]
[PrerequisiteSkill(typeof(ElectronicsSkill))]
public class LaserWeaponSkill : ISkill
{
  public string GetName()
  {
    return "Laser Weapons";
  }

  public string GetDescription()
  {
    return "Allows you to maintain and improve laser based weapons on your ship.";
  }
}

Usage example:

[RequiredUpgradeSkill(typeof(Skills.Engineering.LaserWeapons))]
public class LaserTurretWeapon : IShipWeapon
{
}

There's two slight ugliness's with being very System.Type based, though. One is that my Player._skillLevels dictionary can't serialize as Dictionary<Type, int> because Type isn't supported by DataContractSerializer (what I'm using at the moment).

So what I'm doing in SetSkillLevel<TSkill>(int level) and GetSkillLevel<TSkill>() is translating typeof(TSkill) to and from a string using typeof(TSkill).FullName (i.e. "Game.Skills.Engineering.LaserWeapons").

And the other is potential performance problems, which is something I should profile.

This all works, of course, but it feels like the weak point in an otherwise enum-less, strongly typed skill definition system.

I don't really want to use enums and a "list" of Skill structures, or move it to an external data definition file because then that requires more maintenance of created and deleted enum values and such.

Do you think this is worth it, or do topics such as performance of Type based operations and other considerations make it worth rethinking?

sentences:
AS3 Client not sending movement to server I am having trouble with multiplayer player movement in my game.

The client is in AS3 and the server is in C#.

Here is my problem: When I first launch the game, it connects to the server, and everything works fine. But... when I try to move my player, it isn't sending the UTF8 bytes over to the server. I even have it trace output after the socket sends the bytes. I sent the exact same bytes to the server when the game started just to see if the server recognized it, and it did.

I am not sure why it isn't even sending it at all. This is very frustrating.

private function keyDown(event:KeyboardEvent):void
    {
        switch(event.keyCode)
        {
            case Keyboard.W:
                up = true;
                break;

            case Keyboard.S:
                down = true;
                break;

            case Keyboard.A:
                left = true;
                break;

            case Keyboard.D:
                right = true;
                break;
        }
    }

    private function keyUp(event:KeyboardEvent):void
    {
        switch(event.keyCode)
        {
            case Keyboard.W:
                up = false;

                break;

            case Keyboard.S:
                down = false;
                break;

            case Keyboard.A:
                left = false;
                break;

            case Keyboard.D:
                right = false;
                break;
        }
    }

    private var playerSpdTemp:int = 5;

    private function enterFrame(e:Event):void{
        if (up){
            archer.y -= playerSpdTemp;
            socket.writeUTFBytes("move--"+archer.x+":"+archer.y);
            trace("Sent...");
        }
        if (left){
            archer.x -= playerSpdTemp;
        }
        if (down){
            archer.y += playerSpdTemp;
        }
        if (right){
            archer.x += playerSpdTemp;
        }
    }

I tried putting the socket.writeUTFBytes() in the keyDown and keyUp functions but nothing happens either...

And yes, I have the correct event listeners set up.
The player moves correctly but not the socket.

sentences:
Move object towards the center of coordinating system I would like to move a object towards Vector2(0, 0), but every time I use this script, the object always goes down, instead of going towards the center of the coordinate system.

        void Update()
         {
    //Object rotation
             if (!Input.GetMouseButtonDown(0))
             {
                 _angle += speed * Time.deltaTime;
                 var offset = new Vector2(Mathf.Sin(_angle), Mathf.Cos(_angle)) * radius;
                 transform.position = _centre + offset;
             } else
             {
//Moving object towards center
                 rb.transform.position = Vector2.MoveTowards(transform.position, Vector2.zero, speed * Time.deltaTime);
             }

sentences:
When should iOS gamecenter authentication be called? I'm integrating GameCenter leaderboards into my iOS game. The game has a home screen with a play and "High Scores" button, the game screen itself, and a finished screen with you score, another "High Scores" button, and some other stuff.

When installing the GameCenter package it recommended that you call the authentication function as soon as the device is ready. In this case, if a user that is logged into GameCenter opens the app it immediately says "Welcome back XX" and the player can continue like normal. However, if a user is not logged in, as soon as they open the app they are greeted with the GameCenter login page, which to me is a bad user experience.

The alternative is to only do the initial authorization when the user clicks to see the high scores, if they are logged in it takes them to the leaderboard, if not it prompts them to log in. The problem with this is if they don't try to view high scores until the game is over it would not have saved their score to the leaderboard (as I have it automatically submit if logged in on Game Over).

Which of these two choices is the best? I don't see the first option occur too often as I'm rarely/never greeted with a GameCenter login as I enter a game. Although number 1 is recommended by the plugin I installed. Should I have a dedicated "Sign in" button?

sentences:
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:
Unity SOAP wsdl problem i'm trying to using a SOAP service from my game but the problem is that after using wsdl.exe for generete the connector Unity inform me that System.Web namespace doesn't exist.

How can I use the wsdl?
There is some workaround without writing a lot of code?

Many thanks

sentences:
Prismatic Joint causes a crash-Box2D(cocos2d) tried to set up a prismatic joint, but I get this error upon run time: Assertion failed: (IsLocked() == false), function CreateBody, file /Users/Aether/Developer/JFRecode/JFRecode/libs/Box2D/Dynamics/b2World.cpp, line 109.

Here is the code for the screen boundaries since I am using it as bodyB.

 CGSize s = [CCDirector sharedDirector].winSize;

//define screen boundaries
 // Create edges around the entire screen
 b2BodyDef groundBodyDef;
 groundBodyDef.position.Set(0,0);
 _groundBody = _world->CreateBody(&groundBodyDef);

 b2EdgeShape groundBox;
 b2FixtureDef groundBoxDef;
 groundBoxDef.shape = &groundBox;

 groundBox.Set(b2Vec2(0,0), b2Vec2(s.width/PTM_RATIO, 0));
 _bottomFixture = _groundBody->CreateFixture(&groundBoxDef);

 groundBox.Set(b2Vec2(0,0), b2Vec2(0, s.height/PTM_RATIO));
 _groundBody->CreateFixture(&groundBoxDef);

 groundBox.Set(b2Vec2(0, s.height/PTM_RATIO), b2Vec2(s.width/PTM_RATIO,
 s.height/PTM_RATIO));
 _groundBody->CreateFixture(&groundBoxDef);

 groundBox.Set(b2Vec2(s.width/PTM_RATIO, s.height/PTM_RATIO),
 b2Vec2(s.width/PTM_RATIO, 0));
 _groundBody->CreateFixture(&groundBoxDef);

Here is the code for the prismatic joint itself

b2PrismaticJointDef jointDef;
b2Vec2 worldAxis(1.0f,0.0f);
jointDef.collideConnected = true;
jointDef.Initialize(_shipBody,_groundBody,
                    _shipBody->GetWorldCenter(), worldAxis);
_world->CreateJoint(&jointDef);

sentences:
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:
When should you check collisions? Suppose a basic game with several circles drawn to screen. The user can select and drag any ball and move it around the screen. Should the selected ball overlap with any other ball on screen, the other ball should displace so they are no longer touching.

The example I've seen use the following structure:

for (every ball pair):
   if (collision = true){
   - resolve collision
  }

However, with this method, isn't there a risk that a displacement could cause an overlap in a pair already checked, and therefore the overlap printed to the screen?

Would it not be better to re-check every ball pair's collision, every time a ball is displaced, rather than every time-step?

Maybe something like:

for (every ball pair):
    if (collision = true){
      -resolve collision
         for (every ball pair):
            if (collision = true){
              - resolve collision
              }
       }

EDIT:

Even the method I've listed above shouldn't always provide 100% accurate results. The only way I can think this could work is with some sort of recursive function which only stops when there are no more collisions. Does that seem right?

sentences: How do I make a circular hole inside an editable poly without boolean operations? I have created a rectangle, then converted it into an editable poly. Then I created a circle and converted it to editable poly too. How to make it so that that the circle becomes a hole in the rectangle?

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:
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:
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: Easiest way to make a button in Gamemaker Studio 2 I want to make a menu for my title screen where the user can click on the option they want. The only way I can think of doing this is by making an object that checks if there is a click and then checks if the mouse is on top of it. This feels like a really round-about way to do this. Is there an easier way? I don't yet know how to use the GML so, please use DnD.

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:
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:
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: Design Document Contents What is the minimum content that a game design document should have?

sentences:
How does one multiply by a constant in a VS1.1 assembly vertex shader? I'd like to multiply a vector by -1

e.g.

mul    r0,    r0,    -1

When I try this, I get this error message:

SimpleShaderA.vsh(20,17): error X2000: syntax error : unexpected integer '1l'

How can I specify -1 in my (first) shader program?

sentences: 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:
unity update boolean from other script So my problem is that the color of the sprite should only change if the Boolean is true. My theory is that the Boolean isn't being update. So how do I update the Boolean the whole time and see if it is getting changed.

Thanks Guys,

 public class controlborder : MonoBehaviour
    {
        private SpriteRenderer m_spriteRenderer;
        public float loopdelay = 2f;
        public static bool startstop;
        public void Start()
        {
            m_spriteRenderer = GetComponent<SpriteRenderer>();
            StartCoroutine(Changecolor(2f));
        }
        public void Update()
        {
        }
        private IEnumerator Changecolor(float loopdelay)
        {
            while (true)
            {
                startstop = control.changecolorborder; <== this bool
                Debug.Log(startstop);

                while (startstop)
                {
                    yield return new WaitForSeconds(1F);
                    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;
                    }

                }
            }
        }
    }

sentences:
How to get the closest "visible" object from my "player"? I'm using Unity 3d and i have to accomplish the following task: get the closest "visible" object to my player in forward direction.

It is a sort of radar.

I don't know where to start.
Any advice is welcomed.

Thanks

sentences:
Replace text in Unity i tried to look up my question but didn't really find an answer that works for my situation.

I'm using this unity asset called Dialoguer to create interactive dialogues.
What I'm trying to do is to pass a test in the asset, that test if a condition is true, then replace a specific part of the output text.

My problem right now is I can't find the right code to check for a specific string and replace it with another.

Please help

sentences:
How do I properly use particle simulation in Unity? So I'm using Unity's simulate function to pre-render particles. It seems that simulate is not quite working as to what I expect. It's most likely a setting that I missed. But I just really cannot find the issue.

This is from inside the editor, I clicked on the particle object and just let it run. This is what I'd like.

This is after I've run the game a little bit, then hit pause. This is what is currently happening, for some reason the particles get bigger.

Here is the script that I've attached.

public float initTime;
public ParticleEmitter partEmitter;
// Use this for initialization
void Start () {
    for (float i = 0.1f; i < initTime; i = i + 0.1f) {
        partEmitter.Simulate(i);
    }
}

I've run this scene in both Unity 3.5 and in Unity 4.0. Same thing happens in both versions.I'm pretty sure that it's something to do with the script. But I've tried many different pieces of code and they are all similar and do the same thing.

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:
Is Scaleform/Flash used in console games for non-UI, game elements? I work for Konami as a Flash developer, and got sent some code for a puzzle mini-game from a new, yet-to-be-released Silent Hill game for PS3/Xbox 360.  It was a windows executable, but it was made in Flash, and I saw some GFX (Scaleform) libraries in the source.  I was very surprised by this, as I thought the extent of Flash's reach into console games was simply for UI.  Granted, this was an essentially 2d, UI-centric puzzle minigame, but nonetheless, this was a gameplay useage of Flash/Scaleform in a "next-gen" console title.

My question is, how prevalent is this?  I really want to get into console programming, and if this is something that appears elsewhere, maybe I can apply my Flash/Actionscript skills to getting a job working on console titles.  Anyone have any thoughts or experiences with this?

Thanks!

sentences:
How do I approximate the result of battle between two armies with known strengths? I need a simple algorithm to calculate the outcome of two differently sized armies battling.

Each army has 1-100 troops and every troop is the same value on the battlefield. The troops do not have individual stats. The only parameter on each army is the number of troops. For example: A with 57 troops battles B with 89 troops. Who wins?

Randomness can be a factor: For example, there could be a 50% chance that team A's total is subtracted by half of team B's total. Here's what I have so far (in a variation of BASIC):

lbl 1
If A>B goto2
If A<(or equal to)B goto3
lbl 2
50% chance B-((A-B)/2)→B
50% chance A-(B/2)→A
goto4
lbl 3
50% chance A-((B-A-/2)→A
50% chance B-(A/2)→B
goto4
lbl 4
If A=0:stop
If B=0:stop
goto1

So this system repeats until one of the armies reaches 0 troops.

The problem is, the battles go too fast. The battle is done almost instantly sometimes. Is there a better algorithm?

sentences:
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:
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 do I draw an animated object in OpenGL ES? I have a VBO, which I initialise like this (just an example):

- (void)setupVBOs {

    GLuint vertexBuffer;
    glGenBuffers(1, &vertexBuffer);
    glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);
    glBufferData(GL_ARRAY_BUFFER, sizeof(Vertices), Vertices, GL_STATIC_DRAW);

    GLuint indexBuffer;
    glGenBuffers(1, &indexBuffer);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(Indices), Indices, GL_STATIC_DRAW);

}

As you can see, I'm  using GL_STATIC_DRAW, which is good for visually unchanging objects (not including translations and such).

How do I draw animated objects though? I mean things that might be changed by user interaction. This video is a good example. It is obvious OpenGL is being used, as the vertices are manipulated by gestures.

How is it done? by changing the x y z coordinates on every touch? Are they using GL_DYNAMIC_DRAW? Is this hard?

sentences:
Gamemaker Multiplayer Game I'm trying to implement multiplayer into my game using the server client model. What is the best method of synchronozing the game between the clients? What I'm thinking is that the game runs on the client, where the clients send the inputs (keyboard input for example) to the server, and the server then passes that on to the other clients, which then process that information. To make this system more robust the game would also run on the server, and the server would send synchronization packets to synchronize all the instances in the room. I can already see some potential flaws in this design, so that's why I'm asking for a better implementation. Both the server and client run in gamemaker.

To give you some context: my game is a relatively simple rpg platformer, where you have an inventory and items, player stats like armor and physical damage (the stats are almost identical to those of league of legends). You move with the arrow keys or wasd, like a regular platform game. For now I want to implement pvp, but would like to set up networking in a way that allows for npcs. I want to have a maximum of say 4 or 5 players connected at a time.

I have read up on client prediction, server reconciliation, entity interpolation and lag compensation, but it seems overkill for my application (it might not be I'm not sure).

I guess there it is somewhat acceptable to have a pure authoritative server, other than the fact that the player movement will become unresponsive, which is a big issue. Also using items and switching between then will become less responsive, which will make pvp less intense, but I can't think of a reasonable workaround for that.

Also, I am not worried about cheating as I am making this game just to have fun with friends.

Thanks.

sentences:
Get all triangles that are < N dist from you? Does anyone know of a way I could add a radius to this code for p? Like basically saying "this is true if the triangle is < N dist from the point"

public boolean isPointInTriangle( Vector3f p, Vector3f a, Vector3f b, Vector3f c )
{
    return ( pointsAreOnSameSide(p, a, b, c) && pointsAreOnSameSide(p, b, a, c) && pointsAreOnSameSide(p, c, a, b) );
}

public boolean pointsAreOnSameSide( Vector3f p1, Vector3f p2, Vector3f a, Vector3f b )
{
    Vector3f diffba = new Vector3f(0,0,0);
    Vector3f.sub( b, a, diffba );
    Vector3f diffp1a = new Vector3f(0,0,0);
    Vector3f.sub( p1, a, diffp1a );
    Vector3f diffp2a = new Vector3f(0,0,0);
    Vector3f.sub( p2, a, diffp2a );

    Vector3f cross1 = Vector3f.cross(diffba, diffp1a);
    Vector3f cross2 = Vector3f.cross(diffba, diffp2a);

    return ( Vector3f.dot( cross1, cross2 ) >= 0 );
}

sentences:
Self-illumination vs luminance I'm using a graphics format reading library which has an enum called "MaterialLuminanceMode". There are three luminance modes for materials available:

Self-illumination, which I interpret to mean "glow", as in a glowing light bulb,
Color emission, which I interpret to be using the diffuse color mask for the lumination,
Luminance, which I interpret to be the exact same as self-illumination.

Does anybody know what the difference between the first and third enum value is?

The best resource I could find seems to suggest that self-illumination is a superset of luminance, but I'm still not certain what exactly separates the two! Note this is from 3ds, which i also an Autodesk product - although not the exact format I'm reading (which is DWG)

sentences:
How to calculate the price for acquisition of a mobile game I searched long and hard thru the Game Dev community here and I didn't manage to find a good enough answer for a situation that I need help with.

Here is the deal - I've spent about a year to single-handedly develop a mobile game which is a mix between MMORPG and idle battle games. Wouldn't like to go into too much depth as to which game we are talking about and who is trying to buy it but, a company I have worked for before reached out to me with a proposal to buy the game from me so they can reap the profit from it and develop it further since they are a professional game dev company while I am a single person and I can't really reach the game's full potential as far as growth and player base goes. Now the game is pretty beneficial for me since I live in a region with a very low-income standard so the money I get from the game might not be much for many other people but for me, they are equal to about 1.5 ~ 2 monthly salaries (we are talking average salary for this country). That is about 600 Euros of pure profit after I pay for all the expenses. Of course, this number fluctuates depending on different events and sales I release and general user activity. It is a free-to-play-game so the income is mostly from microtransactions for in-game rare currency and special event item packs purchases.

Now the issue I have is that I am not sure how to set a price for the acquisition. What feels right for me would be to calculate the potential average income from the game in the next 12 months and add to this the average salary per month for a game dev of my qualifications multiplied by the number of months it took me to develop it to its released state. That would round up to about 15k euros.

When I think about it 15k euro isn't a small price to pay, but the game will pay that off in the next 1-2 years, and it might even grow much faster after they make investments for advertising and release new features and so on and so on. This means that after the second year they should be on a clean juicy profit from that deal, and that sounds good to me as well since 15k euros for me is a decent sum of money considering that the game has been running for about 14 months. And lets not forget that it has been beneficial for me for the last few months so it hasn't been always uphill.

What I need really is an advice as to is this price of around 15k Euro justified and is it a good deal for both sides, since I don't want to shoot way high and blow the acquisition, but I don't want to give the game away for a low price since it really holds a lot of potential, and it is my first fully released game.

sentences: Return different components by name in entity component system I'm working on an entity component system but I'm having trouble with the editor. Components take the form of structs with this formula Component healthComponent; This works fine when you know what component you want but for the game editor I'm working in a dynamic way and need to be able to simple get any component of an entity by string for example auto component = GetComponent("Health", entityId); I know c++ is strongly typed so is there any work around for this?

sentences:
How to create an API for event-based, modular Java game? I don't really know how to explain what I am trying to do that well, but yeah I'll try my best.

I'm currently creating a game with LWJGL 3, and I hope to make it event based and rather abstract as to allow the game to be hopefully easily moddable by community members through their own .jar files. To give them the ability to modify the current functions of the game, I want to make the game event based so they can listen to events and modify them or cancel them completely before my function executes, and provide a way for them to create their own structures, entities, events, artifacts(items), et cetera. I just cannot wrap my head around how to do this exactly, at least with creating the API.

I spent a lot of time researching and I just came up with allowing modules through Unity or with Lua, but that's not what I am looking for. So, what is the best way to set up an API like this? Do I create interfaces for all of my own events, entities, items, and things or do I just create base interfaces which I implement in my own classes? Then however I do this, what do I actually provide for them to create their mod/module? My whole game or just these interfaces. I just cannot figure out a good way to set up the API especially since I've never created one myself, let alone for a game.

sentences:
How to draw a tileset using HTML5 canvas? I have a tileset something like this:

0, 1, 2, 3, 4, 5,
6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16,
17, 18, 19, 20

My tileset draw code looks like this:

var image = new Image();
image.src = '32x32.png';
var tile = 5;
var tileSize = 32;
var x = 100;
var y = 100;
context.drawImage(image, Math.floor(tile * tileSize), 0, tileSize, tileSize, x, y, tileSize, tileSize);

And this code draws the 5 tile, but how would I draw the 10 tile, or the 15 tile without adding tileX and tileY?
I probably need something like if tile is equal to 15, then draw tile 15.

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:
Disabled script works anyway I have a simple code that will be enabled when I kick, so I disable it right away but even though it is disabled, it works somehow. can it be because of his parent or something else I dont know of?

//this is the script Kick_Test, i dont reach it from anywhere else
private GameObject ball;
private Rigidbody2D rg2d;
public int power = 30;

void Start()
{
    ball = GameObject.FindGameObjectWithTag("Ball");
    rg2d = ball.GetComponent<Rigidbody2D>();
    this.enabled = false;
}

private void OnTriggerEnter2D(Collider2D col)
{
    if(col.tag == "Ball")
    {
        Debug.Log("KİCK");
        Vector2 pos = (transform.position - col.gameObject.transform.position).normalized;
        rg2d.AddForce(-pos * power, ForceMode2D.Impulse);
    }
}

sentences: Hiding pixels inside a Shape I have a player wich is a png image and I want a part of him to be able to go behind things, so I need to know how to hide pixels that are inside of a shape

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

Thanks in Advance.

The code i have on my player is this:

using UnityEngine;
using System.Collections;

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

sentences:
How to avoid cost comparison each and every frame? I'm toying around with a ticker(incremental game) for JavaScript.

The basic idea is that you have buttons that represent buildings, each building provides a certain amount of resource per 'tick'.

Each building can cost an arbitrary amount of resource types and amounts (a farm can cost wood, food and labor for example). The game is intended to have several dozens of buildings, units, technologies etc.

I would like to disable the buttons of buildings that you can't currently afford.

My concern: I prefer not to loop over every item and every cost within it to see if we have enough to build it every single tick (a tick is 50ms~).

Is there a 'smart' way that I missed that solves this issue without brute force?

EDIT :
I decided to approve the answer that basically says "Just ignore the problem".
The reasoning behind it is as follows :

Tests indicated that while the theoretical problem is interesting, it's of little consequence in a reality, the performance hit is extremely minimal.
This website is about solving problems, and as "sam hocevar" suggested, The answer needs to be as clear as possible(and the reason behind it).
While the answers are clever and very interesting to read as a theoretical background , they all address the "number of checks", while some answers reduce that number by some fraction, non actually mitigate the amount by any performance-altering number.
Following on 3, It seems that if you've come to a point where you need to implement any of the suggested, over-engineered, solutions to save performance, It seems that the gain from those solutions will be so minimal that performance will still be an issue even after implementation, making the entire game model not viable anyway.

TL;DR - If it doesn't work by ignoring the problem, it probably won't work with over-tweaking it either.

sentences:
How do I get access to the SpriteBatch service in my Sprite class using XNA? I have the following Sprite class (leaving out everything that doesn't pertain to my question):

public class Sprite
{
    public Texture2D Texture { get; set; }
    public Vector2 Position { get; set; }
    private SpriteBatch _spriteBatch;

    public Sprite(Texture2D texture, Vector2 position)
    {
        Texture = texture;
        Position = position;

        // what code do I put here?
        _spriteBatch = ???
    }

    public virtual void Draw()
    {
        _spriteBatch.Draw(Texture, Position, Color.White);
    }

In my Game1.cs class, I register the SpriteBatch as a service:

protected override void LoadContent()
{
    _spriteBatch = new SpriteBatch(GraphicsDevice);
    Services.AddService(_spriteBatch);
}

Problem is, I don't know what code to put in the Sprite constructor to get the SpriteBatch object from the service. It doesn't have access to the Game.Services object. How would I load the service in this case?

sentences:
Slick2D and Nifty GUI I am currently trying to combine both slick2d and nifty to work together. I've had some amount of success - I can now actually run my test and it won't crash. As far as I can tell, it will also receive input properly.

First, I'm having doubts I'm doing it right. I extend NiftyStateBasedGame in my outer game and then I extend two NiftyOverlayGameState to create the two states. However, I am getting an error that doesn't crash my application saying:

WARNING: An event service by the name NiftyEventBusalready exists.  Perhaps multiple threads tried to create a service about the same time?
org.bushe.swing.event.EventServiceExistsException: An event service by the name NiftyEventBusalready exists.  Perhaps multiple threads tried to create a service about the same time?
    at org.bushe.swing.event.EventServiceLocator.setEventService(EventServiceLocator.java:123)

I could ignore it, since the application is running well enough (I think?) but I'm concerened that once I figure out how to actually implement some parts of the GUI they might not work.

Which leads me to my next question. I was trying to create a simple button on screen and I could not for the life of me figure out how to go about it. I have my nifty instance... But what do I do with it? Any pointers in the right direction would be greatly appriciated!

My three classes:

The outer class, TheGame (This is the StateBasedGame)

public class TheGame extends NiftyStateBasedGame
{

    Menu menu;
    Nifty nifty;
    GameOver go;

    public TheGame(String name)
    {
        super(name);
        menu = new Menu();
        go = new GameOver();

    }

    @Override
    public void initStatesList(GameContainer arg0) throws SlickException
    {
        this.addState(menu);
        this.addState(go);

    }

    public static void main(String[] args) throws Exception
    {
        AppGameContainer game = new AppGameContainer(new TheGame("OMG, Super test!"));

        game.setDisplayMode(800, 600, false);
        game.setAlwaysRender(true);

        game.start();

    }

And the two dummy classes the are the states:

public class Menu extends NiftyOverlayGameState
{
    @Override

    protected void initGameAndGUI(GameContainer gc, StateBasedGame sbg) throws SlickException
    {
        initNifty(gc, sbg);
    }

    @Override
    protected void renderGame(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException
    {
        g.drawString("Does it work?", 100, 100);

    }

    @Override
    protected void updateGame(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException
    {
        Input input = gc.getInput();
        if (input.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON))
            sbg.enterState(1);
    }

    public int getID()
    {
        return 0;
    }

public class GameOver extends NiftyOverlayGameState
{

    protected void initGameAndGUI(GameContainer gc, StateBasedGame sbg) throws SlickException
    {
        initNifty(gc, sbg);
    }

    @Override
    protected void renderGame(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException
    {
        g.drawString("WORKS, OOOH-YEA!", 100, 100);
    }

    @Override
    protected void updateGame(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException
    {
        Input input = gc.getInput();
        if (input.isMouseButtonDown(Input.MOUSE_RIGHT_BUTTON))
            sbg.enterState(0);
    }

    public int getID()
    {
        return 1;
    }

Again, if compiled, this gets me the two screens I want with the warning/exception I mentioned above. What am I doing wrong? And how would I start actually adding GUI elements to this?

sentences:
Procedural river or road generation for infinite terrain I should say paths, not roads as I'm thinking more medieval-like. Also, not looking for realism. The answer I'm looking for will be to fit into the mold I describe rather than realism.

I am looking for a method to generate procedural roads/rivers in a curvy sort of fashion, but I'm wanting to do so for a infinite terrain type system. Just like how perlin noise generates blobs, I'm wanting to generate random length line segments (possibly infinite length).

I'm aware of strategies like the suggested answer found here, however it relies on a specified start and end point to work, I don't have a specified start and end point. I'd like to be able to simply call a function using arbitrary coordinates and have it return whether the specific coordinates are part of the river/road.

I am not wanting to require terrain to be generated in advance. That includes a heightmap (like used for rainfall simulations or similar). I would also not want to require a start/end point.

Is there such an algorithm or tweak to a noise algorithm someone might know of to accomplish what I'm trying to explain?

The closest I've came to so far is multi-ridged fractals, if I'm using the name properly. I'm just taking the absolute value of value noise (assuming it is scaled to -1 to +1) and setting a threshold. My primary issue with this is the lines overlap way too often, are mostly circular, sometimes converge to form large lakes which is neat but undesired, and often times the thickness of the lines vary too much.

Here's a picture of what I have so far in 2D, but at a very high frequency to show more detail:

sentences:
How can I render player movement on a 2d plane efficiently? I'm prototyping a 2d HTML5 game with similar interaction to Diablo II. (See an older post of mine describing the interaction here: How can I imitate interaction and movement in Diablo II?)

I just got the player click-to-move system working using the Bresenham algorithm but I can't figure out how to efficiently render the player's avatar as he moves across the screen. By the time redraw() is called, the player has already finished moving to the target point. If I try to call redraw() more frequently (based on my game timer), there's incredible system lag and I don't even see the avatar image glide across the screen.

I have a game timer based off this awesome timer class: http://www.dailycoding.com/Posts/object_oriented_programming_with_javascript__timer_class.aspx

In the future, there will be multiple enemies chasing the player. Fast pace is essential to the experience.

What should I do?

sentences:
Serious issues with grid of connected springs So i have a simulation I am trying to make where there is a grid. Each dot will be connected to the dot Above, below, left, or right (If such dot exists) via a logical grid.

Theoretically when I create a disturbance it will react slightly like cloth.

My problem is it is going all wrong! I didnt know which way to subtract to get the delta so I gave you two samples.

Issue one Detract: This one is probably the wrong one but it might help. Basically when you cause a disturbance it causes everything to fly away. Its pretty cool looking.

Issue two Attract: This one is probably using the correct delta, however when left on its own the grid eventually groups in on top of itself. Ignore the diagonal ones at the very beginning those are just an error, I removed them since recording that video.

Below is excerpts from the code that causes this. This system works entirely on a 1d array (because they arent always even close to a grid) and as a result I have a bunch of functions that find the index of next-door points. I am not showing their implementation unless that is likely to be the error.

The velocity resulting from the spring is stored in a variable springV.

Each frame the interaction displacement and resulting spring velocity is calculated through function transfer. Then after all of that is calculated it is applied to the positions through function resolveGridS. Transfer() is run on each particle one by one in an order, then resolveGridS is run after that.

Theoretically the correct force given from having a spring from the nextdoor point is calculated in the function resolveGridS and added to the total.

The "Resting" distance of the grid is about 30.

 var springV = Point()
    func transfer()
    {
        if (excluded) {return} //Gets rid of points not on the grid, they dont get to be springs

        let touch = MT.getFirstFinger()
    if (touch.down)
    {
        let location = getPosition()
        let dist2p = Math.dist2P(location, touch.location) / Storage.bounds.rb
        let angle = Math.calculateAngle(location, touch.location)
        pointTowords(touch.location)
        direction += 180
        let calc = (-dist2p * dist2p) + 1.0
        if (circleIndex == 0) {print(calc)}
        moveBy(calc / 5)
    }

    let id = Int(circleIndex / 5) //Get the 1d array location of this particle

    //Get the 1d array index of each of the next door points
    let above = moveDirection(id, Direction.Up)
    let below = moveDirection(id, Direction.Down)
    let left = moveDirection(id, Direction.Left)
    let right = moveDirection(id, Direction.Right)

    //Drag
    springV.x /= 1.1
    springV.y /= 1.1

    if (left.1 == -1) //This check just deals with edge cases
    {
        SpringC(Storage.particles[left.0].getPosition())
    }

    if (right.1 == -1)
    {
        SpringC(Storage.particles[right.0].getPosition())
    }

    if (below.1 == -1)
    {
        SpringC(Storage.particles[below.0].getPosition())
    }

    if (above.1 == -1)
    {
        SpringC(Storage.particles[above.0].getPosition())
    }
}

func resolveGridS()
{
    Storage.circles[circleIndex] += springV.x
    Storage.circles[circleIndex + 1] += springV.y
}

  func SpringC(loc: Point)
  {
        let pos = Point(x: Storage.circles[circleIndex], y: Storage.circles[circleIndex + 1])
        let delta = Math.subtract(loc, pos)
        let dist = Math.dist2P(delta)
        let norm = Math.multiply(delta, 1 / dist)

        springV.x += norm.x * 0.01 * abs(dist - 30)
        springV.y += norm.y * 0.01 * abs(dist - 30)

    }

NOTE: I really dont know how you are supposed to deal with physics when one object has multiple springs connected to it. I made the assumption that you just calculate the force each spring gives for each object. And then after all of the forces are calculated you apply it. That could be wrong.

sentences:
Why can't I rotate anything to be "more than 360 degrees or less than 0 degrees"? I've been trying to make an animation in Unity, but most assets already come bundled with everything facing at 0 degrees, not to say it's a bad thing.
However, the problem I'm facing is that the animation keyframes aren't playing out correctly.
When this is done with raw measurements (simply dragging the XYZ rotations), negative and greater than 360 degree angles are taken account. But then again - Unity could be simply remapping them, whcih is not the case.
For example, the prop_robotArm prefab, found within Unity's Robot Factory asset pack has a rotator script that simply rotates the whole thing along the Y axis.

void OnFixedUpdate()
{
    transform.Rotate (new Vector3(0, rotateSpeed*Time.deltaTime,0));
}

Meaning that after slightly more than a full revolution, the Y rotation value should be more than 360 degrees, which it does end up becoming... Eventually.

Thinking that was possible, I tried to mimic this behavior by making the arm rotate 720 degrees (twice) in an animation file (this is not using the rotator.cs script attached to the body in the example above).
Instead, all I ended up was the arm's body staying still as 720 is the same as... 0 degrees in rotation changes.
So, I tried a second experiment; trying to rotate from 359 degrees to 1 degree (or -1 to 1 degree).
Just like above, it didn't go to plan. When the animation is run, it simply runs from 359, through every angle in-between before reaching 1, instead of 359, 360 (0) and 361 (1).
If you don't get what I mean, see the diagram below.

So, I was wondering, is there a way to allow for such rotation to be defined in an animation curve?
Every time I try doing it, any value greater than 360 (or lesser than 0) is replaced by its co-terminal counterpart that's between 0 and 359.999999...999.

sentences:
3dsmax crashes when exporting I'm trying to export a (.max) file to openCOLLADA (.dae). Whenever I do this, 3dsmax crashes and produces this error:

  An error has occurred and the application will now close.
      No scene changes have occurred since your last save.

3dsmax then crashes but the COLLADA file is still produced. Whenever I try opening this COLLADA file in other software though, it comes up with a bad mesh data error. This is leading me to think that it wasn't exported correctly out of 3dsmax. Any advice?

sentences:
snapping an angle to the closest cardinal direction I'm developing a 2D sprite-based game, and I'm finding that I'm having trouble with making the sprites rotate correctly. In a nutshell, I've got spritesheets for each of 5 directions (the other 3 come from just flipping the sprite horizontally), and I need to clamp the velocity/rotation of the sprite to one of those directions. My sprite class has a pre-computed list of radians corresponding to the cardinal directions like this:

protected readonly List<float> CardinalDirections = new List<float>
                           {
                               MathHelper.PiOver4,
                               MathHelper.PiOver2,
                               MathHelper.PiOver2 + MathHelper.PiOver4,
                               MathHelper.Pi,
                               -MathHelper.PiOver4,
                               -MathHelper.PiOver2,
                               -MathHelper.PiOver2 + -MathHelper.PiOver4,
                               -MathHelper.Pi,
                           };

Here's the positional update code:

if (velocity == Vector2.Zero)
            return;

        var rot = ((float)Math.Atan2(velocity.Y, velocity.X));
        TurretRotation = SnapPositionToGrid(rot);

        var snappedX = (float)Math.Cos(TurretRotation);
        var snappedY = (float)Math.Sin(TurretRotation);
        var rotVector = new Vector2(snappedX, snappedY);

        velocity *= rotVector;
        //...snip

private float SnapPositionToGrid(float rotationToSnap)
    {
        if (rotationToSnap == 0)
            return 0.0f;

        var targetRotation = CardinalDirections.First(x =>
                (x - rotationToSnap >= -0.01 && x - rotationToSnap <= 0.01));
        return (float)Math.Round(targetRotation, 3);

    }

What am I doing wrong here? I know that the SnapPositionToGrid method is far from what it needs to be - the .First(..) call is on purpose so that it throws on no match, but I have no idea how I would go about accomplishing this, and unfortunately, Google hasn't helped too much either. Am I thinking about this the wrong way, or is the answer staring at me in the face?

EDIT: Thanks Gregory for the answer. Only thing I really had to modify from the answer  was to re-construct the velocity vector to the new snapped rotation (I'm sure there are further optimizations that I can do, but for now it's enough that it works!):

        var snappedX = (float)Math.Round(Math.Cos(TurretRotation), 3) *
                           velocity.Length();
        var snappedY = (float)Math.Round(Math.Sin(TurretRotation), 3) *
                           velocity.Length();
        var rotVector = new Vector2(snappedX, snappedY);

FOLLOW-UP EDIT:
The initial answer worked very well as a naive implementation, but suffered from inaccuracies of up to 45 degrees when dealing with negative angles; -3.14 snapped to -2.356 for instance. To correct that, I added a check to account for those situations.  Below is a complete implementation of a SnapToGrid method. Some optimizations have been made, like pre-computing the various divisors of Pi to avoid the division. Further optimization could possibly be achieved by looking for short-circuit scenarios, i.e. if rotationToSnap ~=0, but if anyone has further optimizations, I'd be curious to see them!

public static float SnapPositionToGrid(float rotationToSnap)
{
    if (rotationToSnap == 0)
        return 0.0f;

    var modRot = rotationToSnap  % MathHelper.PiOver4;

    float finalRot;

    if (modRot < RoundedPiOver8)
    {
        if (modRot < -RoundedPiOver8)
            finalRot = rotationToSnap + -MathHelper.PiOver4 - modRot;
        else
            finalRot = rotationToSnap - modRot;
    }
    else
        finalRot = rotationToSnap + MathHelper.PiOver4 - modRot;

    return (float)Math.Round(finalRot, 3);
}

sentences:
Combining Quaternion Rotations I'm trying to understand Quaternions in relation to rotation and orientation.
As an example in learning, I'm trying to rotate a point (e.g. at [0.7071, 0, -0.7071], on the unit sphere) about the line x=z (or the vector [0.7071, 0, 0.7071] for a unit vector pointing in x/z direction. It should rotate around the unit sphere, passing through [0,1,0]
I've read that "multiple rotations are just multiplication", but if that's the case, why are the following are not equivalent?
# This version does what I want, rotates a point about the line x=z
val q = Quaternion().setAngleAxis(toRadians(45), 0.7071, 0, 0.7071)

# neither of the following multiplications produce the equivalent to the above q
val qx = Quaternion().setAngleAxis(toRadians(45), 1, 0, 0)
val qy = Quaternion().setAngleAxis(toRadians(45), 0, 1, 0)
val q1 = qx.mul(qy)
val q2 = qy.mul(qx)

(My reasoning is like looking at a unit vector starting in the x direction, which if I rotate 45 degrees in the y axis would give me a vector pointing in the z=x direction, but this is clearly naive as it doesn't work)
An example plot of qx * qy (but using 5 degree rotations instead of 45) is:

The q rotation I want gives me:

My understanding is qx and qy represent rotations about the given axis, or indeed also represent orientations, and if I use these independently and plot them, I get what I would expect, a point being rotated as required.
But if I start from either one of these, why doesn't the multiplication of the other (which represents an initial orientation multiplied by a rotation) result in a rotation that would rotate a point by both the x and the y axis?
Which leads me to the question, what does qx * qy (or vica verca) represent here? (I think this is the key bit I'm not understanding.)
Is it possible to apply something to qx or qy to get the original q directly?

sentences: Enabling virtualization on a PC I was designing games in unity with some friends but none of us have a mac so none of us can download the apple sdk.  To use the sdk, we will have to run a virtual machine with osx on it.  Virtualization is disabled on most PCs by default and I was wondering if there was any way to change that without rebooting into the bios.  If not, how would I change it in the bios?  Thanks for your help.

sentences:
Rotation going wrong I'm calculating matrices by hand. Translations are fine:

 void Translate (float x, float y, float z, float[4][4] m) {
     Identity (m);
     m[3][0] = x;
     m[3][1] = y;
     m[3][2] = z;
 }

If I multiply a vector with this matrix, I get the correct transformation. My problem now is Rotations. I copied the definition from the OpenGL reference on glRotation, but I can't get it right. Can you spot my mistake?

void Rotate (float angle, float x, float y, float z, float[4][4] m) {
    float c = cos (angle);
    float s = sin (angle);
    m[0][0] = x*x*(1-c)+c;
    m[0][1] = y*x*(1-c)+z*s;
    m[0][2] = x*z*(1-c)-y*s;
    m[0][3] = 0;
    m[1][0] = x*y*(1-c)-z*s;
    m[1][1] = y*y*(1-c)+c;
    m[1][2] = y*z*(1-c)+x*s;
    m[1][3] = 0;
    m[2][0] = x*z*(1-c)+y*s;
    m[2][1] = y*z*(1-c)-x*s;
    m[2][2] = z*z*(1-c)+c;
    m[2][3] = 0;
    m[3][0] = 0;
    m[3][1] = 0;
    m[3][2] = 0;
    m[3][3] = 1;
}

I don't know what else is relevant, so, if you're kind enough to lend me a hand on this and if I just don't present enough info, just say it.

Thank you for taking the time to read this question.

EDIT
The trouble I'm having is the following: If I do Rotate (180,0,0,0), the vertexes are inverted as intended but the resulting triangle (in this case) is smaller.

Screenshot:

sentences:
Android sprite sizes? When creating an android game for example space invaders. How big would the sprites have to be? The Enemy ships and player ship and boss ships. So they fit on the android phone and is playable. I'm confused between resolution and this.

Thanks.

sentences:
undefined reference to std::__throw_out_of_range_fmt after some time with oxygine i have decided to start learning SFML, i configured codeblocks to link the header files and .so files, and whenever i try to compile i get this error:

||=== Build: Debug in shouldWorkNow (compiler: GNU GCC Compiler) ===|

SFML-2.3.2/lib/libsfml-graphics.so||undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)@GLIBCXX_3.4.20'|

||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

the SFML package came from their website, under the gcc 64bit for linux, the files are DEFINITELY linked as i used a hundred tutorials on the Internet and youtube.

(mint 17.2 Rafaela | default gcc from apt-get | sfml 2.3)

sentences:
Best way of writing pixel manipuliting-intensive applications with OpenGL/Direct3D Recently I have been making little experiments with engines similar to old Wolfenstein 3D, Doom and Build, engines where the 3D rendering is entirely done in software and therefore you need full access to the screen buffers at pixel level.

In the days of DOS and before we had current GPUs it was relatively straightforward to get a surface to plot pixels. You had to devise the fastest way to do your calculations and the fastest way of updating the framebuffer. In fact, it is still possible by using libraries like SDL, which still give you a reasonable speed when you manipulate surfaces at pixel level.

So I wonder which would be the best way of dealing with pixel-intensive applications like the ones I suggest using current GPUs, by using OpenGL or Direct3D.

I understand this sounds absurd, but I have been looking at API documentation and it seems that it is a feature that we have somewhat lost in current hardware. I see suggestions as using glDrawPixels or using pixel shaders, but no solid explanation or theory which can help me to make the right decisions.

sentences:
How can i exclude "Y" from drag in unity? I'm trying to make a moving object drag when no input is received, but i want the drag to only apply to X and Z variables, and not Y. Meaning i want it to fall at a normal speed, but when i stop giving it force in x and z directions, i want it to gradually and quickly stop going in those directions. How can i achieve this?

I've done this:

Vector3 input = new Vector3(Input.GetAxis("Horizontal") , 0, Input.GetAxis("Vertical");
If (input.x == 0 && input.z ==0) rb.drag = 3;

sentences: How do I generate a sphere mesh in Unity? I'm making a game and I need a way to generate a sphere mesh in Unity for whatever reason. It needs to be generated by code and not be a pre-made sphere or a sphere primitive as I need to edit in generation later on.

sentences:
Error: Framework 'Mono / .NET 3.5' not installed Recently I installed Ubuntu-Mate 16.10. Unity and Monodevelop works, but when I try to compile the javascript on Monodevelop, appears an error:

Error: Framework 'Mono / .NET 3.5' not installed. (Assembly-CSharp)

On 14.04 all works very well but not here....what is the way to fix this problem??

I searched on the internet and I can't find the answer.

sentences:
When entities don't draw themselves, who actually does? There are countless questions here about whether entities should draw themselves or not. The answer is almost universally no, there should be a renderer. And I do see a point in having a single place where everything is rendered. Makes asset management easier and the code less convoluted.

However, I'm struggling to find a good approach to implement this in my 2D game. Currently, every entity is told to draw itself, and I pass the renderer object to it. Now, I want the renderer to draw each entity, but I don't want the renderer to actually know about entities, so I need a more generic class, e.g. RenderObject, and a way to construct render objects from entities.

One obvious approach would be to have a GetRenderObject() method on each entity. However, some of my entities actually draw multiple textures, relative to their position, so I'd probably need a GetRenderObjects() function instead.

But that wouldn't really remove any rendering logic from my entities. I'd still have to refer particular assets and their positions relative to the entity position in the render objects I create.

So my question is: Doesn't having a renderer mean that my entities don't have any drawing logic anymore? If so, who will generate these render objects? Does it even make sense to take the render objects detour?

And, bonus question: How can this work together with a UI system? I'd rather not have the renderer know about widgets and containers and such, so my hunch so far is to have widgets stick to drawing themselves.

sentences:
Platformer collision detection problem - player snapping onto sides I am having problems with collision detection. I am trying to make a simple platformer but when the player is falling or moving too fast it sometimes detects the wrong collision side. I am getting the side of the collision by checking the distance between the player and the sides of a block that are exposed to the player. I also tried detecting collision one axis at a time but this glitch still occurs.

blockCollision: function(block) {
        if(this.x + this.width > block.x && this.x < block.x + block.width && this.y + this.height > block.y && this.y < block.y + block.height) {
            let distanceLeft = Math.abs(this.x + this.width - block.x)
            let distanceRight = Math.abs(this.x - (block.x + block.width))
            let distanceTop = Math.abs(this.y + this.height - block.y)
            let distanceBottom = Math.abs(this.y - (block.y + block.height))

            if(distanceLeft < distanceTop && distanceLeft < distanceBottom && !block.collisionSides.includes('L')){
                this.velX = 0
                this.x = block.x - this.width
            }
            if(distanceRight < distanceTop && distanceRight < distanceBottom && !block.collisionSides.includes('R')){
                this.velX = 0
                this.x = block.x + block.width
            }
            if(distanceTop < distanceLeft && distanceTop < distanceRight && !block.collisionSides.includes('T')){
                this.jumping = false
                this.velY = 0
                this.y = block.y - this.height
            }
            if(distanceBottom < distanceLeft && distanceBottom < distanceRight && !block.collisionSides.includes('B')){
                this.velY = 0
                this.y = block.y + block.height
            }

            if(distanceLeft == distanceTop && !block.collisionSides.includes('LT')){
                this.x = block.x - this.width
                this.y = block.y - this.height
            }
            if(distanceLeft == distanceBottom && !block.collisionSides.includes('LB')){
                this.x = block.x - this.width
                this.y = block.y + block.height
            }
            if(distanceRight == distanceTop && !block.collisionSides.includes('RT')){
                this.x = block.x + block.width
                this.y = block.y - this.height
            }
            if(distanceRight == distanceBottom && !block.collisionSides.includes('RB')){
                this.x = block.x + block.width
                this.y = block.y + block.height
            }
        }
    }

JsFiddle

sentences:
What should a game have in order to keep humans playing it? In many entertainment professions there suggestions, loose rules, or general frameworks one follows that appeal to humans in one way or another.  For instance, many movies and books follow the monomyth.

In video games I find many types of games that attract people in different ways.  Some are addicted to facebook gem matching games.  Others can't get enough of FPS games.

Once in awhile, though, you find a game that seems to transcend stereotypes and appeals almost immediately to everyone that plays it.  For instance, Plants Versus Zombies seems to have a very, very large demographic of players.  There are other games similar in reach.

I'm curious what books, blogs, etc there are that explore these game types and styles, and tries to suss out one or more popular frameworks/styles that satisfy people, while keeping them coming back for more.

sentences:
Handling sound effects for Multiple Collisions How can I generate somewhat realistic sound effects for collisions in a physics engine that simulates lots of objects?

E.g. take >10 marbles that are bouncing off walls and off each other.

If I generate a sound for each collision I would quickly overload the system (Windows Phone 7).

Is there an algorithm that lets me combine multiple collisions to create fewer sound effect instances?

sentences:
Clipping wrong results in C++ DIRECTX 11 Im trying to do some clipping but having some weird results. The triangle is not getting clipped how it should be. Here are some images.
The second image is how it should.

video of what is happen VIDEO OF WHAT IS HAPPENING

What is wrong with my code that is making the triangle wrong way.

CLIPPING ALGORITHM

ClipVertex( const Vector3& end )
{
    float BCend = mPlane.Test(end);
    bool endInside = ( BCend >= 0.0f );

    if (!mFirstVertex)
    {
        // if one of the points is inside
        if ( mStartInside || endInside )
        {
            // if the start is inside, just output it
            if (mStartInside)
                mClipVertices[mNumVertices++] = mStart;

            // if one of them is outside, output clip point
            if ( !(mStartInside && endInside) )
            {
                float t;
                Vector3 output;
                if (endInside)
                {
                    t = BCend/(BCend - mBCStart);
                    output =  end - t*(end - mStart);
                }
                else
                {
                    t = mBCStart/(mBCStart - BCend);
                    output = mStart + t*(end - mStart);
                }
                mClipVertices[mNumVertices++] = output;
            }
        }
    }
    mStart = end;
    mBCStart = BCend;
    mStartInside = endInside;
    mFirstVertex = false;

}

PLANE EQUATION

Plane clipPlane( 1.0f, 0.0f, 0.0f, 0.0f );

In directx 11 in a Left Handed system

sentences:
Difference between GUILayout and EditorGUILayout? Is it matter if I use GUILayout or EditorGUILayout for my custom editor? I need to use one of them in the OnInspectorGUI function.

which one should I use? What are the differences between the two?

Thank you in advance.

sentences:
How can I refactor my code to use fewer singletons? I started a component based, networked game (so far only working on the server). I know why singletons can be bad, but I can't think of another way to implement the same thing. So far I have:

A GameState singleton (for managing the global state of the game, i.e. pre-game, running, exiting).
A World singleton, which is the root entity for my entity graph
An EntityFactory
A ComponentFactory
I'm thinking about adding a "MessageDispatcher" so individual components can subscribe to network messages.

The factories do not have state, so I suppose they aren't so bad. However, the others do have global state, which is asking for trouble. How can I refactor my code so it uses fewer singletons?

sentences:
Developing a browser-based RPG: Loading user data I'm writing a browser-based RPG in JavaScript, HTML5 with Canvas, EaselJS, etc... I'd like to develop the back end data saving/user profile aspect now.

This is a single player RPG where the player will interact with NPCs to solve quests. It is not online.

I've developed a website in PHP before where I saved my own data in a database, and loaded the images to the page via MySQL and PHP.

For a RPG, how would this process be? In my mind... I will try:

At the RPG menu, have a user login screen. Handle this with a traditional PHP session.
Once the user logs in, load their stats from the database.

What I'm confused about is:

Loading text data is okay I suppose... but how can I load objects that were on the screen in the correct locations at the time of the save? Can this be handled through the database?
I have generated the Players, Objects, and NPCs as Javascript objects using EaselJS. To save the state of these objects, do I have to load the character as a PHP object?

Kind of like:

/**
 * Load a character and all related items and skills.
 * Do this when the user logs in. You can save the data in a session or
 * reload it every time the user makes a new request
 */
$Character = Character::model()->with('items, skills')->find(
    'username:=username',
    array('username' => 'demo')
);

Any tips for loading appropriate data per user profile?

Thanks!

sentences:
Getting error when I Send a message to the RaycastHit object I have created a shooting game, here when I am shooting I have a c# script for damage for enemies.I have Used Raycast to Shoot enemies.if the RaycastHit becomes an enemy, it will be deducted it's health.It works properly.But the thing is, If I shoot objects except enemies it causes an error.
I have provided some details about that.this is the script,

public class DamageSMG : MonoBehaviour
{
    public int DamageAmount = 5;
    public float TargetDistance;
    public float AllowedRange = 50;
    public RaycastHit Shot;
    public int Firing;
    void Update()
    {
        if(Input.GetButton("Fire1")){
            if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward),out Shot))
            {
                TargetDistance = Shot.distance;
                if (TargetDistance < AllowedRange)
                {
                    if (Firing == 0)
                    {
                        Deduct();
                    }
                }
            }
        }
    }
    public void Deduct()
    {
        Firing = 1;
        Shot.transform.SendMessage("DeductPoints", DamageAmount);
        StartCoroutine(Wait());

    }
    IEnumerator Wait()
    {
        yield return new WaitForSeconds(0.1f);
        Firing = 0;
    }
}

I am using an machine gun.therefore I have created Script to fire coutinously with 0.1sec break.When I press Fire1 button, The RayCastHit Object is received a message where the method called DeductPoints with the DamageAmount.As this Script my enemies are deduct point 5 by 5 every hit.Then Destroy the object.The Enemy script is this.

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

public class EnemyScript : MonoBehaviour
{
    public int EnemyHealth = 20;
    void DeductPoints(int DamageAmount)
    {
        EnemyHealth -= DamageAmount;
    }

    // Update is called once per frame
    void Update()
    {
        if (EnemyHealth <= 0)
        {
            Destroy(gameObject);
            GlobalScore.GlobalScorecount += 1;
        }

    }

}

But my problem is when I shoot objects except Enemies(Ex: walls),The console gives an error.The error is like this
SendMessage DeductPoints has no receiver
How can I solve this error or is there any other way of Deducting enemy health with raycast?
I can play the game with this error in UnityEngine.but it is not possible to Build the game.Please help me to Solve this..

sentences:
How can I generate a lightning bolt effect? Is there an algorithm to generate a lightning bolt?
I would like an algorithm that generates a list of segment or point objects specifying where the bolt will land. The method would need a start point parameter, along with an endpoint. The bolt should have random branches coming off it, and zig-zag at random intervals. The result will be a random lightning effect that would look somewhat like this

(source: wikimedia.org)
If anyone knows of an algorithm that this may work for, help would be greatly appreciated!

sentences:
Is libgdx fit for 2D game development on Android or are there simpler alternatives? I'm looking for a Java framework to develop 2D games on desktop and Android. I've looked at Slick and I really like the API, however the developer himself says if you want a framework for Android and desktop best go with libgdx atm.

Now I'm reading up on libgdx, but I'm wondering if there are simpler alternatives for just doing 2D sprite stuff on Android and desktop. I'm only interested in creating NES like graphics, nothing too fancy. Something like this.

Because on the wiki of libgdx it says you can't use the OrtographicCamera with OpenGL ES 2.0 (http://code.google.com/p/libgdx/wiki/OrthographicCamera), but I read (http://www.badlogicgames.com/wordpress/?p=504) when your device supports OpenGL ES 2.0 it doesn't support 1.0, so you can't effectively use OrtographicCamera on OpenGL ES 2.0 devices?

I'm confused, should I go with libgdx? Are there simpler alternatives?

sentences: Smallest, most memory-efficient way to have tiles? (C++/OpenGL) I need to have tiles in my game, just 16x16 images, there would be hundreds (or even thousands) that make up a level. Of course it's not viable to have thousands of memory-hog normal entities, but tiles are just repeated images. What's the most memory-efficient way to do tiles?

sentences:
Programmatically set color of Box2D body's sprite or image In my basic Cocos2D + Box2D iPhone app I have a bunch of circular Box2D bodies.  I'd like to change the color of the circles programatically.  What's the easiest way to do this?

So far I'm just assigning a CCSprite* to the b2body->userData.  So perhaps I can change the colors in my sprite sheet programmatically?  Seems like there's an easier way.  I'm just not sure what it is.

Cheers!

sentences:
Increasing height increases width I have a game, where the user presses a button to spend money and increase the height of a Movie Clip. I use the following: height ++.

The problem:  When I test this out, it seems the width increases, too.  The actual thickness, you could say.  How can I solve this?

sentences:
How is tile offsetting accomplished in 2d side scrollers? The idea is to work with tiles that together make up a larger image, or world so to speak.

but im confused as to what the methods used are to offset the tiles, and whether is a good idea to draw offscreen.

For example

var backgroundScroll = 0
update() {
 backgroundScroll++
}
render() {
graphics.draw( resource: BACKGROUND, screenX: -backgroundScroll, screenY: 0)
}

while there's no tiles seen here for the sake of simplicity,
im simply emphasizing that we are drawing off screen.

As such the question is, how is this background offsetting accomplished, more specifically, without trying to render outside of the screen, as the framework may or may not know how to handle drawing to areas beyond that of the screen.

In essence the game's world will be comprised of an array of tiles

var cells[map_w][map_h]

and each cell is 32 px wide and 32px height

the idea is to scroll the map but cutting corner cells 1px per unit of speed,
but altering the logic so that no negative numbers are entered into the draw function.

I could probably figure something out on my own but i really want to hear how other people are accomplishing this rather popular task

sentences:
How can I support the creation and rendering of both interior and exterior environments? Say I already have a renderer that can support outdoor terrain and environment rendering. How would I go about adding support for interior environments (for example, like World of Warcraft's dungeons) to my game?

I'm interested both in how I should fit the interiors into my content creation process (for example, I thought about leaving holes in the terrain mesh into which I can "paste" the interior dungeon mesh at runtime) and how to render them (it seems like I'd want a different rendering flow other than a blended texture rendering phase that terrain uses).

sentences:
Spot Light color fade in Unity 3d I have a scene where many spot lights are focused on the screen. All have red color and same intensity. What I want is that the red Color(0,0,0,1) value should increase and decrease in a fading effect over a period of time. I thought of using Color.Lerp() but can not achieve it. What currently I am doing is attaching this script to all the instances of the SpotLight.

void Update()
{
 if(Time.time()%120==0)
   transform.light.color=new Color(Random.Range(0,255),0,0,1);
}

I know I am missing something big here. Help is appreciated. Thanks in advance.

sentences:
Can we create same name class for different objects in unity? I have four similar objects in my game. As they are all similar therefore I have created a single script that defines mash for all of them. The script that defines mash for these objects uses a variable called radius which I have imported from other file (by classname.radius). The radius updates on every frame and it is the only property that is different for all objects.

To allow different radius for different objects, What I thought would work was, making four different classes of same name classname. Creating variable radius in all of them and giving them different values. Dragging first file to the first object, second file to second object and so on.. When executed, every time the script that generated mash considers classname.radius from the file which is dragged to that object. But that isn't working. What is wrong and how can I implement it?

Seems I'm messing with OOPS concepts!

sentences:
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:
Programatically find out which app store install came from? Background

In my app, I have a 'rate me' button.  It follows the usual path - user clicks in, it starts an intent and opens the app's listing on the Play Store.  All well and good.  Now I wish to try to distribute my app via different app stores (Amazon for example), so obviously, if the user hits the 'rate me' button I don't want it to take the user to the Google Play Store but to whatever store they got it from.

APK For each store

This is possible, true, but I think it would be a complete nightmare to manage (like creating a new APK for each store every time I issue a new update.

So I'm looking for something like this pseudo code:

if(rate-me button pressed){

    if (from Google Play Store){
        Go to Google Play Store
    }
    else if (from Amazon Store){
        Go to Amazon Store
    }
}

And so on.......

I'm guessing there is a way (that some apps must surely use) but I have no idea how to go about it.

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

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

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

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

Following are screenshots demonstrating the situation:

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

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

sentences:
Instantiate player prefab using player data When my scene loads, I want to add my prefab to it along with its components.

Here is what I mean:

scene loads
player gender is determined via playerprefs or playfab sdk
player prefab is loaded and displayed using said gender

The prefab would have a script components attached for the current data etc.

I might be approaching this wrong, but I want this to work with multiplayer in the future, so that's why I didn't just add the prefab directly to the hierarchy.

What is the correct way of doing this?

sentences:
Replacement for XNA? Since Microsoft stopped developing XNA I'm wondering what will be the replacement for the XBox 720°.
I've been wondering about this. XNA was THE technologie the XBox, easy and powerfull.

So is Microsoft developing a new technologie or are they going to continue XNA, even if they've said they'd stop.

sentences:
Left-handed version of the reversed depth projection with infinite far plane Let's say that I have standard left-handed WorldToView and ViewToScreen row-major matrices in the same vein as the DirectX D3DXMatrixPerspectiveLH functions, like so:

EXVector vView = NormalizeVector(LookAt() - m_Position);

float fDotProduct = DotProduct(m_WorldUp, vView);

EXVector vUp = NormalizeVector(m_WorldUp - fDotProduct * vView);

// Generate x basis vector (crossproduct of y&z basis vectors)
EXVector vRight = CrossProduct(vUp, vView);

// Generate the matrix
row0.Set(vRight.x, vUp.x, vView.x, 0);
row1.Set(vRight.y, vUp.y, vView.y, 0);
row2.Set(vRight.z, vUp.z, vView.z, 0);
row3.Set(-DotProduct(m_Position, vRight),
         -DotProduct(m_Position, vUp),
         -DotProduct(m_Position, vView), 1);

EXMatrix mWorldToView(row0, row1, row2, row3);

Here's the left-handed mViewToScreen / projection matrix:

float zNear  =    0.001f;
float zFar   = 1000.000f;
float Aspect = DisplayHeight() / DisplayWidth();

float sinfov, cosfov; qsincosf(VFOV() / 2, sinfov, cosfov);
float cotfov = cosfov / sinfov; // cos(n) / sin(n) = 1/tan(n)

float w = Aspect  * (cotfov);
float h =   1.0f  * (cotfov);
float Q = zFar / (zFar - zNear);
float R = -Q * zNear;

row0.Set(w, 0, 0, 0);
row1.Set(0, h, 0, 0);
row2.Set(0, 0, Q, 1);
row3.Set(0, 0, R, 0);

EXMatrix mViewToScreen(row0, row1, row2, row3);

Many things like map/object culling depend on this fact:

// View to cull matrix
Q = (       zFar + zNear) / (zFar - zNear);
R = (2.0f * zFar * zNear) / (zFar - zNear);

row0.Set(w, 0, 0, 0);
row1.Set(0, h, 0, 0);
row2.Set(0, 0, Q, 1);
row3.Set(0, 0, R, 0);

EXMatrix mViewToCull(row0, row1, row2, row3);

Does anyone know how to derive the infamous "reverse depth with infinite far plane" from the original blog post for mViewToScreen and mViewToCull? Every single reference I have found (nlguillemot and nVidia, for example) is in the right-handed space.

Normally I am able to figure things out visually, but 4D matrices are a headache.

sentences:
Create a game start-up menu screen with Lua/love 2d I just got started programming games and decided to try out love2d since I'm learning lua.

I was wondering if anyone knows how I can create just a simple 2-3 button menu when you start up the game.

All I want to do is make a start up menu.

I have 2 files and nothing else:

main.lua, in which I have the game code and the level design
conf.lua, in which I have the title screen code and the icon of the game

I couldn't find any wiki page to help me for coding for the first time a splash screen and a overall game screen !!

now i have only one screen the game screen and i want to have 3 screens :
1 splash screen in wich i want to draw a image background and 3 buttons PLAY,EXIT,TITLE with coding mousepress!
2 game screen!
3 game over screen with an other background image!

sentences:
pygame KEYUP KEYDOWN events only once per frame? I've been playing around with pygame, and I ran into a bit of an odd issue with input on the pygame event queue. Consider the following test code:

import pygame as pg

def main():
    pg.init()
    pg.display.set_mode([640,480])
    clock = pg.time.Clock()
    while True:
        clock.tick(1)
        events = pg.event.get()
        print("There are %d events in the queue." % len(events))
        for event in events:
            print(event)
        print()

if __name__ == "__main__":
    main()

Here I'm intentionally running the game loop just once per second. What I observe is that the pygame event queue can easily receive dozens of mouse-related events per frame, but only ever a single KEYDOWN or KEYUP event at a time.

This is the output after pressing four keys simultaneously and quickly pressing the left mouse button a few times at the same time:

There are 0 events in the queue.

There are 1 events in the queue.
<Event(5-MouseButtonDown {'pos': (494, 392), 'button': 1})>

There are 8 events in the queue.
<Event(2-KeyDown {'unicode': 'f', 'key': 102, 'mod': 0, 'scancode': 41})>
<Event(6-MouseButtonUp {'pos': (494, 392), 'button': 1})>
<Event(5-MouseButtonDown {'pos': (494, 392), 'button': 1})>
<Event(6-MouseButtonUp {'pos': (494, 392), 'button': 1})>
<Event(5-MouseButtonDown {'pos': (494, 392), 'button': 1})>
<Event(6-MouseButtonUp {'pos': (494, 392), 'button': 1})>
<Event(5-MouseButtonDown {'pos': (494, 392), 'button': 1})>
<Event(6-MouseButtonUp {'pos': (494, 392), 'button': 1})>

There are 3 events in the queue.
<Event(2-KeyDown {'unicode': 'q', 'key': 113, 'mod': 0, 'scancode': 24})>
<Event(5-MouseButtonDown {'pos': (494, 392), 'button': 1})>
<Event(6-MouseButtonUp {'pos': (494, 392), 'button': 1})>

There are 1 events in the queue.
<Event(2-KeyDown {'unicode': 'e', 'key': 101, 'mod': 0, 'scancode': 26})>

There are 1 events in the queue.
<Event(2-KeyDown {'unicode': 'w', 'key': 119, 'mod': 0, 'scancode': 25})>

There are 1 events in the queue.
<Event(3-KeyUp {'key': 119, 'mod': 0, 'scancode': 25})>

There are 1 events in the queue.
<Event(3-KeyUp {'key': 113, 'mod': 0, 'scancode': 24})>

There are 1 events in the queue.
<Event(3-KeyUp {'key': 101, 'mod': 0, 'scancode': 26})>

There are 1 events in the queue.
<Event(3-KeyUp {'key': 102, 'mod': 0, 'scancode': 41})>

There are 0 events in the queue.

At 1 FPS, it takes pygame 8 seconds to process just 4 keypresses, one for each KEYUP and KEYDOWN signal. Is this intended behavior? Am I missing something here? It seems odd to me that pygame cannot register multiple keypresses per frame. I'm a bit of a newbie when it comes to gamedev, so I'm not sure where this is coming from.

sentences:
How to handle hitboxes/hurtboxes in animations? I'm curious how I should go about structuring hitboxes and hurtboxes for my actors. For context, I'm developing a game engine in OpenGL, using C# and OpenTK. I have developed a working skeletal animation system, which loads animations using Assimp, and then passes BoneIDs, BoneWeights, and Transform matrices to the Vertex shader, which calculates all vertex deforms appropriately for the current animation keyframe (or current interpolation between keyframes).

Is there a set standard for calculating collision in animations? I'd prefer to continue using Assimp, which means using standard, recognizable animation formats that my engine can load in, so I'd rather not store any collision data in the animation files, unless there is a precedent for this or room for metadata or something.

My current thoughts: One option would be to calculate the hitboxes and hurtboxes upon loading an animation, and have a mapping that determines which meshes are hitboxes and which are hurtboxes. The second option would be to create a new file format where I store my hitboxes and hurtboxes in a way that is similar to animation files (minus bone weights, since I'll just be transforming the scale/position of axis-aligned rectangles), where I can determine keyframes for hitboxes and hurtboxes, then interpolate based off of these to get the current collision box for each frame. I could combine the two options by automatically generating these files from the animations, then editing them manually until they are reasonable.

Am I on the right track, or are there smarter ways of going about this? I don't want to reinvent the wheel if there are better options available.

sentences:
Align Players Rotation I'm currently working on rope Swinging.
The Rope consists of Physics Constraints/Joints and between them the rope is rendered.
I would like align my Character's Pitch to the Rope.
I'm horribly bad at vector Math, and I have trouble finding the solution.
Here's a picture that shows what I want to achieve:

I tried using the Difference between two joints but somehow it doesn't work.
I'm using Unreal Engine if that helps.

sentences:
Unreal C++ Detecting new Key Down during current Key Hold I am currently working on a combat system and I wanted to be able to have key combos to execute combat moves and such, and I am detecting key input type as well for example, if the key is tapped, or long pressed.

I use this line below to record the time a key is pressed, and time when the same key is released, so I can differentiate whether the key is just a quick tapped or long pressed.

  FPlatformTime::Seconds();

and when the the game detected a key press, it will execute the function below, using a timer and stopped on released.

//Long Press
void ABasePlayerController::StartRepeat(UFunction* FunctionNamesToCall, FKey KeyInput)
{
  //Execute if Timer is still active
  if (IsKeyDown != false && GetWorld()->GetTimerManager().IsTimerActive(RepeatTimerHandle) && WasInputKeyJustPressed(KeyInput))
  {
     CalledFunction.Broadcast(FunctionNamesToCall, KeyInput);
  }
}

The problem is when I wanted to make a key combination, and I stopped this function, whenever a new Key is pressed, the new key will be considered as a Long Pressed as well. My current codes only able to register input types after the key is released, and I wanted to be able to make a charging combo as well.

For example when I'm holding a Tab and I tap a new different key, both keys will be considered as a Long Pressed, while the expected result supposed to be Long Pressed Tab key, and the new pressed key is a simple quick tap.

Any ideas? Thanks!

sentences: How to use 3 cameras simultaneously in Unity I'm working on a project that requires 3 panels, each rendering a game object.  There will be a search box and when the player enters a string, that key word will zoom to the tagged location on the each object in the 3 panels. How can I go about accomplishing this?

sentences:
Ternary conditional in behaviour trees? When designing a behaviour tree that controls an agent, is it possible to construct the tree so that the agent first attempts task A, then depending on whether task A succeeds it attempts either task B or task C? That is, if A succeeds, the agent attempts task B, otherwise it attempts task C? Kind of like the ternary conditional operator?

The following may at first glance seem to work:

* Selector
|
+---* Sequence
|   |
|   +---* A
|   |
|   +---* B
|
+---* C

or equivalently, Selector(Sequence(A, B), C). However, if A succeeds and B fails, the sequence will still fail and C will be attempted (which it shouldn't since A succeeded).

This tree does run B if A succeeds and C if A fails and never runs both B and C:

* Selector
|
+---* Sequence
|   |
|   +---* A
|   |
|   +---* B
|
+---* Sequence
    |
    +---* Inverter
    |   |
    |   +---* A
    |
    +---* C

or equivalently, Selector(Sequence(A, B), Sequence(Inverter(A), C)). This is assuming that A yields the same result both times (oterwise either none of B and C will be attempted, or both will be attempted). However, this has the issue that will be attempted A twice if either either A or B fails.

What I want to achieve could be pseudo-coded like A ? B : C or like B if A else C. Can this be achieved with a behaviour tree?

sentences:
C# Pathing algorithm for moving a object from point(X, Y) to point(X, Y) Given a object which may move forward, backward, left and right at a given X,Y point. How to efficiently direct the object to a X,Y point using the given movement mechanics in the most efficient and human natural way.

The object is available for movement in real time, you may tell them to "startMoving|Direction|()" and "stopMoving|Direction|()" to any heading of 360 degrees. Though as a additional twist and the part I am having trouble with, is the facing of the object is never known, only its current location is known, so the algorithm must "detect" direction. The location of the object is updated in a separate thread in 500-1second intervals. A "Request" to update the location within the algorithm made be made at any point, but it is not immediately available and the algorithm must keep that in consideration. Doing something like requestAndWaitForCoordUpdate() is perfectly acceptable, however likely not needed.

In addition, no obstacles appear, it can be assumed you are on a MOSTLY open plane, stray to far from the direct straight line between the paths and you may run into obstacles. It is safe to assume that 1/4th the distance between a target and source, should be available in width on a given direct path.

I would also mention I am not sure A* applys in this scenario, if it does I am unsure how to implement it given the constraints. The only real variable here is the facing of the object.

Here is some example code:

public int[] currentCoords;
public void movement() {
  currentCoords[0] = 1005; // starting y coord
  currentCoords[1] = 1007; // starting x coord
  moveTo(1050, 1025);
}

public void moveTo(int x, int y) {
  ... how?
}

public void threadUpdatingCoords() {
   ... periodically check for source coord updates
   ... between 200ms and 1000ms apart.
}

sentences:
Why projection window is between -1 and 1 Is it a convetion ? What we achieve with this ?

I am reading about how the perspective and orthographic matrix is getting calculated and everyone is trying to normalize the homogenous coordinates to [-1,1]

Thank you !

Orthographic Projection

sentences:
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:
LibGdx - Move sprite in the direction of other sprite I'm kind new to LibGdx and I'm still learning. I'm working on a small game project to learn this nice framework. However, I'm having some issues with my game. My game is a top down shooter. There is a human character(space marine) that has to shoot an alien, which will be always moving in his direction until it  dies. My code doesn't have any bullets yet.I was able to make the shooter rotate in the direction of the cursor, as well, the alien rotate in the direction of the shooter, but I can't make the alien move in his direction. I'm pretty sure that my method that does that is completely wrong. I've tried a lot to fix it , but I can't get it fixed ! I appreciate your attention guys !
You can find the full code of the main class here:
 https://github.com/Igor-Lopes/LibGdx/blob/master/Splash.java#L125

public void moveAlien() {
    float mX = 0;
    float mY = 0;
    int velocity = 50;
    vAlien = new Vector2(-1 * (float) Math.sin(Alienbody.getAngle()) * velocity,
            (float) Math.cos(Alienbody.getAngle() * velocity));

    mX = (float) Math.cos(Math.toRadians(spacemarine.getRotation()));
    mY = (float) Math.sin(Math.toRadians(spacemarine.getRotation()));

    vAlien.x = mX;
    vAlien.y = mY;
    if (vAlien.len() > 0) {
        vAlien = vAlien.nor();
    }
    vAlien.x = vAlien.x * velocity;
    vAlien.y = vAlien.y * velocity;
    vAlien.x += vAlien.x * Gdx.graphics.getDeltaTime();
    vAlien.y += vAlien.x * Gdx.graphics.getDeltaTime();
}

public float rotateMarine() {
    float angle = 0;
    float mouseX = 0;
    float mouseY = 0;
    mouseX = Gdx.input.getX();
    mouseY = 677 - Gdx.input.getY();
    angle = (float) Math.toDegrees(Math.atan2(mouseX - spacemarine.getX(),
            mouseY - spacemarine.getY()));
    if (angle < 0)
        angle += 360;
    spacemarine.setRotation(angle * -1);
    return angle;
}

public float rotateAlien(Sprite s, float posX, float posY) {
    float angle = 0;
    float mouseX = 0;
    float mouseY = 0;
    mouseX = posX;
    mouseY = posY;
    angle = (float) Math.toDegrees(Math.atan2(mouseX - s.getX(), mouseY - s.getY()));
    if (angle < 0)
        angle += 360;
    s.setRotation(angle * -1);
    return angle;
}

@Override
public void render(float delta) {
    float angle;
    moveAlien();
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    world.step(Gdx.graphics.getDeltaTime(), 6, 2);
    angle = rotateMarine();
    rotateAlien(alien, spacemarine.getX(),
            spacemarine.getY());
    if (Gdx.input.isKeyPressed(Input.Keys.W) == true
            && spacemarine.getY() < 560) {
        Marinebody.setTransform(spacemarine.getX(), spacemarine.getY() + 4,
                angle);
    }
    if (Gdx.input.isKeyPressed(Input.Keys.S) == true
            && spacemarine.getY() > 0) {
        Marinebody.setTransform(spacemarine.getX(), spacemarine.getY() - 4,
                angle);
    }
    if (Gdx.input.isKeyPressed(Input.Keys.D) == true
            && spacemarine.getX() < 920) {
        Marinebody.setTransform(spacemarine.getX() + 4, spacemarine.getY(),
                angle);
    }
    if (Gdx.input.isKeyPressed(Input.Keys.A) == true
            & spacemarine.getX() > 8) {
        Marinebody.setTransform(spacemarine.getX() - 4, spacemarine.getY(),
                angle);
    }
    alien.setPosition(Alienbody.getPosition().x, Alienbody.getPosition().y);
    spacemarine.setPosition(Marinebody.getPosition().x, Marinebody.getPosition().y);
    batch.begin();
    spacemarine.draw(batch);
    alien.draw(batch);
    batch.end();
    // stage.act();
    // stage.draw();
}

sentences:
What kind of culling does XNA do for me? Which kinds of culling and clipping does XNA do for me as default, and which kinds does it not?

Z-culling? Backface culling? etc.

sentences:
How can I use a texture as a font in Unity3D I am making a game in unity and I am trying to make a custom font for showing numbers. I created a png with the numbers, turned it into a material and added it to a custom font object. I set up the index so that it knows where the number are. I set it to a style and used the style with a label to print some numbers to the screen. The numbers printed but the detail from the texture disappeared and the numbers became a single color determined by the text color setting in the style. Is there a way for the text to just show the graphics from the texture.

The alpha is working but the non alpha parts are all set to the same color. I have multiple colors in the text but on the screen they just appear as one color. Also when I add the material to a plain it all shows up properly so I am assuming that it has something to do with the font settings or the style settings.

here's a screeshot http://imgur.com/a/rqAhd

sentences: LibGDX - Show a minimap I've started to develop a small roguelike game in LibGDX. I've also made a minimap class, which creates and updates the minimap as the player explores the dungeon, by using a Pixmap. The minimap class has an OrthographicCamera (currently unused), which will be used for centering the minimap on the player. The minimap is currently rendered with it's own SpriteBatch. Now I'd like to put the minimap on the upper right corner, and clip it, because it is so big, that it'd obscure the half of the screen. I'm not really sure how to do this clipping part. I assume I should use the ScissorStack class, but the LibGDX wiki is a bit uninformative for me.

sentences:
Unity: Can't access repeatDelay from StandaloneInputModule? I have a very specific problem. I'm trying to change the repeatDelay variable within my StandaloneInputModule, but it's not coming up as a variable. All of the other variables come up when I use GetComponent<StandaloneInputModule>(), but not the one that I want. Is there something different about repeatDelay that I'm not seeing?

EDIT: I'm using the UnityEngine.EventSystems namespace too.

sentences:
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:
How should I implement side-scrolling level design? I'm working on a college project using the educational Java framework Greenfoot, and as stated above we're making an r-type clone.

I've been looking at using an array of strings to populate the levels. The array contains 60 strings, filling the Y axis, each element in the array represents a y co-ordinate += 10. I use "0" to represent empty space, "1" to represent a block of terrain.

Then I use a for loop and charAt() method to create a new array representing each column along the X axis, and populate the screen this way.

I thought I was being clever by making a "block" class that checked to see if it was connected to any other blocks and adjust it's image accordingly to make the terrain look as if it's a single block/shape. However, this is now slowing down the game to a crawl as there are so many objects in it.

I've tried to add the columns as the game is scrolling and removing them once they leave the screen, but I end up with gaps in the terrain.

How are levels in these types of game normally implemented?
Would I be better creating a few big objects to make the terrain and build the whole level from start to finish?

Is there some method I've completely missed?

Here is a screen shot of how it looks at the minute, each block is 22 x 10 pixels.

sentences:
How do I draw a line using jme3.scene.shape.Line in JMonkeyEngine 3.0? I can successfully create the object, but it can't be attached to the rootNode. What can I do to make the line appear?

I'll also would like to know how to reverse the effect(making it disappear) shortly after if any special steps are involved.

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: Abstraction for player, NPC's, and monsters I am trying to come up with a good abstract term for my players, NPC's and monsters. They can all have stats and inventory. so they all can function in the same way. But some could be humanoids, some are monsters and whatnot. Are there any standard abstract terms that game devs tend to use.

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

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

sentences:
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:
Why glDrawElements draws nothing? I tried to implement indexed draw, but when I call I got nothing on screen. Even more strange that I wasn't get any error when call it and buffer variables packed right.

There my constructor:

Mesh::Mesh(Shader &shader, std::vector<GLuint>* indices, std::vector<VertexData>* vertices) {
shaderProgram = &shader;
_meshLenght = (GLsizei) indices->size();
_indices = indices;

glGenBuffers(1, &_ebo);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _ebo);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices->size(), indices, GL_STATIC_DRAW);

//create one here
glGenVertexArrays(1, &_vao);
glBindVertexArray(_vao);

std::vector<glm::vec3> positions {};
std::vector<glm::vec3> normals {};
std::vector<glm::vec2> texture {};

for (size_t i = 0; i < vertices->size(); ++i) {
    positions.push_back(vertices->at(i).positions);
    normals.push_back(vertices->at(i).normals);
    texture.push_back(vertices->at(i).texCoords);
}

glGenBuffers(1, &_vbo);
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(glm::vec3)*(positions.size()+normals.size()), nullptr, GL_DYNAMIC_DRAW);

glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(glm::vec3)*positions.size(), positions.data());
glBufferSubData(GL_ARRAY_BUFFER, sizeof(glm::vec3)*positions.size(), sizeof(glm::vec3)*normals.size(), normals.data());

glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, nullptr);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, reinterpret_cast<const void*>((sizeof(glm::vec3) * positions.size())));

glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glBindBuffer(GL_ARRAY_BUFFER,0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glBindVertexArray(0);
}

And there my draw code:

void Mesh::Draw() {
glBindVertexArray(_vao);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _ebo);
if (_ebo==0)
    glDrawArrays(GL_TRIANGLES, 0, _meshLenght);
else {
    glDrawElements(GL_TRIANGLES, _meshLenght, GL_UNSIGNED_INT, nullptr);
}
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glBindVertexArray(0);
}

Also show my vertices info screenshot:

And if you need have apitrace trace file:
https://drive.google.com/file/d/0B-dWIpzqq91mQXVIeHhTOHFhRkU/view?usp=sharing

sentences:
How can I remove a sprite from the screen using pygame? I am having trouble with removing sprites on my screen using pygame.

I am killing my sprite with sword.kill which is removing it from an all_sprites group, so it should disappear right?

Here is where i blit my images:

def draw(self):
        for sprite in self.all_sprites:
            self.screen.blit(sprite.image, self.camera.apply(sprite))
        pg.display.update()

Here is my sword class:

class Sword(pg.sprite.Sprite):
    def __init__(self, game, x, y, entity):
        self.groups = game.all_sprites
        pg.sprite.Sprite.__init__(self, self.groups)
        self.game = game
        self.image = self.game.sword
        #self.image = pg.transform.scale(self.image, (TILESIZE, TILESIZE))
        self.image.set_colorkey(WHITE)
        self.rect = self.image.get_rect()
        self.x = x
        self.y = y
        self.rect.x = x
        self.rect.y = y
        if entity.direction == 'down':
            self.image = pg.transform.rotate(self.image, -90)

        def update(self):
            self.kill()

And here is where I create my sword object:

def get_keys(self):
        self.vx, self.vy = 0, 0
        keys = pg.key.get_pressed()
        if keys[pg.K_LEFT] or keys[pg.K_a]:
            self.game.walk_sound.play(-1)
            now = pg.time.get_ticks()
            self.vx = -200
            self.direction = 'left'
            if now - self.last_update > self.frame_rate:
               self.last_update = now
               try:
                    self.game.player_img = self.game.walkleft[self.frame]
                    self.frame += 1
               except IndexError:
                    self.frame = 0
            self.swing = False
        elif keys[pg.K_RIGHT] or keys[pg.K_d]:
            self.game.walk_sound.play(-1)
            now = pg.time.get_ticks()
            self.vx = 200
            self.direction = 'right'
            if now - self.last_update > self.frame_rate:
               self.last_update = now
               try:
                    self.game.player_img = self.game.walkright[self.frame]
                    self.frame += 1
               except IndexError:
                    self.frame = 0
            self.swing = False
        elif keys[pg.K_UP] or keys[pg.K_w]:
            self.game.walk_sound.play(-1)
            now = pg.time.get_ticks()
            self.vy = -200
            self.direction = 'up'
            if now - self.last_update > self.frame_rate:
               self.last_update = now
               try:
                    self.game.player_img = self.game.walkup[self.frame]
                    self.frame += 1
               except IndexError:
                    self.frame = 0
            self.swing = False
        elif keys[pg.K_DOWN] or keys[pg.K_s]:

            self.game.walk_sound.play(-1)
            now = pg.time.get_ticks()
            self.direction = 'down'
            self.vy = 200
            if now - self.last_update > self.frame_rate:
               self.last_update = now
               try:
                    self.game.player_img = self.game.walkdown[self.frame]
                    self.frame += 1
               except IndexError:
                    self.frame = 0
            self.swing = False
        elif keys[pg.K_SPACE]:
            self.attack = True
            if self.direction == 'down':
                print(self.rect.centery)
                self.sword = Sword(self.game, self.rect.centerx-7, self.rect.bottom, self)
        elif self.vx != 0 and self.vy != 0:
            self.vx *= 0.7071
            self.vy *= 0.7071
            self.swing = False
        elif keys[pg.K_t]:
            self.x = 1 * TILESIZE
            self.y = 1 * TILESIZE
            self.swing = False
        elif self.attack and not keys[pg.K_SPACE]:
            self.sword.update()
            self.attack = False

Any help would be appreciated. Thanks!

sentences: Is it possible to configure a unity project so it only runs on a device? I am want to give someone a sample Android Unity project and I want them to be able to run it only on a device, not the simulator. Is there a way that I can configure the project so that it will only run on a device?

sentences:
Child GameObject doesn't follow parent's transform Look at this picture first:

I have model that has sword in his hand. I added a cube named "Attack Collision" and located to blade position. And then set the hand to parent.

But when the game starts, sword moves but it's children "Attack Collision" doesn't move at all.

The funny thing is in the scene, I tried to move the "sword", but only it's children "Attack Collision" was moved.

Seems like the sword is somekind of locked, because it's transform can be change but not applied at all, it's just stand still there and only it's children that made from Unity was moved like this:

I made this model and animation by Blender and imported to Unity as .FBX file.

What am I missing?

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

sentences:
How can I use a 3x3 matrix within a 4x4 matrix representation? In XNA there is only one Matrix class which is actually 4x4 matrix. How to use it to represent a 3x3 matrix?

I am trying to represent the inertia tensor of a body which is a 3x3 matrix, so I have data for only a 3x3 matrix. How can I store that in a 4x4 matrix and still have operations on it be valid?

sentences:
What are some ways to separate game logic from animations and the draw loop? I have only previously made flash games, using MovieClips and such to separate out my animations from my game logic. Now I am getting into trying my hand at making a game for Android, but the game programming theory around separating these things still confuses me. I come from a background of developing non game web applications so I am versed in more MVC like patterns and am stuck in that mindset as I approach game programming.

I want to do things like abstract my game by having, for example, a game board class that contains the data for a grid of tiles with instances of a tile class that each contain properties. I can give my draw loop access to this and have it draw the game board based on the properties of each tile on the game board, but I don't understand where exactly animation should go. As far as I can tell, animation sort of sits between the abstracted game logic (model) and the draw loop (view). With my MVC mindset, it's frustrating trying to decide where animation is actually supposed to go. It would have quite a bit of data associated with it like a model, but seemingly needs to be very closely coupled with the draw loop in order to have things like frame independent animation.

How can I break out of this mindset and start thinking about patterns that make more sense for games?

sentences:
C# XNA Is key toggled? I've got a question about toggling keys. How do You check if the key is toggled?

Here's my quick and easy code:

    public class KeyToggle
    {
        private bool isEnabled = false;
        private Keys key = Keys.None;

        public KeyToggle(Keys key)
        {
            this.key = key;
        }

        public bool IsEnabled()
        {
            if (keyboardState.IsKeyUp(key) && previousKeyboardState.IsKeyDown(key))
                isEnabled = !isEnabled;

            return isEnabled;
        }
    }

    private KeyToggle keyToggleF12 = new KeyToggle(Keys.F12);

    protected override void Update(GameTime gameTime)
    {
        if (keyToggleF12.IsEnabled())
            Method();
    }

Do You have any better idea for checking if the key is toggled?

EDIT: I didin't mean if the key is clicked (aka current up, previous down). Toggled key is like CapsLock, You press it once and it's enabled, press it once more and it's disabled. I've updated my code a little bit:

    private List<KeyToggle> keyToggleList = new List<KeyToggle>();

    protected override void Update(GameTime gameTime)
    {
        if (IsKeyToggled(Keys.F12))
            Method();
    }

    public static bool IsKeyToggled(Keys key)
    {
        if (ReferenceEquals(keyToggleList.Find(x => x.Key == key), null))
            keyToggleList.Add(new KeyToggle(key));

        return keyToggleList.Find(x => x.Key == key).IsEnabled();
    }

sentences:
Where can I find articles/books on 2D graphics (how it works etc.)? After I have been through more intensive C++ studies, I am thinking of giving it a start in my practices of computer game programming. Therefore, I think 2D knowledge (processing images, animating frames, etc.) would be a good place to start. However, I don't seem to find many articles on 2D (mostly 3D), and if found one, it is mostly stuffs like how to use a 2D game engine. I would really want something much more low-level, or "from scratch" ideas.

I want articles/books that would answer something like:

How would I import images into C++? (Let's say, if I want to import jpeg/bmp/etc. file into raw C++ code, what would I do?)

Basically, I just want to have enough low-level knowledge about computer graphics to be able to create something like 2D game engine from scratch.

sentences:
Box2D - Do these simple objects need to be in the simulation? I would like to get input from the community regarding how best to represent simple objects in a Box2D based simulation.

Some background:
Without going into too much detail, think of a top down game with a character and some 'food'. You can picture PacMan™ even. Suppose I will simulate the character and the walls to be Box2D so the guy cannot leave the maze and I get collision feed back etc.

My question:
Should the 'food' be part of the Box2D simulation?

My thoughts:

The food doesn't need to be in the simulation because..
It doesn't move.
As soon as the character collides with the food it is removed from the game.
It should not apply any force to the guy, or anything, ever.
Nor should anything ever need to apply force to it.
It's extra computation that isn't necessary.

The food could be in the simulation because..
I am already using Box2D.
Box2D can handle the collision events for me.
Again, Box2D can handle the collision events for me; I don't really want to check for collisions myself.
Box2D should let the food 'sleep' so it won't be much extra computation, correct?

What do you guys think? Do the benefits outweigh the costs here? Are there other pros/cons I'm missing?

I look forward to getting feedback.

sentences:
pause function for x amount of time I've read up on several ways of doing this but can't seem to find one that works for what I need. I have a method that is called and performs some logic, and then I need it to wait for a period of time, then continue with more logic in the same function. I had planned on using a coroutine which is what I did with another part of the game, but I'm running into an issue because the class doesn't directly inherit from Monobehaviour so it can't start a coroutine. I've tried Thread.sleep, but that just makes the game stop, so that isn't what I want. I don't know if there is some way to put a timer in there that will wait and then continue the function or if there is something else that I'm overlooking.

Here is the current code:

public void AssaultRifleShot (GameObject mainBall)
{
    if (AmmoRemaining > 0)
    {
        //if there is ammo remaining, set the main ball to just a normal ball so it can be destroyed on impact and then start coroutine
        mainBall.GetComponent<Ball> ().mainBall = false;
        mainBall.GetComponent<Ball> ().onBallHitPaddle -= AssaultRifleShot; //unsubscribe to event when mainBall is set to false.
        StartCoroutine(timer, coroutineHost);

        AmmoRemaining -= 1;
    }
    else
    {
        DestroyPickUp();
    }
}

There are other method calls inside the code for the coroutine, so those would end up going after whatever timer or someting goes in instead of the coroutine.

sentences: Building a shape out of an Texture with Farseer I have already looked at the Documentation on there Website, but the code provieded to create a shape out of an Texture is outdated for the newest version. The body is very simple so maybe i can do it with just 2 rectange but i have no idea how to do, because I just started with Farseer. Here my texture:  Texture

sentences:
Is there a material format for OpenCTM files? I consider using OpenCTM files for my game. Since the format only claims to store raw mesh data, my question is if there is a associated file format for material data and paths to texture maps.

For example material of .obj meshes are stored in .mtl files. Is there such a format for OpenCTM, too?

sentences:
Determining player.isFalling() through change of y? I'm currently using Box2D and my character is a bunch of fixtures in Box2D. I was wondering if, to determine if a player is falling, detecting a change in Y position would be appropriate?

Are there maybe other ways that I'm not thinking of? How is this sort of thing usually detected?

sentences:
Graphics look blurry in SFML I'm working on a 2D game using SFML and many textures (which I'm loading from PNG files, created with Gimp) I use are appearing blurry. They're being drawn without any kind of scaling and transformation, and I have confirmed that smoothing is not enabled for the textures, so I'm not sure what would be causing this or how to fix it.

The image I'm trying to draw is on the left, and what I'm seeing instead is on the right (both are heavily zoomed in).

How can I make SFML draw exactly the contents of the images and not apply this effect?

Edit: Here's a minimal example of what I'm doing:

#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>

int main(){

    sf::RenderWindow window(sf::VideoMode(128,128), "Minimal example");

    sf::Texture* tex = new sf::Texture;
    tex->loadFromFile("img/bg/0.png");

    sf::Sprite s;
    s.setTexture(*tex);

    window.draw(s);
    window.display();

    while(window.isOpen()){
        sf::Event event;
        while (window.pollEvent(event)) {
            if (event.type == sf::Event::Closed) {
                window.close();
            }
        }
    }
}

sentences:
How to await player input using Coroutines How can I accept player input using Coroutines, pausing execution of Unity while the player has not yet provided input? It seems like a simple problem, but I can't seem to figure it out. Here is my latest attempt. In this program I want to do some logic and pause in the middle, continuing only when the player has inputted some data. Someone please tell me I'm on the right track :O

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

public class InputTester : MonoBehaviour
{
    int choice = -1; // valid choices for this example are 0 and 1

    void Start()
    {
        StartCoroutine(DoSomeLogic());
    }

    IEnumerator DoSomeLogic()
    {
        print("Starting...");
        print("Awaiting your choice - 0 or 1. :: ");
        // yield return StartCoroutine(WaitForKeyDown(KeyCode.Alpha0) || WaitForKeyDown(KeyCode.Alpha1));
        // how to combine these two into a single method that gives the player a choice?
        print("Continuing...");
        switch (choice)
        {
            // logic based on the choice
        }
    }

    IEnumerator WaitForKeyDown(KeyCode k)
    {
        while (!Input.GetKeyDown(k))
            yield return null;
        SetChoiceTo(k);
    }

    private void SetChoiceTo(KeyCode keyCode)
    {
        switch (keyCode)
        {
            case (KeyCode.Alpha0):
                choice = 0;
                break;
            case (KeyCode.Alpha1):
                choice = 1;
                break;
        }
        //StopAllCoroutines(); // how do I stop all the coroutines that accept player input?
        print(choice);
    }
}

sentences: 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: Are there any sample projects for Flashpunk? Are there any open source games using Flashpunk? The other big flash game library Flixel has a number of example projects, are there any equivalents for Flashpunk?

sentences:
Optimizing gaussian blur with linear filtering There's a few (here, and here) gaussian blur tutorials out there suggesting that you can essentially cut the number of texture lookups in a gaussian blur shader in half by exploiting the GPU's hardware linear filtering.

Essentially turning this:

Into this:

It sounds good in theory, but after attempting to implement this, I've come to the conclusion that it can't be done correctly, and I'd like someone to prove me wrong :)

My beef lies with the weights.  Take the far left 2 texels in the first image.  Their overall contribution to the shader equals:

t1 * w1 + t2 * w2

In the image, their weights 1 and 4, respectively.  Now let us assign abitrary color values to the texels... 10 and 20.  This gives their overall contribution, according to the formula, of 90.  Great.

Now let us try to work this out with linear filtering.

What we want is essentially a new sampling location and a new weight, such that the value sampled at this new location, multiplied by the new weight, equals our original formula.

((t1 - t2 * new_offset) + t2) * w3 = t1 * w1 + t2 * w2

Let's make it easy and choose a sampling location halfway between texels 1 and 2, so that the value sampled is 15 (((10 - 20) * .5) + 20).  So the new weight MUST be 6, so that 15 * 6 = 90.  Ok great.

Now what happens when you change the values...instead of 10 and 20, you use 10 and 30.  With the first way, you get 10 * 1 + 30 * 4 = 130.  But with the linear sampling way, you get a linear sampled value of 20 ((10 + 30) / 2), times the weight of 6...120!  It doesn't match!

Can anyone shed any light on why the linear sampling optimization is thought to work, and what I'm misunderstanding about it?  I would be more than thrilled to be wrong about this :)

sentences:
Transformations between coordinate systems In a graphics engine, I have three three-dimensional orthogonal coordinate systems, O, A and B.

A and B are the result of two different transformations from O. I now want to calculate the transformation matrix R, which takes you from A to B. R should be the rotation and translation with respect to coordinate system A, not the original coordinate system O.

Which of the following is correct?

(1) B = A * R or (2) B = R * A

By doing some simple worked examples, it seems that (1) is correct. However, my intuition says that (2) is correct, because the transformation to A should be applied before the transformation to B, via R. Which is it?

Thanks :)

sentences:
Rotation on one object affects all others I am making a game using LWJGL. I have encountered a problem with rotation, looked it up, found a solution, and added it, but it doesn't entirely work.
In the code below, the bottom section is rotating well, but when the top one is rotating the other direction, the same direction, or anything else relating to rotation, the bottom sprite seems to move with it, or cancel out the rotation altogether.
            GL11.glPushMatrix();
            GL11.glTranslatef(0.0f, 0.0f, -300f);
            GL11.glRotatef(i+=0.5f, 0.0f, 0.0f, 1.0f );
            drawStar2(0, 0, 0);
            GL11.glLoadIdentity();
            GL11.glPopMatrix();

            GL11.glLoadIdentity();

            GL11.glPushMatrix();
            GL11.glTranslatef(0.0f, 50.0f, -300f);
            GL11.glRotatef(i-=0.5f, 0.0f, 0.0f, 1.0f);
            drawStar0(0, 0, 0);
            GL11.glLoadIdentity();
            GL11.glPopMatrix();

How can I make the rotation of the object in the code on the bottom insensitive to the rotation of the object in the code at the top?
I am also using Slick-Utils, if this is also causing a problem I haven't heard of.

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:
Shaderlab and Cg API reference I am looking for definitive information on Shaderlab's API and the Cg language. The documentation I have found so far has been by way of example programs rather than a definition of APIs. Also, searching for a specific API term such as Sampler2D didn't turn up anything definitive.

What reference documentation is available or possibly documentation of precursors to Shaderlab and Cg?

sentences: Portable sound and music for XNA / MonoGame? What is the best (recommended) way to integrate audio (both sound effect and music) in a game project (using C#/XNA) targeting multiple desktop platforms (W7, W8 Metro, Linux, OSX, ...) via MonoGame. XACT was the usual way in XNA but it is deprecated in W8 and also cannot be used with MonoGame, I am looking for an alternaive. Is there one?

sentences: Disable spaces in InputField This is straight forward. I have an input field and I want to restrict the user of inputting any spaces. I was thinking to make a script that checks if the user typed in a space and then remove it, but is there a simpler way of doing this?

sentences:
How to compensate for moving objects with client side prediction? I'm implementing a game server that supports Star Control-like melee. So you have ships flying and shooting, with super simple velocity/acceleration/dampening physics to drive movement.

I've read Valve, Gafferon and Gambetta and implemented Gambetta's algorithm for client prediction:

Client prediction works on the player ship by updating its position from the server as it comes and then reapplying the yet-unprocessed-by-the-server input to the player ship.

Unfortunately, it doesn't work well for my game. I believe it has to do with the fact that Gambetta's example doesn't take into account objects that are already moving, or commands that are updated on a step by step basis. (by "step" I mean frame). So in my game the player presses up to accelerate the (already moving) ship, which continues moving on the client, sends the command to the server and usually receives the world snapshot from the server on the next step. I get something more like:

The player command runs at client step 3, but on the server its only run at server step 5. By the time the world snapshot is received by the client at client step 6, the prediction is way off, especially in faster velocities.

The crux of the problem is that the client runs the command at step 5, but the server runs it at step 6. I thought about maybe sending the client step with the command, and have the server roll back and re-run the command with the client time step. That might lead to a slew of other problems though - like what happens to commands received since the rollback, or how cheating clients can exploit by changing the sent step.

Reading and watching videos like this one from Google mentions a different approach, where you gradually change player position to match that of of the snapshot over a few steps.

My questions:

Can you make Gambetta's algorithm work with constant step movement? Or is it conceptually incompatible with my game?
Is gradual interpolation over steps the correct way to go then? If so, how do you interpolate an already moving object from the client position to match that which was just received from the server?
Can these methods, gradual interpolation and Gambetta's algorithm work in tandem, or are they mutually exclusive?

sentences:
Class design and data structures for a Tower Defense I was trying to come up with a structure for a simple TD game that has following elements

Tower
Each Tower has a set of properties like range, damage, health etc
There could be different types of Towers with different attack types. For eg Tower A can perform attackType 1 and 2 and Tower B can perform attackType 3 and 4
Creep
Each Creep has a set of properties like damage, health, bountyPoints etc.
There could be different types of Creeps with different abilities just like the Towers

For now I am trying to come with a good design that is scalable and well structured for the above two game elements

This is the skeleton of a Tower class that I have come up with so far. Please comment and suggest changes. Any design patterns that could make life easier

using System.Collections;
using System;

    public enum TowerType
    {
        tA,
        tB,
        tC
    };

    public class Tower {

        private TowerType type;
        private int damage;
        private int range;
        private int health;

        public Tower(TowerType type)
        {
            this.type = type;
            initializeVariables();
        }

        private void initializeVariables()
        {
            if (this.type != null)
            {
                if (this.type == TowerType.tA)
                {
                    this.damage = 20;
                    this.range = 40;
                    this.health = 50;
                }

                else if (this.type == TowerType.tB)
                {
                    this.damage = 30;
                    this.range = 50;
                    this.health = 60;
                }

                else if (this.type == TowerType.tC)
                {
                    this.damage = 60;
                    this.range = 60;
                    this.health = 80;
                }

            }
        }

        public int getDamage()
        {
            return this.damage;
        }

        public int getRange()
        {
            return this.range;
        }

        public int getHealth()
        {
            return this.health;
        }

        public TowerType getTowerType()
        {
            return this.type;
        }

        public string getType(int value)
        {
            return Enum.GetName(typeof(TowerType), value);
        }
    }

So using enums to define various types of towers. But is this a good design? Each Tower would have different damage, range and health.

What if there are 100 different towers? So in my InitializeVariables() would have a cluster of 100 if else statements. How can I improve on this or is there a better way to implement this?

sentences:
How to make my characters turn smoothy while walking on a path(list of coordinates)? I have a list with coordinates - output from A* algorithm - and I would like to make my characters smoothly follow this path with rotations.

So I have something like A and I want to get C

How can I do this ?

EDIT

To make myself a little bit more clear:

I am more interested in smooth turning as I already know how to walk from one node to another.

EDIT

As many people find this useful (me too) I am posting link to Daniel Shiffman's "Nature of code" where he discusses a lot of game AI (and physics) problems e.g. steering behaviours http://natureofcode.com/book/chapter-6-autonomous-agents/#chapter06_section8

sentences:
How can I roll up a plane with a vertex shader? I have plane that I want to roll up using a vertex shader, like this:

I found a math demo that shows the kind of curve I want my mesh to follow. I tried implementing this in my shader code, but the results don't form a roll as expected:

Shader " Custom/Rolling "
{
Properties
{
_MainTex ("Base (RGB)", 2D) = "white" {}
_Bend("Bend",Float) = 1
_Strength("Strength",Float) = 1
}

SubShader
{
Tags {"Queue"="Geometry" "IgnoreProjector"="true" "RenderType"="Opaque"}
Cull Off

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

struct v2f
{
half2 texcoord  : TEXCOORD0;
float4 vertex   : SV_POSITION;
};

sampler2D _MainTex;
float _Bend;
float _Strength;

v2f vert(appdata_full v)
{
v2f o;

//I don't know what should I write here for rolling ,please help me.
//v.vertex.y *= ???
v.vertex.y *= exp(_Bend+(v.vertex.x*_Strength)); // something like this but this hasn't twist effect
o.vertex = UnityObjectToClipPos(v.vertex);
o.texcoord = v.texcoord;
return o;
}

float4 frag (v2f i) : COLOR
{

float2 uv = i.texcoord.xy;
float4 tex = tex2D(_MainTex, uv);

return tex;
}
ENDCG
}
}
Fallback Off
}

Instead of a neat roll, the end of my plane shoots up into the sky!

sentences:
Finding closest coordinate of a pre-known set Let's say I have a large number of conceptual objects of some kind, each of which occupies a pre-known set of points in a Cartesian 3-space.

1) What is the best combination of data structure (for modeling these objects, their occupied points, and/or the enclosing space) and algorithm for the purpose of being able to retrieve only the point within each object that lies closest to an arbitrarily selected point, with speed the first concern and memory footprint secondary (but still important)?

2) Let's say that that a point may be visually occluded with respect to another point, according to a black-box true/false rule, and I now want to retrieve the closest visible point of each object.  Asking the same question as in #1, is the answer the same or is something else now advisable?

3) Let's say that the pre-known set of points for each conceptual object may potentially change somewhat frequently, enough so for computational expense in data structure management to be a concern.  Are the answers to #1 and #2 still good, or are they expensive enough in setup/teardown to be likely to cause problems under this condition?

(I really do want to know the answers to these items separately, if they have distinct answers.  Mega bonus points for any answers that generalize well to a Cartesian 4-space.)

sentences: How to animate a flip of a card in Cocos2d? I am working on a card game and would like to ask if someone could advice me how to implement a flip of a card in Cocos2D?

sentences:
DirectX 11 Mouse Picking Problem I'm trying to do mouse picking and actually it works but when I scale the object and click that point on the image it picks wrong one, this happens only after scaling an object and I'm sure matrices are correct, any idea?

    DirectX::XMFLOAT4X4 projection;
    DirectX::XMStoreFloat4x4(&projection, Graphics::projectionMatrix);

    float viewX = ((2.0f * Input::GetMouseX()) / MainWindow::GetDisplayResolution().width - 1.0f) / projection(0,0);
    float viewY = (1.0f - (2.0f * Input::GetMouseY()) / MainWindow::GetDisplayResolution().height) / projection(1,1);

    DirectX::XMMATRIX inverseMV = DirectX::XMMatrixInverse(nullptr,DirectX::XMMatrixTranspose(entity->Renderer_->MV_Matrix)); //MV is column order

    DirectX::XMVECTOR rayOrigin = DirectX::XMVector3TransformCoord(DirectX::XMVectorSet(0.0f,0.0f,0.0f,1.0f), inverseMV);
    DirectX::XMVECTOR rayDirection = DirectX::XMVector3Normalize(DirectX::XMVector3TransformNormal(DirectX::XMVectorSet(viewX, viewY, 1.0f, 0.0f), inverseMV));

    for (const auto& subMesh : entity->Renderer_->mesh->GetSubMeshes())
    {
        float distance = 0.0f;
        if (subMesh.AABB.Intersects(rayOrigin, rayDirection, distance))
        {
            for (unsigned int i = 0; i < subMesh.GetIndexCount(); i += 3)
            {
                DirectX::XMVECTOR p1 = DirectX::XMLoadFloat3(&subMesh.positions[subMesh.indices[i]]);
                DirectX::XMVECTOR p2 = DirectX::XMLoadFloat3(&subMesh.positions[subMesh.indices[i + 1]]);
                DirectX::XMVECTOR p3 = DirectX::XMLoadFloat3(&subMesh.positions[subMesh.indices[i + 2]]);

                if (DirectX::TriangleTests::Intersects(rayOrigin, rayDirection, p1, p2, p3, distance) && distance < minDistance)
                {
                    minDistance = distance;
                    *pickedEntity = entity;
                }
            }
        }
    }

sentences:
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 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:
SharpDX(DirectX 11) N-tier layering of images I have an project I'm looking for a better solution to. I have a need to render n images over each other the previous one. So I have loop if you will. This should simulate alpha bending via basic combining the target and overlay pixel color values. Please see code below.

public void Render()
    {
        Device3DModule.DeviceContext.ClearRenderTargetView(Device3DModule.RenderTargetView, Colors.Blue.ToDXColor());

        CompositeShader.Apply();

        foreach (var image in Images)
        {
            Texture2D target = null;
            var pass01 = true;

            foreach (var imageChannel in image)
            {
                if(!imageChannel.IsVisible || imageChannel.Image == null) continue;

                imageChannel.Pass01 = pass01;

                Device3DModule.DeviceContext.PixelShader.SetShaderResource(1, imageChannel.Image);
                imageChannel.CopyToDeviceBuffer(ref m_ChannelSettingBuffer);

                QuadMesh.Draw();

                target?.Dispose();

                target = new Texture2D(Device3DModule.Device, Device3DModule.RenderTarget.Description);
                Device3DModule.DeviceContext.CopyResource(Device3DModule.RenderTarget, target);

                ShaderResourceView = new ShaderResourceView(Device3DModule.Device, target);
                Device3DModule.DeviceContext.PixelShader.SetShaderResource(0, ShaderResourceView);

                pass01 = false;
            }

            target?.Dispose();
            ShaderResourceView.Dispose();
        }
    }

Does anyone have a better idea?

sentences: Start Broadcast Unity Network Discovery I am using the unity NetworkDiscovery component, and I am wondering how I can auto-start broadcasting when the server starts, instead of the client having to click on the gui: Initialize Broadcast => Start Broadcasting. I would like to be able to put some C# in my start host function so that the user does not have to do anything.

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:
Game Maker - Selecting tiles in an isometric grid I have implemented an isometric grid with rotation in 2 directions in Game Maker. I did this by first calculating the points of the grid in 3D space and then converting them to 2D points through equations I derived from rotation matrices. I use a single object to draw the grid, and would like to be able to click on a tile to select it.

Here are the equations I use to convert the initial 3D points (x, y, z) to isometric 2D points (iso_x, iso_y), where b and a are the angles I'm rotating the grid by:

iso_x = cos_b * x - sin_b * y
iso_y = cos_a * sin_b * x + cos_a * cos_b * y + sin_a * z

I attempted to rework the equations to calculate the tile from mouse coordinates, but I've run into the problem where I have 2 knowns (mouse_x, mouse_y) and 3 unknowns (x, y, z), which will make implementing height difficult.

So I guess I'm looking for suggestions on how to do tile picking better, especially when it comes to choosing tiles with height. If you need extra information, I will try to provide it.

I want to keep the rotations, so moving to sprite-based tiles probably won't work because the shape of the tiles will change as the grid rotates.

sentences:
just download first assetbundle In the Start of my scenes I call the method that downloads the assetBundles for that scene. The problem is that it only downloads the first assetBundle from the list, the second does not download it. My code is:

Note: The Debug that shows the url shows the correct url both times, first http://mihost.com/assetbundles/asset1 and then http://mihost.com/assetbundles/asset2.
However, in the Debug that shows the assets 'added' in both cases it shows the name only of those in asset1

public virtual IEnumerator LoadBundleFromServer()
{

var AssetPathOnServer = "http://mihost.com/assetbundles/"

var assetBundleNames = new List<string>();
assetBundleNames.Add("asset1");
assetBundleNames.Add("asset2");

    for (int i = 0; i < assetBundleNames.Count; i++)
    {
        var currentAssetBundleName = assetBundleNames[i];
        var url = AssetPathOnServer + currentAssetBundleName;
        Debug.Log("url: " + url);

        var request = UnityWebRequestAssetBundle.GetAssetBundle(url);
        yield return request.SendWebRequest();
        if (!request.isHttpError && !request.isNetworkError)
        {
            var asseBundle = DownloadHandlerAssetBundle.GetContent(request,);

            Debug.Log("count assets: " + AssetNames.Count);

            for (int j = 0; j < AssetNames.Count; j++)
            {
                string assetName = AssetNames[j];
                AssetBundleRequest asset = asseBundle.LoadAssetAsync<AudioClip>(assetName);
                yield return asset;
                AudioClip myClip = asset.asset as AudioClip;
                if (!assetDictionary.ContainsKey(assetName))
                {
                    assetDictionary.Add(assetName, myClip);
                }
                Debug.Log("added: " + assetName);
            }
            asseBundle.Unload(false);
        }
        else
        {
            //TODO: aqui hay que mostrar un error
            Debug.LogErrorFormat("error request [{0}, {1}]", url, request.error);
        }
    }
}

public abstract List<string> AssetNames
{
    get;
}

sentences:
StringBuffer behavior in LWJGL Okay, I've been programming in Java for about ten years, but am entirely new to LWJGL. I have a specific problem whilst attempting to create a text console. I have built a class meant to abstract input polling to it, which (in theory) captures key presses from the Keyboard object and appends them to a StringBuilder/StringBuffer, then retrieves the completed string after receiving the ENTER key.

The problem is, after I trigger the String return (currently with ESCAPE), and attempt to print it to System.out, I consistently get a blank line. I can get an appropriate string length, and I can even sample a single character out of it and get complete accuracy, but it never prints the actual string.

I could swear that LWJGL slipped some kind of thread-safety trick in while I wasn't looking.

==UPDATE==

I've now determined that a null value was appended at the beginning of my StringBuffer. The problem can (sloppily) be solved with a command.delete(0, 1) line, freeing the actual String data. However, I don't know how that null got in there to begin with. If anyone sees it before I do, please let me know.

Here's my code:

static volatile StringBuffer command = new StringBuffer();

@Override
public void chain(InputPoller poller) {
    this.chain = poller;
}

@Override
public synchronized void poll() {
    //basic testing for modifier keys, to be used later on
    boolean shift = false, alt = false, control = false, superkey = false;

    if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT))
        shift = true;
    if(Keyboard.isKeyDown(Keyboard.KEY_LMENU) || Keyboard.isKeyDown(Keyboard.KEY_RMENU))
        alt = true;
    if(Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL))
        control = true;
    if(Keyboard.isKeyDown(Keyboard.KEY_LMETA) || Keyboard.isKeyDown(Keyboard.KEY_RMETA))
        superkey = true;

    while(Keyboard.next())
        if(Keyboard.getEventKeyState()) {
            command.append(Keyboard.getEventCharacter());
        }

        if (Framework.isConsoleEnabled() && Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {
            System.out.println("Escape down");
            System.out.println(command.length() + " characters polled"); //works
            System.out.println(command.toString().length()); //works
            System.out.println(command.toString().charAt(4)); //works
            System.out.println(command.toString().toCharArray()); //blank line!
            System.out.println(command.toString()); //blank line!

            Framework.disableConsole();
        }

        //TODO: Add command construction and console management after that
    }
}

Maybe the answer's obvious and I'm just feeling tired, but I need to walk away from this for a while. If anyone sees the issue, please let me know. This machine is running the latest release of Java 7 on Ubuntu 12.04, Mate desktop environment.

Many thanks.

sentences:
About to release a free game on Google Play Store, any legal considerations I should take into account? I will release in the next few weeks a small free game on the Google Play Store. I was wondering if there was any important legal aspects I should consider before release.

Here's a few infos:

I'm doing this alone.
There's no code/graphic assets/gameplay concepts I would like to protect in particular. I don't have any issues with people copying something from my game.
I'm not sure right now, but maybe I'll add the possibility to make a small donation (so there will be IAP in a sense).
I'm using a music track from http://opengameart.org/. The author has specified that it wasn't necessary to credit him, though I would like to.

sentences:
Framerate is affecting speed of object I'm experimenting with building a game engine from scratch in Java, and I have a couple questions. My main game loop looks like this:

        int FPS = 60;
        while(isRunning){
            /* Current time, before frame update */
            long time = System.currentTimeMillis();
            update();
            draw();
            /* How long each frame should last - time it took for one frame */
            long delay = (1000 / FPS) - (System.currentTimeMillis() - time);
            if(delay > 0){
                try{
                    Thread.sleep(delay);
                }catch(Exception e){};
            }
        }

As you can see, I've set the framerate at 60FPS, which is used in the delay calculation. The delay makes sure that each frame takes the same amount of time before rendering the next. In my update() function I do x++ which increases the horizontal value of a graphics object I draw with the following:

bbg.drawOval(x,40,20,20);

What confuses me is the speed. when I set FPS to 150, the rendered circle goes across the speed really fast, while setting the FPS to 30 moves across the screen at half the speed. Doesn't framerate just affect the "smoothness" of the rendering and not the speed  of objects being rendered? I think I'm missing a big part, I'd love some clarification.

sentences:
Legalities of using song names in a music guessing trivia game I have an idea for a new new music trivia game with a table top skirmish twist. My question is related to the trivia part of the game: are there any copyright laws against me using names of songs in my trivia questions?
The way the game works is that questions will be based on different genres of music (E.G. pop, hip hop, RnB, heavy metal, etc.) and players will be asked to describe it and have other players guess its name without saying the song name, but by quoting a lyric, humming the melody/harmony or base line.  Much like in the game Articulate, but you'd be describing music rather than people and things and there would be song names on the question cards for each category.
Am I able to do from a legal point of view or not.

sentences:
Why does the kinematic body move in opposite direction after I interpolate its movement, and how do I fix it? I have added some basic movement and some manual interpolation to a cube that is a kinematic body in Godot.
extends KinematicBody

var speed : int = 10
var slowdown_buffer = 0.2
var movement = Vector3(0,0,0)
func _ready():
    pass

func interpolate():
    if movement.x > 0:
            movement.x -= slowdown_buffer
    elif movement.x < 0:
        movement.x += slowdown_buffer
    else:
        movement.x = 0.0
func _physics_process(delta):
    if Input.is_action_pressed("left"):
        movement.x = -speed
    elif Input.is_action_pressed("right"):
        movement.x = speed
    else:
        interpolate()

    move_and_slide(movement)

The problem is that when I move the cube using A and D, after the cube stops after the interpolation, it starts moving in the opposite direction with a non-increasing speed.
How can I fix this?

sentences:
For loop only checking the last object Hi I am using a for loop to check and see if my players character is colliding with a collision object in the game. But for some reason it only checks the last Rectangle of the list.

private void collisionDetection()
{
    for(Rectangle rectangle : colrect) {
        Rectangle rect2 = new Rectangle(posX, posY, 64, 64);
        if (rectangle.overlaps(rect2))
        {
            m.setTileCollision(true);
        }
        else
        {
            m.setTileCollision(false);
        }
    }
}

Why and how is this happening? I gave up on looking for an answer so I'm here. I want to check all of the Rectangles in the list not the last... I even for looped text through Bitmap font to see the positions and set text at all Rectangles and that works properly, but this doesn't.  Another solution perhaps is in order?

sentences:
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:
Create random level platforms on screen I'm trying to create random level platforms like this:

 public Level(int platfromsInLevel, Texture2D sprite, int screenWidth)
    {
        rnd = new Random();
        this.screenWidth = screenWidth;

        for (int i = 0; i < platfromsInLevel; i++)
        {
            if (i == 0)
            {
                Platform platform = new Platform((new Vector2(0, 0)), (new Vector2(0, 0)), sprite);
                Platformlist.Add(platform);
            }
            else
            {
                int CurrentX = (int)Platformlist[i - 1].getPos().X + Platformlist[i - 1].getTex().Width;
                int CurrentY = (int)Platformlist[i - 1].getPos().Y + Platformlist[i - 1].getTex().Height;

                int xRand = rnd.Next(CurrentX + 100,(CurrentX + 100) + 150);
                int yRand = rnd.Next(CurrentY + 200, (CurrentY + 200) + 200);

                if (xRand <= screenWidth || xRand >= 0)
                {
                    Platform platform = new Platform((new Vector2(0, 0)), (new Vector2(xRand, yRand)), sprite);
                    Platformlist.Add(platform);
                }
            }
        }
    }

Can anyone help with the random logic? I only want them to appear on the screen that is visible on the X axis, but the y axis is infinite it can go as high as needed. The width of the screen is stored in screenWidth. I also don't think my random logic is taking into account the whole screen width, it only adds positive values. Finally I've tried to add some logic that says a platform can only be a certain height and distance away from another one whilst taking into account the previous platforms position, but its not really working.

Anyone got any ideas to tidy this up a little bit?

sentences: Dynamic Shader Linkage in DirectX12? Do the dynamic shader linking concepts introduced in DirectX11 ShaderModel 5.0 still work in DirectX12? In the documentation the reflection API is still available (e.g. ID3D12LibraryReflection), claiming it is provided especially for the shader linking technology, but I couldn't find other important interfaces like ID3D11FunctionLinkingGraph or ID3D11ClassLinkage in DX12.

sentences:
What's the best control scheme for an arena shooter on a touchscreen phone? I am developing Android an game. It's going to be a top-down shooter with stealth features. I am now thinking about how to the make controls. Most top-down games are now twin stick (joystick on the left and right sides) but I need more buttons (for choosing weapons, commanding your squad, and using skills).

So here are my ideas:

Two (virtual) sticks like in other games, when you tap somewhere on the display, a circle with buttons appears, where you can choose abilities or weapons.
One stick on the left side for walking, shoot where the second finger is pressed, weapons and skills on the right side.

What do you think is the best? Or do you have any other idea? I want to choose the most intuitive and simplest.

sentences:
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:
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:
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:
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:
Changing color of UI Text in Unity into custom values There are a few objects in the scene as well as a title. I want the title to change its text and color based on the object that is mouse-overed. The script below is added to each object that is intended to change the color and text of the title.

The title changes it's color correctly when values like Color.red are assigned but doesn't change color when values like new Color(254f, 152f, 203f).

public Text title;

void OnMouseEnter()
{
    switch(name)
    {
    CONDITION1:
        title.color = Color.yellow;  // works well
        break;

    CONDITION2:
        title.color = new Color(254f, 152f, 203f);  // doesn't work
        break;
    }

    title.text = name;
}

void OnMouseExit()
{
    title.text = "DEFAULT VALUE";
    title.color = Color.white;
}

Is there a specific reason to the former method to work and latter not to work? How can I change the color of the Text element with custom values?

sentences:
NavMesh - LoS and "Containing" For a gameserver/backend, I have a navmesh for "walkable" areas in form of points/triangles.

Now I want to check every gametick if the client is still in a legit place and if he shots/casts a spell, if his target is in line of sight.

I found several possibilities, but I am not sure what is performance-wise ideal.

To check if the player is still in the allowed area (and not wallhacking) I would check if his position is in one of the triangles with a algorithm using barycentric coordinates like this:
https://github.com/SebLague/Gamedev-Maths/blob/master/PointInTriangle.cs
But this would mean that every gametick I have to check soooo much triangles.

To check if its LoS I could either check if the line from the player to its target crosses one of the "border" lines of the mesh (which have no other triangle next to it). Those border lines could be computed at bake time and are just a static list for each level. But still it would be a lot lines per check.
Second option I found would be to start a Simple Stupid Funnel Algorithm (http://digestingduck.blogspot.com/2010/03/simple-stupid-funnel-algorithm.html) until LoS is broken.

The questions now are:
How does a good gameserver handle this/can it be optimised?
What way to check is the best/fastest?
Is it common to only check if the position is legit every now and then or every gametick?

The Levels are fairly simple (~300 mesh-triangles, ~200 border lines, 10 players, 10 npcs maybe)

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

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

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

Is there any possible way to make this faster?

sentences:
Create Render Target View [138][140] need to Bind the back buffer to the render target view DirectX 11 This is the error

D3D11 ERROR: ID3D11Device::CreateRenderTargetView: A RenderTargetView cannot be created of a Resource that did not specify the RENDER_TARGET BindFlag. [ STATE_CREATION ERROR #138: CREATERENDERTARGETVIEW_INVALIDRESOURCE]
D3D11 ERROR: ID3D11Device::CreateRenderTargetView: Returning E_INVALIDARG, meaning invalid parameters were passed. [ STATE_CREATION ERROR #140: CREATERENDERTARGETVIEW_INVALIDARG_RETURN]

So as i see here i need to set the BindFlag of the backBuffer to D3D11_BIND_RENDER_TARGET, but in all the tutorial i saw nobody is doing it, they all create the render target view by using this code

hr=m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), reinterpret_cast<void**>(&m_backBuffer));
if (FAILED(hr)) MessageBox(0, L"Failed get buffer", 0, 0);
hr=m_device->CreateRenderTargetView(m_backBuffer, NULL, &m_renderTargetView);
if (FAILED(hr)) MessageBox(0, L"Failed to create rendertargetview", 0, 0);

And nobody, nowhere is doing as the msdn site says, that the render target view must be created with this specific flag: D3D11_BIND_RENDER_TARGET

So I tried doing it by myself.

I created a texture2d desc like this for the back buffer:

D3D11_TEXTURE2D_DESC backBufferDescription;
    backBufferDescription.BindFlags = D3D11_BIND_RENDER_TARGET;
    backBufferDescription.ArraySize = 1;
    backBufferDescription.CPUAccessFlags = 0;
    backBufferDescription.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
    backBufferDescription.Height = 600;
    backBufferDescription.Width = 800;
    backBufferDescription.MipLevels = 1;
    backBufferDescription.MiscFlags = 0;
    backBufferDescription.SampleDesc.Quality = 0;
    backBufferDescription.SampleDesc.Count = 1;
    backBufferDescription.Usage = D3D11_USAGE_DEFAULT;
    m_device->CreateTexture2D(&backBufferDescription, NULL, &m_backBuffer);
    if (FAILED(hr))
        MessageBox(0, L"Fallito back buffer desc", 0, 0);

And it doesn't work the same.

Help please

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

The cup(and also a cup with flipped normals)

The Rim of the bucket

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

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

            }
        }
    }
}

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

sentences:
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:
Algorithm for Randomized Weather I'm having a hard time modeling weather.
Modeling a single aspect is trivial - some sinusoidal pattern + random noise. However more than 1 is blowing my mind. I cannot have wind, falling leaves, rain, and snow all to be random. Simple collisions like rain and snow should never happen.
On top of this I'd like an "intensity" level for maybe each. But this can come after the main logic.
Weather is stored in MySQL.
All your suggestions are welcome, but please don't suggest pinging some zipcode and pulling weather from there.

Utilizing suggestions from, actually, all answers below I've come up with this not-to-scale distribution:

Each feature will be computed with a random noise, and the combination of the 3 will produce overlay effects.
(temp < 0) and (humid > 65) => snow

sentences:
Why am I getting a return value of zero from my position computation function? Ok I have a Function int x(), which is used in

new Rectangle(x(),a,a,a);

in DrawMethod in XNA
but when I use it I get x() = 0 as as the answer.Here is my CODE:

int x()
        {
            int px = (128 * 5);
            int xx = 0;
            for (int i = 0; i < 6; i++)
            {

                if (Mouse.GetState().X > px)
                {
                    //xx = Mouse.GetState().X;
                    xx = px;
                    break;
                }
                else
                { px -= 128; }
            }

            return xx;
        }

Here is the DrawMethod Code:

if (set)
        {
            spriteBatch.Draw(texture, new Rectangle(x(), y(), texture.Width, texture.Height), Color.White);
            textpositionX = x();
            textpositionY = y();
            set = false;
            select = false;
            place = true;

        }
        else if(select)
        {
            spriteBatch.Draw(texture, new Rectangle(Mouse.GetState().X - texture.Width / 2, Mouse.GetState().Y-texture.Height / 2, texture.Width, texture.Height), Color.White);

        }
        else if (place)
        { spriteBatch.Draw(texture, new Rectangle(textpositionX, textpositionY, texture.Width, texture.Height), Color.White);
        select = false;
        set = false;
        }

sentences:
CW/CCW Rotation of a Vector Considering that I have a vector A, and after an arbitrary rotation I get vector B. I want to use this rotation operation in others vectors as well, but I'm having problems in doing that.

My idea do that is to calculate the perpendicular vector C of the plane AB (by calculating AxB). This vector C is the axis that I'll need to rotate. To discover the angle I used the dot product between A and B, the acos of the dot product will return the lowest angle between A and B, the angle ang. The rotation I need to do is then:
-rotate *ang*º around the C axis.

The problem is that I dont know if this rotation is a CW or CCW rotation, since the cos of the dot product does not give me information of the sign of the angle. There's a tip discover that in 2D ( A.x * B.y - A.y * B.x) that you can use to discover if the vector A is at left/right of vector B. But I dont know how to do this in 3D space. Can anyone help me?

sentences:
Center Perspective Camera on Coordinates I've got a PerspectiveCamera and set of coordinates (x,y,z).

How could I pan the camera to make these coordinates at the center of the screen?

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:
Is there any public in-game data mining/knowledge discovery repository? I'm taking an Introduction to Data Mining course at the university and we have to work on a final project.

As you may already know, it's difficult to collect this kind of data manually (specially when you're not working for a company of have the proper contacts).

Is there any public collection of in-game data in order to apply data mining algorithms? The kind of data I'm looking for is the sort of data they used in this paper "Predicting Player Behavior in Tomb Raider Underworld".

Characteristics: playing time, number of deaths, causes of death, rewards, treasures. Other kind of in-game data (possible an MMORPG): race, level, equipment, guild, items usage, hp/mp rate, level-up mean time, hours played by day/week/month, log-in/log-off time, etc.

The kind of problems I'd like to tackle could be represented as questions like:

What are the chances a player is likely to pass the game [in X seconds]?
What are the best X guilds to be with in order to meet my expectations as a player and not end up being expelled?
What is the best world area in order to level-up faster now while minimizing death possibilities?

sentences:
unity3d model falling apart I found something I can't understand.
I'm only a beginner, so I thought I could use the CarController Scripts of the Car Demo for making a little driving game with different models.

I wonder why the colliders are sub-objects and the RigidBody has "Gravity-Enabled" without falling apart.

my model falls apart with the same configuration.

sentences: GraphicsAdapter lacks a definition for CheckDeviceMultiSampleType The MSDN is really confusing about this, with all their different versions of XNA jumbled together for my google results. All I want to do is find out, in XNA 4.0, what antialiasing modes are supported by the display adapter. Supposedly, this involves calling GraphicsAdapter.CheckDeviceMultiSampleType(), but that function isn't defined. What should I be using in its place?

sentences:
Issue with distinguishing levels in isometric game Possible Duplicate:
  How can I change this isometric engine to make it so that you could distinguish between blocks that are on different planes?

I'm working on an isometric game however I am having trouble visually distinguishing between levels in the game.

Take the example below, the first image shows concrete blocks at ground level and the following images show an attempt to build a few blocks a level above. As you can see the level above is visually swallowed the one below.

I've tried shading to make lower levels darker with respect to camera, but this doesn't work that well.. any ideas?

sentences:
Reset Polygon Collider Runtime (Unity) I've created an animation by using different frames. Then applied polygon collider on that object. Problem is that when frame changes in animation, it does not reset collider. I've searched for resetting polygon collider as sprite gets change. One solution I've found is like following :
Destroying existing collider & Adding new collider to the object.
http://answers.unity3d.com/answers/723811/view.html
I've applied this on the object. But it hangs the game. Is there any another way to reset polygon collider from c#.

sentences:
What is the simplest method to generate smooth terrain for a 2d game? What is the simplest method to generate smooth terrain for a 2d game like "Moon Buggy" or "Route 960"?

I got an answer at stackoverflow.com about generate an array of random heights and blur them later. Yes, it's quite okay. But it would be better to give some points, and get a smooth curve.

sentences:
How manage multiple images in Unity? I'm new in Unity and creating a game. So I have a class PicManager in which I have to load my images(sprites) from assets into a List and then use them in my game. What is the proper way to load multiple images from a folder in Assets?

I know, that I can use  Sprite[] sprites = Resources.LoadAll<Sprite>(texture.name);
But this article of Unity says not to use Resource folder.

sentences:
Do OpenGL buffers overflow to CPU memory? This is a question about OpenGL buffers and memory. My game world is mid-sized, one contiguous space, unchanging, and only partially visible from any position.

Will modern OpenGL overflow buffers into CPU memory?

And if so, can I just allocate buffers (vertex and texture) for all of it, and adjust my draw calls to skip non-visible areas, and let OpenGL pull buffers into GPU as needed, hopefully minimizing thrashing? (Or does OpenGL just fail on the allocate after a while?)

EDIT: The above was ambiguous. But maybe both variations are interesting.

Could I just allocate one huge vertex buffer and a few giant textures, and hope that OpenGL moves parts of it in and out of the GPU as needed, and maybe enough early depth-testing lets it skip some of the texture drawing...
Could I have a handful, or maybe a lot, of "sensibly-sized" vertex and texture buffers, but only glDrawXxx() some of them on each frame? In that case, would OpenGL move them up and down from the GPU, maybe in a least-recently-used sort of way?

sentences:
How can I model the physics of an air blower? I want to model simple lottery machine, it has got a bottom blower.

Do you know how can I get force applied to object above blower by air from blower, or equations to model this behavior?

Red arrow is blower "wind"

sentences: calculate new vertex position given a transform matrix? How can I get the new position of my vertex given a 4x4 transform matrix or simply 9 floats (positionX, positionY, positionZ, rotationH, rotationP, rotationR, scaleX, scaleY, scaleZ)? Usually I can assign the matrix to my final mesh (or "node", or "object", or "geom"), but right now I need to do it manually.

sentences:
Finding collision point of moving projectile/bullet with a cube I am programming a game in the spirit of Wolfenstein 3D (2D grid map, 1 cell = 1 cube) and I wanted to implement shootings. I didn't want the shootings to happen in one frame so, I wanted to see the beams flying everywhere.

So this gets a bit complicated for me to test for impacts. To be fair, I'm not really sure how I'm supposed

This is how I used to do it : I took the position of the beam and checked on the map to see if there is a wall at said position. It works great when the beam is moving very slowly. But when they go extremely fast, naturally, as you would expect, they clip through walls.

Here you can have an idea of what I'm looking for. 2D grid with white cells being air and grey cells being walls. Player is green, beam is red and dotted lines represent the beam on next frames. And orange is the collision

So I'm not exactly sure when and what to test for collisions here, as well as how to find the impact's position. What would be the most optimised way to test for collisions ?

sentences:
Unreal Engine Linux Support I use multiple game Engines, but havn't used Unreal engine for quite a while, Now with the recent changes in Unreal Engine there are quite some interesting features which would be interesting to use in games.

However I also recently heard that UE4 recently dropped build support for Linux.
So my main 2 questions are
1. Did UE4 truly drop Linux build support?
and if so
2. Is there a way to get Linux build support in the latest version of UE4?

I can check the first question myself but due to the large engine size and my slow network connection this would take very long, so I figured it would save a lot of time if someone who already has the newest version installed knew the answer.

sentences:
Is it possible to export a simulation (animation) from Blender to Unity? I created an explosion animation within Blender, something as shown in this video. To achieve this I used a particle-system, together with the "Explode" modifier.

This kind of animation (simulation) doesn't get exported to other file-formats though and I'd like to export the animation as FBX, so that I can use it in Unity. So I basically need some way to "bake" the animation to keyframes. I wonder if there's a way to achieve this?

After some testing I found out, that the only way the simulation gets exported is by writing a sequence of obj files. So an answer on how to integrate/animate such a sequence of obj files in Unity would also be welcome.

Side note: I also tried to get an answer to this over at the blender community.

sentences:
How can I write an additive mesh shader that splits the RGB channels while accounting for depth? I'm trying to create a sort of "hologram" effect. So far, what I have is an additive, three-pass shader that uses ColorMask for each pass to separate the RGB channels. The problem is that doing so requires ZWrite to be off (first image) so that each pass doesn't intersect the others (second image). However, doing so means that the model geometry overlaps itself, which I don't want.

I've tried the various methods of taking depth into consideration with transparency (This, for example) but they all cause problems when trying to separate the RGB channels. Is there some way to have each pass take depth into consideration within itself, but not with the other passes?

sentences:
How can I implement smart scripting, in my game? I'm developing a game engine. It is supposed to be an entity/components based one. For developing my game, itself, I thought to use some scripting language to actually create the entities.

For example, if I want to add a kind of monster that is aggressive to the player, it will be an entity with several components; those components will change with the monster type, so if I have one hundred different types of monsters, in my game, I will not have to create a new method for each of them straight in my game code.

Should I use a scripting language to describe this entity, in term of components or is there something else that would work better? More generally, how should I use scripting, in my game?

sentences:
Mathematics behind Phong shading and additive blending I'm confused about the mathematics behind additive blending used in conjunction with Phong shading. Intuitively, it seems like you would need to use a floating-point framebuffer and some sort of tone-mapping to achieve the actual approximation of many lights. Since the lighting values are computed as diffuse + specular, multiple lights can be encoded as:

finalColor = ambient
for light in lights:
  finalColor += light.specular + light.diffuse

Now, suppose you have multiple white lights shining on a perfectly diffuse, but mostly red sphere. The more lights you add, the closer the final rendered sphere should get to the actual color of the sphere. In this case, if you use an 8-bit RGBA framebuffer, then rendering with glBlend(GL_ONE, GL_ONE) will actually cause the sphere to reach a white color in the limit, similar to the effect outlined in this question.

My question is twofold:

Is my intuition here correct?
If so, how do you combat this situation? If not, why not?

sentences: If you make a game for facebook do you have to have a "real website" on the domain name? Can you just use the domain to house your database and code?  Do you have to have a "real" front end webpage?

sentences:
Framerate on AIR for Android - Actionscript 3 I am currently working on making Android apps using AIR for Android.

This is a sample file and package that I am running to test the FPS and Memory usage of my application while it is not even doing anything,

it appears to hit flat at
6,975,488
FPS:
0

Which from what I can work out is 7 megabytes and a frame rate of 1/0 frames per second...

I was wondering if anyone could help me improve the way I write as3 in order to improve this and get my framerate back up to scratch.

Also I was wondering if people thought it was generally better to mix timeline and package coding or stick to just package/class coding.

Been working on this and my other file for a few days now, I am hoping to get some sleep and solve it in the morning as I know this file is a mess and that there is way too much going on in one file, but I thought after having cut everything out except the base key functions as well as leaving the memory/fps tracer there would bring the fps back up to 60 but it does not appear to have done so.

I have also noticed a blank AIR template running the mem/fps test seems to hit 60fps no problem, I guess I will just have to trace out that data 24/7 while developing so as to keep on top of it.

I apologise because I know my coding is terrible and probably very messy/poorly written.

Thank you for any help in advance.

package com.qr.maze{
import flash.desktop.NativeApplication
import flash.desktop.SystemIdleMode;
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
import flash.utils.getTimer;
import flash.system.System;
[SWF(width="480",height="800",frameRate="60",backgroundColor="#000000")]
public class menu extends MovieClip{

    public function menu(){
        NativeApplication.nativeApplication.systemIdleMode=SystemIdleMode.KEEP_AWAKE;
        NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_DOWN,keyOn);
        NativeApplication.nativeApplication.addEventListener(Event.ACTIVATE,onActivate);
        NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE,onDeactivate);
        NativeApplication.nativeApplication.addEventListener(Event.EXITING,onDeactivate);
        this.addEventListener(Event.ENTER_FRAME,performMemTest);
        this.addEventListener(Event.ENTER_FRAME,performFrameTest);
    }protected function keyOn(e:KeyboardEvent):void{
        if(e.keyCode==Keyboard.BACK){e.preventDefault();}
        else if(e.keyCode==Keyboard.HOME){onDeactivate(null);}
        else if(e.keyCode==Keyboard.MENU){e.preventDefault();}
    }protected function onActivate(e:Event):void{}
    protected function onDeactivate(e:Event):void{NativeApplication.nativeApplication.exit();}
    public function performMemTest(e:Event):void{trace(System.totalMemory);}
    public function performFrameTest(e:Event):void{
        var prevTimer:Number=0;
        var curTimer:Number=0;
        var frames:int;
        frames+=1;
        curTimer=getTimer();
        if(curTimer-prevTimer>=1000){
            trace("FPS: "); trace(Math.round(frames*1000/(curTimer-prevTimer)));
                prevTimer=curTimer;
                frames=0;
        }
    }
}
}

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:
Applying a getButtonDown & getButtonUp on a GUI button for touch input I have a GUI interface with a button for the character's attack, however I want to implement a defense button where the user can hold the button down to block incoming attacks, when the user stops touching the button then the player goes back to idle.

Right now I have the attack button working correctly, whenever the button gets pressed, it triggers a method where the animator gets called and performs the action. I want to implement the getButtonDown("") and getButtonUp("") used commonly with the keyboard input. How can i implement such fucntions to a GUI button?

sentences:
I'm trying to write a randomly patrolling AI for my 2D Platformer I'm trying to write a randomly patrolling AI for my 2D Platformer. The AI already has a ground checker function which checks if there are tiles nearby or not. What I want to do is randomize its actions and create an illusion of a somewhat "sentient" enemy. What I tried to create below is using the built in RNG to make the enemy either jump, change direction, or keep moving.
The problem is, it doesn't seem to work properly. The enemy just jumps every second I want it to change behaviour. The change direction functions, however, don't occur as frequently. I need to know what I've done wrong here. Thanks.
void Update()
{
      //RNG
      behaviour = Random.Range(0,3);
      jumpSpeed = Random.Range(1,5);

      //clock
      timer += Time.deltaTime;
}

  //time
    private float waitTime = 2.0f;
    private float timer = 0.0f;

 void MoveRandomizer()
{
    if((Mathf.Round(timer%waitTime)) == 0)
    {
        if(behaviour == 0)
        {
        movingRight = false;

        }
        if(behaviour == 1)
        {
        movingRight = true;

        }
        if(behaviour == 2)
        {
        rb.velocity = new Vector2(rb.velocity.x, jumpSpeed);
        }
    }

}

sentences:
Finding N shortest paths I know about several of path-finding algorithms that exist: depth-first search, Dijkstra's algorithm, A* etc.

Now I would like an algorithm that gives me the N paths with lowest cost. Can this be obtained by some simple modification of one of the above? Or is a different algorithm needed, and if so which?

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:
How to prevent a character from going up a steep hill with a height map? I've been trying to make my character unable to go up steep hills, but I just can't manage to make it work. I'm using a simple height map which stores the height for every (x, z) point within the map.
I've tried to do this(using C# and XNA):

float height1 = TerrainHeightAt(cam.Position);
float height2 = TerrainHeightAt(cam.Position + cam.GetVelocity());
//If the difference between the two is bigger than a certain constant, don't move.

Basically I find the current height and the future height of the camera. Then, I check if the character is attempting to go up a too steep hill, and if so, I prevent the character from moving. This is not working and I can't see why it isn't.

So my question is:
What am I doing wrong? I would appreciate any link(specially using XNA, but general articles would be great too) showing how to achieve this.

Thank you.

sentences:
Sequencing method calls with time delay I'm trying to solve what seems to be (or should be) a very simple problem. I'd like to sequence several steps in a GameManager class with some time delay between them. In my case, I'd like to clear the screen of objects, then ask my UIManager class to display a "Starting Level" message for 3 seconds, then spawn all the objects I need. This sequence should be repeatable unless a event that the GameManager subscribed to is triggered.

I'm trying to do this in the most generic, flexible and elegant way I can find. This is not a technical, "whatever works" question. I can do this with coroutines. I can do this with the GameManager calling an Action delegate to which UIManager is subscribed, then make the UIManager call an event that the GameManager is subscribed to when the displaying is done. But all these solutions seems convoluted to me.

I've started a thread on Unity Answers with some example code about this, which has generated a small discussion. In posting here I am hoping to find some new ideas, maybe generic to C# and not specific to Unity, on how to sequence a chain of methods. How would you achieve this?

To make this clearer, imagine a more complex sequence inside a GameSequence method:

Initialize variables (level, difficulty etc).
When done, play an introductory animation to that level, which can be of varying lengths depending on the level.
Show a "Get ready" message for 3 seconds.
Spawn the level and let it play.
If the level ends successfully, animate some sort of cutscene (which can be of any duration).
If the level doesn't end successfully, trigger a GameOverManager or something to that effect.

I hope I'm being clear in my question. Thank you for your help.

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:
Issues with Flashlight Handle position with player rotation I want the flashlight to look same while looking up and down as when looking straight.

Normal Position for Hand and flashlight:

Looking up and down, position is completely off:

More images for character/camera prefab rotation:

Basically the position of the Hand held flashlight changes when I look up or down, as well as the arm stretches. How do I fix this?

Code for character rotation:

private void CharacterRotation()
{
    float posX = Input.GetAxis(mouseX) * ((StructsInitializers.Sensitivity * 5) + StructsInitializers.Sensitivity*50) * Time.deltaTime;
    float posY = Input.GetAxis(mouseY) * ((StructsInitializers.Sensitivity * 5) + StructsInitializers.Sensitivity*50) * Time.deltaTime;
    yAxisClamp += posY;

    if(yAxisClamp > 90.0f)
    {
        yAxisClamp = 90.0f;
        posY = 0.0f;
        ClampYAxisRotation(270.0f);
    }
    else if(yAxisClamp < -90)
    {
        yAxisClamp = -90.0f;
        posY = 0.0f;
        ClampYAxisRotation(90.0f);
    }
    transform.Rotate(Vector3.left * posY);
    PlayerBody.Rotate(Vector3.up * posX);
}

private void ClampYAxisRotation(float value)
{
    Vector3 eulerRotation = transform.eulerAngles;
    eulerRotation.x = value;
    transform.eulerAngles = eulerRotation;
}

PS: I am new to game developing. I have lack of experience.

sentences:
Using Unreal Engine 4 to model Earth I could not find a game that has modeled Earth completely (i.e., The entire planet and full round model). Does UE4 have a limitation, such as maximum map size, that limits modeling the entire Earth?

Edit:
Context: The goal is to create a flight simulator using UE4 with centimeter granularity for modeling earth.

sentences:
VertexColor shader is not working correctly in built application I want to change the vertex colors of my mesh. The light sources must not affect the objects with this shader, its lighting must be determined only by its vertices colors, so I turned the Lighting Off. I use this simple shader:

Shader "VertexColored/Simple" {
Properties {
    _MainTex ("Base (RGB)", 2D) = "white" {}
}

SubShader {
    Pass {
        ColorMaterial AmbientAndDiffuse
        Lighting Off

        SetTexture [_MainTex] {
            Combine texture * primary
        }
    }
}
Fallback "VertexLit"
}

And this script:

using UnityEngine;
using System.Collections;

public class BehaviourScript : MonoBehaviour {
    void Start() {
        Color[] exclrs = new Color[11]
        {
            new Color32(25, 25, 25, 255),
            new Color32(50, 50, 50, 255),
            new Color32(75, 75, 75, 255),
            new Color32(150, 150, 150, 255),
            new Color32(200, 200, 200, 255),

            new Color32(255, 255, 255, 255),

            new Color32(200, 200, 200, 255),
            new Color32(150, 150, 150, 255),
            new Color32(75, 75, 75, 75),
            new Color32(50, 50, 50, 255),
            new Color32(25, 25, 25, 255),
        };

        Mesh mesh = GetComponent<MeshFilter>().mesh;
        Vector3[] vertices = mesh.vertices;
        Vector3[] normals = mesh.normals;

        Color[] colors = mesh.colors;

        for(int i = 0; i < vertices.Length; i++)
        {
            for(int j = 0; j < 11; j++, i++)
            {
                colors[i] = exclrs[j];
            }
            i--;
        }

        mesh.colors = colors;
    }
}

When the game is launched, in editor I can see this:

This is EXACTLY what I wanted to achieve!

But in built for PC(x86) version I see this:

Why the results from the editor and from the built .exe differs? What should I do to see my effect in built version? Maybe I need to use an another shader?

sentences:
Game Logic - Tree Based Game Design I'm trying to write an easy to use and extremely modifiable game engine in C++. I was thinking about using a tree to store game data. All objects would inherit a from the Node class and would have parents and children. For example to access an object you could make a request the tree for game.workspace.player or game.devices.controller. I've seen this done in other games and it seems to work well.

Is this worth implementing? Would it affect the performance of my engine? -- I'm just looking for the best way to organize game data. Any critique or insight is greatly welcomed!

sentences:
How do I prevent my game from being detected as a virus? I developed my own game engine and I'll refer to it as a Software Development Kit (SDK) here, for making a specific type of game.
The SDK encapsulates low level DirectX APIs. It's written in C++ and compiled on its own using Visual Studio 2019 which generates a static library file.
Under the Visual Studio 2019 compiler/debugger with remote debugging tools, I can compile, link and deploy a debug sample application to another computer and continue my development activities.
However, when I copy all the graphics files and the executable to a standalone computer (running antivirus software) and then run my sample application, the antivirus software detects my application as a virus and will go so far as to delete it from my computer.
It does so before I get so far as to change video resolution. I am running Windows 10.
This is now of concern because I would like to use the sample to solicit friends and to gauge interest in collaborating with me on a small gaming project.  The sample is simply a means to test artwork by seeing it animated, so that a graphic artist can work independently with his/her own tool. They would simply have the sample application and an artwork compiler as well.
I read  in another post that is several years old entitled “Conundrum with quality and virus reports: is our game releasable?“, in which the author had similar issues.
In that post it was recommended that the antivirus vendors should be contacted, in hopes that the problem would be corrected before they released their product.
Is this really the best course of action? Does anyone know how my application got into the database used by the antivirus vendor? When I contacted the vendor the analyst whom I spoke with suggested to turn the antivirus software off.
I am trying to prevent the possibility of releasing something I worked hard at, only to have it be detected as a virus after release. Is this preventable and avoidable?
Windows Protected you PC
Microsoft Defender SmartScreen prevented an unrecognized app from starting.
Running this app might put your PC at risk
More Info.
App: Buzz.exe
Publisher: Unknown Publisher
Run Anyway or Don't Run
I select Run Anyway

Down Load Insight
Our information on this file is inconclusive.
We recommend not using this file unless you know it is safe.
Very Few Users
Fewer than 5 users in the NXXXXn Community have use this file.
Buzz.exe
Downloaded from
http://codeload.github.com/david-harding/
Very New
File was relead less than 1 week ago
Unproven
There is not enough information about this file to recommend it.

Stop this program from running.
Remove this file from the system (recommended).
Run this program anyway.

More details.
File Insight

Details
a. Developers Not available
b. Version Not Available
c. Identified 2/11/2021 at 4:14:23 am
d. Last used 2/11/2021 at 4:21:46 am
e. Startup item No

Origin
a. https://codeload.github.com/david-harding/sample/zip/main
b. Downloaded file buzz from github.com
c. File Created Buzz.exe

More Info
Taked me to the AV web site to rate the binary
Click 3. Run this program anyway.
Program runs normally.
++++
I am now using only a release version of my sample executable and the original reported issue has not gone away. The problem is chronic. I am not able to unzip the file downloaded from GitHub on my development computer, the AV software removes the .exe file immediately. I have not done exhaustive testing with USB devices etc. The message above indicates that the file is not trusted.
I am going to digitally sign my sample file with a certificate that is trusted by a trust provider. If the certificate is not too expensive. I tested with a sample PFX, which is included in VS 2019.
I found the following article useful. https://docs.microsoft.com/en-us/dotnet/framework/tools/signtool-exe#sign
If anyone has any suggestions on ordering a PFX cert, I would appreciate suggestions. It looks like that is what is needed here. I will report back when this issue is resolved.  Thanks for everything so far.

sentences: IOS Keyboard as Gamepad in unity So I’ve been messing around in unity lately, and I got a vr headset to mess around as as well(google cardboard). I also want to make my own controller to use with this. To achieve this, I want to use a HID complient chip with a arduino. Basicly, this sends usb keyboard input. I was wondering, will Input.getkey(keycode.whateverkey) work with this? I’m not sure if that will even register on ios, because iOS keyboard is usually separate from the app because it covers the screen.

sentences:
Why is std::atan2 returning -0.0? Really? Negative zero?!

double Vector2D::GetFacingAngle(const Vector2D& target, const Vector2D& source) {
    a2de::Vector2D facingVec(Vector2D(source) - Vector2D(target));

    //Negating 'y' argument to account for flipped nature of 'y' screen coordinates.
    double result = std::atan2(-facingVec.GetY(), facingVec.GetX());

    //Which causes -0.0 as a possible result when source is right of target at the same 'y' coordinate.
    if(a2de::Math::IsEqual(result, -0.0)) return 0.0;
    return result;
}

Is this a common behavior? (Similar to subtracting 'y' coordinates for 'up' movement in screen coordinates contrary to Cartesian coordinates.)

sentences:
Object automatic create new with old every time when load / save game.? My problem with this DontDestroyOnLoad(cube.gameObject); When I load my player position its create new object with default and saved position respectively. I have a screen shot for better understand.

First scene without save

Second scene with save game.

Here is my code.

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using UnityEngine.SceneManagement;
using System.Collections.Generic;

public class Player : MonoBehaviour {

public static float speed;
//public static Player control;
public float moveSpeed = 10f;
public float turnSpeed = 50f;
public Transform cube;
public float x, y, z,x1 ,y1, z1;
public int s;

//public static List<Game> savedGames = new List<Game>();
public static Player Instance;
// Use this for initialization

// Update is called once per frame

void OnTriggerEnter(Collider other) {

    if(other.tag == "Player1"){
        DontDestroyOnLoad(cube.gameObject);
        //DontDestroyOnLoad (other.gameObject);
    }
}

void Awake ()
{

    if (Instance == null) {
        DontDestroyOnLoad (this.gameObject);

    } else {
        DestroyObject(gameObject);
    }
}

public void Start () {
    speed = 50f;
}

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

    if(Input.GetKey(KeyCode.W))
        transform.Translate(Vector3.forward * moveSpeed * Time.deltaTime);

    if(Input.GetKey(KeyCode.S))
        transform.Translate(-Vector3.forward * moveSpeed * Time.deltaTime);

    if(Input.GetKey(KeyCode.A))
        transform.Rotate(Vector3.up, -turnSpeed * Time.deltaTime);

    if(Input.GetKey(KeyCode.D))
        transform.Rotate(Vector3.up, turnSpeed * Time.deltaTime);

    }

public  void Save(){

    //Player.savedGames.Add ();
    BinaryFormatter bf = new BinaryFormatter ();
    FileStream fs = File.Create ("D:/playerinfo3.txt");

    playerData pd = new playerData ();
    PlayerPrefs.SetInt ("currentscenesave",SceneManager.GetActiveScene().buildIndex);

    PlayerPrefs.SetFloat ("cubeposx",cube.position.x);
    PlayerPrefs.SetFloat ("cubeposy",cube.position.y);
    PlayerPrefs.SetFloat ("cubeposz",cube.position.z);
    PlayerPrefs.SetFloat ("cuberotx",cube.eulerAngles.x);
    PlayerPrefs.SetFloat ("cuberoty",cube.eulerAngles.y);
    PlayerPrefs.SetFloat ("cuberotz",cube.eulerAngles.z);

    pd.x = PlayerPrefs.GetFloat ("cubeposx");
    pd.y = PlayerPrefs.GetFloat ("cubeposy");
    pd.z = PlayerPrefs.GetFloat ("cubeposz");
    pd.x1 = PlayerPrefs.GetFloat ("cuberotx");
    pd.y1 = PlayerPrefs.GetFloat ("cuberoty");
    pd.z1 = PlayerPrefs.GetFloat ("cuberotz");
    pd.s = PlayerPrefs.GetInt ("currentscenesave");

    SceneManager.LoadScene (pd.s);
    bf.Serialize (fs,pd);
    fs.Close ();

}

  public void Load(){
    //transform.position = new Vector3 (PlayerPrefs.GetFloat ("cubeposx"), PlayerPrefs.GetFloat ("cubeposy"), PlayerPrefs.GetFloat ("cubeposz"));
    if(File.Exists("D:/playerinfo3.txt"))
    {

        BinaryFormatter bf = new BinaryFormatter ();
        FileStream fs = File.Open ("D:/playerinfo3.txt",FileMode.Open);
        playerData pd = (playerData)bf.Deserialize (fs);
        pd.x  = PlayerPrefs.GetFloat ("cubeposx");
        pd.y = PlayerPrefs.GetFloat ("cubeposy");
        pd.z = PlayerPrefs.GetFloat ("cubeposz");
        pd.x1 = PlayerPrefs.GetFloat ("cuberotx");
        pd.y1 = PlayerPrefs.GetFloat ("cuberoty");
        pd.z1 = PlayerPrefs.GetFloat ("cuberotz");
        fs.Close ();
        SceneManager.LoadScene (PlayerPrefs.GetInt ("currentscenesave"));
        cube.position = new Vector3 (pd.x,pd.y,pd.z);
        cube.rotation = Quaternion.Euler (pd.x1,pd.y1,pd.z1);

        Debug.Log ("currentscenesave"+ " "+ pd.s);
        Debug.Log ("currentscenesave"+ " "+ pd.x);
        Debug.Log ("currentscenesave"+ " "+ pd.y);
        Debug.Log ("currentscenesave"+ " "+ pd.z);
    }

  }

  [Serializable]
  class playerData{

    public float x, y, z;
    public float x1, y1, z1;
    public int s;

 }

}

sentences:
How to implement server side physics? I am working on 2-player 2d sidescroller.

How should I implement the physics on the server? Use one world for every game or use a big world in which I add every 2 player that start a game?

I have looked into some source code of multiplayer games and I saw that they don't implement any kind of game loop on the server, instead they work with events. If the game has physics handled by the server shouldn't the server use a game loop to call the step method?

sentences:
Using GrabPass for 2D water reflection? I'm trying to achieve some neat 2d water reflection effect with Unity, something like this:

What I've managed to accomplish so far:

The problem is GrabPass captures the entire screen but I really want to control precisely what area of the screen will be captured.

Is it feasible with GrabPass? (I'd rather not use a new camera for a rendertexture).

Is that even the right approach?

sentences:
Is unzipping SDL2 necessary to set it up on a Visual Studio project? Some tutorials, such as the one on WikiHow.com, suggest to download SDL and use it without unzipping it. The instructions there read as such:

  Download the version for Visual C++. It is SDL2-devel-2.0.9-VC.zip (Visual C++ 32/64-bit).

  In downloading window you have the zip folder SDL2-devel-2.0.9-VC.zip, and inside the folder SDL2-2.0.9. Click it > right click > select Copy.
  Navigate to C:\SDL. Inside SDL, right click > select Paste. Click on name SDL2-2.0.9 and rename to SDL2. Now in folder SDL you have folder SDL2.

I'm wondering if it would be better to unzip the library instead, something that would be instructed like this instead:

  Download the version for Visual C++. It is SDL2-devel-2.0.9-VC.zip (Visual C++ 32/64-bit).

  In downloading window you have the zip folder SDL2-devel-2.0.9-VC.zip, right-click on the zip file and select Extract everything...
  In the window that opened up, type C:\SDL, then click Extract.

sentences:
LibGDX “EXCEPTION_ACCESS_VIOLATION” error when recreating previously disposed Box2DLights light I just installed the Box2DLights dependency for LibGDX and I added a cave with 2 ConeLights inside. The first time I render the cave, everything works as expected. Then when I exit the cave, I make sure to dispose() all the lights. Then if I enter the cave again and try to create the same 2 ConeLights, it gives me this exception with a big error log (PasteBin added at the bottom of this post). If I don't dispose() the lights when exiting the cave, it won't crash the second time, but it will keep adding lights and it will get brighter and brighter and it's bad for performance. It doesn't matter if I use a PointLight or a ConeLight, the same exception will occur.

Everytime a map change occurs, destroyLighting() and then loadLighting() for the new map is called. The error happens when a ConeLight is created, the second time when you enter the cave (4th line in the loadLighting() method)

loadLighting():

for(MapObject o : lightingObjects) {
      EllipseMapObject circleMapObject = (EllipseMapObject) o;
      Ellipse ellipse = circleMapObject.getEllipse();
      Light light = new ConeLight(rayHandler, 60, new Color(255,225,166,1), 100, ellipse.x, ellipse.y, 90, 90);
      light.setSoftnessLength(0);
      lights.add(light);
}

destroyLighting():

for(Light light : lights) light.dispose();
lights.clear();

The error log:
https://pastebin.com/1v36aNPg

sentences:
Complex mesh (created in Blender) is not overlapping when rendered in Monogame (XNA) community. Just started playing with Monogame and stuck with a quite simple, but still unanswered issue, at least I couldn't find any answer.
The model rendered in Monogame (XNA) is not overlapping with its own parts:

Originally in Blender, it looks OK:

The same in Windows 3D Viewer:

I believe it depends on the order I'm rendering bones:
private void DrawModel(Model model, Matrix world, Matrix view, Matrix projection)
    {
        Matrix[] transforms = new Matrix[model.Bones.Count];
        model.CopyAbsoluteBoneTransformsTo( transforms );
        var fixBlenderRotation = Matrix.CreateRotationZ(MathHelper.ToRadians(90));
        var scale = Matrix.CreateScale(0.1f);
        //for (int i = model.Meshes.Count; i > 0; i--) // -> this looks OK
        for (int i = 1; i <= model.Meshes.Count; i++)  // -> this looks BAD
        {
            ModelMesh mesh = model.Meshes[i - 1];
            foreach (var effect in mesh.Effects)
            {
                if (effect is BasicEffect basicEffect)
                {
                    basicEffect.EnableDefaultLighting();
                    basicEffect.Alpha = 1;
                    basicEffect.View = view;
                    basicEffect.Projection = projection;
                    var boneTransform = transforms[mesh.ParentBone.Index];
                    basicEffect.World = (world  * boneTransform * scale *  Matrix.CreateTranslation(_modelPosition)) * fixBlenderRotation;
                }
            }

            mesh.Draw();
        }
    }

Depth buffer is enabled:
protected override void Initialize()
    {
        _graphics.GraphicsDevice.DepthStencilState = DepthStencilState.Default;
        _world = Matrix.CreateWorld(Vector3.Zero, Vector3.Forward, Vector3.Up);
        var cameraPosition = new Vector3(_radius, 0, 0);
        _camera = new FpsCamera(this, cameraPosition, Vector3.Zero, Vector3.Up);
        Components.Add(_camera);
        base.Initialize();
    }

So, cannot figure out how other tools render my model correctly while monogame is messing things up? The hierarchy of objects in Blender is correct:

sentences:
MMO Collision detection I am building a MMO game server for a 2D game and am currently implementing the collision detection, and I am would like to know what I should do.

Lets say I have 1000 players playing and 10,000 objects, should I just iterate over them all to determine if colliding? This seems a bit pricey.

I could separating the world into chunks and iterating every object for each player in it's chunk.

I would like to know some other ideas or what is standard. What's the best way for a MMO server to handle collision detection with static objects?

sentences:
Everything black except where there's a light I have a camera in my scene with a map created at runtime:

As you can see everything can be seen. Now I want the map to be invisible (black as the background) except where there are lights. How can this be achieved in Unity3D?

sentences:
How do I access variables using namespaces? I've got a whole lot of scripts, none of them so far use namespaces. But as I get more and more scripts to deal with I thought it would be a wise idea to start using namespaces. I've never used them before so I'm having a little bit of difficulty. I've declared the namespace in one of my scripts:

using UnityEngine;
using System.Collections;

namespace Train.OnBoardChecker {
    public class OnBoardChecker : MonoBehaviour {
        [SerializeField]private bool isOnBoard;

        public void OnTriggerEnter (Collider col) {
            if(col.gameObject.tag == "Character"){
                isOnBoard = true;
            }
        }

        public void OnTriggerExit (Collider col) {
            if(col.gameObject.tag == "Character"){
                isOnBoard = false;
            }
        }
    }
}

And in my main train script, I've tried to access the 'isOnBoard' bool from the OnBoardChecker script. I was told there were a few ways of doing this, this is what I did:

using UnityEngine;
using System.Collections;
using Train.OnBoardChecker;

namespace Train {
    public class TrainSystems : MonoBehaviour {

        void Start () {

        }

        void Update () {

        }
    }
}

I'm not sure if I'm misunderstanding the whole namespace thing, but I can't access my variables from that script. I've making the variable public, and private (with serialzefield). I've tried these, with the public and private variables, and I even tried making the voids public and not public:

(namespace onboard checker) > OnBoardChecker.OnBoardChecker.insertvariablenamehere
OnBoardChecker.varname

What am I doing wrong, how do I access my variables from the OnBoardChecker script in the TrainSystems script with the namespaces without having to make it public, kind of like the standard assets does.

sentences:
3D movement on an authoritiative server? I'm developing an MMORPG, using Unity for the client and "standard" C# 4.0 for the authoritative server. The server should check each player's movement and ensure that it does not collide with props or walk through unpassable terrain (like a cliff). Collisions with other players and such are not checked. In addition, the server must be able to retrieve/calculate the position of a player at any time so it can be sent to other players (who just walked into range, for example).

To make this all a little more complex, the game is a 3D space, meaning you can have things such as a spiral staircase and flight, and it has multiple maps.

I've run into a problem, though. I'm not quite sure how to actually implement all this.

I've come up with two ideas:

Make the server interop with a Unity client tasked solely with tracking player positions and validating movement
Get the props and terrain onto the server and use math to define the character's movement and check for collisions.

The first one seems ugly to me, and I don't even know if Unity will allow me to load multiple maps onto the same client. I've made some progress on the second one: I managed to export props as OBJ files and read them on the server. But from there, I'm kinda lost.

My question is two parts: Is there a better way to achieve what I want? And if not, how should I proceed with my current plan?

sentences:
SAT test for Triangle - convex hull I'm having real trouble resolving this issue with triangle-convex hull SAT test intersection.

The problem is as follows:

Misses are detected accurately enough:

Clear miss

I have not found a problem with false negatives (ie collision is there but not detected).

But I do have a problem with false positives (collision detected even though there is not one)

Appears to detect false +

This only happens occasionally with orientations like the one shown (that is actually a pretty big gap).

What I'm doing conceptually is just a usual SAT test for the triangle against the hull.  I'm pretending the single triangle is a "convex hull", indeed it might be if you imagine it is a very thin, very flat tetrahedron.  I don't know if I am mistaken in this concept of triangle-convex hull intersection, if the slight inaccuracy is to be expected, or if there is perhaps a bug in my code (the same SAT Test routines work for hull-hull, box-hull, and other test quite accurately though)

The relevant code is at line 621 of hull.h, with the SATTest overlap routine in Intersectable.cpp.

sentences:
how to make a sprite jump or fly and fall slowly I'm a beginner in java and im suffering to make a 2d game.
I already wrote a simple code that makes the character or the sprite jump by increment his Yposition when key is pressed and do the reverse when released ,but it doesn't satisfy me because i don't want the sprite to fall the same speed he fly with it, i want to make fall slowly ,i mean speed (Y increment) of fllying is separated from the falling one.

this may explain what im saying :
1-fllying https://jsfiddle.net/54xfevoc/embedded/result/
2- falling https://jsfiddle.net/poL9cowz/embedded/result/

thank you.

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:
Unable to control trigger events for car animation collsion control I have different car animation running on the road which have imported from max. I want to make such an intelligent System that if car start to trigger from another car it become stop. So far I have tried this.

Added four collider (as you can see in Fig 1) with tag name car, carBack, carLeft, CarRight

car left/right contains this code. Added this script to car left,right collider that if this collider hit with car object then car become stop.(And on trigger exit it resume)

 void OnTriggerEnter(Collider c)
    {
        if (c.tag == "Car")
        {
            Debug.Log("collided with : carsideTriggerScript :" + c.transform + " - object Name to stop : " + gameObject.name);
            c.transform.gameObject.GetComponent<AnimationControlSpeed>().Speed = 0;
            //StartCoroutine(DecreaseSpeedGradually(transform.gameObject.GetComponent<AnimationControlSpeed>()));
        }
    }

    void OnTriggerExit(Collider c)
    {
        if (c.tag == "Car")
        {
            Debug.Log("Exi collided with :  carsideTriggerScript:" + c.transform + " - object Name to resume : " + gameObject.name);
             c.transform.gameObject.GetComponent<AnimationControlSpeed>().Speed = 1;
        }
    }

Added script which check that if car start to collide with carBack collider then stop (And on trigger exit it resume. Same script as above).

But a scenario is creating which you can see in fig 2.

I am enable to handle it. it seems that one car collider hitting  carRightCollider and same thing happen with another car so that both car become stop and unable to move again.
     How can i control it? as same scripts are attached to every gameobject with same OntriggerEnter and logic.

sentences:
Transferring my OpenGL PC game to PS4 and/or XBox One I want to transfer my OpenGL PC game to consoles, PS4 and/or XBox One.

It's a complex application, where many calculations (incl. fast fourier transformations) via FBOs and Transformfeedback are performed within OpenGL. What is the best way to bring it to the PS4?

Or is it easier to implement the game in an engine like Unity or Unreal. As far as I know they have console support? An advantage would be that we could offer our methods as plugin/asset. We are planning to do this too.

There are a lot of glsl-shaders and OpenGL-Api-Calls. Is it possible at all to "translate" that into an engine like unreal? Or would we have to use the engines "predefined" rendnering mechanisms? We basically need shaders operating on floating point textures, changing render targets frequently and transform feedback if possible. We also need low level acces to shading attributes like changing pointsize in the vertex shader etc.

And I really would like to know which is less work. I could image that it is possible to absctract all the Api-Calls in classes/functions and then where first all the OpenGL-calls are implemted and then we would do an implemetation for the console api. Is this realistic on the PS4 Api?

I know that Direct X will have a different design and therefore abstraction itself won't be enough. I believe porting to an engine might be even more work as you have to respect its structures.

sentences: How to merge 2 textures into single SRV I have 2 textures in 2 different ShaderResourceViews. What's the fastest/least expensive way to merge them into one? I would use CopySubresourceRegion but copying a texture is quite a bit expensive. I'm using DirectXTex toolkit for loading textures.

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:
Best/Efficient way to implement a 3d Collision I've already programmed a 2d based collision system for a previous game. It was my first collision system and it was ugly. I was looking for collision between objects by checking all objects with all objects. I've already heard about a grid system with cells where an object will only look the collision with other objects from its current cell(s). Is it really a good way to check collision?

I'd like to have a good technique to loop trough all my items in a 3d world.

sentences:
Modifying A* pathfinding based on size of moving object I've implemented basic A* pathfinding in my top-down 2D game, and I'm almost ready to test it, but I thought of something while adding the movement code to my enemies that I think could affect the pathfinding.

My tiles are 64x64 px, and most enemies are as well. However, I do have some boss monsters that are larger than that. My initial thought was that to move to their goal, they have to move toward each node in their path, and to determine whether they've arrived at that node and to start targeting the next node, I need to test the distance between the enemy and their current target node. So what happens if, for example, their next node is next to a wall, and because of their size, their center is too far to "reach" the node?

My solution to that would be to check if the distance between their center of mass and the next node location is less than half the enemy's width plus maybe 10 px. However, what if one of their movement nodes is in between two tiles, and they're too large to fit through the two objects the node goes between? Is there a simple way to modify A* that takes size into account?

sentences:
Obstacle Avoidance steering behavior: how can an entity avoid an obstacle while other forces are acting on the entity? I'm trying to implement the Obstacle Avoidance steering behavior in my 2D game.

Currently my approach is to apply a force on the entity, in the direction of the normal of the heading, scaled by a number that gets bigger the closer we are to the obstacle. This is supposed to push the entity to the side and avoid the obstacle that blocks it's way.

However, in the same time that my entity tries to avoid an obstacle, it Seeks to a point more or less behind the obstacle (which is the reason it needs to avoid the obstacle in the first place).

The Seek algorithm constantly applies a force on the entity that pushes it (more or less) in the direction of the obstacle, while the Obstacle Avoidance algorithm constantly applies a force that pushes the entity away (more accurately, to the side) of the obstacle.

The result is that sometimes the entity succesfully avoids the obstacle, and sometimes it collides with it, depending on the strength of the avoidance force I'm applying.

How can I make sure that a force will succeed in steering the entity in some direction, while other forces are currently acting on the entity? (And while still looking natural).

I can't allow entities to collide with obstacles when realistically they should be able to easily avoid them, doesn't matter what they're currently doing.

Also, the Obstacle Avoidance algorithm is made exactly for the case where another force is acting on the entity. Otherwise it wouldn't be moving and there would be no need to avoid anything. So maybe I'm missing something. Thanks

sentences:
How do I show a minimap in a 3D world? Got a really typical use-case here. I have large map made up of hexagons and at any given time only a small section of the map is visible. To provide an overview of the complete map, I want to show a small 2D representation of the map in a corner of the screen.

What is the recommended approach for this in libgdx? Keep in mind the minimap must be updated when the currently visible section changes and when the map is updated.

I've found SpriteBatch(info here), but the warning label on it made me think twice:

  A SpriteBatch is a pretty heavy object so you should only ever have
  one in your program.

I'm not sure I'm supposed to use the one SpriteBatch that I can have on the minimap, and I'm also not sure how to interpret "heavy" in this context.

Another thing to possibly keep in mind is that the minimap will probably be part of a larger UI, is there any way to integrate these two?

sentences:
Strange Light Angles in Unity I'm quite sure that I'm missing something very simple here, but I'm a complete Unity noob and I absolutely can't figure out what I'm seeing.

I'm trying to light a sphere from both sides, perpendicular to the camera angle, to create an effect where each side of the sphere is illuminated but there's a strip of darkness down the center. Instead, I'm getting really weird angles from the two lights.

My setup (I've quintuple checked all numbers)...

A single sphere (textured like Mars) at position (0, 0, 0).
An orthographic camera pointed at it from position (0, 0, -20) and rotation (0, 0, 0).
Two Point lights at (-5, 0, 0) and (5, 0, 0), with the same intensity and all other light settings.

By my understanding, that should position each light equidistant from the sphere, exactly on either side from the camera's POV. Sort of like a capital " T " configuration. In theory their shine on the sphere should be mirrored on each side, complimentary angles toward the sphere from exactly horizontal. Instead, I'm getting this:

Left Light...

Right Light...

So, instead of being horizontal and mirrored, it appears as though the Right Light is significantly closer to the camera than the Left Light along the Z axis, and they both seem to be somewhat below the vertical center of the sphere (despite all elements having a Y value of zero).

Even weirder, viewing it in the Scene panel from above, there's a spiral pattern of darkness when both lights are on, rather than a single dark band between them...

Can someone help me out here? Does Unity handle perspective in a way I'm not getting, or have I messed up my arrangement of elements? And aside from eyeballing it, what positions should I use to create the effect I'm going for?

sentences:
Techniques for building out a game idea and mechanics I've been finding that many of my projects fall into the abyss of my "game mechanic tests". That is, they aren't really "games", but rather sandboxes where I try out various things and find some mechanics that would be fun.

Now, I'd like to actually create a game out of some these ideas. Since so many of my "games" end up turning into additional sandboxes when I get distracted by a new idea("whoa, that's cool", and suddenly the whole game completely changes.. twenty times.. sometimes back and forth between several competing ideas), I'd like to actually plan out the mechanics, how they will fit together, and altogether how the game will work as a whole, even though I know I still need to be semi-flexible for when things play-test differently than expected.

This is compared to my usual strategy of, "Let's just get started and then I will build a game out of whatever I create" mindset.

What techniques are used for planning out a game idea (even if just roughly), before actually just jumping in? Is there specific software which helps? How do I go about managing the planning phase in general and keeping things up-to-date if things start to change?

See this great answer on a separate question for the type of actual design I would like to work on for my game, opposed to the programming focus I generally approach things with.

sentences:
Can't create "hero walking" animation I'm creating a Fez-based HTML5 Canvas game and animating my hero image using sprite sheets. The problem is that I can't create the animation of the hero walking, don't matter how much I try, the output is a weird animation that looks like the hero is just shaking its legs. Can someone help me? You don't need to create the sprite sheet for me if you don't want, just show me what's the correct leg position. I'll post the game link in a comment because I can't post more than two links.

Note that the "hero's legs" are compound by 3 pixels each, that are 2x up scaled.

Here is the sprite sheet:

the walking animation is compound by the 6 first frames.

EDIT: If you fall in the demonstration, open the console, type localStorage.x = localStorage.y = 0; and then reload the page immediately to return to the starting point.

sentences:
Cannot Get The Texture Showed Up Correctly glDrawElements I still have  this problem almost 1 month. Tried to search on Google but did not find any solution to this. I have loaded all the data correctly but don't know why the texture came up like this.

Here is my loader:

Header

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

struct STexture
{
public:
    float U, V;
};

struct SFace
{
public:
    int X, Y, Z;
};

class CBMap
{
public:
    struct SMesh
    {
        SVertex *Vertex;
        SVertex *Normal;
        STexture *TexCoord;
        SFace *Face;
        SFace *FaceNormal;

        char Texture[32];
        int TextureID;
        int TotalVertice;
        int TotalNormal;
        int TotalFace;
    };

    SMesh* Mesh;

    CBMap();
    ~CBMap();

    int TotalMesh;

    int Load(char* szFile);
    int Get_FileHeader(FILE* pFile);
    int Get_TotalMesh(FILE* pFile);
    int GetData(FILE* pFile);
};

CPP

int CBMap::Load(char* szFile)
{
    FILE* pFile = fopen(szFile, "r");

    if (!pFile) return 0;

    int iBMap = Get_FileHeader(pFile);

    if (!iBMap)
    {
        printf("BMAP file is not valid\n");
        return 0;
    }

    TotalMesh   = Get_TotalMesh(pFile);
    Mesh        = new SMesh[TotalMesh];
    GetData(pFile);

    int iMesh = 0;

    char* pJunk;
    char szHeader[32];

    while (!feof(pFile))
    {
        fscanf(pFile, "%s", &szHeader);

        if (!strncmp(szHeader, "BMAP", 4)) continue;
        if (!strncmp(szHeader, "mesh", 4)) continue;
        if (!strncmp(szHeader, "mtl", 3))
        {
            fscanf(pFile, "%s", Mesh[iMesh].Texture);
            Mesh[iMesh].TextureID = LoadTexture(Mesh[iMesh].Texture);
        }

        if (!strncmp(szHeader, "ve", 2))
        {
            fscanf(pFile, "%d", &pJunk);
            Mesh[iMesh].Vertex = (SVertex*)malloc(sizeof (SVertex) * Mesh[iMesh].TotalVertice);

            for (int i = 0; i < Mesh[iMesh].TotalVertice; ++i)
            {
                fscanf(pFile, "%f %f %f", &Mesh[iMesh].Vertex[i].X, &Mesh[iMesh].Vertex[i].Y, &Mesh[iMesh].Vertex[i].Z);
            }
        }

        if (!strncmp(szHeader, "uv", 2))
        {
            fscanf(pFile, "%d", &pJunk);
            Mesh[iMesh].TexCoord = (STexture*)malloc(sizeof (STexture) * Mesh[iMesh].TotalVertice);

            for (int i = 0; i < Mesh[iMesh].TotalVertice; ++i)
            {
                fscanf(pFile, "%f %f", &Mesh[iMesh].TexCoord[i].U, &Mesh[iMesh].TexCoord[i].V);
            }
        }

        if (!strncmp(szHeader, "vn", 2))
        {
            fscanf(pFile, "%d", &pJunk);
            Mesh[iMesh].Normal = (SVertex*)malloc(sizeof (SVertex) * Mesh[iMesh].TotalNormal);

            for (int i = 0; i < Mesh[iMesh].TotalNormal; ++i)
            {
                fscanf(pFile, "%f %f %f", &Mesh[iMesh].Normal[i].X, &Mesh[iMesh].Normal[i].Y, &Mesh[iMesh].Normal[i].Z);
            }
        }

        if (!strncmp(szHeader, "f", 1))
        {
            fscanf(pFile, "%d", &pJunk);
            Mesh[iMesh].Face = (SFace*)malloc(sizeof (SFace) * Mesh[iMesh].TotalFace * 3);
            Mesh[iMesh].FaceNormal = (SFace*)malloc(sizeof (SFace) * Mesh[iMesh].TotalFace * 3);

            for (int i = 0; i < Mesh[iMesh].TotalFace; ++i)
            {
                fscanf(pFile, "%d %d %d %d %d %d",  &Mesh[iMesh].Face[i].X, &Mesh[iMesh].Face[i].Y, &Mesh[iMesh].Face[i].Z,
                                                    &Mesh[iMesh].FaceNormal[i].X, &Mesh[iMesh].FaceNormal[i].Y, &Mesh[iMesh].FaceNormal[i].Z);
            }
        }

        if (!strncmp(szHeader, "end", 3))
        {
            if (iMesh < TotalMesh) iMesh ++;
        }
    }

    printf("CBMap::Model Loaded\n");

    fclose(pFile);
    return 1;
}

First picture is reality and second picture expectation

sentences:
C# - How to properly play background songs in XNA So I'm using the game states (enum) to change my game screens. I have 2 songs for main menu and game playing states, respectively. To play songs, I'm using an old code example I saw at MSDN, like this:

bool songStart = false;
Song song1;
Song song2;

// LoadContent method:
song1 = Content.Load<Song>(".\\Songs\\mainMenuTheme");
song2 = Content.Load<Song>(".\\Songs\\mainGameTheme");
MediaPlayer.IsRepeating = true;

// Update method:
switch (CurrentGameState)
{
case gameState.mainMenu:
        if (CurrentGameState == gameState.mainMenu && !songStart)
    {
        MediaPlayer.Stop();
        MediaPlayer.Play(song);
        songStart = true;
    }
    else if (CurrentGameState != gameState.mainMenu && songStart == true)
    {
        MediaPlayer.Stop();
        songStart = false;
    }
break;
case gameState.gamePlaying:
        if (CurrentGameState == gameState.gamePlaying && !m_SongStart)
        {
            MediaPlayer.Stop();
            MediaPlayer.Play(song2);
            m_SongStart = true;
        }
        else if (CurrentGameState != gameState.gamePlaying && songStart == true)
        {
            MediaPlayer.Stop();
            songStart = false;
        }
break;

So if I am in mainMenu, the first song plays; when I go to gamePalying the first song stops and the second one starts playing. If I return to mainMenu, the mainMenu song plays. My issue however, is that if I click Play game and the state moves to gamePlaying there is no background music! What could've caused the problem? Please help me fix it, I'm stuck for a whole week.

sentences:
In GameMaker, is it possible for users to code something into a game while playing, and verify that it is correct? I was wondering if in GameMaker it would be possible to allow people to code a small bit of the game in so that they then unlock that move/code?

Think of the game DLC Quest, in the way that you had to find a few coins and then you were able to buy the ability to jump, would it be possible to do this but instead of getting people to buy the ability to jump, get them to code it? (Only a little bit of code, of course, not an entire script?)

sentences:
How to disable present function when window is invisible to user. Win32 & DXGI When my game window is hidden say by minimising it or hitting Ctrl, Alt, Del. I get the DXGI error:
0x087A0001 : The Present operation was invisible to the user.
I've tried wrapping the present function inside an if statement to check whether the window is visible, this comes from: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-iswindowvisible
And looks like this in my code:
bool Graphics::WindowVisible() const
{
    if (IsWindowVisible(hWnd) == TRUE)
    {
        return true;
    }
    return false;
}

I've created the function in my window object too, and applied it to my EndFrame() call but this doesn't work either.
The function never seems to return false. Any ideas on the best way forward would be gratefully received. If using a check for visibility isn't on the cards, Is there a way to simply disregard the DXGI error and simply throw the frame away and would that be a good idea.

sentences:
Model not rendering correctly XNA Basically i am trying to render a model yet it seems to draw polygons that should be behind something, in front of it. So i end up seeing some faces that should be behind something, totally covering it. Bah, i suck at explaining so here's the pic:

See the Railing? It should be at the front, but it's covered by the top of the platform. Also, on the side, the shadowed area should be practically hidden from that front wall... Other bits are around the place too if you just look at it... :(

I tried the 3 different cull modes, none of them fixed it, so i don't think its the culling (in fact Clockwise made it worse... :P). Thanks for any help.

sentences:
How can I move and rotate an object in an “infinity” or “figure 8” trajectory? I know that the easiest way to move an object with the figure 8 trajectory is:

x = cos(t);
y = sin(2*t) / 2;

but I just don't know how to rotate it, lets says with a new variable r as rotation, how do I merge it into the above formula ?
can anyone please advise me on what is the simplest and cheapest way/formula to move and rotate the figure 8 trajectory ?

ref:How can I move an object in an "infinity" or "figure 8" trajectory?

sentences:
Everything turning black when pitching down Just a quick questions about something that's occurring in my world. Every time I pitch my camera downward, everything starts turning black, and if I pitch upward, everything sort of intensifies.

I'm multiplying my normals by the normal matrix in the shader, and I'm multiplying my lights direction by the model view matrix.

If I leave the normal and light dir in world space everything ends up fine.

I thought putting them both in view space would not cause those weird things to happen?

sentences:
Game Maker - Shader CGA - how to swap the palette I created a shader that get the actual color of the surface and render it to the closer of a cga palette

I have to change it to swap the palette in 4 colors but I don't know how
secondary, I have to render it dynamic (maybe using an uniform variable)
because it have to change in base of the palette

please help me, thanks

///CGA Shader
varying vec2 v_vTexcoord; //xy
varying vec4 v_vColour; //rgba

#define _ 0.0
#define o (1./3.)
#define b (2./3.)
#define B 1.0

#define check(r,g,b) color=vec4(r,g,b,0.); dist = distance(sample,color); if (dist < bestDistance) {bestDistance = dist; bestColor = color;}

void main(out vec4 v_vColour, in vec2 v_vTexcoord)
{
    float dist;
    float bestDistance = 1000.;
    vec4 color;
    vec4 bestColor;

    vec2 pixel = vec2(320,200)-floor( v_vTexcoord.xy / iResolution.xy * vec2(320,200));
    vec4 sample = texture2D(iChannel0, pixel / vec2(320,200));

    sample += (texture2D(iChannel1, pixel / iChannelResolution[1].xy)-0.5)*0.5;

    // pallete 0

    check(_,_,_);
    check(o,B,o);
    check(B,o,o);
    check(B,B,o);

    vec4 color1 = bestColor;
    bestDistance = 1000.;

    // pallete 1

    check(_,_,_);
    check(o,B,B);
    check(B,o,B);
    check(B,B,B);

    vec4 color2 = bestColor;

    float t = (clamp(sin(iGlobalTime)*4.,-1.,1.)+1.)/2.;

    v_vColour = mix(color2, color1, t);

    gl_FragColor = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
}

sentences:
How to implement SDL Button/Menu GUI with callbacks? I have been reading Bjarne Stroustrup's Programming Principles and Practice Using C++ for a while now and am nearing the end of the book. I have to tried to make a very simple game using the SDL libraries as a little exercise to practice programming and utilize techniques from the book.

I've attempted to implement a rather crude GUI system that sort of resembles the one described in the book. The problem that I am having is implementing a callback system so that when a button is constructed it takes a member function as an argument so that it can be called when the button pressed. The reason why it needs to be a member function is that the game has a state system very similar to this http://gamedevgeek.com/tutorials/managing-game-states-in-c/ since I followed the tutorial when crafting my own game state system.

The existing code looks like this:

class Button : public Widget {
private:
    SDL_Surface* m_image;
    SDL_Rect* m_clip;
    bool m_pressed;
    bool m_released;
    int frame;
public:
    Button(int x, int y, int w, int h, SDL_Surface* img, SDL_Rect* clip);
    void handle_events(SDL_Event& event);
    void show(SDL_Surface* screen, GameState* state);
    bool released();
};

Button::Button(int x, int y, int w, int h, SDL_Surface* img, SDL_Rect* clip)
   :Widget(x,y,w,h),
   m_image(img),
   m_pressed(0),
   m_released(0),
   m_clip(clip),
   frame(0)
{
}

So my question is: How do you pass a function in the constructor and call it when the button is pressed? (Like a callback). Currently each state, for example a Menu state, will just look if a button is pressed and perform a corresponding task which is pretty bad and hardly readable.

Stroustrup's code for the GUI system in the PPP book can be found here:
http://www.stroustrup.com/Programming/Graphics/
in the two GUI files.

Thanks in advance.

sentences:
3D Animations in XNA 3.1 Well, guys. I'm in a Game Design class at school. Before you ask "WHY ARE YOU USING 3.1 INSTEAD OF 4" -- I would like to point out that C# 2008, and .NET framework 3 is NOT my preferred environment, nor is Blender 2.49.

I have gotten a pretty decent grip on Blender so far, I think. At least, for what I've figured out how to do. ( Applying textures, exporting to .fbx, and bone-weights ).

Now, I've seen various mentions of using "Skinned Models" in xna 4.0, and I've noticed that 3.1 has no such distinction, so I assume anything you do in 4 with skinned models means alternative methods in 3.1. I have also found nearly NO documentation on 3.1. All of them seem to have actually been updated to cover 4.0 ( Seriously, since when do people update their outdated tutorials? ;_; )

I'm asking around to see if there's any way to play animations stored in .fbx files ( if so, how to do it ), so that I don't waste my time understanding the animations and what not in Blender. ( Or better yet, is there something else that I SHOULD be doing instead? )

If it's not achievable, then I can obviously just use a bunch of constants or some work-around system to apply bone transformations, but it would be really nice if I didn't need to do that.

Some other things -
I've noticed that ALL models I load seem to have semi-transparent textures. Can anybody offer an immediate explanation for this? To see what I'm talking about, here's a video.

Also, could somebody give me advice as far as loading an environment and multiple models?
I think I would use the same camera and projection matrix, and then simply give a new "World" matrix to all of the items, but for some reason, I don't think that's quite right. I read somewhere that the purpose of the Matrix type was to avoid storing position information for every individual model, and store it collectively instead. ( Which, makes sense, really. Especially when some games probably load a gajillion models x3 Vector3's. That could add up fairly quickly, I'm sure. )

I know this is fairly generic / vague, but since I haven't written any code with bugs, I can't exactly ask specific questions, I guess.

If you have a resource that is still rele

sentences:
How to resolve OBB collision penetration? I would think this is a common issue, but I couldn't find an answer that helped me. Help would be appreciated.

In my game I have rectangular objects. They have rotating bounding box, aka not AABB but boxes that rotate with the entity and always match it's exact shape (I think it's called OBB).

When two objects collide, they often penetrate each other a little:

My question is, how can I move the objects out of each other? (Before performing the 'actual' collision handling, i.e. setting velocities etc).

sentences:
.md5mesh normals are not smooth I'm currently working on a project that requires me to load .md5mesh format and draw it.

Following this link I've managed to load the mesh into the engine successfully, but a problem arises when calculating normals; they just don't seem to smooth.

To clarify that it was not my rendering or shader code that was the problem, I loaded a model of .OBJ format, and that lights smoothly.

The mesh is calculated correctly too, as I am able to load in complex models with multiple joints and mesh parts.

Here's a screenshot of the lighting.

And here is how I currently calculate the normals (All normals are set to zero before computing):

EDIT Amended the psuedo-code to be more accurate to what I have. The original may have been confusing.

for (unsigned int i = 0; i < NumberOfTriangles; i++)
{
    Math3::vec3 r, s, result;
    Math3::vec3 p1, p2, p3;

    p1 = Triangle[i].Vertex[0];
    p2 = Triangle[i].Vertex[1];
    p3 = Triangle[i].Vertex[2];

    r = p2 - p1;
    s = p3 - p1;

    result = Math3::Cross(s, r);

    // Add the triangles face normal to each vertex
    // The Vertex's are not local to the triangles.
    // Triangle[i].Vertex[j] is just an index.
    Vertex[Triangle[i].Vertex[0]].normal += result;
    Vertex[Triangle[i].Vertex[1]].normal += result;
    Vertex[Triangle[i].Vertex[2]].normal += result;
}

After the loop I normalise each vertex normal to find the average normal.

EDIT Here is how I find the average normal:

for (unsigned int i = 0; i < NumberOfVerts; i++)
{
    float nx = Vertex[i].normal.x;
    float ny = Vertex[i].normal.y;
    float nz = Vertex[i].normal.z;

    float len = sqrt(nx * nx + ny * ny + nz * nz);

    Vertex[i].normal.x /= len;
    Vertex[i].normal.y /= len;
    Vertex[i].normal.z /= len;
}

As you can see in the image the .md5mesh model is shading flat instead of shading smoothly like the .OBJ model.

So what am I missing?

sentences:
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:
What kind of data structure should I use for a resource container? I am curious what kind of container would be the best choice for a resource container.
BTree, binary search tree or something else?
What like is the priority of the operations over it?
So best inserting performance or best searching performance or between them?

Are there any open source implementation over the net?

sentences:
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:
fragment shader directional light positioning with camera Im trying to set up directional lighting in the fragment shader. So the direction of my light moves with the camera position.

      #version 150 core

      uniform sampler2D diffuseTex;
      uniform vec4 lightColour;
      uniform vec3 lightDirection;

      vec3 LNorm     = normalize(lightDirection);
  vec3 normal    = normalize(IN.normal);
      vec3 calColour = lightColour[i].rgb  * intensity;
  gl_FragColor   = vec4(diffuse.rbg * calColour, diffuse.a);

It lights the entire scene.

sentences:
How does GPU handle texture and VRAM? It's actually a bunch of inter-related questions:

Are compressed textures (dxt5/dxt1 etc.) ever completely decompressed while going through rendering pipeline?
If the answer to the first question is true, then how is memory managed for several large uncompressed textures?
Is framebuffer any different from VRAM in modern GPU?

sentences:
Gamemaker Studio 2 html5 game sfx influence background music volume When I run my game in html5 the game sound effects for shooting makes the background music less audible. It is like the volume of the bg music goes down.
And when shooting is done it goes up again.

When I run my game in test everything is fine.
How can I fix this?

sentences:
My game seems to be incompatible with recording software. What could be causing this? I've just finished a little Game-Dev project for university and I need to record a video to accompany my submission (just in case they can't get my source to work). Basically my game doesn't work at all when FRAPS or Bandicam attempts to attach to it, I get a black screen and a stream of GL INVALID OPERATION messages from my error reporting code. Dxtory can't seem to hook into it correctly at all, it doesn't display it's FPS counter or anything. My game logic appears to be running correctly from the debug traces, it just seems like all the gl library calls break.

I don't know a huge amount about how these programs operate so I don't really know what I could be doing to cause this. I've heard they read from the OpenGL frame buffers so maybe I'm doing something wrong there? I'm letting GLFW and GLEW do all the low level initialization, but I have successfully recorded projects with the same setup and recording software.

Essentially, has anyone ever run into something like this before or do you know anything about how these programs work that could give a clue as to the cause of the issue?

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:
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:
Derive a algorithm to match best position I have pieces in my game which have stats and cost assigned to them and they can only be placed at a certain location.

Lets say I have 50 pieces.

e.g.
Piece1 = 100 stats, 10 cost, Position A.
Piece2 = 120 stats, 5 cost, Position B.
Piece3 = 500 stats, 50 cost, Position C.
Piece4 = 200 stats, 25 cost, Position A.
and so on..

I have a board on which 12 pieces have to be allocated and have to remain inside the board cost.
e.g. A board has A,B,C ... J,K,L positions and X Cost assigned to it.

I have to figure out a way to place best possible piece in the correct position and should remain within the cost specified by the board.

Any help would be appreciated.

sentences:
Object Movement / Constant Movement Rate or Vectors I' have some code to move a unit between two points in a series of points, when it reaches the next point it pops that point off the front of a stack, and then heads towards the next in the stack.

Issue:
When the movement between two points occur, the object will slow down towards the point, I want a constant rate of movement between the two points, I'm thinking of implementing something like a physics engine would, there is some groundwork there already, however it would not ideally work with this code the way I think I should do it, I'd have to rewrite a fair deal where you create a movement vector in the direction of the point?

void EntityUnit::unitgmovement(CWaypoint* &TargetVec, float updatetime, CWaypoint* &Sourcewaypoint)
{
    // BUG why use this twice ? what happening ? probably resolve later tonight.
    // a moveto function without path smoothing used for infantry and tank movement
    pf_Dest = TargetVec;
    pf_Source = Sourcewaypoint;
    double xDistance = pf_Dest->GetX() - unit_x;
    double yDistance = pf_Dest->GetY() - unit_y;
    double zDistance = pf_Dest->GetZ() - unit_z;
    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);
            unit_y += (0.5 * yDistance * speed * updatetime);
            unit_z += (0.5 * zDistance * speed * updatetime);
            util_timer_movedelay = 0;

        }
        else
        {
            pf_Source = pf_Dest;
            dest_reached = true;
            pf_waypoints.pop_front();

        }
    }

}

If I have an objects X,Y,Z global location, how do I create a movement vector for them ? that would work with this so I have a constant rate of movement? Or is there another easier work around ?

sentences:
How do I add an object to the node tree at a specific position I'm making a skiing game, and a part of that is programmatically adding snow to the scene in a specific place. It will all be the child of a single node.

I was looking through the Flappy Bird code but when it instances a scene, it only uses the function add_child(). There doesn't seem to be a way to set its position.

Here is the project on github.

sentences:
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:
How can I reduce the size of bundled Unity DLLs on Android? I have created a simple project (I am a Unity beginner) for Android but the apk size is around 18 MB!

I checked the documentation. One way to decrease the apk size is to check the editor log. Then I discovered that imported DLLs have a size of 3.9MB.

I only used UnityEngine and Collision packages. So how can I avoid to import the other big DLLs?

sentences:
Texture is black when manually building mipmap I am trying to manually build a mipmap from a series of images. For the sake of brevity, let's assume the file containing the images I want (from 256x256 to 32x32) have paths file_1...4.

What I do to load the texture is:

GLuint textureID;
glGenTextures(1,&textureID);
glBindTexture(GL_TEXTURE_2D, textureID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
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_MAX_LEVEL, 4);

for i from 1 to 4
    unsigned char* image =  stbi_load_from_file(file_i, &width, &height, &comp, 3);
    glTexImage2D(GL_TEXTURE_2D, (i-1), GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, image);
    stbi_free_image(image);

When I go and try to use this created texture in a render all I got is a black result. Using singularly each texture works properly, so I excluded they're malformed. What can it be?

sentences: What is the fastest way to work out 2D bounding box intersection? Assume that each Box object has the properties x, y, width, height and have their origin at their center, and that neither the objects nor the bounding boxes rotate.

sentences:
Stereo music playing in mono in libGDX I'm trying to get some music to play back in stereo in libGDX, but it seems to be blending the left and right channels so much that it sounds like it was mono.

To test this out I made a sound file that is just me saying "left" in the left channel and "right" in the right channel. After playing this through libGDX's music class it has blended the channels to the point where the difference is only slight. This is much more noticeable with stereo music where the difference is smaller to begin with.

Here are the sounds themselves. The first one is the input file as I recorded it, and the second is the output recorded from the game:

http://www.jimmakesgames.com/leftRightInput.wav

http://www.jimmakesgames.com/leftRightOutput.wav

You can hear the difference very clearly with headphones. I've looked high and low and can't find anything about this. The libGDX audio stuff seems to be pretty much a black box. The only reference I found to setting stereo or mono is with the newAudioDevice method which is only for writing PCM data directly.

I'm pretty desperate at this point, so if anyone can offer some assistance it would be greatly appreciated. Thanks.

sentences:
Debug Unity DLLs in Windows standalone build I'm trying to publish a game on the Windows Store using a standalone Windows build in Unity 5.6.2 and Desktop Bridge. Despite unchecking "development build", three Unity DLLs remain in debug mode, which blocks deployment:

The binary UnityEngine.Networking.dll is built in debug mode.
The binary UnityEngine.UI.dll is built in debug mode.
The binary UnityEngine.dll is built in debug mode.

How can I force Unity to give me release DLLs if unchecking "development build" isn't enough?

sentences:
Specialisation in game roles: Getting better by learning vs leveling Many games have some sort of role for the players, especially in multiplayer games. Medic, Sniper, Rifleman, AT Specialist in Battlefield, Healer, Tanks, DDs in MMOs, etc.

Now, in many games, there are incentives to specialize in a certain role, allowing access to better equipment for this role. Most of the time, you archive this equip by playing a certain amount of time, gather XP (by doing the roles job), or archive certain goals for that role (heal 1000 players, deal X amount of damage. Battlefield Bad Company 2 and Quake Wars are good examples for that.

Alternatively the player gets "better" in the role by pure stats. They get more health, they heal more etc.

In contrast to that some games have certain roles, that a player can fulfill just by picking certain equipment, that everyone is able to pick. So in theory, every player is as capable of fullfilling the same role. The difference is in the skill of the player and the depth of the role to fulfill.

The game i have  in mind is a coop crew game, where you manage and controll a ship, much like Pulsar: Lost Colony, but much more complicated. Engineering would mean to flux the vents and stabalizing the emitters, which means to have complicated "mini-games" to archive a certain goal: Activating the engine and keep it running. Similiar to Space Station 13 maybe.

So, either i could go the leveling way: The engineer gets traits and stats, what make those minigames easier for him (make something move slower, get a better result). The other thing could be the learning way: you have to learn how to do things, make it more "realistic" and with different (scalar) outcome.

I tend toward learning the about the mechanics. The idea is that you might have more than one person for a certain role, like a chief engineer and many other working in engineering, teaching them the in and outs, maybe even on equal terms. It also would make the game more hectic and thus more reliant on communication. A hard level base would mean, that someone is distinctivly better, if he is a higher level. The higher levels would need to do most of the work, hence their boni are just to good to waste.

On other hand, for roles with less of a learning curve, that wouldnt make that much sense, since mastering it is a lot easier. In that case, it would make sense to have one with skills in this role. But, if you have a pilot with skills for a faster ship, it would be wasted on a slower, but less manouverable ship, where a pilot with talents for better mobility would be far better. For a premade group of players, that would be alright, but if you got drop-in, drop-out, that would be hard to balance for.

What style of role specialisation (leveling vs learning) has what advantage and disadvantage? What would fit better to that syle of game im working on?

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:
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:
Cannot find declaration of element nifty JME I'm new to nifty. I am trying to learn how to create nifty GUI in JMonkey Engine game. I'm going through tutorials and tried to run project. Project runs fine but I get following error when I tried to edit xml:

Cannot find declaration of element nifty

Below is my start.xml code:

<nifty xmlns="http://nifty-gui.sourceforge.net/nifty.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://nifty-gui.sourceforge.net/nifty.xsd http://nifty-gui.sourceforge.net/nifty.xsd">
<useStyles filename="nifty-default-styles.xml" />
<!-- Screen Codes here-->
</nifty>

I guess most possible reason is that above namespace might have been deprecated and already been replaced. Or there might be other steps that I have to perform in JME SDK to make it recognize nifty tag. Please Help.

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:
Architecture for html5 multiplayer game? Hello I want to write a HTML5 multiplayer game in which there are rooms with two players answering a series of questions with 3 possible answers, 10sec/question, which are being downloaded from a server. It will have some ratings and so on.

I want to make it as scalable as possible.
I wonder what technologies to use to accomplish that. HTML5, CSS3 and JavaScript obviously. But what about the server-side? I have been researching and found that Socket.IO + Node.js + mongoDB would do the job but after doing some more research it maybe not.

Can you suggest me some kind of architecture for doing this game? Free technologies, if possible. Or what to read and from where to start in order to understand how to do it.

Thanx in advance!

P.S. I have an experience with HTML5, CSS3, JavaScript, C#, ASP.NET MVC and relational db's.

sentences:
How to choose how to store data? Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.
  - Chinese Proverb

I could ask what kind of data storage I should use for my actual project, but I want to learn to fish, so I don't need to ask for a fish each time I begin a new project.

So, until I used two methods to store data on my non-game project: XML files, and relational databases. I know that there is also other kind of database, of the NoSQL kind. However I wouldn't know if there is more choice available to me, or how to choose in the first place, aside arbitrary picking one.

So the question is the following: How should I choose the kind of data storage for a game project?

And I would be interested on the following criterion when choosing:

The size of the project.
The platform targeted by the game, as well as the development platform used.
The complexity of the data structure.
Added Portability of data amongst many project.
Added2 Silmutaneous use of the data amongst different project. (i.e. User data)
Added How often should the data be accessed
Added Multiple type of data for a same application
Added2 Configuration with multiple data storage.
Any other point you think is of interest when deciding what to use.

EDIT I know about Would it be better to use XML/JSON/Text or a database to store game content?, but thought it didn't address exactly my point. Now if I am wrong, I would gladely be shown the error in my ways.

EDIT2 Added some more points that I would consider relevant. Furthermore, I would be interested to hear what other options are available, aside flat file storage and relational database. What about non-relational database, for example? When it is relevant to use such a database over the formerly mentioned other options?

sentences:
Calculating angle a segment forms with a ray I am given a point C and a ray r starting there. I know the coordinates (xc, yc) of the point C and the angle theta the ray r forms with the horizontal, theta in (-pi, pi]. I am also given another point P of which I know the coordinates (xp, yp): how do I calculate the angle alpha that the segment CP forms with the ray r, alpha in (-pi, pi]?

Some examples follow:

I can use the the atan2 function.

sentences:
How to create reel/slider with mobile controls How can I create a reel/slider with mobile game controls so that it looks something like this?

The slider is normally non visible, and can be accessed if I slide my finger from the right side of the screen to the left. The slider allows me to switch my current weapon and use items in my inventory.
This is my current setup in Unity.

I can figure out the inventory portion of the slider, as there are many tutorials out there on an inventory system, and how to make the slider move based on touch, using something similar to a mobile joystick script, but I can't figure out how to make the slider so that it:

Can "jump" from icon to icon (not have the slider be completely fluid/prevent it from stopping in-between item icons)

Detect what item/slot the slider is currently on (in the case of the example, the item that will be used is the icon in the center of the screen.

Make the icons more transparent the further away it is from the icon in use (I'm guessing that I would have to set the alpha channel value in the color settings of the item to a lower value, but I'm not sure how to detect the icon in use and count how many icons away the other icons are from the one in use.

sentences:
How can I create borders in an open-world game that don't feel artificial? When creating open-world maps, a big issue to take into consideration is how "borders" of sorts are implemented. Obviously, in an open-world game, there shouldn't be invisible-wall borders, as it ruins immersion, and makes the game feel more "artificial".

I've done a little bit of research online and I've found the following methods:

Have the map be an island, surrounded by water that will kill you if you venture out too far.
Have the map be surrounded by mountains that are much too steep to climb over.
A combination of the above; mountains plus a body of water. The Elder Scrolls V: Skyrim does something like this but does have places where paths lead out of the world. (Thanks @Pharap)

These seem like the best methods but I'm wondering if there are any other methods that can be used to create borders in an open world without ruining immersion.

sentences:
How should I organize Lua scripts so that some entities do not have access to functions they shouldn't? For my game in C++ I'm using different objects (like player, enemy, et cetera) which will have to be controlled by a Lua script. My problem is that if I were to write a function in my player script, all my other scripts will have access to it as well, and I don't want that.

I can think of three basic solutions:

For every iteration clear the entire state and re-register everything
Determine out what functions a script registers and remove them
Have every gameobject running it's own Lua state

Is there a good way to do this, keeping runtime performance in mind?

sentences:
Place hexagons together Just made it with some more investigation thanks to this site: Hexagonal grid math, but the hexagons have a little bit spacing horizontally.

Here is the code:

include('class/hexagon.php');

$hexagon = new hexagon(16);

$png_image = imagecreate(500, 500);
imagecolorallocate($png_image, 255, 255, 255);
$black = imagecolorallocate($png_image, 0, 0, 0);

for($i=1;$i<12;$i++) {
    for($j=1;$j<10;$j++) {
        $x = $i * $hexagon->ver;
        $y = $j * $hexagon->height + ( ($i%2) * ( $hexagon->height / 2 ) );
        $points = $hexagon->drawHex($x,$y);
        $last_line = array($points[0][0],$points[0][1]);
        imagettftext ($png_image , 5 , 0 , $x , $y , $black , "C:/Windows/Fonts/Arial.ttf" , "{$i},{$j}" );
        foreach($points as $c):
            imageline($png_image, $last_line[0], $last_line[1], $c[0], $c[1], $black);
            $last_line = $c;
        endforeach;
    }
}
header('Content-type: image/png');
imagepng($png_image);
imagedestroy($png_image);

class hexagon {
    public $size;
    public $width;
    public $height;
    public $hor;
    public $ver;
    public $angle;
    public $rad_angle;
    public $side;
    public function __construct($xsize = 32) {
        $this->angle = 60;
        $this->rad_angle = $this->angle * (pi() / 180);
        $this->side = $this->size * cos($this->rad_angle);
        $this->size = $xsize;
        $this->width = $this->size * 2;
        $this->height = $this->width * sin($this->angle * (pi()/180));
        $this->hor = $this->width * ( 3/4 );
        $this->ver = $this->height;
    }

    public function drawHex($x, $y) {
        $points = array();
        for($i=0;$i<7;$i++) {
            $angle_deg = $this->angle * $i;
            $angle_rad = pi() / 180 * $angle_deg;
            $points[$i] = array($x + $this->size * cos($angle_rad),$y + $this->size * sin($angle_rad));
        }
        return $points;
    }
}

Result:

Any advice?

sentences:
How do I calculate speed given two xy vectors? I have some code that returns the x and y linear velocities of a moving space ship. How can I combine these to give me total speed?

x = self.player._box2dBody.GetLinearVelocity().x;
y = self.player._box2dBody.GetLinearVelocity().y;

So if:
x = 1.99
y = -1.63

How do I calculate the total speed?

sentences:
How to give depth to a top-down shooter? I'm working on a top-down shooter kind of game, but it lacks the feeling of depth.

When you have a sun, it's a bit easier, because the sun can cast shadows. But it's even harder, when there is no sun, like underground.

How do you simulate an ambient occlusion kind of thing? I think that's what it lacks, but maybe I'm wrong.

(And this could be also applied to levels with sun as well, further enhancing the feel)

Example: I have floors and walls, but even if the walls would be a bit thicker, it would lack depth. How could I fix this? I.e. rendering small shadows at floors' edges which are neighbouring walls?

sentences: Specific Physics Lessons and Reference for Game Development What "Physics stuffs" should I learn in game developments? I'm reading about Verlet Integration, and I'm wondering what other lesson should I learn and if there are available resources can you please provide some link or anything. Thanks.

sentences:
Can a Component.gameObject be null in Unity? Can a Component.gameObject be null in Unity? If it can what can cause it to be null?

The context for the question is a NullReferenceException I got from the users, which specifies only method, but not line in which it occurred.

So, I suspect that there may were conditions which cause Component.gameObject to be null.

sentences:
OpenGL Orthographic projection questions I'm studying now about projections with OpenGL and I've some questions:

Is there importance for the viewer's location? I know if I move forward/backward it won't mind, but what if I move upward with 30 degrees for e.g.

Does the viewer is located in the 0,0,0 axis? or he can be in another place after defining glOrtho's properties.

Are there only 6 projections? (I'm asking this because of the properties of the box, and defining the glOrtho - near, far, left, right, up, bottom)

Can I hide objects with ortho proj? I think it's obvious that yes, but I'm still curious maybe I'm wrong.

Do objects that are closer to me seem bigger, meaning that other objects may be hidden? I believe that not. the objects don't seem bigger. they stay the same size.

sentences:
Creating a Custom Map Editor using XNA and Windows Forms I'm looking to create my own level editor for a game I'm making, and I came across the following post:

Tutorial or Example of creating custom sprite tool/map editor for XNA?

In the example posted by Blau, I am unsure what needs to be replaced in this line, and with what:

XnaControlGame.CreateAndShow<MainDialog, VoxelEditorGame>( );

If anyone could help at all, that would be great!

sentences:
Why does my triangle ray intersection test always return -1.0f? I'm trying to get the mouse click position on a terrain geometry, but multiple times in each frame; doing it on the CPU was way too slow, so I'm trying to do it with a compute shader. I can't seem to get a valid result back. I guess it's somehow related to my raydirection/rayorigin vectors, because I tried 4 different written DirectX HLSL solutions, but none of them works for my case; though, I did have to modify them. Anyway, this is my code to generate the ray vectors:

XMFLOAT3 RayOriginFloat = m_Camera->GetPosition(); //The eye position of the camera. I use this vector in the compute shader.

XMVECTOR worldPos;
XMVECTOR RayOrigin = XMLoadFloat3(&RayOriginFloat);
DirectX::BoundingFrustum frustum;

// I use the DirectXMath XMVector3Unproject method to project the mouse coord to worldspace.
ScreenToWorld(m_mouseX, m_mouseY, &worldPos);

XMVECTOR RayDir = worldPos - RayOrigin;
RayDir = XMVector3Normalize(RayDir); //And finally the normalized direction vector

And this is the HLSL code:

cbuffer RayBuffer
{
    float3 RayOrigin;
    float3 RayDir;
    matrix view;
};

struct ComputeInputType
{
    float3 position : POSITION;
    float2 tex : TEXCOORD;
    float3 normal : NORMAL;
};

struct ComputeOutputType
{
    float distance;
    float3 position;
};

static const uint ThreadSize = 32;

StructuredBuffer<ComputeInputType> BufferIn : register(t0);
RWStructuredBuffer<ComputeOutputType> BufferOut : register(u0);

[numthreads(ThreadSize, ThreadSize, 1)]
void PickingCSMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
    float result;
    float3 vertices[3];
    float3 edge[2];

    if (dispatchThreadID.x < 64 && dispatchThreadID.y < 64)
    {
        vertices[0] = BufferIn[(dispatchThreadID.x + dispatchThreadID.y * ThreadSize * 2)].position;
        vertices[1] = BufferIn[(dispatchThreadID.x + (dispatchThreadID.y + 1) * ThreadSize * 2)].position;
        vertices[2] = BufferIn[(dispatchThreadID.x + 1 + (dispatchThreadID.y + 1) * ThreadSize * 2)].position;

        edge[0] = vertices[1].xyz - vertices[0].xyz;
        edge[1] = vertices[2].xyz - vertices[0].xyz;

        float3 normal = normalize(cross(edge[0], edge[1]));
        float b = dot(normal, RayDir);

        float3 w0 = RayOrigin - vertices[0].xyz;
        float a = -dot(normal, w0);
        float t = a / b;

        result = t;

        float3 p = RayOrigin + t * RayDir;
        float uu, uv, vv, wu, wv, inverseD;
        uu = dot(edge[0], edge[0]);
        uv = dot(edge[0], edge[1]);
        vv = dot(edge[1], edge[1]);

        float3 w = p - vertices[0].xyz;
        wu = dot(w, edge[0]);
        wv = dot(w, edge[1]);
        inverseD = uv * uv - uu * vv;
        inverseD = 1.0f / inverseD;

        float u = (uv * wv - vv * wu) * inverseD;
        if (u < 0.0f || u > 1.0f)
        {
            result = -1.0f;
        }

        float v = (uv * wu - uu * wv) * inverseD;
        if (v < 0.0f || (u + v) > 1.0f)
        {
            result = -1.0f;
        }

        BufferOut[(dispatchThreadID.x + dispatchThreadID.y * ThreadSize * 2)].distance = result;
        BufferOut[(dispatchThreadID.x + dispatchThreadID.y * ThreadSize * 2)].position = vertices[0].xyz;
    }
}

The result is always -1.0f. I don't get it; I might have made a big mistake, but I can't find where.

Why does my triangle ray intersection test always return -1.0f?

sentences:
Entity-Component-System data storage design I'm working on an ECS and I've already read a lot of articles about it. Most of these articles are talking about a simple case (store data contiguously, read it in a single for loop). However the real world is more complex: one system reads multiple components and those have to be read fast.

So I'm thinking on a new data storage model but before I start to implement it, I'd like to know what do you think: I'm not sure if this design would solve any (future) performance problem (I'm thinking about cache coherency, prefetching, etc. optimization).

So the basics are the same:

Each Entity is a handle (id + version number together).
Each Component is a(n ideally small) POD.
Each System is responsible for the processing of a set of components.

The first idea in every article is to store the component data in an array (of each type) and use a fast-lookup map (eg. hash_map) for the entity_id->component_id relation.

Eg. the Position component pack looks like this:

component data:
[pos_0][pos_1]...[pos_n]

entity->component map:
[entity_0 -> 1][entity_2 -> 0]...[entity_m -> n]

This works well if the systems are reading a single type of component linearly. If a system wants to read another component as well, it will generate at least two additional cache misses:

one for the entity_id->component_id lookup (to find the other component from the entity)
and one for the actual component data

So my idea is that instead of separating the components I could create groups. Each group has the same behaviour like before (the data laid out contiguously and an entity_id->component_id map is stored for fast component lookup) but the data stores multiple component data.

The point is that the component data is stored in the same order as the other components so if a system wants to read eg. the Position + Velocity component set it can iterate linearly on the array. Each component type has an offset to indicate where it starts on the big array.

So the Position+Velocity group looks like this:

component data:
[pos_0][pos_1]...[pos_n][... some space ...][vel_0][vel_1]...[vel_n]... and so on

entity->component map:
[entity_0 -> 1][entity_2 -> 0]...[entity_m -> n]

And if I'm interested in a component set of a single entity, I can use the map to find the component id then read the components using this id:

component_id = find(entity_id);
comp_0 = data[offset_of(comp_0_type) + component_id]
comp_1 = data[offset_of(comp_1_type) + component_id]

The biggest drawback is the larger array: when the array has to grow it has to allocate and copy more data at once. But IMHO the whole idea could work because most of the time (in my experience at least) an entity's components are not changing at run-time.

Note:
I tagged c++ as well, because I'm using c++.

Edit

Actually I've found a problem with this approach. This way the components cannot refer to each other. Eg a Transform component is responsible for structuring the "objects" in a tree, so each Transform component has a parent and a children property. However with this design I don't know how I could refer to the other Transform component since it can be in any group's array.

Edit 2

For the first iteration I'm going to implement a simple design, similar to the "Packed Array" described here.

sentences:
Problem With Enemy Bullets Attacking The Player Pygame I am trying to make my enemy bullets attack the player but it only attack its x and y how could I make it curve instead of zigzagging VIDEO the bullets only attack the y axis and it wont curve or go to the player only attacks 2 positions

this goes on my main loop and appends projectiles

         for shootss in shootsright:

                if shootss.x < 500 and shootss.x > 0:

                    if enemyshoots1.x < playerman.x:

                        shootss.x +=  5
                    else:
                        shootss.x -= 5
                else:
                    shootsright.pop(shootsright.index(shootss))
                if shootss.y < 500 and shootss.y >0:
                    if enemyshoots1.y < playerman.y:
                        shootss.y += 5
                    else:
                        shootss.y -= 5
                else:
                    shootsright.pop(shootsright.index(shootss))

            if len(shootsright) < 2:
                    shootsright.append(Bools(round(enemyshoots1.x+enemyshoots1.width-107),round(enemyshoots1.y + enemyshoots1.height-50),(0,0,0)))
                # projectile class for each of the bullets

my enemy bullets class

    # enemys bullets
    ksud = pygame.image.load("heart.png")
    class Bools(object):
       def __init__(self, x, y,color):
           self.x = x
           self.y = y
           self.ksud = pygame.image.load("heart.png")
           self.hitbox  = self.ksud.get_rect()
           self.rect  = self.ksud.get_rect()
           self.rect.topleft = (self.x,self.y)
           self.speed = 10
           self.color = color
           self.hitbox = (self.x + 57, self.y + 33, 29, 52) # NEW
       def draw(self, window):
            self.rect.topleft = (self.x,self.y)
            player_rect = self.ksud.get_rect(center = self.rect.center)
            player_rect.centerx += 0 # 10 is just an example
            player_rect.centery += 0 # 15 is just an example
            window.blit(self.ksud, player_rect)
            self.hitbox = (self.x + 97, self.y + 33, 10, 10) # NEW
            window.blit(self.ksud,self.rect)

I have something similar for the player where ever I click it appends bullets  how could I change it to append bullets at the player without the click?

                # this is for the bullets
                    if len(bullets) < 2:
                        shootsound.play()

                        start_x, start_y = playerman.x+playerman.width//2, playerman.y + playerman.height-54
                        mouse_x, mouse_y = event.pos

                        dir_x, dir_y = mouse_x - start_x, mouse_y - start_y
                        distance = math.sqrt(dir_x**2 + dir_y**2)
                        if distance > 0:
                            new_bullet = projectile(start_x, start_y, dir_x/distance, dir_y/distance, (0,0,0))
                            bullets.append(new_bullet)
        # this is displaying the bullets for the player
            for bullet in bullets[:]:
                bullet.move()
                if bullet.x < 0 or bullet.x > 900 or bullet.y < 0 or bullet.y > 900:
                    bullets.pop(bullets.index(bullet))

sentences:
GetMouseButtonUp/TouchPhase.Ended doesn't work properly I'm trying to make a game where your tap doesn't count until you've released your click, or stop tapping.

The weird thing is, it doesn't work in game, but it works for animation.

public class Swipe : MonoBehaviour {

    public Animator anim;
    public bool tap, swipeUp, swipeDown, swipeLeft, swipeRight, hold;
    public bool isDragging = false;
    public Vector2 startTouch, swipeDelta;
    public float animTime;
    public Life life;

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

        anim.SetBool("Hold", isDragging);

        #region Standalone Input
        if (Input.GetMouseButtonDown(0))
        {

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

        #endregion

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

        #endregion

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

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

                }
                else
                {
                    swipeRight = true;
                }
            }
            else
            {
                // Up or down?
                if (y < 0)
                {
                    swipeDown = true;
                }
                else
                {
                    swipeUp = true;
                }
            }
        }

        #region Animation
        if (Tap)
        {
            anim.SetTrigger("Tap");
        }

        if (SwipeDown)
        {
            anim.SetTrigger("Down");

        }

        if (SwipeUp)
        {
            anim.SetTrigger("Up");
        }

        if (SwipeLeft)
        {
            anim.SetTrigger("Left");
        }

        if (SwipeRight)
        {
            anim.SetTrigger("Right");
        }

        #endregion
    }

    public void Reset()
    {
        startTouch = swipeDelta = Vector2.zero;
        isDragging = false;
    }

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

sentences:
LibGDX's HTML project doesn't show anything in Browser The question is self explanatory, when I run my demo-html project as a Web Application and I open Chrome with the provided link by eclipse, my browser doesn't show the image it is supposed to show in a new project.. However, the tab displays the correct title "Demo". Can somebody help me with this?

Eclipse after Running the project:

And Chrome running the project:

I'm using the old setup-tool from Libgdx, the non-gradle way..

sentences:
OpenGL Core 3.2 framebuffer rendering black on Mac OSX I'm trying to get a 2 pass post-processing system going in OpenGL in a cross-platform manor using FBOs. I'm starting the dev on mac OSX (since in the past I've found it the most finicky to get working of windows/linux/osx), I have a toggle to toggle between using the FBO(post-processing) and not. The shaders are working, but it seems the FBO didn't load the texture unit bound to it. The following is the init code for the FBO and it's texture:

glGenTextures(1,&fboimg);
glBindTexture(GL_TEXTURE_2D,fboimg);

glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 512, 512, 0,
             GL_RGBA, GL_UNSIGNED_BYTE, 0);
glBindTexture(GL_TEXTURE_2D, 0);

glGenFramebuffers(1,&fboHandle);
glBindFramebuffer(GL_FRAMEBUFFER,fboHandle);

glFramebufferTexture2D(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT0,GL_TEXTURE_2D,fboimg,0);

GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);

switch(status)
    {

        case GL_FRAMEBUFFER_COMPLETE:    cout<<"The fbo is complete\n"<<endl; break;
        case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:    cout<<"GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT\n"<<endl; break;
        case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:    cout<<"GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT\n"<<endl; break;
        case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER:    cout<<"GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER"<<endl; break;
        case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER:    cout<<"GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER"<<endl; break;
    }

if(status != GL_FRAMEBUFFER_COMPLETE)
{
    cout<<"status !=  GL_FRAMEBUFFER_COMPLETE"<<endl;
    GLUtils::checkForOpenGLError(__FILE__,__LINE__);
}
else
{
    //shader and VAO setup for post
    fboSetup = true;
}

Here is the render code:

//start rendering to FBO
if(postFlag&&fboSetup)
{
    glBindFramebuffer(GL_FRAMEBUFFER, fboHandle);

}
glUseProgram(programHandle);

//start rendering scene one way or another
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

glUniformMatrix4fv(mats.projHandle,1,GL_FALSE, glm::value_ptr(mats.projMatrix));
glUniformMatrix4fv(mats.mvHandle,1,GL_FALSE,glm::value_ptr(mats.modelViewMatrix));

//bind to vertex array object
glBindVertexArray(vaoHandle);
//render scene
glDrawArrays(GL_TRIANGLES, 0, 240*3 );

//do post-processing if we have it enabled
if(postFlag&&fboSetup)
{
    glFlush();
    glBindFramebuffer(GL_FRAMEBUFFER, 0);

    glUseProgram(fboProgram);

    glClear(GL_COLOR_BUFFER_BIT);

    glBindTexture(GL_TEXTURE_2D,fboimg);

    glUniform1i(glGetUniformLocation(fboProgram,"sampler0"),fboimg);
    glUniform2f(glGetUniformLocation(fboProgram,"resolution"),512,512);
    glBindVertexArray(vaoFBO);
    glDrawArrays(GL_TRIANGLES, 0, 6);
    glBindTexture(GL_TEXTURE_2D, 0);
}

Tried everything I can think of or find in a FBO tutorial or have read about. I don't get any errors and it returns as complete. (Also I can't seem to get it glTexImage2d a image of size width and height. says invalid values, and if I try to use GL_TEXTURE_RECTANGLE it says invalid enum :-/ but that's for a different question after I just get it working to begin with^^)

sentences:
swipe effect problem using only mesh and array - libgdx I tried to combine matdesl's and libgdx's draw lines algo ang code. but i can only create a line.

problem is i want to make a fruit ninja swipe effect but only knows this... problem is i want to make a fruit ninja swipe effect but only knows this... anyone try to help me on improving just a line to have a swipe effect like fruit ninja?

    public class GameTouch {

private static final int MAX_LINES = 1000;
private OrthographicCamera camera;
private Mesh lineMesh;
private Vector3 unprojectedVertex = new Vector3();
private FixedList<Vector2> list;

public GameTouch(){
    this.camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    lineMesh = new Mesh(false, MAX_LINES , 0, new VertexAttribute(Usage.Position, 2, "a_pos"));
    list = new FixedList<Vector2>();
}

public void update(float delta){

    camera.update();
    camera.apply(Gdx.gl10);

    if(Gdx.input.isTouched()){
        unprojectedVertex.set(Gdx.input.getX(), Gdx.input.getY(), 0);
        camera.unproject(unprojectedVertex);
        Vector2 input = new Vector2();
        input.x = unprojectedVertex.x;
        input.y = unprojectedVertex.y;

        if(list.size > 0){

            Vector2 temp = new Vector2();
            float sqlen = temp.set(input).sub(list.get(0)).len2();
            Array<Vector2> tempA = new FixedList<Vector2>();
            if(sqlen >= 3){
                list.insert(input);

            }

            lineMesh.setVertices(getVertices(list), 0, list.size * 2);

        }else{
            list.insert(input);
        }
    }else{

         if(list.size > 0){
            list.removeIndex(list.size - 1);
         }
    }
    if(list.size > 2){
        //lineMesh
        lineMesh.render(GL10.GL_TRIANGLE_STRIP);
        Gdx.gl10.glColor4f(0f, 0f, 1, 0.5f);
    }
}

private float[] getVertices(Array<Vector2> list){
    float[] vertices = new float[list.size * 2];
    int counter = 0;
    for(Vector2 vertex : list){
        vertices[counter++] = vertex.x;
        vertices[counter++] = vertex.y;
    }

    return vertices;
}

private class FixedList<T> extends Array<T>{

        public FixedList(){
            super(Vector2.class);
        }

        public FixedList(int capacity , Class<T> type){
            super(false, capacity , type);
        }

        public void insert(T t){
            T[] items = this.items;

            size = Math.min(size + 1 , items.length);

            for(int i = size - 1 ; i > 0 ; i--){
                items[i] = items[i - 1];
            }

            items[0] = t;
        }
    }
}

sentences:
How do I flip upside down fonts in FTGL I just use FTGL to use it in my app. I want to use the version FTBufferFont to render font but it renders in the wrong way. The font(texture?buffer?) is flipped in the wrong axis.

I want to use this kind of orthographic settings:

void enable2D(int w, int h)
{
    winWidth = w;
    winHeight = h;

    glViewport(0, 0, w, h);

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    //I don't even want to swap the 3rd and 4th param
    //because I like to retain the top-left as the origin
    glOrtho(0, w, h, 0, 0, +1);
    glMatrixMode(GL_MODELVIEW);
}

I render the font like this:

//No pushing and popping of matrices
//No translation

font.Render("Hello World!", -1, position, spacing, FTGL::RenderMode::RENDER_FRONT);

On the other forums, they said, just scaled it down to -1, but it wont work in mine. Example:

font is above the screen

I can't see relevant problem like in mine in google so I decide to ask this here again.

How can I invert texture's v-coordinate without modifying its source code ? (assume its read only)

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

sentences:
Input of mouseclick not always registered in XNA Update method I have a problem that not all inputs of my mouse events seem to be registered.
The update logic is checking a 2 dimensional array of 10x10 .
It's logic for a jewel matching game.
So when i switch my jewel I can't click on another jewel for like half a second.
I tested it with a click counter variable and it doesn't hit the debugger when i click the second time after the jewel switch. Only if I do the second click after waiting half a second longer.
Could it be that the update logic is too heavy that while he is executing update logic my click is happening and he doesn't register it?

What am I not seeing here :)? Or doing wrong. It is my first game.

UPDATE :
I changed to Variable time step, then i saw after the reindex of my jewels (so after the switch) i see the elapsedgametime was 380ms. So I guess that is why he doesn't catch the short "Press" of my mouseclick because update method is still busy with executing the reindexing code. Anyone knows how I can deal with this .. Or do I have to start using threads because my update of reindex takes too long?

SOLVED :
The problem was that in my reindexing code I got out of bound exceptions which I catched and then continued. That catching of exceptions caused a massive lag each time a reindex happened. Now everything runs smoothly and I do not have to worry about a slow Update. But I'm still asking the question.. what should you do If you have really heave update logic where the time to process the logic takes almost a 0.5 second? I guess you need to execute your game logic in multiple threads to reduce the update time? I'm also thinking i'll never have to worry about this for a jewels game :p. It's more for a problem for a heavy physics game with alot of game objects ?

My function of the update methode looks like this.

 public void UpdateBoard()
        {
            currentMouseState = Mouse.GetState();
            if (currentMouseState.LeftButton == ButtonState.Pressed &&
                prevMouseState.LeftButton != ButtonState.Pressed)
            {
                debugCount++;
                if (debugCount == 3)
                {
                    int a = 4;
                }

                leftButtonPressed = true;
            }
            if (this.IsBoardActive() == false)
            {
                UpdatingLogic = true;
                if (leftButtonPressed == true)
                {
                    // this.CheckDropJewels(currentMouseState);
                    this.CheckForSwitch(currentMouseState);
                    if (SwitchFound == true)
                    {
                        reIndexSwitchedJewels = true;
                    }
                    this.MarkJewel(currentMouseState);
                }
                if (CheckForMatches == true)
                {
                    if (this.CheckMatches(5) == true)
                    {
                        this.RemoveMatches();
                        reIndexMissingJewels = true;
                    }
                    else
                    {
                        CheckForMatches = false;
                    }
                }

                UpdatingLogic = false;
                if (currentMouseState.RightButton == ButtonState.Pressed &&
                    prevMouseState.RightButton != ButtonState.Pressed)
                {
                    this.CheckMatches(5);
                }

                this.ReIndex();
                leftButtonPressed = false;
            }

            prevMouseState = currentMouseState;
            this.UpdateJewels();

        }

sentences:
How can I optimize coroutines? I have a script which has a Queue datastructure (code below). This queue holds more than 100 Actions. So currently my script does a yield return null after every Dequeue, which means that one Dequeue() call is executed every frame.

private static readonly Queue<Action> DataQueue = new Queue<Action>();
private bool _isHandlingQueue; // Helper bool to check if Coroutine is active

private IEnumerator HandleQueue()
{
    _isHandlingQueue = true;

    while (DataQueue.Count > 0)
    {
        DataQueue.Dequeue().Invoke();
        yield return null;
    }

    _isHandlingQueue = false;

    yield return null;
}

I'm trying to achieve that multiple Dequeue and Invoke actions take place in the same frame. One Dequeue and Invoke takes between x and y ms, this varies depending on the Action itself.

Example: Lets say the Queue has 100 entries and the game runs at 60 frames per second (minimum). One iteration (Dequeue + Invoke) in the while loop takes about 5 ms in this example. Here is the thing: In this case it is essentially waiting for 11.67 ms for the next frame (16.67 ms each frame at 60fps). I don't want the system to wait, but use the remaining 11.67 ms to Dequeue and Invoke 2 more Actions, so it only waits for 1.67ms each frame. In this ideal case the Queue get's cleared in 34 frames instead of 100 frames.

All help to point me in the right direction is appreciated!

sentences:
Drawing multiple triangles at once isn't working I'm trying to draw multiple triangles at once to make up a "shape". I have a class that has an array of VertexPositionColor, an array of Indexes (rendered by this Triangulation class):

http://www.xnawiki.com/index.php/Polygon_Triangulation

So, my "shape" has multiple points of VertexPositionColor but I can't render each triangle in the shape to "fill" the shape. It only draws the first triangle.

struct ShapeColor
{
     // Properties (not all properties)
     VertexPositionColor[] Points;
     int[] Indexes;
}

First method that I've tried, this should work since I iterate through the index array that always are of "3s", so they always contain at least one triangle.

//render = ShapeColor

for (int i = 0; i < render.Indexes.Length; i += 3)
{
    device.DrawUserIndexedPrimitives<VertexPositionColor>
    (
         PrimitiveType.TriangleList,
         new VertexPositionColor[] { render.Points[render.Indexes[i]], render.Points[render.Indexes[i+1]], render.Points[render.Indexes[i+2]] },
         0,
         3,
         new int[] { 0, 1, 2 },
         0,
         1
    );
}

or the method that should work:

device.DrawUserIndexedPrimitives<VertexPositionColor>
(
    PrimitiveType.TriangleList,
    render.Points,
    0,
    render.Points.Length,
    render.Indexes,
    0,
    render.Indexes.Length / 3,
    VertexPositionColor.VertexDeclaration
);

No matter what method I use this is the  "typical" result from my Editor (in Windows Forms with XNA)

It should show a filled shape, because the indexes are right (I've checked a dozen of times)

I simply click the screen (gets the world coordinates, adds a point from a color, when there are 3 points or more it should start filling out the shape, it only draws the lines (different method) and only 1 triangle). The Grid isn't rendered with "this" shape.

Any ideas?

sentences:
Multiple buffering in OpenGL on Windows What is the most common way modern games perform triple buffering ?
What does the SwapBuffers exactly do in terms of OpenGL states ?
Is it possible to perform double and triple buffering independently of window system (for example, by manipulating with glDrawBuffer or by using FBO/PBO) ? If so, any hints ?
Does 3. even make sense in terms of performance and flexibility ?

sentences:
Keep rasterized pixel amount constant I have a scene that is rendered from the point of view of the light using an orthographic projection matrix.

For an arbitrarily shaped and oriented object that doesn't change its shape or size in any way, the amount of pixels that get rasterized change with its position. I guess it's better to explain this with an images:

The depth of the quads (their y coordinates) are constant. Their x and z coordinates are slightly different. However, since it's an orthographic projection matrix, their "world space" floating point sizes are the same as seen from the camera. Just in one case, one additional lines of pixels is rasterized (I drew the two white lines with mspaint to illustrate their size difference).

This is highly undesirable for my application. Is there a way to keep the amount of rasterized pixels consistent? How would I go about implementing it using OpenGL?

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:
Javascript and PHP for real-time multiplayer? I'm wondering if combining Javascript clientside with PHP/mysql serverside is a good idea for HTML5 real-time multiplayer (small scale) browser games?

My technical knowledge is very limited, and even though I plan on learn node.js in the future, the learning curve is rather huge right now.

Since I'm already familiar with PHP I feel I would get it functioning much faster.

The scale I'm thinking is 2-8 players at the time. And trying to keep the client to server message count as low as possible.

The values I intend to store/handle are:

Player name and ID.
X and Y position.
Health.
Equipped items (maximum 8 slots, probably less).
Actions (walk, attack, use etc but only 1 action/player at a time).
Bullet X,Y coordinates and trajectory.
Guild/Clan name.
And some basic chat/mailing function.

My guess is even though it's not the best solution, but aslong as I keep the logic small, that this is completely doable.
Am I right?

sentences:
Handling Event for multiple Sprite with one Event Listener in Andengine In my app i need to add multiple sprite and add event to them. What i am doing now is using individual event listener for each and every sprite which is a kind of mess.

buttonS[0] = new Sprite(x_pos += 0, y_pos, orangeNumImage[0], this.getVertexBufferObjectManager()) {
        @Override
        public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final float pTouchAreaLocalX, final float pTouchAreaLocalY) {
            if(pSceneTouchEvent.isActionDown()) {
                //Perform Some task
                }
                return true;
            } else {
                //Perform Some task
                return false;
            }
        }
    };

    buttonS[1] = new Sprite(x_pos += 115, y_pos, orangeNumImage[1], this.getVertexBufferObjectManager()) {
        @Override
        public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final float pTouchAreaLocalX, final float pTouchAreaLocalY) {
            if(pSceneTouchEvent.isActionDown()) {
                //Perform Some task
                }
                return true;
            } else {
                return false;
            }
        }
    };

I was searching to handle this event with just one event listener and make the code shorter.

In normal android (without andengine) we could use something like this (by using android:onclick to areaTouched in button):-

public void areaTouched(View view) {
    Button nextclick = (Button) findViewById(R.id.button_nextClick);
    Button b = (Button)view;
    int check = Integer.parseInt(b.getText().toString());
    if (check == i){
          ........
    }
}

sentences: Keeping 2 objects within cameras view I have two object to control and I wanted to keep them at cameras view without adjusting the cameras size but the camera can move only in positive y-axis meaning ones it goes up it shouldn't move down but it's okay if one object gets out of bounds. Since its 2D the camera is Orthographic view.

sentences:
Scene graphs and spatial partitioning structures: What do you really need? I've been fiddling with 2D games for awhile and I'm trying to go into 3D game development.
I thought I should get my basics right first.

From what I read scene graphs hold your game objects/entities and their relation to each other like 'a tire' would be the child of 'a vehicle'.
It's mainly used for frustum/occlusion culling and minimizing the collision checks between the objects.

Spatial partitioning structures on the other hand are used to divide a big game object (like the map) to smaller parts so that you can gain performance by only drawing the relevant polygons and again minimizing the collision checks to those polygons only. Also a spatial partitioning data structure can be used as a node in a scene graph.

But... I've been reading about both subjects and I've seen a lot of "scene graphs are useless" and "BSP performance gain is irrelevant with modern hardware" kind of articles.

Also some of the game engines I've checked like gameplay3d and jmonkeyengine are only using a scene graph (That also may be because they don't want to limit the developers).
Whereas games like Quake and Half-Life only use spatial partitioning.

I'm aware that the usage of these structures very much depend on the type of the game you're developing so for the sake of clarity let's assume the game is a FPS like Counter-Strike with some better outdoor environment capabilities (like a terrain).

The obvious question is which one is needed and why (considering the modern hardware capabilities).

Thank you.

sentences:
Getting It Done vs Solid Software Design? With barely enough time at our hands to complete the games we craft, how can you strike a good balance between solid software architecture and making good progress to get it all done?

My personal challenge:
How about being effective today and long-term thinking at the same time? Plus, while you're doing it you may just as well want to learn new things on the way instead of resorting to the same repetitive patterns you've been using those past 5 years?

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

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

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

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

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

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

Here is the relevant part of my drawMap()

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

        }
    }
}

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

sentences:
What is the general architecture of a server for a game like rust/minecraft? If a game's client is written in Unity or UE4 or another engine, is the server usually written in the same engine? Or is it written in standalone c++?

Does the server use a database like MySQL to store the locations of deployed structures and bases etc? Or is everything stored in memory in arrays or in another way?

sentences:
Aim/Scope Oscillation Algorithm I have been struggling to find an algorithm to implement something that will make a direction oscillate within a cone constraint, in a helix-shaped fashion as in photo (it will always go back to the centre after traveling toward the boundaries of the constraint, it doesn't have to hit the max amplitude everytime).
Do you know any algorithm that does this?

EDIT: My mind is telling me that this is somehow similar to a gravity pull but I don't know how to ensure that it always goes back to the centre.

sentences:
AndEngine GLES2 - getting Black screen on emulator 4.1 I'm new in andengine . I create following code

public class MainActivity extends BaseGameActivity {

static final int CAMERA_WIDTH = 800;
static final int CAMERA_HEIGHT = 480;

public Font mFont;
public Camera mCamera;

//A reference to the current scene
public Scene mCurrentScene;
public static BaseActivity instance;

public EngineOptions onCreateEngineOptions() {
    instance = this;
    mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);

    return new EngineOptions(true, ScreenOrientation.LANDSCAPE_SENSOR, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), mCamera);
}

@Override
public void onCreateResources(OnCreateResourcesCallback arg0)
        throws Exception {

    mFont = FontFactory.create(this.getFontManager(),this.getTextureManager(), 256, 256,Typeface.create(Typeface.DEFAULT, Typeface.BOLD), 32);
            mFont.load();
}

@Override
public void onCreateScene(OnCreateSceneCallback arg0) throws Exception {

    mEngine.registerUpdateHandler(new FPSLogger());
    mCurrentScene = new Scene();
    Log.v("Scene","enter");
            mCurrentScene.setBackground(new Background(0.09804f, 0.7274f, 0.8f));
 //             return mCurrentScene;

}

@Override
public void onPopulateScene(Scene arg0, OnPopulateSceneCallback arg1)
        throws Exception {
    // TODO Auto-generated method stub

}

 }

I got code on sites there is returning scene but in AndEngine GLES2 in method onCreateScene() there is no return scene ... so my First run is BLACK .. any suggestion  :)

sentences:
Procedural Generation of tile-based 2d World I am writing a 2d game that uses tile-based top-down graphics to build the world (i.e. the ground plane). Manually made this works fine.

Now I want to generate the ground plane procedurally at run time. In other words: I want to place the tiles (their textures) randomised on the fly. Of course I cannot create an endless ground plane, so I need to restrict how far from the player character (on which the camera focuses on) I procedurally generate the ground floor.

My approach would be like this: I have a 2d grid that stores all tiles of the floor at their correct x/y coordinates within the game world. When the players moves the character, therefore also the camera, I constantly check whether there are empty locations in my x/y map within a max. distance from the character, i.e. cells in my virtual grid that have no tile set. In such a case I place a new tile there.

Therefore the player would always see the ground plane without gaps or empty spots.

I guess that would work, but I am not sure whether that would be the best approach.
Is there a better alternative, maybe even a best-practice for my case?

sentences:
Strange quaternion camera streching in WebGL So after a lot of researching about quaternions I almost got the quaternion camera working. Almost, cause it rotates in a proper way only in a vertical axis. Other rotations stretches and deforms the view (like on a picture below).

Wobbling horizontal moves makes only Z axis stretched

I don't like to post topics like "Please, debug my brain", but I'm in a dead end right now, and I don't know how to fix it.

My implementation looks like this:

I Convert an axis-angle rotation to a quaternion and normalize it.
Then multiply it with a camera identity quaternion.
And then multiply a position of a camera (which is a 4x4 model-view matrix) by a product of above multiplication converted to matrix.

My free quaternion camera class looks like this (for now):

function QuaternionCamera() {
    // Fake 4x4 Matrix
    this.position = new Matrix4x3();
    this.rotation = new Quaternion();
}

QuaternionCamera.prototype = {
    verticalRotation: function(angle) {
        this.rotation.multiply(new Quaternion().axisToQuaternion(angle, 0, 1, 0));
        this.position.multiply(this.rotation.quaternionToMatrix());
        this.rotation.makeIdentity();
    },

    horizontalRotation: function(angle) {
        this.rotation.multiply(new Quaternion().axisToQuaternion(angle, 1, 0, 0));
        this.position.multiply(this.rotation.quaternionToMatrix());
        this.rotation.makeIdentity();
    }
};

And on mouse movement, it runs this:

    camera.verticalRotation(degToRad(deltaX / 6));
    camera.horizontalRotation(degToRad(deltaY / 6));

I believe that this is a proper way to do it, so I'll just dump my math library, maybe you could find a typo in there (cause I have checked it a hunderd of times and found nothing): http://pastebin.com/0zYLaR1V

PS How to get rid off an additional little roll when rotating camera around, so it will move in a game fashion way?

PS2 And where did the imaginery numbers gone when implementing quaternion math to programming language?? ^^ This is a true mystery for me.

sentences:
Simultaneous game states I think I understand the basic idea behind a Finite State Machine-based game loop. But I'm trying to write a little game in which the same object can simultaneously be in multiple, independent states. At least that's what I want to do.

To give you an idea: Robot may be in FleeState and FireLaserState at the same time, besides in each of them individually at any time.

Would something like this be possible using the FSM pattern? Or ought I to look elsewhere?

After all, does the whole idea make sense?

Pasted from my comment below: A little clarification of why I'd like states to be kept separate:  I want the player to have the ability to program simple state changes before a game... say "if (health_is_way_too_low) flee". But then I want multiple such rules to be active simultaneously in order to keep the game interesting, and cannot know beforehand which other states may be active.

sentences:
Simplest way of skeletal animation in openGL I am not interested in using easy libraries like assimp which will import collada files with ease to get skeleton animation done.

I wanna know what is the minimal requirement to get the animation done.

What I understand is that a bone is a 3*3 rotation matrix which is associated with each group of vertex.

We have to augment it with the model matrix to animate anything

How would I play a sequential animation with my existing bone system.

What's the workflow to process the bones. Sending bones through Uniform block is slow but I would consider doing it.

What's the simplest file format to store rig and animation data. Collada is unnecessarily advanced and complex.

Or how would I write my own file format for animation.

I am using blender to model and rig.
How would I even manage to get an exporter for my format in blender

sentences:
Spritekit - gradually apply force vector in different direction (space ship turning) I have a space ship that I'm applying a force vector to using a joystick for control.  I would like this to smoothly fly around when I'm switching directions..  Exactly like minisquadron if you've ever played that..

Let's say I move the joystick to the far right and apply a force on the physics body of (1,0)  and then I abruptly switch directions without circling the joystick around and apply a force of (-1,0).  The ship will move to the right and then slowly lose speed before switching in a linear fashion.

What I want is for it to slowly transition between those two vectors so that it flies in a tight circle.

I'm trying to figure out the best way to write this.. maybe using a loop..  but I could use some help.

pseudo code:

func joystickMoved(){
    let point = pointVector;
    self.moveShip(pointVector);
}

func moveShip(pointVector: pointVector){

    // get current angle
    let curAngle = self.ship.physicsBody.velocity.toAngle()

    // get joystick angle
    let newAngle = pointVector.toAngle

    // while there is a sizeable difference in angles..
    // this loop needs to occur with some delay
    // so transition doesnt occur too quickly
    while fabsf(newAngle - curAngle) > 0.5 {

        // make tiny transitions towards newAngle.. this needs more detail
        curAngle += 1
        let newVelocity = CGPoint(cos(curAngle), sin(curAngle))
        self.ship.physicsBody.velocity = CGVector(dx: newVelocity.x, dy: newVelocity.y)

    }
}

sentences:
Entity component system: how and where store pointers to system resources or third-party lib's objects? I'm migrating my game pet-project to ECS. I use C# (custom-made engine, not Unity). It goes pretty well, but one big thing is making me worry.
This is how and where to store pointers to system resources or third party libraries' objects?
For example, I have object with Transform and RenderModel component.
Transform contains data like matrices, quaternions etc (like described in any ECS paper :)
RenderModel contains path to FBX scene and some data how to render this model (materials, overrides, flags, scaling, etc).
For model rendering I use existing rendering library. To render the model I need to create object, add it to this library, update its transform if necessary and destroy it when I don't need to draw this model any more.
The question is where to store pointer to such rendering objects?
I see three approaches:

Any component that holds such resources implements methods OnAdd and OnRemove which are called when component added or removed respectively. On addition the component create lib's object and destroys it on removal. I've focused on this approach because it's pretty straightforward and simple to implement. Main drawback of such approach that I need to implement some kind of workaround to feed transformation to this models.

Systems are stateful and keep tracking of component addition and removal. When given combination of components is added (i.e. RenderModel and Transform) system that handle object drawing creates internal representation of the model and destroys when components are removed. Main drawback that I have no idea how efficiently track multiple component addition and removal.

Some kind of "imperative" approach. For each entity with RenderModel and Transform components system calls method like DrawModel(...). At the end of the frame the internal representation is destroyed and created again on next frame. Such approach looks like most convenient approach from game logic view, but suffer from obvious performance issues, because rendering library might build internal structures, cache visibility data, use interleaved shadow maps etc. Furthermore, updating this systems in parallel threads obviously will become nightmare.

Same issues I've also encountered with physics library and FMOD sound, because such libs also offer some long-living objects (non-POD) and build internal data structures.
Could you suggest better approach to solve such issue?
P.S. I use custom (made from scratch) engine (not Unity)

sentences:
How 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:
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:
How do you make a object that always follow another object? I'm trying to make a game object follow another game object and switch to another when a button is pressed. But right now it just seems to change the position when the button is pressed but it doesn't follow the object. How can I make it follow the other object?

public Transform PosObjOne;

public Transform PosObjTwo;

public Transform PosObjThree;

void Update () {
    if (Input.GetButtonDown("UseVr"))
    {
        PosObjThree.position = PosObjTwo.position;
    }

    if (Input.GetButtonDown("NoVr"))
    {
        PosObjThree.position = (PosObjOne.position);
    }
}

sentences: Unregister touch sprite when background scene is zoom and moving I am new to game development on Android, I use AndEngine framework. I'm developing an application with isometric view, at this time I had problems with touchlistener area on the sprite in the scene background, I intend to turn off the touch function on the sprite when the background is shifted, so as not to disturb the background when being moved. How it works?

sentences:
How to write "Hello World" for N64 purely from scratch? As an experiment I want to code a "Hello World" program for N64 using only assembly code, using no headers, tools, helper files, etc.

I just want to write the assembly code bare bones from absolute scratch, assemble it and have it run through a demanding emulator that can show me the output.

I can't find enough info on how to send the correct data to the RSP for video output though. Can anyone offer me a hand here? Not on helping me program, but with information regarding N64's RSP and how to program it to display text, etc.

sentences:
(SFML) Moving in one direction a time so i've been making a pathfinder on a grid. I've succesfuly implemented the A* algorithm so the next step is making the AI follow a path. I got it to move to the desired destination but the thing is it moves diagonally and I dont want it to. I want to move vertically or horizontally. this is my current code:

void AIEnemy::AutoMotion(Gridspot& grid)

{

std::pair<int, int> ecn = getNodePosition();

sf::Time deltaTime = clock.getElapsedTime();

std::reverse(grid.Path.begin(), grid.Path.end());

for (auto path : grid.Path)

{

float rectx = rect.getPosition().x + rect.getOrigin().x / 2,

        `recty = rect.getPosition().y + rect.getOrigin().y / 2;`
bool firm= true;

if (ecn.first == path.node.first && top >= path.rectCenter.y)

{

rect.move(0, -2);

}

if (ecn.second == path.node.second && left >= path.rectCenter.x)

{

rect.move(-2 , 0);

}

}

}

before i had a bool set that will ring true it is already in motion to so that it couldn't move in the x-axis in conjunction to th y. that didn't work, i also used if and elseif is before ut that didn't do anything.
essentially I want it to move like pacman ghosts

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:
How can I highlight and move to adjacent tiles in an isometric grid? I trying to create a turn-based strategy game where you move a game object from one tile of a grid to another tile near it. I have created the grid using sprites and game objects but can't sort out the movement part.

How can I highlight adjacent tiles given the 'current' tile, and then allow a game object to move to any of those highlighted tiles?

sentences:
Is it a good idea to use per pixel collision detection in an isometric game? I've completed the per-pixel collision detection for a small side-scroller game, for learning purposes using a Lazyfoo.net tutorial, and I am wondering if it is a good method for detecting collision in an isometric game consisting of a pure 2D world.

My plan is described in this picture:

As you can see, I want to start with bounding boxes, and if I collide with it I start iterating through the tiles rectangles (19, in this case) for better precision. Is it a good way to handle collisions in this type of game? If not, what would be a suitable alternative?

sentences:
Will lots of haptic feedback kill motors? My game centers around joystick oddities, sort of, to make it more interesting.

I've got a cheap $6 joystick that is like a usb PS3 controller. Surprisingly, I find it of great quality, with excellent feedback.

I don't care about it so much, because of the price but I don't want to kill motors in a users expensive joystick.

Basically, it will be running for minutes at a time every once in a while.(Well, not constantly, but almost constantly)

Are these motors really good, and hard to wear down or will I quickly kill them?

Thanks for your time.

sentences:
game server/client user input/event handling I'm currently getting my feet wet in the realm of networking, so I set a goal to make a simple client/server game using SFML for both graphics and networking. In my head it seemed easy at first, but the more I got into it the more questions arised. I didn't want to make a post before I hadn't done any research, but now, having read many blog posts and articles, there's nothing to lose.

The game I'm working on is a trivial PONG game: server waits for 2 players, when they are connected, clients send server paddle's X position only if mouse is moved. Server reads in the X pos. and sends each client opponent's position.

The problematic part is opponent's behaviour on the client side. When playing both clients + server on my computer, using 100% CPU speed server side, the opponent moves smooth, but having CPU running as fast as it can is nonsense! If I reduce update speed the movement becomes weird so to say.

Might there be anything to do with client-side prediction (I read about it too, but didn't quite grasp how it would be implemented)?
Since there are frequent position changes, should the server's update speed be as high as possible?
I'm using TCP, which I understand is "reliable" = no lost packets. For such fast-paced game like PONG, which protocol is more suitable.

Now, I do not fully understand the magic behind it all, very very thrilled about network programming. I've never been more excited during programming as I am dealing with networking.

Thank you for your attention!

sentences:
Divide two quaternions evenly by a scalar to get a smooth rotation in-between How do you divide two quaternions - say A and B - evenly by a scalar, to calculate the rotations between them to render a smoother rotation?

Effectively, say you want to smooth the rotations between A and B
evenly by n. How do you calculate each quaternion value between A and B?

I have found that resorting to .eulerAngles leads to some wild gimbal locking, so I think the math needs to stay in quaternion space...

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: How to Detect Collision Between Entity and Viewport I am using Crafty.js. I want the player to die when they hit the side of the viewport (they need to keep moving to stay alive). How do I detect a collision between the player entity and the side/edge of the viewport? I have looked at Crafty.viewport, but have not been able to find anything useful.

sentences:
SIMD and Inverse Tangent I'm calculating spherical UV coordinates in a loop, trying to get GCC to vectorize the code.

Here's a compile-able example of what it looks like.

#include <cmath>
#include <cstddef>

/// Calculates UV coordinates from positions on a sphere.
/// The sphere has a radius of one.
//
/// @param pos_array The 3D sphere positions to get the UV coordinates of.
/// The positions are in the format: x, y, z, w (where w is unused)
//
/// @param uv_array This is where the UV coordinates go.
/// A series of 2D vectors (no padding)
void calc_uv_coordinates(const float* pos_array, float* uv_array) noexcept {

  constexpr std::size_t chunk_size = 256;

  for (std::size_t i = 0; i < chunk_size; i++) {

    const float* pos = pos_array + (i * 4);

    float* uv = uv_array + (i * 2);

    uv[0] = 0.5 + (std::atan2(pos[2], pos[0]) / (2 * M_PI));
    uv[1] = 0.5 - (std::asin(pos[1]) / M_PI);
  }
}

But the inverse trig functions are keeping it from being vectorized, as per GCC's report:

gcc -c -O3 -fopt-info-vec-missed test.cc

Prints:

test.cc:16:29: missed: couldn't vectorize loop
/usr/include/c++/9/cmath:145:28: missed: statement clobbers memory: _25 = __builtin_atan2f (_4, _3);
/usr/include/c++/9/cmath:145:28: missed: statement clobbers memory: _25 = __builtin_atan2f (_4, _3);
/usr/include/c++/9/cmath:107:27: missed: statement clobbers memory: _24 = __builtin_asinf (_9);

Which is understandable, I don't think there's any hardware implementations of those functions.

Edit: There is for Intel.

In game development, how is this kind of issue dealt with? I could think of two approaches:

Write a vectorized atan2 and asin that compute many inverse trig values at once
Write a SIMD-friendly approximation for each function

A quick google search led me here, where I found an atan approximation.

inline constexpr float fast_atan_approx2(float x) noexcept {
  return x / (1 + (0.28 * x * x));
}

inline constexpr float fast_atan_approx2(float x) noexcept {
  return (0.9724 * x) - (0.1919 * x * x * x);
}

And from the comments, another approximation.

But looking at the graphs, I don't think they're going to be suitable for texture mapping. Here's a picture, where:

blue is true arctan
orange is the first approximation
red is the second approximation

The approximations are only decent in the domain [-1, 1]. So just to restate my question, how is this dealt with? Is there a way to vectorize these trig functions? Do people generally just accept the bottleneck?

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:
How can I get started programming OpenGL on Mac OS X? I'm trying to start OpenGL programming on a Mac, which brings me into unknown territory on a lot of things.

During the day, I'm a Web Developer, working in C# and before that in PHP and Delphi, all on Windows.

During the night, I try to pick up Mac/OpenGL skills, but everything is so different. I've been trying to look for some books, but the OpenGL books are usually for iOS (tons of them out there) and the Mac Books usually cover "normal" application Development.

I want to start simple with Pong, Tetris and Wolfenstein.

I see that there are a bunch of different OpenGL Versions out there. I know about OpenGL ES 1&2, but I don't know about the "big" OpenGL Versions - which ones are commonly supported on 10.6 and 10.7 on current (2010/2011) Macs? Are there any up to date (XCode 4) books or tutorials?

I don't want to use a premade Engine like Unity yet - again, I know next to nothing about any Mac development.

sentences:
2D planetary system simulation- how to improve gravity model? How to control simulation speed? I'm making a simple planetary system simulator. I've run into some problems with physics model and simulation speed and I'd like to learn how to fix them.

My main class is Body:

public abstract class Body {

private double x, y; // position
private double w, h; // dimensions for drawing
private double vx = 0, vy = 0; //velocities along x, y axes
private double ax = 0, ay = 0; // accelerations along x, y axes
private double mass = 1;        //default = 1
private boolean stationary = false; //stationary body is centered during simulation

...
}

Then, in this class, the method I'm using to calculate the force of gravity. I decided to have another body as a parameter, so when I call the method it updates both of the bodies. If that's not the best way to do it, please tell me. I also know that using "this" inside a public method is not necessary, but it makes the code more clear for me.

public void interact(Body b2) {
    double x = calculateDistX(b2);
    double y = calculateDistY(b2);
    double r = calculateDistance(x, y);

    double f = (this.getMass() * b2.getMass()) / Math.pow(r, 2); // gravitational
                                                                    // force

    double fx = f * (x / r); // x component of the force - f times cosine of
                                // the angle
    double fy = f * (y / r); // x component of the force - f times sine of
                                // the angle

    /* calculate accelerations for both bodies, set vector orientation */
    if (b2.getX() > this.getX()) {
        this.setAx(fx / this.getMass());
        b2.setAx(-fx / b2.getMass());
    } else {
        this.setAx(-fx / this.getMass());
        b2.setAx(fx / b2.getMass());
    }

    if (b2.getY() > this.getY()) {
        this.setAy(fy / this.getMass());
        b2.setAy(-fy / b2.getMass());
    } else {
        this.setAy(-fy / this.getMass());
        b2.setAy(fy / b2.getMass());
    }

    /* calculate velocities for both bodies */
    this.setVx(this.getVx() + this.getAx());
    this.setVy(this.getVy() + this.getAy());

    b2.setVx(b2.getVx() + b2.getAx());
    b2.setVy(b2.getVy() + b2.getAy());

    /* calculate positions for both bodies */
    this.setX(this.getX() + this.getVx());
    this.setY(this.getY() + this.getVy());

    b2.setX(b2.getX() + b2.getVx());
    b2.setY(b2.getY() + b2.getVy());
}

Now, when I run the simulation it tends to blow up when bodies get too close. I will try to implement the Runge-Kutta or Verlet algorithm in the interact() method to change this, but how do I implement timestep? Should there be some timer that counts time and is used to calculate derivatives? Right now I'm using a Timer in my drawing method:

class DrawingPanel extends JPanel {
DrawingPanel() {
    int step = 15; // milliseconds
    ActionListener taskPerformer = new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            repaint();
            }
    };
    new Timer(step, taskPerformer).start();
    Body b0 = new Star();
    addBody(b0);
    Body b1 = new Planet();
    addBody(b1);
    Body b2 = new Planet();
    addBody(b2);
}

List<Body> bodies = new ArrayList<>();

@Override
protected void paintComponent(Graphics g) {
    super.paintComponent(g);

    bodies.get(2).interact(bodies.get(1));
    bodies.get(0).interact(bodies.get(1));
    bodies.get(0).interact(bodies.get(2));

    for (Body b : bodies) {
        f.draw(b);
    }
}
public void addBody(Body b) {
    bodies.add(b);
}
}

I feel like calling the interact() method in my paintComponent() method is not the right solution, but I don't know how to do it. Also, how to make the simulation slower? Right now changing the "step" to bigger value slows the simulation down, but it ends up being just low FPS, because it's just the separation between two drawing events. How should I implement the timer to control the simulation and preserve its smoothness?

sentences:
How can I manually call/fire OnTriggerExit() for colliders a trigger is inside of in Unity? In Unity, the OnTriggerExit() method is not called/fired (not sure if it's an event or not) when an object is disabled or destroyed within it's collider. In comparison to it being fired is an active object that was within it's collider no longer being inside the bounds of that collider on the next frame. I want to be able to call OnTriggerExit() on my triggers OnDisable() method as a workaround.

How would I go about calling/firing OnTriggerExit() manually?

sentences:
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:
Libgdx Resizing Textures for Different Platforms I'm using viewports to handle different screen resolutions to support multiple platforms (desktop, android, etc.) in my libgdx powered game. I made all image assets for Full HD resolution and thought it will be easy to scale down them for lower screen resolutions. The thing is when I resize them (scale up or down) they are pixelated very badly. I tried to use TextureFilter.Linear and TextureFilter.MipMapLinearLinear (enabled mipmaps). The result is still not satisfying. Then I came across this post made by an administrator on libgdx forums:

http://badlogicgames.com/forum/viewtopic.php?p=107267#p107267

He says it scales the texture 60 times a second.

1-) Does it really gets scaled 60 times a second? If so why isn't it scaled only one time at program start? How can i do this?

2-) Since all games which support multiple platforms somehow need to achieve the rescaling, what is the best way to do it? My image editor program can resize it without pixelating so I think there should be a way.

sentences:
How would I go about updating my electronic circuit simulator's 'electricity'? I have made an application which allows the user to place down wires, power sources, and inverters on a virtual circuit board. All connections between tiles are automatic, as shown here:

As you can see in the last image, the updating of power throughout this grid is not yet functioning. I think I understand how to do this updating conceptually, but getting it to work in my program is appearing to be much more difficult than I first imagined. My source code can be found here.

Getting tiles to pass on power to their neighbors is quite easy, but the tricky part is getting wires to "unpower" after the removal of a power source. The size of the grid is just 18x18, so efficiency really isn't a factor, for those wondering.

If you have any tips as to how to I might approach this task, please let me know.

sentences: 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:
Why does SDL2 blur pixel art even with SDL_HINT_RENDER_SCALE_QUALITY set to 0? I am working on a game with SDL2 and having trouble turning off linear filtering when upscaling textures.

My game has a bunch of 32x32 tiles. I used SDL_RenderSetLogicalSize so that there is a one-to-one pixel mapping (i.e. my logical size is n * 32 x m * 32.)

However, when the the whole scene is upscaled to fit the actual screen, it seems to be interpolated (blurry).

I saw these two other posts (1, 2) which recommended using SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0");. I did that, but nothing seems to change at all. It returns true and it is in fact changing the hint, but the rendering just doesn't change at all. I even tried setting it with priority but nothing changes.

Any idea how to fix this? I am on Windows if that's relavent.

sentences:
A* in 2D grid with obstacles in between graph nodes I am using standard A* (and Jump Point Search) for pathfinding in my 2D game. A map in this game is a simple 2D grid (tile-based). A node (i.e. grid cell) in my map graph can either be blocked or walkable. That works fine so far.

Now I got a new requirement: There can be obstacles in between cells as well, i.e. walls. I thought the easiest way to implement this is to make the cell "behind" a wall an obstacle while searching for a path. However, that does not really work, because if I search for a path from the other side of the wall, then "behind" is also on the other side...

So my question: Is there any "best practice" to implement this, or, if not, what are your ideas?

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

sentences:
OpenGL : Keeping alpha in a render buffer In my current task, i need to render a texture into a render buffer, in order to work on it (apply special filters) there. The result is then considered a "new texture", which is later displayed.

This works fine, except when the texture contains some transparent/semi-transparent parts.

My current guess it that, within the render buffer, the texture is "merged" with a kind of "grey background". In this case, it obviously impacts the R,G,B color components of transparent pixels.
I've yet to find a way around this.

Even manually assigning alpha after the rendering process doesn't save the day for semi-transparent pixels, which RGB are "tainted" by the grey background.

sentences:
Android appstore developer account, to not charge then change The idea of charging for my early releases doesn't sit well with me, but at some stage, I will want to devote more time to games dev activities, when I will need it to be rewarding.

On the Play Store site a lot of options become locked once the app is published. Can this be revised at a later date? Thanks, I'd rather not worry about money already.

sentences:
Building a chunk w/ blocks: making ramps. How to detect if blocks are making "stairs" (like in a mountain) and should be turned into ramps? My question is quite simple, but the answer may be not.

I am studying and making a voxel engine, generating block vertices around its center position with TriangleList primitive at C#/XNA.

The problem is that I don't want that my game make those ugly "stairs" of cubes in mountains or hills. I want that the cube turns into a ramp when needed (when it has no connection with blocks at some sides, for example: no connection at top and east, then it turns into a ramp from west top to east bottom).

Another example that already exists may be found at SimCity 2000 maps. Edges become ramps, in many types, depending of how the squares of the terrain grid are modeled. Even corners between two directions of ramps become a new type of ramp, with two triangles.

I don't know how to detect that in a easy way, like, do I have to test each side and then check between the sides detected for selecting the type of ramp to create?... Or what should I test first, and then select the way of placing the vertices?

Thanks for any answer. And sorry for my English, if something is wrong.

sentences:
Ray tracing - glossy reflection Here I am again with my ray tracer for ipad. Now I'm trying to add glossy reflection to an object. How do i implement it?
I read some documentation online like these:

http://www.cs.cmu.edu/afs/cs/academic/class/15462-s09/www/lec/13/lec13.pdf
http://www.cs.cornell.edu/courses/cs4620/2012fa/lectures/37raytracing.pdf

If I understood correctly instead of trace a single ray as for standard reflection I have to trace n ray in a random direction. How do I get this random direction for each ray? How do i generate these samples?

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:
When should I make different LODs? This is something I have been discussing with my team as to how we should approach it on our project.

The question is, what is better practice, make your model already with different Levels of detail, importing everything in one go, or importing the base model on the game and only then making LODs for it later?

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

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

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

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

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

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

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

sentences:
Why is GameObject.FindGameObjectsWithTag returning null? I'm currently working on refactoring my gravity simulator, but I'm running into a problem. I have two GameObjects, both tagged with the tag "Body", as you can see below:

I'm attempting to cache a list of all GameObjects like so:

private GameObject[] _bodies;

...

public void Start()
{
    ...
    this._bodies = GameObject.FindGameObjectsWithTag("Body");
    ...
}

When I try to use the value this._bodies though, as seen in the foreach loop below, I get a NullReferenceException.

foreach(GameObject body in this._bodies)
{
    ...
}

I have verified that the value of this._bodies is null, using this piece of code:

Debug.Log(this._bodies);

I'm honestly stumped as to why GameObject.FindGameObjectsWithTag is returning null when I run it. Is there a way to solve this?

For reference, here's the full code involved:

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

[RequireComponent(typeof(Rigidbody))]
public class GravityComponent : MonoBehaviour
{
    public double gravitationalConstant = 6.674 * Mathf.Pow(10, -11);
    public Vector3 startingForce;

    private GameObject[] _bodies;
    private Dictionary<GameObject, double> _massProducts;
    private Rigidbody _bodyRigidbody;

    /// <summary>
    /// Initalize various private values and caches, like the
    /// cache of bodies, masses, etc.
    /// </summary>
    public void Start()
    {
        this._bodyRigidbody.AddForce(this.startingForce);
        this._bodyRigidbody = GetComponent<Rigidbody>();
        this._bodies = GameObject.FindGameObjectsWithTag("Body");
        this._massProducts = this._bodies.ToDictionary(
            body => body,
            body =>
                  this.gravitationalConstant
                * this._bodyRigidbody.mass
                * body.GetComponent<Rigidbody>().mass
        );
    }

    /// <summary>
    /// Calculate the attractions between two separate bodies, and
    /// then apply the calculated attraction.
    /// </summary>
    public void ApplyAttraction()
    {
        foreach(GameObject body in this._bodies)
        {
            Vector3 bodyPositionDifference = body.transform.position - this.transform.position;
            double attraction = this._massProducts[body] / bodyPositionDifference.sqrMagnitude;
            this._bodyRigidbody.AddForce(bodyPositionDifference * (float)attraction);
        }
    }

    public void FixedUpdate()
    {
        Debug.Log(this._bodies);
        this.ApplyAttraction();
    }
}

sentences:
Using a vector to measure an angle relative to the screen / camera My game is supposed to have an object that changes it sprite depending on which way the mouse faces. programming this has become a challenge, because I want to calculate the angle relative to the center of the screen using the X axis.

To explain what I mean, pretend that under a sprite in the center of a screen is a protractor.

I want to measure the angle that's formed between the cursor and the center. If I use the X axis as a base, I should get an angle between 180° and -180°.

How would I achieve this? I've tried vector.angle(reference-vector), but that doesn't seem to give the desired result.

sentences:
handling buffers in OpenGL I'm reading through the OpenGL documentation for version 3.3 core. I'm having issues understanding proper buffer deletion.

At the moment I have an object that loads itself into OpenGL memory in the constructor and only exposes a VAO with the attribute pointers and a bound element array ready for rendering. When it stops existing it deletes all the buffers and sets pointers to NULL.

How do I properly delete OpenGL data? I'm going to assume that the object doesn't stop existing while it's being rendered. Do I have to do something more than just delete the VAO and then delete the buffer objects? Does that leave anything out? Should I bind the VAO disable the attributes, unbind it and then delete it?

sentences:
Discussion about Serious Games : Their lacks and forces I would like to start a little discussion about serious video games. Do you think serious games DO have their place in today's world ? What kind of serious games do you think the most interesting in term of education / work tools ?

I've recently read an article about the educational power of such games in early ages. Do you think serious video games could become a ubiquitous learning tool in primary school ?

Any experience, title share or ideas are heightly appreciated, I want to get a feel of this question from experienced game developper that are interested of writing an answer !

sentences:
Creating a Nations Stockpile If I created different XML files for each Nations' Stockpiles and made an XMLmanager to do updates such as resource consumption and trade, wouldn't that be too much resource intensive? I mean, if I had to access each Nations' stockpiles every tick and update them (Quantity, Price, Quality).

Is there any other faster way to manage all those updates?

From the back and forth in the comments, I've came up with this approach.

public class Nation
{
    public string NationName;
    public int Population;

    public void NationCreator(string name, int pop)
    {
        NationName = name;
        Population = pop;
    }

    public class Stockpile
    {
        public int food;
        public int water;
        public int wood;

        //Then methods to work with that stockpile
    }
}

However, after some thinking and reading, my next approach to this problem will be Arrays but I only know how to make an array of one particular type like:

double[] balance = { 2340.0, 4523.69, 3421.0};

How could I do an array like this (Lua style array) in C# language?:

raw_material = {
    cotton = {
        Value = 17.50
    }
}

sentences:
Texture doesn't scale and repeat I wrote the script for automatic repetition of texture background. To save it I typed Cmd+S. I dragged and dropped the script to Background in Hierarchy. When hit play button the texture doesn't scale and doesn't repeat itself. What is it that I am doing wrong?

using System.Collections;

public class TiledBackground : MonoBehaviour {

    public int textureSize = 32;

    void start(){
        var newWidth = Mathf.Ceil (Screen.width / (textureSize * PixelPerfectCamera.scale));
        var newHeight = Mathf.Ceil (Screen.height / (textureSize * PixelPerfectCamera.scale));

        transform.localScale = new Vector3(newWidth * textureSize, newHeight * textureSize, 1);

        GetComponent<Renderer>().material.mainTextureScale = new Vector3(newWidth, newHeight, 1);
    }
}

Expected Results:

Results that I'm getting are same as before. Script doesn't seem to work:

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:
How can I animate a recursive algorithm? Say I have a recursive algorithm, for example one that generates a random tree:

// Pseudocode, just a simple algorithm: it isn't perfect.
function generate_branch(angle, length, current_depth, max_depth) {
  var branch = Branch(angle, length); // creates a new branch
  if (current_depth == max_depth) {
    return branch;
  }
  current_depth++;
  // random_int(min, max)
  branch.subbranches[] = generate_branch(random_int(0, angle + random_int(-30, 30)),
                                         random_int(0, 20)
                                         current_depth,
                                         max_depth);
  // ^^^^ recursion
  return branch;
}

var trunk = generate_branch(0, random_int(10), 0, 5);
RenderTree(trunk);

The problem is that this will render the entire tree in one frame. If I want to animate this (i.e. grow the tree over time), how would I do that? What is the best way to do this?

The game uses a game loop.

sentences:
Picking up items and references Just a heads up, I'm sure there are much more efficient ways to do what I'm trying to do. I've even thought of some myself. However, at the moment, I'm mostly interested in getting this code to work. I think I understand exactly why it doesn't work, but I'm not sure how to fix it.

Firstly, there is an ItemPickupTrigger script attached to the drop prefab. The purpose of this script is simply to modify a variable's truth value depending on whether or not the player is in range. This script must be attached to the drop prefab because it uses OnTriggerEnter/OnTriggerExit. No problem here.

Secondly, there is a pretty standard EnemyDrops script.

public class EnemyDrops : MonoBehaviour {

    private EnemyHealth enemyHealth;

    public GameObject dropPrefab;

    private float randomNumber;

    public bool objectDropped;
    private bool numberGenerated;

    public GameObject drop;

    // This is the correct offset for enemies' current y-position of 1.083333
    private Vector3 dropPositionOffset = new Vector3(0f, -0.958333f, 0f);

    void Start()
    {
        enemyHealth = GetComponent<EnemyHealth>();
    }

    void Update()
    {
        if (enemyHealth.isDead && !objectDropped && !numberGenerated) {

            randomNumber = Random.value;
            numberGenerated = true;

            if (randomNumber <= 1.0)
            {
                DropObject();
            }
        }
    }

    private void DropObject()
    {
        objectDropped = true;

        drop = GameObject.Instantiate(dropPrefab, transform.position + dropPositionOffset, Quaternion.identity);
    }
}

It drops the object where the enemy has been killed. This script is attached to each enemy. As it's currently set up for testing purposes, an item will always drop. I'm sure there are better ways to do this, but it works, so no problem here.

Finally, there is an ItemPickup script attached to an ItemController object which is otherwise pretty empty. I'm not even really sure why I decided to do it this way, I just thought that it might be better for things I wanted to do in the foreseeable future to not have this script attached to each enemy. Now get ready because the code below is problematic.

public class ItemPickup : MonoBehaviour {

    private GameObject pickupWindow;

    private bool windowOpen;

    private GameObject drop;
    private ItemPickupTrigger itemPickupTrigger;

    void Start()
    {
        pickupWindow = GameObject.Find("Pickup Window");
        pickupWindow.SetActive(false);

        drop = GameObject.Find("Drop");
        itemPickupTrigger = drop.GetComponent<ItemPickupTrigger>();
    }

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.R) && itemPickupTrigger.playerInRange && !windowOpen) {
            pickupWindow.SetActive(true);

            windowOpen = true;
        }
        else if (Input.GetKeyDown(KeyCode.R) && windowOpen)
        {
            pickupWindow.SetActive(false);

            windowOpen = false;
        }
    }
}

For starters, it only works if there is a drop object already present when the script begins, but there shouldn't be a drop object then. Second, if I don't set the reference there, I'm not sure how to set itemPickupTrigger's reference, since I'm using it in update and need the reference set before then. Make a function called SetReferences() and call it early in Update()? Yeah, I'm pretty lost. Basically, I want to be able to open the "loot window" near any instantiated drop object in the game. Currently, that functionality only in a limited capacity (either only on a "preexisting" drop object in the scene or on one random instantiated drop object(?) depending on how I have been modifying the code). Help!

sentences:
How to enable geometry shader in OpenGL 4.2? I'm porting my Direct3D-based engine to OpenGL and I'm using geometry shaders for rendering text characters (basically, textured billboards).

D3D version works fine, but in OpenGL mode it gives only a flickering point right in the center of the screen.

It seems that somehow the geometry shader stage is not enabled (in AMD GPUPerfStudio the box, representing GS stage, is grayed-out).

I tripple-checked the OpenGL back-end and the shader code but couldn't find any mistakes.
Maybe, I'm missing something.

Below is the source code of the relevant shaders:

Vertex shader:

in vec4 in_xy_wh;
in vec4 in_tl_br;   // UVs for top left and bottom right corners
out vec4 v_xy_wh;
out vec4 v_tl_br;
void main()
{
    v_xy_wh = in_xy_wh;
    v_tl_br = in_tl_br;
}

Geometry shader:

layout(points) in;
layout(triangle_strip, max_vertices=4) out;

in vec4 v_xy_wh[];
in vec4 v_tl_br[];  // UVs for top left and bottom right corners

out vec2 v_uv;

void main()
{
    vec2    pos = v_xy_wh[0].xy;
    float   width = v_xy_wh[0].z;
    float   height = v_xy_wh[0].w;

    vec2    tl = v_tl_br[0].xy;
    vec2    br = v_tl_br[0].zw;

    gl_Position = vec4( pos.x, pos.y, 0.0f, 1.0f );
    v_uv = vec2( tl.x, tl.y );
    EmitVertex();

    gl_Position = vec4( pos.x + width, pos.y, 0.0f, 1.0f );
    v_uv = vec2( br.x, tl.y );
    EmitVertex();

    gl_Position = vec4( pos.x, pos.y - height, 0.0f, 1.0f );
    v_uv = vec2( tl.x, br.y );
    EmitVertex();

    gl_Position = vec4( pos.x + width, pos.y - height, 0.0f, 1.0f );
    v_uv = vec2( br.x, br.y );
    EmitVertex();

    EndPrimitive();
}

Fragment shader:

in vec2 v_uv;
out vec4 v_color;

uniform sampler2D   s_font;

void main()
{
    vec4 color = texture( s_font, v_uv ).rgba;
    if( color.w < 1.0/255.0 ) {
        discard;
    }
    v_color = color;
}

I've added the "#version 420 core" preamble to each shader.
I know I shouldn't use the glProgramParameteriEXT function to define GL_GEOMETRY_INPUT_TYPE_EXT, GL_GEOMETRY_OUTPUT_TYPE_EXT, GL_GEOMETRY_VERTICES_OUT_EXT,
because these parameters are specified in the geometry shader (which is core in OpenGL 4.2).

EDIT:
My mistake was incorrect usage of glVertexAttribPointer (wrong value of the the last parameter).
Thanks for all the answers and sorry for your wasted time!

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:
Is there a way to make money from indie downloadable games? It appears that there are ways to make money with flash games through portal and aggregator sites and embedded ads.

But I do my programming in C and C++.  I've started a prototype which relies on a few existing C++ SDK's.  The game would have to be downloadable.   Is this just a labor of love, or are there any ways to make money from this type of game?  Does anyone pay for shareware anymore?  What other options are there?

sentences:
Adding character stats/traits in Ren'py I'm coding a relatively simple VN with RPG elements in Ren'py, with little prior programming knowledge. There's one aspect that I can't simplify further because it's important to the game's branches, but that I'm not sure how to enact.

There are four traits/stats the main character can have in this game:

Viciousness
Intelligence
Creativity
Charisma

You have two of the four. They don't have levels or anything -- it's simply 'do you have this trait or not'. You can't change traits after picking the two of them, you just have e.g. a Creativity/Viciousness build for the rest of that playthrough.

With my limited prior knowledge, the only way I can figure out how to enact this is with a giant mess of if-else statements. You would, for instance, start with:

default Intelligence = False

Then if you pick Intelligence as one of your stats:

$ Intelligence = True

Then, for anything further that requires Intelligence (or precludes it, as the case may be):

if Intelligence = True

But this sounds like a giant overcomplicated mess if I'm doing it for each and every time the game checks if you have/don't have a trait. There's a better way. What is it?

sentences:
Vertical camera rotation has reduced speed & range when looking at the character from the left or right I completed a camera tutorial for Unity. I can rotate a camera around my figure around the Y axis (Vector3.up) and I wanted to extend that for a Fixed-Free 3rd Person camera (What are the types of 3rd-person camera called?) where I can tilt aswell but I am stuck with the wrong rotation.

I expect the camera to go up/down whenever I use the joystick up/down and always go left/right when I use the joystick left/right.

But instead of that I get always left/right movement as I wish but up/down is only working at the center. The further I go left or right (see images) the less I go up/down. This sounds super complicated, please see the images. I want the same behaviour as shown when the camera is behind the object and I want to avoid the behaviour at the right side like in the first image.

Bonus would be if I can limit the up and down movement to say 160° so the player can't look top down.

The Code looks like this (only RotateCamera() and UpdateCameraPosition() are relevant):

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

public class PlayerCamera : MonoBehaviour
{
    [System.Serializable]
    public class InputSettings : System.Object
    {
        public float inputThreshold = 0.1f;
        public string VERTICAL_AXIS = "CameraVertical";
        public string HORIZONTAL_AXIS = "CameraHorizontal";
        public string LOCK_TARGET_PYRAMID = "LockToPyramid";
        public string LOCK_TARGET_AREA = "LockToArea";
    }

    [SerializeField] private Transform target;
    [SerializeField] private float cameraSpeed = 2;
    [SerializeField] private Vector3 lookAtPlayerOffset = new Vector3(0f, 0.6f);

    private PlayerController playerController;
    private float cameraHorizontal, cameraVertical;
    private float lockPyramid, lockArea;
    private InputSettings inputSettings;
    private Vector3 cameraPlayerOffset;

    void Start()
    {
        SetCameraTarget(target);

        inputSettings = new InputSettings();
        cameraPlayerOffset = transform.position - playerController.transform.position;
    }

    private void Update()
    {
        GetInput();
    }

    private void LateUpdate()
    {
        RotateCamera();
        UpdateCameraPosition();
    }

    private void RotateCamera()
    {
        Quaternion cameraRotationXDelta = Quaternion.AngleAxis(cameraHorizontal * cameraSpeed, Vector3.up);
        Quaternion cameraRotationYDelta = Quaternion.AngleAxis(cameraVertical * cameraSpeed, Vector3.right);

        // this does not work how I wish it would after rotating around a bit
        cameraPlayerOffset = cameraRotationYDelta * cameraRotationXDelta * cameraPlayerOffset;

    }

    private void UpdateCameraPosition()
    {
        // prevent camera from clipping through floor
        Vector3 newPos = playerController.transform.position + cameraPlayerOffset;
        newPos.y = newPos.y < 0.2f ? newPos.y = 0.2f : newPos.y;
        transform.position = newPos;
        transform.LookAt(target.transform.position + lookAtPlayerOffset);
    }

    private void GetInput()
    {
        cameraHorizontal = Input.GetAxis(inputSettings.HORIZONTAL_AXIS); // interpolated
        cameraVertical = Input.GetAxis(inputSettings.VERTICAL_AXIS); // interpolated

        lockPyramid = Input.GetAxis(inputSettings.LOCK_TARGET_PYRAMID); // interpolated
        lockArea = Input.GetAxis(inputSettings.LOCK_TARGET_AREA); // interpolated
    }

    private void SetCameraTarget(Transform targetTransform)
    {
        target = targetTransform;

        if (target != null)
        {
            if (target.GetComponent<PlayerController>())
            {
                playerController = target.GetComponent<PlayerController>();
            }
            else
            {
                Debug.LogError("The camera's target needs a player character controller.");
            }
        }
        else
        {
            Debug.LogError("Your camera needs a target");
        }
    }
}

sentences:
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:
Unity Shader Graph, set blackboard properties from code I have a Shader Graph shader with a blackboard property that I want to change from within my code. The property is called Highlight here are the things I have tried:

Color myColor = new Color(1f,0,0,1f);
material.Color = myColor;                       // throws error (as I expected)
material.SetVector("Highlight", myColor);       // Name in blackboard window
material.SetVector("HighlightColour", myColor); // Name in material property
material.SetVector("Color_8C3A526", myColor);   // Name in the shader inspector

None of these work.

Here's the shader set up:

sentences:
Easy way to project point onto triangle (or plane) I have a mesh of triangles (navigation mesh), and a point in 3d space. This point should be "over" one of the triangles all the times. I'm trying to determine which triangle is the one the point is "over", but I can't quite figure it out.

I have found a way to tell if the point is in the triangle using one of the techniques described here, but I can't quite figure out how to project the point on the triangle (or the plane the triangle is in, for that matter). I've been looking online but I can't find anything helpful.

Does anyone know how to project a point onto a triangle (or plane)?

Also, if someone knows of a better way to test which triangle is the one the point is over, it would be appreciated.

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:
'perfect' platformer base Xna When a player touches a ground peice in a game, he seems to sink through the ground then slowly rise back up, and when he has risen back up, he is very jittery.

 if (touchingTheGround())
 {
     player.velocity.Y -= 2;
     touchground = false;
 }

the collision method sets the variable touchground to true if the player touches a ground peice, and if i dont set it to false, the collision detection wont work at all. i set the players velocity to move 2 up because when he's not touching a platform, his velocity.Y += 1. How do i achieve a way so that the player

Does not sink in the ground before moving up
Stops jittering when its position is higher than the ground its touching

sentences:
Disable autorotation if Android has it disabled I'm making a game for Android in Unity. I wanted the game to handle screen rotations, so I set "Default Orientation" to "Auto Rotation. This works well, except for one issue:

If you disable auto-rotation in the device's settings, the game ignores this and keeps autorotation.

How would I go about making it disable autorotate when the Android device is set to disable autorotate?

sentences:
Using 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:
Press and hold camera movement with mouse in new Input System? I am transitioning to the new movement system and am having trouble figuring out how to move the camera when a mouse button is pressed and held.
Here's how I did it before:
private void Update()
{
    // Get the position of the mouse when a middle click occurs
    if (Input.GetMouseButtonDown(2))
    {
        _dragOrigin = cam.ScreenToWorldPoint(Input.mousePosition);
    }

    // If the MMB is still held down, calculate the distance and move the camera
    if (Input.GetMouseButton(2))
    {
        Vector3 difference = _dragOrigin - cam.ScreenToWorldPoint(Input.mousePosition);
        cam.transform.position += difference;
    }
}

I have tried doing something similar in the new input system but it doesn't work:
public void OnMMB(InputAction.CallbackContext context)
{
    if (context.phase != InputActionPhase.Started)
    {
        // Get the position of the mouse when a middle click occurs
        dragOrigin = cam.ScreenToWorldPoint(Mouse.current.position.ReadValue());
    }
    else
    {
        // If the MMB is still held down, calculate the distance and move the camera
        Vector2 newPosition = cam.ScreenToWorldPoint(Mouse.current.position.ReadValue());
        Vector3 difference = dragOrigin - newPosition;
        cam.transform.position += difference;
    }
}

Here is how I set this up inside the Input editor:

The Action Type of the action is Button.

sentences:
how to modify shadow mapping in "3D Graphics with XNA Game Studio 4.0"? So I've been following the tutorials from the book Sean James's "3D Graphics with XNA Game Studio 4.0", and have been doing fine until i reached the shadow mapping part.
in this book it creates point lights with a Sphere model.
my first Q is how to draw a directional Light with this frame work?
secondly it can do shadow mapping just for one light,
how can i do shadow mapping for all or parts of the lights in the game?
i just want to know how to modify this codes to do the above tasks.
I've followed tutorials on MSDN and some other sites and didn't got the answer.
please help me, its so urgent.

sentences:
Collision detection doesn't work for automated elements in XNA 4.0 I have a really weird problem. I made a 3D simulator of an "assembly line" as a part of a college project. Among other things it needs to be able to detect when a box object passes in front of sensor. I tried to solve this by making a model of a laser and checking if the box collides with it. I had some problems with BoundingSpheres of models meshes so I simply create a BoundingSphere and place it in the same place as the model. I organized them into a list of BoundingSpheres called "spheres" and for each model I create one BoundingSphere. All models except the box are static, so the box object has its own BoundingSphere (not a member of the "spheres" list). I also implemented a picking algorithm that I use to start the movement. This is the code that checks for collision:

if (spheres.Count != 0)
        {

            for (int i = 1; i < spheres.Count; i++)
            {
                if (spheres[i].Intersects(PickingRay) != null && Microsoft.Xna.Framework.Input.ButtonState.Pressed == Mouse.GetState().LeftButton)
                {
                    start = true;
                    break;
                }
                if (BoxSphere.Intersects(spheres[i]) && start)
                {
                    MoveBox(0, false);//The MoveBox function receives the direction (0) and a bool value that dictates whether the box should move or not (false means stop)
                    start = false;
                    break;
                }
                if (start /*&& Microsoft.Xna.Framework.Input.ButtonState.Pressed == Mouse.GetState().LeftButton*/ && !BoxSphere.Intersects(spheres[i]))
                {
                    MoveBox(0, true);
                    break;
                }

            }

The problem is this:
When I use the mouse to move the box (the commented part in the third if condition) the collision works fine (I have another part of code that I removed to simplify my question - it calculates the "address" of the box, and by that number I know that the collision is correct). But when I comment it (like in this example) the box just passes trough the lasers and does not detect the collision (the idea is that the box stops at each laser and the user passes it forth by clicking on the appropriate "switch"). Can you see the problem? Please help, and if you need more informations I will try to give them.
Thanks

sentences:
How can I extract a list of Minecraft items and recipes? I'm designing a robust system for resolving item dependencies in Minecraft and to do so, I need to maintain a database of items and recipes.  Right now, this database has to be hand-crafted (no pun intended); I would like to know if it is possible to somehow query the Minecraft jars (or perhaps more realistically, grep through them) to extract this data automatically.

How can this be done?  The project is currently in Python, but it can still be ported to Java without much fuss at this stage.  (For the curious.)

sentences:
How to change colors where two boxcollider2d objects intersect (Unity 5 2D) I'm creating a 2D game in Unity that relies on combining colors.  For instance, if the yellow sprite in in a position, and the player slides a magenta sprite partly over it, the area where the two intersect should become red.  If someone then slides a cyan sprite, the cyan+yellow should be green, the cyan+magenta should be blue, and the cyan+red should be black.

I was planning to use box collider 2d and use a OverlapArea on TriggerStay2D, but that didn't work.  I'm assuming in my code below that pointA is the upper left coordinate of the first sprite, and pointB is the upper left coordinate of the second sprite (though perhaps I'm wrong on that).

void OnTriggerStay2D(Collider2D collisionInfo)
{
    Debug.Log("I am still colliding");

    Vector2 pointA;
    Vector2 pointB;

    pointA = this.transform.position;
    pointB = collisionInfo.transform.position;

    Vector2 pointC = Physics2D.OverlapArea(pointA, pointB);

}

After reading the documentation, I think I'm not understanding what OverlapArea returns - it seems to return a Collision, but that doesn't make a whole lot of sense.

Any thoughts on this?  Is there a better way than trying to find a pair of 2-Tuples that would bound the collision area and create a new sprite of the new color over that area?

sentences:
Cant get a Farseer Physics body’s rotation to follow the mouse Here is what’s in my HandleKeyboard() method that is called from the Game1 Update method.

        MouseState mState = Mouse.GetState();
        // the Vector2 that will hold the angle from the player to the mouse pointer.
        Vector2 mDirection = new Vector2(0, 0);

            // Get the current mouse position from the state update in the beginning of this method.
            Vector2 mPosition = new Vector2(mState.X, mState.Y);
            // Subtract the potsition of the player fromthe mouse pointer to get the exact angle in a vector2
            mDirection = mPosition - arrow.Position;

            // Control Rotation
            arrow.FixedRotation = true;
            // display the arrow in the rotation gathered above.
            arrow.Rotation = (float)Math.Atan2(mDirection.Y, mDirection.X);

From what I have read, this seems like the exact right thing to have the arrow look at my pointer. However when I rotate the mouse around the pointer it really doesn’t work properly.

It's hard to explain so here is a youtube video displaying what’s happening

I really hope you can tell me what’s going wrong.

sentences:
Best practice for toggling between ragdoll and CharacterController One feature of the game I'm working on is that if a character is hit with a certain amount of force, it will temporarily ragdoll, then get up off the ground after a small period of time. This character is moved by a CharacterController (CC) component. At the moment, I have the model as a child of an object with a CC component and movement script. My issue is that when the ragdoll is activated/animator is disabled, the model moves independently of the CC - if it ragdolls with some arbitrary force in any direction, the CC does not move with it (as you'd expect). This would be fine if the ragdoll wasn't meant to be re-enabled, but it is. At this stage, the model teleports/moves to where the CC is, and it looks very weird.
I have tried a few different methods to synchronize the two:

Decoupling the CC and model. Both objects are children of a shared parent, and I added them both to an PhysicsIgnoreLayer (for now - eventually if I go with this I'll probably add all the ragdoll colliders to an array and ignore them individually). When the ragdoll state is enabled in the parent, the CC is disabled and the object is teleported to the root bone every frame. When the CC is enabled, the model is teleported to the CC object every frame. See here. The issue here is that setting the position means extra Update() calls and it lags behind the controller a little. Also, because the model isn't a child of the controller, it doesn't inherit the velocity of the controller, so it needs to be manually applied.
Changing the parented GameObject at runtime. Depending on the state of the character, the CC/model will be parented to each other - if the CC is active, the model is set as its child and vice versa using SetParent. I couldn't get this one working (the local position variable was a little confusing to me, but no configuration I tried worked for me).
Conjoined CC and model. I placed the CC on the same object as the model. This isn't really ideal for me because I want greater control over the rotation and presentation of the model. I couldn't get this one working either - I don't know how I could set the position of the CC without moving the whole thing.

Is there a more effective way of doing this? If so, what? I feel like I am greatly overcomplicating this. Any help would be great. In an ideal situation, I could have the model as a child of the controller (or behave that way) and move the CC when it is inactive without affecting the model position.

sentences:
LibgGDX drawing two separate Textures in FrameBuffer So I am trying to combine multiple TextureRegions in to one by using a FrameBuffer. This works extremely well when the TextureRegions originate from the same Texture object/file but as soon as I try to combine TextureRegions with different textures of origin, only the TextureRegions from one texture file are drawn. The TextureRegions with different textures of origin do not get drawn.

For example I have two textures:

Texture tex1 = new Texture(path to texture 1);
Texture tex2 = new Texture(path to texture 2);

TextureRegion reg1a = new TextureRegion(region from tex1);
TextureRegion reg2a = new TextureRegion(region from tex2);

TextureRegion reg1b = new TextureRegion(another region from tex1);

I set up my FrameBuffer like this:

buffer = new FrameBuffer(Pixmap.Format.RGBA8888, WIDTH, HEIGHT, true);

In my draw method I do the following:

buffer.begin();
batch.draw(reg1a, x, y);
batch.draw(reg2a, x, y);
buffer.end();

batch.draw(buffer.getColorBufferTexture());

Using the above draw method, ONLY reg2 is drawn. reg1 does not show up at all.

buffer.begin();
batch.draw(reg1a, x, y);
buffer.end();

batch.draw(buffer.getColorBufferTexture());

Using this draw method reg1 IS drawn, so there is nothing wrong with the textures.

buffer.begin();
batch.draw(reg1a, x, y);
batch.draw(reg1b, x, y);
buffer.end();

batch.draw(buffer.getColorBufferTexture());

This draw method renders BOTH reg1a and reg1b because they both come from the same Texture object/file.

What I want to be able to do is draw to TextureRegions from different Texture objects in the same FrameBuffer and have them both show up.

I have tried having everything from one Texture in one FrameBuffer, and the other in another FrameBuffer, then drawing those two FrameBuffers into a new FrameBuffer, but that produces the same problem.

Any help would be greatly appreciated!

sentences:
Texture not visible on particles This is the first time I am working with particles (GL_POINTS) I am using kinematic equations and controlling their movement in vertex shader.

I am following an example given in OpenGL 4.0 Cookbook by David Wolff.

I am not able to see the texture which I am loading in the particle.
However, I can see the texture if I put it to some other object, say quad.

I have increased the size of POINT using glPointSize just so I can see if the texture is really visible.

In the image above you can that I am loading and rendering the same texture for quad, but when I use the same texture for particles, I get different results.
PS: The color which you're seeing for the particles is from the texture itself. If i choose a texture having white color, the same is seen for the particles.

Here is a code from my fragment shader.
I figured if the texture is being displayed correctly for quad, then the issue may not be with the loading of the texture.

if(rendPlane == false)
{
    //vs_fragColor = vec4(.3f,.3f,0.6f,1.00f);
    vs_fragColor = texture(u_particlesTex, gl_PointCoord);
    vs_fragColor.a *= vs_transp;
}
else
{
    //plane...
    vs_fragColor = texture(u_particlesTex, vs_texCoord);
}

sentences:
Unity, choosing a mobile shader I have multiple 3d objects in my scenes. These are without any graphics and have different colors and some lights.

I was building all of the scenes with a standard shader and now, when running on an Android device, FPS drops to 30-50. I've already fixed the particles with Mobile shaders, these work well now but I have some problems with normal cubes, spheres etc.

As I read, Standard shader == death on mobiles and here comes my question. I read that I should use one of these from Mobiles tab or Legacy ones.

Which one is better in my case? Which one should I use when I only want to adjust the color of the object ( + support a lightmap ) ?

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:
How to create a solid cross-scene game manager in the editor of unity? I have been checking dozens of known 'solutions' for how to create a game manager in Unity, but none leave me satisfied.

I know I can create a singleton GameManager.Instance() that would have data to persist across multiple scenes, but it doesn't show up in the editor unless I assign it to a game object.
The problem is, this game object would then be destroyed upon loading a new scene except if I use DontDestroyOnLoad().

However, when I use DontDestroyOnLoad(), and I open up a new scene in the editor, this GameManager Object doesn't exist in the new scene. The DontDestroyOnLoad() method assumes that the program entry point will always be the main/first scene, which is often not the case when working in the editor. This isn't great.

Example:

When I have events within scene2 (say a button or something), I cannot reference the gameobjects in scene1 in the Unity Editor (most importantly, the game manager).

Instead, I have to first attach a settings.cs script to my UI Button GameObject. When pressed, the Button will then call a function from the settings.cs void ChangeInput() {GameManager.Instance().ChangeInput();}. This feels quite clunky because the Button Element cannot reference the GameManager directly, since the Button is scene-specific but the gamemanager is not.

Is there a proper solution for issues like this?

sentences:
OpenGL ES screen to world coordinate I am currently attempting to convert my screen coordinates to world coordinates, to be able to interact with objects. I am using glm and unProject to try and achieve this, so far this is my code:

glm::vec4 viewPort = glm::vec4(0.0f, 0.0f, width, height);
glm::mat4 tmpView = sceneCamera->updateView();
glm::mat4 tmpProj = sceneCamera->updateProjection();
glm::vec3 screenPos = glm::vec3(touchPosition.x, height - touchPosition.y - 1.0f, 1.0f);
glm::vec3 worldPos = glm::unProject(screenPos, tmpView, tmpProj, viewport);

Renderer->SceneObjects[120]->translateX(worldPos.x);
Renderer->SceneObjects[120]->translateY(worldPos.y);

I am trying to get a sprite to equal the position where I tap.
The issues is that the further I click going down the screen, the further the sprite overshoots, and the same horizontally. So if I click 2/3 the way down the screen, the sprite will overshoot the bottom of the screen.

sentences: How do I identify a collision with a specific body? How can I identify when the ground body collides with another b2Body? I can use b2ContactListener to be notified of collision events, but how do I tell which bodies collided?

sentences:
What are "world space" and "eye space" in game development? I am reading a book about 3D concepts and OpenGL. The book always talks about world space, eye space, and so on.

What exactly is a world inside the computer monitor screen?
What is the world space?
What is eye space? Is it synonymous to projection?

sentences:
Can I set a texture as the wallpaper of an iOS device? I have a game in Unity which creates drawings.

I need to have a button which sets the drawing as the wallpaper (with permission from the user of course).

Is it possible?

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:
Cannot run quake 3 engine compiled from source code Recently I tried to compile and run the source code of Quake 3 engine. I basically followed this article. However it doesn't work for me.

I am using Visual Studio 2010 on Windows 7, with June 2010 DirectX SDK (I doubt if it is necessary). Here is how I did:

Install the original version of Quake 3 Arena to "D:\Quake III Arena", and update to 1.32
Download and extract the source code
Open quake3.sln in "code" folder. Visual Studio upgraded it to 2010 format.
Build all the 8 projects in Debug mode (in some order). I checked that every project had been built successfully
In the properties of quake3 project, in Debugging page, I changed "Working Directory" to "$(TargetDir)" and "Command Arguments" to "+set fs_cdpath "D:\Quake III Arena""
Set quake3 as the Startup Project and press F5

The game started and could correctly recognize the game folder and parse some options, such as screen resolution. However an exception window popped out before I can see the game main menu, saying "Unhandled exception at 0x053e9938 in quake3.exe: 0xC0000005: Access violation."

I tried to start the game from command line, but it had the same problem.

I followed the code and found that the exception was generated in int VM_CallCompiled(vm_t *vm, int *args), when executing call entryPoint in the __asm block, located in line 1148 of vm_x86.c. Since it's assembler code, I don't know how to debug it.

I don't know if anyone here knows about this problem. Could anyone provide some help on this? Thanks gratefully.

sentences:
Exporting XNA class library as a DLL file I have downloaded an open source project that I intend to use with my current game. The download came with all the class files from the original project as well as a pre-compiled DLL file representing the project. I was able to easily link this DLL with my current project and get it working just fine, no problems there.

The problem I now have is that I want to make a couple of changes to the original libraries (extend its functionality a bit to better suit my needs) and re-export the class library as a DLL again, but I have no clue how to do this. Is there some simple way in VS where I can just take the class library and export/compile it as a DLL file again or is there more to it than that?

This seems like something that should be pretty simple but my efforts to find an answer have so far come up with nothing.

Thanks in advance.

sentences:
Pixel Collision - Detecting corners How would I go about detecting the corners of a texture when I use pixel collision detection? I read about corner collision with rectangles, but I am unsure how to adapt it to my situation.

Right now my map is tile based and I do rectangular collision until the player is intersecting with a blocked tile, then I switch to pixel collision.

The effect I would like to achieve is when the player hits the corner of an object to push him around the side so he doesn't just hit the edge and stop.

Any ideas?

sentences:
Why aren't my 2D primitives visible using a custom effect? I'm working with Monogame and rendering a triangle using the following code.

vertices = new []
{
    new VertexPositionColor(new Vector3(100, 200, 0), Color.White),
    new VertexPositionColor(new Vector3(200, 100, 0), Color.White),
    new VertexPositionColor(new Vector3(300, 200, 0), Color.White),
};

graphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, vertices, 0, 1);

Ordinarily I'd apply a BasicEffect before the draw call, but this time I'm using a custom effect. For testing, I wrote the following shader code to return solid green for each pixel within the triangle.

struct VertexShaderInput
{
    float4 Position : POSITION;
    float4 Color : COLOR;
};

struct VertexShaderOutput
{
    float4 Position : POSITION;
    float4 Color : COLOR;
};

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
    VertexShaderOutput output;
    output.Color = input.Color;
    output.Position = input.Position;

    return output;
}

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR
{
    return float4(0, 1, 0, 1);
}

technique Technique0
{
    pass Pass0
    {
        VertexShader = compile vs_4_0_level_9_1 VertexShaderFunction();
        PixelShader = compile ps_4_0_level_9_1 PixelShaderFunction();
    }
};

The problem is that, although the shader compiles successfully, nothing shows up.

Why is my triangle invisible using this shader?

Based on my understanding of vertex and pixel shaders, the above HLSL code should work correctly. In the vertex shader, since (for the moment) I'm working in strictly 2D without a camera, no transformations need to be done on the vertices (i.e. they're already in screen space). From there, the pixel shader simply returns solid green for each pixel. I've also ruled out potential backface culling issues by swapping the order of vertices, and I've tried using different semantics on my HLSL structure variables. No luck.

Shaders still feel uncomfortable to me, but I feel my logic is correct based on what I've read. If that's the case, there must be some weird quirk I'm not aware of in having these HLSL shaders work at all, apart from the logic. What am I missing? Is there a better way to debug these problems short of changing random variables and hoping for the best?

sentences:
Easy way to generate colour-per-vertex models for input to Blender I procedurally generate 3D planet models that I would like to import into Blender.

I use colour per vertex rendering in my shaders (In practice, I use the same colour for all vertices of a face, but my vertex attributes include RGBA.)

I like generating wavefront .obj files, because the syntax is so easy. But wavefront obj does not let me specify colour per vertex, or colour per face. Instead, the entire object is coloured with a material from the material-library that accompanies the obj geometry file.

I've looked into collada .dae as well, but frankly, that seems like a very complex format, and it still seems to work with material libraries, like the .obj format does.

Is there an easy to generate 3d model format that lets me specify a colour per vert (or face) without material libraries, and can be imported into Blender?

sentences:
GL_INVALID_OPERATION in glGenerateMipmap(incomplete cube map) I'm trying to learn OpenGL and i'm using SOIL to load images.

I have the following piece of code:

GLuint texID = 0;

bool loadCubeMap(const char * baseFileName) {

    glActiveTexture(GL_TEXTURE0);

    glGenTextures(1, &texID);
    glBindTexture(GL_TEXTURE_CUBE_MAP, texID);

    const char * suffixes[] = { "posx", "negx", "posy", "negy", "posz", "negz" };
    GLuint targets[] = {
        GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
        GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
        GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
    };

    for (int i = 0; i < 6; i++) {
        int width, height;
        std::string fileName = std::string(baseFileName) + "_" + suffixes[i] + ".png";
        std::cout << "Loading: " << fileName << std::endl;
        unsigned char * image = SOIL_load_image(fileName.c_str(), &width, &height, 0, SOIL_LOAD_RGB);
        if (!image) {
            std::cerr << __FUNCTION__ << " cannot load image " << fileName << " (" << SOIL_last_result() << ")" << std::endl;
            return false;
        }
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, image);
        SOIL_free_image_data(image);
    }

    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
    glGenerateMipmap(GL_TEXTURE_CUBE_MAP);

    glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
    return true;

}

When i call this, the images load successfully, but then i get an error in console:

---- OGL DEBUG ----
message <1>: 'API' reported 'Error' with 'High' severity:
GL_INVALID_OPERATION in glGenerateMipmap(incomplete cube map)
---- BACKTRACE ----

and no cubemap is displaying at all.
Do you see any mistake in this code?

sentences:
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:
Cocos2d-x project every time must compile the project plus other libraries I'm using cocos2d-x v3.6 for win32 desktop and Visual Studio 2013 with c++.

When I change the code and then compile the project again, I must re-compile my project AND other libraries every time (e.g. libraries: libbox2d and libcocos2d), and this phase takes a long time.

I don't know why I get this bad behavior of having to re-compile the dependency libraries every time with the project.

Is there is any way to change this bad behavior, to compile the project only without dependency libraries every time?

sentences:
How collision boxes are assigned to object in 3D games? Level designers make levels and then programmers import the models and use it but How and when collision boxes are generated for objects and models in the 3D map placed at random locations?

Thanks.

sentences:
What controls the platform override codes in AudioClip (and maybe other Assets) .meta files? My game needs to use Unity 2019.3 for the console versions, and 2020.3 for the mobile ports.
The Console Project is the master project. Virtually any changes done to it are replicated to the Mobile project.
I would like to setup import overrides for Android (e.g. the compression quality for my soundtracks). To be consistent, I perform this change in my Console Project using the "Override for Android" checkbox (which affects the .meta file), and then replicate the change to the Mobile Project (a program checks for differences between both projects and applies most changes).
Ideally, the Mobile Project will now reflect the compression quality I want for said soundtracks, but it actually doesn't - in fact, the "Override for Android" checkbox does not appear to be checked in the Mobile Project, despite having a .meta file identical to the Console Project.
I digged into the .meta files, and noticed that when I use "Override for Android" in my Console Project, the .meta file adds an entry code 27:
  platformSettingOverrides:
    27:
      loadType: 2
      sampleRateSetting: 0
      sampleRateOverride: 44100
      compressionFormat: 1
      quality: 0.5
      conversionMode: 0

But, when I go to my Mobile Project and check the checkbox, it adds an entry coded 7:
  platformSettingOverrides:
    7:
      loadType: 2
      sampleRateSetting: 0
      sampleRateOverride: 44100
      compressionFormat: 1
      quality: 0.5
      conversionMode: 0

I don't understand this inconsistency. Does anyone have any insight on the exact conditions/rules Unity uses for the platform codes in the .meta files?
I can only think of a few dubious reasons:

Maybe they changed from 2019 to 2020.
My Console Project actually supports more platforms than the Mobile Project (the consoles, obviously), so maybe they "pushed" the Android code from 7 to 27.

It is not the end of the world; I could make a script that duplicates the settings of 27 into 7... But only if this behaviour is predictable or consistent. So my question is, what is Unity's logic behind the choice of these platform codes?
Note: so far I've only found this behaviour on AudioClip files. With Textures, I see that it actually uses the name of the platform in the .meta file, so the settings do work thankfully, but it is even more puzzling because now I don't understand why Textures and AudioClips use different conventions to begin with... What other Asset Type has numeric conventions?

sentences:
How do I handle this type of collision? So I've been messing around with simple game development for a while and just found an interesting game idea here . I'm using SFML 2.1 with C++ and so far I have a tilemap in a VertexArray using a very similar way to this tutorial and have gotten it working with submarine movement but I feel that I have dug myself a hole with this. Here is what I have so far and you can see my simple tileset: . I am pretty lost in terms of how to handle collisions between the submarines (and anything else fired) and the walls. The only way I can really think of is pixel collision but I'm not really sure how I would implement that.

Sorry if this has been asked before but I have looked and can't find much that applies. Any help is greatly appreciated.

Thanks,

Karel

I just realised that the question is badly worded sorry. I was wondering how to do collision detection between the submarine and the walls of the level. Since I don't want to just do collision tests on the whole tile (as it would prevent the sub from getting close to the wall) but rather the section that has the actual wall part (just the line in the tile). I really don't know how to do this, should I switch out the tilemap for just a bunch of line objects and do the collision tests on those or is there a way to do it as it stands now?

sentences:
Ubuntu-Unity3D All Compiler Errors Problem Before 2 weeks ago I can develop games on Ubuntu with Unity3D but after some updates or somethings I give "all compiler errors have to be fixed before you can enter play mode" messages. If I compile code on Intellij Rider it's ok, no problem. There is nothing on Unity console and I am researching about it since 2 weeks but I can not find any solution. I tried to install mono and .net core, yesterday find line ending problem an try to different editor but they don't work.

Produce Steps:

Create new 2D project
Add empty object to scene
Add script to empty object
Compile

ubuntu: 18.04

unity3d: 2017.4.26f1 and 2019.1

sentences:
Standard Asset package import in unity 2018.3 I am using iMac, I don't see any for import standard package in unity. My working project need to import standard packages. I use unity version unity 2018.3.0f2. Please guide me from where I get the unity standard asset package.

Thanks.

sentences:
Using PyOpenGL, can I rotate raw data rather than the current matrix? I'm trying to create a sort of PyOpenGL renderer for the Bullet physics engine, and at the moment I'm rotating my basic cubes with math in Python. However, if I do the math in Python that's going to take more time than doing the math with OpenGL.

OpenGL has the ability to rotate a matrix using glRotatef(), but it only rotates the "current matrix". I'm not really interested in convoluting my render loop with an individual check for each object's rotation and position if I don't have to.

So my question is, is there a way I can, for example, load a matrix of points into OpenGL, rotate this matrix and then read it back and give it to my render loop? Or should I instead look for an alternative 3D math library? (Or for that matter, is running the code in python really all that laggy?)

sentences:
How to rotate within a fixed interval in Unity? I have very recently started to learn Unity.

I'm trying to write code that will make a character swing a flag. I want to use this object and rotate the arm up and down. So I need to make it rotate up and down with within 30 degrees.

This is my attempt but it simply keeps on turning. How would I make the hand rotate in motion within the interval [-30, 30] degrees.

private GameObject myobject;
public float timeElapsed =0;
public float delay = 3.0f;
float OO = 0.0f;

void Start () {
    myobject = GameObject.Find ("rightarm").gameObject;
}

void Update () {
    timeElapsed += Time.deltaTime;
    Debug.Log (timeElapsed);

    if (timeElapsed >= delay) {
        OO = 30.0f;
        timeElapsed = 0;
        if (myobject.renderer.enabled == false) {
            myobject.renderer.enabled = true;
        }

        myobject.transform.Rotate (OO, 0.0f, 0.0f);
    }
    else
    {
        myobject.transform.Rotate (-OO,0.0f, 0.0f );
    }
}

sentences:
How can I imitate interaction and movement in Diablo II? I'm prototyping a simple browser-based game. It's played from a top down perspective on a 2d canvas.

You left-click on a point on the map, and your character will begin walking to it. If you click on a different point on the map, then your character will begin walking to the new point.

It's similar to Diablo II. (a demonstration video)

How can I best imitate this movement system for a player? Ideas...

Track current coords and target coords
If target coords are exactly up, left, right, or down, then increment appropriate direction until you get there
Implied else: target coords are in a quadrant. To make this movement look natural, character will have to move diagonally. For example, pretend the target is to the northeast. For each game frame, alternate incrementing current coordinates in the north and then east directions.

sentences:
Partnership vs. Limited Partnership vs. LLC for not-serious gamedev project Me and one friend are getting close to releasing our first game to the App Store. Right now we're registered as a "partnership" with the IRS. I don't expect to make much money, and I have a day job so it doesn't matter too much anyway.

In this situation, what would the benefits of registering an LLC be? I really just want simplicity of taxes and legal stuff. The limited liability seems nice in some sort of crazy disaster scenario, but how likely is that to actually happen? We haven't hired anyone, and all our assets are royalty-free ones from the Unity Asset Store or similar. We've done all the coding ourselves. Our game is a straightforward, pay-a-couple-bucks-up-front, no in-app purchases or ads, type of business model.

sentences:
Passing variables down the pipeline glsl I am sorry to post a question that may be easily tested, but I don't have an OGL4+ hardware at the moment and I have to make some design decision beforehand so I wanted a clear scenario.

Looking at various tutorial that involve tessellation shaders, each single parameter that I want to send from the texture shader to the fragment shader are before passed through tessellation shaders as well (as they always needed in the case I saw).
If I have a variable that I want to send from vertex shader to the fragment one, but that's not needed by TCS and TES, can I just do something like

//// Vertex shader

out vec3 foo;

// Ignore foo in tessellation control and eval shader

//// Fragment shader
in vec3 foo;

or I have to pass foo through the tessellation shaders as well?
 I always understood the out variables are just being passed to the next stage, but what if the variable is not "picked" until another non-consecutive stage?

Thank you!

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:
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: 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:
Show/hide soft-keyboard on demand I'm writing simple chat-app using Unity. The problem with Unity's default implementation of soft-keyboard visibility is that it hides itself when i'm clicking outside of keyboard panel. What i want is that keyboard stays always shown until i explicitly tells otherwise.

For a couple of days i tried to find similar questions but none of them helped me. I have very little experience in "native" android development (i.e. Java). So far i managed to create simple native plugin for Unity. I tried to manually open keyboard with this code:

imm = (InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);

The result was fine, except the keyboard had InputType set to TYPE_CLASS_NUMBER. For my app i needed TYPE_CLASS_TEXT. So i tried to research how to set InputType and stumbled on fact that this property can only be changed inside EditText object. As i'm writing my app in Unity, i had no way of finding my InputField's inside native code. So i tried to create EditText inside my native plugin. I followed the logic that if i create custom EditText, place it inside main layout and set visibility to NONE or make background transparent, then i can set focus to that element and be fine:

FrameLayout myLayout = activity.findViewById(android.R.id.content);
focusedText = new EditText(context);
focusedText.setFocusable(true);
focusedText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_NORMAL);
myLayout.addView(focusedText);
focusedText.setFocusableInTouchMode(true);
focusedText.requestFocus();
focusedText.setBackgroundColor(activity.getResources().getColor(android.R.color.transparent));
imm.showSoftInput(focusedText, InputMethodManager.SHOW_FORCED);

The end result was a mess. Soft keyboard behaviour became undesirable. In order for keyboard to show, i first needed to select InputField, then i would see transparent EditText be created in the middle of my layout with all input characters visible. Even if all worked fine, it still looks like a wacky hack.

Does anyone stumbled across similar issues?

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:
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:
A game that can balance itself over time? So after reading some history and learning about how some countries were allowed to survive by stronger countries, just so that a power gap wouldn't exist. That being said, we can assume that if this power gap did exist, eventually the world will rebalance itself one way or another.

Would that be applicable in games? Can a game (for example, Overwatch or any MMORPG) balance itself over time whether the imbalances are a result of how the classes are built or even the population of people in every faction?

I thought about it a lot and I tried finding dissimilarities between my real world example and games.

In games, you are allowed to have many identities. You can essentially have a character in every faction. In a game like OW you can pick any hero. You don't have a fixed identity that defines you like IRL so cloning the idea of a "Country/Nation" in real life to a game is nearly impossible as developers don't have power over how many characters/factions the player can have.
Nations have finite resources. All MMOs I played have infinite resources which simply doesn't make sense compared to the real world. Finite resources is what makes nations great whether by smart utilization of said resources or conquering/invading other nations.

That being said, I still have a feeling that it's possible, one day, to have a game that can balance itself over time. But to achieve that, I believe we need to put many constraints on the gameplay to mimic real life constraints that "define" a nation.

What do you guys think? What would those constraints be?

sentences:
How are flow fields different from potential fields? I've heard of of both flow fields and potential fields for pathfinding in games. They sound similar, but I never see them mentioned in the same contexts. Places that mention one never mention the other, as if they're completely unrelated.

How are they different? Why would I choose one over the other?

sentences:
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:
Should I be using Reach or HiDef profile if I have large spritesheets? I'm working on a platformer in monogame, that I want to use a large number of sprites for making up items and objects in the background.

The main spritesheet I've created is 4095x3734, when I tried to convert it into xmb using XNA Content Compiler, I received an error that Reach Profile only supports 2048x2048.

I've read that I can use HiDef which will support 4096x4096, which will be sufficient for my requirements, but I am a bit concerned about what the potential pitfalls will be - will less graphics cards support the game? What about Mac/Linux? Does monogame fully support HiDef?

In short, I would like to know if there are any cons of using HiDef and if using multiple 2048x2048 spritesheets would perhaps be better - and how much of a performance hit it would be.

sentences:
How to make an object in box2d have constant velocity even after collision? I have iOS game where I have a bouncing character. Everything is being handled by box2d. The problem is when the character hits a wall of another character it's velocity changes, but I don't want this. I need the velocity to stay constant even after collisions.

I was thinking the only way to do this was to keep setting the velocity after each collision unless there's another way to do this that I'm not aware of?

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 to store each rendered frame as image in libgdx for debugging I have a libgdx screen's render method where I am executing lots of for loops and drawing various shapes on screen in thoese loops. Also I am manupulating (x,y) of each shape at runtime to acheive a smooth animation.Everything was ok until,

Issue: Recently I had added few more shape's at some positions in my screen. Due to some mess up, I am getting flicker, and some shapes are getting drawn out of my game world.

I tried to debug my code many times but there are too many loops and shapes so I am unable to pin point the exact loop or frame where shapes are getting drawn out of my game world.

Need Input on following approach to debug:

So I was thinking to save each frame of my render method as an image locally. Is it possible? Please provide suggestions or sample code to acheive it.

I will hook up some debug variables in my loops to calculate exact frame where things are getting messed up. That I will take care of.  Please advice on above question.

Thanks in advance.

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:
Unity: camera moving up and down for no reason I have a standard camera in my scene. With standard I mean the camera you get when you click right mouse > Camera, with no modification except for the transform position and rotation. Then I attached to the camera this simple script:

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

public class CameraController : MonoBehaviour {

public GameObject target;
public Vector3 translationOffset;
public Vector3 rotationOffset;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
    transform.position = target.transform.position + translationOffset;
    transform.LookAt(target.transform);
    transform.Rotate(-rotationOffset);
}

}

the result I have is this:

Why my camera is doing that? It may be worth noticing that everything was working fine, but at some point i clicked on "reimport all assets" and it started this weird behaviour. How can I fix? Thanks a lot.

sentences:
Simple, casual open source OpenGL games to implement other things in I am looking for a simple casual game (open source) done in openGL. I need it to implement communication component i build this is not for learning opengl  and to implement some other stuff into it. Where can I find one?
(I am using C++)
Thanks

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:
XNA Skinning Sample - exporting from Blender recognize only first animation clip (and sorry for my English)
I'm using animation components from XNA Skinning Sample. It works great but when I export a model from Blender, it does not recognize any other animation clips than the first one. So I have three animation clips, but XNA recognize only one. Also, when I looked up on Xml file of the model in Debug\Content\obj directory, there is only one animation clip, but when I check code directly from .fbx file, it seems to be alright.

Link to my model files:
https://skydrive.live.com/redir?resid=8480AF53198F0CF3!139

BIG Thanks in forward!

sentences:
Converting a Flash animation to Silverlight I recently had an animated logo done in Flash for Deen Games. I need to display in all my Silverlight games. The problem is, the logo is about ~8 seconds long (205 frames); if I export all the images as even JPEGs, the result is almost 3.5MB of content (more than the game itself).

I tried exporting as various formats (PNG, JPG, GIF, etc.) but nothing is small enough. What are my options? How can I incorporate these into my game without blowing up the file size?

There's always the option of "recreate it in-game with animation/rotation/etc. as it is now) but that's tons of work and I'd rather avoid that.

And no, just a static image is not good enough!

Edit: Exporting as a movie (AVI, MPEG) won't work since XNA doesn't support movies at this time.

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:
Custom sampling points for anti-aliasing I'm trying to write an anti-aliasing shader in HLSL, but I can't find any way to rasterize at a custom point. (in between pixels on the screen, but not orderly like supersampling)

Is there any way to do this completely in HLSL, or would it require external c++ code?

Currently I am creating a 2nd camera to rasterize my geometry on a screen of 1x1 at this point, and editing it from there, but it feels like this isn't the best way to do this.

sentences:
Season Change Reveal Effect I was watching the teaser trailer for Seasons After Fall, and I was struck by the effect they use to transition between seasons (around 21-24 seconds):

The level art, including the background and the foreground platforms, change from a sepia-coloured autumn to a lavender winter, with the effect spreading outward from the player character a bit like water soaking through paper.

It looks like more than just a palette change, as details in the leaf and bark patterns change in the transition.

How could I achieve an effect similar to this in a 2D Unity game?

sentences:
How to change the KEYSTORE securely? I'm wanting to release a free version of an app to which I've already made a paid version.

I simply copied the project to another folder:

The project is initially the same as the paid application when finalized. I want to simply delete a few phases and put a link that takes the application paid in the Google Store (this I know how to do);

Turns out there is something called a keystore.

I would like to know if only thing I have to do is create a file.keystore in the directory with different name, rename the Filename (before Password) and click the generate button (below Country).

OBS - Obviously I will make a backup copy of the paid version file.keystore.

sentences:
Creating straight lines between two Vectors? (and slopes?) (interpolation??) libgdx java I am trying to make a game with very basic physics (just gravity at this stage). Without using box2d
How is the best way to create the solid ground. I will be wanting to make ramps soon, but at this moment i am even stuck trying to make flat ground.

The approach i've been researching involves 'interpolation' between 2 or more vector2's , this sounds perfect for me as I only need very basic levels (think Excitebike for NES) so I want to be able to provide my level-creator class with just a bunch of height values and i want it to create invisible straight lines joining up those height points.

As i said ive seen about "interpolation" in the vector2 or the libgdx.math classes but I'm very confused on how to go about using those commands.

As usual any help is much appreciated, thanks for reading

(EDIT: I am thinking I could use Rectangles between the straight parts but is this going to work when i start introducing sloped ground?)

for example i have the green dots saved as vector2 and i need a method that makes the lines between (straight lines is fine no need for curves etc)

sentences:
How to panning camera on XZ axis with different angles I have an Orthographic camera where the position is { x:0, y:100, z:0 } and is pointing/looking at { x:0, y:0, z:0 }. At this point, I'm able to capture the mouse movement and translate it to make the pan correctly. If the mouse goes 10 px down/y I just have to move Z in the 3D world.

The problem is that I don't know how to calculate if the camera position is in perspective, let's say:

position: { x:50, y:50, z:50 }
lookAt: { x:0, y:0, z:0 }

I guess I have to use some trigonometry, but I'm very lost, to be honest. Any guide would be very helpful.

sentences:
How can I avoid repeatedly setting up SDL in VS 2013? Do I have to set up SDL 2.0.3 every time I make a new project?

I tried putting sdl.dll in system32 so that I don't have to include it in my project folders, but that didn't work.

sentences:
How do I keep different platforms code in separate plugins? Considering that some game platforms are under NDA and that publishing code publicly using their SDK is not allowed, how do game engine usually manage keeping plugins for different platforms separated?

For example if I make a plugin for PS3 export, it needs to be distributed only to people that do have the PS3 license.

Platform code can happen in many places of the code, and keeping it entirely separated from the core engine seems really hard/impossible to manage to me.

Edit for example:

If I make an open source game engine for which users are allowed to see the code, it means that the core engine is entirely viewable. Using preprocessors or anything like that would allow people to view code subjected to NDA, which doesn't work.

So, the platform-specific code needs to be totally separate from the core engine, but the core engine needs to be able to use it. The most obvious solution is to duplicate implementations of system things for every platform, and when using a plugin you select which implementation you use, but it seems very hard to maintain.

sentences:
Ray->triangle collision math seems to not work? First time asking, pardon any mistakes I make :)

I am programming a game from scratch, and the collision detection is giving me issues. I have AABB in place to check proximity, and if that reacts, the two models are checked by having each vertex in the moving model be a line going from the vertex' current position to its intended position. That line then gets checked against each triangle polygon in the 'obstacle' model.

My (current...) problem is that the math seems to react wrongly in the early part of that ray-triangle check (code below). I try simply to see if the two ends of the ray (vertex origin and vertex destination) are on opposite sides of the polygon plane (if they are not, the ray could not possibly be going through the polygon). I do this by getting a (not yet normalized) normal from the polygon via cross product. Then I dot the ray ends' positions with that. If it's one positive and one negative dot product, they should be on either side. Problem is, that never happens, even when i run models right through each other in tests. Never a 'positive & negative' result.

Can anyone spot my mistake(s)??

Code:

double Dot(Vec3 *a, Vec3 *b)
{
    double d = a->v[0] * b->v[0] + a->v[1] * b->v[1] + a->v[2] * b->v[2];
    return d;
}

Vec3 CrossProduct(Vec3 *a, Vec3 *b)
{
    Vec3 v;
    v.set(
        a->v[1]*b->v[2] - a->v[2]*b->v[1],
        a->v[2]*b->v[0] - a->v[0]*b->v[2],
        a->v[0]*b->v[1] - a->v[1]*b->v[0]
    );
    return v;
}

bool Collide(Vec3 *a, Vec3 *b, int target, int p)
{
    // a and b are the ray points in global space
    // target is the index number of the obstacle model
    /// p is the triangle polygon being checked (in a loop not included here)
    Vec3 poly_vert[3] = {entities[target].vertex[entities[target].poly[p].vertex[0]].pos
                    ,entities[target].vertex[entities[target].poly[p].vertex[1]].pos
                   ,entities[target].vertex[entities[target].poly[p].vertex[2]].pos};
    // poly_vert is the three vertices of the triangle polygon
    // Subtractions so poly_vert[0] essentially becomes the 0,0,0 center of the universe
    Subtract(&poly_vert[2],&poly_vert[0]);// Essentially, the vector from
                                             polyvertex 0 to polyvertex 2
    Subtract(&poly_vert[1],&poly_vert[0]);// Essentially, the vector from
                                             polyvertex 0 to polyvertex 2
    Subtract(a,&poly_vert[0]);
    Subtract(a,&entities[target].pos);// Make it relative to the obstacle model
    Subtract(b,&poly_vert[0]);
    Subtract(b,&entities[target].pos);// Make it relative to the obstacle model

    Vec3 poly_cross;
    poly_cross = CrossProduct(&poly_vert[1],&poly_vert[2]);
    double da = Dot(a,&poly_cross);
    double db = Dot(b,&poly_cross);

    if (da*db >= 0){return false;}
    return true;
}

sentences:
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:
How to make sound play when button is pressed I'm using Game Maker Studio 2.

When I press the "Z" key I need audio to play, but I can't seem to get it to work.

I'm using the following code inside an object's Key Press event:

if keyboard_check_pressed("Z")
{
   audio_play_sound(snd_menu_selection,1,false);
}

sentences: Can Java be used for developing games for Android in Unity3D I only know Java Programming Language and no other. Can I develop games for Android in Unity3D using Java?

sentences:
How to find all the possible places to go on a grid? Given the amount of steps you can take in a grid, how could I implement a way to get all the possible places a unit can go to, in a game like Advanced Wars?

I have currently got A* path finding working, but it would be nice to have an indicator of the possible places to go to. I have linked to an image to make things more clear.

I was thinking of computing the path of every single tile on the grid to the unit tile, then working it out from there, but I can imagine that will take crazy amounts of resources.

Notice how the other units 'block' the path of the selected unit. So unfortunately its not a trivial 'draw a circle with radius X'

sentences:
How to draw a Minecraft-like world with Open GL I recently completed the this Open GL tutorial. The tutorial shows how to set up a window and shaders, and teaches you how to draw a single cube in the middle of the screen, which all makes sense to me (I think).

I'd like to make just a simple flat world made of cubes like Minecraft, but I have no idea how to turn my single giant cube into a bunch of smaller cubes, or how to get the smaller cubes to be arranged in the proper way.

Mostly what doesn't make sense to me is the coordinate system being from 1 to -1 and trying to draw a bunch of cubes in that space. Is there a way to adjust that coordinate space to be more world-like, where each unit of coordinate space is roughly equivalent to a meter or something?

sentences:
Collider does not call callback functions I have a script that will create new GameObjects and will place it where the mouse is placed on the terrain. Now I need to have a check for collision on other already placed GameObjects on the field.

I check different tutorials and documentation and cannot find a way to do this in code.

My code looks like:

objectToPlace = (GameObject)AssetDatabase.LoadAssetAtPath("Assets/Game/3D Models/Buildings/" + objectName + ".fbx", typeof(GameObject));
objectToPlace.SetActive(true);
objectToPlace.transform.localScale = new Vector3(1, 1, 1);
objectToPlace = Instantiate(objectToPlace);

objectToPlace.transform.Rotate(Vector3.right * 90);

BoxCollider collider = (BoxCollider)objectToPlace.AddComponent(typeof(BoxCollider));
collider.isTrigger = true;

In the same class as the above code I have OnTriggerEnter function. But that function is not called. How can I link the Collider to that function in Unity 5.6?

I also tried using the Physics.CheckBox for checking if my new create gameObject does not collide to any other object. But without any succes.

sentences:
Pros and Cons of AMF in multiplayer flash game? After trying to use red5 for my turn-based multiplayer game, I've decided to give AMF a try using amfphp, because of the expensive media server hosting solutions. (With AMF all I need is a web server). The game is a simple turn based game. It uses Box2D for physics. Its similar to pool or billiards. More than two users should be able to play in one game 'table'. Is it OK to use AMF in this situation? Also which one should I use? ZendAMF or AMFPHP?

Features: No. of players >= 2 in each 'room' or 'table', turn-based, multiple rooms.

I've heard games like farmville use AMF. Does zynga's poker game also use AMF? How does one player get info on what the other player is doing? Do they do a timed checking for any changes, similar to polling? How can changes or 'moves' made by one player be updated to everyone? Since the connection is terminated after every request unlike in a socket connection.

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:
Device Disposing Memory leak issue I have a memory issue after disposing all my D3D objects and lastly disposing the device. I want to free all memory and, depending on user interaction, creating a new device, but removing all memory footprint of the old device.

I traced down some Disposing issues I had to only have this left, right at the line at disposing the device:

I get this by calling:

mDevice.QueryInterface<DeviceDebug>().ReportLiveDeviceObjects(ReportingLevel.Summary)

I understand that that the DeviceDebug interface I receive to get this debug information increases the Refcount of the ID3D11Device by +1. So it should be 2 references left.

Now I wonder if I need to track down this last reference (the 2nd) in order to get the device fully released after I call .Dispose(). Or if this is a internal refernece that is handled for me.

The issue is, that I don't know how to check for remainding objects after the device disposing. I get no warnings about active objects in output anymore, them I fixed already.

My memory grows linearly by about ~15MB each creation and destruction of my window (not closing the application, just the part that needs a device).

Any help appreciated!

sentences:
Kinect Hand tracking in xna I'm trying to create an application using the Kinect to simulate the following project:

Kinect Hand Tracking

I want my project to have similar usability with the Kinect tracking hand and finger positions for use in a menu system, or to navigate another system.

What I would like to know is; is it possible for the exact same to be accomplished in XNA using Kinect?

I know that it can be done in Winform / C#, but I know XNA / C# a lot better and would (ideally) prefer to use that.

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:
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:
Is it possible to get object rotation in a shader for dynamically batched objects? All the batched objects have the same rotation. To simulate the effect of directional light I need to determine the object sides actual (world) directions. Normally I would use unity_ObjectToWorld & unity_ObjectToWorld for that, which is not possible when the objects are batched.
Is it possible to pass the object rotation to the shader in one action (since it's the same for all of them) without breaking the batching?

This is a simplified shader example (here I use colors instead of light/shadow effect and only 2 sides instead of 4):
Shader "Test/UnlitTest"
{
    Properties
    {
        _MainTex ("Texture", 2D) = "white" {}
        _TopColor ("TopColor", Color) = (1, 0, 0, 1)
        _BottomColor ("_BottomColor", Color) = (0, 0, 1, 1)
    }
    SubShader
    {
        Tags { "RenderType"="Opaque" }
        ZTest Off
        ZWrite Off
        Lighting Off
        Cull Off
        Fog { Mode Off }

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

            sampler2D _MainTex;
            float4 _MainTex_ST;
            float4 _MainTex_TexelSize;
            fixed4 _TopColor, _BottomColor;

            struct vertData
            {
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
            };

            struct fragData
            {
                float2 uv : TEXCOORD0;
                float2 uvW : TEXCOORD1;
                float4 vertex : SV_POSITION;
            };

            fragData vert (vertData v)
            {
                fragData f;
                f.vertex = UnityObjectToClipPos(v.vertex);
                f.uv = TRANSFORM_TEX(v.uv, _MainTex);
                f.uvW = mul(unity_ObjectToWorld, f.uv);
                return f;
            }

            fixed isTransparentPixel(fixed2 uv)
            {
                return step(tex2D(_MainTex, uv).a, 0.0);
            }

            fixed isEdgePixel(fixed2 uv)
            {
                uv = mul(unity_WorldToObject, uv); // back to object space
                return isTransparentPixel(uv);
            }

            fixed4 frag (fragData f) : SV_Target
            {
                fixed isTransparent = isTransparentPixel(f.uv);
                clip(-isTransparent);

                fixed4 c = tex2D(_MainTex, f.uv);
                float2 borderSize = float2(3, 3); // border size in tex pixels
                float dy = borderSize.y * _MainTex_TexelSize.y;
                fixed3 borderColor = fixed3(0, 0, 0);
                float borderColorsCount = 0;
                float2 uvW = f.uvW; // UV in the world space

                // Top edge:
                fixed isEdge = isEdgePixel(uvW + float2(0, dy));
                borderColor += isEdge * _TopColor.rgb;
                borderColorsCount += isEdge;

                // Bottom edge:
                isEdge = isEdgePixel(uvW + float2(0, -dy));
                borderColor += isEdge * _BottomColor.rgb;
                borderColorsCount += isEdge;

                fixed noBorderColor = step(length(borderColor), 0);
                fixed hasBorderColor = 1 - noBorderColor;
                c.rgb = c.rgb * noBorderColor + hasBorderColor * borderColor / max(borderColorsCount, 1);
                return c;
            }
            ENDCG
        }
    }
}

It gets a semi-transparent image as a texture. The image is completely transparent at the edges and contains an opaque shape in the center.

The shader colors the top edges of the non-transparent shape in red and the bottom ones in yellow. It uses unity_WorldToObject & unity_ObjectToWorld to check the edges facing directions in the world space.

sentences:
How can I apply a Camera Shader to UI? I am trying to make a shader that applies a black image with 50% transparency to the entire screen, with the exception of a designated area.  I am starting by just trying to apply a shader to the entire screen.  So I am using the default ImageEffect Shader.

This is my before and after when applying my shader, which should invert everything.  It inverts everything except for the Balmer's Peak, which is a Unity Image:

Before:

After:

Example of what I am going for:

I attached a script using OnRenderImage to the Camera, and the attached material is being applied to everything in sight, except the UI.  What can I do to make my material applied to everything on the screen, including the UI?

I am new to shaders, so this may seem like a bit of a dumb question.  But I am not sure what direction I should be headed.  Here are my scripts, although I did not really change anything from what Unity provided me:

Script attached to camera:

using UnityEngine;

public class ButtonHighlight : MonoBehaviour
{
    [Tooltip("Material which is to be applied")]
    [SerializeField]
    private Material material;

    private void OnRenderImage(RenderTexture source, RenderTexture destination)
    {
        Graphics.Blit(source, material);
    }
}

Shader attached to material above:

Shader "Magic/Magic Shader"
{
    Properties
    {
        _MainTex ("Texture", 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;

            fixed4 frag (v2f i) : SV_Target
            {
                fixed4 col = tex2D(_MainTex, i.uv);
                // just invert the colors
                col = 1 - col;
                return col;
            }
            ENDCG
        }
    }
}

What is the correct approach to apply a shader to the entire screen?  (Keeping in mind, that the purpose is to add a filter to most, but not all, of the screen.)

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:
Any way to optimize testing each bullet for each enemy in shoot em' ups? Possible Duplicate:
  Is there a way to increase the collision check efficiency of a system of n objects?

Lately I have been making a shoot em' up, and for collision detection I would use foreach loops, testing each bullet for each ship, like so:

foreach (Bullet bullet in BulletOnScreen.ToList())
{
    foreach (EnemyShip ship in Enemies.ToList())
    {
        if (bullet.BulletRectangle.Intersects(ship.Rectangle))
        {
            ship.ReceiveDamage(bullet.Damage);
        }
    }
}

But is there a better way to check for collision?

sentences:
How does Unity's execution order work? I wonder how Unity's execution order really works.
There's an ordered list at https://docs.unity3d.com/Manual/ExecutionOrder.html, but how does this work when there are different gameobjects involved? Will Unity first run the specific function for all the monobehaviours in the scene before it proceeds to the next function? Or will each monobehaviour go through that specific order of functions before Unity goes to the next monobehaviour? Or is it more complex? It isn't really clear to me from the documentation.

For example, normally Start() gets called before Update(), however when I was debugging, Update() on my Avatar prefab got called before Start() of my Camera child object. Is this supposed to happen?

sentences:
What are the benefits of designing a KeyBinding relay? The input system of Quake3 is handled using a Keybinding relay, whereby each keypress is matched against a 'binding' which is then passed to the CLI along with a time stamp of when the keypress (or release) occurred.

I just wanted to get an idea from developers what they considered to be the key benefits of designing your input system around this approach?
One thing i don't particularly like is the appending of the timestamp to the bound command. This seems like a bit of a hack to bend the CLI into handling the games input?
Also I feel that detecting the keypress only to add the command to a stream of text that gets parsed at a later date to be a slightly latent way of responding to input? (or is this unfounded?)

The only real benefit i can see is that it allows you to bind 'complex' commands to keypresses; like 'switch weapon;+fire;' for example. Or maybe for journaling purposes?

Thanks for any insights!

sentences:
How can I seamlessly loop a background texture in XNA? Using XNA, I made a looping background with several textures (whose widths are over 1024px). There are fewer than five of them. All the pictures are different, held in a list and their positions are looped. When it reaches the end of the loop, it flickers.

In my Update method I do this:

dt = (float)gameTime.ElapsedTime.TotalSeconds;
foreach(BackGroundObject bgo in myList)
{
    bgo.Position += speed * dt;
}

So that it works based on gameTime. Then, in my drawing function is this code:

foreach(BackGroundObject bgo in myList)
{
    spriteBatch.Draw(bgo.Picture, bo.Position, Color.White);
}

Here is the BackGroundObject class. The game holds a list of BackGroundObjects and Update changes their positions. If any object goes off screen, its position is set again; a BackGroundObject is loaded once and the game always uses same BackGroundObjects. MayDraw is a property of the picture's position. I.e. If in the screen or not.

public class BackGroundObject
{
    public Texture2D Picture;
    public Vector2 Position, DrawPosition;
    public bool MayDraw;

    public BackGroundObject(Vector2 position, Texture2D picture)
    {
        this.Picture = picture;
        this.Position = position;
        this.MayDraw = true;
    }

    public virtual void Draw(SpriteBatch spriteBatch)
    {
        if (MayDraw == true)
        {
            spriteBatch.Draw(Picture, Position, Color.White);
        }
    }
}

Does the flicker problem occur because of the large image sizes? Could I do this with a shader instead?

My background code works on with a graphic card with 60 FPS, but on a onboard graphic card with 30 FPS.

I have 4 background layers, each layer has 4 pictures, in total about 15pictures are drawen with widths of 1920.

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:
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: LWJGL—How to Animate Sprites from a Sprite Sheet Using Certain Keys? I'm talking here about walking animations and such for a 16-bit RPG. I have a simple sprite sheet that contains walking animations for all directions (up, left, down, and right), but I'm having trouble getting LWJGL to animate them—how would I do it?

sentences:
3d puzzle game generating levels I want to create a puzzle game for my first year in college.
I will use OpeGL and C++.

The point of the game is to create a path between squares that have the same color, without making the paths intersect each other.

This is the game I want to reproduce: http://mypuzzle.org/3d-logic-2

When I first told my teacher that I want to create this game, I told him I will generate levels, not store them internally.

Then when I actually give it a little thought, I realised I don't have a great idea, just a bad-medium idea (one that doesn't generate "good levels", levels that are actually hard, that use as much space as possible, levels that have multiple solutions).

So my question is:

Does anyone of you know a great idea, an algorithm, some math etc. to use it to generate good levels?

sentences:
Find new position of rotated by 10 degrees line I have a line that goes to x (x1) of 300, and then I rotate the line by -10 degrees. How can I get the new x (x0) of the rotated line?

Here's a picture to show what I mean:

Are there any books that would help me learn this stuff?

sentences: 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:
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:
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:
How to use multiple textures in OpenGL ES 2.0? I am working in OpenGL ES 2.0.

I load two png images as my textures with the libSOIL. I need to use one of them as the texture for the background and another one as the texture of a rotating cube.

In OpenGL ES 2.0, the adding texture operation is in the shader. I don't know how to add the different textures to the different places in a shader. How do I do that?

sentences:
User input in game loop I am building a simple multi-player fly-around-a-3D-world game in Javascript/webGL/websocket (Chrome, Firefox mostly).

How should I handle and process user input?

My preliminary design (untested) is to first just track which keys are down in the event handler:

var keys = [];

document.onkeydown = document.onkeyup = function(evt) {
   keys[evt.charCode] = evt.type == "keydown";
   keys[CTRL] = evt.ctrlKey;
   keys[SHIFT] = evt.shiftKey;
   websock.send(JSON({time: (new Date()).gettime(),
      down: evt.type == "keydown",
      key: evt.charCode,
      shift: evt.shiftKey, ctrl: evt.ctrlKey }));
};

and then, in my requestAnimationFrame callback, compute how many time-slices (say 20 per second?) have elapsed since the last render callback, and then compute that many time-steps using the booleans in the keys array to determine if to apply a left bank, right bank, up down and accelerate and so that time-step for each player.

How effective / responsive is this?  Is there a better way?  And is there a neater way to deal with latency than just backdating changes for other user's ships?

sentences:
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:
Iris-wipe shader not properly working I'm working on creating an iris wipe transition, like the ones you see in old cartoons - a fully transparent circle closes on a certain point, leaving a full screen of a solid color. Additionally, the background around the circle fades in from full transparency as well. I decided that shaders would be easier than creating vertices to build the iris effect. I may have been wrong.

EDIT: I've made some progress since asking this question - there is now an iris effect, but it opens and closes around a blank CornflowerBlue screen before displaying the screen, and the background around the circle is always full transparency.

Shader:

sampler TextureSampler : register(s0);
float2 irisCenter;
float radius;
float4 backColor;

float4 PixelShaderFunction(float4 pos : SV_POSITION, float4 color1 : COLOR0, float2 coords: TEXCOORD0) : COLOR0
{
    float4 p = pos;
    float2 c = irisCenter;
    float r = radius;

    float alpha = abs(1 - step(pow(p.x - c.x, 2) + pow(p.y - c.y, 2), r * r));
    return float4(backColor.r, backColor.g, backColor.b, alpha * backColor.a);
}

technique Technique1
{
    pass Pass1
    {
        PixelShader = compile ps_3_0 PixelShaderFunction();
    }
}

The alpha variable should be deciding if a pixel is inside the circle and should be transparent, or if the pixel is outside the circle and shouldn't be. irisCenter, radius, and backColor are all set on each frame by:

public void Draw()
{
    if (isInitialized && (isRunning || dir == EffectDirection.Backward))
    {
        float r = color.R; // / 255f;
        float g = color.G; // / 255f;
        float b = color.B; // / 255f;
        float a = (color.A * currentFadeLevel); // / 255f;

        var irisEffect = GameServices.Effects["IrisEffect"];
        irisEffect.Parameters["irisCenter"].SetValue(irisCenter);
        irisEffect.Parameters["radius"].SetValue(irisRadius);
        irisEffect.Parameters["backColor"].SetValue(new Vector4(r, g, b, a));

        quadRenderer.Render(irisEffect);
    }
}

IrisEffect.cs

QuadRenderer.cs

Instead of behaving as an iris wipe, it first draws a full-screen rectangle for half the effect, and then a full-screen Color.CornflowerBlue rectangle (I guess the quad from QuadRenderer isn't drawing with transparency). I'm not sure what's wrong as I'm new to HLSL.

Question 1: How can I get the coordinates of the current pixel being processed by the shader?

Question 2: What am I doing wrong?

Question 3: How do I draw the rest of the quad transparently?

sentences:
How can I render an OpenGL scene into an ImGui window? The picture rapresents what i want to achieve.

I read, somewhere on the Internet, that you can render the fbo and pass that fbo as a texture to render into the ImGui window. The problem is that I don't even know what an FBO is, and how to create it. I just want to have the scene rendered into my ImGui window (just like the scene window in Unity)

How do i do it?

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:
Is there a way to start with OpenGL 3.0+ without need to write my own shaders? I'm starting with OpenGL and found out that after OpenGL 3.x you must write your own shaders (think it's obligatory). Am I right here?

I have made some research but I can't seem to find the answer.
If it's necessary to write the shaders for OpenGL 3 the I still can use 2.x right? Just because I'm just starting and OpenGL seems a little bit more level than I'm accustomed to. So I think I'll have a really hard time writing a shader myself.

P.S. My GPU only supports up to OpenGL 3.0. I think it's because of the drivers, I'm running a Linux distro that only has FLOSS (no proprietary software).

sentences:
Serializing nested ScriptableObjects with runtime changes I'm making an effort to use ScriptableObjects more in my game architecture, after watching a fantastic Unity Unite talk on the subject. The central idea is to use ScriptableObjects, during runtime, as a kind of pluggable, mutable global data container. It's intended to replace things like the singleton pattern in a more testable, less tightly-coupled way.
I'm not going to go into detail on the arguments in favor of this, but I do definitely recommend watching the talk.
When using this pattern, you'll probably run into data-container-style ScriptableObjects that you want to persist between play sessions. The problem I'm running into is that, when Unity's serializer is run on a ScriptableObject that references other ScriptableObjects, and those referenced ScriptableObjects have changed during runtime, the serializer ignores the changes on those sub-SOs.
Is there a good way to serialize nested SOs containing data that changes during runtime?

For some examples/more in-depth background:
In the game I'm working on, I'm emulating a file system that multiple otherwise-independent game objects are interested in. It looks somewhat like this:
public abstract class FilesystemObject : ScriptableObject
{
    public string FileName;
}

[CreateAssetMenu(fileName = "NewDirectory.asset", menuName = "Directory")]
public class FilesystemDirectory : FilesystemObject
{
    public List<FilesystemObject> Contents;
}

[CreateAssetMenu(fileName = "NewTextFile.asset", menuName = "Directory")]
public class FilesystemTextFile : FilesystemObject
{
    public string Contents;
}

In my project directory, I have a FilesystemDirectory asset file named FSRoot.asset that represents the root directory of the filesystem. It's populated with all the files that need to exist when the player first launches the game.
If a MonoBehaviour wants to read or write to this filesystem (say, an in-game text editor), all I have to do is expose a FilesystemDirectory field to Unity's serializer, and then hook FSRoot up to that field using the inspector. Then, during runtime, if the player creates, edits, or deletes any filesystem data, those manipulations are done directly on the FSRoot object. Any other MonoBehaviour with the same reference to FSRoot sees the same mutated data, since those changes persist in memory.
However, unless you're in the editor, those changes do not persist between sessions. You have to serialize and deserialize the data manually for that. However, when I serialize FSRoot using Unity's JsonUtility, it only captures changes that have happened to FSRoot directly, and not any changes in subdirectories/files inside FSRoot. Any files that were authored in edit time are completely unchanged.

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: How to keep player in the center of the screen but let him move to the edge of the map without moving camera there? In my rpg-styled (top-down perspective) 2d game, I want my player to be at the center of the screen, while the entire world moves, giving the effect of player movement. I can make that, but my problem is at the edges of the game-world, I want the world to stop moving and the player to move.

sentences:
Platform game: applying gravity and jumping I am making a 2D platform game in Java but I don't know how to apply gravity and jumping on my player and other living creatures in game that it looks natural and that it is physical correct.
I have formula: speed = v0 + gt^2/2
but i don't know how to implement it in my code...

Thanks for any help.

sentences:
Load destructible mesh at runtime Using the tutorial: Components and Collision as a guide, to dynamically load a SphereShape the following is done:

AClass::AClass()
{
    // Create USphereComponent
    USphereComponent *sphere = NULL;
    sphere = CreateDefaultSubobject<USphereComponent>(TEXT("Root"));
    sphere->InitSphereRadius(1.0f);
    sphere->SetCollisionProfileName(TEXT("PhysicsActor"));
    sphere->SetSimulatePhysics(true);
    sphere->WakeRigidBody();

    // Create UStaticMeshComponent
    UStaticMeshComponent *mesh = NULL;
    mesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
    mesh->SetupAttachment(RootComponent);

    // Load asset from filesystem
#define ASSET TEXT("/Game/MobileStarterContent/Shapes/Shape_Sphere.Shape_Sphere")
    static ConstructorHelpers::FObjectFinder<UStaticMesh> asset(ASSET);
#undef ASSET
    if (asset.Succeeded())
        mesh->SetStaticMesh(asset.Object);

    RootComponent = sphere;
}

Now, when I try the same set of steps, but this time for an Actor that has a UDestructibleComponent instead of a USphereComponent:

AClass::AClass()
{
    // Create our UDestructibleComponent
    UDestructibleComponent *destructible = NULL;
    destructible = CreateDefaultSubobject<UDestructibleComponent>(TEXT("Root"));
    destructible->SetCollisionEnabled(ECollisionEnabled::PhysicsOnly);
    destructible->SetSimulatePhysics(true);
    destructible->SetEnableGravity(false);
    destructible->WakeRigidBody(NAME_None);

    // Load asset from filesystem
#define ASSET TEXT("/Game/MobileStarterContent/Shapes/Shape_Cube_DM")
    static ConstructorHelpers::FObjectFinder<UDestructibleMesh> asset(ASSET);
#undef ASSET
    if (asset.Succeeded())
        UE_LOG(LogTemp, Warning, TEXT("It worked!"));

    RootComponent = destructible;
}

I receive the following errors:

ConstructorHelpers.h:105:20: error: cannot initialize a parameter of type 'UObject *' with an lvalue of type 'UDestructibleMesh *'
ValidateObject( Object, PathName, ObjectToFind );
                ^~~~~~

ConstructorHelpers.h:29:19: error: incomplete type 'UDestructibleMesh' named in nested name specifier
UClass* Class = T::StaticClass();
                ^~~

I've also tried adding .Shape_Cube_DM to the end of the string, similar to how the first asset was imported, but no luck. What is the correct way to load a DestructibleMesh from the filesystem and apply it to the UDestructibleComponent?

sentences:
Why does this impulse not affect the body? I'm just getting started with Box2d and I'm trying to apply an impulse to a circle but nothing really happens.

First I define ball:

BodyDef bodyDef = new BodyDef();
bodyDef.type = BodyDef.BodyType.DynamicBody;
bodyDef.position.set(camera.viewportWidth / 2, camera.viewportHeight / 2);
ball = world.createBody(bodyDef);
CircleShape dynamicCircle = new CircleShape();
dynamicCircle.setRadius(50f);
FixtureDef fixtureDef = new FixtureDef();
fixtureDef.shape = dynamicCircle;
fixtureDef.density = 0.5f;
fixtureDef.friction = 0.4f;
fixtureDef.restitution = 0.6f;
ball.createFixture(fixtureDef);
dynamicCircle.dispose();

then I call this line from inside my inputprocessor

public boolean touchDown(int screenX, int screenY, int pointer, int button) {
    Gdx.app.log("input", "touchDown");
    ball.applyLinearImpulse(new Vector2(0f, 5000f), ball.getPosition(), true);
    return true;
}

Here's the render method:

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

    debugRenderer.render(world, camera.combined);
    world.step(1 / 60f, 6, 2);
}

I tried logging this and can confirm the touchDown event is triggered, but the impulse never applies.

Am I forgetting some call to make this work? What might be going wrong?

sentences:
How to apply friction vector to acceleration in top-down 2D game? I'm making a top-down view 2D RPG game, meaning the player can move in any direction on a 2D plane, and I'm trying to implement a somewhat realistic non-orthogonal acceleration/friction physics model for movement.

For instance, if the player's acceleration value is "100", holding the right arrow key will change the player's "input force" vector to (100, 0). If holding both right + down, the force will be roughly(71, 71) since 712 + 712 ≈ 1002. This part is working correctly right now.

The function I'm currently using to update the position looks something like this (Note: I'm not a physics expert):

void GameEntity::updateSpritePos( const float timeStep )
{
  // Store old velocity.
  const Vec2D<float> curVel( m_v2Velocity );

  // Get force.
  Vec2D<float> force( m_v2InputForce );

  // Calculate friction.
  Vec2D<float> friction;
  if( curVel.getLength() < m_fFriction * timeStep ) // Make sure the friction doesn't overextend.
    friction = ( -curVel / timeStep );
  else
    friction = -curVel.getNormalized() * m_fFriction; // getNormalized() returns the unit vector.

  // Apply friction.
  force += friction;

  // Calculate acceleration.
  const Vec2D<float> accel( force ); // Since we're not taking mass into account, acceleration = resultant force.

  // Calculate new velocity based on acceleration.
  const Vec2D<float> newVel( curVel + ( accel * timeStep ) );

  // Calculate how much to move using "improved Euler" integration.
  const Vec2D<float> avgVel( ( curVel + newVel ) * 0.5f );
  const Vec2D<float> moveAmount( avgVel * timeStep );

  // Update variables.
  m_c2Position += moveAmount;
  m_v2Velocity = newVel;
  m_v2LastMoved = moveAmount; // Storing this for collision resolution.
}

Where m_fFriction is a constant float value that can be anywhere above 0.

The problem is the way that friction is being applied: If walking in a given direction and then simply letting go of the key, you will glide for the appropriate distance.

But if letting go of the key while also accelerating in a perpendicular direction at the same time, you will glide much further in the original direction. This is not the behavior I want, I want the player to always glide the same distance.

Since I'm currently doing this:

friction = -curVel.getNormalized() * m_fFriction;

Friction will always be applied in the opposite direction of the current velocity. I'm not sure if this is correct.

I could solve it by doing something like this:

if( curVel.x > 0.0f )
    friction.x = -m_fFriction;
else if( curVel.x < 0.0f )
    friction.x = m_fFriction;

if( curVel.y > 0.0f )
    friction.y = -m_fFriction;
else if( curVel.y < 0.0f )
    friction.y = m_fFriction;

But then it doesn't work right when walking in a non-orthogonal direction (i.e. diagonally). This is especially bad since I also want to implement joystick support in the future where the force will be applied in the exact direction you're holding the stick.

Is there an easy way to fix this that I have overlooked, or am I getting into deep water here?

Note: I don't want to change my code to use a fixed timestep for a number of reasons, and I don't want to use damping (e.g. vel *= 0.99timeStep) since this doesn't create linear deceleration (unless there's a way to make it do that).

sentences: How I can count how many time gameOver scene is loaded? I'm building a game using unity 3d and I want to add an interstitial ads to it, but I want it to appear after the player lost every 3 times. So when the player loses for the first time the ads will appear, and when he loses for the second and third time, nothing appears until he lost for fourth time.

sentences:
What is the best way to render eletric wires (like in gta 4)? From the top of my mind, I see 2 ways to do it :

classic mesh. (but that's likely to be a lot of tris for little screenspace)
bilboards (but the placements of the billboards may be tricky. still looks like the best solution)
a box with a shader (the parametric shape would be in the shader, seems tricky).

Any idea ?

refs :
Screenshot1
Screenshot2

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:
Not able to assign any scripts to my game object I am not able to assign a particular C# script to a game object. When I try to do so, I get this error as shown below Only the script I have is different.

In brief, just like the error above I am getting it as Can't Add Script Component 'AIWaypointNetwork' because the script class cannot be found. Make sure that there are no compile errors and that the file name and the class name match
And when I try to create a script component, I get the warning Associated Script cannot be loaded. Please fix compile errors and assign a valid script. Here is a screenshot of the situation.
As far as I know, I don't see anything wrong with the script and it's pretty simple too.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AIWaypointNetwork : MonoBehaviour
{
    public List<Transform> Waypoints = new List<Transform>();
}

The unity version that I am using right now is Version 2020.1.11f1 Personal. And I have not faced these types of errors before. Based on my search, I see that I would probably have to reimport assets over again. How do we do that in this version of unity?
Is there something else I am missing here?

sentences:
How to prevent tendencies to upper-left corner? In a 2D tile-based game I'm making, I have a loop that runs through each of the tiles to check and apply values.
One of the effects is intended to make a circle around itself, using a similar method. However, instead of making a circle (or a square, due to the shape of the map), it tends to smear towards the upper left corner.

In have tried running the loop in the reverse direction every other round, but oddly the effect persists.

I am wondering if there are any tips for preventing such a buildup.

edit:
here's the current code of the simulation system
http://pastebin.com/NsgK0SxP

sentences:
Directional light causes an FPS drop I have only one object in the scene and it is lit with a directional light. It uses the mobile/diffuse shader. The issue is that on iPhone 4 the FPS drops from ~42FPS to ~11FPS when the directional light is enabled. Rendering is set to forward rendering and there are no other light sources. Shadows are not enabled.

Scene stats give a total of five draw calls, 3k tris and 2.6k verts. Having a single directional light should not have that kind of effect on FPS. What could cause this FPS drop?

sentences:
How do I plot individual pixels using the XNA APIs? If I wanted to fill my game screen with individually coloured pixels, how would I do this?

For example, if I wanted to write a 'game of life'-type game where each pixel was a cell, how would I achieve this using XNA?

I've tried just calling SetData() on a Texture2D object using a screen-sized array of Color values, but it complains with:

You may not call SetData on a resource while
it is actively set on the GraphicsDevice.
Unset it from the device before calling SetData.

How do I do as it asks? Or better still... is there an alternative, better, efficient way to fill a screen with arbitrary pixels?

sentences:
2D Island generator algorithm - chances of tile becoming land I am developing my first island generator (in c#). I am using this algorithm as my basic idea :
http://www.funstormgames.com/blog/2012/09/procedural-island-generation-for-ludum-dare-24/

Basically you loop around the tiles in a spiral shape, adding land based on chances - the more land the current tile is touching, the more chances of this tile becoming land. However, I don't know how to work with the chances - whatever I put I am never satisfied with my result.

If you havent worked using this algorithm, you can't really help me with the numbers, but a recomendation for a new approach would be great!

I am using a function to determine each tile - passing an argument called potentialChance.
For the first "circle" or round around the starting island I put a 25 potential chance.

This potential chance was at first multiplied with the number of land tiles the current grid we are potentially changing into land is touching. So, if a grid has 3 surrounding tiles of land, its chance would be 75% (I generate a random number up to 100 and compare).

I was not satisfied with too many islands I got, and I was changing the potential chance while testing. So instead of multiplying the number of tiles with the potential chance - I tried a different approach.

I would have a quotient of ie 0.7, and for each surrounding land tile, I would multiply  the quotient by ie 1.5, and then multiply that number with the potential chance. Still, I was not too satisfied.

I know my algorithm works properly (I have debugged and seen the results), but my numbers are not too good.

If anyone worked with this same logarithm, I would love to see the approach and numbers! Otherwise, would you suggest working on a new algorithm? I'm new in game development so...

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:
HTML5 game obfuscation HTML5 games have viewable source code. Is there a way to make them like swf file?

How to hide the game algorithm?

What do you think of the Firefox JavaScript Deobfuscator Plugin and obfuscation?

sentences:
How to integrate PS3 & Xbox 360 games to Facebook? After some research online, I am unable to find any concrete references for how to go about implementing Facebook functionality from either Xbox 360 or PS3 games.  There is apparently some degree of integration, but how does one go about hooking into Facebook's API from within a console title?

Is there any How To documentation online?  Or alternatively, is anyone aware of a developer that specializes in incorporating this type of functionality in an existing codebase?

For an answer unaffected by NDA, does anyone know of a company that specializes in integrating PS3 or Xbox games with Facebook?

sentences:
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:
Tiled/TMX C++ Library/Parser Where can I find an easy to use and up to date C++ parser/library for the .tmx map format (used by the Tiled Map Editor) ?

EDIT: David's comment, 'Unless you want to build your game around the format of the parser..', got me thinking... So I have downloaded pugixml, which is an easy to use xml-parser with very straightforward documentation. Together with the spec for the TMX Map Format, I think I'll give it a try myself. I'll probably compare with Cocos2d-x's CCTMXTiledMap at some point.

sentences:
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:
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:
A problem with texture atlasing in Unity I have the texture below and I need to get rectangular parts from it. I could finally combine meshes of different quads to improve performance, but I with quads of different tilings, this means different materials, then combining meshes will fail.

Can anybody tell me how to have a part of that texture in C#? Such that all quads will be of the same material only then combining meshes passes.

Thanks in advance.

sentences:
Where to install game from my game launcher I've created a game launcher that I'm pretty proud of :). I use nw.js and so the interface uses html/javascript/css. It makes ajax api calls to my web service that I've written in C# to do things like register/login/news. I'm now looking at having my game launcher do the initial install of the actual game and updates.

My question is, where should the game be installed by default. I will allow them to change the location but what should the default game location be? This will be on Windows only at this time. My concern is that I've heard (and I don't know because I'm always admin on my PC) that you can run into issues if your game is in program files because of permissions.

Does anyone who has made a game launcher have experience around the downloading/copying/unzipping of game files in a game launcher?

sentences:
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:
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 do I procedurally generate rivers on a tilemap with thickness? I have read numerous articles on the subject but can find none that can explain to me how it is that procedural river generation achieves a certain amount of thickness to the river. I have managed to pice together that I must search for perpendicular vectors to the one I use to construct the river, but am not sure how that is implemented. I am working on a 2D game with tilemaps implemented and don't know how I iterate through the tiles to achieve the intended result.
I am fairly intermediate when it comes to game development and have just started proc-gen games. Please try to answer simply as to how to do this. I know that others have figured it out and want an answer.
How do I set the thickness of procedurally generated rivers?
EDIT
I am able to code simple straight lines and have access to an astar algorithm to connect two points together, but my river is literally one tile thick. I want to increase its size and I am not proficient in other programming languages enough yet to be able to read through source code.
The rivers I want just need thickness to them. I just need whatever technique others might use to produce rivers or roads thicker than a single tile.

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

sentences:
World Location issues with camera and particle I have a bit of a strange question, I am adapting the existing code base including the tile engine as per the book: XNA 4.0 Game Development by example by Kurt Jaegers, particularly the aspect that I am working on is the part about the 2D platformer in the last couple of chapters.

I am creating a platformer which has a scrolling screen (similar to an old school screen chase), I originally did not have any problems with this aspect as it is simply a case of updating the camera position on the X axis with game time, however I have since added a particle system to allow the players to fire weapons. This particle shot is updated via the world position, I have translated everything correctly in terms of the world position when the collisions are checked.

The crux of the problem is that the collisions only work once the screen is static, whilst the camera is moving to follow the player, the collisions are offset and are hitting blocks that are no longer there.

My collision for particles is as follows (There are two vertical and horizontal):

    protected override Vector2 horizontalCollisionTest(Vector2 moveAmount)
    {
        if (moveAmount.X == 0)
            return moveAmount;

        Rectangle afterMoveRect = CollisionRectangle;
        afterMoveRect.Offset((int)moveAmount.X, 0);
        Vector2 corner1, corner2;

        // new particle world alignment code.
        afterMoveRect = Camera.ScreenToWorld(afterMoveRect);
        // end.

        if (moveAmount.X < 0)
        {
            corner1 = new Vector2(afterMoveRect.Left,
                                  afterMoveRect.Top + 1);
            corner2 = new Vector2(afterMoveRect.Left,
                                  afterMoveRect.Bottom - 1);
        }
        else
        {
            corner1 = new Vector2(afterMoveRect.Right,
                                  afterMoveRect.Top + 1);
            corner2 = new Vector2(afterMoveRect.Right,
                                  afterMoveRect.Bottom - 1);
        }

        Vector2 mapCell1 = TileMap.GetCellByPixel(corner1);
        Vector2 mapCell2 = TileMap.GetCellByPixel(corner2);

        if (!TileMap.CellIsPassable(mapCell1) ||
            !TileMap.CellIsPassable(mapCell2))
        {
            moveAmount.X = 0;
            velocity.X = 0;
        }

        return moveAmount;
    }

And the camera is pretty much the same as the one in the book... with this added (as an early test).

    public static void Update(GameTime gameTime)
    {
        position.X += 1;
    }

sentences:
Impossible rooms in 3D games recently I was playing The Stanley Parable, and noticed that there are several impossible spaces in the game - in this example, a pair of pillars in the middle of the room, which from each side appear to open onto a long corridor between them, which would have to cut the room in two if it were present in the same space.

I hadn't seen this in a game since the Marathon Trilogy. The marathon games used a 2.5d engine that due to a quirk in its programming allowed for non-Euclidean geometry.  I was not aware it was even possible with fully 3D engines until I played The Stanley Parable. How does it work? how would I do that in Unity 5?

sentences:
Make character following another What's a solid way to have a character stuck to another one?

I have a moving character (say followed) and I want a second one (say follower) to follow the first without chance of getting stuck into obstacles.

I thought that I could save every delta velocity vector of the followed and having the follower consuming one each frame after it reached its target's starting position.

More to say, dynamic obstacles could be an issue.

Since this sounds to me like a common topic (despite the fact that I'm having difficulties in finding answers), is there anyone who could enlighten me on a proper way of facing the issue?

Edit:

Since I'd like to describe something more like to an edge case of a pathfinding algorithm, consider the following:

follower should always be at a fixed position related to followed
follower must not necessarily interact with the environment the way followed does

sentences:
Implementing a group formation behavior I am trying to implement a group formation behavior where all the units in my group follow a leader and maintain their position throughout. So far I am able to move them, rotate and follow the leader. I have also implemented character separation and obstacle avoidance behaviors for all my units and the leader. However I want all the units to maintain the same relative position to the leader throughout the behavior ie say for example if one of the unit falls far behind the group due to an obstacle in its path, it should converge back to the main group to its initial relative position so that the formation of the group is not broken and stays the same throughout

I have stored all my units in a list and offset them from the leader at the start of the game. But I want their offset position to be maintained  throughout each update in the game. I am not able to do that.

Below is my code so far

public List<GameObject> followersList = new List<GameObject>();

    void Start()
            {
               for (int i = 0; i < followersList.Count; i++ )
                {
                    if(i%2 == 0)
                      followersList[i].transform.position = new Vector3(gameObject.transform.position.x + (2 + i*2 ), gameObject.transform.position.y, gameObject.transform.position.z - (2 + (i*2 )));
                    else
                      followersList[i].transform.position = new Vector3(gameObject.transform.position.x - (2 + i*2), gameObject.transform.position.y, gameObject.transform.position.z -  (2 + (i*2 )));
                }
        }

    private void VShapeFlockWander()
        {
            Followers = GameObject.FindGameObjectsWithTag("follower");
            Wander(gameObject);
            foreach (GameObject Follower in Followers)
            {
                followerDirection = (gameObject.transform.position - Follower.transform.position).normalized;
                Vector3 normal = CheckFollowerCollisionAvoidance(Follower);
                Vector3 followerSepVector = CheckFollowerSeparation(Follower);
                followerSepVector.y = 0;
                followerDirection += (normal + followerSepVector);
                Quaternion rot = Quaternion.LookRotation(followerDirection);
                Follower.transform.rotation = Quaternion.Slerp(Follower.transform.rotation, rot, Time.deltaTime * 3.0f);
                Follower.transform.position += (Follower.transform.forward * Time.deltaTime * acceleration);
                if (acceleration < vShapeWanderSpeed)
                {
                    acceleration += 0.01f;
                }
            }
        }

in the code above all the followers represent the units and the gameObject is the target leader to follow. All the other behaviors like separation and collision avoidance are working fine. Only thing I want to achieve now is for all the followers to maintain their relative position to the leader throughout.

I tried using a Dictionary for each follower as key and its initial difference to the target as the value. Then somehow use that difference factor and make them move in a stable formation but I cannot get it to work either

sentences:
Make gameObject “stick” to another gameObject after it has collided with it? Currently, I am using the following code to make objects stick to other gameObjects.

rb = GetComponent<Rigidbody>();
rb.isKinematic = true;
gameObject.transform.SetParent (col.gameObject.transform);

It works perfectly, but it causes many other problems... For example, after colliding, it can no longer detect collisions... Is there an alternative to this code (which makes a gameObject stick to another one after collision)?

sentences:
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:
how to re-use a sprite in cocos2d-x some times it takes time to create the sprite structures in the scene, I might need to setup structures inside this sprite to meet requirement, thus I would hope to reuse such structures with the game again and again.

I tried that, remove the child from parent, detach it from parent , clean parent with the sprite. but when I try to add the sprite to another scene, it's just wont pass the assertion that the sprite already have parent

did I miss some step ?

add an example:

I have a sprite A which involves of quite a few steps to construct, so I used it in scene A layer A, and then I want to use it in scene A layer B, scene B layer A1  etc..... generally speaking I don't want to reconstruct the sprte again.

sentences:
How are 2D transformation matrices applied to their targets? I understand mathematically how transformation matrices work, in that a transformation matrix multiplied by a vector results in a new vector, and we use the matrices for rotation, translation, etc. I also understand that in 3D, the transformation matrices are applied to every vertex of each model in order to transform them, although that's basically the extent of my understanding vis-a-vis 3D transforms, and maybe even that understanding is a little wrong/simplistic.

However, many game engines/graphics rending libraries are designed with the intention of rendering 2D graphics (ex: Flash, XNA, SDL, Allegro), although I know at least some of them are really 3D under the hood. These engines allow the programmer to use transformation matrices to manipulate 2D entities, to do something like implementing a camera, for example. But I don't understand what the transformation matrices I'm plugging in to the engine are being multiplied by in order to perform the transformation. For a while I assumed it was applying the transformation matrix to each pixel of the original image, but that doesn't seem right to me.

So what vectors are the transformation matrices being multiplied by in the 2D transformations? Was I right, and it's really a per-pixel operation? Or does it do some kind of 3D magic under the hood?

sentences:
Screen Capture rendered on a RenderTexture in Unity I have a pretty wild idea for a unity application that would work on a multi-display setup.

The app would be running in full screen mode on one of my displays, and the contents of the remaining two displays should be rendered in-game on a texture.

I've seen RTMP clients for unity and I've tried streaming my desktop with OBS to a local RTMP server but the delay was too big (more than 5 seconds). I would prefer an instant (or very low delay) solution for mirroring my displays on textures in Unity.

If anyone can help me solve this, i would appreciate it!

sentences:
Unity3d - zooming with orthogonal camera like in Google maps I am implementing 2d orthogonal zoom.

As far as I know - in Unity3d there are no translations like in OpenGL.
Taking this into consideration, I work with :

camera size
camera position (center)
real world mouse position

I have no issues implementing simple zoom in/ zoom out operations, combined with camera position changes ( drag'n'drop )

But I have some issues calculating camera zoom shift in this case :

camera size = (4,4)
camera position = (0,0)
real world mouse position = (1,0)

A double zoom in (2x) is applied, as a result -

camera size = (2,2)
camera position = (0.5,0)
real world mouse position = (1,0)

User shifts real mouse position to (1.5,0) and applies a double zoom out ( 0.5 ). In this case :

camera size is again (4,4)
camera position = ???????
real world mouse position = (1.5,0)

What should be the camera shift so the mouse doesn't visually move ?
What is the formula for calculation in this case ?

Thank you in advance.

P.S. Any suggestion regarding current method of handling zoom are welcome

Update

So - I resolved this issue with Blue's help. The basic idea about shifting is right. The main reason it didn't work was incorrect zoom factor.

Example :

Initial camera size is 5. User zooms in by 1, camera size is now 4 ( it displays less content on the same 'screen'). User changes mouse position and zooms out by 1. Camera size is 5 again, but the amount of zoom is actually different :

initially the change was 20% ( 1/5 )
in the second time, the change was 25% ( 1/4 )

My fault was that, when zooming out, I tried to restore position by 20%, not 25%.

sentences:
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:
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:
Peculiar problem rendering specific triangles I've encountered a strange problem with a peculiar [not quite] solution. This problem is that certain polygons aren't rendered unless I run 'fraps'. Needless to say, I would much rather my program to run without 3rd party programs. So I was wondering what part of my directx 11 code would be the cause of this.

Thanks in advance, please ask for code fragments if they're needed!

sentences:
CS:GO workshop awp skin scrambles I was starting make my awp skin, but I was wondering that my skin at CS:GO looks bit different than on photoshop. So I came here for help. I will show just a test skin (fully red).

First I was save my skin with photoshop to .tga format (32 bits/pixel).

Then importing to VTF editor, but not changing any of these settings, they are default.

After that I checked only "No Level Of Detail", "No Mipmap" and "SRGB".

Opening CS:GO and workshop, awp is not fully red, there is some scrambles.

I hope for solution. :)

sentences:
How to make MathNet.Numerics work with Unity? I have installed the latest version of MathNet on Visual Studio using the NuGet Package Manager. I've also, copied the MathNet.Numerics.dll to an Plugins folder in the Unity editor. Yet it still gives a compiler error: error CS0234: The type or namespace name 'Distributions' does not exist in the namespace 'MathNet.Numerics' (are you missing an assembly reference?)

Does anyone know how to solve this or knows a similar package that works with Unity?

sentences:
Real time data retrieval - database vs file system I'm planning to develop a game in which I want to draw 3d models in real time using some given x,y,z coordinates. The coordinates will be given at an average of 30 coordinates per second. Drawing will happen maximum of 15 seconds (450 coordinate sets)

For faster retrieval what, is the most efficient way of retrieving data? Is it storing in file system (storing coordinates in a text file etc.) or storing the coordinates in a database (SQL).

sentences:
can't make my unity character move so I'm starting with Unity , I followed the john lemon tutorial , and I wanted to apply what I learn on a model on my own coming from blender.
Everythings works , animation , rotation , but not translation . For some reasons my character doesn't move at all .
It might have to do something with root motion since I have apply root motion in grey with written just after "handled by script" . Not sure what to do ..
I found something about character in place,  I think I'm in this case but I'm not sure how to use it in my script ..
https://docs.unity3d.com/Manual/ScriptingRootMotion.html

If you ask I'll give you my project .

EDIT :

ok so I made some advances :

 void OnAnimatorMove()
{
        m_Rigidbody.MovePosition(m_Rigidbody.position + m_Movement * m_Animator.deltaPosition.magnitude * 10000);
        m_Rigidbody.MoveRotation(m_Rotation);
        Debug.Log("m_Animator.deltaPosition.magnitude: " + m_Animator.deltaPosition.magnitude);

}

m_Animator.deltaPosition.magnitude is actually always equal to 0 , explaining why my charachter doesn't translate but why is it always equal to zero ?

sentences: On 3d ripper DX and other 3d asset tools that can help boost 3d artists learning Aside from 3d ripper DX does anyone know any other 3d asset tools to help 3d artist in learning modelling and/or animations.

sentences:
Why is it difficult to port games from consoles to PC? PC ports of console games often come out a month or two later. Why is this?

Games are written in languages that compile on PCs too, so the game logic should compile without issue. What's holding them back then? Is it rendering code or what?

sentences:
Body lost a velocity component when hitting a wall I am creating a Breakout game using Box2D (of LibGdx if anyone interest). Everything works well until when the ball hits the wall when moving with a very small angle. Please look at the image for details:

I tried to set the wall friction to 0 and restitution to 1, as well as the ball's friction and restitution, but it still move along the wall (I have no World Gravity). This also happens to the vertical wall if the angle is small enough, it will lose X velocity.

How can I move the ball the way I expected? If there is no friction, what caused the problem?

EDIT: In case of LibGdx only, this is a fix:

World.setVelocityThreshold(float threshold);

I set it to 0.1f, and it helped. If you encounter problem, maybe 0 can help, but it is unrecommended..

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:
How would you generate details like trees, water or caves in a 2D terrain? Yesterday I made a post about generating a 2D planet, which resulted in this:

I did it by subtracting a radial gradient from simplex noise (explained in my other post).

Now of course thats a bit boring, what technique should I use to add details like trees, lakes or caves? Would be able to do something like this (but of course across the whole planet):

I know doing it on a planet would make it a bit harder, because you would have to know if f.E. the tree is on the north of the planet or the south. To make it easier, if you want, just assume a flat 2D surface like this:

sentences:
Ray Triangle Intersection issue I'm trying to perform ray triangle intersection on a mesh made of triangles. The below code seems to work fine but only about 50% of the time. The ray often gets into positions where no intersection is detected when there definitely should be. Is there something wrong in my function that isn't checking for intersection under all circumstances.

bool rayTriangleIntersect(Vector3 rayOrigin,
                          Vector3 rayDirection,
                          Vector3 vert0,
                          Vector3 vert1,
                          Vector3 vert2,
                          ref Vector3 intersectionPosition)
{
    // this originally comes from http://www.graphics.cornell.edu/pubs/1997/MT97.pdf

     float u, v, t, det, inv_det;
     Vector3 edge1, edge2, pvec, tvec, qvec;

    Vector3 direction = rayDirection;
    direction.Normalize();
    t = v = u = 0f;
    edge1 = vert1 - vert0;
    edge2 = vert2 - vert0;
    pvec = Vector3.Cross(direction, edge2);
    det = Vector3.Dot(edge1, pvec);

    if (det > -0.00001f)
        return false;

    inv_det = 1.0f / det;
    tvec = rayOrigin - vert0;
    u = Vector3.Dot(tvec, pvec) * inv_det;

    if (u < -0.001f || u > 1.001f)
        return false;

    qvec = Vector3.Cross(tvec, edge1);
    v = Vector3.Dot(direction, qvec) * inv_det;

    if (v < -0.001f || u + v > 1.001f)
        return false;

    t = Vector3.Dot(edge2, qvec) * inv_det;

    float rayMagnitude = rayDirection.magnitude;

    if (t <= 0f || t >= rayMagnitude)
        return false;

    intersectionPosition = rayOrigin + (rayDirection * (t / rayMagnitude)); // percent along ray

    return true;
}

and im calling it with

for (z = 0; z < LENGTH - 1; z++)
{
     for (x = 0; x < WIDTH - 1; x++)
     {
           v0 = verts[(z * WIDTH) + x];
           v1 = verts[((z + 1) * WIDTH) + x];
           v2 = verts[(z * WIDTH) + x + 1];
           v3 = verts[((z + 1) * WIDTH) + x + 1];

           if(rayTriangleIntersect(rayOrigin, rayDirection, v0, v1, v2, ref intersectPosition) ||
              rayTriangleIntersect(rayOrigin, rayDirection, v1, v2, v3, ref intersectPosition))
           {
                 Debug.log(Intersection found at : " intersectPosition);
           }
    }
}

I'm really stuck on this one so any guidance would really be appreciated.

Edit

The triangle are defined like this:

 for (z = 0; z < LENGTH - 1; z++)
   {
        for (x = 0; x < WIDTH - 1; x++)
        {
            triangles[index++] = (z * WIDTH) + x;
            triangles[index++] = ((z + 1) * WIDTH) + x;
            triangles[index++] = (z * WIDTH) + x + 1;

            triangles[index++] = ((z + 1) * WIDTH) + x;
            triangles[index++] = ((z + 1) * WIDTH) + x + 1;
            triangles[index++] = (z * WIDTH) + x + 1;
        }
    }

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:
Spriterenderer on top of canvases I have two canvases. One with a background image and one with all overlaying elements like texts and such.

The background canvas has an order of 0, the overlay canvas of 1.

Now, I'd like to create an animating sprite on top of those canvases but I can't for the life of me get the sprite on top of the other images.

I can see the sprite being on top on the stage, but when I switch to gameview, it's gone! There are no scripts attached to the sprite. Only an animator(Which works fine when I play it).

Note:

My canvases have a render mode of
Screen space - Overlay.
I've set the spriterenderer on
Sorting Layer 9, order 300. Although
it's  the only sprite out there.
layer 1 or order 1 didn't do anything
different, though.
The other elements in the canvases are either UI texts or Images
All the elements in the canvases are on either BackgroundLayer or OverlayLayer
The canvases themselves are on the UI layer

sentences:
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:
Is there a game oriented graphics or image editor? I remember looking a few times over the years for an alternative to Photoshop for editing images. I've tried using Gimp too, and that's also not quite sufficient. There are some problems that have only been solvable by breaking out into an asset compiling stage. For example, none of the graphics packages come with premultiplied alpha options, and none come boxed with previews of what the image will look like once it's been compressed for hardware. I've never come across a package that lets you modify the diffuse, specular, ambient and normal maps all at the same time with the same tools.

Is there an image manipulation package out there that can satisfy things like this, allow for textures that have more than just 4 channels, export with preview to final format, maybe even rendering them in some coherent way?

items on the wishlist include:

batch conversion
scriptable pixel shader/transform
view diffuse+alpha over a background / allow alpha2coverage preview
render depth mapping via height or normal map
show mip-maps and allow editing them

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:
Unity is reimporting everything! How do I stop that? I have a relatively large project (about 8GB) and it is constantly reimporting itself over and over, to the point that I spend 80% of my time waiting for Unity to:

Reimport everything
Stop hanging.

Even for the smallest of changes (ie. removal of a comment on one line in a script), or changing import settings on an asset can cause these long hangs and reimports.
To make matters worse, this project is also synced over UnityCollabBETA, which throws manual/selective import (auto-refresh is forced on) out the window.
I've also read up that other programs locking asset files (to read them) can also cause Unity to reimport everything as opposed to simply doing a selective import (only reimporting things that has been changed).
I've tried creating blacklists for my auto-backup programs, anti-viruses and anything that would snoop around and/or mess with the Unity Project folders. However, despite those programs not accessing anything, Unity still reimports the whole project every time I alt-tab out.
The only workaround I've found so far is to just kill Unity every time it does it and relaunch it as for some reason it processes the actual changed files first, then hangs itself by going through everything else.
It is also worth noting that I/O is maxed up by Unity (due to the sheer size of the project) and CPU/GPU usage are relatively low (does not exceed 20-30%, assuming nothing else is running in the background).
Note: This has persisted through installs and computers.

Question
How do I stop Unity from reimporting everything without constantly killing Unity?

sentences:
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:
How to propagate component updates? (Changing components at runtime) Whenever an entity is being added to an entity controller (which is essentially just a bag of entities), I scan through it's components to figure out if I need to register additional entity processors (game systems). For instance, if I add an entity which has a SpriteComponent attached to it for the first time, the EntityController resolves the e.g. SpriteRenderSystem using a factory and a simple specification, which is then being registered within the controller.

Now I'd like to make it possible to figure out whether the component of an entity has changed. I was suggested in off-topic discussion elsewhere that I should use an eventing system to raise component change events in order to have the entity rescanned.

However this has two problems, I think:

The entity, which was a simple component bag beforehand, now holds a dependency to a event bus.
An event bus traditionally raises global fire-and-forget events. My entitiy controllers are the base of scenes (individual game states to activate/deactivate entities together) - and there can be many scenes active at once. When a component changed event fires, then I ask myself: In which entity controller is the affected entity? Scanning all controllers for whether they contain the entity sounds expensive.

Another option would simply make the entity aware of the entity controllers in order to signal "Hey, I have changed!". However should an entity know where it's currently attached to?

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:
C++ OpenGL Game Timer Possible Duplicate:
  Tips for writing the main game loop?

I am attempting to make a game using OpenGL and C++ but i haven't been able to find any good tutorials..or anything that could assist me in setting up my main game loop with some kind of timer/tick system...i would prefer to use as little external libraries as possible...i am using Win32
any help would be appreciated

sentences:
Multiplatform GLSL shader validator? Im working on a multiplatform (Pc,Mac,Linux) game that uses shaders quite extensively. Since we do not have any funding, it is pretty hard to test our game on all possible hardware configurations.

While our engine seems to run fine on different platforms, its usually the slight differences in GLSL compiling that gives us headaches. We have things set up such that we can test the shaders on Ati/Nvidia cards, but since the new Macbooks have Intel graphics, I'm really looking for a tool that can simply validate my GLSL shaders for different hardware without the need of yet another system.

Does anyone know such a tool?

sentences:
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:
problem with git on a unity project I tried to version control my project folder with git. When it came to pull the project from the repository, though, something went wrong: apparently scripts are missing and the prefabs and kind of all the graphical elements appear to be pinkish. Does anybody know how to fix this?

This is the .gitignore I'm using at the moment:

Temp/
Obj/
UnityGenerated/
Library/

ExportedObj/
*.svd
*.userprefs
*.csproj
*.pidb
*.suo
*.sln
*.user
*.unityproj
*.booproj

.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db

Thanks in advance.

sentences:
Phong: Real-time rendering of Metal and Plastic Materials Using a shader that works like Phong, what would be the difference between painted Metal and plastic?

I seem to remember reading in books that I no longer have access to, the following:

Specular color for painted metal is same color as the paint.
Specular color for plastic is always white.
Ambient for metal should be darker than for plastic.

This also seems to correlate with what I see when I observe objects (in real world)

But I tried to verify this also by checking the Internet, and found conflicting versions, some said the complete opposite.

So what is true?

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:
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:
3D Location Handling I am thinking about making a simulator type game that will involve having lots of small objects in a 3D space.  What is the typical solution for handling these objects?  The first thing that comes to mind is a 3D Array, but I can't help but think there is a more efficient solution.  Another idea that comes to mind is objects having possession of smaller items. For example a House possesses a Table which possesses a Cup and Bowl.

The final way I can think of handling this is just having an array of "objects" that each have an x, y, z value.  While this would make storing them easy I do not understand how you would detect collisions without just looking at every possible object and checking to see if it is in the way.

Are there other ways of holding onto these objects that is more efficient?

Edit: Following up with the comments below, are there typical thread-safe ways of implementing these structures in Java?

sentences:
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:
Lost transparency in SDL surfaces drawn manually I want to create SDL_Surface objects for each layer of my 2d tile-based map so that I have to render only one surface per layer rather than too many tiles. With normal tiles which do not have transparent areas this works well, however I am not able to create a SDL_Surface with transparent pixels everywhere to be able to draw some tiles on specific parts which should be visible (I do NOT want the whole surface to appear with a specific opacity - I want to create overlaying tiles where one can look through).

Currently I am creating my layers like this to draw with SDL_BlitSurface on them:

SDL_Surface* layer =
    SDL_CreateRGBSurface(
        SDL_HWSURFACE | SDL_SRCALPHA,
        layerWidth, layerHeight, 32, 0, 0, 0, 0);

If you have a look at this screenshot I have provided here

you can see that the bottom layer with no transparent parts gets rendered correctly. However the overlay with the tree tile (which is transparent in the top left corner) is drawn own its own surface which is black and not transparent as expected. The expected result (concerning the transparency) can be seen here

Can anyone explain me how to handle surfaces which are actually transparent rather than drawing all my overlay tiles separately?

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:
Fast, simple procedural 2d island generation I need to generate tile data for an island based rpg, my goal is have something that looks like this (mountains not required):

For the past few days I have been trying to figure out a satisfactory way to generate tile data that will give me varied and natural islands, such as in the example above.

I've tried using Unity's Mathf.PerlinNoise but the results are far too random, and I can't see a way to get it to generate a single island.

Using LibNoise I was able to get slightly better results, although the generation seems to be significantly slower and perhaps better suited to 3d terrain. Similarly however, I can't see a way to set the Octaves/Frequency/etc, so that I get a nice single island each time.

While there are a fair amount of resources online for perlin/noise in general, it mostly seems to be aimed at 3d terrain and height, where I simply have a 2d array of int for my tile data, that maps to either water, sand or grass and needs to be generated in such a way that sand/grass are grouped together logically to form an island.

Any help would be greatly appreciated!

sentences:
FBO blit depth buffer to screen? I have an FBO in a deferred 4.3 OpenGL renderer, in which I setup the depth buffer of that FBO like this:

GLCALL(glGenRenderbuffers(1, &mDepthbuffer));
GLCALL(glBindRenderbuffer(GL_RENDERBUFFER, mDepthbuffer));
GLCALL(glRenderbufferStorageMultisample(GL_RENDERBUFFER, 0, GL_DEPTH32F_STENCIL8, windowWidth, windowHeight));
GLCALL(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, mDepthbuffer));
GLCALL(glBindRenderbuffer(GL_RENDERBUFFER, 0));

Normally when I debug I can output the color attachments to screen easily, like this for normals:

GLCALL(glReadBuffer(GBuffer::GBUFFER_COLOR_ATTACHMENT_NORMAL));
GLCALL(glBlitFramebuffer(0, 0, mWindowWidth, mWindowHeight, 0, 0, mWindowWidth, mWindowHeight, GL_COLOR_BUFFER_BIT, GL_LINEAR));

But how can I do the same for the depth buffer contents, as it is not a color buffer?

sentences:
Should frame rate affect the speed in a game engine? I am writing a 2D game engine for fun. I am able to perform animation using the engine. However, if I change the frame rate (frames per second) the speed of the animation changes.

I have never used any game engine. I want to know whether other game engines handle this issue or not. If not, what is the ideal frame rate for a 2D game?

sentences:
Have the character automatically slide around obstacle corners Like this:

The player is only holding right, however the character still moves up a bit to go around an obstacle.

My current collision system has access to:

The entity's previous position
The entity's current position
The entity's (axis-aligned) bounding box
All the obstacles and their (also axis-aligned) bounding boxes

Also it proccesses each axis separatelly.

How can I implement this?

sentences: 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:
In an asynchronous server environment where player input and timed events modify data is using an in-memory array problematic? So let's say I have a server running on node.js, and there is an array of player objects...

At an interval, all of these player objects are looped and processed for events and changes that are based on time, such as fuel or food consumption and movement.

However players can also trigger things from the client that could modify player data as well.

Now what I'm trying to determine is if I am going to run into any problems with timing, such as if we are mid loop and somebody changes something and it throws some other calculation off balance.

Will I need to implement some kind of locking mechanism I can use as needed or is there a better way to hold this data in memory?

sentences:
how to calculate intersection time and place of multiple moving arcs I have rocks orbiting moons, moons orbiting planets, planets orbiting suns, and suns orbiting black holes, and the current system could have many many layers of orbitage.

the position of any object is a function of time and relative to the object it orbits.
(so far so good).

now I want to know for a given 2 objects(A,B), a start time and a speed, how can I work out the when and where to go. I can work out where A and B is given a time.
so i just need.

1: direction to travel in from A to B(remember B is moving(not in a straight line))
2: Time to get to b in a straight line.

travel must be in a straight line with the shortest possible distance.

as an extension to this question, how will i know if its better to wait, EG is it faster to stay on object A and wait for a hour when the objects may be closer, than to set off from A to B at the start.

Cheers, it hurt my brain.

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

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

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

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

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

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

    //Set the default track
    track = outsideTrack

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

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

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

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

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

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

sentences:
Sprite won't travel properly to a point I am creating a game in which I would like the player to be able to click a location and have the character travel to it. This is the code I am trying to use for this:

if (Mouse.GetState().LeftButton == ButtonState.Pressed && prevMouse == ButtonState.Released)
{
    travelTo = new Point(Mouse.GetState().X, Mouse.GetState().Y);
}
if (travelTo.X >= 0 && travelTo.Y >= 0)
{
    if (Bounds.Y < travelTo.Y)        {
        if (Bounds.X < travelTo.X)
            destRadians = MathHelper.ToRadians((float)Math.Atan((Bounds.Y - travelTo.Y) / (Bounds.X - travelTo.X)));
        else if (Bounds.X > travelTo.X)
            destRadians = 90 + MathHelper.ToRadians((float)Math.Atan((Bounds.X - travelTo.X) / (Bounds.Y - travelTo.Y)));
        else if (Bounds.X == travelTo.X)
            destRadians = MathHelper.ToRadians(90);
    }
    else if (Bounds.Y < travelTo.Y)
    {
        if (Bounds.X < travelTo.X)
            destRadians = MathHelper.ToRadians(-1 * (float)(Math.Atan((Bounds.Y - travelTo.Y) / (Bounds.X - travelTo.X))));
        else if (Bounds.X > travelTo.X)
            destRadians = 180 - MathHelper.ToRadians((float)(Math.Atan((Bounds.Y - travelTo.Y) / (Bounds.X - travelTo.X))));
        else if (Bounds.X == travelTo.Y)
            destRadians = MathHelper.ToRadians(-90);
    }
    else if (Bounds.Y == travelTo.Y)
    {
        if (Bounds.X < travelTo.X)
            destRadians = MathHelper.ToRadians(0);
        else if (Bounds.X > travelTo.X)
            destRadians = MathHelper.ToRadians(180);
        else if (Bounds.X == travelTo.X)
            travelTo = new Point(-1, -1);
    }

    //turn the sprite
    if (radians < destRadians)
    {
        radians += .06f;
    }
    else if (radians > destRadians)
    {
        radians -= .06f;
    }

    //move sprite
    Bounds.Offset((int)(2.5f * (float)(Math.Cos(radians))), (int)(2.5f * (float)(Math.Sin(radians))));

    //remove the destination if the player is close enough
    if (Bounds.Intersects(new Rectangle(travelTo.X, travelTo.Y, 1, 1)))
        travelTo = new Point(-1, -1);
}

What I want to happen is for the sprite to do two things each game loop: Turn toward the destination a little if it is not already pointed there, and move forward a little.

Right now what happens is this:

When the destination is above the sprite, it continually moves straight across the screen to the right (0 radians).

When the destination is below and to the left of the sprite, it turns around in a continuous circle.

When the destination is below and to the right, the sprite travels straight accross to the right until it is directly above the destination, then turns and proceeds down in a series of semicircles until it reaches the destination point.

sentences:
How to Interpolate between two game states? What is the best pattern to create a system that all the objects positions to be interpolated between two update states?

The update will always run at the same frequency, but I want to be able to render at any FPS. So the rendering will be as smooth as possible no matter the frames per second, whether its lower, or higher than the update frequency.

I would want to update 1 frame into the future interpolate from the current frame to the future frame. This answer has a link that talks about doing this:

Semi-fixed or Fully-fixed timestep?

Edit: How could I also use the last and current speed in the interpolation? For example with just linear interpolation, it will move at the same speed between positions. I need a way to have it interpolate the position between the two points, but take into consideration the speed at each points for the interpolation. It would be helpful for low rate simulations like particle effects.

sentences:
Help understanding Simplex Noise Introduction

This is less of a "how to" on using 2D simplex noise and more of a quest to understand what is happening both in the math and visually. I would rather not copy and paste the code I've found. I really would like to understand it.

I have done my homework on the subject and have read through Stefan Gustavson's paper and other sources many times. I feel like I understand about 70% of what my sources are saying, but when I try to manually follow my code loop through to check my understanding I either get hung up on what the variables represent or the math just doesn't add up.

I have begun to rename the variables in the code I've found in order to better understand what's going on. If someone with some knowledge of what is actually happening can cross reference the original code (basically Gustavson's code) with my code that would be most excellent. I'm not actually done with renaming the variables though, partly because I'm stuck.

My Understanding

Let's say I pass pixel (2, 3) into my noise function. At this point I'm working with a normal grid and my goal is to translate this normal grid into a simplex. This simplex is in the form of many triangles since we're working in 2D and supposedly this is better for various reasons.

To translate this point from the normal grid to the simplex grid, I must scale the point along the main diagonal line. After doing that, I apparently don't care about the decimals because I then Floor the results putting it back near the closest previous grid point.

Now I'm going to align the simplex cell to the normal grid by unskewing the simplex cell. Why I do all this work to get to the simplex cell, then undo it I'm pretty hazy on. Seriously, I think the best way for me to understand this is if someone could whiteboard out in steps what the heck is going on here. Super lost.

I didn't walk away empty handed though. I now have what I believe to be the distance between the original grid point I passed in and the simplex point I translated from that original grid point. Woo.

I think I'll stop here for now, just because I don't want this to turn into a huge wall of text. I'm pretty sure the rest of this will click once I understand the the beginning part.

Weird Math

Using the (2, 3) point from earlier, this is what I get by stepping through my own code on paper:

x = 2
y = 3

skewfactor = 1.830
unskewFactor = 1.479
unskewed_x = 1.520
unskewed_y = 2.520
simplexCell_i = 3
simplexCell_j = 4
x_distance0 = -1.520
y_distance0 = -1.520
i1 = 0
j1 = 1
x1 = -1.309
y1 = -2.309
x2 = -2.5207
y2 = -2.5207
ii = no idea why this isn't i2 or something like that. No idea what this is.
jj = same

Not sure if plotting on a graph would work, but I tried and it looks so bad. I used the original parameters (2, 3), simplexCell_i & j, i1, j1, x1, y1, x2, and y2. Doesn't make any sense visually.

Not just visually, but mathematically as well. What's with (2, 3) returning negative numbers that go off the chart? What am I doing wrong here?

sentences:
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:
Unity Asset Store Tools Problem So I downloaded Asset Store Tools in the Unity Asset Store. When I upload my asset to my package, I get this popup:

  Wrong project path The path selected must be inside the currently active project. Note that the AssetStoreTools folder is removed
  automatically before the package enters the asset store.

My Unity is version 5.4.0b25. I've tried other assets and reinstalled Unity, I still get the same popup.

Screenshot:

sentences:
Where should the collision response/resolution code go? I've got a collision response/resolution function that does the same for any pair of two entities. It's is in the World class right now.

But right before that function is invoked, I have some entity-specific logic:

A specific pair of entities should never have their collisions resolved (this is literally to keep the player from hitting itself with a carried object)
When two specific entities collide, an event should be triggered

Because of this, I'm starting to wonder if I should move the collision resolution function as a method into Entity, that'd allow me to use polymorphism. However, this sound very messy to me: If both entities involved in a collision can resolve it, how can I figure out which one should do it?

Is there another way to move these special cases out of World?

sentences:
How do I pause and resume a game in ActionScript 2? I'm making a game where the player must avoid random falling objects. I dont know how to implement pausing. I've been stuck on this for 2 days!

I tried using gotoAndPlay and such, but the objects continue to run in the background. When I resume the game, they're still falling and it seems like the frame resets and loads new random falling objects.

(Simple English would be appreciated; English isn't my mother tongue.)

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:
What causes still objects have lines in them when lighting is being changed? First, here is what I'm talking about (I changed the contrast to make it more visable, since it's not really visible in still images):

Ingore the chat box, I was spamming buttons to see which one took a screenshot :P

Hopefully you can see clearly what I'm talking about. Basically, those lines in the sky (they're only visible in the top part of the image). This seems to occur for me any time I use a still object and move lighting across it (the faster the light, the more the lines are visible to the player). What causes this? It seems to happen in lots of games though (especially in the sky, since it's pretty much still). Is there any way to remove them (I'm not looking for API specific because it seems to occur in all APIs)?

sentences:
For loop not detecting Actors in draw method. (libGDX) Question: In my code, I want to draw my actors through a For Loop. However the for loop doesn't seem to detect the addActor() call or even other libGDX calls.

Code:

package com.puzzlepieces.jjstudios;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.scenes.scene2d.ui.Table;

import java.util.Random;

public class Box extends Table

{
    Texture box = new Texture(Gdx.files.internal("box.png"));
    Random rand = new Random();
    Texture test = new Texture("bomb.png");

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

        batch.draw(box, 400, 90, 900, 600);

        this.setBounds(400 , 90, 900, 600);
        this.addActor(new Bomb());

        this.setDebug(true);

        for (int i = 0; i>5; i++)
        {
            for (int a = 0; a > 9; a++)
            {
                int randomNo = rand.nextInt(2);  // Sets random value
                int est = 0;

                if (randomNo == 0)
                {
                    this.addActor(new Bomb());   //Spawns bomb if value 0
                }
                else if (randomNo == 1)
                {
                    this.addActor(new FireCracker());  //Spawns FireCracker if value 1
                }
                else if (randomNo == 2)
                {
                    this.addActor(new SteeringWheel());  //Spawns SteeringWheel if value is 2
                }
                else if (est == 1)
                {
                    batch.draw(test, 400, 90);
                }
            }
            this.row();
        }
    }
}

Please help me and sorry if I made some mistakes in my post as I'm a newbie

sentences:
2D Parallax Scrolling I'm trying to implement parallax scrolling and have a partially working equation (from a book I've read) but it doesn't fully align to the screen.  I also want to stick purely to integer maths.  I've played around with it a lot and tried alternate approaches but can't get it right.

Unfortunately the book doesn't go into detail of how the maths is supposed to work it just glosses over it.

The calculation is:

x * (screenWidth - layerWidth) / (screenWidth - playfieldWidth)

Variables I'm inputting are the following values:

x = Player x Position within playfield width
the others should be self explanatory

The book also calculates x as (screenWidth / 2 - playerX - tilewidth) which I've tried.

The only difference I can think of is that to the book the player X co-ordinate is left of the player where for my engine it's the centre, but I changed - tileWidth to account for that to no avail.

The way it should work is when the player is at 0 the left-most pixel of the layer should be at the left edge of the screen and when the player is at (playfieldWidth - 1) then the right most pixel of the layer should be touching the right of the screen.

I finally figured it out, after tracking down the fact that I had a small rendering bug that shifted things a few pixels (oversight from adding overscan)

The final algorithm is as follows and works as long as layer is equal to or lower than screen width which i derived from scroll bar maths

public static final int calculateScroll(final int scroll, final int minScroll, final int maxScroll, final int contentSize) {
    return (scroll - minScroll) * contentSize / (maxScroll - minScroll);
}

scrollX = calculateScroll(playerX, 0, playfieldWidth, screenWidth - layerWidth + 1);

I'm sure it will work for layers that are larger than the screen width just need to figure out the right input values

After further playing I realised the variable I was using for testing the larger than viewport layers was incorrect and throwing everything off, that's now been fixed and i've refined the final function

  public static final int calculateScroll(final int scroll, final int minScroll, final int maxScroll, final int contentSize, final int viewportSize) {
    return (minScroll / 2 - scroll) * (contentSize - viewportSize) / (maxScroll - minScroll);
  }

sentences:
Unity's Animator.GetBehaviour always returning null I have the following line:

As you can see "transitionOutAnimator" is null before the line runs. transitionOutAnimator is a StateMachineBehaviour of type ThoughtBubbleTransitionOutAnimator.

We can check that the StateMachineBehaviour of the correct type is actually stored in the run time animator:

Yet when the line runs:

Am I doing something obviously wrong? Is this a bug? I have another identical instance in the code where I do this, and it works perfectly.

EDIT: Immediate window:

EDIT: This is still a problem as of Unity 5.3.5f1.

sentences:
Isn't OnGUI and Event cyclical? Here's what I don't understand about Events:

the documentation says that Events correspond to user input (key presses, mouse actions), or are UnityGUI layout or rendering events. For each event OnGUI is called in the scripts; so OnGUI is potentially called multiple times per frame. Event.current corresponds to "current" event inside OnGUI call.

the documentation pertaining to onGUI states that it hasone call per event

That doesn't make sense to me, because I know I can call Events within OnGUI.

I have an OnGUI function that draws a grid using x and y nested for loops, then checks using Event.current.mousePosition if your mouse is hovering over a grid block. What I don't get is how OnGUI is ever called, if OnGUI is only called when an event occurs, but I have the event inside OnGUI so how can you ever check if the event is being called inside a script that is only called after the event is called?

I know that probably sounds confusing -- I'm just puzzled by the seemingly cyclical nature of ongui.

sentences:
How can I send a live notification when a user gets leveled up? This question is about how to implement a live notification if the user gets leveled up. My leveling system consists of 100 levels, so every time a user levels up, a notification will pop up into their profile.

while($user->curr_exp >= $user->exp_needed){
      if($user->level == 10 || $user->level == 15 || $user->level == 20)
      {
      $user->reward_token += 1;
      }
      $user->curr_exp -= $user->exp_needed;
      $user->prev_exp = $user->exp_needed;
      if($user->level <= 19){
      $user->exp_needed = $user->prev_exp * 1.4;
      }
      elseif($user->level >= 20 && $user->level <= 39){
      $user->exp_needed = $user->prev_exp * 1.1;
      }
      elseif($user->level >= 40 && $user->level <= 59){
      $user->exp_needed = $user->prev_exp * 1.05;
      }
      elseif($user->level >= 60 && $user->level <= 79){
      $user->exp_needed = $user->prev_exp * 1.04;
      }
      elseif($user->level >= 80 && $user->level <= 99){
      $user->exp_needed = $user->prev_exp * 1.03;
      }
      elseif($user->level == 100){
      $user->exp_needed = $user->exp_needed * 0;
      }
      $user->level += 1;
      $user->save();
     }

Edit:
I have already added a toaster to my profile.blade.php here is the script:

<script type="text/javascript">
    $(document).ready(function(e){
     $.toast({
        text: 'You level up!',
        heading: 'Congratulations',
        icon: 'info',
        position: 'top-right',
        bgColor: '#d4af37',
        textColor: 'black'
    });
   })
  </script>

Now, everytime i refresh the profile.blade.php, the toastr pops up in the right corner, nonetheless, it's still a static functionality, what I want to happen is when the user gets the exp and gets leveled up, that will be the time the toastr will pop up. Any ideas on how do I call this up?

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:
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:
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:
HTML5 - check if font has loaded At present I load my font for my game in with @font-face

For instance:

@font-face {
    font-family: 'Orbitron';
    src: url('res/orbitron-medium.ttf');
}

and then reference it throughout my JS implementation as such:

ctx.font = "12pt Orbitron";

where ctx is my 2d context from the canvas.

However, I notice a certain lag time while the font is downloaded to the user.  Is there a way I can use a default font until it is loaded in?

Edit -

I'll expand the question, because I hadn't taken the first comment into account.  What would the proper method of handling this be in the case that a user has disabled custom fonts?

sentences:
Acceleration and Deceleration During Rotation I'm attempting to have a sprite rotate in a way where its rotation speed increases until it has reached the halfway point in its rotation, to which it starts to slow down. I'm currently calculating the halfway point by calculating the amount of time it should take to rotate the sprite, and then checking if a current time variable is larger.

The code works rather well except for the fact that I can't figure out how current time should increment each update. Currently I'm using delta time, but that doesn't work. I'm thinking it needs to be some combination of the calculated time to rotate and delta, but I haven't gotten it yet (clearly).

EDIT:
Specifically, currentTime shouldn't be incremented by delta solely, but I have no idea what it should be in place of delta.

        if (currentTime <= timeToRotate)
        {
            rotationSpeed += 5f * delta;
            currentTime += delta;
        }

        else
        {
            if (rotationSpeed > 5f)
                rotationSpeed -= 5f * delta;

            else
                rotationSpeed = 5f;

            currentTime += delta;
        }

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:
Unity Setting up the Universal Rendering Pipeline for Layer Masking I've been watching this video about Field of View (Player) by CodeMonkey which explains on how to set up a scriptable rendering pipeline for the layer unmasking/masking of objects. However, the interface changed with the latest updates. There's an Opaque Layer Mask and there's a Transparent Layer Mask. I've followed the Render Features as described in the video but I wasn't able to get the masking done correctly as there's these two options that I can't seem to figure out what it does. I tried toggling to and from layers to see which one is meant to be in the other one but this is the best I could get:

For simplicity's sake, these are the layers that I am using:
Characters (things I want to see when the Field of View mask is over them):

player

enemy

friendly

dead

Field of view (the unmasking layer)
Fog of war (the thing that makes everything have a black transparent fog)
UI (the layer that I want to see regardless of the where the Field of view mask is)
As of right now, I could see the Field of View and the UI. Everything else is missing. I have asked in their own community; however, no one reached out to me. Let me know in the comments if you need more info.

edit 1:
to reproduce:

create the following layers (Player, Enemy, FogOfWar, FieldOfView, Wall, UI)
Set a game object with sprite component to player, enemy. Set them to the Player and Enemy respectively. This one, we want to see if the field of view layer is on top of it. They will be invisible if the field of view is not on top of it.
Place a Sprite Renderer (a square) and set it to the Wall. This one, we want to see regardless if it's masked or not. If the field of view layer is not on top of it, this should be darkened by the fog of war.
Set a Mesh Renderer (A simple plane would do) to Field of view and set it above the player and enemy. Make sure the face of the plane is facing the camera. This object would reveal or hide the Player and the Enemy layer. If this is on top of the FogOfWar, the area that the FieldOfView is upon will be invisible. That way, the sprites underneath it is not darkened.
Have a sprite renderer (A square) and set it to black with 50% opacity and make it cover the the Player, Enemy, and FieldOfView. Set this to FogOfWar
Create a button, and set it to UI layer
Create a universal rendering pipeline. head over to the options and add the settings (keep in mind, I don't know what to set here. The Opaque and Transparent Layer Mask are my problem.):

a. Opaque Layer Mask - Wall, FogOfWar, FieldOfView
b. Transparent Layer Mask - Player, Enemy

For the render features, add these three:

Behind Masks contain Player & Enemy

edit 2:
I forgot. I have three cameras. All orthographic. They only render a specific layer.

Main Camera - Culling Mask is Wall
Character Camera - Culling Masks are Player and Enemy
UI Camera - Culling Masks is UI

Character and UI camera have a depth. UI Camera's depth is 0. Character Camera's depth is 1. I want to render the UI below the characters. Hence, I separated them into their own camera.

sentences: Farseer: Shooting a ball in a certain angle? How can I shoot a ball in a certain angle? When I press the Space key, the ball should be shot in a 45 degree angle. How can I do that?

sentences:
Performance of many canvas drawImage calls is very slow I'm developing a top-down 2D tile-based canvas game. I have a single sprite sheet of all my tiles, and then a JSON tile map array of where they're placed.
Previously I would render all the layers of tiles out to a single canvas element once, and then re-render that every frame. This would give me 300+ FPS because it would just be a single draw call each frame to redraw this canvas.
However, the issue with this is that the map is not just a "flat" image. Sometimes tiles need to be destroyed, or sometimes the player needs to stand behind certain tiles (such as when the player is above them), which doesn't seem possible if the map is just a static image.
As a result, I believe I instead need to re-render all the tiles every frame. However, even if I only re-render the tiles that the user can see, the FPS drops tremendously. With just two tile layers and a 100x100 map, the FPS drops to 20.
I would have assumed that, despite there being 100 * 100 * 2 canvas.context.drawImage calls per frame, that it would still be fine, because it was leveraging the GPU, and I'm using a single sprite sheet, so there should be no texture swapping. Apparently this is not the case.
I was looking for a way to possibly speed this up, but the recommendations seem to be extremely heavy-handed and opinionated libraries like three.js and pixi.js. These libraries would be great, except they do too much. In PIXI and Three.js you need to add objects to a scene and they're automatically redrawn each frame. This is not what I need, as my current ECS architecture demands an immediate-mode renderer, and I have my own scene graph already, so I can't (and don't want to) use theirs.
Is there a solution here? The only thing I really need to do is draw images clipped from a spritesheet quickly. Can this be done using immediate-mode rendering? Or is it doomed to be 20 FPS?

sentences:
Unity Transform.Position not returning expected position So in my scene hierarchy, I have an object laid out like so;
-Level1
--Level2
---Level3
----Level4

My script is attached to the Level1 object. When I try to find the transform.position of Level4 by way of Debug.Log to the console, I get the position of Level1, and so when I change the position of Level4 inside Level3, the data sent to the console doesn't change, still shows the position of Level1.

I do not believe this may be relevant, but what I am doing is an IK rig to move a character's limb. The object for which I am attempting to find the position is nested inside the skeleton of the character. The value returned to me is the position of the prefab placed in the scene. All of the objects (Level1 through Level4) are not explicitly moved, however they inherit their positions from the rotation of their parent.

My code to read the position is as follows:

Debug.Log(object.position);

Where object is already a transform. I have also tried:

Debug.Log(object.transform.position);

But still, all I get is the position of the top level parent.

Thanks for any help.

ADDITION

Ok so to expand on the question, I'll explain exactly what I'm trying to do.
I have the mecanim example and unity 5.0.1f1. I have the Mecanim Example project from the asset store and I'm in the animator controller scene. I have enabled IK pass on my base layer, and have placed my code in the "idle run jump" script, attached to the top level of the game object for the playable character.
I have then attached an empty game object inside the left foot to mark the location of where the left heel meets the floor.
This object is attached in the inspector to a variable in the "idle run jump" script, which then receives the ik pass through the function OnAnimatorIK.
My aim is to get the foot to follow the same position as another object, where leftFoot follows leftFootObj.
My code is as follows;

using UnityEngine;
using System.Collections;

public class pos : MonoBehaviour {

    protected Animator animator;
    public float offset = 0.156f;

    public Transform leftFoot;
    public Transform leftFootObj;

    void OnAnimatorIK() {
        if (animator == null)
            return;

        if (leftFoot != null) {
            Debug.Log(leftFoot.position);
            animator.SetIKPositionWeight(AvatarIKGoal.LeftFoot,1);
            animator.SetIKRotationWeight(AvatarIKGoal.LeftFoot,1);
            animator.SetIKPosition(AvatarIKGoal.LeftFoot,(leftFootObj.position+(Vector3.up*offset)));
            animator.SetIKRotation(AvatarIKGoal.LeftFoot,leftFootObj.rotation);
        }
    }

    void Start ()
    {
        animator = GetComponent<Animator>();

        if(animator.layerCount >= 2)
            animator.SetLayerWeight(1, 1);
    }

}

sentences:
Undeviating bullet in AndEngine I'm looking for a bullet that can collide with other bodies of the world but doesn't change direction according to collisions. I want the bullet to perform the collisions but without changing its own direction of moving. Basically I want to create a super bullet that can kill multiple bodies available in sequence. Would you have an advice?

If RayCastCallback is part of the solution, then could you tell me how to use it in this case?

sentences:
Unity move Vector3 position with transform How can I move a new Vector3 position with a Transform? Like the transform is the parent the vector.

Example if I want to push the x position for example by 10 value and I rotate the transform its push in world coordinate but I want to push by the rotation too.

    void Update () {
    temp = transform.Find("Transform").position;
    temp = new Vector3(temp.x + 10.0f, temp.y, temp.z);

    Debug.DrawLine(transform.Find("Transform").position, temp);
}

sentences: 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:
Entity System Texture Rendering Performance Java I use Artemis and LibGDX.
I have the following two components which manipulate a texture:

ComponentTexture // Stores the texture
ComponentSource // Define a region for the texture, that will only be
                  shown
ComponentSize // The size of the texture
ComponentMirror // Stores wether you want to flup on x and y axe
ComponentOrigin // The origin of the texture
ComponentPosition // The position of the texture
ComponentRotation // Rotation of the texture
ComponentScale // The scale of the texture

Than I have a System that requires the Texture and position component(Thats the minimum to draw a texture) and draw them to screen, before I render I check if it has some possible extra components.

@Override protected void process(Entity entity)
{
    final ComponentTexture  componentTexture    = mComponentTextureMapper.get(entity);
    final ComponentSource   componentSource     = mComponentSourceMapper.getSafe(entity);
    final ComponentSize     componentSize       = mComponentSizeMapper.getSafe(entity);
    final ComponentMirror   componentMirror     = mComponentMirrorMapper.getSafe(entity);
    final ComponentOrigin   componentOrigin     = mComponentOriginMapper.getSafe(entity);
    final ComponentPosition componentPosition   = mComponentPositionMapper.get(entity);
    final ComponentRotation componentRotation   = mComponentRotationMapper.getSafe(entity);
    final ComponentScale    componentScale      = mComponentScaleMapper.getSafe(entity);

    // Texture
    final Texture texture = componentTexture.getTexture();

    // Source
    final Rectangle source;
    if(componentSource == null)
    {
        source = new Rectangle(0, 0, texture.getWidth(), texture.getHeight());
    }
    else
    {
        source = componentSource.getSource();
    }

    // Size
    final Vector2 size;
    if(componentSize == null)
    {
        size = new Vector2(texture.getWidth(), texture.getHeight());
    }
    else
    {
        size = componentSize.getSize();
    }

    // Mirror
    final boolean mirrorX;
    final boolean mirrorY;
    if(componentMirror == null)
    {
        mirrorX = false;
        mirrorY = false;
    }
    else
    {
        mirrorX = componentMirror.isMirrorX();
        mirrorY = componentMirror.isMirrorY();
    }

    // Origin
    final Vector2 origin;
    if(componentOrigin == null)
    {
        origin = new Vector2(0, 0);
    }
    else
    {
        origin = componentOrigin.getOrigin();
    }

    // Position
    final Vector2 position = componentPosition.getPostion();

    // Rotation
    final float rotation;
    if(componentRotation == null)
    {
        rotation = 0;
    }
    else
    {
        rotation = componentRotation.getRotation();
    }

    // Scale
    final Vector2 scale;
    if(componentScale == null)
    {
        scale = new Vector2(1, 1);
    }
    else
    {
        scale = componentScale.getScale();
    }

    mSpriteBatch.draw(texture, position.x - origin.x, position.y - origin.y, origin.x, origin.y, size.x, size.y, scale.x, scale.y, rotation, (int) source.x, (int) source.y, (int) source.width, (int) source.height, mirrorX, mirrorY);
}

I can create 5000 Entities with textures and a small rotation animation.
I'm wondering about the efficiency of this method and how bad of a performance hit I will get from creating a lot of instances in the method.
I plan to optimize this.

Does anyone have a good idea as to how I can get better performance from drawing textures?

How I can avoid the check for every component that the entity has?

Thanks for reading :D

sentences:
Messaging/Event System in Generic Game Engine? Yay or nay? Should I develop a basic messaging/event system for a generic game engine or should I leave it up to the individual case-by-case basis of the end-users to create systems specific to the game being developed?

This question raises some valid points: (I am currently using the per-frame function call system mentioned)

Per-frame-function-calls-versus-event-driven-messaging-in-game-design

sentences:
Edit existing editor inspector? I want to write custom inspector for one of my scripts. All I want to change is input method for one of the strings to popup (so instead of writing whole string everytime I choose it from premade list of strings, like enums, the list is different for every dialogue). But the thing is it's VERY long inspector with a lot of variables and rewriting everything just for this one input doesn't click for me. Other problem is that this string is nested deep in the serializable object arrays, it look like so

I'm very happy with how default inspector shows all the fields, expect this one string I want to change. I tried playing around with SerializedProperty but no luck.

If it comes to available options I populate public string array with the names in the inspector (every dialogue has different list of participants) so the options should vary between different dialogues. What's the best way to set options?

Is there a way to do it without rewriting whole inpector on your own?

sentences:
How does OpenGL-ES 2 assemble primitives? Two things I'm quite confused about.

1) OpenGL ES 2.0 creates primitives before the vertex shader is invoked. Why, then, does it not automatically provide the vertex shader the position of the vertex?

2) OpenGL ES 2.0 supports glDrawElements(), but it does not support glEnableClientState() or GL_VERTEX_ARRAY, so how can this call possibly be used to construct primitives?

NOTE: this is OpenGL ES 2.0, NOT normal OpenGL!

Thanks!

Resolution:

I think my confusion was stemming from the built in variable gl_Vertex that some versions of GLSL support (according to some sources, I couldn't find this in the official documentation at http://www.opengl.org/sdk/docs/manglsl/) which gives you the position of the vector provided to the draw command. This isn't present in GL ES. Further, my code was't working, and as GLSL can be difficult to debug, I had no idea what was going on :)

In this case, using vertex attributes and passing the model-space location of the vertices and my transformation matrix allows me to transform the vertices correctly.

sentences:
How to find the smallest distance between two 4-sided objects in 3D space? I was wondering if there is a way to calculate the smallest distance between two 4-sided objects in space. In this specific scenario, the only information I know about both of them are the 4 points that make up their vertices (so 8 points in total). Is there a way to achieve this?

Also, I'm considering that both shapes have a non-zero volume and that they do not intersect each other.

sentences:
Best way to constrain character to a path? I'm in the process of developing a level-based runner for mobile phones, and I've hit a wall when deciding which method to use to get the character to move through the level.

Basically - I need my character to travel a constrained path across the level as I manipulate the character by speeding up/down and jumping to avoid obstacles. I couldn't just place a straight path and use Curved World look as I needed a realistic feel to character motion. I also have up/down slopes that have to affect the character's speed.

I'm not use whether using iTween is the best for this as it makes it difficult to manipulate character speed and especially the jumping 'arc'. I've tried using MoveTo() but problems arose when trying to change character parameters... PutOnPath() made sense in theory but I found it harder to implement.

Is there any easier way to go about this? I'm almost completely new to Unity, so an easier implementation is what I'm going for, for now.

Thanks in advance!

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:
Drawing behavior when a fragment is written to multiple times in a single pass This seems really basic, but I'm confused and can't find a clear answer anywhere.

What happens to a target fragment of a rendertarget if the fragment is written to multiple times within one pass (e.g. by drawing two identical triangles above each other), assuming depth and stencil testing is disabled?

Does this just use the behavior specified with the current blend state? If not, can I modify this behavior?

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:
How to pack the game files into one without using any file compressor? Well, one example is this file of the game The Sims 2 for PS2: quickdat.arc.
The file contains this .arc extension, but it's no one an archive file and it contains some data of the game inside. How can I do this? Put so many files in one?

How to do something like this? All the game files inside one without using a file compressor?

sentences:
Loading Song in MonoGame Windows I cannot load the song into my game. I got error in both templates WindowsDX and WindowsGL. Monogame Develop Build 1252

Both files .wma and .xnb are exist in Content folder and Build Actions are sets to Content, and Copy Always to output dir. Checked with mp3/ogg too but with no result.

The Song works perfect with XNA, and with MonoGame I cannot load any song.

Edit SOLVED: The newest build 1478 solved the problem

DX

GL

sentences:
Designing an API for defining rigged game entities I am making a game framework for building/constructing what I would imagine are called something like "multi-component rigged entities". This would be things like a stick-figure drawing. Can't find a great animation to demonstrate, but something like this, where the head is a circle, the hands circles, the arms are poles, torso is one block, etc. (imagine there is no bending, only rigid shapes moving attached by joints).

I need to design some kind of API for a user of the framework to use to describe such a rigged entity.
As one example, I am looking at Vue.js and their API is basically like this, you have a template:

    Ask a yes/no question:
    <input v-model="question">

{{ answer }}

And a model, which has external/internal properties, computed properties, and methods:
var watchExampleVM = new Vue({
  el: '#watch-example',
  data: {
    question: '',
    answer: 'I cannot give you an answer until you ask a question!'
  },
  watch: {
    question: function (newQuestion, oldQuestion) {
      this.answer = 'Waiting for you to stop typing...'
      this.debouncedGetAnswer()
    }
  },
  created: function () {
    this.debouncedGetAnswer = _.debounce(this.getAnswer, 500)
  },
  methods: {
    getAnswer: function () {
      if (this.question.indexOf('?') === -1) {
        this.answer = 'Questions usually contain a question mark. ;-)'
        return
      }
      this.answer = 'Thinking...'
      var vm = this
      axios.get('https://yesno.wtf/api')
        .then(function (response) {
          vm.answer = _.capitalize(response.data.answer)
        })
        .catch(function (error) {
          vm.answer = 'Error! Could not reach the API. ' + error
        })
    }
  }
})

This is just one example of an API I am looking for.
But what I'm looking for is some inspiration, perhaps from Unity or some other gaming framework/engine, where it allows you to specify not "view components" but entire rigged entities like in this animation above.
It seems to come down to a skeleton with bones and joints, and the bones are somehow attached to skins, but that's as far as my knowledge goes, and I'm not really sure what a DSL sort of thing would look like for defining a rigged entity.
How can I design an API that handles this task?

sentences:
Draco encoder lossless, is it possible? I'm trying to use the draco library in a Unity project. I've a lot of obj files with models of a person in different positions. When I encode these models with the draco_encoder command I obtain a lossy conversion, and a lot of parts of my original models get lost.

I tried to play around the parameters -qp and -cl in order to change the quantization and the compression level, but also with qp at its maximum and cl to its minimum some parts get lost.

In this image the left model is the original one. The right model is the one converted with draco_encoder by using cl 0 and qp 21. As you can see some parts are missing.

Do you have any suggestion on how can I obtain a lossless (as lossless as possible) conversion?

sentences:
How to get the loudness of the real world environment using the device's microphone in Unity? I am trying to create a game where the character's movement is dependent on the loudness of the real world environment. So if the person playing the game screams or do something loud the character will move accordingly.

What I need is a function returning the loudness of the real world environment and use it in the Update() to control the character.

Is there such a function or if not how can I make one?

sentences:
Instantiate creates a clone in wrong position I have this prefab with this transform:

And then using this code to create a clone (the prefab is assigned to a public property of a script, which I assign using the editor, which is the e.Weapon):

Instantiate(e.Weapon, new Vector3(0f, 0f, 0f), Quaternion.identity, rightHand.transform);

I am parenting it to my character's right hand. But whenever the clone gets created, it has different position than the one I have in my code. It appears like this:

Any idea why this is happening?

sentences:
Is the Humble Bundle reasonable? I love the humble bundle.  They are getting more and more generous, now including Pack #3 with Pack #4.

I am so confused.  Will they last?  Are they doing ok?  They're putting so much out there, and if you donate less than $1, you get this image :

And that's it!

Is this really working?

sentences:
How important is understanding Software Project Management for an indie? I ask this because I'm curious to know from people who actually support themselves by making games, if their project management skills contribute to determining the success of a project?

I also have this feeling for some reason that having too much project management can strangle the creative process. Maybe there is a way to prevent that from happening. I don't know.

Thanks to all that reply.

sentences:
Angular velocity from 2D Collision I have been working on a 2D physics engine for my A Level computing project and I am having trouble calculating the angular velocity from a collision. I have managed to workout each objects linear velocity and create a collision manifold containing the collision points relative to each of the 2 objects involved in to collisions centre of mass (0, 0) along with the overlap etc. I also know each objects mass, speed etc.
I have been looking for a couple weeks now at every equation I can find and non of them seem to work returning incredibly high numbers for normal collisions.
My current algorithm pulled from an article in the game development section on tuts+ (linked here) is like so:

objectArray[i].angularVelocity += objectArray[i].inverseMass * CrossProduct(collisionInfo.collisionPointB, impulse);
objectArray[ii].angularVelocity += objectArray[ii].inverseMass * CrossProduct(collisionInfo.collisionPointA, impulse);

Could someone please explain how I can calculate the change in angular velocity and give me some example values for the equations as mine are probably in the wrong scale or something.

Thank you for any help,
Andy A

Other things to note, this engine is written in C# for XNA so if there are any language specific optimisations they have to work with C#, thank you.

sentences:
Where can I find game postmortems with a programmer perspective There are a number of interesting game post-mortems in places like GDC vault or gamastura.com. The post-mortems are generally give with a CEO/manager perspective or a designer perspective, or, more often a combination of both e.g DOOM postmortem

But I have not been able to find many post-mortems which are primarily from the programmers perspective. I'm looking for discussions and rational for technical choices and tradeoffs and how technical problems were overcome. The motivation here is to learn what kind of problems real game programmers encounter and how they go about solving them.

A perfect example of what I'm looking for is Renaud Bédard's excellent GDC talk on the development of Fez, "Cubes all the way down". Where can I find more like that?

sentences:
How to avoid wagon wheel illusion of a rotating gun barrel reversing direction? I didn't know which forum to post this in, but I'm going to try here first. I am making a shotgun with 3 barrels which spin. However, I also want it to have kickback in the animation, but every time I add that recoil it breaks the animation, making a strange wagon-wheel style illusion. No matter what I try, it always reappears once I add the recoil. Here is the animation:

Here is how the animation is supposed to be perceived, with the barrels spinning in one direction:

But this is what I often see when I look at it, where it seems to snap backwards one step:

It may be a bit hard to see, but if you look at it long enough it will flip between the two, similar to that animation of a ballerina which can be spinning in either direction.
I have tried having it only spin when it is down, only spin when it is up, changing the interpolation of the spinning and of the recoil, everything I can think of, but none of it works.
How do I solve this problem? Can I stop the optical illusion while keeping the recoil?

sentences:
Updating physics for animated models For a new game we have do set up a scene with a minimum of 30 bone animated models.(shooter)
The problem is that the update process for the animated models takes too long.

Thats what I do:
Each character has ~30 bones and for every update tick the animation gets calculated and every bone fires a event with the new matrix. The physics receives the event with the new matrix and updates the collision shape for that bone. The time that it takes to build the animation isn't that bad (0.2ms for 30 Bones -> 6ms for 30 models). But the main problem is that the physic engine (Bullet) uses a diffrent matrix for transformation and so its necessary to convert it.

Code for matrix conversion: (~0.005ms)

btTransform CLEAR_PHYSICS_API Mat_to_btTransform( Mat mat )
{
btMatrix3x3 bulletRotation;
btVector3 bulletPosition;

XMFLOAT4X4 matData = mat.GetStorage();

// copy rotation matrix
for ( int row=0; row<3; ++row )
    for ( int column=0; column<3; ++column )
        bulletRotation[row][column] = matData.m[column][row];
for ( int column=0; column<3; ++column )
    bulletPosition[column] = matData.m[3][column];

return btTransform( bulletRotation, bulletPosition );
}

The function for updating the transform(Physic):

void CLEAR_PHYSICS_API BulletPhysics::VKinematicMove(Mat mat, ActorId aid)
{
if ( btRigidBody * const body = FindActorBody( aid ) )
{
    btTransform tmp = Mat_to_btTransform( mat );
    body->setWorldTransform( tmp );
    }
}

The real problem is the function FindActorBody(id):

    ActorIDToBulletActorMap::const_iterator found = m_actorBodies.find( id );
if ( found != m_actorBodies.end() )
    return found->second;

All physic actors are stored in m_actorBodies and thats why the updating process takes to long. But I have no idea how I could avoid this.

Friendly greedings,
Mathias

sentences:
Migration from XNA to SharpDX My fear is that XNA has reached the end of the road. To keep up with the latest technology a shift to another game framework might be needed. We have many games in a large codebase, all based on XNA. My question is, how much work would it be to migrate to SharpDX and are there other possibilities?

Our code base mainly uses basic 3D rendering and the SpriteBatch, no fancy shader stuff.

Update:

I should have mentioned we only use 2.5D, we have a simple engine that builds textured quads to render text and animated sprites. Also for sound we use XACT (what else..) with some effects.

sentences:
Collision Detection and Bounding Box Creation I am trying to create bounding boxes. My goal is not to create them with giving x,y and z coordinates. But rather, I will be loading a model or else rendering a shape - say an aeroplane. The algorithm then should be able to create efficient bounding boxes around it. I am coding in opengl.

Can you help me out with the same?

sentences:
Discrepancy in Box2D Flash applied impulse I have two clients. Player A, and Player B. What Player B sees in his screen is a mirrored version of what Player A sees. This is a carrom game, hence the mirroring.
Does anyone know why even if I have the same Impulse calculated for both of the clients, sometimes the resulting actions is different? The only difference is that the angle for Player B's impulse is inverted. Below is the snippet of the force calculation
var angle = data.originId == ig.game.playerIndex ? data.angle : invertRadAngle(data.angle);
var dx = (this.striker.powerMult * data.powerDrag) * (ig.game.boardControl.size.x * Box2D.SCALE) * -Math.cos(angle);
var dy = (this.striker.powerMult * data.powerDrag) * (ig.game.boardControl.size.y * Box2D.SCALE) * -Math.sin(angle);
var force = new Box2D.Common.Math.b2Vec2(Math.round(dx * 100) / 100, Math.round(dy * 100) / 100);

this.striker.body.ApplyImpulse(force, this.striker.body.GetPosition());

Here's the function in charge of inverting the angle
function invertRadAngle(angle) {
    return angle + Math.PI;
}

I am using ImpactJS's version of Box2D, hence the difference in syntax, but it should be the same with vanilla Box2D Flash

sentences:
Importing audiofile into Unity3d gets shown after ending playmode I am working on a game where the user has the possibility to import custom audio tracks that can be listened to during the game.

For this I am making use of System.IO.File.Copy method. This works, there are no issues or flaws here. When I inspect the target and destination folder the file(s) get copied properly and show up in the folder.

The issue however is that the Unity Editor doesn't show the file despite it actually being there. During play mode in the Unity editor the new file isn't shown in the resources folder (which I use as destination for now). When I use windows file explorer I can clearly see the file in the corresponding folder. Using debugs (in Unity) also state that the folder is empty, however when I use debugs outside of Unity it shows that the folder contains the copied item. Keep in mind that these both debugs are called roughly at the same time. I have tested this in many ways to be 100% certain that Unity doesn't see the file, while it is there.

So once I stop playmode it starts loading/importing/processing the new file and then it shows up in the folder in unity as well. When I launch playmode after this the file is indeed loaded and included in the game as well.

I however need this to happen without having to stop playmode. So there is probably some type of processing that I haven't called for Unity to process the addition of the new file and for it to be visible.

So in a nutshell basically copying a file from folder to folder isn't enough for Unity to directly utilized in the same play session (and all after). How can I make the audio-file directly showable and accessable?

There aren't any errors or warnings. The file plays correctly after it has been processed. I am at a loss with this issue/bug.

sentences: Oculus Rift DK1 and DK2 compatability issues For a project I need to make a multiplayer game using Unity and the Oculus Rift. My project works fine with the DK2 but it turns out the second rift is a DK1 and it won’t work with Unity. I was thinking the best way forward would be to use an older version of the Oculus Runtime and Unity. Does anyone know what versions of Unity and the Runtime I need to have both the DK1 and DK2 work with Unity?

sentences:
How to change AddForce code to MovePosition or SetVelocity? Vector2 vec = new Vector2(horizontal, vertical);
    vec = Vector2.ClampMagnitude(vec, 1f);

    Vector3 camF = cam.transform.forward;
    Vector3 camR = cam.transform.right;

    camF.y = 0;
    camR.y = 0;
    camF = camF.normalized;
    camR = camR.normalized;

    targetPosition = (camF * vec.y + camR * vec.x) * MoveSpeed;

    Vector2 targetVelocity = (targetPosition - transform.position)/Time.deltaTime;

    rb.AddForce(targetPosition - rb.velocity, ForceMode.VelocityChange);

My problem is my character doesn't affects by the gravity when i changed my code from transform.position to rb.AddForce. I searched online and even asked here how to calculate gravity and add it to my character, nobody knew, so i think if i can change this code to rb.MovePosition or rb.SetVelocity maybe it does affects by the gravity?

sentences:
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:
Tile map optimization algorithm I've read this artical on tilemap optimization https://www.scirra.com/blog/ashley/3/tech-blog-tilemap-tidbits and wondering what algorithm is used to achieve something like this.

I'm wondering how they convert an array of tiles into simplified rectangles that use the same texture. To optimize rendering

sentences:
Text Pooling Optimizations In my game I have created popup text for gained points when enemies are killed.
it pops up wherever the enemy was and will say something like
"+32"
float up a bit and fade away at the same time.
This transition lasts for a few seconds if that. and hundreds could appear at a time when AoE attacks destroy a lot of enemies.

That's all well and good. and it works!
but I fear that this could become quite slow on mobile devices. So I did what any good game dev does. I pooled it!

Then it occurred to me.
I'll still be changing the display value of the text elements dynamically and libraries like TextMeshPro already, in surely an optimized way, instantiate actual meshes to render text. So is pooling these text elements really a big optimization?

so here goes my question for experienced and knowledgeable devs. Is it more efficient to pool each character I need and assemble my short strings dynamically as sets of pooled gameobjects for these popups of just a few characters or should I simply pool text elements that will change their text just before appearing? Assume the memory usage difference is minimal. only worried about speed.

This is on top of the game having possibly thousands of projectiles moving at any given time, so I believe it is a valid optimization question, but I ask this more for curiosity than practicality. For now, I already have a working solution. but I believe such an issue could arise in the future. and want to satisfy my curiosity now.

sentences:
Best way to prevent UIPanGestureRecognizer from firing when moving sprites in cocos2d Im using UIPanGestureRecognizer in my cocos2d game to do drag and drop of sprites. I have a row of sprites and when I drag a sprite on top of another one, the sprite underneath it and any other sprites between should shift left or right out of the way to allow space to drop the currently selected sprite.

This is working ok, however, if I am too quick at dragging the sprite around the screen, this triggers another round of the UIPanGestureRecognizer's callback method, and screws up the logic, as the sprites are in-between shifting.

I need a way to freeze the callback from firing, whilst the other sprites are shifting, then once they have finished moving, re-enable the callback to fire.

Whats the best way to do this?

sentences:
My sprite walking animation code doesn't work at all This is my first time doing code for a game so I followed some online tutorials.

When I got to the walking and the jumping animation I just can't get it to work whatever I do.

I tried multiple codes but it doesn't work.

My animation code right now:

//animation
if (!place_meeting(x,y+1,Owhitetile))
{
    sprite_index = Scute_character_jump_right;
    image_speed = 0;
    if(sign(vspeed)  < 0) image_index = 0;
}
else
{
    image_speed = 1;
    if(hspeed == 0)
    {
        sprite_index = Scute_character_right;
    }
    else
    {
        sprite_index = Scute_character_walk;
    }
}

All my code so far

//player imput
key_left = keyboard_check (vk_left);
key_right = keyboard_check (vk_right);
key_jump = keyboard_check_pressed (vk_space);

//calculate movement
var move = key_right - key_left;

hspeed = move * walksp;
vspeed = vspeed + grv;

if (place_meeting(x,y+1,Owhitetile)) and (key_jump)
{
    vspeed=-7;
}

//horizontal colision
if (place_meeting(x+hspeed,y,Owhitetile))
{
    while (!place_meeting(x+sign(hspeed),y,Owhitetile))
    {
        x = x + sign(hspeed);
    }
    hspeed = 0;
}
x = x + hspeed;

//vertical colision
if (place_meeting(x,y+vspeed,Owhitetile))
{
    while (!place_meeting(x,y+sign(vspeed),Owhitetile))
    {
        y = y + sign(vspeed);
    }
    vspeed = 0;
}
y = y + vspeed;

//player death
if (place_meeting(x,y+vspeed,Ospikes))
{

   instance_destroy()
   game_restart()

}

//animation

if (!place_meeting(x,y+1,Owhitetile))
{
    sprite_index = Scute_character_jump_right;
    image_speed = 0;
    if(sign(vspeed)  < 0) image_index = 0;
}
else
{
    image_speed = 1;
    if(hspeed == 0)
    {
        sprite_index = Scute_character_right;
    }
    else
    {
        sprite_index = Scute_character_walk;
    }
}

sentences:
How do RPG store and retrieve maps? I'm making a very basic online RPG (2d, and instead of sprites I use characters, like a roguelike) and I still haven't figured out how to store and retrieve maps. Until now I used a text file that are stored on the server.
Should I store the map in the database and retrieve it as the player moves around?
For example, if the player is in the position [x, y], load all the tiles within a 15 tile radius.

Or maybe dividing the map in "sections" and then, depending on the player's location load a given section?
Which is the best option?

Also, if I was to save the map in the database, which is the best data type to store it as a bi-dimensional array? BLOB maybe?

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:
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:
Legal issues around forming an international game dev team A friend and I have been wanting to collaborate on a mobile app game. It's a 'start small but dream big' kind of venture, where neither of us has much experience, but we're hoping that if we succeed, we could build on it and become a proper full-time game dev studio in the future.

The main issue here is that we're both from different countries, and neither of us wants to risk personal liability in releasing a game without having first formed a LLC. I know the odds of ACTUALLY being personally sued for damages are very low, but it's just not a risk that we want to take.

There seem to be a lot of problems with forming a LLC when both people are in different countries, though. There are multiple laws against having a co-founder, director, or even an employee being someone from a different country.

How do game dev teams or studios consisting of people all around the world get around this problem?

sentences:
LibGDX trying to create a matrix of circles I am trying to create a circular stage like so:

But I can only make a square:

sentences:
CrossPlatformInput Prefabs - Button handler to move? I am currently trying to put two buttons on my UI that move a character left and right if touched down (Held). I would like to use the cross platform input, and would like the buttons to change the value of the Horizontal axis as my "A" and "D" keys would...

And my code for moving my character is as follows:

private void Update()
    {
        isGrounded = Physics2D.OverlapCircle(groundChecker.position, .15f, groundLayer);

        float move = CrossPlatformInputManager.GetAxis("Horizontal") * moveSpeed;
        playerRB.velocity = new Vector2(move, playerRB.velocity.y);

    }

sentences:
Nine Patch Images in DirectX In Android development I found nine patch images very useful to draw images that have a fixed border. When the image is scaled the inner part scales, but the border stays at a fixed size.

I was looking for something similar in DirectX. Does anyone have information/pointers to nine patch images in DirectX?

sentences:
Does using [STAThread] with XNA have any negative implications? I'm working on a game in XNA, which has an inbuilt level editor. To facilitate this I want use the FileOpenDialog from Winforms. I followed the instructions as per this answer. This involves setting the [STAThread] attribute on my Program class.

Does using STAThread have any negative implications? Meaning will it cause worse performance or limit me in some way?

sentences:
Why do my .wav sound effects delay before playing the first time on iOS? First off, I'm using Unity 5.2.3. I have a bunch of .wav sounds that I play like this:

     Debug.Log(m_audioAssets.m_soundBanks[(int)m_currentSoundBank].m_multiplier[data].loadState);
     m_multiplierSource.clip = m_audioAssets.m_soundBanks[(int)m_currentSoundBank].m_multiplier[data];
     m_multiplierSource.Play();

The Debug.Log is just there temporarily, to verify that the sounds' loadState is "loaded". It is, every time they play. But the first time they play on my iPhone, there is a noticable delay before they start. After playing the first time, they work fine.

What am I supposed to do to get these sounds to preload properly? I have their "Preload Audio Data" boxes checked in the import settings, and they're set to "Decompress on Load".

sentences:
Optimize a render call to draw out several semi-transparent sprites I'm writing a 2D side-scrolling style game in C++ and openGL. In this game I have several cloud sprites which are rendered across the top of the screen. They rotate and scale and such so they're not static. I'm wondering if there is any way that I can optimize this, because currently every time one of these sprites is rendered, GL has to perform blending between everything already rendered (like the background, etc) and these sprites.

I'm thinking something along the lines of rendering ONLY the clouds together all at once, and then performing a single call where the final result is rendered and blended into the main scene. Not sure how to even go about that or if it will even result in a performance gain. Any suggestions would be greatly appreciated!

Just for clarity, here is what a final render looks like. The clouds are formed by several smaller sprites being populated close together around certain points.

sentences:
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:
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:
Tile Map Coordinates I am have now this code: http://jsfiddle.net/DK67k/2/ In here is 2D tile map and when you click on tile you get coordinates on alert. But for get precises coordinate you need click on top left tile(tiles is 16x16) and if I click on bottom right tile I am get second tile coordinates.

Maybe anyone have idea how to fix this?

sentences:
Can I load a SpriteFont without a content project? I'm developing a game in XNA, however, I do not want to use a content project. I'm loading all my textures through different means, and I'd also like to load my fonts without a content project.

Is there any quick way to maybe include the SpriteFont in the main game project?

sentences:
Component-wise GLSL vector branching I'm aware that it usually is a BAD idea to operate separately on GLSL vec's components separately.
For example:

//use instrinsic functions, they do the calculation on 4 components at a time.
float dot = v1.x*v2.x + v1.y * v2.y + v1.z * v2.z; //WRONG
float dot = dot(v1, v2); //RIGHT

//Multiply one by one is bad too, since the ALU can do the 4 components at a time.
vec3 mul = vec3(v1.x * v2.x, v1.y * v2.y, v1.z * v2.z); //WRONG
vec3 mul = v1 * v2; //RIGHT

I've been struggling thinking, are there equivalent operations for branching?

For example:

vec4 Overlay(vec4 v1, vec4 v2, vec4 opacity)
{
    bvec4 less = lessThan(v1, vec4(0.5));
    vec4 blend;
    for(int i = 0; i < 4; ++i)
    {
        if(less[i]) {
            blend[i] = 2.0 * v1[i] * v2[i];
        } else {
            blend[i] = 1.0 - 2.0 * (1.0 - v1[i]) * (1.0 - v2[i]);
        }
    }
    return v1 + (blend - v1) * opacity;
}

This is a Overlay operator that works component wise. I'm not sure if this is the best way to do it, since I'm afraid these for and if can be a bottleneck later.

Tl;dr, Can I branch component wise? If yes, how can I optimize that Overlay function with it?

sentences:
How can you run events after a set amount of time in SFML 2.0? I've been using SFML 1.6 for a while and recently upgraded to 2.0, apparently there's a new sf::Time type however I'm clueless as to how I can achieve running of a certain function after a set amount of time.

How would you go about doing this? Say you want something to execute after 5 seconds, how would you do it in SFML?

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

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

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

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

sentences:
Translate operation is rotating? cube
 [[ 1.  0.  0. 6.]
 [ 0.  1.  0.  0.]
 [ 0.  0.  1.  0.]
 [ 0.  0.  0.  1.]]

view
[[1. 0. 0. 0.]
 [0. 1. 0. 0.]
 [0. 0. 1. 0.]
 [0. 0. 0. 1.]]

final
[[ 1.  0.  0. 6.]
 [ 0.  1.  0.  0.]
 [ 0.  0.  1.  0.]
 [ 0.  0.  0.  1.]]

Hello! I have a cube and I'm trying to move it around. The above are the calculated matricies for the cube, viewport, and the combined matrix after multiplication. The result is this:

I'm not sure why it's being warped like this instead of scooting over a bit. Any idea?

sentences:
3D OBB vs OBB Collision Detection and Response (Edited, was a rather goofy, long question. I have since decided on using JBullet and I love it.)

How can I accomplish 3D OBB vs OBB collision detection in my game? I understand how AABB's detect being inside one another, and I understand how to rotate a point around another point. But once a collision is detected, how should a physics engine respond to that? It is the collision and resolution that I don't understand how to do; making the objects move/react appropriately.

sentences:
Show the progression of a loop in GameMaker Studio I'm using a loop to destroy some objects in my code.

for (var i = 0; i < instance_number(obj_item); i++)
{
    var inst = instance_find(obj_item, i);
    with (inst)
        instance_destroy();
}

I would like to make them disappear one at a time on screen (i.e., the first one disappears, one second after that the second one disappears, etc.).

However, it seems that the screen is updated only when the loop has finished: all objects disappear at once.

In Unity, I would use coroutines for such a situation. How do I do that in Gamemaker?

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:
Xna - How do you use large animations for a menu In the main menu of my game I have several animations that pause in specific frames.

I made the sprite sheets for the different layers, but then I found out that the sprite sheet has to be smaller than 2048 pixels. My sprite sheet is 14400 pixels with 18 frames...

How can I play these large animations? I tried video playback but I couldn't find a way to do this...

sentences:
Spriter model not touching ground in? I was attempting to make a game in Construct 2 by using my Spriter Models plugin. However, when I imported the model, rescaled it & changed a few things, I got this:

As seen in the picture, the Spriter model is not touching the platform ground.

Do you know of any ways I could have the model touch the ground?

Thanks in advance,

Jamie

Ps. Here is the link to the files, just in case you guys might wanna have a look at it:

https://drive.google.com/folderview?id=0B11opD9YgSqWbVhaNEVTcGhIRTA&usp=sharing

Pps. You will need the Spriter plugin for Construct 2 to open the project file. The Spriter model files will need Spriter to open it.

sentences:
Unturned weapon modification not spawning in singleplayer I've been working on my first modification for Unturned and I'm having some serious trouble doing the process due to the lack of up-to-date tutorials on modding weapons.

I've done everything I can to make it, and I was finally able to create a bundle and export the .unity3d file into the copied folder for my modded gun. However, when I go into Unturned and actually attempt to spawn it, nothing works.

I'm assuming it's the version of Unity that I'm using (Unity 5 2.4), even though I followed the instructions correctly while in the editor. Please help, I really need a solution, because I've been at it for weeks now and no one has been able to provide any solution.

sentences:
Identifying groupings of objects I have a cloud of objects, each with a 3D position, and I want to pick out tight groups of these objects.

Specifically, I want to find all objects which form a grouping of radius r within a large cloud of objects. It is likely that the objects are spaced out in vague groupings already, but I need to identify these and essentially put a sphere of radius r around them.

I would prefer to avoid a brute force method if possible - which I presume would be a process of comparing objects against each other to find two within a distance 2r of each other, then putting a sphere in the middle and determining what other objects are within this sphere.

My actual use case is not games related at all, but if an game based example use case would help, here is how I might use it in a game;

The player is flying a plane over a battlefield and has been given orders to bomb the enemy.

To assist the player I want to highlight tight groups of enemies that make prime targets, however the troops on the ground do not move or coordinate in a flocking system, they move completely as individual entities.

Given those criteria, how might I identify the largest groups of objects within the bomb's blast radius?

sentences: Textures in Unity3D appear with lower quality than in Photoshop I made game assets that look great in Photoshop, but they look like crap when I import then into Unity and run the game.  Why?

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:
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:
What are the parameters for btHingeConstraint::setLimit? What does each parameter in btHingeConstraint::setLimit do to the hinge constraint?

void btHingeConstraint::setLimit    (   btScalar    low,
        btScalar    high,
        btScalar    _softness = 0.9f,
        btScalar    _biasFactor = 0.3f,
        btScalar    _relaxationFactor = 1.0f
    )

sentences:
Changing the color of a sprite at runtime Is there a form to change the color of a sprite in runtime?}

I have a black point loaded with an image, but i dont want to load various images with different colors, is there a mode to change the color in runtime and not loading lot of images?

And i want to tell it what part to color of the sprite, is it possible?

sentences:
How to update the monsters in my MMO server using Node.js and Socket.IO Currently I am creating an MMO using Node.js and Socket.IO.

The node server needs to handle connections for players, and also use a loop to update all monsters positions in my game and let them attack players in range.

For the loop I read that you can use process.nextTick or use a child process, which option would be the best choice? What are the advantages/disadvantages of using each?

Also, how many times per second should I run this loop for the monsters?

sentences:
Does this constitute as copyright infringement? Say there is a card game, and it has cards that arc out, and has certain types of memberships with certain features such as premium members being allowed to chat, or use private game rooms etc. If I, from scratch created a card game (for example, Hearts) that had similar arced cards, and had similar basic and premium memberships, but used all my own, graphics, sound, and theme, would this constitute as copyright infringement? Where is the line drawn for this sort of thing?

Thanks

sentences:
Slide effect in voxel collisions I'm making a voxel engine, and I'm trying to figure out the right way to make efficient collisions with a slide response (making the player slide against the wall).

Currently my collisions are pretty simple : if, after update, the player bounding box collides with the voxel world, then we just cancel the collision.

I have seen this answer on SO, but I don't understand what the answerer means here. Since a voxel is a single unit, how can I compute its normal ? Should I map the 3x3x3 block surrounding the voxel to a precomputed normal ?

  Take the unit surface normal of the colliding voxel (pointing outward).

sentences:
Rotating one object to track another in worldspace This should be pretty straightforward, but its been awhile and my brain has officially turned off for the holidays :-) To keep things simple, lets assume everything is in 2D space.

I've got a large circle, who's centre will be the origin (0,0).  Now lets say I've got Object A, who is sitting inside this circle at the origin, and is facing a direction (0,1), the positive y direction. Circumference of the circle shouldn't matter for what I'm trying to do.  Now let's say I have two incoming parameters (which I have no control over).  One of these parameters is a rotation (in Radians), and the other is a translation.  If I apply this rotation to Object A while it's in the centre of the circle, followed by the translation, the object will now be on the outside of the circle but its direction will be facing the origin.  In other words, the incoming parameters will translate the object to be outside but facing the centre of the circle, where it was originally inside and facing the positive y direction.

Here's where I'm stuck:  If I also have a random point inside the same circle, and I want Object A to be translated to the exact same position it would normally be translated to (outside the circle) from those two incoming parameters, but facing the direction of this point instead (which could be anywhere inside the circle), what's the most efficient combination of operations to apply to it to accomplish this, assuming object A always starts in the origin, and this is the only information I have (the translation/rotation parameters, and the position of the point I wish to track).  Assume the point can move around anywhere inside the circle, and the object will remain outside in the exact same position but its direction will "track" the point regardless of where it is.

UPDATE for clarification:  Sometimes a picture is worth a thousand words ;-)  See attached image... #1 is where the object starts at.  #2 is what would happen if I apply the incoming translation and rotation parameters.  #3 is what I'm trying to achieve.  I do know that the "random" point is located at (0, 0.5) in this example.  How do I get from #1 to #3 in the least amount of steps.

sentences:
3D Perspective issues My team is currently developing a 3D Sidescroller game and we encountered some issues regarding the whole in-game perspective of the levels.
The levels are composed of 3D modeled corridors which are specifically modified to simulate the effect of - 'immersive-depth'.

Example(Front View - InGame View):

Example(Side View - Angled Floor):

Example(Flat Floor Comparison - Angle vs No Angle)

The issues I spoken of are appearing at the moment I start adding 3D objects on the corridor, like lamps, crates, cabinets etc. They all seem off, due to the fact that the whole floor of the corridor is angled forward
(even if the objects themselves are angled forward).

I know it seems like a strange question to ask but are there any smarter ways/alternatives of simulating the same depth of the corridor without angling it's floor?

P.S.

1) 2D is not an option. The camera isn't static.

2) Increasing the Angle of the camera on a flat floor doesn't simulate the same effect.
The camera was meant to change dynamically in certain situations, via it's angles and position (up and down). The higher it is the more it resembles the perpendicular version. However, if the camera is lower, at a lower position and angle (on the same level as the floor is) the difference comes in place, due to the back walls being higher.

EDIT:

We've decided to stick with the 'flat'- 90 deg, floor, it's easier to maintain.

Although the Angled version is more entertaining, it is limited by the fact
    that increasing the depth - means increasing the angle, which at a certain
    point will generate an inadequate look.

sentences:
Stop schedule on gameOver I have 2 events running through time in my game. I want that when gameover starts, this events stops running

This is my code:

- (void)onEnter
{
   [super onEnter];
   [self schedule:@selector(addStars:) interval:1.5];
   [self schedule:@selector(addBoxes:) interval:2.5];

}

-(void)gameOver
{

 //stop schedule addStars
 //stop schedule addBoxes

 }

sentences:
How can I handle a bunch of achievements in a game? Take for example Team Fortress 2.  There are a huge load of achievements, and I'm wondering how the manages all of them. And since there's a lot of achievements, I'd also like to know how it "knows" you've achieved one.

Basically, how can the game handle a huge achievement system?  Is there some special process? Are there hundreds and hundreds of boolean variables all over the code, waiting for certain conditions to be met, then ,Bam, achievement?

If there are several approaches, what are they?

sentences:
Unity SphereCast HitInfo Give me an interpolation of the normal surface? I'm doing a SphereCast for a GroundCheck of a player.
I have my Raycast hitInfo, and here in the picture at the left, I Debug.drawRay in black the direction of the hitInfo.normal every frame

It seems like hitInfo.normal give me an interpolation of the normal, not the real normal of the surface...

I only want the real normal of the surface... (red normals I have draw on the right), and may be the green one (the perfect normal between 2 surface), but if I can have only the red one, it would be great

How can I do it ?

Thanks !

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:
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:
convert clock input into 24 hour format I have stuck in a logical problem I have a third party package of DayNight. It takes hours input(24-hour-format) to show dayNight effects in scene

My code is to transform 12 hours clock cycle into 24 hours is

if (todsky.Cycle.Hour >= 0 && todsky.Cycle.Hour < 11.97)
            {
                Debug.LogError("1st");
                var degree = 360 - hourniddle.transform.eulerAngles.z;
                var degreeToMintues = degree * 2;       //multiply each degree with 2 to get correct minutes
                ConvertMinutesToHours(degreeToMintues); //
            }
            else if (todsky.Cycle.Hour > 11.97 && todsky.Cycle.Hour < 23.97)
            {
                Debug.LogError("2ndt");

                var degree = 360 - hourniddle.transform.eulerAngles.z; // as rotation is anti-clock getting rever degree
                var degreeToMintues = degree * 2; //multiply each degree with 2 to get correct minutes
                var MintuestTo24HoursMintueCoverstion = 720 + degreeToMintues; //add 720 mintues into current minute in order to get 24-hour-format
                ConvertMinutesToHours(MintuestTo24HoursMintueCoverstion);

            }
 void ConvertMinutesToHours(float mintues) {
        result = TimeSpan.FromMinutes(mintues);
        Debug.LogWarning(result.Hours + ":" + result.TotalHours + ":" + result.Minutes + ":" + result.TotalMinutes);
        todsky.Cycle.Hour = (float) result.TotalHours;
        Debug.LogWarning("setted hours : " + todsky.Cycle.Hour);
    }

But it is not working correctly .
 have made a clock GUI(360-degree) and as you know it only show 12 digits-format not 24. I am getting clock needle movement which can be change through mouse drag. Needle z position up to 320 degree which means one degree is equal to 2 minutes and i am taking it as input from GUI. I write below code to integrate my clock needle with my DayNight package in order to integrate GUI with package and passing hour parameter into the package but it not working correctly. Problem is that else condition is skipping.

sentences:
Project development in a long distance Indie Dev environment Myself and 4 other coders have been working as a modding team for the past 7 months. We all have a very good grasp on our preferred language (C#), and also use versioning (GitHub / BitBucket / Assembler) to organize our code, and updates.

We want to now get into developing our own game. We have an idea, and have a very basic engine in place.

How do we project manage from here?

Obviously we dont want to dive into adding content, but how do we manage the project from here? Should we assign tasks to each person? How do we manage the project do that each person gets a fair share of work? Once we have a game, how should profits be split?

Any advice on this is welcome.

Thanks
Twitchy

sentences:
Why are cube map axes sometimes labelled incorrectly? In both 3ds Max (which uses a right-handed coordinate system) and Unity (which uses a left-handed coordinate system), the cube map faces labelled "left" and "right" show the view facing the opposite direction. This is not the case with the front, back, up, or down directions.

In 3ds Max, this is in the context of rendering cube map images from a Reflect/Refract map. In Unity, both cube map textures and skyboxes exhibit the same left/right "confusion". Oddly, however, the GUI labels for cube maps indicate that left is the -X direction and right is the +X direction - which is correct in Unity - while skyboxes indicate the opposite (all other axial labels are consistent between the two).

The upshot of this is that cube map images rendered by 3ds Max (which each have a suffix indicating their viewing direction) can be assigned to the texture slots in Unity with the same name and everything will work, but only because both programs label the left view as "right" and vice versa.

The only discussion of this I was able to find online was in a blog post on floored.com (search for "Unity Skybox Weirdness" and it should come up; I'd post a link but I lack sufficient reputation to include more than two). Here's an image from the post that illustrates the issue:

Is there a reason why the left/right axes of cube maps are mislabelled in both of these programs? Although it's trivial to ignore once you're aware of it, it seems like there should be a good (or at least historical) explanation for it, unless it's simply a case of a long-overlooked bug in 3ds Max that the Unity developers decided to accommodate.

Any thoughts would be appreciated!

sentences:
Change 3ds max mesh local origin pivot point I'm developing a 3D videogame in C# with XNA, my problem comes when I load my model done in 3ds max, and I try to rotate a mesh of it, because the pivot point isn't exported so it takes the local origin of the mesh, the point you get when pressing "Reset Pivot" in 3ds max.

What I want to do is to change its point default value, so that my animation gets the correct pivot point, how can I achieve this?

Thanks in advance! :)

sentences:
How do I efficiently check if a point is inside a rotated rectangle? Part for the sake of optimization, part for learning purposes, I will dare to ask: How can I most efficiently check whether a 2D point P is inside a 2D rotated rectangle XYZW, using C# or C++?

Currently, what I am doing is using a "point in triangle" algorithm found in the book Real Time Collision Detection, and running it twice (for the two triangles that make up the rectangle, say XYZ and XZW):

bool PointInTriangle(Vector2 A, Vector2 B, Vector2 C, Vector2 P)
{
 // Compute vectors
 Vector2 v0 = C - A;
 Vector2 v1 = B - A;
 Vector2 v2 = P - A;

 // Compute dot products
 float dot00 = Vector2.Dot(v0, v0);
 float dot01 = Vector2.Dot(v0, v1);
 float dot02 = Vector2.Dot(v0, v2);
 float dot11 = Vector2.Dot(v1, v1);
 float dot12 = Vector2.Dot(v1, v2);

 // Compute barycentric coordinates
 float invDenom = 1 / (dot00 * dot11 - dot01 * dot01);
 float u = (dot11 * dot02 - dot01 * dot12) * invDenom;
 float v = (dot00 * dot12 - dot01 * dot02) * invDenom;

 // Check if point is in triangle
 if(u >= 0 && v >= 0 && (u + v) < 1)
    { return true; } else { return false; }
}

bool PointInRectangle(Vector2 X, Vector2 Y, Vector2 Z, Vector2 W, Vector2 P)
{
 if(PointInTriangle(X,Y,Z,P)) return true;
 if(PointInTriangle(X,Z,W,P)) return true;
 return false;
}

However, I have the feeling that there might be a cleaner and faster way. Specifically, to reduce the number of math operations.

sentences:
In Box2D, how can I check for bodies within a circle? I'm trying to sample random positions to find one that is sufficiently far from other bodies.

Hence I'd need to test for bodies within a given circle. So far, I've used b2World::QueryAABB around my circle (which does what I want but for a rectangular area), then manually doing an intersection test with all the fixtures it gives me.

It seems to me like Box2D should already provide such functionality—is there a way that lets me do this without reinventing most of the wheel?

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:
Unity3d iOS: unable to find iPhone_GlesSupport.h i've an old unity project and i've tried it just today (with unity 4.1) and xcode 4.6.
Xcode is unable to build it for the error: "iPhone_GlesSupport.h" file not found.

Im pretty a noob under xcode and objective-c in general so i've searched in internet about this problem, but without any luck.

Anyone know more or have experienced this problem?

Thanks

sentences:
Unity Collider2D is causing the game object to disappear upon collision I have gone through just about everything to try and isolate this bug.

I have isolated it down to the enemy collider, but have not solved the issue.

When my player collides with my enemy, the enemy game object is destroyed and removed from the hierarchy (until reset).

Removing the enemy collider fixes this issue of course. However removing the player collider does not.

Neither the player nor the enemy has collider code written into their scripts, so I can't blame that. I did have an OnEnterCollision2D script added to the enemy game object, but have since removed it in an effort to debug the situation, and it did not do a thing.

There are no other scripts at play - only the relationship between player and enemy colliders.

I'm newish to Unity and coding, but I can't seem to find anything on this issue. Any help is much appreciated!

What. The. Heck.

If you're wanting to read through the scripts, you can here:
https://forum.unity.com/threads/oncollisionenter2d-is-destroying-my-game-objects-and-i-cannot-figure-out-why.710837/

sentences:
Using State Pattern with Unity I am new to Game Development and Unity. I have written a component for Jumping and Running, CharacterJumpAbility.cs and CharacterRunAbility.cs.

I would like the Character to be able to Jump only if the Character is not moving. I came across a State Pattern but I can't understand how to apply it. For example if I want to Jump, first I must check if the Character is Running, but I have to do this in the CharacterJumpAbility.cs or in the CharacterController.cs (the component who handles inputs)?

If I define a state for example:

public enum CharacterState {
    Run,
    Jump
}

For example if the player is pressing the space bar, I have to set the Jump state, the code that sets state = CharacterState.Jump should be written in the CharacterJumpAbility.cs or in the component that handles inputs?

And if I want to set a new state for example Jump, while I am running, this is clearly not possible, how to handle situations like these?

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:
Parallax background positions when jumping I am currently building my first Mobile game. The concept is pretty simple, it's a sideways scroller.

I have implemented 5 layers to act as parallax scrolling, these are working quite well for general movement. However they look a bit weak when jumping, I would like to apply some sort of ratio which gives a  3d effect to the jump. I made a basic attempt, however it just looks a bit naff.

I have struggled to find any tutorials on this , could anyone provide any help?

As requested, here is some example code

    backgroundJumpEnd = function(){
    transition.to(hills,{time=600,y=153})
    transition.to(hills2,{time=600,y=153})
    transition.to(hills3,{time=600,y=153})
    transition.to(tree,{time=600,y=153})
    transition.to(trees,{time=600,y=180})
    transition.to(cloudsBig,{time=500,y=cloudsBig.y-6})
    transition.to(cloudsBig2,{time=500,y=cloudsBig2.y-6})
    transition.to(cloudsSmall,{time=500,y=cloudsSmall.y-2})
    transition.to(cloudsSmall2,{time=500,y=cloudsSmall2.y-2})
    transition.to(sky,{time=500,y=sky.y-3})
    transition.to(sky2,{time=500,y=sky2.y-3})
    transition.to(sky3,{time=500,y=sky3.y-3 })
    transition.to(floor,{time=500,y=floor.y-15})
`}`

`backgroundJumpStart = function (){
    transition.to(hills , {time=500, y=180,onComplete=backgroundJumpEnd })
    transition.to(hills2,{time=500,y=180})
    transition.to(hills3,{time=500,y=180})
    transition.to(tree,{time=500,y=185})
    transition.to(trees,{time=500,y=220})
    transition.to(cloudsBig,{time=500,y=cloudsBig.y+6})
    transition.to(cloudsBig2,{time=500,y=cloudsBig2.y+6})
    transition.to(cloudsSmall,{time=500,y=cloudsSmall.y+2})
    transition.to(cloudsSmall2,{time=500,y=cloudsSmall2.y+2})
    transition.to(sky,{time=500,y=sky.y+3})
    transition.to(sky2,{time=500,y=sky2.y+3})
    transition.to(sky3,{time=500,y=sky3.y+3})
    transition.to(floor,{time=500,y=floor.y+15})
}`

sentences:
Positional sound with headphones? I've have read this interesting question, where is explained how to simulate positional sound with the left and right channel; but still I wonder: is it possible to simulate positional sound (with headphones) when the source is "in front" of you, "behind", "above", or "below"?

Again, all I can do is to adjust left/right volume.

EDIT: I can also alter the playback rate (pitch) of the sound, ranging from double to half the original pitch.

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

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

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

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

Therefore, any suggestion to tackle this problem?

sentences:
Tangent space - Lengyel vs ShaderX5 - difference I have been studiing tangent space calculations and came across two solutions

E. Lengyel - http://www.terathon.com/code/tangent.html

ShaderX5 solution - (solution is also desribed here http://www.thetenthplanet.de/archives/1180)

What is the difference between tangent computed one or another way? Lengyel solution seems "easier" but I am no quite sure of its orthogonality to the normal vector of the tangent plane.

sentences:
LibGDX Box2DLights shadow offset problem on bodies Hello I just started to use LibGDX, and it's awesome.
I looked at the Box2DLights library, and started to learn how the lighting work here.

I got something up:

(source: gyazo.com)

As you can see, it works, but the shadow of the sprite goes over itself, and doesn't start in the right place.

Why is it doing this? is it possible to set offsets?

This is how I initialize them:

    this.texture = new Texture("sprites/water.png");
    this.camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    this.camera.setToOrtho(false);
    this.renderer = new SpriteBatch();

    this.map = new TileMap(20, 20);
    this.map.generateAllSame(new Texture("sprites/sprite.png"));

    this.world = new World(new Vector2(), true);

    this.createBodies();

    RayHandler.setGammaCorrection(true);
    RayHandler.useDiffuseLight(true);
    this.ray = new RayHandler(this.world);
    this.ray.setAmbientLight(0.2f, 0.2f, 0.2f, 0.1f);
    this.ray.setCulling(true);
    this.ray.pointAtLight(50, 0);
    this.ray.setBlurNum(1);
    camera.update(true);
    this.spriteLight = new PointLight(ray, 128);
    this.spriteLight.setDistance(500f);
    this.spriteLight.setPosition(150, 150);

    this.spriteLight.setColor(new Color(0.5f, 0.8f, 0.7f, 1f));
    this.spriteLight.setSoftnessLength(0);
    this.spriteLight.setSoft(true);

public void createBodies() {
    CircleShape chain = new CircleShape();
    chain.setRadius(10);

    FixtureDef def = new FixtureDef();
    def.restitution = 0.8f;
    def.friction = 0.01f;
    def.shape = chain;
    def.density = 1f;

    BodyDef body = new BodyDef();
    body.type = BodyType.DynamicBody;

    for (int i = 0; i < 3; i++) {
        body.position.x = 40 + MathUtils.random(500);
        body.position.y = 40 + MathUtils.random(500);

        Body box = this.world.createBody(body);
        box.createFixture(def);
        this.bodies.add(box);
    }
    chain.dispose();
}

And my rendering:

public void render() {
    handleInput();
    camera.update();
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    renderer.setProjectionMatrix(camera.combined);

    renderer.disableBlending();
    renderer.begin();
    this.map.render(renderer);
    renderer.draw(texture, 50, 50);

    renderer.enableBlending();

    for (Body body : this.bodies) {
        Vector2 pos = body.getPosition();
        renderer.draw(texture, pos.x + amount, pos.y);
    }
    renderer.end();

    ray.setCombinedMatrix(camera.combined, camera.position.x, camera.position.y,
            camera.viewportWidth * camera.zoom, camera.viewportHeight * camera.zoom);

    ray.update();
    ray.render();

}

What did I do wrong?

sentences: Can I mix OpenGL and swing? I'm working on a small game library for me and some people I know that just handles the window and nothing special that we weren't gonna use. I know how to use OpenGL and stuff I just don't like having to deal with more then one library at a time like OpenGL and Swing so I want to combine them into something basic. Anyway my question is, is there any way I can use OpenGL's rendering onto Swing? I need a simple answer. I also don't want to have to include other libraries into my library, I just want it to be the only jar in the program that isn't program specific.

sentences:
OpenGL ES 2 on Android: native window According to OGLES specification, we have the following definition:

EGLSurface eglCreateWindowSurface(EGLDisplay display,
                                  EGLConfig config,
                                  NativeWindowType native_window,
                                  EGLint const * attrib_list)

More details, here: http://www.khronos.org/opengles/documentation/opengles1_0/html/eglCreateWindowSurface.html

And also by definition:

int32_t ANativeWindow_setBuffersGeometry(ANativeWindow* window, int32_t width,
                                         int32_t height, int32_t format);

More details, here: http://mobilepearls.com/labs/native-android-api

I am running Android Native App on OGLES 2 and debugging it in a Samsung Nexus device. For setting up the 3D scene graph environment, the following variables are defined:

struct android_app {
    ...
    ANativeWindow* window;
};
android_app* mApplication;
...
mApplication=&pApplication;

And to initialize the App, we run the commands in the code:

ANativeWindow_setBuffersGeometry(mApplication->window, 0, 0, lFormat);
mSurface = eglCreateWindowSurface(mDisplay, lConfig,
                                  mApplication->window, NULL);

Funny to say is that, the command ANativeWindow_setBuffersGeometry behaves as expected and works fine according to its definition, accepting all the parameters sent to it. But the eglCreateWindowSurface does no accept the parameter mApplication->window, as it should accept according to its definition. Instead, it looks for the following input:

EGLNativeWindowType hWnd;
mSurface = eglCreateWindowSurface(mDisplay,lConfig,hWnd,NULL);

As an alternative, I considered to use instead:

NativeWindowType hWnd=android_createDisplaySurface();

But debugger says:

Function 'android_createDisplaySurface' could not be resolved

Is 'android_createDisplaySurface' compatible only for OGLES 1 and not for OGLES 2?

Can someone tell if there is a way to convert mApplication->window? In a way that the data from the android_app get accepted to the window surface?

sentences:
What are the advantages of having a real time based physics? Possible Duplicate:
  Fixed time step vs Variable time step

Now just let me clarify what I mean by "real time based physics", which I will call RTBP from now on. Well, basically, it implies taking, you guessed it, actual time into calculations.

For example:

timePassed = time - lastTime

positionx += vx*timePassed
positiony += vy*timePassed

lastTime = time

This would be a simple RTBP model. What's the alternative? I call it "step based physics" (SBP from now on), which would just be this:

positionx += vx //v in SBP is obviously smaller than in RTBP
positiony += vy

I currently use SBP, but I see that many people actually include time in their calculations. Why is that? I of course limit the update time to 1000/60ms.

Once the update interval is limited, both models would behave the same. The only difference is when the FPS drops. I believe that here is where PBS excels over RTBP. In PBS the game would, yes, run slower, but would always produce the same results! In RTBP, the position might increase so much that an object actually passes through a wall!

Anyway, there must be something that I'm missing.

sentences:
Is this Code saving performance ? It is kind of a Occlusion Culling I wanted to do Occlusion Culling on my Scene but I just get a bunch of Errors like "Couldn't load geometry..." etc. I tried to do like another way but the same thing, the Occlusion Culling just disables the Objects the Camera dont see.
I tried it with OnTriggerEnter and Exit.

I have 2 Areas one is on the left and one on the right, when the Player is walking in the first Area the Box Collider checks it and disables the Objects in Area2 but when Player is walking into Area2, Objects in Area1 disables and Different. Got the Script on both Areas that it disables a list of arrays as GameObjects.

My Question is, does this save performance ?

public GameObject[] deactivatingModels;
bool playerEntered = false;

void OnTriggerEnter (Collider other)
{

    foreach(GameObject envis in deactivatingModels)
    {
        if(other.gameObject.tag == "OcclusionCuller")
        {
            envis.SetActive(false);
            Debug.Log ("Player has entered Occuling Zone");
        }
    }
}

void OnTriggerExit(Collider other)
{
    foreach(GameObject envis in deactivatingModels)
    {
        if(other.gameObject.tag == "OcclusionCuller")
        {
            envis.SetActive(true);
            Debug.Log ("Player has left Occuling Zone");
        }
    }
}

sentences:
Orbits: Combine the Pros of RK4, Symplectic Euler, and Verlet Velocity Integrator Recently, I've implemented and compared a number of basic integrators for my physics engine.  The 3 that gave me the best results are RK4, Symplectic Euler, and Verlet Velocity, but I think I need something a little more advanced.  I've done many Google and StackExchange searches but haven't found what I'm looking for.

I'm looking for something that combines the strengths of those integrators without their weaknesses. I'm only concerned about orbital mechanics. Drag and other similar forces will not be put through the integrator because it's not important that I get perfect answers for those other forces, but (near) perfect answers are very important for my orbital mechanics.  Computationally expensive algorithms (within reason) are not as much of a concern as accuracy is.

My thoughts and primary concerns are as follows:

RK4 Pros: Very accurate.
RK4 Cons: Loses energy over the long term.  This sim needs to be able to run for a VERY long time, so experiencing this kind of "orbital decay" is quite undesirable.
Symplectic Euler and Verlet Velocity Pros: Symplectic/Don't lose energy.
Symplectic Euler and Verlet Velocity Cons: Much less accurate.  Highly eccentric orbits make this apparent very quickly...even with a simple massless-satellite-orbiting-a-massive-object scenario, the satellite's orbit "rotates" around the parent object over longer periods of time.  This is extremely undesirable behavior.

For my purposes, I cannot resort to orbits "on rails".

TLDR: I am looking for an algorithm that gives me the accuracy of RK4 without the slow decay.  Computational expense is not a major concern.

Thanks in advance for the help!

Update 1: I found a similar question here: https://stackoverflow.com/questions/3680136/help-with-symplectic-integrators

There might be good answers in the accepted answer, but after several hours of study, I have only determined that they are very difficult to understand.  I will keep studying the accepted answer's linked paper and source code and post an answer if I get results. However, I suspect that while the algorithm is not much more complicated than RK4, the symbology and style of the linked explanations/source code are making it very difficult for anyone without a heavy math/physics background to understand.  Unfortunately, as a comment noted, the OP accepted that answer, but never came back and gave a clearer explanation himself.  I'll leave this question open and keep studying myself. Hopefully, together we can come up with a clearer answer for future searchers!

sentences:
Can you run OpenGL 2.0 on modern machines? I'm looking to get into 3d with OpenGL, using SDL to help with other stuff.

I found plenty of good tutorials (lazyfoo is a big one), but "Learning Modern 3d Graphics Programming" uses a newer version of openGL that I'm not able to run!

I opened up OpenGL extensions viewer, and I can only run OpenGL 2.0, whereas most tutorials are in higher versions.

I ask this because I've heard that just about everything in 2.* got depreciated in the newer versions, so I'm worried that my code might not work.

I'm looking at a few other tutorials, but I'm so used to SDL that those just confuse me...

So should I bother trying to do graphics programming now,  or should I just wait until I can upgrade my computer?

sentences:
How to Cease the Ragdoll Wiggle Dance When I instantiate a ragdoll object, it collapses nicely, but the movement never stops. It wiggles continuously. I'm using CharacterJoint components.
None of the colliders (box and capsule) intersect. They are all spaced by at least a small amount.
I tried playing with angular drag of the colliders, but that seems not to work. There do not seem to be any values in the CharacterJoint that affect this. But I'm probably wrong.
How can I get the physics to stop "wiggling" after a certain threshold?

sentences:
Can you do a stencil glow with native GM:S commands? I am looking to a stencil glow on GM:S with d3d_* functions.

I could not find anything how to access the stencil buffer though.

Is it even possible to access the stencil buffer without using an external .dll?

sentences:
How can I get the "SelfActor" in OnBeginActorOverlap? The signature it takes is

void ( AActor* OtherActor )

However, The actor that is handling this event is not involved in the overlap. How can I access the actor that owns this delegate? Assuming I can't store a reference to this elsewhere. Is there another delegate that takes that parameter? Is this reference stored in OtherActor somewhere?

sentences:
How to use the Vulkan graphics backend in the Stride game engine? What do I have to do in order to run my Stride game on the Vulkan graphics platform?

The documentation section seems to be outdated, the drop-down doesn't exist anymore:
https://doc.stride3d.net/latest/en/manual/platforms/index.html#set-the-graphics-platform

sentences:
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:
Diverse loading-screen tips and who does that? Smaller games and projects have been seen to add jokes and tips that are not directly game related and in any form advice to their loading screens. For some reason I can't think of a tripple A title? Anyone else?

Some people around the industry think its bad taste... I've seen arguments where companies have senseless aggression as core gameplay but get iffy about throwing harmless jokes into splash screens. It was really weird.

Can you name a big game that does it?

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 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:
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:
why is Lua so important ( frequently used ) in game development I have written some small games for fun myself, but never used Lua myself.

I have seen people discussing Lua's use in games everywhere.

The question is: What benefit can I get from using Lua in game development?

Can someone explain this a little bit to me?

sentences:
Transparency problem, phong model It's the first time I'm trying to implement the Phong lighting model. I'm pretty sure everything is working fine.

I was experimenting using different materials, meaning I played with Kd,Ks,Ka and Ns values when I came across this problem.

Whenever I use a material with alpha value less than one I get this weird result :

At first I thought it has to do with the normals of the model since they are all supposed to point away from the model but it doesn't seem to be the case.

Any ideas?

sentences:
How to draw equal length line stripes on a parabola? Simply put I'm making a basketball game. I'm using these equations to predict the ball position and it works fine:

x = vx * t
y = vy * t + 0.5 * gravity * t * t

But I can't find a way to draw equal length line stripes on the parabola. At this moment I'm using:

t = t + dt

in which dt is the time elapsed in last frame. It works but the line segments would be longer if velocity is larger. Anybody know a way to draw equal length line stripes like the flying trails in Angry Bird? Thanks very much.

I suppose I should calculate the integral on the curve but I can't get it through...

sentences: 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: What is the formula or algorithm used in libgdx delta time? I'm studying time stepping algorithm and I need to know how delta time works in libgdx, because I think delta time uses some kind of time stepping algorithm.

sentences:
what is the very last element of a 4x4 transformation matrix for? while its a similar value to its neighbour - Z translation (and I wont say if thats above or to the left for fear of sparking a religious war!) and it only seems to change when the Z translation value changes, however the value is not quite the same

Normally I just see either this value ignored or just a 1 in all the tutorials I've seen

Can someone explain exactly what this last element does ?

sentences:
Queueing with Unity's NavMeshAgent I have created a strategy game where the units use Unity's NavAgent pathfinding and flocking algorithms.  This works well.  However, I need to add queueing so that units will queue sensibly.  This works most of the time, but it isn't perfect and I want to know if there's a better way of doing it.

My first draft was to simply check which unit is closest to the destination, but this caused issues because a group might be navigating around an obstacle and the unit closest is at the back of the queue... so the whole group stops.

Second draft checked the distance to destination based upon the length of the path each unit had to take.  This works far more often, but sometimes still has issues.  Sometimes the same problem happens, but much less often.  The one who is supposed to be moving stops, and so the entire group stops.

There's also a problem I've noticed, where the waiting units could sometimes benefit from rotating, even if they shouldn't be moving.  Unfortunately they sometimes get stuck and will wait before they can move, to rotate.  If they could rotate when forbidden from moving it'd help considerably too.

What I need to know...

How can I make Unity NavAgent's queue, so that they will wait for the other agents closest to the destination to move first?
How can I ensure that this does not stop agents from rotating while in a queue (rotating may move them into a better position in the queue).

Code:

Unit Movement Function

private void Movement()
{
    // Unit is moving.
    if (moveVectors.Count > 0)
    {
        navAgent.isStopped = false;

        // Check for whether to wait in queue.
        Vector3 nextVector = transform.position;
                nextVector += transform.forward * speed * Time.deltaTime;

        foreach (Unit unit in list)
        {
            if (unit != this &&
                unit.moveVectors.Count > 0 &&
                Vector3.Distance(unit.transform.position, nextVector) <= (unit.footprint + footprint) &&
                PathDistance(unit) < PathDistance(this))
            {
                navAgent.isStopped = true;
                return;
            }
        }
    }
}

There's a bit more to Movement, but it's not relevant so we'll ignore it for now.

PathDistance Function

private float PathDistance(Unit unit)
{
    Vector3 startPosition = unit.transform.position;
    Vector3 endPosition = unit.moveVector;
    Vector3 lastPosition = startPosition;
    Vector3[] path = unit.navAgent.path.corners;
    float distance = 0;

    for (int i = 0; i < path.Length; i++)
    {
        distance += Vector3.Distance(lastPosition, path[i]);
        lastPosition = path[i];
    }

    distance += Vector3.Distance(lastPosition, endPosition);
    return distance;
}

Is there a better way of achieving the result I want?

sentences:
Efficient way of loading wavefront models in openGL game In my game, a RTS game, the units are all wavefront obj. all their animation frames are each seperate wavefront obj file. ie. without any skeletal animation; fully rigid models. So when many units are loaded before a game starts, it takes too much time. for example, if 20 types of units are loaded, they take approximately 700/800MB in memory, take atleast 3 minutes to load.

Can it be done in an efficient way somehow?

Solutions I have already used:

As obj parsing take too much time. I have stored each obj as memory dump and load that dump. This helped a lot atleast reduced to 3min from 10min, for above example.

Further Possible solution I tried:

I tried loading the anination frames on runtime, when they are accesessed. But this is making the game slow at some crucial time. Like when fighting, all units' fighting frames are loaded together. thus making the game slow.
loading the units in different threads. Makes no improvement

sentences:
How can i scale a cube on one side on x only? I have in the Hierarchy a empty GameObject and a cube as child of it.
The cube the child is at position 0,0,0 and scale 1,1,1

But when running the game the scaling is on both sides of the cube.
I put the cube as child of the empty gameobject and scaling the empty gameobject but still it's scaling the cube on both sides.

The script is attached to the empty GameObject:

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

public class Walls : MonoBehaviour
{
    Vector3 originalScale;
    Vector3 destinationScale;

    void Start()
    {
        originalScale = transform.localScale;
        destinationScale = new Vector3(100.0f, 0, 0);
    }

    private void Update()
    {
        if (transform.localScale.x != 100.0f)
            transform.localScale += new Vector3(1, 0, 0);
    }
}

This is a working solution:

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

public class Walls : MonoBehaviour
{
    public Transform[] objectstoScale;

    private void Update()
    {
        if (objectstoScale[0].localScale.x != 100.0f)
        {
            objectstoScale[0].localScale += new Vector3(1, 0, 0);
        }
    }
}

But i want to make that the same cube will also scale one side on the z. So the cube will be scaled on both x and z but without filling it one be like frames. So i tried this:

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

public class Walls : MonoBehaviour
{
    public Transform[] objectstoScale;

    private void Update()
    {
        if (objectstoScale[0].localScale.x != 100.0f)
        {
            objectstoScale[0].localScale += new Vector3(1, 0, 0);
            objectstoScale[1].localScale += new Vector3(0, 0, 1);
        }
    }
}

And i have now two cubes childs of the empty gameobject one cube position is 0.5,0,0 the second is 0,0,0.5 but what i'm getting is:

What i want to do is to create automatic a rectangle scaling a cube on 4 sides at the same time not filled rectangle.

For example like this:

sentences: Standard key bindings for movement along three axes? I understand that the WASD keys are standard for moving a character along two axes (left/right, up/down) because in the QWERTY layout, they are arranged like the arrow keys. I want to make a game where the character can move along three axes, i.e. also front/back. Are there standard key bindings for this as well?

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:
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:
How can I access an OpenGl buffer from within a GLSL 330 shader? I am currently attempting to create a simulation using OpenGl's GPU acceleration for both the simulation computations and rendering. The rendering portion of my simulation is complete and working, but I still need to create the simulation portion. To do this, I want to use transform feedback, for I am rendering as GL_POINTS and each point needs to be moved in relation to every other point each frame. This matches nicely to a vertex shader and transform feedback abstraction. The issue comes from the fact that my input data (the initial positions of each point) is in a buffer, and each vertex shader invocation in the transform feedback render only has access to that specific entry in my buffer, while I need access to all entries in my buffer. How can I solve this issue?

I can't use compute shaders because I am targeting OpenGl 3.3. I have also considered taking the buffer data, copying it to the CPU, and then back to the GPU in the form of a texture, however this is likely to be incredibly inefficient, especially as I begin scaling up how many points I am working with. This is further exasperated by the fact that textures don't allow me to get pixels at integer coordinates, and passing whole numbers as floating point coordinates is likely to cause floating point error to be sufficiently significant to be a problem, especially with texture filtering (I have thousands of points for now, but that will increase to whatever my GPU can handle once I have it working).

sentences:
Ortho projection of 3D points with a vector I have 3D points and I need to make an 2D orthographic projection of them onto a plane that is defined by the origin and a normal n. The meaning of this is basically looking at the points from the top (given the vertical vector). How can I do it?

What I'm thinking is:

project point P onto the 3D plane: P - P dot n * n
look at the 3D plane from the "back" in respect to the normal (not sure how to define this)
do an ortho projection using max-min coordinates of the points in the plane to define the clipping

I am working with iOS.

sentences:
How can I render attack ranges as in this screenshot? Divinity: Original Sin 2 has an amazing range-of-attack display. When I select a character's abilities, the range of the ability will appear (as shown in the screenshot below).

I'd like to know how to create an effect like this.

You can see this system in motion via this YouTube video

I think It just displayed navmesh , so I tried to display my navmesh.I used NavMesh.CalculateTriangulation() , GL API to displaying.

After baking navmesh attach this script to your camera and give this a material:

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

public class NavmeshDebuger: MonoBehaviour {
    public Material material;

    void OnPostRender() {
        var triangulation = NavMesh.CalculateTriangulation();
        if (material == null) {
            return;
        }
        GL.PushMatrix();

        material.SetPass(0);
        GL.Begin(GL.TRIANGLES);
        for (int i = 0; i < triangulation.indices.Length; i += 3) {
            var triangleIndex = i / 3;
            var i1 = triangulation.indices[i];
            var i2 = triangulation.indices[i + 1];
            var i3 = triangulation.indices[i + 2];
            var p1 = triangulation.vertices[i1];
            var p2 = triangulation.vertices[i2];
            var p3 = triangulation.vertices[i3];
            var areaIndex = triangulation.areas[triangleIndex];
            Color color;
            switch (areaIndex) {
            case 0:
                color = Color.red; break;
            case 1:
                color = Color.green; break;
            default:
                color = Color.blue; break;
            }
            GL.Color(color);
            GL.Vertex(p1);
            GL.Vertex(p2);
            GL.Vertex(p3);
        }
        GL.End();

        GL.PopMatrix();
    }

}

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: I can't figure out how to animate my loaded model with Assimp I have loaded in a model to my C++ OpenGL game. It is a COLLADA file type that I have loaded, and I setup an animation under blender for the file. The problem is I don't know how to animate the model. The Assimp documentation didn't really help me out. Their source code didn't use animations, and I can't seem to find anywhere online that someone explains how to animate your loaded model... I'm sorta wondering if someone could link me to a helpful website, or maybe just help me out, so that maybe I will understand how to do animations with assimp.

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:
Implementing a color picker I'm making a paint program using applets in Java, and I want to create some sort of color palette where the colors blend into each other, similar to this:

However, I'm having trouble understanding the correlation between the R, G, B, values and the X, Y coordinates for both the outer circular color palette, and the inner hue selecting palette.

Representation:

sentences:
How to load data for specific level at runtime? I'm trying to create a game with many levels loaded from XML files. In my game I have many objects in each level.

At present my game contains 20 levels, and I load all the textures at once on startup. But I think the correct way to do it is to only load textures used in the current level. I don't know how to do that. So please explain this by providing some example code.

At present I create a class for each type of entity by extending my Sprite class. This subclass loads the appropriate image. I know this is not the best way to do things.

Basically I want to know how to load large levels efficiently in Andengine.  What is the proper method for loading textures, level data and background images from files when the level is run?

sentences:
Driving Force GT: Force Feedback and Wheel Rotation I'm diving into the world of game development on PC and have a language agnostic question in regards to controller output.

I have in my possession a Logitech Driving Force GT. This particular steering wheel controller has force feedback (aka vibration or rumble) and the ability to turn the wheel through the game.

What are my options for interfacing with this advanced functionality (not the basic axis rotations and button presses)? I've read the DirectInput and xInput documentation with no luck. Is it like a propriety Logitech only API, or as simple as passing information via HID?

Any pointers that will lead me in the right direction would be greatly appreciated!

sentences:
Patterns for racing AI behaviour So let's say you've got a spline-based racing AI.  Assume it can already handle the basics of braking and steering around the track.

How would you structure and implement collision avoidance, overtaking, drafting, blocking and other behaviours so your cars remain competitive but make interesting races?

Links to papers/implementations would be awesome.

sentences:
Leaderboard Testing on Google Play Services I have a shared Google Play Developer account so that he allowed me to publish a game app. Next, I want to know if in order to test the online highscore is to upload the APK and publish it first before adding a new game at the Game Services section.

One thing, according to this link and this link on setting up Google Play Services, these tutorials on implementing code for the leaderboard is possibly applied on the Manifest. Is it still the same in Unity if I added the lib folder onto the plugins folder of the Unity project and how?

sentences:
How do I add corner tiles to infinitely generated terrain base tiles? I have a tileset as seen on the right and they make the images seen on the left:

In game I have placed the full grass and full stone tiles for each chunk (infinitely generated) using perlin noise as seen in the image below:

I am trying to find a way to determine what corner tiles to use and then place them.  As you can see there is so many possibilities that I don't know how to do it.  Using Lua with love2d engine by the way.

This question is different.  Everything I read about bitmasking with corners says that you need at least 48 tiles or more in a set to do corners.  I am wondering how and if it is possible to use the tile set at the right which doesn't need this many tiles to make any possible shape.  It only uses 14 original plus 2 existing tiles.  Here is a image of what tiles are used in bitmasking.

sentences:
Random generated text not working I'm trying to make a game which requires a random generation of sentence upon pressing spacebar. I've never done anything like this and wanted to give it a shot with whatever knowledge I had.

Whenever spacebar is pressed, "Be something in something." appears. I want the somethings to be randomized.

This what I wrote in the Create event -

global.profession = irandom(2);
global.situation = irandom(2);

And this in the Space event -

draw_set_colour($777777);
draw_set_font(fnt_rpl);

if global.profession = 0{
  global.profession = "a nurse"
}

if global.profession = 1{
  global.profession = "a driver"
}

if global.profession = 2{
  global.profession = "a police officer"
}

if global.situation = 0{
  global.situation = "in a hospital."
}

if global.situation = 1{
  global.situation = "in a car."
}

if global.situation = 2{
  global.situation = "in a police station."
}

draw_text_ext_transformed(200, 500, "Be" + global.profession + global.situation, 20, 800, 1, 1, image_angle);

Room is set to be 1920x1080 and I've added the object in the room. I'm getting no result, not even an error, when I press space.

sentences:
Objects are stumbling in place continuously. How to fix that? I have a nasty problem with my physics engine. Objects sometimes just jump in place, or roll left and right.

Main game loop works in that manner:

Every living object is updated (it changes velocity, the logic is different for each object)
Engine computes collisions using objects' positions and velocities and resolves them.

Imagine that we have a grenade positioned at one pixel above ground, with zero speed, and the gravity is 1 px/tick^2. Normal bounce coefficient is 0.5, so an object will bounce with half speed.

According to the algorithm:

Object's controller adds gravity to its velocity, so now v = -1.
Engine moves object to y = 0, no collisions happen.
Velocity is changed to -2 by the controller.
Engine tries to move the object, the collision happens immediately, v is set to 1, and object moves to y = 1.
Velocity is changed to 0 by the controller.
The object remains in place.

Initial conditions has reproduced. The object will bounce forever with a period of 3 ticks. These situations vary, but they all are caused by discrete nature of the engine described above.

This bug was in every version of my game. Objects may vary in shape and size, and the terrain is destructible Worms-like. I use my own engine that uses swept collision detection customized to work with small and fast objects, never letting them go through impassable object unless they were spawned inside, and the only acceptable option for me is to modify it.

One thing that I have in mind that I can detect if object had very low speed for some time, make it "immobile" and call different controller functions depending on "immobile" flag. It's an ugly solution though, because the complexity of my logic will increase. Also, when a round object stands on two points and we remove one, it will not fall. So this approach is wrong at all I guess.

What is the right approach to fix that?

sentences:
Why am I unable to edit the Input Field object's script? When attempting to edit an Input Field object's script like so

I get the following error:

  Unable to open C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll: Check external application preferences.

Why is Unity attempting to open a *.dll, here?

sentences:
How should I connect objects when using the MVC paradigm? This has been confusing me for the past week as I am trying to make my first actual game. It's only my 2nd year learning Java so I am really trying to learn how to program like a professional organization and how classes interact and whatnot.

I found that the MVC is generally the pattern for professional programs (although there are different ways). I've been trying to code in this pattern and have been confounded by the connections. I don't understand code-wise how to connect them but I understand the concept.

For example, in my game I have a Card class which contains all the logic for the card but I also have a CardDisplay class which contains the paint override and extends JComponent displaying the image of the card and the listeners. Should I consolidate them together or are they suppose to be separate?

Also how do I connect the view to the controller such as my View class containing the JFrame and update methods + GUI elements. Do I create a instance variable of View in my Game class? Do I Create the variable in the Main method?

Basically, I really am just trying to progress past learning the "actual language" and more of the technique and structure behind professional programs. I've been looking at the structure of Notch's Minicraft (not minecraft!) source code if that helps?

sentences:
How to handle interaction with the map in a 2D-RPG-typed TileMap? Sorry if this is a long post, but I'd like to explain the context before asking my question ^^"

I'm currently working on my "first" game (the more advance one, at least). It'll be a 2D-ARPG where the player will be able to interact with the map, by doing things like chopping tree, farming, mining, etc...

As it is my first game, I didn't really know where to go so I started by implementing basics functionalities, and i added more while the game took shape.

With that in mind, the first thing I did is implementing a TileMapReader that take JSON files generated by Tiled, and render it on screen. I've kept the structure Tiled use (github.com/bjorn/tiled/wiki/JSON-Map-Format) in order to store the tiles : The Map have a list of Layer, and each Layer as a list of "gid", corresponding to a Tile in the Tile Set. I generate my map directly from the Tile Set, without creating a Tile Object ... So my map really is just a bunch of Integers, corresponding to a Tile id. I generate then the display by pasting the right piece of the Tile Set at the right place on the map.

After that, I start implementing a Camera that could be move around the Map, and then a Player character who can move around too. Currently, the player is an instance of a "Body" class that is store with a x;y location in a field on the Map Object, and is display on a specific empty Layer like any other Tiles (except the sprites come from other external pictures, and not the Tile Set). I linked the control and the Camera to the character, and here I go ! Walking-in-forest simulator 2016 !

So now, I want to start implementing interaction like collision and so. The problem is that I really can't decide how to do this.
The two first thing I'd like to add to the game are interactions with the trees : collisions and chopping.

Since the beginning, trees are just collections of tiles on different Layers, like the rest of the map. But I think I have to make them as Object entity, just like my "Body" ...

To do so, I've thought of servals ways :

I could parse my Map Tile by Tile, and store my tree-tile's position in order to create my tree, but I find it way to difficult since I don't really know wish Tiles in the Tile Set are the tree-tiles, so I don't know theirs gid. Moreover, a tree is composed of servals Tiles, placed on servals Layers. So it'll be a pain to locate a single tree correctly on the map. Finally, the problems multiplies themselves if I add other entity like water or rocks ...
Another idea was to create another Map in which I store all the entity as Objects (and use the tile map for ground and water only). But if I do that, would the Tile Map really be useful ? wouldn't it be better to just randomly-generate a Map entity-full directly ? And since I want to add farming in the future, grass tiles would be passed on the Object-Map too, right ? So the Tile Map will become completely obsolete ...

I decided to go with the second one, but here again, I had to pick a way to store this second Map.
I wanted to go with a Tree-like Graph in which I would separate different sections of the map (like each node is 1/2 of it's parent node, and the last Nodes are the different entity with their positions). That would help a lot for the collision's detection, but I think it still really complicate to implement ...

So here my questions : is my approach on this player-world interactions correct ? since it is my first "big" game, I really would like to know if I'm doing it right or not ... and if not, how can I handle this interactions properly ?

I'm posting these here, hopping that there is a simple answer to it (even "just do it" would do ^^ (even if some explanation would be really nice)) and that this post will not be be closed for being too broad ^^"

sentences:
Top-Down Octree Generation of Procedural Terrain I'm trying to implement a voxel-based terrain generation  system in Unity3d (C#). I have successfully implemented a uniform 3d grid system, and have extracted the isosurface out using Marching Cubes and Surface Nets algorithms.

I quickly bumped up against the inherent issues in representing all space with a 3d grid. Much of this space was either above or below the surface, and I turned to space partitioning with octrees, as it didn't seem too difficult. One of the great things about octrees is that octree nodes that that don't have edges intersected by the surface don't need to be split again.

I researched, and found a couple resources to construct my code. One is Volume GFX, and another is the original Dual Contouring paper by Ju et al. My edge-checking is done by the Marching Cube's checking from Paul Bourke's code. If the "cubeindex" is either 0 or 255, then no edge is intersected, and the octree node does not need to be split.

My Octree generation code works for something like a quarter-sphere, where the surface features are extremely normal:

As seen in the picture, only octree nodes containing the surface are subdivided. Working great.

Now, however, when we move to something more complex, like Unity3d's PerlinNoise function:

GASP! What's that hole doing in the mesh at the lower-right corner? Upon closer inspection, we see the octree didn't subdivide properly (red lines highlighting the offending node's dimensions):

This turns out to be the same issue Jules Bloomenthal highlights in her paper on polygonization, page 10, Figure 10. Traditional methods at generating top-down octrees ("Adaptive Subdivision"), are sensitive to fine surface features relative to the size of the octree node.

The gist:

X-------X
|       |
|       |  <- Node
X--/\---X     X's - tested values, all outside of the surface!
  /  \  <- surface

The surface breaks the surface, but comes back down before it goes over a vertex. Because we calculate edge intersections by looking at the signs at the two vertices, this does not flag the edge as crossed.

Is there any method to determine if these anomalies exist? Preferably, the solution would work for more than just the Unity3d noise function, but for any 3d noise function (for cliffs/overhangs/floating islands, etc).

UPDATE

Thanks to Jason's awesome answer, I was able to answer my own questions I asked (in the comments under his answer). The issue I had was that I didn't understand how I could create a bounding function for trigonometric functions (sine,cosine,etc) due to their periodic nature.

For these guys, the periodicity is the key to bounds functions. We know that sin/cos reach their extrema values at a set interval, specifically every π/2. So, if the interval we are checking contains any multiple (cos) or half-multiple (sin) than 1/-1 is the certain extrema. If it doesnt contain a multiple (i.e. the interval [0.1,0.2]), then the range is simply the values of the function evaluated at its endpoints.

UPDATE 2:

If the above doesn't make sense, check Jason's answer to my comments.

sentences:
Understanding Tetris speed curve I'm attempting to make a Tetris clone and want to be as accurate to the games as I can. I found a chart that explains the speed curve that's supposedly used in games that follow the official Tetris guideline:
https://harddrop.com/wiki/Tetris_Worlds

1G = 1 cell per frame

Level 1: 0.01667G
Level 2: 0.021017G
Level 3: 0.026977G
Level 4: 0.035256G
Level 5: 0.04693G
Level 6: 0.06361G
Level 7: 0.0879G
Level 8: 0.1236G
Level 9: 0.1775G
Level 10: 0.2598G
Level 11: 0.388G
Level 12: 0.59G
Level 13: 0.92G
Level 14: 1.46G
Level 15: 2.36G

Another thing that might be worth noting is, like most Tetris games, my loop is updating at 60fps.

So given all this, there are two things that I'm having problems understanding.

1: The speed curve doesn't always translate to whole numbers.

For example, at level 2: 1 / 0.021017 = 47.5805300471. So every 47.5805300471 frames the game is supposed to drop the piece one row. Am I supposed to round these numbers? I can't process a partial frame so I don't understand why the speed curve comes out as a decimal.

2: Level 14 and 15 drop the piece more than one row per frame

Because it's dropping more than one row per frame, this would make some moves impossible in the game. For example, if I wanted to move a piece horizontally into a one cell space and the game is dropping the piece more than one row at a time, it will skip the row entirely and make the move impossible. Is this correct or am I missing something?

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:
How to correctly implement custom tick system? I am making a custom tick system to suit my needs (calling normal ticks every 0.2 seconds, medium ticks every 5 seconds etc...)
I followed the tutorial in this video: CodeMonkey tick system tutorial
In his tutorial, he implements the tick counting as shown:
    private const float tickTimerMax = 0.2f;

    private void Update()
    {
        tickTimer += Time.deltaTime;

        if (tickTimer >= tickTimerMax)
        {
            tickTimer -= tickTimerMax;
            Tick++;

            // Happens every 0.2 seconds.
            OnTick?.Invoke(this, new OnTickEventArgs {Tick = Tick});
        }
    }

However, in other sources I have seen that instead of subtracting tickTimerMax from tickTimer, we just straight up set the tickTimer to 0, as shown:
if (tickTimer >= tickTimerMax)
    {
        tickTimer = 0;
        Tick++;
    }

It's hard to say if there's a big difference between these two methods, because at first glance they seem to do the same thing, but clearly they have their differences. So I'm wondering, which one I should use?

sentences:
How to play an animation backwards in Unity? I know this question has been asked before but it all involves using the Animation(?) component, so that is no longer any good in Unity 5.3.1f1, I explain a bit more later.

I'm trying to simply get an animation to play backwards. On the object that I want to have an animation play backwards on, I have an animator.

private Animator anim;
...
anim = GetComponent<Animator>();

If I do:

animator.speed = -1.0f;

It tells me Animator.speed can only be negative when Animator recorder is enabled. Animator.recorderMode != AnimatorRecorderMode.Offline

So I try putting on an Animation component on the game object, and making the clip the animation.

Every time I do anything with the Animation component in script, it tells me the component must be marked as Legacy. That is no good, because when I tried making it Legacy it caused multiple problems including not being recognized by the Animator. Also GetRef errors. The entire Animation component seems like it's treated as legacy now or is just broken.

So I decided well maybe I could just try to get the animation to play backwards in the animator and having the animator record it, and then using that backwards recorded animation in the actual game. I cannot figure out how to this, even if I click record in the Animation view anim.recorderMode != AnimatorRecorderMode.Record. I don't know what to do. All I want to do is play the same animation backwards without having to copy and paste an animation in the Project and moving all of the keys around so that they are reversed. Please help. Unity's animation system seems so convoluted in script.

sentences:
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:
Unity Rotate Object Around Local X Axis , then Local Y Axis, then Local Z Axis (like a turtle) I am having trouble getting my unity gameobject to rotate in the manner I would like.

I would like my gameobject to act kind of  like a turtle from a drawing program, where I could input a Vector3 like (10, 25, -5)  and then it would rotate around its x axis by 10 degrees.  Then rotate around it's Y axis by 25 degrees, and then rotate around it's z axis by -5 degrees.

Here's a picture example: (rotations not exact)

The problem is that the axes (the green, blue, and red gizmos you see when you have an object selected) change direction as the "turtle" goes through the Vector3.

It seems like transform.Rotate(new Vector3(10,25,-5), Space.Self) should be what I'm looking for.
But it doesn't give me the result I would like! It still seems to rotate around it's start up, right, and forward vectors.

public Vector3 rotation;

Quaternion zero = new Quaternion(0,0,0,1)

void Update()
{
    transform.rotation = zero;
    transform.Rotate(rotation, Space.Self);
}

I have also tried doing some things with Quaternions to get the desired result, but I can't figure out exactly what is need. If anyone has any advise it would be greatly appreciated!

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:
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:
TiledMap problem in android device (LIBGDX) I'm a noob when it comes to programming Java apps, so I'm trying to make a very simple platformer game.
All is running very well on desktop project, but when I put the game on my Xperia a "strange" thing happens...I'm using Tiled to draw the map, and on code OrthogonalTiledMapRenderer and TiledMap, with a OrthographicCamera, I "zoom" with camera.setToOrtho a part of the map. The problem here is...

I have an elevated floor and other tiles, and on phone screen, this all appears squashed: the tiles and the elevated floor display in a lower position than the desktop version, which is an ugly problem. Resizing the window on PC, all runs and resizes good, mantaining the aspect ratio.

Sorry if I don't explain the problem very well, I'm lost on this theme! xD
I thank tutorials, examples and all other things for noobs.
I tried all viewports and still have not solved the problem, a good way I think is cut off the top part when resize, but I don't know how to do it!

Edit:
I add the screenshots, this part of code is from a good book from packt, and I don't know if I can share here here, I prefer not do it, I'm only learning at the moment, and a comment that saying a track to try solve this is sufficient, here are:

The figure is a sprite on code, the floor and the "door" are layers on tiled (floor and doors). I configured as 16x16 tiles, but configuring as 32x32 or more is the same.

The second image is the regular window, and the last is at the minimum size window, but the aspect is the same that on the more big window...If I stretched out the window, all is stretched, but the upper floor and the sprite maintains the same distance. I don't understand what is happening on the mobile version...

sentences:
Calculating the weights of matrices/bones in opengl/glsl I have a basic shape that I want to render. Nothing too complex, just a tall cube. And I want to attach 2 bones to it. Not only that, but I also want one of the bones/matrices to influence the cube more than the other bone, say 60-40 ratio. Can someone show or explain how to do this? I've been trying to find an explanation for this the past few days without luck. How to calculate the weight of a bone/matrix and how (much) effect it will have on the vertex transformation.

Im just using basic c++/opengl for this, looking for an explanation about how weights are calculated in, especially if there are multiple bones.

sentences:
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:
Continous repeatable object/image moving horizontally unity3d I want to move objects on the screen horizontally. And the user has to pop the object by touching it. When user touch it, it gets destroyed and new object comes randomly.

For experimenting, I used Unity's Scroll Rect to move them. What can be the best solution for this.

sentences:
smooth movement pygame Hello im trying to learn more about smoother movement in games. I have created a little program to hopefully help me understand this. As far as i can tell i am suppose to track time, and update positions accordingly. However, for some reason, this concept is very hard for me to understand. I am using python and pygame at the moment for my games, and in none of them i have been able to come up with the smoothness i wanted. Ive also tried several games off of the pygame website and so far none of them have had the smoothness i prefer.

like i said, i understand you have to track time, and update positions accordingly instead of just +1'ing location each frame/iteration. By doing it the 'wrong way' as far as i understand then it doesnt neccesarily sync up with the monitor thus creating the sense of jittery motion, even at high FPS.

i have read a few articles on the subject of time steps, however i have been unable to fully understand the concept and incorporate it in my game. so i would like to ask, if someone can explain how to implement a timestep and create smooth motion. i am not going to incorporate physics in my first games, so the accuracy of the timer does not matter too much, what is most important right now is a game that can run as smooth as a proffesional game. i am sure a revisit if not simplified explanation of timestepping, and even how to do it in a simple way with python will be of benefit to any programmer hoping to use pygame/python for his games.

Anyway this is the program i was able to write, that doesent have smooth motion. Perhaps someone can modify it, so we can get a working example with time stepping and see how it improves the smoothness. PS. you need python 2.7 and a python 2.7 pygame compatible version to run the program/game

http://bpaste.net/show/qmE362O29sq6GPGBK3fg/

sentences: In GameCenter realtime multiplayer how to identify who is host? In GameCenter real-time multiplayer how to identify who is a host?

sentences:
Getting screen coordinates of actor I'm trying to tell if an actor exists at a screen position so I can do something if the actor is clicked on. To do this, I first need to get the screen coordinates of the actor so I can compare it to the coordinates where I click, however, I am having some difficulty. I am currently trying to do this:

Actor actor = ...
// The position where I clicked obtained from touchDown() in my InputAdapter
Vector2 screenPos = ...
Vector2 actorStagePos = actor.localToStageCoordinates(new Vector2(0,0))
Vector2 actorScreenPos = actor.getStage().stageToScreenCoordinates(actorStageCoordinates)
Rectangle actorScreenBounds = new Rectangle(actorScreenPos.x, actorScreenPos.y, actor.getWidth(), actor.getHeight());
if (actorScreenBounds.contains(screenPos))
{
    System.out.println("An actor is there")
}

However, the coordinates don't seem to be converting correctly. They end up slightly below and to the right of where they should be. At first, I thought this was caused because I'm scaling some of the Image actors, but it also did not work when nothing was scaled up.

sentences: How to reset a Script? Is there a way where I can make the script restore its condition to that before I hit play? Should I create a new copy of the original script every time instead?

sentences:
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:
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:
Multiple traversal of a component-based hierarchy Let's say a game use a component-based hierarchy to store all of its entities.
So it can have objects, characters, lights organized in some kind of tree.

When rendering the game, it needs to first render objects, then lights. So it needs to first traverse the hierarchy and render all the objects it finds, then traverse a second time to render all the lights it finds.
What is a better way to do this? If the hierarchy has thousands of entities, it could be slow to traverse twice the tree.

I thought about having two lists, one containing objects to render, the second one being lights. Each time the user adds an entity to the hierarchy, it adds it to the corresponding list. This way, the game only have to traverse the object list then the light list, without traversing useless entities.

What is the best option?

sentences:
Separating Axis Theorem Duplicate Axis I am building a physics game engine from the ground up and currently stumped with my SAT implementation. The situation I am having is in regard to Edge cases, if I remove all parallel / duplicate Axis from the possible 15, I run the risk of removing an edge case as seen in the attached photo.

Hoping you guys can give me some pointers, Thanks!
edit: I should state that the way I have my SAT implemented is I have 0-5 cases being the Face contact and 6 - 14 being Edge cases. When I dont remove parallel cases, situations such as the picture below get treated as an edge case

edit: Probably shouldve added this in the beginning but here is the code where I am establishing my Axes to test.
The GetAxisFromEdge function simply takes two vectors and crosses them
The RemoveParralels function loops through the established axis and removes them if there exists a duplicate.
The FixAxes function is something of a patch to fix a greater problem where I needed the axis to face in the direction of one object for uniformity.
std::vector<glm::vec3> AxesToTest;

        glm::vec3 Obj1Edge1, Obj1Edge2, Obj1Edge3, Obj2Edge1, Obj2Edge2, Obj2Edge3;

        Obj1Edge1 = glm::normalize(this->Objects[x]->TransformedPhysMesh[1] - this->Objects[x]->TransformedPhysMesh[0]);
        Obj1Edge2 = glm::normalize(this->Objects[x]->TransformedPhysMesh[1] - this->Objects[x]->TransformedPhysMesh[2]);
        Obj1Edge3 = glm::normalize(this->Objects[x]->TransformedPhysMesh[1] - this->Objects[x]->TransformedPhysMesh[5]);

        Obj2Edge1 = glm::normalize(this->Objects[y]->TransformedPhysMesh[1] - this->Objects[y]->TransformedPhysMesh[0]);
        Obj2Edge2 = glm::normalize(this->Objects[y]->TransformedPhysMesh[1] - this->Objects[y]->TransformedPhysMesh[2]);
        Obj2Edge3 = glm::normalize(this->Objects[y]->TransformedPhysMesh[1] - this->Objects[y]->TransformedPhysMesh[5]);

        AxesToTest.push_back(this->Objects[x]->TransformedNormals[0]);
        AxesToTest.push_back(this->Objects[x]->TransformedNormals[1]);
        AxesToTest.push_back(this->Objects[x]->TransformedNormals[2]);

        AxesToTest.push_back(this->Objects[y]->TransformedNormals[0]);
        AxesToTest.push_back(this->Objects[y]->TransformedNormals[1]);
        AxesToTest.push_back(this->Objects[y]->TransformedNormals[2]);

        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge1, Obj2Edge1)));
        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge1, Obj2Edge2)));
        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge1, Obj2Edge3)));

        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge2, Obj2Edge1)));
        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge2, Obj2Edge2)));
        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge2, Obj2Edge3)));

        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge3, Obj2Edge1)));
        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge3, Obj2Edge2)));
        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge3, Obj2Edge3)));

        glm::vec3 toCenter = this->Objects[x]->Position - this->Objects[y]->Position;

        RemoveParallels(AxesToTest);
        //FixAxes(AxesToTest, toCenter);

sentences: Trigger an event only if two colliders fully cover each other Let's say I have two different objects that can go through each other. Both have a circle collider (2d) that has the exact same size and there is a good chance that the two colliders will completely overlap each other. How can I trigger an event when that happens?

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:
Incorrect Model Position (XNA) I am new at XNA, i have started it about a week earlier but i have 3d experience in WPF.

Scenario:
I have a room in which i have a object(for now it is a cube). The objects are generated in Max 2011 in the designers computer which i import into mine using fbx importer.

Problem:
1. The model are not positioned as per the max files, and also there are losses in the models.

In Max: http://i.imgur.com/iNJGTh.png
In XNA: http://i.imgur.com/ZXoU8.png

Could anyone suggest me how to resolve this problem?

Is there a dynamic way to get the camera position information from the "FBX" file that i exported from 3Ds Max?

sentences:
Find mouse pos in 3D space? I have a game where there is a set of tiles rotated 45° away from the camera. I want to work out what tile is being hovered over by the mouse, and for that I need to translate the mouse pos on the screen into the position on the plane rotated 45° away. How can I do this? Is there an easy way of doing this without using (expensive) 3D transformation?

Thanks in advance.

sentences:
Generating face normals with the geometry shader I'm trying to visualize the face normals for a mesh, using the geometry shader to generate lines represeting the normal vectors. My intention was to draw that line from the triangles centroid, extenting a certain amount in the normal's direction.

This is the vertex shader's code :

#version 450 core

layout (location = 0) in vec3 vs_in_pos;
layout (location = 1) in vec3 vs_in_normal;
layout (location = 2) in vec2 vs_in_texc;

out VS_OUT_GS_IN {
    layout (location = 0) vec3 pos;
    layout (location = 1) vec3 normal;
    layout (location = 2) vec2 texc;
} vs_out;

void main() {
    gl_Position = vec4(vs_in_pos, 1.0f);
    vs_out.pos = vs_in_pos;
    vs_out.normal = vs_in_normal;
    vs_out.texc = vs_in_texc;
}

This is the geometry shader's code :

#version 450 core

layout (row_major) uniform;
layout (triangles) in;
layout (line_strip, max_vertices = 2) out;

in VS_OUT_GS_IN {
    layout (location = 0) vec3 pos;
    layout (location = 1) vec3 normal;
    layout (location = 2) vec2 texc;
} gs_in[];

out GS_OUT_PS_IN {
    layout (location = 0) vec4 color;
    layout (location = 1) vec3 pos;
} gs_out;

layout (binding = 0) uniform transform_pack {
    mat4 model_view_projection;
};

uniform float normal_length;
uniform vec4 start_point_color;
uniform vec4 end_point_color;

void main() {

    const vec3 avg_normal = normalize(
        gs_in[0].normal + gs_in[1].normal + gs_in[2].normal);

    const vec3 triangle_centroid =
        (gs_in[0].pos + gs_in[1].pos + gs_in[2].pos) / 3.0f;

    {
        gl_Position = model_view_projection * vec4(triangle_centroid, 1.0f);
        gs_out.color = start_point_color;
        gs_out.pos = triangle_centroid;
        EmitVertex();
    }

    {
        const vec3 end_pt = triangle_centroid + avg_normal * normal_length;
        gl_Position = model_view_projection * vec4(end_pt, 1.0f);
        gs_out.pos = end_pt;
        gs_out.color = end_point_color;
        EmitVertex();
    }

    EndPrimitive();
}

My problem is that the line representing the face normal has the origin
at one of the triangle's vertices (not the centroid).

If, however, I change this line

const vec3 triangle_centroid =
    (gs_in[0].pos + gs_in[1].pos + gs_in[2].pos) / 3.0f;

with this line

const vec3 triangle_centroid =
    (gl_in[0].gl_Position.xyz + gl_in[1].gl_Position.xyz
    + gl_in[2].gl_Position.xyz) / 3.0f;

the line representing the normal has the origin at the centroid (as it should).

But I really have no ideea why the first approach does not produce the correct
result.

Some screenshots :

first method (wrong):

second method (correct):

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:
How do I handle loads of (prefab?) objects in Unity2D/3D? I have been looking around for information regarding this process but I was unable to come across anything that would help me out. Basically, in a game where you may have many items or enemies or player objects, how would one go about creating these objects?

Am I supposed to be creating every single one of these objects as a prefab and then load them into the game when needed? Or is it possible to create one object that has references to the different variables needed to create the above objects and then load in from an external source all the necessary information? And then during run time, depending on what object I am looking at, the script will 'create' the object with the information from the external source.

Meaning, if I decide to have 50 different enemies in my game, do I need to make 50 prefabs, one for each enemy? Or just one prefab that loads in data pertaining to the 50 different enemies and then build upon that information?

Thank you!

sentences:
Allowing a unit to equip only certain types of weapons I'm making a FireEmblem style game, and I am working on items at the moment. I have a Weapon class from which Sword, Axe, etc. are derived. I also have character classes like Swordsman, Mage, etc. I would like to have a way to allow classes to only equip certain weapons (Swordsman can equip Sword but not Axe). One way I thought of was to have a global enum for WeaponType, and each weapon has a const weapon_type value. Then, each character class has a list of allowed WeaponTypes and you would check if a weapon's weapon_type is in the allowed list.

Is there a better way to implement this without using any casting?

sentences:
What Situations is Saving a Game to Main Memory for? I've been reading through Unreal's 'Saving and Loading' guide: Link

Within, they present a capability to save a game to main memory rather than secondary storage:

I haven't found any information on where this would ever be used.

The only situation I can fathom for this being useful is to keep data about other load zones in memory so that travelling through load screens into these zones is quicker.

Why, When and Where is this technique of saving to Main Memory used instead of saving to Secondary Storage?

sentences:
How can I guarantee a solvable Fifteen Puzzle shuffle? I am making a 15 Puzzle game in C# that allows the user to enter a custom row and column value up to a maximum of a 10 x 10 puzzle. I am having problems with the shuffle method.

I want to make it so the puzzle is always solvable by first creating a winning puzzle then shuffling the empty space. The problem is it is too inefficient to call every click event each time. I need a way to invoke the click event of a button adjacent to the empty space but not diagonal. I also use an invisible static button for the empty spot. The PuzzlePiece class inherits from Button. I am not too sure how to do this.

Here is what I have:

private void shuffleBoard()
    {
        //5 is just for test purposes
        for (int i = 0; i < 5; i++)
        {
            foreach (Control item in this.Controls)
            {
                if (item is PuzzlePiece)
                {
                    ((PuzzlePiece)item).PerformClick();
                }
            }
        }
    }

 void PuzzlePiece_Click(object sender, EventArgs e)
    {
        PuzzlePiece piece = (PuzzlePiece)sender;

        if (piece.Right == puzzleForm.emptyPiece.Left && piece.Top == puzzleForm.emptyPiece.Top)
        {
            movePiece(piece);
        }
        else if (piece.Left == puzzleForm.emptyPiece.Right && piece.Top == puzzleForm.emptyPiece.Top)
        {
            movePiece(piece);
        }
        else if (piece.Top == puzzleForm.emptyPiece.Bottom && piece.Left == puzzleForm.emptyPiece.Left)
        {
            movePiece(piece);
        }
        else if (piece.Bottom == puzzleForm.emptyPiece.Top && piece.Left == puzzleForm.emptyPiece.Left)
        {
            movePiece(piece);
        }
    }

sentences:
Any hints about the average renderstate changes per frame? While answers will vary depending on the case, I'd love to hear about what people have seen in their past experiences.
The question mainly relates to DirectX though if you have some numbers for any other API (OpenGL, consoles etc) I'd be glad to hear them too.

Thanks in advance.

sentences:
Equation to make small number big and big number small (gravity) I have a sprite that I want to speed up as it gets closer to another object. I really want this to flow well and don't want a series of if statements. All I can think of is to take the distance and have some equation pump out a number that slowly rises as the distance decreases.

But for the life of me I can't think of a way to do this, though I'm sure it's possible. My mathematics knowledge is just too lacking to think of the tools I need for this.

Here's a pseudocode breakdown:

50->(function)->1.2
20->(function)->1.8

Than I'd could do something like:

speed = speed*1.8

I've thought about it and I think this would be similar to gravitation, I've tried some googleing, is there anyone that can point me in the right direction

sentences: Can not tweak collider`s border manually in Unity Why can not I change collider`s border manually? I remember being able to do that. I just clicked the gray button under in this case Box Collider 2D component, then went to the Scene view and tweaked it as I wanted by clicking and moving collider`s border. But now when I do the same procedure on trying to click and drag the border in Scene view I am just losing focus of the collider, but do not change it in any way.

sentences:
How to make the screen not flicker? I want to be able to draw all my text, lines , triangles and other stuff to screen and then clear the screen and draw something new, BUT this method makes the screen flicker, and all the drawings dont appear at the same time.

My idea is to draw to some kind of a buffer and then draw that buffer to the screen and clear the buffer, and repeat. This way the screen wont flicker and all will be drawn at the same time.

I am using windows.h , Visual Studio.

#include <Windows.h>
#include <iostream>
using namespace std;

struct vec2d
{
    int x, y;
};

void Line(HDC dc, vec2d a, vec2d b)
{
    MoveToEx(dc, a.x, a.y, NULL);
    LineTo(dc, b.x, b.y);
}

vec2d GetMousePos(HWND console)
{
    vec2d out;
    POINT p;
    GetCursorPos(&p);
    out.x = p.x; out.y = p.y;
    return out;
}

int main()
{
    HWND console = GetConsoleWindow();
    HDC dc = GetDC(console);
    SelectObject(dc, CreatePen(PS_SOLID, 1, RGB(255, 255, 255)));

    while (1)
    {
        //BitBlt(dc, 0, 0, 1000, 1000, 0, 0, 0, BLACKNESS);        Flickering is much much bigger, because its faster
        system("cls");
        Line(dc, { 0, 0 }, GetMousePos(console));
    }
}

Thanks in advance, Mark.

sentences:
Unity - Accessing a UI's text through a Transform I have this in my player's component list. The HungerTarget transform is the text box in the UI canvas. How would I change the UI's text here?

using UnityEngine;
using System.Collections;

public class HealthHunger : MonoBehaviour {
    //public Transform HealthTarget; Not being used yet...
    public Transform HungerTarget;

void Start () {
}

void Update () {
    //set HungerTarget's text to ...
}

}

sentences:
Unity - Mecanim & Rigidbody on Third Person Controller - Gravity bug? I'm working on a third person controller which uses physX to interact with the other objects (using the Rigidbody component) and Mecanim to animate the character.

All the animations used are baked to Y, and the movement on this axis is controlled by the gravity applied by the rigidbody component.

The configuration of the falling animation:

And the character components configuration:

Since the falling animation doesn't have root motion on XZ, I move the character on XZ by code. Like this:

    // On the Ground
    if (IsGrounded())
    {
        GroundedMovementMgm();

        // Stores the velocity
        velocityPreFalling = rigidbody.velocity;
    }
    // Mid-Air
    else
    {
        // Continue the pre falling velocity
        rigidbody.velocity = new Vector3(velocityPreFalling.x, rigidbody.velocity.y, velocityPreFalling.z);
    }

The problem is that when the chracter starts falling and hit against a wall in mid air, it gets stuck to the wall. Here are some pics which explains the problems:

Hope someone can help me. Thanks and sory for my bad english!

PD.: I was asked for the IsGrounded() function, so I'm adding it:

    void OnCollisionEnter(Collision collision)
    {
        if (!grounded)
            TrackGrounded(collision);
    }

    void OnCollisionStay(Collision collision)
    {
        TrackGrounded(collision);
    }

    void OnCollisionExit()
    {
        grounded = false;
    }

    public bool IsGrounded()
    {
        return grounded;
    }

    private void TrackGrounded(Collision collision)
    {
        var maxHeight = capCollider.bounds.min.y + capCollider.radius * .9f;
        foreach (var contact in collision.contacts)
        {
            if (contact.point.y < maxHeight && Vector3.Angle(contact.normal, Vector3.up) < maxSlopeAngle)
            {
                grounded = true;
                break;
            }
        }
    }

I'll also add a LINK to download the project if someone wants it.

sentences:
networking - how to deal with serverside packet arrival delay? Let's assume each client sends a packet every 0.05 seconds. (rate = 20)
Server update tickrate is 60 and it sends data back to client every 1 / 30 seconds.
Now client A has 50ms ping time and it sent each data at [A]5, [B]5.05, [C]5.10 second.
But due to some networking issue, server received each data at [A]5.05(good), [B]5.10(good), [C]5.18(bad! it delayed 0.03 seconds.)
When server get the packet [A] at 5.05 seconds, since each packet contains client data(like commands) for 0.05 seconds, it updates the entity based on this [A] packet for 0.05 seconds. after that, server time is now 5.10. and the next packet, [B] is already arrived so server just can keep updating.
At 5.15, now server has to update the entity with next packet, which is C, but there's no packet! Server has to wait for 0.03 seconds till next packet will be arrived. now, server is behind 0.03 seconds from client. sync failed.

I have two idea for solving this problem.

Server maintains its own client's time and sends back to client. For client side, when there is heavy desync between client and server, the client syncs to the server time.

Solution 1 is still applied. but there is one more. like entity-interpolation, there is packet-interpolation. Client sends each packets every t seconds which is (t = [SEND-TICKRATE + CLIENT-LAG]) . It means server gets next packet after [t + LATENCY] seconds which is always larger than SEND-TICKRATE, 0.05 in this assumption.
So when server gets packet, it doesn't update it immediately but waits for some time (like 0.03 ~ 0.05 seconds). Now server has next packet with a high probability.

I think Solution 2 is good. But the drawback is, client renders other player's data behind [RTT + Entity-Interpolation time + Server packet Interpolation time], so for a fast-paced-game, Shot-behind-the-wall will more happen.
What technique is used in other fast-pace-game like league of legends or overwatch?

sentences:
Calculate polygon points from image I'm new to OpenGL, so please excuse my brevity and/or lack of technical knowledge of the subject.

I need some help with rendering a polygon on an OpenGL canvas (using C# w/ Tao). I understand that I will need to tessellate the polygon points so it'll draw correctly, but technicality aside, what's the best method to get usable XY points from the image below so I can draw the polygon shape?

sentences:
Concerns about using a 3D tileset grid I'm thinking of implementing a 3D tile system for my engine, and tie it to it's world streaming system as well. As in, using it for it's terrain for an open world in an engine that theoretically can support up to about 80 kilometers squared even if it won't be fully used.

The game will be making use of both free form movement, and tiled movement when it comes to combat. With cover systems involved.

I was wandering about a few questions.

How viable is it to use a bunch of smaller tiles for terrain? Think Dota 2 Reborn. Where the increased levels are guaranteed to be flat and at exact heights. And there will be hills and the like connecting them.

If I was to use tiles, do I need to weld the vertexes and recompute the normals for the affected vertices?

If I do not need to connect them, will it cause any visible artifacts? Or any sort of performance hits? I know I can batch all the standard tiles. But I don't think the same can be said if I treat the terrain tiles like normal terrain when it comes to texturing.

sentences:
In XNA 4, how can I access SpriteBatch's transformMatrix in my shader? I would like to use a custom effect with a regular XNA SpriteBatch. I have a 2D camera which computes a transform matrix, so I need my shader to take this into account.

I have put a world matrix property into my shader:

float4x4 World;

However, it does not get set by SpriteBatch:

spriteBatch.Begin(spriteSortMode, blendState, samplerState,
    depthStencilState, rasterizerState, effect, camera.WorldToScreen);

Everything is rendered properly if I set it manually in the draw loop:

effect.Parameters["World"].SetValue(camera.WorldToScreen);

How can I set up my shader parameters to make SpriteBatch set them up correctly?

sentences:
In Unity3D, try to load a png into a Texture2D in an Editor script and then run PackTextures, but they need Readable flag to be set I am trying to automatically create a texture atlas from a set of generated png files in an Editor script. The problem is that I can't seem to be able to load a png into a Texture3D without it being inaccessible by the PackTextures method. I have tried a few different ways to load the PNGs, such as Resources.LoadAssetAtPath(...), AssetDatabase.LoadAssetAtPath(...) and a few more.

Since all of this is done in OnPostprocessAllAssets, I don't want to have to do any manual editing of the textures. I just want to be able to drop a PNG into a certain folder and get an updated atlas. Answers such as this seem to suggest manual editing.

The actual error message is

  "Texture atlas needs textures to have Readable flag set!".

So the question is, is it possible to do this kind of post processing in Unity3D? Is there any way to import a PNG into a Texture2D with the Readable flag set, without having to manually change it?

sentences:
JMonkeyEngine in Eclipse I wanted to try the JMonkey engine, so I downloaded the JMonkey sdk, but I don't want to work in the JME IDE, I would rather like to work with Eclipse, since I already started a game project there, and I only want to replace the game engine(the code is modular, so i can do that) form pure LWJGL to JME. I found this tutorial:
http://hub.jmonkeyengine.org/wiki/doku.php/jme3:setting_up_jme3_in_eclipse
But that won't work, when I add the jar-s then there is no com.jme3.app.SimpleApplication anywhere there, as the tutorial suggests. Also where are the correct native files? I googled, but I can't find any example projects of Eclipse, or any decent explanations how to set up JME in Eclipse properly.

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: SharpDX Texture to Image in C# I currently have an image processing application that outputs processed images post pixel shaders have been applied. However, using the examples I've found on the internet, the colors are flip to BGRA when RGBA is expected. I currently work around this with by post export processing to get the desired RGBA format. I was hoping someone else has dealt with this and has a solution that does not require post processing to correct the format.

sentences:
How can I implement simple object orbits in Game Maker? I've seen a lot of tutorials for things like "fixed circular orbit" and "elliptical orbits" which end up never been what I actually want.

I have two objects: oPlayer, and oPlanet.

I am trying to allow the player to move around freely, but be able to be caught by the gravity of oPlanet, causing the player to go around in circles/elliptical orbit. I also need the player to be able to escape thate orbit, and end up on a trajectory. In fact, I want it to work for any oPlanet.

What I am looking for is something similar to the orbital gravity in Kerbal Space Program.

Is there any way I should go about this? If anyone can be of help, I would rather answers be in GML rather than the Drag and Drop, but any help is great!

sentences:
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:
XNA clip plane effect makes models black When using this effect file:

float4x4 World;
float4x4 View;
float4x4 Projection;

float4 ClipPlane0;

void vs(inout float4 position : POSITION0, out float4 clipDistances : TEXCOORD0)
{
    clipDistances.x = dot(position, ClipPlane0);
    clipDistances.y = 0;
    clipDistances.z = 0;
    clipDistances.w = 0;

    position = mul(mul(mul(position, World), View), Projection);
}

float4 ps(float4 clipDistances : TEXCOORD0) : COLOR0
{
    clip(clipDistances);

    return float4(0, 0, 0, 0);
}

technique
{
    pass
    {
        VertexShader = compile vs_2_0 vs();
        PixelShader = compile ps_2_0 ps();
    }
}

all models using this are rendered black. Is it possible to render them correctly?

sentences:
XNA help - too much memory used? I'm writing code in XNA 4.0, and part of my game entails drawing a textured grid of cubes. It is working, but the problem is the memory usage is growing way too rapidly. Each cube has 8 points, and each point is a VertexPositionTexture. A 16x9 grid takes 50MB memory, and that is just the grid and lines, no textures or anything else. Doubling the grid to 32x18 makes the memory jump to 150MB....I don't understand what is taking up so much room. I draw the grid using DrawUserIndexedPrimitives. The cubes can move around and be different sizes so I can't consolidate them to one set of vertices. What is the proper way to render a few thousand vertices without using so much memory?

These are all the members for my Cube class so far:

GraphicsDevice graphicsDevice; // for drawing this cube
Tileset tileset; // reference to parent object
VertexPositionTexture[] pointList; // the list of 8 vertices
BasicEffect basicEffect; // effect to draw using a shader
Vector3 localTranslation; // just 3 floats
VertexBuffer vertexBuffer; // for sending the vertices to the GPU

There are also a few functions that allocate memory for the pointList...but nothing out of the ordinary...

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:
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 can i remove the margins in Window_Base? So i am remaking Window_Status for my game where i have the character battler displayed in the background. bellow is the portion of the script which adds the battler image taken from def refresh (the first part, i omitted the at-the-time experimental code for Status Icons and Stats)

bitmap = RPG::Cache.battler(@actor.battler_name+"_menu", @actor.battler_hue)
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw,ch)
self.contents.blt(0,0, bitmap, src_rect, 75)
draw_actor_name(@actor, 0, 0)
draw_actor_level(@actor, 80,0)
draw_actor_class(@actor, 0, 32)

and this is the result

now the battler image used is about 5x larger than the regular one (because stretching it using code made it look pixely, this way it's a bit more smoother) and also i've chopped off the left side because some of the battlers i use don't have their head perfectly centered (this way they can all can get set at 0,0)

however as you can see the bottom, which isn't cropped in the original image, is still being chopped off at the bottom. also despite the bitmap being at 0,0 it's not flesh against the sides.

i'd like to know how i can remove these margins? ideally at the Window_Base level since i can see myself running into the same problem with Window_Command

NOTE: this is in RPG Maker XP so i'm using RGSS

sentences:
Preventing diagonal movement I was originally fine with diagonal movement but it's clashing with my sprite animation...

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

    switch(key){
        case KeyEvent.VK_W:{
            dir = 3;
            velY = -speed;
            break;
        }
        case KeyEvent.VK_S:{
            dir = 2;
            velY = speed;
            break;
        }
        case KeyEvent.VK_A:{
            dir = 1;
            velX = -speed;
            break;
        }
        case KeyEvent.VK_D:{
            dir  = 0;
            velX = speed;
            break;
        }
    }
}

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

    switch(key){
        case KeyEvent.VK_W:{
            velY = 0;
            break;
        }
        case KeyEvent.VK_S:{
            velY = 0;
            break;
        }
        case KeyEvent.VK_A:{
            velX = 0;
            break;
        }
        case KeyEvent.VK_D:{
            velX = 0;
            break;
        }
    }
}

    public void update(){
    y += velY;
    x += velX;
}

I thought that perhaps a switch statement or an if else statement would prevent multiple keys from firing at once, but it's not working out. I even tried synchronizing some methods but still to no avail. Any suggestions? And please ignore the dir variable I use it to find the direction the player is facing.

sentences:
OpenGL-ES: clearing the alpha of the FrameBufferObject This question is a follow-up to Texture artifacts on iPad

How does one "clear the alpha of the render texture frameBufferObject"?  I've searched around here, StackOverflow and various search engines but no luck.  I've tried a few things... for example calling GlClear(GL_COLOR_BUFFER_BIT) at the beginning of my render loop... but it doesn't seem to make a difference.  Any help is appreciated since I'm still new to OpenGL.

Cheers!

p.s.  I read on SO and in Apple's documentation that GlClear should always be called at the beginning of the renderLoop.  Agree?  Disagree?  Here's where I read this: https://stackoverflow.com/questions/2538662/how-does-glclear-improve-performance

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:
Separate "Battle Character" class from "Character" class? So I have a Class called Character which represents all the player, his companions, and all enemies.  This class does a lot of things including performing actions upon other characters, and upon the environment, and so on.

I'm about to start work on a battle system for this RPG, and there will be the player controlled (and enemy controlled) units which will have a location on the screen, and a delay since their last action, and a ton of other properties and methods that apply entirely to the battle.  But, this thing will also be associated in a one-to-one relationship with a Character which exists separate from a battle.  It will need to access that characters stats for it's battle actions as well as some of it's methods.

So the root of my question is, is it better to create a new "Unit" class, which references the character it's associated with, or should I just expand upon the existing Character class with functions and properties that relate only to a battle?  If it matters I'm writing this in C#.

sentences:
How to support importing .uasset files in game for content creators(UE4)? I would like to support importing clothes(as SkeletalMeshes) and props(as StaticMeshes) as uasset files into game for content creators, which  obviously have not been packaged with the game.
Basically I am looking for a clean modding pipeline.
EDIT:
TLDR:
Is it possible to load .uasset files with StaticLoadObject() into game and use assets from it after the game has been packaged?
Or does it only work with packaged files?
If not what function do you recommend for that purpose?
not-TLDR
Bringing in stuff does work well in the editor, using Rama's LoadObjectFromAssetPath, just by:

right clicking my asset in Content Browser

copy reference

and copy pasting the result to the path variable of the LoadObjectFromAssetPath blueprint node.

Well, I am not sure if it is going to work at runtime...
So I used my favourite search engine and put in some keywords and bumped into this.
Then I wrote some code(Blueprint Function Library):
void UFileDialogOpener::LoadFile(FString  from) {

    auto result = StaticLoadObject(UStaticMesh::StaticClass(), NULL, *from);

    GEngine->AddOnScreenDebugMessage(-1, 150.0f, FColor::Red, "from: " + from);

    if(result)GEngine->AddOnScreenDebugMessage(-1, 150.0f, FColor::Green, "name: " + result->GetName());
    else GEngine->AddOnScreenDebugMessage(-1, 150.0f, FColor::Green, "no result");

    auto * meSkelMesh = Cast<UStaticMesh>(result);

    if(meSkelMesh)GEngine->AddOnScreenDebugMessage(-1, 150.0f, FColor::Red, meSkelMesh->GetName());
    else GEngine->AddOnScreenDebugMessage(-1, 150.0f, FColor::Red, "no mesh");

}

As per the debug messages StaticLoadObject does not find anything.
I tried feeding it the both of the results of righclicking my asset in Content Browser and choosing either: copy reference and copy path.
Neither of them yielded any result.
Not sure where I am messing up.
Anyways, just wondering if anyone can recommend a better way of doing this(code, plugins etc)?

sentences:
Why does BorderLayout crop out JSlider on JFrame I have some working code with a small circle randomly appearing around a large circle in the middle, kinda like planets. I have implemented a JSlider that controls the speed of the small ball moving around, and has set it's location to BorderLayout.SOUTH.  The problem is that you can't see the slider when you run. You have to click fullscreen for it to appear. I have a windows computer and I know  that it is blocked by the toolbar, but I kinda don't want to move it. Is there a way to use Java and set it to fullscreen without doing it manually? Here is my code:

     package com.company;

    import javax.swing.*;
    import java.awt.*;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

public class Main extends JPanel {

       private static JFrame frame = new JFrame();
        private static int random = 11;
        private static JSlider timeController = new JSlider(1000, 3000, 3000);
        private static Runnable number = () -> random = (int) (Math.random() * 110) + 1;

        private static ScheduledExecutorService executor1 = Executors.newScheduledThreadPool(1);

        public static void main(String[] args) {
            number = () -> random = (int) (Math.random() * 100) + 1;
            executor1.scheduleWithFixedDelay(number, 0, timeController.getValue(), TimeUnit.MILLISECONDS);
            frame.getContentPane().add(new Main());
            frame.setSize(2000, 1080);
            frame.setLocationRelativeTo(null);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setBackground(Color.GRAY);
            frame.setExtendedState(JFrame.MAXIMIZED_HORIZ);
            frame.setVisible(true);
            frame.setResizable(true);
            timeController.setBackground(Color.RED);

            timeController.setFont(new Font("Arial Black", Font.ITALIC, 10));
            timeController.setForeground(Color.CYAN);
            timeController.setMajorTickSpacing(100);
            timeController.setMinorTickSpacing(10);
            timeController.setPaintTicks(true);
            timeController.setPaintLabels(true);
            timeController.addChangeListener(e -> sliderChanged());
            frame.add(timeController, BorderLayout.SOUTH);

        }

        private static void sliderChanged() {
            executor1.shutdown();
            executor1 = Executors.newScheduledThreadPool(1);
            number = () -> random = (int) (Math.random() * 110) + 1;
            executor1.scheduleWithFixedDelay(number, 0, (timeController.getValue()), TimeUnit.MILLISECONDS);
        }

        public void paint(Graphics g2) {
            Graphics2D g = (Graphics2D) g2;
            g.fillOval(770, 250, 400, 400);
            g.setColor(Color.BLACK);
            if (random > 0 && random <= 15) {
                g.fillOval(920, 3, 100, 100);
            } else

 if (random > 15 && random <= 20) {
            g.fillOval(920, 797, 100, 100);
        } else if (random > 20 && random <= 35) {
            g.fillOval(523, 400, 100, 100);
        } else if (random > 35 && random <= 50) {
            g.fillOval(1317, 400, 100, 100);
        } else if (random > 50 && random <= 65) {
            g.fillOval(620, 143, 100, 100);
        } else if (random > 65 && random <= 80) {
            g.fillOval(1220, 143, 100, 100);
        } else if (random > 80 && random <= 90) {
            g.fillOval(620, 657, 100, 100);
        } else if (random > 90 && random <= 100) {
            g.fillOval(1220, 657, 100, 100);
        }
        frame.repaint();
    }
}

sentences:
How can I link to callback functions in Lua such that the callbacks will be updated when the scripts are reloaded? I'm implementing Lua scripting in my game using LuaBind, and one of the things I'm not clear on is the logistics of reloading the scripts live ingame.

Currently, using the LuaBind C++ class luabind::object, I save references to Lua callbacks directly in the classes that use them. Then I can use luabind::call_function using that object in order to call the Lua code from the C++ code.

I haven't tested this yet, but my assumption is that if I reload the scripts, then all the functions will be redefined, BUT the references to the OLD functions will still exist in the form of the luabind::object held by the C++ code. I would like to be able to swap out the  old for the new without manually having to manage this for every script hook in the game.

How best to change this so the process works?

My first thought is to not save a reference to the function directly, but maybe save the function name instead, and grab the function by name every time we want to call it. I'm looking for better ideas!

sentences:
Why does my depth test fail on Nvidia cards? I sent a test version of my in-development game to some friends, and they found out that the Depth Test in OpenGL does not work on Nvidia cards. I'm using LWJGL.

I use my own matrices and send them to the shader, and at the start of evey game loop I use

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); // clear the display

On an Nvidia card, you can see mountains through other mountains and stuff. On my Radeon HD 6650M it works perfectly fine. Any ideas?

I don't have anything special in the shaders—just some basic lighting calculations. I dont touch the gl_FragDepth.

Here's a screenshot (with placeholder textures):

I use these calculations for the Projection Matrix:

public Matrix4f getProjectionMatrix() {
    // Setup projection matrix
    Matrix4f projectionMatrix = new Matrix4f();
    float fieldOfView = 40.0f;
    float aspectRatio = (float)Display.getWidth() / (float)Display.getHeight();
    float near_plane = 0.1f;
    float far_plane = 1000f;

    float y_scale = coTangent((float) Math.toRadians(fieldOfView / 2f));
    float x_scale = y_scale / aspectRatio;
    float frustum_length = far_plane - near_plane;

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

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:
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 generate a 2d grid-based map without screwing it up? I'm relatively new to the mechanics of game development - catching up fast, but there are still some things that escape me. For example: generating a fully-accessible map on a 2d grid.

See the example at http://crawl.s-z.org. Each floor map starts with dozens of winding labyrinthine passages and randomly drops in points of interest - temples, boss lairs, bazaars, etc. I know there's a lot of factors that go into this: generating passages that always have at least one exit (no isolated tunnels in the walls), making sure passages have at least a one-cell-width wall between them and adjacent parallel passages, and dropping points of interest in such a way that they connect to the dungeon.

I've taken a shot at it, and it's very easy to ranomly place lines in a 2d matrix that represent passages - but they're never guaranteed to connect, and it's not nearly as elegant as the maps at the above example.

I suppose my question is, what do I need to know to reproduce the example at crawl.s-z.org? I know this is a large question - I'd be fine with someone handing me a link to a reference site and telling me to learn it there. I'm just new enough at this that I don't even know what terms to google - maybe there are names for different generation processes? Available techologies are JS (jQuery) and PHP, so a solution tailored to one of those would be ideal. Thanks!

sentences:
How 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:
Best practices for UnitTesting heavy Flash game clients and libraries? We have several quite heavy game clients completely written in AS3 (some also use Flex for UI). Some clients are built with PureMVC, others are a pile of spaghetti code that's grown over the years. We also have several libraries used by our game clients that are written in AS3/Flex.

I'm tasked to evaluate the benefits/risk/cost of applying unit-testing to our clients and libraries and decided to give FlexUnit a closer look. I chose FlexUnit for a first attempt over fluint since FlexUnit is definitively able to test pure AS3 projects while I'm not sure about that for fluint.

Now I'm wondering what some good starting points and best practices are to get unit-testing into previously untested applications.

So my questions for unit-testing game clients and libraries are:

How to get started? What are "low-hanging" (= easily testable) fruits to test with unit-testing?
What are commonly tested aspects of game clients?
Can you apply unit-testing to the BBOY design pattern or do you need to (extensively) refactor the game clients?
Is it useful (and does it make sense) to test asset loading? If so, how to do it (comparing a binary diff, or comparing hash checksums, or ...)?
How to test server communication and asynchronous commands?
How to integrate the whole thing with Hudson/Jenkins CI server and Maven? Are there any reporting tools that can generate overviews of the run tests and report which test failed on which function/class?

I'm thankful for all pointers about the issue (direct answers, blog posts, forum discussions, how-tos, etc. etc. etc.) since I have little previous practical experience with unit-testing.

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:
How to figure out hidden fields in an .ini file? I'm not sure if this is the right place to ask this, but I can't think of anywhere else that would fit better.

Fallout 4 has just recently released, and I'm wondering what exactly can I edit in the ini. I know you can add certain things that aren't already present in the ini. For example, to change the FOV:

[Display]
fDefaultWorldFOV=100
fDefault1stPersonFOV=100

However, how do I figure out what other 'hidden' fields are? In Skyrim, for example, you can change the camera like this:

[Camera]
fOverShoulderAddY=0.0000
fOverShoulderPosZ=10.0000
fOverShoulderPosX=0.0000
fOverShoulderCombatAddY=0.0000
fOverShoulderCombatPosZ=10.0000
fOverShoulderCombatPosX=0.0000

Surely it's not just trial and error?

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:
[Unity][C#] Coding Better Camera Recoil I am trying to get a good camera recoil system in Unity, but what I have tried so far doesn't seem to look very good. My current method, is using Quaternion.Lerp. With the way I have my shooting system set up, the camera recoil going up all happens within one frame, so when you shoot faster, it tends to look choppy, whereas the recoil going back down is smooth and normal. My question is, is there a better way to handle the camera recoil, while keeping the same look and effect, but having it look much more smooth? I have a quick video to show how the camera recoil looks (watch as the camera moves upwards)
https://www.youtube.com/watch?v=HsS0rtoj9l4

And here is the part of my code that handles the camera recoil

void Update () {
    Recoil2();

    Vector3 cameraRecoil = weaponSettings.CurrentWeapon.cameraRecoil;
    Transform cameraClimb = generalSettings.cameraClimbHolder.transform;
    string fireMode = weaponSettings.CurrentWeapon.fireMode.ToString();

    if (fireMode == "Semi")
        if (Input.GetButtonDown("Fire1"))
            Shoot();
        else
            CameraRecoil1 = Vector3.Lerp(CameraRecoil1, new Vector3(0, 0, 0), Time.deltaTime * cameraRecoil.z / 10f);

    if (fireMode == "Auto")
        if (Input.GetButton("Fire1"))
            Shoot();
        else
            CameraRecoil1 = Vector3.Lerp(CameraRecoil1, new Vector3(0, 0, 0), Time.deltaTime * cameraRecoil.z / 3f);
}

void Shoot ()
{
    if (shoottime <= Time.time && !isBusy && !isReloading && !isRunning)
    {
        shoottime = Time.time + weaponSettings.CurrentWeapon.fireRate;

        WeaponInfo currentWeapon = weaponSettings.CurrentWeapon;
        Transform cameraClimb = generalSettings.cameraClimbHolder.transform;
        Vector3 cameraRecoil = weaponSettings.CurrentWeapon.cameraRecoil;

        CameraRecoil1 = Vector3.Lerp(CameraRecoil1, new Vector3(-cameraRecoil.x, Random.Range(-cameraRecoil.y, cameraRecoil.y), 0), Time.deltaTime * cameraRecoil.z);
    }
}

void Recoil2 ()
{
    Vector3 cameraRecoil = weaponSettings.CurrentWeapon.cameraRecoil;
    Transform cameraClimb = generalSettings.cameraClimbHolder.transform;

    cameraClimb.localEulerAngles = CameraRecoil1;
}

Anyone have any ideas? I appreciate anyone who can help me!

sentences:
GLSL Shader compiles, but source is empty I'm trying to compile a GLSL shader, to which I use the following code.

Initialization

SDL_Window* boringInitStuff(){
    SDL_Init(SDL_INIT_VIDEO);
    SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, 3 );
    SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, 1 );
    SDL_GL_SetAttribute( SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE );

    Uint32 windowFlags = SDL_WINDOW_OPENGL;
    SDL_Window* sdlWindow = SDL_CreateWindow("Boooring", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 400, 400, windowFlags);

    SDL_GL_CreateContext(sdlWindow);

    glewExperimental = GL_TRUE;
    glewInit();

    return sdlWindow;
}

File parser

void readFile(std::string path, std::string& data){
    std::ifstream f(path.c_str(), std::ios::binary);
    data.assign((std::istreambuf_iterator<char>(f)),
                (std::istreambuf_iterator<char>()));
}

Main

int main(int argv, char** args) {
    SDL_Window* sdlWindow = boringInitStuff();

    std::string buffer;
    readFile("./compile_test.vert", buffer);
    const char* cBuffer = buffer.c_str();

    GLuint shaderID = glCreateShader(GL_VERTEX_SHADER);
    glShaderSource(shaderID, 1, &cBuffer, nullptr);
    glCompileShader(shaderID);

    while(!SDL_QuitRequested()){
        SDL_GL_SwapWindow(sdlWindow);
    }

    return 0;
}

But when I try to inspect the source code in gDEBugger, the source code is gone. Linking of course doesn't work aswell. The weird thing is, that the compilation error checking works.
EDIT: When I copy & paste the main part into another opengl project, it works.

sentences:
What is Opengl ES ? What is gl and GLES20 mean? I am new in opengl. I saw tutorial some have gl at the beginning and some have GLES20 at the beginner and some has GL10.

What are the differences? Is GLES20 mean opengl es2 whereas GL10 mean version 1

sentences:
Open Source Engine for RTS I must write a cross-platform real-time-strategy game within 2-3 months. I want use C++ and OpenGL and am looking for an engine.

The engine must be open source and work under both Linux and Windows. Preferably it should work with 3ds Max models. I do not know the game engines. Which engine would you recommend?

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:
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:
In Unity, Change which mouse button is used to scroll in ScrollRect I've created a new ScrollView in Unity. How do I change which mouse button is used to scroll in ScrollRect (through script or in the editor).

By default it's the left mouse button. I'd like to be able to change this to another mouse button.

I'd also like to be able to use a keyboard key and disable it altogether (via script without also disabling the scrollbars), but mainly I at least want to change it from the left mouse button.

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:
Multiplayer VR art gallery using different headsets I'm creating a VR art gallery using Unity3D (like a VR Museum Views with more freedom) and would like to have an environment where 1 or more users can gather together, communicate and move around (similar concept to SecondLife except in this case would be first-person view (by default) with only one room/location and users would be in VR).

From a user perspctive, the initial screen would be a door and the user would have a mini-map and a menu, turned to him/herself, with specific actions.

Once inside of the gallery, the users would be able to see others, "walk" or "teleport" to different locations

and see the canvas

The overall environment is rather simple so I've decided to get feedback from potencial users. Turns out the majority doesn't want to be alone in such environment. So, I've considered adding multiplayer (one of the users could even be guiding the others, which is interesting).

Now, multiplayer makes more sense when we can more inclusive. That's where the problem starts. In this specific case, inclusive is being defined as the possibility of users to be able to be present in the environment using at least one of the following devices

Android Phone (Cardboard)
Oculus GO
Samsung Gear VR
Google Daydream
Oculus Rift
HTC Vive

I've done some research and couldn't find someone doing it or a way to do it (considering all of the requirements). If that's possible to do, how can i do it?

One thing I found was that if I didn't want the users to move around and just be watching the gallery like watching a webinar / presentation in different devices, I could use VR Sync (they basically synchronize video playback on multiple VR devices).

So, at the moment I can either have the environment with just one user at a time and develop the environment for all the different headsets or use VR Sync.

sentences:
Can I use two Collision Boxes on the same GameObject? I have two Collision Boxes on the same GameObject. I don't want the Collision Boxes to be triggers. I want the Collision Boxes on the actual GameObject, not its children.

For example, if I want to check for a headshot. My reason for not wanting triggers is that a trigger is already being used. My reason for not wanting children is for cleanliness. I understand there are work arounds. I was wondering if there was a more direct approach.

When there is a collision, how can I check which Collision Box is hit?

sentences:
Need to know the origin and coordinates for 2d texture and 2d/3d vertices in webgl Long story short, I know my coordinates are off and I believe my indices might be off.

I'm trying to render a simple 2d rectangle with a texture in webgl

here's the code I have for the vbo/ibo:

rectVertices.vertices = new Float32Array(
[
    -0.5, -0.5,  // Vertice 1, bottom /  left
     0.0,  0.0,  // UV 1

    -0.5,  0.5,  // Vertice 2,    top /  left
     0.0,  1.0,  // UV 2

     0.5,  0.5,  // Vertice 3,    top / right
     1.0,  1.0,  // UV 3

     0.5, -0.5,  // Vertice 4, bottom / right
     1.0,  0.0,  // UV 4
]);

rectVertices.indices = new Int16Array([
    0,1,2,2,0,3
]);

/* I'm assuming the vertices go like this

(-0.5, 0.5) ------ ( 0.5, 0.5)
            |    |
            |    |
(-0.5,-0.5) ------ ( 0.5,-0.5)

with the origin in the middle

and the texture coordinates go like this:

( 0.0, 1.0) ------ ( 1.0, 1.0)
            |    |
            |    |
( 0.0, 0.0) ------ ( 1.0, 0.0)

so as you can see I'm all messed up.

I'm also using:

gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);

*/

Here's the output of the program:

the texture I'm using is this:

So, I guess I need to know the origins, but the triangle strip looks way off.

I am doing this as well:

// create VBO and IBO
vbo = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, vbo);
gl.bufferData(gl.ARRAY_BUFFER, triangleVertices.vertices, gl.STATIC_DRAW);

ibo = gl.createBuffer();
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, ibo);
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, triangleVertices.indices, gl.STATIC_DRAW);

and:

gl.bindBuffer(gl.ARRAY_BUFFER, vbo);
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, ibo);

gl.vertexAttribPointer(vertexAttribute ,2, gl.FLOAT, false,FLOAT*2,FLOAT*0); // position
gl.vertexAttribPointer(textureAttribute,2, gl.FLOAT ,false,FLOAT*2,FLOAT*2); // texture
gl.enableVertexAttribArray(vertexAttribute);
gl.enableVertexAttribArray(textureAttribute);

gl.drawElements(gl.TRIANGLE_STRIP, 6, gl.UNSIGNED_SHORT, 0);

It almost seems as though the Vertices and the UV coordinates are getting mixed up.

sentences:
GLSL Unsigned Int Values Not Retrieved Properly I have packed several values needed for shading a particular vertex into a single 32-bit uint. In the shader, it is unpacked like this:

vec3 color;
uint vertexData = data;
float sunlight, artificialLight;
bool occlusion;

artificialLight = float(vertexData & 31u);
vertexData = vertexData >> 5;
sunlight = float(vertexData & 31u);
vertexData = vertexData >> 5;
occlusion = bool(vertexData & 1u);
vertexData = vertexData >> 1;
color.b = float(vertexData & 127u);
vertexData = vertexData >> 7;
color.g = float(vertexData & 127u);
vertexData = vertexData >> 7;
color.r = float(vertexData & 127u);

The color produced by this extraction is much different from the originally intended color. For example:

130, 245, 90 --> 78, 125, 249   (These values are not exact)

I took the code and put it into my main c++ program and ran it with a debugger. It showed the right values.

130, 245, 90 --> 130, 245, 90

EDIT

I have taken a uint produced by my compressor and directly inputted it into my shader like this

vertexData = 2179293184;

Every vertex is shaded with the color of green this value corresponds to. So apparently, there is something going wrong with the transmission of the values. What might be causing this?

sentences:
Successful Elements to a 4X Game 4X games (That is, Xpand, Xplore, Xploit and Xterminate) like Civilization, Sins of a Solar Empire, and other top Strategy games, all seem to have the same addictive hook. I'd like to know what elements these developers incorporate into their games to make them:

Well paced (You can't beat the game in 5 minutes, but it wont take a week)
Replayable (The first game isn't your last)
Competetive (The AI doesn't play like a 3 year old)
Not repetetive (Such as using the same strategy over and over, or spamming units)
Economical (Not having 7 trillion metal and coins after 10 minutes of play)
Not to much micro-managing
Exciting (Necessary?) combat
You stil need to use strategy
Intuitive interfaces (Civilization 5 is a good example)
And any other important parts to the Strategy/4X genre

Some of these seem pretty simple, but others look like balancing acts, and I'd like to have some opinions on how to make a game that is fun to play. I'd be grateful if anyone could answer tell me how you or another game\developer has managed to successfully balance them together.

sentences:
Most efficient method to render 1,000s of unique space scenes? I'm an artist with a concept, not the developer, and I'm trying to wrap my head around the approach I should be taking for the following scenario, namely whether to model in Photoshop or 3DS Max.

Say I have a simple animation loop of a rotating planet with a moon orbiting it that I want to play in the background of a game menu screen. Thanks to your help I have some ideas as to how to represent this illusion in 2D. But what if instead I had thousands of different scenes of this nature I wanted to represent in-game, using different planets, moon configurations, orbiting ships, passing asteroids, various backgrounds, etc. I assume that attempting to render these as video files and apply individually as movie texture is out of the question due to hardware and/or storage limitations on mobile devices, and that the scenes would be too complex for spriting.

Would I be best off using a 3D game engine to individually render constituent objects (a rotating planet, an orbiting moon, a drifting debris field) and then place them in front of a static backdrop (a JPEG of a nebula and star field, for example)? I assume for the same reasons as above that you wouldn't actually pre-render these objects, but instead send instructions to the game engine to draw a sphere, map a couple of textures to it, give it rotational parameters, etc.? Is this basically how it works? What about for the non-simple shapes like asteroids, ships, etc., can you also send a model parameter?

Keeping in mind that these scenes will be backgrounds only and non-interactive, am I on the right track?

sentences:
What is the correct way to raycast on click? I am using raycast from screen point to detect if the user has clicked/touched on something.

The following fails 1/10 times; at first I thought due to the raycast missing the subject below, but after adding in the drawline i realise that it randomly doesn't even fire:

// layerMask declared with correct layers
void FixedUpdate(){
    if(Input.GetMouseButtonDown(0)){
        Debug.Log("click");
        Ray ray;
        RaycastHit hit;
        if(Physics.Raycast (ray, out hit, Mathf.Infinity, layerMask)){
            Debug.Log("You clicked on " + hit.collider.gameObject.name,hit.collider.gameObject);
        }
}

If I run this in Update() function instead, it will work perfectly - so FixedUpdate() seems to understandably cause the missed clicks... but i'm told I should always run the raycasts in FixedUpdate() for physics optimisation.

Maybe I should split this basic action over 2 functions?

A friend said i need an event handler

sentences:
Can a scrub design/develop a strong competitive fighter? The definition of Scrub in this question comes from David Sirlin's famous article, Playing To Win

I am a fan of fighters, and I am fairly well versed in design (I get my daily dose of gamasutra). However, I am also a MASSIVE Scrub. I don't like using tactics/characters that I feel lessen the experience or go against the spirit of the game (for example, Street Fighter's roll-cancel glitch, MVC2's infinite combos, Cable, etc).

I will practice and get good at using those tactics/characters, so that I can better defend against them, but I'd never use them against another player.

My question is, can someone like me design/develop a strong competitive title, or does my outlook prevent me being able to appreciate elements of design that are a necessity for developing a competitive scene?

My question is, are such elements necessary in creating a competitive fighter? What are the "gotchas" a scrub would by hindered by when designing/developing a competitive fighter?

sentences:
Should I avoid using object inheritance as possible to develop a game? I prefer OOP features when developing games with Unity. I usually create a base class (mostly abstracted) and use object inheritance to share the same functionality to the various other objects.

However, I recently heard from someone that using inheritance must be avoided, and we should use interfaces instead. So I asked why, and he said that "Object inheritance is important of course, but if there are lots of extended objects, relationship between classes are deep coupled.

I'm using an abstract base class, something like WeaponBase and creating specific weapon classes like Shotgun, AssaultRifle, Machinegun something like that. There are so many advantages, and one pattern I really enjoy is polymorphism. I can treat the object created by subclasses as though they were the base class, so that the logic can be drastically reduced and made more reusable. If I need to access the fields or methods of the sub-class, I cast back to the sub-class.

I don't want to define same fields, commonly used in different classes, like AudioSource/Rigidbody/Animator and lots of member fields I defined like fireRate, damage, range, spread and so on. Also in some cases, some of methods could be overwritten. So I'm using virtual methods in that case, so that basically I can invoke that method using the method from parent class, but if the logic should be different in child, I have manually overridden them.

So, should all these thing be abandoned as bad practices? Should I use interfaces instead?

sentences:
How could I implement an ECS in C? I'm looking into how to do a game engine using only C and wanted to know how to implement ECS in C.

I didn't find any ECS implementation for C, it only seems to exist for C++.

So I'm wondering... Is it possible to implement such a feature?

And if so, how to implement such a pattern in C?

sentences:
How to stop a decelarating object? I am programming a 2D game. When a ball is launched it should decelerate and eventually come to a stop. I have implemented the deceleration part but when the ball nearly stops it starts accelerating. I understand that I should implement some kind of condition for when it should stop (when velocity is 0), however all of my attempts have failed.
These are my variables:
v, v0 - velocity
acc - acceleration
dt - delta time
Here is a code sample of how the velocity gets updated on every game tick:
v.setX(v0.getX() + acc.getX()*dt);
v.setY(v0.getY() + acc.getY()*dt);

sentences:
Multiplayer architecture in games like Diablo 2 So I've been wondering, what kind of architecture would games like world of warcraft, diablo 2 (which is most probably a different beast than WoW) use?

As far as I know, RTS games state-syncs every client and server, and the input from the clients get relayed to the server, and all states from all clients will get the same input, because everything is synced.

And because everything is synced, state changes can be done safely, thus allowing large numbers of entities in the game (e.g zerglings), because the clients only need to know the players' inputs.

This is all fine and well, but AFAIK diablo 2 allows players to join servers mid-game, which leads me to believe they use a different architecture. I'm stumped on how they do this though, and if elegant solutions exist for such a thing. Does anyone have a better idea?

sentences:
What is a normalized Vector? Can someone explain the following code? I need to learn what each part means so I can turn it into enemy movement in a space shoot-em-up

Vec2d playerPos;
Vec2d direction; // always normalized
float velocity;

I get the above is naming two 2d Vector objects, and creating a variable called velocity. I'm not sure what the normalized comment is about, though.

update()
{
   direction = normalize(playerPos - enemyPos);
   playerPos = playerPos + direction * velocity;
}

sentences:
Planet sized quadtree terrain precision I've been working on a planet sized and shaped terrain lib for a while (In webgl and Unity) and have a couple of working implementations [Quadtree cubesphere and circular clipmaps].

But both of them suffer from the same problem. In the GPU vertex shader I move the vertices to their correct location on the planet. But 16 bit floats can't handle values that go into the millions. So when you get close to any vertex in the terrain it jiggles from the GPU rounding errors.

With the quadtree solution this is how I put vertices where they belong in the shader:

vec3 newPosition = vec3(normalize(StartPosition.xyz + (WidthDir * position.x + HeightDir * position.y) * Width) * Radius);

In the circular clipmaps I create a point at 0,0,1 and use two quaternions to rotate it to where it belongs (one for where the point is in the clipamp and one for where the clipmap should appear on the planet), then multiply it by the planet radius.

But both implementations require the multiplication of the planet's radius [the clipmap also has one quaternion with precision far higher than a 16 bit float, at ground level it will be a precision of 1/6000000 of PI].

So does anyone know how to handle this problem on the GPU so that at least the points closest to the camera have position values close to zero and no large number multiplication? Or is the only solution to set the positions on the CPU and just do some math work to make sure the vertices on the side of the planet closet to the camera always have values close to zero?

sentences:
FPS games: don't they have unrealistic one-eyed view? What are the causes? I have played many fps games, and noticed that the camera perspective is similar to the 'one eyed view' of the surroundings. It does not feel like bilinear. :/

Is it because of the single flat view of the screen? Or is it the problem that can be fixed by some research?

PS: If you want, try to roam around with only one eye open.

sentences:
Fair combat system for new players on RTS game I'm working on an idea/concept for a multiplayer game that I want to develop after my functional analysis but I'm still thinking of a way to implement a proper, fair combat system between new and existing players.

A player can create a new village/town once, anywhere on a map (this is key!). There is an attacking period where players can attack each other but I want to limit the possibility that more progressed players can attack beginners and prevent them from growing. Tribal Wars for example does this by creating new villages further away from the more progressed players. In my case, a user can create his town anywhere on the map, so I'm looking for a fair solution for all players.

A few examples of combat systems used in other games that I thought off:

RuneScape

  Any player within a particular level range of your combat level can be
  attacked in the Wilderness. The range is calculated by taking your
  current combat level and adding or subtracting the current Wilderness
  level you are in.

Tribal Wars

  Every new player is assigned a new village at the border from the
  previous players. So older, longer players are in the center while new
  players are further away from them, repeatedly. Combat system is based
  on the distance between 2 villages, so if older players want to attack
  a new player, it would take significantly more time to attack those
  players for less rewards.

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:
Scene graph or just plain container? I'm trying to understand if it makes sense to call what I have a scene graph or not.

Im doing an asteroid-like game, where all objects in the game are described in world space coordinates (an asteroid will be at X 50, Y 50 and it wont have objects orbiting, the player avatar is at X 100, Y 100 and it does'nt have a turret rotating the base of the ship. Objects are all described in world space, not in relationship to each other cause it just dose'nt make any sense).

For clarity (on why I will be mentioning a view matrix and a projection matrix bellow) - this is a 3D game with 3D objects in it, but the camera is locked facing one direction.

What I have is an object with a set of vectors containing all the objects visible in the scene. To me, this is still a scene graph - it just happens to be a flat graph where everything in the scene is a single node, not a child of a parent.
The scene graph also stores the projection and view matrix, as these are common to all objects scene (the view and projection matrix are static, only world space coordinates are updated). One could consider this view matrix as a transformation "node" that will be applied to all the children in the scene graph I guess.

So my question is - am I stretching it calling this a a "Scene Graph" and should I use another name for it?

sentences:
What functions should be called in C++ gameloop from Lua Script I am using sol2 lua wrapper for my 2D game-engine to implement some lua scripting,but I have some questions about what should functions should i call from Lua scripts in c++, and i cannot find any good resources about this topic.

For example. lets say that i am trying to render a sprite on the screen, which sprite is created inside a lua script. As usually the sprite should call render() function every frame, my question is that, should i call every frame functions from Lua in my game-engine loop ? or its bad habit? i mean can i have a structure in lua like below :

function init()
   --called only once
end

function render()
  --called every frame in C++ gameloop
end

or should I implemented in other way?
Can someone suggest me any books about this matter or any good resources ?

sentences: Efficiently tracking active instances I'm creating a game with lots of instances. On each iteration of the game loop, I only want to deal with the ones that are near the player. Currently, I do this by constructing a list of all the existing instances within a rectangle surrounding the player every few iterations. However, this takes far too long. How could I speed it up?

sentences:
Why would I lose the D3D device during an HLSL unroll? I have a pixel shader that downsamples a texture from one size to another. The downsample shader uses a nested 'for' loop to traverse the uv coordinates. When the for loop executes more than four times( [unroll(8)] for example ) the graphics device is lost and all hell brakes loose...Here is shader code:

void DownsamplePass_Pixel_Shader( in float4 Position : POSITION0,
           in float4 PositionSS : VPOS, out float4 vEnergy : COLOR0 )
{
    float width = LastMipInfo.x;
    float height = LastMipInfo.y;
    float mip = LastMipInfo.z;
    float mult = LastMipInfo.w;
    float4 vPos = PositionSS;
    float4 vColor = 0;
    int ncPixels = 0;

    // depending on the size of the visibility buffer( texture to downsample )
    //      it may be necessary to sample more than a 2x2 block of pixels( if the size is greater than twice the target )
    //      this is only necessary for the first pass
    if( bFirstDownsamplePass )
    {
        [unroll(8)]
        for( int y = 0; y < mult; ++y )
        {
            [unroll(8)]
            for( int x = 0; x < mult; ++x )
            {
                float2 vCoord = float2( ( vPos.x * 2 * mult ) / width + x * ( 1 / width ), ( vPos.y * 2 * mult ) / height + y * ( 1 / height ) );
                float4 vTexel = tex2Dlod( g_SamplerMip, float4( vCoord, 0, mip ) );
                if( all( vTexel.rgb == 0 ) )
                    continue;

                vColor.rgb += vTexel.rgb * tex2D( g_SamplerMultiplier, vCoord ).rgb;
                ncPixels++;
            }
        }
    }
    else
    {
        float2 vCoords[ 4 ];
        vCoords[ 0 ] = float2( ( vPos.x * 2 ) / width, ( vPos.y * 2 ) / height );
        vCoords[ 1 ] = float2( vCoords[ 0 ].x + ( 1 / width ), vCoords[ 0 ].y );
        vCoords[ 2 ] = float2( vCoords[ 0 ].x, vCoords[ 0 ].y + ( 1 / height ) );
        vCoords[ 3 ] = float2( vCoords[ 1 ].x, vCoords[ 2 ].y );

        // calc average energy
        float4 vColor = 0;
        int ncPixels = 0;
        for( int i = 0; i < 4; ++i )
        {
            float4 vTexel = tex2Dlod( g_SamplerMip, float4( vCoords[ i ], 0, mip ) );
            if( all( vTexel.rgb == 0 ) )
                continue;

            vColor.rgb += vTexel.rgb;

            ncPixels++;
        }
    }

    vEnergy = float4( vColor.rgb / max( ncPixels, 1 ), 1 );
}

I could just define each uv coordinate but I'm interested in knowing why this problem occurs!

sentences:
How to make Sprites scroll with the background image that are inside Scroll View? I'm new in Unity, so I hope you guys can help. I'm developing a 2D-game for Android device, on the scene I have a huge background image inside Scroll View (UI - Scroll View).

Next, I created new empty Game Object "Players", attached to it "Players script" and added "Sprite Renderer" component.

From the Sprites I created two prefabs - housePrefab and dogPrefab. Inside "Players script" I have the following code:

[SerializeField] GameObject housePrefab;
[SerializeField] GameObject dogPrefab;

void Start()
{
var houseXPos = 1.41f;
var houseYPos = 2.63f;

var dogXPos = -0.41f;
var dogYPos = 2.63f;

GameObject house = Instantiate(housePrefab, transform.position = new Vector2(houseXPos, houseYPos), Quaternion.identity) as GameObject;
GameObject dog = Instantiate(dogPrefab, transform.position = new Vector2(dogXPos, dogYPos), Quaternion.identity) as GameObject;
}

After I run game both Sprites appears on the screen (as I expected). The problem occurs when I Scroll background image, both sprites stay in the same position under scrolling. In other words sprites not scrolling with the background image.

As far as I understand, the Sprites needs to be added to the background image, but I don’t know how to do it.
How to make Sprites scroll with the background image?

Thanks to all in advance.

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:
How can we sell rights to our computer game We have an indie team that created a game on PC using Unity. We created the game for a long time and everything was exciting. We just don't even have money for advertising.
We had to borrow $100 for steam direct to release the game into early access. Since there was no money for advertising, the game collected only $66. But we did not receive them either, due to the fact that payments from Steam come only when income is above $100.
I'm looking for a way to sell the rights to this computer game to recoup our costs. We are so desperate that we are ready to sell all the rights to the game together with source code (The game was created for more than two years).
How can we go about finding a buyer for this game?

sentences:
How can I convert an html5 web game to an android app? I have already made an html5 game and it is in service.
I want to service this at Android app too.
I know little about Java or Kotlin, so I think the least risky way is to use a webview.
There is already a function to save game data with Oauth authentication.
I thought this part should be replaced with google play Oauth.

However, there is a problem that the app does not run when the player is offline. (Run the app fails to load any html document)

However, if you load a local html file, it will be rejected from the existing firebase SDK because there is no domain.

In fact, I know very little about native app development, so I don't know that what I don't know, what I need.

What should I do in this situation?

Do I need to rebuild my app in Kotlin or Java from scratch?
Do I have to use the same engine as Unity?
Do I have to rebuild with a framework like cordova?

The question may not fit here, but I need help. Please.

sentences:
How do games deal with Z-sorting partially transparent foliage textures? I was busy implementing basic transparency in a prototype I'm working on when something occurred to me.

In order for a given texture's transparency to work as expected, the (semi-)transparent texture must be drawn after whatever is behind it, right?

Well, if we take for example a tree or shrub in a game like Skyrim, the texture(s) that make up the foliage on that tree or shrub must include some transparency somewhere, right?  A vertex-perfect leaf model would be far too resource-intensive.  But the player can move around, and sometimes through, any plant at will, thus changing the relative position of all textures to the camera.

Doesn't this mean that the game has to constantly Z-sort all textures, both between models and even within a single plant model, whenever the player moves (so potentially every single frame)?  Isn't that very resource-intensive?  How do games with lots of partially transparent textures deal with this?

sentences:
Varying framerate (FPS) In my game-loop, I am using fixed time step for physics and interpolation for rendering as suggested on Gaffer on Games | Fix Your Timestep!

However, when the framerate is varying between 30-60fps during the game, the game looks jumpy. For example, balls suddenly look accelerated when the frame rate increases from 35 to 45 suddenly.

Is there a way to make the game look smooth while framerate is varying?

Here is my game loop:

protected void update(float deltaTime) {
    //do some pre stuff

    deltaTimeAccumulator +=deltaTime; //deltaTimeAccumulator is a class-member holding the accumulated frame time
    while(deltaTimeAccumulator>FIXED_TIME_STEP) {
        world.step(FIXED_TIME_STEP, 6, 2);  //perform physics simulation
        deltaTimeAccumulator-=FIXED_TIME_STEP;
    }
    // world.step(deltaTime, 6, 2);

    destroyBodiesScheduledForRemoval();
    render(deltaTimeAccumulator /FIXED_TIME_STEP); //interpolate according to the remaining time
}

Here is the part related to the interpolation (related inner works of render() method) :
        this.prevPosition = this.position; //get previously simulated position

    this.position = body.getPosition(); //get currently simulated position

    //interpolate
    Vector2 renderedPosition = new Vector2();
    if (prevPosition != null) {//&& !isFloatApproximatelyEquals(this.prevPosition.x, this.position.x) && !isFloatApproximatelyEquals(this.prevPosition.y, this.position.y)) {
        renderedPosition.x = this.position.x * interpolationAlpha + this.prevPosition.x * (1 - interpolationAlpha);
        renderedPosition.y = this.position.y * interpolationAlpha + this.prevPosition.y * (1 - interpolationAlpha);
    } else {
        renderedPosition = position;
    }

    //Draw the object at renderedPosition

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:
Overlap color between objects I'm currently trying to build a game with Ogre3D that is basically a moving vehicle that leaves a green trail (2D manual mesh) in it's path, what i'm trying to achieve is exactly what this image shows:

My problem is that i need to change, by some method/technique, the color of the intersected path where the two meshes overlap (red area).
I've been searching around the Ogre forum and found this thread http://www.ogre3d.org/forums/viewtopic.php?f=2&t=47674, I've replicated that solution in my code but now on the screen i only see the intersected path. I'm a total newbie in stencil buffers and in Ogre generally, so I'm still not sure if this is the best approach to solve my problem.
should I try another method rather than applying a stencil buffer? vertex/fragment shader code that could help?

Any advice or direction that you could provide will be very appreciated.
Thanks a lot

***** UPDATE *****

According to JasonPh's answers i've managed to start adding some code:

1) Create manual texture

Ogre::TextureManager* tmgr = Ogre::TextureManager::getSingletonPtr();
gkString mMapTextureName = "pathTexture";
if (!tmgr->resourceExists(mMapTextureName)) {
    Ogre::TexturePtr ptr = tmgr->createManual(mMapTextureName,
                           Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
                           Ogre::TEX_TYPE_2D,
                           480,  // Width
                           640,    // Height
                           1, // Depth
                           0,
                           Ogre::PF_A8R8G8B8,
                           Ogre::TU_RENDERTARGET);

    ptr->createInternalResources();
    ptr->load();

    Ogre::RenderTexture* pathTexture = ptr->getBuffer()->getRenderTarget();
    gkEngine* engine = gkEngine::getSingletonPtr();
    Ogre::Camera* camera = engine->getActiveScene()->getMainCamera()->getCamera();
    pathTexture->addViewport(camera);
    pathTexture->getViewport(0)->setClearEveryFrame(true);
    pathTexture->getViewport(0)->setBackgroundColour(Ogre::ColourValue::Black);
    pathTexture->getViewport(0)->setOverlaysEnabled(false);
    pathTexture->setAutoUpdated(true);
}

2) Create material from scratch and use the previously created texture. This material is then assigned to my "path" entity.

Ogre::MaterialManager* mmgr = Ogre::MaterialManager::getSingletonPtr();
mMaterialName = uniqueMaterialName("pathMaterial");
mMaterial = mmgr->create(mMaterialName, "General");

Ogre::Technique* tec = mMaterial->getTechnique(0);
tec->setSchemeName("ShaderGeneratorDefaultScheme");
Ogre::Pass* pass = tec->getPass(0);
pass->setVertexProgram("pathMaterial/vs", false);
pass->setFragmentProgram("pathMaterial/fs", false);
pass->setCullingMode(Ogre::CULL_NONE);
pass->setColourWriteEnabled(true);
pass->setLightingEnabled(true);
Ogre::TextureUnitState* tus = pass->createTextureUnitState();
tus->setTextureFiltering(Ogre::TFO_NONE);
tus->setTextureAddressingMode(Ogre::TextureUnitState::TAM_CLAMP, Ogre::TextureUnitState::TAM_CLAMP, Ogre::TextureUnitState::TAM_CLAMP);
tus->setTexture(tmgr->getByName(mMapTextureName));

mMaterial->prepare();
mMaterial->load();

3) Fragment shader code

uniform sampler2D pathTexture;

void main()
{
   vec4 color = texture2D(pathTexture, gl_TexCoord[0].xy); =
   if(color == vec4(0.0, 1.0, 0.0, 1) //green
       gl_FragColor = vec4(1.0, 0.0, 0.0, 1) //red
   else
       gl_FragColor = vec4(0.0, 1.0, 0.0, 1) //green
}

This still needs some fixes to work, so new questions have emerged:

1) Do I realy need to render "pathTexture" on screen to this to work? Maybe that texture could only be used to decide pixel colors an then discard it?

2) To only use "pathTexture" as an "input" for my shader, should I add a second pass on my material file with "pathTexture" as a texture unit?

Thanks!

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:
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:
XNA flip SpriteBatch on click Is there any way to make a SpriteBatch flip when its clicked, something like Android Animation?

I know that spriteBatch.Draw() have SpriteEffects, but it literally flip it and I want to flip it like an animation.

sentences:
How do I do a game loop in c99? I'm having trouble with how to structure a game using c99. I've seen a few tutorials on making a game loop, but they are all done with c++ and classes. My main problem seems to be moving data around between the functions without creating a mess, and what stuff to put in what header files etc. Do I just do something similar to the c++ loops, and create a class-like header with a structure containing all items needed by more than one of the functions, along with the prototypes of said functions, and include the header in each function's header file? Then, in the main function, instantiate the structure and pass a pointer to it to every function in the loop?

Is this ok, or is there a better way to do it, and are there any good 'c' specific tutorials available?

Cheers

sentences:
How to find 2D grid cells swept by a moving circle? I'm making a game based on a 2D grid, with some cells passable and some not. Dynamic objects can move continuously, independent of the grid, but need to collide with impassable cells.

I wrote an algorithm to trace a ray against the grid, that gives me all cells that ray intersects. However, actual object are not point-sized; I'm currently representing them as circles. But I can't figure out an effective algorithm to trace a moving circle. Here's a picture of what I need:

The numbers show in what order the circle collides with grid cells. Does anybody know the algorithm to find these collisions? Preferably in C#.

Update The  circle can be bigger than a single grid cell.

sentences:
how could RTT be so slow on my intel card? I simply draw something into a render target, and use it as an normal texture. It's always working greate to me with my nvidia video card. But today I found my program ran terribly slow (less than 5 fps) on a intel card.

After running an analyse I found glGenerateMipmapEXT is the trouble maker, it costs most of the cpu time. Here's how I bind a RT texture:

  glBindTexture(GL_TEXTURE_2D, m_textureID);<br>
  glGenerateMipmapEXT(GL_TEXTURE_2D);

without glGenerateMipmapEXT the texture is nothing but pure white pic. Something wrong with my RTT?

sentences:
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: Change opacity for texture or sprites in XNA Is there a way to change the opacity or transparency for a texture or sprite?

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:
Getting body position I am using BodyA.getPosition().x and BodyA.getPosition().y to get the x and y vector of a body location so i may attach some text above its head, but the log of that position prints out something like 3.666757..... I want this text to be moving when the body moves so it should be relative to the body position at all times until removed. Currently when I try to use this

speech = new TickerText( 0, 0, font,
            ptext, new TickerText.TickerTextOptions( 10 ),
            ResourceManager.getInstance().vertexManager );

speech.setBlendFunction( GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA );
speech.setScale( 0.5f );
speech.setAutoWrapWidth( 500f );
speech.setAutoWrap( AutoWrap.WORDS );
speech.setPosition( xVal, yVal );`

The text is not displayed on screen on screen at all, I figure its the x and y location being wrong because when I manually set x and y to positions I know would be on the screen area it is shown. I am looking for help as how to get the actual X and Y coordinate of the body on screen so I can have the text follow the body.

sentences:
How do I query a LibGDX Box2DLights "light" and "dark" regions? I have lighting implemented using Box2dLight. I want to update/render things inside the player's PointLight area. Stuff in the dark area should not be rendered.

How can I find which areas are lit or dark?

My PointLights and Body look like this:

sentences:
How do I create a half-ortho half-perspective projection matrix I've been trying to make a formula for the projection matrix where your vertical axis is projected orthographically but your horizontal axis will have perspective to it.
So the view frustum would look like this:

I studied how the formulae of orthographic projection and perspective projection and how they where achieved. And tried to modify those to try to reach projection I wanted. It seemed to me it wasn't possible to have one axis scale to Z and the other not (or to have them scale at a different factor).
It it possible to reach the perspective I want? If so what would the projection matrix look like?

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

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

sentences:
Handling lost graphics device XNA 4.0 in winforms I'm trying to put in a new feature into my level editor. Part of the feature is to bring up a form when a user places a new tile onto the map, but once the form is brought up the XNA embedded screen throws up a big red X.  I think this is due to the embedded screen losing focus to the form and then crashing.

This is where the form is initialized

 public Form1()
   {
    InitializeComponent();

    //Node Editor

    tileDisplay1.OnInitialize += new EventHandler(tileDisplay1_OnInitialize);
    tileDisplay1.OnDraw += new EventHandler(tileDisplay1_OnDraw);

    Microsoft.Xna.Framework.Input.Keys[] allKeys = (Microsoft.Xna.Framework.Input.Keys[])
     Enum.GetValues(typeof(Microsoft.Xna.Framework.Input.Keys));

    foreach (var key in allKeys)
    KeyboardInput.AddKey(key);

     KeyboardInput.KeyRelease += new KeyHandler(KeyboardInput_KeyRelease);
     MouseInput.MouseMove += new MouseMoveHandler(MouseInput_MouseMove);
     MouseInput.MouseDown += new MouseClickHandler(MouseInput_MouseDown);
     MouseInput.MouseUp += new MouseClickHandler(MouseInput_MouseUp);

     Application.Idle += delegate { tileDisplay1.Invalidate(); };

     saveFileDialog1.Filter = "Map File|*.map";

     Mouse.WindowHandle = tileDisplay1.Handle;

   }

This is where the draw event is fired off

void tileDisplay1_OnDraw(object sender, EventArgs e)
        {
            Logic();
            Render();

            KeyboardInput.Update();
            MouseInput.Update();

            foreach (var actor in Actor.Actors)
                actor.Update();
        }

This is where the form is being called

     private void Logic()
    {
               if (colIndex == 8 && AssociateBox.SelectedIndex == 0)
                {
                    currentCollisionLayer.SetCellIndex(collideCellX, collideCellY,form.spawnNumber.ToString());

                    if(form.spawnNumber == "12")
                    {
                       camdetails.ShowDialog();
                    }
                }
    }

sentences: Get screen bounds of 3D object I'm trying to draw a 2D plane that has minimum dimensions to contain a 3D model (a sphere). How do I calculate the minimum size and position of the rectangle to completely cover a 3D model on screen?

sentences:
Applying scale to objects appears to have little effect when close up. I just started out with D3D 11. My goal is to write a cube voxel engine (Minecraft style). Actually it's working pretty solid already, but when I finally tried to change the size of my cubes, I ran into a problem:

No matter how large I make my cubes, they always appear super large when I move very close to them. Although they appear in a different size when I declare them in a different size and look at them from the same absolute distance.

For example: Let's say I make my cubes have a width, height, and depth of 1.0, and another time I give them a width, height, and depth of 0.01, and both times I look at them from a distance along the z axis of -1.0. The 1.0 cubes look larger than the 0.01 cubes. But I think this is only because the "relative" distance (100 cubes vs 1 cube) is a lot larger. The problem is, when I move very close to my 0.01 cubes, they become just as large as my 1.0 cubes with the front side filling almost the entire screen. I am very confused right now, since I have no clue as to how I can make my cubes appear smaller when I get very close to them. The problem is, the smaller I make my cubes, the closer I have to be able to get to them in order to make them appear as if they were right in front of me, which always results in huge cubes. Can anybody please help me figure out how to make my cubes appear smaller?

I don't know if this matters, but here is how I make my cubes:

1) Create a mesh for each chunk of voxels. In this process, I already define my vertices in world coordinates taking into account the cube size that I want (this is working, I printed out my vertex data with different cube sizes).

2) When rendering, each frame, I take the view projection matrix from my camera and send it to the shader. My vertex shader then simply does the following to my world coordinate vertices:

vout.pos = mul(float4(vin.pos, 1.0f), vpMatrix);

I also made some screenshots to show my problem. I just made a simple 32x3x32 map with different textures at each height.

1) Cube size 1.0, distance 10.0:

2) Cube size 0.1, distance 10.0:

3) Cube size 1.0, close distance:

4) Cube size: 0.1, close distance:

As you can see, at a distance of 10.0, the size difference is noticeable. But the closer I get, the less the size difference appears. A cube size of 0.1 at a close distance is still way too large. Almost as large as a cube size of 1.0 (which should be 10 times bigger?). I can go lower and lower on the cube size, but it just stays way too big at close range. And at some point, I can't go any lower. So, is there a way to make my cubes at a close distance look just a little bit bigger than the cubes seen in the second picture (cube size 0.1 at distance 10.0)?

Here is another screenshot of a more complex "map" proving, that I should actually be rendering stuff correctly:

sentences:
How do I resize a game object, when it has extended past a boundary? I have some white blocks, and within the white blocks, I have some cyan-bordered boxes. Whenever the white boxes are extended outside of the cyan bordered boxes, I want to resize them so they are back inside the cyan bordered boxes.

As per my image, they need to remain in their borders, like the fifth one from the top.

How do I resize a game object, when it has extended past a boundary?

Here is my current code:

void Update()
{
    if(numOfGeneratedGuideline < numOfGuidelineToGenerate)
    {
        Generate_Guideline_Positons(numOfGeneratedGuideline);
        Generate_Platform_Positions_And_Scale(numOfGeneratedGuideline);
        Generate_Platforms(numOfGeneratedGuideline);
        numOfGeneratedGuideline++;
    }
}

void Generate_Guideline_Positons(int i)
{
    float tempGuidelineOffset = groundHeight + (guidelineOffset * (i + 1));

    guidelinePosX[i] = worldWidth / 2;
    guidelinePosY[i] = tempGuidelineOffset;
    guidelinePosZ[i] = 0;
}

void Generate_Platform_Positions_And_Scale(int i)
{
    randomGuidelineNumber = Random.Range(1, numOfGuidelineToGenerate + 1);

    float tempPlatformPosXMin = (worldWidth - guidelineWidth) / 2;
    Debug.Log(tempPlatformPosXMin);
    float tempPlatformPosXMax = worldWidth - tempPlatformPosXMin;
    Debug.Log(tempPlatformPosXMax);
    float tempPlatformPosY = groundHeight + (guidelineOffset * (i + 1));

    platformPosX[i] = Random.Range(tempPlatformPosXMin, tempPlatformPosXMax);
    platformPosY[i] = tempPlatformPosY;
    platformPosZ[i] = 0;

    platformScaleX[i] = Random.Range(minPlatformScaleRange, maxPlatformScaleRange);
    platformScaleY[i] = 1;
    platformScaleZ[i] = 1;

    //22 29 36 43 50
}

void Generate_Platforms(int i)
{
    GameObject newplatform = Instantiate(platformPrefab,
        new Vector3(platformPosX[i], platformPosY[i], platformPosZ[i]),
        Quaternion.identity) as GameObject;

    newplatform.transform.localScale = new Vector3(platformScaleX[i], platformScaleY[i],
        platformScaleZ[i]);
}

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: Is there a simple C++/.NET game with scripting? I would like to play around with games that use scripting to see how much easier it makes development. What --simple-- C++ or .NET game may i download and play with using a scripting language. I dont really care which scripting language it is.

sentences:
Dealing with multiple 2d sprite animations for the same object I am using libGDX for a 2d game. Some of my in-game objects have animations, for example a soldier in top-down view that has a walking animation. That is working fine.

Now, while walking, this soldier could do other things as well, for example firing his gun. So both, walking and firing, can happen at the same time.

My question now is: How does one usually deal with these multiple simultaneous animations for the same object? Do I need different animations (one for just walking, one for just shooting, and one animation for both at the same time), or do I rather split the object into several sprites (eg. the soldier's body separated from his arm with the gun), to animate these parts separately? Or is there even another way to achive this?

sentences:
How to approach debugging of java.lang.NullPointerException in android build of unity app? We are getting an obscure java.lang.NullPointerException when building a Unity app for android.  There's not much information here that I can trace back to our code. Does anyone have advice about how to approach debug this?

All I have to go on at the moment are logCat logs:

Uncaught exception thrown by finalizer
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference
    at java.lang.reflect.Proxy.getInvocationHandler(Proxy.java:891)
    at bitter.jnibridge.JNIBridge.disableInterfaceProxy(Unknown Source:0)
    at bitter.jnibridge.JNIBridge.delete(Native Method)
    at bitter.jnibridge.JNIBridge$a.finalize(Unknown Source:15)
    at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:250)
    at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:237)
    at java.lang.Daemons$Daemon.run(Daemons.java:103)
    at java.lang.Thread.run(Thread.java:764)

(Unity version : 2018.1.0b10)

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 do I force Unity to reload editor scripts I am working of some editor scripts for Unity but have found that it is difficult to force Unity to reload my editor scripts.

My scripts are modelled on the static constructor approach and perform some manipulation of the Tag Manager.

Currently the static constructor is called when either:

Unity is launched, or
Changes to a script (any of them) are written to disk

While verifying that the tag manipulation performed by the script is correct I am manually setting the tags via the GUI and then triggering script by saving a trivial change to the file.

This is clearly a clumsy workaround, is there a better way to force Unity to reload editor scripts?

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:
Load large quantities of data in Unity3D I'm building an Android app using Unity3D where users can visualize data immersively.

The data is immutable and stored using a MySQL database hosted on cPanel.

When the user clicks a button in the environment, it starts the creation of a chart. First, contacts a .php file present in the server responsible to query the database, fetching the data and make it available to the Unity controller which then adds the points to the chart. This works fine for small quantities of data.

To increase performance, thought of exporting from MySQL as CSV and transform to one JSON, instead of querying a database or try to make MySQL transform to JSON, but I'm afraid this won't be enough.

Could also extract as CSV and use a 3rd party for reading it.

How would you load the data in such case to have the best performance?

sentences: (Unity 5) Force child object to be perpendicular to the ground? As i mentioned in the header, i want my MainCamera child object to stay perpendicular to the ground, any ideas?)

sentences:
What is the size limit to the Unity 2017.2 Tilemap? I've been digging through the documentation on the Tilemap feature of Unity 2017.2.

Does Unity limit the maximum number of tiles it will support for a particular tilemap mesh?

I know that each tile is instantiated once and used to texture the quads on the Tilemap mesh at runtime, so I would guess that the mesh quad count limit is ultimately dependent on the hardware, and more or less is arbitrarily high.

Is that a correct assumption, or is there a hard cap in the engine?

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:
Calculating distance for Gauss Map optimized SAT There's an optimization method for the separating axis test in 3D that uses Gauss Maps to discard certain redundant axes from the set of axes that need to be tested generated by edge-edge cross products.

A detailed presentation can be found here.
Along with some source code.

The presentation also states that using the Gauss Map method lets you compute the distance between the two polyhedra along the separating axis orthogonal to corresponding edges (i.e. ones that the Gauss Map method doesn't discard) in O(1).

This is done by considering the plane formed by the cross product of the two corresponding edges fixed on one edge, and finding the minimum distance from a vertex to the plane on the corresponding edge.

My question is:

Why isn't the distance found this way in the general case when testing the axis formed from the cross product of two edges (i.e. when not using the Gauss Map optimization)?

Generally the method I see used is projection intervals, or fixing the plane for the separating axis to its corresponding edge or face on one polyhedron, and ensuring all vertices of the other polyhedron fall outside.

sentences:
Pluggable modifiers to game engine I'm currently working on a clone of an old turn-based strategy game "Stars!" and am looking for solutions to a challenge in game engine implementation.

The premise

The premise of the game is that every player takes control over the entire race of his denizens (called "colonists") and fight other players to conquer the known part of the galaxy.
Each player can design their race as they please. The first choices presented when creating a race are those of the Primary Racial Trait (PRT - must select exactly one from a list of 10) and Lesser Racial Traits (LRT - can select any number of them from a list of 14). A PRT usually modifies several aspects of the base game, e.g. sets starting technology level, gives some starting spaceships, controls the availability of certain ship parts and modifies the rules of the game for that player while LRTs provide minor advantages/disadvantages.

A few examples to show the extent of game modifications as well as interactions between them:

PRTs can modify the same part of the rules from two directions: Inner Strength PRT - 10% increased strength of defending colonists; War Monger PRT - 10% increased strength of attacking colonists.
PRT and LRT can directly modify the same "property" of a race: Jack Of All Trades PRT - +20% maximum planet population; Only Basic Remote Mining LRT - +10% maximum planet population; they cumulate multiplicatively (+32%).
LRTs can work conditionally based on other LRTs: Improved Fuel Efficiency grants access to several unique types of engine, where one of them is granted only if another LRT No Ram-Scoop Engines is not chosen.
PRT can fundamentally modify the game mechanics: Alternate Reality PRT races do not live on planets but rather in orbiting starbases. Rules of economy (resource production) are completely different for them as they do not build planetary facilities (factories and mines).

Constraints - the challenge

Make it possible to design new PRTs and LRTs and put them in the game without much pain.
(Induced from previous) They must be in some way decoupled from the main engine (so the core "rules engine" cannot be based on if/switch statements that change flow based on PRT/LRT).

The question

What design patterns would be suitable to this problem of "pluggable modifiers"?

The language is C#, if that helps with suggesting more specific solutions. So far my brain is wandering in the realm of attaching the Traits to events in the engine where it calculates certain properties (so they could modify the output of these calculations), but I don't want to suggest too much.

sentences: Rotate final image with projection matrix I'm trying to use space in my shadow (depth) maps in a more efficient way. If I could freely rotate the final image I get with projection matrix I could save a lot of pixels, but I don't know if it is possible to do so. Is it?

sentences:
How much more do I have to learn? So I started learning java sometime ago and now I am understanding packages.

My main goal is to do minecraft modding. Can someone with modding experience please tell me how hard(or easy) minecraft modding is? And how much time will it take for me to get to a level when I can start modding?

sentences:
Recording the gameplay in the game itself? I'm presently working on a 3D car racing game for the iOS platform. I had to implement a replay system and then record that replay in a video file to upload it to YouTube.

I'm only having issues with the recording part, the rest is done. What I'm doing is using the glReadPixels() command of OpenGL ES 1.1 to capture the framebuffer content and creating a video from these frames during runtime (using AVFoundation framework).

The problem I'm facing is that I have to call glReadPixels() in each update which is very slow . It decreases the FPS from around 30 to only 2-3...
Is there any alternative to the glReadPixels() command?
Or did anyone create a replay system and recorded to video?

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:
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:
New Unity version copies the settings of previous version I use Ubuntu 20.04.
When I download a new version of Unity 3D through Unity Hub, this new version automatically takes the settings of the previous version. I have installed Unity 2020.1, and I am facing the same problem. I created a new project, but it written in 2020.1 that I used preview package. I didn't even installed any package in Unity 2020.1. I did install preview package in 2019.4. But I didn't even open the project with 2020.1. I only have one project with 2020.1. The new project I just created. I asking help because I faced this issue when I first installed 2019.1, 2019.2, etc.
How can I flx it? Thanks

sentences:
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:
When does a parallel-tasks engine becomes a good solution? I'm often tempted to break the game I'm working on to try a parallel-tasks based architecture, but that don't seem a big requirement for my project so I avoid this for the moment. I'm planning to just try it in a toy project first, to "play with the concept."

Now, what I'm asking is, as lot of (non AAA) games do not require really really high performance, it feels like using a task-based engine isn't worth bothering until... what cases?

At the moment, I'm only guessing that it's necessary when you really need to exploit maximum performance of the (multi-core) hardware. Is there other cases where it's a good idea to use task-based engine? Or maybe, for new projects, it's always good to start with a task-based engine?

sentences:
Can I publish an indie game on XBL made with directx So I know that XNA can be used to publish games on Xbox Live Indie Games and I signed up for the $100/year subscription thing.

I haven't downloaded XNA yet but I was wondering if I can publish a game made entirely in DirectX onto it or do I have to go through XNA?

sentences:
How can I implement scrolling endless road in XNA? I am developing XNA game like following screenshot.

I created my 3D objects and camera so I have models. But how can I implement scrolling road in XNA?

sentences:
Lunar lander: How to calc acceleration in each step I'm trying to make a lunar lander simulator. I'm going to use a simple Euler integration. AFAIK all I've to calculate is the acceleration in each step, and then I should be able to update velocity and position.

I'm following this page:
http://www.braeunig.us/apollo/LM-descent.htm

There's a paragraph I don't really understand:

  Although most operations are self-explanatory, a brief description of
  acceleration is warranted. Acceleration is broken down into vertical
  and horizontal components, where the vertical component is normal to
  the Moon's surface. The instantaneous vertical and horizontal
  accelerations of a moving body in reference to this surface are
  Av=Vh^2/r and Ah=–VhVv/r. To this we add the accelerations resulting
  from gravity and thrust. Gravity, of course, acts vertically downward.
  The vertical and horizontal components of thrust are a function of the
  pitch angle.

The author is making a much more realistic simulation here and because of that he is not assuming the Moon is flat. He comes up with two initial values for each acceleration component:

    Av=Vh^2/r

    Ah=–VhVv/r

1- Seems that Av is the centripetal acceleration, but where does the Ah come from?

2- Are those initial values really needed? In my game the Moon is going to be flat. I thought taking into account thrust/mass and gravity would suffice.

Thanks in advance.

sentences:
Abstracting Entity System animation states I recently started designing a Game Engine using the Entity System paradigm, i.e. having entities as an aggregation of components, and systems that implement the actual game.
Whereas I've had difficulties in various aspects, what concerns me most is the abstraction / modularity of the various Components / Systems. Specifically, let's say my Player has several animation states, eg. Walking, Sleeping, Jumping, and one type of Opponent entity has several (not necessarily the same) states as well, eg. Walking, Hiding etc.

How should I design the engine, so that it handles the various (animation) states of each entity type? Should there be different animation Systems for each Entity type? Should I use flags that signal the animation System to render the correct entity? Also, can I avoid using "hard-coded" enums for the various poses? I can see that a scripting system could probably help, but I'm almost sure there is a simpler solution.

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:
How can I detect a perfect passageway for collision detection? The problem is when I move diagonal it moves fractions of units and therefore my coordinates might be a fraction of a unit say (40,400) might be actually (40.12,400.40) but another problem is my pink square might be moving really fast. Below is a screenshot where you can see I can make it past a pixel perfect passageway with my pink square but the other passageway with the white square is very difficult if not impossible to make it through (I have by zooming in and moving REALLY slow but sometimes it impossible for the reasons listed above) Suppose in the example above I am holding the up and left arrows how can I make it so the pink square slides across the yellow rectangle and detects it can move upward and begins to move up?

The code I am using right now looks like this

float d45 = (float) (1 / Math.sqrt(2));
moveX = -d45;
moveY = d45;
moveX = moveX * t * speed;
moveY = moveY * t * speed;
        for (Stuff s : collidables) {
            if (overlaps(s, moveX, 0)) {
                collidedX.add(s);
                x += moveX > 0 ? s.x - width - x : s.x + s.width - x;
            }
        }
        if (collidedX.size < 1) {
            x += moveX;
        }
        for (Stuff s : collidables) {
            if (overlaps(s, 0, moveY)) {
                collidedY.add(s);
                y += moveY > 0 ? s.y - height - y : s.y + s.height - y;
            }
        }
        if (collidedY.size < 1) {
            y += moveY;
        }

I check for collision twice once on the Y axis and another on the X axis so that it can still slide to the left even if you are pushing the up and left arrow. The problem is it skips over the 100 unit passage to the left of the picture above. If I create a passage that is 110 units wide it will slide up fine but this isn't really cool because I like how it looks where it slides perfectly. Any ideas?

sentences:
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:
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:
Drawing to create game drafts Man, I'm really bad at drawing...
I feel myself really ashamed because I cannot draw even a little nice sword... :(

The problem is, on game development (I will be on the programming part, relax!) I will need to explain some game ideas to game artists, like "I need that city like this" or "that character needs to have that look and feel".

My idea is, I really need some BASIC skills on drawing some draft of what I'm thinking...

I'm bad in pen/paper drawing and photoshop/corel drawing, but I'm convicted to learn photoshop or corel to draft something...

Someone has passed that problem? What you recommend?

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 do I display same “proportional” text size on different resolutions? I draw some text on screen using ID3DXFont::DrawText. This text should be displayed the same regardless of screen resolution.

For example, if screen resolution is low, text wrapped and when it is higher text is not wrapped. How can I avoid such situation? I want text size to be connected to screen resolution so if resolution is lower I want the text to be relatively smaller so that no wrapping happens. Is there any way?

Thanks in advance

sentences:
How to create scrolling input text field using Unity UI How to create scrolling input textfield using UI

in Unity 4.6.6

problems in my project are

1.Cursor is not masking

2.Scrollbar size is automatically become 0 to 1 size

3.Scrollbar is not working after assigning in "Scroll Rect".

Here is my sample project

Thanks in advance .

sentences:
Speed needed to make a car jump from a ramp I need to make a car jump from a ramp to another, and I need this to be done using AI so I thought it would be enough to set a fixed speed for my car when near the ramp, in order to let it jump correctly.

It works fine if I input the speed manually but I'd like my game to calculate it since the ramps will be generated by user's input.

Unfortunately my physics knowledge lacks, so I need your help.

The problem is summarized in the picture below.

Basically, what I need to compute is the speed (in m/s) that the car has to have on the highest point of the first ramp, given that all the data in red are user's input.

I had some rough ideas on using the projectile range with x=L, y=h-launchRampHeight but the results weren't as I expected them so I gave up.

Do you have any hints on this?

Please note that both ramps have the same length (50m).

EDIT:

Based on @mklingen here's the C# code that I'm using (where Distance = L)

var speed = (Mathf.Sqrt(g)*Mathf.Sqrt(Distance)*Mathf.Sqrt((1/Mathf.Sin(Theta)))* Mathf.Sqrt((1/Mathf.Cos(Theta))))/Mathf.Sqrt(2);

What happens is quite weird though.

For example, with theta = 19, L = 196, h = 46 my code returns 80.54646 which seems to work if I input it to the car. However running the expression in WolframAlpha leads to 55.8 which is wrong.

It may seem that the code is correct but with theta = 35, L = 261, h = 39 my code returns NaN while WolframAlpha shows 52.17 which made the jump happen.

So, tu summarize, I have 2 different cases in which my result is different from WolframAlpha's one and none of them is the correct one both the times.

What's going on?

sentences:
Gamemaker: images appear blurred in application I'm making a practice game (generic space invaders clone) in Gamemaker Studio. However, there appears to be a problem with the images. While they look acceptable in Gamemaker Studio (not amazing, due to stretching effects, but acceptable for a practice project):

However, once I compile the project down to an application I get this blurring effect:

Can anyone tell me what's causing this, and how to turn it off?

sentences:
DX11 Reusing Command Lists My team is working on an engine implementation and we are trying to add multithreaded scene traversal for updating and rendering our components... The question has come up as to whether or not we can create command list for a subscene once and reuse it across multiple frames. Current code recreates the subscene command list for each frame but we would like to track renderables being added or removed from the subscene and only regenerate the command list as needed.

Google searches have revealed that it is OK to reuse the device context for a new cycle after FinishCommandList is called, but there is nothing definitive about reusing the the command list from frame to frame once it is created.

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:
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:
What does this shader error in Löve2D mean? What could I've done wrong to get the following error message when trying to create a GLSL shader in Löve2D?

I'm sincerely clueless of what the mistake could be, though I suspect the error being a compile-time error because it's happening during love.load, in which I require the shader from another file (and not during love.draw).

The full code can be found here.

sentences:
Get array from JSON in Libgdx? I wanted to load in map information using JSON, is there a way to get String, Int, float etc lists or arrays from JSON in Libgdx?

My structure looks like this

{
    "data": [{
        "name": "startmap",
        "actors": [{
            "name": "ryder"
        }]
    }]
}

And I want to get Actors as either a String List or Array, but there is no GetList or GetArray function. Is there any other way to do this?

sentences:
Web application interacts bi-directional with server program? I want to write a web application to play chess against the engine Crafty. I'm not new to PHP and javascript, but must learn how to interact with a server process : how can a web application and/or (jQuery) ajax interact bi-directionally with a (linux) program running on the server?

At this moment i am developing on (Apache) local host. Crafty is installed on my Ubuntu PC. This well-known chess engine has no GUI, it runs in terminal by the command

$ /usr/games/crafty

and so you can play chess against it and even see it's calculations. I can make Crafty run by PHP, using the functions proc_open() or exec(), and most documentation i found states that the output stream should be a file .. But i think i don't want such setup, because then the webpage should be constanty polling that file (eg. by ajax) to see if some new data was appended, right?

How can Crafty talk to the web page directly, saying "i have calculated another variation" or "i have decided a move" etc, then display this info on the web page and let the user give some counter move, just like in terminal. Isn't it possible to use some session / stream / listener?

I have no clue at all, can anybody point me in a right direction?

sentences:
How do I implement delta-only data packet updates in UDP? Edit: My current system is going to be to send constant player updates every 1/20th of a second, each containing the player's status and position. I will also send another packet (or as many needed) every 1/20th of a second with the information of all the bullets, using this format to save space (the number representing the space in a packet):

1: Owner's ID
1: Type
1: Amount of bullets (so I don't have to include this info each time)

3: X coord
3: Y coord

I am currently writing a co op game to play at LANs, and have run into the issue of dealing with many entities and game updates. I only have implemented player movement, and the packets sent include the player's position for 3 ticks (as packets are sent and received every 3 ticks).

I have also implemented a system to keep track of the delay between client and server (sending the tick the server/client is at and comparing it to with the receiver's local tick).

This has worked thus far, however I have run into trouble with sending bullet information. It would be unfeasible to send the position of the bullet every update, as I would only have room for ~160 bullets + players per packet.

I thought of just sending the information that a bullet has been created and enough information for the client to simulate the bullet flying, such as velocity, angle, lifetime, and owner, and sending information when the bullet has been destroyed (via impact, lifetime, or otherwise). This got me thinking if it is possible to only send the keystates of a client to other clients via the server, to reduce the space required for co-ordinates and to increase smoothness of movement(floats will be used in this case instead of the current ints, as I have found difficulty transmitting floats).

This raises the concern of packet loss, and that with it the game could easily go out of sync. I have read of sending acks, however I am unsure if this will give me the wanted result. I have also read about sending a full game state ever so often, and this seems to me to be the best solution. What should I do to fix the issue of space and to reduce the space required for transmitting movement? And if it's the full game state solution, how often should I resync the clients? 5 seconds? 10 seconds? How do other games do it? I have read that the steam engine almost never does this, however it has many systems set in place to prevent packet loss and resending lost packets and I feel that I am unable to code all that.

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:
XNA HLSL: Skinned Model Deforming Wrong I am creating a basic XNA recreation of Minecraft. My current problem is that my "Steve" model, which is skinned with an armature using vertex groups to deform, is showing up disfigured beyond all reason. I am using a custom shader with skinning imported from the SkinnedEffect from the StockEffects example. I'm sure the effect itself works fine and that my model's groups and weights are the problem. A link to another forum with the same question is here, since I cant post pictures or more than two links.

Here are some details about my model: The version of Blender I use is 2.6. Pay no attention to the corner-looking piece. That's just there for size comparison when I built him. I export to .fbx with only the mesh and armature selected. No options are selected other than "Export Selected" and "Apply Modifiers". Smoothing is off, Forward is -Z Forward and Up is Y Up. Again, I think the problem is the vertex groups and wights. Everything deforms properly in Blender, but not in XNA.

My Custom Shader:

//VertexShader
VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
        VertexShaderOutput output;
        Skin(input, NumBones);
        float4x4 worldViewProj = mul(mul(World, View), Projection);
        output.Position = mul(input.Position, worldViewProj);
        float4 normal = mul(input.Normal, WorldInverseTranspose);
        float lightIntensity = dot(normal, DiffuseLightDirection);
        output.Color = saturate(DiffuseColor * DiffuseIntensity * lightIntensity);
        output.Color.a = 1;
        output.TextureCoordinate = input.TextureCoordinate;
        return output;
}

//Skin() Method
void Skin(inout VertexShaderInput input, uniform int boneCount)
{
        float4x4 skinning = 0;
        [unroll]
        for (int i = 0; i < boneCount; i++)
        {
                skinning += Bones[input.Indices[i]] * input.Weights[i];
        }
        input.Position = mul(input.Position, skinning);
}

sentences:
How do you simulate UV light and materials with UV-reflective/fluorescent properties within a PBR renderer? I have a PBR setup, say, in Unity (or Unreal, doesn't really matter, I'm asking about the general principle, not specific implementation), and I would like to add a UV light source, and have control over how my materials respond to it, but still ideally have it conform to the rules of physically-based rendering.
Question is: what do I need to extend with what kinds of properties, and what are the equations to wire them together, and where do I plug those?
Do I need to actually do modifications like this, or does the fact that it already is PBR mean that I only need to plop in a light source with correct combination of settings, and correct responses to that UV source just naturally happen?
Edit:
I am asking about fluorescence, where I want certain materials to glow in particular visible light colours in places where the invisible UV light hits them.

sentences: Game Structure in depth I've been curious about game structure for some time now. Does everyone who is a game programmer come up with there own approach to structure there game, or is there like some sort of defined layout. to put this in prospective. Lets say a game programmer wanted to create a tiled map. Is there a specific way to do this, or does the every programmer do it there way.

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: How can I find the reflection of a point in a perpendicular line? From the image below I know the positions A and B. How can I find positions C and D and the reflection (Er) of an object E in the line CD? I saw the solution in How can I reflect a point about a line in Unity? but I don't understand it enough to apply it in my case. Please note that I'm trying to achieve this in 2D.

sentences:
delta_time with discrete movement I have a basic snake game movement system with Pygame:
clock = pygame.time.Clock()
if timer == MOVE_TICK_INTERVAL:
    timer = 0
    move_snake()

timer += 1
clock.tick(MAX_FPS)

The issue is that the higher MAX_FPS is, the faster timer iterates and thus the faster the snake moves. I'm aware of using some form of delta_time variable to calibrate and adjust the velocity of an object moving continuously but I don't know how to implement this method with discrete, grid-based movement.
In short,
I want to move my snake the same amount of units in a direction every interval with frame rate considered but I don't want to modify said distance.

sentences:
How to remove a box2d body when collision happens? I’m still new to java and android programming and I am having so much trouble Removing an object when collision happens.
I looked around the web and found that I should never handle removing BOX2D bodies during collision detection (a contact listener) and I should add my objects to an arraylist and set a variable in the User Data section of the body to delete or not and handle the removing action in an update handler.
So I did this:
First I define two ArrayLists one for the faces and one for the bodies:

ArrayList<Sprite> myFaces = new ArrayList<Sprite>();
ArrayList<Body> myBodies = new ArrayList<Body>();

Then when I create a face and connect that face to its body I add them to their ArrayLists like this:

face = new AnimatedSprite(pX, pY, pWidth, pHeight, this.mBoxFaceTextureRegion);
Body BoxBody = PhysicsFactory.createBoxBody(mPhysicsWorld, face, BodyType.DynamicBody, objectFixtureDef);
mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(face, BoxBody, true, true));

myFaces.add(face);
myBodies.add(BoxBody);

now I add a contact listener and an update handler in the onloadscene like this:

this.mPhysicsWorld.setContactListener(new ContactListener() {
private AnimatedSprite face2;
@Override
public void beginContact(final Contact pContact) {
}
@Override
public void endContact(final Contact pContact) {
}
@Override
public void preSolve(Contact contact,Manifold oldManifold) {

}
@Override
public void postSolve(Contact contact,ContactImpulse impulse) {
}
});

scene.registerUpdateHandler(new IUpdateHandler() {

@Override
public void reset() { }

@Override
public void onUpdate(final float pSecondsElapsed) {

}
});

My plan is to detect which two bodies collided in the contact listener by checking a variable from the user data section of the body, get their numbers in the array list and finally use the update handler to remove these bodies.

The questions are:
Am I using the arraylist correctly?
How to add a variable to the User Data (the code please).
I tried removing a body in this update handler but it still throws me NullPointerException , so what is the right way to add an update handler and where should I add it.
Any other advices to do this would be great.
Thanks in advance.

sentences:
Game loop architecture using WPF(MVVM) and C# Could i get some suggestions on how to implement a game loop whilst using WPF(MVVM) and C#, I am a professional developer and understand the technology well.

The game loop usually contains a Init(), Render() and Update().

I know how to implement the Init() and Update(), but i would like ideas of how the render() fits in, using data binding the Render will happen on update(). Should forget the Render method or suppress the bindings and force them with a render?

Hope that makes sense :)

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:
Simultaneous AI in turn based games I want to hack together a roguelike. Now I thought about entity and world representation and got to a quite big problem.

If you want all the AI to act simultaneously you would normally(in cellular automa for examble) just copy the cell buffer and let all action of indiviual cells depend on the copy. Actions which are not valid anymore after some cell before the cell you are currently operating on changed the original enviourment(blocking the path) are just ignored or reapplied with the "current"(between turns) environment. After all cells have acted you copy the current map to the buffer again.

Now for an environment with complex AI and big(datawise) entities the copying would take too long. So I thought you could put every action and entity makes into a que(make no changes to the environment) and execute the whole que after everyone took their move.
Every interaction on this que are realy interacting entities, so if a entity tries to attack another entity it sends a message to it, the consequences of the attack would be visible next turn, either by just examining the entity or asking the entity for data. This would remove problems like what happens if an entity dies middle in the cue but got actions or is messaged later on(all messages would go to null, and the messages from the entity would either just be sent or deleted(haven't decided yet)

But what would happen if a monster spawns a fireball which by itself tracks the player(in the same turn). Should I add the fireball to the enviourment beforehand, so make a change to the environment before executing the action list or just add the ball to the "need updated" list as a special case so it doesn't exist in the environment and still operates on it, spawing after evaluating the action list?

Are there any solutions or papers on this subject which I can take a look at?

EDIT: I don't need information on writing a roguelike I need information on turn based ai in respective to a complex enviourment.

sentences: How to select a sprite with the mouse in c# XNA? I'm attempting to create a chess game, for the movement I need to be able to click on a piece with the mouse, and then the square I'd like to move it to. Each piece on the board is a sprite, and I'm struggling to find a way to select a sprite in order to then move it, what would be the best way to do this? I'm programming in c# with XNA framework btw. Thanks in advance :)

sentences:
Why does the order of Farseer collision categories affect collisions? I've discovered a bizarre issue with the Farseer Physics Engine that I can't figure out. I have two Farseer bodies that I'd like to only collide with each other. To that end, I have the following code.

body1.CollisionCategories = Category.Cat1;
body1.CollidesWith = Category.Cat2;

body2.CollisionCategories = Category.Cat2;
body2.CollidesWith = Category.Cat1;

Which works fine. However, if I switch the categories around (shown below), the bodies no longer collide.

body1.CollisionCategories = Category.Cat2;
body1.CollidesWith = Category.Cat1;

body2.CollisionCategories = Category.Cat1;
body2.CollidesWith = Category.Cat2;

Some additional notes that might be relevant:

body1 is static, while body2 is dynamic.
body1 is created before body2 (although I switched the order and nothing changed).

Does anyone know why this happens? Based on my understanding of how Farseer uses collision categories (i.e. as masks using bitwise operations), the order shouldn't matter. Is it something silly I'm missing?

Thank you.

sentences:
Scrolling with SDL2 & Box2d - My Camera isn't keeping up with my player I'm trying to get a game on the google play store before I'm 40 (long held dream to publish a game since the days of the speccy), I have just over a month to go so it's not looking good! Foolishly I decided to use SDL2 and Box2d to write the game, both technologies I have little experience in & to compound my misery I'm a noob at C++ so please bear with me if I've made a common error.

Basically I've managed to get a simple physics simulation up and running and have sorted applying my SDL textures to the box2d collision boxes, that all seems to be fine and dandy, where I've come a cropper is my player moves along a ground entity on the X axis,

I've managed to implement a scrolling background but it doesn't keep pace with the player, in which I mean the player moves across the screen instead of remaining central as I'd like him to and the background scrolls behind him. I've probably completely mis-interpreted how to manage my requirements and after days of searching for reference code I'm now at a bit of a loss.

Hopefully some kind soul can help me realise my dream! I've posted what code I think is relevant but if theres something missing I'll add it.

Player movements

// Get the position and angle of the player
playerPos = player.pl_body->GetPosition();
playerDeg = player.pl_body->GetAngle();
playerVel = player.pl_body->GetLinearVelocity();

float velChange = desiredVel - playerVel.x;
float impulse = player.pl_body->GetMass() * velChange; //disregard time factor
player.pl_body->ApplyLinearImpulse( b2Vec2(impulse,0), player.pl_body->GetWorldCenter(), true );

SDL2 rendering

//Render current frame using clips
SDL_Rect* playerCurrentClip = &playerClips[ plAnimFrame / 2 ];

// Render player texture to x & Y of player entity
gPlayerTexture.render (playerPos.x - player.PLAYER_WIDTH/2, playerPos.y - player.PLAYER_WIDTH/2, playerCurrentClip, playerDeg, NULL, flipType);

Camera setup

// Setup a surface for the camera area
SDL_Rect camera = {0, 0, SCREEN_WIDTH, SCREEN_HEIGHT};
// Render background texture
gBackgroundTexture.render (0, 0, &camera, NULL, NULL, flipType);

Camera scrolling

//Center the camera over the player
camera.x = (playerPos.x + player.PLAYER_WIDTH / 2 ) - SCREEN_WIDTH / 2;

 //Keep the camera in bounds
 if( camera.x < 0 )
 {
     camera.x = 0;
 }
 if( camera.x > LEVEL_WIDTH - camera.w )
 {
     camera.x = LEVEL_WIDTH - camera.w;
 }

sentences:
Slick2d fullscreen with black bars NOTE: I am moving this question here from Stack Overflow because I feel it belongs better on this forum. I am deleting the original question from Stack Overflow.

I'm working on a game in Slick2D and I want to have some versatility with the resolutions I can use for fullscreen. Is there a way to make the game's fullscreen add black bars around the game instead of stretching the game to whatever resolution the graphics card can support for fullscreen? I'm not terribly familiar with openGL so if the only way to fix that requires openGL, I would appreciate some detailed explanation on how to implement the code. Currently I'm using the

arg0.setDisplayMode(X_resolution, Y_resolution, true); //arg0 is my AppGameContainer

method. But it means I have to stretch my game to one of the compatible resolutions.

sentences: InputProcessor without stage I have a GameScreen where I'd like to have a pause button. I've tried using an Image with a listener, but since my GameScreen isn't a stage, I can't use that in the inputProcessor. So my question is how should one create a clickable button outside a stage class?

sentences:
Making sprite rotate smoothly I have a sprite that I want to rotate smoothly and face the opposite direction:

This is my render function:

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)){
        bug.rotate(rotDeg);
        turn = !turn;
    }
    else if(bug.getX() <= 0 && bug.getY() <= 0){
        bug.rotate(rotDeg);
        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.draw(spriteBatch);
    spriteBatch.end();
}

What my code does is that when it reaches the destination (top right corner, or bottom left corner), it immediatly turns facing the opposite direction. How would I make this turn smoothly?

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 create Button/Switch-Like Tile where you can step on it and change its value? If the player steps on a Button-Tile when its true, it becomes false. If the player steps on a Button-Tile when it is false, it becomes true.

The problem is, when the player stands on (intersects) the Button-Tile, it will keep updating the condition. So, from true, it becomes false. Because its false and the player intersects it, it becomes true again. True-false-true-false and so on.

I use ElapsedGameTime to make the updating process slower, and the player can have a chance to change the Button to true or false.

However, it's not the solution I was looking for. Is there any other way to make it keep in False/True condition while the Player is standing on the Button tile?

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:
LibGDX: Scrollpane won't scroll to bottom after adding children to contained table To my game I want to add a gui element that displays text and textButtons whenever something is happening or it wants you to make a decission (an answer while talking to a person for example). To keep track of your actions you shall be able to scroll it. Similar to text adverntures or dialog boxes in rpgs.

I use Scene2Dui for my GUI, so I put a scrollPane in my GUIs root table. I have methods for adding stuff to the contained table and tell the scrollPane to scroll to the bottom.

In general the idea works, but the thing doesn't scroll to the bottom but only to the bottom of the element I added before the current one. I'm puzzled.

Here's the code, leaving out the skins and styles part:

public class TextBox {

ScrollPane box;
Table table;
Label.LabelStyle lStyle;
Skin skin;

TextBox() {

    table.setFillParent(false);

    box = new ScrollPane(table, scrollStyle);

    box.setScrollingDisabled(true, false);
    box.setOverscroll(false, false);
    box.setFillParent(false);

    table.align(Align.topLeft);
    table.row();
}

void writeDecissions(GameEvent[] events) {

    Table tableD = new Table();
    tableD.setFillParent(false);

    if (events != null) {

        for (int i = 1; i < events.length; i++) {

            if (events[i] != null) {

                String s = Character.forDigit(i, 10) + " - "
                        + events[i].getDecision();

                TextButton button = new TextButton(s, style);
                button.getLabel().setWrap(true);
                button.getLabel().setAlignment(Align.left);

                tableD.add(button).width(box.getWidth() - 40).spaceBottom(20).spaceTop(20);

                tableD.row();

            }
        }
    }

    table.add(tableD).align(Align.left).pad(20);
    table.row();

    box.setScrollY(table.getHeight());
}

This is the way I test it:

public void render(float delta) {
    Gdx.gl.glClearColor(0, 0, 0, 0);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    stage.act();
    stage.draw();

    if (Gdx.input.justTouched()) {
        gui.textBox.writeDecissions(events);
    }

I tried box.setScrollY(box.getMaxY) as well as setting overscroll to true (don't really know what that is tough). With the same result.

Finally a screenshot:

Help appreciated.

sentences: 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: How to make platforms spawn without touching other platforms So I am making a doodle jump like game where there are platforms scrolling by but right now how I have platforms spawning is completely random. I would like the platforms to be spread apart so they weren't touching but don't have much of an idea to implement it. I was thinking of using the distance formula to check to make sure that they were apart but I was thinking that as I was creating those object I would have to check with all the previous objects before to see if they weren't colliding. Does anyone have any ideas on how to make this work efficiently?

sentences:
Designing for multiple screen resolutions and aspect ratios, target one resolution then scale to meet others or use normalized values? I feel like what I'm currently doing is stupid but would just like reaffirmation it is. Basically I'm writing games which target a certain screen resolution (800x480), so all positions, widths and heights I set for sprites is for that resolution.

On the engine side I have special scalers which will change the width and height of what is being drawn to meet the current platforms res, so for example if the platforms screen res is 1200x720 I will stretch a sprite by a factor of:

1280 / 800.0f;
720 / 480.0f;

Positions are also offset and manipulated in a similar way.

I really feel I should move to a normalized system for widths and positions (i.e. 0 to 1) but at the same time feel this is more intuitive since the first platform I target is 800x480 and I already kind of have a good udnerstanding of dimensions and such for that.

So my question is, is it really that bad to target a specific ccreen res then in the engine side modify this res to meet different platforms?

sentences:
Using random numbers with a bias I appear to be awful at describing the question so I'll try and describe the problem.

I want to add a random amount of heads to my creatures but I want to be able to determine several things.
a) The minimum number of possible heads
b) The maximum number of possible heads
c) The probability of the number being high/low within the above values.

So i could add heads like so:
addHeads(5, 10, 0.5); // should produce creatures with "around" 7.5 heads but they could have anywhere from 5 to 10.

So random number generation isn't the problem, but controlling and actually using them in a game is. :D

sentences:
Rotation grid positions I'm dealing with objects on 15x15 chunks in my game.
I'd like the chunks to rotate, for example, rotation version 0 is the original position of 2,5;
(EDIT: Oops, rotation 2 and 3 names need switching in the image)

How can I get the other positions in the simplest and quickest way? It only needs to rotate in 90 degrees increments, having 4 version (so 0, 90, 180, 270)

sentences:
TextField Add in Editor does not display when put under if statement I've been trying to make a custom editor window in Unity and I needed to make an "add TextField" button. When I add a TextField directly (without requiring a button), it works. When I put it under if(GUI.Button()) it does not show up.
Here's my code:
private static List<string> s = new List<string>();
private void OnGUI()
{

    if (GUI.Button("+");)
    {
        s.Add(GUI.TextField(new Rect(0,50,Screen.width,20),"field"));
    }
}

sentences:
Making AI follow player in pacman game with grid I have an AI that I want to navigate a maze in order to follow the player. I thought of creating a large grid with the help of FloatRects, so I do it like this:

private List<FloatRect> grid;
//...
for(int y = 0; y < screenHeight; y += 16)
{
    for(int x = 0; x < screenWidth; x += 16)
    {
        grid.Add(new FloatRect(x, y, 16, 16));
    }
}

making each rectangle 16x16. Now I want to make the AI find the path that crosses the least amount of rectangles in order to cross the player, while avoiding walls. How do I approach this?

sentences: Multiple Colliders in Collision I have an object that has a front collider, left collider and right collider.  When a collision occurs, I notice that there are situations where the front collider and left collider/right collider has collided with the object. I need to somehow figure out which collider made contact "first".  Is there anyway to do this?  The reason I need this is because I have different code that needs to run depending on which collider made contact first.

sentences:
Unity3D Automatic Mipmap I'm using Unity3D. I'm working advanced topics. For example Mipmap.

How I can automatic mipmap (use camera distance) for textures?

Thank you.

sentences:
Unity 2109.3.4 apk fails to install on to quest Hello's I was able to successfully sideload APK's on to the quest for a while now however when I updated to unity 2019.3.4 side quest is now unable to successfully load a built APK onto the oculus quest.
Here is the error I receive,  INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113
I have tried numerous things and am a bit stuck. Any help is appreciated
List of attempts :
Tried with SDK included in unity
Tried custom android studio location
Tried switching from MONO backend and enabling Arm 64
Tried lowering min to the lowest API level
Tried updating all SDK tools in android studio
Tried custom ndk, unable to get one unity is happy with
Tried clearing cache and uninstalling prev install

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:
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:
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:
Why can't I change the size of my spheres in Unity? I started to learn Unity. Now I make something like a solar system. I have one problem. What are the min and max sizes of the sphere? E.g. I have a radius of the Sun - 1.5 but it shows like the Sun has radius 1, I can't make bigger. But also I have the Earth with 0.01 size and the Moon with 0.009. But I can't make the Mercury with 0.03 radius.
So why when I'm creating a new sphere now I have only radius 1 and can't change it in Scene window?

sentences:
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: Why does Unity let you install iOS Build Support on Windows? When installing Unity on a Windows machine, you are allowed to select "iOS Build Support" as one of the components to install. However, it is not possible to make an iOS build from Windows. Why is this package available on Windows? What does it offer?

sentences:
How do I scale down pixel art? There are plenty of algorithms to scale up pixel art. (I prefer hqx, personally.) But are there any notable algorithms to scale it down? My game is designed to run at a resolution of 1280x720, but if it is played at a lower resolution I still want it to look good.

Most pixel art discussions center around 320x200 or 640x480 and upscaling for use in console emulators, but I wonder how modern 2D games like the Monkey Island Remake could look good on lower resolutions?

Of course ignoring the option of having multiple versions of assets (i.e. mipmapping).

sentences:
Mathematics help. Preliminary grid checking assistance. (Supercover Z) Problem outline: A ray passes through a gridcell. The gridcell's max z's must be compared to the ray segment's min z. This is the preliminary check, so it must be quick.
2 values must be obtained, the 2 points on the ray segment which are directly outside of the grid.
To determine the z values, the distance of the ray from these 2 points must be obtained.
The red shows the points (and distance) of the ray of z values that must be checked as max and min.

The sloppy solution
Instead of getting the points directly touching, calculate the hypotenuse and offset it doing various calculations. I tried this way and there are a lot of operations to be done. I am not sure if this is the best way.
(cant upload more than 3 pics)

The sloppiest (and possibly best) solution
The best sloppy solution would be to create a line offset by the hypotenuse, and have it congruent to the main line then use line_line_collision to determine the distance for point 1 then subtract that distance by hypotenuse*2 for point 2.

The streamlined solution
The best way would have the z's directly retrieved as part of the actual supercover algorithm.
Unfortunately retrieving the n values or error values in tandem with n values couldn't actually yield me the intersection points of the line and grid. My brain is utterly fried at the moment.
My code is here, possibly someone can find an inherent method to retrieve the intersection points of the line and grid.

iX=0 iY=0 s=16 res=8
repeat (res*res)
{
draw_rectangle(iX*s,iY*s,(iX+1)*s,(iY+1)*s,1)
iX+=1;
if iX>res-1
    {iY+=1; iX=0}
}
if mouse_check_button(mb_left) direction+=5

xfrom=mouse_x/s yfrom=mouse_y/s l=300

vecx=lengthdir_x(l,direction)/s vecy=lengthdir_y(l,direction)/s
direction=point_direction(0,0,vecx,vecy)
xto=xfrom+vecx yto=yfrom+vecy

draw_line(xfrom*s,yfrom*s,xto*s,yto*s)
x0=xfrom y0=yfrom x1=xto y1=yto it=0

{
    dx = abs(x1 - x0);
    dy = abs(y1 - y0);

    x = floor(x0);
    y = floor(y0);

    n = 1;
    var x_inc, y_inc;
    error=0;

    if (dx == 0)
    {
        x_inc = 0;
        error = 1000000;
    }
    else if (x1 > x0)
    {
        x_inc = 1
        n += (floor(x1)) - x;
        error = (floor(x0) + 1 - x0) * dy;
    }
    else
    {
        x_inc = -1
        n += x - (floor(x1));
        error = (x0 - floor(x0)) * dy;
    }

    if (dy == 0)
    {
        y_inc = 0;
        error -= 1000000;
    }
    else if (y1 > y0)
    {
        y_inc = 1
        n += (floor(y1)) - y;
        error -= (floor(y0) + 1 - y0) * dx;
    }
    else
    {
        y_inc = -1
        n += y - (floor(y1));
        error -= (y0 - floor(y0)) * dx;
    }
mn=n
    for (n=n; n > 0; n-=1)
    {

   draw_set_color(merge_color(c_red,c_white,it))
   draw_rectangle(x*s, y*s,x*s+s,y*s+s,1)
        it+=1
        draw_set_color(c_green)
        draw_circle((xfrom+lengthdir_x(it+.5,direction))*s,(yfrom+lengthdir_y(it+.5,direction))*s,2,0)draw_set_color(c_red)
        draw_circle((xfrom+lengthdir_x(it-.5,direction))*s,(yfrom+lengthdir_y(it-.5,direction))*s,2,0)
draw_set_color(c_black)
        if (error > 0)
        {
            y += y_inc;
            error -= dx;
        }
        else
        {
            x += x_inc;
            error += dy;
        }
    }
}

There are some other stuff I would like to know...such as 3d triangle/line collisions, but I don't want to boggle the thread down with too much information at the moment...

sentences:
How can I use websockets in a Unity WebGL project? There are plenty of good Websocket APIs for C#, but I run into trouble when targeting Unity WebGL due to this restriction described in the Unity documentation:

  No direct socket access

  Due to security implications, JavaScript code does not have direct access to IP Sockets to implement network connectivity. As a result, the .NET networking
   classes (ie, everything in the System.Net namespace, particularly System.Net.Sockets) are non-functional in WebGL. The same applies to Unity’s old UnityEngine.Network* classes, which are not available when building for WebGL.

  If you need to use Networking in WebGL, you currently have the options to use the WWW or UnityWebRequest classes in Unity or the new Unity Networking features which support WebGL, or to implement your own networking using WebSockets or WebRTC in JavaScript.

How can I work around this restriction for networking in my Unity WebGL game?

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:
Is any data structure more efficient than quad-tree for storing and querying points that lay within an OBB? Is there any method more effective than quad-trees for storing and searching sets of points that are not spread uniformly on the plane?

I need to be able to add, remove and search for points that are within a specified range.

I am currently testing with quad-tree but it seems the results are less than optimal when the points are not spread uniformly enough.

The points are mostly clustered in specific areas:

sentences:
Bounding Box in Monogame for mouse picking Hello guys so I'm implementing this mouse manager to be able to pick up objects.

My application uses mainly textured quads in 3d space.
I'm using bounding boxes in monogame to do so, however my solution lacks accuracy.

Right now what I have is this:
http://imgur.com/oySTCay

you can clearly see what the problem is, so this solution is probably not the best.

this is my method to calculate the bounding box:

        public BoundingBox GetBoundingBox()
    {
        Matrix transform = Node.GetTransformForBoundingBox();

        vertices[0] = Vector3.Transform(new Vector3(0, 0, 0), transform);
        vertices[1] = Vector3.Transform(new Vector3(Texture.Width * m_fTexturescale, 0, 0), transform);
        vertices[2] = Vector3.Transform(new Vector3(0, (Texture.Height * m_fTexturescale) * -1, 0), transform);
        vertices[3] = Vector3.Transform(new Vector3(Texture.Width * m_fTexturescale, (Texture.Height * m_fTexturescale) * -1, 0), transform);

        return BoundingBox.CreateFromPoints(vertices);
    }

And the mouse picking part is the standard ray tracing into near/far clipping planes with unproject.

So I was thinking, maybe if I do the other way around, and instead of un-projecting the mouse, i could project all the vertices and do some kind of polygon math to check if the mouse position is inside the polygon formed from the projected vertices, (occluded vertices are worrying me though).

Do you think is feasible, or is there any other option, should i just go for OBB?

Thanks alot,

Roger Martins

EDIT:

So after searching a bit for OBB's i found that CartBlanche had one implementation on his samples repo

this:
https://github.com/CartBlanche/MonoGame-Samples/blob/master/CollisionSample/BoundingOrientedBox.cs

so I just used it and it works pretty well, now i just have one bug that i cant figure out, one transformation must be wrong.¨

result : http://imgur.com/QOsIbj7

what i'm doing:
so now I have a box parameter in this class, nullable one.

how I build the bounding box :

  public SOrientedBoundingBox GetBoundingBox()
    {
        //create the initial bounding box
        if (obb == null)
        {
            //calculate the vertices for the textured quad in model space at the origin (inferior left corner is origin because we invert the y to conpensate for the perspective projection)
            vertices[0] = new Vector3(0, 0, 0);
            vertices[1] = new Vector3(Texture.Width * m_fTexturescale, 0, 0);
            vertices[2] = new Vector3(0, (Texture.Height * m_fTexturescale) * -1, 0);
            vertices[3] = new Vector3(Texture.Width * m_fTexturescale, (Texture.Height * m_fTexturescale) * -1, 0);
            //get bounding box and trasnform it to orientedboundingbox
            //TODO : remove the middle step
            BoundingBox box = BoundingBox.CreateFromPoints(vertices);
            obb = SOrientedBoundingBox.CreateFromBoundingBox(box);
            return obb.Value;
        }
        else
        {
            return obb.Value.Transform(Node.GetQuaternion(), new Vector3(Node.AbsolutePosition.X, Node.AbsolutePosition.Y * -1, Node.AbsolutePosition.Z)*Node.Scale);
        }

    }

I'm going to fiddle a bit more with it, but the problem is something minor, i think. But maybe one of you can detect something silly i did.

Thanks, Roger.

sentences: Whats the point of all these Surface Formats I am relevantly new to Graphics Programming. I have written some basic games in xna in the past but I am trying to understand what the point of all these surface formats is. For instance Xna and DDS support the standard RGBA (8bpp). Why does one need 32 bpp or even stranger combinations of bits per channel like Rg32. Isn't it enough to have the standard DXn, RGBA, and HDR formats?

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:
C++ GameState management I have been attempting to make a game engine in C++ and have come across the dilemma of game state management. I have done a lot of research and found numerous ways of accomplishing from game engine with derived classes to using enums and I would like to know the most effective/efficient way of managing game states.

EDIT
I would like to know how other people implement their game state management, i.e. what you like the most and why you like it. Also, any tutorials/code examples that are generally about game state would also be much appreciated.

sentences:
What does everyone like to use for UI elements for their games on the iPhone? I'm asking this to get everyone's opinion -- I realize there isn't one "right way" to do this.  I've tried a few ways myself, including using Cocoa for everything including the game itself (good for simpler games, like card games for example), using Cocoa for the screens outside of the game and using my game engine to present game objects on the screen as UI.

What do people prefer to use for game UI?  I'm particularly interested in hearing about why you chose to go that way and if you found that your choice was a good one after implementing it.

sentences:
How to Color.Lerp between multiple colors? I have found it rather difficult to find a solution to this in the Unity documents.

Color.Lerp(Color a, Color b, float t) is a function that gradually changes a color according to a step t, giving it the final value of the Color b.

How do I Lerp between multiple colors one after another?

sentences:
How to generate a multiplier map for radiosity I am following this tutorial: here
I am at the part where you are creating a hemicube.
I have got the code to render the scene into a texture and therfore an array.

Now how can I generate a so-called "multiplier map" for use given these
parameters: width, height, camera location, camera direction/normal.

I want the multiplier map to be stored in an array like this:

unsigned char* mult0 = new unsigned char[width*height];

I will have 5 of these maps for each side of the hemicube.

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:
Need efficient way to keep enemy from getting hit multiple times by same source My game's a simple 2D one, but this probably applies to many types of scenarios.

Suppose my player has a sword, or a gun that shoots a projectile that can pass through and hit multiple enemies.

While the sword is swinging, there is a duration where I am checking for the sword making contact with any enemy on every frame.  But once an enemy is hit by that sword, I don't want him to continue getting hit over and over as the sword follows through. (I do want the sword to continue checking whether it is hitting other enemies.)

I've thought of a couple different approaches (below), but they don't seem like good ones to me. I'm looking for a way that doesn't force cross-referencing (I don't want the enemy to have to send a message back to the sword/projectile). And I'd like to avoid generating/resetting multiple array lists with every attack.

Each time the sword swings it generates a unique id (maybe by just incrementing a global static long). Every enemy keeps a list of id's of swipes or projectiles that have already hit them, so the enemy knows not to get hurt by something multiple times. Downside is that every enemy may have a big list to compare to. So projectiles and sword swipes would have to broadcast their end-of-life to all enemies and cause a search and remove on every enemy's array list. Seems kind of slow.
Each sword swipe or projectile keeps its own list of enemies that it has already hit so it knows not to apply damage. Downsides: Have to generate a new list (probably pull from a pool and clear one) every time a sword is swung or a projectile shot. Also, this breaks down modularity, because now the sword has to send a message to the enemy, and the enemy has to send a message back to the sword. Seems to me that two-way streets like this are a great way to create very difficult-to-find bugs.

sentences:
Starter love2d physics program not working I am starting out with my first love2d (using LöVE 0.8) physics program. I am just creating some ground/floor, a car body and attaching two wheels with revolute joints and setting the motors a-go.

However, the car stands still, whereas I expect it to move. Can someone glance over the code below and see what I am doing wrong?

UPDATE See below!

function love.load()

  -- Set up world
  love.physics.setMeter(50)
  world = love.physics.newWorld(0, 9.81*50, true)

  -- Window dimensions
  windim = {height = love.graphics.getHeight(), width = love.graphics.getWidth()}

  objects = {}

  -- Ground/Floor
  objects.ground = {}
  objects.ground.body = love.physics.newBody(world, 300, windim.height)
  objects.ground.shape = love.physics.newRectangleShape(2000,20)
  objects.ground.fixture = love.physics.newFixture(objects.ground.body, objects.ground.shape)
  objects.ground.fixture:setFriction(3)

  -- Body of the car; a rectangle
  objects.carbody = {}
  objects.carbody.body = love.physics.newBody(world, 300, 500, "dynamic")
  objects.carbody.shape = love.physics.newRectangleShape(100,40)
  objects.carbody.fixture = love.physics.newFixture(objects.carbody.body, objects.carbody.shape)
  objects.carbody.fixture:setFriction(3)
  objects.carbody.fixture:setDensity(3)
  objects.carbody.fixture:setRestitution(0)

  -- First wheel
  objects.wheel = {}
  objects.wheel.body = love.physics.newBody(world, 330, 520, "dynamic")
  objects.wheel.shape = love.physics.newCircleShape(20)
  objects.wheel.fixture = love.physics.newFixture(objects.wheel.body, objects.wheel.shape)
  objects.wheel.fixture:setFriction(3)
  objects.wheel.fixture:setDensity(3)
  objects.wheel.fixture:setRestitution(0.6)

  -- Second wheel
  objects.wheel2 = {}
  objects.wheel2.body = love.physics.newBody(world, 270, 520, "dynamic")
  objects.wheel2.shape = love.physics.newCircleShape(20)
  objects.wheel2.fixture = love.physics.newFixture(objects.wheel2.body, objects.wheel2.shape)
  objects.wheel2.fixture:setFriction(3)
  objects.wheel2.fixture:setDensity(3)
  objects.wheel2.fixture:setRestitution(0.6)

  -- Create joint between car body and first wheel
  objects.carbody.wheeljoint1 = love.physics.newRevoluteJoint(objects.carbody.body, objects.wheel.body, 330, 520)
  objects.carbody.wheeljoint1:enableMotor()
  objects.carbody.wheeljoint1:setMaxMotorTorque(10000) -- Following example from http://www.emanueleferonato.com/2011/08/22/step-by-step-creation-of-a-box2d-cartruck-with-motors-and-shocks/

  -- Create joint between car body and second wheel
  objects.carbody.wheeljoint2 = love.physics.newRevoluteJoint(objects.carbody.body, objects.wheel2.body, 270, 520)
  objects.carbody.wheeljoint2:enableMotor()
  objects.carbody.wheeljoint2:setMaxMotorTorque(10000)

end

function love.update(dt)
  -- Set contstant speed for the wheels
  objects.carbody.wheeljoint1:setMotorSpeed(20)
  objects.carbody.wheeljoint2:setMotorSpeed(20)

  world:update(dt)

end

function love.draw()
  love.graphics.print(objects.carbody.wheeljoint1:getMotorSpeed(), 10, 10)

  -- Render ground
  love.graphics.setColor(72, 160, 14)
  love.graphics.polygon("fill", objects.ground.body:getWorldPoints(objects.ground.shape:getPoints()))

  -- Render car body
  love.graphics.setColor(72, 160, 200)
  love.graphics.polygon("fill", objects.carbody.body:getWorldPoints(objects.carbody.shape:getPoints()))

  -- Render wheels
  love.graphics.setColor(193, 47, 14)
  love.graphics.circle("line", objects.wheel.body:getX(), objects.wheel.body:getY(), objects.wheel.shape:getRadius())
  love.graphics.circle("line", objects.wheel2.body:getX(), objects.wheel2.body:getY(), objects.wheel2.shape:getRadius())
end

UPDATE
I added a line to print the angle of one of the wheels (see below). When this line is present, suddenly the car flips over from the wheels spinning when it hits the ground. This leads me to believe that something did not get initialized properly first time around.

This is the line added:

function love.draw()
  love.graphics.print(objects.wheel.body:getAngle(), 10, 10) -- Line added

sentences:
Unity Behavior Designer get gameobject I am trying to create my own action in Behavior Designer. However i cannot seem to get the game object that designer is attached to. if i attempt to do:

protected Combatant enemyCombatantObject;

public override void OnAwake()
{
    enemyCombatantObject = GameObject.GetComponent<Combatant>();
    base.OnAwake();
}

It gives me an error:

  the property or indexer 'Task.GameObject' cannot be used in this
  context because it lacks the get accessor

Can anyone tell me how to get the GameObject that the script is attached to?

sentences:
How to get collision area within a circle in libgdx I have a ball inside of a multi-colored circle, the ball will hit the inner area of the circle like this bellow circle image

And the Circle will be rotated clockwise or anti-clockwise based on user input.
How would I know, where the ball hit the Big Colored circle.

I just need to identify in which color of my circle sprite has made a collision with the ball.

I have tried a lot, googled a lot but still, the solution has not been found yet.

Experts, please help me.

sentences:
Term for coordinating design elements to produce larger possibility spaces? The concept is when content elements work together in such a way to produce more possibilities, playable content, or engagement than the relative amount of added content.

Mathematically:

A content gives you x units of gameplay

B content gives you y units of gameplay

(units of gameplay are however you'd like to measure them, hours of play, total items, actions/discussion branches, etc.)

A = x
B = y
A + B = x*y*?

So that when the game includes both:

A + B

The gameplay unit increase could be:

x * y
(x + y) * c
x ^ y

This concept of expressing it mathematically leads me to want to call this Content Multiplication. But I haven't been able to find much on a specific term for this (most of my attempts have lead me to math games).

Example:

In a game like Minecraft, there's a mechanics and dynamics that define crafting.  By themselves they produce a set of craftable items. Once a player crafts them there's less or no desire/need to craft them again.

Then a relatively small mechanic is added that causes loss, perhaps on death or through durability. The impact on player motivation and time played is much larger. Forcing players to either recraft items, or to craft extras preemptively.  No new items have to be added to the crafting system, and having players lose items isn't a big change (not a lot of work).

Specifically if we look at just these two mechanics, and the expected impact they have together.  Perhaps we're talking about Minecraft 0.1, and only crafting exists, and a decision needs to be made on what next feature to add, that provides us with the most benefit in gameplay content for development effort.

Conclusion

Is there a term to describe the intentional design of coordinated mechanics and system to produce larger sets of content with minimal effort?

Edit: Emergence

Emergence typically refers to unforeseen and unintended results rising from a rise in complexity. Emergent results are frequently hard to quantify, or to ascribe cause to specific elements.

What I'm looking for is an explicit, deliberate, and predictable outcome from the addition of a single element to an existing system.

Contrasting Example:

An example of emergence can be found in the original Deus Ex. Being able to place mines on walls and jump off of them. This effect was (likely) unintended, caused by the interaction of complex systems, and in cases where it could be used to skip content, actually reduced the amount of gameplay. Emergent Gameplay

While designing for emergence can be intended, the outcome is less certain or planned.

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:
Scaling a UI bar for progress in Unity I have created a progress bar inside Unity for one of my energy systems. The bar progression works fine. Its just a plane pivoted on one of the faces so scaling it in x axis makes it progress further as seen in the image below
Now I am trying to implement a feature where when the bar stops progressing I would want to show a red bar indicating that it has stopped like in the image below

To implement this I would need to know somehow that the bar has stopped scaling and not progressing any further so that I can put the red bar at the position where it stops scaling.

But how do I know when the yellow progress bar stops progressing as its position stays the same throughout and its just scaling in the x direction.

I hope my question makes sense. Please help me out if it does. Thanks :)

sentences:
Move relative to screen I use top down 60 degree tilted camera and want move always visually straight directions relative to screen (up, down, left, right). When object is near screen edges it starts moving diagonally (visually) probably because of camera tilt.

I tried with WorldToViewportPoint / ViewportPointToRay but it doesnt work exactly because even when there is no input, conversion to viewport and back to world same value sometimes gives slighltly offset from start position.

float delta = Time.deltaTime;

float h = Input.GetAxisRaw("Horizontal");
float v = Input.GetAxisRaw("Vertical");

Vector3 view = MainCamera.WorldToViewportPoint(transform.position);

view.x = (h > 0) ? 1 : (h < 0) ? 0 : view.x;
view.y = (v > 0) ? 1 : (v < 0) ? 0 : view.y;

Ray ray = MainCamera.ViewportPointToRay(view);

RaycastHit hit;

Physics.Raycast(ray, out hit, Mathf.Infinity, 1 << 15); // 15 - ground plane layer

Vector3 world = new Vector3(hit.point.x, transform.position.y, hit.point.z);

Vector3 dir = (world - transform.position).normalized;

transform.position += dir * Speed * delta;

sentences:
Trying to convert Unreal shader graph to Unity, what nodes are a close equivalent in the Unity shader graph? I am trying to convert an Unreal shader graph to a Unity Shader Graph.

https://api.unrealengine.com/udk/Three/VolumetricLightbeamTutorial.html

I am struggling with understanding which nodes to use in the Unity Shader Graph while trying to replicate it.

I managed to get something looking Ok using the fresnel node, but if you enter inside the geometry, you lose the effect.  I found the above article which is perfect for what I need to do.

Here is the first node setup:

I tried to follow along but a lot of the nodes I don't understand what the equivalent would be in the Unity shader graph.

Combine looks to be the equivalent of the Append node I think.
Mask node I am not sure about as there are 3 mask nodes in Unity shader graph.

Edit:

Spent most of the weekend trying to learn which nodes to use.  Still not sure on what the "Reflection Vector" should be.  I think it's something to do with the camera.

Here is the graph currently.

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:
Text alignment in OpenGL with FreeType2 I'm trying to implement font rendering and have got into some trouble with glyph metrics.
Here's the code where I get the metrics:

Glyph gl;
gl.width = face->glyph->metrics.width / 64;
gl.height = face->glyph->metrics.height / 64;
gl.character = i;
gl.advance = face->glyph->metrics.horiAdvance / 64;
gl.bearingX = face->glyph->metrics.horiBearingX / 64;
gl.bearingY = face->glyph->metrics.horiBearingY / 64;
gl.textureX = this->_textureWidth;

The value of gl.advance is way too small. Here is a picture of it:

If I'm dividing face->glyph->metrics.horiAdvance by 40, it looks like this:

The text is now readable, but the advance and X-, Y-bearing still don't look correct. This is what it should look like:

Here is my code where I draw the glyphs:

float aspect = this->_graphics->getMetrics().x / this->_graphics->getMetrics().y;

float offset = 0;
for(unsigned char c : str){
    Glyph g = this->_fonts[fontID]->getGlyph(c);

    vec2 pos = (position.getRelative() + vec2(offset, 0) + (vec2(g.bearingX, -g.bearingY) / SCALING) * scale - vec2(1, 1))
                * vec2(1, -1);
    glyphShader->setUniform("position", pos);
    glyphShader->setUniform("scale", (vec2(g.width, g.height * aspect) / SCALING) * scale);
    glyphShader->setUniform("glyphSize", vec2(g.width, g.height));
    glyphShader->setUniform("textureMetrics", this->_fonts[fontID]->getTextureMetrics());
    glyphShader->setUniform("textureOffset", vec2(g.textureX, 0));
    glyphShader->setUniform("image", 0);
    glyphShader->setUniform("color", color);

    this->_graphics->getMeshByID(guiInstance->_quadID)->drawMesh();

    offset += (g.advance / SCALING) * scale;
}

I'm doing some transformations on position to move the origin to the top-left corner and flipping the coordinate system on the X-Axis. Then I divide every pixel value by a constant factor, to have the font having the same size on every resolution. The ratio of the glyphs is correct, but not the alignment.
And here is my vertex shader:

#version 400

layout(location=0) in vec4 vertPosition;
layout(location=1) in vec2 vertUV;

uniform vec2    position;
uniform vec2    scale;
uniform vec2    glyphSize;
uniform vec2    textureMetrics;
uniform vec2    textureOffset;

out vec2 fragUV;

void main(void){
    gl_Position = vertPosition *
                  vec4(scale, 1, 1) +
                  vec4(position, 0, 0);

    fragUV = vec2(vertUV.x * (glyphSize.x / textureMetrics.x) + (textureOffset.x / textureMetrics.x),
                  -vertUV.y * (glyphSize.y / textureMetrics.y));
}

Why are the characters misaligned?

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:
LibGdx- Sprites moving alongside camera I am trying to render some entities in random positions on the screen. The spawning positions are okay however when I move the player entity (which the camera is focused on) and pass the middle of the screen (then the camera starts moving) the sprites of the other entities also move with me, which I do not want.

I tried giving them postions in the world and not in the screen using cam.unproject(position); which converts psotions relative to the screen into positions relative to the game world, but that did not work either.

They are rendered the same way all other sprites are rendered in libgdx

This is the code where I initialize the entities:

Texture zombie = new Texture("zombie.png");
    float x, y;
    for (int i = 0; i < enemy_amout; i++) {
        x = rm.nextFloat() * (mapWidth * 8f- zombie.getWidth());
        y = rm.nextFloat() * (mapHeight * 8f - zombie.getHeight());
        Vector3 position = new Vector3(x, y, 0);
        cam.unproject(position);
        enemies[i] = new Entity(zombie, position.x, position.y, 1);
    }

This is what the game looks like when I start it

And this is what it looks like after I moved the player character to the right. As you can see they moved alongside the camera but I want them to remain on their original positions.

sentences:
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:
How to speed up script compilation? Is there a way to speed up script compile time when I change something in VS then click on Unity?

It takes 15 seconds. Is this normal?

sentences:
Rendering multiple textures on same image for terrain with index buffers (LWJGL 3) I have started with LWJGL3 and trying to built game engine. I'm stuck on generating terrains and this is my second big problem and I'm exhausted so I need some advice on how to solve my problem.

What I want to achieve :
I want to have all textures in one place and to have some kind of texture map that I will use to render specific texture at that place.

example:
textures

map

but result is

Only thing that I think is problem is because I use same points (index buffers)

So instead of 8 points, I have 6. Is it possible that then texture gets all messed up?

Should I use all points, even if they are at same or almost the same location? But then I would have a lot more vertices than actually need it.

sentences:
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:
Slow down in the same time over different distances I'm trying to slow down a object over different distances in the same time, say 3 seconds.

My slow down code is.

function lerpSpeed (speed: float, lerpSpeedTime: float)
 {
     incomingFlightSpeed = flightPathScript.flightSpeed;

     i = 0;
     while(i < 1)
     {
         i += Time.deltaTime/lerpSpeedTime;
         i = Mathf.Clamp(i, 0, 1);

         flightPathScript.flightSpeed = Mathf.Lerp(incomingFlightSpeed, speed, i);

         yield;
     }
 }

So I call it with.

 waypointScript.lerpSpeed(1,(totaFlighpointsDistance/flightSpeed));

In the picture below I've draw a bezier curve and at the last 8 flight points (the red and yellow spheres) I want to start the slow down from the yellow sphere to the last red sphere.

I get the distance in between each of the last 8 flight points and total them up to give me the total distance, I understand to get the time it will take to travel that distance is time = total distance/speed, but as I'm slowing the speed in my function above this will not work.

And because every bezier curve I generate is different, some stretched out, with total distances sometimes ranging from 30 to 8.

So I'm a bit stuck here, thought I'd get this one, but unless I'm missing something simple I can't get my head around it, so any help would be greatly appreciated, thanks.

sentences:
Low Level Audio Engine Sample Rate Conversion First off, there seems to be a sparse number of audio programming tutorials out there so if anyone knows of some good resources I would be very appreciative. Now on to the topic at hand!
I am using WASAPI for the audio engine that I am trying to develop and I am having difficulties reformatting data from a read audio file data into a format that the audio device is prepared to receive. Specifically I am wondering how games generally handle converting the sampling rate of a read audio file into the requested sampling rate of the device. I saw an example where linear interpolation was used but read elsewhere that such a filter introduces too many artifacts, so again I'm wondering what a practical algorithm would be for game design, something good enough that can be achievable in a high work load real time environment.
On a separate note, would it be safe to assume that most games store the majority of its audio assets in an uncompressed audio format to save the CPU the work of uncompressing the data or are there more benefits to be gained from having less data to load from the hard drive.
Thanks in advance for the help.

sentences:
What is the approach of creating an image puzzle game with libgdx I would like to create a game which consists of taking a random image, slicing it up into some number of pieces (according to a selected difficulty) and letting the player solve the puzzle.

I've googled this, but didn't find anything relevant that would at least help me understand how this kind of games are to be approached. I did come across this article Custom Sprite Batcher in LibGDX, but it is not complete and is rather confusing to me for now.

Any suggestions are much appreciated.
Thanks.

sentences:
Help implementing virtual d-pad Short Version:

I am trying to move a player around on a tilemap, keeping it centered on its tile, while smoothly controlling it with SneakyInput virtual Joystick. My movement is jumpy and hard to control. What's a good way to implement this?

Long Version:

I'm trying to get a tilemap based RPG "layer" working on top of cocos2d-iphone. I'm using SneakyInput as the input right now, but I've run into a bit of a snag.

Initially, I followed Steffen Itterheim's book and Ray Wenderlich's tutorial, and I got jumpy movement working. My player now moves from tile to tile, without any animation whatsoever.

So, I took it a step further. I changed my player.position to a CCMoveTo action. Combined with CCfollow, my player moves pretty smoothly. Here's the problem, though: Between each CCMoveTo, the movement stops, so there's a bit of a jumpiness introduced between movements.

To deal with that, I changed my CCmoveTo into a CCMoveBy, and instead of running it once, I decided to have it CCRepeatForever. My plan was to stop the repeating action whenever the player changed directions or released the d-pad.

However, when the movement stops, the player is not necessarily centered along the tiles, as it should be. To correctly position the player, I use a CCMoveTo and get the closest position that would put the player back into the proper position. This reintroduces an earlier problem of jumpiness between actions.

What is the correct way to implement a smooth joystick while smoothly animating the player and keeping it on the "grid" of tiles?

Edit:

It turns out that this was caused by a "Bug Fix" in the cocos2d engine.

sentences:
Showing keyboard on SKScene and performing action on a sprite node based on key tapped I am trying to learn SpriteKit and play with some simple sample apps.

Currently I am trying to achieve below things:

Show keyboard over SKScene
If user taps 'A', perform some action on a sprite node, if user taps 'B' perform some other action on other sprite nodes

I tried to google 'Showing keyboard over SKScene' but could not get any suitable answer :(

Any clues or suggestions?

sentences: Animation with non-uniform frame sizes How do you know when to draw the next frame if its bounding box is larger/smaller than the current? For example, in KOF, some characters have elastic arms and things of the like..How are these handled in a game?

sentences:
Transparent texture over colored polygon? Let's say I have a cube with each face having a different colour. I want them all to look like brick walls, but I don't want to have to recreate the same brick texture for every colour.

Is it possible to create a greyscale semi-transparent brick texture that I can overlay overtop of the polygon colour?

This scene will eventually be used in Unity, but I also have access to 3DS Max and Blender. So, whatever works.

sentences:
Why the update function only call once I asked about this question How to efficiently implement a 7-segment display? in previous post. Now I just add an update function to the last part of the code to display the time(I don't bother the exact time at the moment just want to make sure the number change regularly). However,I'm not sure why the update only run once, I checked the answer in this website, mentioned the root cause is gameobject deactivated(Update function only running once) but this is not my case. I tried with void OnMouseDown(){Display(DateTime.Now.Second)}, the number does change according to my mouse button so I'm not sure what wrong with Update function. In addition, I assigned all the variable but it still pop out message unassigned reference exception, not sure where the problem.
using System;
using UnityEngine;

public class ClockDigit : MonoBehaviour
{
//  Assuming you number your segments as follows:
//   -- 0 --
//  |       |
//  5       1
//  |       |
//   -- 6 --
//  |       |
//  4       2
//  |       |
//   -- 3 --
// Store a lookup table for which segments
// should be active when displaying each digit.
static readonly bool[,] SEGMENT_IS_ACTIVE = new bool[,] {

    {true,  true,  true,  true,  true,  true,  false}, // 0
    {false, true,  true,  false, false, false, false}, // 1
    {true,  true,  false, true,  true,  false, true }, // 2
    {true,  true,  true,  true,  false, false, true }, // 3
    {false, true,  true,  false, false, true,  true }, // 4
    {true,  false, true,  true,  false, true,  true }, // 5
    {true,  false, true,  true,  true,  true,  true }, // 6
    {true,  true,  true,  false, false, false, false}, // 7
    {true,  true,  true,  true,  true,  true,  true }, // 8
    {true,  true,  true,  true,  false, true,  true }  // 9
};

public Color32 activeColour = Color.red;
public Color32 inactiveColour = Color.black;
public SpriteRenderer[] segments = new SpriteRenderer[7];

public void Display(int number)
{
    var digit = number % 10;
    if (digit < 0) digit *= -1;
    for (int i = 0; i < 7; i++)
    {
        if (SEGMENT_IS_ACTIVE[digit, i])
        {
            segments[i].color = activeColour;
        }
        else
        {
            segments[i].color = inactiveColour;
        }
    }
}

public void Update()
{
    Display(DateTime.Now.Second);

}
}

I tried this command also, the infinite loop freeze the Unity and FixedUpdate() command also update the frame only one time.
void Update()
    {while(true)
      Display(DateTime.Now.Second);
    }

sentences: To what platforms can the blender game engine build to? I used to use the BGE until I found that unity can build to lots of different platforms. What platforms does the BGE support?

sentences:
making a monster encounter method I'm currently making my own little 2d text based game and I've got a 11 / 11 grid where a monster spawns in the middle and when i stand on it's position and it brings me to another 11/11 grid where i fight the monster. I'm going to make it a turn based theme where it starts on my turn and i can only move a certain amount of spaces and the monster can only move a certain amount of spaces and when are abilities are in range we can use them etc etc etc,

I want it so every time i encounter a monster it sees where i am on the grid and see's if its a low level area or a high level area, if it's a low level area it will spawn a Slime , wolf or pig. or high level area it will spawn a dragon , giant etc. Is there a better way to do it than what i'm currently doing it. Right now I've started to low level area.

What i'd like it to do

if monster = pig,wolf,slime , give it a certain amount of stats and health then start the fight

if monster = giant,dragon , give it a certain amount of stats and health then start the fight

Is the current way i'm doing it good or is there a better way?

  public static void monster_encounter() {
  Random gen = new Random();
  final int monster_gen = gen.nextInt(3);
  if( monster_gen == 0) {
  System.out.println("You're fighting a: Wolf");
  }
  else if( monster_gen == 1) {
  System.out.println("You're fighting a: Slime");
  }
  else if( monster_gen == 2) {
  System.out.println("You're fighting a: Pig");
  }

  }

sentences:
Separate game engine from game I'm building a simple game engine (or mostly rendering engine) and I would like to separate the "engine" part from the "game" part. So, I've come up with an idea to build "engine" part as a library (static or dynamic) and the "game" part will link to this library. Simple.

However, there is one problem - "engine" part needs to reference some assets i.e. files with source code of builtin shaders (defualt shaders of the rendering engine).

Is there a way to include these shader files into an "engine" library? Or is there any other solution to this problem?

sentences: 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:
LWJGL 3 how to convert screen coordinate to world coordinate? I'm trying to convert screen coordinate to world coordinate on mouse click event.
For LWJGL 3 there's not GLU utility class is available whereas LWJGL 2 has.

I'm using JOML math classes and wrote following code, but its returning wrong world coordinate, I'm doing something wrong and couldn't figure out.

On program init, I get viewProjMatrix and viewport:

viewProjMatrixUniform = glGetUniformLocation(this.program, "viewProjMatrix");
IntBuffer viewportBuffer = BufferUtils.createIntBuffer(4);
int[] viewport = new int[4];
glGetIntegerv(GL_VIEWPORT, viewportBuffer);
viewportBuffer.get(viewport);

On render loop, I calculate viewProjMatrix:

viewProjMatrix
    .setPerspective((float) Math.toRadians(30), (float) width / height, 0.01f, 500.0f) // define min and max planes
    .lookAt(eye_x, eye_y, eye_z,
            eye_x, eye_y, 0.0f,
            0.0f, 2.0f, 0.0f);
glUniformMatrix4fv(viewProjMatrixUniform, false, viewProjMatrix.get(matrixBuffer));

I convert screen coordinate to world coordinate with following code:

DoubleBuffer mouseXBuffer = BufferUtils.createDoubleBuffer(1);
DoubleBuffer mouseYBuffer = BufferUtils.createDoubleBuffer(1);
glfwGetCursorPos(window, mouseXBuffer, mouseYBuffer);
double x = mouseXBuffer.get(0);
double y = mouseYBuffer.get(0);
System.out.println("clicked at: " + x + " - " + y);

Vector3f v3f = new Vector3f();
viewProjMatrix.unproject((float)x, (float)y, 0f, viewport, v3f);
System.out.println("world coordinate: " + v3f.x + " - " + v3f.y);

Here's the full source code: https://gist.github.com/digz6666/48bb433c83801ea4b82fa194f05b4f02

sentences:
Export information to a custom file type from Air So I have an engine (air application) that basically (for now) is loading some windows on the screen/stage, and you can drag them around. And later on, I'll be able to add other objects onto the stage.

How would I export any kind of information (like co-ordinates or sizes of windows) out of my application to an external custom file. And then I would use that file to reload a previous project if I were to re-load the engine.

I'm working in AS3/Air and in FlashDevelop.

Thanks for the help and time. If anymore information is needed please let me know.

Cheers.

sentences: Unity Multiplayer functionalities or Google's plug-in? I want to add multiplayer matches to a game I'm making for Android/PC, and something echoed in my mind: would the network functionalities Unity provides work in Android? I ask this because Google has a free plug-in for their services, but Unity also offers possibilities. Also, using any of the above, do I need to pay to rent a server? Or, for example, since we need a paid developer account to register our game at Google Play Store, the servers are part of the deal?

sentences:
What coding issues can be significant in damaging the performance of a game? I have just finished a 2D game in Java that I've been working on for a while.

I found that on some computers it runs fine, and on others (which are not particularly slow in general), the game runs a little slower, and with minor interruptions every second or so. Not completely smooth.

Since I am a beginner to making games, and probably since I didn't plan everything about the game in advance, the code of the game is rather long, clumsy and probably inefficient.

I want to improve this in my next projects. So my question is - In general, what would be the main causes for a common 2D game to slow down on a computer?

What should I pay the most attention to, next time, in order to design an efficient game?

Making a small amount of classes? (Even if the classes are small
ones?)
Avoiding repetition of code? (Even small sections of code, such as
short if statements).
Avoiding too many threads running?
Anything else?

Obviously, all of the above are recommended for an efficient program.

But I'd like to know, what in a game's code, could be especially significant for making an efficient application, and what would be less important and will not save significant amounts of memory.

Any advice would be welcome - could be regarding game design, or regarding more specific coding issues.

I don't know if this matters, but please note that I'm talking mainly about real-time games, using a 'game-loop' that constantly updates the game and the dispaly.

Thank you

sentences:
How can I generate Sudoku puzzles? I'm trying to make a Sudoku puzzle generator. It's a lot harder than I expected and the more I get into it, the harder it gets!

My current approach is to split the problem into 2 steps:

Generate a complete (solved) Sudoku puzzle.
Remove numbers until it's solveable and has only 1 solution.

In step 1, since I'm using a brute force methods, I'm facing some run time issues. Is there an optimal way of filling in a complete Sudoku puzzle?

In step 2, what kind of algorithm should I use to "puzzlize" a solved sudoku?

sentences:
Does collision between two Area2D work differently than collision with Rigidbody2D? Consider a Main.tscn with:
(1) a player:
+ Player extends Area2D
|_ AnimatedSprite
|_ CollisionShape2D

The player has:
func _on_Player_body_entered(body):
    hide()

(2) a falling rock:
+ Rock extends RigidBody2D
|_ AnimatedSprite
|_ CollisionShape2D

(3) a trap:
+ Trap extends Area2D
|_ AnimatedSprite
|_ CollisionShape2D

The collision between Player and falling Rock (Area2D vs RigidBody2D) makes the player disappear as expected. While, the collision between Player and Trap (Area2D vs Area2D) does nothing. Is it expected?

sentences:
How do you create a 2d world then view it in 3d? I have been learning OpenGL for a while now and have a pretty good understanding so far.

What I would like to know is if I create a 2D game in Orthographic Projection, is it possible to switch to a perspective projection and view the scene without having to manually adjust the camera etc?

Thanks

sentences:
Object orbiting a 3d sphere I'm developing in libgdx java/android but not using any high-level environment like Unity.

I have a sphere at [0,0,0], with a PerspectiveCamera looking at it. Through the main game loop I have managed to have the camera orbiting the sphere in different directions. However, what I want to do is have a stationary camera and have 3 objects orbiting the sphere on their own accord, and their own orbital plane. Have been looking all day and struggled to get this working.

Eventually, I want to link the camera to always be above one of the orbitting objects, but that's at a later stage.

I also want to be able to have these objects orbitting on their own "forwards" direction, but able to change their direction over time. Say, from their top-down view, they each have a heading 0-359 degrees.

Anyone lend a hand with this? I've tried using 2D X/Y maps transposing onto mercator projections and then converted to spherical coordinates; I've tried Vector3 and setFromSpherical(); I've tried looking at Quaternions, and just got lost.

It's a relatively simple thing I'm trying to do, multiple orbiting objects around a sphere (radius 3, origin [0,0,0]), but just getting my initial approach wrong.

EDIT:

After talking the situation through, I have two options:  I either keep track of the orbiting objects with theta/phi as to their position around the sphere, or just calculate the amount by which to rotate based on the object's direction (0-359). On further talks with DMGregory, the latter option would introduce orbital instability/divergence with roudning errors so I have decided to change my requirement to the following:

Keep track of the object's position based on 2x360 degree values for  azimuth and polar, called theta and phi. The two coordinates are used to locate the object at any point in orbit around the sphere, but I need to be able to still "move" the orbital object "forwards" and thus change theta/phi accordingly, allowing the direction to still be changed.

Many thanks,

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 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:
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:
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:
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:
How unity works on Web How Unity can work on Web if the code is written in C#? I understand that you can compile the C# code to a shared library and use it in Java (for Android) in ObjectiveC (for iOS) to enable Unity on multiple platforms, but you cant use shared library on JS. Does Unity do language to language translation from C# to JS to enable Unity on Web?

As I understand now starting from Unity 5.0 it even doesn't use Unity Web Player.

sentences:
How to compare two skeletons by using kinect sensor? I need to know about how to compare record skeleton with live skeleton in C#. If there are any reference please let me know.

 example image for what I done up to now

sentences:
multiplayer networking with physics I'm curious how multiplayer networking with physics is implemented in racing games.
We have a physical world with multiple fast-moving vehicles controlled by different people.
Let's say that vehicles have weapons and can shoot each other (Twisted Metal, Vigilante v8)

I'm anxious about hits and collisions.
Authoritative server or a better alternative?

sentences:
Cost of changing scene in andengine I'm working on a simple 2d puzzle with small textures (in count and quantity).
Now after I finished the game logic I'm considering tow options to switch between levels:

Remove all objects manually and de-attach their spirits from the current scene .
Drop the whole scene and start the new level on a new scene.

Both options are not much different in code complexity in my case. so the question is what are the drawbacks of the second approach ? specifically is a scene a heavy object?

sentences:
Unity C# Changing Button Color? void OnMouseDown ()
{
    foreach (Button thisButton in buttonArray)
    {
        thisButton.GetComponent<SpriteRenderer>().color = Color.black;
    }

    GetComponent<SpriteRenderer>().color = Color.white;
}

This code results in whichever button I select changing color to white while the rest are black. However, I am not understanding how this works. How does it know to specifically change ONLY the selected button to white while the rest are black. Seems contradictory to me...

sentences:
Why the timer is not showing the hours? It's showing minutes seconds milliseconds but I want to show also the hours.

At the top:

private int seconds; // Seconds.
private int minutes; // Minutes.
private int hours;   // Hours.

In Update:

void Update()
{
if (seconds < 1)
        {
            seconds = 59;
            minutes--;
        }
        if (minutes < 1)
        {
            minutes = 59;
            hours--;
        }
        if (hours < 1)
        {
            hours = 59;
        }
        seconds--;

        EditorGUILayout.LabelField("Next: ", hours.ToString() + ":" + minutes.ToString() + ":" + seconds.ToString());

Update, This is what I tried:

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

public class Timer : EditorWindow
{

    private static Timer editor;
    private static int width = 300;
    private static int height = 110;
    private static int x = 0;
    private static int y = 0;
    int totalSeconds;

    [MenuItem("Window/Timer")]
    static void ShowEditor()
    {
        editor = EditorWindow.GetWindow<Timer>();
        editor.Init();
    }

    public void Init()
    {
        StartTimer(1, 1, 50);
        Debug.Log("The level will now be saved automatically");
    }

    void OnGUI()
    {
        EditorGUILayout.LabelField("Next: ", TimeString());
    }

    public void StartTimer(int hours, int minutes, int seconds)
    {
        totalSeconds = seconds + 60 * minutes + 60 * 60 * hours;
    }

    string TimeString()
    {
        return string.Format("{0:00}:{1:00}:{2:00}",
                      totalSeconds / (60 * 60),   // Hours
                      (totalSeconds / 60) % 60, // Minutes
                      totalSeconds % 60);     // Seconds
    }
}

But the timer is not moving not counting back it stay still.
I tried also to move the line:

StartTimer(1, 1, 50);

To be inside the OnGUI before the LabelField.

sentences:
Are there any good ways to know if a resource is patented trademark or illegal to use? This is something that I worried about for a long time. While making games, it is hard to tell for sure if any of the resources are copyrighted unless a person is clearly aware that they are to a like to an image that have known in certain work done. I wanted to make a 2D MMO, that in certain ways might be similar to "Pokémon". I did not want to make an illegal game, but it is just that there are certain elements that I want in the game which are similar to those in "Pokémon". I also wanted to possibly sell the features of it, if the project succeeds and works out all well. What exactly are some ways that I can find out for sure if images that I am using are illegal to use or not.

The element which I am worried about in the game which I was planning to make was about creature battling and summoning. Thankfully, game concepts cannot be copyrighted, but I did not want to take or use images that were exactly like those in "Pokémon", and I wanted to make a game that is very different in many ways. I might have wanted to use creatures in a similar cartoon fashion that is used in "Pokémon". This has been somewhat of a concern, to me, though as about the legal issues possibly.

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:
Unable to find good parameters for behavior of a puck in Farseer EDIT:

I have tried all kinds of variations now. The last one was to adjust the linear velocity in each step: newVel = oldVel * 0.9f - all of this including your proposals kind of work, however in the end if the velocity is little enough, the puck sticks to the wall and slides either vertically or horizontally. I can't get rid of this behavior. I want it to bounce, no matter how slow it is. Retitution is 1 for all objects, Friction is 0 for all. There is no gravity. What am I possibly doing wrong?

In my battle to learn and understand Farseer I'm trying to setup a simple Air Hockey like table with a puck on it.
The table's border body is made up from:

    Vertices aBorders = new Vertices( 4 );
    aBorders.Add( new Vector2( -fHalfWidth, fHalfHeight ) );
    aBorders.Add( new Vector2( fHalfWidth, fHalfHeight ) );
    aBorders.Add( new Vector2( fHalfWidth, -fHalfHeight ) );
    aBorders.Add( new Vector2( -fHalfWidth, -fHalfHeight ) );

    FixtureFactory.AttachLoopShape( aBorders, this );
    this.CollisionCategories = Category.All;
this.CollidesWith = Category.All;
this.Position = Vector2.Zero;
this.Restitution = 1f;
this.Friction = 0f;

The puck body is defined with:

FixtureFactory.AttachCircle( DIAMETER_PHYSIC_UNITS / 2f, 0.5f, this );
this.Restitution = 0.1f;
this.Friction = 0.5f;
this.BodyType = FarseerPhysics.Dynamics.BodyType.Dynamic;
this.LinearDamping = 0.5f;
this.Mass = 0.2f;

I'm applying a linear force to the puck:

this.oPuck.ApplyLinearImpulse( new Vector2( 1f, 1f ) );

The problem is that the puck and the walls appear to be sticky. This means that the puck's velocity drops to zero to quickly below a certain velocity. The puck gets reflected by the walls a couple of times and then just sticks to the left wall and continues sliding downwards the left wall. This looks very unrealistic.

What I'm really looking for is that a puck-wall-collision does slow down the puck only a tiny little bit. After tweaking all values left and right I was wondering if I'm doing something wrong. Maybe some expert can comment on the parameters?

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

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

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

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

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

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

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

and I load an image in like this :

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

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

I render the sf::Sprite like this :

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

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

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

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

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

sentences:
How can I handle a transition into building interiors? I am trying some stuff on Unreal Engine to make something approching games like Commandos series.
But for now, I'm stuck with something I can't figure how it is done :
How are building interior handled ?

Here's a screenshot to illustrate what I say :

When you enter a building, everything become black, except the building's interior. The interior is isolated, there is no "communication" between the interior and the exterior, and between linked interiors. For exemple if you shoot with a weapon and there is an enemy outside just behind the door, he can't hear you.

Sometimes biggest buildings are divided in many parts, and each floor are a different "section" that are isolated from each other (you have a transition and can't communicate between). Here is an image that explain it well : Commandos 2 interior

Teleport : I first thinked that you were teleported to a different portion of the map, or a different small map, but it is unlikely. If you look at a window, you are at the same time outside (you can see your character outside at the window) and inside (you character is leaning out the window). Teleport would cause many sync issue.

Section toggle : Then, I thinked that the interior is already handled in the exterior map, but completely hidden, and when you enter it, it "deactivate" the exterior by hidding everything outside and displaying interior. Again, this is unlikely since map are full 3D (you can rotate 360°) and exterior are 2D.

How can I create this kind of transition?

I've specified that I am on Unreal, but I'm more searching the theorical way rather than Unreal specifics.

sentences:
Store metadata for tile in Tiled Map Editor In my tilemap-based game, I need to associate lights with light switches, buttons with doors etc. I am using the Tiled map editor (mapeditor.org), but I have yet to find a way to store these associaltion. My idea is to store a number with each tile, so I can have groups of tiles that interact with each other.

Is there a way to store custom data with each tile in the Tiled map editor? Just to be clear: I don't want to store custom data with each tile type, but with individual instances of one tile type.

sentences: Should I create .fla files in Flash Professional and import them into Flash Builder? With Flash Builder and Flash Professional at my disposal for creating games, I'm having a hard time figuring out if I should be creating the .fla files in Flash Professional and then importing them into Flash Builder, or something else? Does it matter?

sentences:
Can XNA's content pipeline be used to load C# source files? I am wondering if its possible to use the XNA Content Pipeline to load C# files?

I'm working on a game and am currently writing a FSM. I would like to be able to load states from the content pipeline, but the states would be written in C# and must use my interface.

Anyone know how to do this?

sentences:
Drawing a textured triangle with CPU instead of GPU I understand the benefits of GPU rendering and such, but for a certain limited application I need to render textured triangles purely using CPU.

I've built a 3D engine capable of object handling, transform, projection, culling and the likes ... now all I need is a little code snippet that draws a single textured triangle onto a bitmap... any language accepted!

Inputs: Texture bitmap, Triangle U/V/W coords, Triangle X/Y screen coords
Output: The textured triangle drawn at the given screen coords

I've currently been using a platform function to draw triangles to screen, but I'm looking to handle it myself to speeden up the process.

sentences:
C++ libtcod example doesn't work I'm starting to learn C++ (I have a very basic programming background) and I have in mind to create an old-school ASCII-looking roguelike. I know it may be easier in Python, but it has to be in C++. I'm using Windows 10.

I want some eye candy beyond basic ASCII, I've seen libtcod 1.5.1 offers a lot of possibilities so I wanted to try it and follow this tutorial. The problem is I'm stuck right at the beginning, because the libtcod demo "samples_cpp.exe" works but not the example code:

#include "libtcod.hpp"

int main()
{
   TCODConsole::initRoot(80, 50, "libtcod C++ tutorial", false);
   while ( !TCODConsole::isWindowClosed() )
   {
       TCODSystem::checkForEvent(TCOD_EVENT_KEY_PRESS, NULL, NULL);
       TCODConsole::root->clear();
       TCODConsole::root->putChar(40, 25, '@');
       TCODConsole::flush();
   }

   return 0;
}

If I launch the .exe compiled with the command:

g++ src/*.cpp -o tuto -Iinclude -Llib -ltcod-mingw -static-libgcc -static-libstdc++ -Wall

by double-click, it opens and closes a window very fast, and if I execute it from the console I get the in-console message:

24 bits font.
key color : 0 0 0
character for ascii code 255 is colored

Any clues of what I'm doing wrong? The project has all the proper .dll and include folder. This should be pretty easy :/

Thanks a million!

UPDATE:
Ok, I got some new info, gdb says this:

[New Thread 7468.0x1f24]
[New Thread 7468.0x203c]
[New Thread 7468.0x1bdc]
[New Thread 7468.0x190c]
[New Thread 7468.0x108c]
24 bits font.
key color : 0 0 0
character for ascii code 255 is colored
Using SDL renderer...

Program received signal SIGSEGV, Segmentation fault.
0x65e70d9f in TCODConsole::clear (this=0x1) at src/console.cpp:196
196     src/console.cpp: No such file or directory.

Not sure what that means, the console.cpp file of libtcode at line 196 has the following:

void TCODConsole::clear() {
    TCOD_console_clear(data);
}

sentences:
How do dialog trees work? That is, what is connected to what and how to move between lines of speech when a sub-conversation ends?

If you have any examples of a basic dialog tree in C#, please post them.

sentences:
vuforia how do I force objects into a 2D plane I'm working on a game in which cards are placed on a table and then rendered in augmented reality. These objects have 3D physics attached to them which doesn't work as well if they are either rotated or if the system mistakes them for being higher or lower then they really are.

Is there a good method to force Vuforia/Unity to place all items in the same 2D plane and keep all of them upright compared to that plane?

I currently have the following code:

using UnityEngine;
using System.Collections;

public class projectioncode : MonoBehaviour {
    Vector3 p1;
    Vector3 p2;
    Vector3 p3;
    Vector3 v1;
    Vector3 v2;
    Vector3 normal;

    /*
     *use a plane with the following 3 coordinates
     */
    public void setPlaneByPoints(Vector3 point1,Vector3 point2, Vector3 point3){
        p1 = point1;
        p2 = point2;
        p3 = point3;

        v1=p2-p1;
        v2=p3-p1;
        normal=getNormal(v1,v2);
    }

    public Transform projectTransform(Transform input){
        input.position = projectPoint (input.position);
        return input;
    }
    /*
     *  projects a 3d point into space;
     */
    Vector3 projectPoint(Vector3 point){
        Vector3 vOToPoint = point - p1;//vector between origin and point
        float dist = Vector3.Dot (vOToPoint, normal); //distance plane to point
        return point - dist * normal;
    }

    /*
     * caclulates the normal of 2 vectors
     */
    Vector3 getNormal(Vector3 v1,Vector3 v2){
        Vector3 res= (Vector3.Cross (v1, v2));
        res.Normalize();
        return res;
    }
}

This seems to project objects onto a plane but the results tend to be inaccurate and result in weird movements, particularly when moving the camera around.

This is what it looks like:

sentences:
Why is there a discrepancy between these two transform.up vectors? I was trying to implement a feature which required transform.up, the result didn't match the green axis gizmo displayed in the editor so I assumed it was being put off by the rotation of the object despite expecting the gizmo to adapt to that. I then modified the prefab such that everything was now child to an empty object and the secondary objects were child to that instead of the rotating model, and wrote a script that simply copies the transform so that it tracks. This still didn't show the values expected from what the gizmo in the editor showed. I then did a Debug.LogError in the track script and this time the result was as expected.

Why is transform.up showing the value expected from the local y-axis gizmo but when passing a reference to the original script and checking tracked.transform.up gives off results?

To reproduce in a simpler environment I set up a simple test scene.

Simple default cube with the hierarchy structure shown in the screenshot.
The transform values are as follows:

parent zeroed
x:0, y:-90, z:0 for cube
x:0, y:-90, z:90 for TrackPoint

Scripts are as follows:

test.cs - attached to trackpoint

private void Update()
{
    Debug.LogError(transform.up);
}

Track.cs - attached to tracker

public Transform transformToTrack;

private void Update()
{
    transform.position = transformToTrack.position;
    transform.rotation = transformToTrack.rotation;
    Debug.LogError(transform.up);
}

byref.cs - attached to cube

public GameObject refObj;

private void Update()
{
    Debug.LogError(refObj.transform.up);
}

When run, if you clear the console then click pause you'll see that one of them differs from the others. I don't understand why. My project and this sample scene differ in which it is that is giving unexpected results but the results are inconsistent with what I would expect.

But wouldn't they all give the same result?

sentences:
OpenGL ES 2.0 not drawing images with shadows I'm using OpenGL ES 2 to program a simple game 2D for Android mobile phones. I'm coding the rendering portion of the software, using the GLES20 default library.
All my sprites are rendered from a large image containing all the pictures of what I need. I use very basic fragment and vertex shaders which are the following:
Vertex shader:
uniform mat4 uMVPMatrix;
attribute vec4 vPosition;
attribute vec2 a_texCoord;
varying vec2 v_texCoord;
void main() {
     gl_Position = uMVPMatrix * vPosition;
     v_texCoord = a_texCoord;
 }

Fragment shader:
 precision mediump float;
 varying vec2 v_texCoord;
 uniform sampler2D s_texture;
 void main() {
      vec4 dst = texture2D(s_texture, v_texCoord);
      gl_FragColor = dst;

  }

Those are the shaders I use and everything is rendering fine.
I also set the blending function to:
 GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA,GLES20.GL_ONE_MINUS_SRC_ALPHA);

The problem is that I needed a sort of shadow around an object, so  I decided to solve this problem simply making the game image with already the shadow in it.
So, as you can see, here is a piece of my image with a large orange outside shadow so I get the effect that the main object (the two columns in the middle) is glowing.

(Ignore the black background, I put it there to make the shadow visible, it's not there in the real game image)
Anyway, when I render this image I get this result:

As you can clearly see, there is not any sort of shadow, even it is there in the source image.
What is really strange from my point of view is that I don't generate the shadow using the shaders, I created it in a very static (and probably not very effective) way: using Photoshop.
How can I make the outer orange glow visible ?
Thank you in advice

sentences:
Uniform not being applied to proper mesh Ok, I got some code, and you select blocks on a grid.

The selection works. I can modify the blocks to be raised when selected and the correct one shows.

I set a color which I use in the shader. However, I am trying to change the color before rendering the geometry, and the last rendered geometry (in the sequence) is rendered light.

However, to debug logic I decided to move the block up and make it white, in which case one block moves up and another block becomes white.

I checked all my logic and it knows the correct one is selected and it is showing in, in the correct place and rendering it correctly. When there is only 1 it works properly.

Video Of the bug in action, note how the highlighted and elevated blocks are not the same block, however the code for color and

My Renderer is here (For the items being drawn)

    public void render(Renderer renderer) {
    mGrid.render(renderer, mGameState);

    for (Entity e:mGameEntities) {
        UnitTypes ut = UnitTypes.valueOf((String)e.getObject(D.UNIT_TYPE.ordinal()));
        if (ut == UnitTypes.Soldier) {

            renderer.testShader.begin();
            renderer.testShader.setUniformMatrix("u_mvpMatrix",mEntityMatrix);
            renderer.texture_soldier.bind(0);
            Vector2 pos = (Vector2) e.getObject(D.COORDS.ordinal());
            mEntityMatrix.set(renderer.mCamera.combined);
            if (mSelectedEntities.contains(e)) {
                mEntityMatrix.translate(pos.x, 1f, pos.y);
                renderer.testShader.setUniformf("v_color", 0.5f,0.5f,0.5f,1f);
            } else {
                mEntityMatrix.translate(pos.x, 0f, pos.y);
                renderer.testShader.setUniformf("v_color", 1f,1f,1f,1f);
            }
            mEntityMatrix.scale(0.2f, 0.2f, 0.2f);
            renderer.model_soldier.render(renderer.testShader,GL20.GL_TRIANGLES);
            renderer.testShader.end();
        } else if (ut == UnitTypes.Enemy_Infiltrator) {
            renderer.testShader.begin();
            renderer.testShader.setUniformMatrix("u_mvpMatrix",mEntityMatrix);
            renderer.testShader.setUniformf("v_color", 1.0f,1,1,1.0f);
            renderer.texture_enemy_infiltrator.bind(0);
            Vector2 pos = (Vector2) e.getObject(D.COORDS.ordinal());
            mEntityMatrix.set(renderer.mCamera.combined);
            mEntityMatrix.translate(pos.x, 0f, pos.y);
            mEntityMatrix.scale(0.2f, 0.2f, 0.2f);
            renderer.model_enemy_infiltrator.render(renderer.testShader,GL20.GL_TRIANGLES);
            renderer.testShader.end();
        }
    }
}

        String vertexShader = "uniform mat4 u_mvpMatrix;                   \n"
            + "attribute vec4 a_position;                  \n"
            + "attribute vec2 a_uv;                  \n"
            + "varying vec2 v_uv;                  \n"
            + "void main()                                 \n" + "{                                           \n"
            + " v_uv = vec2(a_uv.x,1.0-a_uv.y);\n"
            + "   gl_Position = u_mvpMatrix * a_position;  \n" + "}                            \n";
        String fragmentShader = "#ifdef GL_ES\n" + "precision mediump float;\n" + "#endif\n"
            + " uniform vec4 v_color;"
            + " uniform sampler2D tex;"
            + " varying vec2 v_uv;     \n"
            + "void main()                                  \n"
            + "{                                            \n"
            + "  gl_FragColor = v_color*texture2D(tex, v_uv);\n"
            + "}";
      testShader = new ShaderProgram(vertexShader, fragmentShader);

sentences:
Rifle bullets/projectiles in Unity, raycasting or rigidbody? Hello again gamedevers :) I'm trying to create a fairly simple FPS shooter game. Im using a Rigidbody FPS Controller prefab from Unity. I have a rifle model attached to that, with a further gameobject for the bullet spawn location on the rifle.

I can see in the Editor, that the bulletSpawn object already knows which way it's supposed to be facing (ie. Z axis is pointing correct direction).
I've never really used Raycasts before except mobile games to select an object on screen, but my head is telling me that this might be the best way to make realistic bullets.

I've been reading about, particularly this: http://answers.unity3d.com/questions/22800/raycast-shooting.html

It suggests to use Raycasts and I understand how to call a ray from the bulletSpawn and set it's direction, and to see what it hits.
But what I don't understand is how fast the ray will travel, and how to limit the speed of said ray.

I'm not sure if this is a good way to acheive the gunfire or whether it might be better to create Rigidbodies and addforce() to them.

You guys are always so helpful and often make things MUCH easier to understand that travelling through dozens of old posts and the docs which I cant always follow along with.

How to achieve this effect?

sentences:
Simplify paths when a user builds I am looking for some guidance on how to simplify my nodes on a path when a user builds on the fly.

Imagine a path like this with a gap:

Logically 3 nodes are required 2 connected one isolated.

But now the user builds another inbetween these nodes like this:

You can see the idea is now the nodes have simplified automatically and i only now have 2 nodes on my path.

My question is how would i approach the logic for this so the code can update accordingly? I currently store my path data as an array of nodes which have a property that lists an array of other nodes that link to them. This is what it would look like before the user adds a new tile to the map:

var path    = [];
    path[0] = {'x':1,'y':3,'linksTo':[1],'id':0};
    path[1] = {'x':1,'y':4,'linksTo':[0],'id':1};
    path[2] = {'x':1,'y':1,'linksTo':[3] ,'id':2};
    path[2] = {'x':1,'y':0,'linksTo':[2] ,'id':3};

I use JavaScript - but the language isn't strictly important only the logical approach here.

I should be more clear, the paths can go in 8 compass directions in total the diagonals will be 45 degree angles rather than any other type of shallow angle. But the image just merely shows an example of a path running north to south.

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:
Creating looping canvas animation (slot machine with reels) I have a small assignment to create something like slot machine with spinning pictures. I have to use HTML5 Canvas. I would like to hear some opinions how this can be made simply and performantly.

There are  symbols that would be spinning vertically while only 2 would be fully visible, next 2 are partially hidden and remaining 2 are not visible at all.

I have chosen CreateJS suite, but I have no experience with that, so I am just trying to figure it out. I made this for the start...

var reels = [160, 405, 648, 892, 1137]; // X offset of reels
var reelLines = [0, 317, 634]; // Y offset of symbols in the reel

var stage = new createjs.Stage('game');

for (x = 0; x < reels.length; x++) {
  for (y = 0, y < reelLines.length; y++) {
    bmp = new createjs.Bitmap('symbol').set({
      x: reels[x],
      y: reelLines[y]
    });
    stage.addChild(bmp);
  }
}

This displays 3 symbols in each reel and it looks good. Now I need to add some animation to it. I am thinking about it like having stack of symbol bitmaps at the top position where it's not visible yet. I tried to use Tween class like this.

createjs.Tween.get(bmp, {loop: true}).to({
  y: 808
}, 500);

It's basically correct, symbol rolls in and out and then it pops at top again. However this works for single symbol only. If I position three symbols as stated above and run same tween on them, each of them will go in different speed, because to call second argument is duration, not the speed.

I would really appreciate some ideas on this approach and if it's even correct one.

sentences:
Rotating A model in 3D so it matches its direction of movement So I have a model of a spear and when it gets thrown I want to set the orientation of the spear to its direction.  ( I also want to use this for other things like bullets pointing in the direction they are moving in)

my Models local forward Vector is +Z and I have the direction that it is moving in (in world space) from the velocity but I can't work out how to rotate it locally so that it is always pointing the right direction.

I tried to work out the difference in the angles and then create a Rotation matrix to apply to its rotation, but that didn't give me the desired results.

I am working in DirectX.  Any help would be appreciated

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 make loss of control acceptable? Let's say the game we're talking about is some kind of platformer. With all the puzzles, mini-challenges and mechanics aspects it is very, very important to have good control over the character. A single mistake can lead to character death or some other unwanted result.

In some scenes complete control is the key to the victory. Quickly the player becomes involved in the process and every lag or mistake in input processing brings negative experience.

But what if loss of control is needed as a 'feature', it is intended? How can I prevent the players from raging about 'broken gamepad' or 'stupid buggy game'? I want the player to not only understand that it's intended, but also be somewhat happy with it, but can't find a way to show it the right way.

In other games I've seen two types of control loss so far:

Character is unable to do anything, unless animation sequence ends
Character executes some moves without player intervention (like cutscenes or end of stage, when character goes out the screen and you can't stop this).

sentences:
Clipping a windows draw area - Direct x 9 and c++ - 2D using D3D DirectX 9, C++... Let me set the scene:

I have a 16:9 image.
I have a 16:10 screen.
I want the 16:9 image to be drawn so that it is vertically centred within my 16:10 screen.
My 16:9 image is 1920 x 1080.
My screen is 1920 x 1200.

Easy:

float topOffset = ( 1200 - 1080 / 2 )

But what if my screen was 1400 x 900

I have to resize the image and get its new height, then do the above again:

float newHeightForScaledImage = ( 1080 * 1400 ) / 1920

Okay so now I have a topOffset for both widescreen cases. I draw all of my images and interactive objects at their ( y position + the topOffset ).

New problem is that the menu is also needed to take into consideration, so I use that systemmetricssomething call which returns 20 which I then subtract from the topOffset... Okay my drawing is vertically centred... perfect!

Question is, regardless of my entire game now being vertically centred (in the most crazy long hauled way possibly known to man), I can still draw outside of the game area into the black zone that now exists.

I know I am approaching this wrong, but I am too new to this to know any better.

How do you guys vertically centre your games if they are a different ratio to the artwork you have created for the backgrounds etc?

sentences:
How important is c# for game programming? Possible Duplicate:
  Does C# have a future in games development?

Presently I'm learning c++ and in starting stage of opengl . My ultimate goal is to be game programmer. I want to stick with c++ but my doubt is how important is to learn c# or XNA? What's their future compared to c++ in game development? What about the career prospective?

sentences:
Is there a way to write a camera class without matrix-transformation? I have a problem with a camera class I got from the internet. It does a transformation like this:

public Matrix get_transformation(GraphicsDevice graphicsDevice)
    {
        _transform =
          Matrix.CreateTranslation(new Vector3(-_pos.X, -_pos.Y, 0)) *
                                     Matrix.CreateRotationZ(Rotation) *
                                     Matrix.CreateScale(new Vector3(Zoom, Zoom, 1)) *
                                     Matrix.CreateTranslation(new Vector3(ViewportWidth * 0.5f, ViewportHeight * 0.5f, 0));
        return _transform;
    }

Later the spritebatch is called like this:

spriteBatch.Begin(SpriteSortMode.BackToFront,
                    BlendState.AlphaBlend,
                    null,
                    null,
                    null,
                    null,
                    cam.get_transformation(device));

The problem is that at this point the mouse coordinates are not relative anymore to the other sprites I draw. This is a problem because I try detect which sprite has been clicked. I understand that this issue can be solved by considering the following picture:

This was posted in a very good awnser before, here. But somehow this does not really help me. So my question is:

Is there a way to create a Camera class which does not use transformation, can be moved with keys and keeps the viewport coordinates relative?

Thanks in advance!

sentences:
Throttling MonoGame actions (explosions, sounds, etc) I'm trying to find a way to deal with throttling/managing actions that need to happen on a regular (regulated) basis.

Right now, if I want to throttle an "action" in MonoGame I need to setup a "timer".

Let's say I want to spawn a bunch of explosions during the update loop, but I don't want to spam them.  I would setup a variable to track the countdown to the next time I can spawn an explosion, and another variable for the time between:

public override void Update(GameTime gameTime)
{
    // ExplosionTimer is a class variable, defaulted to 0
    // ExplosionTimerMax is a class variable set to something like 1000 milliseconds
    ExplosionTimer += elapsedGameTime;

    if (ExplosionTimer >= ExplosionTimerMax)
    {
        // Perform actions
        ExplosionSound.Play();
        SpawnExplosion();

        // Reset the timer
        ExplosionTimer = 0;
    }

    // Other update code
    ...
}

This is pretty easy to setup and straightforward, but is there a better way?  If I need to setup 5 different timers, that means I need to define 10 variables, increment them all, run checks for their state, and reset them if needed.

sentences:
What's the largest "relative" level I can make using float? Just like it was demonstrated with games like dungeon siege and KSP, a large enough level will start to have glitches because of how floating point works. You can't add 1e-20 to 1e20 without losing accuracy.

If I choose to limit the size of my level, how do I calculate the minimum speed my object can move at until it begins to be choppy ?

sentences:
unity emission map bleeds (bug?) I have a material with a spritesheet texture (albedo) and an emission map.
The spritesheet has 32x32 squares. The emission has a 32x32 square that is an emission for the magma-looking square.

It works well on the magma, however, the glow also spreads to the sand, grass, planks, and snow_grass textures. You can clearly see it spread on the sand (bottom-rightmost opaque texture) in the right because it isn't directly touching the magma. Here is another picture where it is attached

You can still see the spreading of glow if you look closely.
Now, you can definitely see it glow here

How do you stop that from happening? That artifact is really weird and i really need it to go away. I've tried decreasing the size of the square in the emission map but it still was there. Please help.

Thanks.

EDIT 1
Here is how I apply uv

`
public static Dictionary textureMap = new Dictionary();

public static void Initialize(string texturePath, Texture texture)
{
    Sprite[] sprites = Resources.LoadAll<Sprite>(texturePath);

    foreach (Sprite s in sprites)
    {
        Vector2[] uvs = new Vector2[4];
        uvs[0] = new Vector2(s.rect.xMin / texture.width, s.rect.yMin / texture.height);
        uvs[1] = new Vector2(s.rect.xMax / texture.width, s.rect.yMin / texture.height);
        uvs[2] = new Vector2(s.rect.xMin / texture.width, s.rect.yMax / texture.height);
        uvs[3] = new Vector2(s.rect.xMax / texture.width, s.rect.yMax / texture.height);
        //Debug.Log(s.name);

        if (!textureMap.ContainsKey(s.name))
        {
            textureMap.Add(s.name, uvs);
        }
    }

}

public static bool AddTextures (Block block, Direction direction, int index, Vector2[] uvs)
{
    string key = FastGetKey(block, direction);

    Vector2[] text;
    if (textureMap.TryGetValue(key, out text))
    {
        //Debug.Log(key);
        uvs[index] = text[0];
        uvs[index + 1] = text[1];
        uvs[index + 2] = text[2];
        uvs[index + 3] = text[3];
        return true;

    }

    text = textureMap["Default"];

    uvs[index] = text[0];
    uvs[index + 1] = text[1];
    uvs[index + 2] = text[2];
    uvs[index + 3] = text[3];

    return false;
}

`

Where Direction is a direction (example north) and Block is a short. Index is the vertex index of the mesh. Texture is the sprite texture (.png)

sentences:
Would Raycast suffice for a game clock based on sun position? I need help with some logic in my script. I created a dynamic day/night cycle that works fine in itself, but I want to add a game clock that works off the initial position of the sun (Directional Light).

I was thinking that it could be achieved by Shooting a ray from the directional light to the terrain and computing an angle which i would use to estimate the time.

Would ray casting be the best/ most efficient way to do this?
Is it even possible to achieve what I'm asking for, if not is there a method that better suits what I need?

So to go over.. I want the user to be able to place the sun anywhere along the x axis that would rotate around the terrain, when the user is satisfied with the position they chose, on startup of the game I would like my script to calculate the current position of the sun and then estimate the current time.

I can take care of the actual clock after that point but is ray casting from the sun to the terrain the way to go about something like this or should I be looking at this in totally different way?

sentences:
LibGDX - Rotating sprites and still keep the positioning between them I've been struggling with a problem regarding rotations and relative positions between sprites (in this case, the sprites are just lines) - a bit off-topic, but should i be using the ShapeRenderer class to do this, though?

Anyway, it might be quite simple but i can't seem to figure it out properly. Heres a picture of the situation: https://gyazo.com/78988e07991fedc778eaeb70f8a04d8e

Now, after trying a bunch of different approaches, this piece of code is the one i'm testing right now:

`   public class TestState extends AbstractGameState {

private static final String LINE = "lineEffect.png";

private Sprite[] sprites;

public TestState(GameStateManager gsm) {
    super(gsm);

    sprites = new Sprite[2];
    for (int i = 0; i < 2; i++) {
        sprites[i] = new Sprite(new Texture(LINE));
        // both lines starting at the same X and Y
        sprites[i].setPosition(20, 50);
        // both lines have the same size
        sprites[i].setSize(100, 2);
        // guess i might be messing up here
        sprites[i].setOrigin(sprites[i].getX(), sprites[i].getY());
    }

    // for testing purposes
    sprites[0].setRotation(-20);
    sprites[1].setRotation(45);
}

@Override
public void render(SpriteBatch batch) {
    batch.setProjectionMatrix(camera.combined);
    batch.begin();
    for (Sprite sprite : sprites)
        sprite.draw(batch);
    batch.end();
}`

Any help on this would be appreciated, thanks in advance.

sentences:
Does friction only apply in opposite direction of motion? Let's say an object is sliding on a slope and is the object has a velocity of (0,0,5).
The friction would be acting in the opposite direction of motiong, being (0,0,-1).
However, gravity is also affecting the object on the slope. The gravity is doing an impulse of (-1,-1,0) every frame in the direction of the slope tangent. Should the object also experience friction in the direction of (1,1,0)? Or would it only experience friction in the direction of (0,0,-1)?
I find the notion that friction always opposes the direction of motion strange, because this means that when an object is sliding downwards slightly on a slope, but not much, due to friction acting in opposite direction of gravity, when you add an impulse in a perpendicular direction, suddenly the object will be sliding downwards much more because friction is no longer resisting gravity. Is that correct?

sentences: How to make an existing Editor window floatable I added a second inspector window tab to Unity and locked it. I tried moving it to another desktop on my Mac but it doesn't move to the next desktop. How can I make a duplicate Inspector Window floatable?

sentences:
Gizmos not being drawn until GameObject selected I have implemented Scene loading in my game and have three scenes: Persistent, Main Menu and Game
By default, the player is loaded into the Persistent scene, which immediately loads the Main Menu, and when the player clicks on Play, Main Menu is unloaded and Game is loaded.
Now, the two active scenes are Persistent and Game.
However, I have a script with OnDrawGizmos on a GameObject in the Game scene. It seems that by default gizmos only begin to be drawn when I click on that GameObject, sort of activating it, and everything works fine. This used to just work before because Game was my only scene and Unity automatically selected that first GameObject. Now, with multiple scenes, no GameObject is selected by default and my gizmos won't draw until I manually click on it.
How can I solve this?

sentences:
Rotating a view of a chunked 2d tilemap I'm working on a top-down (oblique) tile-based engine. I would like for the tiles to have a definable height in the world, with Characters being occluded by them, etc.

This has led to a desire to be able to "rotate" the view of the world, even though I'm using all hand-drawn graphics and blitting.

Therefor, I need to rotate the actual world itself, or change how the Camera traverses these arrays.

How can, or should, I create individual rotations of 90 degrees, when I have multi-dimensional arrays?

Is it faster to actually rotate the array, to access it differently, or to create pre-computed accessor(?) arrays, something like how my chunks work?

How can I rotate an individual chunk, or set of chunks?

Currently I establish my tile grid like this (tile height not included):

function Surface(WIDTH, HEIGHT)
{
  WIDTH = Math.max(WIDTH-(WIDTH%TPC), TPC);
  HEIGHT = Math.max(HEIGHT-(HEIGHT%TPC), TPC);

  this.tiles = [];
  this.chunks = [];

  //Establish tiles
  for(var x = 0; x < WIDTH; x++)
  {
    var col = [],
        ch_x = Math.floor(x/TPC);

    if(!this.chunks[ch_x])
      this.chunks.push([]);

    for(var y = 0; y < HEIGHT; y++)
    {
      var tile = new Tile(x, y),
          ch_y = Math.floor(y/TPC);

      if(!this.chunks[ch_x][ch_y])
        this.chunks[ch_x].push([]);

      this.chunks[ch_x][ch_y].push(tile);

      col.push(tile);
    }

    this.tiles.push(col);
  }
};

Even some basic advice on my data struct would be much appreciated.

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:
What edition of VS is installed by Unity and what are its capabilities? My brother just installed Unity on my desktop, and it seems like it installed Visual Studio 2017 as well.

I was planning to install Visual Studio before this, so I was wondering what kind of version is this edition of VS? Is this like a bare-bones version? Does it work like a standalone version without lacking features? Can I use it just as a regular IDE to program in?

I typically program in C++, and I never used Unity before, so I'm not sure if this version of VS is only suited for Unity.

sentences:
How do I change the size and specific height values of Unity generated terrain? I'm having problems with terrain scripting while trying to do a infinite-world with Unity's terrain generation.

How do I change the terrain height at specific points? And how do I set the amount of terrain generated?

Edit: What I'm having problem with is doing that from a script, from the editor is plain easy.

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: 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:
Need some help implementing VBO's with Frustum Culling i'm currently developing my first 3D game for a school project, the game world is completely inspired by minecraft (world completely made out of cubes). I'm currently seeking to improve the performance trying to implement vertex buffer objects but i'm stuck, i already have this methods implemented: Frustum culling, only drawing exposed faces and distance culling but i have the following doubts:

I currently have about 2^24 cubes in my world, divided in 1024 chunks of 16*16*64 cubes, right now i'm doing immediate mode rendering, which works well with frustum culling, if i implement one VBO per chunk, do i have to update that VBO each time i move the camera (to update the frustum)? is there a performance hit with this?
Can i dynamically change the size of each VBO? of do i have to make each one the biggest possible size (the chunk completely filled with objects)?.
Would i have to keep each visited chunk in memory or could i efficiently remove that VBO and recreated it when needed?.

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:
How to render water reflections on multiple heights I'm making a voxel game on OpenGL, and are trying to find a way to render semi-realistic water (At least partially good looking, it doesn't need to be strictly scientific accurate).

All sources written about that topic I find seem to assume that all the water in the scene has the same height, which is not the case on a voxel game, where you can have (And see at the same time) multiple bodies of water, with different height each.

The tricky detail lies in the multi-height part of the problem, which makes really difficult to render the scene in real time using typical water reflection algorithms aimed at single level water surface.

As an example, consider the following image:

The dirt pillar at the left should be reflected on the water at its front, as so should be the mountains near the horizon. The water collindant to the pillar is ~20m higher than the general sea water, so traditional reflection methods (Considering a fixed water level) would simply not work in this case. Considering that a lot of different water levels can be seen in a single scene, performing a traditional water reflection method for each water body height is not an option if we want to achieve a acceptable frame rate execution.

How can I overcome this problem? There is any way to render it in real time?
If it isn't actually possible to do, what approximation should I take to get a good looking result, even if reflections aren't 100% realistic?

sentences:
What is the best method to share the projection matrix and view matrix with all graphic entity shaders in a custom game engine? What is the best method to share the projection matrix and view matrix with all graphic entity shaders in a custom game engine? The refer graphic entities have glUseProgram({shader_program_id}); glDrawArrays(GL_XXXX, x);

One of my ideas is to have a camera object that manages the current view and projection matrix. Then, I pass a reference of that camera object to all the entities. However, my issue with that approach is syncing the current camera across all the entities/objects when switching views.

I could make the Camera global, however, that could have many issues.

sentences:
How do I blend a bitmap with a color? I have a png which is mostly transparent, except for a shape I've drawn in white. I want to be able to blend this bitmap with a color when drawing it with Canvas. I'd like something like [Sa, (Dc * (1 - Sa)) + (Sc * C * Sa)], where C would be the color I want to blend with. I assumed I would just set the paint color to C, then call drawBitmap, but the default behavior doesn't seem to be blending.

Is this the right approach? Are there some Xfer codes I'm missing? Can I create a custom shader to do this? Is there an example in the android sdk api I missed that does this?

As an additional constraint, I should mention I want to avoid just creating a new bitmap with the blended color to use. The color C (above) could change every frame, and I don't want to have to generate 100's of these bitmaps for every color that I might need.

sentences:
Box2D and OrthographicCamera working incorrectly I'm trying to build a simple game where TileMapRenderer renders a labyrinth, a ball moves in it and camera follows it. I'm currently having the following bug:

For some reason, the game renders the world incorrectly. The gamescreen is cleared with the following method:

private void clearScreen() {
    Gdx.gl.glClearColor(1, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
}

Which is basically red, and the camera seems to show it incorrectly while moving.

Camera movement method:

public void moveCamera() {
    GameInfo.camera.position.set(player.body.getPosition().x,
            player.body.getPosition().y, 0);

    // LEFT
    if(GameInfo.camera.position.x < GameInfo.WINDOW_WIDTH / 2){
        GameInfo.camera.position.x = GameInfo.WINDOW_WIDTH / 2;
    }

    // UP
    if(GameInfo.camera.position.y > GameInfo.WORLD_HEIGHT_PIXELS / 100.0f - GameInfo.WINDOW_HEIGHT / 2) {
        GameInfo.camera.position.y = GameInfo.WORLD_HEIGHT_PIXELS / 100.0f - GameInfo.WINDOW_HEIGHT / 2;
    }

    // DOWN
    if(GameInfo.camera.position.y < GameInfo.WINDOW_HEIGHT / 2) {
        GameInfo.camera.position.y = GameInfo.WINDOW_HEIGHT / 2;
    }

    // RIGHT
    if(GameInfo.camera.position.x > GameInfo.WORLD_WIDTH_PIXELS / 100.0f - GameInfo.WINDOW_WIDTH / 2f) {
        GameInfo.camera.position.x = GameInfo.WORLD_WIDTH_PIXELS / 100.0f - GameInfo.WINDOW_WIDTH / 2f;
    }
}

As you can see, I'm using Box2D physics for the ball.

Setting up the camera:

public static OrthographicCamera camera = new OrthographicCamera();

public static void setCamera() {
    camera.setToOrtho(false, 8.0f, 4.5f);
}

Rendering method:

public void render () {
    batch.setProjectionMatrix(GameInfo.camera.combined);
    clearScreen();
    moveCamera();
    GameInfo.camera.update();
    Game.tiledMapRenderer.setView(GameInfo.camera);
    Game.tiledMapRenderer.render();
    batch.begin();
    batch.draw(player.texture,
            player.body.getPosition().x - player.radius,
            player.body.getPosition().y - player.radius,
            player.radius,                   // originX
            player.radius,                   // originY
            player.radius * 2,               // width
            player.radius * 2,               // height
            1.0f,                          // scaleX
            1.0f,                          // scaleY
            player.body.getTransform().getRotation() * MathUtils.radiansToDegrees,
            0,                             // Start drawing from x = 0
            0,                             // Start drawing from y = 0
            player.texture.getWidth(),       // End drawing x
            player.texture.getHeight(),      // End drawing y
            false,                         // flipX
            false);                        // flipY
    player.updatePlayer();
    Game.checkStateOfGame(player);
    batch.end();
    //GameInfo.doPhysicsStep(Gdx.graphics.getDeltaTime());
    Game.world.step(1/60f, 8, 3);
}

It's not only while moving either. As soon as the game starts, the red block is visible like seen in the first picture.

Also the red blocks seem to always be coming from left and down, never from up or right...

What could be wrong in here?

sentences:
Change item rotation axis in inventory item visualization I'm learning unity and i'm trying now make an inventory, i made a simple interface, and now i'm trying to make a item visualization. I look for some codes from web and i found this one:

using UnityEngine;

public class TurnObject : MonoBehaviour
{
    protected Vector3 posLastFame;
    public Camera UICam;

    // Update is called once per frame
    void Update()
    {
        if(Input.GetMouseButtonDown(0)) {
            posLastFame = Input.mousePosition;
        }

        if (Input.GetMouseButton(0)) {
            var delta = Input.mousePosition - posLastFame;
            posLastFame = Input.mousePosition;

            var axis = Quaternion.AngleAxis(-90f, Vector3.forward) * delta;
            transform.rotation = Quaternion.AngleAxis(delta.magnitude * 0.1f, axis) * transform.rotation;
        }
    }
}

I know some code, but I'm not good with geometrics. In this code when I move my mouse horizontal way, my object turn in the Y axis. And that's good. But when I move my mouse vertical the object move in the X axis instead of Z axis.

Is there a way in this code for change this? I really have difficulty to understanding geometrics in Unity.

sentences:
Opengl create tunnel TRIANGLES and texture coords on a 3d path I have a path, lets say a bezier, or a circle.

I d like to make a continously 3d cylinder (tunnel) on it (R=0.5f)

How can I calculate tha TRIangles (TRIANGLE_STRIP) coordinate, and the texture coords right?

sentences:
Whats the best way to publish and promote an app by myself? My first little casual-action android game is nearly finished. Its my first one and i dont expect any sucess. But nevertheless i want to try to publish and market it by myself.

But what can i do without any bugdet? How do i attract and reach people ? Are there any tricks ? How did you published and promoted your first app/game ? And what is your experience with self publishing/marketing ?

sentences:
Game Asset Management I am making my first small mobile game in C# XNA. Lets say I have 3 screens, the main menu, options and game screen. A single game session usually lasts for 1 min, so the user will alternate frequently between the main menu and game screen. Therefore, once I load the textures for either screen, I want to keep them in memory to avoid frequent reloading. Both screens share some assets like their background textures, but differ in others.
The first solution I came up with is making 2 texture factory classes, MainScreenAssetFactory and GameScreenAssetFactory, each with their own content manager, and ill store them in a globally accessible point so that they persist after either screen is destroyed. There is also a OptionsScreenAssetFactory, but that I dont want to cache it since the options screen is rarely visited.

A typical Factory would look something like this

public class MainScreenAssetFactory
{
    private readonly ContentManager contentManager;

    public MainScreenAssetFactory(IServiceProvider serviceProvider, string rootDirectory)
    {
        contentManager = new ContentManager(serviceProvider) { RootDirectory = rootDirectory };
    }

    public Texture2D ListElementBackground
    {
        get { return contentManager.Load<Texture2D>("UserTab"); }
    }

    public Texture2D ListElementBulletPoint
    {
        get { return contentManager.Load<Texture2D>("TabIcon"); }
    }

    public Texture2D LoggedOutUser
    {
        get { return contentManager.Load<Texture2D>("LoggedOutUser"); }
    }
}

Since both Main, Options and Game Screen share some common resources, instead of loading them more than once, I created another class CommonAssetTexFactory which holds the common stuff and stays in-memory during the app lifetime. For example, this class gets passed to the options screen when it is created.

However, given my small game with its few assets, I am already finding this solution cumbersome and inflexible. Changing anything would require looking to see if its already in the common factory, and if not, modifying existing factories and so on. And this is just considering textures currently, i didnt add sound files yet. I cant imagine bigger games with thousands of resources using this approach. A better idea must exist. Would someone please enlighten me?

sentences:
Unity : apk vs aab for the same scene I'm new to Unity , i use mac os catalina , unity 2019.4 and build for android/mobile.
I downloaded a unity project from internet. It's already in format of unity project. so i just copy it into my unity folder. THere's only 1 scene there. I can load , run and built with no problem. It created 160mb of .APK file. But now i need to bring this project into my other project (let's name it B project ). Basically i only need to bring that single scene (and all its linked assets) into that B project. What is the proper way to do this ?
Last time, what i did was: i export the whole things as package then imported it into my B project. When i open the scene  , i can run and build with no problem. But it create .AAB rather than .APK and size is 300mb (2x of the previous APK). Is this big size become the reason it become AAB ?
Can someone tell me what's wrong ? why the size is doubled when i just build the same scene. Does unity build includes unused asset ? because in B project there's already asset from my other scenes. What is the proper way to do this ?

sentences:
Unity augmented reality app doesn't work on android I am pretty new to unity and augmented reality applications. I use unity 2019.4.4f1 and my project is very simple as you can see in the screenshot below:

I am using Wikitude plugin for image tracking and the image i am using as the marker is the Jack of Clubs card as you can see in the assets. The project works fine when i press play and use my laptop's webcam , but when i build the project for android (unity 2019 automatically uses Gradle to build the project) and install the .apk file in my android phone, all i see on my phone screen when i open the application is:

As you can see the phone camera doesn't work and it gets stuck in this screen. How should i fix it? Does it have to do something with Gradle? I haven't tried using unity version 2018 to build it using the "Internal" build option. Anyways that's just my own thought and i might be wrong, but the final question remains which is how this problem can be fixed?
By the way i don't build the .apk file directly from the unity engine. I use the export option in unity to get a gradle project folder then i use that in Android Studio to build the final .apk file. The reason that i don't use unity to build .apk is that it gives errors and doesn't work for me so this is the solution i found for it.
Update: I debugged the application and it seems that the application needs camera permission to work, this is my debugging log:
07-22 17:47:16.908: E/Unity(32483): On Camera Error
07-22 17:47:16.908: E/Unity(32483):         Error Code: 1000
07-22 17:47:16.908: E/Unity(32483):         Error Domain: com.wikitude.camera.android
07-22 17:47:16.908: E/Unity(32483):         Error Message: Permission denied. Make sure to have camera permissions before trying to access the camera.
07-22 17:47:16.908: E/Unity(32483):
07-22 17:47:16.908: E/Unity(32483): (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)

I'm pretty sure that it didn't ask for camera permission, how should i allow the permission if it's not asking?

sentences:
Magnitude of a vector in Generalized Balanced Ternary? Generalized Balanced Ternary is a fairly obscure but very elegant method of indexing a hex grid, using only a single integer coordinate. Operations like addition and multiplication on these coordinates have intuitive effects: translation and rotation respectively.

The only difficulty with GBT is calculating the magnitude of a vector given its coordinate, or alternatively, of decomposing it into a series of one-unit steps. Is there a standard method of doing this?

sentences:
Level Modeling Workflows in Maya for Unity I'm wondering what the standard workflow for modeling static levels for Unity (or for that matter, other High-Level engines) is? My somewhat limited knowledge tells me that the best process is modeling the entire static level in Maya, texturing, then baking AO and some static lighting into the scene, then importing the single level asset into unity to add dynamic objects.

Is there another way that I should be doing this that is more efficient in a performance sense or from a workflow point of view?

I know the question is somewhat open ended, but generally i'm asking what the standard workflow for level modeling is.

Thanks!

sentences:
What is the purpose for drawing vertices and shapes in OpenGL (or DX), if a game is using sprites? Something I do not understand.  All the tutorials on OpenGL, DirectX, or other, always show you how to draw a shape and then change its vertices, move it around and so on.  But all the games I know of, tutorials on creating, etc., always have sprites and sprites alone.

What is the reason for drawing triangles and squares for games?  I never see it used, only pre-made graphics.

edit:  based upon answers so far, is the purpose of drawing shapes to "bound" a sprite?  So if I have a character, on a platformer like Mario, Mario has a shape around him and that shape's location is used to detect collisions, etc.?

edit:  Maybe a small example?

sentences:
What common spritesheet formats for 2D Top-Downish Games are there? For 2D top-down style sprites, what commonly used spritesheet formats are available?

By a sprite sheet format, I mean this: for any RPG Maker sprite sheet, you can count on all the walk animations being in the same place on the image between characters. For Final Fantasy 6's characters, you could open all their sprite sheets and compare them and in each one, the walk animations, crouching sprites, surprised sprites, etc would all be in the same places. They all adhere to a standard.

I'm using RPG Maker XP right now and it defines character tilesets as having four states -- facing up, down, left, and right, each with animation. This is really restrictive, and I'd rather have more options like Final Fantasy 6.

So are there any more common sprite sheet formats out there that I can use?

sentences:
Problem importing Blender materials into Unity via FBX I've created a simply low poly house in Blender (2.92) that I have imported into Unity as an FBX. Materials (simple colours) are all set up in Blender.
Initially this was all working fine. Colours all came across correctly (bit dark, but they always seem to do that), but now all of a sudden I am finding that in some cases the material for object A is applied to object B and the material for B applied to A, and so on. Most are fine, but not all (eg the window frames - meant to be white, are coming out dark wood, and the sills - meant to be dark wood, are coming out white.
The only thing that appears to have changed between working OK, and not working, is that I started to apply different colours to different faces of the walls for different rooms. However, the walls themselves are fine, all the right colours in the right places, it is just some other bits as above - and those bits were previously OK.
I've read there are issues in importing complex textures from Blender, but these are nothing complicated, just plain colours. Everything looks fine in Blender. What I do before creating the FBX is join most of the objects together in Blender with CTRL-J to minimise the number of objects going across, but again, this was all fine up to now.
I'd be grateful for any suggestions. I don't really want to have to reapply all material in Unity if I can avoid it.
UPDATE:
Having exported all the objects separately, the wrong ones actually have the wrong material assigned. For instance a window frame has material WindowSill assigned. It is the right colour for WindowSill - it just isn't meant to be that material at all, it is meant to be WindowFrame, and in Blender, that is what shows up as assigned.

sentences:
How can I dynamically switch between graphics APIs? In games like the new "Doom", you have a console, from which you can use commands to reduce the game's quality or even to switch graphics API, from Opengl to Vulkan and viceversa.

How is this done? I think it reconstructs the window context based on the chosen graphics API (maybe?). How could this be implemented?

sentences:
Java vs Javascript for Web-based games With all the recent interest in developing HTML5 apps and games, and I am curious why all the focus is on Javascript, and not on Java.

Minecraft is a great example of what can be accomplished in a browser, and it's written in Java, not JS. I doubt if it is even possible/practical to attempt such a complex project in JS.

Java is clearly a more powerful platform, and it probably runs significantly faster (this is just my guess, though). About the only drawback of Java I can think of is that it runs as a plugin, and with the trend towards plugin-free browsers (e.g. IE10 metro) Java applets may become obsolete in mobile environments. This has already happened with Flash on iOS.

What do you think? Is there a future in developing Java-based Web apps (especially for mobile devices)?

Thanks

sentences:
box2dlights confuses ScreenUtils for screenshots in libGDX I take screenshots as usual in libGDX via ScreenUtils.getFrameBufferPixmap(), which works fine. Hoever, when I call RayHandler.updateAndRender() during rendering, then the screenshot only contains those assets rendered after this call. All other pixels in the screenshot are transparent.

What is the best way to deal with this issue?

sentences:
When is transform width in code not equal to the transform width in inspector? I've come across a strange case in Unity's UI where the width of a RectTransform isn't the same as what is being reported. I have a transform which is 50 by 50 with no scaling, it is a root object of the canvas yet when I use the information that I get from the transform in code to draw from the bottom left edge of the transform to the top right it doesn't reach all the way!

Gizmos.color = Color.red;
Vector2 pos = new Vector2(transform.position.x, transform.position.y);
Gizmos.DrawLine(pos - transform.sizeDelta, pos + transform.sizeDelta);

Vector3[] corners = new Vector3[4];
transform.GetWorldCorners(corners);

Gizmos.color = Color.magenta;
Gizmos.DrawLine(corners[3], corners[0]);
Gizmos.DrawLine(corners[0], corners[1]);
Gizmos.DrawLine(corners[1], corners[2]);
Gizmos.DrawLine(corners[2], corners[3]);

The first section should draw a line from the bottom left to the top right according to what the transform reports are the width and height however they don't reach across the entire transform. Using GetWorldCorners the actual corners can be found and drawn around, with that data you can extract that the actual width is 60 (150.2 - 30.2 = 120 / 2 = 60)!

Why? Is this a bug or an I missing something obvious here?

sentences:
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:
All Pairs Shortest Paths in Weighted Undirected Graph I'm currently working on path-finding for my game and need help with finding an efficient algorithm to calculating the all-pairs shortest paths in a weighted undirected graph (each vertex in the graph represents a way-point on my map, and each edge represents the distance between pairs of way-points).

I have considered using Floyd's Algorithm due to its simplicity and relative memory efficiency, but Floyd was designed for a directed graph, whereas my graph is undirected. This means that Floyd's algorithm is rather more expensive than required given that I know that the shortest path from vertex A to vertex B is always identical to the shortest path from B to A.

Can Floyd's algorithm be optimized to deal with this duplication? Or is there an alternative algorithm fast/space efficient algorithm that I could use to solve the same problem?

sentences:
Splitting Graph into distinct polygons in O(E) complexity If you have seen my last question:
trapped inside a Graph : Find paths along edges that do not cross any edges

How do you split an entire graph into distinct shapes 'trapped' inside the graph(like the ones described in my last question) with good complexity?

Please note each vertex has a fixed x,y position.

What I am doing now is iterating over all edges and then starting to traverse while always taking the rightmost turn. This does split the graph into distinct shapes. Then I eliminate all the excess shapes (that are repeats of previous shapes) and return the result.

The complexity of this algorithm is O(E2). I am wondering if I could do it in O(E) by removing edges I already traversed previously. My current implementation of that returns unexpected results.

sentences:
Box2D - Platformer tiled map problem I'm using C++, Box2D and SFML.

I convert a Tiled map to world in my platformer game and I get stuck when I go against a block when I go forward like that :

I can use a circle as foot of my character but sometime, it make me jump a bit. Is there a solution or I must only do shape ?

sentences:
Is it ok to use NPOT textures with OpenGL in this situation? I drew some icons to use on orthographic projection and instead of loading each icon file individually as a texture I thought of putting them all together in one single file. Now I have a file 72x36 which is not a power of two. This texture is divide in two icons, both with 36px wide.

I didn't remember about this restriction when designing the texture but I eventually noticed it when the texture didn't load because I have an if statement checking if the texture is a power of two, if it's not, than the texture is not loaded. I commented that code to see if the texture loaded anyway and it did. The texture was loaded and properly applied to the area I wanted.

To draw the first icon I do this:

glBindTexture(GL_TEXTURE_2D, gameTextures.hudKeys);
glBegin(GL_QUADS);
    glTexCoord2f(0, 0); glVertex2f(0, 36);
    glTexCoord2f(0.5, 0); glVertex2f(36, 36);
    glTexCoord2f(0.5, 1); glVertex2f(36, 0);
    glTexCoord2f(0, 1); glVertex2f(0, 0);
glEnd();

And for the second this:

glBindTexture(GL_TEXTURE_2D, gameTextures.hudKeys);
glBegin(GL_QUADS);
    glTexCoord2f(0.5, 0); glVertex2f(0, 36);
    glTexCoord2f(1, 0); glVertex2f(36, 36);
    glTexCoord2f(1, 1); glVertex2f(36, 0);
    glTexCoord2f(0.5, 1); glVertex2f(0, 0);
glEnd();

Which is easy to understand, I only use half of the texture depending on which icon I want.

I don't want my icons to be distorted or stretched, the icons were designed with 36x36 in mind. If I use a power of 2 texture, for instance 128x64 (that's the lowest possible to fit a 72x36 texture), how do I properly map the 36x36 texture area I want to the quad?

Or maybe I can keep doing using this NPOT texture or should I still really create a power of 2 texture? How to fix the problem above then?

sentences:
The importance of WebGL in the future of game development I've recently stumbled upon some pretty impressive Babylon.js and PlayCanvas demos.

Babylon.js example
PlayCanvas example

As a reminder: these frameworks allow 3D rendering in any (up to date) web browser, using the WebGL library.

Along with node.js and Socket.io, those 3D engines make it possible to release real-time multiplayer 3D games.

For sure, such games will never compare to AAA titles running in more native environnments.
But a part of today's video game industry is leaning towards more simple, accessible games. Think about strategy games or (MMO)RPGs for example (or anything that doesn't require very low latency and high reactivity, like FPS do). Those Javascript libraries could do a pretty good job at it.

In addition, they make it easy to create multiplatform games, since any modern device with a web browser can run your game.

Another advantage is the "one click" accessibility (i.e. someone sends you an url -> you click on it -> you're playing the game), which can be a crucial advantage to spread your game.

I've seen some Unity games which could have been made in WebGL with only little drop in performances and visual quality (though I may be wrong here). And they could have benefited a lot from being playable in web browsers.

I'm actually surprised that we haven't already heard of some massively played 3D Web game. Why is it so? Do you think it will change in the future?

Even if one wants to argue that web-games aren't mature enough for 3D, then what about 2D? So many people are using engines such as Unity or Unreal 4 for relatively "simple" 2D games, while they could have made something totally similar with today's javascript, and potentially reached a wider audience.

sentences:
How to merge Sorting Layers in Unity? I have two unity3d projects, both are using sprite renderers and sorting layers.
Project 1 has Following Sorting Layers:

Default
Tile Map
Items
Animals
UI
Particles

Project 2 has Following Sorting Layers:

Default
Background
Slots
Chips
Foreground
Map
UI

Project 1 is my main project. I need to merge these both projects. I created new layers in project 1 and then imported project 2 but sorting layers of project 2 are broken .Setting each layer again in project 2 is very difficult task and rework. How can i merge these two project without breaking any sorting layer or tags ?

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:
I add a straight big plane over terrain(3d). Vibrations are happening when i move camera I have this problem in my OpenGL project but i will show you the same thing over blender3d with video. So I believe that I will better explain the problem. it is just 30 seconds. Take a look.  Youtube LINK
How can i fix these problem ?

sentences:
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:
Linker error while trying to extend and recompile irrlicht I am trying to create a custom IGUIElement in irrlicht, for that I have included the sources from irrlicht and extended the CIGUIStatictext class.
Now whenever I try to compile my project, I get a host of linker errors, I must admit to ignorance of the compilation process and am not really able to figure out why this is happening.
I'm including the source for both my header and cpp class as pastebin.

sample of the linker errors:

1>graphNode.obj : error LNK2019: unresolved external symbol "public: virtual__thiscall irr::gui::CGUIStaticText::~CGUIStaticText(void)" (??1CGUIStaticText@gui@irr@@UAE@XZ) referenced in function__unwindfunclet$??
    0graphNode@gui@irr@@QAE@PAVIGUIEnvironment@12@PAVIGUIElement@12@HV?$rect@H@core@2@PB_W@Z$0 1>graphNode.obj : error LNK2019: unresolved external symbol "public:__thiscall irr::gui::CGUIStaticText::CGUIStaticText
    (wchar_t const *,bool,class irr::gui::IGUIEnvironment *,class irr::gui::IGUIElement *,int,class irr::core::rect<int> const &,bool)" (??0CGUIStaticText@gui@irr@@QAE@PB_W_NPAVIGUIEnvironment@12@PAVIGUIElement@12@
    HABV?$rect@H@core@2@1@Z) referenced in function "public: __thiscall irr::gui::graphNode::graphNode(class irr::gui::IGUIEnvironment *,class irr::gui::IGUIElement *,int,class irr::core::rect<int>,wchar_t const*)"
    (??0graphNode@gui@irr@@QAE@PAVIGUIEnvironment@12@PAVIGUIElement@12@HV?$rect@H@core@2@PB_W@Z)

1>graphNode.obj : error LNK2001: unresolved external symbol "public: virtual bool__thiscall irr::gui::graphNode::OnEvent(struct irr::SEvent const &)" (?OnEvent@graphNode@gui@irr@@UAE_NABUSEvent@3@@Z)
1>graphNode.obj : error LNK2001: unresolved external symbol "public: virtual void__thiscall irr::gui::CGUIStaticText::updateAbsolutePosition(void)" (?updateAbsolutePosition@CGUIStaticText@gui@irr@@UAEXXZ)
1>graphNode.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall irr::gui::CGUIStaticText::draw(void)" (?draw@CGUIStaticText@gui@irr@@UAEXXZ)
1>graphNode.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall irr::gui::CGUIStaticText::setText(wchar_t const *)" (?setText@CGUIStaticText@gui@irr@@UAEXPB_W@Z)

sentences:
How I can advertise my browser game I developed a browser-based game. It's a Multiplayer Business Strategy Game. Currently I am unable to find a place where I can advertise my game. My main requirements are :

I can only pay via Credit Card. No Paypal. Just tell me which ad company accepts credit cards.
I also have quite a limited budget.

Also, I want to know is their is any rating / review website for my type of game?

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:
How do I do 3d collisions in isometric game? I've wondered how to get basic collision detection working in an isometric game. I'm using panda3d which has very comfortable support for bullet, ode and a small builtin physics framework. The problem is that these naturally don't work with flat images. I'm using dynamically generated quads as canvases in the 3d coordinate system. Every image or texture is mapped on one of these. The idea is to create tiles with images and place them in 3 dimensions to let panda3d do the rendering.

In order to place a tree on the screen I would generate one of the dynamic flat quads and map a texture with an image of the tree on it. Then I would move the quad to the desired position and everything's fine. Panda3d manages the correct rendering order.

Up to now the player object simply walks through the environment. I need to implement basic collision detection in order to solidify the trees. Browsing through previous questions I've found this one How do I handle Isometric collision detection? Unfortunately the question only targeted collisions to prevent the player from falling through the ground and allowing him to jump on platforms. This can be done comfortably with panda3d's builtin physics.

Here's a picture to show you what I want:

The ground itself is composed of a 10x10 grid of tiles. I've used the same texture for all of them. The tree is not a sprite that's rendered in 2d. It's actually a flat rectangle with a partially transparent tree texture. The white rectangle is my player object. With the standard 3d physics I could prevent the player from walking through the quad but the tree would still be perfectly flat. I thought about adding a "dummy mesh" to have 3d collisions but that would surely come pricey in terms of performance and would spoil the neat implementation of my 3d canvases.

Is there a canonical way to get 3d collisions in an isometric game ?

How would you do this ? Please answer this second question on behalf of panda3d.

I know that this is probably rather complicated. A link to a good article would be perfect. If you want to have a look at my code, you might want to read this question: How do I use setFilmSize in panda3d to achieve the correct view?

UPDATE:

Here's another picture that might depict the problem better

sentences:
Exporting scene during gameplay to FBX In Unity is there a way to add a menu button during gameplay that allows the player to export the current scene as an fbx file?
My googling and research shows that its possible to do this while developing the game but wondering if there is a way to add this functionality for the gameplay itself.
Any suggestions on how/if this can be done?

sentences:
add random walls with an array in 3D xna 4 I'm trying to add walls to my 3D game. I created a wall entity and added model array

public Walls()
{
  modelArray = new Model[10];
}

public void Initialize(ContentManager contentManager)
{
  for (int i = 0; i < modelArray.Length; i++)
  {
    rnd = new Random();
    sidesWall = rnd.Next(-4, 4);
    forwardWall = rnd.Next(-8, 0);
    modelArray[i] = contentManager.Load<Model>("wall");
  }
}

Draw method:

public void Draw(Camera camera)
{
  foreach (Model m in modelArray)
  {
    foreach (ModelMesh mesh in m.Meshes)
    {
      foreach (BasicEffect effect in mesh.Effects)
      {
        effect.EnableDefaultLighting();
        effect.PreferPerPixelLighting = true;
        effect.World = GetWorldMatrix();
        effect.View = camera.ViewMatrix;
        effect.Projection = camera.ProjectionMatrix;
      }

      mesh.Draw();
    }
  }
}

It doesn't work and it shows only one wall.

How can I make it work?

sentences:
Why won't my sprite move with this code? When I ran the android application, The sprite image will not move when I press the input keys. I followed a tutorial based on input keys and wish to know what's wrong. Can anyone see what's wrong? Not sure if its my android emulator.

EDIT: website where the tutorial is located http://www.gamefromscratch.com/post/2013/10/15/LibGDX-Tutorial-4-Handling-the-mouse-and-keyboard.aspx

import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Animation;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;

public class otherSide implements ApplicationListener
{
    private SpriteBatch batch;
    private TextureAtlas textureAtlas;
    private Texture texture;
    private Sprite sprite;
    private Animation animation;
    private float elapsedTime = 0;

    @Override
    public void create()
    {
        float h = Gdx.graphics.getHeight();
        float w = Gdx.graphics.getWidth();

        batch = new SpriteBatch();
        texture = new Texture(Gdx.files.internal("image.png"));

        sprite = new Sprite(texture);
        sprite.setPosition(w/2-sprite.getWidth()/2, h/2 - sprite.getHeight()/2);
        //textureAtlas = new TextureAtlas(Gdx.files.internal("spritesheet.atlas"));
        //animation = new Animation(1/15f, textureAtlas.getRegions());
    }

    @Override
    public void resize(int width, int height)
    {

    }

    @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_RIGHT))
            {
                sprite.translateX(1f);
            }else
            {
                sprite.translateX(10.0f);
            }
        }

        batch.begin();
        //elapsedTime += Gdx.graphics.getDeltaTime();
        //batch.draw(animation.getKeyFrame(elapsedTime, true), 0, 0);
        sprite.draw(batch);
        batch.end();

    }

    @Override
    public void pause() {

    }

    @Override
    public void resume() {

    }

    @Override
    public void dispose()
    {
        batch.dispose();
        texture.dispose();

    }
}

sentences:
Listen for asset modification in editor I would like to listen for an event that some asset (prefab, precisely) has been modified. To my surprise, there's no such event in AssetModificationProcessor.

Is there any way to do this in Unity?

sentences:
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:
Is speed runs ranking mechanism heuristic or statistics based? I'm looking to implement some sort of speed run mode in my game.

Let's say I want to assign each level three 'winning' bars, (bronze, silver and gold for example), which are independent of the player, and are based only on the difficulty of the level itself.

I can think of two methods:

Having a heuristic which outputs these three bars, given the level's settings.
Spending some time for testing the game over several players, and collecting statistics (mainly time to completion), in order to determine the bars.

Are both methods considered acceptable? Or is one of them is somewhat "banned"?

I would also like to consider a more limited situation, where there's not a real option to perform a wide-scale statistics collection. Would that completely throw the second method off the windows? Or is small-scaled (for example, having 5-10 players playing a level for a few times) is usually enough in common indie game developer scales?

I guess the answer here should depend on the nature of the game itself, but I wonder if this certain type of test ('winning bars' for speed runs) is considered easy to handle.

sentences:
Xna c# picking model with Ray mouse cursor select the wrong model i made a small 3D game and i just try to apply a basic sample from here : http://rbwhitaker.wikidot.com/picking
for picking model by the mouse cursor.
For that i use the Ray object and check if some model intersect my Ray.
But i don't know why, the model object target by my cursor is always offset to the left.there is a shift difference.

Here is the code i use.

// Update Ray cursor each frame in the Update loop function

public void UpdateRayCursor()
        {
            Vector3 nearPoint = new Vector3(Globals.mouseState.Position.ToVector2(), 0);
            Vector3 farPoint = new Vector3(Globals.mouseState.Position.ToVector2(), 1);

            nearPoint = graphic.GraphicsDevice.Viewport.Unproject(nearPoint, CameraNode.Camera.Projection, (Matrix)CameraNode.View, Matrix.Identity);
            farPoint = graphic.GraphicsDevice.Viewport.Unproject(farPoint, CameraNode.Camera.Projection, (Matrix)CameraNode.View, Matrix.Identity);

            Vector3 direction = farPoint - nearPoint;
            direction.Normalize();

            Ray = new Microsoft.Xna.Framework.Ray(
                nearPoint
                ,
                direction
                );
        }

// check if a model is target by the Ray

public void UpdateIntersectSceneRay()
    {
        float? nearestDistance = 0f;
        bool findModelTarget = false;
        foreach (var bdgToCheck in ListBlocksSelectable)
        {
            //Check if the boundingBox intersect with the ray
            var checkIntersectDistance = _mainPlayer.Ray.Intersects(bdgToCheck);
            if (checkIntersectDistance != null)
            {
                if ((float)checkIntersectDistance < (float)nearestDistance || nearestDistance == 0)
                {
                    nearestDistance = checkIntersectDistance;
                    _mainPlayer.ItemFocusByReticle = item;
                    findModelTarget = true;
                }
            }
        }
        if(!findModelTarget)
        {
            _mainPlayer.ItemFocusByReticle = null;
        }

    }

Some people have some idea why ? i use monogame library with XNA.
Thank you in advance

sentences:
Gyroscope Parallax Effect In Unity I want to make a parallax effect in Unity 3D with gyroscope like the one on this site:
http://matthew.wagerfield.com/parallax/

I found an asset, but it is too expensive.

So I need a script which I can set to the GameObject, so it would move depending phone's gyroscope.

sentences:
Bitmap Font Displays in Center Always Without Coding it Manually (Fix Coordinate Problem onText) Is there a way on how to stay the texts in center without manually coding it or something, especially when making an update? I'm making a display for the highest score. Let's say that the score is 9. However, if the score is 9,999,999, the text displays still only at the fixed X and Y coordinate. Is there really a way to stay the text in center especially when there is changes when a player beats the new world record?

Here's my code inside Sprite Batch:

        font.setScale(1.5f);
        font.draw(batch, "HIGHEST SCORE:", (900/10)*1 + 60, (1280/16)*10);
        font.draw(batch, "" + 9999999 + "", (900/10)*4, (1280/16)*8);

        batch.draw(grid_guide, 0, 0, 900, 1280); // --> For testing purpose only.

        // Where 9999999 is a new record score for example.

Here's the image shown as example. I add it some red grid so that I could check if the display of score when updated will always display on center no matter how many digits takes place in. However, it is fixed, so I have to figure it out how to display it automatically on center regardless of the number of digits while updating for the new highscore. I have used the LibGDX preferences very well though to save and load records for the highscore.

sentences:
Build pipleine between 2 points take rotation into account Given a start point and start rotation and end point and end rotation, how can i find a path from start to end, that takes rotation into account and moves only on the axis. I currently have a code that can handle straight line and a L turn. I want it to be able to handle also S or U turn (like on this image), but i cant figure out how to do it. Below is my current code for handling the pipleine building.
How do different games handle that? Like satisfactory fluid pipes on vertical mode.
 Vector3 endPos = endPosition;
        Vector3 startPos = startPosition;
        Vector3 dir = startRotation * Vector3.forward;
        Vector3 diff = endPos - startPos;

        Conveior prev = startTarget;
        int dist1 = Mathf.RoundToInt(Vector3.Scale(diff, dir).magnitude);

        BuildStraight(dist1, ref startPos, dir, startRotation, ref prev);
        Vector3 endDir = endRotation * Vector3.forward;
        GameObject temp;
        if (dir != endDir)
        {
            temp = GameObject.Instantiate(turnRight, startPos, Quaternion.AngleAxis(Vector3.Angle(prev.transform.right, endDir), dir) * startRotation);
        }
        else
        {
            temp = GameObject.Instantiate(straight, startPos, startRotation);
        }
        temp.GetComponent<RaycastController>().dontIgnoreRaycast();
        temp.transform.Find("DirectionGuides").gameObject.SetActive(false);
        Conveior t = temp.GetComponent<Conveior>();
        if (prev != null)
        {
            prev.SetNext(t);
        }
        prev = t;

        diff = endPos - startPos;
        int dist2 = Mathf.RoundToInt(Vector3.Scale(diff, endDir).magnitude);
        startPos += endDir;

        BuildStraight(dist2, ref startPos, endDir, endRotation, ref prev);
        if (endTarget)
        {
            prev.SetNext(endTarget);
        }

    private void BuildStraight(int distance, ref Vector3 startPos, Vector3 dir, Quaternion rotation, ref Conveior prev)
{
    for (int i = 0; i < distance; i++, startPos += dir)
    {
        GameObject go = GameObject.Instantiate(straight, startPos, rotation);
        go.GetComponent<RaycastController>().dontIgnoreRaycast();
        go.transform.Find("DirectionGuides").gameObject.SetActive(false);
        Conveior c = go.GetComponent<Conveior>();
        if (prev != null)
        {
            prev.SetNext(c);
        }
        prev = c;
    }
}

sentences:
Using Chromosomes to Go from Input to Output in Genetic Algorithms Lately I've developed an interest in AI and genetic algorithms. Specifically, AI that learns to do something completely on its own. For example, play a video game. I've seen AIs that start out playing the game with no knowledge of what any of the buttons do, the only information they are given is their position, velocity, and the solid tiles and entities near them. Eventually the AI learns to run and jump. Later on, it learns to avoid enemies.

I mostly understand how genetic algorithms work, but there is one thing I really don't get. The chromosome is basically the instructions for the AI, right? My question is, how do you use the chromosome of the AI to go from the inputs(the AI's position, velocity, nearby tiles/enemies) to the outputs(button presses)? I think this is called neural networks, but after researching for an hour or so I didn't really understand the concept. Is the answer to my question just a bunch of "if" statements?

if(enemyNear)
{
    if(chromosomeContents[0]==1)
        jump();
    else
        keepRunning();
}

That seems like it would be redundant, since you would have to manually program in all of the best solutions, right? I'm not sure; I feel like I'm missing something really obvious here. If anyone could explain this to me, that would be fantastic. :D
(Sorry if my explanation was confusing. I tried to explain the best I could.)

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:
On a 2D generated terrain what is the easiest way to pick tiles for the shoreline? If I have a two-dimensional array with ones and zeros for water and land respectively how do I choose what shoreline tile to use according to the water and land tiles surrounding it? The shoreline can form straight lines, outside corners and inside corners and there are four possible orientations for all of them. I have all the necessary tiles in the sprite sheet numbered. I want it to look similar to the shoreline in Age of Empires 2.

I could come up with a way to do this by comparing the eight surrounding tiles but this quickly became a mess as there are a lot of different possible combinations to take into account and manually assessing all of them with if statements seemed very unpractical and I'm quite sure there is a more elegant way of doing this. (I'm making this game with Slick2D)

sentences:
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 to create a spiral brightness gradient I am stuck on creating a brightness gradient that looks as below(the values are continuous from the inner circle). What formulae can create such brightness gradient? So that when _Time is added to it, it will slowly brighten up from the inner circle in a spiral form?

Tried a long time to modify from codes below but fail.
Shader "Unlit/testDisplay"
    {
      Properties
     {
        _MainTex ("Texture", 2D) = "white" {}
     }
    SubShader
    {
    // Render with transparent objects, after the opaque pass.
    Tags { "RenderType"="Transparent" "Queue"="Transparent"}
    LOD 100

    // Don't write to the depth buffer.
    ZWrite Off
    // Additive blending (add light/glow).
    Blend One One

    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 = UnityObjectToClipPos(v.vertex);
            // Shift our texture coordinates so 0 is in the center,
            // and we go to -2 ... +2 at the edges.
            o.uv = (v.uv -0.5f) *4.0f;
            return o;
        }

        fixed4 frag (v2f i) : SV_Target
        {
            //Define boundary value for radius
            float radius=length(i.uv);
           radius = radius - (radius % 0.5) + 0.5;

            //convert to polar coordinates
            float angle=atan2(i.uv.y,i.uv.x);
            float angle1=frac(angle/(2*3.142f));
            float result=-4*radius+angle1+13*frac(_Time.x);
            return result;

        }
        ENDCG
    }
}
}
```

sentences:
LibGDX: How to make an object falls with random speed I'm trying to make an object (ball) fall into position Y and when the ball collides with the base. The sprite changes and along with the change I want the speed of the fall to change according to the sprite

public void create () {
    circleBall = new Circle();
    rectangleBase = new Rectangle();
    ball = new Texture("ball.png");
}

public void render () {
    spriteBatch.begin();
    fallBall();
    rand();
    spriteBatch.end();
}

void fallBall(){
    fallSpeed++;
    if(posYBall > 0){
        posYBall -= fallSpeed * 2 / 2;
    }
}

void rand(){
    int rand1 = random.nextInt(15 - 1) + 1;
    int rand2 = random.nextInt(10 - 1) + 1;
    int rand3 = random.nextInt((55 - 35) + 1) + 35;
    collisionBallBase(rand1, rand2, rand3);
}

void collisionBallBase(int rand1, int rand2, int rand3){
    if(Intersector.overlaps(circleBall, rectangleBase)){
        if(rand1 <= 5){
            ball = new Texture("ball.png");
        }else if(rand1 <= 10){
            ball = new Texture("ballb.png");
        }else{
            ball = new Texture("ballc.png");
        }

        if(rand2 >= 5){
            ballDirection = 4;
        }else{
            ballDirection = -4;
        }
        fallSpeed = -rand3;
    }
}

sentences:
OpenGL ES Faces appear to be transparent when alpha is 1.0? I am working on an object (OBJ File) loader for my app on iOS, currently I have successfully read the vertices and the faces of the object, and I am now just adding colours to the imported models.

I am coming across a major problem now. Out of a cube with six faces, all coloured red apart from two opposite faces which are coloured blue. This cube is set to rotate so I can see all sides, but the colours do not appear correctly as shown in the video below:

http://youtu.be/0L2AIFkd2Qk

The blue faces only shows when the two blue sections overlap, I cannot figure out why - I am used to OpenGL for PC, is there something I am missing which is causing this strange colouring?

The colouring is achieved by sending a large float array of the format RGBA RGBA RGBA etc for each vertex;

// colours is the name of the array of floats
glColorPointer(colorStride, GL_FLOAT, 0, colors);
glEnableClientState(GL_COLOR_ARRAY);
glDrawArrays(renderStyle, 0, vertexCount);

Any help you can offer would be great,

[EDIT]

Even if you don't know the problem, but have seen this before and know what it may be that would help as I have no idea where to even start looking as it is!

Many thanks

sentences:
How to make my sprite jump in pygame? I wonder how to make a sprite jump in pygame! Can anybody explain if possible?
Thank you!

sentences:
Examples of Android Joystick Controls? I can't seem to find any well executed code examples for Android joystick controls.

Whatever it may be, algorithms, pseudo code, actual code examples, strategies, or anything to assist with the design and implementation of Android joystick controls; I can't seem to find anything decent on the net.

What are some well executed examples?

More specifically,

Pseudo Code
Current Examples
Idea/Design
Functionality Description
Controller Hints Related Directly to Android Architecture

What kind of classes will I have making this? Will there be only one? How would this be implemented to the game architecture? All things I am thinking about.

Cheers!

UPDATE

I've found this on the subject Joystick Example1, though I am still looking for different examples/resources.
Answered my own question with a link to the code of the above video. It's a fantastic start to Android Joystick Controls.

sentences:
Unity3D Tag as a public variable in editor How do you incorporate Tag strings into a scripts editor found in the inspector?

What it is I'm babbling about: When you create a public GameObject fooObject in a script, it shows up as a box that can have Game Objects dragged onto in its editor. It also has a small clickable dot that shows every Game Object that could be selected.

Now, say I have a public string fooString that would specifically be used for referencing the Tag strings of Game Objects (such as if (fooObject.tag == fooTag) or another use). Is there a way to define that string so that in the script's editor it strictly allows tag names to be used with it? I'm assuming with a similar clickable dot or a drop down menu of every selectable tag.

Although I could just manually type my string, a solution like the one above would have big object-orientated advantages. For example, if I was to change the name of this tag, it would change the string variable accordingly, as if the variable was a reference to such tag.

[Note to the moderators: I looked for an answer to this question for nearly 2 hours now to no avail. I understand that I may be missing some specific wrong word choice, in which case this question easily could have already been answered here. If this is closed as a duplicate, then, a quick comment explaining my mistake would be greatly appreciated.]

sentences:
What are the practical limitations of using XNA? Since development on XNA has long since stopped, it is unlikely that it will ever be updated to be in line with modern graphics technology, however aside from the obvious fact that it's Windows-only - what are the practical limitations of using XNA?

The obvious ones are:

It uses DirectX 9.0 - which means no compute or geometry shaders.
It's Windows-only (Excluding Monogame/FNA)
It requires the installation of .NET and XNA on a client's computer.

#2 and #3 are obvious limitations, but can be considered acceptable. #1 on the other hand, is a bit more complicated. In practical terms what does being limited to DirectX 9.0 mean in terms of game development and graphical capability? No geometry or compute shaders means having to do more heavy lifting on the CPU, but is there any other limitations that an end user would notice? Ideally beyond a generic term such as "graphical fidelity".

sentences:
andEngine dynamic sprites Ive just started with andEngine the past week and i only started learning java/android 3 weeks.

I can use a for loop to add multiple sprites to the screen but when i try to check collisions on them it only does it to one and not the rest.

I want to be able to add a specific number for sprites made from the same texture to the scene, add collision detection to them and also make them slide across the screen (im making a game where you avoid the obstacles).

My simple code:

private void createobstacle(float pX, float pY) {

    obstacle = new AnimatedSprite(pX, pY, this.mObjTextureRegion.deepCopy(),     getVertexBufferObjectManager());
    obstacle.setScale(MathUtils.random(0.5f, 3f));
    scene.attachChild(obstacle);
}

private void createobstacle(int num) {
    for(int i=0; i<=num; i++ ) {
        final float xPos = MathUtils.random(30.0f, (CAMERA_WIDTH - 30.0f));
        final float yPos = MathUtils.random(30.0f, (CAMERA_HEIGHT - 30.0f));
        createobstacle(xPos, yPos);
    }
}

Ive read about arrays but i cannot find any tutorials about anything im stuck with.

Any help would be great!

sentences:
Unity3d reading profiler binary information So I'm using Unity's profiler to help debug some of my code in the standalone. I've got it running smoothly, and writing all it's data to a .data file which I can read.

However, the binary file Unity creates for profiler information gets quite huge very quickly. I'm hoping to get past this by writing the profiler data log to a zip archive. I have dotnetzip installed, and can add files to a zip archive.

What I'm trying to figure out is how I could possibly either write the profiler data log directly to the zip archive, or write the profiler binary data to a variable of some sort which I could store in a stream and write to the zip archive on quit. This way I won't ever have to have the large file on the user's drive.

Another option would be to continuously write the binary data to the log on the drive, then get the binary info from that log, write it to a stream, put it in to a zip archive, then delete the log. However I'd have to do this every few seconds, and that may get slightly process intensive.

sentences:
How do I perform an xBR or hqx filter in XNA? I'd like to render my game scaled up with one of the hqx filters (hq2x, hq3x or hq4x) or an xBR filter in a shader.

How can I do this in XNA 4.0 and SM3?

Side note: this question has been heavily edited to become what it is now.

sentences:
What are some ways to texture map a terrain? I'm working with XNA on a 3D Game, and I'm trying to have a proper and nice environnement.
I actually followed a tutorial to create a terrain from a heightmap. To texture it, I just apply a grass texture on it and tile it a number of times.

But what I want to do is to have a really realistic texturing, but also generate it automatically (for example if I want to use Perlin noise to generate a terrain and then texture it).

I already learned about multi-texturing, loading a map file with different colors for different textures, but I don't think this is really efficient, for instance for cliffs or very steep areas it will tile a texture badly as it's a view from the top.
(Also, I don't know how I'll draw roads or dirt paths with that.)

I'm looking for an efficient solution to realistically texture mapping procedurally-generated terrain.

sentences: Simulating Enums with Javascript When developing in Javascript, it seems useful especially for event systems to use enum-likes, but not string comparison for performance considerations (also because it doesn't protect against typos). How do you use Enums in JS? Should I switch to Typescript?

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:
Sending an object from one point to another I am working on a simple game in Java and am stuck for now with getting an object to be directed from its current position to a certain point, all at a fixed speed. My problem is that whenever I activate the movement, the object seems to shoot off into a random direction, sometimes towards my target, sometimes away, really any direction it seems, but nothing consistent.

This is what I'm working with:

    else if (key == KeyEvent.VK_SPACE)
    {
        double deltaY = 100 - p.getY();
        double deltaX = 100 - p.getX();
        double angle = Math.atan2(deltaY, deltaX) * 180 / Math.PI;
        System.out.println(angle);
        double dx = (double) (Math.cos(angle) * 3);
        double dy = (double) (Math.sin(angle) * 3);
        p.setVelX(dx);
        p.setVelY(dy);
    }

Here is my SetVel functions as well as the tick method.

public void tick()
{
    x+=velX;
    y+=velY;

    if(x <= 0)
        x = 0;
    if(x >= 640)
        x = 640;
    if(y < 0)
        y = 0;
    if(y >= 480)
        y = 480;
}

public void setVelX(double velX)
{
    this.velX = velX;
}

public void setVelY(double velY)
{
    this.velY = velY;
}

Using the system outs, and positioning my object at 90 degree angles relative to my target I am getting 90 and 180 degrees, so I don't think its a problem with that.

sentences:
Cyclone LED gaming code HOW TO HELP? I am very new to programming. For a project I decided to make a game of cyclone using some LEDs,a push button, and a raspberry pi. I researched how to at least start on the game, but the problem that I encounter is that most examples of this game utilizes an arduino and python code, when I am familiar with the raspberry pi and c code. I would like to know to loop lighting up multiple LEDs one at a time with a decent amount of speed for a fun reaction game. My code starts out as this:

    #define pinOutYOne 0 //first yellow LED
    #define pinOutYTwo 3 //second yellow LED
    #define pinOutGOne 21 //green LED one
    #define pinOutGTwo 22 //green LED two
    #define pinOutBOne 23 //blue LED one...etc
    #define pinOutBTwo 25 //
    #define pinOutROne 4
    #define pinOutRTwo 5

    int  main(void){
      //set up pin mode as output
      pinMode(pinOutYOne, OUTPUT); //syntax for pinMode(pinNumber, Mode)
      pinMode(pinOutYTwo, OUTPUT);
      pinMode(pinOutGOne, OUTPUT);
      pinMode(pinOutGTwo, OUTPUT);
      pinMode(pinOutBOne, OUTPUT);
      pinMode(pinOutBTwo, OUTPUT);
      pinMode(pinOutROne, OUTPUT);
      pinMode(pinOutRTwo, OUTPUT);

      //clear output
      digitalWrite(pinOutYOne, 0); //write 0 (low) to output pin
      digitalWrite(pinOutYTwo, 0);
      digitalWrite(pinOutGOne, 0);
      digitalWrite(pinOutGTwo, 0);
      digitalWrite(pinOutBOne, 0);
      digitalWrite(pinOutBTwo, 0);
      digitalWrite(pinOutROne, 0);
      digitalWrite(pinOutRTwo, 0);

     //loop to allow blinking
     while (1 == 1){
       //light up the LED for 1 second
       digitalWrite(pinOutYOne, 1);
       digitalWrite(pinOutYTwo, 1);
       digitalWrite(pinOutGOne, 1);
       digitalWrite(pinOutGTwo, 1);
       digitalWrite(pinOutBOne, 1);
       digitalWrite(pinOutBTwo, 1);
       digitalWrite(pinOutROne, 1);
       digitalWrite(pinOutRTwo, 1);
       puts("LED on"); //display a message on console
       delay(1000); //1 for 1 milliseconds, 1000 for 1 second

    //turn off for 1 second
      digitalWrite(pinOutYOne, 0); //write 0 (low) to output pin
      digitalWrite(pinOutYTwo, 0);
      digitalWrite(pinOutGOne, 0);
      digitalWrite(pinOutGTwo, 0);
      digitalWrite(pinOutBOne, 0);
      digitalWrite(pinOutBTwo, 0);
      digitalWrite(pinOutROne, 0);
      digitalWrite(pinOutRTwo, 0);
      puts("LED off");
      delay(1000);
     }
 }

**I do know that this code lights all of the LEDs at once, I'm not sure how to implement a loop and light them up one at a time in sequence

sentences:
Custom VertexDeclaration for Color, Texture, Normal What is the best way to create a VertexDeclaration, that makes it able to render a Shape consisting of vertices and also be able to store a color for the shape (in case the texture can't be rendered - or in case we want color instead of a texture) - instead of having both a VertexPositionNormalTexture and a VertexPositionColor struct in the same class/struct.

I'm trying this approach:

public interface IShape : IVertexType { }

public struct ShapeFace
{
    public int Count { get; set; }
    public Color Color { get; set; }
    public Vector3 Position { get; set; }
    public Vector2 TextureCoordinates { get; set; }
    public Vector3 Normal { get; set; }
    public Vector3[] Vertices { get; set; }

    // Perhaps I need this?
    // public int[] Indexs { get; set; }
}

public struct Shape : IShape
{
    public ShapeFace[] Faces { get; set; }

    /* Need to implement VertexDeclaration here */
}

How do I implement the VertexDeclaration to understand what I want to do?

A shape contains faces, each face can have it's own texture OR color, normal mapping, texture coordinates, etc.

Example A cube has 6 faces, each face needs 2 triangles, each triangle has 3 points. 6 * 2 * 3 = 36 vertices. This way I can create a cube with 6 faces instead of 36 vertices, and render it in color or with a texture.

I really want to simplify it so that I can create some kind of struct that works this way.

sentences:
Unity Rendering Pass Before Refraction not showing In the documentation it states:

Before Refraction: Draws the GameObject before the refraction pass. This means that HDRP includes this Material when it processes refraction. To expose this option, select Transparent from the Surface Type drop-down.

I have selected the Transparent option for surface type but the Before refraction rendering pass is not in the drop down list for rendering pass. How can I get it to be there? Are there some other option that might be disabling it?

sentences: Minimax for Bomberman I am developing clone of Bomberman game and I am experimenting with different types of AI. First I used searching through state space with A* and now i want to try different approach with Minimax algorithm. My problem is that every minimax article i found assumed players alternates. But in Bomberman, every player make some action at the same time. I think i could generate all possible states for one game tick, but with four players and 5 basic actions (4 moves and bomb place) it gives 5^4 states at first level of the game tree. That value will raise exponentially with every next level. Am I missing something? Are there any ways to implement it or should i use totally different algorithm? Thanks for any suggestions

sentences:
How to flip sprite and all collision children of a KinematicBody2D at the same time? I have tried to use the scale property of KinematicBody2D to flip at the same time the sprite and the collision/area/raycast children. For flipping, one just has to set scale.x = -1.
If it works in the editor, it does not work properly because the engine seems to reset scale.x to 1 each frame (as stated here):

NB: Here the original sprite is looking left (that is why it is blinking when going to the right, not very didactic sorry).

How to do the same without flipping every collision children one by one?

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 use OpenGL blend mode/functions to brighten/darken a texture. Tried this code, but the texture didnot get any lighter.

    try {
        texture = TextureLoader.getTexture("png",
           Game.class.getResourceAsStream("/brick.png"), true, GL_NEAREST);
    } catch (IOException e) {
        e.printStackTrace();
    }

    GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.getTextureID());

    glEnable(GL_BLEND);
    glBlendFunc(GL_CONSTANT_ALPHA, GL_CONSTANT_ALPHA);
    GL14.glBlendColor(1.0f, 1.0f, 1.0f, 0.5f);

    glColor4f(1, 1, 1, 0.5f);
    GL11.glBegin(GL11.GL_QUADS);          // Start Drawing Quads
    // Front Face
    GL11.glNormal3f(0.0f, 0.0f, 1.0f);    // Normal Pointing Towards Viewer
    GL11.glTexCoord2f(0.0f, 0.0f);
    GL11.glVertex3f(-1.0f, -1.0f, 1.0f);  // Point 1 (Front)
    GL11.glTexCoord2f(1.0f, 0.0f);
    GL11.glVertex3f(1.0f, -1.0f, 1.0f);   // Point 2 (Front)
    GL11.glTexCoord2f(1.0f, 1.0f);
    GL11.glVertex3f(1.0f, 1.0f, 1.0f);    // Point 3 (Front)
    GL11.glTexCoord2f(0.0f, 1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, 1.0f);   // Point 4 (Front)
    glEnd();

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

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

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

Here’s the mother class code (Bonus) :

using UnityEngine;

public class Bonus : MonoBehaviour
{
    protected int lifeTime;

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

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

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

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

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

Here's the daughter class code (BonusHealth) :

using UnityEngine;

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

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

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

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

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

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

Thanks in advance ;)

sentences:
Smoothen line on linerender I've created a square using linerenderer but my problem now is that the line is not smooth. see below picture. I've tried enabling anti-aliasing and setting lr.numCapVertices to no avail.

 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.startWidth = .1f;
lr.endWidth = .1f;

lr.SetPosition(0, new Vector3(1, 0, 0));
lr.SetPosition(1, new Vector3(2, 0, 0));
lr.SetPosition(2, new Vector3(2, -1, 0));
lr.SetPosition(3, new Vector3(1, -1, 0));
lr.loop = true;

Gradient gradient = new Gradient();
gradient.SetKeys(
    new GradientColorKey[]
    {
        new GradientColorKey(Color.red, 0.25f),
        new GradientColorKey(Color.green, 0.50f),
        new GradientColorKey(Color.blue, 0.75f),
        new GradientColorKey(Color.yellow, 1f),
    },
        new GradientAlphaKey[] { new GradientAlphaKey(1f, 0.0f)

    }
    );
lr.colorGradient = gradient;

}

sentences:
Property replication vs RPC: Communication directions I have an UParticleSystemComponent attached to ACharacter. Its activation is controlled by user input, so it receives several updates per second.

For replicating the activation state of the particle system, the user input triggers an update of the value of a replicated variable (UPROPERTY(Replicated)) on the ACharacter. This works fine for the direction

Listen server -> Clients,

however not for the directions

Client -> Listen Server
Client -> Client.

I assume this is the case b/c "Property updates only come from the server (i.e., the client will never send property updates to the server)".

So for Client -> Client replication I have to rely on RPCs and can't use property replication at all?

sentences:
OpenGL ES, orthographic projection and viewport I want to make some simple 2D game on iOS to familiarize myself with OpenGL ES.
I started with Ray Wenderlich’s tutorial (How To Create A Simple 2D iPhone Game with OpenGL ES 2.0 and GLKit). That tutorial is quite good, but I miss some parts of a puzzle.

Ray creates an orthographic projection using some magic numbers like 480 and 320. It is not clear to me why he took these numbers, and as far as I can see - sprites are not mapped to the iPad simulator screen one-to-one pixel. I tried to play with parameters with which the ortho matrix is created, but I cannot figure out the maths in here.

How can I calculate numbers (bottom, top, left, right, close, far) which will be parameters to the orthographic projection matrix creation and have the sprite on the screen shown in its original size?

sentences:
How can I efficiently implement a bitmask larger than 64-bits for component existence checks? In my ECS implementation, I use bit-wise operations (as described and illustrated in this thread) to tell an entity what type of components it currently consists of. So my Entity class has the following member:

unsigned long m_CompMask;

The different component types are then defined as an enum, whose member values are all power of two:

enum ComponentType
{
    COMP_TYPE_UNKNOWN                   = 0,
    COMP_TYPE_PERSON                    = 1,
    COMP_TYPE_RENDERABLE                = 2,
    COMP_TYPE_MOVEABLE                  = 4,
    [...]
};

Each time a new component is added to my entity instance, I do the following bit operation to update the mask (where newType is a member of the enum mentioned above):

m_CompMask |= newType;

This approach enables me to efficiently check if a certain entity instance has a certain component (and hence might be relevant for a specific system), like so:

return (m_CompMask & type);

The limiting factor in this approach however is the m_CompMask variable since it won't be able to handle more than 64 component types (if I increase it to unsigned long long).

I don't expect to be needing more than that in my current project, but nonetheless I'd like to hear some ideas regarding alternatives that allow more than 64 types (as big games certainly need to) while still maintaining the ease and efficiently of those bit-wise operations as much as possible? Any ideas how this is handled in "proper big" projects?

sentences:
Does it matter what file type my save file is? So, I am looking into game development, and I just learned how save files work and how to create and implement them. Here is the code that I was using on Dev C++:

// basic file operations
#include <iostream>
#include <fstream>
#include <sstream>
using namespace std;

int main () {
    string line;
    ifstream saveFiles ("save.txt");
    if (saveFiles.is_open()) {
        getline (saveFiles, line);
        string arr[2];
        int i = 0;
        stringstream ssin(line);
        while (i < 2){
            ssin >> arr[i];
            ++i;
        }
        saveFiles.close();
        cout << "You have " << arr[0] << " hearts" << endl;
        cout << "You have " << arr[1] << " food";
    }
    else {
        cout << "Hearts > ";
        int hearts;
        cin >> hearts;
        cout << "Food > ";
        int food;
        cin >> food;
        ofstream saveFile;
        saveFile.open("save.txt");
        saveFile << hearts << " " << food;
        saveFile.close();
    }
    return 0;
}

For me, this checks if there is a save file, if there isn't, asks for input and then saves it. Then, when they come back, it checks again and it finds the file and gives you the data. This seems like it'd be how you make a save file (instead you likely wouldn't directly enter information like in my example).

As you can see, I create a save.txt file and it works fine. However, for games that I've run (like Minecraft), it doesn't use a .txt file. What difference does it make and what would work best for me (in any example)?

sentences:
Android Studio with libGDX doesn't recognize boolean In my game, when the users clicks an image button, the value of a boolean changes and then the game is closed. I mean, if I want to restart the game, I click this image button, the game is closed and immediately is opened. However this doesn't happen because the value of the boolean is false and I don't know why at all.

Here is the code of the image-button:

    playagain.addListener(new ClickListener()
    {
        @Override
        public void clicked(InputEvent event, float x, float y)
        {
            interfaccia.rigioca();
            Gdx.app.exit();
        }
    });

And this is the code of the MainActivity:

public class MainActivity extends Activity implements MyGdxGame.GestioneClick, Serializable
{
MainActivity activity;
boolean start;
@Override
public void onCreate(final Bundle bundle)
{
    super.onCreate(bundle);
    setContentView(R.layout.layout);
    activity = this;
    findViewById(R.id.button).setOnClickListener(new View.OnClickListener()
    {
        @Override
        public void onClick(View v)
        {
            startActivity();
        }
    });

}

@Override
public void onResume()
{
    super.onResume();
    if(start)
        startActivity();
}

@Override
public void menu()
{
    start=false;
}

@Override
public void rigioca()
{
    start=true;
}

public void startActivity()
{
    Intent intent = new Intent(MainActivity.this,AndroidLauncher.class);
    intent.putExtra("MainActivity",activity);
    activity.startActivity(intent);
}

}

As you can see, rigioca method is called and start sould be true. I checked ALL with logs and we can say that the value is true. Then resume method is called but start value is false! How is it possible? I also took away start=false; in menu method, but that isn't the problem. Why is this variable false!?

Note: onDestroy and onCreate aren't called but the activity is destroyed.

sentences:
3D models budget. What matters more number of triangles or vertices When I am making a model for a 3D game what should I take as a measure in my budget Polygons (triangles) or vertices?  I have made an experiment with two sets 40000 cubes one with 8 vertices and 12 triangles, another with 24 vertices and 12 triangles. All was done in Unity and both of those were generated procedurally. To my surprise, both sets performed almost the same there was a very small difference between them.

Does it mean I should not worry about vertices count and only look at triangles count?

EDIT:
I have made another experiment I have created a plane with 19602 triangles and 10000 vertices and another one with same ammount of tirangles  but 39204 vertices. I have generated 4000 of both. Now less vertices won 14 fps to 19 fps.  So I guess generally less is better, but only in large differences.

sentences:
Is there a standard way to rig a humanoid? I am using some placeholder humanoid models for my game, which will be replaced later.  I am concerned that when I replace them, they will not work with my animations, due to different rigging.
Is there a standard rigging that artists use for humanoids?  Such as, is there always a the same number of body parts attached in the same hierarchy, or does this vary based on the artist/studio?  If there is a standard, what is it?  If there isn't how can I ensure that my animations and models play nice?

I use Unity, if it's relevant.
Disclaimer:  I am not an artist, and I have no idea what I am talking about.  Please feel free to ask for clarification.

sentences:
What is a good way to store tilemap data? I'm developing a 2D platformer with some uni friends.  We've based it upon the XNA Platformer Starter Kit which uses .txt files to store the tile map.  While this is simple it does not give us enough control and flexibility with level design. Some examples: for multiple layers of content multiple files are required, each object is fixed onto the grid, doesn't allow for rotation of objects, limited number of characters etc. So I'm doing some research into how to store the level data and map file.

This concerns only the file system storage of the tile maps, not the data structure to be used by the game while it is running.  The tile map is loaded into a 2D array, so this question is about which source to fill the array from.

Reasoning for DB: From my perspective I see less redundancy of data using a database to store the tile data.  Tiles in the same x,y position with the same characteristics can be reused from level to level.  It seems like it would simple enough to write a method to retrieve all the tiles that are used in a particular level from the database.

Reasoning for JSON/XML: Visually editable files, changes can be tracked via SVN a lot easier. But there is repeated content.

Do either have any drawbacks (load times, access times, memory etc) compared to the other?  And what is commonly used in the industry?

Currently the file looks like this:

....................
....................
....................
....................
....................
....................
....................
.........GGG........
.........###........
....................
....GGG.......GGG...
....###.......###...
....................
.1................X.
####################

1 - Player start point, X - Level Exit, . - Empty space, # - Platform, G - Gem

sentences:
Why are trees shining in background? Currently I am creating a forest scene in the dark, and the trees are shining far away, but when I get close they are fine. I have the shaders set to "Nature/Tree Soft Occlusion [bark/leaves]", but they are still rendering strange far away, but close they are fine.

I tried placing the trees in a folder named "Ambient-Occlusion" like said here, but no luck. Also fog is turned off. Thanks in advance.

UPDATE

When I looked at the trees using the "Render Paths" camera, they appeared red while everything else was green.

UPDATE 2

I have tried re-installing the package I downloaded these from, but still no luck.

UPDATE 3

I have added some trees manually, and they work fine, but when adding them by painting on the terrain I get the problem.

FINAL UPDATE

I tried building the game to see if this had the effect on the .exe, and it didn't. So I just have to ignore when I am debugging it, as it works fine on the build. Thanks for all the help, it just seems like an error with unity. Picture of build:

sentences: Third Person Flying Camera I am having issues creating a third-person camera for my Rogue Squadron (N64) like game. First I have posted my issue on the official Unity Answers site here. So far my ship is behaving as I want and the camera follows position correctly (XYZ), however, it doesn't rotate how I would like. My first attempt was to set the rotation of the camera to the rotation of the ship and realized that is not what I am looking for either. I have found some information on rotating around a (pivot) point but I am having trouble understanding them. For example, I have found this and this but Im not sure how they work. The end result would be something like the camera found here. Thank you for any help, I would greatly appreciate a description of what you are doing/how it works. Lastly this is done in C# in Unity. I can provide my code if needed.

sentences:
How do I stop movement from being mirrored on the X and Y axis with Unity & Kinect? I have made a scene and avatar in the scene, put all of the correct joints on the Open NI Skeleton, but the outcome is not only mirrored on the x-axis, it is also on the y-axis.

So, when I lift my arms, the avatar's arms move downward. How can I fix this?

sentences:
Cube world rendering optimizations I'm making a Minecraft like game and I would like to apply some optimizations. Firstly I didn't and I rendered the world using a vbo in which I stored a cube model and I drow all blocks of the worlds and off course it caused lag if there were too many blocks.
Then I decided to draw the world face-by-face and check if a face is hidden from another one.

This concept is simple if I have the world made only by cubes of the same size, like this:

Blue and black block are two blocks of the same size and the red face is the face to ignore since is hidden (overlapped) by another opaque face.

As I said if I want to make blocks of different sizes (scale)/position/rotation but by always drawing them from faces, the matter is different since I can't know if a face is completely visible or not. Here's an image of a normal block with a "custom" block on it:

Blue block is the custom block, the black a "normal" block and the red is the face overlapped by the biggest one (then it should be ignored during rendering).

Here the rotation is null but if there's no way to check rotated faces I can simply ignore it and draws all rotated blocks by default (I don't rotate all the world lol)... that's not what I'd like to do but if there's no way or the way is too difficult...

Anyway, finally, how can I check (using GL functions or doing it in my code) if a face is hidden and to ignore it on rendering?

I forgot to say that another optimization I did is if a block is hidden (has a block relative to each face) by other blocks I don't draw it.

sentences:
How to to convert UV coordinates to texel coordinates and how to convert texel coordinates to "array coordinates"? I am currently writing a UV texture mapper.

But i don't know how to convert UV coordinates to texel coordinates.

And i also have no idea how i should convert texel coordinates to "array coordinates".

By "array coordinates", i mean number that represents a part of an array (in this case a bitmap).

Here is my code:

 su =  (u0)  * (tx-1) ;
 sv =  (v0)  * (ty-1) ;

 texloc = ((sv >>16)* bytes_per_row) +((su>>16)* bytes_per_pixel);

Also i use fixedpoint math to interpolate between the uv coordinates.

tx and ty are the dimensions of the texturemap.

sentences:
How to manage grid-based inventory with items larger than 1x1 cell? Me and my team have been trying to implement some sort of inventory system. We've set our eyes on an inventory system where some items may take up more than one box on the grid system, sort of like the one used in SOTS the pit, like this:

(source: webguyunlimited.com)

Notice how some items, such as the gun, take up more than one slot. How can we implement this? This includes checking to make sure that a slot we would like to insert an item in hasn't already been taken up (we may have irregular shaped items too).

sentences:
C# - XNA - Making a Modular Screen / State Manager I'm not entirely sure how to ask this question since its somewhat broad, but also a bit specific to my code.

I'm making a game in C# XNA and attempting to have the parts of it be fairly modular so that they can be used in any other relevant programs I create down the road.  For instance, I have an InputHandler accessible from any class in my program that simply checks the state of the keyboard and mouse and has various methods to find out specifically if a key / button is held down, pressed, or released, etc.

The groundwork of my program was made by following these tutorials:
Part 1
Part 2
and Part 4

(Its not a mistake that I don't have a link to part 3 as that dealt with adding in Xbox 360 gamepad functionality only, which isn't something I needed in my testing.)

In those tutorials there is a GameScreen Game Component made which is what all the other screens / states inherit from.

The way the tutorial handles screen management is that a type of screen is created in the Game1 class and then only in the Game1 class can you Hide / Show a screen or change which screen is active.

For instance, when the program is first run in the LoadContent section of Game1 a StartScreen(which inherits from GameScreen) is created.  The StartScreen is then set to be the ActiveScreen and is set to Show.

My problem is that in my StartScreen I'm handling the checks for what menu option a user selects, but I can't actually hide the current screen and change to the one that was selected because that can only be done from the Game1 class.

I could just handle all of my input checking for the different screens in the Game1 class by using an if statement based on not only what menu option is selected, but also what screen is active, but that would mean a lot of clutter in my Game1 class and it would kind of ruin my goal of making my game components modular by having all of the stuff relevant to a given screen being handled within that screens code.

My question is essentially what I should do to address this...

I tried several times to make a separate ScreenManager Game Component that is accessible from everywhere much like my InputHandler, but each time that ended in disaster with numerous errors that I simply don't have the experience or grasp on lingo to troubleshoot.

My most recent attempt at making a separate one ended with me being able to choose which screen was active, but not being able to use the ".Hide()" method that is part of the GameScreen base class.  I also had numerous "accessibility" errors.

I also tried to simply make my screens themselves be public.  For instance, in my Game1 class I have variables for GameScreen activeScreen and StartScreen startscreen.  I've tried making those two variables be Public or even Public Static, but I still couldn't use them anywhere outside of Game1.

I've looked at numerous other posts and tutorials on making a Screen Manager or how to handle State Management, but that only served to confuse me more.  They were either WAY over my head, like the Microsoft State Management sample, or they were understandable and working, but far too different from the one I have now for me to grasp how to apply it to my current code.

Is there something easy and obvious that I'm stupidly overlooking or is there some key concept at work that I'm unaware or failing to grasp?

Or am I going about it all in the wrong way entirely?

sentences:
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: 2D game board for android I am trying my hand at android game development. I want to start with a simple 2D board game. What is the best way to draw a game board like the one in the image attacked below. The blue circles are points where the players can place objects.

sentences:
Simulate wind affecting a boat using a 2D physics engine like Box2D or SpriteKit? I'm looking for a way to simulate the forces created by wind and how it affects a boat.

In a nutshell: if wind hits a boat (sailing yacht), the bow is aligning with the wind and if the wind is strong enough, the boat will then slowly start to move.

I am not looking for a correct simulation of sails or alike. Just wind as it would affect a boat during maneuvers at slow speed.

Here's what I have tried:

Make the boat just one body and apply a force: this does not take into account the heavier stern versus the lighter bow.
Make the stern a heavy body and the bow a lighter one and connect them with a fixed joint: this will make the boat rotate if the same force is applied to both bodies but ignores the fact that once the boat is aligned with the wind, the force should be reduced.
Create many (thousands) of very small objects with little mass and apply a force to them, simulating the wind "particles" and let them hit the boat: this kills performance on slower devices.

Maybe I am missing a very simple solution that would work good enough?

sentences:
Getting the edge-cells in a list of cells on a 2d grid, and knowing which neighbor is missing I create a "circle" on my 2d-grid using this code:
public List<Cell> GetSurroundingCellsCircle(Coord originCoord, int distance)
{
    List<Cell> matches = new List<Cell>();
    int EX = distance + coord.x;
    int EY = distance + coord.z;
    int SQ = distance * distance;

    for (int x = coord.x - distance; x <= EX; x++)
    {
        for (int z = coord.z - distance; z <= EY; z++)
        {
            int c = x - coord.x;
            int d = z - coord.z;

            if ((c * c + d * d) < SQ)
            {
                Cell cell = GetCell(new Coord(x, z));
                if (cell != null)
                    matches.Add(cell);
            }
        }
    }

    return matches;
}

This code works fine and returns a list of cells that together create a circle-shape. Now I want to get all the edge-cells of this circle, and not only that, but I also need to know which side of the edge-cell that has no neighbor, so I know where to draw the line. I want a result that looks like this red line:

I wrote this code that would work for a square (it just finds the max/min of X/Z and draws a sphere there, but as you can see in my image, its missing the "rounding" cells:

int maxX = 0, maxZ = 0, minX = 0, minZ = 0;

        for (int i = 0; i < cells.Count; i++)
        {
            int cX = cells[i].coord.x;
            int cZ = cells[i].coord.z;

            if (i == 0)
            {
                minX = cX;
                minZ = cZ;
            }
            else
            {
                if (cX < minX)
                    minX = cX;

                if (cZ < minZ)
                    minZ = cZ;
            }

            if (cX > maxX)
                maxX = cX;

            if (cZ > maxZ)
                maxZ = cZ;
        }

        for (int i = 0; i < cells.Count; i++)
        {
            int cX = cells[i].coord.x;
            int cZ = cells[i].coord.z;

            if (cX == maxX || cZ == maxZ || cX == minX || cZ == minZ)
            {
                Gizmos.DrawSphere(
                    new Vector3((cells[i].coord.x * GridBase.WORLD_CELL_SIZE) + GridBase.WORLD_CELL_OFFSET,
                    1,
                    (cells[i].coord.z * GridBase.WORLD_CELL_SIZE) + GridBase.WORLD_CELL_OFFSET),
                    1);
            }
        }

sentences:
How does Direct3D know if a constant buffer is for the vertex or pixel shader? I have a question about constant buffers in directX 11.  They really confuse me and after searching on google most sites simply supply sample code without explaining how it works.  I am probably overlooking something but, as of now, they appear to me to work by sheer magic.  Say I have two constant buffers in an hlsl file:

struct Light
{
    float3 dir;
    float4 ambient;
    float4 diffuse;
};

cbuffer cbPerFram
{
    Light light;
};

cbuffer cbPerObject
{
    float4x4 WVP;
    float4x4 World;
};

And I create an equivalent buffer in my C++ program like so:

//Create the buffer to send to the cbuffer in effect file
D3D11_BUFFER_DESC cbbd;
ZeroMemory(&cbbd, sizeof(D3D11_BUFFER_DESC));

cbbd.Usage = D3D11_USAGE_DEFAULT;
//cbPerObject is a struct with same layout as cbPerObject in HLSL file
cbbd.ByteWidth = sizeof(cbPerObject);
cbbd.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
cbbd.CPUAccessFlags = 0;
cbbd.MiscFlags = 0;

hr = d3d11Device->CreateBuffer(&cbbd, NULL, &cbPerObjectBuffer);
//Create the buffer to send to the cbuffer per frame in effect file
ZeroMemory(&cbbd, sizeof(D3D11_BUFFER_DESC));

cbbd.Usage = D3D11_USAGE_DEFAULT;
//cbPerFrame is struct with same layout as in cbPerFrame in effect file
cbbd.ByteWidth = sizeof(cbPerFrame);
cbbd.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
cbbd.CPUAccessFlags = 0;
cbbd.MiscFlags = 0;

And then I update one like this:

d3d11DevCon->UpdateSubresource( cbPerObjectBuffer, 0, NULL, &cbPerObj, 0, 0 );
d3d11DevCon->VSSetConstantBuffers( 0, 1, &cbPerObjectBuffer );
hr = d3d11Device->CreateBuffer(&cbbd, NULL, &cbPerFrameBuffer);

How does directX know which constant buffers in my shader are going to be used for VS and which for PS and which buffers in my codes correspond to which buffers in my hlsl?  For example I call VSSetConstantBuffers above and pass the arguments and it automatically knows to throw that stuff in the per object buffer as opposed to trying to put it in the perFrame buffer. As far as I can tell when creating cbPerObjectBuffer, I never explicitly bound it to the cbPerObject buffer in my hlsl.  Is slot number dependent on the order the buffers appear in hlsl?  The only way I can figure is that the data structures simply define an interface to the buffer memory on the card and it is up to the programmer to use the correct one.  For example, I COULD attempt to use cbPerFrame in my vertex shader and indeed the same data can be accessed that way but in order to get correct results you would have to access it using offsets into the light object.  Does what I am asking make any sense? lol

sentences:
2D Collision in JavaFX - Bad accuracy with .intersects() I have several Shape objects - Circle, Rectangle and Polygon.

I use the built-in .intersects(Bounds1, Bounds2) method to detect collision but it's quite inaccurate.

Circle c1 = new Circle(20);
Bounds c1Bounds = c1.getBoundsInParent();
Rectangle r1 = new Rectangle(20,20);
Bounds r1Bounds = r1.getBoundsInParent();
... etc for other Shape objects

My collision code:

if (c1Bounds.intersects(r1Bounds) {
    //collision happened.
}

Why is the collision accuracy so bad and how can I improve it? The collision detection is REALLY bad for polygon objects. It is literally at least 50 pixels off.

sentences:
2D moving sprites collision I'm trying to create a game where i have two abjects A and B

1 :I know the shape of the two objects(Rectangles) .

2 :The speed and position of each object.

And i'm trying to figure out if the two object will eventually collide .

I  calcuted the point where   the object's paths intersect
using this formula

The same for y

But i still don't know if the two object will actually collide or will miss each other .

sentences:
How can I determine where objects can be seen from a given perspective? I'm wrapping my head around OpenGL ES 2.0 and I think I'm trying to do something very simple, but I think the math may be eluding me.

I created a simple, flat-ish cylinder in Blender that is 2 units in diameter.  I want to create an arbitrary grid of these edge to edge (think of a checker board).

I'm using a 3D perspective with GLKit:

    CGSize size = [[self view] bounds].size;
    _projectionMatrix = GLKMatrix4MakePerspective(GLKMathDegreesToRadians(45.0f), size.width/size.height, 0.1f, 100.0f);

So, I managed to manually get all of these cylinders drawn on the screen just fine.  However, I would like to understand how I can programmatically "fit" all of these cylinders on the screen at the same time given the camera location, screen size, cylinder diameter, and the number of rows/columns.

So the net effect is that for small grids (i.e., 5x5) the objects are closer to the camera, but for large grids (i.e., 30x30) the objects are farther away.  In either case, all of the cylinders are visible.

sentences:
How do I avoid users hacking my network games from the client side? I've decided to make an online game; the server sends packets of information to the client application, which is going to simulate what it gets from the server. The client makes a part of the design of the game, and sends the new state back to the server for processing.

The clients can send fake information to the server, and inform the server that I've done the task successfully, without trying. Assume a Counter-Strike game; the client may send a fake packet to the server and tell the server that I've defeated someone. How can I avoid this violation?

sentences:
C++, OpenGL: Building a polyhedron via geometry shader I'm stuck with geometry shaders in OpenGL - c++ programming. I want to create simple cube by repeating 6 times drawing one rotated wall. Here is my vertex shader (everyting has #version 330 core in preamble):

uniform mat4 MVP;
uniform mat4 ROT;
layout(location=0) in vec3 vertPos;
void main(){
    vec4 pos=(MVP*ROT*vec4(vertPos,1.5));
    gl_Position=pos;
}

Now geometry shader:

layout (triangles) in;
layout (triangle_strip, max_vertices = 6) out;
out vec4 pos;
void main(void)
{
    for (int i = 0; i < 3; i++)
    {
        vec4 offset=vec4(i/2.,0,0,0);
        gl_Position = gl_in[i].gl_Position+offset;
        EmitVertex();
    }
    EndPrimitive();
}

And now fragment shader:

uniform mat4 MVP;
in vec4 pos;
out vec3 color;
void main(){
    vec3 light=(MVP*vec4(0,0,0,1)).xyz;
    vec3 dd=pos.xyz-light;
    float cosTheta=length(dd)*length(dd);
    color=vec3(1,0,0);
}

Well, there is some junk, I wanted also put shading into my cube, but I've got a problem with sending coordinates. The main problem is - here I get my scaled square (by MVP matrix), I can even rotate it with basic interface (ROT matrix), but when I uncomment my "+offset" line I get some mess. What should I do to make clean 6-times repeating?

sentences: Get the current time of animation using script Unity3d I want to know the current time of the played animation using script in Unity3d. I tried using currentState.normalizedTime but this time is not the time of the animation, like it's the time of the runtime I think. Any advice please?

sentences:
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:
Spritegroups and colorkeys I have a problem using spritegroups in pygame. In my situation I have 2 spritegroups, one for humans, one for "infected". A human is represented by a blue circle:

image = pygame.Surface((32,32))
image.fill((255,255,255))
pygame.draw.circle(image,(0,0,255),(16,16),16)
image = image.convert()
image.set_colorkey((255,255,255))

An infected by a red one (same code, different color).

I update my spritegroups as follows:

 self.humans.clear(self.screen, self.bg)
 self.humans.update(time_passed)
 self.humans.draw(self.screen)

 self.infected.clear(self.screen, self.bg)
 self.infected.update(time_passed)
 self.infected.draw(self.screen)

Self.bg is defined:

self.bg = pygame.Surface((SCREEN_WIDTH, SCREEN_HEIGHT))
self.bg.fill((255,255,255))
self.bg.convert()

This all works, except that when a red circle overlaps with a blue one, you can see the white corners of the bounding box around the actual circle. Within a spritegroup it works, using the set_colorkey function. This does not happen with overlapping blue circles or overlapping red circles.

I tried adding a colorkey to self.bg but that did not work. Same for adding a colorkey to self.screen.

sentences:
Orienting a model to face a target I have two objects (target and player), both have Position (Vector3) and Rotation (Quaternion).  I want the target to rotate and be facing right at the player.  The target, when it shoots something should shoot right at the player.

I've seen plenty of examples of slerping to the player, but I don't want incremental rotation, well, I suppose that would be ok as long as I can make the slerp be 100%, and as long as it actually worked.

FYI - Im able to use the position and rotation to do plenty of other things and it all works great except this last piece I cant figure out.

Code samples run in the Target's class, Position = the targets position, Avatar = the player.

EDIT

Im now using Maik's c# code he has provided and it works great!

sentences:
Engine with Terrain and Indoor Areas (BSP-like) I'm not really a graphics programmer, but I used to toy around with Truevision3D 6.5 a few years ago. It wasn't too bad, but TV3D was just going nowhere so my foray into 3d game dev ended there.

I know nothing of XNA. I think it's time to get up to date.

My goal is to be able to render chunks of terrain from heightmaps (big huge terrain a la Morrowind) and BSP-like indoor areas (think Quake, so moveable objects like doors included).

I googled for "xna engine", "best xna engine" but the quantity of results is a bit scary for a xna-impaired like me.

Can anyone recommend a xna engine (or a combination of libraries) to achieve the desired result? If you targeted similar features, can you share your experience?

(and for a laugh, has anyone tried TV3D 6.5 here?)

Edit: I'm looking for something xna-related.

sentences:
RPG stats degrading by level I'm looking for some math to "degrade" stats over level. The idea is that if you have x value for a stat that it's affect will be less when you increase your level, making you have to put more points into that stat to maintain.

For my specific example I have a stat I call Focus. I want the Focus stat combined with the level to create a percentage. I will use this percentage against each abilities damage/heal value to get a value. This value will act as the low end and the abilities value will act as the high end for finding a random number between. So if "Strike" has a value of 10 and my focus % is 50% then then I find a random number between 5 and 10 to get the actual damage to apply.

So at level 1 ideally this % is 100% (so "Strike" will do 10 damage always). At level 2 with no more points in the Focus stat, I want this final % to go down but putting points into the Focus stat could keep it up.

This seems like the kind of thing every RPG game has, but I'm not sure how it's done. I'm picturing all stats being like this. Each level I would increase base damage/heal values for abilities by x% and then degrade other stats. Like strength for example. The idea would be to try and keep the strength state so it results in 100% of the ability damage by putting points into it each level.

Does this make sense or am I way off base in my thinking on how this kind of stuff is done or can be done?

sentences:
Using GPU on Silverlight 5 for a Fast Fourier Transform I've got an audio library for Silverlight that is in need of some acceleration on slower machines. Specifically, this library makes extensive and repeated use of the FFT transform as a part of its acoustic echo cancellation and noise reduction algorithms, and I'm wondering if it would make any sense to use the GPU for this (as described, for instance, here: http://www.inf.fu-berlin.de/lehre/SS10/SP-Par/download/fft1.pdf).

I know that Silverlight 5 provides a fairly simple port of Microsoft's XNA framework, but unfortunately, I'm a complete novice to 3D coding in general, and XNA in particular. It seems to me like it should be theoretically possible to use some combination of vertex and/or pixel shaders to work this magic, but before I go too far down this road, I wanted to get some expert opinions on a few questions:

(1) SL5's XNA implementation throws the output of its pipeline onto a single "DrawingSurface". I had been thinking that this is where I might be able to read the results of the calculations (kind of how you could use a WriteableBitmap to read the results of pixel shader calculations in SL4). But I can't figure out how I would do that: there's no "GetPixels()" method, or anything like that. In regular XNA 4.0, the VertexBuffer has a GetData() method, as do the Texture2D and Texture3D classes, but those methods are missing in the SL5 version. Does anyone know of any way to actually read the results of shader outputs? Or is the GPU a write-only device in SL5?

(2) It seems like the real problem with GPU calculations is reading the results quickly. Assuming I can solve problem #1, does anyone know whether an FFT would be amenable to this sort of solution?

(3) Silverlight 5 is limited to HLSL Level 2, which has a number of serious limitations, so far as instructions, registers, available functions, and so forth. Is it at all reasonable to expect to be able to port an FFT or some portion thereof over to this?

Thanks in advance.

sentences:
Why don't variables in a script on a prefab clone store runtime changes? I have a building prefab. There is a simple script attached to it that allows me to store unique data for each prefab instance, such as address. There are hundreds of clones of this prefab.

The prefab is instantiated like so:

//instantiate a "building" object :
    multiFamHigh = Instantiate(multifamilyHigh,myV3,Quaternion.identity) as GameObject;

//set a reference to the prefab's behavior script:
    BuildingBehavior bldgBhave = multiFamHigh.GetComponent<BuildingBehavior>();

//set the information for the prefab:
    bldgBhave.setInfo( mgr.lotsList[chose].getAddress(),buildingRef);

In the "TownCreator" script, after the prefab is instantiated, I call the setInfo function and pass the address to it. The setInfo looks like this:

public class BuildingBehavior : MonoBehaviour {

    private string address;

public void setInfo(string useString, int bldgListRef)
    {
        address = useString;
        Debug.Log ("Set Address = " + address);
        buildingListRef = bldgListRef;
    }
}

The debug log correctly displays "you set address 3071 N." - meaning at that time, the "address" variable of the prefab script is set to 3071 N. Perfect.

However; later, when I click on any of the prefabs at runtime (via the mousedown) the UI message box pops up (as intended), and the Text is changed from "New Text" (default) to a blank string. I added a similar Debug.Log, at that point, and it also tells me that "address" on the clone is blank.

That code is:

 void OnMouseDown()
    {
        thisCG = GameObject.Find("MainCanvas").GetComponent<CanvasGroup>();
        thisCG.alpha = 1;
        CanvasStuff thisCS = GameObject.Find("MainCanvas").GetComponent<CanvasStuff>();
        thisCS.setAddyText (address);
        Debug.Log ("clicked on " + address);
    }

This happens:

Any ideas why the script on the prefab clones is not storing the values?

Also - when I change (address) to ("Address"), the popup has "Address" above the OK, Thanks! button. :/

sentences: Controller vibration with Monogame Is there a simple way to make a connected Xbox controller vibrate with Monogame? I know that GamePad.SetVibration is not implemented but it seems like this would be a common enough problem that there would be an easy answer.

sentences:
Curiosity on any Smartphones that Run on Android 2.3.3 with Different Screen Reoslution I have a question regarding about any smartphones that run only in Android 2.3.3. Is the size of screen or the screen resolution is always HVGA or does it have capable of running this OS (Android 2.3.3) on big screen size (4" to 5") at about 720x1280?

I'm thinking of the game's compatibility depending on the version of the Android OS and the screen resolution, which affects the change of coordinates especially for assigning touch buttons and drag-n-drop at exact location, before I'm gonna decide to make one. My program works on the Android 4 ICS and Jellybean, however, will that work on Android 2.3.3 in spite of precise touch coordinate or just dependent on the screen resolution (regardless how large it is) as the X and Y coordinate?

And take note, I'm using Eclipse IDE for Java developers.

sentences:
Calculating Hit Accuracy score in a game I'm currently in the process of making a scoreboard for my game. One of things I would like to display is the players accuracy in the amount of hits they had in game. However, I have never done this before and I've no idea how to go about doing this.

Is there a commonly used algorithm out there that can help me calculate this, or has someone found a way to calculate this fairly easily?

Any help with this would be appreciated.

sentences:
How to play character animation when using A* pathfinding Hi I am trying to make racing game. In which I am using mecanim animation system to animate my character. Here are the conditions for the animation to play

Speed --> 1       Run
Speed --> 0-0.5 - walk
Speed --> <-0.10   -walk back

if I set the speed to 1, my character will run i.e

anim.setFloat("Speed",1);

will run my character.

As it is a racegame I need to move the other characters from source to destination. For which I am using A* Pathfinding project of arongberg.
using the above algorithm I am getting the path and I am using simpleMove of character control to move the character. Now the problems comes here

1.As the character needs to play run animation while moving, which is not happening, if I set

anim.setFloat("Speed",1); it is not moving in the direction of path instead it is moving on its own direction

I have tried to apply run animation directly instead of animation controller, but the same Happening.
if I  remove all the animation character reaching to destination without any animation.

Here is the question where I have posted the code, I am asking the same question again but I was stuck with from past4 days.

http://answers.unity3d.com/questions/495397/how-to-make-my-character-move-in-the-direction-of.html

sentences:
haxe level scrolling How would level scrolling be implemented with haxe and nme?

I started plying with haxe and currently the only way to display things on screen is by using nme.display.Sprite.

I don't think changing the position of all sprites to scroll the level is the most efficient way of doing things.

I can't find any comprehensive example of how this should be done with haxe.

Any pointers?

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:
Aiming with a crosshair with a lot of polygons/triangles I'm working on a 3d kindof game where I'll eventually be able to modify the shapes present in the environment by pulling their faces with a crosshair. The thing is that I don't know how to achieve ray-quads or ray-triangle collision. I did it once with a teacher at school, but he didn't have much time and it was not well constructed (+I lost this code). I was also wondering how I could check for theses collisions with thousands of shapes? Because I know this is quite resource-demanding and doing this for 1000 spheres/cube/freeform shapes is not easy. If anyone could help me push my knowledge a bit further, it'd be very much appreciated!

I also work in Java using LWJGL, so OpenGl.

sentences:
How can I display a 3d object and my player on a canvas? The main goal is to animate my player with animator on a canvas.
The problem is that any 3d object (my player, a cube) I drag over the canvas is transparent/not seen.
The main camera is set to Clear Flags : Depth Only and Culling Mask to Everything.
The Main Menu Canvas is set render mode to Screen Space Camera and I selected the main camera.
The Main Menu Background Material is set to New Material I created and on the new material I added a shader I created that make this image to be blur.
The main camera settings screenshot :

And the Canvas settings :

And the Main Menu Background settings :

You can see in all the screenshots in the scene view top left that my player and the cube both are transparent on the canvas.
Now if I change the Main Camera Clear Flags to SkyBox then I see my player and the cube but also they are not looking like they should be with the texture/materials and also I don't want the Main Camera to be the clear flags on SkyBox I want the objects to be over the blur image so the Main Camera should be clear flags depth only.
The main goal again is to put my player on the canvas with the blur image and animate my player. This is for my main menu.

The canvas that will display the player if the player will be on his own canvas should be transparent and only display the player so the canvas will not overlap the other cnavas with the blur image.

I want to animate using animator the player not only to display it as static object.

This is a screenshot of what I mean I used paint to cut my player and put it on but the player canvas should be transparent or without a canvas the player should be on like the ui button on the left :

Another screenshot. On the top it's the scene view window the player the ui button and the blur image.
On the bottom the game view window the ui button is on the blur image.
I want the player to be the same as the ui button on the blur image and then to animate the player. Not like in my other screenshot the player should not have a skybox background or something it should be like the ui button on the blur image:

sentences:
Efficiently blit texture rotated by 90° to renderer with SDL 2 Let's say I have a 1024x768 SDL_Window, an SDL_Renderer bound to that window and a 768x1024 SDL_Texture into which I do my rendering. How can I render that texture such that it is rotated by 90° to fit the screen exactly (1:1 mapping between texels and pixels)?

I tried using the SDL_RenderCopyEx() function but I couldn't make it work properly with non-square window and texture, probably because it doesn't support scaling.

sentences:
Object to reach height depending on its gravity and mass A mathematician will probably think this was a silly question, but I'm not one and I'm in need of help :D
I'm working in Godot and with its RigidBody2Ds (objects that have automated physics behaviour).
I want to create a spring of type RigidBody2D (the 'springiness' is not the only function of this object).
I'm at the point in code where this spring and another RigidBody2D collide so I have all information about the two bodies at the moment of collision.
My goal is to make any body that touches the spring reach a certain height (from the spring), and move by certain speed horizontally, as you can see in the picture

So, the information about both bodies I have is: position, velocity, gravity scale, mass, weight.
What I want to achieve is constant line of movement of any object (that may have different properties I mentioned above) by applying a certain force to the colliding object.
I can stop the body before applying new force to it, that is, at the time of collision.
Rotation, friction, absorption and similar properties don't need to be counted on as the game I'm making is a simple one. With this I'm trying to make a predictable movement for the player to count on. I also plan to disable collision briefly at the time of collision so that the colliding object can touch the spring from any angle and the collision result would be the same.
EDIT:
Here's some of my testing
Stones have random mass from 1 to 50, in this case 45.748413, 41.445225, 24.259401 and 37.189552 and all have same gravity scale (GS), that is: 2.
The slime has GS of 5 and mass of 1.
I bothered to make a seamless gif, so you can only see the two jumps here. Because the spring has circular shape they fall apart after i think 10 bounces.

From this test I see that mass doesn't matter when I use @Sergio's method, so that's a step foreward. Thanks @Sergio!
func _on_body_entered(body):
    if body is RigidBody2D:
        body.set_linear_velocity(Vector2(0, -50 * body.gravity_scale))

Now, even though they don't reach the same height, they have same timing - from first touching the spring (yeah, i know, it doesn't look like a spring), to falling back. So that's also a step foreward, but I still don't have an idea how to get them all to get to the same height.

sentences:
Is an inertia tensor in local-space always diagonal? I'm looking at the implementation of a physics engine and I observe that the inertia tensor of a rigid body, in local-space coordinates, is stored as a 3 dimensional vector, rather than a 3x3 matrix, and the description says "A vector with the three values of the diagonal 3x3 matrix".
A diagonal matrix is one with all zero off-diagonal entries.
What I don't understand is why the inertia tensor in local coordinates would be diagonal?  Why couldn't it have non-zero off-diagonal entries?

sentences:
What approaches are there to re-designing 8/16-bit sprites for HD? I'm new to game development, and my skills with Photoshop are not that great.

I was planning to try to convert a old game to HD, but for this I need HD sprites. What is a good way to approach converting 8/16 bit sprites into something like HD? I mean something like this:

sentences:
Black stripes at the junctions of road segments I made a simple runner where the road is dynamically generated, and the sphere together with the camera moves with the help of Rigidbody velocity, but the problem is that black bars appear at the joints between segments, and if you add an AddForce sphere, then the sphere at the joints jumps which should not be. How to solve this problem

I checked the positions of the segments, they fully correspond to the desired ones, that is, there are no gaps between them, I use the standard shader

Segments 10.4 units in size. Imported from Blender, but if you take the standard cube model then the same thing (black bars), so that’s not the point. Positions between these segments:

The segment before (on which the sphere in the screenshot)

and the next segment

Road Material Settings:

sentences:
What's a way to implement a flexible buff/debuff system? Overview:

Lots of games with RPG-like statistics allow for character "buffs", ranging from simple "Deal 25% extra damage" to more complicated things like "Deal 15 damage back to attackers when hit."

The specifics of each type of buff aren't really relevant.  I'm looking for a (presumably object-oriented) way to handle arbitrary buffs.

Details:

In my particular case, I have multiple characters in a turn-based battle environment, so I envisioned buffs being tied to events like "OnTurnStart", "OnReceiveDamage", etc.  Perhaps each buff is a subclass of a main Buff abstract class, where only the relevant events are overloaded.  Then each character could have a vector of buffs currently applied.

Does this solution make sense?  I can certainly see dozens of event types being necessary, it feels like making a new subclass for each buff is overkill, and it doesn't seem to allow for any buff "interactions".  That is, if I wanted to implement a cap on damage boosts so that even if you had 10 different buffs which all give 25% extra damage, you only do 100% extra instead of 250% extra.

And there's more complicated situations that ideally I could control.  I'm sure everyone can come up with examples of how more sophisticated buffs can potentially interact with each other in a way that as a game developer I may not want.

As a relatively inexperienced C++ programmer (I generally have used C in embedded systems), I feel like my solution is simplistic and probably doesn't take full advantage of the object-oriented language.

Thoughts?  Has anyone here designed a fairly robust buff system before?

Edit: Regarding Answer(s):

I selected an answer primarily based on good detail and a solid answer to the question I asked, but reading the responses gave me some more insight.

Perhaps unsurprisingly, the different systems or tweaked systems seem to apply better to certain situations.  What system works best for my game will depend on the types, variance, and number of buffs I intend to be able to apply.

For a game like Diablo 3 (mentioned below), where nearly any bit of equipment can change a buff's strength, the buffs are just character stats system seems like a good idea whenever possible.

For the turn-based situation I'm in, the event-based approach may be more suitable.

In any case, I'm still hoping someone comes along with a fancy "OO" magic bullet which will allow for me to apply a +2 move distance per turn buff, a deal 50% of damage taken back to the attacker buff, and a automatically teleport to a nearby tile when attacked from 3 or more tiles away buff in a single system without turning a +5 strength buff into its own subclass.

I think the closest thing is the answer I marked, but the floor is still open.  Thanks to everyone for the input.

sentences:
How can I position framebuffer objects on the screen in OpenGL? I currently have two framebuffers which are drawn using

glBlitFramebuffer(0, 0, 1920, 1080, 0, 0, 1920, 1080,
    GL_COLOR_BUFFER_BIT, GL_NEAREST);

But the texture does not take up the whole screen, and I would like to position it at a certain x,y on the screen. The images by default start from 0,0 and then span the width/height provided, however I would like the image to start at say, [100, 100] and span the width/height provided.

How would I do this?

sentences:
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: Position of Gameobject Changes When Hit Play Button I have a 3D Humanoid model. When I press play button, suddenly position of model  changes and collider doesn't match with model.

sentences:
Scene Graph as Object Container? Scene graph contains game nodes representing game objects. At a first glance, it might seem practical to use Scene Graph as physical container for in game objects, instead of std::vector<> for example.

My question is, is it practical to use Scene Graph to contain the game objects, or should it be used only to define scene objects/nodes linkages, while keepig the objects stored in separate container, such as std::vector<>?

sentences:
How can I calculate where my camera can be to avoid showing something outside a region? I have a landscape model, which goes from the coordinate -45, -45 to 90, 90.

The edge of the model just cuts off and i would like to somehow stop the screen from ever passing these points. Basically sticking a boundary so that you can't see off the side. The game is always in top view, with the camera directly facing down.

However the problem is that the player can zoom in and out, obviously you have a wider range of view when zoomed out. (There is a limit to how far you can zoom out, you couldn't zoom out say, so that opposite sides of the map are seen at once).

I am assuming using something like Viewport.Project or Unproject, which changes screen coordinates to 3d space and the other way round, could somehow help me in the situation.

My initial idea may lag too much, which would be a while loop saying "While projection of screen point.X is less that -45, add 1 to the camera.X" etc.

Does anyone have any ideas for this? To sum it up, i need to find a way of stopping anything outside the area of -45, -45 to 90, 90 from being shown on the screen.

Thanks for any help!

sentences:
velocity question from book iPhone I am reading an iphone game dev book and I have a question about velocity.

mainly it is this line

playerVelocity = ccp(playerVelocity.x * dec + acceleration.x * sens, 0);

Why do you mutiple the playerVelocity.x by the deceleration. the book says it works by reducing the current velocity so it is easier to change direction and then add the ( acceleration.x * sens. )

this piece of code is using the accelerometer.

float dec = 0.4f; //lower = quicker to change direction;
float sens = 6.0f; //higher more sensitive;
float maxVel = 100;

playerVelocity = ccp(playerVelocity.x * dec + acceleration.x * sens, 0);
NSLog(@"%@", NSStringFromCGPoint(playerVelocity));

if(playerVelocity.x > maxVel)
{
    playerVelocity.x = maxVel;
}
else if(playerVelocity.x < - maxVel)
{
    playerVelocity.x = - maxVel;
}

sentences:
How do you calculate a gradient value within multiple colors (gradient stops) In WPF/Silverlight XAML you can have a brush with multiple gradient stops at different points along the color line.

I was able to replicate this behavior with two colors, a single color lerp, from this answer to my previous question: Code to generate a color gradient within a texture using a diagonal line

How do I do the same thing in that question, but with multiple color steps even at different widths from each other.

sentences:
Best way to render multiple objects I have a scene that consists of 1 player object, 1 platform, 1 enemy, and 1 background. Currently, this is how my render function looks like:

void Sprite::Render()
{
    glUseProgram(m_Program);
    glActiveTexture(GL_TEXTURE0);

    // Background
    glBindVertexArray(BackgroundVAO);
    glBindTexture(GL_TEXTURE_2D, m_Textures[1]);
    glUniform1i(glGetUniformLocation(m_Program, "Texture1"), 0);

    m_ProjectionMatrix = m_Camera.ViewToWorldMatrix();
    m_TransformationMatrix = m_ProjectionMatrix;
    m_TransformationMatrixLoc = glGetUniformLocation(m_Program, "TransformationMatrix");
    glUniformMatrix4fv(m_TransformationMatrixLoc, 1, GL_FALSE, &m_TransformationMatrix[0][0]);

    glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, 0);

    // Enemy
    glBindVertexArray(EnemyVAO);
    glBindTexture(GL_TEXTURE_2D, m_Textures[2]);
    glUniform1i(glGetUniformLocation(m_Program, "Texture3"), 0);

    m_ProjectionMatrix = glm::translate(glm::mat4(), glm::vec3(EnemyX, EnemyY, 0.0f)) * m_Camera.ViewToWorldMatrix();
    m_TransformationMatrix = m_ProjectionMatrix;
    m_TransformationMatrixLoc = glGetUniformLocation(m_Program, "TransformationMatrix");
    glUniformMatrix4fv(m_TransformationMatrixLoc, 1, GL_FALSE, &m_TransformationMatrix[0][0]);

    glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, 0);

    // Platform One
    glBindVertexArray(PlatformVAO);
    glBindTexture(GL_TEXTURE_2D, m_Textures[3]);
    glUniform1i(glGetUniformLocation(m_Program, "Texture4"), 0);

    m_ProjectionMatrix = glm::translate(glm::mat4(), glm::vec3(0.0f, -0.5f, 0.0f)) * m_Camera.ViewToWorldMatrix();
    m_TransformationMatrix = m_ProjectionMatrix;
    m_TransformationMatrixLoc = glGetUniformLocation(m_Program, "TransformationMatrix");
    glUniformMatrix4fv(m_TransformationMatrixLoc, 1, GL_FALSE, &m_TransformationMatrix[0][0]);

    glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, 0);

    // Player
    glBindVertexArray(PlayerVAO);
    glBindTexture(GL_TEXTURE_2D, m_Textures[0]);
    glUniform1i(glGetUniformLocation(m_Program, "Texture2"), 0);

    m_ProjectionMatrix = glm::translate(glm::mat4(), glm::vec3(PlayerX, PlayerY, 0.0f)) * m_Camera.ViewToWorldMatrix();
    m_TransformationMatrix = m_ProjectionMatrix;
    m_TransformationMatrixLoc = glGetUniformLocation(m_Program, "TransformationMatrix");
    glUniformMatrix4fv(m_TransformationMatrixLoc, 1, GL_FALSE, &m_TransformationMatrix[0][0]);

    glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, 0);

    glBindTexture(GL_TEXTURE_2D, 0);
    glBindVertexArray(0);
}

As you can see, it is unnecessarily complicated. And if I want to draw, say, two or more enemies, or 4 or more platforms, then it'd get ridiculously large! My question is this, how can I make this smaller? I prefer to be able to do something like this in my main.cpp: Sprite.Render(Player); Sprite.Render(EnemyOne); etc...

Looking forward to reading your tips, thank you!

sentences:
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:
How to obtain touch events from a GL Viewport, not the whole screen? Background

I'm implementing viewport resizing in order for my game to maintain the same display ratio on all devices.

However, I've found an issue with getting touch events.

Basically, if my viewport, for example, uses the whole of the physical screen's width and height then there is no issue.  However, if it is resized say in the vertical, then my touch events are thrown off, because touch events are registered from the top of the physical screen.  Hence if I put a sprite at say position 50 in the Y direction then it put's the sprite 50 pixels down from the top of the viewport, not the top of the actual screen.

Do I have to manage this myself by adding my viewport's offset to my touch events or is there a way to tell Android to register 0, as the top of the viewport as opposed to the actual screen.

Here is a graphic to illistrate what I mean, any help would be appreciated

sentences:
Simulating Physics - dt vs formula I was just wondering, when simulating physics is it usually a good idea to get the time delta from the last frame and apply the relevant motion equations?

Something like:

void simulate(float dt)
{
    vel += (force / m) * dt;
}

In this case wouldn't there be an accumulated error over time due to precision? For example when trying to simulate a circular motion?

Or would it be better to get the entire elapsed time from the beginning, and then apply the motion:

void simulate(float elapsedTime)
{
    vel = vel0 + (force/m)*elapsedTime;
}

And since this doesn't depend on the previous simulate() steps, it's less likely to cause precision errors?

Thanks!

sentences:
Collisions on complex map 2D I'm currently thinking about collision and map system that I want to use in my next game and I'm kind of puzzled. Maps are going to be somewhat complex with lots of irregularities and thus tiling is out of question.

I thought about an editor where you'd draw rectangles on the map that would represent areas that are collidable with and then saving such "collision map" with only black/white gfx. Or maybe should I save exact rectangles data with their x/y/width/height into some text file and go from there?

What would you recommend? Thanks.

sentences: MonoGame InstancePlayLimitException on Windows w/ OpenGL Why am I getting the InstancePlayLimitException when playing several SoundEffects per second  despite there being no limit unless programming for mobile? It occurs after only a few seconds of repeated playing. I am using Visual Studio 2013 and MonoGame 3.2.

sentences:
D3DXLoadSurfaceFromResource failed to load bitmap image I'm working on a small DX9 game project for learning purpose. I'm current dealing with resources manager file (*.rc) which I'm not used to (I have only worked with direct file until now).
If I use D3DXLoadSurfaceFromFile, it worked fine, the image was drawn on windows. When I changed to D3DXLoadSurfaceFromResource, I think it can not load the image, only a black screen & the Hresult that it returns is S_FALSE.
This is the create surface function :
bool Surface::CreateSurface()
{
    if (FAILED(m_Device->CreateOffscreenPlainSurface(
        m_Width,
        m_Height,
        D3DFMT_X8R8G8B8,
        D3DPOOL_DEFAULT,
        &m_Surface,
        NULL
    )))
        return false;

    if (FAILED(D3DXLoadSurfaceFromResource(
        m_Surface,
        NULL,
        NULL,
        GetModuleHandle(NULL),
        MAKEINTRESOURCE(m_RsSymbol),
        NULL,
        D3DX_DEFAULT,
        0,
        NULL
    )))
        return false; // S_FALSE and return false while debug
    return true;
}

This the render function :
void GWindow::Render()
{
    Surface Hello_Brown(146, 146, m_lpD3DV, IDB_SAMPLE); // IDB_SAMPLP will be assigned to m_RsSymbol
    LPDIRECT3DSURFACE9 backbuffer;
    if (NULL == m_lpD3DV)
        return;

    m_lpD3DV->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 255), 1.0f, 0);

    m_lpD3DV->GetBackBuffer(
        0,
        0,
        D3DBACKBUFFER_TYPE_MONO,
        &backbuffer
    );

    m_lpD3DV->StretchRect(
        Hello_Brown.GetSurface(),
        NULL,
        backbuffer,
        NULL,
        D3DTEXF_NONE
    );

    m_lpD3DV->Present(NULL, NULL, NULL, NULL);
}

Where I am wrong and how do I fix it?
Resource file : link
I linked the file above, because it too long to post here.

sentences:
Collisions with complex assets from Blender in SceneKit I have a very basic workflow question: I'm prototyping a game with Apple's SceneKit framework. It can automatically create a mesh for collision detection, but it will always be a convex hull. This works okay for simple meshes, but now I want my character wo walk into a house.
The options I could come up with:

Use the same mesh for the physicsShape (could be too complex and a performance bottleneck)
Build the level in SceneKit and only create atomic building blocks in Blender
Create a second low-poly version of the model and use that for collisions (basically twice the work?

As you can see I have zero experience with game development and best practices. What is the typical way to do this?

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:
Common light map practices My scene consists of individual meshes. At the moment each mesh has its associated light map texture, I was able to implement the light mapping using these many small textures.

1) Of course, I want to create an atlas, but how do you split atlases to pages, I mean do you group the lm's of objects that are close to each other, and load light maps on the fly if scene is expected to be big.

2) the 3d authoring software provides automatic uv coordinates for each mesh in the scene, but  there are empty areas in the texel space, so if I scale the texture polygons the texel density of each face wil not match other meshes, if I create atlas like that there will be varying lm resolution, how do you solve this, just leave it as it is, or ignore resolution ?

Actually these questions also applies to other non tiled maps.

sentences:
Finding Endpoint of line in Unity I have a startpoint, magnitude(length) and direction and want to find endpoint to construct the line
here is the code to make question more clear

private Vector2 GetEndPoint(Vector2 startPoint, Vector2 direction, float magnitude) {
    Vector2 endPoint = //some stfuff with parameters
    return endPoint;
}

And this is the visualization of what I want

Hope I am clear enough, any suggestions is welcomed

sentences:
Unity assets file structure I'm writing a map editor for a game built with Unity (5).

I want to reuse as much of the resources from the game as possible. That means textures and meshes.

I know they are somewhere in the assets files, but I need to be able to extract that data during runtime since I cannot (and do not want to) redistribute those files.

Additionally, given that the game receives frequent updates, I need to be able to calculate the offsets each time the editor is started. I also need to know how the textures connect to the objects in the game.

In order to do that, I need to know what the structure of assets file is, or at least find a way to extract them all and then use hex editor to figure out how they're put together.

I know there is a devxdevelopment tool that can do the latter, but I don't really have any money to spend on this.

Can you give me any info or pointers that would enable me to figure this out?

sentences:
Follow behaviour with transform.LookAt on Unity2d So i've been trying to make an enemy follow my player on Unity2d using transform.LookAt.
While it does follow the player, It also rotates the enemy as well in 3D but my sprite is made for 2d so the sprite just vanishes. Any ideas?

//follows player
transform.position = Vector2.MoveTowards(transform.position, target.position, speedEnemy * Time.deltaTime);

//make enemy look towards player
transform.LookAt(target);

sentences:
How to calculate score in my game based on playtime and coins picked? I've been trying to figure out a way to calculate the score in my game.... but nothing seems to work properly...

The score is to be calculated according to:

playtime
coins collected.

The playtime should be as low as possible and number of coins should be as high as possible.

For example:
Let's say an idle play for a level X has:

playtime = 15 seconds
coins = 20.

The score is 100.

Then what will be the score when the:

playtime = 20 seconds
coins = 14.

P.S.: Pardon me if the example is wrong but I can't figure out how to explain my problem...
Thanks in advance.

sentences:
Bitmap & Object Collision Help Is it possible to detect when an object and a bitmap collide. I have an arraylist of sprites that I am shooting with an image. I tried using this method here but as soon as the bitmap appears the sprite disappears, this is in the Sprite class:

public boolean isCollision(Bitmap other)
{
    if(other.getWidth() > x && other.getWidth() < x + width && >other.getHeight() > y && other.getHeight() < y + height);
    return true;
}

sentences:
Using texture() in combination with JBox2D I'm getting some trouble using the texture() method inside beginShape()/endShape() clause.

In the display()-method of my class TowerElement (a bar which is DYNAMIC), I draw the object like following:

void display(){
    Vec2 pos = level.getLevel().getBodyPixelCoord(body);
    float a = body.getAngle(); // needed for rotation

    pushMatrix();

    translate(pos.x, pos.y);
    rotate(-a);

    fill(temp);    // temp is a color defined in the constructor
    stroke(0);

    beginShape();
    vertex(-w/2,-h/2);
    vertex(w/2,-h/2);
    vertex(w/2,h-h/2);
    vertex(-w/2,h-h/2);
    endShape(CLOSE);

    popMatrix();

}

Now, according to the API, I can use the texture() method inside the shape definition. Now when I remove the fill(temp) and put texture(img) (img is a PImage defined in the constructor), the stroke gets drawn, but the bar isn't filled and I get the warning

  texture() is not available with this renderer

What can I do in order to use textures anyway? I don't even understand the error message, since I do not know much about different renderers.

sentences:
combine two translation/rotation/scale triplets without matrices Let t1/2, r1/2 and s1/2 be two sets of transformations.
Translations are vec3, rotations are quaternions and scales are vec3.
Lets assume that all common operations are defined (overloaded operators in c++).

How do I combine (in what order) the two sets of transformations into a third set t3, r3 and s3, such that mat4(t1, r1, s1) * mat4(t2, r2, s2) == mat4(t3, r3, s3), without actually converting to matrices?

Mat4 is composed as M = T * R * S. (OpenGL conventions, if it makes any difference)

Thanks

My original code:

transform transform::operator * (const transform &other) const
{
    transform r;
    r.orientation = orientation * other.orientation;
    r.scale = scale * other.scale;
    r.position = position + (other.position * orientation) * scale;
    return r;
}

this used to work when scale was just one number (uniform scale). But it does not work with non-uniform scale. I guess that one of the scales have to be rotated, but I am failing to find the correct way.

This is how I test it:

for (uint32 round = 0; round < 10; round++)
{
    vec3 pa = randomDirection3() * randomRange(-5, 20);
    vec3 pb = randomDirection3() * randomRange(-5, 20);
    quat oa = randomDirectionQuat();
    quat ob = randomDirectionQuat();
    vec3 sa = randomRange3(real(0.1), 10);
    vec3 sb = randomRange3(real(0.1), 10);
    transform ta(pa, oa, sa), tb(pb, ob, sb);
    test(mat4(ta * tb), mat4(ta) * mat4(tb));
}

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:
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:
How do I spread a LookAt rotation over 3 bones with different percentages? I'm trying to rebuild the RE4 controller.
At first, I thought that only the chest bone is used to rotate the pistol towards a target.
I have then however found a hack to put the camera in a fixed position so that I could actually see the bone rotations.
Juding the logic that I have recorded, I believe that first a LookAt rotation is used, and then this rotation is spread over the abdomen, abdomen2 and chest bones.
Looking at the video that I have recorded, I think that the rotation is not "divided by 3", but procentually and then again changing towards the limits (for example, at the limits, the rotation is mostly done only by the chest).
Can anybody tell me if my judgement is correct, and if yes, how to split a rotation this way?
Would this be correct?
-->
The chest bone moves the most, the abdomen2 less, and the abdomen bone moves the least.
In percentages:

chest bone: 60%
abdomen2 bone: 30%
abdomen bone: 10%

Let's assume a rotation of 200°.
Am I right to assume that the rotation of each bone is calculated like this?
Chest bone:
Gets 60% of 200°, that is 120°
Abdomen2 bone:
Gets 30% of 200°, that is 60°
Abdomen bone:
Gets 10% of 200°, that is 20°.
Thank you!
ps:
Here are a few screenshots, but it's much easier to estimate from the video:

sentences:
Procedural Breakout level generation I am currently developing a Breakout game for a school project, and I've decided to use it as an opportunity to get started with procedural content generation. I took a quick look at some of the basic procedural stuff, but I wanted to know if there is a known good method to generate levels for this kind of game (block patterns, "power up" distribution, etc).
Any articles or ideas are greatly appreciated.

sentences:
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:
SFXR-Like Tool for Speech Sfxr (and also Bfxr) is a great tool for generating sound-effects for games. Is there something like this for speech synthesis?

Not every game development tool and platform has a speech synthesis engine, and it would be great to at least get some decent-sounding placeholders in place to see how the usability/experience plays out. Even better if the results are tweakable, like sfxr.

I'm looking for something I can at least run on windows, though preferably (like Bfxr) I would like a web application that I can just run out of my browser.

sentences:
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:
Using of opengl buffers Newbie question, and sorry for my English. Suppose that we create a lot of GL_ARRAY_BUFFER buffers, fill them with some data. But only few of them we link with shader variables. During glDraw..., what happens with other non-linked buffers? Do they go to the pipeline as well as linked buffers?

I hear but can misunderstood, that all buffers linked to the current VAO will go to the pipeline
in any case, if they are involved in the shader or not. I hope this is wrong.

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:
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:
For 2D games, is there any reason NOT to use a 3D API like Direct3D or OpenGL? I've been out of hobby Game Development for quite a while now.  Back when I did it, most people used Direct Draw to create 2D games.  By the time I stopped people were saying OpenGL or Direct3D with an orthogonal projection is just the way to go.

I'm thinking about getting back into creating 2D games, in particular on mobile phone but maybe on the XNA platform as well.  To make something using OpenGL I'd have a (hopefullly) small learning curve to acclimate myself to 3D development.

Is there any reason to skip that and instead work with a 2D framework where I just have a Width x Height frame buffer I need to fill with pixels?

sentences:
issue with Compute Shader macbeth chart I'm trying to generate a macbeth chart using the compute shader, but there seems to be an issue with the output image.

here is the glsl code:

#version 430 core

layout (local_size_x = 32, local_size_y = 32) in;

layout (rgba32f, binding=0) uniform image2D data;

uniform int factor = 2;

const float colorMatchingFunc[3][72];
const float spectralData[24][36];
void spectrumToXYZ(uint colorIndex, out vec3 XYZ);

const mat3 XYZ_TO_RGB;
const float gamma = 1;

void main(void){

    uvec2 dim = gl_NumWorkGroups.xy/factor;
    uvec2 ij = gl_WorkGroupID.xy/factor;
    uint i = ij.x + dim.x * ij.y;

    vec3 xyz;
    spectrumToXYZ(i, xyz);

    vec3 rgb =  max(vec3(0), XYZ_TO_RGB * xyz);
    rgb = pow(rgb, vec3(1/gamma));

    imageStore(data, ivec2(gl_GlobalInvocationID.xy), vec4(rgb, 1));
}

and here is the c++ setup

static int factor = 4;
static int patchSize = 32;
int width = 192 * factor;
int height = 128 * factor;
glActiveTexture(TEXTURE(_id));
glBindTexture(GL_TEXTURE_2D, _buffer);
glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA32F, width, height);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glDispatchCompute(_width / (patchSize), _height / (patchSize), 1);

This setup and glsl code makes sure I get a 6 * 4 macbeth chart.

I'm assuming regardless of which invocation/workgroup I end up in I should always generate the correct color for the patch I'm currently on. but I seem to have som aliasing especially on the bottom row and its very noticable all rows on lower resolutions.

Low resolution image:

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

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

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

Normally, I move my player like this:

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

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

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

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

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

sentences:
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:
How slow is generating a new Vertex Buffer? I am currently working on a project that does 2D sprite-like graphics on Windows 8 (Metro-style app). For that purpose I am using Direct3D with quads to act as sprites.

My problem is that it get's very slow (30fps at 100 sprites) and profiling led me to believe that the bottleneck is withing the CreateBuffer call. How can I solve that problem in an elegant way? Wouldn't gathering copying vertex data from all elements that share the same texture in a single, bigger, buffer be more cost-prohibitive, as it is all done on the CPU?

sentences:
Rotating a sprite to touch I know this has been asked before and Ive looked through peoples questions and answers all over the internet and I just cant get it to work.
Im sure its down to my inexperience. Ive got an arrow attached to a sprite, this sprite appears when touched but I want the arrow to point where the sprite will launch.
I have had the arrow moving but it was very erratic and not pointing as it should. Its not moving at the moment but this is what I have.

- (void)update:(ccTime)delta
{
    arrow.rotation = dialRotation;
}

-(void) ccTouchMoved:(UITouch*)touch withEvent:(UIEvent *)event
{
    pt1 = [self convertTouchToNodeSpace:touch];

    CGPoint firstVector = ccpSub(pt, arrow.position);
    CGFloat firstRotateAngle = -ccpToAngle(firstVector);
    CGFloat previousTouch = CC_RADIANS_TO_DEGREES(firstRotateAngle);

    CGPoint vector = ccpSub(pt1, arrow.position);
    CGFloat rotateAngle = -ccpToAngle(vector);
    CGFloat currentTouch = CC_RADIANS_TO_DEGREES(rotateAngle);

    dialRotation += currentTouch - previousTouch;
    }

I have got pt from ccTouchBegan the same way as pt1

Thanks

sentences:
Is basic SDL hardware accelerated? I'm going over some SDL tutorials aimed at creating 2D games.

However, when I create a basic SDL program - is it hardware accelerated?

Or is hardware acceleration only relevant when it comes to 3D animations? Can a GPU help when it comes to pure 2D graphics?

sentences: Break a learning barrier with Java + LWJGL I have been coding with Java and LWJGL for some time. I mainly use thebennybox's tutorials, but I can't always remember the 3D rendering. But even when I have a 3D rendering models, planes, cubes, etc. I can't get past that. I need a good LWJGL tutorial! I look up to Notch and I know a good bit about Minecraft's history, and wish I could code as fluently as him. I also understand a good bit of Java.

sentences:
how to recieve a trigger with collider or recieve a trigger with collider in unity i know if your object has a Collider you can sense another Collider with OnCollisionEnter function or... and you can sense another collider with trigger with OncollsionEnter function and...
but i want to sense other object with trigger even with collider or even with trigger. i cant sense otherobjects that have triggers. for example i have bullet that as i dont want to collider have any physics i turned it to trigger but how can make a charcter to sense it?

Thank you for helping

sentences:
What is the recommended way to store game entity data? The following is specific to my problem, but I believe the principles can be applied to any game.

I am currently working on a 3D game which will have many different types of spaceships.
The physics and behavior of the spaceships are controlled by a base 'Ship' class. This base class in turn derives from a 'Drawable Object' class which handles the transformations and drawing of the ship.

I want the spaceships to have a set of stats such as

Max speed
Cargo capacity
Weapon power
etc

that can be passed into the physics and behavior functions.

However, during gameplay new spaceships will be able to be bought/upgraded, but i want to be able to pre-define a (possibly large) list of setups that will be available to the player.

What is the best way to store the available stat setups?

Should I be using a large JSON/XML file or similar to store the stats which is loaded at runtime?
Or might I just as well hard-code the stats into the constructors of a set of derived classes?

The actual physics attributes (location, velocity etc) and its stats of a particular spaceship are being saved to file when the game is actually played.

I have researched about entity-component-system architecture, but I haven't found much about how to define these entity stats.

Any advice on improving my entity architecture would be much appreciated - this is one of my first attempts at hobby game development.

sentences:
Controlling depths of objects in Flash I am trying to change depths/ layers of my gameobjects inside the game using flash. To be more specific, I have a horse object and a fence object. I set them up initially on stage and the horse layer is in front of the fence which is correct like shown below

Now at some point in my game, the horse moves behind the fence. So the Fence layers should now be in Front. Right now, when the horse moves behind the fence, it is still in front because of course its layers has not changed like shown in image below. How do I control this using ActionScript?

Hope someone could throw some ideas here!

sentences: Decompile an FX shader Is it possible to decompile a .xnb file?  I've lost my shader code, but only have my .xnb file left.

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:
Vector Art Tool: Size, Position, Shapes, Symbols I'm looking for a vector art tool for gameart, similar to Flash, but preferably free. It just needs the following capabilities:

Create vector images (can scale up/down without losing quality)
Specify shape X/Y to the pixel (eg. set the X to 24.1, like in Flash)
Draw primitive shapes (square/circle/triangle) with border and colour (or gradient)
Specify shape width/height in precise pixels
Export to PNG

Flash can do all this, but it's expensive (and heavy to install). Is there a free alternative that I can use?

This is NOT for pixely, pixel-style art.

sentences:
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:
Bullet Physics - scaling I have added Bullet to my game engine. So far I am using translation and rotation, and it works fine. But now, I want to scale my geometry (eg. user can drink some potion an became small :-)).

I am using

btWorldTransform.setOrigin(origin);
btWorldTransform.setRotation(rotation);

to set position of bullet body directly (it is done only once in initial object placement in scene or in case of teleportation etc. otherwise position is updated by bullet and forces)

Now, if I put object into scene, I set its btCollisionShape and that has some fixed size. Now, I change size of my scene object, graphics has scale, but what to do with bullet collision shape?

I have found setLocalScaling method, but I am not sure if it is, what I want. Can someone verify this?

sentences: What is the easiest way to make an object follow the edge of a sprite? I have a rounded rectangle sprite and another sprite that's just a circle. I want the center of the circle to follow the edge of the rounded rectangle. Is there any easy way to accomplish this task? I've seen other answers that talk about curve and AI predictive algorithms, but they all seem more complicated to implement that for my current needs. Is using these algorithms necessary for what I'm trying to do, or is there an easier way to make one sprite follow the edge of another?

sentences:
Moving the bulk of a recursive ray tracer function to the gpu, using DirectX12 not DirectX 12 DXR HLSL So I'm wanting to generate images by ray tracing. I've done so, but the main ray function is recursive. I know one can make a non recursive function out of a recursive function using a stack, but is it possible to do in HLSL? I have the bulk of the function I'm using here:
color ray_color(
    const ray& r,
    const color& background,
    const hittable& world,
    const shared_ptr<hittable>& lights,
    int depth) {

hit_record rec;

// If we've exceeded the ray bounce limit, no more light is gathered.
if (depth <= 0)
    return color(0, 0, 0);

// If the ray hits nothing, return the background color.
if (!world.hit(r, 0.001, infinity, rec))
    return background;

scatter_record srec;
color emitted = rec.mat_ptr->emitted(r, rec, rec.u, rec.v, rec.p);

if (!rec.mat_ptr->scatter(r, rec, srec))
    return emitted;

if (srec.is_specular) {
    return srec.attenuation
        * ray_color(srec.specular_ray, background, world, lights, depth - 1);
}

auto light_ptr = make_shared<hittable_pdf>(lights, rec.p);
mixture_pdf p(light_ptr, srec.pdf_ptr);
ray scattered = ray(rec.p, p.generate(), r.time());
auto pdf_val = p.value(scattered.direction());

return emitted
    + srec.attenuation * rec.mat_ptr->scattering_pdf(r, rec, scattered)
    * ray_color(scattered, background, world, lights, depth - 1)
    / pdf_val;
}

sentences:
How should I use Monte Carlo method to simulate some police cars that keep patroling in a tile based map? I have a tile map (isometric) and I have some police cars that they patrol all the time on the map, there is some building and other cars in map too so they are considered as constraints in my shortest path algorithm (below).

I use to randomly select some target for each police car and use A* algorithm to find the path to the randomly selected destination tile and this cycles over and over. because cars should move all the time! (except those that gamer should control)
The problem is police cars routes are correlated and they do not just traverse the area randomly, for instance, they do not usually cover a same area or they do not repeat their own route so my implementation based on some random destination point wasn’t a good idea and the result was not satisfying. Take a look at the following picture, it shows how randomly selecting the destinations worked for me, obviously, it is a dumb patroling for sure, even a cockroache could do better!

Suddenly, I remembered Monte Carlo Method and I thought it would solve my problem, because it exactly does what I wanted to do, However may be I should use Zobrist Hashing since it is tile base in nature. Does anyone has any idea how should I use this kind of methods?
Question in Brief :
How can I use Zobrist Hashing or Monte Carlo method to set destinations points for my patroling car (like police car)?
If anyone knows another way to implement a patrolling method, he/she is very welcome to post an answer, I am not sure if Zobrist Hashing is the best and worth to implement.
---First Edit (added following paragraph) :
I need to distribute the cars and their destination points in a homogeneous manner. Every kind of solution that get me close to a good pattern could be my answer, of course there is a lot of methods to do so, but I dont have any clue.

sentences:
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: 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:
Drawing order of 2D tiles with 3D bounding volume I'm wondering which algorithm was used to draw the sprites of the video game Commandos in the correct order. Each sprite has a 3D bounding volume (either a polygon or a cylinder), this is how the developers stored the information:

POLY "NONAME",73,987,0,54,7,1   ;Name,CenterX,CenterY,CenterZ,Height,#Vertices,#Tiles
POINT        0,-37              ;Coord. X, Coord. Y
POINT        36,-18
POINT        36,-1
POINT        28,28
POINT        -21,37
POINT        -36,1
POINT        -36,-9
TILE          37, 581,  74,  83,   0,   0, 0,"ROC10010.RLE","   "   ;PosX,PosY,Width,Height

POLY "NONAME",70,816,0,120,4,1
POINT        0,-8
POINT        8,6
POINT        0,10
POINT        -8,-3
TILE          48, 434,  50,  98,   0,  41, 0,"POST0001.RLE","   "

POLY "NONAME",1557,4094,0,44,0,1
RADIO       17
TILE        1539,2588,  37,  55,   7,   0, 0,"DEPT0000.RLE","   "

POLYRAMPA "NONAME",626,952,0,48,40,4,1  ;Name,CenterX,CenterY,CenterZ,Height,HeightOff,#Vertices,#Tiles
POINT       43,-8
POINT       2,29
POINT        -36,-7
POINT       1,-45
TILE         590, 515,  85, 111,   0,   0, 0,"CASA0003.RLE","   "

The last object named 'POLYRAMPA' is used for stairs and ramps.
Edit: All bounding volumes are convex and don't overlap each other.

And here are some in-game screenshots:

The first three screenshots show the same map. Of course it's possible to fake the drawing order of this 'flat' map by sorting the sprites by their y-value.

But this approach won't work if the map is more complex, like the one at the bottom right.

So my question is: Which algorithm did the developers use?
Bonus question: Is there some source code available? (pseudocode or any object-oriented programming language would be great)

Edit: Sorting by the XYZ-coordinates of the bounding boxes center point doesn't work.For example:

The objects on the left side have the same center points as the objects on the right. The cylinder on the left should be in the background but the one on the right in the foreground.

sentences:
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:
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:
How do I create a World Healing Wave effect? I want to change my dark and depressing background to a happy grassy background, in real-time, such that the happy background is shown in a radius around a game character.

A forcefield of happiness, if you will.

How can this be done as performantly as possible when rendering to a canvas in a custom view?

UPDATE:
Here's how it works in my head:

    private int hModeX, hModeY;
    private float hModeRadius = 0.1f;
    private float hModeStart = 0;
    happyModeBg = Bitmap.createScaledBitmap(happyModeBg, getWidth(),getHeight(), true);
    hModeX = getWidth()/2;
    hModeY = getHeight()/2;

private void initHappyMode(Canvas canvas){
    hModeRadius = 75 * thread.getDelta();

    if(hModeRadius > 500) {
        hModeStart = timestep; //What is timestep?
    }

    //context.arc(x, y, radius, 0, 2 * Math.PI, false); <- your version
    canvas.save();
    canvas.drawArc(oval, startAngle, sweepAngle, useCenter, paint) // <- my version
    //context.clip(); <- dont know what this does or if there is an equivilant
    canvas.drawBitmap(happyModeBg, 0, 0, null);
    canvas.restore();
    //requestAnimationFrame(step); <- dont know what this does since I cant seem to find it for android

}

I'm using canvas.drawArc() to make a circle, but I'm definitely missing something.

sentences:
Calculating the distance from a line to a point in 2D I have a simple setup:

How do I calculate the orange distance?

It's the distance between the block on the left to the white line in the center (X & Z axes combined).

I don't have the intersection point. My only knowledge of the white line is that it goes through the point (0, 0, 0), running between (10, 0, -10) and (-10, 0, 10)

My problem is that I need to calculate this distance without the depth (Y value). Only on two planes combined: X & Z

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: How do I stop a moving object when colliding with a static wall or falling to a static ground I'm writing my very first 2D game engine in C++ and SDL2. I wrote a very simplistic RigidBody class that computes the resultant force, applies forces and simulates gravity. I also wrote a BoxCollider class and a QuadTree class which as any game dev would know manages collisions. Every thing seems to be working fine, however I'm facing a pit stop I can't wrap my head around. How do I stop a GameObject when it collides with a static wall or ground. I tried setting the velocity to zero but that literally freezes the object and I can't move it using my controls. Also setting the gravity to zero doesn't stop the object since it still has a non zero velocity and it sort of digs it's way through the ground. How can I implement this and if there are any decent tutorials regarding my question please do share them. Thanks!

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:
screen space or pixel space for a GUI? I want to design a very simple GUI for my game using OpenGL.

So far, every GUI implementation I have seen uses pixel space coordinates ( x range 0.0 to screen width and y 0.0 to screen height)

Why aren't they simply using screen space coordinates ? ( x and y range -1 to 1)

With screen space coordinates we would'nt have any issue with screen resizing, plus we won't have to transform coordinates for OpenGL since we use same space.

So why every GUI engine uses pixel space ?

sentences:
An efficient way for generating smooth circle I'm looking for creating smooth circle. OpenGL supports point, line, and triangle. To create other primitives like circle, we utilize the preceding shapes. In my case, I've utilized points as follows:

float radius(0.5f);
for ( float angle(0); angle < glm::radians(360.0f); angle += glm::radians(0.5f) ){
    Vertex vertices[] = { Vertex(glm::vec3( radius*cos(angle), radius*sin(angle), 0)) };
    meshes.push_back(   new Mesh(vertices, sizeof(vertices)/sizeof(vertices[0]), 'P')   );
}

In rendering loop,

while( Window.isOpen() ){
    Window.PollEvents();
    Window.clear();
    //================( Rendering )=========================
    Shader.Use();

    for ( int i(0); i < meshes.size(); ++i )
        meshes[i]->draw();

    //======================================================
    Window.SwapBuffers();
}

The result is

Now to create smooth circle, basically I just increase the number of points. I don't like this approach since I need to create a lot of points for single shape. My question is is there an alternative yet efficient approach for this issue?

sentences: How 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:
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:
XNA GameTime before first Update Using XNA, is it possible to access the GameTime object before Update is called for the first time?

Can it be used in the game constructor, Initialize or LoadContent methods?

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

Youtube Link

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

These are the properties of my player:

And the block only has the default box collider.

Any ideas?
Thanks!

sentences:
How do you display non-cutout transparent 2D textures with a depth buffer? (OpenGL) I've been able to get my 2D renderer to display transparent cutout textures by testing the alpha of a fragment and discarding if it is less than 1 (or any fraction really). The problem is I want to support using translucent textures.

The current way I sort my sprites is by what texture they use, so that I can minimize texture changes. The only way I can think of getting this to work properly is by scrapping that and only sorting by z-order. But I don't want to throw away the optimization I already did. Is there any way to do both?

Does only rendering in 2D simplify the problem at all?

I was hoping to support translucent sprites, but my font renderer makes translucent font textures, so I can't just only use cutouts.

EDIT: After doing some research, it seems there really is no easy way to do this. (depth peeling for a 2D renderer seems a little overkill) I'm going to compromise by having my renderer hold 2 different sets of sprites, cutouts and translucent. I can draw the cutouts first in whatever order I want, making full use of texture atlases. The translucent textures, however, will need to be in z-order, ignoring atlases.

If anyone can tell me a better way, I'm all ears.

sentences:
How to determine collision direction between two rectangles? I am trying to figure out how to determine the direction a collision occurs between two rectangles.

One rectangle does not move. The other rectangle has a velocity in any direction. When a collision occurs, I want to be able to set the position of the moving rectangle to the point of impact.

I seem to be stuck in determining from what direction the impact occurs.  If I am moving strictly vertically or horizontally I manage great detection.  But when moving in both directions at the same time, strange things happen.

What is the best way to determine what direction a collision occurs between two rectangles?

sentences:
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:
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:
Can somebody explain this behavior in pygame? I have an image that I'm rotating and moving

And when the rotation angle is negative the image moves as expected.

But when the angle is positive it moves it's origing point to the left

Can anybody explain this behavior, and how to solve it?

Here is the code

import pygame, sys
import math

screen = pygame.display.set_mode((700, 400))
wrench = pygame.image.load('prueba.bmp')
white = (255,255,255)

ox = 20
oy = 32
running = True
posX = 100 - ox
posY = 100 - oy

pygame.init()
while running:
    event = pygame.event.poll()
    if event.type == pygame.QUIT:
        running=0
        screen.blit(wrench, (posX, posY))
    if(pygame.time.get_ticks() <= 20000):
        screen.fill(white)
        t = pygame.time.get_ticks() / 1000
        ang = math.degrees(math.pi / 2 * math.cos(math.pi * t))
        #ang = math.pi / 2 * math.cos(math.pi * t)
        print(ang)
        posX = 100 + (50 * math.cos(math.pi * t)) - ox
        posY = 100 + (20 * math.sin(math.pi * t)) - oy
        rotated_wrench = pygame.transform.rotate(wrench, ang)
        screen.blit(rotated_wrench, (posX, posY))
    pygame.display.flip()

sentences:
How to detect collisions in Unity ECS? I am creating a game using the new Data-Oriented Tech Stack (DOTS).
I am using Entities with the PhysicsShape and PhysicsBody authoring components of the new Physics package. Some of my PhysicsShape have "Collison Response: Collide Raise Collision Events" set. Unfortunately the documentation of the new Physics system doesn't say anything about how I can detect and handle these collision events, and information on the Internet regarding this is very sparse and disorganized. How can I detect when one PhysicsShape collides with another one sending collision messages and run some code in that case?

sentences:
Issues compiling .fx shader to MGFX I've been trying to port Catalinzima's 2D lighting example over to MonoGame to try and get some basic understanding around it and adapt it for use in my engine. I've been trying to convert the two .fx files provided with it to MonoGame compatable .mgfxo files. The first file ran through the converter and compiles successfully. However, the second file ran into issues converting; cmd Dump:

C:\Program Files (x86)\MSBuild\MonoGame\v3.0>2MGFX.exe resolveShadowsEffect.fx /DEBUG
C:\\Program Files (x86)\\MSBuild\\MonoGame\\v3.0\\resolveShadowsEffect.fx(213,8):
error X5608: Compiled shader code uses too many arithmetic instruction slots (85). Max. allowed by the target (ps_2_0) is 64.
(1,1): error X5609: Compiled shader code uses too many instruction slots (99). Max. allowed by the target (ps_2_0) is 96.

Failed to compile the input file 'resolveShadowsEffect.fx'

So i thought fine, ill just change the PixelShader model to ps_3_0. Now this converts fine, but fails to compile in visual studio with the following errors:

A namespace cannot directly contain members such as fields or methods (1, 1)

and..

Unexpected character '' (1, 5)

In the visual studio error message this character shows as '|' but its not the same when i paste it out.

I've tried comparing the first lines of the files, but have not been able to notice any differences.

I'm pretty new to using shaders, so i haven't been able to debug whats going on effectively. Any ideas?

You can find the original shader files and compiled versions here: http://puu.sh/9ZfMe/efe8fbaf9d.zip

sentences:
Still i can't make the cross hair to be in the middle of the screen, What am i missing? In the editor i did:

GameObject > UI > Image

On the Canvas i changed the Render Mode to Screen Space - Camera.

It created a Canvas and a child Image in the Hierarchy.
Then i changed the Image source to UISprite changed the color to red also added to it a material in red.

I can't changed the Canvas anchors not sure why.

The Image rect transform anchors is set to the center.

I don't have a Main Camera the only camera i have is on the FirstPersonController (The FirstPersonController is a child of a FPSController).

But still the red dot/circle is a bit to the left not in center.

Screenshot of the Canvas:

And two screenshots of the Image:

And

sentences: What does rebuilding the .vcxproj file do? I'm having the same problem this user had.  The solution is confusing me, because all I want to do is comment out the code I added that caused the compiler crash, get Unreal to accept it and stop crashing, but he sounds like he is rebuilding the whole engine, and I just have one crashing project.  I tried commenting out the code and saving the visual studio project, but it didn't change anything.  What is his solution doing?

sentences:
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:
Pygame falling shape and keyboard input I want a shape in pygame to fall down slowly. The user should be able to move the shape with the arrow keys. My code is given below:

while Running:
    Keys=pygame.key.get_pressed()
    if event.type == pygame.QUIT:
        Quit()
    elif event.type == pygame.KEYDOWN:
        if event.key ==pygame.K_LEFT:
            x=x-1
    y=y+1
    pygame.time.wait(3000)

However, it doesn't always take in the keyboard input if the shape is falling. e.g I will have to press the left arrow key 5 or 6 times for the shape to move. Any idea how I can sort this out?

update: I think the error is in the following code, but if I don't have it then the shape falls too quickly.

    pygame.time.wait(3000)

sentences:
Lists of concrete types show up in inspector, but not lists of interfaces In one of my custom C# classes in Unity, I need to expose a List of objects in the inspector, and they need to conform to a specific interface.

Below are two lines from my class definition. Card is a concrete type in my game, and CellObserver is an interface. Multiple classes may implement this interface, so I'd like to define it this way if possible.

public List<Card> currentCards;
public List<CellObserver> observers;

The list of Card objects shows up in the inspector just fine, but lists based on CellObserver don't. It's not unique to this interface either - I also have one on another class that behaves the same way.

The code builds just fine, and as far as I can tell, this is valid in C#. Is there something else I need to do in Unity to implement this list? Or is this simply not an option in Unity?

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:
Does the Maya FBX 2013.3 exporter write tangent and binormal data? I'm making an XNA game at the moment and I'm trying to knock out my bump map shader right now. However when I compile the game crashes at the mesh.Draw() line and tells me TANGENT0 is missing. Apparently the FBX 2012 exporter didn't export tangent and binormal data properly, and I'm still having this problem despite installing the most recent exporter for Maya 2012.

For the record the plug-in readme tells me that bug is fixed and I am checking 'Tangents and Binormals' when I export.

What am I doing wrong?

sentences:
Cannot implicitly convert type 'T' to 'UnityEngine.Vector3' I'm trying to use C# generics on a method in order to send a Vector3 (position) as a parameter. I can print the value correctly but can't store it on a local variable. I also can't access its x, y or z attributes separately.

I'm implementing a state machine. My intention is to use generics for allowing sending different parameters to the different states. The value will be sent to an "Enter" method which will be called once on each state every time that state is set to active or current.
So for example: the player will be on the DefaultState->something happens->change state to HeroTeleportingState while sending it it's new position

This is my Enter method on the HeroTeleportingState class:

void IState.Enter<T>(T newPosition)
{
    //The following line prints the correct value
    Debug.Log("move this hero to " + newPosition);

    //The following lines don't work
    //pos = newPosition
    //pos.x = newPosition.x;
}

The method call is just something like: currentlyRunningState.Enter(Vector3.one);

pos = newPosition gives me the following error on Visual studio (I'm paraphrasing cause my visual studio is in spanish):

  Cannot implicitly convert type 'T' to 'UnityEngine.Vector3'

And pos.x = newPosition.x gives me something like:

  'T' does not contain a definition for 'x' and no extension method 'x' accepting a first argument of type 'T' could be found

EDIT: IState interface:

public interface IState
{
    void Enter<T>(T value);

    void Execute();

    void Exit();
}

sentences:
Scene components and renderer I'm currently writing a very small game engine for learning purposes, and hit a block when trying to separate the engine's logic from the "rendering" module.

My current approach is to feed my renderer with a pointer to a "Scene", iterate through its nodes, test them with a static_cast(yeah you read that right) to a "Renderable" object (for example a static mesh class that contains a material and a vertex array) and draw.

I'm aware that this approach is terrible but I can't think of an alternative. At this point I feel like my architecture is complete spaghetti. Any indication would be much appreciated.

sentences:
admob ads problem in uity In unity 2019.1.3f I want to implement google admob ads in that game but after importing GoogleMobileAds-v3.18.0.unitypackage in to my project I got a porblem.

when I hit play button

this window poped up.

Please help me regarding the problem

Thank you

sentences:
Huge performance difference when using drawImage with IMG vs CANVAS I put together a couple of simple tests that render an image to a canvas. One renders from an IMG, while the other renders from an offscreen CANVAS. You can see the code and results here: http://jsperf.com/canvas-rendering/2

In most browsers rendering from an image is much faster than rendering from a canvas, except in Chrome, where the situation is reversed. Can anyone explain the reason for the differences? After all, we are rendering the same pixel data to the same destination.

sentences:
Implementing a 2D Platformer Game Engine Any ideas where I can find info about making 2D jump & run games? I need some general ideas, so I wouldn't reinvent wheel (at least where game design is concerned).

Another point is that I am thinking of using boxes instead of images for collision testing. However, it should possible that I can implement slopes. Commander Keen 4+ is a good example of my idea.

Actually, what is troubling me is of course the collision testing and simple physics (mainly gravity).

I've got to build the engine myself and it for the J2ME.

Thanks a lot, guys!

sentences:
My VBO is always empty I'm trying to render an obj file with a VBO but I have some problems. I have a Renderer object that has a method "setPositions()" that simply stores some data from a QVector to a VBO. The render part is in another method. I couldn't render anything, so I wanted to check if the array was really copied in the VBO. Instead of working on the Qvector, I wrote this simple code to make some test to render a simple square. As you guessed, the bufferSize variable is still at 0, and I have no render.

     /* setPositions() */
     float vertices[] ={
          0, 0, 0,
          100, 0, 0,
          100, 100, 0,
          0, 100, 0
     };
     glGenBuffers(1, &pos); // Gluint pos : class attribute

     glBindBuffer(GL_ARRAY_BUFFER, pos);

     glBufferData(GL_ARRAY_BUFFER,
                   12 * sizeof (float),
                   NULL,
                   GL_STATIC_DRAW);
     glBufferSubData(GL_ARRAY_BUFFER,
                      0,
                      12 * sizeof (float),
                      &vertices[0]);

     int bufferSize = 0;
     glGetBufferParameteriv (GL_ARRAY_BUFFER, GL_BUFFER_SIZE, &bufferSize);

     if (bufferSize != (12*sizeof(float)))
     {
          glDeleteBuffers (1, &pos);
          std::cout << "sizes mismatch. Buffer: " << bufferSize << " Array : " << 12*sizeof(float) << std::endl;
     }

     glBindBuffer (GL_ARRAY_BUFFER, 0);

     /* render() */
     glBindBuffer (GL_ARRAY_BUFFER, pos);

     glEnableClientState (GL_VERTEX_ARRAY);

     glVertexPointer (3, GL_FLOAT, 0, BUFFER_OFFSET (0));

     glDrawArrays (GL_QUADS, 0, 4);

     glDisableClientState (GL_VERTEX_ARRAY);

     glBindBuffer (GL_ARRAY_BUFFER, 0);

Does somebody have an idea ?

sentences:
Breathing for game/movie characters Breathing (the movement of chest and face features): I'd like to ask if it is hard to model and whether it is computationaly expensive. I recently noticed the great effect it has in Madagascar 3 movie, but (please, correct me if I am wrong) don't remember seeing it in any games (except maybe steam cloud in cold/winter setting) and very few animated movies does that to noticable degree (e.g. when it is necessary by the plot or situation).

I'd greatly appreciate answers from both movie graphics and game graphics perspective.

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:
Make handlers visible on scene load In my dev enviroment I have a couple custom handlers I want to always be visible.

I have already figured out that I can do this by deriving a class from Editor, linking it to the desired component type, and then appending the render method to SceneView.duringSceneGui (in OnEnable(), as the target gameobject information will be available there).

However, this appending now only happens once a specific gameobject carrying the component has been selected. Is there a way I could have the Editor's OnEnable() method properly trigger on opening a scene, for all relevant gameobjects, without manually selecting them first?

sentences: Declaring another alpha or beta testing after a game app for Android (APK file) is uploaded and already published in Google Play Store This question is related about alpha or beta release in Google Play Store. . Let's say my app (APK file) was uploaded in alpha/beta testing. If one of the testers satisfied or quick fixes on the bugs, then I'm gonna go promote to production, which means publishing an app. Now, let's say I wanna go for another alpha or beta testing for the next version before updating new version in production. I have to test it; let's say testing for the leaderboard or achievements created from the Game Services at Google Play Developers Console, adding Google Play Games plugins for Unity to the app, and then uploading the new APK version for the next beta release before updating new version in production. Is it possible or not?

sentences:
Most efficient way to draw vertex with OpenGL I am writing an OpenGL 3D game.  There will be tons of triangles for terrain and objects in use.

I am studying from the OpenGL official guide and the first presented method is to call a function glVertex after the glBegin for each vertex you want to draw.

However this method sounds quite antique and inefficient when you have to draw thousands of triangles. I guess there are methods to store in the graphic card memory the information that does not change at every frame so that when you render each frame that information is already there. While for more "unstable" information probably you have to send new vertex data every frame and so a different tecnique might be more efficient.

Coming to my question: I would like a clear explanation of the most modern and efficient OpenGL functions and tecniques used to send vertex information to the hardware and to give instruction to render.

What are the best ways and OpenGL tools to send the order to render vertex data that seldom changes during the frames (i think of terrain and objects) and what it the best way to send vertex data that changes a lot during frames?

sentences:
Should I use one line per .wav or one scene per .wav for character speech? I'm building a game in XNA and I wanted to know how I would organize the character speech portions of the game. These would include both cutscenes and anything else where characters interact.

I wanted to know if it would be more efficient to use sound file (.wav) per character line, such as:

SCENE 4: ENTERING THE CAVE

PLAYER1: Wow, this is going great! } One file called "04_PLAYER1_01.wav"
PLAYER2: I know! } A file called "04_PLAYER2_01.wav"
PLAYER1: Let's get going! } A file called "04_PLAYER1_02.wav"

I wanted to know if that would be better opposed to:

SCENE 4: ENTERING THE CAVE

PLAYER1: Wow, this is going great! }
PLAYER2: I know!                   } One file called "scene_04.wav"
PLAYER1: Let's get going!          }

I am aware that by going with option 2, you'd probably save a bit more space because you have less files (but they might be larger) but it poses the problem of coordinating it all.

I was thinking maybe XML for coordinating the speech and cutscenes, but am open to other suggestions. :)

P.S. This not intended to be a "DIALOG-TREE". These are actual models moving their lips in accordance with sound!

sentences:
my iPhone app skips the splash screen! I have developed an iPhone app. When I have installed it in the device, it worked fine, ie it showed, the logo screen, the title screen and goes to game screen and now I have exited pressing the home button. The problems starts when I relaunch the app, it straightly goes to the game screen, by skipping the splash screens.

While I was working on it the app crashed and when I launched again it showed the logo screen and title screen. But when I relaunched it, the splash screens where skipped.

Could you tell me the possible errors that might have occurred?

sentences:
What are the different ways to balance an online multiplayer game where user spend different amounts of time online? Let's consider a game where every player is building his own medieval town. To make this question simple, let's assume that, on this persistent world, some people will play an hour every day (heavy players), and others will spend an hour per week (light players).

To keep the game fair, a gamer with a lot of free time shouldn't be able to grow much faster than a less present gamer just because he connects more often to the game.

So the first idea is to have a sort of time-based budget: You are saving "action points" as the time is passing. When you connect, you are able to spend this "action points". This way, players are fairly treated...

I see 2 problems:

On one hand, heavy gamers should have the opportunity to play. As often that they want to...
On the other hand, light gamers will be able to connect and make a lot of "actions" in a really short range of "real time" (for instance without been "seen" as the heavy players are..)

So my question is:

What are the solutions that allows light and heavy players to play flairly and balanced regardless of free time to play?

sentences: LibGDX - Draw multiple textures with different positions with one shader? currently I'm optimizing my render calls by drawing multiple textures with one shader. The background textures who all share the same position are no problem. But now I want to draw some Textures with different positions with one shader. I think it isn't possible, because the textures don't have the same geometry. But maybe there is a possible way to do this? I never worked with the geometry shader for example. For example, draw a 512x512 texture to position (100, 50), draw a 256x256 texture to position (500, 300)... , like in this picture:

sentences:
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:
Integration of gravitational interaction I don't know if this question get her place in physics.stackoverflow forum. I prefer post here, with code etc.
So, I want simulate 2D movements (no rotation) of an asteroid in space affected by a planet's gravity, the problem is how integrate that ?
Any better integration for performance ?
Here is the code in C:
struct vec2
{
  float x;
  float y;
};

struct body
{
  double mass; //kg
  struct vec2 prev_pos; //for semi-implicit euler method
  struct vec2 pos; //position
  struct vec2 v; //velocity
};

void move_asteroid(float dt) {
  //semi-implicit euler integration #1 -moving the object
  asteroid.pos.x += asteroid.v.x * dt;
  asteroid.pos.y += asteroid.v.y * dt;

  //START
  float x = planet.pos.x - asteroid.pos.x;
  float y = planet.pos.y - asteroid.pos.y;
  float d = x * x + y * y; //distance^2 between asteroid and center of planet

  //acceleration
  float ah = G * ((planet.mass * asteroid.mass) / d); //gravity

  //get components of gravity
  float rad = atan2(y, x);
  float ax = ah * cos(rad);
  float ay = ah * sin(rad);

  //semi-implicit euler integration #2 -update velocity
  asteroid.v.x += ax * dt;
  asteroid.v.y += ay * dt;
}

this is for 'fun' and sadly my knowledge is quite not good, I try to find with my vocabulary (not native english), if you have directions, ideas for better implementation (like study RK4 for correctness etc), it's welcome

sentences:
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 can I perform 2D side-scroller collision checks in a tile-based map? I am trying to create a game where you have a player that can move horizontally and jump. It's kind of like Mario but it isn't a side scroller. I'm using a 2D array to implement a tile map.

My problem is that I don't understand how to check for collisions using this implementation. After spending about two weeks thinking about it, I've got two possible solutions, but both of them have some problems.

Let's say that my map is defined by the following tiles:

0 = sky
1 = player
2 = ground

The data for the map itself might look like:

00000
10002
22022

For solution 1, I'd move the player (the 1) a complete tile and update the map directly. This make the collision easy because you can check if the player is touching the ground simply by looking at the tile directly below the player:

// x and y are the tile coordinates of the player. The tile origin is the upper-left.
if (grid[x][y+1] == 2){
   // The player is standing on top of a ground tile.
}

The problem with this approach is that the player moves in discrete tile steps, so the animation isn't smooth.

For solution 2, I thought about moving the player via pixel coordinates and not updating the tile map. This will make the animation much smoother because I have a smaller movement unit per frame. However, this means I can't really accurately store the player in the tile map because sometimes he would logically be between two tiles. But the bigger problem here is that I think the only way to check for collision is to use Java's intersection method, which means the player would need to be at least a single pixel "into" the ground to register collision, and that won't look good.

How can I solve this problem?

sentences:
Difficulty with Texture Alphas - HLSL UPDATE 3:

I have fixed the issue by reordering my effects (see my answer for details.) Anyone who wants to post more information based on that answer (either in an answer or in the comments) would be greatly appreciated.

UPDATE 2:

I think the issue may be that I've been using the default Magenta as transparent rather than having actual alpha values. It's hard to tell through Monogame what magic is happening to make the Magenta transparent (note: I'm in a 3d camera and not using spritebatch.)

I will try this again tonight or tomorrow with a set of identical textures using an alpha value instead of magenta.

Looks like this was unrelated to my issue. I now have images that have proper alpha values rather than replacement color values and am still having the same issue.

I've been able to apply my shader to multiple layered textures, with the issue that I can't seem to get the alpha to detect in my shader.

As you can see in the picture, the Alpha values for the Turret and the Tank-body are not being multiplied in properly ("derp.a") meaning that the lighting pass is hitting certain pixels 2x-3x based on how the textures overlap.

Full shader pasted below:

//Texture2D currTexture : register(s0);
sampler currSampler : register(s0);
/*{
    Texture = (currTexture);
    AddressU = clamp;
    AddressV = clamp;
};*/

float4x4 xViewProjection;
float3 tankpos;
float4 shotpos;

struct VertexToPixel
{
    float4 Position : POSITION; // Can't use in pixel shader, but required for it
    float4 Color : COLOR0;      // color for the vertex?
    float2 rPos : TEXCOORDS0;   // world position of the texture
};

struct PixelToFrame
{
    float4 Color : COLOR0;
};

VertexToPixel SimplestVertexShader(float4 inpos : POSITION)
{
    VertexToPixel output = (VertexToPixel) 0;
    output.Position = mul(inpos, xViewProjection);
    output.rPos = inpos.zx;
    return output;
}

PixelToFrame LightAroundAShot(VertexToPixel PSIn)
{
    PixelToFrame output = (PixelToFrame) 0;
    output.Color = PSIn.Color;
    float x = (PSIn.rPos.x * 0.02 - shotpos.z * 0.02) * 1 / (1 + shotpos.w);
    float z = (PSIn.rPos.y * 0.02 - shotpos.x * 0.02) * 1 / (1 + shotpos.w);
    float4 derp = tex2D(currSampler, float2(PSIn.rPos.x, PSIn.rPos.y));

    output.Color.g += (0.75 - sqrt(x * x + z * z)) * shotpos.w * derp.a;
    output.Color.br += (0.35 - sqrt(x * x + z * z)) * shotpos.w * derp.a;

    return output;
}

technique Simplest
{
    pass Pass0
    {
        VertexShader = compile vs_4_0_level_9_1 SimplestVertexShader();
        PixelShader = compile ps_4_0_level_9_1 LightAroundAShot();
    }
}

I've attempted to use curr texture at the top in a couple ways and can't seem to find the voodoo to get it working. Any help understanding the relationship (especially in monogame) between Textures, Samplers, and how to get that darn "derp" alpha to apply correctly would be great.

Note: When I tried using curr texture I was setting it before each call of the graphics device so that it'd be the appropriate texture. I've also attempted to register them in various ways to s1, different ways of setting the texture in graphics device. I'm truly stuck at the moment.

Thank you for any help!

sentences:
Emulate border color texture address mode efficiently In WinRT the border color texture address mode is not supported.

The best I came up with in emulating the border address mode, is doing this in my pixel shader:

float4 tcol = tex.Sample(texSampler, texCoord);

if(texCoord.x < 0 || texCoord.y < 0 || texCoord.x > 1 || texCoord.y > 1)
  tcol = borderColor;

But as only ps_4_0_level_9_1 is supported as minimum requirement in WinRT, this conditional in the pixel shader is quite inefficient.

How would I emulate border texture addressing mode efficiently?

sentences:
openTTD tileset atlas I'm trying to create an isometric game and would like to use some tiles from Open Transport Tycoon Deluxe
newGRF library link
The atlas I'm used to work with are basically a big image that can be splitted in 64x32 tiles, so I can use any Atlas import tool or just easily extract the tiles with a loop.
However, OpenTTD uses atlas that I don't understand. The files look something like this, where each tile has a numer and starts at positions that are not evenly distributed.
I assume it might exist some file with metadata that contains the locations and sizes of each tile, in order to be extracted and used.
Has anybody experience with this type of Atlas? How can I extract the tiles so I can use them?
Thanks

sentences:
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:
How to make a more accurate lap time? get_timer() LIMITATION? In the room there are 22 cars. All cars have a different speed.

The cars are numbered from 1 to 22 with the help of the variable carNumber.

CODE - obj_Car / Set car speed (Create Event):

velocity=10-((carNumber-1)*0.01);

Here's how there is a difference in car placement near the end of the lap:

However, even with this difference, the times of many cars are repeated:

The detection of lap time looks like this.

CODE - obj_Car / Time lap (Collision with obj_Finish) :

other.orderLapTime[car]=get_timer()-other.discount;

Discount = this is the exact time when the room starts (cars already start running).

CODE - obj_Finish / Set discount (Create Event):

discount=get_timer();

The display is made with a modifier (multi, to simulate actual track times).

CODE - obj_Finish / Draw time lap (Draw Event):

draw_text(1500,100+(20*(i)),string_format(orderLapTime[i]*obj_Seth.multi/1000000,1,3));

Even taking the multiplication and increasing the number of decimal places, there are still many repeated times:

Some inconsistencies including. Cars with slower speeds marking faster times.

I could slow down the base speed (10) to solve such a problem, but I already think in the long run. The races can't take so long. In addition I intend to give the player the option to set the speed with which the race takes place (a multiplier, more frames, etc).

It could also increase the difference between the speeds (0.01 to 0.05), but I would like a general resolution, so that I can notice through the lap time, if only by one thousandth (0.001).

EDIT 1 - Attempts made based on answers and comments from Bálint and TomTsagk:

That is what I tried to do.

CODE - obj_Car / lap time (Step Event):

unit+=velocity/60*0.001;

Below the results...

Respective code:

draw_text(1500,100+(20*(i)),string_format(orderLapTime[i],1,3));

Respective code:

draw_text(1500,100+(20*(i)),string_format(orderLapTime[i],1,5));

The speed difference between the cars is 0.01.

sentences:
AddForce doesn't work anymore when Acceleration is added Everything worked fine until I added acceleration on the x axis..now when I try to jump it just lifts up very little from the ground in a weird way and then it slowly sinks down like having 0 gravity. Here is the code I'm using:

public class PlayerMovement : MonoBehaviour {

    public float baseSpeed = 10f;
    public float maxSpeed = 10f;
    public float timeFromZeroToMax = 10f;
    public float jumpSpeed = 10f;
    public Collider coll;

    float accelRatePerSecond;
    float forwardVelocity;
    Rigidbody rb;

    void Awake () {
        rb = GetComponent<Rigidbody>();
        coll = GetComponent<Collider>();

        accelRatePerSecond = maxSpeed / timeFromZeroToMax;
        forwardVelocity = 0f;
    }

    void FixedUpdate() {

        transform.Translate(transform.right * baseSpeed * Time.deltaTime);
        forwardVelocity += accelRatePerSecond * Time.deltaTime;
        forwardVelocity = Mathf.Min(forwardVelocity, maxSpeed);

        if (isGrounded() && Input.GetKeyDown("w"))
        {
            rb.AddForce(transform.up * jumpSpeed * Time.deltaTime, ForceMode.Impulse);
        }

    }
    void LateUpdate()
    {
        rb.velocity = transform.right * forwardVelocity;
    }
    bool isGrounded()
    {
        return Physics.Raycast(transform.position, Vector3.down, coll.bounds.extents.y + 0.1f);
    }
}

sentences:
Does abstraction influence performance? Say I have a GameObject class that is being extended by all of the objects in the game that are moving around. (This class provides basic stuff like a sprite, draw method, update method with application of move vector and so on...) I also have a class Asteroid that like I said extends GameObject

Then there are two versions of the game:

Version 1: Somewhere in the game there is a Collection that holds all of the Asteroid-objects. The update Method is something like this:

for(Asteroid a : asteroids)
    a.update(...)

Draw method goes equivalent.

Version 2: I decided to put all of my GameObjects in a single collection, so that all moving stuff is being handled in one single loop like this:

for(GameObject o : gameObjects)
    o.update(...)

Again, draw method goes equivalent.

The problem I am facing with version 2 is that the game loop basically takes twice as long. (The update method as well as the draw method.) I am astonished at the draw method, since in either version there is the exact same amount of object being drawn. So my question is: Does this abstraction in version 2 affect the game's performance in any way? (I can imagine that version 2 requires the JVM to alway cast the GameObject implicitly to it's specific type which it does not have to do when the type is already given like in version one, but I am not sure about that.) (I am using Java with LibGDX if it matters)

sentences: How 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:
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:
Does it make sense to export and use skeletal animation as sprites? As tools like Dragonbones, Spine lets you export animations as both sprite atlas and skeleton data (JSON/binary), I'm not sure which format to use when importing to Unity.

I have few concerns:

Will there be any differences between the quality of the animations, when imported as atlas vs skeleton data?
Any other pros and cons, using one over the other?

If I use a sprite atlas, I don't have to depend on a third party runtime though. It is for mobile, so performance is also a concern.

sentences:
How 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:
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:
Basic multiplayer matchmaking implementation I am currently writing a matchmaking server application for a 5vs5 UDK game.

Here is the scenario on which I built my code:

The player starts the game and authenticate
The player clicks an huge "Play" button and asks the server for an open lobby
The server searches for a lobby and adds the player to the lobby found, and sends back lobby informations to the player so it can react accordingly (lobby id, players in lobby). Note that if no lobby is found (all lobbies are full, or there's no lobby at all) then a new one is created.
The player (now in a lobby) selects a character and hits a "Ready" button.
Once all players are ready, the server searches for an opposing team
Once an opposing team is found, the server sends match infos (udk server ip and port) to all of the concerned players

I have written my matchmaking server with the C# Web Api template. This RESTful webservice can at the moment take care of steps 1, 2 and 3 as they are transactions between the frontend (player in UDK game) and the backend (the C# matchmaking server). The player asks for something, the server replies with JSON data. I have done so because having many HTTP requests seemed less foolish than having all authenticated players on a constantly alive TCP connection.

However, for the next steps (particularly the steps concerning what happens inside the lobby), I am undecise on what approach I should take. How can the server notify the players of new events (disconnections, new player, character chosen by a player, player ready...)? Should the players poll the server on a (very) regular basis for new events? Or would it be better to have a pool of threads to keep a TCP connection alive with the players in order to broadcast new events? Or something else? (UDP?). I'm kinda lost.

This is my first post so I hope it's not poorly phrased. 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:
XNA Subtract blending function doesn't work I wanted to subtract a white image with black circle background from a picture to get a lighting circle here is the white image

So I wrote this code

spriteBatch.Begin(SpriteSortMode.Deferred, new BlendState
{
      ColorBlendFunction = BlendFunction.Subtract,
      AlphaBlendFunction = BlendFunction.Subtract
});
//Draw the white image with black circle
spriteBatch.Draw(test, new Vector2(), Color.White);
spriteBatch.End();

I was aiming to get difference between it and the background image rendered

to get something like this

But the result that the first image is only drawn while second is below it

sentences: Distance to a sphere, in Screen Space Is it possible to find the distance of a pixel to a rendered sphere, in screen space? All my naive solutions for just using the 2D screen distances are failing because of the warping that occurs during projection.

sentences:
Component based architecture - Rendering approach? I'm planning to use a component based architecture for a new 3D game engine I plan to work on, however I don't know how to approach the rendering side of things.

I can see two options here:

Every renderable game object has a RenderComponent, which stores a mesh and OpenGL-specific stuff like VBOs and VAOs. When the time comes to have update() called, it will use OpenGL to render itself.
Every renderable game object has a MeshComponent. When it's time to render, the Renderer would go through a list of all MeshComponents, extract vertex and material information, and render it.

Which option would be most flexible if I want to implement things like post-processing (bloom, motion blur), skyboxes, LOD, blending/transparency or implementing a deferred renderer?

sentences:
UnityIAP Subscription Purchase Basically I want to setup UnityIAP for implementation of weekly or monthly subscription for apple store game. I completely read following article given by Unity:

Integrating Unity IAP In Your Game

After this I become aware with actual implementation but i have following questions arise:

how we can get information about subscription already purchased by this user?
how we track time for auto renewable subscription purchase?

Please give me some information about this.

sentences:
Prevent oversteering catastrophe in racing games When playing GTA III on Android I noticed something that has been annoying me in almost every racing game I've played (maybe except Mario Kart): Driving straight ahead is easy, but curves are really hard. When I switch lanes or pass somebody, the car starts swiveling back and forth, and any attempt to correct it makes it only worse. The only thing I can do is to hit the brakes. I think this is some kind of oversteering.

What makes it so irritating is that it never happens to me in real life (thank god :-)), so 90% of the games with vehicles inside feel unreal to me (despite probably having really good physics engines). I've talked to a couple of people about this, and it seems either you 'get' racing games, or you don't. With a lot of practice, I did manage to get semi-good at some games (e.g. from the Need for Speed series), by driving very cautiously, braking a lot (and usually getting a cramp in my fingers).

What can you do as a game developer to prevent the oversteering resonance catastrophe, and make driving feel right? (For a casual racing game, that doesn't strive for 100% realistic physics)

I also wonder what games like Super Mario Kart exactly do differently so that they don't have so much oversteering?

I guess one problem is that if you play with a keyboard or a touchscreen (but not wheels and pedals), you only have digital input: gas pressed or not, steering left/right or not, and it's much harder to steer appropriately for a given speed. The other thing is that you probably don't have a good sense of speed, and drive much faster than you would (safely) in reality. From the top of my head, one solution might be to vary the steering response with speed.

sentences:
Plane to always face object How do i get a plane to always face an object with the flat/mesh/xy side? I tried sticking in Vector3. forward and up but i always get the plane facing the object on an edge.
    void Update()
{
    planeRotate.transform.LookAt(cube.transform, );
}

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:
Prefabs moved to before position when zooming scene I have build some pipes for waterline drawing, like following screencast:
https://youtu.be/WnJb1JwOW78
As you can see, when I zoom in the scene,  Pipes moved to lower position. When i zoom out, Pipes moved to higher position.
Actually I have changed the position and  moved down the pipe position before, the unexpected higher position was the pipe before position.
So i guessing this problem might about cache clean.
So I I try to clear the GI cache, but the problem still exist.
And then I try to build a windows executable file and run game again, problem still.
How to fix it?
I am using  Unity 2018.4

sentences:
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:
OpenGL approach to depth-testing-like combination of a large buffer of fragments I have a depth buffer and color buffer created by another effect. The buffer is more than double my screen size. It is not rendered from geometry, but as a whole it resembles a rendered scene with an ortho projection. I can't generate this data w/ any other projection. I'm trying to redraw the scene in two-point perspective. This means each fragment from the orthographic data will be skewed and translated based on the depth value.

If I render a fullscreen quad, each fragment will not know how or where to sample from the original buffer. It seems like I the sources have to assign themselves to destinations, rather than a destination gathering sources.

Impractical or incomplete solutions:
- Generate a tri or point for every pixel in the source buffer, and actually rasterize them with depth testing. This is really slow, but it could be possible to generate the vertices in a compute shader or something? We're still dealing millions of tris for an average screen. I'm skeptical that this is the real solution.
- Something with SSBO and atomicMax. It seems like you can only compare your actual data, so I would have to pack my colors with depth values somehow.

This seems like a fairly fundemental operation, so I'm hoping there is some canonical technique or opengl extention that does this sort of thing for me well. Even a name for this operation might help me find existing literature.

The final solution must be realtime for typical screen sizes. C++/OpenGL.

sentences:
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:
Pinch in zoom in android In My layout
parent as Relative layout and then am having Scroll view
inside Linear layout
now am having child views as Image view Text View Web view and Recycle view and 2 buttons is there
now i want to pinch in zoom entire layout

please help me out
Regards
Govardhana

sentences:
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:
Need some advice on designing components So after reading about components for a bit I want to make a very simple spaceshooter game that uses components and systems. However, I'm a bit confused on how much scope each component should have. For example, let's say the game had asteroids that fly around and if you hit them, you take damage. They also have health. The asteroid entity may then contain these components:

SpriteComponent (Texture2D texture)
HealthComponent (int amount)
CollidableComponent (bool rigid)
MovementComponent (int x, int y)
RotationComponent (int degrees)

Now let's say we had a RenderSystem. Its Update() method would require SpriteComponent, MovementComponent, and RotationComponent to draw an entity.

That's all fine and good but when would have MovementComponent and not RotationComponent? Couldn't we just have a TransformComponent that contains the x, y, and rotation? It feels a little weird designing these components to only be a container of one data-type. But then where do you draw the line? All sprites also have a position and rotation amount, so should the SpriteComponent contain the TransformComponent, or should the members of TransformComponent be moved to SpriteComponent?

But then the problem is if you wanted an entity with a position and rotation but no sprite. Then you either have to give it an empty texture (not necessarily a bad solution) or maintain TransformComponent and just make SpriteComponent contain it as well (or just pass both).

There's a lot of decisions to be made and I really feel similar to when I began object-oriented programming. "What should be objects? What should its methods be? Should this be public or private?" Obviously I've figured all that out now but this new component-based paradigm is giving me these same problems now. Does anyone have any advice or standards for component-based design for typically used components and how one normally would set something like this up?

sentences:
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:
Make platform's visibility distinct from background I have a 2d infinite runner type game which background is changing its colors constantly. Meanwhile the color of the platforms stays the same. This way the platforms at some point(when their color is the same as the background's) become "invisible" for the player.

How can I creatively, shortly and conviniently avoid this problem with unity?

P.S. I've tried adding glossy material to it but it didn't work.

sentences:
How do I get and install the Android SDK on my Ubuntu OS? I heard that it would be a lot easier to do java type games and then move on to Android gaming?
I AM a total beginning but with motive and I have been reading about it from several sources, including similar questions on this site alone.
But I need to know specific things from experienced users.

As for getting the SDK and Eclipse on the computer, I'm having trouble with it, I am running Ubuntu btw so exe files are useless. But I have tired terminal use but I kind of failed because I don't think the SDK and Eclipse are installed, just downloaded.
Ubuntu users especially, I can use help from you seeing how complicated Ubuntu can be compared to windows "click install" setups.

Also if you guys really suggest me learning Java first (which is still a big question cause I don't want to waste time with something I don't want to really use, but getting the feel of gaming is pretty important I know) I am looking at this tutorial:

http://zetcode.com/tutorials/javaswingtutorial/

And it talks about using swing toolkit, but idk how to get that exactly, I tried searching. Sorry for the noobness, but gotta start somewhere and I'm new to this site so I'm really hoping you guys can really help me. I want to make simple games to put on the android market, and then advance.

So going to the tutorial above, it just kind of starts with giving me coding and whatnot which is fine, just copy it but idk where exactly to do all this on (Swing toolkit?) so I can't even start with that.

But really I want help getting this SDK and Eclipse/plugins on my computer and then I can continue with this guide:

www.rbgrn.net/content/54-getting-started-android-game-development

Which is the main guide that I probably should follow, and would be great if some expert skims it a little at least to see if I should start with that guide and skip the java.
But again, I'm stuck on the SDK stuff.

Sorry for the long questions, I am new and I really want to get out of this beginner stage, it's the worst part. Tank you to all and if you want my facebook or AIM to help me through with IM to at least get this SDK and stuff installed fine with Ubuntu OS, ask please (:

sentences:
How can I realistically simulate audio for multi-sensor processing? I am performing audio simulations in Unreal Engine 4.

Ideally, I need realistic audio propagations. So microphones at multiple locations will experience propagation delays related to their distance from a sound source. Basically to be able to do spatial signal processing with a microphone array.

I have done some experiments with the Steam Audio plugin but I don't think that the propagation delays are built-in. Some research points to needing to add the propagation delays in post processing, but if the sound source is moving, then the problem becomes difficult.

How can I implement this in my project?

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:
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:
Saving total play time could be fine? I'm making a game that needs to save total played time into file (using JSON) for comparing & resolving data conflicts between local and cloud. I will override outdated one.

Currently, I'm just adding Time.realtimeSinceStartup, but is that okay? What if the time is really, really big and couldn't be handled in Unity anymore? Could that eventually happen?

If so, what are some alternatives?

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:
SceneGraph understanding So far i can understand that it is a  tree data structure consisting of multiple nodes.

If i draw an entity in world without any scenegraph, e.g. I have an object "Aircraft" which inherit from object "Entity"... so far so good i guess.

But what if i use scenegraph? if i draw an entity in world with scenegraph, i still have an object "Aircraft" which inherit from object "Entity" but now my object Entity inherit from a object "Node"? what is the diference? i still move my aircraft as the same without a scenegraph? or do i need to move node instead of aircraft?

sentences:
How can I make item interactable for action? In this script when there is a detection I'm setting the flag detect to true and using in with other scripts. And using the clickForDescription flag and OnGui to display text description for each interactable item if there is a text for it.

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

public class DetectInteractable : MonoBehaviour
{
    public Camera cam;
    public float distanceToSee;
    public string objectHit;
    public bool interactableObject = false;
    public Transform parentToSearch;
    public static bool detected = false;

    private RaycastHit whatObjectHit;
    private bool clickForDescription = false;
    private bool clickForAction = false;
    private int layerMask = 1 << 8;

    private void Start()
    {

    }

    private void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            clickForDescription = true;
            clickForAction = true;
        }

        Debug.DrawRay(cam.transform.position, cam.transform.forward * distanceToSee, Color.magenta);
        if (Physics.Raycast(cam.transform.position, cam.transform.forward, out whatObjectHit, distanceToSee, layerMask))
        {
            detected = true;
            objectHit = whatObjectHit.collider.gameObject.name;
            interactableObject = true;
            print("Hit ! " + whatObjectHit.collider.gameObject.name);
        }
        else
        {
            detected = false;
            clickForDescription = false;
            print("Not Hit !");
        }
    }

    private void OnGUI()
    {
        if (clickForDescription == true)
        {
            ProcessOnGUI(parentToSearch);
        }
    }

    void ProcessOnGUI(Transform parent, int level = 0)
    {
        foreach (Transform child in parent)
        {
            if (child.GetComponent<ItemInformation>() != null)
            {
                ItemInformation iteminformation = child.GetComponent<ItemInformation>();
                if (child.name == objectHit)
                {
                    var centeredStyle = GUI.skin.GetStyle("Label");
                    centeredStyle.alignment = TextAnchor.UpperCenter;
                    GUI.Box(new Rect(
                          Screen.width / 2 - 50 + 20 * level, // <== INDENTATION
                          Screen.height / 2 - 25, 100, 50),
                        iteminformation.description, centeredStyle);
                }
            }

            // Process next deeper level
            ProcessOnGUI(child, level + 1);
        }
    }

    public class ViewableObject : MonoBehaviour
    {
        public string displayText;
        public bool isInteractable;
    }
}

This is the ItemInformation:

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

public class ItemInformation : MonoBehaviour
{
    [TextArea]
    public string description;
}

Once object is tagged for Interactable and the ItemInformation is attached to it it will display some description for the item.

Now I want to do something for action. For example if the item is Interactable and a script name ItemAction is attached to it do some action, For example move the object from side to side or rotate the object. The logic should be like the Information. It's just with the Action there might be many options then just displaying text.

I'm not sure how to make some logic and how to work with the ItemAction.

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

public class ItemAction : MonoBehaviour
{

}

sentences:
Updating object position An object - a player or npc or whatever - has a position, direction and speed and such.

Before drawing each frame, we want to compute the current position of each object.

How do you do this?

If you take the elapsed time since last frame, you run the very real risk of the game running at the wrong speed if the frame-rate is very fast and the clock precision poor (as it often is on some platforms).

And how can you incorporate player controls such as the player wanting to go left or right (e.g. in a simple asteroids clone without ship inertia)?

sentences:
Moller Tri Tri intersection I'm done implementing Moller's tri-tri intersection routine.  It gives you the location of where each triangle edge intersects the line of intersection between the 2 triangle planes:

Really you get the point location in the form of t values along the (really big) purple ray shown above.  So you can tell if the triangle intersects if the t values are overlapping..?

That's what the paper says.  But I can show you scenarios where the t values are overlapping, but the triangles don't intersect:

So I can't seem to figure out which edge value to discard.

The original paper is here: http://fileadmin.cs.lth.se/cs/Personal/Tomas_Akenine-Moller/pubs/tritri.pdf

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:
Can I rely on SoundEffects being stopped when unloaded? I am using XNA's SoundEffect class to play sounds. I have to unload all sounds from the corresponding ContentManager for technical reasons, while some of them are still playing.

What happens to sounds that are still playing (via SoundEffect instances) when being unloaded? It seems that they just stop abruptly. Is this a deterministic behaviour I can rely on? Can it cause any errors when unloading sounds that are currently playing?

sentences:
Sprite button not triggering "On Click()" event -Unity Hi have created some buttons from sprite and I added image and button components on it.

I am just using sprites because In my game the camera can be moved on x and y. But I don't want my button to move and since UI buttons move with camera that is why I am not using them.

Here is the GIF to explain the scene:

sentences:
Supersampling - Pixel color average calculation I am currently trying to understand Supersampling.

Wikipedia says (or at least Wikipedia tells me) that multiple color samples are taken from one pixel to calculate the final result. But to my mind one pixel has exactly one color and logically, the average of an infinite amount of equal colors remains the same.

So, how can the resulting color differ from the original pixel's color?

sentences:
How can I enhance this keyboard handler class (remove global variables) I would like to enhance my keyboard class to be more tight and encapsulated. The first issue I've addressed is Singleton design pattern. I've done this as follows:

/*** inside keyboard.h ***/
class Keyboard
{
public:
    static Keyboard* Instance(){
        if(s_pInstance == NULL)
            s_pInstance = new Keyboard;
        return s_pInstance;
    }
    ...
private:
    static Keyboard* s_pInstance;
    Keyboard() {}
    ...
};

/*** inside keyboard.cpp ***/
#include "keyboard.h"

Keyboard* Keyboard::s_pInstance = NULL;
...

The design pattern works just fine. Now in while(true) I can do

while(Window is Open){
...
    if ( Keyboard::Instance()->isKeyDown() ){
        if ( Keyboard::Instance()->m_key == GLFW_KEY_E )
            std::cout << "E is pressed ..." << std::endl;
    }
...
}

In GLFW, I have to declare key_callback as static member function. To store keyboard actions, I've introduced global variables and every time I call any Keyboard function, I need to update those global variables as follows:

bool Keyboard::isKeyDown()
{
    // assign global variables to data members
    update(g_key, g_scancode, g_action, g_mode);

    if( m_action == GLFW_PRESS ){
        std::cout << "Key down..." << std::endl;
        ...
        // reset global variables
        m_action = -1;
        g_action = -1;
        return true;
    }

    return false;
}

void Keyboard::update(int k, int s, int a, int m)
{
    m_key      = k;
    m_scancode = s;
    m_action   = a;
    m_mode     = m;
}

The code works but I don't believe this is the right way to encapsulate my class. Any suggestion how to remove these global variables which is a consequence due to using static function?

This is the full code

#ifndef _KEYBOARD_H
#define _KEYBOARD_H

#include <GLFW/glfw3.h>

class Keyboard
{
public:

    static Keyboard* Instance(){
        if(s_pInstance == NULL)
            s_pInstance = new Keyboard;
        return s_pInstance;
    }
    void init(GLFWwindow* window);
    void update();
    bool isKeyDown();
    bool isKeyUp();

    int m_key, m_scancode, m_action, m_mode;
private:
    static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mode);

    GLFWwindow* m_pWindow;
    Keyboard() {}
    static Keyboard* s_pInstance;
    bool keys[1024];

    void update(int, int, int, int);

};

#endif

keyboard.cpp is

#include "keyboard.h"
#include <iostream>

Keyboard* Keyboard::s_pInstance = NULL;

int g_key, g_scancode, g_action, g_mode;

void Keyboard::init(GLFWwindow* window)
{
    m_pWindow = window;
    glfwSetKeyCallback(window, key_callback);
}

void Keyboard::key_callback(GLFWwindow* window, int key, int scancode, int action, int mode)
{
    g_key      = key;
    g_scancode = scancode;
    g_action   = action;
    g_mode     = mode;
}

bool Keyboard::isKeyDown()
{
    update(g_key, g_scancode, g_action, g_mode);

    if( m_action == GLFW_PRESS ){
        std::cout << "Key down..." << std::endl;
        keys[m_key] = true;

        m_action = -1;
        g_action = -1;
        return true;
    }

    return false;
}

bool Keyboard::isKeyUp()
{
    update(g_key, g_scancode, g_action, g_mode);

    if( m_action == GLFW_RELEASE ){
        std::cout << "Key up..." << std::endl;
        keys[m_key] = false;

        m_action = -1;
        g_action = -1;
        return true;
    }

    return false;
}

void Keyboard::update(int k, int s, int a, int m)
{
    m_key      = k;
    m_scancode = s;
    m_action   = a;
    m_mode     = m;
}

sentences:
Creation of block mesh for minecraft like chunk Problem:

I'm trying to build a naive mesh for a "chunk" of 2x2x2 blocks. But the "mesh" i create is 3x3x3 blocks (i don't understand why?) and the "extra cubes" are not like i intendet them to be (image at the end).

My code for creation of the mesh:

/**
 * Creates vertices and indices for a mesh
 * @return
 */
public FloatBuffer createVerticesAsBuffer(){
    vertexPositionData = BufferUtils.createFloatBuffer((24*3)*worldSize*worldSize*worldSize);
    indicesData = BufferUtils.createIntBuffer(worldSize*worldSize*worldSize*36);
    int i = 0;
    for (int x = 0; x < worldSize; x++) {
        for (int y = 0; y < worldSize; y++) {
            for (int z = 0; z < worldSize; z++) {
                if(world[x][y][z] == BlockType.Grass)
                {
                    i += putVertices(x*cubeSize, y*cubeSize, -z*cubeSize, i);
                }
            }
        }
    }

/**
 * Creates cube data and puts it into buffers for one mesh
 * @param tx
 * @param ty
 * @param tz
 * @param offset number of indices
 * @return number of vertices added
 */
public int putVertices(float tx, float ty, float tz, int offset) {
    vertexPositionData.put(new float[]{
            // Back face
            -cubeSize + tx,cubeSize + ty,-cubeSize + tz,    //0
            -cubeSize + tx,-cubeSize + ty,-cubeSize + tz,   //1
            cubeSize  + tx,-cubeSize + ty,-cubeSize + tz,   //2
            cubeSize + tx,cubeSize + ty,-cubeSize + tz,     //3

            // Front face
            -cubeSize + tx,cubeSize + ty,cubeSize + tz,     //4
            -cubeSize + tx,-cubeSize + ty,cubeSize + tz,    //5
            cubeSize + tx,-cubeSize + ty,cubeSize + tz,     //6
            cubeSize + tx,cubeSize + ty,cubeSize + tz,      //7

            // Right face
            cubeSize + tx,cubeSize + ty,-cubeSize + tz,     //8
            cubeSize + tx,-cubeSize + ty,-cubeSize + tz,    //9
            cubeSize + tx,-cubeSize + ty,cubeSize + tz,     //10
            cubeSize + tx,cubeSize + ty,cubeSize + tz,      //11

            // Left face
            -cubeSize + tx,cubeSize + ty,-cubeSize + tz,    //12
            -cubeSize + tx,-cubeSize + ty,-cubeSize + tz,   //13
            -cubeSize + tx,-cubeSize + ty,cubeSize + tz,    //14
            -cubeSize + tx,cubeSize + ty,cubeSize + tz,     //15

            // Top face
            -cubeSize + tx,cubeSize + ty,cubeSize + tz,     //16
            -cubeSize + tx,cubeSize + ty,-cubeSize + tz,    //17
            cubeSize + tx,cubeSize + ty,-cubeSize + tz,     //18
            cubeSize + tx,cubeSize + ty,cubeSize + tz,      //19

            // Bottom face
            -cubeSize + tx,-cubeSize + ty,cubeSize + tz,    //20
            -cubeSize + tx,-cubeSize + ty,-cubeSize + tz,   //21
            cubeSize + tx,-cubeSize + ty,-cubeSize + tz,    //22
            cubeSize + tx,-cubeSize + ty,cubeSize + tz      //23
    });
    indicesData.put(new int[]{
            0+offset,1+offset,3+offset, // Back face
            3+offset,1+offset,2+offset, // Back face

            4+offset,5+offset,7+offset, // Front face
            7+offset,5+offset,6+offset, // Front face

            8+offset,9+offset,11+offset, // Right face
            11+offset,9+offset,10+offset, // Right face

            12+offset,13+offset,15+offset, // Left face
            15+offset,13+offset,14+offset, // Left face

            16+offset,17+offset,19+offset, // Top face
            19+offset,17+offset,18+offset, // Top face

            20+offset,21+offset,23+offset, // Bottom face
            23+offset,21+offset,22+offset // Bottom face
    });
    return 24;
}

Full code on github: https://github.com/karoc123/ba_tobias_zink/tree/master/LWJGLTest

My actual output:

sentences:
Pygame's sprite.collide_circle() missing several frames of head-on collision I've spent hours trying to figure why my collision detection was so crappy, with sprites visibly ovellaping for several frames, when I noticed the culprit could be pygame's detection callback pygame.sprite.collide_circle().

I've stripped down the code and created a simple demo, and results were surprising: collide_circle() still returns False for several frames after its sibling collide_rect() correctly detects a collision and returns True.

Here is the code:

import pygame

RED   = (255,   0,   0)
GREEN = (  0, 255,   0)
BLUE  = (  0,   0, 255)
BLACK = (  0,   0,   0)
WHITE = (255, 255, 255)

SCREEN_SIZE = (800, 600)
FPS = 60
BG_COLOR = BLUE

class Ball(pygame.sprite.Sprite):
    def __init__(self, color=WHITE, radius=10, position=[], velocity=[]):
        super(Ball, self).__init__()

        self.color = color
        self.radius = radius
        self.position = list(position) or [0, 0]
        self.velocity = list(velocity) or [0, 0]
        self.bounds = (screen.get_size()[0] - self.radius,
                       screen.get_size()[1] - self.radius)

        self.image = pygame.Surface(2*[self.radius*2])
        self.rect = self.image.get_rect()
        pygame.draw.circle(self.image, self.color, 2*(self.radius,), self.radius)

    def update(self, dt=1./FPS):
        super(Ball, self).update()

        for i in [0, 1]:
            self.position[i] += self.velocity[i] * dt

            if self.position[i] < self.radius:
                self.position[i] = self.radius
                self.velocity[i] *= -1

            elif self.position[i] > self.bounds[i]:
                self.position[i] = self.bounds[i]
                self.velocity[i] *= -1

        self.rect.center = self.position

pygame.init()

screen = pygame.display.set_mode(SCREEN_SIZE)
clock = pygame.time.Clock()

background = pygame.Surface(screen.get_size())
background.fill(BG_COLOR)
screen.blit(background, (0,0))

balls = pygame.sprite.Group()
balls.add(Ball(color=RED,   radius=100, position=[  0, 300], velocity=[ 100, 0]))
balls.add(Ball(color=GREEN, radius=100, position=[700, 300], velocity=[-100, 0]))

done = False
while not done:
    for event in pygame.event.get():
        if (event.type == pygame.QUIT or
            event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE):
            done = True

    balls.update()
    if pygame.sprite.collide_rect(*balls):
        collision = pygame.sprite.collide_circle(*balls)
        print collision
        if collision:
            for ball in balls:
                ball.velocity[0] *= -1

    balls.clear(screen, background)
    balls.draw(screen)
    pygame.display.update()
    clock.tick(FPS)

pygame.quit()

And the output:

False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
True
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False

That's 17 frames of overlap before collide_circle() realizes that hey, there's a collision there! Even at 60 FPS that's huge.

The balls are almost halfway through each other, and this behavior seems to be velocity independent: if I change the balls' speed or the FPS, the visual result (halfway overlap) remains, but for fewer frames.

So, my question is: is this a pygame bug? Or did I completely misunderstood how detection works?

sentences:
Fragment shader for lighting in isometric perspective What I'm trying to do is to achieve basic lighting in 2D from an isometric perspective.

Here I have 2 textures that are used as tiles for the ground:

Color:

Normal map:

I have a fragment shader that was adjusted a bit to my needs, but mostly made from this tutorial: https://github.com/mattdesl/lwjgl-basics/wiki/ShaderLesson6

Here is my fragment shader:

uniform sampler2D texture;
uniform sampler2D normal_texture;

//values used for shading algorithm...
uniform vec2 Resolution;      //resolution of screen
uniform vec4 AmbientColor;    //ambient RGBA -- alpha is intensity

uniform vec3 LightPos[3];        //light position, normalized
uniform vec4 LightColor[3];      //light RGBA -- alpha is intensity
uniform vec3 Falloff[3];         //attenuation coefficients

void main()
{
    vec4 DiffuseColor = texture2D(texture, gl_TexCoord[0].xy);

    vec3 NormalMap = texture2D(normal_texture, gl_TexCoord[0].xy);

    vec3 Sum = vec3(0.0);
    for (int i = 0; i < 3; i++) {
        //The delta position of light
        vec3 LightDir = vec3(LightPos[i].xy - (gl_FragCoord.xy / Resolution.xy), LightPos[i].z);

        //Correct for aspect ratio
        LightDir.x *= Resolution.x / Resolution.y;

        //Determine distance (used for attenuation) BEFORE we normalize our LightDir
        float D = length(LightDir);

        //normalize our vectors
        vec3 N = normalize(NormalMap * 2.0 - 1.0);
        vec3 L = normalize(LightDir);

        //Pre-multiply light color with intensity
        //Then perform "N dot L" to determine our diffuse term
        vec3 Diffuse = (LightColor[i].rgb * LightColor[i].a) * max(dot(N, L), 0.0);

        //pre-multiply ambient color with intensity
        vec3 Ambient = AmbientColor.rgb * AmbientColor.a;

        //calculate attenuation
        float Attenuation = 1.0 / (Falloff[i].x + (Falloff[i].y*D) + (Falloff[i].z*D*D));

        //the calculation which brings it all together
        vec3 Intensity = Ambient + Diffuse * Attenuation;
        vec3 FinalColor = DiffuseColor.rgb * Intensity;

        Sum += FinalColor;
    }

    gl_FragColor = gl_Color * vec4(Sum, DiffuseColor.a);
}

This shader WORKS with traditional 2D perspective. That's because in traditional perspective the ground tiles normal map would have a color scheme closer to something like this, just wouldn't be tilted to fit an isometric perspective of course.

The issue: How do I go about adjusting the math in my fragment shader to fit an isometric perspective and work with the "greenish" ground normal maps.

Here's what I'm currently getting with this shader. Light should be equally going in all directions, but it's as if it's going down a slope.

sentences:
Starting a Game Dev Incubator - Engines to Start With? I'm currently in the process of developing a technology incubator in my region to cater to game development professionals and aspiring devs and I'm curious about what engines are best to use, with regards to flexible licensing (e.g. right now we're on a shoestring budget) and also performance/popularity and a solid community/company backing.

As my background is in web development my focus with this group is more of the management and logistics while other professionals will be on the board to handle the other aspects, but I'm still  trying to pick a few solid engines.

Garry's Mod at the moment seems to be the most feasible option since I've used it a lot and I know it's simple to pick up, but I wanted to ask if there is anything similar to that.

Also, this group is purely for PC gaming so we're not handling consoles and we are ideally looking to do 2-D and 3-D development or even game engine coding.

sentences:
Do I need TCP socket? My game uses UDP sockets to stream updates between server and client and I've also made a reliable channel that resends messages if there's no response and makes sure same message isn't processed multiple times.

But TCP is specifically designed to be reliable and the people who made it probably have more experience than me. So would it be good to use TCP to send commands such as "attack", "play animation", etc. instead of my UDP implementation?
(Of course I mean TCP sockets that don't delay sending the data (Nagle algorithm))

sentences:
Why are clicks not corresponding correctly to XY positions? I'm trying to make custom buttons in LibGDX (I really only wanted to use it for the Android/Desktop portability, not for any of its features, like Scene2D)

The issue I'm having is that the clickable area and the texture don't have a 100% overlap. I can click some places in the texture that don't respond to my isClicked method, and there are places outside the texture that do. I just don't understand what's happening.

Here's my button  class.

public class btn
{
private Texture btnTexture;

private int x;
private int y;

private int width;
private int height;

public btn(String btnTexturePathSet, int xSet , int ySet)
{
    btnTexture = new Texture(btnTexturePathSet);
    x = xSet;
    y = ySet;
    width = btnTexture.getWidth();
    height = btnTexture.getHeight();

}

public void render(SpriteBatch sb)
{
    sb.begin();
    sb.draw(btnTexture, x, y);
    sb.end();
}

public boolean isClicked()
{
    if (Gdx.input.justTouched())
    {
        if (Gdx.input.getY() >= y && Gdx.input.getY() <= y + height && Gdx.input.getX() >= x && Gdx.input.getX() <= x + width)
        {
            return true;
        }

    }
    return false;
}
}

sentences:
Scrolling Camera in Pygame is not working properly I implemented a camera with edges in 2D side scrolling game using Pygame, it is working but sometimes it will scroll for more than it should have, and in case of using different moves that involved movement, sometimes the value will be in float number and it will cause the level to be buggy. I have tried different methods of camera, but none of them worked for me so far. Is there any other way to implement camera, or at least make this one work as intended?

Below is the code for scrolling at x-axis:

   if self.rect.right >= 500 and self.in_level.world_shift_x >= -((self.in_level.total_level_width - (Screen_Width + 32))):
        diff = self.rect.right - 500
        self.rect.right = 500
        self.in_level.shift_world_x(round(-diff, 0))

    if self.rect.left <= 200 and self.in_level.world_shift_x <= -((self.speed / 2)):
        diff = 200 - self.rect.left
        self.rect.left = 200
        self.in_level.shift_world_x(round(diff, 0))

sentences:
Which files should I be looking at to do a total conversion mod using the Source Engine? I just installed Source SDK. Made a multiplayer mod from a template using Source Engine 2007. I'm currently using VS2008.

I was wondering which folder I should work in. For example weapons, which files I should change?

Is it "\src\game\server\hl2\weapon_crowbar.cpp"
or "\src\game\shared\hl2mp\weapon_crowbar.cpp"
or "\src\game\shared\sdk\weapon_crowbar.cpp"

Also, I've seen the various help on the wiki, if I want to change bullets for example, saying I should change the scripts in the mod folder in Steam. Is that necessary? Shouldn't I make changes from the source mod folder to things like that and recompile?

I'm aiming for a total conversion mod rather than just a mini-mod in case that matters.

sentences:
How to lock aspect ratio when resizing game window in unity? I want a scalable game window that when resized stays at 16:9 aspect ratio.  The goal is for the user to be able grab the window on the right or bottom and resize it.  The game should adjust the corresponding side of the view-port to lock the aspect ratio.  I've tried forcing certain values in the update line of a script on the camera, but it did not work. the game is 2d and most of the elements are scripted using the gui functions. I'm having a very hard time finding exactly what I'm looking for as it is, most of what I've found is in an attempt to create black bars and keep the game from stretching, but that doesn't help ongui using matrices.

here are the resources I've tried so far

http://goo.gl/8FuyRC - this one is a script someone wrote that I attached to the main scene camera, I then built it, however that didn't work.

http://goo.gl/qZ5DAl - this is something from the unity website regarding camera aspect ratio. I put a line of code in the update function of my camera object

#pragma strict

function Start () {

}

function Update () {
Camera.main.orthographicSize = 3.596306;
}

as well as

#pragma strict

function Start () {

}

function Update () {
Camera.aspect = 1;
}

none of the above worked.

http ://goo.gl/MbTDcz - was the last thing I tried, and it just made some more black bars...

so far nothing has worked. not sure why. to reiterate, the goal I'm trying to accomplish is that, when the user grabs the edge of a windowed player, and drags it, the corresponding x or y axis will follow in suit to keep the aspect ratio the same.

sentences:
Get world position of touch on objects In my Unity3d game, I want to get the world position that was touched, when I touch a specific object, regardless of all objects that are in front of it.

How would I do that, I only know Camera.ScreenPointToRay(...), but for some reason that does not work properly?

OK - one cannot answer the question with the information I provided.

In order to determin the point, where the Ray hit the object, I used RaycastHit.transform.position (which refers to the Transform object that was hit) as opposed to RaycastHit.point (which refers to the Vector3 in world space, where the RaycastHit happened).

sentences:
Camera and enemy behaviour in AS3 platformer beginner in AS3 here. I am working on a platformer game based on the code of a provided example exercise. I have the following problem:

I have an enemy who shoots bullets. The enemy is the parent, and the bullet are the child. When I move to the next scene (level), the bullets are still there, but invisible, even using the removeEventListener to shut down the bullet hit check.

Here is the code of the child "disparoEnemigo_mov":

addEventListener(Event.ENTER_FRAME, fl_MoveEnemyShot);
function fl_MoveEnemyShot(event: Event) {
try {
    if (enemy_shot.y < 300) {
        if (enemy_shot.hitTestObject(Object(this.parent).mario)) {

            variablesGlobales.variables().vidas -= 1;
            Object(root).texto.text =
variablesGlobales.variables().vidas.toString();
            trace("vidas: " + variablesGlobales.variables().vidas);
            if (variablesGlobales.variables().vidas < 1) {
                MovieClip(this.parent).gotoAndStop(2);
            }
            this.parent.removeChild(this);
            removeEventListener(Event.ENTER_FRAME, fl_MoveEnemyShot);
        } else {
            enemy_shot.y += 3;
        }
    } else {
        trace("LLEGADA");
        removeEventListener(Event.ENTER_FRAME, fl_MoveEnemyShot);
        this.parent.removeChild(this);
    }
} catch (error: Error) {
    removeEventListener(Event.ENTER_FRAME, fl_MoveEnemyShot);
}
}

import flash.events.Event;
import flash.media.SoundMixer;

addEventListener(Event.ENTER_FRAME, fl_EnterFrameHandler);

function fl_EnterFrameHandler(event: Event): void {
try{
if (this.hitTestObject(Object(this.parent).mario)) {

    SoundMixer.stopAll();
    var sound:gameOver = new gameOver();
    sound.play();
    Object(this.parent).mario.y=1000;
    Object(this.parent).mario.x-=15;
    trace("Mario dies");
    var cartel:StageLose = new StageLose();
    stage.addChild(cartel);
    cartel.x = -85;
    Object(this.parent).mario.y = 1000;
    }
}catch(error: Error){
removeEventListener (Event.ENTER_FRAME, fl_EnterFrameHandler);
}
}

And this is the code of the parent, "enemigo_mov":

var leftPressed: Boolean = true;
var rightPressed: Boolean = false;
stage.addEventListener(Event.ENTER_FRAME, fl_MoveEnemy);
function fl_MoveEnemy(event: Event) {
try{
if (leftPressed) {
    enemy1.x -= 0;
    if (enemy1.x < -120) {
        leftPressed = false;
        rightPressed = true;
    }
} else if (rightPressed) {
    enemy1.x += 1;
    if (enemy1.x > 120) {
        rightPressed = false;
        leftPressed = true;
    }
}
var number: Number = Math.random();
if (number < 0.05){// &&
variablesGlobales.variables().coleccionEnemigos.indexOf(this) != -1) {
    trace("creation");
    var disparo: disparoEnemigo_mov = new disparoEnemigo_mov();
    this.parent.addChild(disparo);
    disparo.x=enemy1.x +115;
    disparo.y=enemy1.y +115;

    //disparo.z=50;
    trace(disparo.x + " " + disparo.y);
    }

}catch(error:Error){
removeEventListener(Event.ENTER_FRAME, fl_MoveEnemy);
}
}

In both codes, "mario" is the player character.

What I need to do is to stop the bullet creation of ""disparoEnemigo_mov" when we move to the next scene. Shouldn't the "removeEventListener(Event.ENTER_FRAME, fl_MoveEnemy)" line stop the bullets to check if there is any collision with the player?

Any help or resource will be helpful. Thank you so much!

sentences:
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:
Climate / weather generation on 3d hex map I am working on 3d hex map game. I am aiming to dynamical generate map (as new players joins). To make the map realistic I am looking for some climate/weather models which possibly I could use so that the generated terrain / game environment remains realistic.

Currently I am not having any system implemented to generate hex map. I was thinking of using height map but I am looking for ways to connect with it also such variables as aridity, temperature so that it is as realistic as possible. I may not exclude that in future I will want players to be able to modify the climate (e.g. via spells) and thus, the map generation mechanism should work not only during map generation but also should be able to calculate further changes in environment caused by players. It would be the best if given model would be able to be used also to calculate impact of climate and weather on crops, speed of troops and so on.

Would you be so kind and advise on any ready climate generation/administration solutions? I am looking for something quite complex to be from one hand maximally realistic and from the other  in further able to generate game variables such as current weather information.

sentences:
Crash when trying to detect touch I've got a character in a 2D game using surfaceView that I want to be able to move using a button (eventually a joystick), but my game crashes as soon as I try to move my sprite.
This is my onTouch-method for my steering button:

public void handleActionDown(int eventX, int eventY) {
    if (eventX >= (x - bitmap.getWidth() / 2) && (eventX <= (x + bitmap.getWidth()/2))) {
        if (eventY >= (y - bitmap.getHeight() / 2) && (y <= (y + bitmap.getHeight() / 2))) {
            setTouched(true);
        } else {
            setTouched(false);
        }
    } else {
        setTouched(false);
    }

And if I try to put this in my update-method:

public void update() {
    x += (speed.getXv() * speed.getxDirection());
    y += (speed.getYv() * speed.getyDirection());
}

The sprite moves on its own just fine, but as soon as I add:

public void update() {
    if(steering.isTouched()){
        x += (speed.getXv() * speed.getxDirection());
        y += (speed.getYv() * speed.getyDirection());
    }

the game crashes.

Does anyone know why this is or how to fix it? I cannot figure it out. I'm using MotionEvent.ACTION_DOWN to check if the user if pressing the screen.

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:
Render only a cross-section of a 3D scene in Godot I'm working on a 3D game where I sometimes want to display only a cross-section of the scene.  Ideally I would like this to be just the intersections of the scene with a plane.  But the only way I've been able to achieve this so far is by setting the near and far culling planes to be very close together.  However, there are two problems with this approach:

The result isn't actually 2D, the cross-sections have the thickness the size of the gap between the culling planes (this isn't a huge deal, but would be nice to fix)
Most objects become quasi-outlines since their fronts and backs are now culled by the camera.  I at least want this to be filled in (e.g. for a sphere I want a solid circle instead of just an outline).

Is there a way to make a very small gap between the near and far culling planes but filling in the interior of the objects, or is there another way to achieve this plane-intersection effect?

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

I can calculate a perpendicular like so:

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

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

Image of the problem here:

sentences:
How 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 texture lookups for trig functions work? I have a pixel shader that calculates a mandelbrot fractal. It uses the standard formula:

z = z2 + c

I'd like to extend it so the power z is raised by varies. To do this i have the following function:

float2 ComPow(float2 Arg, float Power)
{
    float Mod = pow(Arg.x * Arg.x + Arg.y * Arg.y, Power / 2);
    float Ang = atan2(Arg.y, Arg.x) * Power;

    return float2(Mod * cos(Ang), Mod * sin(Ang));
}

The problem i've got is the xbox does this really slowly compared to squaring a complex number. I'm thinking it's partly because of the increased number of instructions, but mainly it's using trig functions (cos, sin and atan2).

I tested this by adding a single atan2 within the for loop and it's visibly jerky, whereas before it was getting a good FPS.

Can i use texture lookup to speed up / replace the cos, sin and atan2 calls? If so, how?

sentences: Best way to do buttons for an OpenGL ES iPhone game I'm making a simple 2d game in OpenGL ES and I want to add movement buttons to it. What's the best way of going about this? In previous projects I've simply added UIButtons to the view but I hear there are performance implications in doing so with OpenGL ES so I'm wondering what the possible alternatives are if so.

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:
UI/Menu that works with and without VR (Unity, WMR) I'm working on an app that I want to be useable without and with VR (with a Windows Mixed Reality HMD like the Samsung Odyssey).

For non-VR I'm simply using a canvas in "Screen Space - Camera" and a second camera, which is a child of the Main Camera and can only see the UI (the Main Camera can see everything but the UI). This way the menus are displayed as transparent overlays that are always visible to the player (with the game scene in the background).

For VR you have to use World Space. This makes sense because I want to be able to look around without having the menu move too.

How do you now make an e.g. pause menu work in VR AND non-VR - depending on if the player plugs in his headset before starting the app or not?

Do you change the Screen Space to World Space in code at runtime if there's an HMD?
Do I have to move the whole canvas at runtime to where the player is? You'd want the menu to be in front of the player, no matter where he is but it also has to be in front of the other objects in the scene, so you can interact with it.

I'm using Unity 2017.3 with OpenVR/SteamVR.

sentences:
What is the difference between graphics filters in Adventure Game Studio? Adventure Game Studio supports following graphics filters:

max nearest-neighbour filter and 2x-8x nearest-neighbour filter
2x-8x anti-aliasing filter

What graphics filter offers the best image quality? What is the difference between "nearest-neighbour filter" and "anti-aliasing filter"?

sentences:
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:
How to mitigate when applying horizontal force to a rigidbody seems to overpower gravity? I've started testing movement using the example code in this answer of making a body accelerate to a target velocity
    private void FixedUpdate()
    {
        Vector2 input = GetInput();

        if (Mathf.Abs(input.x) > float.Epsilon || Mathf.Abs(input.y) > float.Epsilon)
        {
            Vector3 desiredVelocity = new Vector3(input.x * speed, 0f, input.y * speed);

            Vector3 delta = desiredVelocity - body.velocity;
            Vector3 acceleration = delta / Time.deltaTime;

            if (acceleration.sqrMagnitude > maxAccel * maxAccel)
            {
                acceleration = acceleration.normalized * maxAccel;
            }

            body.AddForce(acceleration, ForceMode.Acceleration);
        }
    }

and I've encountered the following curious behavior:
https://imgur.com/snGyVYK
When moving the body by applying force, the body seems to levitate as if gravity is not being applied. It actually is being applied but it seems as if the force being applied to the body is overriding the force of gravity because as soon as I let go of the movement keys the body suddenly drops. I am not applying any force on the y axis so I'm not sure what exactly is at play here. What is going on here and what can I do to mitigate this behavior?

sentences:
Why it's not removing the right doors from the list? GameObject[] doorsLeft = GameObject.FindGameObjectsWithTag(c_doorLeft);
        GameObject[] doorsRight = GameObject.FindGameObjectsWithTag(c_doorRight);

        List<GameObject> allDoors = doorsLeft.Union(doorsRight).ToList();

        for(int i = 0; i < allDoors.Count; i++)
        {
            if(allDoors[i].transform.parent.name != "Wall_Door_Long_01" && allDoors[i].transform.parent.name != "Wall_Door_Long_02")
            {
                allDoors.RemoveAt(i);
            }
        }

        foreach(GameObject door in allDoors)
        {
            Debug.Log("Door Parent : " + door.transform.parent);
        }

If it's not "Wall_Door_Long_01" and not "Wall_Door_Long_01" then remove the item from the list.

After that when I'm doing a loop on the allDoors again and debug log the parents I see that some of the parents are not "Wall_Door_Long_01" and not "Wall_Door_Long_02" but after removing they all should be only "Wall_Door_Long_01" or "Wall_Door_Long_02"

Maybe the comparison is wrong ?

sentences:
How do you calculate if a line is facing a curve? Given the 2 points describing a line segment, and the 3 points describing a quadratic bezier curve, how do you calculate if the line is facing towards or away from the curve?

The line has a fixed length, and is stored in 2D as x1/y1 and x2/y2. The curve is a quadratic bezier curve, and is stored as x1/y1 (control point), x2/y2 (bezier point), x3/y3 (control point).

sentences:
Line plane intersection: what is this variable? I'm doing line plane intersection, and have come across an un-referenced variable or constant in the tutorial I'm following.
One of the formulae given is this:
t = N dot (p2 – p0)
     N dot V
The variable I'm stuck with is V. Can someone tell me what V is and how I'd go about finding it?
For more info on that formula, please see the link given in the first para.
Thanks,
James

sentences:
Hemispherical Projection I'm trying to implement a radiosity processor. I'm aware of many places online to find information about radiosity. I found a great source on NVidia's website is  GPU Gems - Chapter 39 . On this page they talk about Hemispherical projection. I've implemented a projector that will place mesh 'vertices' on a unit hemisphere...the problem is that the rasterizer only linearly interpolates between vertices along an edge...

...is there a way to adjust the method of interpolation?

Here is shader code for hemispherical projection...it does place the objects correctly, however, the edges between the vertices are straight...when true hemispherical projection would create rounded edges...

float4x4 mW;
float4x4 mV;
float4x4 mP;
float4x4 mOrtho;
float2 vNearFar;
static const float PI = 3.14159265f;

texture g_TextureDiffuse;
sampler g_SamplerDiffuse = sampler_state
{
    Texture = <g_TextureDiffuse>;
    MinFilter = Point;
    MagFilter = Linear;
    MipFilter = Linear;
    AddressU = Clamp;
    AddressV = Clamp;
};

struct VS_IN
{
    float4 Position : POSITION0;
    float3 Normal : NORMAL0;
    float2 UV : TEXCOORD0;
};

struct PS_IN
{
        float4 Position : POSITION0;
    float3 Normal : TEXCOORD0;
    float2 UV : TEXCOORD1;
    float4 Pos2 : TEXCOORD2;
};

PS_IN VS( VS_IN input )
{
    PS_IN output = ( PS_IN )0;

    float4x4 mWV = mul( mW, mV );
    float4x4 mWVP = mul( mWV, mP );
        half4 vPos = mul( input.Position, mWV );

    half3 vHemi = normalize( vPos.xyz );

    half3 fNearFar = vNearFar.y - vNearFar.x;

    output.Position.xy = vHemi.xy * fNearFar;
    output.Position.z = ( vPos.z / ( vNearFar.y - vNearFar.x ) );
    output.Position.w = fNearFar;
    output.Pos2 = output.Position;
    output.Normal = mul( input.Normal, mWV );
    output.UV = input.UV;
    return output;
}

float4 PS( PS_IN input ) : COLOR0
{
    //float2 uv = input.UV - 0.5;
    //float z = sqrt( 1.0 - input.Pos2.x * input.Pos2.x - input.Pos2.y * input.Pos2.y );
        //float a = ( z * tan( ( PI / 2 ) * 0.5 ) );
        //return tex2D( g_SamplerDiffuse, ( uv * a ) + 0.5 );

    float4 diffuse = tex2D( g_SamplerDiffuse, input.UV );
    return diffuse;
}

technique Render
{
    pass Pass0
    {
        VertexShader = compile vs_2_0 VS();
            PixelShader = compile ps_2_0 PS();
    }
}

Here is screenshot:

It may be difficult to tell, but the cube has two faces( triangles ) per side( 6 sides, 12 faces ). From the picture you may be able to see the problem with flat edges...this problem is well documented...I'm trying to avaoid having to render 5 different images( hemicube ) to approximate a hemisphere...I'm mostly interested in hearing about methods of implementing a hemisphere...I also tried( to no avail ) to write a pixel shader that would warp the final( post scene render ) image. I didn't get great results...

...it also just came to me that I don't necessarily need a render result for computing the form factor...just the area that the projected object consumes within the area of the hemisphere base...

...any thoughts are appreciated!

... here is a screenshot of the cube subdivided...much better...still not accurate

sentences:
How to pass array of dozens of floats to OpenGL 3.0 vertex shader? I use PyOpengl and Python 3.

I have 50 thousand vertices. Position of each vertex could be calculated in vertex shader as

#version 300 es

uniform v_coefficients_weights[COEFFICIENTS_AMOUNT];
in vec3 v_coefficients[COEFFICIENTS_AMOUNT];
in vec3 v_initial_position;
out vec3 v_position;

void main() {
    v_position = v_initial_position + v_coefficients * coefficients_weights;
}

Amount of coefficients varies between 0 and 199 — it's not a problem  for me to generate 200 vertex shaders to cover each situation.
I need to change position of vertices tens of thousands times per application calls as fast as it's possible, so I cannot calculate them once on start.

Though, I cannot provide arrays for each vertex because documentation says:

  Attribute variables cannot be declared as arrays or structures.

I see following solutions of this issue:

(will not work) hardcode suffices of variables names to emulate arrays:

use vectors with names like coefficients_000, coefficients_001, ..., coefficients_199;
use matrices to have 4 vectors in each of variable — will it be better than previous solution with vectors (maybe performance of matrices product is faster than 4 products of vectors)?

calculate vertices positions by myself using C/NumPy;
calculate vertices positions by myself in parallel using OpenCL;
(will not work) store all coefficients in uniform int v_coefficients[COEFFICIENTS_AMOUNT*VERTICES_AMOUNT] and access needed ones according to vertex number, which will be stored in in int vertex_id;
store coefficients in textures (proposed by @HolyBlackCat).

Are there any other solutions of my issue? Is there optimal solution in proposed above?
Will I go out of memory if I will use 200 float 3-vectors for each vertex?

I imagine the solution with hardcoded indices as:

#version 300 es

uniform v_coefficients_weights[COEFFICIENTS_AMOUNT];

in vec3 v_coefficients_000;
in vec3 v_coefficients_001;
...
in vec3 v_coefficients_199;

in vec3 v_initial_position;
out vec3 v_position;

void main() {
    v_position = v_initial_position
        + v_coefficients[0] * coefficients_weights_000
        + v_coefficients[1] * coefficients_weights_001
        + ...
        + v_coefficients[199] * coefficients_weights_199;
}

sentences:
Can I switch scenes by swipe gesture or drag？ Can I switch scenes by swipe gesture or drag?

In my game, there are three main scenes, each of them has several layers which have some UI elements, these elements have some tap gesture.

I already know some ways to switch scenes, such as replaceScene, or by some transitions ways, just like CCTransitionMoveInT, so swiping scenes is feasible or not?

If not, why?

If yes, is it possible to cause memory increases that my gameApp crash?

sentences:
How is actual object size in a scene calculated? I've got stuck with 'pixel per unit' parameters and object scale.

I've created two different sprites. A background picture, 1000x1000 pixels, and another one for a 'player', 200x200 pixels.
I've added two empty game objects, with default transform, so positions are (0; 0; 0) and scale is (1; 1; 1). I added a sprite renderer to both of them, and assigned the required sprites. Both sprites have 1 pixel per unit.

And the 'player' in the scene looks much more bigger than the background.

I expect that if ppu=1, then the background would have a size of 1000 units, a player 200 units and it would be 5 times smaller.

What am I doing or understanding wrong? What is an actual object size?

sentences:
Blender books for advanced character animation and modeling? I've been messing with Blender on and off for over a year, and am now ready to put a lot of sweat into making a great model for an iPhone app I'm working on. I want to learn tips and tricks on how to make great looking models and how to animate them as well.

I know how to do key-frame animation, I just want to learn how to do it well. For instance, I have made a model that walks, but I want to improve it. I want to learn how make its movements realistic.

Does anyone have any resources that could help me with this?

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:
Looking for an elegant way to represent fixed parts of a randomly generated level map I'm coding from scratch a small experimental game on a medium-sized random rectangular square tile map. (Say, a map of a dungeon.)

There are several types of tiles (for example: floor, wall, monster, boss, treasure, player etc.). There are no extra information stored in the map tiles, just tile type.

Most parts of map are randomly generated. However there are several features that are to appear on every generated map in pre-set places. Say, walls around the dungeon, boss locations, player spawn point and the treasure.

Note: Since the game is small, coded for fun, and the only game designer is a programmer (that is, me myself), I do not plan to spend resources on coding a level editor or supporting an existing one. Also, I do not plan to support existing tile map libraries as I want to dig into some of the related coding problems myself (see above about fun), but I be happy happily to look at relevant existing code as a reference.

When I look at my map generation code, I find it rather ugly.

Is there an elegant way to deal with the problem? If that matters, I'm writing this game in JavaScript, but I will be happy to see a relevant reference in any programming language.

Here is a partial pseudocode to illustrate how my current tile generator solution looks like:

this.init = function(w, h) {
  this.w = w;
  this.h = h;
  this.tile_presets_ = { };

  var mid_h = Math.floor(h / 2);
  var quarter_w = Math.floor(w / 4);

  /* Here is the part I don't like -- a set of generator rules: */

  this.preset_col_(0, Tile.GRASS);
  this.preset_tile_(0, mid_h, Tile.FLOOR);

  this.preset_col_(1, Tile.GRASS);
  this.preset_tile_(1, mid_h, Tile.FLOOR);

  this.preset_col_(2, Tile.WALL);
  this.preset_tile_(2, mid_h, Tile.FLOOR);

  this.preset_tile_(2, mid_h, Tile.PLAYER);

  this.preset_tile_(1 * quarter_w, mid_h, Tile.BOSS);

  this.preset_tile_(2 * quarter_w, mid_h, Tile.BOSS);

  this.preset_tile_(3 * quarter_w, mid_h_, Tile.TREASURE);

  this.preset_col_(w - 1, Tile.WALL);
};

Implementation details that may help to understand the code above:

this.tile = function(x, y) {
  var preset = this.tile_presets_[x + y * this.w];
  if (preset !== undefined) {
    return preset;
  }

  return this.random_tile_();
};

this.preset_tile_ = function(x, y, tile) {
  this.tile_presets_[x + y * this.w] = tile;
};

this.preset_col_ = function(x, tile) {
  for (var y = 0; y < this.h; ++y) {
    this.preset_tile_(x, y, tile);
  }
};

Note that I shown a rather simple set of generator rules above. Actual thing is several times longer.

I hate that the code looks imperative — and it is hard to figure out what is going on from the first glance. I think that declarative approach could help. But so far I can't figure out a good solution.

Any clues?

sentences:
Prevent GUI Clickthrough I'm using NGUI to setup my UI in Unity.

Attached to the MainCamera I do have a script to rotate the camera view by clicking and dragging.

It does handle mouse events using Input.GetMouseButton().

The problem is that if I click and drag when the mouse is over a NGUI element (Button, Panel, Slider, whatever), NGUI handles all the mouse events correctly, but they also go through the MainCamera, and the camera rotate.

I want to prevent that.

If I use for example the Unity GUI.Button(), the mouse events are not transfered to the MainCamera and the camera does not rotate.

I have to replicate that, but using NGUI.

I have searched on their support forum, but i couldn't find a solution.

sentences:
Should I have one asset manager and unload and load with different gamestates? Or should I have one for each gamestate? I am working on a LibGDX game and I would like to find out the best way to manage assets. Should I have one AssetManager that is passed through to my GameState init() method to load from each level, then unload all of those resources in the dispose() method of the gamestate.

Or, should I have a separate AssetManager in each gamestate which is passed to each of the entities and components within the gamestate and clear + dispose the entire AssetManager in the dispose() method of the gamestate.

sentences:
View Matrix from Camera in Unity Script I am looking to get a Camera component's "view" matrix in a script. I see that I can get the projection matrix using Camera.projectionMatrix, but I don't see a Camera.viewMatrix property...

I want these matrices in a script for a 3D graphics refresher tutorial that will visualize a camera's view and projection transforms in the form of game objects (representing vertices) that can be moved around the scene.

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:
Mouse Speed in GLUT and OpenGL? I would like to simulate a point that moves in 2D. The input should be the speed of the mouse, so the new position will be computed as following

new_position = old_position + delta_time*mouse_velocity

As far as I know in GLUT there is no function to acquire the current speed of the mouse between each frame. What I've done so far to compute the delta_time as following

void Display()
{

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glColor3f(1.0f, 0.0f, 0.0f);
    static int delta_t, current_t, previous_t;
    current_t = glutGet(GLUT_ELAPSED_TIME);
    delta_t = current_t - previous_t;
    std::cout << delta_t << std::endl;

    previous_t = current_t;
    glutSwapBuffers();
}

Where should I start from here? (Note: I have to get the speed of the mouse because I'm modeling a system)

Edit:
Based on the above code, delta_time fluctuates so much

34
19
2
20
1
20
0
16
1
1
10
21
0
13
1
19
34
0
13
0
6
1
14

Why does this happen?

sentences:
How can I iterate over all entities with a particular component? I'm currently designing a game engine and want to implement my own ECS implementation, so I decided to look around for ideas.

Unity has recently updated their engine and seems to be pushing towards using ECS, instead of their original components-are-systems design.

I noticed that Unity has a method called "GetEntities", a generic method which can do something like this:

public struct SomeComponent : IEntityComponent
{
    public string Message = "Hello, World!";
}

public struct Filter
{
    SomeComponent someComponent;
}

public MovementSystem : EntitySystem
{
    public override Process()
    {
        // How can I accomplish something like this?
        foreach(var entity in GetEntities<Filter>())
        {
            Console.WriteLine(entity.someComponent.Message);
        }
    }
}

I like this style of iterating over entities, given a filter for a specific component they need to include. But I'm not sure how to accomplish something like this.

If someone could shed some light on how something like this is even possible in C# that would be great!

sentences:
Unity: BuildFailedException Reference Library Missing Texture at index 1 I'm new to Unity and I have no idea what this error means, I'm following a tutorial on YouTube which had no error of the sort.

Any idea how can I fix this?

BuildFailedException: ARCore Image Library Generation: Reference library at 'Assets/ReferenceImageLibrary.asset' is missing a texture at index 1.
UnityEditor.XR.ARCore.ARCorePreprocessBuild.BuildImageTrackingAssets () (at Library/PackageCache/com.unity.xr.arcore@2.1.8/Editor/ARCoreBuildProcessor.cs:286)
UnityEditor.XR.ARCore.ARCorePreprocessBuild.OnPreprocessBuild (UnityEditor.Build.Reporting.BuildReport report) (at Library/PackageCache/com.unity.xr.arcore@2.1.8/Editor/ARCoreBuildProcessor.cs:33)
UnityEditor.Build.BuildPipelineInterfaces+<>c__DisplayClass15_0.<OnBuildPreProcess>b__1 (UnityEditor.Build.IPreprocessBuildWithReport bpp) (at <af78ad00a40d4f61b82afc6cafb0a416>:0)
UnityEditor.Build.BuildPipelineInterfaces.InvokeCallbackInterfacesPair[T1,T2] (System.Collections.Generic.List`1[T] oneInterfaces, System.Action`1[T] invocationOne, System.Collections.Generic.List`1[T] twoInterfaces, System.Action`1[T] invocationTwo, System.Boolean exitOnFailure) (at <af78ad00a40d4f61b82afc6cafb0a416>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

The code is the following:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR;
using UnityEngine.XR.ARFoundation;

public class RecognitionScript : MonoBehaviour
{
    private ARTrackedImageManager _arTrackedImageManager;

    private void Awake()
    {
        _arTrackedImageManager = FindObjectOfType<ARTrackedImageManager>();

    }

    public void OnEnable()
    {

        _arTrackedImageManager.trackedImagesChanged += OnImageChanged;
    }

    public void OnDisable()
    {
        _arTrackedImageManager.trackedImagesChanged -= OnImageChanged;
    }

    public void OnImageChanged(ARTrackedImagesChangedEventArgs args)
    {
        foreach (var trackedImage in args.added)
        {
            UnityEngine.Debug.Log(trackedImage.name);
        }
    }
}

sentences:
How to clip what is outside scroll view when using a custom UI element? I have created a custom UI element (that use CanvasRenderer).

Here is code :

Mesh mesh = new Mesh();

Rect drawArea = GetComponent<RectTransform>().rect;

using (VertexHelper helper = new VertexHelper())
{
    helper.AddVert(new Vector3(drawArea.xMin, drawArea.yMin), Color.white, Vector2.zero);
    helper.AddVert(new Vector3(drawArea.xMin, drawArea.yMax), Color.white, Vector2.zero);
    helper.AddVert(new Vector3(drawArea.xMax, drawArea.yMax), Color.white, Vector2.zero);
    helper.AddVert(new Vector3(drawArea.xMax, drawArea.yMin), Color.white, Vector2.zero);
    helper.AddTriangle(0, 1, 2);
    helper.AddTriangle(2, 3, 0);

    helper.FillMesh(mesh);
}

var canvas = GetComponent<CanvasRenderer>();
canvas.SetMesh(mesh);
canvas.SetMaterial(Material, null);

It creates a simple rectangle that is same size as rect transform.

It works great. However if I put this inside a scroll view, everything that is outside scroll area / viewport is rendered (while it should be clipped).

The scrolling works as it should (rectangle get scrolled by changing position when scrollbar is used).

I have tried to call canvas.EnableRectClipping(...); but without success.

sentences:
Explain this line segment intersection code I've been reading this article on pathfinding over polygon meshes using line-of-sight, and in the article are several code snippets. One of them, the one I'm trying to understand, is a simple function that determines whether two line segments intersect.

Here is that function from the article (in C#, though that isn't important to me):

public static bool LineSegmentsCross(Vector2 a, Vector2 b, Vector2 c, Vector2 d)
{
    float denominator = ((b.X - a.X) * (d.Y - c.Y)) - ((b.Y - a.Y) * (d.X - c.X));

    if (denominator == 0)
    {
        return false;
    }

    float numerator1 = ((a.Y - c.Y) * (d.X - c.X)) - ((a.X - c.X) * (d.Y - c.Y));

    float numerator2 = ((a.Y - c.Y) * (b.X - a.X)) - ((a.X - c.X) * (b.Y - a.Y));

    if (numerator1 == 0 || numerator2 == 0)
    {
        return false;
    }

    float r = numerator1 / denominator;
    float s = numerator2 / denominator;

    return (r > 0 && r < 1) && (s > 0 && s < 1);
}

Without any explanation, I assume that the function accepts two line segments, a-b and c-d. I know the first part checks whether the two lines are parallel, in which case they don't intersect. After that, I'm not sure. I suspect the next bit checks whether the two segments are out of range of each other? The code talks about numerators and denominators, so maybe it's dealing with slope comparisons?

In any case, I'd like to understand the math used here for determining line intersections. I know there's an algorithm that this code is following, but I don't know what it is. How does the formula used in the first part determine that the lines are parallel? I know it works, but why does it work? And what does the function do after that? Why?

I'd much rather understand how the code works, and then write my own code from that knowledge, than just blindly copy someone else's code.

sentences:
Resizing a parallax background (bug) I'm attempting my first 2D vertical scroller and can't seem to get the background size to work. For some reason, it stays small. I think in the beginning of the parallax scrolling class, I was told to initialize variables and I know which ones I have to change.

public Texture2D picture;
public Vector2 position = Vector2.Zero;
public Vector2 offset = Vector2.Zero;
public float depth = 0.0f;
public float moveRate = 0.0f;
public Vector2 pictureSize = Vector2.Zero;
public Color color = Color.White;

I think I must change pictureSize to make it bigger, as the current sizing I get this:

Finally, how can I remove the whitespace from the ship image?

EDIT: Here is the code for the rendering of the actual ship:

public void Render(SpriteBatch batch)
{
    batch.Begin();
    batch.Draw(shipSprite, position, null, Color.White, 0.0f, spriteOrigin, 1.0f,
    SpriteEffects.None, 0.0f);
    batch.End();
}

The whitespace seems to be provided by XNA as I've tried clearing it using Photoshop. Because I can't directly upload to the site, I have put it here

This renders the background:

public void Draw()
{
layerList.Sort(CompareDepth);
batch.Begin();
for (int i = 0; i < layerList.Count; i++)
{
   if (!moveLeftRight)
   {
       if (layerList[i].position.Y < windowSize.Y)
       {
           batch.Draw(layerList[i].picture, new Vector2(0.0f,
           layerList[i].position.Y), layerList[i].color);
       }
       if (layerList[i].position.Y > 0.0f)
           batch.Draw(layerList[i].picture, new Vector2(0.0f,
           layerList[i].position.Y - layerList[i].pictureSize.Y),
           layerList[i].color);
       else
           batch.Draw(layerList[i].picture, new Vector2(0.0f,
           layerList[i].position.Y + layerList[i].pictureSize.Y),
           layerList[i].color);
   }
   else
   {
       if (layerList[i].position.X < windowSize.X)
       {
           batch.Draw(layerList[i].picture, new Vector2(layerList[i].position.X,
           0.0f), layerList[i].color);
       }
       if (layerList[i].position.X > 0.0f)
           batch.Draw(layerList[i].picture, new Vector2(layerList[i].position.X -
           layerList[i].pictureSize.X, 0.0f), layerList[i].color);
       else
           batch.Draw(layerList[i].picture, new Vector2(layerList[i].position.X +
       layerList[i].pictureSize.X, 0.0f), layerList[i].color);
       }
   }
   batch.End();
}

(It's from a XNA tutorial book I'm reading.)

sentences: How can I get game objects and prefabs to recognize modifications in enum values from scripts in the scene window I have made a script with several properties and enums that I attached to an empty game object. I am making changes to the values within the inspector, since they a public. How can I get the scene window to recognize these changes as they occur?

sentences:
Why won't my integer go down when my function is called? I'm trying to implement a limited-use slow-mo power into my game using C#, but I can use it infinitely. Why won't my integer go down when my function is called?
using UnityEngine;

public class TimeManager : MonoBehaviour
{
    public float slowdownFactor = 0.05f;
    public float slowdownLength = 2f;
    public int slowmos = 5;

    private void Update()
    {
        Time.timeScale += (1f / slowdownLength) * Time.unscaledDeltaTime;
        Time.timeScale = Mathf.Clamp(Time.timeScale, 0f, 1f);
    }

    public void SlowMo()
    {
        if (slowmos != 0)
        {
            Time.timeScale = slowdownFactor;
            Time.fixedDeltaTime = Time.timeScale * .02f;
            slowmos--;
        }
    }
}

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

public class charcterMovement : MonoBehaviour
{
    public TimeManager timemanager;
    public Rigidbody rb;
    public float forwardForce = 1000f;
    public float rightForce = 100f;
    public float leftForce = -100f;

    // Start is called before the first frame update
    void Start()
    {
        rb.useGravity = true;
    }

    // Update is called once per frame
    void FixedUpdate()
    {
        rb.AddForce(0, 0, forwardForce * Time.deltaTime, ForceMode.VelocityChange);
        //Set Speed To Cube

        if (Input.GetKey("d"))
        {
            rb.AddForce(rightForce * Time.deltaTime, 0, 0, ForceMode.VelocityChange);
        }

        if (Input.GetKey("a"))
        {
            rb.AddForce(leftForce * Time.deltaTime, 0, 0, ForceMode.VelocityChange);
        }

        if (Input.GetKey("space"))
        {
            timemanager.SlowMo();
        }
    }
}

sentences:
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:
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:
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:
OnTrigger not firing consistently I have a Prefab called Player which has a Body and a Sword.
The game uses 2 instances of Player, Player1 and Player2.

I use Player1 to strike Player2. This is code on the sword. My hope is that Sword of Player1 will log on contct with Body of Player2. It happens but only the first hit and then i have to hit several times before another strike is logged. But when i look at log from OnTriggerStay it looks like the TriggerExit is never detected untill long after the sword is gone.

    void OnTriggerEnter(Collider other)
{
    //Play sound to confirm collision
var sm = ObjectDirectory.soundManager;
    sm.PlaySoundClip(sm.gui_02);

    Debug.Log(other.name + " - ENTER" );

}

void OnTriggerStay(Collider other)
{
    Debug.Log(other.name + " - collision" );
}

void OnTriggerExit(Collider other)
{
    Debug.Log(other.name + " - HAS LEFT" );
}

DEBUG LOG:

  Player2 - ENTER
  UnityEngine.Debug:Log(Object)
  SwordControl:OnTriggerEnter(Collider) (at Assets/Scripts/SwordControl.cs:28)

  Player2 - collision
  UnityEngine.Debug:Log(Object)
  SwordControl:OnTriggerStay(Collider) (at Assets/Scripts/SwordControl.cs:34)

  (The last debug log then repeated hundreds of times long after the sword of player 1 had withdrawn and was in no contact with player 2  )

EDIT:
Further tests shows that if i move player1 backwards away form player2 i trigger the OnTriggerExit. Even if the sword is not touching Player2 since after the blow. However even after OnTriggerExit it takes many tries untill i can get another blow registered.

sentences:
MonoGame, sprite to rectangle I'm working with MonoGame in VB2015 - please don't give answers that involve using C#.

Anyway, I found a snippet which I converted to VB for pixel collision. The function below accepts two rectangles, then runs a pixel check on the intersection between the two.

What I can't work out is how to send my two sprites (textures) to the function as rectangles. Or if anyone has a alternative, please let me know.

  Private Shared Function IntersectPixels(rectangleA As Rectangle, dataA As Color(), rectangleB As Rectangle, dataB As Color()) As Boolean
    ' Find the bounds of the rectangle intersection
    Dim top As Integer = Math.Max(rectangleA.Top, rectangleB.Top)
    Dim bottom As Integer = Math.Min(rectangleA.Bottom, rectangleB.Bottom)
    Dim left As Integer = Math.Max(rectangleA.Left, rectangleB.Left)
    Dim right As Integer = Math.Min(rectangleA.Right, rectangleB.Right)

(No, this isn't the whole routine...)

sentences:
libGDX fileHandle cannot readString() I have created a text file called "useraccounts.txt". All I want to do is to read the file using the filehandle class but I always get this exception:

Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Cannot open a stream to a directory: useraccounts.txt (Local)

Here is my code:

FileHande accountsFile = Gdx.files.local("useraccounts.txt");
String text = accountsFile.readString();

Any explanation is appreciated!

sentences:
How to spawn GameObject exactly in front of another object? I'm working on a 3D game in Unity and I'm having a problem trying to spawn an object exactly in front of a wall in my game, like hanging a picture on it. I don't want the object to look like it's too far from the wall or overlapping the wall.

public void SpawnPrefab(Transform prefab)
{
    compSize = prefab.gameObject.GetComponent<Collider>().bounds.size.z;
    Vector3 mousePosition, targetPosition;
    InputManager inputManager;
    inputManager = prefab.gameObject.GetComponent<InputManager>();
    mousePosition = Input.mousePosition;
    targetPosition = Camera.main.ScreenToWorldPoint(new Vector3(mousePosition.x,mousePosition.y,mousePosition.z + compSize/2 + wallSize/2));
    prefab.localPosition = targetPosition;
    if(isAlreadyClicked == false)
    {
        GameObject comp = (GameObject) Instantiate(prefab.gameObject, new Vector3(prefab.transform.position.x, prefab.transform.position.y, prefab.transform.position.z + compSize/2 + wallSize /2), prefab.transform.rotation);
        isAlreadyClicked = true;
    }
}

I tried adding float value on the mouseposition.z like mouseposition.z + <somefloatvalue> but it doesn't seem working like how I wanted because I have different object with different sizes, where some objects spawn at the back of the wall, while some will spawn too far at the front from the wall.

Update: I managed to get the accurate z position for the spawning process, but there's something wrong with its x and y position, it's not spawning based on the mouseclick position.

public void SpawnPrefab(Transform prefab)
{
    clicked = false;
    compSize = prefab.gameObject.GetComponent<Collider>().bounds.size.z;
    Vector3 mousePosition, targetPosition;
    InputManager inputManager;
    inputManager = prefab.gameObject.GetComponent<InputManager>();
    mousePosition = Input.mousePosition;
    targetPosition = Camera.main.ScreenToWorldPoint(new Vector3(mousePosition.x,mousePosition.y,mousePosition.z));
    ray = Camera.main.ScreenPointToRay(targetPosition);
    float rayDistance;
    if(plane.Raycast(ray, out rayDistance))
    {
        prefab.localPosition = ray.GetPoint(rayDistance);
        Debug.Log("clicked");
        if(isAlreadyClicked == false)
        {
            OnClickedButton();
            GameObject comp = (GameObject) Instantiate(prefab.gameObject, new Vector3(targetPosition.x, targetPosition.y, frontWall.gameObject.transform.position.z + compSize - wallSize), prefab.transform.rotation);
            isAlreadyClicked = true;
            Debug.Log(clicked);
        }
    }
}

I don't know what is happening...

sentences:
Java code for client-server game on Android I have developed a game on Android. Now I want to play it on wifi or 3G. I have game packets which I want to send form client (mobile) to server then to another client (mobile).

I don't know how to write code in Java to send the playPackets continuously to server and receive the playPacket continuously from the server to the clients.

I guess I have to use two thread one for sending and one for receiving.

Can someone help me with the code, or the procedure to write code for it?

sentences:
How to deal with different resolutions in a 2D game? For example, you have a sprite of mario with a size of 20px x 20px.  This sprite however was made for a game resolution of 1000px x 1000px. What if you want to provide a different game resolution as an in-game option? You could offer to change the game resolution to 2000px x 2000px, but then Mario should be drawn again for this particular resolution. And if you offer many resolutions, this can be very much to draw and the amount of space the image files will take, are going to get too big.

So, my question, what's the trick here?

sentences:
Implementation of finding an index in a 1D array for a triangular grid Am using a while loop to find an index within a 1D array, is there an easier, less-time-consuming and/or mathmatical way to find the index?

Consider the next grid:

 4   o
     |\
     | \
     |  \
 3   o---o
     |\  |\
     | \ | \
     |  \|  \
 2   o---o---o
     |\  |\  |\
     | \ | \ | \
     |  \|  \|  \
 1   o---o---o---o
     |\  |\  |\  |\
     | \ | \ | \ | \
     |  \|  \|  \|  \
 0   o---o---o---o---o

     0   1   2   3   4

To find an index in the triangular grid within a 1D array I have the next function:

//int size = 5;
int getindex( int x, int y )
{

    int columnCount = size;
    while( y-- > 0 ) x += columnCount--;

    return x;

}

The array (The numbers within the parenthesis are the coordinates and to simplify your view, in reality the (x,y) is in its whole the data):

pointdata data[ 15 ] = {
    (0,0), (1,0), (2,0), (3,0), (4,0),
    (0,1), (1,1), (2,1), (3,1),
    (0,2), (1,2), (2,2),
    (0,3), (1,3),
    (0,4),
};

sentences:
Verlet collision with impulse preservation I came across this article, recently, that presented a technique for impulse preservation with position-based verlet integration. What was interesting was that the integration steps are seemingly done differently from typical position-based verlet schemes, as well as the ordering of the integration step and collision resolutions.

Specifically, the typical verlet position integrator is:

newPosition = 2 * position - oldPosition + acceleration * timeStepSquared
oldPosition = position
position = newPosition
DoConstraints()

Where the article has:

position += acceleration * timeStepSquared
DoConstraints()
newPosition = position * 2 - oldPosition
oldPosition = position
position = newPosition

Which ignoring constraints for a moment works out to be:

newPosition = 2*position - oldPosition + 2*acceleration*timeStepSquared
oldPosition = position + acceleration*timeStepSquared
position = newPosition

Which is different in a term of acceleration * timeStepSquared.  I haven't quite convinced myself that those terms cancel out through the iteration, as the prior acceleration * timeStepSquared term may not be the same as the current one.

Could someone explain the reasoning for this, and if indeed it makes sense?

sentences:
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 it possible to publish an app based on a board game? Usually the boxes says "all rights reserved" and "registered trademark". What does it mean? Could others make an app with the game's name and mechanic? Is it possible to sell it, put banner ads or make it free?

sentences: Moving object parallel to another on path on 2d space How to Move object parallel to another on curved path on 2d space

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:
Having trouble with foreach loop affecting anything past the first object found I have been trying to disable isTrigger in unity c# script on all GameObjects containing a certain tag. Currently my code works and disables the isTrigger part of the box collider, but it only does this for the first object with the tag I am looking for do this for all objects.

Here is the code:

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

public class DefenseCollisionTrigger : MonoBehaviour {

    public static Rigidbody rb;
    public bool CanBePlaced;
    public GameObject[] defenseTriggers;

    void Start ()
    {
        CanBePlaced = true;
        defenseTriggers = GameObject.FindGameObjectsWithTag("Defense");
    }

    public void OnTriggerEnter (Collider other)
    {
        if (other.tag == "Defense")
        {
            CanBePlaced = false;
        }
    }

    public void OnTriggerExit(Collider other)
    {
        if (other.tag == "Defense")
        {
            CanBePlaced = true;
        }
    }

    public void IsTriggerFalse()
    {
        foreach (Object dt in defenseTriggers)
        {
            Debug.Log("working on it");
            GetComponent<Collider>().isTrigger = false;
        }
    }
}

That is what is currently looks like. The public void IsTriggerFalse() is called on each time I go to instantiate an object with my mouse button. The Debug.Log is working and printing to the console. This is the closest I have came to making it work, but it only works for the first object. I have searched for hours and watched videos/looked at unity docs on foreach statements with no luck to my issue. I have also tried using foreach (GameObject dt in defenseTriggers) instead of just Object.

Anyone know how to solve my issue?

sentences:
Appropriate database schema for heroes' skills in a Tower Defense game? In a Tower Defense game, each hero (or character) has some skills. Each skill has some "chance of appearance" (CoA for short) when attacking enemies and if appeared it has some "hit accuracy" (i.e. hit on enemies) (HA for short) and has effects on the enemies (if hit by the skill) (EoH for short).
Examples:
Skill #1: Frost 1, CoA: 50%, HA: 100%, EoH: (1) slow enemy down for 4s and (2) yield 200 damage points.
Skill #2: Frost 2, CoA: 100%, HA: 50%, EoH: (1) make enemy frozen for 8s.
I first tried to breakdown skills into "atomic" effects and come up with tables as below:

All looks good?
But now we want to update Skill #1 a bit to make it more complicated:
Skill #1: Frost 1, CoA: 50%, HA: 100%, EoH: (1) slow enemy down by 40% for 4s and (2) yield 200 damage points. (Please pay attention to the 40% here!)
Or even coming up with more complicated skills:
Skill #3: Frost 3, CoA: 20%, HA: 100%, EoH: (1) frozen enemy for the first 4s then slow enemy down by 50% for next 4s and (2) yield 200 more damage points.
Skill #4: Frost 4, CoA: 10%, attack enemy 3 times continuously, each time: HA: 50%, EoH: (1) frozen enemy for the first 2s then slow enemy down by 50% for next 2s and (2) yield 400 more damage points.
Each effect now has more parameters to be specified -- which makes my current schema not fit anymore. Please help deal with this!

sentences:
Find the Contact Normal of Rectangle Collision It seems a lot of people have asked similar questions on this site, and every time it seems like a whole bunch of answers that don't work are given.
Basically, I have two rectangles (AABBs) that collide, and I want to find out on what side they collided with each other.

I know the velocities of each object before they collide, and of course their positions before and when they've actually collided (if I use discrete collision checking that is, currently I'm using speculative). Many people say find the lowest penetration distance or take the largest speed (either horizontal or vertical) and that will give you the answer. But the collision is dependent on both of those values, I just don't know how they fit together to tell me where the collision is coming from. I don't think I need an exception for corner collisions.

I do not want to do my horizontal and vertical collisions separately as that just opens up even more problems.

So, any suggestions?

sentences:
Is it legal to use car manufacturers' names in a game? Is it legal to use car manufacturers' names in a game?

For example:

to describe Audi's quattro drive system?
to display a rendering of an Audi?
to include a photo (to which I have rights) of an Audi?

sentences:
Getting a 3d mouse position I've looked at a few tutorials about picking and the method Unproject, so I have an idea of how getting the mouse in 3d space is done. The code I have does display a mouse position, but it is way off of the actual position the mouse is at.

    public Vector3 FindWhereClicked(MouseState ms)
    {
        Vector3 nearScreen = new Vector3(ms.X, ms.Y, 0);
        Vector3 farScreen = new Vector3(ms.X, ms.Y, 1);
        Vector3 nearWorld = device.Viewport.Unproject(nearScreen, cam.proj, cam.view, Matrix.Identity);
        Vector3 farWorld = device.Viewport.Unproject(farScreen, cam.proj, cam.view, Matrix.Identity);

        Vector3 direction = farWorld - nearWorld;

        float zFactor = -nearWorld.Y / direction.Y;

        Vector3 zeroWorldPoint = nearWorld + direction * zFactor;

        return zeroWorldPoint;
    }

This code is from another thread I found on here. I'm guessing the problem is the near and far world variables.

    public ThirdPersonCam()
    {
        proj = Matrix.CreatePerspectiveFieldOfView(0.78f, 1.7777f, 1f, 10000f);
    }

    public void CameraUpdate(Matrix objectToFollow)
    {
        Vector3 camPosition = objectToFollow.Translation + (objectToFollow.Backward * 10) + (objectToFollow.Up * 2);
        Vector3 camTarget = objectToFollow.Translation;

        view = Matrix.CreateLookAt(camPosition, camTarget, Vector3.Up);
    }

The variables are grabbed from my camera class, but I don't know why it isn't working. A point that's supposed to be at 0, 0, 0 ends up being at something like 36, -1, 57

sentences:
Switching from one solution to another in visual sudio I have been able to bring a number of projects together like this:

But now, whenever I try to switch from "Bitmap Loading and Drawing" sln(do realize bold letters) to another sln, I am unable to do so.

I even tried to click on another sln's file. It does come out but if I try to build the latter sln file... the former sln gets built.

what is the correct way to switch from one solution to another?

Thanks in advance.

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:
In modern AAA games with open environment and lot of static content (eg : crysis), how is occlusion culling performed? Two ideas i have in mind :

1) Scene is rendered to a invisible buffer, using low resolution and low polygon count models (or even using only bounding volumes like cubes or spheres). The buffer is then checked to know what is visible or not. Before rendering the low resolution scene, some frustum culling could be applied, to already remove as much objects as possible.

2) A tool is run on the static map and will perform complex (and thus slow) ray tracing to know for some 3d positions on the map what is visible and what is not. All that information is then stored in a efficient way that can be user later at runtime (eg: an octree)
This solution would only work for static meshes (eg : building) not moving objects.

sentences:
Setting up images for frame animation I am learning the basics of iPhone frame animation.  I have code that loops through 15 images to do an animation:

- (void)viewDidLoad
{
    [super viewDidLoad];
    UIImageView *iv = [[UIImageView alloc] initWithFrame:CGRectMake(40, 40, 95, 70)];
    NSMutableArray *arr = [[NSMutableArray alloc] init];
    for(int i = 1; i <=15; i++){
        UIImage *img = [UIImage imageNamed:[NSString stringWithFormat:@"someImage_%02d", i]];
        [arr addObject:img];
    }
    iv.animationImages = arr;
    iv.animationDuration = 1.0 / 2;

    [self.view addSubview:iv];
    [iv startAnimating];
}

I want to load images of Link from a picture I found on the internet.  How can I take this image (available as a png) and load the unique parts of the image?  I have heard of people putting multiple images into a single PNG to improve performance. How do I extract the individual images into an array for use in code like the above?

Please keep in mind this is my first time doing frame animation.  I realize this code can likely be improved.  I'm trying to keep things simple.

sentences:
How to load a text file from a server into iPhone game with AS3 in Adobe AIR? Im creating an iPhone game with Adobe AIR, and I want to be able to load a simple text msg into an dynamic text box on the games front screen from my server (and then be able to update that text file on the server, so it updates automatically in the game after the game is on the app store) How would I go about acheiving that? is it as simple as using a getURL? are there any specifical issues with trying to do this on the iPhone via AIR that I should be aware of?

Thanks for any advice.

sentences:
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:
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: Full Engine or Not: C++ Programmer Trying to get into Game Development I'm a fairly experienced programmer, and I want to try out doing some game development. However, I am unsure of whether or not to use a full engine like Unity or just start with something like OpenGL. How much flexibility/extensibility do you use going with Unity. I know it can be used with minimal coding, but if you can write your own code, will it constrain you later down the line? For my first project I want to just build a simple tile based rpg and build it up to something larger. Any advice is welcome.

sentences:
Object Transparency Dithering (as shown in Super Mario Odyssey) A couple games I've been playing recently all have a similar goal of dithering objects when they approach the near clip plane.  Super Mario Odyssey applies this dithering-near-clip-plane effect, but along with object intersection dithering for objects like Mario.  I have an example of this dithering in Super Mario Odyssey later in this post.

How would one go about creating this effect in their graphics solution of choice?

The gifs might take a little while to get started.  I couldn't get them to each be under 30 mb :(

Example in Super Mario Odyssey

The balloon of the Odyssey doesn't "exit dithering" until the camera is a good distance away from it.  This could mean dithering is calculated based on object distance from camera, instead surface distance.

Flag starts out with a small dither density, and Mario has no dithering applied to him.  Once the flag is fully opaque, Mario becomes dithered, but only in the portions that is covered.  Also note Mario's coat tail has the "transparency dithering" applied to it.  How are the object's shaders structured to allow this compound effect?

Below is a blown up image of Mario being dithered.  Notice how dithering exists in intersection regions, and when behind objects!

sentences:
How can I stop rigidbody velocity from being overridden? I have two behaviors on my player. "Walk" and "Dodge". Individually they work as intended by altering the players Rigidbody.velocity. However trying to dodge while holding left or right will trigger "Dodge" then "Walk" will over ride the change since you're holding left or right.

"Walk Script"
within the update loop If you press left or right

_body2D.velocity = new Vector2(speed * direction, _body2D.velocity.y);

"Dodge Script"
within the update loop If you press the dodge input it will move the player the opposite direction their facing.

_body2D.velocity = new Vector2( - (speed * direction), _body2D.velocity.y);

if you hold left or right while pressing the dodge input it will dodge in the direction you're pressing.

_body2D.velocity = new Vector2(speed * direction, _body2D.velocity.y);

I've tried changing the script execution order to prioritize the Dodge behavior over Walk. I've tried disabling the walk script during the animation with the following method.

ToggleScripts(!_animator.IsInTransition(0));

protected void ToggleScripts(bool value)
{
    foreach (var script in disabledScripts)
        script.enabled = value;
}

sentences:
Do I have to compile Unreal 4's source myself in order to make games with it? Now I understand the need for this if people want to make modifications to the engine itself, but if I want to use the engine as is and just program games with it, do I need to do all this?

I figured I needed to build the Engine because a UE4 programming tutorial said "I assume you have already downloaded the engine source from GitHub and compiled it in VS2013", nobody says why, nobody clearly states whether or not this is required to make a game in C++ using Unreal Engine 4.

Can anyone help?

sentences:
Is there a common way to execute a task at a certain pace, without relying on the task priority feature of the OS? There is no cross platform way to set process priorities, and I don't want to use threads since there are no standard method of setting priority to certain threads, apart from the fact that threads are hard to use.

Let's say I have a task that takes a certain amount of computing time, which on my computer takes 10 seconds. This task usually takes a long time, like for example, loading geometry chunk dynamically, or opening a new audio ambience file. I don't need this task to be finished instantly because it's a big task so I can't afford to wait for a frame to finish, so I need to execute it over several frames, rather a certain amount of time.

Since I don't want to freeze the game, I can cut this loop into several batches and execute one batch per frame. If my game runs at 50 fps, a 10 second task can be divided in 500 batches. If my program loops over N*500 iterations, each batch loops over N iterations. If I don't want it impact others parts of my game, I can execute N/2 or even N/5 iterations per batch.

I'm not sure if I'm reinventing the wheel though, isn't there some C++ standard thing or programming pattern that allows me to do that already ? I'm not sure if it's optimal to cut a loop, and I'm not planning to use multithreading.

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:
UE 4.25.3 - can't make layered animations to work I want to make my character's upper body animations not connected to the lower body. For example, I have this set of animations:
Running
Jumping
Crouching
Kick
Sliding
Idle with sword
Sword attack
I need the idle with sword and sword attack animations override upperbody for every other animation, but the slide and kick. So, I want my character to hold his hand with the sword in front and do sword attack even while running and jumping.
I tried using layered animation like in every tutorial on Youtube. I created the upperbody slot, created a montage for my desired upperbody animation, added the Layered blend per bone node in the animBP and set the bone there, but it doesn't work. I don't know if I've missed something.

sentences:
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:
Cursor position to a 3D ray using angles I've been stuck for a month trying to get gluUnProject working. After my attempts to use gluUnProject failed (as well as attempts to implement gluUnProject functionality manually) I implemented method to get ray using angles.

 float RadToDeg = 180.0f / (float)M_PI; // conversion coefficient to degree
 float DegToRad = 1 / RadToDeg; // conversion coefficient to radians

 float DeltaX = tan(fovy/2 * DegToRad) * 2 * (Width / 2 - winX) * zNear / Height;
 float DeltaY = tan(fovy/2 * DegToRad) * 2 * (Height / 2 - winY) * zNear / Height;
 float AngleX = atan(DeltaX / zNear) * RadToDeg;
 float AngleY = atan(DeltaY / zNear) * RadToDeg;

 float DeltaXY = sqrt(DeltaX*DeltaX + DeltaY*DeltaY);
 float AngleXY = atan(DeltaXY / zNear) * RadToDeg;
 float AxisAngle = atan(DeltaX / DeltaY) * RadToDeg;
 vec3 RotationAxis = rotate(Camera->X, AxisAngle, Camera->Z);
 if (DeltaY < 0) { RotationAxis = -RotationAxis; }

 vec3 ray = rotate(-(Camera->Z), AngleXY, RotationAxis); //getting ray direction
 ray = vec3(ray.x * scale, ray.y * scale, ray.z * scale); //scale ray if needed

 vec3 RayEndPoint = Camera->Position + ray;

The main idea behind my method is to rotate ray pointing perpendicularly from the middle of the screen (like in first person shooters) to position where you clicked.

Necessary values are fovy angle (field of view in vertical direction), zNear (distance from Camera to near plane) and Camera Transformation Matrix(Camera->X, Camera->Y, Camera->Z, Camera->Position - 1st, 2nd, 3rd and 4th columns). Difference between Camera Transformation Matrix and View Matrix here.

Besides we need some method rotate(vec3 vector,float angle,vec3 axis) that will rotate any vector at any angle around any arbitrary axis.
Explanation how it works will consume too many lines (check photo of my calculations).

Q: Is any easier or better way to do it? Any information or links welcomed.

sentences:
How do I get A.I. that follows a list of movement commands to move smoothly in a tilemap based game? This is for a school project so it's not intended to be sold/fun/or a complete game, rather just a demonstration of stuff we've learned without resorting to frameworks and stuff.

My ai agents choose a random point in the grid and generate a sequence of actions to take to get there using breadth first search. They do this indefinitely until they're killed (something I haven't gotten to yet).  Each action corresponds to one tile movement so I'm having trouble translating that into smooth movement transitioning from one tile to the next rather than just stuttering to it.  What I have at the moment is limiting how many actions can be taken per second so the agent doesn't just teleport around the game because it's moving so fast.  Can I modify what I have here to achieve smooth movement, or do I need to take a different approach in how to generate my action sequence?

I had smoothish movement when my MAX_VELOCITY = 1 by just rounding down if the time step made the agent move past more than one tile, but it didn't work for higher numbers, like MAX_VELOCITY = 10. The player character moves at MAX_VELOCITY = 10 which I think is perfect.

Edit:  I'm thinking of something now though I don't know if it'll work or if it's the right way to do it.  If I only use enough of the time step to advance to the next square, then I could use the rest of the timestep on the next action, or something like that until I'm out of time.

Edit2:  It seems to work properly.  There's some collision detection issues coming up, but it looks pretty much as smooth as the player character movement.  I'll leave the answer unchosen for now since my solution isn't very good but I'll post what I have here once I figure out the collision detection issues.

@Override
public void move(double dt) {
    this.elapsedTime += dt;
    if (this.actionsIndex == this.actionsToGoal.length() || this.actionsIndex == -1) {
        long startTime = System.nanoTime();
        if (this.goal != null) { //Debugging stuff
            startingPosition = new Point((int) this.posX, (int) this.posY);
            System.out.println("Arrived at goal");
            System.out.println(startingPosition.toString());
            System.out.println(goal.toString());
        }
        chooseGoal();
        this.frontier.clear();
        generateActionSequence();
        double timeTaken = (System.nanoTime() - startTime) / 1000000000.0;
        this.elapsedTime += timeTaken;
    }

    if (this.actionsIndex != -1) {
        while (elapsedTime >= 1.0 / this.actionsPerSecond && this.actionsIndex != this.actionsToGoal.length()) {
            char action = actionsToGoal.charAt(this.actionsIndex++);
            switch (action) {
                case State.LEFT:
                    this.posX -= MAX_VELOCITY;
                    break;
                case State.RIGHT:
                    this.posX += MAX_VELOCITY;
                    break;
                case State.UP:
                    this.posY += MAX_VELOCITY;
                    break;
                case State.DOWN:
                    this.posY -= MAX_VELOCITY;
                    break;
            }
            elapsedTime -= 1.0 / this.actionsPerSecond;
        }
    }

}

sentences:
Trying to use an overlapping shader for 2D sprites but sprite wont show its shape So Im trying to use this shader I had from a while ago to implement shadows in a 2D top down game. In order to show clouds on top of the game.
At the moment, Sprites dont overlap which is good, but the shape of the sprite rendered by the sprite renderer is completely different to the one inserted in the sprite renderer, as the sprites in the sprite renderer are circles not squares.
And it seems to cover any other sprite in the scenes which is not what a shade is supposed to be like.

How can I modify the shader so that it respects the sprite. Also I want it to react to lighting the same way as sprite diffuse does.

Shader "Custom/OverlappingDiffuse"
{
    Properties
    {
        [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" { }
        _Color ("Tint", Color) = (1, 1, 1, 1)
        [MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
    }

    SubShader
    {
        Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" "PreviewType" = "Plane" "CanUseSpriteAtlas" = "True" }

        Cull Off
        Lighting On
        ZWrite Off
        Blend One OneMinusSrcAlpha

        Stencil
        {
            Ref 1
            // Comp NotEqual
            Comp NotEqual
            Pass Replace
            Fail Keep
            ZFail Keep
            ReadMask 1
            WriteMask 1
        }

        CGPROGRAM

        #pragma surface surf Lambert vertex:vert nofog keepalpha
        #pragma multi_compile _ PIXELSNAP_ON
        #pragma multi_compile _ ETC1_EXTERNAL_ALPHA

        sampler2D _MainTex;
        fixed4 _Color;
        sampler2D _AlphaTex;

        struct Input
        {
            float2 uv_MainTex;
            fixed4 color;
        };

        void vert(inout appdata_full v, out Input o)
        {
            #if defined(PIXELSNAP_ON)
                v.vertex = UnityPixelSnap(v.vertex);
            #endif

            UNITY_INITIALIZE_OUTPUT(Input, o);
            o.color = v.color * _Color;
        }

        fixed4 SampleSpriteTexture(float2 uv)
        {
            fixed4 color = tex2D(_MainTex, uv);

            #if ETC1_EXTERNAL_ALPHA
                color.a = tex2D(_AlphaTex, uv).r;
            #endif //ETC1_EXTERNAL_ALPHA

            return color;
        }

        void surf(Input IN, inout SurfaceOutput o)
        {
            fixed4 c = SampleSpriteTexture(IN.uv_MainTex) * IN.color;
            o.Albedo = c.rgb * c.a;
            o.Alpha = c.a;
        }
        ENDCG

    }

    Fallback "Transparent/VertexLit"
}

This is how is showing up in the editor:

here is what I want , and want I am getting at the moment:

sentences:
At what scale do I need to make tools? In making a game, if I'm writing my own engine, at what sort of scale of team should I invest time in making a level editor tool? If it's just me on my own will it be worth it? Or when there's a team of two? ten?

By what metric do I judge if making the tool is "worth it"? Or is it always worth the time investment?

sentences:
Blue color instead of alpha using Alpha Blending I am testing rendering with alpha blending state according to this guide.
The aim is to add snow on terrain grass texture.
Finally, I got the wrong result -- the blue color fillings up all alpha = 0 pixels.
I checked the instruction step triple time, can't find any mistakes.
Could someone explain to me what's is wrong with my code?
PS and VS:
SnowPSIn SnowVSMain(SnowVSIn Input)
{
    SnowPSIn Output;
    float fY = g_txHeightMap.SampleLevel(g_samLinear, Input.vTexCoord, 0).a * g_fHeightScale;
    float4 vWorldPos = float4(Input.vPos + float3(0.0, fY, 0.0), 1.0);
    Output.vPos = mul(vWorldPos, g_mViewProj);
    Output.vTexCoord.xy = Input.vTexCoord;
    Output.vTexCoord.z = FogValue(length(vWorldPos - g_mInvCamView[3].xyz));
    Output.vTexCoord.w = length(vWorldPos - g_mInvCamView[3].xyz);
    //Output.vShadowPos = mul(vWorldPos, g_mLightViewProj);

    return Output;
}

float4 SnowPSMain(SnowPSIn Input) : SV_Target
{
    float4 vSnowColor = g_txTerrSnow.Sample(g_samLinear, Input.vTexCoord.xy * 64);
    return vSnowColor;
}

BlendState:
BlendState SrcAlphaBlendingAdd
{
    BlendEnable[0] = TRUE;
    SrcBlend = SRC_ALPHA;
    DestBlend = INV_SRC_ALPHA;
    BlendOp = ADD;
    SrcBlendAlpha = ZERO;
    DestBlendAlpha = ZERO;
    BlendOpAlpha = ADD;
    RenderTargetWriteMask[0] = 0x0F;
};

Pass:
pass RenderShowPass
{
    SetVertexShader(CompileShader(vs_5_0, SnowVSMain()));
    SetGeometryShader(NULL);
    SetPixelShader(CompileShader(ps_4_0, SnowPSMain()));
    SetBlendState(SrcAlphaBlendingAdd, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xFFFFFFFF);
}

all sources
Before:
After:

sentences:
How do game designers create vibration patterns? I am curious about creating and implementing vibration patterns for console controllers (for the PS4 controller, if it makes a difference).

There is a delay and motor speed parameter right? But also we can fade from left motor to right, or make them work together....

Is there a standardized way to create those patterns?

For example I thought about creating them with stereo wav audio in an audio editor and reading the wav file in my code to convert them to delays and speeds.

How is this done in the gaming industry?

sentences:
Are there any open source CCG projects? I'm having trouble finding any well-developed open source Collectible Card Game projects.

I want to find projects to learn from and port to a mobile platform.

sentences:
Networking Pong Clone I have the fundamentals of TCP sockets, UDP communication etc, but can't find much on how to apply these to a real time game environment.

I have a Pong clone, with 4 players, and need to synchronise the paddle positions between the three clients and the server (the server is the fourth player). Currently I use UDP to send real time updates (paddle movements), and TCP for setting up the game lobby etc.

Is it a BAD THING to be spamming out huge amounts of UDP traffic? Should I look into something like DCCP for its congestion features? Or is this not really a problem with a small scale project like this?

When should synchronise messages be sent between client/server? Currently the server is spamming out UDP packets with the current game state as fast as it can manage, and clients are spamming out their paddle position back to the server as fast as they can.
Is this the best way to do it? Is there some sort of delay I should add so messages are sent once every X milliseconds, or should I only be sending out messages as events happen? (eg paddle velocity changed due to user input)

Would it be better to make clients communicate their paddle positions with each other peer to peer?

I am asking these questions within the context of Pong but am also interested in how these problems would be overcome in other games, or generalised solutions.

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:
Determining whether to trigger random events Say I want to trigger some event with a certain likelihood throughout gameplay. For example, say I want there to be a 5% chance of engine failure in a spaceship simulator that runs for an indeterminate length of time.

When and how do I determine if that event will occur? If I determine it will occur, how do I determine when it will occur?

The problem I see is that if you calculate the chance of a failure every tick, then there's a 5% chance of failure per tick, which means over two ticks there's more than a 5% chance - something like 8% I believe. Once the game ticks 1,000 or 1,000,000 times, it's almost certain the engine will have failed (~100% chance) when there's only supposed to be "a 5% chance."

Say we somehow knew the game would last for ten minutes - then we could get a random number 1-100 and if it's 5 or less, say the engine will fail within those ten minutes. But then at minute 5, say the player upgrades his or her engine to a 2% failure rate. We could again roll the die and if we get 2 or less, the engine will fail within the next five minutes. But again, we've calculated the chances of failure twice, which means it's more likely to fail than if we calculated those chances only once.

When we look at in-game items, they never say "5% chance of failure per frame, per minute, per game, etc." What does "x% chance" really mean and how do we get a computer to tell us if and when the event will occur?

sentences:
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:
More vertices vs more textures I'm currently working on a dynamic 'door' creator, and I'm trying to decide which is more efficient. Not much experience with 3D render speeds, so I'm asking before I choose which direction to go because its a lot of work either way. (The doors will be able to open/close.)

So I came up with two possibilities.

I generate all the triangles (as in the left picture), and go on my way.
I generate only two triangles, then create and save a whole new texture that is filled only  with pixels that are not 'covered' by the door (the others are marked as transparent). I would then dynamically add the texture to a texture atlas. Then when the outside portion (gray) of the door is drawn, it would appear as in the right picture.

Hence, more vertices, or more textures? Before I start down one road, any advice on this? Or any other suggestions?

Thoughts: Creating a new texture for each instance would eventually take up too much memory, but they would be reusable. My gut says this would be better for a small game world with not many unique doors, so maybe I should just implement both and let the user decide.

sentences:
FPS-like mouse-look camera WinAPI problem I have a problem with implementing mouse-look camera movement, like in FPS games. For me common solution is:

Process WM_MOUSEMOVE event in WndProc
Calculate delta movement from the window's center using event's lParam
Rotate camera
Return cursor back to window's center using SetCursorPos

The problem is when SetCursorPos is called, another WM_MOUSEMOVE event is being fired. So camera rotates back.

What is the common way to create such type of camera on Windows platform (using WinAPI)?

I know that in WM_MOSEMOVE I can check is mouse.x == windowCenter.x and if it is - do nothing, but it's a hack from my point of view. Is there any "non-hacky" way to achieve the goal?

sentences:
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:
Have several classes with a common interface, but still able to access MonoBehaviour methods through that interface? In our project we used to have a PlayerObject class and then Unit and Building derived from that class. We recently started taking a look at Bolt, which requires classes that define objects that may have different states to inherit directly from a Bolt class. So Unit and Building can no longer inherit from PlayerObject.

This turns out to create a few problems, a significant portion of our game uses PlayerObject rather than Unit or Building to perform actions that are the same for both. Separating them would really throw a wrench into the program, since you now have to have methods that use both Unit and Building instead of just PlayerObject.

I thought making a common interface IPlayerObject, and defining common properties and methods in the interface and making Building and Unit both derive from IPlayerObject would do the trick. I did not think it through enough and came to find out that if I use IPlayerObject I can no longer access MonoBehaviour methods and fields (such as transform, or render).

Can I make this in such a way that I can use the IPlayerObject type, with a Unit or Building type and still have access to MonoBehaviour through that interface?

If not, is there a proper way to do this, past just adding in extra methods to handle Unit and Building types separately.

sentences:
Rectangle in object-layer has wrong coordinates in game I extended the SuperKoalio LibGDX Example about an Tiled Object Layer in the Tiled Level-Editor and draw a rectangle on this layer.
Now I would like to draw this rectangle in my game using the ShapeRenderer debugRenderer from the above SuperKoalio Example.

So, I changed the renderDebug method from example:

private void renderDebug () {
    Gdx.graphics.getGL20().glLineWidth(1.5F);

    // I think something is wrong with this:
    debugRenderer.setProjectionMatrix(camera.combined);

    debugRenderer.begin(ShapeType.Line);

    //Removed the rendering of the rectangles around ground and player

    // I added the object layer "objects" in the level1.tmx map
    // And this code:
    MapLayer objectLayer = map.getLayers().get("objects");
    debugRenderer.setColor(Color.RED);
    Rectangle rect;
    for(MapObject mo : objectLayer.getObjects()) {
        rect = ((RectangleMapObject) mo).getRectangle();
        debugRenderer.rect(rect.x, rect.y, rect.width, rect.height);
    }

    debugRenderer.end();
}

Running this looks like:

The rectangle is missing in game and I can't figure out why.
Removing the setting of the ProjectionMatrix camera.combined makes the rectangle visible but it doesn't stick on the map and scrolls with the player. The position is a little wrong, too.

You can find my gist with modified example here.

How do I render this rectangle correctly? Thanks in advance!

sentences:
LibGDX Bounding Rectangles I'm creating some rectangles surrounding my sprites for my player and bullet class to detect collisions with the overlaps method in Intersector class of LibGDX.

I have a question:

When I instantiate Player and Bullet, I create a bounding box around the sprite using sprite.getBoundingRectangle() which returns a Rectangle object. I update the movement of these somewhere else in the main class.

When I update the movement of the bullet/player sprite, do I also need to update the position of the bounding box surrounding the bullet/player sprite? Or since the bounding Rectangle surrounds the sprite, will the box automatically move with the sprite?

Thanks

sentences:
Multiplayer and creeps (NPC enemies): how to compute bullet hits given the lag? We are making a multiplayer co-op game, where players will shoot not each other but AI enemies (creeps), controlled by the game. The chosen implementation is client-server with an authoritative server. Edit: we use client-side prediction for both creeps and avatats to give the illusion of immediate responses. So far we managed to make creeps movement syncronized on the client and the server, that is at the same point in time each and every creep are located in the very same place on the client and on the server.

However, the player avatars cannot be syncronized in this way - it is simply impossible. Player avatar will always lag on the server. Now the problem arises when we try to shoot and hit the creeps. The two avatars (client and server ones) will fire bullets in different places (because one lags from another), but the creeps positions are equal. Bullets hit almost instantly, which means that quite often the bullets will not hit the creeps on one of the machines and, as the server is authoritative, it will have the final say in what actually happened. Ofcourse such behaviour is unacceptable.

One solution would be to force creeps to lag on the server, but that is a poor solution as the lag (ping) may vary dynamically and, more importantly, the game is designed to allow for up to 4 player multiplayer mode and I cannot even start to think, how to fit this solution to other players' bullets.

The only thing I could find so far on the internet is the fact that in FPS multiplayer shooters you see your opponent in the past and the server "rewinds" each of you before hit-scanning. But how do you exacly implement this? Do you keep the list of recent positions/actions on the server? But what if hit-scanning involves taking skeletal animation into account? Do you store recently played animations aswell? Any advice would be appreciated.

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:
Question on parallelizing ECS Systems Learning & Implementing an ECS system for my game, I'm wondering how I am supposed to parallelize the systems on multiple threads. Different systems can't run at the same time (unless they operate on completely different set of components), so I guess the most common option is to run each system sequentially and parallelize the iteration they do on components, in a parallel_for fashion. The problem with this is that parallel_for assumes each iteration is self contained, which is not always true. In case an entity needs to access the component of another entity, and maybe modify it (very common in gameplay programming), we cannot really run a parallel_for as often we don't know what entities will want to access (through the system) what other entities.
How is this handled in ECS?

sentences:
Different bounding volumes for culling and collision detection Should an object in a 3D-engine use different bounding volumes for collision-detection (broad-phase) and culling?

Basically class renderBounds and class physBounds versus class boundingVolume?

Each of this classes then could either contain the same type of volumes (AABB's, kDOP's,  sphere's etc.) or a special fitting one for the particular object.

(note: without considering of using an external physics engine)

sentences:
How to include a new file js in a project cocos2d js? I'm trying to include a new js file containing a new scene on a cocos2d js project, but every time try occurs the following error:

  Uncaught ReferenceError: GameScene is not defined.

I included my file in jsList and in appList:

"jsList"        : ["src/game_scene.js"],
    "appFiles"      : ["src/game_scene.js"]

The code of my scene looks normal:

var GameScene = cc.Scene.extend({
    onEnter:function(){
        this._super();

        var gameLayer = new GameLayer();
        this.addChild(gameLayer);
    }
});

The code on app.js to call my scene looks good too:

var gameScene = new GameScene();
cc.Director.runScene(gameScene);

What should I do?

sentences:
Keep Mini map static after rotating / zooming with camera Hi I am making a 2D game, where the Camera is able to rotate / zoom in or out on the camera focus (the player usually).

However my game also contains a mini-map, and so far whenever I have to rotate / zoom my camera the mini-map rotates and zooms accordingly. This behaviour was expected, but now I am a little stuck on "un-doing" the changes the view transformation has on my mini-map. What I want to happen is to essentially keep my mini-map statically in the same position throughout the game no matter how the camera rotates or zooms.

I am extremely rusty with my linear algebra / 3D transformations but I have tried the following...

My first thought was, I thought all I had to do was to transform the mini-map origin point with the view matrix, then undo the scaling of the zoom against the mini-map width / height. The zooming was fixed, but the mini-map still rotated so this did not work.

My second try, I remembered to undo the change of a matrix, I would have to multiply the transform by its inverse. So I tried to calculate the inverse matrix, however the determinant of the view matrix was 0, so I could not find an inverse.

Ok... well I guess I'll just see if I can get the rotation down, since I got the zoom to work... So I transformed my mini-map origin by the inverse rotation matrix applied by the view matrix... The mini-map is rotating now, but is not staying in the fixed position I was hoping for.

I was wondering, if anyone here can give me a push in the right direction, or a hint towards a more elegant solution overall. If people would like more information I can upload images, show code... But what I wrote above is exactly how my code would look.

Thanks for any help!

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:
Blending for multiple lighting passes I am attempting to perform shadow mapping with deferred shading, using the following code:

for (auto light : m_ShadowDirs)
{
    //render shadow map
    shadowDirPass(m_ShadowBuffer, light);
    glEnable(GL_BLEND);
    glBlendFunc(GL_ONE, GL_ONE);
    // activate shader for non shadow casting lights
    m_ShadowDirLightShader.activate();
    m_FrameBuffer.LightingPass(m_ShadowDirLightShader);
    m_ShadowDirLightShader.setUniform(("WSCamPos"), m_ActiveCamera->getPosition());
    m_ShadowDirLightShader.setDirLight(("dirLight"), static_cast<DirLightData&>(light->getLightData()));
    m_ShadowDirLightShader.setUniform(("ShadowTransform"), m_ShadowDirMatrix);
    //bind depth map
    m_ShadowDirLightShader.bindTexture(("shadowMap"),5, m_ShadowBuffer.getDepthTexture());
    //render
    renderQuad();
    glDisable(GL_BLEND);
}

shadowDirPass(m_ShadowBuffer, light); Simply renders the geometry to the shadow map.
m_FrameBuffer.LightingPass(m_ShadowDirLightShader); Just binds the Gbuffer textures.

I have two directional lights in the scene, one with red colour (1,0,0), and one with blue colour (0,0,1)

One would think that the scene would be coloured purple, but no.
Every time I render (for each) light, the image in the target framebuffer is overwritten completely, instead of blended together. To illustrate this, see the following images:

Above is the scene with a single red light.

Above is the same scene, with a single blue light, but from a different direction. (See shadows).

When I enable both lights, the result is as if the first light was never used, though by stepping through the code, I can confirm that it is definitely going through a render cycle.

I'm pretty sure than I've messed up the blending somehow, but I could use some guidance.

sentences:
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:
Unity 3D - Have a Vector3 attribute on inspector that behaves as GameObject's Transform position Vector3 As the title suggests, I am looking to serialize on the Inspector a Vector3 that behaves just as the Transform's position Vector3:

If you modify the position Vector3, the GameObject positions itself according to the World Position.
If you move the GameObject on the scene by picking the handles, the GameObject moves, and the position Vector3 gets modified equal to the GameObject's position.

So, is there a way I can constrain a serialized Vector3, so if I modify it on the inspector I can change the GameObject's position, like this:

[ExecuteInEditMode]
public class LameExample : MonoBehaviour
{
    public Vector3 transformPosition;

    private void Update()
    {
        if(modifyingVectorOnInspector)
        transform.position = transformPosition;
        else if(gameObjectIsBeingMovedOnScene)
        transformPosition = transform.position;
    }
}

I've tried an approach using Selection.contains(gameObject), but that does not take into account if it is dragged by the handles.

Thanks in advance for your help.

sentences:
Resolving Circle-Circle collision If you have a stationary circle with radius x, and a moving circle with radius y, when a collision is detected, how can you resolve the collision, such that the moving circle stop?

I.e. What would be the 'resolved' position of the moving circle?

sentences: Duplicating actor in Unity New to video game development and im working in unity on a Mac right now. I also have been using unreal on my pc figuring them both out. Im trying to (in unity) quickly copy prefabs by dragging them to different spots on mac? Basically the unreal engine equivalent to Alt + dragging your actor on windows. I've tried looking it up and shortcuts dont help and randomly pressing buttons and dragging is getting me nowhere fast

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

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

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

All help is appreciated.

sentences:
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 can I fix this code to spawn multiple types of enemies on the same point with the Corona SdDK? I have this code to spawn a simple enemy outside the window:

local function spawnGrupo1()
  local color01 = display.newImage("assets/img/enemigos/blue.png")
  color01.x = 40
  color01.y = -50
  physics.addBody( color01,{density = 5.0, friction = 0.0, bounce = 0} )
end

timer.performWithDelay( 1000, spawnGrupo1, 0)

But I want to be able to spawn multiple enemies from that point, and I can't figure it out.

I tried this, but it doesn't work:

local function spawnGrupo1()
  local numero = math.random(1, 3)

  if numero == 1 then
    local color01 = display.newImage("assets/img/enemigos/blue.png")
  end
  if numero == 2 then
    local color01 = display.newImage("assets/img/enemigos/yellow.png")
  end
  if numero == 3 then
    local color01 = display.newImage("assets/img/enemigos/red.png")
  end
  color01.x = 40
  color01.y = -50
  physics.addBody( color01,{density = 5.0, friction = 0.0, bounce = 0} )
end

timer.performWithDelay( 1000, spawnGrupo1, 0)

How can I approach the problem?

sentences:
How to fix a crowbar mesh deformation problem I am having a problem exporting my model to Garry's Mod.
Every time i compile the model in crowbar it comes out deformed like this

when the model is really suppose to look like this

how do I fix this is there something wrong with the collision?
I am also ready to provide whatever files/information are needed to solve this problem.
I should also mention that the mesh has multiple objects from each sphere that are joined but not connected.
I went to the arqade for this at first but they said it was offtopic and that I should come here instead.

sentences:
What are the parameters for a smooth wall jump I want to make a platformer like Celeste and trying to implement wall jump.
When the player is on the air and near a wall, and presses jump, the player gains x velocity opposite the wall direction, and some y velocity. So the player jumps against the wall, but it shouldn't climb the wall thru wall jumping.
Game runs 60 frames per second. resolution is 320x180. Tile size is 16.
Here's some constants for calculating velocity and gravity:
export const vMax = 4; // maximum velocity in pixels
export const tMax = 20; // time to reach maximum velocity in frames

export const hMax = 16 * 3; // maximum jump height
export const xSubH = 16 * 3; // x distance that is reached in one jump

export const xFriction = 5 / tMax;  // friction to apply to x velocity
export const hAccel = vMax * xFriction; // accelaration for x

export const v0Jump = (2 * hMax) * vMax / xSubH; // initial jump velocity
export const gJump = - (2 * hMax * vMax * vMax) /
      (xSubH * xSubH); // gravity applied to y velocity on jump

Here's how I do wall jump:
 // player object
 let p = {
   x: 0, // position
   y: 0,
   dx: 0, // velocity
   dy: 0,
   ax: 0, // acceleration
   ay: 0
 };

 // let inputX = -1 for left input 1 for right input

 // x movement
 let _hAccel = inputX * hAccel;
 p.dx += _hAccel;
 p.dx += - p.dx * xFriction;

 // let isGrounded = ...
 // let wallDir = ... // -1 for left wall 1 for right wall

 // fall
 if (!isGrounded) {
   p.ay = -gJump;
 }

 // jump
 p.ay = -gJump;
 p.dy = -v0Jump;

 // wall jump
 p.dy = -v0Jump;
 p.dx = - wallDir * hAccel;

 p.dy += p.ay;

 // position
 p.x += p.dy;
 p.y += p.dx;

What are the parameters of the wall jump I need to control and tweak so it looks smooth and doesn't allow player to climb up the wall. But player can climb two walls side by side jumping one off another vs.
As you can see I have parameters like vMax and tMax that I can tweak to control the jump and movement. I tried setting arbitrary fractions of current values to give more x velocity or y velocity for wall jumping, but I can't quite get a wall jump that feels good to climb against two walls.
If you look at the Celeste Pico 8 source code:
  if (E.abs(spd.X) > maxrun)
        spd.X = G.appr(spd.X, E.sign(spd.X) * maxrun, deccel);
    else
        spd.X = G.appr(spd.X, input * maxrun, accel);

When the x velocity is greater than maxrun, it is decelarated towards maxrun, otherwise it is decelarated towards input. So this basically disables input when given a big x velocity, thus disallowing to approach the wall thru input.

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:
Game Metrics for Achievements So I posted not too long ago looking for an alternative system to what I'm using for game metrics, meaning information I post each update when something specific happens (enemy damaged, killed, a wave starts, player taking damage, etc). I got suggestions to implement something more similar to "events" instead, where I could have a general interface to define events and create derivative classes to represent specific cases. This would be fine, but I'm having a hard time figuring out how to define achievements now in terms of these new events.

My current system, I have long values for each type of metric: player, enemy, kill, damage, damage types, weapons, and various other pieces of information. Each value is a single bit and I compose them together so I can later check specific bits to see if a certain metric was posted and apply it to my achievement progress tracker.

For example, let's say ENEMY = 1, DAMAGE = 2, PISTOL = 4. I compose these together to indicate that an enemy was damaged by the pistol this update and the resultant value is 7. I can later look at the individual bits for different cases. Say I have a general achievement for tracking number of kills regardless of enemy type, I could extract the bit relevant to KILL and ENEMY and see if one of those was posted, and if so, increment the milestone. However, I can also use this same metric to apply to an achievement that's tracking kill counts for specific enemies if I wanted to.

I also have more complicated achievements that use a rudimentary state machine with logic deciding what each state does with the metrics that are posted and determine the next state.

The reason this was problematic is because even though this system is great and works well, it means I only have 64 values I can use to compose together, and with the number of weapons and enemies I'm adding, I'm going to run out fairly quickly.

When I tried implementing "metric events" instead, I found that defining milestone achievements (and likely state machine achievements) was impossible because I could only take the metric events with all the information composing that class, and couldn't "compose" them together and then pick them apart. It also made it a lot more difficult to figure out how to save that information to a file for keeping track of achievements in save files.

Does anyone have a suggestion as to how I could approach this? If it helps, you can find my current implementation of my achievement system here:

Achievements System

You can also find the AchievementController class under the controllers package one level up. This controller defines the achievements themselves, if you want to take a look at how I define my achievements.

I really appreciate any insight people may have. Links to articles detailing how to properly implement an achievement and metrics system would be very helpful, or if anyone has their own examples of systems they've implemented, that would be awesome.

sentences:
How do I create a third Person View using DXUTCamera in DX10? I am creating a 3d flying game and using DXUTCamera for my view.

I can get the camera to take on the characters position, But I would like to view my character in the 3rd person.

Here is my code for first person view:

    //Put the camera on the object.

    D3DXVECTOR3 viewerPos;
    D3DXVECTOR3 lookAtThis;
    D3DXVECTOR3 up         ( 5.0f, 1.0f, 0.0f );
    D3DXVECTOR3 newUp;
    D3DXMATRIX matView;

    //Set the viewer's position to the position of the thing.

    viewerPos.x = character->x;   viewerPos.y = character->y;
    viewerPos.z = character->z;

    // Create a new vector for the direction for the viewer to look

    character->setUpWorldMatrix();
    D3DXVECTOR3 newDir, lookAtPoint;
    D3DXVec3TransformCoord(&newDir, &character->initVecDir,
                                  &character->matAllRotations);

    // set lookatpoint

    D3DXVec3Normalize(&lookAtPoint, &newDir);
    lookAtPoint.x += viewerPos.x;
    lookAtPoint.y += viewerPos.y;
    lookAtPoint.z += viewerPos.z;

    g_Camera.SetViewParams(&viewerPos, &lookAtPoint);

So does anyone have an ideas how I can move the camera to the third person view? preferably timed so there is a smooth action in the camera movement. (I'm hoping I can just edit this code instead of bringing in another camera class)

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:
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:
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:
Algorithm to find all tiles within a given radius on staggered isometric map Given staggered isometric map and a start tile what would be the best way to get all surrounding tiles within given radius(middle to middle)?

I can get all neighbours of a given tile and distance between each of them without any problems but I'm not sure what path to take after that. This feature will be used quite often (along with A*) so I'd like to avoid unecessary calculations.

If it makes any difference I'm using XNA and each tile is 64x32 pixels.

sentences:
Hammer Editor - How to fix harsh lighting between brushes I'm working on an old Half-Life 2 map that I haven't worked on in many years. I changed some textures on the map and for some reason, lighting between the old textures and the ones I now just changed is very harsh.

There are no errors during map compilation. Any ideas what may be causing this issue or how to fix it?

sentences:
3D Side-Scrolling Shooter: to use or not to use Lua scripting? I'm programming a Side-Scroller, and I've reached the point where I need to program the enemy behaviour. I don't know what I should choose between hard-coding the enemy ships' behaviour or using a scripting language.

Going with the hardcoded way, all different kind of enemies would be different classes derived from an abstract EnemyShip class with a virtual function redefined for each of them. Going with the scripting instead I could do just a base class and a script manager which moves the ships as needed.

What should I do?

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:
Is there a game that is both voxel and polygons? Looking to see the difference between the two technologies in a game experience and not in experiments - is there a half-decent game out there that has two modes - polygons and voxel?

EDIT

Games like minecraft that voxels are exaggerated to make the game appear like a retro is not the intention. The comparison I want to make is for games that attempted to deliver realistic experience like outcast. In addition it would be best to see the same assets in both versions so not characters in polygons and landscape in voxels.

sentences:
PointSprite in DirectX9 I was trying to implement a particle system using PointSprites. Draw calls return D3D_OK but I don't see any particle on the screen. I'm not using Vertex Buffer for the particles, but I use two vectors of vertices and I call the DrawPrimitiveUP function. This is my code:

            CreatePntVertices();

            pD3DD -> SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
            pD3DD -> SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
            pD3DD -> SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);

            pD3DD -> SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
            pD3DD -> SetRenderState(D3DRS_ZENABLE, FALSE);

            pD3DD -> SetRenderState(D3DRS_LIGHTING, FALSE);

            pD3DD -> SetFVF(FVF_PNTVERTEX);
            pD3DD -> SetTexture(0, pTex[TEX_POINT]);

            pD3DD -> SetRenderState(D3DRS_POINTSPRITEENABLE, TRUE);
            pD3DD -> SetRenderState(D3DRS_POINTSCALEENABLE, TRUE);

            pD3DD -> SetRenderState(D3DRS_POINTSCALE_A, 0.0f);
            pD3DD -> SetRenderState(D3DRS_POINTSCALE_B, 0.0f);
            pD3DD -> SetRenderState(D3DRS_POINTSCALE_C, 1.0f);

            pD3DD -> SetRenderState(D3DRS_POINTSIZE, 20.0f);
            pD3DD -> SetRenderState(D3DRS_POINTSIZE_MIN, 3.0f);
            pD3DD -> SetRenderState(D3DRS_POINTSIZE_MAX, 50.0f);

            D3DXMatrixIdentity(&mWorld);
            pD3DD -> SetTransform(D3DTS_WORLD, &mWorld);

            pD3DD -> DrawPrimitiveUP(D3DPT_POINTLIST, pntPlanets.size(), (PVOID)pntPlanets.data(), sizeof(PNTVERTEX));

            pD3DD -> SetRenderState(D3DRS_POINTSIZE, 40.0f);
            pD3DD -> SetRenderState(D3DRS_POINTSIZE_MIN, 9.0f);
            pD3DD -> SetRenderState(D3DRS_POINTSIZE_MAX, 70.0f);

            pD3DD -> DrawPrimitiveUP(D3DPT_POINTLIST, pntStars.size(), (PVOID)pntStars.data(), sizeof(PNTVERTEX));

            pD3DD -> SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);

            pD3DD -> SetRenderState(D3DRS_ZWRITEENABLE, TRUE);
            pD3DD -> SetRenderState(D3DRS_POINTSPRITEENABLE, FALSE);
            pD3DD -> SetRenderState(D3DRS_POINTSCALEENABLE, FALSE);

CreatePntVertices() is a function that set the position of objects and their color into two vectors of PNTVERTEX (pntStars and pntPlanets). pTex is an array of textures. mWorld is a D3DXMATRIX. pD3DD is the Device. FVF_PNTVERTEX is set as (D3DFVF_XYZ | D3DFVF_DIFFUSE). I really don't know why it doesn't work, I tried everything to make it work. Maybe, should I use a dynamic vertex buffer instead?

sentences:
The rule to scale pixel art non multiple of integer ratios I have pixel art, I want to draw. When player jumping I want to animate the art to squash stretch to have a feeling. But when I scale the art it get's distorted, as demonstrated in the image.

In one video I heard a rule to always scale to multiples of 100% ratio. So 150% is not allowed otherwise pixels collapse into each other. I haven't experienced that in this image but is it ok to scale arbitrarily in pixel art?
I see they scale the sprite arbitrarily in Celeste Game Player source. But It feels wrong to me.

sentences:
BSPs, Octrees and modern graphics hardware I have read a lot of literature on BSPs, Octrees and like. Problem is that it is all old literature from software rendering time. Nobody describes how it is implemented today. So here is my idea how to do it and my question.

Let's say that I use some partitioning algorithm, it does not matter which one. I subdivide my level mesh into multiple partitions and store it in RAM. Should I simply create vertex buffers for each node so I can render my scene faster or what?

How do you do it, is there any better way today?

Thank you

sentences:
How to gain accurate results with Painter's algorithm? A while ago I asked how to determine when a face is overlapping another. The advice was to use a Z-buffer.

However, I cannot use a Z-buffer in my current project and hence I would like to use the Painter's algorithm. I have no good clue as to when a surface is behind or in front of another, though. I've tried numerous methods but they all fail in edge cases, or they fail even in general cases.

This is a list of sorting methods I've tried so far:

Distance to midpoint of each face
Average distance to each vertex of each face
Average z value of each vertex
Higest z value of vertices of each face and draw those first
Lowest z value of vertices of each face and draw those last

The problem is that a face might have a closer distance but is still further away. All these methods seem unreliable.

Edit: For example, in the following image the surface with the blue point as midpoint is painted over the surface with the red point as midpoint, because the blue point is closer. However, this is because the surface of the red point is larger and the midpoint is further away. The surface with the red point should be painted over the blue one, because it is closer, whilst the midpoint distance says the opposite.

What exactly is used in the Painter's algorithm to determine the order in which objects should be drawn?

sentences:
How are 3D game levels built? I am wondering what is the best / most common practice in 3D games (mostly shooters) like Quake or Doom. How are the levels built?

With larger, open spaces the answer is probably some kind of terrain editor, that is what I understand. But what about things like houses or closed areas?

I see two main solutions. One is to make a whole house, factory, dungeon (or generally a level) in other tool, like Blender, and then put it in the game. Other is to make the most simple elements like walls, floor, doorways and make the level from them (like Lego blocks).

Is one of the ways more common? More "industry standard"? Are there some obvious advantages or disadvantages?

sentences:
Centering GLViewport position within physical screen I'm developing my app on one device and want it to display at the same ratio on all other devices.

Currently what I have is 'image 1' in my image below - the game fits perfectly onto my development device's screen.

If I keep the viewport at the same ratio then I get the results seen in 'image 2'.

This is great, but now I need to center the viewport , and I'm not sure how to do that.

What I'm aiming for is what is in 'image 3' - just not sure how to get there.

This is how I'm keeping the viewport at the same ratio:

the ratio is width / height (this is 1.702127659574468 and we will use this explicitly)

//Set viewport size based on screen dimensions
GLES20.glViewport(XVal, YVal, (int) (height * 1.702127659574468), height);

At the moment, XVal and YVal are both 0 - I need to change XVal to move the image along.

How do I work out the amount to move the viewport along by? (I know it will be equal to half of the space to the right of the viewport ('image 2') - just not sure how to work this out.......)

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:
Measure elapsed gpu time of draw call I'm rendering to a texture via DrawIndexedPrimitive (SharpDx). In some specific situations, the framerate drops significantly when doing this render. The framerate can be improved by rendering to a smaller texture.

I want to gracefully degrade the quality of the graphics performance at runtime by measuring the impact of this particular pass and rendering to a smaller texture if the framerate would be impacted by this pass. Later, when the impact of this pass is smaller I want to restore the larger texture size.

Is there some way to measure at runtime the impact of a particular draw on the gpu? It's ok if the results of the measurement are delayed to the next frame.

sentences:
Backend for data-driven multiplayer game I am working on a match-based (5v5) multiplayer steam game that is similar to TF2, LoL, Dota 2, etc.

I am planning a data-driven approach where character/abilities/items/etc are defined in data (JSON). This will allow for easy patching to constantly balance the game.

So I have something like the following. (obviously simplified)

{
    "Troll": {
        "name" : "Troll",
        "health" : "100",
        "abilities" : [
            {
                "name" : "ClubSwing",
                "damage" : "50"
            },
            {
                "name" : "FootSmash"
                "damage" : "100"
            }
        ]
    },
    "Orc": {
        "name" : "Orc",
        "health" : "50",
        "abilities" : [
            {
                "name" : "SwordSwing",
                "damage" : "10"
            },
            {
                "name" : "ArrowShoot",
                "damage" : "25"
            }
        ]
    }
}

I am wondering what the best practice way is for storing this data. I obviously can't store it client-side or the player will be able to cheat. Is it normally stored in the database? I haven't setup any backend for my game yet.
Should I setup a nodejs server with a nosql database like mongodb to be the master of this data? And then build a REST API on top of that for reading this data?

I also need to write some things to a database. Such as the users rank, items, game stats, etc.

Would it be better to have two separate databases? One for reading gameplay data like I have above and another reading/writing user information (stats, rank, items, etc.)

Or would it be wiser to use a single database? Would you recommend nosql or sql based?

Note: The game engine I'm using is unreal engine 4. Currently I am using a listen server (peer-to-peer), but think it may be necessary to eventually use the dedicated server instead.

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:
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:
Best strategy (tried and tested) for using Box2D in a real-time multiplayer game? I am currently tackling real-time multiplayer physics updates for a game engine I am writing. My question is how best to use Box2D for networked physics. If I run the simulation on the server, should I send position, velocity etc to every client on every tick? Should I send it every few ticks? Maybe there is another way that I am missing?

How has this problem been solved using Box2D before? Anyone with some ideas would be greatly appreciated!

sentences: How do I shoot bullets towards the mouse in a top down shooter? I have a formula for pointing my main character of the game towards the mouse, and it gets the angle he needs to be turned to point towards the mouse. But how do I get the bullets from the gun to use the angle produced and shoot a bullet towards the mouse.

sentences:
Designing Drops system - How and where chance of drops are defined? Just found a related topic but I have different/extended questions

I was wondering how the implement the drop system. I have to start designing the DB model for this so I was wondering whether what I am thinking is a good practice or not.

My game is like "City building" kind of browser based game (Flex/Flash app) with PHP and MySQL in the backend. In my game, like in any other games, there are chance based drop rate. I want to design the drop system such a way that I can easily configure

What item(s) can be dropped from which game element
What is the percent chance (probability) of getting a drop (a 100% meaning there will be some drop always)
What percent chance of getting a specific drop. Here I define for each item (if can drop various items) what is the chace of drop, 90% to very frequent, 5% to very rare

I am wondering how the probability is determined? It might sound very noobish but just want to confirm does it mean roll a random number and compare with the odds we defined?
If I am not wrong this is good for determining "how much to drop" but not for "what to drop"

Example: If we say drop 1-10 coins or 20-50 coins. I will simply call a random() function and generate a random numbed from the desired range.

Now for other example: Drop one of Bullets (95%), Empty Gun (4%), Loaded Gun (1%)

If I roll a random number range from 1-100 and compare with probability I defined

so, a number between 1-95 drops bullet, and a number between 96-99 drops empty gun and a loaded gun when it generates 100?

Is this how it has to be done? or is there a better way?

Update:

Removed 2nd question about hack safety

sentences: Change Unity 3d viewport shortcuts to match Blender? The shortcuts in Unity are more similar to Maya (Alt+Middle for 3d orientation, LeftClick select, etc). I've looked into Edit -> Shortcuts but couldnt find them. Is there any way to do this?

sentences:
questions about position and size I am new to game development and I wanted to ask a question.

I am reading the simple game example from here.

1) I want to ask why we define bucket.x = 800 / 2 - 48 / 2 ? How is that?
Why not just set bucket.x=400 ( at the middle position).

...

camera.setToOrtho(false, 800, 480);
...
bucket = new Rectangle();
   bucket.x = 800 / 2 - 48 / 2;
   bucket.y = 20;
   bucket.width = 48;
   bucket.height = 48;

2) The bucket width and height are seet 1/10 of our screen size.Ok.
But what about the real dimensions of bucket object?I mean , the bucket what size must be?32x32 pix?48X48 pix?How we handle that?

3) Also, I am a bit confused about x and y dimensions.
x refers to width and y to height as we see the cell phone in portrait mode?
So , if we are in landscape mode , y is "x"?

Thanks!

sentences:
Why and how should I cast DirectX function parameters? I'm learning DX11 and I found that in some D3D functions, a parameter has to be cast just like in the GetBuffer function of the swapChain: the third parameter has to be of type void*, so when calling this function the conversion is done just writing (void*) before, a C conversion if I'm not wrong.

But in other functions with a pointer like type** (where type IS NOT void) is used the reinterpret_cast. I wanted to know if the difference is because of the void type respect to the other types and, if it's not because of the void type, when should I use (type**) and when should I use reinterpret_cast.

sentences:
How do I make dialogue only appear once? So I made it so when I walk over a NPC it brings up 12 lines of dialogue, and you press E to get to the next line. When the dialogue is over you can keep pressing E and it will bring the dialogue up every time. I want it so it only brings the dialogue up once. How do I do that?

This is my script for it:

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

public class dialogHolder : MonoBehaviour
{
    public string dialogue;
    private DialogueManager dMan;

    public string[] dialogueLines;

    public float questComplete;

    // Use this for initialization
    void Start()
    {
        dMan = FindObjectOfType<DialogueManager>();
    }

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

    private void OnTriggerStay2D(Collider2D other)
    {
        if (other.gameObject.name == "Shrump")
        {
            if (Input.GetKeyUp(KeyCode.E))
            {
                //dMan.ShowBox(dialogue);
                if (!dMan.dialogActive)
                {
                    dMan.dialogLines = dialogueLines;
                    dMan.currentLine = 0;
                    dMan.ShowDialogue();
                }
            }
        }
    }
}

sentences:
With Slick, how to change the resolution during gameplay? I am developing a tile-based strategy game using Java and the Slick API.

So far so good, but I've come to a standstill on my options menu. I have plans for the user to be able to change the resolution during gameplay (it is pretty common, after all).

I can already change to fullscreen and back to windowed, this was pretty simple...

//"fullScreenOption" is a checkbox-like button.
if (fullScreenOption.isMouseOver(mouseX, mouseY)) {
   if (input.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON)) {
      fullScreenOption.state = !fullScreenOption.state;
      container.setFullscreen(fullScreenOption.state);
   }
}

But the container class, contrary to my previous beliefs, does not seem to have any resolution-change functions! And that's pretty much the situation...I know it's possible, but i don't know how to do it, nor what is the class responsible!

The AppGameContainer class, used on the very start of the game's initialization as of Slick's examples and tutorials, is the only place with any functions for changing the display-mode that I've found so far, but it's only used at the very start, and i haven't found a way to travel back to it from my options menu.

  //This is my implementation of it...
  public static void main(String[] args) throws SlickException {
    AppGameContainer app = new AppGameContainer(new Main());
//    app.setTargetFrameRate(60);
    app.setVSync(true);
    app.setDisplayMode(800, 600, false);
    app.start();
  }

I can define it as a static global on the Main, but it's probably a (very) bad way to do it...

sentences:
What can cause ALT-TAB to be 'annoying'/slow/glitchy? This is more of an open ended question, but I hope to get some good insight on how to avoid the issue.

When playing Games on Windows, I might want to ALT-TAB out of it. Some games have no problems, others are not so easy: They may take AGES to switch out and back in. Some are even prone to crashing or to weird behaviour like graphic distortion or stuttering sound.

I just wonder what causes this behavior? Is this more a DirectX or an OpenGL thing? Is it caused by Games being 'clever' and caching/wiping the cache whenever the screen settings change? (I assume they do get some sort of signal when I ALT-TAB?)

I don't have any problem of my own, but I'd like to know what to avoid and which 'clever' trick may cause this type of horrible customer experience?

sentences:
D3DXMatrixDecompose gives different quaternion than D3DXQuaternionRotationMatrix In trying to solve this problem, I tracked down the problem to the conversion of the rotation matrix to quaternion. In particular, consider the following matrix:

-0.02099178 0.9997436  -0.008475631 0
 0.995325   0.02009799 -0.09446743  0
 0.09427284 0.01041905  0.9954919   0
 0          0           0           1

SlimDX.Quaternion.RotationMatrix (which calls D3DXQuaternionRotationMatrix gives a different answer than SlimDX.Matrix.Decompose (which uses D3DXMatrixDecompose). The answers they give (after being normalized) are:

                            X            Y             Z            W
Quaternion.RotationMatrix   -0.05244324  0.05137424    0.002209336   0.9972991
Matrix.Decompose             0.6989997   0.7135442    -0.03674842   -0.03006023

Which are totally different (note the signs of X, Z, and W are different). Note that these aren't q/-q (two quaternions that represent the same rotation); they face completely different directions.

I've noticed that with matrices for rotations very close to that one (successive frames in the animation) that the Matrix.Decompose version gives a solution that flips around wildly and occasionally goes into the desired position, while the Quaternion.RotationMatrix version gives solutions that are stable but go in the wrong direction. This is only for the right arm in my animation -- for the left arm, both functions give the correct solution, which is the same quaternion within error tolerances.

This makes me think that there's some sort of numeric instability or weird stuff with signs going on. I tried implementing this and then this, but both gave me a completely incorrect solution (even for the matricies where the SlimDX ones were working correctly) -- maybe the rows and columns are flipped?

sentences:
Hiding text/choosing which text to show in unity i'm making a dialogue system that reads from a text file with a portrait that changes expressions depending on the context. I'm thinking of putting in a "cue" in the text file to determine which expression to show on the screen. Like #1 for default expressions, 2 for happy, etc. But the problem is the cues will show up on the dialogue box as well.
So, is there a specific code to hide texts specifically in unity like how "\n" is not shown in other languages?
Because my other solution to this is making two separate files and scripts for the dialogue and expression cues which will probably add confusion and more problems in the future.

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:
Did old games like Golden Axe or Street or Rage use tilemaps? I am wondering if old games like Golden Axe (genesis) or street of Rage (genesis) used tilemaps or background bitmaps for the levels.

I could not find any resource that explain this and searching around in the web I can find background images, but I never found any tilemap for the levels. This off course, does not answer the question, but it looks like they used background bitmaps for the entire level.

But I am not sure if it was practical for those old consoles to store such "big" images and render those.

Does anyone knows a bit of programming on those old systems and knows how those "perspective" levels were built?

sentences:
Question about Monster Rancher/My Brute generators I want to build a system based on the idea of Monster Rancher's monster generation system.

First, is it legal per se?

Obviously, I don't know how they built theirs and I will be generating my own "generator". But the idea itself of being able to randomly create a character or monster based on something..is it copyrighted? patented?

sentences:
Life is Strange art style So, I've been obsessing over the video game Life Is Strange for the past few weeks (rightfully so, its a wonderful game) and I've been putting together a list of what makes it compelling to play. I got to the art style, as it obviously isn't realistic but not too unrealistic. I was trying to put it together myself but when I google search life is strange art style, all that shows up is fan art that doesn't well reflect it. I want to know what style of texture painting they used to give it that semi-realistic feel. How can I replicate it on my own in photoshop for my own game?

Sorry if I misplaced this question in this community, I just didn't feel right posting in graphic design.

sentences:
Is it considered poor programming to do this with xna components? I created my own Menu System that is event driven.

In order to have a loading screen and multithreaded loading to work, I devised this sort of implementation:

//Let's check if the game is done loading.
if (_game != null)
{
    _gameLoaded = _game.DoneLoading;
}

//This means the game is loading still,
//therefore the loading screen should be active.
if (!_gameLoaded && _gameActive)
{
    _gameScreenList[2].UpdateMenu();
}

//The loading screen was selected.
if (_gameScreenList[2].CurrentState == GameScreen.State.Shown && !_gameActive)
{
     Components.Add(_game = new ParadoxGame(this));
     _game.Initialize(); //Initializes the Game so that the loading can begin.
     _gameActive = true;
}

In the XNA Game Component that contains the actual game, in the LoadContent method I simply created a new Thread that calls another method ThreadLoad that has all the actual loading.

I also have a boolean variable called DoneLoading in the XNA Game Component that is set to true at the end of the ThreadLoad.

I am wondering if this is a poor implementation.

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:
glm rotating quaternion in Y axis deforms object I'm implementing my own game engine in C++ and I need help here,

I have a game object, its orientation property is a quaternion and I want to rotate it A degrees in the Y axis.

So, I have:

currentAngle += 0.01; // currentAngle is a member variable, so yes i initialized it
quat q(currentAngle, vec3(0, 1, 0));
myGameObject->SetOrientation(q);

GameObject::SetOrientation(quat q)
{
 myOrientation  = q;
}

but as the game object rotates, it also gets scaled (deformed). So I checked how I am applying the transformation matrices

myModelMatrix = Math::CreateTransformationMatrix(
    transformation->GetPosition(),
    transformation->GetOrientation(),
    transformation->GetScale());

mat4& Math::CreateTransformationMatrix(vec3&    translation, quat& orientation, vec3& scaleSize)
{

     mat4 translate = glm::translate(glm::mat4(), translation);
     mat4 rotate = glm::toMat4(orientation);
     mat4 scale = glm::scale(glm::mat4(), scaleSize);

    return  translate * rotate * scale;
}

but it looks ok (at least to me), I removed the scale matrix form the multiplication to check if somehow I was doing something with it. However, it didnt fix anything.

I also tried:

  quat q(currentAngle, vec3(0, 1, 0));
   quat orientation = myGameObject->GetOrientation();
   orientation  = orientation  *q;
   myGameObject->SetOrientation(orientation);

But it didnt work either.
I also checked the code in my shaders and I am positive is not the problem.

This is how I send the matrices to the shader:

glUseProgram(progarmId);1
    glUniformMatrix4fv(uniforms[name], 1, GL_FALSE, glm::value_ptr(matrix));

I tried modifying the 3rd parameter to True and swapping the order of the projection view matrix multiplication and it didnt work either :/

So, guys ... any ideas what could I be doing wrong ? I'm out of ideas :/

sentences:
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:
Find the closest point along a rectangle, given an another point and direction Given a rectangle, and a point with a vector direction towards the rectangle.
How can I find the closest point on the outside of that rectangle to the point in question?

sentences: Why did an Android update disable  the textures in my game? I recently updated my tablet to Android 4.0.3 and now the textures for my game do not show up. I'm using OpenGL-ES 2.0 for my engine. It worked fine when I was running android 3.0.  Is there any reason as to why this is happening?

sentences:
Player keeps bumping when walking over to another sprite So, my problem is that my play when he walks over to another sprite he will stop.

I fixed that by adding a physics material with 0 density and 0 friction to the player

and adding a circle collider instead of a box collider to the player.

However now I have another problem where my character keeps bumping when it enters another sprite.

The sprites are at the exact same height, the objects are just as big and the colliders have the exact size.

I would like to get a fix for this problem, which still allows me to use Rigidbody2D.AddForce for movement.

Video of my problem :

Video :>

How to recreate the problem :

Make a sprite, add a Circle Collider 2D to it and a Rigidbody2D.

That will be the player.

Next, make some platforms and add a Box Collider 2D

Now, if you let your player walk over the platforms it will (or should..) start bumping.

sentences:
Show a range grid movement as3 How do I show range of grid movement in AS3? When player controls a character and chooses "move" options, the grid of movement will be displayed as 3 grid of X, 4 grid of Y (Both sides, + and -). So, it will be like this:

In the image above, movement grid displayed in blue color. But, how do i display a range grid movement like that?

sentences:
what is the simplest way to get player selection system like checkers in unity 3d c# like lets say the board is a top down grid like if your were in front of an actual checkers board i want to figure out how i would be able to select/deselect a piece then select/deselect a space on the board so that the players piece will move to said place and if another piece is occupying that place already then the said player cant move there

also im new to c# and progrming in general...i have been only doing it for about five months and have been looking at tutorials and all that ... but if some one could paste an example code if possible something simple so that i can dissect it, learn from it, and change it as I see fit.

and if you can explain how the code works that would be really appreciated.

things i need:
some kind of grid/checker board code
player selection/deselection

i would prefer it in c# and the code applicable strictly to unity3ds mono develop although I intend to learn visual studio in the future at the moment i just want something for unity.

lastly please assume that i may be stupid when explaining/writing your example code/ or answer.

sentences:
How to make an object oscillate left and right? I can't seem to make an object move left and right, back and forth, on room start whilst on solid ground.

Codes I used:

Step Event:

if image_index is greater than 5, then physics_apply_force (0,0,100,0) for the right

if image_index is less than 5, then physics_apply_force (0,0,-100,0) for the left

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:
Handle two different touch gestures at same time without overlapping I'm trying to create a Character touch controls for 2d platform.

In my script Im using one horizontal swipe and hold touch gesture and one vertical swipe gesture without hold.Both are different methods called in void Update ().

And here is my script :

void Update ()
    {

        HorizontalSwipe();
        VerticalSwipe ();

    }

    void HorizontalSwipe()
    {
        foreach (Touch FingerTouchx in Input.touches)
        {
            if(FingerTouchx.fingerId<1)//         FINGERID

            {
                //if(FingerTouchx.position.x < Screen.width/2)

                if(FingerTouchx.phase == TouchPhase.Began)
                {
                    FingerInitialPositionx=FingerTouchx.position.x;

                }

                else if(FingerTouchx.phase == TouchPhase.Moved)
                {
                    FingerMovedPositionx=FingerTouchx.position.x;

                    if(FingerMovedPositionx>FingerInitialPositionx)
                    {
                        charcter.transform.Translate(Vector2.right * speed * Time.deltaTime);
                    }

                    else if(FingerMovedPositionx<FingerInitialPositionx)
                    {
                        charcter.transform.Translate(-Vector2.right * speed * Time.deltaTime);
                    }

                }

                else if(FingerTouchx.phase == TouchPhase.Ended)
                {
                    FingerInitialPositionx=0f;
                    FingerMovedPositionx=0f;

                }

                else
                {

                    FingerMovedPositionx=FingerTouchx.position.x;

                    if(FingerMovedPositionx>FingerInitialPositionx)
                    {
                        charcter.transform.Translate(Vector2.right * speed * Time.deltaTime);
                    }

                    else if(FingerMovedPositionx<FingerInitialPositionx)
                    {
                        charcter.transform.Translate(-Vector2.right * speed * Time.deltaTime);

                    }

                }

            }

        }
    }

    void VerticalSwipe()
    {
        foreach (Touch FingerTouchy in Input.touches)
        {

            if(FingerTouchy.fingerId<1)      //         FINGERID

            {
                //if(FingerTouchy.position.y > Screen.width/2)

                if(FingerTouchy.phase == TouchPhase.Began)
                {
                    FingerInitialPositiony=FingerTouchy.position.y;

                }
                if(FingerTouchy.phase == TouchPhase.Moved)
                {
                    FingerMovedPositiony=FingerTouchy.position.y;

                }
                if(FingerTouchy.phase == TouchPhase.Ended)
                {
                    if(FingerMovedPositiony>FingerInitialPositiony)
                    {
                        charcter.transform.Translate(Vector2.up * speed * Time.deltaTime);
                    }
                    if(FingerMovedPositiony<FingerInitialPositiony)
                    {
                        charcter.transform.Translate(-Vector2.up * speed * Time.deltaTime);
                    }
                    FingerInitialPositiony=0f;
                    FingerMovedPositiony=0f;

                }

                else
                {}

            }
        }
    }

Problem:

1:When i swipe and hold horizontally the character moves fine but when i take my finger back it triggers the vertical swipe method.

2:When i try to swipe only vertically the horizontal swipe is also triggered.

3: The two swipe gestures are overlapping and triggered at same time on a Single touch.

Solution(Guess):Dividing the touch screen equally half and forcing horizontal touch gestures strictly on left side of touch screen and vertical touch gestures on right side.

But I'm beginner(You can see my coding style) and would like to know how to do it programatically.
Im still learning.

sentences:
What is the most efficient way of rendering a large number of SDL2 objects? I'm trying to find the most efficient way of rendering a large number of SDL2 objects to the screen.

Each of my objects have their own sprite sheets which are stored as SDL_Texture*.

Currently my render process looks like this:

Update objects.
Clear screen.
Call each objects render function, which calls SDL_RenderCopyEx(...) to render to the screen.
SDL_RenderPresent()

I was thinking I could improve this in one of two ways:
Method 1:

Update objects.
Clear screen.
Call SDL_SetRenderTarget(...) to set render target to a new texture 'X' which had previously been created with a SDL_TEXTUREACCESS_TARGET flag.
Call each objects render function, which calls SDL_RenderCopyEx(...) to render to texture 'X'.
Call SDL_SetRenderTarget(...) to set render target to screen.
Call SDL_RenderCopyEx once more to render texture 'X' to the screen.
SDL_RenderPresent()

Method 2:
Method 2 would require all sprite sheets to be stored as SDL_Surface*.
It would also require a 'global' SDL_Surface 'Y' to memcpy to.

Update objects.
Clear screen.
Call each objects render function, which calls a custom function to memcpy(...) each current obj surface information to surface 'Y'
Use surface 'Y' to create a new texture 'Z'.
Call SDL_RenderCopyEx only once to render texture 'Z' to the screen.
SDL_RenderPresent()

Unsure if any of these methods would make a difference in speed. Was looking for some input on whether it would be a good idea to implement either, or implement something new entirely.

Also, I'm not really looking for any new libraries to use, currently trying to use pure SDL. But if it's impossible to have an efficient rendering system with SDL, I would consider switching.

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:
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:
Is Frustum Culling by itself enough for Consoles and Mobiles? Software occlusion culling is often expensive, especially for smaller and older devices.

Is frustum culling alone adequate on systems that can optimally display 10k triangles at most?

If not, are there any relatively fast techniques for determining which objects (both moving and static) occlude others?

sentences: Physics-based dynamic audio generation in games I wonder if it is possible to generate audio dynamically without any (!) audio assets, using pure mathematics/physics and some input values like material properties and spatial distribution of content in scene space. What I have in mind is something like a scene, with concrete floor, wooden table and glass on it. Now let's assume force pushes the glass towards the edge of table and then the glass falls onto the floor and shatters. The near-realistic glass destruction itself would be possible using voxels and good physics engine, but what about the sound the glass makes while shattering? I believe there is a way to generate that sound, because physics of sound is fairly known these days, but how computationaly costy that would be? Consumer hardware or supercomputers? Do any of you know some good resources/videos of such an experiment?

sentences:
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:
Why is my Admob reward interstitial ad connected to Unity stuck on pending? I am trying to better monetize my game by using rewarded interstitials. I have set these up on my admob console. I have also linked the ad source on the admob console to my game through the Unity ads service using my game's id.

It seems to be stuck on "pending". I can't find any further options on admob or on the unity ads console to remedy this. In the game itself, my rewarded ads are not loading.

Is there some step I am missing either through Admob or Unity ads? How long does pending take because it has been like this for a few days.

Edit with more info
Unity version 5.5.1f1
I am using the example code from the admob site (I removed my apps id's here for privacy reasons):

    public RewardBasedVideoAd nonskipInterstich;
    public void NonSkipGoogleAd(){

    #if UNITY_ANDROID
    string adUnitId = "--------------------------------------";
    #elif UNITY_IPHONE
    string adUnitId = "------------------------------------------";
    #else
    string adUnitId = "unexpected_platform";
    #endif

    nonskipInterstich = RewardBasedVideoAd.Instance;

    // Create an empty ad request.
    AdRequest request = new AdRequest.Builder().Build();
    // Load the interstitial with the request.
    nonskipInterstich.LoadAd(request, adUnitId );

    nonskipInterstich.OnAdFailedToLoad += LogFailedToLoadError;

}

if I display the failed to load event I get "No fill".
I haven't ever gotten it to fill a request, but I am only using remediation linked to the UnityAds source.

I read a post online that recommended importing the Unity Ads plugin from the asset store into the project. I did this and the google request is still not filling. I do not use the unity ads plugin directly to make the request. I also have the unity ads adapter jar found here

sentences:
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:
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:
How to use Actors/Groups with ShapeRenderer instead of Batch? I am intersted in using Actors and Groups on a Stage so that I can make components and subcomponents which draw relative to their parents, but I intend to do my drawing with a ShapeRenderer instead of a Batch.  From what I understand of an Actor, the batch which is passed in to the draw() method has all of its matrices set up properly so that I can just use a coordinate system WITHIN THE PARENT to lay out the subcomponents.  But it seems that this coordinate system is focused on Batches, and I want to draw using a ShapeRenderer.

What do I have to do to get the child Actors to draw themselves RELATIVE TO THEIR PARENT (rather than in global coordinates) when drawing them with ShapeRenderers?

Also, one other question:  How should I be managing begining/ending the ShapeRenderer?  I am currently passing in a reference to a global ShapeRenderer when I construct my parent object, and this parent object passes in references to each of its children.  Should I be calling begin() end() separately in the draw method of each parent/child actor?  Or should I call it in my main app's draw() method, so I'm only calling it once each frame?

sentences:
Stencil buffer appears to not be decrementing values correctly I'm attempting to use the stencil buffer as a clipper for my UI system, but I'm having trouble debugging a problem I'm running in to.

This is what I'm doing: A widget can pass a rectangle to the the stencil clipper functions, which will increment the stencil buffer values that it covers. Then it will draw its children, which will only get drawn in the stencilled area (so that if they extend outside they'll be clipped). After a widget is done drawing its children, it pops that rectangle from the stack and in the process decrements the values in the stencil buffer that it has previously incremented.

The slightly simplified code is below:

static void drawStencil(Rect& rect, unsigned int ref)
{
    // Save previous values of the color and depth masks
    GLboolean colorMask[4];
    GLboolean depthMask;
    glGetBooleanv(GL_COLOR_WRITEMASK, colorMask);
    glGetBooleanv(GL_DEPTH_WRITEMASK, &depthMask);

    // Turn off drawing
    glColorMask(0, 0, 0, 0);
    glDepthMask(0);

    // Draw vertices here
    ...

    // Turn everything back on
    glColorMask(colorMask[0], colorMask[1], colorMask[2], colorMask[3]);
    glDepthMask(depthMask);

    // Only render pixels in areas where the stencil buffer value == ref
    glStencilFunc(GL_EQUAL, ref, 0xFF);
    glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
}

void pushScissor(Rect rect)
{
    // increment things only at the current stencil stack level
    glStencilFunc(GL_ALWAYS, s_scissorStack.size(), 0xFF);
    glStencilOp(GL_INCR, GL_INCR, GL_INCR);

    s_scissorStack.push_back(rect);
    drawStencil(rect, s_ScissorStack.size());
}

void popScissor()
{
    // undo what was done in the previous push,
    // decrement things only at the current stencil stack level
    glStencilFunc(GL_ALWAYS, s_scissorStack.size(), 0xFF);
    glStencilOp(GL_DECR, GL_DECR, GL_DECR);

    Rect rect = s_scissorStack.back();
    s_scissorStack.pop_back();
    drawStencil(rect, s_scissorStack.size());
}

And this is how it's being used by the Widgets

if (m_clip)
    pushScissor(m_rect);

drawInternal(target, states);
for (auto child : m_children)
    target.draw(*child, states);

if (m_clip)
    popScissor();

This is the result of the above code:

There are two things on the screen, a giant test button, and a window with some buttons and text areas on it. The text area scroll box is set to clip its children (so that the text doesn't extend outside the scroll box). The button is drawn after the window and should be on top of it completely. However, for some reason the text area is appearing on top of the button. The only reason I can think of that this would happen is if the stencil values were not getting decremented in the pop, and when it comes time to render the button, since those pixels don't have the right stencil value it doesn't draw over. But I can't figure out whats wrong with my code that would cause that to happen.

sentences:
Moving walkway in Three.js - pathfinding algo or vector math ala Nature of Code? I am trying to develop a moving walkway for a 3D virtual space made in Three.js (link here).  Right now guests navigate using WASD or the arrow keys and the mouse to look around.
My goal is to have guests would navigate themselves onto the walkway and be moved along a path through the space, like a high speed lazy river.  They could hop off any time once they reach their destination.
I was planning on using vectors and adapting some steering behaviors code from The Nature of Code series (which is based on Craig Reynolds' steering behaviors).  I would accelerate the user once they're on the path and keep them on the path using steering, until they move themselves off.
I am curious if there is a better way to do this and determine the pathway.  I checked out Don McCurdy's Three.js pathfinding work, but it requires that you build an external mesh in something like Blender and import that into Three.js, which I haven't been able to do yet.  A lot of Blender's options have also changed since he wrote the tutorials, so it's hard to map.
I'm all ears if anyone has suggestions.

sentences:
How do I implement variation in font letters, like handwriting? I can use a sprite sheet to automatically use a custom font. What I'd like to do though is to have several versions of each letter, such that the letters can be varied and more natural looking (a la handwriting). I don't know precisely how fonts are internally implemented, but I assume there's some function mapping chars to images. It seems like if that function isn't sealed, it wouldn't be difficult to make that function randomly choose one of "equal" images (that have slight variations).

Anyone know the plausibility of this/what code I'd want to overload to make this work with existing font infrastructure in xna?

sentences:
Trying to make a python map editor The program is supposed to read the pixel color values from an image, and use that data as a map for where to place objects in a game world.

Getting the color values was easy enough:

import numpy
from PIL import Image

img = Image.open("colors.png")
data = numpy.array(img)

The color value should be used to choose a type of object, and the data[ ] index values translated as coordinates to choose where on a surface the object is placed. It's not clear to me how to go about implementing this, I'm still trying to learn python.

I need help with understanding how to structure a system which goes through all the values of the data[ ] array, and creates a map based off of those values. For example, data[0,0] is a red pixel, therefore make an instance of object_type_1 and place it in the top left corner of the screen surface, data[0,1] is a blue pixel, make an instance of object_type_2 and place it 20 pixels to the right of the first object.

sentences:
XNA: Camera's Rotation and Translation matrices seem to interfere with each other I've been following the guide here for how to create a custom 2D camera in XNA. It works great, I've implemented it before, but for some reason, the matrix math is throwing me off.

public sealed class Camera2D
{
    public Vector2 Origin { get; set; }
    public Vector2 Position { get; set; }
    public float Scale { get; set; }
    public float Rotation { get; set; }
}

It might be easier to just show you a picture of my problem: http://i.imgur.com/H1l6LEx.png

What  I want to do is allow the camera to pivot around any given point. Right now, I have the rotations mapped to my shoulder buttons on a gamepad, and if I press them, it should rotate around the point the camera is currently looking at. Then, I use the left stick to move the camera around. The problem is that after it's been rotated, pressing "up" results in it being used relative to the rotation, creating the image above.

I understand that matrices have to be applied in a certain order, and that I have to offset the thing to be rotated around the world origin and move it back, but it just won't work!

public Matrix GetTransformationMatrix()
    {
        Matrix mRotate = Matrix.Identity *
            Matrix.CreateTranslation(-Origin.X, -Origin.Y, 0.00f) *  // Move origin to world center
            Matrix.CreateRotationZ(MathHelper.ToRadians(Rotation)) * // Apply rotation
            Matrix.CreateTranslation(+Origin.X, +Origin.Y, 0.00f);   // Undo the move operation

        Matrix mTranslate = Matrix.Identity *
            Matrix.CreateTranslation(-Position.X, Position.Y, 0.00f); // Apply the actual translation

        return mRotate * mTranslate;
    }

So to recap, it seems I can have it rotate around an arbitrary point and lose the ability to have "up" move the camera straight up, or I can rotate it around the world origin and have the camera move properly, but not both.

sentences:
OnTriggerEnter / OnTriggerStay triggers multiple times and is not been call a second time I am working on a feature that when the Player pass thru a door, a message will popup on the screen.
I'm having few problems: Debug.Log gives me from 2 to 6 logs when I pass thru the collider plane and when I come back to the same collider plane the script it is not been call a second time.
What I'm trying to achive is that Debug.Log gives me only one log and every time I pass thru the collider the script runs again.
so here is my code:

function OnTriggerEnter (other : Collider) { //OnTriggerStay gives the same result
    if (other.tag == "Player") {
    isColliding = true;
  } else {
    isColliding = false;
  }
}
function OnGUI() {
  if (isColliding) {
      Debug.Log(isColliding);
    //Application.ExternalCall('hive.OpenHiveAlert', 'test');
  }
}
function OnTriggerExit() {
    Destroy(this);
}

Any help would be appreciated, thanks.

sentences: Why is Unreal Engine Blueprint Editor so slow? Blueprint Editor is extremely slow on my Ubuntu 16.04. Can I improve performance without upgrading?

sentences: In unreal engine, what's the difference among "set global time dilation" and "set current time dilation" and "set custom time dilation"? what's the different effect of these three functions, thanks!

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:
Entity Component System - Handling Input I'm developing a using the Entity-Component model, and so far have components for position, input, graphics and a camera, and systems for rendering graphics and handling input.

All seems to be working well, and I can use my model to create a multi-player, multi-camera setup relatively easily.

Anyway, my problem is that my input system checks keypresses against each player's controls, but I'm not sure how to react to these keypresses without introducing a lot of coupling.

For example, if 'W' is pressed, I want to tell player 1 to move upwards, but that first involves some collision detection -- something I'm not sure my input system should handle.

Advice greatly appreciated!

Thanks in advance,
Rich.

sentences:
Determining which edge of a box was clicked in Unity How would I go about figuring out which edge of a box is clicked in Unity?

Quick image I created, colored in boxes represent edges on a face I would like to check for.

The current solution I have is half working. I create a raycast, check if it collided with a box, get the normal from the hit (to determine which side it collided with) & check if the point meets the criteria for X, Y, or Z (in the buffer zone, as outlined in the image). For example, if the raycast intersects the forward face I check that the point is inside one of the X buffers and not in one of the y buffers.

Currently only 2 sides on the forward / backward face work, as shown below

Finally, the related code.

void forwardMethod(RaycastHit hit){
    if(intersectsX(hit.point, hit.transform) && !intersectsY(hit.point, hit.transform)){

    }
    else if(intersectsY(hit.point, hit.transform) && !intersectsX(hit.point, hit.transform)){

    }
}

bool intersectsX(Vector3 hit, Transform transform){
    float buffer = transform.localScale.x * edgeBufferPercent;
    return hit.x <= buffer || hit.x >= transform.localScale.x - buffer;
}

bool intersectsY(Vector3 hit, Transform transform){
    float buffer = transform.localScale.y * edgeBufferPercent;
    return hit.y <= buffer || hit.y >= transform.localScale.y - buffer;
}

bool intersectsZ(Vector3 hit, Transform transform){
    float buffer = transform.localScale.z * edgeBufferPercent;
    return hit.z <= buffer || hit.z >= transform.localScale.z - buffer;
}

The buffer is equal to .15 if anyone is interested in that as well.

Any ideas? Am I approaching this wrong or is there a bug in my code I'm not seeing?

sentences: How do I calculate a line segment that is a certain number of degrees from another line segment? I have a line segment that is at an arbitrary angle in 3D space. I want to (in code) draw another line that shares an end point with the first line and has an angle of arbitrary degrees between them. The second line will partially overlap the first in the XZ plane.

sentences:
How can I generate an infinite procedural road? I'm currently trying to make a game where the player races others along an infinite, more-or-less straight, road.

By "more-or-less straight", I mean that the road goes straight ahead (the player can't turn their vehicle to face left or right), but there are bends in the road for them to pass through, as if they were switching from one lane to another on a highway.

There will also be different "areas" to race through (all on the same road), for example, deserts, jungles and over water.

And, finally, there will be gaps in the road for the player to jump over, as well as checkpoints every so often.

Starting with a seed, how can I generate the road ahead of the player as they race? I can't generate the entire road in advance (obviously), but each player needs to see the same thing at the same places along the track.

How can I do this?

sentences:
Trying to better understand Unity gameobjects New to Unity, but develop in C# normally.  I can't seem to get how / why / where to grab certain elements.  For simplicity, I have a top-level game object, say a cube.  I add a sphere to the scene as child to the cube. The child sphere (actually more complex), has navigation mesh, animation object, collider and finally a script in C#.

Now, my C# class is comprised of an instance of an C# class on the class.  Something like

public class CMyGeneric
{
   public void someMethod()
   {
      // invalid getting to "gameObject" reference
   }
}

public class CMyMainScript
{
   public CMyGeneric myGeneric;

   void Start()
   {
      myGeneric = new CMyGeneric();
   }

   void Update()
   {
      myGeneric.someMethod();
   }
}

So, the parent game object is the cube, the child is the sphere, and the CMyMainScript script is attached to the sphere.  However, when I try to reference "gameObject" via the CMyGeneric (instance), call within the "someMethod", the "someMethod" doesn't appear to see the overall "gameObject".

Now, how/what am I missing as each thing that gets attached, unity adds to these game objects, and I don't know how to get respective hierarchical levels of where things are even though I know where they are from a relative perspective.

sentences:
Efficient way to build a 360 rotation system with clockwise and counterclockwise direction I've been struggle with rotation for sometime now, maybe it isn't that hard for someone who dominates the mathematical side of things regarding rotation and angles but, I need to build a rotation system that rotates the player to either clockwise or counterclockwise direction according to the nearest direction to the target angle.
I.E.
If my player is rotated to 45° and the direction is changed to 135°, he must rotate 90º clockwise (from 45° to 135°).
If my player is rotated to the same 45° and the direction is changed to 315°, he must rotate 90° counterclockwise (from 45° to 315º).
This didn't seemed a big deal when I started, but it's been hard for me to build something that cover all the rotation possibilities, which tells me that I'm doing something wrong here. I mean, there's must be a couple of formulas that fit this problem and cover all the possible rotations or something.
Right now, my rotation system is configured to a minimal of 5 degrees of rotation, wich means that the possible degrees goes from 0 to 355(it never get to 360, going back to 0 instead).
I don't have a code to show cause everytime I try to build this, I reach to a point where there are so many possibilities that aren't covered by my tests that I end up deleting everything to try again, but I'm tired of this seemingly endless loop (for me anyway lol).
Does anyone knows a way to build this?
-EDIT-
My project is 3D and the camera perspective is similar to sports games like NBA 2K or soccer games in general. The input is a Vector2 obtained with the new input system. I need to move my player around with root motion, which means that my goal with this system is to calculate the rotation data to be passed as an animation parameter (using a event), so the correct animation is played and the player finally rotate according to the animation. The main part of the code (calculation part) was built by a friend of mine, who has more knowledge than me. This is my current code:
if (movementVector != Vector2.zero)
    {
        targetRotationAngle = Mathf.Atan2(movementVector.x, movementVector.y) * Mathf.Rad2Deg + cameraTransform.eulerAngles.y; //FUNCTIONAL CODE BUILT BY A FRIEND
        targetRotationAngle = Mathf.CeilToInt(targetRotationAngle / 5) * 5; //FUNCTIONAL CODE BUILT BY A FRIEND
        if (targetRotationAngle < 0)
            targetRotationAngle += 360;
        if (currentRotationAngle == targetRotationAngle)
            return;
        else
        {
            if (currentRotationAngle < targetRotationAngle)
            {
                Debug.Log("Clockwise rotation in " + (targetRotationAngle - currentRotationAngle) + " degrees");
            }
            if (currentRotationAngle > targetRotationAngle)
            {
                Debug.Log("Counterclockwise rotation in " + ((360-currentRotationAngle)+targetRotationAngle) + " degrees");
            }
        }
            currentRotationAngle = targetRotationAngle;
    }

This is a summarized version of my previous attempts (the ELSE part), I know my formula is wrong, cause it doesn't cover all the rotation scenarios, the more I tried to build, more of this IF's were nesting. That's why I've decided to ask...

sentences:
Strange artifacting with textures (Pseudo 3D) I'm using SFML to make a pseudo 3d engine (Technically not software rendered since SFML uses OpenGL) and things are going rather swimmingly, but then I tried to make another wall, the picture says everything:

The artifact gets worse the closer you get to the wall on the left.

And the Code...

#include "Quad3B.h"

Quad3B::Quad3B() {
    pos = sf::Vector3f(0, 0, 1);
    size = sf::Vector3f(1, 1, 0);
    shape = sf::VertexArray(sf::Quads, 4);
    c = sf::Color::Red;
    color = true;
}

Quad3B::Quad3B(sf::Vector3f p) {
    pos = p;
    size = sf::Vector3f(1, 1, 0);
    shape = sf::VertexArray(sf::Quads, 4);
    c = sf::Color::Red;
    color = true;
}

Quad3B::Quad3B(sf::Vector3f p, sf::Vector3f s) {
    pos = p;
    size = s;
    shape = sf::VertexArray(sf::Quads, 4);
    c = sf::Color::Red;
    color = true;
}

Quad3B::Quad3B(sf::Vector3f p, sf::Vector3f s, sf::Color c) {
    pos = p;
    size = s;
    shape = sf::VertexArray(sf::Quads, 4);
    Quad3B::c = c;
    color = true;
}

void Quad3B::loadTexture(string path, sf::Vector2f ts) {
    color = false;
    tex.setRepeated(true);
    tex.loadFromFile(path);
    texp = sf::Vector2f(ts.x * tex.getSize().x, ts.y * tex.getSize().y);
}

void Quad3B::dr(sf::Vector3f camPos, sf::RenderWindow &window, float hw, float hh, float rat) {
    bool draw = true;

    shape[0].position = sf::Vector2f((((pos.x + camPos.x) * rat) / (pos.z + camPos.z)) * hw + hw, (-(pos.y + camPos.y) / (pos.z + camPos.z)) * hh + hh);
    shape[1].position = sf::Vector2f((((pos.x + camPos.x) * rat) / (pos.z + camPos.z)) * hw + hw, (-(pos.y + size.y + camPos.y) / (pos.z + camPos.z)) * hh + hh);
    shape[2].position = sf::Vector2f((((pos.x + size.x + camPos.x) * rat) / (pos.z + size.z + camPos.z)) * hw + hw, (-(pos.y + size.y + camPos.y) / (pos.z + size.z + camPos.z)) * hh + hh);
    shape[3].position = sf::Vector2f((((pos.x + size.x + camPos.x) * rat) / (pos.z + size.z + camPos.z)) * hw + hw, (-(pos.y + camPos.y) / (pos.z + size.z + camPos.z)) * hh + hh);

    if (color) {
        shape[0].color = c;
        shape[1].color = c;
        shape[2].color = c;
        shape[3].color = c;
    }
    else {
        shape[0].texCoords = sf::Vector2f(0, texp.y);
        shape[1].texCoords = sf::Vector2f(0, 0);
        shape[2].texCoords = sf::Vector2f(texp.x, 0);
        shape[3].texCoords = sf::Vector2f(texp.x, texp.y);
    }

    if (pos.z + camPos.z < 0) { draw = false; }
    if (draw) { if (color) { window.draw(shape); } else { window.draw(shape, &tex); } }
}

Quad3B::~Quad3B() { }

sentences:
Zooming in so a smaller portion of the game scene fills the entire screen so i am creating a game similar to super-smash-bros, in which the camera should zoom in on players when they are close together, and scale back when they are apart. I create a window for my game via

m_pWindow = SDL_CreateWindow("First SDL game attempt", SDL_WINDOWPOS_UNDEFINED,
                SDL_WINDOWPOS_UNDEFINED, 1000, 1000, SDL_WINDOW_SHOWN);

and then initialise my render via

m_pRenderer = SDL_CreateRenderer(m_pWindow, -1, SDL_RENDERER_ACCELERATED);

and when i call render for my buffer, it simply calls

SDL_SetRenderDrawColor(m_pRenderer, m_clearRed, m_clearGreen, m_clearBlue, 0xff);
SDL_RenderClear(m_pRenderer);
SDL_RenderPresent(m_pRenderer);

Now i am wondering where in this solution should i implement the camera, if you could point me in the right direction that would be great. For example, i have a player positioned at {500, 800}, and another at {300,800}. I want to zoom in on this point of the screen. The total window is 1000x1000, but rendering {x = 200->600, y = 600->1000} is what i want to achieve.

I have currently tried using

SDL_Rect rect;
rect.x = 0;
rect.y = 0;
rect.w = 900; //TEST VALUES
rect.h = 900; //TEST VALUES
SDL_RenderSetViewport(m_pRenderer,
    &rect);

But this simply doesn't render part of the screen, as opposed to scaling the entire view.

Any other help would be greatly appreciated

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:
Hidden copies of the environment in an entity component system For reasons outside the scope of this question, my game has several full copies of the game environment running asynchronously. At any one time, only one of these is rendered.

This is trivial to support in a traditional, object-oriented architecture. Instantiate a few copies of the environment, run each one in its own thread (I actually use a parallel task system for cases where there are more environments than CPU cores), and only call call draw() on the one you want rendered.

The time for large refactorings has come, and I'm considering converting to an entity component system such as Entt. What would be the best way to achieve this same functionality?

The best I've come up with is each environment being a self-contained ECS, managed by an object-oriented system (which would also handle things not replicated, such as UI). The render system would be disabled in all environments except the one being rendered.

I don't like that solution though. I don't want the render system for the game environments to be separate from that of the UI, etc. I also don't like the idea of mixing ECS and object-oriented architectures.

Is there a better solution?

sentences:
Unity Physics Material - Character Slides Too Much I am currently working on a 2D platformer in Unity. I am using a prefab from the AssetStore for my character (The last paragraph contains a link to the prefab). The character has a circle collider for his feet so that he can walk up slopes.

The problem I'm having is that because it is a circle collider, he also slides down any slope. I realize that I can add a Physics Material to the collider with a friction variable to stop (or at least resist) the sliding, but if I add any friction above ~0.1 the character can collide with a wall to stop himself from falling and yet 0.1 isn't even enough to stop him from sliding down slopes.

So my question is, how can I stop the character from sliding down slopes in a way that doesn't allow the player to stop himself from falling by colliding with walls?

The prefab that I'm using specifically is an asset found here, it's disk location is Sample Assets/2D/Prefabs/2D Character

sentences:
Linking error when compiling Allegro example I am currently learning about game development tools and decided to use Allegro and OpenGL for starters. I've run into some problems in getting examples to compile though. It seems the allergro.h library isn't linking correctly. Some web searching didn't help.

Here's my example code:

#include <stdio.h>
#include <allegro.h>

int main()
{
    allegro_init();
    //...
    return 0;
}
END_OF_MAIN();

I'm running this command to compile it:

g++ allegroTemplate.cpp -o allegroTemplate

This is the error I'm getting:

/tmp/ccbpAXIY.o: In function `main':
allegroTemplate.cpp:(.text+0x2a): undefined reference to `_install_allegro_version_check'
collect2: ld returned 1 exit status

I'm running this in Ubuntu.

sentences:
Grayscale color mode texture not rendering in libGDX I am about to develop a game completely in shades of grey using libGDX and just for testing purposes, i created two textures in photoshop:

2048 x 2048 plain white png image with RGB color mode of size 19.1KB
2048 x 2048 plain white png image with grayscale color mode of size 7.67KB

... so basically both are just plain white images to look at, but the GREY.png one takes comparatively less space than the RGB.png. While rendering the both the images one at a time, RGB image renders perfectly but the grayscale one does not render at all and the output is completely black. My code:

@Override
public void create() {

    texture = new Texture (Gdx.files.internal ("GREY.png")); // ...just change to "RGB.png" to render RGB.png image..
    batch = new SpriteBatch ();

}

@Override
public void render() {

    Gdx.gl.glClearColor (0, 1, 0, 1);
    Gdx.gl.glClear (GL20.GL_COLOR_BUFFER_BIT);

    batch.begin ();
    batch.draw (texture, 0, 0);
    batch.end ();

}

@Override
public void dispose() {
    texture.dispose ();
}

This is all it...No cameras are used, just 2 lines in create() and 5 lines in render() method and 1 line in dispose() method, nothing fancy at all...

Also it will be really stupid to load 19.1KB texture and render it in greyscale using shader when you can directly load same looking image of 7.67KB size.

I don't understand why libGDX does not render the image with grayscale color mode, is it not supported?

UPDATE:
grayscaled images are supported by libGDX and

 texture = new Texture (Gdx.files.internal ("gs.png"), Pixmap.Format.LuminanceAlpha, true);

solved my problem.

sentences:
Tick() method error when I run it. HELP! Okay so I get this error:

Exception in thread "Thread-2" java.lang.NullPointerException
at basic.game.here.Game.tick(Game.java:71)
at basic.game.here.Game.run(Game.java:54)
at java.lang.Thread.run(Unknown Source)

Here is the code it says the error relates to:

package basic.game.here;

import java.awt.Canvas;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.image.BufferStrategy;

import basic.game.here.tiles.Ground;

public class Game extends Canvas implements Runnable {

private static final long serialVersionUID = 1L;

public static final int WIDTH = 960, HEIGHT = WIDTH / 12 * 9;

private Thread thread;

private boolean running = false;

private int FPS = 0;

private World world;
private Player player;

public Game(){
    new Window(WIDTH, HEIGHT, "BASIC", this);

    world = new World();

    player = new Player(500, 200);

}

public synchronized void start(){
    thread = new Thread(this);
    running = true;
    thread.start();
}

public synchronized void stop(){
    try{
        thread.join();
        running = false;
    }catch(Exception e){
        e.printStackTrace();
    }
}

public void run() {
    long lastTimeChecked = System.nanoTime();
    int frames = 0;
    while(running){
        tick();
        render();
        try {
            Thread.sleep(6);
        } catch (InterruptedException e){
            e.printStackTrace();
        }
        frames++;
        if(System.nanoTime() - lastTimeChecked >= 1000000000){
            FPS = frames;
            frames = 0;
            lastTimeChecked = System.nanoTime();
    }
}
}

private void tick() {
    player.tick();
}

private void render(){
    BufferStrategy bs = this.getBufferStrategy();
    if(bs == null){
        this.createBufferStrategy(3);
        return;
    }
    Graphics g = bs.getDrawGraphics();
    g.setColor(Color.BLUE);
    g.fillRect(0, 0, WIDTH, HEIGHT);

    g.setColor(Color.YELLOW);
    g.setFont(new Font("Dialog", Font.BOLD, 18));
    g.drawString("" + FPS, 5, 20);

    //g.drawString("(" + player.x + ", " + player.y + ")", 5, 40);

    world.render(g);
    player.render(g);

    g.dispose();
    bs.show();
}

public static void main(String[] args){
    new Game();
}

}

Here is the player class because I think it is related to this:

package basic.game.here;

import java.awt.Color;
import java.awt.Graphics;

public class Player {

private int x, y;

public Player(int x, int y){
    this.x = x;
    this.y = y;
}

public void tick(){

}

public void render(Graphics g){
    g.setColor(Color.CYAN);
    g.fillRect(x, y, 16, 16);
}

}

Thanks in advance!

sentences:
Binding and unbinding, what would you do? Let's assume the following example

creation:

glBindVertexArray(vao)
   glBindBuffer(GL_ARRAY_BUFFER, vbo)
   glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indices)

   // Filling up buffers

   glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)
   glBindBuffer(GL_ARRAY_BUFFER, 0)

glBindVertexArray(0) // Unbinding vertex array

This looks great from a code-beauty perspective. Each bind-unbind-pair is like parenthesis, so {[()]} (I am also actually using these indentions)

But it also results in a more code for rendering, because the buffers are unbound in the vao, they need to be rebound during rendering, which kind of defeats the purpose of a vao which represents a certain state you can just use whenever you need to.

Rendering would need to look like:

glBindVertexArray(vao)
    glBindBuffer(GL_ARRAY_BUFFER, vbo)
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indices)
        // Do your drawing
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)
    glBindBuffer(GL_ARRAY_BUFFER, 0)
glBindVertexArray(0)

so it would be better to

glBindVertexArray(vao)
   glBindBuffer(GL_ARRAY_BUFFER, vbo)
   glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indices)

   // Filling up buffers

glBindVertexArray(0) // Unbinding vertex array
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)
glBindBuffer(GL_ARRAY_BUFFER, 0)

Just to make sure the buffers are not bound for another write or anything.
Code-wise this looks kind of ugly.

But rendering then is just

glBindVertexArray(vao)
 // Do your drawing
glBindVertexArray(0)

Regarding the cost, the second one uses less (un)bindings, but also it could happen that the vao is already unbound (during rendering) but the vbo and element-buffer is not, so one could write messy data in there.

Am I missing something? Which way is more error-prone? Are the costs for un/binding neglect-able and is the beauty of code worth it?

sentences:
What is the best practice to handle event with order? When you play card games, you always face some abilities and effects will be triggered at the same time. To resolve this, players relies on the rules. For example, if a minion dies, it triggers effects on my side and opponent side. If the effects is handled on my side first if it is my turn.

But how would you resolve it in computer games. Even you are using mediator for event handling, the event is usually handled by the order of subscription. Unless there are some indicators for the subscribers, you will not able to distinguish between the subscribers. But wouldn't it defeats the purpose of observer pattern? What is the best way implement it?

sentences:
Unity 5.5 - Modify image of a button from an array of images via script - Logic Help Right now i have this:

Is a placeholder for what i want to do. This blue circles are images in different buttons, i have a blue image circle for every letter. I have to display the correct letter image to create a word. For example: word: "DOG" and the word is created by the "D" "O" "G" images.

That is the logic i cannot get my head around.

How can I, via script, select which image to show depending on the word given?

IDEAS:

I have an array of (INDEX, "letter") in my GameController.CS. Maybe i can add a number to the different images name. Separeate the word in characters. Look the position of this character in the Letters[] and that number turn it into a string and find the image with that number in the name.

I really need help to figure this out.

Thanks in advance for any help.

sentences:
UDK - Packaging the Game I have set up all the config files to my game classes and am able to launch the game to test everything.

Although when I package the game, it still runs the UT deathmatch game??

What other lines in the config files should be changed to make it default to my game and default map once published?

sentences:
Designing a fluent API for card effects I'm currently trying a develop a small game similar to http://www.estiah.com/.

Basically, there are 2 teams of 1 or more actors each, everyone with their same deck. Turn order is fixed and each card is automatically played when drawn, so games play out automatically. I already got the basic game loop, game state and history and turn order and currently try to create a fluent API, that makes it easier to add cards later on.

Each card consists of multiple effects, that can either target the current user, a random ally/enemy, a specific ally/enemy based on some criteria (like, enemy with lowest hp) or all allies/enemies/everyone. On top of this, effects may also have some kind of setup/cleanup, that should only be executed once before/after all targets have been processed.

Below are the use cases i can currently think of:

apply 1 effect to self
apply 1 effect to a random ally/enemy
apply 1 effect to a ally/enemy matching criteria
apply 1 effect to all allies/enemies
apply 1 effect to everyone
apply multiple effects to either of the above (targets should not change between effects, even if, for example, the "enemy with lowest hp" is different after the first effect)
execute effects based on a condition on the user
execute effects based on a condition for each target

Conditions/targets should be resolved during effect execution, since previous effects might influence them (unless multiple effects are joined and assigned to the same target, in which case it should not change between effects, as stated above).

Since the theory probably isn't very expressive, i already developed a basic system, which can be found over here: https://codereview.stackexchange.com/questions/189732/designing-a-system-to-apply-multiple-effects-to-one-or-multiple-targets.

The current system allows me to do things like:

public class MyCard implements Card {
    public Effect getEffect() {
        dealPhysicalDamage(10).to(randomEnemy());
    }
}

Where dealPhysicalDamage(...) returns an instance of TargetedEffect, randomEnemy() returns an instance of TargetSingle and the to(...) method binds the target to the effect, converting it into a plan Effect, which in turn can get executed by the game engine. This modifies the current game state, which gets deep cloned into a history for later usage as a battle log.

I've been trying for days to come up with a better system that gives me the freedom to apply 1-n effects to 1-n targets (single target effects will be the majority), while keeping the API as compact as possible. I'm probably too deep in the code to get a clear view, so maybe someone else can come up with an idea.

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:
How do I draw more than just points in 3D? I'm currently working on a 3D rendering engine in JavaScript. I've successfully rendered a cube and can rotate it. My cube is represented by 3D points in an array ([x, y, z]):

var cube = [[-20,-20,5],[20,-20,5],[-20,20,5],[20,20,5],
[-20,-20,-5],[20,-20,-5],[-20,20,-5],[20,20,-5]];

Now that I can render a basic cube I'd like to try rendering something more complicated to make sure my math works well. It's there a standard 3D object file i can import and use or I have to manually specify the 3D positions of every vertex like I did with the cube?

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:
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:
Turn-based multiplayer animate moves from last turn I'm trying to make a 2-player turn-based strategy game, using the Google Play Games APIs

According to the documentation,

  As a match progresses, the current player can modify and store the game data on Google's servers. The other participants can then retrieve and update this data on their turn.

What this seems to be saying (sorry if I'm completely misinterpreting this; I've never played with the Play Games APIs before) is that, since each turn is just updating the game state data on the server, a round could look something like this:

Unit A is on Square 1, Unit B is on Square 3
[P1's turn] Player 1 moves Unit A to Square 2
[P1's turn] Player 1 kills Unit B with Unit A
[P2's turn] When Player 2 looks at the game, it shows Unit A on Square 2, and no Unit B

What I want is for both players to see the animation when Unit A moves, rather than Player 2 just seeing the new state and not the transition:

Unit A is on Square 1, Unit B is on Square 3
[P1's turn] Player 1 moves Unit A to Square 2
[P1's turn] Player 1 kills Unit B with Unit A
[P2's turn] When Player 2 looks at the game, it shows Unit A on Square 1 and Unit B on Square 3, then animates Unit A moving to Square 2 and killing Unit B

So basically each player gets a replay of the action from their opponent's turn before taking their turn.

I know it could be possible to do something like this by looking at the differences in position of a unit between turns, then animating the change; this, however, breaks down when you have something like an attack, where all you know is a unit was destroyed and wouldn't necessarily be able to infer which unit attacked and should be animated.

How would I go about implementing something like this?

sentences:
Process for Creating Imposters (For Unity) I'm still working on making a sports stadium with crowd etc. I've been reading a lot about 'Imposters' and 'Billboarding'. I want to explore and learn the imposters technique.
But I am stuck at step 1 :|
I have a stadium model made which is empty (no seats or people).
All I want at the moment is seats. I have the model made in Maya for a seat.

Do I need to make (and import to Unity) both a low-poly and high-poly version of the model.
How exactly is an 'imposter' asset stored in data (specifically if used in Unity)?
Do I need to make 2d images/textures of many angles of the seat?

I do have more questions, but these may be enough to get me started.
Thanks as always for any help.

sentences:
Quest UI Display in Unity 2D I have this quest manager script where I store all my quests for easy duplication.

I'm adding a feature that gives the player the option to see his/her current to-do quest.

The first thing I tried was just showing it in my dialogue box(which closes immediately because it's supposed to be for dialogues only).

Now I made a quest log UI so he/she can see his/her current to-do list with a claim button for the reward.

All I need to do now is to change the text I have in the quest log UI (the Quest Title and the Description) the same way I was doing with the dialogue for each quests, but I can't seem to figure out how.

public QuestObject[] quests;
public bool[] questCompleted;

public DialogueManager theDM;
public PanelManager thePM;

public string itemCollected;

// Use this for initialization
void Start () {
    questCompleted = new bool[quests.Length];
}

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

}

public void ShowQuestText(string questText)
{
    theDM.dialogLines = new string[1];
    theDM.dialogLines[0] = questText;

    theDM.currentLine = 0;
    theDM.ShowDialogue();
}
public void ShowQuestList()
{
    thePM.ShowDialogue();
}

public class QuestObject : MonoBehaviour {

public int questNumber;

public QuestManager theQM;
public DialogueManager donMariano;

public string startText;
public string endText;

public string questTitle;
public string questDescription;
public int rewardGold;
public int rewardChilli;
public int rewardEggplant;
public int rewardPotato;

public bool isItemQuest;
public string targetItem;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
    if(isItemQuest)
    {
        if(theQM.itemCollected == targetItem)
        {
            theQM.itemCollected = null;

            EndQuest();
        }
    }
}
public void StartQuest()
{
    theQM.ShowQuestText(startText);

}
public void EndQuest()
{
    theQM.ShowQuestText(endText);
    theQM.questCompleted[questNumber] = true;
    gameObject.SetActive(false);
}

}

public class DialogueManager : MonoBehaviour {

    public GameObject dBox;
    public Text dText;

    public bool dialogActive;
    public string[] dialogLines;
    public int currentLine;

    public Image[] dialogImage;

    private PlayerControl thePlayer;
    // Use this for initialization
    void Start () {
        thePlayer = FindObjectOfType<PlayerControl>();
    }
    // Update is called once per frame
    void Update ()
    {
        if(dialogActive && Input.GetKeyDown(KeyCode.Space))
        {
            currentLine++;
        }
        if(currentLine >= dialogLines.Length)
        {
            dBox.SetActive(false);
            dialogActive = false;

            currentLine = 0;
            thePlayer.canMove = true;
        }
        dText.text = dialogLines[currentLine];
    }
    public void ShowBox(string dialogue)
    {
        dialogActive = true;
        dBox.SetActive(true);
        dText.text = dialogue;
    }
    public void ShowDialogue()
    {
        dialogActive = true;
        dBox.SetActive(true);
        thePlayer.canMove = false;
    }
}

sentences:
My Directional light lights the floor of my cave but not the ceiling (concave mesh) I am developing a small demo with Meshes created from a vertex map.

When i put a hole in the mesh (making it concave) the physics work fine but the directional lightning only lights one part of the concave park.

All of my mesh can receive and and cast shadow (so i should have self-shadowing) but it does not seem to work.

my directional light creation:

            var dirLight = new THREE.DirectionalLight( 0xffffff, 1 );
            dirLight.position.set( -50, 50, 1 );
            dirLight.position.multiplyScalar( 50);
            dirLight.name = "dirlight";
   dirLight.castShadow = true;
            dirLight.shadowCameraVisible = true;
   dirLight.shadowDarkness = 1.0;

my shadow settings:

   renderer.setSize( window.innerWidth/1, window.innerHeight/1 );
   renderer.shadowMapEnabled = true;
   renderer.shadowMapSoft = true;

   renderer.shadowCameraNear = 3;
   renderer.shadowCameraFar = camera.far;
   renderer.shadowCameraFov = 50;

   renderer.shadowMapBias = 0.0039;
   renderer.shadowMapDarkness = 0.5;
   renderer.shadowMapWidth = 1024;
   renderer.shadowMapHeight = 1024;

Finally my mesh creation code:

var newGeometry = new THREE.Geometry();
for (var i = 0; i < rawGeometry.vertices.length; i++) {
  newGeometry.vertices.push(new THREE.Vector3(rawGeometry.vertices[i][0], rawGeometry.vertices[i][1], rawGeometry.vertices[i][2]))
}
for (var i = 0; i < rawGeometry.faces.length; i++) {
  newGeometry.faces.push(new THREE.Face3(rawGeometry.faces[i][0], rawGeometry.faces[i][1], rawGeometry.faces[i][2]))
}

newGeometry.computeFaceNormals();
;

var color = rawGeometry.color;
var newMesh = new Physijs.ConcaveMesh(newGeometry, new THREE.MeshLambertMaterial({
  color: color
}), 0, 50, 50);
newMesh.position.x = location[0];
newMesh.position.y = location[1];
newMesh.position.z = location[2];

newMesh.castShadow = true;
newMesh.receiveShadow = true;

this.Chunks[chunkIndex[0]][chunkIndex[1]][chunkIndex[2]][typeIndex] = newMesh;

scene.add(newMesh);

sentences:
Custom shadow mapping in Unity. Works with preservative Light view but not with Orthographic So about a week ago I decided to make my own shadow mapping technique in Unity based on my understanding of the whole thing. The entire experience was somewhat successful. I learned a lot and I get to correct a lot of things such as the MVP matrix and the math behind it.  One thing though didn't work as planned and I don't know why.

First lets talk about what worked. I wrote a replacement shader that will show the depth of every object based on the Light Position/perspective. Therefore I made a custom Light GameObject that act as a camera/light with that replacement shader attached to it, and I record everything the Light sees into a render texture.

Then I made a second Camera which is basically a child of the main camera, and sees what the main camera see with the exception of the replacement Shader that I attached previously to the Light gameobject. again I recorded everything from the camera to a render texture as well.

After that, I wrote a basic Shader that does a basic light calculation and make a the shadow comparison between the two textures, and determines whether a fragment in a shadow or light. Also, I added a shadow Bias as well to eliminate any artifacts.

            struct appdata {
            float4 position : POSITION;
            float3 normal : NORMAL;
            float2 uv : TEXCOORD0;
        };

        struct v2f {
            float4 position : SV_POSITION;
            float2 uv : TEXCOORD0;
            float3 normal : TEXCOORD1;
            float3 worldPos : TEXCOORD2;

        };

        float4 _Tint;
        sampler2D _MainTex;
        sampler2D  SahdowMap_Light, SahdowMap_View;
        float4 _MainTex_ST;
        float4x4 WorldToCamera, WorldToLight;
        float3 _LightDir1;

        v2f VertexProgram(appdata v) {
            v2f i;
            i.position = UnityObjectToClipPos(v.position);
            i.worldPos = mul(unity_ObjectToWorld, v.position);
            i.normal = UnityObjectToWorldNormal(v.normal);
            i.uv = TRANSFORM_TEX(v.uv, _MainTex);
            return i;
        }

        float Shadow_Cal(v2f i, sampler2D DepthMap,float4x4 space) {

            float4 projected2 = mul(space, float4(i.worldPos, 1.0f));
            float2 uv = (-projected2.xy / projected2.w) * 0.5 + 0.5;
            float Shadow = tex2D(DepthMap, uv).r;

            if (uv.y > 1.0)
            Shadow = 0.0;

            return Shadow;
        }

        float4 FragmentProgram (v2f i) : SV_TARGET {

            float LightDepth = Shadow_Cal(i, SahdowMap_Light, WorldToLight);
            float ViewDepth = Shadow_Cal(i, SahdowMap_View, WorldToCamera);
            float bias = max(0.05 * (1.0 - dot(i.normal, _LightDir1)), 0.015);
            float Shadow = LightDepth + bias < ViewDepth ? 0 : 1;

            float4 Texture = tex2D(_MainTex, i.uv);
            float3 lightpos = _LightDir1 - i.worldPos;
            return saturate(dot(lightpos, i.normal)) *_Tint * Texture * Shadow;
        }

The problem is when the Light is on perspective, this works perfectly fine as shown above, but when I switch the light camera to Orthographic this happen:

I tried many different things to fix it but I failed.
I would love your insight in this whole thing, your thought, solution or even a suggestions.

You are free to download the whole project as a package here Download

Special thanks to DMGregory.

sentences:
MMO Chat system methods I'm working on a little MMO game as a learning experience, the server coded in Python.

When a player logs in it pulls their character data from a SQL db and into server memory. It then uses memory for just about all things in the game and only uses the database again to back up the states at periodic save intervals, or when that player leaves/disconnects.

My question though is about the chat system. I've made chat systems before for websites where it just pulls from mySQL databases. But as I've learned accessing databases can be expensive for MMOs.

Currently in my build, chat is just sent to and stored locally by the player as and when it happens, but if an important guild message is sent while the player is loading between zones/channels then they don't receive it.

Is my current way the 'common' one? (just needing tweaks) Or should I be pulling chat from a SQL database? Or should chat be saved in server memory? Maybe its a mix...

Some pointers in the right direction would be great!

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:
Is quadrilinear texture sampling hardware supported? If you have a volume texture with mipmaps, GL_LINEAR_MIPMAP_LINEAR texture sampling will perform quadrilinear texture sampling.

Is that implemented in hardware like bilinear texture sampling is? Or does the driver just do two trilinear texture samples and interpolate those results for you?

Is trilinear sampling even supported by hardware?

sentences:
View individual UI Rect boxes when multiple UI elements are selected? I have 2D UI layout with multiple text boxes over the canvas, I need to easily be able to see where the Rect boxes for each are positioned, so that I can see where the safe areas are for placing buttons etc.

Selecting each individual item shows its own individual Rect box, but selecting multiple items just shows one big box around all of them.

Is there a way of selecting multiple items and see each individual Rect box?
It's extremely time consuming having to go and check each one individually.

sentences:
How do I store Items in MySQL? I'm working to my first game containing items (built a small one before, strategy type but not very complicated). I was thinking something like this for the db design since it will be almost the same items in each shop.  I'm thinking of connecting the shop to user items (not sure if you understand what i'm thinking of):

shopname
  shopNameId, shopName
shopCategory
 shopCategoryId, shopNameId shopCategoryName,
shopItems
 shopItemId, armourId, oneHandedWeaponId, twohandedWeapoinId,

this would be for the shop..now;

oneHandedWeapons
 oneHandedWeaponId, weaponName, weaponMinAtk, weaponMaxAtk, ...

otherAttributes,

oneHandedExtendedAttributes
 oneHandedExtendId, oneHandedWeaponId, ... otherAttritubes,

and again for other item types.
This npc's will be the only place from where they can buy items.

Now when a user bought a new item from one of the shops i should insert the id of that item in the inventory table no?
I was thinking on a structure like this for a stash based on 10 slots.

userStash
userStashId, userId, slot1, slot2, slot3, slot4, slot6, slot7, slot8, slot9, slot10

now on each on slot i can insert the id of that item.

Now my questions:

Is it ok how i did this?
Do you see any problems?
Do you have any advice?
Can you give me another ideea / another example how should I do this part?

sentences:
Box2d Collision problem I'm not good with words so here's a picture to describe my problem:

In my game there is this big ball which the user can move on x-axis only. Now, if the ball is falling like the red one, it's blast away. But, with the angle/hit position of the green one it's just kinda sliding on the big ball and falling.

I'm using Box2d above AndEngine on an Android platform.

What is the reason for my green ball problem?

sentences: How do I import a custom map into UE4? I have seen videos on creating the map/level in UE4, but not how to import the map from something like maya. Would I have to import it as an object? I have been playing around in the editor but haven't been able to find any setting that seems to do the trick.

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:
Is Time.deltaTime different on various devices? Can someone say what is wrong with my code. I have custom timer implemented like this:

 float timeRemain = 10f;
 void Update(){
 timeRemain -= Time.deltaTime;
 if(timeRemain <= 0){
  ///...code here.
   }
 }

On PC it runs like expected but on Android device timeRemain variable becomes 0 in less then 10 secs. Who can suggest me what happens when i run it on Android device?

sentences:
Real-Time Speech & Verbal Communication with a Mecanim Character What would be the simplest method of integrating real-time verbal communication within a mecanim character that is already being used in a Unity app/project? Something like an SDK or toolkit?

I have such a character that is animated by a motion-capture device, so the user puts on the suit and the Unity character is driven by receiving live motion data. This is the non-verbal part for research in Social Sciences & Psychology.

I tried integrating the Virtual Human Toolkit into my Unity app to use its real-time speech & lip sync & facial gestures, but their character is set up in a complicated way, so I still cannot animate it by using my motion-capture device.

So, now I am thinking what is the next best thing to do with a Unity mecanim character to make it say something, etc...?

sentences:
HLSL Manual Alpha Blending I'm trying to do alpha blending manually because I only want to apply alpha blending on certain pixels. Underlying is the texture I'm writing to. This is what I got so far, but it doesn't give the same result as when AlphaBlendEnable = TRUE

What formula does default alpha blend in HLSL use?

matrix WorldViewProjection;

texture2D OverlyingShadingMap;
sampler2D OverlyingShadingMapSampler = sampler_state
{
    texture = <OverlyingShadingMap>;
};

texture2D UnderlyingShadingMap;
sampler2D UnderlyingShadingMapSampler = sampler_state
{
    texture = <UnderlyingShadingMap>;
};

struct VertexShaderOutput
{
    float4 Position : SV_POSITION;
    float4 Color : COLOR0;
    float2 TextureCoordinates : TEXCOORD0;
};

VertexShaderOutput SpriteVertexShader(float4 position : POSITION0, float4 color : COLOR0, float2 texCoord : TEXCOORD0)
{
    VertexShaderOutput output;
    output.Position = mul(position, WorldViewProjection);
    output.Color = color;
    output.TextureCoordinates = texCoord;
    return output;
}

float4 SpritePixelShader(VertexShaderOutput input) : COLOR
{
    float4 overlying = tex2D(OverlyingShadingMapSampler, input.TextureCoordinates);
    clip(overlying.a - 0.001);
    float4 underlying = tex2D(UnderlyingShadingMapSampler, input.TextureCoordinates);
    // Alphablending
    float3 rgb = overlying.rgb * overlying.a + (1 - overlying.a) * underlying.a * underlying.rgb;
    float alpha = underlying.a + (1 - underlying.a) * overlying.a;
    return float4(rgb, alpha);
}

technique SpriteDrawing
{
    pass P0
    {
        AlphaBlendEnable = FALSE;
        VertexShader = compile vs_2_0 SpriteVertexShader();
        PixelShader = compile ps_2_0 SpritePixelShader();
    }
};

sentences:
How to determine if and when a point and triangle moving uniformly will collide? TLDR; I just learned this problem can be simplified to:  How to determine the time at which a uniformly moving point will intersect with a stationary triangle?  Also, how to figure out the time when the point will exit the triangle?

I have a player with a triangular line of sight ("field of vision" would be more a accurate term here).  I also have an NPC, represented by a point.  Currently I have the server update the client about both their positions only when one of them changes speed or direction of movement.

Without a limited field of vision, I was able to solve this.  How I intend to solve this new problem is as follows:

Each time either the player or NPC changes speed or direction (speed is a boolean at the moment, 1 or 0, and will probably remain that way), figure out if a line drawn from the point NPC to the edge of the game "room" at the angle of it's current direction, is within a triangle consisting of one point at the player's current position, and the other two points at the location they would be if the player were to reach the edge of the room moving at their current angle.
If the above is false, we can ignore the following steps because it means the NPC can't enter the vision field.  But if true, continue.
Figure out at what time the NPC will intersect the player's field of vision.  This, I do not know how to do, but I expect there is some formula I can use instead of checking every tick.
But once I do have this formula, I will use it's return value to set a timer that, when it goes off, will have the server update the client and tell it the location of the NPC.
Then I will have to also figure out at what time the NPC will exit the field of vision, and tell the client to delete or inactivate that NPC.

Does anyone know what mathematical formula I'm looking for?  I need to figure out when a moving point will intersect a moving triangle, when they are both moving uniformly (not changing direction or speed).  Also, the point in time when the point will exit the triangle.

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:
What are the implications of using multiple OpenGL Contexts on a single thread? I'm trying to integrate two third-party OpenGL rendering pipelines into the same application, namely Cinder's OpenGL API for 3D drawing and backbuffer rendering, and Google Skia's API for 2D drawing. Unfortunately, Skia tends to trigger a lot of GL state changes in general use, and offers no functionality to reset the GL state. To make matters worse, Cinder (GLNext branch) tries to keep an internal record of all of its GL state changes so that they can be easily 'unwound', but bad things can happen if its internal representation becomes different from the actual GL state.

The easiest way to alleviate these problems was to create a new OpenGL context for use exclusively by Skia, performing context switches only when 2D updates were necessary. However, I've noticed some weird behaviours when I'm required to switch context more frequently, like certain draw calls failing or blend states flickering. Everything I've read about GL contexts indicates that they're meant for use in multiple threads or multiple windows. I've also read about context switches failing in certain circumstances? Is there anything terribly wrong with switching context in a single-threaded, single-windowed application?

sentences:
[2D] Finding largest possible straight lines around body I've got a 2D-map, largely consisting of rectangular tiles, but with some none-rectangular objects mixed in as well (tilted lines on corners for example).

Take this image as an example:

I now need all the largest possible (straight) lines around the two bodies inside that map. There are no additional required attributes to the lines.

In this image, I've marked the lines that I'm trying to find, each one with a different color to make sure there are no confusions:

It's important however, that the algorithm doesn't produce lines inside those two objects, as it would be a waste of resources.

Are there algorithms suited for that or will I have to research an algorithm myself?

By the way, the algorithm will run at loading-time of the game, so it doesn't need to be optimized for runtime-speed. Also, principally, an algorithm that is just able to find the lines around bodies which consist only of square or rectangular tiles would suffice as well.

sentences:
How does this background scrolling code work? I'm glad that this code does exactly what I wanted it to do...But I can't make sense of it although I wrote it from scratch myself.  What I wanted to do was create an infinitely scrolling background.

What I figured I'd need to do was have it draw the entire background twice so that the second one comes in after the first one, and when the first one gets to the end it starts over behind the second one, and it would loop like this forever.  However, after I wrote the code to make it scroll and tested it, it scrolls infinitely by just having the code draw the background once...

I have the function to draw the background like so...

void drawBackground(int xStart,int yStart,SDL_Rect *clip) {
  int x,y;
  for(y=yStart;y<SCREENH;y=y+TILEH) {
    for(x=xStart;x<SCREENW;x=x+TILEW) {
      drawClip(x,y,background,&clip[45]);
    }
  }
}

And then I use the function like this to scroll the background...

bgX -= 1;
if(bgX==SCREENW) bgX=0;
bgY -= 1;
if(bgY==SCREENH) bgY=0;

drawBackground(bgX, bgY, bgClip);

It works perfectly...I just don't understand what makes it loop around with no gaps.

sentences:
How to make minecraft like world round? I'm interested is there a game or at least example which shows how minecraft-like world turn to sphere?

Idea is that there is sphere which consists from cubes like in minecraft but they are on the surface of it. This have to make that player can go around the world.

Math? Code? Examples?

sentences:
Start timer when button pressed (what is wrong with my code?) I want a timer to start when my rocket takes off and stop when it lands. Stopping works fine (using a collider and state-switching) but I can't get the timer to start when I press the boost button.

Currently the timer text is displayed at the moment I pressed the button but clearly has been counting from the moment the scene started, not the moment the button is pressed.

Any help will be greatly appreciated. If there is a better way to start the timer rather than when I press the boost button then I am open to ideas!

Here is the all relevant code (I think). It appears as though it should be working to me, but it isn't.

// Timer
public Text timerText;
private float startTime;
private bool started = false;
private bool finished = false;

  void Start ()
{
    startTime = Time.time;  // get time since scene started
}

void Update ()
{
    if (currentState == State.Alive)
    {
        ProcessBoostInput();
        ProcessRotationInput();
        ProcessFiringInput();
        if (started)
        {
            RunTimer();
        }
    }

}

    private void ProcessBoostInput()
{
    if (Input.GetKey(KeyCode.A) || (CrossPlatformInputManager.GetButton("Fire1")))
    {
        BoostShip();
        PlayBoostSound();

        if (started != true)
        {
            started = true;
        }

    }

    private void RunTimer()
{
    if (finished)
    {

        return;
    }
    else if (started)
    {
        float timeSinceTimerStart = Time.time - startTime;

        string minutes = ((int)timeSinceTimerStart / 60).ToString();
        string seconds = (timeSinceTimerStart % 60).ToString("f3");

        timerText.text = minutes + ":" + seconds;
    }
}
private void StopTimer()
{
    finished = true;
    timerText.color = Color.green;
}

sentences: PUZZLE MAZE using probability - HOW TO is there an easier way to do this? perhaps a formula?

sentences:
How do I create a CPU read/write buffer in SlimDX (what are the legal combinations of Usage and CPUAccess flags)? Currently, I create a vertex buffer in SlimDX like so:

SlimDX.Direct3D11.BufferDescription Description = new SlimDX.Direct3D11.BufferDescription();

Description.BindFlags = SlimDX.Direct3D11.BindFlags.VertexBuffer;
Description.CpuAccessFlags = SlimDX.Direct3D11.CpuAccessFlags.Write;
Description.OptionFlags = SlimDX.Direct3D11.ResourceOptionFlags.None;
Description.SizeInBytes = _BufferSize;
Description.StructureByteStride = 0;
Description.Usage = SlimDX.Direct3D11.ResourceUsage.Dynamic;

_Buffer = new SlimDX.Direct3D11.Buffer(Parent.Device, Description);

Which I can update:

DataBox box = _Parent.Context.MapSubresource(_Buffer, 0, _BufferSize, SlimDX.Direct3D11.MapMode.WriteDiscard, SlimDX.Direct3D11.MapFlags.None);
box.Data.Position = destStartPosition * _VertexStride;
/* Where T is my vertex structure type */
box.Data.WriteRange<T>(data);
_Parent.Context.UnmapSubresource(_Buffer, 0);

My first question is about the MapSubresource parameter MapMode.WriteDiscard: when the documentation says

  "the previous contents of the resource will be undefined"

, does that mean that if I only update part of the buffer, when it is unmapped the remainder could become anything? Or simply that if I read from the DataStream there is no guarantee what I am reading will be valid?

Second, if I specify MapMode.Write, SlimDX will throw an exception (E_INVALIDARG: An invalid parameter was passed to the returning function (-2147024809)). Why is this? The documentation says that I only need to have a writeable buffer for this to be valid, which I do, because that is the same requirement for WriteDiscard which I can pass successfully.

One last question, if I specify:

Description.CpuAccessFlags = (SlimDX.Direct3D11.CpuAccessFlags.Write | SlimDX.Direct3D11.CpuAccessFlags.Read);
Description.Usage = (SlimDX.Direct3D11.ResourceUsage.Dynamic | SlimDX.Direct3D11.ResourceUsage.Staging);

The same exception is thrown, but this is the only combination of flags I can see that would give me a ReadWrite buffer, how can I create one?

sentences:
How do I implement object picking, using OBB in OpenGL? I am trying to make 3D drawing software. I wanted to have the drag feature so I am using object picking using the OBB algorithm. I am facing problems in understanding the algorithm, and my implementation thus is having bugs.

How do I implement object picking, using OBB in OpenGL? As I am new to OpenGL (free-glut library), a step by step explanation would be helpful.

sentences:
How can I make outline shader like "Life is Strange"? I want to make sketch shader like life strange.

shader has two part:

1.animated dashed line

2.noisy outline

I like to know how can I make noisy outline?

see outline of objects

First I tried to make outline by copying of incoming vertex data and scaled according to normal direction then Cull Back.but I think it's something like Image effect because outline sometimes move inside of object.
anyway I will appreciate if someone help me to Implement this shader :)

What I tried

I used edge detection and animate it by vertex shader but this isn't good like above gifs.

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 Use loop's in cocos2d-x I've for loop which work well on Windows

double speed = 35;

    for(int i=0; i<60 ;i++){

        speed += 0.3;
        Sleep (1000); // sleep 1000 mili seonds

     }

But it responds an error on cocos2d-x.what should i do in cocos2d-x.
In my code i want to increase my speed to N unit every X second.

auto Action = MoveBy::create(3  *   visibleSize.width,Point(-visibleSize.width * speed, 0));

My way is right or should I do something else

sentences:
How 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:
In Unity, why do my animator states wait until the end of each animation to change? I'm trying to make a simple idle-walk transition in Animator using Unity.
I've set a script that changes the Speed value from the Animator, and it works perfectly when I move the character forward when the game is on.

The transitions work well between both animations, except that they don't start automatically after the speed has changed to greater than zero.

I've found out that it waits until the animation loop gets to it's end, which makes the game feel dull and not fluid at all.

I don't think there's an issue with the code, but I'm attaching it anyway:

#pragma strict
var anim : Animator;

function Start () {
    anim = GetComponent("Animator");
}

function Update () {
    var move : float = Input.GetAxis ("Vertical");
    anim.SetFloat("Speed",move);
    transform.Rotate(0,Input.GetAxis("Horizontal"),0);
    transform.Translate(0,0,(Input.GetAxis("Vertical")*Time.deltaTime*move));
}

sentences:
Turning a Java single player game into a multiplayer game I recently built a game with libgdx for my desktop. I would like now to make it a multiplayer game.

How could I do this? I was thinking about using node.js but there are some problems: I use Box2D and other Java libraries to help me making the game simulation and this would be hard to write all over again in Javascript.

The other option would be to write a Java server. Honestly I never used sockets or anything related to networks in Java (I have always been a C++ guy). So, what would you guys recommend? What would be the best option?

Also I would like to consider the performance since Box2D simulations are a bit heavy and with Java I am able to use multi-threading while node.js doesn´t allow me to do that. (I also think Java itself is a bit faster than Javascript).

Just one more note. As I said before I never done anything network related with Java, so if you think Java is the best option could you also recommend some technologies and/or java libraries and/or articles about networking or server creation in Java?

Thanks for your time!

sentences:
Subdived objects in different shapes Currently I'm working on an Android OpenGL 3D game and now I want to implement a collision detection. For this I want to use oriented bounding boxes but here is my problem. For a normal oriented bounding box I have to store the middle and then the length into every dimension. Now let's say I have a tree and of course my character can walk under the treetop but not into the tree trunk. I tried to sketch up the different bounding boxes here:

Tree as two rectangels                         Normal bounding box

-----------------------                   ------------------------------
|                     |                   |                            |
-----------------------                   |                            |
        |     |                           |                            |
        |     |                           |                            |
        |     |                           |                            |
        |     |                           |             x              |
        |     |                           |                            |
        |     |                           |                            |
        |     |                           |                            |
        |     |                           |                            |
        |     |                           |                            |
        -------                           ------------------------------

If you think about the collision detection in the first sketch you can walk under the treetop because the border of the tree is subdivided into different shapes and the outline of a tree is still visible. In the second picture you can't tell something about the outline of the object because you only have one big box around the whole object so you can't walk under the treetop. You see the first method is much better then the second method for my plan.

Now my question: Do you have any ideas how I can subdivide my objects into different shapes? Maybe even in triangles, circles and so on. Is there an algorithm  for this or do I have to do it by myself?

sentences:
LIBGDX: Shoot a bullet using mouse position I want to shoot a bullet towards my mouse position but I think that my math is probably wrong since the position the bullets travel to isn't the right one.
Here's my code
Vector2 bulletDirection = new Vector2(screenX - player.getX(), Gdx.graphics.getHeight() - (player.getY() - screenY)).nor();
bullet.setPosiion(player.getX(), player.getY());
bullet.translate(bulletDirection.x * flightSpeed, bulletDirection.y * flightSpeed);

Can you tell me what I'm doing wrong? The "bullet" object is my current bullet sprite

sentences:
Uncaught TypeError: Cannot read property 'Mesh' of undefined I would like to use dragonBones with pixi.js. I got a problem.

When the following line executes in dragonBones, I am getting an error:

slot.init(slotData, displays, new PIXI.Sprite(), new PIXI.mesh.Mesh(null, null, null, null, PIXI.mesh.Mesh.DRAW_MODES.TRIANGLES));

The error says: Uncaught TypeError: Cannot read property 'Mesh' of undefined.. And yeah, while debugging, I noticed that PIXI.mesh is really undefined.

What can I undertake against the error?

I am using this file for a dragonbones.

May it be that the problem is in the fact that I am using pixi.js - v4.5.6?

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:
How do I best solve multiple component modifications via a single event? I'm trying to solve multiple component modifications via a single event. Is there a better way of handling this?

I have an a label entity that cares about when a shield entity's hitpoints component is modified (damage, regeneration, etc).

The label will need to change

its text to display the current % of shield remaining.
its text color to display the severity of shield remaining.

When my ShieldSystem resolves the hitPoints component, the below code runs. For eah type of modification I plan to listen for, I need to add a new if-statement to the for-loop. This means I have a bunch of duplicated code between systems if more than one wants to modify any listening text component, sprite component, etc.

for(int i =0; i < listeners.size(); i++)
{
    if(listeners.count(MessageType::CHANGE_TEXT) == 1)
    {
        std::vector<Entity*> entities =  listeners[MessageType::CHANGE_TEXT];
        for(int j; j < entities.size(); j++)
        {
            Entity* e = entities[j];
            MessageInfo* messageInfo = new MessageInfo(MessageType::CHANGE_TEXT, e, "Some Text");
            MessageCenter::Dispatch(messageInfo);
        }
    }

    // Add an If(listeners.count(MessageType::CHANGE_TEXT_COLOR)...

    // Add an If(listeners.count(MessageType::CHANGE_SPRITE_RECT)...

    // etc

}

sentences:
Unity reflections going white with camera movement Please refer to this video to understand the issue I am facing.

With camera movement, there is a strong white reflection that appears over the complete model. What settings do I need to change to fix this ?

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:
Cloning a Game - Dev diary while using original assets I'm currently cloning a game and still using the sound and graphic assets of the original.

I know that I may not distribute those assets but what about publishing a video of my progress as part of a dev diary, is that allowed?

Thanks.

sentences:
What behaviors should go into making a "non-perfect" AI combatant? When making an npc combatant, it's easy obvious what to do to get a robot deathmachine by optimizing combat tactics, timing and attack types, but harder (and more interesting in a fight) to get an idiosyncratic, inpredictable enemy.  What behaviors (algorithms?) are useful for creating a more organic, unconventional enemy?

Edit: My specific use case is with MMO-like enemies, e.g. World of Warcraft, although with less graphics involved.  Note that that means both human and inhuman enemies (animals, monsters, etc)

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:
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: how can you use playerprefs to save an array in javascript on unity As I stated I can't find a working answer anywhere else. I have a game where you are to draw out your own weapon and I'm storing that information in an array. How?

sentences:
What rotation needs to be applied to align mesh with expected axis of target? I'm using LWJGL and JOML to create a 3D view of hexagons whose positions lie on a torus.
I have a number (NxM) hexagons, whose centres and normals I have calculated to be placed on the torus to completely cover the torus surface, but in the "game" engine I'm using I need to convert each item being rendered to a position and 3 rotation angles. I'm struggling to go from the 3 normals of the item to the 3 angles.
EDIT: Subsequent to posting this I have got some way in creating a matrix with the angles and converting to Euler angles, everything is now turned according to those angles, but they aren't facing directions I expect.
The background
I'm trying to create a visualisation of a Conway Game of Life using hexagons but instead of a simple plane, mapping each hexagon onto a Torus.
I've done the maths to calculate the centres of every hexagon, and the 3 direction unit vectors that they need to point to, when in their places around the torus.
For illustrative purposes, here's a view of the torus and 2 hexagons that would lie on it (not real, this is just me mocking it up in Blender)

What I'm struggling to understand is how to rotate the single mesh for a hexagon to its calculated normals at the position I want to place it.
i.e. How do I rotate some "unit" hexagon mesh (loaded from an OBJ file exported from Blender) to point in the direction of the 3 normals I've calculated they should be for each hexagon around the torus.
I have read a similar question here, but I'm struggling to get from the idea of the 4d rotation matrix to how I convert that to a Vector3f for rotations. I have the 3 vector normals, could create the 4d matrix, but I need a Vector3f (the rotations about x/y/z) to the mesh is drawn correctly.
My code is here. I'm following this guide for using LWJGL to create GameItems (my hexagons) and position/rotate them from a loaded obj file mesh, but as I say, I'm struggling to calculate the rotation Vector3f needed to point in the same direction I've calculated.
Here's the code section relevant to the problem at hand:
    val mesh = loadMesh("/conwayhex/models/simple-hexagon.obj")

    hexGrid.hexAxes().forEach { (location, axis) ->
        // axis is a Matrix3f with my 3 normals at the centre of the hexagon, e.g
        // cX  cY  cZ
        //  0  -1   0
        //  0   0  -1
        //  1   0   0

        val gameItem = GameItem(mesh)
        gameItem.position = location
        gameItem.scale = 0.2f // TODO: calculate this according to the torus size

        // what rotation do I give this?
        // How do I calculate it from the given axis for the current item?
        gameItem.rotation = Vector3f(30f, 30f, 30f)

        gameItems += gameItem
    }

The output of the application given the above static 30 degree rotation is:

Can anyone help me unserstand how I apply the rotation to my items so they align to what I've calculated they should be?

sentences:
Unity - Setting a sprite animation idle to a specific frame and transition smoothly I'm new to Unity. I have built an animation with a 2d spritesheet and now I want to transition between idle and walking.

Idle is my frame 1 (or any other frame) and the whole spritesheet animation is running.

When I create the animatorcontroller, I'd set idle as no animation and walking as the animation from the spritesheet, I then assign conditions as paramenter, but when a paramente change, the transition is not smooth, it skips back to the first frame.

How can I make a transition that would, when stopping, continue to animate until the idle frame has been reached, and then stop?

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:
Pathing for pipe style layout I've been trying to think of ways to approach doing a pipe style game like the one pictured below, but am coming up short.
The pic is from Star Trek Elite Force 2, the hacking minigame part. I've never played the game, but found this particular part via a search.

The player must click on to turn each pipe section and get a path between the blue nodes, while not connecting to any red nodes.
I assumed the way to create the pipe route is to begin from the end node and generate a path towards the starting node, then obscure the path with branches. But on trying this, the path is very obvious (pic added below), so I'm looking for other ideas.
Does anyone have any pointers to set me in the right direction?

sentences:
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:
Game Programming in java I'm new to this site as well as new in game development, so I need to get a great start for it. Can anybody tell me from where I should start and some books or link are appreciable.
What are the prerequisites to start game programming in java?
I already knows the concepts of java.

sentences: D3D11 SkyDome with texture Has anyone some code about a skydome mesh with a texture and a shader? Or even know how can I create a skydome mesh in Direct3D11? I wanted give an idea from https://ifun01.com/R8CTFZQ.html but it needs the md3 skydome mesh and without a sky texture. So I still think.

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:
Why does this game loop stop my process from responding? I implemented a fixed time step loop for my C# game. All it does at the moment is make a square bounce around the screen. The problem I'm having is that when I execute the program, I can't close it from the window's close button and the cursor is stuck on the "busy" icon. I have to go into Visual Studio and stop the program manually.

Here's the loop at the moment:

public void run()
    {
        int updates = 0;
        int frames = 0;
        double msPerTick = 1000.0 / 60.0;
        double threshhold = 0;
        long lastTime = getCurrentTime();
        long lastTimer = getCurrentTime();

        while (true)
        {
            long currTime = getCurrentTime();
            threshhold += (currTime - lastTime) / msPerTick;
            lastTime = currTime;

            while (threshhold >= 1)
            {
                update();
                updates++;
                threshhold -= 1;
            }

            this.Refresh();
            frames++;

            if ((getCurrentTime() - lastTimer) >= 1000)
            {
                this.Text = updates + " updates and " + frames + " frames per second";
                updates = 0;
                frames = 0;
                lastTimer += 1000;
            }
        }
    }

Why is this happening?

sentences:
My mesh has holes in it. How do I make those invisible faces show? I have a mesh. A perfectly normal mesh, without any artefacts at all.

However, when I import it into Unity, there are holes in it.

After going through my UV mapping and normals, they are all mapped, have no faces with the normals going the wrong way (facing inwards) and have non-transparent textures over each mapped UV face.

Oddly enough, this mesh hasn't been split, despite its poly count and is one whole object, but yet - It has missing polygons. Is there any way to get Unity to recognise these faces?

Also, it is worth noting that these holes happen to be all the tris faces on this model, and are all (mostly) along the UV seames.

Question

How do I make the invisible faces show? What's going on?

sentences:
Having trouble setting color in fragment shader For some reason, the color isn't applying to the object. Here's my fragment shader code. There's probably something obvious wrong with it that i'm not seeing.

#version 330 core
out vec3 Color;

uniform int InColor;

void main()
{
        Color = vec3(float(127 / 255), 0, 0);
}

sentences:
Minimal Inform6 code to support  syntax Without using any of the standard Inform libraries, what is the minimal amount of code / infrastructure needed to support the <action> syntax?

What I tried is

Verb 'foo' * -> Foo;

[ FooSub;
    "Hello from FooSub";
];

[ Main;
  <foo>;
];

I expected this to print Hello from FooSub when run; however, the output I get is

Action <0 0 0>

sentences:
Unity only rendering certian parts of 3d building model from certian angles So I made a couple modular building sections in blender, modular in the sense that I can insert build a floor at a time. I transferred them into Unity and then I got a rendering error that  I have gotten many times before. I will put the object in the game world and then certain chunks of the building will only be visible from on direction and the other it will be completely invisible. I have been having trouble with this bug for a long time and I really would like if someone could point out what's causing this problem. I will include pictures below to help show my problem.

Thanks, Nova

sentences:
Could frame interpolation like used by SmoothVideo Project be an option to increase the framerate of games without as big a performance hit? The SmoothVideo Project uses frame interpolation to increase the fps of video from 24 to 60. The results are pretty impressive. I was wondering if this could be applied to, and whether it would look good in video games?

It uses much less resources than rendering all the frames so would allow lower end rigs to render at the quality of much better rigs at some level of compromise. I know it won't be as accurate, and would slightly increase input latency as it needs to hold on to the newest frame to be able to generate and insert the interpolated one. It's not as bad as a full frame though, by my reasoning only the lag would be the interpolation time plus half the original fps refresh time. So for 30 fps it would be 33ms/2 + interpolation time.

Maybe this lag would make it unsuitable for fast past first person games, but I doubt it would be a hindrance in slower paced games.

The lag becomes lower at higher start rates, so I would think it would be certainly worth it when going from 60fps to 100+fps which improves the experience though increasingly marginally, while being extreme taxing on the system.

sentences: 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: UNITY: How do I use SetTile() with a tile asset/ scriptable tile? How do I use Tilemap.SetTile() with a tile asset? I want to use it for scriptable tiles in the 2d-extras package, such as rule tiles, weighted random tiles, and animated tiles. How would I 1. get inspector reference of this scriptable tile, and then 2. use SetTile() with it? Thanks for your attention.

sentences:
How to calculate “real” distance between cursor and distant object? I don't really know how to formulate the title, but the problem is the following:

I'm using a scripting language called "SQF" which has been created by a company named "Bohemia Interactive" (no, I do not work for them) and it's for modding their games. So I won't fill up these lines with code. If somebody else knows it and wants to see, comment and I'll add what I've tried so far.

The issue anyway is rather abstract, so I'm going to explain it with an archer and his target. Ratios may not be correct as they are only for explanation.

Say I (as the player) am the archer (first person), the target is 10m away, has a diameter of 2m and appears 200px in diameter on the screen. Now I aim 50px left of the target edge, execute my desired function and and get the info that this is 1m away from the target (2m from its center).

Now, I move 90m back, so the target is 100m away and appears 100px in diameter (don't know if that's correct, but you get the idea). Now I am aiming 25px left of the target and again, execute my desired function and it should tell me again that the distance is 1m.

Now, the "real" distance was 1m in both cases, but on my screen it was 50px at the first aim and 25px at the second.

So, what I am looking for is a (mathematical/programmatical) model to get the "real" distance between the target and where I aimed, no matter how far away I was from the target. I do have the positions of both archer and target in 3D coordinates. Though SQF is a very special language, it does provides a function to calculate the distance in meters and to dertermine certain geometrical values:

https://community.bistudio.com/wiki/Category:Command_Group:_Math

... so there's no need for that.

I know, this is very abstract, but I am hoping, somebody could give a hint or knows a mathematical procedure to do that.

If somebody knows how to do it in C, C++ or Java, I can write these languages, so that would be great!

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:
Character movement on a 2D tile map I'm working at making a HTML5 game. Top down, closest thing I can equate it to is the gameboy zeldas, but open world and no rooms.

What I have so far is a procedurally generated map in a multi dimensional array. And a starting position on the map. Along with this I have an array of movable and non movable tile ID's.

I also have a class for my player and have him being rendered out in the center of the starting tile.

My problem however is getting the movement sorted out for the player. I want to be able to have the character free move around the map (pixel by pixel essentially) ontop of this 2D generated world. Ideally this would allow the user to move around the walk able area of the canvas. this is simple enough for me to do, but I am having problems now moving the world.

If the user is 20% from the edge of the screen i want the world to start panning in the direction the player is heading. But I'm rather lacking in ideas of how to do this.

I've looked around for some tutorials, but am coming up blank on ideas of how to generate the playable area (zoomed in) and to then move this generated area under the player when they reach near the end of the screen.

My current idea was to generate a certain amount of tiles full size to fill the screen and place the player i the middle. Then when the user approaches the edge of the screen start generating the tiles offset by the distance moved and the direction. I can kind of see this working but I really have no idea if this is the best or easiest to code of methods for generating the world.

sorry for the lack of code but I'm still just in the theory stages of working this all out.

sentences:
Is it okay to copy a game's formula? (damage, etc) Is it okay to copy a game's formula? Formulas like damage formulas, taking the stats STR, DEX, INT, critical rate, etc. into account. Specifically I want to copy Ragnarok Online's damage calculation. But I will probably remove some stuff from the formula to reduce the scope of my game.

  Your question has been identified as a possible duplicate of another question.

I think game formulas and the like are different from game mechanics. Game mechanics is how the game is played.

sentences:
How should I calculate the score in Minesweeper: 3BV or 3BV/s? I'm designing a minesweeper game, and I'm a bit confused as to how to calculate the score.

The objective of my game is to reveal all the non-flagged boxes. Marking the flag must not count toward the score. Just showing the number of seconds required to complete a board seems obsolete as I have a variable board size which is decided by the user. I studied the Wikipedia page on Minesweeper regarding the two scoring techniques.

But I don't understand how to calculate the 3BV. Is it just the number of left clicks done by user done during the game, or is the 3BV the minimum number of clicks required to complete the board? Also how can 3BV/s be judged: does a higher or lower score give a higher ranking?

Regarding my implementation

I used an integer array with all zeros and 9 designating a mine position. When a user click in the grid I calculate the nearby cells and then display the appropriate number and if he clicks on cell with value 9 then game is over.

sentences:
which quarter of a triangle the point is in I've got a world made out of squares. The square are devided in four triangles like this:

The corners have their heights stored in a 2D array and the center height is the average of the corners. To calculate the players Y-coordinate I have to know in which triangle he is standing on. How can you calculate in which quarter the player is by the X and Y coordinates?

EDIT:

My algorithm:

bool h1 = false, h2 = false;

if(posZ < posX - posZ) //something weird going on here
{
    h1 = true;
}
if(posX < posZ - posX) // and here
{
    h2 = true;
}
if(h1 && h2)
{
    triangle = 0;
}
if(h1 && !h2)
{
    triangle = 1;
}
if(!h1 && !h2)
{
    triangle = 2;
}
if(!h1 && h2)
{
    triangle = 3;
}

This algorithm tries to find in which triangle you are. There is something wrong in that math.

sentences:
How 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:
DXGI and 2+ full screen displays on Windows 7 I am developing a program that needs two full screen Direct3D dispalys. According to the documentation I should create the swap chains in windowed mode and then switch to full screen mode. While this works fine on Windows 8 (currently I'm just using Alt-Enter to do the switch), it does not work on Windows 7. On Windows 7 I get a problem similar to this issue where the screen that has most recently been switched to full screen works fine, but the other screen, which was previously working just fine in full screen, goes black (and stays at the same full screen resolution) until I take it out of full screen.

You can find my mess of a rough prototype at this tag: github.com/AllenPestaluky/InputLagTimer/tree/DXGI

Apparently there have been other bugs relating specifically to Windows 7 in the past... But I appear to be getting an issue that is slightly different: scalibq.wordpress.com/2012/05/25/the-story-of-multi-monitor-rendering/

Also, I have tried disabling DWM Composition like suggested in the linked question, but that did not do anything to resolve the problem..

Please let me know if there's any more information I can provide about the issue... I guess worst case scenario is I simply fall back on DX9 which apparently works fine for multi-monitor full screen setup...

sentences:
UI Text Won't Change Color in Unity 5 In Unity 5 on Windows 10, I try to change the text color from the Inspector and in scripts, but the color won't change. Here are some screenshots of my Text objects open in the inspector, with there colors set to red and white, but staying the default black in the Scene and Game windows:

Here are the lines of code I am using to change the color

var textColor = beatBestTime ? "#FF0" : "FFF";

scoreText.text = "Time " + FormatTime (timeElapsed) + "\n<color="+textColor+">Best " + FormatTime (bestTime)+"</color>";

which I can verify are being run, but the color remains the same!

sentences:
Wrong behavior when trying to move on air I´m using Andengine and jBox2D to implement a Mario-like platform videogame. Jumping and moving works fine. The problem comes in a very specific case:

I keep the "Move left" button pressed all the time
Player is on air and when moving left, it hits a wall and it stops moving left (while it keeps falling) This is correct.
When the player passes the wall, if the "Move left" button is pressed, it should start moving left while falling but it doesn't. If I lift my finger and press "Move left" again, it works.

The code to move left/right is:

_playerBody.setLinearVelocity(-mLinearVelocityX, _playerBody.getLinearVelocity().y);

The jump code is:

_playerBody.applyLinearImpulse(0, -mImpulseY, _playerBody.getPosition().x, // /////JUMP
            _playerBody.getPosition().y);

This is the code for the hud:

Sprite left = new Sprite(-10, CAMERA_HEIGHT - 150, mLeftTextureRegion) {
    @Override
        public boolean onAreaTouched(TouchEvent pEvent, float pX, float pY) {

            if (!pEvent.isActionOutside() && !isDead && !isPaused) {
                movePlayerLeft(player_self_sprite, player_self_body);
            }

            if (pEvent.isActionUp())  {
                if (isPlayerMoving) {
                    stopPlayer(player_self_sprite, player_self_body);
                    isPlayerMoving = false;
                }
            }
            return true;
        }
    };

sentences:
Unity 2D C# Enemy Attackng Ai issue Ok to be specific, both of my enemies will continuously play their attack animation even when it is false. I don't understand what I am doing wrong here :(

void OnTriggerEnter2D(Collider2D other){
    //If attack collider is player and we're not attacking
    if (other.name == "Player" && !attacking) {
        attacking = true;
        attackTimer = attackCD;
    }
    if (attacking)
    {
        if (attackTimer > 0)
        {
            Debug.Log ("Decreasing");
            attackTimer -= Time.deltaTime;
        }else if (attackTimer == 0)
          {
            attacking = false;
            Debug.Log ("Done attacking!");
            //attackTimer = attackCD;
          }
    }
}

anim.SetBool ("Attack", attacking);//This sets the animation but it is in my Update function not my OnTriggerEnter2D function

sentences:
How can I manipulate a static 2D sprite so that it looks alive? I've got a stick figure in the corner of my UI, but I don't like the way he's just standing there, without moving. I'm stuck without additional frames of animation, so my only recourse is the manually move the sprite up and down, left to right, rotation, or whatever else you can think of. Basically I can do everything besides drawing another sprite of animation.

I've tried things like have it subtly bounce or rotate a bit to give it a little bit of dynamism, but I don't believe its the best approach.

I've got a static sprite of a stick figure, how do I give it a bit of life?

sentences:
Best way to handle realtime melee AI in authoritative network environment So i've been working on a multiplayer game for a bit; it's a co-op action RPG with real-time combat. If you've seen or played TERA, I'd say it's comparable to that, but not an MMO, heh.
I'm currently handling the AI units authoritatively, the server calculates their pathing, movement, and pursue/attack logic, and syncs the movement to the clients 15x per second, and the state changes when they happen.

When I emulate 200ms ping, though, the client can perceive being out of range to an AI's attack, but still take the hit, because on the server he hadn't moved that far yet. This also plays hell with my real-time blocking.

I don't really want to allow the clients to be allowed to say "that was out of range" or "I blocked that", but I'm not really sure how else to handle it.

sentences:
Monogame - All effects in one file? I am successfully drawing all of my geometry with an AlphaTestEffect and would like to apply shaders. I've built a shader Effect from a tutorial and can't seem to find anything on the web that answers my question:

Does monogame support passing separate effects with the same geometry to the Graphics Device, or do you have to perform all Techniques you intend to apply to a model in the same effect?

sentences:
OpenGL's matrix stack vs Hand multiplying Which is more efficient using OpenGL's transformation stack or applying the transformations by hand.

I've often heard that you should minimize the number of state transitions in your graphics pipeline.  Pushing and popping translation matrices seem like a big change.  However, I wonder if the graphics card might be able to more than make up for pipeline hiccup by using its parallel execution hardware to bulk multiply the vertices.

My specific case.  I have font rendered to a sprite sheet.  The coordinates of each character or a string are calculated and added to a vertex buffer.  Now I need to move that string.  Would it be better to iterate through the vertex buffer and adjust each of the vertices by hand or temporarily push a new translation matrix?

sentences:
How to tween to move an object in arc? Okay, so I think I need to use a tween in order to move an object in my game.  I have some little green dudes that need to move in an arc (bezier) to a location that is clicked by the user.  My game functions by having the mouse point raycast to the screen giving my character a position to move to.  They don't just run though,  they fire off their jetpacks and should travel in an arc to the target position.  I'm pretty new to Unity but all I can come up with is using a tween to do this.  Am I missing something?   That being said,  I'm totally confused on what a tween actually is.  I can't wrap my head around how the object can be moved outside of an update function.  I'm using the "free from the asset store" LeanTween package.  I feel like there should be some sort of easier way to achieve the desired behavior.

How can I have my character move from Vector3 A to Vector3 B in an arc?

sentences:
Firing attack and take_damage events on entity attacking? I have an Entity class with health, armor, and damage.
I want my entities to raise some kind of take_damage and attack events whenever they attack or take damage. Here's my current implementation:

class Entity:

   """Base class for all entities."""

    def __init__(self, name, health, armor=0, damage=0):
        """Initializes a new entity."""
        self.name = name
        self.base_health = health
        self.base_armor = armor
        self.base_damage = damage
        self.events = event_dict('take_damage', 'die', 'attack', 'kill')

    def take_damage(self, damage, attacker=None):
        """Takes damage from a source."""
        final_damage = damage * (self.armor / (100 + self.armor))
        self.base_health -= final_damage
        self.events['take_damage'].fire(
            attacker=attacker,
            victim=self,
            damage=final_damage,
            raw_damage=damage
        )
        if self.base_health <= 0:
            self.events['die'].fire(
                attacker=attacker,
                victim=self
            )
        return final_damage

    def attack(self, victim):
        """Attacks a victim."""
        final_damage = victim.take_damage(self.damage)
        self.events['attack'].fire(
            attacker=self,
            victim=victim,
            damage=final_damage,
            raw_damage=self.damage
        )
        if not victim.alive:
            self.events['kill'].fire(
                attacker=self,
                victim=victim
            )

    @property
    def health(self):
        """Getter for entity's health."""
        return self.base_health

    @property
    def armor(self):
        """Getter for entity's armor."""
        return self.base_armor

    @property
    def alive(self):
        """Getter for entity's alive state."""
        return self.base_health <= 0

    @property
    def damage(self):
        """Getter for entity's damage."""
        return self.base_damage

First of all, I'm really new to game developing, so any improvements would be nice.
The problem I'm having is that I'm "forced" to return a value from the take_damage() method, in order to include the actual damage in attack()'s event arguments. Would there be any fix for this?

sentences:
Unity Build not working because resources.assets is over 10GB in size. I made a application where a bunch of images are loaded and placed in 3d. The total amount of images in the asset folder are about 10.000 images. Only 1100 random of these images get actually used in the application. This is different eachtime on startup. The total size of the Assets folder is 3.2GB.

See the Image below for confirmation:

Now when i build the application the application wont display any of the images in 3D space... :( So i went to investigate, and i found out that my resources.assets file is over 10GB in SIZE!! And i found out that unity cant really handle a resources.assets file more then 4GB. See the proof below:

So i have no idea what happens here or what to do about it.. All suggestions are welcome!
If more explaination or details are needed let me know.

Edit:
Maybe the image import settings are useful to know.. I just used the default settings.. See image below:

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:
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:
How to find intersections using MapBox Unity SDK I'm currently using MapBox's Untiy SDK, which allows me to render 3D Buildings and roads. I want to place a gameobject at each intersection in an area. But, I'm having trouble finding a good way to do that.
The roads are gameobjects attached to a "Tile" gameobect. The roads have a local position 0,0,0 with meshes on them that dictate their rendered position. A long road can cross multiple tiles, and thus the same "road" may exist as two or more gameobjects on two or more tiles. The Mesh itself is rectangular prism extruded from some line data by Mapbox.
I have tried to use colliders with no success. For one, in order to get points of intersections between two colliders, they need to have rigidbodies attached to them and it's too expensive to do that, since there are hundreds of roads. Furthermore, many of the meshes have bad verts in them, which wont allow mesh colliders to work anyway, and box colliders wont work for non-straight roads. Some road meshes are sprawling, twisting, and winding and could "collide" with a number of roads without actually touching them.
I am not above brute force looping through every mesh's vertex in every tile to detect intersections, but I am as of yet unsure of the best way to do this or if it is necessary.
I am also not sure if MapBox has some hidden feature for this the way Google Maps Unity SDK allows for access to the road lattice and intersections. If I could get some info about the line that represents the road, it would be easy to tell if roads overlap.
The best way I can figure is to loop through the verts on a road to determine if the lines between verts overlap that of the roads within the same time, but am not sure if that is the best course of action

sentences:
What is the difference between sprites and tiles? I'm making a game, where it came to adding a tile class, but i already have a sprite one, which does the same at first glance.
Can you explain the difference with a couple of examples?

sentences: What applications can I use to generate music? In my cocos2d iPhone app I wanted to have in game music. But I don't want to use garageband! It is just dragging prewritten loops. I wanted to compose the music for my game. Is there software that I can use to write music, such as techno music? Not taking songs that were made by someone else and adding effects.

sentences:
Error on MonoGame Content Pipeline: Texture Importer Error I just encountered this kind of error when using the MonoGame Content Pipeline and it's my first time to use it to convert png to xnb files (I use a stand alone app for converting files to xnb in the past). I've done building spritefonts to xnb files and stuff like that in my previous MonoGame projects and I thought it would be similar but it turned out to be not the case.

So this is the error I have:

error: Importer 'TextureImporter' had unexpected failure!
System.NullReferenceException: Object reference not set to an instance of an object
  at Microsoft.Xna.Framework.Content.Pipeline.TextureImporter.Import (System.String filename, Microsoft.Xna.Framework.Content.Pipeline.ContentImporterContext context) [0x00000] in <filename unknown>:0
  at Microsoft.Xna.Framework.Content.Pipeline.ContentImporter`1[Microsoft.Xna.Framework.Content.Pipeline.Graphics.TextureContent].Microsoft.Xna.Framework.Content.Pipeline.IContentImporter.Import (System.String filename, Microsoft.Xna.Framework.Content.Pipeline.ContentImporterContext context) [0x00000] in <filename unknown>:0
  at MonoGame.Framework.Content.Pipeline.Builder.PipelineManager.ProcessContent (MonoGame.Framework.Content.Pipeline.Builder.PipelineBuildEvent pipelineEvent) [0x00000] in <filename unknown>:0

Is there a way to resolve this? Is there a tutorial of some kind I can follow to use the TextureImporter and the things I haven't yet understood on MonoGame's Content Pipeline with in-depth explanation about it?

sentences:
Colouring greyscale images/sprites for HTML canvas What is the best method to colour in sprites at runtime using the canvas element and javascript? I know there are various blending modes using globalCompositeOperation, but I don't know how best to utilise this.

I'll break my question down into the following:

Is there an optimum way to export greyscale images so they can be easily re-coloured later? (At the moment, the images are created with colour in Photoshop or a similar package and then turned into a greyscale and exported from there before I even touch them)
With these greyscale images in place, what method makes colouring them with any colour possible? (They must retain the shading etc)

I've tagged this with HTML5 and Javascript, but any advise from other platforms would be helpful.

Edit: Here's an example greyscale output of the image on the left. I want to be able to restore it to the same colour, but also be able to blend it with other colours for different shades of skin.

sentences:
Why is my game object generated by a custom Unity editor script missing its sprite? I have a number of sprites that I generate outside of Unity.  I'd like to automate the process of importing these sprites into Unity as fully-configured game objects.  I'm trying to do this through a Unity editor script, but I'm having some difficulty.  When I run my script, my game object is saved as a .prefab as expected.  However, the Sprite I'm assigning to my game object's SpriteRenderer component is missing:

In my script, I'm assigning my SpriteRenderer's sprite property to a Sprite object that I dynamically create in the script.  Here's the relevant excerpt from my editor script:

GameObject gameObject = new GameObject(fileName);

SpriteRenderer spriteRenderer = gameObject.AddComponent<SpriteRenderer>();

// texture size will be replaced during the LoadImage() call
Texture2D texture = new Texture2D(1, 1);
texture.LoadImage(File.ReadAllBytes(Path.Combine(generatedOutputPath, fileName + ".png")));

spriteRenderer.sprite = Sprite.Create(
    texture,
    new Rect(0.0f, 0.0f, texture.width, texture.height),
    new Vector2(0.0f, 0.0f)
);

PrefabUtility.CreatePrefab("Assets/Prefabs/" + fileName + ".prefab", gameObject);
DestroyImmediate(gameObject);

I can verify through logging that the image path to my .png is correct and that the Texture2D and Sprite objects seem to be instantiated correctly.  For example, I can do this:

// logs "580" as expected
Debug.Log(texture.width);

What am I doing wrong?  How can I save this game object as a .prefab without losing its sprite information?

sentences:
try to create CCSpriteFrame but get nil values I'm trying to animate a CCSprite in cocos2d v3 following this question, but I'm getting the following error message in Log:

    Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM
 insertObject:atIndex:]: object cannot be nil'

This is my code:

NSMutableArray *animationFrames = [NSMutableArray array];
    int frameCount = 0;
    for(int i = 1; i <= 9; ++i)
    {
        CCSpriteFrame *spriteFrame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName: [NSString stringWithFormat:@"hero-%d.png", i]];

            [animationFrames addObject:spriteFrame]; //ERROR OCCUR THIS LINE

        frameCount++;
        if (frameCount == 8) break;
    }

The problem is that all spriteFrames are nil, but I don't why. I already tested the i values with NSLog, and also tried to add hero-1.png to a CCSprite object and works fine. I also tried to add all fixed hero-1.png in all frames to verify if the problem was with i variable. But didn't work also.

sentences: Any open source game engines for Android? Is there any open source android gaming engine ?

sentences:
"Running" against a steep slope on a Box2D Platformer Ive seen alot of pages talking about how to emulate a platformer on Box2D, specially about how people dont want to slide down a slope. Well, my problem is different and Im surprised I cant find posts/solutions about it.

The problem happens when I have a very steep slope and I run against it. This is what happens:

Being the square a common platformer hero fixture, since in a Box2D platformer the movement is based on applying impulses or setting the velocity, what happens when I "move" torwards such a slope, its like im pushing against it, which creates a vertical force and therefore the square moves UP (specially since friction is 0 to avoid the "sticking to a wall" thing).

I've solved most of Box2D's non-platformer-proficient issues. This one seems unsolveable.

So, how do I avoid my object to go up a steep slope when pushed against it, and instead slide down since its too steep to be climbed?

sentences:
Problem with handling key input C# I am attempting to make a game in C# in windows forms, and need for the character to react to key input. I have implemented a very basic code which changes the position of a picture box on key pressed, and then displays the picture box in a new position:

    public Form1()
    {
        InitializeComponent();

        KeyDown += new KeyEventHandler(keyDown);
    }
    void keyDown(object sender, KeyEventArgs e)
    {
        int x = SpriteCharacter.Location.X;
        int y = SpriteCharacter.Location.Y;

        if (e.KeyCode == Keys.Right) x += 1;
        else if (e.KeyCode == Keys.Left) x -= 1;
        else if (e.KeyCode == Keys.Up) y -= 1;
        else if (e.KeyCode == Keys.Down) y += 1;
        else if (e.KeyCode == Keys.Escape) Close();

        SpriteCharacter.Location = new Point(x, y);
    }

The problem you can probably immediately spot is that this script cannot handle user input if two keys are pressed at the same time. E.g. if you press right and down, the character will not move diagonally, but will either go right or down, depending on which key was pressed last.

What would be a more advanced way to handle key input, to make something like this possible? Is these anything I could read up on?

sentences:
How can I add an in-game level editor? I have 200 prefabs and a scene with an infinite flat plane.

I want to allow user to edit the scene - add, remove, rotate, place that prefabs and save/load resulting "scene" in some custom format.

How can I implement this?

sentences:
Is there a way to read unity console outside of unity? my unity  project keeps crashing and it does not let me read the exception error, I am wondering if there is a way to read the unity console externally outside of unity. Any pointers will be highly appreciated.
Thanks

sentences:
How a "Collision System" should be implemented? My game is written using a entity system approach using Artemis Framework. Right know my collision detection is called from the Movement System but i'm wondering if it's a proper way to do collision detection using such an approach.

Right know i'm thinking of a new system dedicated to collision detection that would proceed all the solid entities to check if they are in collision with another one.

I'm wondering if it's a correct way to handle collision detection with an entity system approach? Also, how should i implement this collision system?

I though of an IntervalEntitySystem that would check every 200ms (this value is chosen regarding the Artemis documentation) if some entities are colliding.

protected void processEntities(ImmutableBag<Entity> ib) {
    for (int i = 0; i < ib.size(); i++) {
        Entity e = ib.get(i);
        //check of collision with other entities here
     }
}

sentences:
TBN Matrix : Eye vs. World Space Conflict I am tired of misleading and insufficient articles making me more confused each time I read, I need a clarification that will solve my TBN matrix problem forever.

Each article I read informs me differently about from which space TBN matrix converts to tangent space. One article says that it converts from eye space, other one says that it converts from world space  to tangent space.

As far as I know, world space is ModelMatrix * vertex, eye space is ViewMatrix * ModelMatrix * vertex. Another article says that transpose of TBN Matrix actually does it.

Can you please explain me how to use TBN matrix, does it (or transposed tbn) convert from eye or world to tangent ? Should I convert my lighting vectors from eye space to world and then apply TBN on them ?

sentences:
Unreal Engine 4 - Error in Macro Syntax Causes Build to Hang Problem
Errors in macro syntax causes the module's build to hang for 2+ hours (possibly, indefinitely) with no indication of a build error.
Steps to Reproduce

Create a template game project in the editor.
Introduce the following macro into some C++ code:

UE_LOG(LogTemp, WrongVerbosityTypeHere, TEXT("Some Text Here"));

Trigger a module-only build e.g. right-click project > Build.

Look for the following in the build output:

1>Using Visual Studio 2019 14.28.29335 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333) and Windows 10.0.18362.0 SDK (C:\Program Files (x86)\Windows Kits\10).
1>Building 4 actions with 32 processes...

The message should stay the same for 2+ hours. So wait for that long or until you feel something is wrong...

Remove or correct the macro usage with something like the following:

UE_LOG(LogTemp, Log, TEXT("Some Text Here"));

Trigger module-only build.

Build completes in seconds.

Development Environment

Windows 10 (Version 10.0.19042 Build 19042)
Visual Studio Community 2019 (Version 16.8.3)
Unread Editor 4.26 (Version 4.26.0-0+++UE4+Release-4.26)

Questions

Is this a known bug?
If not, is there a configuration in UBT via Visual Studio or in the terminal to report errors quickly?

Cross Postings
Unreal Engine Forums

sentences:
Protecting the integrity of a game state while minimizing amount of data sent I'm developing a multiplayer game in PHP/jQuery, and naturally have to be wary of any sort of data coming from the client.

At present, I have tables of data representing the map (2D roguelike), monsters, items, and player(s).  Initially, my thought was to simply package it all in a JSON object and send it every game tick, however when actually looking at the data I realized that's quite a large packet to be sending.

So, my question is what is a good approach for minimizing data sent to the client?  Obviously I would need to figure out some way of validating whatever it sends back.  Initially we'd hoped to do some minimal verification on the client-side, but each time we thought of one thing we could do it is immediately invalidated with tools like Firebug.

Kind of an open question I realize, but we want to get this right before we move on with our implementation so we don't have to shoehorn in bugfixes later on.

sentences:
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:
Parent-Child position mathematics What is the math theory when a child object moves with the parent transform?

I am doing an angle indicator which shows a field of view, which works fantastic when the angle is static. But I cannot get the
field of view indicators to play nice with the angle changing. Everytime I change the angle, the indicators are reset to
default positions and then the direction indicator and FoV indicators are out of sync.

There is of course a ghetto way of resetting the whole thing when changing the angle, but I'd prefer not to do it that way.

The red circles are the points which are used to draw the FoV lines and they are childed to the white sphere. If the angle is not modified after start they follow the white sphere nicely and show the FoV correctly.

Here is how it looks after trying the dynamic angle changing. The FoV lines should be pointing to the right and the white sphere should be in the middle.

Currently I am changing the red circles' position based on the angle given(transform is the green square in the middle.):

leftAngle.transform.position = transform.position + new Vector3(Mathf.Cos(firstLineRendererAngle * Mathf.Deg2Rad), 0, Mathf.Sin(firstLineRendererAngle * Mathf.Deg2Rad)) * 10;
rightAngle.transform.position = transform.position + new Vector3(Mathf.Cos(secondLineRendererAngle * Mathf.Deg2Rad), 0, Mathf.Sin(secondLineRendererAngle * Mathf.Deg2Rad)) * 10;

How do I add the position of the FoV direction sphere to emulate parent-child relationship with the objects?

sentences:
How do 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:
Difference between rotation methods? My question is in about rotate methods in android.graphics.Camera. In Docs, I saw these comments:

  public void rotateX (float deg) Since: API Level 1
  Applies a rotation
  transform around the X axis.

  public void rotate (float x, float y, float z) Since: API Level 12
  Applies a rotation transform around all three axis.

There is my question:What is difference between using rotate (float x, float y, float z) and a sequence of rotate methods? For example what's the difference between these two snippets A and B?

A)

camera.rotate (x, y, z);

B)

camera.rotateX (x);
camera.rotateY (y);
camera.rotateZ (z);

sentences:
Camera chasing player I want the camera to follow the player and lag a little bit and then catch up with the player when the player halts. When stopped the player is in the center.

At the moment im at the point where i get the camera to move with the player but i dont know how to get the lag effect!

On the camera object

    void Update () {
    var newX =  player.transform.position.x;
    var newZ =  player.transform.position.z;
    var y = transform.position.y;
    transform.position = new Vector3(newX, y, newZ);
}

sentences:
Learning math from the basic to become a game programmer Hi i want to become a game developer. Im currently doing some web programming. I want to learn
game programming. Im not good in math thats why i decided to learn from basic math to be sure i will not missed
some important concepts. Do you have some advice if my way of learning is ok. thanks.

sentences: How can I provide a csv file to a player on mobile? It seems many people do this with regards to game data so they recommend userprefs, but I just want the user to have the file in the end, whether this is the Files app on iOS or choosing a folder to save in on Android or even just attaching the file as an attachment to an email that they can send using their preferred mail app or something.

sentences:
Play continuous music when swapping between multiple scene in Unity3d I have the following scenario

Main menu scene containing a gameobject with an audio source component
An about us scene

gameObject script :

using UnityEngine;
using System.Collections;
public class ManageMusic : MonoBehaviour {

// Use this for initialization
    void Start () {

}

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

}
public static ManageMusic Instance;
void Awake()
{

    if (Instance)
        DestroyImmediate (gameObject);
    else {
        DontDestroyOnLoad (gameObject);
        Instance = this;

    }
  }
}

when i click on aboutUs Button the Game Music object keep on playing an i can hear the music but when i return back to the main menu no music is still playing . i can see that the gameobject is not destroyed when i return to the main menu and the audio Listener have the value of the volume set to 1 , but i can't figure out the problem can anyone help me

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:
iOS custom memory allocator I'm about to start writing an iOS game and I'm going to use mainly C++/C for the core gameplay logic.

I really like pre-allocating everything in the game and try to avoid any dynamic allocations as much as possible. With my own C++/C code it's not a big deal. However there are some ObjC libraries which I'd like to re-use and I'm not sure how to inject my custom memory allocator to Cocoa based classes.

Is there any central 'inject point' in Cocoa where I can do that?

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:
XNA - Autodeploy .exe of game upon succesfull commit to GIT I know of ClickOnce which creates an .exe file so a user can play my XNA game.

However, I have to manually go through a wizard in order to create this file.

I would like for the new .exe to be created upon a successful commit of the code to GIT (ie. all my tests pass and the build succeeds) and for this file to be deployed on my Amazon AWS server so users can instantly download the 'new version' each commit.

Is this possible? I've been taking a look at Jenkins which seems to do what I want (Automated builds) but seems as though it's only for JAVA software.

Thanks for any info :)

sentences:
Directional light shader not behaving as expected I coded my first glsl shader which manage diffuse and specular effects of a directional light.
This is the fragment shader.
#version 120

//matrix
uniform mat4 model_matrix;

//directional light position in world coordinates
uniform vec3 light_position;
uniform vec3 eye;

//send to fragment shader
varying vec4 color;
varying vec4 normal;
varying vec4 vertex;

void main()
{

    float light_diffuse_intensity;
    float light_specular_intensity;
    float light_mod;

    vec3 world_normal;
    vec3 world_vertex;
    vec3 world_reflec;
    vec3 vertex_to_light;
    vec3 vertex_to_eye;

    world_normal = (model_matrix * normal).xyz;
    world_vertex = (model_matrix * vertex).xyz;

    vertex_to_light = light_position - world_vertex; //vector from vertex to light
    vertex_to_eye = eye - world_vertex; //vector from vertex to eye
    world_reflec = 2 * dot(vertex_to_light, normalize(world_normal.xyz)) * normalize(world_normal) - vertex_to_light; //reflection of vertex_to_light

    light_diffuse_intensity = dot(normalize(vertex_to_light), normalize(world_normal.xyz)); //computing angle between light and normal
    light_specular_intensity = dot(normalize(vertex_to_eye), normalize(world_reflec)); //computing angle between eye and reflection

    if (light_diffuse_intensity > 0){
        light_mod = light_diffuse_intensity;
        light_specular_intensity = pow(light_specular_intensity, 8.0);
    }
    else{
        light_specular_intensity = 0;
    }

    gl_FragColor = vec4(mix(color.rgb * light_diffuse_intensity, vec3(1.0,1.0,1.0), light_specular_intensity), 1.0);

}

As you can see from the screenshot below, in the first screen, where I look at the sphere from the direction of the light, the border of the sphere is white because of the specular effect. However if the shader were correct it should not look like that. It should be white only in the middle of the sphere.
In the second screen, I look at both the sphere and the source of the directional light (the yellow sun) and everything looks just fine.
I cannot find the error in my shader, could someone help please?
Thank you very much!

sentences:
Why can't a blendShader sample anything but the current coordinate of the background image? In Flash, you can set a DisplayObject's blendShader property to a pixel shader (flash.shaders.Shader class).

The mechanism is nice, because Flash automatically provides your Shader with two input images, including the background surface and the foreground display object's bitmap.

The problem is that at runtime, the shader doesn't allow you to sample the background anywhere but under the current output coordinate.  If you try to sample other coordinates, it just returns the color of the current coordinate instead, ignoring the coordinates you specified.  This seems to occur only at runtime, because it works properly in the Pixel Bender toolkit.

This limitation makes it impossible to simulate, for example, the Aero Glass effect in Windows Vista/7, because you cannot sample the background properly for blurring.

I must mention that it is possible to create the effect in Flash through manual composition techniques, but it's hard to determine when it actually needs updated, because Flash does not provide information about when a particular area of the screen or a particular display object needs re-rendered.  For example, you may have a fixed glass surface with objects moving underneath it that don't dispatch events when they move.  The only alternative is to re-render the glass bar every frame, which is inefficient, which is why I am trying to do it through a blendShader so Flash determines when it needs rendered automatically.

Is there a technical reason for this limitation, or is it an oversight of some sort?  Does anyone know of a workaround, or a way I could provide my manual composition implementation with information about when it needs re-rendered?

The limitation is mentioned with no explanation in the last note in this page: http://help.adobe.com/en_US/as3/dev/WSB19E965E-CCD2-4174-8077-8E5D0141A4A8.html  It says:

  "Note: When a Pixel Bender shader program is run as a blend in Flash
  Player or AIR, the sampling and outCoord() functions behave
  differently than in other contexts.In a blend, a sampling function
  will always return the current pixel being evaluated by the shader.
  You cannot, for example, use add an offset to outCoord() in order to
  sample a neighboring pixel. Likewise, if you use the outCoord()
  function outside a sampling function, its coordinates always evaluate
  to 0. You cannot, for example, use the position of a pixel to
  influence how the blended images are combined."

sentences:
VS code doesn't recognise new Unity Files Vs code was working fine for some time, and suddenly it stopped supporting new unity c# classes

Also, there is no regenerate project files option in unity
I tried restarting unity and vscode, but no success....
Also, assemblyCSharp doesn't add new files to it....

sentences:
When to trademark my game/game company I'm planning on building an online presence of a game I'm working on once it reaches a stage that would allow for creating marketing material (screenshots, trailers, etc).

Should I trademark/copyright my game before I start building online presence?
How long does the trademarking/copyrighting process take?
How much money can it cost?

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:
Deproject Screen To World Coordinates (Unreal Engine 4.15) I am working on a small game in Unreal Engine 4.15 using blueprints only and encountered a behaviour I don't understand.

The game is based on the Top Down Example. As I'd like to teleport an actor to a world location corresponding to a screen location (i.e. left edge of the viewport). I use "Deproject Screen To World". Giving screen X = 0 and screen Y =  0 as input to this node, outputs world coordinates close to the bottom center of the viewport. In order to get a test actor to move to outputted world coordinates close to the left edge of the viewport, input screen coordinates need to unexpectedly high (around -20000.00 for both x and y). This occurs strange  to me, as the viewport is much smaller (around 1400x740 in editor preview).

I was hoping to use something like -(viewport width/2) for x screen coord (in case the x origin is centered.

Where is the origin for screen coordinates?
What unit are they measured in?

Note: The location on screen is not set from mouse position, so i can not use "Get Hit Result Under Cursor".

sentences:
How can I acquire marketing and sales data for games? I need to evaluate a marketing perspective for a videogame in order to predict its income, sold units, etc. Since this sounds like quite a bit of an impossible task, I thought I could collect some statistic for similar games in order to have an idea.

Is there a way which I could figure out selling statistics about games on specific platform? For example collect statistic for game xyz available on Steam platform or game abc available on HumbleBundle.

I think that could be a good practice to achieve this goal.

EDIT: recently was published SteamSpy, which offers a lot of statistics about games on Steam platform.

sentences:
Bounding box not right rotation XNA blender object (.fbx) I am importing .fbx models (a simple cuboid), the model itself displays fine (and is repeated to make a wall) however the bounding box seems to be on the wrong rotation. Below is a screen shoot:

The yellow line is the bounding box for the grey cuboids.

The map walls are loaded from a map object that specifies where walls should be

for (int row = 0; row < map.Rows; row++){
                for (int col = 0; col < map.Columns; col++){
                    if (map.Get(row, col) == 'w') walls.Add(new Wall(content.Load<Model>("models/wallnew"), new Vector3(col, 0, row)));
                }
            }

and a wall is:

public class Wall : Entity {
        BoundingBox boundingBox;

        public Wall(Model model, Vector3 position) : base(model){
            this.translation = Matrix.CreateTranslation(position);
            Vector3 from = Vector3.Transform(new Vector3(0f), World);
            Vector3 to = Vector3.Transform(new Vector3(1f), World);
            boundingBox = new BoundingBox(from, to);
        }

        public BoundingBox GetBoundingBox() {
            return boundingBox;
        }

        public override void Draw(bool textured, Matrix view, Matrix proj) {
            foreach (ModelMesh mesh in model.Meshes) {
                foreach (BasicEffect effect in mesh.Effects) {
                    effect.World = World * mesh.ParentBone.Transform;
                    effect.View = view;
                    effect.Projection = proj;
                    effect.EnableDefaultLighting();
                }
                mesh.Draw();
            }
        }
    }

I cant for the life of me work out why the bounding box is being added wrong, if you need any more info let me know!

sentences:
Logic only GUI library I'm not sure whether this place is the correct for asking this. If it's the wrong place I'm sorry, please tell me if so!

I'm making a small game for fun which would uses an own engine with OpenGL and Vulkan as underlying renderer implementation. The engine itself is targeted for Mono/.Net.

Currently I'm not yet there but I'll come to the point where I'm pushed to implement some kind of GUI (I'm thinking ahead because of good design).
I already searched the Internet for render independent GUI systems but I wasn't lucky yet. As result I thought about how I could implement the GUI on my own and came to the conclusion:

a independent implementation is needed which takes care only for layout, positioning of GUI objects with responding to inputs.
another implementation is needed which only takes the results of calculations for rendering (the renderer)

Before I start inventing the whole wheel new I simply want to know:

Is it a correct approach to doing it this way? Is there a different common approach doing what I described?

sentences:
How can I implement simple distributed processing in a Unity game? I'm looking to set up a game which uses distributed processing. Just a simple brick shooter in unity with the distributed part being that the calculations for the falling blocks are handled by another PC and the transformations are sent back and applied to a clients machine.

To use this in Unity I assume I'll be using Remote Procedure Calls?
Will I also require socket programming? Any other networking elements I require?

sentences: When should I extrapolate and when should I interpolate? I'm having trouble understanding when to extrapolate and when to interpolate. In gaffer on games, he said to interpolate but then in another article it recommended extrapolating the player. So my question is when is it better to extrapolate and when is it better to interpolate?

sentences:
Merging several textures into one using RGB channels Would it be possible to place a texture into each RGB channel?

Example:
Red = wood.png
Blue = tiles.png
Green = metal.png

The advantages I could see are saving space, memory and draw calls and the resolution might not suffer. (unless I'm missing something)

I've seen people pack many textures into one but they have to be scaled to fit which lowers resolution.

sentences:
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: 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 do I interpolate air drag with a variable time step? So I have a little game which works with small steps, however those steps vary in time, so for example I sometimes have 10 Steps/second and then I have 20 Steps/second. This changes automatically depending on how many steps the user's computer can take. To avoid inaccurate positioning of the game's player object I use y=v0*dt+g*dt^2/2 to determine my objects y-position, where dt is the time since the last step, v0 is the velocity of my object in the beginning of my step and g is the gravity. To calculate the velocity in the end of a step I use v=v0+g*dt what also gives me correct results, independent of whether I use 2 steps with a dt of for example 20ms or one step with a dt of 40ms.

Now I would like to introduce air drag. For simplicity's sake I use a=k*v^2 where a is the air drag's acceleration (I am aware that it would usually result in a force, but since I assume 1kg for my object's mass the force is the same as the resulting acceleration), k is a constant (in this case I'm using 0.001) and v is the speed.

Now in an infinitely small time interval a is k multiplied by the velocity in this small time interval powered by 2. The problem is that v in the next time interval would depend on the drag of the last which again depends on the v of the last interval and so on... In other words: If I use a=k*v^2 I get different results for my position/velocity when I use 2 steps of 20ms than when I use one step of 40ms.

I used to have this problem for my position too, but adding +g*dt^2/2 to the formula for my position fixed the problem since it takes into account that the position depends on the velocity which changes slightly in every infinitely small time interval.

Does something like that exist for air drag too?
And no, I dont mean anything like Adding air drag to a golf ball trajectory equation or similar, for that kind of method only gives correct results when all my steps are the same.
(I hope you can understand my intermediate english, it's not my main language so I would like to say sorry for all the silly mistakes I might have made in my question)

sentences:
Strange behavior for "make x face y" algorithm (with video) I know, I know, on the internet there are a lot of tutorial on how to get the angle between the center of two objects or "make x face y".

I have this code:

//  (180 / PI = 57.3065)
float AngleBetweenVectors(sf::Vector2f, sf::Vector2f);
float AngleBetweenVectors(sf::Vector2f a, sf::Vector2f b){
   return 57.3065f * atan2(b.y - a.y, b.x - a.x);
}

that get the angle, and then this code that I use to set the rotation:

float angle = AngleBetweenVectors(player_p, cursor.getPosition());
player.setRotation(angle);

where player_p is the player center position (a 50x50 square sprite), cursor is the cursor sf::Sprite I use and player is the player sf::Sprite.

But when I run it it gets this kind of problems: video here

As you can see on the border of the terrain it gets a little bit tricky. Why is that? I'm using two views, and this is the code of the main loop regarding views and drawing:

window.clear(sf::Color(0, 0, 0, 255));
window.setView(camera); // camera view
// start drawing
    terrain.draw(); // terrain blocks
    window.draw(player); // player sprite
    window.setView(cursor_camera); // cursor view
        window.draw(cursor); // cursor sprite (the circular one)
// end drawing logic
window.display();
window.setMouseCursorVisible(false); // no mouse pointer please

The player sprite in the video is the orange one, the black circle is the cursor sprite. The player sprite is moved via WASD and the cursor sprite via mouse movement.
Thanks.

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

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

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

Is there any real reason to reset MMR?

sentences:
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:
Line vs Triangle wrong computation I used the Möller-Trumbore algorithm. That seemed to work for a while but I found a bug:

const glm::vec3 avert0 = glm::vec3(-0.13f, 0.01f, 0.0f);
const glm::vec3 avert1 = glm::vec3(-0.01f, 0.01f, 0.0f);
const glm::vec3 avert2 = glm::vec3(-0.13f, 0.1f, 0.0f);

const glm::vec3 start = glm::vec3(-0.1f, 0.05f, -1.0f);
const glm::vec3 end = glm::vec3(-0.1f, 0.05f,    1.0f);

rayIntersectTriangle(start, end, avert0, avert1, avert2, position);

The above code does not collide ( u is < 0 ). However, if I change the Z value of the end vector from 1 to 30, it works:

 const glm::vec3 end = glm::vec3(-0.1f, 0.05f,    30.0f);

Here is my implementation:

bool Node::rayIntersectTriangle(glm::vec3 orig, glm::vec3 dest
              , glm::vec3 vert0, glm::vec3 vert1, glm::vec3 vert2
              , glm::vec3 &result)
{
const glm::vec3 edge1 = vert1 - vert0;
const glm::vec3 edge2 = vert2 - vert0;
const glm::vec3 pvec = glm::cross(dest, edge2);
const float det = glm::dot(edge1, pvec);

static const float Epsilon = std::numeric_limits<float>::epsilon();

/*
   If det is below zero, we are back facing the triangle.
   If det is close to zero we are missing the triangle.
*/
if (det > -Epsilon && det < Epsilon)
  return false;

const float invDet = 1.0f / det;

const glm::vec3 tvec = orig - vert0;

result.x = glm::dot(tvec, pvec) * invDet;
if (result.x < 0.0f || result.x > 1.0f)
  return false;

const glm::vec3 qvec = glm::cross(tvec, edge1);

result.y = glm::dot(dest, qvec) * invDet;
if (result.y < 0.0f || result.x + result.y > 1.0f)
  return false;

result.z = glm::dot(edge2, qvec) * invDet;

return true;
}

sentences:
How do I make a pop-up window with Scene2D? I have a main-menu screen with a logo and a bunch of buttons. When the Login-button is pressed, I pop up a dialogue asking for a username and password.

This works fine, other than the "popping up". At the moment the new the dialogue box just shifts everything about, but I'd want to position it over the current scene.

I'm just learning Scene2D.

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:
How to process events as well as do OpenGL rendering using multithreading? I am working on a very complicated graphics rendering, using OpenGL, and it is very time consuming, in the sense that it creates a delay in the event handling, of my application to an extend that, the OS will think my application is freezing !
Therefore, I was thinking of running two threads, one for the OpenGL rendering and the other for event handling. But, I dont think this is possible for my current framework that I'm using!
Basically, I'm using SDL 2.0 to set up an OpenGL context, and then using vertex and fragment shaders to do the rendering.
Code:
// Initialize OpenGL context
// Set up VAO, VBO, compile vertex/frag. shaders, link, use program  etc.
//
bool run = true;
SDL_Event e;
while(run)
{
       glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
       render(); // Complicated rendering :(
       SDL_GL_SwapWindow(window);
       while(SDL_PollEvent(&e))
       {
             switch(e.type){
                   case SDL_QUIT:
                        run = false;
                        break;
             }
       }
}

As you might realize if render is slow,  then event handling will lag. This might crash my application !
The SDL library wants everything in the same thread I guess. If I move the event handling part to another thread, then OpenGL won't render anything! Similarly, if I move the OpenGL based render function to another thread, still it won't render anything!!! In fact event handling is a must for SDL in particular and to the OS  in general.
What is the practical remedy to this issue?

sentences:
Loop through a loaded .x file's vertices I need to compute the "gravity center" of a mesh, some kind of barycenter, and then find the farest vertices to compute a bounding sphere.

Here is what I have for the moment:

D3DXVECTOR3 result(0,0,0);
int num = mesh -> GetNumVertices();
LPDIRECT3DVERTEXBUFFER9 vertexBuffer;
mesh -> GetVertexBuffer((*vertexBuffer));
void* rawData;
vertexBuffer -> Lock(0, mesh->GetNumBytesPerVertex() * mesh->GetNumVertices(), &rawData, D3DLOCK_READONLY);
D3DVERTEXELEMENT9 decl;//[MAXD3DDECLLENGTH];
UINT numElements;
mesh -> GetDeclaration();
mesh -> GetFVF();

Apparently I need to cast the rawdata pointer, but I don't know what to do next...

sentences:
Developing internet sweepstake games I have absolutely no idea about game developing but want to know following things about internet sweepstake games: Click on demo and play any of the game.

What technology (programming language) is used to develop these games. e.g. Flash, Silverlight, etc.
If I wish to develop such game(s) what is the best technology to use, how much time it might take to learn and develop a simple commercial product.
Is the algorithm/code behind the scene re-usable while changing the front graphics. I mean a scalable/adjustible game.
In case I wish to hire a game programmer what would be the approximate cost or per/hr charge for such developer.
Any good books or online tutorial/videos to learn/see this in action?

Or any other ideas or suggestions?
Sorry if these are lot of questions but this is the only good place I see asking such questions. I will more than happy to post them as separate questions if that is necessary.

sentences:
Create a body of an irregular 2D sprite in Farseer I'm trying to create a body of a irregular 2D sprite Farseer 3.3.1.
The regular shapes that BodyFactory provides are not that I want. Is there a way that one can create irregular objects? Could it be done using the BodyFactory.CreateCompoundPolygon method?

sentences:
What should I name the keybinding menu? Here's a pretty basic question:

My game supports custom keybindings. What label should I put on the button the player clicks to get to the menu that lets him customize them?

Specifically, this game is targeted at nerdy high-schoolers to nerdy middle-aged adults, and any given player may or may not be an experienced gamer, or even if they are they may or may not be familiar with first person shooters, where I imagine the idea of custom key bindings is usually first encountered.

I need a name that doesn't feel out of place in my menu (which consists of short two-word labels: "Start Game," "Load Game," "Level Select, "Save & Quit," etc...) but conveys the idea of "this is where you go to alter which buttons do what" without using semi-advanced gamer jargon like "bind" or "mapping."

Any suggestions?

sentences:
How to properly multi-thread my game loop? I am trying to implementing multi-threaded game loop in iOS.
(Actually, two thread - Render and Update)

This is my structure.

Update Loop

Has logic and at the end of loop, save update state. (Basically copy buffer for Render)

Render Loop

Using CADsiplayLink
It is on Main
Everytime, it triggers method, get the state, and draw.

I am seeing some stuttering, and I am thinking render loop is just faster than update loop, and also inconsistent "Render" call, something like this:

Update #1     ->    Render #1
Update #2     ->    Render #1
Update #2     ->    Render #2

How can I synchronize this?

I heard that Render thread should be not on Main Thread, and I am using CADisplayLink with default setting. (Call MainLoop); is it running on Main thread? If running on different thread, is better, can I get some suggestions working with CADisplayLink? It could be that I just lack some understanding about CADisplayLink.

Is my current structure adequate? Could it be improved?

sentences:
How to flip sprites with different dimensions horizontally? I am trying to make an animation on HTML5 Canvas with this texture atlas, which was packed by TexturePacker:

and it works good when the Character is facing right. I try to flip it horizontally, but it gets wrong position:

Here is my current code, each frame has a offset value to fix position:

<canvas id="c" width="200" height="100" style="background: #000"></canvas>

var metaData = [
    {x:0,y:0,w:35,h:38,offsetX:3,offsetY:9},
    {x:37,y:0,w:31,h:37,offsetX:6,offsetY:10},
    {x:70,y:0,w:65,h:47,offsetX:0,offsetY:1},
    {x:137,y:0,w:65,h:47,offsetX:0,offsetY:1},
    {x:204,y:0,w:61,h:46,offsetX:1,offsetY:1},
    {x:267,y:0,w:42,h:46,offsetX:1,offsetY:1},
    {x:311,y:0,w:43,h:44,offsetX:1,offsetY:3},
    {x:356,y:0,w:38,h:37,offsetX:6,offsetY:10},
    {x:396,y:0,w:35,h:34,offsetX:6,offsetY:13},
    {x:433,y:0,w:33,h:37,offsetX:7,offsetY:10},
    {x:468,y:0,w:36,h:40,offsetX:5,offsetY:7},
    {x:506,y:0,w:34,h:39,offsetX:6,offsetY:8}
],
dx = 0, //position x
dy = 0, //position y
index = 0; //frame index

(function draw() {
    context2D.clearRect(0,0,c.width,c.height);

    var cur = metaData[index];

    if(facingRight) {
        context2D.drawImage(
            img,
            cur.x, cur.y,
            cur.w, cur.h,
            dx + cur.offsetX, dy + cur.offsetY,
            cur.w, cur.h
        );
    } else {
        context2D.save();
        context2D.scale(-1,1);
        context2D.drawImage(
            img,
            cur.x, cur.y,
            cur.w, cur.h,
            -dx - cur.offsetX - cur.w, dy + cur.offsetY,
            cur.w, cur.h
        );
        context2D.restore();
    }

    index = ++index % metaData.length;

    setTimeout(draw,100);
})();

I use scale(-1,1) to flip sprite, but I have no idea how to keep it at the same postion like facing right. Should I have to fix the offset value?

Please, any help will be appreciated :)

sentences:
Managing game states (states flow, controlling the state machine...) I am currently struggling really bad to make the game states management. Before we dig into the problem, I must point out that I do know about state machines, I do have both implemented (states and state machine) and they look SIMILAR to this, or you can also see my real outdated implementation from my github.
Alright, my questions are:

Do states usually operate state machines? Eg.: when the LoadingState
finishes (based on the 'update' method) loading something, it tells
the state machine to pop the stack (which would pop the
LoadingState) and to push a new state, such as PlayingState OR
should the LoadingState only notify the state machine and the state
machine itself will be responsible of knowing whats the next state
based on the state that has requested a pop? Knowing which state has
requested a pop (pop, push or whatever) is kind of difficult because
it needs some advanced C++11 stuff, which requires a lot of
'not-easy-to-understand' code and validations (asserts), unless we
use an enumeration inside each state and do a simple switch (again,
more typing).
Should the state machine be opperated/accessed (pointer/static
functions) by any component (class, system, manager...) of the game?
Eg.: the main player has moved into a map teleport and it triggered
a map load, since it should be teleported to a new map. Should the
Map class notify the state machine to push the MapTransitionState
into the stack, through a static (it doesnt really make any sense to
have a pointer to the state machine in the map class) public
function?

Thanks a lot!

sentences:
How to show part of the world scaled to screen size? I have a world size of 100x100
I want to map this world size to screen size using this mapTo function
function mapTo(pos, from, to) {
  let n = pos / from;
  return n * to;
}

Now I want to show only a portion of this world scaled up to the screen size, let's call it view size of 10x10 now how should I map this world size of screen size with regards to view size?
I want to show 10x10 world units fit the whole screen.
I've tried to do:
let aWorldPosition = [0, 0];

let worldSize = [100, 100];
let viewSize = [10, 10];
let screenSize = [20, 20];

let r = mapTo(aWorldPosition, worldSize, viewSize);
r = mapTo(r, viewSize, screenSize);

but that doesn't work.
Also I want to be able to move the view so I can show portions of the world.
I've tried this and seems to be working but I don't know if it's correct:
let r = mapTo(aWorldPosition, viewSize, screenSize);

Here viewSize is in world coordinates.

sentences:
1D functions and shapes I have a set of numbers I normalize ( so the converted number is between 0 and 1 ) which I want to pass trough a function, which in return gives me a different number between 0 and 1 based on the curve/shape.

For animation the following would do for easeInQuad ( From ):

Math.easeInQuad = function (t, b, c, d) {
    t /= d;
    return c*t*t + b;
};

Where t = current time. b = start value. c = change in value. d = duration

which looks like:

In my case the min is always 0 and max is always 1.
How would I go about creating a function equal to the shape but without all parameters that are required for animation?

sentences:
Whats the best way to make my Unity game moddable? Basically the title. I'm building a game with several NPCs and complex systems, and I want it to be nice and modular for modders right from the beginning. So far, I have looked into:

Asset Bundles, I don't completely understand these, probably will have to write some custom loading code? I don't know how/if this will let the modders write code.

Lua-Based Modding, I don't particularly like Lua, but I will fall back to it if I absolutely have to (The Unity-Lua Plugin makes this a seemingly very fast way.)

Exposed C# (original idea from this Question). But again, as stated in the question raw c# has a lot of disadvantages, not to mention the security risks and compatibility issues.

Minecraft-Style? Completely custom? Basically a lot of events and registries? I'm not sure about this option.
To give you an example, there are several Tribes in the game. Ideally, if a modder wanted to make a new tribe they would need to extend from some Tribe base class and then register/add their custom tribe to my AvailableTribes list. Not to mention the models, animations, and sounds for the Tribe NPCs and such.

Any help is appreciated!

sentences:
AddRelativeForce not working correctly I am stuck on the code for couple of days but couldn't figure it out. Therefore I turned out to look the answer here but couldn't find any that match the requirement Hope some One might help

here is the code

/*  Part1
 *Step Horizontal Movement
 * Use to get left and right movement
 */
if(Input.GetKey ("right")||Input.GetKey ("left")){
    moveDir.x = Input.GetAxis("Horizontal"); // get result of AD keys in X
}
rigidbody.velocity = moveDir * speed;

/*Part2
 *Continuse Forward Movement
 */
if (Input.GetKey(KeyCode.UpArrow) || Input.GetKey(KeyCode.W))
{
    moveDir.z = Input.GetAxis("Vertical");
    rigidbody.AddRelativeForce(moveDir*50);
}

I have a Cube with added rigidBody Component. When pressed left or right key the cube should move in that direction and when key is released it should stop Part one when run commenting part2 code runs correctly

the other movement that I am trying to achieve is the cube should move continuously.But the thing is when pressed up key it should increase the magnitude and when released it should maintain the magnitude and move constantly.This is also achieved successfull with the part2 code by commenting part1 code But when but run without commenting any of them part1 results are correct but part2 does not provide correct result which was obtained by commenting part1 code

Is there any other way to obtain the same reult

sentences:
Efficient way to implement animation from spritesheet? I'm actually trying to port a GBA game to SDL for educationnal purpose.
The game has many sprites and tiles. Since the GBA screen size is 240x160px, I decided to scale it 2x. At first, it went okay creating spritesheet for animations, because typical animations had something around 2-8 frames.

However, I faced yesterday a problem that I had not seen coming. I got a 89-frame animation. Including the scale, each frame is around 480x320px. With 89 frames, it creates a huge image.

When I load it into a SDL_Texture with IMG_LoadTexture, the size of the test program goes from ~9MB to 56MB. I find this huge considering the image weights at most 4MB (without compression, PNG-32 bits I believe). No matter what compression I do, it still takes ~50MB.

Here's the code that loads the image:

m_frameDestRect = { 0, 0, 480, 320 };
m_frameSrcRect = { 0, 0, 480, 320 };
m_pTexSprite = IMG_LoadTexture(pRenderer, "image.png");

I keep the SDL_Texture in a SDL_Texture* property of my class. It also never change.

Here's the code that "draws" the texture:

SDL_RenderCopy(m_pRenderer, m_pTexSprite, &m_frameSrcRect, &m_frameDestRect);

Here's the code that "update" the frame:

uint32_t frameX = (m_frame + 1) % 5;
uint32_t col = (m_frame + 1) / 5;

m_frameSrcRect = { frameX * 480, col * 320, 480, 320 };

I could live with that, but then I saw that I got an animation that has 489 frames...

Since I am no expert in video games programming, nor in imaging, I came here to ask this very question.

1. Is the RAM consumption of SDL_Texture (and whatever loaded behind) normal ?
2. Animation wise, are there other ways to implement them?

I find it totally impressive all these sprites (got tons of them, in gif formats) actually loaded quite smoothly on the GBA, considering the number of frames.

Any advice / solutions / answers is more than welcomed.

Thanks

sentences:
Unity: How do I only show parts of objects that overlap [2D] I'm working on a 2D Unity project where the player can only see objects in their field of view. I have successfully created a mesh that overlaps anything that would be in the player's field of view, but now I'm having trouble with only showing parts of objects that the mesh overlaps with.

Here is what I have so far (the gray area is the player's field of view which is a mesh:

Here is the type of thing that I'm looking for:

What can I do to get that desired effect? Shaders (I have no clue how to use shaders)? Colliders? Any ideas would be greatly appreciated. If there is any info you need that I didn't provide, comment and I add the necessary info. Thank you in advance!

sentences:
Identifying mesh format from initial bytes I have a file containing mesh data whose blocks seem to start with DWORDS like:

0x1 0x1 0x3100026f 0x1 0x30000112

or

0x1 0x1 0x310007b2 0x1 0x30000112

or

0x10000006 0x3 0x310001f6 0x310001f6 0x310001f6

They don't look like .x binaries. Any other ideas?

UPDATE:

Here's more: 00000001 00000001 3100026F 00000001 30000112 000000C7 BD869270 3F0372D4 00000000 BD41F15F 3F11A611 3F522E05 3E40EF5A 3E17CDF8 3E40993C BF504FBD 3F0CCC2A BF78001B BE654B6A 3DDA7965 BD80EB99 3F003679 3C0BDAE1 BD3DD880 3F112A76 3F528732 3E8EFD04 3E185DD8 3E3984B8 BF48A923 3F180DA9 BF7854DC BE6599AE 3DBF7319 BCD7235C 3F041CCC 00000000 BF52314E 3F12223D 00000000 3F727B04 3C22FD80 3E29BCD1 3F7C0367 3D6FCD12 3E70A826 BCE91707 BF78B921 BCD7235C 3F008C87 3C28E0F6 BF6B36D8 3BD28E32 3ECA109F 3F4AEA89 3D894EC0 BE18A98D 3F7CC7A8 3D57AE4B 3E48D2F6 B46C577B 3F7B0753 BE3DBAC2 3EF41E67

It looks like some of these are almost certainly floats and others are almost certainly not. And it appears (not shown here) that after a long list of valid floats, there is a long list of DWORDS that aren't valid floats. A list of vertices followed by some table of indices?

sentences:
Doom 3 codebase release details Does anyone know when the source code for Doom 3 is to be released?
I've heard a lot of things but nothing conclusive.

Thanks
Adam

Edit any info is appreciated

sentences:
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:
Delay in connecting to server in Unity I have a button, when I press the connect button, it gets connected to the server. When I press the connect button again, it's getting delay in connecting to the server. Below is the code to connect to the server:

public void setupSocket() {
    try {
        socket = new Client(Host, Port);
        theStream = socket.GetStream();
        theWriter = new StreamWriter(theStream);
        theReader = new StreamReader(theStream);
        socketConnect = true;
    }
    catch (Exception e) {
        Debug.Log("Socket error:" + e);
    }
}

And I have one more issue. When I take the desktop build of the app and opened the app, clicked button, it's getting connected to the server, but when I click the button again it's not getting connected. But when I close the app, it displays the connection message and also close message on the server. Is there anything to be set when taking the desktop build?

Can anybody help out what will be the problem?

sentences:
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:
An Ogre3D iPhone 'Hello World' project? I have been investigating various 3d engines for iPhone/iPad development and have mostly decided to use Ogre3d.  I have got the SDK, the iPhone dependancies, built and run the SampleBrowser project on the simulator and (with some difficulty) my 3GS. My problem is with the complexity of the SampleBrowser project.

It is a cross platform project, which (at this point) I am not interested in supporting and pre-loads all the Ogre tech samples (some of which don't work on the iPhone). What I really need is a very simple bare bones Hello World XCode project to start work with. If someone knows where I can find one, I would appreciate it. If not, building one is the next thing on my todo list.

I have posted the same question on the Ogre forums, so if I get some feedback there, I will update here.

sentences: Can you export lighting models directly from 3D application to a real time renderer? is it possible for example to insert lighting in a 3D Model software like 3DSMAX and export an animated model like md5,..etc. and export the lighting too ?

sentences:
Need help in making buttons for MenuScreen in Java I'm making a Menu for my game and I made the MenuState(class) and made a MouseManager(class, implemented MouseListener and MouseMotionListener) and they are different class in different folder. Here is my problem, usually people make their buttons my drawing rectangles and adds font and makes that their button.
But I didn't do that. I made a button using Photoshop and I put it in my sprite sheet, cropped it and made it my button. now I want to make it that if I click on my 'play' button picture it sends to my GameState and if I click on my 'exit' button picture it closes my window

MyMenuState(class)

 package com.vescorspel.game.MyFirstGame.states;

import java.awt.Color;
import java.awt.Graphics;

import com.vescorspel.game.MyFirstGame.Handler;
import com.vescorspel.game.MyFirstGame.gfx.Assets;

public class MenuState extends State{
// Resizing my button from 64 pixels to 256 pixels
public static final int ButtonWidth = 256;
public static final int ButtonHeight = 256;

// coordinates where my buttons are placed in pixels ;)
public static final int PlayButtonX = 500;
public static final int PlayButtonY = 100;
public static final int ExitButtonX = 500;
public static final int ExitButtonY = 400;

public MenuState(Handler handler){
 super(handler);
}

// My tick method
@Override
public void tick() {
 //This If statement tells my game if I LeftClicked anywhere in the MenuScreen, then it send me to my GameState(GameScreen)
 if(handler.getMouseManager().isLeftPressed())
  State.setState(handler.getGame().gameState);;
}

//My render where i render the button pictures in my MenuScreen
@Override
public void render(Graphics g) {
 //PlayButton from my Assets class(this is an image)
    g.drawImage(Assets.PlayButton, PlayButtonX, PlayButtonY, ButtonWidth, ButtonHeight, null );
    //ExitButton from my Assets class(this is an image)
    g.drawImage(Assets.ExitButton, ExitButtonX, ExitButtonY, ButtonWidth, ButtonHeight, null);
    //these 2 commands tells my game to make a red cube and follow my mouse in the MenuScreen
    g.setColor(Color.RED);
    g.fillRect(handler.getMouseManager().getMouseX(), handler.getMouseManager().getMouseY(), 8, 8);
}
}

MouseManager(class)

package com.vescorspel.game.MyFirstGame.input;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;

public class MouseManager implements MouseListener, MouseMotionListener{
 private boolean leftPressed;
 private int mouseX, mouseY;

 public MouseManager(){
 }

 //Getters

 public boolean isLeftPressed(){
     return leftPressed;
 }

 public int getMouseX(){
     return mouseX;
 }

 public int getMouseY(){
     return mouseY;
 }

 // Implemented methods

 @Override
 public void mousePressed(MouseEvent e) {
  if(e.getButton() == MouseEvent.BUTTON1)
   leftPressed = true;
 }

 @Override
 public void mouseReleased(MouseEvent e) {
     if(e.getButton() == MouseEvent.BUTTON1)
         leftPressed = false;
 }

 @Override
 public void mouseMoved(MouseEvent e) {
     mouseX = e.getX();
     mouseY = e.getY();
 }

 @Override
 public void mouseDragged(MouseEvent e) {
     // TODO Auto-generated method stub

 }

 @Override
 public void mouseClicked(MouseEvent e) {
 }

 @Override
 public void mouseEntered(MouseEvent e) {
     // TODO Auto-generated method stub

 }

 @Override
 public void mouseExited(MouseEvent e) {
     // TODO Auto-generated method stub
 }

}

sentences:
How do I deal with collision resolution causing another collision? I'm making a simple 2D, top-view simulation of an evacuation, sprites running around, looking for exits, going at it, all that good stuff.

I have no control over them when the simulation is running, I just program their behaviour.

I'm using the simulation space provided by JADEX, but I'm just using the simplest of what it provides, so it comes down to Java and OOP.

I already have collision detection working, each person has a radius and I search for objects within that radius, so my question is focused on the aftermath.

Say two people collide and one gets pushed to the ground while the other keeps going. No problem so far, but in the cicle after the collision they will again register a collision - since they are still close enough to each other - and trigger a confrontation.

Is there any general or already known technique to deal with this?

Or should I instead focus on another way of detecting a collision?

EDIT:

The expected cases are, when two people collide:

They are both up
One is up (D0) and the other one is down (D1).

In case 2, there are two outcomes:

D0 helps D1
D0 tramples D1

In case 1 there are 3 outcomes:

Both are aggressive. Dices are rolled, one keeps going the other one goes down and his physical condition deteriorates.
Both are non aggressive. Physical condition is compared, winner keeps going, loser is pushed but not to the ground, physical condition does not suffer.
Only one is aggressive. He will always be the winner. Rest as in 1).

As suggested, I will start by having people maintain a list of objects they just collided with and add an extra comparison to that list in the collision detection to filter them and also make sure that when they are no longer colliding to remove them from that list and see how far that takes me.

sentences:
Looking for literature about graphics pipeline optimization I am looking for some books, articles or tutorials about graphics architecture and graphics pipeline optimizations. It shouldn't be too old (2008 or newer) - the newer, the better.

I have found something in [Optimising the Graphics Pipeline, NVIDIA, Koji Ashida] - too old, [Real-time rendering, Akenine Moller], [OpenGL Bindless Extensions, NVIDIA, Jeff Bolz], [Efficient multifragment effects on graphics processing units, Louis Frederic Bavoil] and some internet discussions. But there is not too much information and I want to read more.

It should contain something about application, driver, memory and shader units communication and data transfers. About vertices and attributes. Also pre and post T&L cache (if they still exist in nowadays architectures) etc. I don't need anything about textures, frame buffers and rasterization.

It can also be about OpenGL (not about DirecX) and optimizing extensions (not old extensions like VBOs, but newer like vertex_buffer_unified_memory).

sentences:
What is a library for event-driven mouse and keyboard input in Java? The title basically says it all.

The only thing to take into consideration is it needs to be cross platform.

sentences:
Timer.schedule(task, 0, 100) never fires I added some code using java.util.Timer to execute my spawnMonster function every 100ms. It worked, until I tried instantiating images in it -- since it doesn't run on the libGDX core thread, there's no OpenGL context, so it can't do stuff with images.

I figured using the libGDX Timer class, which the javadocs say runs on the core thread, would solve this problem; but unfortunately, the timer code just doesn't execute.

I tried:

- new Timer().scheduleTask(task, 0, 100)
- new Timer().scheduleTask(task, 0, 100, 99999)
- Timer.schedule(task, 0, 100)
- Timer.schedule(task, 0, 999999)
- Timer.start()
- t = new Timer(); t.scheduleTask(...); t.start();

task appears to execute once, and only once; it never executes again. (It prints a date-time diff from a target time, so I can tell it's not running.)

sentences:
How can I track a "most wins" leaderboard using the Buddy API? I work on a mobile game with leaderboards that rank players by most wins. Currently, we've rolled our own, but I am looking to replace this with a SaaS leaderboard solution offering rolling time-based leaderboards (e.g. most wins this week, most wins in the last 30 days, etc.).

One of the leaderboard services I am looking at, Buddy, seems to provide "top score" leaderboards, which is not exactly what I'm looking for. I'm trying to register wins for players with the service and produces a leaderboard by summing the wins for each player for the time period I'm interested in.

How can I accomplish this with Buddy?

sentences:
Making games In Python I'm a beginner at making games, and my eBook that I learnt Python from just made a 2D game and simple game like snake in Nokia because I want to know more Python in correlation with game development.

Can someone tell and explain to me what the Python language can do to make a game?

sentences:
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:
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 does an HLSL shader actually end up affecting the render output? I understand the syntax of HLSL, for example let's pretend I have this as my HLSL:

struct VOut
{
    float4 position : SV_POSITION;
    float4 color : COLOR;
};

VOut VShader(float4 position : POSITION, float4 color : COLOR)
{
    VOut output;

    output.position = position;
    output.position.xy *= 0.7f;    // "shrink" the vertex on the x and y axes
    output.color = color;

    return output;
}

float4 PShader(float4 position : SV_POSITION, float4 color : COLOR) : SV_TARGET
{
    return color;
}

and I compile it like this:

D3DX11CompileFromFile(L"shaders.hlsl", 0, 0, "VShader", "vs_5_0", 0, 0, 0, &VS, 0, 0);
D3DX11CompileFromFile(L"shaders.hlsl", 0, 0, "PShader", "ps_5_0", 0, 0, 0, &PS, 0, 0);

How does it like... know to change... I'm confused about exactly what the pipeline between HLSL and the actual pixels/vertices on the screen is.

Is this what actually "applies" them?

dev->CreateVertexShader(VS->GetBufferPointer(), VS->GetBufferSize(), NULL, &pVS);
dev->CreatePixelShader(PS->GetBufferPointer(), PS->GetBufferSize(), NULL, &pPS);

// set the shader objects
devcon->VSSetShader(pVS, 0, 0);
devcon->PSSetShader(pPS, 0, 0);

Keep in mind I'm like a literal beginner at this stuff. Can someone maybe explain what it's doing? I'm assuming the vertex HLSL function goes through every vertex and then changes them to whatever I have in the function, and the output is what was changed... and similarly for the pixel shader?

Another confusion, I know what a pixel is, and I understand what a vertex is... but what exactly does the pixel shader do?

sentences:
How to calculate the estimated time of arrival and control signal between two quaternion? I'm trying to wrap my head around a control algorithm for a space game. If the user sets a target rotation I want to get a ETA counter and show the engine output. The only input to the system is a max delta angular velocity around the space ship local axis.

I uses Unity engine so I ave access to the quaternion of the rotation and global angular velocity. I can find the delta rotation between the two points as it's dQ = Qstart^-1*Qtarget (from Qstart*dQ=Qtarget).

But how Do I find the engine parameter at that frame and what is the ETA?

sentences:
Unity sprite with higher sorting layer not firing its OnMouseDown function I have 2 objects, both have a Box collider 2D.

The first object is on the Level1 Sorting Layer and has a Tile script attached to it.

The second object is on the Level0 Sorting Layer and doesn't have any scripts.

The Tile script code is as follows:

void OnMouseDown()
{
    Debug.Log(Input.mousePosition.ToString());
}

Whenever I click the top tile, nothing prints in the console unless I click on the red area like I show in the image below (red area = [first box collider] minus [the two box colliders intersection area]).

Why this happens ? Why doesn't the OnMouseDown() function fire up simply when you click on its collider, since the top tile is on a higher sorting layer than the bottom tile. How does this work ? Doesn't sorting layer affect the 2D box collider ? (If I change the Z-axis of the top tile to -1, while keeping the bottom tile to 0, it works as expected.)

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:
Getting Vector at 90 Degrees from provided vector I need a function that can take a vector as an input and provide a vector that is at a 90-degree angle to the provided vector. I understand that in 3D there is an infinite amount of vectors that could be produced from this calculation, but I only require 1. I have been using GLM and have tried using its built in vector rotation functions but to no avail. I would like to keep the solution compatible with GLM as I wish to have everything standardized.

Here is a basic visualization of what I need.

Edit
The function's purpose is to pass a direction vector into a function, radius, and an angle and it will create a point around the origin at x angle in space. The reason for this is so I can loop through and create a point cloud in 3D space and then join them together to make shapes such as cylinders (see photo)

Solution Code

glm::vec3 CreateAngledPoint(glm::vec3 rotation_point, float radius, float angle, glm::vec3 normal)
{
    // Normalize the normal (axis to rotate on)
    normal = glm::normalize(normal);
    // Create a vector that will be used for the dot product
    glm::vec3 to_cross = glm::normalize(glm::vec3(0.0f,1.0f,0.0f));
    // Make sure that the normal and cross vector are not the same, if they are change the cross vector
    if (to_cross == normal) to_cross = glm::normalize(glm::vec3(0.0f, 0.0f, 1.0f));
    // Get the cross product
    glm::vec3 to_return = glm::normalize(glm::cross(normal,to_cross));
    // Rotate point around the axis
    to_return = glm::rotate(to_return, angle* RAD_TO_DEG, normal);
    // Scale the point up from the origin
    to_return *= radius;
    // Apply it to the point in space we are rotating around
    return rotation_point + to_return;
}

Example of its usage

sentences:
Unity Shader Blend like ugui Outline Unity UGUI Outline it create fourfold vertexs, So I wirte shader to optimization ( vertex only create once ),
And I want to Keep one pass . (one drawcall)

There are four character , all character font size are same.
but this character edge look a little small.

I write shader like this

 fixed4 frag(v2f IN) : SV_Target
        {
            fixed4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color;

            float4 pClipRect = float4 (IN.uvOriginXY, IN.uvOriginZW);
            color.a *= IsInRect(IN.texcoord, pClipRect);
            half4 val = half4(_OutlineColor.r, _OutlineColor.g, _OutlineColor.b, 0);//(r,g,b,0)

            //black characters
            val.a += SampleAlpha(2, IN);
            val.a += SampleAlpha(5, IN);
            val.a += SampleAlpha(8, IN);
            val.a += SampleAlpha(11, IN);

            val.a = clamp(val.a, 0, 1);

            //blend
            color = (val * (1.0 - color.a)) + (color * color.a);

            return color;
        }

And the lower right picture is create by UGUI Outline it look like white color overlap black color , How can I do like this ?

The problem probably from here : color = (val * (1.0 - color.a)) + (color * color.a);

What should I do to make it look like UGUIOutline? thanks.

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: Mysql database reading and writing In my Libgdx application I would like to be able to connect to a mysql server securely and read and write data from it without other users injecting, or changing information. I've found this: http://www.helloandroid.com/tutorials/connecting-mysql-database but its only for reading what about writing data without people messing with it with other apps? I need a form of unique verification.

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:
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: 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:
Moving autonomous robot form one location to another based on array I have a 3D model of a house, and I want an autonomous robot to move from 1 object in this house to the next one. I have it moving to the first, but it won't move to the second one. This is my code:

using UnityEngine;
using System.Collections;

public class MoveTo : MonoBehaviour {

public Transform[] goals;

void Start () {
    NavMeshAgent agent = GetComponent<NavMeshAgent> ();
        agent.destination = goals[0].position;

    if (agent.transform.position == goals[0].position) {
        agent.destination = goals[1].position;
    }

}
}

I'm a complete beginner in code, please keep that in mind :)

sentences:
Why the canvas text is gray and not really white? This script change the text color to white:

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

public class DisplayInfo : MonoBehaviour
{
    public string myString;
    public Text myText;
    public float fadeTime;
    public bool displayInfo = false;

    // Use this for initialization
    void Start()
    {
        if (myText == null)
        {
            Debug.LogError(myText + " Is null please add Text component !");
        }

        if (myString == "")
        {
            Debug.LogWarning(myString + " Is empty, No text will be display.");
        }

        myText.color = Color.clear;
    }

    // Update is called once per frame
    void Update()
    {
        FadeText();
    }

    void FadeText()

    {
        if (displayInfo)
        {
            myText.text = myString;
            myText.color = Color.Lerp(myText.color, Color.white, fadeTime * Time.deltaTime);
        }

        else
        {
            myText.color = Color.Lerp(myText.color, Color.clear, fadeTime * Time.deltaTime);
        }
    }
}

This is the script i'm using with the DisplayInfo:

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

public class DetectInteractable : MonoBehaviour
{
    public Camera cam;
    public float distanceToSee;
    public string objectHit;
    public Image image;
    public bool interactableObject = false;
    public DisplayInfo displayInfo;
    public Canvas canvas;

    private RaycastHit whatObjectHit;

    private void Update()
    {
        Debug.DrawRay(cam.transform.position, cam.transform.forward * distanceToSee, Color.magenta);

        if (Physics.Raycast(cam.transform.position, cam.transform.forward, out whatObjectHit, distanceToSee))
        {
            if (whatObjectHit.collider.gameObject.tag == "Interactable")
            {
                image.color = Color.red;
                objectHit = whatObjectHit.collider.gameObject.name;
                interactableObject = true;
                displayInfo = whatObjectHit.collider.gameObject.GetComponent<DisplayInfo>();
                displayInfo.displayInfo = true;
            }
            else
            {
                image.color = Color.white;

                if (displayInfo != null)
                    displayInfo.displayInfo = false;
            }
        }
        else
        {
            image.color = Color.white;

            if (displayInfo != null)
                displayInfo.displayInfo = false;
        }
    }
}

When it's "Interactable" then i display the info about this object.

The DetectInteractable is attached to the Player (FPSController) in the hierarchy:

And on each "Interactable" item i attach the script DisplayInfo:
For example the door:

And this is the editor screenshot before running the game:
Display Infomration is Canvas. The Text i set it's color to white in the inspector.

But when running the game the text i see on objects is gray and i see that on the inspector the white is becoming gray: On the game view window there is a text Security Door in fray it's hard to see it. It should be in white and bright enough to see it clear:

sentences:
Accessing struct in glut I have to write a game for a uni project using openGL / glut. I am just going to use a generic example code as I'm just looking for a solution to one specific problem:

Using glut, I have to call a function 'glutDisplayFunc(display);' in the main function. I am also using an IdleFunc(update). The problem is that, as described here, the 'display' function cannot pass anything. I have some structs outside my main that I wish to be initialized in the main, and be accessible by display and update. Hopefully some code will explain my problem better:

#include <gl/glut.h>

struct Player
{
GLfloat x;
GLfloat y;
GLfloat z;
int score;
...
}

//function prototypes (showing how I would normally pass the struct)
void InitPlayer         (Player &player);
void DrawPlayer         (Player &player);
void UpdatePlayer           (Player &player);

void main (int argc, char **argv)
{

    Player player;

    InitPlayer(player);

    //...
    //glut / openGL initialisation code left out
    //...

glutDisplayFunc         (display);
glutReshapeFunc         (reshape);
glutIdleFunc            (update);

glutMainLoop();

}

void display()
{
DrawPlayer(player);
}

void update ()
{
UpdatePlayer(player);
glutPostRedisplay ();
}
//end

The above code doesn't work: I hope it demonstrates what I would like to do though. Access the struct 'player' in 'display' and 'update', having the same values stored globally. How would I go about ?

sentences:
Trigger the button's onclick after checking that the cursor has been on it for some time I would like to have the mouse hover/click the button for a fixed amount of time (5 seconds) before triggering the onclick method, it can click only after they have hovered for a certain amount of time on one button. I'm using it with the leap motion UI and EventSystem to prevent clicking a button by accident when passing the hand over it.
I tried using the highlight animation and then triggering the event after it but i can't check if the hand has passed through another button and then got back to the previous one.

sentences:
How should I manage level progression? In my code, I just have a Level class right now in the main game loop that just blits a background and spawns some enemies for testing purposes...But I can't figure out how to go about implementing multiple levels and level progression.  What is the best way to manage multiple levels and level progression in a game?

I'm thinking that I would make the Level class just read level data from a file, and create a Level vector...But I'm not sure if that's the best way to do it.

sentences:
Where's the line between homage and copyright infringement? My current WIP game contains a music note collectible mechanic which allows players to play short tunes if collected in the right order (usually very obvious by the layout of the collectibles).
So far, I've kept it at references to Mozart or Beethoven, as this is what fits my game's theme. However, I was thinking of hiding, say, the first few notes of the Mario theme, or of Star Wars' Imperial March, in certain locations, as an homage.

Is this copyright infringement? I assume that having a whole copyrighted song reconstructed note by note like so would constitute a breach of copyright, but how about 10 recognisable notes?

Thanks! :)

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:
Multiple SpriteSheets break batching The problem: I can't fit all my 2d animation sprites for all units and environment in 1 spritesheet.

Everything batches fine until I use two spritesheets... I noticed the following : all units from spritesheet A batch fine until something needs to be rendered fom spritesheet B. so lets say from back to camera : 50units - tree -50 units - camera will result in 3 drawcalls... Not that bad but if you have: unit- tree - unit -tree -unit -tree ... like it's probably most of the time... this wil result in 100+ drawcalls even though you have only two spritesheets...

How can you solve this? Or better, how can i use two spritesheets and have only two drawcalls even though the sprites are at different distances to the camera

Hope this image helps to understand the problem:

1 : the trees are on spritesheet B and batch fine
2: the batching is broken as the unitsprite sits on spritesheet A and is put in between the trees...

sentences:
How to make texture for text displaying using SDL ttf with good performance? In my game, there are many units and for each units there's an information widget attached next to them. I use SDL as the game rendering engine.

I currently want to display their ID for debugging purposes.

However, for each unit, I create a texture with their ID, I render it, then I destroy it.

Needless to say that when there are about 40 units on my screen, the game gets pretty laggy (if its any indication, my game currenly weights 25 MB)

How can I get over this?

sentences:
How can I detect if a gamepad stick has been pushed to the limit? As in the question, really. I want to be able to detect if a gamepad has it's analogue input pushed as far as it can go in any direction.

Given x and y axis values in the range [-1, 1] (-1 being left and down respectively), how can I account for all of the angles between horizontal and vertical, as this means that I can't simply check if abs(axis) == 1.

As I'm unaware of how it might affect it, the engine I'm using is UE4, so any answer could take that into account.

sentences:
Tweening multiple image objects in html5/js Is there an optimal way to choose when tweening multiple images as a single image?

For example let's say i have 10 preloaded image objects in my script, and i want to place them one on top of the other (the arrangement is supposed to be dynamic), and then tween it as a single "collage".

Do javascript tweening libraries like Tweenjs/GSAP etc, care about how many objects you tween concurrently (as long as in the end they move in the same direction and with same speed), or is it transparent for the fact that the hardware will move an array of pixels in the end?

Do you think that it would be better - performance-wize - to pre-combine the multiple images into one larger image, and then feed it to the tweening algorithm?

I would like to do it this way, as it would be more transparent to me, seperating the image "collage" process from the tweening process, but i haven't found a way to dynamically create javascript image objects by combining multiple single images.

Thank you.

sentences:
Unity Webgl build: fast in Chrome, slow in Firefox, Opera and Edge Good day.
I've a Chrome 'factory default' settings that can Run my unity webgl app fast, without problem (between 40 and 60fps).
Same app run at 1 fps in others browsers: edge, firefox and opera.
What can I check to solve ?
Thanks

sentences:
Running two simultaneous animations on a model? I am just looking for a broad answer to this question. I am more curious about the general information rather than the specific. Also, I tried to search for this, but I think it's hard to word it so you get the right question. Anyway:

One common thing I see in a lot of games is multiple animations on the same model.

i.e.

A character runs, but also raises his arms an shoots.

A character has a walking animation, but can also be carrying resources as he walks.

I am curious if the first model has a "run" animation and a "run while shooting" animation. Or if they have a "run" animation and a "shoot" animation and run them at the same time. Obviously the first is possible, but I am wondering how the second one is done.

Do they use two models for upper and lower body or is there a way to ignore certain parts of a model when animating?

I know this depends a lot on the model, the programmer, language and the way the animation is done.

But broadly, if you were making a model with the intent of it doing multiple animations at once, what would be the best way to go about it?

Again, not after detailed specifics, just an overview :)

Thanks!

sentences:
Is there any way to convert .unr file? I'd like to examine a Harry Potter game for study purposes.
All of resources are fine except map file.
The maps are in a .unr file format. I know it is unreal map file.

Is there any way to convert .unr file to .fbx, .obj, or pskx formats?
I want to open map file to 3ds max or blender.

sentences:
Can I make a Flash version of an actual game? Possible Duplicate:
  Legal issues for a “fangame” of a commercial franchise?

For example, some of you may have seen Portal: The Flash Version. I was wondering what the legal background on this kind of stuff is, for example what legal things I'm supposed to say, give credit to the original's creators and all.

Obviously, I'm presuming that I'm not allowed to make money off of it, but I just want to know what restrictions there are of making a free Flash version.

For example, would I be allowed to make a Yu-Gi-Oh! game based off the Power Of Chaos series? And if so, would I be allowed to use the Yu-Gi-Oh name or would I have to call it something else?

sentences:
3D Binary Space Partitioning with solid/empty leaves I've recently started looking into BSPs for real-time collision detection, and I'm now looking into improving the performance of my solution.

The system that I've implemented is rather similar to the solution found on wikipedia (https://en.wikipedia.org/wiki/Binary_space_partitioning), where each node contains triangles found located on the node's hyperplane, and references to two nodes found on each side of the hyperplane.

BSP generation pseudocode:

Node generate_bsp(Trimesh mesh)
Trimesh back, front
Node node(mesh[0]) // Generates the plane position and normal of the node
loop (Triangle tri : mesh)
   if (onPlane(tri, node))
      node.triangles.add(tri)
   else if (inFront(tri, node))
      front.add(tri)
   else if (Behind(tri, node))
      back.add(tri)
   // Not fully in front or behind means that the triangle is found on both sides
   // and needs to be split
   else
      Triangle[] trisSplit = tri.split(node)
      loop (tri2 : trisSplit)
         if (inFront(tri2, node))
            front.add(tri)
         else if (Behind(tri2, node))
            back.add(tri)

node.nodeBack = generate_bsp(back)
node.nodeFront = generate_bsp(front)

return node

This means that for a raycast, I iterate over the hyperplanes sorted from front to back, and determine if my ray hits any of the triangles found on each hyperplane.

BSP raycast pseudocode:

Bool ray_intersect_bsp(Vector rayPos, Vector rayDir, Node* BSP)
if (BSP == null)
   return false

if (onPlane(rayPos, node))
   if (ray_intersect_triangles(rayPos, rayDir, BSP->triangles))
      return true
   if (ray_intersect_bsp(rayPos, rayDir, BSP->nodeFront))
      return true
   if (ray_intersect_bsp(rayPos, rayDir, BSP->nodeBack))
      return true
else if (inFront(rayPos, node))
   if (ray_intersect_bsp(rayPos, rayDir, BSP->nodeFront))
      return true
   if (ray_intersect_triangles(rayPos, rayDir, BSP->triangles))
      return true
   if (ray_intersect_bsp(rayPos, rayDir, BSP->nodeBack))
      return true
else
   if (ray_intersect_bsp(rayPos, rayDir, BSP->nodeBack))
      return true
   if (ray_intersect_triangles(rayPos, rayDir, BSP->triangles))
      return true
   if (ray_intersect_bsp(rayPos, rayDir, BSP->nodeFront))
      return true

return false

This system however demands using ray-triangle intersection determination, which is a costly procedure. What makes matters worse is that there's a high chance that the triangles you iterate on are missed by the ray, which results in a relatively large amount of costly raycasts that need to be performed before finding the closest hit on the trimesh.

What methods can I use to optimize my BSP structure and traversal?

sentences:
Implementing Jump in pygame I have come across a problem in my code for my game. Currently i am developing a 2D platformer game in pygame. I have gotten the character to move left and right, although i haven't been able to get him to jump. I have experimented with a number of possibilities that all haven't worked.

while True:
    #handles user input
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()
        elif event.type == KEYDOWN:
            if (event.key == K_LEFT or event.key == K_a) and player.direction != RIGHT:  #if the left key is pressed
                player.direction = LEFT  #change the direction to left
                player.playerPicture = player.runLeft
                player.playerPicture = player.playerPicture.convert_alpha()
                DISPLAYSURF.blit(player.playerPicture, (player.playerx, player.playery))

            elif (event.key == K_RIGHT or event.key == K_d) and player.direction != LEFT:  #if the right key is pressed
                player.direction = RIGHT #change the directions to right
                player.playerPicture = player.runRight
                player.playerPicture = player.playerPicture.convert_alpha()
                DISPLAYSURF.blit(player.playerPicture, (player.playerx, player.playery))

            elif (event.key == K_UP or event.key == K_w) and player.direction != LEFT and player.direction != RIGHT:
                player.direction = UP
                player.playerPicture = player.jump
                player.playerPicture = player.playerPicture.convert_alpha()
                DISPLAYSURF.blit(player.playerPicture, (player.playerx, player.playery))

            elif event.key == K_ESCAPE: #if the escape key is pressed
                 terminate()  #quit the game

        else:
            player.playerPicture = player.standingStill
            player.playerPicture = player.playerPicture.convert_alpha()
            player.direction = None

    DISPLAYSURF.fill(Black)

    #update game state

    if player.direction == LEFT:
         #if the players position is greater than the left boundary
        if (player.playerx > boundaryLeft):
            player.playerx -= 8 #move the player to the left

        #if the direction is right
    elif player.direction == RIGHT:
        if (player.playerx < boundaryRight): #player is less than the right boundary
            player.playerx += 8  #move the player to the right

    elif player.direction == UP:

This code is in the mainloop of the game. It pretty much checks what key has been pressed, applies the appropriate image for the character and changes the direction. Afterwards the character is manipulated based on the direction that he is facing. If he is facing right, he will walk right etc.

class Player(pygame.sprite.Sprite):
def __init__(self): #constructor
    pygame.sprite.Sprite.__init__(self) #constructor for the sprite
    self.playerPicture = pygame.image.load('JumpLeft.png')
    self.runRight = pygame.image.load('RunRight2.png')
    self.runLeft = pygame.image.load('RunLeft2.png')
    self.jump = pygame.image.load('Jump.png')
    self.playerPicture = self.playerPicture.convert_alpha()
    self.rect = self.playerPicture.get_rect()

    self.standingStill = pygame.image.load('JumpLeft.png')
    self.playerx = windowWidth / 2
    self.playery = windowHeight - 200
    self.direction = None
    self.onGround = False
    self.isJumping = False;
    self.gravity = 1.2
    self.velocity = 0

    self.rect.center = (self.playerx, self.playery)

Current attempts:
So far i've tried

if direction == 'UP':
   player.playery -= 2

which the character pretty much just continuously moves up until the user releases the space button

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:
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:
enemy View Range , chase player for 3D:
Q1 : I want to make zone range for each enemy in the game , so that when the player in the view range he will be chased .

Q2 :if I want to make enemy walk a little bit around his position ( from -10  to 10 ) for example , i.e as he is searching for some one , can you give me just steps ! thanks

Q3 : How to make enemy moves toward Player if he is being detected ?
Sorry for question , but I am new to this world :)

sentences:
Roguelike game: detect intent of other actors by observing their moves In grid turn-based roguelike game, how can I detect the following scenarios:

other actor is following observing actor
other actor is intentionally moving to block its path

Path blocking can happen if for example player intentionally stops right in front of actor and then when actor moves to avoid player, player moves in front and that keeps repeating as long as player does it. I managed to detect that situation in hackish way and I would like to know if there is a better method for solving things like this.

sentences:
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:
Which code module should map physical keys to abstract keys? How do you bridge the gap between the library's low-level event system and your engine's high-level event system? (I'm not necessarily talking about key events, but also about quit events.)

At the top level of my event system, I send out KeyPressedEvents, KeyRelesedEvents and others of this kind. These high-level events only contain the abstract values of the keys (they don't say that Space way pressed, but that the JumpKey was pressed, for example).

Whose responsibility should it be to map the "JumpKey" to an actual key on the keyboard?

sentences:
How to create texture coordinates for a spritesheet with lwjgl Using lwjgl and slick-util I've been trying to use certain pieces of a spritesheet as textures. lwjgl uses glTexCoord2f(); to map coordinates to individual vertices, and the coordinates it takes in are normalized (between 1 and 0), so I've been using this code to make the coordinates only use a small piece of the full Texture:

glTexCoord2f(0 / 128, 0 / 128); glVertex2f(0, 0);
glTexCoord2f(0 / 128, 8 / 128); glVertex2f(0, 32);
glTexCoord2f(8 / 128, 8 / 128); glVertex2f(32, 32);
glTexCoord2f(8 / 128, 0 / 128); glVertex2f(32, 0);

but whenever I used normalized coordinates that are a fraction of the images size I just get a solid square that had 50% alpha.

My question is: what am I doing that's making the texture coordinates screw up? Is there a better way to go about this?

Any help is appreciated, thanks in advance!

sentences:
Instantiating problems I'm beginner here, I'm trying to instantiate a single object every specific duration, either form the left of the screen or from the the right, at the same time I want this object to move to the other side of the screen

So the troubles I'm facing here are:

sometimes 2 objects are being instantiated at the same time.
the objects move in the direction that are defined in the first if statement (both objects on the left and the right move in one direction)

the part where I instantiate objects is in the script(smallFishes) that's attached to an empty gameobject is :

void Start () {
    timer = gameObject.AddComponent<Timer>();
    width = 2f;
    timer.Duration = 3;
    timer.Run();
    left = Resources.Load("Left") as GameObject;
    right = Resources.Load("Right") as GameObject;

}
void Update () {

    if (timer.Finished)
    {
        lr = Random.Range(1, 3);
        if (lr == 1)
        {
            var generetx = -8.8f - width / 2;
            Instantiate(left, new Vector2(generetx, Random.Range(-4.8f,4.8f)), Quaternion.identity);
        }
        else
        {
            var generetx = +8.8f + width / 2;
            Instantiate(right, new Vector2(generetx, Random.Range(-4.8f, 4.8f)), Quaternion.identity);
        }
        timer.Duration = 3;
        timer.Run();
    }

}
public int state
{
    get { return lr; }
}

the part where I make the object move from the script that's attached to the object prefab:

void Start () {
    small = gameObject.AddComponent<smallFishes>();
    rb2d = gameObject.GetComponent<Rigidbody2D>();
}

void Update()
{
    var fishes = GameObject.FindGameObjectsWithTag("small");
    if (fishes!=null)
    {
        if (small.state == 1)
        {
            moveright = new Vector2(4 * Time.deltaTime, 0);
            rb2d.AddForce(moveright, ForceMode2D.Impulse);
        }
        else
        {
            moveleft = new Vector2(-4 * Time.deltaTime, 0);
            rb2d.AddForce(moveleft, ForceMode2D.Impulse);
        }
    }
}

Thanks in advance.

sentences:
How do you map a 3D scene to a stero image pair? I'm a novice.  I'm working in XNA studio with simple models.

How can I turn a 3D image into two images meant for the left and right eyes respectively?

Note: I'm not referring to "magic eye" - I'm wondering how you calculate the left and right images starting from the 3D scene info.

sentences:
Can I switch off scenery elements on a 3D model? I am using a 3D asset that has flat scenery elements (3D island with 2D bushes). [1] Having encountered a number of problems with this scenery [2] I want to deactive it (not visible, not collidable, keep the island itself). Is this possible?

[1]: The asset set in question is http://u3d.as/content/dexsoft-games/platformer-2/3Uo - the problematic objects are things like AmbientOcclusion/platform2_floating_*.fbx which (I can see visually) include bits like plant_9.fbx which are the misbehaving elements.

[2]: The bushes are collidable making it difficult to move around on the island. Specifically you can walk through them in one direction but not the other. On the suggestion of the creator, we unchecked "Generate colliders" on the island model, but doing that means the whole island has no collider and you fall through it! In addition, the alpha levels on the bushes stopped working, and they appear as rectangular elements (alpha values have been lost, replaced by gray/white) - I must've messed up the alpha value setting but can't figure out how to turn it back on. (If comments reveal these issues are fixable I'll expand them into separate questions.)

sentences:
Are there any preexisting maps for a Minecraft-like level I could use in my engine? I am working on a tiny cube-based engine like Minecraft. I was wondering if there is a way for me to get large blocky terrain in a text format that I can use for rendering on my engine?

I don't want to start on procedural generation now, I just want a resource where I can get the coord list for a pretty looking terrain.

Alternatively, is it possible for me to parse the Minecraft world files and use that data to generate terrain/buildings in my code?

sentences:
OpenGL strange color issue I recently made terrain generation for my game, and I created a lighting system (simply diffuse lignting), but there's a strange problem around the edges.

I know, OpenGL interpolates the different values between the vertex shader and fragment shader, but in this case, it comes out strangely. Here is the issue:

The edges of the squares look a little jagged (I use triangles).

I especially don't understand this one:

Every vertex of that area is dark, but the middle is lighter.

Here are the codes for the vertex and fragment shader:

Vertex shader:

#version 330 core

in vec3 vertex;
in vec3 normal;
in vec4 color;

uniform mat4 projection;
uniform mat4 view;
uniform mat4 model;

out vec3 vertexNormal;
out vec3 cameraPos;
out vec3 vert;
out vec4 vertColor;

void main() {
    gl_Position = projection * view * model * vec4(vertex, 1.0);
    vertexNormal = normal;
    cameraPos = vec3(view[3][0], view[3][1], view[3][2]);
    vert = vertex;
    vertColor = color;
}

Fragment shader:

#version 330 core

in vec3 vertexNormal;
in vec3 cameraPos;
in vec3 vert;
in vec4 vertColor;

uniform vec3 sunColor;
uniform vec3 sunDirection;

void main() {
    vec3 toLightVector = -sunDirection;
    vec3 uLightVector = normalize(toLightVector);

    float diffuse = max(dot(uLightVector, vertexNormal), 0.1);
    vec3 lightColor = diffuse * sunColor;

    gl_FragColor = vec4(lightColor, 1.0) * vertColor;
}

sentences: How Would I Design Realistic Fluid Handling? I'm making a game that is like a mix of many other games (Minecraft, Factorio, Don't Starve, Terraria, etc). I want to make pipes and fluid handling like it works in Factorio. I can't seem to find much information on it. I thought about making fluid even out across all connect pipes with less fluid than this pipe, but the order in which I processed pipes would matter a lot. So, how exactly does Factorio work? I also want pumps, if that changes anything.

sentences:
Call function after Level loaded I'm stuck in this situation:

I have a GameObject with a script, that persist trough Level loads.

Inside this script, when a condition is meet, i Load a Level, and also call a function. That function is a C# Messenger Broadcast() function.

The level that I am loading contain the script with the Listener for that Messenger Broadcast.

The problem is that the Broadcast occurs before the level has been loaded, and so there is no Messenger Listener that can receive the event.

  BroadcastException: Broadcasting message OnConnectionError but no listener
  found.

I need to do the Broadcast only after the level has been loaded, but I don't know how, or maybe there is a better solution.

For a simple example here is the code:

public class NetworkingManager : MonoBehaviour {

    void Start(){
        DontDestroyOnLoad (this);
    }

    void OnConnectionLost(BaseEvent _event ){
        if(Application.loadedLevelName != "LoginScreen"){
            Application.LoadLevel ("LoginScreen");
        }
        Debug.Log ("Disconnected. Reason: " + _event.Params["reason"]);
        Messenger<string>.Broadcast ("OnConnectionError", "Disconnected");
    }
}

sentences:
LibGDX - how to make sizeToAction relative to other corner than bottom-left? I'm trying to resize a widget inside a Table.
It's a fullscreen widget and when Android Keyboard comes out, the widget is resized so it fits half of the screen from the top.

SizeByAction works from the left-bottom corner so it resizes the widget down, and I have to resize it up.

For now I use a hack with a parallel action and I change it's size and POSITION in the same time so it looks like a want (like it was staying in the left-top corner all the time).

I know there's a originX and originY but they're used to rotation, not resizing elements.

If someone did something like this before without a hack  like mine, I would be grateful for a tip! :)

How does the widget look like? It's a fullscreen widget:

How does it look after resize?

How I want it to look like?
I want it to rezise relative to it's left-up corner

sentences: How to create memory manipulation and how does it works? How does memory manipulation works for cheats?, how does one create it, i think it must be something to do with your RAM and changed it to give a different value, but how to create it?

sentences:
Odd Android touch event problem (Nexus 10) Overview

When testing my game I came across a bizarre problem with my touch controls.

Note this isn't related to multi-touch as I completely removed my ACTION_POINTER_UP and ACTION_POINTER_DOWN along with my ACTION_MOVE code.  So I'm simply working with ACTION_UP and ACTION_DOWN now and still get the problem.

The problem

I have a left and right button on the left of the screen and a jump button on the right.  Everything works as it should but if I touch a large area of my hand (the fleshy part at the base of the thumb for instance) onto the screen, then release it and then press one of my arrows, the sprite moves in that direction for a few seconds, and then ACTION_UP is mysteriously triggered.  The sprite stops and then if I release my finger and re-apply it to an arrow, the same thing happens.  This goes on and on and eventually (randomly??) stops and everything work OK again.

Test device & OS

Google Nexus 10 Tablet running Jellybean 4.2.2

Code

        //Action upon which to switch
        actionMask = event.getActionMasked();
        //Pointer Index of the currently touching pointer
        pointerIndex = event.getActionIndex();
        //Number of pointers (for multi-touch)
        pointerCount = event.getPointerCount();
        //ID of the pointer currently being processed (Multitouch)
        pointerID = event.getPointerId(pointerIndex);

        switch (actionMask){

        //Primary pointer down
        case MotionEvent.ACTION_DOWN: {

        //if pressing left button then set moving left
        if (isLeftPressed(event.getX(), event.getY())){
                    renderer.setSpriteLeft();
                }

        //if pressing right button then set moving right
        else if (isRightPressed(event.getX(), event.getY())){
                    renderer.setSpriteRight();
                }

        //if pressing jump button then set sprite jumping
        else if (isJumpPressed(event.getX(),event.getY())){
                    renderer.setSpriteState('j', true);
                }

        break;

        }//End of case

        //Primary pointer up
        case MotionEvent.ACTION_UP:{

        //When finger leaves the screen, stop sprite's horizontal movement
            renderer.setSpriteStopped();
            break;
        }

sentences: How to intentionally make an RPG maker game crash? I'm currently working on a game project that involves tricking the user into thinking the game experienced a bug/glitch and crashed. The reason that I want to code this is that I want to hide the file size of the main game, thus separating it into two files. So I want the first file which has x amount of game to crash at a certain point. Then manually give the second half of the game to the user and they can continue on. It may seem a little pointless, but I think stylistically this is a neat concept to try.

sentences:
Receiving keyboard events on a canvas in Javascript I need to receive keyboard events in a canvas element. Click events are received but key presses aren't.

Here is my code which doesn't handle key events:

var canvasElm = $('canvas');
Event.observe('canvas', 'keypress', function(e) {
    console.log('Key event is received!!');
    console.log(e);
});

How can I make it handle those key events?

sentences:
Obstacle avoidance with 2.5D game I'm struggling to make the sprites avoid each other and other obstacles in the field. To achieve something like this:

To do so I decided to have a 3D environment with an Orthographic camera. It all looks as I wanted.

I have set up a plane. My sprites have a 3dCollider and a rigidbody as I want them to be affected by physics.

I move the sprites using RigidBody.MovePosition.

I checked the collisions, how far they where from their target position, etc...

I've tried also a few scripts that intend to do something like this, but I think they are not suitable from what I am doing as after adapting them they don't work.

Can somebody give me some guidance on a simple way to do this? I don't want to use a A* pathfinding system as I think it's too complex to what I want to do, but if I have to use one I will... I just need some guidance on this...

sentences:
How to monetize a free XNA game? I have written a windows based game in XNA. I wish to release it for free but I would also like to monetize it in some way. What are my options?

Possible ways:

Ads - what current libraries/services are available?
Donations - PayPal, what else?
MicroTransactions - what current libraries/services are available?

sentences:
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: 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:
Understanding log/exp formula for RPG experience While looking for examples of RPG experience formulas I came across this one
How to create adjustable formula for RPG level up requirements?, and I would really like to figure it out because I don't seem to get the same results. I'm trying to understand the maths behind it because actually we are using UDK and Unreal scripts for our project.

Thank you in advance for your time.

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: Get 2D mouse delta along 2D angle? I'm trying to develop my own transformation gizmo (with x, y & z handles/arrows the user can grab and move, like in game engines), however, I'm not sure how I should calculate the 2D mouse delta along the 2D angle of the grabbed handle axis. I already have converted the base and tip of the handle/arrow to screen-space, and have calculated the screen-space points' angle between the screen-space base and tip. I'm just stuck on taking the X & Y mouse delta and getting the acceleration of the delta along that 2D angle. I've made a little visualization;

sentences:
What technology does Starcraft 2 use render its maps? I've got a map that is being procedurally generated at run-time and I'm currently investigating methods of rendering this map.
I've taken an interest in the look of Starcraft 2 and I'd like some advise on what methods it employs to achieve it. Secondarily, I'd like to see any tutorials, articles, or even source code examples if possible.

There are a couple of main things I'd like to get some advise on, but please also feel free to suggest anything else that could help me.

Snappable Tilesets - A typical starcraft map seems to consist of a tileset of models that one can snap together to create the cliffs, ramps and other elevated terrain. What methods do they employ to make them look so natural? What I mean is, its very hard to spot repetition.
Terrain Textures - The terrain textures are so varied and even dynamic (Zerg creep). What methods are used to do this?

Thanks.

sentences:
How should I go about handling nonuniformed sprite sheet with JSON data? This might be a lenghty question so bare with me.

I'm developing a 2D game i Monogame framework and I'm stuck with it comes to handle large sprite sheets with different frame width, height and animation. I want to load a sprite sheet that has different animation.

Like this one

Taken from this question

Some frames in this sprite sheet have different width and height, meaning that I can't use a uniform split with spritesheets width / amount of columns because it will not work with all the frames. I have used a tool that gives me cordinates in JSON format like this

{
   "@imagePath": "sprites.png",
   "SubTexture": [
      {
         "@name": "spriteframe1.png",
         "@x": "862",
         "@y": "0",
         "@width": "112",
         "@height": "120"
      },
      {
         "@name": "spriteframe10.png",
         "@x": "0",
         "@y": "320",
         "@width": "252",
         "@height": "156"
      }
}

But here I have problem understanding how I should handle these different frames. How can I switch between animation frames and make sure that the animation loops with state of the object?

E.G If the object in this case flies, I want to loop trough the wing animation but how should I handle it so that only the "Fly-frames" are being looped?

At the moment I have all the frames in a list where every element is a frame with its own x,y,width and height metadata.

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 to correclty play the sounds in a 3D enviornment? I'm currently working on an XNA game with C#. I've been looking into 3D Sounds recently as this is the next objective on my list. I've found several tutorials online and they don't work to the standards I'm after.

What I've found is that even when the player moves, the sounds don't or when the play looks around the sound doesn't change where it's being projected from in my earphones. (When I look at the sound source, I expect to hear it and in front of me, or if I have my left turned to it, then I expect to hear it on my left etc...)

My Code so far:

//Decleration
    private Cue cue;
    private AudioEmitter emitter = new AudioEmitter();
    private AudioListener listener = new AudioListener();
    private AudioEngine engine;
    private WaveBank waveBank;
    private SoundBank soundBank;
    private float angle = 0;

//load content
        engine = new AudioEngine("Content/music/footsteps/footsteps.xgs");
        waveBank = new WaveBank(engine, "Content/music/footsteps/Wave Bank.xwb");
        soundBank = new SoundBank(engine, "Content/music/footsteps/Sound Bank.xsb");

//update
                listener.Position = Vector3.Zero;
                emitter.Position = new Vector3(10, 10, 10);
                cue.Apply3D(listener, emitter);
                cue = soundBank.GetCue("pl_step1");
                cue.Apply3D(listener, emitter);
                cue.Play();

My code works fine in that the sounds are being played and I can hear them, they are just not realistic and so I'm asking if anyone could help me how I could make the sound move around so that it sounds like it does in real life. (If the source/emitter is on my left, the main sounds should be coming through my left earphone.)

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:
Android Game Development. Type Usage for Entity Positions I've recently started developing on Android and have made some basic apps. I now wish to start development on a game project. I have intermediate skill in Java and will be developing with that language in mind. I also have made a couple games for PC in java before. I will be using Native Android Studio for development and not an Engine/Framework.

My question is what is the preffered way to store object positions in Android for a 2D GAME.
The options I have right now are listed below:

Int (Very basic, not precise)
Float
Double
Custom Vector ADT
Other native Android Type.

sentences:
Tweening back from arbitrary 3D rotation in javascript I'm using a 3D javascript library to rotate the vertex of a 3D object with a classic 3x3 matrix, to an arbitrary angle in the 3D space, as depicted in the image below.

For example, a first rotation of 180° about the X axis, and a 2nd rotation of 180° about the Z axis will produce the following result:

Now, i need to tween back the 3D object to the initial rotation, e.g. to 0,0,0 degrees.

Briefly, the 3D figure  shall be return to its initial position.
In this example, the shortest way would be to apply to the figure a 180° rotation about the Y axis.

How can i determine the shortest way, starting from an arbitrary rotation, and then calculate a certain number of intermediate rotation angles to smoothly animate the movement of the 3D figure?

Is this a problem of decomposing a rotation matrix back to Euler angles, or could be this accomplished with pure matrix math?  Should i keep track of the applied rotation angles?  I have really no idea from where to start.

Any hint, preudocode or javascript algorythm that can me point to the right direction would be greatly appreciated!

sentences:
Unity3d - Do I need to destroy gameobject AND script? From proper leak protection do I need to delete both of these or will getting rid of one take care of both?

Currently I am destroying the script AND the gameobject

private void OnDestroy() {
    Destroy(this.gameObject);
    Destroy(this);
}

sentences:
How to process particle effect between UI? I'm developing a game with Unity3D. I found that particle effects would penetrate upper hierarchy UI. Can I show the effect when the UI's sibling index bigger then effect's and hide the effect when the UI's sibling index smaller then effect's?

Here is an illustration:

sentences:
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:
Design patterns for rules systems? As a quick fun project, I tried writing a solitaire game. But when getting to writing up the rules systems, I felt dirty, because my code felt completely unstructured and inextensible, mainly because my game logic was complete spaghetti code.

I've run into this problem before, and always feel awkward when writing this part of my program, so I was wondering, are there any tried and tested best practices when it comes to defining rules in a game?

sentences: How 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:
Array textures on Pixel shader I'm developing on D3D11 and D3D12 in parallel. D3D12 is really difficult, but I learn it gradually. I faced a problem such as passing an array of textures to a vertex Shader. The method Textures2DArray was interesting in D3D11 , but it had disadvantages (size of texture, width and height must be the same, the same levels of MipMaps etc). As a result: I'm looking for a way to transfer a dimensionless ( if it is possible ) texture array, or at least an array of fixed size, but with different textures (*.dds (mipmaps, *.jpg etc). Why is it so necessary? Let's imagine that a model has been loaded. It has 50 textures. I loaded all 50 textures on the CPU, built an array from it, created the necessary descriptors and sent it to the Shader. I get the right texture in the Shader using the index. Thus, there will be one call to the GPU, instead of multiple calls = = number of textures in the model. Thank you for any information.

P.S.: I know about texture atlases, but in ordinary geometry I do not see any benefit from it

sentences:
MCS character mouth open - is this mo cap animation problem? I have MCS Female Character where I can assigned Mocap to my character. I have downloaded mixamo animation and assigned this to the character but the problem is, the character mouth remains open. I am not 3d artist or animation guy, so here are my question.

How can I solve mouth open problem in unity?
What is the reason that mouth is open? Either mocap data has open the mouth or what else problem?

sentences:
AS3 .hitTestObject() not working with Tween function (This was originally in an other senction but many told me to ask here, hopefully someone can answer this)
I am having a major problem in my new browser app.

Okay so I made game where different cubes (squares) spawn at the top of the screen and I use the Tween class to make them go down the screen and then disappear.

However I want to detect a collision when a cube hits the player (that is also a flying cube).

I tried everything, truly everything but it does not seem to work. The problematic thing is that when I remove the "Tween" function it does detect collision with the hitTestObject method but when I add the "Tween" line collision won't be detected anymore.

The code looks like this:

    function enemiesTimer (e:TimerEvent):void {

newEnemy = new Enemy1();
  layer2.addChild(newEnemy);
  newEnemy.x = Math.random() * 700;
  newEnemy.y = 10;
  if (enemiesThere == 0)
  {
      enemiesThere = true;
      player.addEventListener(Event.ENTER_FRAME, collisionDetection)
  }

  var Tween1:Tween = new Tween(newEnemy, "y", null, newEnemy.y, newEnemy.y+distance, movingTime, true); }

The collision detection part:

private function collisionDetection (e:Event):void
  {

      if (player.hitTestObject(newEnemy))
      {
          trace("aaa");
      }

  }

*Another weird thing is that the collision detection works only in the starting point, where the squares spawn but they aren't really there anymore so I don't quite get it.

I hope someone can answer this and maybe tell me how I can code this. Thanks in advance :)

*I've tried out Tweener & TweenMax as well, the problem is always the same

sentences:
Unity mailchimp / Klaviyo subscription form Hey everyone so i want to add a subscription form on my game. so far i can send data to a database and display them on a leaderboard, i found a similar question here but its a bit outdated. Ideally i would like to use klaviyo but since this is the only lead i have i might want to get familiar with how it works!
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;

public class MailingScript : MonoBehaviour
{

    public InputField emailField;
    public InputField nameField;

    public void onClick()
    {
        StartCoroutine(SendToMailChimp());
    }

    private IEnumerator SendToMailChimp()
    {
        WWWForm form = new WWWForm();
        form.AddField("EMAIL", emailField.text);
        form.AddField("b_0f079b7af1cef143021ff4236_6cd74c0a6a", nameField.text);
        //form.AddField("subscribe", "Subscribe");
        UnityWebRequest www = UnityWebRequest.Post("https://slaga-games.us1.list-manage.com/subscribe/post?u=0f079b7af1cef143021ff4236&amp;id=6cd74c0a6a", form);
        yield return www.SendWebRequest();

        if (www.isNetworkError || www.isHttpError)
        {
            Debug.Log(www.error);
        }
        else
        {
            Debug.Log("Registered");
        }
    }
}

this is my code so far but it wont do anything. i have a same code for the database which works!

sentences:
How to efficiently spawn / instantiate a large amount of objects from a prefab I am trying to make a game where the whole world is consists of a very large amount of cubes (sort of a Minecraft / Trove clone), but I keep running into huge performance issues due to the large amount of objects / vertices being rendered at once.

Just to clarify, the problem appears to be caused by the rendering, not the instantiation. I think so based on the fact that when I look away from the cubes, the frame rate will return back to normal (>60).

Is there any way to optimize this? Many answers to similar questions suggest disabling colliders, but that does not really seem to make much of a difference for me. I have also tried making the prefab static, but the problem still remains.

Currently I keep getting ~40 FPS with 10000 cubes (just the built-in cube shape stored as a static prefab with a disabled collider). I believe there should be a way to have a larger amount of objects on screen without having such a performance drop.

Does Unity have any way of storing information about a prefab in graphics card memory that would allow it to mass-render its instances in a more performance-efficient way (much like modern OpenGL uses vertex buffers)?

sentences:
Spritebatch not working in winforms I'm using the Winforms sample on the app hub and everything is working fine except my spritebatch won't draw anything unless I call Invalidate in the Draw method. I have this in my initialize method:

Application.Idle += delegate { Invalidate(); };

I used a breakpoint and it is indeed invalidating my program and it is calling my draw method. I get no errors with the spritebatch and all the textures are loaded I just don't see anything  on the screen. Here's the code I have:

    protected override void Draw()
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);
        spriteBatch.Begin();
        tileSheet.Draw(spriteBatch);
        foreach (Image img in selector)
            img.Draw(spriteBatch);
        spriteBatch.End();
    }

But when I do this:

    protected override void Draw()
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);
        spriteBatch.Begin();
        tileSheet.Draw(spriteBatch);
        foreach (Image img in selector)
            img.Draw(spriteBatch);
        spriteBatch.End();
        Invalidate();
    }

then all of a sudden the drawing starts to work! but the problem is that it freezes everything else and only that control gets updated. What can I do to fix this? It's really frustrating.

sentences:
My SDL Game executable cannot run outside codeblocks After compiling and running SDL programs successfully inside CodeBlocks, when I run them outside CodeBlocks (by clicking .exe file) my program does not run. Instead, it says that libstdc++6.dll is missing from computer.

I have all the SDL dlls, but why is this error happening?

sentences: Importance of templates? From a game developing point of view, how important do you consider templates to be as a topic to know about in C++? Have you used templates as a part of developing games or similar? Neither do I really understand how important templates can be considered from a general point of view.

sentences:
With Unity and Mecanim, how do I trigger an effect animation? We have a Mecanim animation. We'd like to play a particle effect on it at a certain frame in the animation.

Do we need to use an AnimationEvent and have it call a function that triggers the effect? Or is there some editor-only way to do it without script?

We're using Unity 5.3.5.

sentences:
Issues with character controller (unity 4 project in unity 5) I'm having the weirdest issues with a game me and a mate have been working on. They came up immediately after moving from the last version of Unity 4 to Unity 5.

The two objects (player and enemy) return an error "Character Controller Settings are invalid" both on starting and stopping the game.

The enemy settings are:

Slope Limit:        50
Step Offset:        60
Skin Width:         0.003
Min Move Distance:  0
Center:            (0, 0, 0)
Radius:             0.01
Height:             0.01

some of the values have had to be scaled down to accommodate for the scale of the actual model.

Then, whenever the "Move" function calls (which use to have the enemy move towards the player), I get

CharacterController.Move called on inactive controller

which I have located to come from this code:

_controller.Move(moveDirection * Time.deltaTime);

where moveDirection is just a Vector3 co-ordinate of where to move too.

as I said, this was all working before I converted to the new version of Unity. I have checked and confirmed that the Character Controller is both correctly linked and enabled. I have not found anything useful looking up problems others have had with a similar error, and it's pretty much got me stumped.

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:
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:
HTML5 as application for tablets? I'm looking at creating a tablet application (iPad, Nexus, Surface...). I've heard it's possible to create it using HTML5 canvas. I was wondering if it was limited to canvas, if div/input/table can also be used.

Can a normal HTML page be used as an application for the Apple, Microsoft, Android store?

sentences:
Structure of Visual C++ Projects in Visual Studio In particular, I was wondering if it was possible for Visual Studio to treat source files in different directories as all in the same directory. I first saw this after purchasing the Introversion Software Humble Bundle which gave people access to their source code for their previous games from Subversion. I noticed with one of their games that it was split into physical folders for different parts (like "\world", "\lib", ect.), but in Visual Studio the files were put into filters with the same names as the physical folder and all of the files were treated as if they were in the base directory. I also noticed that they included files in the VS project that weren't even in the base project folder. This is what I mean:

Things like the \data folder are included with the folders from \source, even though they are in different directories and levels.

What I also want to know is how to go about including folders and files from different locations and treat them all like they are all in the same place. But most of all, I would like to figure out how they made all source files act like they were all in the base folder, instead of the separate physical folder that they are, as shown by the #includes in the files:

Image Here

As you can see, the app.h/.cpp files are in the "\app" folder, but the includes are able to reference things from "\lib" without including "..\lib" to go up a folder, effectively treating all of the source files like they originate in the base folder.

TL;DR: How does one include multiple folders from different places as filters, and how do you treat all source files like they originate from the same place.

Any help is greatly appreciated, as this will help me organize my project better.
Thanks.

sentences:
Moving turret aiming at moving target I've found this post Turret Aiming Formula on Reddit and a nice answer a while back.

The solution in the answer works great for still sanding turrets but is almost unusable for moving turrets since the speed of the turret is not applied to the bullet speed. The bullet still have the same fixed speed all the time but should be faster if the turret is moving in the same direction.

There are also a lot of answers here, but non of them respects the speed of the turret.

Is it possible do integrate turret speed into this formula or is there any other known solution?

My current code without turret speed:

Vector2f toTarget =  target.position - attacker.position;

float a = Vector2f.dot(target.velocity, target.velocity) - (bulletSpeed * bulletSpeed);
float b = 2 * Vector2f.dot(target.velocity, toTarget);
float c = Vector2f.dot(toTarget, toTarget);

float p = -b / (2 * a);
float q = sqrt((b * b) - 4 * a * c) / (2 * a);

float t1 = p - q;
float t2 = p + q;
float t;

if (t1 > t2 && t2 > 0){
    t = t2;
}
else{
    t = t1;
}

Vector2f aimSpot = target.position + target.velocity * t;

update:

the solution is to use relative velocity instead of target.velocity as suggested in the answer

relativeVelocity = target.velocity - attacker.velocity

and then use bulletSpeed + attacker.velocity for the bullet velocity

sentences:
What is the best way to remove a list reference after the object has been deleted at edit time? Inside a MonoBehaviour MyComponentA I have a list of MyComponentB (also a MonoBehaviour) like so:

List<MyComponentB> myList;

This list gets populated mostly through editor scripts at edit time.
Now say that someone who is editing the scene comes along and deletes a game object that has MyComponentB attached, and also happens to be referenced by the list above.

How can MyComponentA fix the list to remove null references after such a deletion? I basically want to make this automatic so that when designers delete these objects, they dont have to go hunt down which MyComponentA referenced them and fix the list.

My naive approach was to have a circular reference from MyComponentB to MyComponentA (so that it knows which list it belongs in), and then unregister it properly when OnDestroy gets called. This however doesn't work at edit time unfortunately since OnDestroy is not called.

Thanks for your help!

sentences:
Using timer to reverse enemy movement in Flash game made with Flixel I am creating a 2d flash game using Flixel 2.5 in Flash Builder. I am trying to reverse enemy movement on an interval so that they will move back and forth over a set space. I felt that a timer would be best for this situation. The enemy class extends FlxSprite.
I have three class level variables to help with managing the sprite's direction:

private var _movementTimer:Timer;
private var _movementTimerEvent:TimerEvent;
private var _forward:Boolean;
public var _directionSet:int = 0;

In the constructor, I instantiate the timer like this:

//create timer for movement
_movementTimer = new Timer(3000);
//set listener for movement
_movementTimer.addEventListener(TimerEvent.TIMER,SetDirection);
//start timer
_movementTimer.start();
//set initial direction
_forward = true;

The function called on the timer interval is as follows:

/*Reverse direction of this sprite*/
        public function SetDirection():void
        {
            _directionSet++; //increment direction set for debug purposes
            FlxG.log("direction set");
            FlxG.log(_directionSet);

            if(this._forward)
            {
                this._forward = false;
                //set the direction the sprite is facing
                this._facing = RIGHT;
            }
            else
            {
                this._forward = true;
                //set the direction the sprite is facing
                this._facing = LEFT;
            }

        }

Then, the update function evaluates the _forward flag to determine direction of movement:

/*Update this sprite*/
        override public function update():void
        {
            super.update();

            if(this._forward)
            {
                this.acceleration.x = this.maxVelocity.x * .5;
            }
            else
            {
                this.acceleration.x = -this.maxVelocity.x * .5;
            }
        }

However, my sprite is not reversing direction, it just continues forward. What am I missing?

EDIT:

I added additional variables and calls to FlxG.log for debugging purposes, and it seems that SetDirection is never called, but I am not sure why.

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:
Using dom elements for game interaction - slow performance I have a need for my html5 game (using melonjs) to allow users to click tile areas on the map. The idea is it will show a css styled hover area. The browser tested is chrome.

I could do this natively in the game engine but the styling options available for canvas entities is limited. So I went with creating a dom element for each item in the canvas map. As the player moves, I update only the positions of the dom elements which are on the viewport.

Probably 70 total elements are created and only 2-3 are on the screen updating at any given time.

I'm pretty surprised how slow it's making my browser.

So my questions are:

why would updating 2-3 elements as the player moves be so slow?
is it better to remove elements when offscreen then readd when they are back on, even though they arent updating as they move off screen?
should I just scrap the dom solution altogether and rely on the api the canvas and game engines provide for styling

sentences:
Moving OBB vs. triangle intersection test Requirements: to write a test function that, given a moving OBB (oriented bounding box) and a triangle, returns true whenever the OBB hits the triangle.

The OBB is described by its half extents (h1, h2, h3), principal axes (a1, a2, a3) and center point C(cx,cy,cz). The triangle is described by its three vertices (U1, U2, U3). The OBB moves with the velocity V over a period of time of 1 second (hence V is also the displacement the OBB undergoes).

Question:
I have already read Dave Eberly's mini-paper on the matter and made an attempt at an implementation. Also related to this paper, I have a question regarding the w projection of the W velocity: - is w equal to dot(W, L), where L is one of the 13 possible separating axes he considered in that paper?

sentences:
knowing all available entity types I'm making a game where at some point the game will create enemies of random types. Each type of enemy available is defined on its own class derived from an enemy superclass. To do this, obviously the different types of enemies should be known. This is what I have thought of:

Just make a list manually. Very simple to do, but I don't like it because I'll be adding more enemy types over time, so any time I add a new class I have to remember to update this (same if I remove an enemy). I would like some kind of auto-updating list.
A completely component based system. There are no different classes for each enemy, but definitions of enemies in some file where all enemy types can be found. I really don't need that level of complexity for my game. I'm still using a component based model to some degree, but each Enemy type gets defined on its own class.
Java Annotation processing. Give each enemy subclass an annotation like @EnemyType("whatever"), then code an annotation processor that writes in a file all available enemy types. Any time a new class is added the file gets updated after compilation.This gives me a feeling of failure even if its a good solution, it's very dependant on Java, so it means I cant think of a general design good for any kind of language. Also I think that this would be too much work for something so simple.

I would like to see comments on these ideas and other possible solutions

Thanks

sentences:
How do I find the closest points(thereby forming a polygon) enclosing a particular point?(see image) I am working with a game engine, and my task is to add code for simulating fracture of rigid meshes.

Right now I'm only working on breaking a cube.

I am using Voronoi's algorithm to make a (realistic)fractured shard and I am using the half-plane method to generate a Voronoi cell.

Now the way I do this is for every seed point, I make planes that are perpendicular bisector planes(the straight black lines in the image) with rest of the seed points and I calculate the intersections of all these planes to give me distinct points(all the orange dots).

I've gotten this far.

Out of all these calculated intersection points, I only need the ones that are closest and enclosing the seed point(the points encircled in red) and I need to discard all the rest.

Information that I have :

1) Plane equations of all planes(defined by normalized normal vectors and their distance from origin)

2) Points of intersection(that I've calculated)

Can anybody help me find out how I can find the points encircled in red?

sentences:
How to access random material in a renderer besides first without cloning any materials except accessed one? Clones only first material:

renderer.material

Clones all materials in the same renderer:

renderer.materials[0]

sentences:
Unity: Car Rollover Protection I have a standart Unity car with Unity Car physics.
What would be the best approach to protect my car from a rollover?

I dont want to mess up and try and error 10 different approaches, so maybe here is an expert who really knows how to do it right?

I couldnt find anything decent on the internet.

sentences:
Is using the applet class in a Java game a wise thing to do? I am making an 2D multiplayer game in Java project, by using Java sockets and simple  java.applet.*

Our teacher told us to use J2EE concepts in the project. Do I have to use JSP? Is it better or more employable in game development?

Am I doing the correct thing?

sentences:
Interface or Class Inheritance I am making an inventory system. Different inventory item will have different uses so i am thinking about making a base class called InventoryItem and derive Wood, Gold, Weapons and so on. This way all InventoryItems will share some basic functionality and can have their unique as well.

My questions are:

If instead i use a interface i cannot count on specific fields or variables as it only takes methods. Is there any reason to use interfaces?
If i use derived classes and have a List with mixed items from different derived classes i would need some code that goes through each class and casts it to the proper class to use its unique abilities. How is this best handled?

sentences:
Time based movement Vs Frame rate based movement? I'm new to Game programmming and SDL, and I have been following Lazyfoo's SDL tutorials. My question is related to time based motion and frame rate based motion, basically which is better or appropriate depending on situations?. Could you give me an example where each of these methods are used?.

Another question I have is that, in lazyfoo's two Motion tutorials (FPS based and time based) The time based method showed a much smoother animation while the Frame rate based one was a little hiccupy, meaning you could clearly see the gap between the previous location of the dot and its current position when you compare the two programs.

As beginner which method should I stick to?(all I want is smooth animations).

sentences:
No collision detected with 2D rigidbody No collision detected with 2D rigidbody
0
I have a ZombieBoy with a circle collider2D and a box collider2D and a RigidBody2D . The player shots energy balls which has a Circle Collider2D and a Rigidbody2D. It is set to trigger. But i have also tried without it set to trigger.

The ZombieBoy has this on its script

        void OnTriggerEnter (Collider other)
       {
          Debug.Log ("Im hit! " + other.name);
       }

       void OnCollisionEnter (Collision collision)
       {

          Debug.Log ("Im hit! " + collision.gameObject.name);
       }

But i get nothing in the console, and no breakpoints react.

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:
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:
Sprite disappears after adding a material to it I have background which is FirsLayer, order in layer 0 and platform over it which is FirstLayer, order in layer 1.

Once I add a material to the platform, the layer doesn't seem to change but it gets rendered behind the background.

The material that I add:

1)Why do I get such results?

2) How can I add the material to the platform and still keep it above the background?

P.S. For further clarification if somebody didn't understand, I expected the sprite to stay on its original position(i.e. not to go behind the background when a material is being added to it)

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:
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:
Additive scene loading to UNet I have a main scene where my player is loading as I start or join the server. On some player action, I want to load additive scenes in to my main scene. It is loading fine on the client, but not across the network. My other clients are unable to watch it.

I checked different links, and found a forum post and a Unity Suggestions page. It seems, to me, that this "Additive scene loading to UNet" feature is not available in Unity.

If additive scene loading in UNet is not available, then what are the alternatives?

I am able to load scene through [ClientRpc]. Is this the correct way to do this?

[ClientRpc]
public void RpcLoadLevelAcrossNetwork()
{
    SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Additive);
}

sentences: Estimated framerate for custom engine? I've been writing my own engine with C++ and DirectX 11. I've got 3d models loaded in with diffuse maps, normal maps, and shadows. There's other things with the engine but my question doesn't pertain to those parts. What estimated framerate should I be getting from a simple cube with all the maps on it. And a moving shadow? Obviously my computer specs make the biggest difference. But lets say anywhere from Nvidia 500 series to 700. Personally I have a GT 750m. So whats a rough estimate of framerate to be getting? Dont want to keep building something that has a major framerate flaw.

sentences:
How to setup engine properly in ktx-ashley? I'm trying to setup simplest Ashley project with only 2 entities and get this error:

Exception in thread "LWJGL Application" java.lang.IllegalStateException: createComponent(T::class.java).apply(configure) must not be null

Here is the code:

class AshleyScreen(game: Main): KtxScreen {

    private val engine = Engine()

    override fun show() {
        engine.add {
            entity {
                with<DrawableComponent> {
                    sprite = Sprite(Texture("image1.png"))
                }
                with<TransformComponent> {
                    position.set(0f, 400f)
                }
            }
            entity {
                with<DrawableComponent> {
                    sprite = Sprite(Texture("image2.png"))
                }
                with<TransformComponent> {
                    position.set(500f, 50f)
                }
            }
        }
        val renderSystem = RenderSystem()
        engine.addSystem(renderSystem)
    }

    override fun render(delta: Float) {
        engine.update(delta)
    }
}

// Components
class DrawableComponent(var sprite: Sprite): Component
class TransformComponent(val position: Vector2 = Vector2()): Component

//Systems
class RenderSystem: IteratingSystem(allOf(DrawableComponent::class).get()) {
    val batch = SpriteBatch()
    val tm = ComponentMapper.getFor(TransformComponent::class.java)
    val dm = ComponentMapper.getFor(DrawableComponent::class.java)

    override fun processEntity(entity: Entity, deltaTime: Float) {
        val t = tm[entity]
        val d = dm[entity]
        d.sprite.setPosition(t.position.x, t.position.y)

        clearScreen(0.8f, 0.8f, 0.8f)
        batch.begin()
        d.sprite.draw(batch)
        batch.end()
    }
}

Compiler complains on engine.add line.

sentences: Voxel sparse octrees for indirect illumination I don't understand the use of voxel sparse octrees for indirect illumination calculations. First of all, what exactly is happing? We're rendering the scene as usual with diffuse lighting. In the meantime, we're maintaining the octree of our scene. But when do we use it and for what exactly?

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:
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 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:
How to calculate FPS and what factors affect FPS? In this case, FPS means Frames Per Second and that means the number of frames that graphic hardware render in one second. I'm wondering what kind of stuffs could affect FPS?

So, for some tests I created a simple scene in Unity with some cubes and capsules and then create a empty game object and then add this c# code to it:

public class FPSReport : MonoBehaviour {

    public double Fps;

    void Update ()
    {
        Fps = 1.0 / Time.deltaTime;
    }
}

I think it can tell me the FPS. When I played it it worked but it wasn't more than 30.

I was saw a lot of games that their fps was normally on 150. Is this fps rate ok?

If I add more objects, textures, animations , etc ... to my scene.

What happen to my fps?
Could it attain zero? and
If it attain zero, what is the meaning of a zero FPS (the hardware stopped working?!)?

sentences:
Unity prefab functionality without files? Task

Display a UI list

Assumptions

Most UI parts only get their data during runtime
UI parts need to be styled in the editor (= before runtime)
UI editing should be done with real time preview in the editor
The items in UI list should look the same

Current solution

Save a list item prototype as a prefab (drag&drop in the editor)
Set that prefab as the reference in the script managing the list
During runtime, instantiate the referenced prefab as needed

However, this needs a prefab file, which seems like an unnecessary additional point of failure. Just one annoying example: More often than not I forget to click "Apply" after editing such a prototype - which only becomes apparent at runtime.

Suggested solution

In the script managing the list, set the list item prototype as a reference
On Awake(), create a prefab and store it in a class field
During runtime, instantiate the prefab from the class field

Question

I got the suggested solution working withPrefabUtility.CreatePrefab(). The only issue with that is that it still saves a prefab file. I currently just save those to a temp directory, but that is a workaround.
Is it possible to have a prefab which does not exist as a file, but still allows copying with Instantiate()?

sentences:
Converting eulerAngles to "Inspector rotation" The inspector shows certain rotation values for Game Objects.

I would like to work with these instead of the eulerAngles (which are the rotation values that I can access by a script).

To get these rotation values shown by the Inspector, I found out that the eulerAngles of the game object's localRotation could be of help.

I'm not sure if my approach is correct.

Can somebody tell me what I'm actually trying to do here (I guess there is a name for it) and how to do that correctly?

My current approach is this:

private float EulerToRotation(float value)
{
    if (value > 180)
    {
        return value - 360f;
    }
    else if (value < -180)
    {
        return value + 360f;
    }
    else
    {
        return value;
    }
}

sentences:
GLSL shader without a vertex array Ok so I have a idea for a neat GPU driven curve renderer, and I realised that the vertex shader can be hardwired to generate points of the curve segment (to be rendered as a line strip) without sending any vertex positions - gl_Position could be set completely procedurally.

That said I'd still need to specify a "t" value per point via vertex attributes.

Is it possible to specify attributes (ie via glVertexAttribPointer) without specifying vertices? Or does the GL need "space" in the buffers for vertices - even if they aren't initialized.

sentences:
UI Button OnClick not playing AudioClip on gameObject Basically, I am loading an Audio Clip onto a game object's Audio Source in the Awake function when the game starts. When I click on the game object a UI comes up that basically has a Play button attached and all I want to do is play the Audio Clip on the Audio Source. The problem is I can see that there is an Audio Clip on the Audio Source at runtime and I can play it in the inspector at runtime but, when I click the button nothing happens. I have tried just referencing the gameObject in the OnClick() of the UI button and that doesn't work and I have also tried going through and getting the gameObject through GameObject.Find

public void PlayMe()
    {
        GameObject[] objs = GameObject.FindGameObjectsWithTag("Voice_log");
        foreach (GameObject obj in objs)
        {
            if (obj.layer == LayerMask.NameToLayer("Selected"))
            {
                Debug.Log("Found it");
                if (obj.GetComponent<AudioSource>().clip.loadState == AudioDataLoadState.Loaded)
                {
                    obj.GetComponent<AudioSource>().Play();
                    Debug.Log("Should Play");
                }
            }
        }
    }

Both of my Debugs print when I click the Play button.

sentences:
Game Maker Studio 2, Shaders not working as intended in webbrowsers on mac The shader output of my html5 game in Game Maker Studio 2 looks wrong on  webbrowsers on MacOS. Sometimes the shaders lack completely and at other times the shader colors look completely different. How can I make the shaders work like they are intended to for safari webbrowsers?

See images below:

Mac webbrowser lacking shaders on squares

Other browsers not lacking shaders on squares

Mac webbrowser  different color hexagon

Other browsers intended colors

sentences:
Unity - blur only selected layers I'm messing around with Unity 2017's post processing tools while making a 2D game that benefits from the parallaxing effect using a perspective camera.
Please note that the game is mostly made using sprites.

Now, I have a playerGround, a backGround and a foreGround. I wish to blur the background and foreground only but not the playerground.
I'd like to know how to do this as playing with the focal length didn't do anything, everything receives the same blur amount regardless of the distance from camera.

sentences:
Making Cave system in Unity 5 I know there are many threads about this but none of them seems to work for me and I spent like 2 days already on that problem. Things that I've checked:

http://wiki.unity3d.com/index.php/TerrainTransparency
http://forum.unity3d.com/threads/hollowed-mountain.7791
http://forum.unity3d.com/threads/hiding-parts-of-terrain.31734/#post-266593
http://www.blog.radiator.debacle.us/2012/08/how-to-dig-holes-in-unity3d-terrains.html
http://www.smokymonkeys.com/kyrill/index.asp?direct=22

It's like I see the way to accomplish that but can't really glue all the pieces together. It seems that to make a "hole" in terrain we have to:

Place an Cube/Plane with depth-mask shader onto our terrain (mountainside e.g)
Add collider to it and script with OnTriggerEnter/Exit where we have to ignore collision between player and terrain
Put an object with our cave system (made in 3ds/blender) inside our mount-shaped terrain and camouflage the edge of entrance with other objects e.g rocks so we wont see any artifacts.

I don't want to use voxel terrain, instead of depth-mask I could use transparent terrain texture paint option.

Do You know any working example for version 5.3.5 or could You help me somehow with it?

sentences:
geometry shader shim for opengl es 2.0 I just have a few months of OpenGL experience, just starting to get the hang of it.

I find geometry/vertex/fragment shaders to be very powerful. You have a few parameters that translates into a complex representation. One layer of your program can compute these parameters, the "model" only, and sharers can do the "view" part. That gives you a good separation of concerns and a lot of flexibility.

It's a pity that OpenGL ES 2 doesn't have geometry shaders. I think the CPU could totally take over this part in case the GPU doesn't support it and if proper shim libraries were present.

Is there any library that helps unfolding a model into vertexes / vertex attribute parameters / uniques, etc? Maybe one that uses the language of the geometry shaders?

sentences:
How to Create a Perfect Dash (Quick Movement) in Pygame I am trying to create 2d side scrolling platform similar to Megaman. Here is the progress so far:

Red box is the spriteholder while blue box is the hitbox of the character. The sprite I use is random idle sprite I found on the internet.

My question will revolve around the quick movement, where the character will accelerate faster than their usual speed for certain distance / time / sprite index.
This is my take currently on the problem:

def dash_left(self):
    self.sprite.index = 0
    self.sprite.rect.midbottom = self.rect.midbottom
    if self.dash_current_use > 0:
        self.vx = -1.5 * self.speed
        self.ax = (self.speed * 0.5)
        self.status = -3
        self.dash_current_use -= 1

on the def main():

if event.type == g.KEYDOWN:
    if event.key == g.K_q:
        player.dash_left()

if event.type == g.KEYUP:
    if event.key == g.K_q and player.vx < 0:
        player.stop_left()

The problem is that in my take, the dash will go continuously as long as the player pressed Q, or upon collision. My aim is for the dash to be able to stop itself, preferred when a certain distance has been passed or when ax (velocity variable from outside force) is greater or lesser - depending on the direction - than the vx (velocity variable from input.)

sentences:
How can I implement shader lookups for my material system? I have been working on a material system and for the most part everything works just fine, however, I hard code the shader that will be used. Obviously this causes a problem when I want to have the materials be saved through the material editor.

What I ended up doing was having the material save "attributes". These attributes would know if the material is using a texture or diffuse color (that's it for now). I then have a VS/PS to render objects with a texture or a diffuse color. Then for each of those, I have shaders for either no lighting, or my lighting system. Right there that will leave eight different shaders, so you can see where the complexity comes in with which ones to pick. Also, that is only if all the objects all have the same vertex type (position, tex coord, normal). However, that is not always the case, as some times the geometry may be built differently.

My question is, how can a propery shader lookup system be written for a material system? There comes into two things I can think of

Shaders based upon different lighting models
Shaders based upon different vertex formats

sentences:
Texture not working on object I have a project that I'm having a bit of trouble with. Let me try and explain. In short, I'm trying to apply a texture to an object, but instead it is a solid color.

I built a building in "Autodesk 123d design", and exported it as stl. Then I used an online converter to convert it to obj, then added that to the unity scene. I created a material with a texture and tried to apply it to the object, but it was a solid color.

I think the UVs on the object might be messed up. I tried some things in blender, but had no luck. Any ideas on how I can fix this?

Edit:

Here is the 3D model I'm working with: http://www.123dapp.com/123D_Design/Conisbrough-Castle-Keep/4578568

sentences:
Scaling Model in XNA, keep position I am trying to create a little fun 3D game in XNA, but I am having some problems with scaling my models. I use models from random sites, so my battleship is for an example 10 times larger than my planet.

I thought I had found out how to scale my model, but it does not show up when I do, or the coordinates get really messed up. Is there a way to scale my models but still keep the same position system?

Here is my model base class.

public class BaseModel
{
    protected Matrix world = Matrix.Identity;
    protected Matrix RotationMatrix = Matrix.Identity;
    protected Model model;
    protected float scale = 1.0f;
    protected Vector3 direction;

    public Vector3 Position
    {
        get
        {
            return world.Translation;
        }
        set
        {
            world = Matrix.CreateTranslation(value);
        }
    }

    public BaseModel(Model model, Vector3 position, float scale = 1)
        : this(model, position, Vector3.Zero, Matrix.Identity, scale)
    {
    }
    public BaseModel(Model model, Vector3 position, Vector3 direction, float scale = 1)
        : this(model, position, direction, Matrix.Identity, scale)
    {
    }
    public BaseModel(Model model, Vector3 position, Vector3 direction, Matrix rotationMatrix, float scale = 1)
    {
        this.model = model;
        this.Position = position;
        this.direction = direction;
        this.RotationMatrix = rotationMatrix;
        this.scale = scale;
    }

    public virtual void Update(GameTime gameTime)
    {
        world *= Matrix.CreateTranslation(direction);
    }

    public virtual void Draw(GameTime gameTime, Camera camera)
    {
        Matrix[] modelTransforms = new Matrix[model.Bones.Count];
        model.CopyAbsoluteBoneTransformsTo(modelTransforms);
        Matrix wworld = GetWorld();

        foreach (ModelMesh mesh in model.Meshes)
        {
            foreach (BasicEffect effect in mesh.Effects)
            {
                effect.EnableDefaultLighting();
                effect.World = modelTransforms[mesh.ParentBone.Index] * wworld;
                effect.View = camera.view;
                effect.Projection = camera.projection;
            }
            mesh.Draw();
        }
    }

    public virtual Matrix GetWorld()
    {
        return RotationMatrix * world * Matrix.CreateScale(scale);
    }

    public virtual Model GetModel()
    {
        return model;
    }

    public virtual bool CollidesWith(Model otherModel, Matrix otherWorld)
    {
        // Loop through each ModelMesh in both objects and compare
        // all bounding spheres for collisions
        foreach (ModelMesh myModelMeshes in model.Meshes)
        {
            foreach (ModelMesh hisModelMeshes in otherModel.Meshes)
            {
                if (myModelMeshes.BoundingSphere.Transform(
                    GetWorld()).Intersects(
                    hisModelMeshes.BoundingSphere.Transform(otherWorld)))
                    return true;
            }
        }
        return false;
    }
}

sentences:
Rotate sphere in Javascript / three.js while moving along x/z plane I have a sphere/ball in three.js which I want to "roll" around on the x/z plane. For the z axis I could simply do this no matter what the current x and y rotation is:

sphere.roll_z = function(distance) {
      sphere.position.z += distance;
      sphere.rotation.x += distance > 0 ? 0.05 : -0.05;
    }

But how can I roll it along the x axis? And how could I properly do the roll_z? I've found a lot about quaternion and matrices, but I can't figure out how to use them properly to achieve my (rather simple) goal.

I'm aware that I have to update multiple rotations and that I have to calculate how far to rotate the sphere to match the distance, but the "how" is the question. It's probably just lack of mathematical skills which I should train, but a working example/short explanation would help a lot to start with.

Here is an example of how the rotation goes wrong (WASD movement): http://js.blockheaven.net/simple.html

sentences:
Why distant objects are being drawn in front of close objects? I am rendering two cubes in the space using XNA 4.0 and the layering of objects only works from certain angles.

Here is what I see from the front angle (everything ok)

Here is what I see from behind

This is my draw method. Cubes are drawn by serverManager and serverManager1

        protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);
        switch (_gameStateFSM.State)
        {
            case GameFSMState.GameStateFSM.INTROSCREEN:
                spriteBatch.Begin();
                introscreen.Draw(spriteBatch);
                spriteBatch.End();
                break;
            case GameFSMState.GameStateFSM.GAME:
                spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);

                // Text
                screenMessagesManager.Draw(spriteBatch, firstPersonCamera.cameraPosition, fpsHelper.framesPerSecond);

                // Camera
                firstPersonCamera.Draw();

                // Servers
                serverManager.Draw(GraphicsDevice, firstPersonCamera.viewMatrix, firstPersonCamera.projMatrix);
                serverManager1.Draw(GraphicsDevice, firstPersonCamera.viewMatrix, firstPersonCamera.projMatrix);

                // Room
                //roomManager.Draw(GraphicsDevice, firstPersonCamera.viewMatrix);

                spriteBatch.End();

                break;
            case GameFSMState.GameStateFSM.EXITGAME:
                break;
            default:
                break;
        }

        base.Draw(gameTime);
        fpsHelper.IncrementFrameCounter();
    }

serverManager and serverManager1 are instances of the same class ServerManager that draws a cube. The draw method for ServerManager is:

        public void Draw(GraphicsDevice graphicsDevice, Matrix viewMatrix, Matrix projectionMatrix)
    {
        cubeEffect.World = Matrix.CreateTranslation(modelPosition); // Set the World matrix which defines the position of the cube
        cubeEffect.View = viewMatrix; // Set the View matrix which defines the camera and what it's looking at
        cubeEffect.Projection = projectionMatrix;

        // Enable textures on the Cube Effect. this is necessary to texture the model
        cubeEffect.TextureEnabled = true;
        cubeEffect.Texture = cubeTexture;
        // Enable some pretty lights
        cubeEffect.EnableDefaultLighting();
        // apply the effect and render the cube
        foreach (EffectPass pass in cubeEffect.CurrentTechnique.Passes)
        {
            pass.Apply();
            cubeToDraw.RenderToDevice(graphicsDevice);
        }

    }

Obviously there is something I am doing wrong. Any hint of where to look? (Maybe z-buffer or occlusion tests?)

sentences:
Cell height with heightmap for collision detection Hello everyone I'm programming a game with c++ and openGL. My world is generated from a heightmap (100x100 matrix with values 0-255) and now I need a function that returns the actual height based on which triangle of the heightmap I am.
I wrote this code

float Terrain::getCollisionHeight(float x, float z) {
    float x_pos = x / lato;
    float z_pos = z / lato;

    float _x = x-x_pos;
    float _z = z-z_pos;

    float m = _x / _z;

    float hp0 = hm->getHeight(x_pos,     z_pos)     / divider;
    float hp3 = hm->getHeight(x_pos + 1, z_pos)     / divider;
    float hp2 = hm->getHeight(x_pos + 1, z_pos + 1) / divider;
    float hp1 = hm->getHeight(x_pos,     z_pos + 1) / divider;
    cout << "HP: " << hp0 << " " << hp1 << " " << hp2 << " " << hp3 << endl;
    if (_x >= _z) {
        cout << "Upper triangle" << endl;
        float zp12;
        if (_z == 0) zp12 = lato;
        else zp12 = m*lato;
        float i1 = hp1 + (hp2 - hp1)*zp12/lato;
        return hp0 + (i1 - hp0)*_z / sqrt(0.5*0.5 + zp12*zp12);
    } else {
        float xp23;
        if (_z == 0) xp23 = lato;
        else xp23 = m*lato;
        float i1 = hp2 + (hp3 - hp2)*xp23 / lato;
        return hp0 + (i1 - hp0)*_x / sqrt(0.5*0.5 + xp23*xp23);
    }

but it returns wrong values (e.g. when i interpolate 135 and 117 it returns something like 140 which is greater than both of them).
The cases are separated because i always draw two triangles merged as a square.
Can you help me returning the right interpolation value? Thanks a lot

sentences:
How can I find the difference between rotations represented as angles in [0, 360]? What is the easiest way to find the difference between two 2D rotations/directions?

I want to test if one rotation is within 10° of another. I would just subtract, but there are some problems because I want to keep each rotation between 0 and 359. E.g. 0 is within 10° of 359, but simple subtraction would claim that they're 359 degrees apart.

sentences:
Way to avoid excessively bright objects with specular lighting? I have a typical Phong shading with specular light. I have all the parameters tuned so to give appropriate highlights from a point light source. Now the problem I have is a new object that has a large flat surface which tends to face directly towards the light source (which is a bit offset from the camera). It also has a normal map which is primarily in one direction (steel panels). This results in a pure white object.

I have a lot of options to try and work around the problem, but I was wondering if this is a common issue and perhaps there is a clean workaround. The various options I see (and am trying) are:

Reduce specular map intensity. There are two problems here, first when the object is not facing the camera it looks dull, second on a low quality setting I don't use specular maps.
Clamp the range of specular light. This of course limits the highlights for the entire scene. It also limits the highlights when the object isn't facing the camera.
Put a per-object specular light limit. This at least doesn't affect the whole scene, but does dullen this object when not facing the camera.

sentences:
Real cash gambling app I am making a cash game like deal or no deal for use as an android app, using adobe software.

The idea is player wagers 50 pence through Paypal plays the game wins, say, £10 pounds and then cash out.

How do I create a cash pay and play system probably with Paypal? I have done the art work and the basic flash script, i.e. actions and movie.

I will also need some sort of data feedback to prevent hacking of game, I think, and to be able to send updates and be able to remotely alter win percentages according to profits and losses.

Will the user need to be connected to a server?

Can someone help guide me through what the steps I need to do?

sentences:
Maximum number of controllers Unity3D can handle I've been trying to find out the maximum amount of xbox controller Unity3D can handle on one editor. I know through networking, Unity is capable of having as many people as your hardware can handle. But I want to avoid networking as much as possible.

Thus, on a single computer, and in a single screen (think Bomberman and Super Smash Brothers) how many xbox controllers can Unity3D support?

I have done work in XNA and remember that only being capable of support 4, but for the life of me, I can't find any information that tells me how many Unity can support.

sentences:
How to define data for an input sequence game? I'm starting to program my very first game, it's a clone of DDR/Stepmania done for research purposes and learning.

I (at this early stage) get most of the UI/Music/input work that should be done, but what i still can't grasp is scripting, i've read about Lua and that you shouldn't use it with XNA/Monogame as C# is capable enough, but i cannot get the utility of it.

Assuming the needs of my game, What would be the ideal way to implement the input sequences it needs?, i thought of XML/Json, let's say Stage 1

<game>
 <level id="1">
  <step id="1" key="up" time="00:00:01"/>
  <step id="2" key="left" time="00:00:02"/>
 </level>
</game>

Is that a correct implementation? or are there better ways with more benefits?

sentences:
Problem displaying drawing of a path in camera/viewport I have an adm object, which draws the path in the room like this (Object ADM - Draw Event):

draw_set_color(c_black);

repeat(5){
    repeat(5){
        draw_path(circuito_australia,684+i,568+j,false);
        j+=1;
    }
    i+=1;
    j=0;
}

i=0;
j=0;

Result:

I created 2 viewports, to more closely display specific cars:

And this problem happens, parts of the circuit in the view of these cameras are wrong/bugged:

The reason I know (or at least I imagine) is because I'm taking a part of the room and doubling its display.

Any ideas on how to get around this?

sentences:
Separation of axis theorem implementation at normals This might be more of a math question, but it relates to the development of a simple physics engine I am trying to create.

I have been stumped on this for about a week now, and have been unable to find an answer in any of the SAT tutorials. (http://www.metanetsoftware.com/technique/tutorialA.html#toc, http://gamedevelopment.tutsplus.com/tutorials/collision-detection-using-the-separating-axis-theorem--gamedev-169, etc.)

I understand how SAT is supposed to work, however I am little confused on the math. First, I am finding my normals like so:

Block.prototype.findNormals = function () {

        var axisVectors = new Array();
        var vertices = this.Properties.Vertices;
        var keys = Object.keys(vertices)

        for( var i = 0; i < keys.length; i++) {
            var last = {x: 0, y: 0};

            axisVectors.push({xComponent: -(vertices[keys[i]].y - last.y), yComponent: (vertices[keys[i]].x - last.x) });

            last = {x: this.x, y: this.y};
        }

        return axisVectors;
    }

I am then precede to project each vertex of the shapes I am testing on those normals.

The problem occurs, and the part of the math that I am not fully understanding, is when I have a situation like so:

axis = (-5, 6)
vertex = (6, 5)

math.dot(vertex, axis)

This results in 0.

Thus my min value for shape1 is always 0. And this results in a false collision.

Can anyone explain the math a little better?

sentences:
How to prioritize related game entity components? I want to make a game where you have to run over a bunch of zombies with your car. When moving around, the zombies have a few things to take into consideration:

When there's no player around they might just roam about randomly. And even when some other component dictates a specific direction, they should wobble to the left and right randomly (like drunk people). This implies a small, random, deviation in their movement.
They should avoid static obstacles. When they see they are headed towards a wall, they should reorient themselves.
They should avoid the car. They should try to predict where the car will be based on its velocity and try to move out of the way.
When they can, they should try to get near the player.

All these types of decisions they have to do seem like they should be implemented in different components. But how should I manage them? How can I give different components different weights that reflect the importance of each decision (in a given situation)?

I would need some other component that acts as a manager, but do you have any tips on how I should implement it? Or maybe there's a better solution?...

sentences: How to unpack game data files encrypted with AES key? In game development pak files are secured by some encryption and one of these are AES key. I want to know that for security purpose is the AES key is stored in the game files itself? I know that computer cannot store the AES key in his mind so it need some clues or files to extract these Ppak files, so where does these AES keys gets stored in a game file itself?

sentences:
ELO Rating System & Multiple Games Against the Same Player I've decided to use the ELO rating system for my chess-like strategy game.

I've implemented the algorithm but I don't really understand it completely (I'm not a maths person)...

I've decided to give starting rank of 1000 for new players, and I use 32 as max increase.

Now for my actual question:

Let's say that player A plays hundreds of games against player B, and player A is much better player (or player A has created a dummy account so that he cheats!).

Do I need to take this in account in any way "manually" or does ELO handle this "automatically"? I mean, ultimately the difference between the two players will be so great that the "cheater" gets only +1 to his rank? So he would possibly have to play LOTS of games to cheat/climb up the ladder this way? Am I correct?

I REALLY wouldn't want to disallow the ladder system completely for friend vs friend (invited matches). And I shouldn't need to: even www.chess.com handles this in some way.

sentences:
Collision detection between player and tiles I am trying to implement basic (for now) collision detection into my platformer. I have tiles that are each 16 x 16 in size. The character is 32 x 32 pixels in size and has its own bounding box. Now, in my Tile class, I have a bool, isSolid. Each of these tiles in my array also have a rect for their respective bounding boxes.

I am checking to see if there's an intersection between the player and tiles by doing:

if (player.GetBoundingBox().Intersects(map.tiles[(int)player.position.Y / 16,
(int)player.position.X / 16].bounds) && map.tiles[(int)player.position.Y / 16,
(int)player.position.X / 16].isSolid)
{
...
}

Now, my problem is that this is extremely inaccurate as I'm rounding off the position. I'm tired as heck right now and for the life of me I can't figure out how to properly do this. What is the best way to approach this issue?

sentences: How to get the point of collision in Separating Axis Theorem? I'm interested in the relatively precise point (not line) of collision for calculating angular velocity on impact for use in a impulse calculation. At first I thought, perhaps naively, that I could use the closest point along the shortest overlapping axis, but closest to what exactly?

sentences:
Problems with texture orientation in space I am currently drawing texture in 3D space and have some problems with it's orientation.

I'd like me textures always to be oriented with front face to user.

My desirable result looks like

Note, that text size stay without changes when we rotating world and stay oriented with front face to user.

Now I can draw text in 3D space, but it is not oriented  with front but rotating with world.

Such results I got with following shaders:

Vertex Shader

uniform vec3 Position;

void main()
{
    gl_Position = vec4(Position, 1.0);
}

Geometry Shader

layout(points) in;
layout(triangle_strip, max_vertices = 4) out;

out vec2 fsTextureCoordinates;

uniform mat4 projectionMatrix;
uniform mat4 modelViewMatrix;
uniform sampler2D og_texture0;
uniform float og_highResolutionSnapScale;
uniform vec2 u_originScale;

void main()
{
    vec2 halfSize = vec2(textureSize(og_texture0, 0)) * 0.5 * og_highResolutionSnapScale;
    vec4 center = gl_in[0].gl_Position;
    center.xy += (u_originScale * halfSize);

    vec4 v0 = vec4(center.xy - halfSize, center.z, 1.0);
    vec4 v1 = vec4(center.xy + vec2(halfSize.x, -halfSize.y), center.z, 1.0);
    vec4 v2 = vec4(center.xy + vec2(-halfSize.x, halfSize.y), center.z, 1.0);
    vec4 v3 = vec4(center.xy + halfSize, center.z, 1.0);

    gl_Position =  projectionMatrix * modelViewMatrix   * v0;
    fsTextureCoordinates = vec2(0.0, 0.0);
    EmitVertex();

    gl_Position =  projectionMatrix * modelViewMatrix   * v1;
    fsTextureCoordinates = vec2(1.0, 0.0);
    EmitVertex();

    gl_Position =  projectionMatrix * modelViewMatrix   * v2;
    fsTextureCoordinates = vec2(0.0, 1.0);
    EmitVertex();

    gl_Position =  projectionMatrix * modelViewMatrix  * v3;
    fsTextureCoordinates = vec2(1.0, 1.0);
    EmitVertex();
}

Fragment Shader

in vec2 fsTextureCoordinates;

out vec4 fragmentColor;

uniform sampler2D og_texture0;
uniform vec3 u_color;

void main()
{
    vec4 color = texture(og_texture0, fsTextureCoordinates);

    if (color.a == 0.0)
    {
        discard;
    }
    fragmentColor = vec4(color.rgb * u_color.rgb, color.a);
}

Any ideas how to get my desirable result?

EDIT 1:

I make edit in my geometry shader and got part of lable drawn on screen at corner. But it is not rotating.

..........

    vec4 centerProjected = projectionMatrix * modelViewMatrix * center;
    centerProjected /= centerProjected.w;

    vec4 v0 = vec4(centerProjected.xy - halfSize, 0.0, 1.0);
    vec4 v1 = vec4(centerProjected.xy + vec2(halfSize.x, -halfSize.y), 0.0, 1.0);
    vec4 v2 = vec4(centerProjected.xy + vec2(-halfSize.x, halfSize.y), 0.0, 1.0);
    vec4 v3 = vec4(centerProjected.xy + halfSize, 0.0, 1.0);

    gl_Position =  og_viewportOrthographicMatrix * v0;

..........

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:
Bezier curve not drawn correctly I'm trying to draw a bezier curve using 3 points. If I use the quadratic form:

I get this result:

And I believe it's correct.

Now since I need to draw it with a variable number of points, I'm trying to apply the explicit definition:

This is the code that implements it:

typedef struct Point2D
{
    GLfloat x;
    GLfloat y;
    Point2D operator+(GLfloat c) const
    {
        return {x+c, y+c};
    }
    Point2D operator+ (const Point2D& other) const
    {
        return {x+other.x, y+other.y};
    }
    void operator+= (GLfloat c)
    {
        y+=c;
        x+=c;
    }
    void operator+= (const Point2D& other)
    {
        x+= other.x;
        y+= other.y;
    }
    Point2D operator* (GLfloat factor) const
    {
        return {x*factor, y*factor};
    }
    void operator*= (GLfloat factor)
    {
        x*=factor;
        y*= factor;
    }
}Point2D;

Point2D bezier(const vector<Point2D>& points, GLfloat u) // u is t
{
    Point2D point;
    unsigned int n= points.size();
    vector<int> factorials(n);
    // For efficiency, I put all factorials in an array instead
    // of recalculating them each time.
    GLfloat c1= pow(1.0-u,n-2);
    // This is (1-t)^(n-1)
    GLfloat c2= 1.0;
    // This is t^i , I'll progressively multiply it for u.
    factorials[0]=1;
    for(unsigned int i=1; i<n;i++)
    {
        factorials[i]= factorials[i-1]*i;
    }
    point= points[0] * (GLfloat)(n-1) * c1; // This is the first point
    for(unsigned int i=1; i<n; i++)
    {
        c2*= u;
        GLfloat bCoeff= factorials[n-1]/(factorials[i]*factorials[n-2]);
            // bCoeff is the binomial coefficient: n! / ( i! * (n-1)! )
        point+= points[i] * bCoeff * c1 * c2;
    }
    return point;
}

void display()
{
    glClearColor(0.75,0.75,0.75,1.0);
    glClear(GL_COLOR_BUFFER_BIT);

    glColor3f(1.0,0.0,0.0);
    glBegin(GL_POINTS);
    vector<Point2D> points{Point2D{200,200}, Point2D{400,400}, Point2D{600,200} };
    for(GLfloat u=0.0; u<=1.0; u+=1.0e-4)
    {
        Point2D point;
        point= bezier(points,u);
        glVertex2f(point.x,point.y); // For now I use the immediate mode
                                         // I'll put it in a vbo.
    }
    glEnd();

    glutSwapBuffers();
}

Unfortunately this is the result that I get:

Which I believe is incorrect. I guess I'm not applying correctly the explicit definition, but I don't know where's the mistake, I would like to know what I'm doing wrong.

sentences:
SpriteBatch.Draw with scale or rotation trigger a new batch? I recently read that any transformation changes will cause a new batch to be triggered.

So, if I have 10 Sprites and each has a different rotation or scale will there be 10 batches sent up?

Or is this somehow limited to SpriteBatch.Begin, where a Matrix is used?

I'm not clear on how the Begin/End relate to scale/rotation in draw calls or if they do at all in terms of how many batches are created.

I appreciate any info on this topic...

sentences: Move an enemy towards the player in pygame I set variables for the distance between the enemy and the player along the x-axis and y-axis. My plan is to move the enemy along the hypotenuse formed by y and x-axis line at a constant speed. The thing is I'm not sure how to set x and y speed of the enemy so that it will adjust dynamically to the changing position of the player and still maintain a constant speed. I thought that maybe I could find the angle at which enemy approaches the player and do something with that, but I couldn't think of anything.

sentences:
How to create a random array of Transforms and Instantiate the random item? I'm trying to make a rock that after you break it, it will spawn a random item from the minerals array. How can I pick a random item from the minerals array and then instantiate it?

    var rockHealth : int = 50;
    var rock : GameObject;
    var speed : int = 8;
    var rb : Rigidbody;

    var copper : Transform;
    var gold : Transform;

    var minerals : Transform[];
    minerals.push(copper);
    minerals.push(gold);

    function DeductPoints(hitpoints : int) {
     rockHealth -= hitpoints;
    }

    function Update() {
     if(rockHealth <= 0) {
         DestroyRock();
     }
    }

    function DestroyRock() {
     Destroy(rock);
     var position : Vector3 = Vector3(Random.Range(-1.0, 1.0), 0, Random.Range(-1.0,1.0));
     Instantiate("random mineral would go here", rock.transform.position + Vector3(0,0,0) + position, Quaternion.identity);
    }

sentences:
How to select an image on the J2ME Canvas I am working on J2ME. I have got a canvas, with a layout of a Checkers board. At the position of pieces, I have placed images. The point at which I got stuck is, how to select/highlite a piece's image for a move. I can't figure out the appropriate commandListener and how to handle this keyPressedEvent.
I understood the logic of this game from:
Draughts AI

Any suggestions?

sentences:
I need a map generation algorithm for towerdefense I'm making a simple JavaScript tower defense game, I've experimented on some map generation my self, i seem to get one that works properly.

What I want is for you to provide a start point (possibly an end point) and an algorithm to generate a random path between them in a tower defense like style.

Examples

sentences:
How to spawn an object on collision in box2d + love2d? I'm trying spawn collidable debris from a ship when it explodes in love2d/box2d, however,  World:isLocked() is true when collision callbacks are called:

  This will return true inside the callbacks from World:setCallbacks.
  (source)

So creating a new body throws an error. Are there any workarounds for this?

sentences: Draw cube in glsl shader I am working on a voxel engine. Currently my cubes are rendered as vbos. I thought, it may be better to load only the cooridinates of voxels to the shader and make it draw a cube itself. Can someone tell me, if thats possible, and if so, how?

sentences:
Programmatically generated mesh vertex colors not showing up in Unity? I'm sorry if this is an obvious thing to solve but I just can't figure it out...did I miss something...I've generated a mesh and during vertices generation I've also set its colors (and colors32 just in case) by reading those values from a ply file, and afterwards I've added a number of vertex color shaders but none of them will show the vertex point colors in play mode, it's either solid black or just like I added no material to the mesh (which I've tried doing manually in play mode too).

Did I miss something please?

sentences: Is there any level design copyright? I am planing to develop a game, in fact a puzzle game, I have changed the graphics but the level design is all the same. For example, the original puzzle game have five aliens as the obstacle in the human way to airship, the aliens spit fire on human. So here I have changed the alien to chameleon, with same positions(the aliens position never change so as the chameleon's ) and exact strike range(stick its tongue out to catch) and exact measurement(tile) and also converted the human to honey bee. So my doubt is that will there be any issue on this, for I am rendering the exact level design? ( I have searched, but didn't get a precise answer for my doubt)

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:
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:
OpenGL ES multiple indices I need suggestions for the best method of acheiving what I am trying to do:

-Using either OpenGL ES 1.x or 2.x

I need to pass a bunch of vertices to the GPU. Each one has 3 attributes: Position, Color, and Texture coords.

The vertices form quads, which share vertices. The shared vertices have both position and color attributes in common, but texcoords are not shared because each quad is textured with a 'tile' from a texture atlas.

I already know that it is not possible to use separate indices for a glDrawElements() call, so does that mean I can only use indexing for individual quads(specify 4 unique vertices per quad)? .. or is there any better solution?

sentences:
2D Tile-Based Concept Art App I'm making a bunch of 2D games (now and in the near future) that use a 2D, RPG-like interface. I would like to be able to quickly paint tiles down and drop character sprites to create concept art.

Sure, I could do it in GIMP or Photoshop. But that would require manually adding each tile, layering on more tiles, cutting and pasting particular character sprites, etc. and I really don't need that level of granularity; I need a quick and fast way to churn out concept art.

Is there a tool that I can use for this? Perhaps some sort of 2D tile editor which lets me draw sprites and tiles given that I can provide the graphics files.

sentences:
3D position of an arbitrary UV coordinate I have a UV map for a 3D mesh that encodes "links" between pairs of UV coordinates. I have previously defined this links (or pairs), one to one. The links are enconded using the function rgb_color(u1, v1) = (u2, v2, 0.0). Therefore, in the fragment shader, given UV coordinates of the current fragment, I can get the UV coordinates of the fragment "linked" with the current one.

What I want to do is to draw this links in the 3D space(i.e. draw a line between the current fragment with texture coordinates (u1, v1) and its "link" texture coordinate (u2,v2). As far as I know this is a hard problem to solve because in the fragment shader you cannot access to the 3D coordinates (u2,v2).

Edit: Notice that the UV map is fragmented, therefore you cannot just draw this lines in the UV domain.

Do you have any idea how to approach this problem?

sentences:
Scrolling background stops after awhile? Can anyone tell me where my maths is wrong please, it stops scrolling after awhile.

if (background.position.y < background2.position.y)
{
    background.position = ccp(background.contentSize.width / 2, background.position.y - 50 * delta);
    background2.position = ccp(background.contentSize.width / 2, background.position.y + background.contentSize.height);
}
else
{
    background.position = ccp(background2.contentSize.width / 2, background2.position.y - 50 * delta);
    background.position = ccp(background2.contentSize.width / 2, background2.position.y + background.contentSize.height);
}

//reset
if (background.position.y <-background.contentSize.height / 2)
{
    background.position = ccp(background.contentSize.width / 2 ,background2.position.y + background2.contentSize.height);
}
else if (background2.position.y < -background2.contentSize.height / 2)
{
    background2.position = ccp(background2.contentSize.width / 2, background.position.y + background.contentSize.height);
}

sentences:
Build includes sprite packer atlas and its original textures I use Unity's Sprite Packer, it's working great. However, when I looked at the build report (in the Editor.log) it turns out that the build often includes the generated atlas texture and its original textures too. It wastes too much space. I checked the size of the unzipped APK and the build report was correct. I tried several configurations (adding and removing textures) but I could not find any regularities.

Some observations: - I could reproduce this only if I use 25+ textures in an atlas with variable sizes. - Texture compression settings did not matter. Packer policy could modify the result but did not solve the problem.

Has anybody had similar experience? I can upload my test project if necessary.

sentences:
XNA:Rectangles Movement Behavior im trying to create simple pong game, and learning some XNA.
im creating for each paddle 3 rectangles, who represnt the collision when the ball hit them, so i can dicide where to throw the ball back.
here is the function that i create the rectangles:
List<Rectangle> collisonRectanglesList = new List<Rectangle>(3);
      private void creatCollisonRectangles()
        {
 smallPaddleWidth = collisionRect.Width;
             smallPaddleHeight = collisionRect.Height / 3;
            for (int i = 0; i < collisonRectanglesList.Count; i++)
            {
                if (collisonRectanglesList[i] != null)
                    collisonRectanglesList.RemoveAt(i);
            }
             collisonRectanglesList.Add(new Rectangle((int)position.X + smallPaddleWidth, (int)position.Y + smallPaddleHeight * 2, smallPaddleWidth, smallPaddleHeight));
             collisonRectanglesList.Add(new Rectangle((int)position.X + smallPaddleWidth, (int)position.Y + smallPaddleHeight, smallPaddleWidth, smallPaddleHeight));
             collisonRectanglesList.Add(new Rectangle((int)position.X + smallPaddleWidth, (int)position.Y , smallPaddleWidth, smallPaddleHeight));

        }

now i want this to follow the paddle it self so i put this function in the update method
and made a simple texture so i can draw them and see where they are on the screen.
my problem is that when i call the creatCollisonRectangles() 1 of the rectangles paint it self in the middle and not in the place it should be.
any idea why?
this is when im not calling it in the Update method:

and this when i do:

(sorry for my english)

sentences:
How do idle games handle such large numbers? Just wondering how games such as Tap titans and Cookie Clicker handle such large numbers.

I am trying to implement an idle game however the largest number format supported by C# is decimal.

I am looking to support up to 10^500; that needs to be floating point

How could I handle this?

P.S. it needs to be cross platform i.e. pc, mac, ios, android and compatible with Unity

sentences:
What the difference between public int and int? I was trying to understand the difference of int and public int by checking how unity respond to it
using UnityEngine;
using UnityEngine.Assertions.Must;
using UnityEngine.SceneManagement;

public class Bird : MonoBehaviour

{
 int CurrentState = 1;
 int PreviousState = 1;

}
Void Update()
{(if CurrentState != PreviousState)
 transform.localScale = new Vector3(transform.localScale.x+1,transform.localScale.y+1,transform.localScale.z+1);
  }

Since the equality is false, the scale of object remail unchange and in my next step, I changed "int CurrentState = 1" to "public int CurrentState=0" and "int PreviousState = 1" to "Public int PreviousState = 1" . Isn't that this time, the equality is true as 1 !=0 but the scale of object remained the same. Once I deleted the word "public" on both currentstate and previousstate, the scale increase indefinitely. I thought the word "public" basically meant there no access restriction but why it looks like the "if" statement couldn't retrieve the info correctly?

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: Are techniques from Warioware: D.I.Y actually useable in creating an actual game? In a game called Warioware: D.I.Y, it teaches you how to create minigames with certain forms of AI. Can I use the techniques shown in this game to actually develop an advanced game?

sentences:
Unity run-time creating material has performance impact? Just found creating a material in a script for the first time would have performance impact.
(Using Unity 5.6.5f)

A very simple script for testing is to create a game object with MeshRenderer in Start(), assign a new material each time in Update(),

gameObj.GetComponent<MeshRenderer>().material = new Material(Shader.Find("Standard"));

From Unity Profiler the first function call took much longer than following calls, the first one took 100ms and others less then 1ms.

Can someone give it an explanation? Thanks.

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:
How to use motioncontroller thumbstick move (not press) to teleport motion controller pawn in UE4 To clarify the title: I'm using the built in VR blueprint, Oculus Touch controllers as my MotionControllers, and I'm trying to replicate the teleport style that RoboRecall uses (which should be possible given that RoboRecall was made in UE4 by EPIC themselves).

The blueprint does have a teleport feature built in, but it's activated by pressing
the thumbsticks in (as in pressing the thumbstick down until you hear the button click), what I'm hoping to do is instead activate it on thumbstick push (as in just tilting and move the thumbstick around, but not clicking it down).

So I can actually get it half working by just changing the input in the game settings > inputs section, but when you release the stick it loses the rotation data (though it does actually move your charecter to the right xyz).

So it would seem that the first part (activating the teleport blueprint stuff) activates when the thumbstick is moved, it requires the thumbstick to fully return to centre in order to move the player, which by then has lost rotation.
I'm new it UE4 and it might be a simple fix, so any pointers appreciated!

sentences:
Background music not stopping while game is set to paused I am implementing pause game functionality in a Unity3D game using the following script

    public class PauseGame : MonoBehaviour
    {
        /// <summary>
        /// class to pause the game using Time.timeScale and
        /// implement the related behaviours associated the game
        /// </summary>

        #region Fields

        // Boolean variable that informs script if game should be paused or not, false by default.
        private bool isPaused = false;

        #endregion

        #region MonoBehaviour Messages

        /* ----------------------------------------
         * At Start,
         *
         */
        void Start()
        {

        }

        /* ----------------------------------------
         * Whenever 'ESC' key is pressed, toggle 'isPaused' boolean
         * and call SetPause() to pause/resume game
         */
        void Update()
        {
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                isPaused = !isPaused;
                SetPause();
            }

        }

        #endregion

        #region Methods

        /* ----------------------------------------
         * A function to pause/resume the game
        */
        public void SetPause()
        {
            Debug.Log("SetPause");

            // Invert 'isPaused' boolean and convert it into a float variable, being true = 1; and false = 0f.
            float timeScale = !isPaused ? 1f : 0f;

            // Set the Time Scale as 1(game runs normally) or 0(game pauses)
            Time.timeScale = timeScale;

        }
        #endregion
    }

All the game elements pause as expected using the above, except the background music. I can pause the background music by additionally referencing the AudioSource and disabling it while timescale is set to 0. However, I was wondering whether it was a bug. Kindly suggest.

sentences:
What Shading/Rendering techniques are being used in this image? My previous question wasn't clear enough. From a rendering point of view what kind of techniques are used in this image as I would like to apply a similar style (I'm using OpenGL if that matters):

http://alexcpeterson.com/

My specific questions are:

How is that sun glare made? How does the planet look "cartoon" like? How does the space around the planet look warped/misted? How does the water look that good?

I'm a beginner so any information/keywords on each question would be helpful so I can go off and learn more. Thanks

sentences:
Check if all gameobjects are destroyed I am making a shooting game, where I have a countdown as I destroy enemies. I want to implement logic when all the game objects are destroyed within the given time, and the countdown reaches zero.

How do I do that?

sentences:
How can I do unit testing in Unity? How to implement Unit Test at Unity3D.

I wonder if it would be possible to extend the Unity editor to have some sort of testing framework in it.

Is there any guideline to implement it?
Any reference like book, blog?
Any working example or project?

sentences:
Will Frame Independant Movement break collision Using my game loop to give my game movement which is independant from the framerate, has been working fine for me but, I've started to consider my games running on machines which cannot keep up with my expected frame limit of 60fps, I've tried manually setting it to a lower cap and noticed that my collision detection starts to go off and objects on screen overlap because of this.

How can I make collision detection occur on movements which are too great and overshoot boundary checks?

Below is my loop for running my game

  while (g_Window.isOpen()){

    sf::Time dt = clock.restart();
    timeSinceLastUpdate += dt;
    while(timeSinceLastUpdate > TIME_PER_FRAME){

         timeSinceLastUpdate -= TIME_PER_FRAME;
         processEvents();
         update(TIME_PER_FRAME);
}
   updateFPSCounter(dt);
   render();
}

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:
Cant jump from ground collision I have a character that starts in the air and applying gravity to it to collide with platforms in my level. At the start, the character gradually gains speed descending until it collides with a platform. After colliding, I display text letting me know if collision is detected (character touching the ground is true). But when I push the 'W' key, the character doesn't jump. It's worth noting that there is no dedicated ground zero as the level has platforms at different heights.

void Player::update(const std::vector<std::string>& layerData, float deltaTime)
{
    // check if player touches ground
    mOnGround = collideWithLevel(layerData);

    if (mInputManager->isKeyDown(SDLK_w)) // press W to jump
    {
        jump(deltaTime);
    }

    land(deltaTime);
}

void Player::jump(float deltaTime) // problem
{
    if (mOnGround)
    {
        mVelocity.y = mJumpPower * deltaTime;
        mOnGround = false;
    }
}

void Player::land(float deltaTime)
{
    if (!mOnGround)
    {
        mVelocity.y += mGravity * deltaTime;
        mPosition.y += mVelocity.y;
    }

    if (mOnGround)
        std::cout << "On ground" << std::endl; // fires
}

sentences: XNA with WPF or Winforms If you compare integration between WPF with XNA vs Winforms with XNA, what is the most suitable framework to integrate XNA framework with.

sentences:
Render a sphere when the user clicks on the screen with libgdx I’m really new to Libgdx, and decided to try out some codes to familiarise myself with it. I’m trying to write a program such that a sphere is rendered at the position of the user’s click.

Here’s my code:

package com.mygdx.game;

import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.PerspectiveCamera;
import com.badlogic.gdx.graphics.VertexAttributes.Usage;
import com.badlogic.gdx.graphics.g3d.Environment;
import com.badlogic.gdx.graphics.g3d.Model;
import com.badlogic.gdx.graphics.g3d.ModelBatch;
import com.badlogic.gdx.graphics.g3d.ModelInstance;
import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute;
import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight;
import com.badlogic.gdx.graphics.g3d.Material;
import com.badlogic.gdx.graphics.g3d.utils.CameraInputController;
import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder;
import com.badlogic.gdx.InputAdapter;
import com.badlogic.gdx.graphics.FPSLogger;

public class Render implements ApplicationListener {
    public Environment environment;
    public PerspectiveCamera cam;
    public CameraInputController camController;
    public ModelBatch modelBatch;
    private FPSLogger fps;

    public Model model;

    @Override
    public void create() {
        Gdx.graphics.setContinuousRendering(false);

        environment = new Environment();
        environment.set(new ColorAttribute(ColorAttribute.Specular, 0.4f, 0.4f, 0.4f, 0.6f));
        environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, 0f, 0f, -1f));

        modelBatch = new ModelBatch();

        cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        cam.position.set(0f, 0f, 10f);
        cam.lookAt(0,0,0);
        cam.near = 1f;
        cam.far = 300f;
        cam.update();

        ModelBuilder modelBuilder = new ModelBuilder();
        model = modelBuilder.createSphere(1f, 1f, 1f, 30, 30,
                new Material(), Usage.Position | Usage.Normal)
        camController = new CameraInputController(cam);
        Gdx.input.setInputProcessor(camController);
        fps = new FPSLogger();
    }

    @Override
    public void render() {

        if (Gdx.input.justTouched()){
            ModelInstance Instance = new ModelInstance (model);
             Instance.transform.setToTranslation(Gdx.input.getX(),Gdx.input.getY(), 0);
            DataBase.array.add(Instance);
            Gdx.graphics.requestRendering();
        }
        camController.update();

        Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);

        modelBatch.begin(cam);
        for (ModelInstance instance: DataBase.array) {
            modelBatch.render(instance, environment);
        }
        modelBatch.end();

        //fps.log();
    }

    @Override
    public void dispose() {
        modelBatch.dispose();
        model.dispose();
    }

    @Override
    public void resize(int width, int height) {
    }

    @Override
    public void pause() {
    }

    @Override
    public void resume() {
    }
}

The DataBase.array is simply an ArrayList.

What am I doing wrong? Any help would be really appreciated; thanks!

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: Stuck in Wall after rectangle bounding box collision Using XNA's built in Intersects() on two Rectangles, I can detect a collision and set my velocity to zero. However, the object is stuck there and can't get out! How can I resolve this collision properly?

sentences:
Issues using real names in a soccer player game Is illegal to use the real player and team names in a game? When I say game could be and desktop, mobile or fantasy game.

If is illegal, is ok to change a little bit names? Instead of using Messi could I use Messsi (or something similar)?

All gambling and statistics soccer websites have permissions to use those names?

Thanks!

sentences:
How should one handle positions in a tile-based world? I have a simple Tower Defense game using a tiled world.  Creep and towers are on a tile at all times.

How should I represent the position of creeps in code? (Do creeps know their current tile and position on said tile or are they aware of their absolute world position?)

I'm basically looking for best practices, design pattern-type tips or general insight about how one manages positioning in a tile-based world.

Thank you.

sentences:
Add 1 to a PlayerPref float if a day has passed in Unity 2D I'm making a daily rewards system in my Unity 2D game. For each real-life day the user logs in (not necessarily consecutive) the player earns a Reward Point. Reward Points do two things:

Increase the rarity of what the player may obtain from Reward Chests.
Increase the frequency that a player may open a Reward Chest. The frequency starts at 24 hours, and for each Reward Point, it is decreased by 24 hours. (The frequency a player earns a Reward Point is not increased, just the frequency that the player can open a chest.)

I am asking how to check if a day has passed since the player last opened the game, and, if they have, add 1 to a PlayerPrefs float (this float contains the amount of Reward Points). I am familiar with Time, but I'm not sure how to accomplish my goal with it.
.

sentences:
Scrolling background tiles in an isometric environment? I'm working on my first game and I've run across an issue, when the character moves around, the "camera" is supposed to follow but I don't know how to make the computer draw only the necessary tiles.

Here is what I currently have

    public void drawBack(Graphics2D g2d) {
    int x = mvmt.getX(),
        y = mvmt.getY();

    int charOffX = mvmt.getCharCamX(),     //the difference between the top
        charOffY = mvmt.getCharCamY();     //left corner and where the
                                           //character is drawn

    for(
        int startCoordX = ????,
            startCoordY = ????,
            startTileMapX = ????,
            startTileMapY = ????;
        startTileMapX < width && startCoordX <= 3 * screenWidth;
        startCoordX += startXadd, startTileMapX++, startTileMapY--
    ) {
        for(
            int drawCoordX = startCoordX,
                drawCoordY = startCoordY,
                tileMapX = startTileMapX,
                tileMapY = startTileMapY;
            tileMapY < height && drawCoordY <= screenHeight;
            drawCoordX -= xadd, drawCoordY += yadd, tileMapY++
        ) {
            if(tile.getTileMap(tileMapX, tileMapY, 1) == 1) {
                g2d.drawImage(tile.getTile(tileMapX, tileMapY), drawCoordX, drawCoordY, 32, 32, null);

            }

        }

    }

I need the tile map to line up with where the character is. Thanks so much in advance, this one really has me scratching my head!

sentences: Phone for Android game development I've been developing casual iPhone/iPod Touch games touch for about two years.  I'd like to port some games to the Android platform.  Since I'm stuck w/ a two year iPhone contract I don't want to get an Android phone that requires a service plan.  What is the best phone to get for development in this situation?

sentences:
How to add high score? I wanted to add a high score to my game but I don't know how I already tried to find some videos for it but I just can't find the right one. I already have a scoreUI on my game I just wanted to add a high score.

Here is my UIManager's script which consists of different functions including the score system.

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

public class uiManager : MonoBehaviour {

public Button[] buttons;
public Text scoreText;
int score;
bool gameOver;

// Use this for initialization
void Start () {
    gameOver = false;
    score = 0;
    InvokeRepeating("scoreUpdate", 0.5f, 0.25f);
}

// Update is called once per frame
void Update () {
    scoreText.text = "" + score;
}

void scoreUpdate(){
    if (gameOver == false) {
        score += 1;
    }
}
public void gameOverActivated(){
    gameOver = true;
    foreach(Button button in buttons) {
        button.gameObject.SetActive(true);
    }
}

public void Play() {
    SceneManager.LoadScene("level1");
}

public void Menu(){
    SceneManager.LoadScene("Menu");
}

public void Retry()
{
    SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}

public void Pause() {

    if (Time.timeScale == 1) {
        Time.timeScale = 0;
    }
    else if (Time.timeScale == 0) {
        Time.timeScale = 1;
    }
}
}

I got the score system from Charger Games. Here is the link to the Video

and here is what my game looks like

sentences:
Is Ada suitable for game development? Would Ada be a practical language for game development (at least for the PC--I understand there aren't compilers for PlayStation and other consoles)?

It has bindings to OpenGL, it has decent performance, and it's less error-prone than C++. Please feel encouraged to support your point with relevant example projects you know about.

sentences:
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:
Terrain collision with sphere and OBB I'm implementing my physics engine for my 3D game. So far I've been able to implement collision detection between OBB, spheres and planes. The engine generate contacts and resolve them with an iterative impulse-based approach.

The result is this (so far).

Now I need to detect and generate contacts between a height map terrain and those bounding volumes (sphere and OBB). The terrain looks like this:

I don't know how to do it. I need to detect collisions and generate contact data (contact point, contact normal and interpenetration to feed my existing engine).
I know I can't use a SAT because the terrain in not convex. What about ad hoc code for boxes and spheres? or is there a general approach?

EDIT

I narrowed down my problem to detecting (and resolving) collisions between a simple convex collidable (sphere/OBB) and triangles (always convex). Since the terrain is stored as an height map I can easily select a subset of triangles to run the algorithm against. I can use the SAT to detect interpenetrations. But what about collision response? How can I generate the necessary contact data (collision point and collision normal) to resolve the collision?

sentences:
Simulating crowds of enemies I am wondering what would be a good way to handle enemy crowds generation and simulation.

For example in a hack'n'slash game, how would one go about placing enemies and managing their movement in the world with it feeling at least a bit natural?

What I am looking for is the general approach behind this. I can write (and have written) some code to simulate as best as I can these things, but it feels a bit "hacky", it's just each enemy having a pre-scripted behavior. I am wondering if there are general simulations method to manage enemies walking in the world and chasing players, as it is an element that exists in many games.

In my case, what I have done is to give them random intervals of time in which they can choose a random direction and move for a random duration. Then if the player gets near a certain range they will stop that and chase him (applying pathfinding), but maybe there are more general ways of thinking others than pre-scripting pseudo-random behavior?

sentences:
How do game clients know that a server is running on their LAN? In lots of multiplayer games there is the option for LAN play. My question though is how does a client know where a server is on the LAN?

The only ways I can think of

Send out broadcasts over the broadcast address. This has the disadvantage of being filtered sometimes by routers or switches in different network environments.
Attempt to connect to a server on every IP in your subnet. This has the disadvantage of being slow (Especially if the network uses 10.XXX.XXX.XXX for their IPs) and a mini ddos attack, but isn't going to be filtered.

How do games do this especially in other network environments?

sentences:
Architecture for scaling a large 2D MMORPG world vs player load I want to make 2D MMORPG in a post-apocalyptic world.
I would like to make the game world seamless and big, with big battles for the players. Something similar is in Eve Online (in 3D), but I do not like the fact that during major battles time in EVE slows down. All this due to the limitations of the game. I thought, what if we come up with a new architecture to handle large player numbers in one region without slowing down? I had the following idea:
Server cluster Quadtree
The whole world is one big quadtree. And each quadrant of the tree is processed by a separate server.

If a big battle is coming, the quadtree subdivides, and the number of servers in the battle region increases automatically.
Can this strategy work at all?
How do you handle conflicts in this world?
I think that everything will be built using ECS (EnTT). Each server should have a connection to the servers nearby tell them information if, for example, I shoot a player while I am in server 1 and they are in server 2.
Perhaps you see some other problems with the implementation of such an architecture?

sentences:
way to implement a menu -pratical i do my first game and already read alot about design strategie, programming style, design .. and so on
theoretically it works perfect but in practice i dont know if i do thinks "right"

i have three classes my main which starts the view
in this i do all my stuff -currently-

it holds an state variable, it has an onDraw method .. and so on

the third class is the game-thread while my game is running, in here are decisions -depending on my current state- what should be done

@Override
public void run() {
    Canvas canvas = null;
    mStartTime = System.currentTimeMillis();
    while (mRun) {
        canvas = mHolder.lockCanvas();
        if (canvas != null) {

            // State Updating State means to manage state transitions, such as a game over, character select or next level.

            switch( mPanel.getModeState() ){
                case Surface.MODE_LOGO_SPLASH :
                break;

                case Surface.MODE_MENU :
                    // the menu

                break;
                case Surface.MODE_LOADING :
                    // loading animation

                break;
                case Surface.MODE_GAME_PLAYING :
                    // game stuff
                                            // GAME START _ RUNNING _ END

                    // Input
                    // AI
                    // Physics

                    // animation
                    //mPanel.animate(mElapsed);
                break;
            }

            // draw everyThing
            mPanel.doDraw(mElapsed, canvas);
            // sound
            // Sound and Video.
            mElapsed = System.currentTimeMillis() - mStartTime;
            mHolder.unlockCanvasAndPost(canvas);
        }
        mStartTime = System.currentTimeMillis();
    }
}

my problem is .. the function onDraw draws everything .. including the menu ?
this sounds for me like bad code because everytime doDraw is executet, i have to check in this function which state i am currently in .. this cost time, dosent it ?

public void doDraw(long elapsed, Canvas canvas) {
    canvas.drawColor(Color.BLACK);

        // currently just gameLayout
        canvas.drawBitmap(background, 0, 0, mPaint);
    gameLayout.draw(canvas);

}

would it not be better do implement an other thread which draws the menu ?
but if so, how can i overlay the menu afer pause the game ?

:\
thanks for help
erwin

sentences:
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 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 does interpolation actually work to smooth out an object's movement? I've asked a few similar questions over the past 8 months or so with no real joy, so I am going make the question more general.

I have an Android game which is OpenGL ES 2.0. within it I have the following Game Loop:

My loop works on a fixed time step principle (dt = 1 / ticksPerSecond)

loops=0;

    while(System.currentTimeMillis() > nextGameTick && loops < maxFrameskip){

        updateLogic(dt);
        nextGameTick+=skipTicks;
        timeCorrection += (1000d/ticksPerSecond) % 1;
        nextGameTick+=timeCorrection;
        timeCorrection %=1;
        loops++;

    }

    render();

My intergration works like this:

sprite.posX+=sprite.xVel*dt;
sprite.posXDrawAt=sprite.posX*width;

Now, everything works pretty much as I would like. I can specify that I would like an object to move across a certain distance (screen width say) in 2.5 seconds and it will do just that.  Also because of the frame skipping that I allow in my game loop, I can do this on pretty much any device and it will always take 2.5 seconds.

Problem

However, the problem is that when a render frame skips, the graphic stutter.  It's extremely annoying.  If I remove the ability to skip frames, then everything is smooth as you like, but will run at different speeds on different devices.  So it's not an option.

I'm still not sure why the frame skips, but I would like to point out that this is Nothing to do with poor performance, I've taken the code right back to 1 tiny sprite and no logic (apart from the logic required to move the sprite) and I still get skipped frames.  And this is on a Google Nexus 10 tablet (and as mentioned above, I need frame skipping to keep the speed consistent across devices anyway).

So, the only other option I have is to use interpolation (or extrapolation), I've read every article there is out there but none have really helped me to understand how it works and all of my attempted implementations have failed.

Using one method I was able to get things moving smoothly but it was unworkable because it messed up my collision.  I can foresee the same issue with any similar method because the interpolation is passed to (and acted upon within) the rendering method - at render time.  So if Collision corrects position (character now standing right next to wall), then the renderer can alter it's position and draw it in the wall.

So I'm really confused.  People have said that you should never alter an object's position from within the rendering method, but all of the examples online show this.

So I'm asking for a push in the right direction, please do not link to the popular game loop articles (deWitters, Fix your timestep, etc) as I've read these multiple times.  I'm not asking anyone to write my code for me.  Just explain please in simple terms how Interpolation actually works with some examples.  I will then go and try to integrate any ideas into my code and will ask more specific questions if need-be further down the line. (I'm sure this is a problem many people struggle with).

edit

Some additional information - variables used in game loop.

private long nextGameTick = System.currentTimeMillis();
//loop counter
private int loops;
//Amount of frames that we will allow app to skip before logic is affected
private final int maxFrameskip = 5;
//Game updates per second
final int ticksPerSecond = 60;
//Amount of time each update should take
private final int skipTicks = (1000 / ticksPerSecond);
float dt = 1f/ticksPerSecond;
private double timeCorrection;

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:
fmod getWaveData() export to WAVE file help (C++) I am trying to export the current sound that is being played by the FMOD::System into a WAVE file by calling getWaveData(). I have the header of the wave file correct, and currently trying to write to the wave file each frame like so:

const unsigned int samplesPerSec = 48000;
const unsigned int fps = 60;
const int numSamples = samplesPerSec / fps;
float data[2][numSamples];
short conversion[numSamples*2];

m_fmodsys->getWaveData( &data[0][0], numSamples, 0 ); // left channel
m_fmodsys->getWaveData( &data[1][0], numSamples, 1 ); // right channel

int littleEndian = IsLittleEndian();

for ( int i = 0; i < numSamples; ++i )
{
    // left channel
    float coeff_left = data[0][i];
    short val_left =  (short)(coeff_left * 0x7FFF);

    // right channel
    float coeff_right = data[1][i];
    short val_right =  (short)(coeff_right * 0x7FFF);

    // handle endianness
    if ( !littleEndian )
    {
        val_left = ((val_left & 0xff) << 8) | (val_left >> 8);
        val_right = ((val_right & 0xff) << 8) | (val_right >> 8);
    }

    conversion[i*2+0] = val_left;
    conversion[i*2+1] = val_right;
}

fwrite((void*)&conversion[0], sizeof(conversion[0]), numSamples*2, m_fh);
m_dataLength += sizeof(conversion);

Currently, the timing of the sound is correct, but the sample seems clipped way harshly. More specifically, I am outputting four beats in time. When I playback the wave-file, the beats timing is correct but it just sounds way fuzzy and clipped. Am I doing something wrong with my calculation?

I am exporting in 16-bits, two channels.

Thanks in advance! :)

Reference (WAVE file format): http://www.sonicspot.com/guide/wavefiles.html

sentences:
Should game objects draw themselves? Assuming you have classes like Player, Enemy, Map and Tile.

The first approach to structuring rendering code would be to give each a render() method and let it draw itself:

void render(){
   player.draw();
   enemy.draw();
   // etc.
}

But considering the Model-View-Controller perspective, that feels wrong... Another idea would be to make a Renderer class, but then I wonder how you give the Renderer information what to draw.

Which one should I choose and why?

sentences:
XNA- Texturing problem, exporting model How,can I disable coloring when texture is applied, because right now
the texture is being colored over.

foreach (BasicEffect effect in mesh.Effects)
{
    effect.TextureEnabled = textureApplied;

    if(textureApplied)
        effect.Texture = Texture2D.FromStream(GraphicsDevice,System.IO.File.OpenRead(texturePath));
    else
    {
        effect.DiffuseColor = ti.DiffuseColor;
        effect.EmissiveColor = ti.EmissiveColor;
    }
    ...
}
mesh.Draw();

Also, is there any easy way for xna to export models? Or do I have to write my own?

sentences:
Anybody know how I can write a game for the dualshock 3 or other gampad in python? I am a new developer and want to write a game that uses a gamepad like the dualshock 3 I want to write it in python although am willing to learn a little C/C++

I need to identify the buttons and rotaters and send feedback like haptics not to mention the motion control

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:
Is keeping all my game art in a static class wasting memory? When I make games, I generally create a static class called Art that has static fields to track all content in the game. For example

public static class Art
{
    public static SpriteFont defaultFont;

    public static Texture2D playerSprite;

    public static void LoadContent(ContentManager content)
    {
        defaultFont = content.Load<SpriteFont>("Fonts/DefaultFont");
        playerSprite = content.Load<PlayerSprite>("Sprites/PlayerSprite");
    }
}

My question is do these objects in my art class take up memory for the duration of the games lifetime? The point of this class is to only have to load my art once in the game and have easy access to the assets anywhere in my project, but at what cost?

sentences:
GLSL: Issue replacing ternary operator with mix I was expecting these two code snippets to do the same thing:

return  vec3(  1.0-b.r>=a.r ? 0.0 : 1.0-((1.0-b.r)/a.r),
               1.0-b.g>=a.g ? 0.0 : 1.0-((1.0-b.g)/a.g),
               1.0-b.b>=a.b ? 0.0 : 1.0-((1.0-b.b)/a.b)  );

and

return mix( ONE3 - ((ONE3-b)/a), ZERO3, vec3(greaterThanEqual(ONE3-b, a)) );
       // ONE3=vec3(1.0,1.0,1.0); ZERO3=vec3(0.0,0.0,0.0);

For some reason, they have different outputs. Do you know why? (a can have zeros sometimes)

sentences:
Sample() returns (0, 0, 0) for normal map 90% of frames I'm having some trouble reading the values from my Normal map in my lighting fragment shader.

The relevant part of the shader code is as follows:

Texture2D NormalGB : register(t0);
Texture2D DiffuseGB : register(t1);
Texture2D SpecularGB : register(t2);
Texture2D PositionGB : register(t3);

SamplerState NormalSampler : register(s0);

void GetGBValues(
    in int2 screenPosition,
    out float3 normal,
    out float3 diffuseAlbedo,
    out float3 specularAlbedo,
    out float specularPower,
    out float3 position)
{

    int3 screenPos3 = int3(screenPosition, 0);
    normal = normalize(NormalGB.Sample(NormalSampler, screenPosition).xyz); // HERE
    diffuseAlbedo = DiffuseGB.Load(screenPos3).xyz;
    float4 specularValues = SpecularGB.Load(screenPos3);
    specularAlbedo = specularValues.xyz;
    specularPower = specularValues.w * 50.0f;
    position = PositionGB.Load(screenPos3).xyz;
}

However, in 9 frames out of 10, normal is set to {0. 0, 0}. I've tried the code under the reference driver too, and get the same issue.

What's really weird is that if I change the line marked // HERE to a simple .Load call, the code works perfectly (except the obvious fact that I get no interpolation of normals). The sampler that is bound at time of the draw call (according to the graphics debugger) is:

D3D11 Sampler State (obj:18)
AddressU D3D11_TEXTURE_ADDRESS_WRAP
AddressV D3D11_TEXTURE_ADDRESS_WRAP
AddressW D3D11_TEXTURE_ADDRESS_WRAP
BorderColor (0.000f, 0.000f, 0.000f, 0.000f)
ComparisonFunc D3D11_COMPARISON_NEVER
Filter D3D11_FILTER_ANISOTROPIC
MaxAnisotropy 4
MaxLOD 340282346638528860000000000000000000000.000f
MinLOD 0.000f
MipLODBias 0.000f

Device obj:3

And finally, the normal-map (rendered to a texture by the previous pass):

sentences:
How can I achieve a flickering torch/candle effect in 2D? I'm currently working on a 2D lighting system that has point lights effectively rendered as a quad in a top-down 2D view, something like this for each light:

I'd like to achieve a somewhat realistic "flickering" effect by changing the position and attenuation of the light over time, simulating the light emitted from a torch or candle. What would be a good way to adjust these attributes of the light, and how quickly / over how much time?

sentences:
I am having this error in unity and i don't know what's causing it I don't know how it happen this is an endless runner game
The road is 15 on x and 100 on z.
This is happening in android road is a cube with png image as texture it is distorted and turn blue every 2 sec.

sentences:
How do I convert 3D vertices and faces to 2D shapes? I'm assuming all the math is done with projection matrices from linear algebra, but I don't yet understand how they work, and haven't found much information on them.

What I'm mainly curious about is how after you convert the 3D stuff to 2D, how do you attribute the vision through a portal (like in game Portal)? How is that math done?

sentences:
Solidworks (3D model) import help Hey guys, I'm not sure if this is the right place to ask, but I'm also not sure where else to ask.  I have a 3D model in Solidworks that is imported from a STL file.  Solidworks imports the file multiple triangular faces and as either a solid, or a surface.  See pic below:

What I need to do is take the model and have it be hollow but with a thickness, not that big.  Also it would help to have the surface be one smooth surface since I will be imported it to another program, ADINA.  Any ideas or suggestions?

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:
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:
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:
Draw Rectangle To All Dimensions of Image I have some rudimentary collision code:

public class Collision {
    static boolean isColliding = false;
    static Rectangle player;
    static Rectangle female;

    public static void collision(){
        Rectangle player = Game.Playerbounds();
        Rectangle female = Game.Femalebounds();

        if(player.intersects(female)){
            isColliding = true;
        }else{
            isColliding = false;
        }
    }
}

And this is the rectangle code:

public static Rectangle Playerbounds() {
    return(new Rectangle(posX, posY, 25, 25));
}

public static Rectangle Femalebounds() {
    return(new Rectangle(femaleX, femaleY, 25, 25));
}

My InputHandling class:

public static void movePlayer(GameContainer gc, int delta){
    Input input = gc.getInput();

    if(input.isKeyDown(input.KEY_W)){
        Game.posY -= walkSpeed * delta;
        walkUp = true;

        if(Collision.isColliding == true){
            Game.posY += walkSpeed * delta;
        }
    }

    if(input.isKeyDown(input.KEY_S)){
        Game.posY += walkSpeed * delta;
        walkDown = true;

        if(Collision.isColliding == true){
            Game.posY -= walkSpeed * delta;
        }
    }

    if(input.isKeyDown(input.KEY_D)){
        Game.posX += walkSpeed * delta;
        walkRight = true;

        if(Collision.isColliding == true){
            Game.posX -= walkSpeed * delta;
        }
    }

    if(input.isKeyDown(input.KEY_A)){
        Game.posX -= walkSpeed * delta;
        walkLeft = true;

        if(Collision.isColliding == true){
            Game.posX += walkSpeed * delta;
        }
    }
}

The code works partially. Only the right and top side of the images collide. How do I correct the rectangle so it will draw on all sides?

sentences:
C++ Pass the reference of the class to a vector inside the constructor Okay so i have an extern vector of pointer type 'Entity', and what i want to do is, when a new Entity type class gets constructed it gets pushed back in the vector of Entities, in C# this would be possible by passing 'this' as a parameter, but i'm unable to do that in c++ ! Here is my code:

'Public.h':

// other code
    #ifndef Entity_h
    #include "Entity.h"
    extern vector <Entity*> AllEntities;
    #endif
// other code

I've put the code in Include guards to not get in trouble, because i'm including 'Public.h' from 'Entity.cpp' and if i didn't have guards it would become a circular dependency !

'Public.cpp':

// other code
#ifndef Entity_h
vector <Entity*> AllEntities;
#endif
// other code

Everything fine, no errors!

'Entity.cpp':

#include "Public.h"
#include "Entity.h"

Entity::Entity()
{
// other code
    AllEntities.push_back(this);
}

i'm trying to do this, but doing this causes me some linker errors:

   Error    3   error LNK2005: "void __cdecl AddToAllENT(class Entity *)" (?AddToAllENT@@YAXPAVEntity@@@Z) already defined in Entity.obj    C:\Users\drin-_000\Documents\Visual Studio 2013\Projects\ECSystem\ECSystem\Public.obj   ECSystem
    Error   4   error LNK2001: unresolved external symbol "class std::vector<class Entity *,class std::allocator<class Entity *> > AllEntities" (?AllEntities@@3V?$vector@PAVEntity@@V?$allocator@PAVEntity@@@std@@@std@@A) C:\Users\drin-_000\Documents\Visual Studio 2013\Projects\ECSystem\ECSystem\Entity.obj   ECSystem
    Error   5   error LNK1120: 1 unresolved externals   C:\Users\drin-_000\Documents\Visual Studio 2013\Projects\ECSystem\Debug\ECSystem.exe    1   1   ECSystem

When i try to do this:

Entity::Entity()
{
// other code
    AllEntities->push_back(this);
}

it gives me these errors!

Error   1   error C2819: type 'std::vector<Entity *,std::allocator<_Ty>>' does not have an overloaded member 'operator ->'  c:\users\drin-_000\documents\visual studio 2013\projects\ecsystem\ecsystem\entity.cpp   9   1   ECSystem
Error   2   error C2232: '->std::vector<Entity *,std::allocator<_Ty>>::push_back' : left operand has 'class' type, use '.'  c:\users\drin-_000\documents\visual studio 2013\projects\ecsystem\ecsystem\entity.cpp   9   1   ECSystem
    3   IntelliSense: expression must have pointer type c:\Users\drin-_000\Documents\Visual Studio 2013\Projects\ECSystem\ECSystem\Entity.cpp   9   2   ECSystem

sentences:
How to Use/Initialize UDP (Unity Distribution Portal) I would like to use UDP (which stands for Unity Distribution Portal) in my game, but I have a problem with the Initializing. What i´ve already done is: Downloading/Importing UDP from Unity Assets Store and setting up the connection between UDP and my game (with the Client ID)
Now i would like if anyone can give me a detailed description what to do next, The description on the official Unity Website just confuses me...

sentences:
3D models on 2D background perspective mismatch we are working on a tactics game, with a hand drawn 2D backgrounds and 3D models moving on them. The game generates a 2D grid placed on a XY plane, with faux isometric tiles (Diamond Grid).

I have tried following the guides found here to create the "isometric" effect on the 3D models: prepared two ortho cameras, one perpendicular to the 2D elements and seeing only them and another rotated (30,45,0) which sees only 3D models. Like this:

The issue we're having is the mismatch of the positions between the elements seen by the cameras.

Character should be standing on the tile with the green border. This cannot be solved by simply moving the 3D camera to match these positions because the seem to differ for objects placed in different parts of the screen.

Could anyone please help?

Thanks!

sentences: 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 to control units in a game using scripts I'm looking to create a game like screeps, in which the user controls their units using javascript.  I am planning on using lua as the scripting language that controls the units in my game, as it is supposedly easily embeddable.  After doing some research, I decided that I should code the game in C++ and allow the player to access the objects (or the C++ equivalent of Lua's tables) in C++ that represent the units in the game through lua.

So far I have been able to send C++ functions to a Lua environment using LuaBridge.  However, I'm not sure how to expose unit objects to the player through lua.  The player should only be able to change certain attributes of the object (for example, they shouldn't be allowed to change the object's position to anywhere on the map, but they should be able to view the unit's position).  The user should also be allowed to run functions like unit1.forward that can change the units position.

What is the best way to implement this behavior?

sentences:
Mouse Interaction in 3D space (ray) I use this code

    public static Ray CalculateRay(Vector2 mouseLocation, Matrix view, Matrix projection, Viewport viewport)
    {
        Vector3 nearPoint = viewport.Unproject(new Vector3(mouseLocation.X,
                mouseLocation.Y, 0.0f),
                projection,
                view,
                Matrix.Identity);

        Vector3 farPoint = viewport.Unproject(new Vector3(mouseLocation.X,
                mouseLocation.Y, 1.0f),
                projection,
                view,
                Matrix.Identity);

        Vector3 direction = farPoint - nearPoint;
        direction.Normalize();

        return new Ray(nearPoint, direction);
    }

to calculate a ray for mouse position x;y.
But the result is everytime again NaN..
If I try it with .99f it works but the collision detection is not exact..
How can I determine whether the cursor hits and model in 3d space?

sentences:
Center Gravity in Unity a 2d planet in the center, where the players will be able to walk on it and also will be affected by center gravity. planet will be static and there won't be any other planets. so;

Is there a way that I can change the gravity position? yes you can adjust gravity via project settings but I want it to be in the middle x,y,z(0,0,0)

I have tried creating my own gravity but it wasn't very useful because objects wouldnt fall, stand on foot and also in contact with another object they would vibrate instead of standing still. (if they stand on the planet they would vibrate)

        private void FixedUpdate()
{
    foreach(GameObject item in grav)
    {
        Attact(item);
    }
}

private void Attact(GameObject gmf)
{
    Rigidbody2D rgg = gmf.GetComponent<Rigidbody2D>();

    Vector3 direction = rg2d.position - rgg.position;
    float distance = direction.sqrMagnitude;

    float forceMag = (10 * rgg.mass) / distance;
    Vector3 force = direction.normalized * forceMag * 10;

    rgg.AddForce(force);
}

I can create a script that will change the gravity by the opposite of the object's position. this does work but I cannot see any way to do it for more than one object.

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:
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 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:
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:
How to trigger onclick for Unity Selectable by script? As title, I know Button can be triggered onclick by button.onClick.Invoke();
But how to simulate onclick event of Selectable?
Thanks for the help.

sentences:
Is it possible to make calculations in a Quake 3/Live hud? I would like to add a new field to a Quake 3/Quake Live HUD that shows the following number:

min(health + armour, health * 3) * (1.5 if guard_rune else 1)

This is the amount of damage you can take before getting killed, btw.

Is this even possible?

sentences: How animate objets seperately? I've set up a simple scene with some triangle and quads. With  glPushMatrix() and  glPopMatrix() i achieved to move an object to a new position, relative to another object in my render scene, but what i want is, for example, that the first triangle translates every render() call -2 units on the z axis, but the other triangle translates only -1 unit. I couldn't find any information how to manage this. As yet every glTranslatef() affects all objets. So what I have to do?

sentences:
Performance of 8 bit / 16 bit games vs Android/iOS games! CONTEXT

I have always been intrigued by video games - NES and SNES in particular. Now I am a 32 years old computer professional who has mostly done his coding in Java and C#. I recently found great inclination for Android games and posting this question to much wiser community in the field for knowledge and awareness of everyone.

INTRO

NES brought an invasion of 8 bit games. Very sleek, very entertaining and surprisingly very compact in size - few hundred Kb only.
Games like Mario/Contra/Ninja/Zelda and countless more.

SNES followed the suite and brought an era of much graphically appealing games in 16 bit - still the size of the games were very compact and games were very powerful.

For Android, I have been doing some research for some good game engine and found that LibGDX is very powerful, open source and written for Java developers. A plus for any Android game developer.

THE QUESTIONS

What I am not able to understand is that how those classic game developers managed to put all those endless levels and game characters and features and goodies in just few hundred kbs!
I am trying to replicate just 1 level of Mario and the size is already reaching to 300Kb, let alone adding the files code and characters sprite images!
Can we implement similar principles of compact and powerful coding using Android and LibGDX? If yes, how - If no, why not!
Is it possible to create a game in 8bit/16bit code and then migrate it to the Android/iOS platform?

sentences:
Camera rotation in 4D What practical choices do I have in order to rotate a camera in 4D space? I would like to make it as intuitive as possible.

A camera in 3D space can be represented by

a point where it is located
the forward vector (movement using the [w] and [s] buttons)
the left (movement using the [a] and [d] buttons)
the up vector (eg. [space] and [ctrl])

In 4D space, the an additional axis is added:

the fourth axis vector (eg. [q] and [e])

All of the vectors remain orthogonal to eachother. So the movement is trivial.

sentences:
Detecting right/left collisions with a bounding box I'm building a platformer in cocos2d, my first game project. I'm working on movement and collision detection. I'm using a tilemap with a "meta" layer of invisible blocks that are designated collidable.

Everything seems to work pretty well except for one minor detail: when the character jumps from above into a platform, he does not fall but clips through it. If he jumps from below, it recognizes it and resets his Y velocity accordingly. I know that it's because of how I'm  detecting the collisions, and just doing a simple comparison of the origin.y's, but I'm unsure of how to refactor this code better:

- (void) update: (ccTime) dt {
    CGPoint scaledVelocity = ccpMult(leftJoystick.velocity, 35.0f);
    CGPoint newPosition = ccp(player.position.x + scaledVelocity.x * dt, player.position.y);
    CGPoint oldPosition = [player position];

    float velocityX = player.Velocity.x + scaledVelocity.x * dt;
    float velocityY = player.Velocity.y;

    BOOL isCollision = NO;
    BOOL isCollisionBelow = NO;
    BOOL isCollisionRight = NO;
    BOOL isCollisionLeft = NO;

    NSMutableArray* collisionSprites = [[NSMutableArray alloc] init];

    if (oldPosition.x > newPosition.x) {
        player.flipX = YES;
    }
    else if (oldPosition.x < newPosition.x) {
        player.flipX = NO;
    }

    for (CCSprite* sprite in gameplayLayer.collidableTiles) {
        if (CGRectIntersectsRect(player.boundingBox, sprite.boundingBox)) {
            isCollision = YES;
            [collisionSprites addObject:sprite];
        }
    }

    // Figure out which direction collision is in
    if (isCollision) {
        for (CCSprite* collisionSprite in collisionSprites) {
            if (collisionSprite.boundingBox.origin.y < player.boundingBox.origin.y) {
                isCollisionBelow = YES;
            }
            if ((collisionSprite.boundingBox.origin.x > player.boundingBox.origin.x) && (collisionSprite.boundingBox.origin.y >= player.boundingBox.origin.y)) {
                isCollisionRight = YES;
            }
            if ((collisionSprite.boundingBox.origin.x < player.boundingBox.origin.x) && (collisionSprite.boundingBox.origin.y >= player.boundingBox.origin.y)) {
                isCollisionLeft = YES;
            }
        }
    }

    if (isCollisionLeft) {
        velocityX = 0.5f;
    }
    else if (isCollisionRight) {
        velocityX = -0.5f;
    }

    if (isCollision && !isCollisionBelow && player.characterState != kStateFalling) {
        velocityY = 0;
        velocityY -= 0.8f;
        [player setCharacterState:kStateFalling];
    }
    else if (!isCollisionBelow) {
        velocityY -= 0.7f;
    }
    else if (isCollisionBelow) {
        velocityY = 0;
        [player setCharacterState:kStateIdle];
    }

    if (rightButton.active) {
        if (player.characterState != kStateJumping) {
            velocityY += 15.0f;
            [player setCharacterState:kStateJumping];
        }
    }

    // Ground friction
    if (player.Velocity.x > 0) {
        if (player.Velocity.x < 0.5f) {
            velocityX = 0;
        }
        else {
            velocityX -= 0.5f;
        }
    }

    if (player.Velocity.x < 0) {
        velocityX += 0.5f;
    }

    [player setVelocity:ccp(velocityX, velocityY)];
    [player setPosition: ccp(player.position.x + player.Velocity.x, player.position.y + player.Velocity.y)];
    [gameplayLayer setViewpointCenter:newPosition];
    [player setOldPosition: player.position];
}

How can I refactor this code to work properly from all angles and reduce the complexity (I feel that there's too many booleans, and they all get a bit confusing).

sentences:
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:
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:
How to use assimp textures with openGL/getting a better understanding I recently learned how to load a model to openGL using assimp, but I am having trouble figuring out how to do lighting calculations on this model. Previously with my own created objects I would set the normals manually and pass them to the shader as attributes. Then I would use one diffuse and one specular texture passed as uniforms for lighting.

I'm trying to do the same with a model, but I can't seem to get it to behave correctly. When I use my own objects everything works normally, but when I try to draw the model some weird lighting occurs.

Here's how the model should look:

But mine looks like this:

What confuses me in particular is that assimp loads both normal vertices and normal textures. I'm not sure what the difference between them is or if there is more about model loading that I've yet to learn, which is entirely possible since I don't know much about heightmaps and other things yet.

Anyway, here's what I'm doing for calculations:

void main()
{
    vec3 normal = normalize(Normal);
    vec3 viewDir = normalize(viewPos - fragPos);

    vec3 result;

    for (int j = 0; j < sizeModels; j++)
        result += CalcDirLight(DirLights, normal, viewDir, models[j]);

    FragColor = vec4(result, 1.0);
}

vec3 CalcDirLight(DirLight light, vec3 normal, vec3 viewDir, Material textures)
{
    vec3 lightDir = normalize(-light.direction);
    // diffuse shading
    float diff = max(dot(normal, lightDir), 0.0);
    // specular shading
    vec3 reflectDir = reflect(-lightDir, normal);
    float spec = pow(max(dot(viewDir, reflectDir), 0.0), textures.shininess);
    // combine results
    vec3 ambient = light.ambient * vec3(texture(textures.diffuse, Tex));
    vec3 diffuse = light.diffuse * diff * vec3(texture(textures.diffuse, Tex));
    vec3 specular = light.specular * spec * vec3(texture(textures.specular, Tex));
    return (ambient + diffuse + specular);
}

Notice that I'm providing my own diffuse values to the DirLight struct. The Material struct is what contains the diffuse and specular textures, as well as a shininess float.

For reference I am following guides from this site:
https://learnopengl.com/

Any help would be appreciated!

sentences:
How can I implement sprite layering in a 2.5D game? I started making a game, which has a 3D engine under it, but achieves a 2D look by using ab orthographic camera and billboards. Similar to how Don't starve, Realm of the Mad God and (I think) the new Stardew Valley manages entity rendering.

All three games I posted have structures in them (grass, trees, etc), and the player can go behind them. I want to achieve this effect. Of course, by having a fixed Z coordinate for the entities (I use Z sorting) isn't enough for this.

I once achieved this effect by making the entity's Z coordinate change based on their clip space position, but this I felt like this wasn't the best solution.

Basically, what's the best (fastest) way to achieve the above mentioned effect?

sentences:
All Materials are pink (Unity URP) Version: Unity 2020.2.0f1
I started my project with Universal render pipeline template but I don't know why all materials are pink. i even tried to upgrading but nothing happened.
This error was coming after upgrading:

And when I am creating new materials then I still getting pink materials and I am also not able to upgrade them:

sentences:
Pathfinding with multiple random paths in a Tower Defense game I thought about random pathfinding for my Tower Defense game. A* would not work for my puposes, because I specifically need random pathfinding.

Imagine a map with routes, a starting point and a destination. I have multiple routes, which all lead from the starting point to the destination, one way or another. It could look like this:

Color description: red - starting point; black - destination; grey - route; white - free space
(The numbers are used in the text as a reference to some tiles)

I first thought about just calculating the next waypoint randomly, when an entity passes a tile. But that would not work. When an entity passes tile 1 it either can go up or down. When it comes to 2 it can either go down/up (relative to it´s position) or right.
If it goes down/up it would go to tile 1, which means that it goes backwards. Bad...

I would really like to make it dynamic, but I can´t figure out what I can do now. Anyone with ideas or experience in this?

sentences:
DX11 - Weird shader behavior with and without branching I have found problem in my shader code, which I dont´t know how to solve.

I want to rewrite this code without "ifs"

tmp = evaluate and result is 0 or 1 (nothing else)
if (tmp == 1) val = X1;
if (tmp == 0) val = X2;

I rewite it this way, but this piece of code doesn ´t word correctly

tmp = evaluate and result is 0 or 1 (nothing else)
val = tmp * X1
val = !tmp * X2

However if I change it to:

tmp = evaluate and result is 0 or 1 (nothing else)
val = tmp * X1
if (!tmp) val = !tmp * X2

It works fine... but it is useless because of "if", which need to be eliminated

I honestly don´t understand it Posted Image . I tried compilation with NO and FULL optimalization, result is same

sentences:
Analytics for PC games: is there anything similar to localytics, flurry, etc? I would like to know if there exists any service such as Localytics or Flurry but for PC? These ones are mobile focused. It would be really great if they had support for PC too.

In the case there's nothing similar at all, what alternatives or which methods would you recommend for me to keep track of this analytics?

I'm planning to use it in a game and not only to gather generic data such as gender, age, country, etc. What I'd really like is to be able to track gameplay statistics such as: is my game too difficult? (number of deaths per player per level), is my game fun? (number of players who never finish the game and at which point did they stop playing), etc.

sentences:
Should I send the elapsed time to the fixed step update function from my game loop? I am making a basic game loop based on this article.  This is the nearly final version:

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

But I think the update function should have elapsed time passed to it so that the game state is calculate based on that.

So this should be the correct version:

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(elapsed);   ---------------->>>??
    lag -= MS_PER_UPDATE;
  }

  render();
}

Am I right? Because I think a physics engine should always have a delta time to calculate state changes.

sentences:
OpenGL/SDL2 How to resize the render area with the window? After calling SDL_SetWindowSize, the area being rendered to doesn't change with the window, so if the window gets bigger, it leaves a black area on the top and right sides.  I am adjusting the OpenGL viewport to the new window dimentions.  Everything I'm drawing scales correctly but is cut off when the window is bigger.

I've been searching for the solution all day and all I've found is creating a new OpenGL context, but that causes crashes unless I reload all my graphics data which seems ridiculous just to resize the window.

Is it the default framebuffer that needs to be resized?  According to the OpenGL wiki,

  All default framebuffer images are automatically resized to the size of the output window, as it is resized.

So if the default framebuffer is being resized, why is it only rendering to the same small area?

I could initialize it to the largest possible resolution and then shrink it, but wouldn't that cause OpenGL to process a bunch of fragments outside the window?

sentences: Writing a dynamic achievement system without hardcoding rules into the application I really enjoyed the solution provided here for groundwork on writing an achievement framework. The problem I have is I have game designers that would like to be able to insert achievements into a CMS at runtime. In a way, it sounds insane and complex to do this, but is it really? I think the concept of having to do a hard push of the application for every new achievement is cumbersome. I would love to be able to give our designers the capability to put together new achievements by entering them into a database. It shouldn't matter what tool I'm using, but for those interested, my backend is being written in JRuby (Ruby on top of the JVM). What are some possible ways of going about abstracting the logic in the aforementioned link even further so that rules can be interpreted at runtime?

sentences:
Algorithmic error in tile engine? I'm toying with creating a tile-based 2D java game engine. I can render the "local" area without issues(I.E. deciding which local tiles to render). The problem came when I introduced floating point locations. I want my "camera" location to be a double. My thought was "I'll multiply the double by the tilesize, round it, and get a pixel approximation". That doesn't work, for one reason or another. The code below is the most functional code I've been able to construct. It works almost entirely correctly except around the 0,0 area it skips tiles(?) and it looks hackish and the code's overall hideous. Is there some easier method I'm missing here, is there an example I can examine?

private HashMap<Integer, HashMap<Integer, Tile>> tiles = new HashMap<>(); // Tiles stored here
public double cameraX = 0, cameraY = 0; // Camera location(centered on screen)
private final int TILE_SIZE = 100; // Size of tiles
private final int TILE_BUFFER = 5; // Buffer of tiles to be rendered/loaded around screen
private int screenTileWidth = 0, screenTileHeight = 0; // Tiles that fit onto the screen

@Override
public void render(Graphics g) {
    // Calculate tile width/height of screen
    int screenWidth = this.screenTileWidth + (TILE_BUFFER * 2), screenHeight = this.screenTileHeight
            + (TILE_BUFFER * 2);

            // Supposedly the offsets from the camera's location to be applied to the rest of the tile locations
    int locOffsetX = (int) Math.round((cameraX % 1) * TILE_SIZE);
    int locOffsetY = (int) Math.round((cameraY % 1) * TILE_SIZE);

            // Big mess of "eww" hackish stuff to fix negatives messing with things
    if (cameraX >= 0 && locOffsetX >= 0) {
        locOffsetX *= -1;
    }
    if (cameraX < 0 && locOffsetX < 0) {
        locOffsetX *= -1;
    }
    if (cameraY >= 0 && locOffsetY >= 0) {
        locOffsetY *= -1;
    }
    if (cameraY < 0 && locOffsetY < 0) {
        locOffsetY *= -1;
    }

            // Base offsets to center tile
    int offsetX = ((GameEngine.g.getWidth() / 2) - (screenTileWidth / 2)
            * TILE_SIZE)
            + locOffsetX;
    int offsetY = ((GameEngine.g.getHeight() / 2) - (screenTileHeight / 2)
            * TILE_SIZE)
            + locOffsetY;

    // Loop through loaded tiles(x/y tile coord)
    for (int x = (int) (Math.floor(cameraX) - (screenWidth / 2)); x < Math
            .floor(cameraX) + (screenWidth / 2); x++) {
        for (int y = (int) (Math.floor(cameraY) - (screenHeight / 2)); y < Math
                .floor(cameraY) + (screenHeight / 2); y++) {
                            // The screen-relative tile coord
            int sx = (int) (x - Math.floor(cameraX));
            int sy = (int) (y - Math.floor(cameraY));

                            // Tile pixel location
            int locX = sx * TILE_SIZE + offsetX;
            int locY = sy * TILE_SIZE + offsetY;

            // Draw box/location info
            g.setColor(Color.RED);
            g.drawRect(locX, locY, TILE_SIZE, TILE_SIZE);
            g.drawString(x + ", " + y, locX + 10, locY + 20);
        }
    }
}

sentences:
String storage in game engine I've been designing the memory management module for my game engine, including things like custom allocators and when it came to allocating memory for strings I kinda got stuck.
What I mean by strings in this context is things like UI text,
Items description, dialogues etc, so basically strings themselves are immutable, but they can stop being useful and just get freed.

With the string (and basically any object type with such allocation patterns) allocator I'd like to mostly get rid of the malloc/free invocations and so I'm wondering what kind of allocator is suitable for this jobs.
Another thing that worries me is fragmentation, because string have variable length by nature

How do game engines handle strings like this in the first place?

EDIT

Firstly I'd like to address some of the questions that came up.

The strings themselves would be loaded from an asset file.

By 'stop being useful' I mean a situation where player interacts with some kind of item that has a description associated with it and we'd like to show the description on screen.

To do that, the text would get loaded, displayed and freed some time after the player closes the description window (the delay is here because there the player could reopen the window again in a brief second for whatever reason).

Such allocations would occur very often, because we don't need all the resources at all times, just a specific subset of them and my idea was to create an allocator for that purpose. It would malloc a large enough block of memory and store the strings (or any resource of such allocation pattern) in it, marking the free spots as the string get freed.

That's when 'what about fragmentation' came up in my mind, because some strings might actually be stored a bit longer than others, leading to fragmentation inside the allocator.

But after reading some of the comments I figured that what I actually need is separate allocators for long-living strings/resources, such as UI elements, and for short-lived elements, like the dialogues and descriptions
What I also realized thanks to @Moo-Juice is that I could introduce something like resource-groups, that would hold the group of resources needed at that time, for example when entering some location, we'd load all the things that are contained within that location.
Thanks for the insight!

One thing remains a puzzle for me tho.
I've looked around Doom 3 source code, where I found a class called idStrPool which uses new/delete to allocate/deallocate strings.
Can anybody comment on that? After reading some books and articles I was convinced, that such a thing is pure evil in a game engine, yet here it its.
A use case I see for this is like handling input from the player, i.e. when the player types something and we want to capture it.
Can anyone comment on that?

Edit 2

Ok, I see that guys from idSoftware have overrided the operators in Heap.h

sentences:
openGL managing images, VBOs and shaders I'm working on a game where I use shaders with vertex attributes (so not immediate mode). I'm drawing lots of images and changing the width/height of the quads I use to draw them a lot. To optimize this it's probably a good idea to have one buffer but then one needs to update the complete buffer when one image changes (or only a part of the buffer using glBufferSubData...)

I was just wondering what kind of strategies you guys are using?

sentences:
How can I test if an oriented rectangle contains another oriented rectangle? I have the following situation:

To detect whether is the red rectangle is inside orange area I use this function:

- (BOOL)isTile:(CGPoint)tile insideCustomAreaMin:(CGPoint)min max:(CGPoint)max {
    if ((tile.x < min.x) ||
        (tile.x > max.x) ||
        (tile.y < min.y) ||
        (tile.y > max.y)) {
        NSLog(@" Object is out of custom area! ");
        return NO;
    }
    return YES;
}

But what if I need to detect whether the red tile is inside of the blue rectangle?
I wrote this function which uses the world position:

- (BOOL)isTileInsidePlayableArea:(CGPoint)tile {

    // get world positions from tiles
    CGPoint rt = [[CoordinateFunctions shared] worldFromTile:ccp(24, 0)];
    CGPoint lb = [[CoordinateFunctions shared] worldFromTile:ccp(24, 48)];
    CGPoint worldTile = [[CoordinateFunctions shared] worldFromTile:tile];

    return [self isTile:worldTile insideCustomAreaMin:ccp(lb.x, lb.y) max:ccp(rt.x, rt.y)];
}

How could I do this without converting to the global position of the tiles?

sentences:
OpenGL ES 2.0. Sprite Sheet Animation I've found a bunch of tutorials on how to make this work on Open GL 1 & 1.1 but I can't find it for 2.0.

I would work it out by loading the texture and use a matrix on the vertex shader to move through the sprite sheet.

I'm looking for the most efficient way to do it. I've read that when you do the thing I'm proposing you are constantly changing the VBO's and that that is not good.

Edit:
Been doing some research myself. Came upon this two Updating Texture and referring to the one before PBO's. I can't use PBO's since i'm using ES version of OpenGL so I suppose the best way is to make FBO's but, what I still don't get, is if I should create a Sprite atlas/batch and make a FBO/loadtexture for each frame of if I should load every frame into the buffer and change just de texture directions.

sentences:
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:
XNA mesh.Draw() takes the longest CPU time We have a problem. Our game steadily slows down as we increase the number of models we draw. When the number reaches 100 - FPS is dead. Our humble tests showed that the reason is not GPU. This is what we did:

Rendered models with the most basic shader code - nothing changed;
Checked the NVidia NSigt metrics - GPU was less and less loaded per second as we increased number of models;

At the same time, a simple Windows Task manager showed that, as the number of models rise, the load increases (up to a 100%) on the single CPU core that our game uses. So we are pretty sure our game is running slowly because of the CPU.

We then moved on and tried to identify which line exactly causes the problem. We used c# TimeSpan metrics and timers for that. Our research showed that the biggest cause of the slow performance is... mesh.Draw() function used by every model that we draw.

We tried commenting this very line and things improved instantly (ofc. nothing was drawn on the screen).

So the question is, what are we to conclude from this? mesh.Draw is a closed function and we cannot optimize it. Trying to bruteforce parallel it is impossible (i guess it was natural). But something tells me that we need to look elswhere if this function is slowing the CPU, the question is where?

Update: here is the code I use to draw the model:
            public void Draw(...)
            {
                int index = 0;

            int i = 0;

            foreach (ModelMesh mesh in Actor.Model.Meshes)
            {

                bool isDrawable = false;
                #region Check if this ModelMesh needs to be drawn according to PartsToDraw (string) list.
                foreach (string s in PartsToDraw)
                    if (s == mesh.Name)
                        isDrawable = true;
                #endregion

                if (isDrawable)
                {
                    int effectStartIndex = index;
                    foreach (Effect effect in mesh.Effects)
                    {
                        if (Actor.MatrixPaletteParams[index] != null)
                        {
                            Actor.WorldParams[index].SetValue(World);
                            Actor.MatrixPaletteParams[index].SetValue(Actor.Palette[i]);
                        }
                        else
                            Actor.WorldParams[index].SetValue(Actor.Pose[mesh.ParentBone.Index] * World);

                        if (drawType != null && drawType.DrawShadow)
                            SetShadowEffectParameters(effect, renderer, drawType.DrawShadowMort);
                        else
                        {
                            SetCommonEffectParameters(effect, renderer);
                            SetLitEffectParameters(effect, renderer, drawType);
                        }

                        index++;
                    }
                }
                else
                    index++;

                if (isDrawable)
                    mesh.Draw();

                i++;
            }
        }

"Set...EfectParameters" methods mostly consist of effect.Parameters["SomeParameter"].SetValue() calls. I pass around 30 parameters to the GPU there, mostly floats, matrices and bools. Moreover each ModelMesh has three textures that it passes into the GPU. I have no idea how fast this works and if it can be optimized. It should be fast.

You should also note that I draw a skeletaly animated model using Dastle's XNA Animation Component library. Once again, I understand that this might be the reason behind lags, and we did find the weak spot of the animation code, but why on Earth does the metrics show that mesh.Draw is the slowest spot? What is happening there?

sentences:
How can I record and replay axis input accurately for testing? I want to do integration testing for an old C#/Unity project. The project uses its own input system, so I can't use inputEventTrace or any other convenient Unity class. So I subscribed a new game object to the custom input system so that it records any input detected in each frame.
But when I replay, because of the difference in frame times, the replays are not quite equal to the original playthrough (especially because of the axis input). My understanding is that input in Unity is not event-based, so I can't think of any way to perfectly mimic the input given different frame times. Does anyone know of a way to do this?

sentences:
Cocos Code IDE unable to find python I am trying to create a new JavaScript project on Cocos Code IDE but every time it immediately give me the error message:

  Unable to find python. Please, click the setting button to set the python path, then python 3.0 or later is not supported.

I click the button and I set the path to C:\Python27 which is the folder of my python installation, and I try again but I get exactly the same error. The version of my python installation is 2.7.8. I am using Windows8.1.

EDIT: It occurred to me that there is also another error message:

the python's version must be greater than or equal to 2.7.5 and less than 3.0

But I cannot understand why it does not accept my version(2.7.8).

sentences:
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: Saving data across same game in multiple devices Is there any library or something that works like iCloud but for different operating systems (Android, IOS, Windows Phone) that allow me to save game data to cloud and open the game data from another device to sync the game progress?

sentences:
Multiple ( V- / I- ) Buffers, is it sane? Currently I am developing an RTS game using XNA ( / ANX.Framework ).
There is one thing bothers me. I am not sure in what way or how to organise Buffers.
Should I use a new Vertexbuffer for any object ( e.g. a Char, a Table, an model ) or is it better to use ONE HUGE/ BIG Buffer to store any geometry in?

I am still new to 3D Programming though I finished yet couple games using DirectX 9.

Well, I hope this question qin't a duplicate and I appreciate any answer leading me into the right direction.

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:
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:
Some autocompletion doesn't work in Visual Studio Code with Unity I am using Unity 2018 with Visual Studio Code version 1.43.2 on a Mac.

Things seemed to work fine between Unity and Visual Studio Code, but now I realize that something is wrong with Code. I have been following along with a tutorial and the autocompletion functionality of Code seemed fine until the function OnTriggerEnter, which was shown as autocompleting for the guy in the video (who was using the other Visual Studio), didn't fill in. However, many other Unity things do automatically show up as options.

I looked at this Microsoft help page about VS Code and Unity, and I have everything it I seems I would possibly need to combine the two; I have .NET, Mono, Debugger for Unity, the C# extension, and got Unity Tools for good measure.

Generic C# things like return, void, int, etc. autocomplete, so the C# extension seems fine. Many Unity things, like Vector3, GameObject, Destroy, transform, etc. also autocomplete like they should.

What is wrong here? How can I fix this and get full autocomplete?

sentences:
Recurring stalls in SwapBuffer I am currently doing measurements on a test scene implemented in OpenGL 4.5 with different "setups".

I noticed that in case I have a very high amount of FPS (1550 in this specific case), SwapBuffer does stall about every 20th frame and the frame time increases from ~0.5ms to ~1.2ms.
This does ONLY happen when the FPS is above a certain threshold.
I already figured out that it is not related to pre-rendered frames (i disabled pre-rendered frames in the NV control panel) and it is also not related to vsync (wglSwapIntervalEXT(0) is used).

Can someone tell me what might be causing this stalls/lags or wathever.

I attached two screenshots made with Nsight.

The first shows a "healthy" setup with no stalls:

While the seconds shows the setup with the stalls:

sentences:
Canvas enabling is not working I have a canvas with two buttons in it and I want to enable it on the button click, but when I try to enable it, it doesn't work. However, when I try to disable it on button click it does work.
Here is my code:

 public GameObject mycanvas;
  public  void onClick() {
     mycanvas.SetActive(true);
}

Can someone please tell me what I am doing wrong?

sentences:
How do I use threads together with DirectX11? I have only found the documents on MSDN: http://msdn.microsoft.com/en-us/library/windows/desktop/ff476884(v=vs.85).aspx Although it doesn't say anything about creating them, it mentions that device is thread-safe while device context is not.

Does the framework use threads by itself (if driver supports it) when it thinks it's more optimal? Or do we have to use some external library like BOOST to play around with threads?

sentences:
How do I use D3DXVec3Unproject with D3D11? I'm having a small issue with D3DXVec3Unproject. I'm currently using Direct3D 11 and not 10, and the signature for this function is:

D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3D10_VIEWPORT *pViewport,
      CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld

As you may have noticed, it requires a D3D10_VIEWPORT, and I'm using a Direct3D 11 viewport, D3D11_VIEWPORT.

Do you have any ideas how I can use D3DXVec3Unproject with Direct3D 11?

sentences: Planar reflections not showing when baked reflection probes enabled I have a reflection probe that is baked that is set to capture static environment objects like buildings/terrain etc. I also have a planar reflection probe that is following the player camera which is only set to capture the player. I am trying to have both of these displaying on a surface. When I have the baked reflection probe turned on the planar reflection will not show. Are they mutually exclusive? I am using Unity 2020.1.6f1 with HDRP.

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:
Level progression grid/chart What I'd like to do is create a sheet where I can track character XP/level progression.

I created this by hand:

It's sloppy, but in the realm of what I'd like to generate on a computer. Each bar represents XP needed to level up, with each square on the grid representing a set number of XP.

Any ideas how I could go about doing this in a more standardized/repeatable/printable?

sentences:
Most efficient way to calculate angle between two line-segments that do not necessarily touch each other Although I found answers on calculating angles from vectors, I didn't find a specific way to calculate angles between line-segments that do not necessarily touch each other (I say "not necessarily because I will apply to different cases).

See the figure below:

Consider that I know the 2D position of all 4 red points. I am using C# here. What would be the cheapest way of calculating the angles formed by line-segments that do not touch each other, such like the ones above?

sentences:
Unreal Engine: saving in-game images to disk without blocking game thread I am working on an Unreal based open-source UAV simulation (Microsoft AirSim) where I am trying to capture and save images from a camera that's attached to the drone. The image underneath gives an idea of how the game looks like. The rightmost view on the bottom is the actual view from the camera, the other two are just processed versions of the same image.

Right now the way it's set up in this way: There's a camera asset, which is read through the code as a capture component. The three views in the screenshot are linked to this capture component. The views are streamed without any problem as the drone is flown around in-game. But when it comes to recording screenshots, the current code sets up a TextureRenderTargetResource from this capture component, and subsequently calls ReadPixels and saves that data as an image (please see below for code flow). Using ReadPixels() as it is, is blocking the game thread directly and slowing down the whole game by a lot: drops from ~120 FPS to less than 10 FPS when I start recording.

bool saveImage() {
  USceneCaptureComponent2D* capture = getCaptureComponent(camera_type, true);
  FTextureRenderTargetResource* RenderResource = capture->TextureTarget->GameThread_GetRenderTargetResource();
  width = capture->TextureTarget->GetSurfaceWidth();
  height = capture->TextureTarget->GetSurfaceHeight();

  TArray<FColor> imageColor;
  imageColor.AddUninitialized(width * height);
  RenderResource->ReadPixels(bmp);
}

Looking at this article, it seems evident that ReadPixels() "will block the game thread until the rendering thread has caught up". The article contains sample code for a 'non-blocking' method of reading pixels (through removal of FlushRenderingCommands() and using a RenderCommandFence flag to determine when the task is done), but it doesn't significantly improve the performance: the rate at which images are saved is slightly higher, but the game thread still runs at about only 20 FPS, thus making it really hard to control the UAV. Are there any more efficient asynchronous methods that can achieve what I am trying to do, perhaps, say, in a separate thread? I am also a little confused as to why the code has no trouble streaming those images on-screen as fast as possible, but saving the images seems way more complicated. It's fine even if the images are saved to disk only at 15 Hz or so, as long as it doesn't interfere with the game's native FPS too much.

sentences:
(real) 3d map rendering in wpf without an engine - how to handle the map data? I'm just doing some research before embarking on rendering a 3D map inside a wpf app. I've never delved into 3D before, and hence the question..

I have map data (in several formats, and many files) which I need to render - probably in a wpf viewport3D. All the map data is in 2D, but I can add a height-map and convert to 3D. This data can be altered (updated) by the user without my knowledge, but a bit of data-crunching can be done before application start, so it doesn't need to be entirely realtime.

I've googled around but can't find a framework for how to represent my world. Do I write a terrain-tile stream server to handle requests from the viewport about which area to display?
Do I create a collossal map, and hope it fits into memory?

Are there tutorials about how to deliver large terrains for rendering? Most of them seem to be about building a world inside an editor..

My world could be about 1000km * 1000km, with roads, parks, forests, power lines, street addresses (etc) - it's going to be a fair bit of data..

The machines that this software has to run on are ruggedized laptops - so not terribly fast (Core 2 duo?) and probably without DX10, but we can insist on heaps of RAM and HDD (SSD?).

Thanks - I'm looking forward to getting into this project..

sentences: Why is there almost never online multiplayer in indie games? There are alot of which are local but very few who have online.

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 to link the game class to the main menu class in XNA? So I got my game in another class and my main menu in another class.

This is the update method in my Main menu class

MouseState mouse = Mouse.GetState();
            switch (CurrentGameState)
            {
                case GameState.MainMenu:
                    if (btnPlay.isClicked == true) CurrentGameState = GameState.Playing;
                    btnPlay.Update(mouse);
                    break;

                case GameState.Playing:

                    break;

            }
            base.Update(gameTime);

This is the draw method in my Main menu class

spriteBatch.Begin();
            switch (CurrentGameState)
            {
                case GameState.MainMenu:
                    spriteBatch.Draw(Content.Load<Texture2D> ("MainMenu"), new Rectangle (0,0, screenWidth, screenHeight),Color.White);
                    btnPlay.Draw(spriteBatch);

                    break;

                case GameState.Playing:
                    break;
                                    }

            spriteBatch.End();

But now I don't know how to link/call the actual game file..
Would someone be able to help me with this please?

sentences:
Beginner flash game development: Start with framework or from scratch? I want to write some simple flash games (as a hobby). I have a lot of programming experience, but no experience with Flash/ActionScript.

My question is:
As a beginner, is it a good idea to start with a framework like Flixel, FlashPunk or PushButton or would it be better to write my first games from scratch?

Also, if you vote for using a framework, which one would you recommend?
What are the differences?

And another question: What about Flex, would you recommend using it?

sentences:
Game ladder using Apple Game Center I'm implementing a turn based game where players can meet other players in matches via Apple Game Center. Each match has two players.

I want to make a global ranking of all players using Apple Game Center. This ranking serves two purposes:

each player will know his/hers ranking.
a player can be matched to another player with a similar skill.

My current thinking is something like this:

A win gives +1 points
A lose gives -1 points
An aborted match, or not accepting a match gives -1 points.
0 is the minimum score.
The leaderboard will present the score of each player.
Players will be placed in groups according to their score. Each group can cover a range of scores, and players will be matched with players from the same group.

I have the following questions:

Do you like my suggested scoring solution?
Is it possible to accomplish an effective match making with this approach? I mean, some groups can have very few participants. Maybe only one. Of cause you can try to do a match making with a lower group, but that can also be empty, and it will take time. How shall I solve this?
I've not released the game, and I don't know how many players it will have. Is it possible to make the grouping dynamic in some way? More players requires more groups.
Is it possible to make players that does not accept matches to lose points? I only want to have active players in top of the ladder.

So far I've only found this input:
https://stackoverflow.com/questions/9355799/can-i-make-a-ladder-systemlike-battle-net-with-using-just-game-center

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:
2d engine/library for android in C# I'm looking for a good 2d engine or library (that supports physics) for Android. I have a restriction - language should be C#.
It's not a requirement to use Mono Droid, but it seems that it is an only way.

What can you suggest?

sentences:
In a collision detection loop, when do I apply the velocity? I'm writing a really basic collision detection system (AABB vs AABB, AABB vs Circle, Circle vs Circle), and I've just got to the point of writing the actual loop which iterates the objects and checks for collisions.

My question is when do I apply the velocity to each object? Do I move all objects by vel * dt before I even start colliding? Do I apply the velocity as I iterate? If so, do I apply it to both objects I'm testing, or just the first, and then apply the velocity to the second when I check collisions against that one?

Also presumably I should do the whole collision check recursively (as the act of responding to one collision might cause another), but that obviously effects how and when the velocity is applied.

My suspicion is that I should move all the objects by their velocity before I begin, and then recursively detect and respond to collisions until nothing is colliding (or until some loop limit).

sentences:
Split tiles into Chunks [2D] I'm trying to make a Chunk class for my Tile class creating Chunks of 25 Tiles each, But for some reason it doesn't work correctly
Tile.cs extends Sprite.cs

  class Tile : Sprite
    {
        public TileType TileType { get; set; }

        public Tile(Texture2D texture, Vector2 position, SpriteBatch spriteBatch) : base(texture, position, spriteBatch)
        {
        }
    }

Sprite.cs

    class Sprite
    {
        public Vector2 Position { get; set; }

        public Texture2D Texture { get; set; }

        public SpriteBatch SpriteBatch { get; set; }

        public Sprite(Texture2D texture, Vector2 position, SpriteBatch spriteBatch)
        {
            this.Position = position;
            this.Texture = texture;
            this.SpriteBatch = spriteBatch;
        }

        public virtual void Draw()
        {
            SpriteBatch.Draw(Texture, Position, Color.White);
        }
    }

My Chunk.cs

class Chunk : Sprite
    {
        public Tile[,] Tiles { get; set; }

        public const int CHUNK_SIZE = 25;

        public Chunk(Texture2D texture, Vector2 position, SpriteBatch spriteBatch) : base(texture, position, spriteBatch)
        {
            Tiles = new Tile[CHUNK_SIZE, CHUNK_SIZE];

            GenerateChunks();
        }

        public void GenerateChunks()
        {
            for (int x = 0; x < CHUNK_SIZE; x++)
            {
                for (int y = 0; y < CHUNK_SIZE; y++)
                {
                    Vector2 tilePos = new Vector2(Texture.Width * x, Texture.Height * y);
                    Tiles[x, y] = new Tile(Texture, Position, SpriteBatch);
                }
            }
        }

        public override void Draw()
        {
            foreach (var tile in Tiles)
                tile.Draw();
        }
    }

And my World.cs

 class World
    {
        float NoiseValues { get; set; }

        public Chunk[,] Chunks { get; set; }

        public SpriteBatch SpriteBatch { get; set; }

        public Texture2D Texture { get; set; }

        public int Height { get; set; }

        public int Width { get; set; }

        public const int CHUNK_TILE_SIZE = 400;

        private float NoiseScale = 0.1f; //Smaller the scale the better caves

        private Random Random;

        public World(SpriteBatch spriteBatch, Texture2D texture, int x, int y)
        {
            this.Height = y;
            this.Width = x;

            this.SpriteBatch = spriteBatch;

            this.Texture = texture;

            Chunks = new Chunk[x, y];

            Random = new Random();

            Simplex.Noise.Seed = Random.Next();

            GenerateBasicWorld();
        }

        public void GenerateBasicWorld()
        {
            for (int x = 0; x < this.Width; x++)
            {
                for (int y = 0; y < this.Height; y++)
                {
                    NoiseValues = Simplex.Noise.CalcPixel2D(x, y, NoiseScale); //Just a simplex noise for further generation doesn't affect current gen

                    Vector2 chunkPos = new Vector2(16 * x, 16 * y);
                    Chunks[x, y] = new Chunk(Texture, chunkPos, SpriteBatch);

                    System.Diagnostics.Debug.WriteLine(NoiseValues);
                }
            }
        }

        public void Draw()
        {
            foreach (var chunk in Chunks)
                chunk.Draw();
        }
    }

My initialization goes like this:

World world = new World(spriteBatch, tilesTexture[0], 5, 5);

What I'm currently getting is 5x5 tile set drawn.

I'm expecting to get 5 chunks on X axis and 5 chunks on Y axis, each chunk has to be made of 25 tiles, am I missing something out? Thanks.

sentences: Static Camera on Endless Runner I am developing a mobile game in ue4. For this project, I need to have a "static" camera so that the player can move within the frame not affecting camera location and rotation. But as this is an endless scroller I also need to have the camera move at a constant pace limiting the player's area of movement. Does anyone know how to do this?

sentences:
Multiple image objects extracted from spritesheets or one-two object for all? Let's say I want to make a 2D game and I'll use a spritesheet containing all of the animation frames and a texture-atlas for static sprites such as walls, non-animated decorations...etc.

Should I create separate image objects for all the static sprites and for all animation-rows or should I just pass the on-texture-atlas (or on-spritesheet) coordinates for them?

Which solution, or "direction" is considered elegant in game-development?

Thanks for the help! :)

Some pseudocode:

Separate image objects:

Class StaticSprite {
  Image texture;

  // ...

  public Image getImage() {
     // ...
  }

  public static final CheckedWall cw = new CheckedWall( -- checked wall grid extracted from the texture-atlas -- )
  public static final WoodWall ww = new WoodWall( -- wood wall grid extracted from the texture...
}

Or:

class StaticSprite {
 int texX, texY, size;

 // ...

 public Image getImage() {
    // gives the part of the spritesheet
 }

 public static final WoodWall ww = new WoodWall( -- coordinates for the texture-atlas -- )
}

Assuming that the spritesheet is accessible for all these sprite-related classes.

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:
How to handle a different kinds of weapon in a single component and system in entity system? A weapon can be used as melee or range weapon, it can be thrown, toss, fired, shoot, cast (a projectile) or use to slash, bash, stab . How do I apply these to entity-system? my first approach is to create an enum class of WeaponType, a melee or range.

public enum WeaponType {
    MELEE,
    RANGE
}

public interface Weapon {
    void use();
}

Then I've create a weapon component and add weapon type data, to determine its type. For melee a weapon, it needs to have a method that handles different kind of "attack motion" like slash, bash, stab. For range weapon, it needs to have a container, factory and a method that handles different kinds of "projectile motion" like shoot, fire, throw, toss etc.. Now the problem is how could I create a method for different kinds of projectile motion, remember I am specifically using Ashley ECS framework

public class WeaponComponent implements Component {
    public Weapon weapon;
    public WeaponType type;
    // if weapon type is melee, use the below data
    public Container container // holds the created projectile
    public Factory factory // creates a different kinds of projectile object
}

// or create seperately???

public class MeleeWeaponComponent implements Component {
    ... different kinds of method also like slash, bash, stab
}

public class RangeWeaponComponent implements Component {
    ... Factory and Container
    ... different kinds of projectile motion?
}

In this idea, I can use abstract or interface but I think abstraction or is not recommended.

[Combined data suggestion] by @Ryanwhite and me

Blue line is area of effect angle covered
Green line is distance covered
Red point is the target point

public class WeaponComponent implements Component {
    public Ray ray // to handle collisions
    public float aoe; // 0.5 for melee, more than 0.5 for other weapon
    public float aoeAngleCovered;
    public float aoeAngle
    public Ammo[] // 0 for melee, 1 or more for other weapon
}

sentences:
Distinction between constant and changeable game objects in save/load game? Do you distinguish constant and changeable game objects when you save/load game? If yes, how do you do it?

If not to save constant objects (for example, mountains and trees), we optimize memory usage and save/load time. But functional requirements for the game can change. Now you want trees to be mutable and destroyable. It can screw up all previous game states. Trees were not saved => saved game map is interpreted as the prairie without trees.

sentences:
Why won't my vertex buffer render in GLFW3? I have started to try to learn OpenGL, and I decided to use GLFW to assist in window creation. The problem is, since GLFW3 is so new, there are no tutorials on it or how to use it with modern OpenGL (3.3, specifically).

Using the GLFW3 tutorial found on the website, which uses older OpenGL rendering (glBegin(GL_TRIANGLES), glVertex3f(), and such), I can get a triangle to render to the screen. The problem is, using new OpenGL, I can't get the same triangle to render to the screen.

I am new to OpenGL, and GLFW3 is new to most people, so I may be completely missing something obvious, but here is my code:

static const GLuint g_vertex_buffer_data[] =
{
-1.0f, -1.0f, 0.0f,
1.0f, -1.0f, 0.0f,
0.0f, 1.0f, 0.0f
};

int main(void)
{
    GLFWwindow* window;

    if(!glfwInit())
    {
        fprintf(stderr, "Failed to initialize GLFW.");
        return -1;
    }

    glfwWindowHint(GLFW_SAMPLES, 4);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
    glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

    window = glfwCreateWindow(800, 600, "Test Window", NULL, NULL);
    if(!window)
    {
        glfwTerminate();
        fprintf(stderr, "Failed to create a GLFW window");
        return -1;
    }
    glfwMakeContextCurrent(window);

    glewExperimental = GL_TRUE;
    GLenum err = glewInit();
    if(err != GLEW_OK)
    {
        glfwTerminate();
        fprintf(stderr, "Failed to initialize GLEW");
        fprintf(stderr, (char*)glewGetErrorString(err));
        return -1;
    }

    GLuint VertexArrayID;
    glGenVertexArrays(1, &VertexArrayID);
    glBindVertexArray(VertexArrayID);

    GLuint programID = LoadShaders("SimpleVertexShader.glsl", "SimpleFragmentShader.glsl");

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

    while(!glfwWindowShouldClose(window))
    {
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        glUseProgram(programID);

        glEnableVertexAttribArray(0);
        glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);
        glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);

        glDrawArrays(GL_TRIANGLES, 0, 3);

        glDisableVertexAttribArray(0);

        glfwSwapBuffers(window);
        glfwPollEvents();
    }

    glDeleteBuffers(1, &vertexBuffer);
    glDeleteProgram(programID);

    glfwDestroyWindow(window);

    glfwTerminate();
    exit(EXIT_SUCCESS);
}

I know it is not my shaders, they are super simple and I've checked them against GLFW 2.7 so I know that they work. I'm assuming that I've missed something crucial to using the OpenGL context with GLFW3, so any help locating the problem would be greatly appreciated.

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:
How to finish a sprite animation before going back to default animation? I want to run a animation until it has gone through all the frames, even when the activation key is no longer held. After the animation is completely finished, it goes back to walking state. I also want to force the animation to finish first before the player can trigger the new animation.

     if (mCurrentState == State.Walking)
        {
            action = "stand";
            Update_Stand(gameTime);

            if (aCurrentKeyboardState.IsKeyDown(Keys.Left) == true)
            {
                action = "run";
                feetPosition.X += MOVE_LEFT;
                effect = SpriteEffects.None;

                Update_Run(gameTime);

            }
            else if (aCurrentKeyboardState.IsKeyDown(Keys.Right) == true)
            {
                action = "run";
                feetPosition.X += MOVE_RIGHT;
                effect = SpriteEffects.FlipHorizontally;

                Update_Run(gameTime);
            }

            if (aCurrentKeyboardState.IsKeyDown(Keys.Z) == true)
            {
                mCurrentState = State.Hitting;
            }
        }

        if (mCurrentState == State.Hitting)
        {
            action = "hit";

            Update_Hit(gameTime);

            mCurrentState = State.Walking;
        }

My Update_Hit(GameTime gameTime) method is something like that.

// Amount of time between frames
TimeSpan frameInterval_Hit;
// Time passed since last frame
TimeSpan nextFrame_Hit;

 public void Update_Hit(GameTime gameTime)
    {
        // Check if it is a time to progress to the next frame
        if (nextFrame_Hit >= frameInterval_Hit)
        {
            // Progress to the next frame in the row
            currentFrame_Hit.X++;

            // If reached end of the row advance to the next row, reset to the first frame
            if (currentFrame_Hit.X >= sheetSize_Hit.X)
            {
                currentFrame_Hit.X = 0;
                currentFrame_Hit.Y++;
            }

            // If reached last row in the frame sheet, jump to the first row again
            if (currentFrame_Hit.Y >= sheetSize_Hit.Y)
                currentFrame_Hit.Y = 0;

            // Reset time interval for next frame
            nextFrame_Hit = TimeSpan.Zero;
        }
        else
        {
            // Wait for the next frame
            nextFrame_Hit += gameTime.ElapsedGameTime;
        }
    }

sentences:
using heightmap to simulate 3d in an isometric 2d game I saw a video of an 2.5d engine that used heightmaps to do zbuffering.
Is this hard to do? I have more or less no idea of Opengl(lwjgl) and that stuff.

I could imagine, that you compare each pixel and its depthmap to the depthmap of the already drawn background to determine if it gets drawn or not.

Are there any tutorials on how to do this, is this a common problem? It would already be awesome if somebody knows the names of the Opengl commands so that i can go through some general tutorials on that. greets!

Great 2.5d engine with the needed effect, pls go to the last 30 seconds

Edit, just realised, that my question wasn't quite clear expressed: How can i tell Opengl to compare the existing depthbuffer with an grayscale texure, to determine if a pixel should get drawn or not?

sentences:
Is this possible to edit the Unity app through inspector while running on Android device? When on PC, I can run the app and edit things temporarily through the inspector.

I know that I can attach the Android ADB and the profiler, but is there any option to edit objects through the inspector while running on the emulator/physical device?

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 you make a Pong slider using touch events for mobiles? I am stuck with an issue of moving the slider on android mobiles with finger touch event while developing pong game in unity 3D, though its working fine for pc.

This game is developed in 2D environment... please help me if anyone have available solution to this issue

Actually I have developed this game for pc so I have code for the movement of slider accordingly as below:

var keyup:KeyCode;
var keydown:KeyCode;
var speed:float=1;

function Update () {
    if(Input.GetKey(keyup))
        rigidbody2D.velocity.y=speed;
    else if(Input.GetKey(keydown))
        rigidbody2D.velocity.y=speed*-1;
    else
        rigidbody2D.velocity.y=0;
}

But now i want to use this game for android mobiles.

sentences:
Particle friction with variable timestep in XNA Alright, so I'm working on an engine of sorts in XNA (yes, it's deprecated, I know) and I'm implementing my own particle system. I've defined a "ParticleEffect" such that when it's supplied a GameTime and an IEnumerable<T:IParticle>, it applies an "effect" to every particle in that collection.

For example, my Friction effect:

public sealed class Particle2D_Friction : ParticleEffectBase<Particle2D>
{
    public float Magnitude { get; set; }
    public float StopThreshold { get; set; }

    public override void Apply(GameTime time, IEnumerable<Particle2D> particles)
    {
        if (Enabled)
        {
            if (particles != null)
            {
                float delta = time.GetDelta();
                float magnitude = MathHelper.Clamp(Magnitude, 0.00f, 1.00f);
                Vector2 result = Vector2.Zero;

                foreach (var particle in particles)
                    if (particle != null && particle.Alive)
                    {
                        result = particle.Velocity - (delta * (1.00f - magnitude) * particle.Velocity);
                        if (Math.Abs(result.X) <= StopThreshold) result.X = 0.00f;
                        if (Math.Abs(result.Y) <= StopThreshold) result.Y = 0.00f;
                        particle.Velocity = result;
                    }
            }
        }
    }
}

Unfortunately, it isn't behaving quite as well as I'd like it to, and I know the issue is linked to the delta time. I should mention that time.GetDelta() is an extension method that returns (float)time.ElapsedGameTime.TotalSeconds; as a shortcut.

Anyways, when I remove the delta, the effect is a rather strong, but it comes to an immediate stop when Magnitude is equal to 0.00f (retains 0% of velocity), while it moves indefinitely when equal to 1.00f (retains 100% of velocity). That's fine and that's how it should work.

When I add the delta to smooth it out, I encounter a problem. When Magnitude is equal to 1.00f, it retains 100% velocity as it should. However, when Magnitude is equal to 0.00f, it retains 1/60th of it's velocity instead of stopping. Of course, 1/60 is equal to 0.01666, which is the frames per second on the delta. But it's wrong.

I'm not sure how to fix this behavior. Any suggestions?

sentences:
Unity 5: Check if an object's collider contains the mouse click point I am building a 2D turn-based RPG battle scene with Unity 5. The enemies are represented as 2D sprites with box colliders. In my script, the relevant enemy class is defined as:

public class EnemyView : MonoBehaviour {

    public SpriteRenderer _renderer;
    public BoxCollider2D _collider;

    void Awake() {
        _renderer = gameObject.GetComponent<SpriteRenderer>();
        _collider = gameObject.GetComponent<BoxCollider2D> ();
    }
}

And I have the following code grouping the enemy sprites together:

public class MainGUIView : MonoBehaviour {
    public EnemyView[] _enemyViews;
}

When a player clicks on an enemy, I would like to know the index of that enemy within the _enemyViews array. I thought of implementing this within EnemyView class but that class has no information about its index, so I am thinking of implementing OnMouseDown() within MainGUIView where I could iterate through _enemyViews to find the one whose collider contains the mouse click point, but I don't know how to write the code. Anyone can point me to some useful code snippet?

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:
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:
C++ exensible resource manager class with dynamic registration of factories I've done some some research on my own, so I hope someone can help me finish it. I'm trying to replicate the design of an extensible asset manager featured in this answer.

At the moment I have created this and have no clue on how to proceed.

class ResourceManager {
    public:
        template<typename T>
        bool addFactory( std::unique_ptr<ResourceFactory<T>> factory ) {
            std::type_index ti = std::type_index(typeid(T));

            auto searchResult = factories.find(ti);
            if(searchResult != factories.end()) {
                return false;
            } else {
                factories[ti] = std::move(factory);
                return true;
            }
        }

        template <typename T>
        ResourceHandle<T> load(const std::string &path) {
            std::type_index ti = std::type_index(typeid(T));
            auto searchResult = factories.find(ti);

            if(searchResult == factories.end()) {
                throw NoValidFactory(std::string("No registered factory of type ") +
                                     ti.name());
            }

            // TODO SOMEHOW DO LOADING
            //return searchResult->second->load(path);
        }
    private:
        std::unordered_map<std::type_index,
                           std::unique_ptr<ResourceFactoryI>> factories;
 };

I assume that TextureHandle featured in the answer is probably a typedef for something like a custom reference counted smart pointer (e.g. ResouceHandle<Texture>, like in my engine) but how do I return something like that? I'm not (YET) good with templates but I know that it's impossible to have a virtual specifier with a template method, so I CAN'T do something like this:

class ResourceFactoryInterface {
    public:
        template <typename T>
        virtual ResourceHandle<T> load(const std::string &path) = 0;
};

template <typename T>
class ResourceFactory : public ResourceFactoryInterface {
    public:
    ResourceHandle<T> load(const std::string &path) {
        // loading
    }
};

// TODO Template specializations for object types? Inherit from ResourceFactory?

What should I do? Am I even close or am I doing a complete nonsense? How should I proceed?

If someone wants to know why I need something like that: at the moment I have one huge, difficult to maintain and extend ResourceManager class with a different method (loadTexture, loadMesh, loadSound, etc.) for each resource type. Having something that can be extended dynamically would make my hobby engine's resource management system more reusable. Moreover, I have a few places where I'd benefit from instantiating separate resource managers with only several registered (level specific) resource types.

sentences:
Main Controller dont destroy on load I would like to have a Main Controller class that should exist in many scenes.
I used DontDestroyOnLoad and in runtime an object associated with this class is present in hierarchy. However, how can I use this script if its only visible in runtime? How can I assign the coresponding game object to button if I cant see It until I run the game?

sentences:
How do I map a 2D grid to my game object coordinates? I'm using Gameplay3d as a game engine to develop a simple board game, PEG Solitaire.

I've come to the part where I've created a 2D grid for all the movable object, empty locations and also where it's not movable. I'm now trying to somehow map that 2D grid to my actual game coordinates, translations of my pieces. Using Gameplay I can select my objects. What I'm trying to figure out is how to solve this actual problem to map my grid to the actual movement of the game pieces?

I was maybe thinking of using an std::map<char*, int> where "char*" is the NodeID and "int" is the index in the 2D grid list so that I can identify each Node and where they are in my 2D grid.  The problem I'm having now is how can I solve the problem if the user select places on my board that doesn't have moveable piece. Let's say the user clicks on an empty hole on the PEG Solitaire board. How can I map that location to my 2D Grid?

I've created my board model and Sphere using Blender. I can using Gameplay use raypicking and select the differente Sphere Nodes and the whole Board Node. The problem is that I can't pick the individual holes on the Board as Nodes.
I know the center position of each hole on the board. So my solution was to somehow first figure out the Spheres world size maybe translate it to the screen size. When the user then clicks on the screen I can check if the position of x and y is inside the selection area of that hole so to say. I'm probably just wondering away in my own thought. But any detailed help here would be appreciated.

Get object world size and translate to screen size of possible.

The 2D grid looks like this:

0022200
0022200
2222222
2221222
2222222
0022200
0022200

sentences:
Customizing Unity WebGL index.html Hey everyone just some css and styling tips needed! i want to use a game as a 404 page. so i would need on top to be either text or a contact form then some spacing and then the actual game window. iframes dont work that good on mobile devices and by doing a simple div in unity index although on mobile it works rather crude but nice, on desktop the text is going behind the unity game window. any tips please? Note that im adding the style in the index.html and not using the separate css file in the template folder.
So to sum up how can i make another div centered in the page and well responsive for mobile above the game container and add a margin on the bottom of that div!
Thank you!!

sentences:
How do I pause Andengine, but still get input? In my game when I pause the game, I'd like to display three options (Resume, Restart and Menu) so I did this after calling mEngine.stop():

Sprite resume = new Sprite(CAMERA_WIDTH/2, CAMERA_HEIGHT/2, RM.resume, vertex){
            @Override
            public boolean onAreaTouched(TouchEvent event, float pTouchAreaLocalX, float pTouchAreaLocalY) {
                if(event.isActionDown()){
                    this.setScale(1.1f);
                    Log.i("Click","Click");

                }

                return super.onAreaTouched(event, pTouchAreaLocalX, pTouchAreaLocalY);
            }
        };

But the Log "Click" never display. So I tried to do this with the Engine active and the Log displays correctly.

How can I stop my game (Modifier, Physics, Score) without using the mEngine.stop() method ?

sentences:
Is there a command line ATI texture compression tool? Is there a command line tool that can convert PNG and JPG files to ATITC compressed textures?

I have my own export pipeline that converts all textures to PVRTC, ATITC, and DXT, so I have no use for a GUI-based tool like the Compressonator. Also, I'm running on Linux (although Wine might be able to handle simple conversion tools).

sentences:
How 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:
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:
Transparency in GLSurfaceView I'm new in game development. I have a view using GLSurfaceview and call in MainActivity.

I want to make transparent that view. I have tried setZOrderOnTop() method in MainActivity and glClearColor() but both are not working.

public class RubikActivity extends Activity {

        cubeView cv;
        GLSurfaceView gv;

        @SuppressLint("NewApi")
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity);
        cv = (cubeView) findViewById(R.id.cubeView);
        cv.initialize(PreferenceManager.getDefaultSharedPreferences(this));
         cv.requestFocus();
            cv.setFocusableInTouchMode(true);
            cv.setEGLConfigChooser(8, 8, 8, 8, 8,0);
          //  cv.setRenderer( new CubeRenderer(getApplicationContext(), font, mWorld, rCube, mMenu, prefs);

            cv.getHolder().setFormat(PixelFormat.TRANSLUCENT);
        cv.setZOrderOnTop(true);

        }

cubeView.java

public cubeView(Context context, AttributeSet attrs) {
super(context, attrs);
font = new TextureFont(getContext(), R.drawable.roboto_regular, "roboto_regular_dims.txt");
mWorld = new GLWorld();

}

public void initialize(SharedPreferences prefs) {
rCube = new Rubec(mWorld, prefs.getInt("dim", 3));
mMenu = new CubeMenu(rCube, font);
_renderer = new CubeRenderer(getContext(), font, mWorld, rCube, mMenu, prefs);
rCube.setRenderer(_renderer);
mWorld.setRubeCube(rCube);
setRenderer(_renderer);

getHolder().setFormat(PixelFormat.TRANSLUCENT);
setZOrderOnTop(true);
}

cubeRenderer.java

@Override
public void onDrawFrame(GL10 g) {
GL11 gl = (GL11)g;

surfaceSetup(gl);

gl.glClearColor(1.0f, 1.0f, 1.0f,0);
gl.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
gl.glDisable(GL11.GL_DEPTH_TEST);
gl.glMatrixMode(GL11.GL_MODELVIEW);
gl.glShadeModel(GL11.GL_SMOOTH);
    gl.glLoadIdentity();

GLU.gluLookAt(gl, 0f, 0f, 7f,
          0f, 0f, 0f,
          0f, 1f, 0f);
gl.glGetFloatv(GL11.GL_MODELVIEW_MATRIX, modelViewMatrix, 0);
if(!worldBoundsSet) {
    getWorldBounds();
}
gl.glColor4f(0.5f, 0.5f, 0.5f, 1);
gl.glEnable(GL11.GL_DEPTH_TEST);
gl.glEnableClientState(GL11.GL_COLOR_ARRAY);
    gl.glEnableClientState(GL11.GL_VERTEX_ARRAY);
gl.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
menu.draw(gl);
mWorld.draw(gl);
gl.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
/*gl.glDisableClientState(GL11.GL_COLOR_ARRAY);*/
gl.glDisableClientState(GL11.GL_VERTEX_ARRAY);

//gl.glFlush();
}

I want the white color to show as transparent background in my layout.
I am already use glClearColor(0,0,0,0) which shows as a black color
and already use in xml file:

 <com.rtpl.rubikgame.cubeView
  android:id="@+id/cubeView1"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:layout_weight="1"
  android:background="#000000"
  android:windowIsTranslucent="true"/>
</LinearLayout>

but nothing happened; when we use glClearColor(0,0,0,0) it shows this:

sentences:
Perspective Projection Far Plane Not Clipping? I've just discovered that far away objects in my world don't seem to clip like they should with a perspective projection matrix.

When I fly far away from my main landscape, so that I am much more than 10 units (if not hundreds) away, it won't disappear. This is weird, because I thought objects should clip/disappear once they hit the far plane.

Here's a photo that demonstrates the issue:

I have defined the projection with my own custom function. The field of view is 60 degrees and the aspect ratio is 1.3333 (although those shouldn't matter), the near plane is 0.1 and the far plane is 10. I have experimented with adjusting the far plane and even when it is 0.2 nothing is ever clipped. When it is 0.1 or below I get a blank screen. (which makes sense)

The matrix is calculated like so:

    projectionMatrix.setIdentity();

    float yScale = MathHelper.coTangent((float) Math.toRadians(fieldOfView / 2f));
    float xScale = yScale / aspectRatio;
    float frustumLength = farPlane - nearPlane;

    projectionMatrix.m00 = xScale;
    projectionMatrix.m11 = yScale;
    projectionMatrix.m22 = -((farPlane - nearPlane) / frustumLength);
    projectionMatrix.m23 = -1;
    projectionMatrix.m32 = -((2 * nearPlane * farPlane) / frustumLength);
    projectionMatrix.m33 = 0;

This produces a perspective projection like so:

    1.299038 0.0       0.0    0.0
    0.0      1.7320508 0.0    0.0
    0.0      0.0       -1.0   -0.20202021
    0.0      0.0       -1.0   0.0

Thanks very much if you could help with this annoying issue/benefit.

sentences:
What is a "2.5D" environment? I don't understand the meaning of the term "2.5D." I'm specifically confused about the difference between 2.5D and 3D environments, even though I've read different definitions and articles about both. I understand the parts where 2.5D is like 3D but I don't get the parts where 2.5D is different.

So, what does it mean for a game to be 2.5D? For example, is the game shown here 2.5D?

sentences:
Confused About My Code Suggesting The Normal Matrix Is Equivalent To The ModelView Matrix I'm learning environment mapping in OpenGL by following this page.

In his vertex shader, the author calculates the vertex normal in eye space with the following code:

nEye = vec3(viewMatrix * modelMatrix * vec4(vertexNormal, 0.0));

This works, but I've fooled around and made modifications to the shader code, so that it calculates the vertex normal with this code:

nEye = vec3(normalMatrix * vec4(vertexNormal, 0.0));

Where normalMatrix is a uniform 4x4 matrix I calculated outside the shader:

objectNormalMatrix = viewMatrix * modelMatrix;
objectNormalMatrix.invert();
objectNormalMatrix.transpose();

(I read from this question that the above is how you are supposed to calculate the normal matrix).

For either method of calculating the vertex normal I use, I get the same (working) graphical result, and this is what is confusing me.

My question is, why is(viewMatrix * modelMatrix) apparently equivalent normalMatrix? In calculating the normal matrix, I invert and transpose, but I do none of that when just multiplying by (viewMatrix * modelMatrix).

Here is some extra info that might be relevant:

The matrix library I use in my application is column major order (same as OpenGL).
When I pass my matrices to GLSL with glUniformMatrix, I have transpose as false.
The view matrix and model matrix in GLSL are uniforms from the application, and they are the exact same view matrix and model matrix matrices I use in my calculation of the normal matrix.

sentences:
What is the design rationale for having armor and magic penetration mechanics? It seems to me that the penetration stat found in many games adds needless complexity and often is not easily understood.

It is obvious to a player that if they are taking a lot of damage, then they need to get armor.

An opposing player then has to decide whether or not to get an item to do more damage or an item to do armor penetration.

The answer is often not obvious.  The player could look up definitions and statistics on the web and not get a clear answer.  They can scour forums and find several different explanations both for and against one or the other.

To me this seems needlessly complex. If more damage can't scale with more armor, then shouldn't damage be buffed or armor be nerfed? Am I missing something obvious?

sentences:
DX11: Drawing with index buffer not working? For our student project I've been tinkering with an OBJ-loader in order to import models into our application.
It loads without issues, and drawing it kind of works without index (the model is obviously not represented correctly because I'm not using an index buffer)
However, drawing with DeviceContext->DrawIndexed shows nothing on screen.

Without indexed drawing

With indexed drawing

Buffer creation method:

void ObjectLoader::CreateBuffers()
{
    //Index buffer
    D3D11_BUFFER_DESC iBufferDesc;
    memset(&iBufferDesc, 0, sizeof(iBufferDesc));
    iBufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
    iBufferDesc.Usage = D3D11_USAGE_DEFAULT;
    iBufferDesc.ByteWidth = sizeof(DWORD);

    D3D11_SUBRESOURCE_DATA indexData;
    indexData.pSysMem = &ind;
    pDevice->CreateBuffer(&iBufferDesc, &indexData, &pIndexBuffer);

    //Vertex buffer
    D3D11_BUFFER_DESC bufferDesc;
    memset(&bufferDesc, 0, sizeof(bufferDesc));
    bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
    bufferDesc.Usage = D3D11_USAGE_DEFAULT;
    bufferDesc.ByteWidth = sizeof(TriangleVertex) * this->NumberOfVerts();

    D3D11_SUBRESOURCE_DATA data;
    data.pSysMem = tva;
    pDevice->CreateBuffer(&bufferDesc, &data, &pVertexBuffer);
}

Draw method:

void ObjectLoader::Draw()
{
    if (pDevice == nullptr)
        return;

    UINT32 vertexSize = sizeof(float) * 5;
    UINT32 offset = 0;

    pDeviceContext->IASetVertexBuffers(0, 1, &pVertexBuffer, &vertexSize, &offset);
    pDeviceContext->IASetIndexBuffer(this->pIndexBuffer, DXGI_FORMAT_R32_UINT, 0);
    pDeviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);

    pDeviceContext->DrawIndexed(vIndex.size(),0 , 0);

    //pDeviceContext->Draw(this->NumberOfVerts(), 0);

}

Index data is initially stored in an unsigned integer array before being passed to D3DD11_SUBRESOURCE_DATA

//index array
UINT* ind;

What the hell am I missing? I've looked at several books on indexed drawing and it seems pretty straight-forward. At first I thought the winding order was reversed but I checked this by simply reversing the index array; same result.

If you need more code let me know, but I feel this should suffice.

Thanks in advance!

sentences:
Subtract waves from tilemap I'm wondering how I could create a shader that would turn a randomly generated shape like this:

And turn it into something more like this:

Essentially just creating a top down view of ocean waves that would flow in and out. I would prefer to be able to subtract this shape from a tilemap.

Any resources or pseudo code on how I could get started with this would be great.

sentences:
Is it possible to detect a collision between a sprite and a UI image in Unity? I have a stationary sprite with the tag "Player" with a Rigidbody2D (dynamic body type and discrete collision detection) and circle collider 2D.

I also have a moving UI image; also with a Rigidbody2D (dynamic body type and discrete collision detection) and circle collider 2D.

I want to detect when the moving UI Image collides with the sprite, however I'm not getting the print statement inside of the OnCollisionEnter2D() function below whenever I see them collide on the screen.

public class MeteorController : MonoBehaviour
{
    float xCoor;
    float yCoor;

    float newXCoor;
    float newYCoor;
    Vector3 newPos;

    float speed = 1.25f;

    // Start is called before the first frame update
    void Start()
    {
        xCoor = transform.localPosition.x;
        yCoor = transform.localPosition.y;

        newXCoor = xCoor * -1;
        newYCoor = yCoor * -1;
        newPos = new Vector3(newXCoor, newYCoor, 0);
    }

    // Update is called once per frame
    void Update()
    {
        transform.Translate(newPos * Time.deltaTime * speed);
    }

    void OnCollisionEnter2D(Collision2D coll)
    {
        if (coll.gameObject.tag == "Player")
        {
            SceneManager.LoadScene("PlanetSpawningTest");
            print("PLAYER");
        }
        else if (coll.gameObject.tag == "Planet")
        {
            print("PLANET");
        }
    }
}

sentences: How can I use touch input for 3rd-person controls? I have a 3rd-person controller in my Unity scene, which I can only control with the WASD buttons. But since I plan to make a smartphone game, I wonder how I can change these controls t swipe up/down/right/left and (if possible) keep WASD for debugging.

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:
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: How does one load TMX files into a SFML game? How does one load .tmx files from Tiled into a SFML game?

sentences:
DirectX 9.0c and C++ GUI Well, I'm trying to code a gui for my engine, but I've got some problems.
I know how to make a UI overlay but buttons are still black magic for me. Anything I tried was to compilcated ( if it goes big ). To Example I tried to look if the mouse position is the same as the Pixel that is showing the button. But If I use some bigger areas it's getting to complicated. Now I'm searching for a Tutorial how to implement your own gui.
I'm really confused about it.
Well I hope you have/ know some good tutorials.

By the way, I took a look at the DXUTSample, but it's to big to get overview.

sentences:
Game development for high-school with C++ and OpenGL I've been teaching high-school students (12th grade) game programming in the last 2 years. The way I did this till now, was first to give them "half made" classes (for Point, Polygon, etc.) and they've completed them with my help/their friends/themselves, and then they were free to design their models, and write their game logic.

The programming language was C++ and I used GLUT. I gave the students the base class that does all inits for OpenGL so they didn't work on it (except some high-motivated students that wanted to extend their graphics).

My goal was to teach them the fundamentals of C++ using OOP, by implementing their own classes rather than teaching them methods from OpenGL/GLUT API. It's also important to notice that most of those students never programmed in their life and all they knowledge comes from theory in high-school computer science.

I write this post here to get your opinions about the way I handled this class until now, do you think I've done wrong not teaching the OpenGL/GLUT API? do you think I need to utilize OpenGL power to implement basic models, or it's good practice to let them implement models by themselves? Maybe I don't need to use GLUT anymore because there are modern libraries these days that does better work, or it doesn't matter as long as it's for learning purposes?

I really want to give the students motivation by demonstrating what they can do in modern game programming, but I still got my limits which I wrote here, and also time limit (the class is one year, one lesson each week).

Thanks for your help!

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:
Smooth Camera Follow I am using a fixed static background. I have a gameobject(Current ref. image) which is moving with the help of waypoints. I have made camera to follow the Current. The camera is stuttering while moving. Can anyone help me to solve the camera stuttering and make it follow the Current smoothly?

This is my code attached to camera following the star

public class CameraController : MonoBehaviour {

    void Start () {
        GameObject.FindGameObjectWithTag("OptionCamera").GetComponent<Camera>().orthographicSize =
        (20.0f / Screen.width * Screen.height / 2.0f);
    }

    void LateUpdate() {
        if (GameObject.FindGameObjectWithTag ("Current") != null) {
            if (GameObject.FindGameObjectWithTag ("Current").GetComponent<CurrentController>().Greenblast == false &&
                GameObject.FindGameObjectWithTag ("Current").GetComponent<CurrentController>().Redblast == false)
            {
                Vector3 pos = GameObject.FindGameObjectWithTag ("Current").transform.position;
                transform.position = new Vector3 (transform.position.x, pos.y, transform.position.z);
            }
        }
    }
}

sentences:
How can I generate a wall/s? I want to create for example 4 cubes and then to connect them all making a square but making them scaling to one direction and not two directions as by default.
The prefab variable is a Cube.
I have this old script I did long time ago. The script is working but not what I wanted.
This script create like a cube from all the walls.
How can I add some flag bool to decide if to create a kind of cube like it is now or to create a square empty square not to fill it. I mean if I want to make it like hollow.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GenerateWall : MonoBehaviour
{
    public GameObject prefab;
    public Vector3 wallsStartPosition;
    public float width = 0;
    public float height = 1;
    public float lengthX = 2;
    public float lengthZ = 2;
    public float time = 1;

    private List<GameObject> walls = new List<GameObject>();
    private IEnumerator coroutine;

    void Start()
    {
        for (int i = -2; i < 2; i++)
        {
            GameObject go = Instantiate(prefab);
            go.transform.parent = transform;
            go.tag = "Wall";
            Vector3 scale = Vector3.one;
            Vector3 adjustedPosition = wallsStartPosition;

            float sign = Mathf.Sign(i);
            if ((i * sign) % 2 == 0)
            {
                adjustedPosition.x += (lengthX * sign) / 2;
                scale.x = width;
                scale.y = height;
                scale.z *= lengthZ + width;
            }
            else
            {
                adjustedPosition.z += (lengthZ * sign) / 2;
                scale.x *= lengthX + width;
                scale.y = height;
                scale.z = width;
            }
            adjustedPosition.y -= height / 2;
            go.transform.localScale = scale;
            go.transform.localPosition = adjustedPosition;
            walls.Add(go);
        }
        coroutine = raiseWall(walls[0], height, time, 0, 100);
        StartCoroutine(coroutine);
        coroutine = raiseWall(walls[2], height, time, 0, 100);
        StartCoroutine(coroutine);
        coroutine = raiseWall(walls[1], height, time, 0, 100);
        StartCoroutine(coroutine);
        coroutine = raiseWall(walls[3], height, time, 0, 100);
        StartCoroutine(coroutine);
    }

    IEnumerator raiseWall(GameObject wall, float amount, float time, float delay, float steps)
    {
        Vector3 position = wall.transform.localPosition;
        float finalHeight = position.y + amount;

        yield return new WaitForSeconds(delay);

        while (position.y < finalHeight)
        {
            float remainingHeight = finalHeight - position.y;
            position.y += Mathf.Min(remainingHeight, amount / steps);
            wall.transform.localPosition = position;
            yield return new WaitForSeconds(time / steps);
        }
        yield break;
    }
}

The result is :

but if I want it to be like this ?

sentences: RTS Pathfinding without collision between units Options Ever since I made my units move to a certain location a problem has popped up that of course if I try to make two or more units go to the same place they fight for the same spot. Am I just being stupid and unity already has a way around this or do I need to do something specific? I have looked into flow field path finding but no way on how to implement it. I dont want to have to use a ready made script but some pointers and other options are more than welcome.

sentences:
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:
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:
How can procedural generation be used to support exploration mechanics? It would seem that procedural generation would be a great tool for open adventure games, since it would provide an almost limitless world. However, I notice most successful procedural generation games are of a totally different genre. The only game I can think of that uses procedural generation for exploration specifically is No Man's Sky, but it failed to meet expectations, probably in part because the procedural content, while vast, did not necessarily add as much value to the exploration game mechanics as people thought it would.

From attempts making procedural generation games and from what I see in other games, I see three problems hindering procedural generation in adventure games, and I cannot see any solutions:

Procedural terrain may be straightforward, but procedural storytelling is not. I tried both. A few simple rules can make something that resembles a mountain or a city, but it is hard to make a game around it unless you have some sort of quest. It is hard to design a quest, though, unless you have a map to work with. How can you make a quest to find a place that might not exist?
Procedural terrain provides scale without density. Sure, a procedural mountain might have all the textures and ridges to give it the complexity of a real mountain, but where's the fun it that unless there are lots of things to do on that mountain? Much of the strength of procedural generation is that it is easy to make something massive. If you make a world too massive without putting enough new things to experience in that world, it will just feel empty.
The experience is not consistent. Much of the enjoyment from adventure games is reaching "that one part." Walkthroughs, tutorials, and wikis usually rely on the fact that players are all playing the same game, taking place in the same world. It is more difficult sharing your excitement for a game with others if the experience is so personalized. Imagine sharing a meme about the game if no other player in the world played a game with the same locations, characters, or creatures.

Keeping these problems, and perhaps others you can think of in mind, is there still a way to incorporate procedural generation into a game without ruining exploration? Maybe some certain limited procedural techniques that an adventure game could benefit from but not get in the way of a story?

sentences:
Unity2D - move rigidbody object with collision How do I move and collide my object (position given by touch or click), by Using rigidBody2D.MovePosition i can only teleport my character, and by using velocity, my character keeps moving, I want him to stop at the position given

Ilustrations:

sentences:
How to fix bad Collada produced by FBX? I tried to use the FBX SDK (2011.3.1) to load FBX files and save them as Collada files in order to be able to import FBX files in Panda3D.
Unfortunately the resulting Collada files are not usable for several reasons, among them:

There's a Maya specific extra technique

diffuse

<diffuse>
    <texture texture="Map__2-image" texcoord="CHANNEL0">
        <extra>
            <technique profile="MAYA">
                <wrapU sid="wrapU0">TRUE</wrapU>
                <wrapV sid="wrapV0">TRUE</wrapV>
                <blend_mode>ADD</blend_mode>
            </technique>
        </extra>
    </texture>
</diffuse>

It assigns a texcoord channel name that isn't referenced anywhere else in the file (in the previous code sample, no geometry uses "CHANNEL0"...)
Every polygon is exported twice, a first time with a basic material (only diffuse color, specular color, etc.) and a second time with a textured material --> this doubles the number of polygons of each model without any valuable reason

Anyway, the resulting Collada file cannot be opened correctly either with OpenCOLLADA or Panda3D's "dae2egg".

Anyone has any experience on how to "fix" it and make it understandable by common and well-reputed Collada importers such as OpenCOLLADA?

sentences:
Explicit resource loading in Ogre (Mogre) I am just starting to learn Mogre and what I would like to do is to be able to load resources 'explicitly' (i.e. I just provide an absolute path instead of using a resource group tied to a directory).

This is very different to manually loading resources, which I believe in Ogre has a very specific meaning, to build up the object using Ogres methods. I want to use Ogres resource management system/resource loading code, but to have finer control over which files are loaded and in what groups they are.

I remember reading how to do this but cannot find the page again; I think its possible to do something like:

Declare a resource group
Declare the resource(s) (this is when the actual resource file name is provided)
Initialise the resource group to actually load the resource(s)

Is this the correct procedure? If so, is there any example code showing how to do this?

sentences:
How to flip 2d skinned quadruped character? just would like to know is flipping 2d skinned character with one of scale axis good way for left or right movement(flipping direction and animation)?
Normal direction would change.(UPDATED)
for example i have a 2d skinned dog, and i wanna dog move left when i press left with same animation as right direction.
or is there any better way?
Thanks.

sentences: 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:
Unity animation won't play on trigger. What do I do to fix it? Ok so I added a play animation line to my trigger script. I made an animation, added it to the trigger object, attached the animation to the trigger, and tested. The target goes to the trigger as it should, deletes the trigger, but the animation never plays. So I check the console, and it's telling me "The AnimationClip 'MazeDoorClose' used by the Animation component 'SuckInTarget' must be marked as Legacy." so I do that, but now the trigger activates before the target gets there, and there is still no animation playing!

I know this sounds confusing so in an attempt to make it easier to understand I made a short video . Sorry for the crappy quality, but hey it's free.
Here is the code:

using UnityEngine;
using System.Collections;

public class SuckIn : MonoBehaviour
{

    public Transform target;
    public float speed;
    public string ObjectWithTagToBeDestroyed;
    public string ThingToAnimate;

    void Update()
    {
        float step = speed * Time.deltaTime;
        target.position = Vector3.MoveTowards(target.position, transform.position, step);
    }

    void OnTriggerEnter(Collider coll)
    {
        if (coll.gameObject.tag == "Ball")
        {
            Destroy(GameObject.FindWithTag(ObjectWithTagToBeDestroyed));
            GetComponent<Animation>().Play(ThingToAnimate);
        }
    }

}

Before you ask yes the animation is on the object as it should be, and as Unity told me to do I marked it as a legacy animation. Any ideas what  am doing wrong?

sentences:
Movement in grid in Unity I am a beginner at Unity. I want to make a game like Lightbot, but in 2d (without the z axis movement) with some obstacles. Before making the function system of the Lightbot, I want to make the in-game character move on a grid by the set of key inputs (e.g. WASD) by the player. But I'm stuck here. I searched on Tilemap which makes a grid, but I have no idea how to save the set of input keydowns and move my character on this grid at once. Suppose my character is on the (0, 0) square for example. After the player taps WWDD, then my character should move to the following squares, in the following order:

(0, 1)
(0, 2)
(1, 2)
(2, 2)

How can I achieve my goal?

sentences:
How to modify the Unity sprite renderer (or create a custom one) that can display the sprites on the X-Z plane? Prefix: I am NOT trying to rotate a sprite 90 degrees by it's transform, this changes what is up/down and forward/backwards for the object. I need the sprite displayed on the X-Z plane in comparison to the default X-Y plane in it's natural state in the game world with rotation transforms of 0.

I'm trying to use 2D sprites on the X-Z plane, how do I go about either modifying the built in sprite renderer to do this, or creating my own custom sprite renderer component?

sentences:
Rendering Many Objects in OpenGL4 Sorry for asking such a basic question. I am reading books on OpenGL4 but in most examples they generally render only objects. So I understand how to deal with vertex buffers and vertex array buffers, etc. but my question is does it work when you have say hundred of objects to draw?

Should you have 1 vbo for example and replace the data in the buffer each time you need to draw a new object?

Should you have hundreds of vbos? By my understanding was that you were limited in the number of buffers you could create (using getBuffer()).

How would one typically do this?

Thank you.

sentences:
Why is it called "roguelike" and "metroidvania"? As the title says, where did roguelike and metroidvania genre games get their names from? All other genres (that I can think of) have pretty self-explanatory names like:

First Person Shooter: You shoot and it's first-person perspective.
Role-Playing Game: You role-play as another character.
Massive Multiplayer Online: The game is online with multiplayer and supports a lot of players.

But roguelike and metrodvania doesn't seem to relate to any core gameplay element like the other genres do. So why are they called roguelike and metroidvania?

sentences: 3D Game Engine comparable to UDK that's not GPL'd Are there any good, free 3D game engines similar to UDK that are under open-source licenses without copyleft provisions?

sentences:
How to import character from Blender to Unity? I am trying to import a character into Unity from Blender. I exported the model (which has actions/animations) from Blender as a FBX file and dropped in into my Unity project’s Assets folder. The model with all of its components (mesh, armature, animations) appears in the project window; however, Unity doesn’t immediate associate the animations with the model when I drag an instance of the model into my scene.

I have also imported a Blender default model (“Constructor” - a man with red overalls and a wrench), and have been comparing the settings of my model to the Blender model in order to find discrepancies.

3 observations I have made:

Blender’s model is automatically assigned an “Animation” window in the Inspector panel (image #1), while mine is assigned an “Animator” window (image #2). Since the former window is the one where the animations are listed and you assign the default animation, it seems like this one is crucial. How do I import my model such that the “Animation” window appears in its Inspector window? (I’ve tried adding an “Animation” window myself, but it doesn’t recognize the model’s animations as the Blender model’s “Animation” window does.

In Unity, my model’s animations all begin at -1.0 (even though they begin at keyframe 0 in Blender) (image #3). For each animation, I get the message, “The clip range is outside the range of the source take.” I get this message even when I move the animation forward several keyframes in Blender and re-export the file to Unity as a FBX.
I compiled several of my actions into an animation that I then exported as a .mov file, and this is the sequence of actions that begins when I press “Play” in Unity. When I deleted this animation from Blender (as I thought this was the issue), my model now does nothing when I press “Play.”

I am using:

Blender 2.67 and Unity 4.1.5f1

My actual question: How do I import my character into Unity such that it is automatically assigned an “Animation” window?

I have been struggling with this issue for several hours now, and none of the online tutorials or forums seem to address it.

sentences:
How do I center the view around specific coordinates in SFML I want to use sf::View in SFML in order to change the position of the view, such that the player sprite is always in the center of the screen. Thus I want to write a function which allows me to input a set of coordinates and thus center the screen around those coordinates. In addition I want to be able to set a limit to this, such that when the player reaches the side of the map, that axis of the camera stops following the player, as it has reached a "limit". How do I achieve this?

Thank you in advance.

sentences:
Error When Loading a .tmx TILED map through the TiledMap class So I made a map using the TILED application and I have it as a .tmx for reasons, but whenever I use the TildMap class in the Slick2D library to render the map on the screen, it gives me an error. Here are the files:

Class file:

public TiledMap testMap = null;

//TILE-READER
public static TileReader tileReader;

public Game (int stateID) {}

@Override
public int getID() {
    return Main.game; //GAMESTATE = 1
}

@Override
public void init(GameContainer gameContainer, StateBasedGame stateBasedGame) throws SlickException {
    worldMap = new Image ("res/in_game_map.png");
    player = new Player(playerX, playerY, mapX, mapY);
    tileReader = new TileReader();
    player.init(gameContainer, stateBasedGame);
    tileReader.init(gameContainer, stateBasedGame);

    testMap = new TiledMap("res/worldMap.tmx");
}

@Override
public void update(GameContainer gameContainer, StateBasedGame stateBasedGame, int delta) throws SlickException {
    player.update(gameContainer, stateBasedGame, delta);
    tileReader.update(gameContainer, stateBasedGame, delta);
}

@Override
public void render(GameContainer gameContainer, StateBasedGame stateBasedGame, Graphics graphics) throws SlickException {
    graphics.scale(1.05f, 1.05f);

    graphics.translate(player.camera.getCamX(), player.camera.getCamY());
    gameMap.draw(mapX - mapLength, mapY - mapWidth);
    testMap.render(0, 0);
    tileReader.render(gameContainer, stateBasedGame, graphics);
    player.render(gameContainer, stateBasedGame, graphics);
    graphics.translate(-player.camera.getCamX(), -player.camera.getCamY());

    if (inputHandler.keyMAP) {
        worldMap.draw(0, 0);
    }

    graphics.drawString("Player X: " + player.getxPos(), 400, 400);
    graphics.drawString("Player Y: " + player.getyPos(), 400, 415);
}

And here is the error message that it provided me:

  Caused by: org.newdawn.slick.SlickException: Unsupport tiled map type: base64,zlib (only gzip base64 supported)

Is there an issue with the way I formatted the .tmx file or is it that I am using the latest version of Tiled and that slick2D is no longer compatible with the newer version?

sentences:
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:
LibGDX collision detection on moving and rotating object (rectangle enemy) i am trying to get collision dectection working properly but when i do it, the collision area keeps moving. no matter what i tried.
there are 2 objects and the objects are moving and i cannot get the area of the collision to follow the enemy/object.

i am using the method below to see if the collision will work and it does not follow the enemy properly.

enemy class extends sprite {

the above is an example of how i am using the sprite extension.

the object/enemy is a sprite from libgdx the class is extended by sprite.

shapeRenderer.begin(ShapeType.Filled);
shapeRenderer.setColor(Color.RED);

shapeRenderer.rect(rect1.getX() + (rect1.getWidth() / 2), rect1.getY()  + (rect1.getHeight() / 2) - 2, rect1.getOriginX() - 1, rect1.getOriginY() - 4, 1.0f, 1.0f, rect1.getRotation());

shapeRenderer.rect(rect2.getX() - 10, rect2.getY() - 10, rect2.getWidth() - 10, rect2.getHeight() - 10, rect2.getOriginX(), rect2.getOriginY(), rect2.getRotation());

shapeRenderer.end();

this is in the enemy class collision check

rect.set(getX() + (getWidth() / 2), getY()  + (getHeight() / 2) - 2, getOriginX() - 1, getOriginY() - 4);

this is to see if the enemy is colliding

public boolean collides(Ball ball) {
 if (getX() < ball.getX()) {
 return (Intersector.overlaps(ball.getRect1(), rect));
  }
 return false;

 }

Any help will be really nice.
thank you

sentences: With flash/flex games talking to backend, is it pull only or can the game server push? With flash based games (or flex), is it a pull or request/response system or is it possible for the game server (say java based) to actually push out to its remote flash clients?

sentences:
Objective-C to plain c iPhone game performance improvements I'm testing a 2D OpenGL ES based iPhone game on both the iPhone 3G and the iPhone 4.  It runs great on the iPhone 4... and pretty well on the 3G.  The game state is updated at 60 Hz... and the rendering is done at 60 fps.  Would the following conversion from Objective-C to c improve the performance at all?

// current Objective-C function
- (void) updateSomething {
    // simple update like x_position += 2.0;
}

// plain c function
void updateSomething(){
    // simple update like x_position += 2.0;
}

Assume these functions are called at a rate of 60 Hz.  The reason I'm curious is this blog post.  The author mentions substantial performance improvements when making a similar conversion.

Cheers!

Edit:  after running w/ the CPU Sampler instrument in XCode it looks like about 65% of the function calls are to mach_msg_trap.  objc_msgSend apparently takes up a trivial amount of resources.

sentences:
Character and Weapon animation interaction If I have two models, for example: some character, and a bow, how do I work with them together in 3DS Max to animate them both (for example, when the character shoots an arrow with his bow, the characters pulls his hand out, the bow is scratching etc).

Also, any guidelines on how to port custom weapon models to UDK?

sentences:
How 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: Is it bad practice to set the velocity of an object every loop? Say I have a simple game with a gameLoop function that gets called every 50 milliseconds or something similar, and I have a box2d object. Is it bad practice/too CPU intensive to use SetLinearVelocity on the object every time the gameLoop is called?

sentences:
Using raw vertex information for sprites rather than SpriteBatch in XNA I have been wondering whether using SpriteBatch is the best option. Obviously for prototyping or small games it works well.
However, I've been wanting to apply techniques such as shaders and lighting to my game. I know you can use shaders to some extent with SpriteSortMode.Immediate, but I'm not sure if you lose power using that.

The other major thing is that you cannot store your vertex data in the graphics memory with buffers.

In summary, is there an advantage of using VertexTextureNormal (or whatever they're called) structs for vertex data for 2D sprites, or should I stick with SpriteBatch, provided I wish to use shaders?

sentences: Unity3d - deploy game to android device off site I am using Unity3d to develop my game and my friend with android device wanted to test it. I am natively IOS developer and have no knowledge of deploying Android platform. What do I need other than Unity3d? The scenario here is that I have to send to my friend who is not developer to install and test on his device via internet. We used to have TestFlight App but that is history now.

sentences:
Extract smaller frustum from camera frustum? Background:

I was thinking of implementing multiselection by performing a frustum culling on a sub-part of the screen.

Problem:

Given total screensize, a rectangle on the screen (pos, size), and the original camera frustum (projection, pos, rot), how can I construct a sub frustum corresponding to the given rectangle?

UPDATE:

To be implementation specific, I am using DirectX and in DirecXMath there is a BoundingSphere vs BoundingFrustum intersection currently used in my ordinary frustum culling.
http://msdn.microsoft.com/en-us/library/windows/desktop/hh855914(v=vs.85).aspx

So presumably given a new projection matrix and a new rotation I would be able to construct a new BoundingFrustum to use in my ordinary frustum culling.

sentences:
Texture2DArray in Directx11 with different formats I'm trying to create a texture2DArray from multiple of images, each of which has different formats, and I got the following error from the DirectX11 debug layer.

D3D11 ERROR: ID3D11DeviceContext::CopySubresourceRegion: Cannot invoke CopySubresourceRegion when the Formats of each Resource are not the same or at least castable to each other, unless one format is compressed

I want to ask you there is any way of creating a texture2d array in Directx 11 with different format?

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:
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:
Making neural nets more efficient in Unity Some backstory: currently using a Asus x555la so not the fastest laptop. Computing power is kind of the problem.

Hi there. I am currently doing hand tracking in Unity. I have developed a half-and-half approach to cut down lag and CPU stress (using one half image processing and one half good old fashioned neural nets). I am trying to embed an object detection neural net in Unity, and I have done so using TensorFlowSharp, but I can't figure out how to cut down lag. It's currently managing around 1FPS. How do I speed up neural nets in Unity. It doesn't have to be loads, just around 30FPS.

Has anyone had any experience using neural nets in Unity, and how did you make it work well?

sentences: physics.addBody() with custom shapes in Corona SDK Does the physics.addBody() only work with Circles and Rectangles? Or is it possible to physics.addBody() on vector shapes or sprites or with masks or something?

sentences:
Rotating a circle on its axis I have a circular shape object, which I want to rotate like a fan along it's own axis.
I can change the rotation in any direction i.e. dx, dy, dz using my transformation matrix.
The following it's the code:
 Matrix4f matrix = new Matrix4f();
 matrix.setIdentity();
 Matrix4f.translate(translation, matrix, matrix);
 Matrix4f.rotate((float) Math.toRadians(rx), new Vector3f(1,0,0), matrix, matrix);
 Matrix4f.rotate((float) Math.toRadians(ry), new Vector3f(0,1,0), matrix, matrix);
 Matrix4f.rotate((float) Math.toRadians(rz), new Vector3f(0,0,1), matrix, matrix);
 Matrix4f.scale(new Vector3f(scale,scale,scale), matrix, matrix);

My vertex code:
 vec4 worldPosition = transformationMatrix * vec4(position,1.0);
 vec4 positionRelativeToCam = viewMatrix*worldPosition;
 gl_Position = projectionMatrix *positionRelativeToCam;

But, it's not rotating along its own axis, it is flipping like a coin instead. What am I missing here?

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:
Possible to create transparency shader which doesn't stack alpha values The image above best demonstrates what I'm trying to achieve. It's a transparent shader for objects, but wherever the objects with this shader intersect they don't add together but simply merge with the same amount of transparency.

It seems like a simple thing, but I can't tell if it's even possible from my understanding of how the shader pipeline works. From what I understand of the process (and please correct me if I'm wrong), a fragment is created by each independent object. Once all the fragments for each object are created, the depth buffer chooses which fragment to write to that pixel in the framebuffer at a time, layering them on top of each other, so to speak. Once they've all been added to the framebuffer, the final result becomes the pixel.

If I could access the individual fragments to compare them against each other before they get written ('layered') into the frame buffer, it would be a simple case of tracking them and discarding any extra fragments in the same pixel space that are part of this shader / render queue. But I don't think this is possible with OpenGL?

Is there perhaps another way I can achieve the same effect?

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:
Are shader-based antialiasing methods making traditional multisampling obsolete? See an analysis of FXAA here, and the page for SMAA here

Now these methods have a drawback which is that they are not capable of improving quality in a physically accurate way, like multisampling does (what I mean by this is that it brings out the sub-pixel details from geometry by super-rasterizing), but they are a terrific method for curtailing visual artifacts which are a result of regular rasterization.

Case in point: I run an Nvidia GTX 260, it came moderately overclocked from the factory, it is a Gigabyte Super Overclock model. I also run a 1920x1200 screen.

It's sometimes difficult to maintain good framerates when I play Battlefield 3, but I've noticed some general improvements in terms of speed recently which has made the game play quite a bit better today than it did back when it was released.

The point is, the performance hit caused by 4xMSAA or even 2xMSAA is very noticeable in this game at my full resolution, because it needs all the power it can get. However, FXAA post processing antialiasing comes at almost no cost! A month or two ago, I found myself running the game in windowed mode most of the time because it achieved better framerates that way. But now I've discovered that disabling MSAA and using FXAA almost completely eliminates edge-artifacts without the performance hit of MSAA.

I find that shader-post-process AA is extremely good at producing smooth edges when lines are near-horizontal or near-vertical, and also with thin objects, like the cables on the telephone pole in the link. On still images, a similar smoothness quality is unobtainable until you crank MSAA to 16x.

However shader-post-process AA does not eliminate temporal aliasing artifacts: Even though edges are smoothed terrifically, they "jump" as they move across pixel boundaries.

The reason why this happens is because the shader-AA has no knowledge of actual geometric coverage data, which is what MSAA and friends are essentially based on. As an edge traverses the pixel boundary, our smooth edge will "jump" the length of a pixel, rather than smoothly blending in and out like we would see with 16xMSAA/CSAA. CSAA is particularly good for this because it rasterizes at a higher resolution than MSAA.

So with all this in mind I don't think that shader-based antialiasing methods are a replacement for traditional methods. However I think they are a really cool way to improve image quality in almost every situation. They have the benefit of not requiring a different render buffer storage format.

I think that, going forward, the best way to apply antialiasing in games would be a combination of coverage sampling AA and post-process AA.

Jeff Atwood claims that FXAA made MSAA/CSAA obsolete overnight. What do you think? What are some other ways to compare and contrast traditional antialiasing with shader-based antialiasing?

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:
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:
Animating child objects via parent object animator in script I'm using unity 5

I'm trying to animate multiple child objects via a parent object. The animation worked in the animation view but would not work when I tried to preview the game. In the script I use the code:

ParentObject.GetComponent<Animator>().Play("intro");

to play the animation. A similar line of code worked when playing a singular object, not sure what's going wrong now, any sugestions?

sentences:
Networking a fast-paced game (2D) - Forced Movement - Server / Client I started a new project, a fast-paced online game (some sort of 2D MOBA). I encountered a problem with the part of netcode about client prediction & server reconciliation.
Game Mechanics: 2D - Platformer (MOBA)
Movement: WASD (jump / left / down / right)
Abilites & Autoattack: J/K/L
Architecture: Client/server (authoritative)
My netcode is using these techniques:

Client-side prediction & server reconciliation

Server is sending position & data to the player, the player is replaying the last unprocessed inputs
Client is sending input each frame at a fixed timestep (60 times/sec) which are processed on the server-side

Other entities are interpolated
Bullets/abilities are extrapolated (Dead reckoning)

So far, this is working good on clients. My question is, how to handle some sort of forced movement?
For example, another player stuns or slows down you, on the server, you will be slowed down or stunned, but you will not know it before the packet arrives, since you are predicting the next state, it will teleport you back because your speed was changed to 0 or lower (in case of slow), it will immediately turn you back (teleport).
What is a good way to handle this technique? I was thinking about interpolating between the current position and the position on the server, but it is not working well for me.

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:
Give people your app for free I was wondering how developers can give some people (like family) their paid apps for free?
Or even give paid in app purchases for free. I'm not talking about the promo codes, i believe they only last a few months?
Do they use some kind of custom developed promo code system?

Your insights are much appreciated

sentences:
Minecraft-Style Voxel Sunlight Algorithm I'm implementing a pure Minecraft clone, and I want to implement sunlight.
I have a basic sunlight algorithm working perfectly in 2D, and I understand how to scale it to 3D.  But how do I make it so I don't have to recompute the entire sunlight every time I place a block?

Pseudocode, because the actual algorithm is not written very well :)

FUNC propogateSunlight(x,y,z):
    IF (x,y,z) is out of bounds then RETURN
    IF light_at(x,y,z) is <= 0 then RETURN

    # PROPOGATE
    IF light_can_spread(x,y-1,z) AND light_at(x,y-1,z)<light_at(x,y,z) then:
        set_light_at(x,y-1,z) to light_at(x,y,z)
        propogateSunlight(x,y-1,z)
    IF light_can_spread(x-1,y,z) AND light_at(x-1,y,z)<light_at(x,y,z) then:
        set_light_at(x-1,y,z) to light_at(x,y,z)-1
        propogateSunlight(x-1,y,z)
    *repeat above IF statement for (x-1,y,z), (x+1,y,z), (x,y,z-1), (x,y,z+1) and (x,y+1,z)

Then it sets the top layer to 16 (the max light level) and calls propogateSunlight on the top level.

This algorithm does what I want it to PERFECTLY.  The only downside is that it is really really slow.

So what (psuedocode) algorithm is there to place / remove blocks (without transparency) that make it so I don't have to recalculate the entire world?

P.S. The coordinate system is standard 3d graphics, XZ is ground plane, +Y is up and -Y is down.

sentences:
Enemy evolution in shoot-em-ups Are there any shoot-em-ups in which the enemies actually evolve as a response to their relative success against the player?

By evolve, I mean that each enemy has some genetic information encoding their behaviour. Enemies which last longer or do more damage are allowed to mix their genes to create new enemies. This way the enemies would become better adapted to the particular player.

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 can I use orientation to compute position in Windows Phone 7? I'm using the motion API and I'm trying to figure out a control scheme for the game I'm currently developing.

What I'm trying to achive is for an orienation of the device to correlate directly to a position, such that tilting the phone forward and to the left represents the top left position and back to the right would be the bottom right position.

Here are some photos that should make my intent clearer. The red dot would be the calculated position.

Tilted forward and left, upper left selected.

Tilted back and right, bottom right selected.

I also have to make sure that the algorithm takes into account left landscape and right landscape device orientations (portrait is the default so no calculations would be needed for it).

I've tried using the yaw, pitch, roll and Quaternion readings. Here's a sample of my current attempt:

// Get device facing vector
public static Vector3 GetState()
{
    lock (lockable)
    {
        var down = Vector3.Forward;
        var direction = Vector3.Transform(down, state);

        switch (Orientation)
        {
            case Orientation.LandscapeLeft:
                return Vector3.TransformNormal(direction, Matrix.CreateRotationZ(-rightAngle));
            case Orientation.LandscapeRight:
                return Vector3.TransformNormal(direction, Matrix.CreateRotationZ(rightAngle));
        }

        return direction;
    }
}

sentences: I can't drag'n'drop UI-Elements from the Scene-hierarchy into a public field (Unity 5) I just watched this Video https://unity3d.com/learn/tutorials/projects/survival-shooter/player-health and tried to drag'n'drop the UI-Elements on the matching script, just like they did. But this is not working for me. If I hover the public field Unity shows up an error icon and I can't drop it there. If I set this UI-Element as prefab I can place it there, but it does not update the Element which is in the Scene when the Code is live. The Elements just gets an update after each restart. Can anybody explain to me why I cannot drag'n'drop my Object from the hierarchy to the public field?

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:
When someone joins or leaves a room, send the entire user list or just the delta? I'm developing a game that has a lot of rooms and most rooms will have between 2 and 15 users. On the UI there is a list of all the players currently in the room. I'm wondering, when someone joins a room, should the server send the entire list of players (admittedly not much) to everyone, or just the delta?

Option 1) Send the entire list to the new person joining because he needs all of them and send the one user to the rest of the players because they already know who else is in the room. Possible synchronization issues and harder to code.

Option 2) When someone enters or leaves a room, resend the entire list of players to everyone. No synchronization issues, much easier to code and test, but increased packet sizes.

Which option would you choose or is there a third one? For reference I'm using node.js and socket.io.

sentences:
Display CCSprites with a delay I am a beginner in cocos2d and I wanted to display coin CCSprites as soon as it moves off the screen with a 5 second delay. So this is what I wrote in my main gameplay layer to add 7 coins in a row:

- (void)coinSidewaysRowOne {
        if (coinSide1 == FALSE)
        {
            coinSide1 = TRUE;
            NSLog(@"coinSide1 = TRUE");
            int originalX = 500;
            for(int i = 0; i < 8; i++)
            {
                CCSprite *coinHorizontal = [CCSprite spriteWithFile:@"bubble.png"];
                coinHorizontal.position = ccp(originalX, 150);
                originalX += 20;

                [self addChild:coinHorizontal];
                [coinArray addObject:coinHorizontal];
            }
        }
    }

And then, in my updateRunning method I added this, so when the coins spawn outside the screen, they move to the left and disappear:

// Move coins off the screen and make them move away
    for (CCSprite *coin in coinArray) {
        // apply background scroll speed
        float backgroundScrollSpeedX = [[GameMechanics sharedGameMechanics] backGroundScrollSpeedX];
        float xSpeed = 1.09 * backgroundScrollSpeedX;

        // move the coin until it leaves the left edge of the screen
        if (coin.position.x > (coin.contentSize.width * (-1)))
        {
            coin.position = ccp(coin.position.x - (xSpeed*delta), coin.position.y);
        }
    }

Update:
What I've tried doing is adding this below the if statement above:

else {
        coin.visible = TRUE;
        coin.position = ccp(500, 150);
     }

So right now, when I run this, the coins move in from the right and move off the screen from the left.
How do I make it so that when the coins move to the left and go off the screen, have a five second delay and then have new coins come back to the screen from the right like it originally did.

sentences:
Why aren't my isometric objects where I think they are? Background
I am creating an isometric RPG using Tiled and Monogame. My goal is to have relatively elaborate terrain and movement, with my vision for the overworld being much like the now-venerable Megaman Battle Network franchise. As such, by world must be 3D and simply drawn on top of an isometric map assembled from tiles.
Quirks
The Monogame.Extended system for drawing Tiled maps does so mostly on its own, though I have elected to draw a layer at a time and render any sprites I need to between the layer draw calls. The layers do not use the SpriteBatch I have configured to draw movable sprites, and just take a translation. I've managed to become decently adept at navigating it to convenient locations.
The Issue
Wikipedia says that for a good isometric scene, you want to rotate 45 degrees around Z and something like 32 degrees around what in my system is X. In my case, the resulting transformation does not seem to match the map image, so I am using an angle of approximately 52 degrees around X, which matches up fairly well. However, while the map itself can be perfectly aligned to the collision system, and I'm able to walk around the edges perfectly, objects within the map seem oddly placed. Some of this may be due to my incorrect handling of the Z (world upward) index, but it seems more than that. When I align the image so that it lines up with them instead of the edges of the map, their sizes seem subtly incorrect - I have found, for instance, that if my X rotation is negative, the objects (which are distant) seem slightly smaller than how they are drawn. I could be misreading that, however.
EDIT: The only distortion, if there is indeed any, seems to be in the viewport's Y direction. I collide where I expect to horizontally.
My Assumption
I believe this may simply be a camera issue - perhaps the default camera is not orthographic or something?  I don't really know the way to fix that if so, and if not, I'm mystified by what is going on.

sentences:
Circles within circle (PUBG safe zone) I'm attempting to do something that resembles the safe zone in PUBG (PLAYERUNKNOWN'S BATTLEGROUNDS), a circular area on the map that shrinks over time.

On map screen:

draw circle at rand X Y, 300 pixels wide

After say 5 minutes, I want to edit the X, Y and WIDTH of the circle so the new, smaller circle sits at a random position inside the old one.

sentences:
Is it feasible for a Server to send nothing more than a tile-based area to a Client? To start, I have a good amount of background in networking (hardware, routers, ex.) but very little knowledge past the basics of network programming. This may seem like a stupid question, but I want to know what I am getting myself into while fathoming the implementation of multiplayer in my game.

I am creating a tile-based world, which is generated through a simple 2D Array. Let's say something like World[100][100], for simplicity's sake.

Currently, the render method only renders the tiles based on the resolution of the window, plus one tile (for smooth rendering during movement.) No matter how large the world is, (10x10, 1million x 1million) the rendering is flawless in performance.

The gameplay needs nothing more than to know what is in the currently visible (rendered on screen +1) and at the most possibly SOME information of tiles in an area around the player.

So anything more sent by the Server wouldn't be the full tile information.
Ex. Items laying on the ground, ground type, trees, etc. would not be important in the area outside the player's view, but would only be what the Client/Player needs to know about in those tiles. (Ex. Ultima Online's 'incoming names' where players could know a Character [player or monster] was just beyond the tiles in their rendered view.)

I do not know very much about networking, so perhaps as I learn this might answer my question. However, I am curious if this is a feasible solution or if the idea is simply laughable.

The information being sent would be about a 10x15 area of tiles, and each tile holds information about what is on the tile.
More efficiently, everything would be an Object, where the tile holds all the Objects on the tile. Ex. Tile[4][4] holds Sword#23452, Rock2, Tree5, Player3, Monster4.

Empty tiles would send nothing more than terrain type [Grass, Sand, Water] if not already loaded during Initialization/Load. Some tiles would have a handful of objects [Tree2, Sword#924, Gold, Corpse, Rock3].

So I cannot imagine that a tile would have very much information to send to the Client from the Server, since the Client mainly only needs to know the Texture that needs to be loaded and Position to place it on screen. Position being only two integers and Texture being one integer for a list of files to tell the client to render.

At the craziest, the Server would have to send 150 tiles with information of only a handful of Objects OnLOAD, and from then on update only changes to tiles (if any) and any new tiles (10 to 15 everytime a player moves in a direction) and the direction of movement for characters on screen (so the client can simulate smooth movement between tiles).

I assume I am correct in thinking this is an incredibly low amount of information being sent over the internet or between peers, so it should have little problems with performance even over laggy connections? Or am I so ignorant of networking that my mind will be blown when I finally get around to opening up my book on multiplayer networking?

If it is a very low amount of information being sent between Client/Server, would it make more sense to simply load the entire World on Initialization? Or 'Map' if the World is excessively large. And then after LOAD, send only tiles which are updated?

I am still pondering how I should specifically deal with data. The book I am using as reference wants me to have a Linked List, where I add and remove objects, so everything is a bool. "Is there a Character? Is there a Tree?"

I was thinking of a different approach, such as a container which holds objects, and Server logic that sends only what is required to tell the Client what to render. Possibly with objects that hold networking information within itself, which is sent out when called for by the Server.

sentences:
Converting UnityScript code to C#: What is the alternative for .ToBuiltin? I'm trying to convert this code from UnityScript (Unity's version of JavaScript) to C#:

var polys = new Array(); // array to collect vertex locations
polys.Push((scanpoint + padding) + Vector2(0.5, 0.5) * Pixel_vs_Unit_Scale);
var poly:Vector2[] = polys.ToBuiltin(Vector2);

I converted the first two lines like so, with no errors:

var polys = new List<Vector2>();
polys.Add((scanpoint + padding) + new Vector2(0.5f, 0.5f) * Pixel_vs_Unit_Scale);

But when I try to adapt the last line like this:

Vector2[] poly = polys.ToBuiltin(Vector2);

I get two errors:

  ToBuiltin does not exist.

And also an error on the Vector2 inside the ():

  Vector2 is a type which is not valid in the given context.

How can I convert this code to C# correctly?

sentences:
How do I smooth out the edges at the end of the threshold on noise? I'm making a terrain generator for a game and I need it to smooth down to a float, I've tried a bunch of different things with lerping but I can't figure it out.

I need to stop this from happening by smoothing the height down to 1 once it gets to the edges.
public LevelManager level;

public float noise;
public float oceanNoise;
public float mountainNoise;

public Transform water;
public Transform land;

public void Start()
{
    level = FindObjectOfType<LevelManager>();

}
public void Update()
{
    float landNoise = noise + oceanNoise;
    noise = SimplexNoise.Noise(transform.position.x * level.deatalscale, transform.position.z * level.deatalscale);
    oceanNoise = SimplexNoise.Noise(transform.position.x * level.oceanDetailScale, transform.position.z * level.oceanDetailScale);
    mountainNoise= SimplexNoise.Noise(transform.position.x * level.mountainDetailScale, transform.position.z * level.mountainDetailScale);

    if (noise > level.thresh)
    {
        land.gameObject.SetActive(true);
        water.gameObject.SetActive(false);

    }
    else
    {
        land.gameObject.SetActive(false);
        water.gameObject.SetActive(true);

    }

    if (oceanNoise < level.oceanHhresh)
    {
        land.gameObject.SetActive(false);
        water.gameObject.SetActive(true);

    }

    if (oceanNoise < level.oceanHhresh)
    {
        land.gameObject.SetActive(false);
        water.gameObject.SetActive(true);

    }
    land.transform.localScale = new Vector3(level.planeScale, Mathf.Lerp(noise*level.height,1,noise) * level.height + level.addHeight, level.planeScale);

    if (level.landpos.Contains(transform.position))
    {
        Destroy(gameObject);
    }
}

This script goes on the terrain chunk and it uses its position to find value in noise, the level manager just holds a few settings.
Any help is appreciated, thanks in advance.

sentences:
Substance Painter: Fix color addition Substance Painter appears to add colors together wrongly when selecting "Normal Blending Mode"
The right side is what photoshop does correctly, meaning R+G+B values in the border region never exceed 255. On the left side is what Substance Painter does incorrectly, the green dot appears to have a glow around it.

If there is no quick way to fix this, I will have to export Red and Green and Blue layers individually and blend them together in Photoshop.

sentences:
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:
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:
Slow dictionary access with coordinates as keys I am making a game server and currently I am experiencing a huge performance hit.

I have a class Map which holds a Dictionary of the class Tile with each tile having X, Y, and Z coords, some lists, etc. nothing fancy as it's a MMORPG.

Currently in the Map class I have this:

public Tile GetTile(Coordinate_t coordinate)
{
    if (Tiles.ContainsKey(coordinate))
    {
        return Tiles[coordinate];
    }
    return null;
}

Coordinate_t is a struct containing X, Y and Z as UInt32. the Dictionary is represented like this:

 Dictionary<Coordinate_t, Tile> Tiles;

Basically I need to hold over 7 million tiles in this list, but it's being really slow! Every time I try to get around 12 tiles in a function it increases the program CPU use to 1~3% which is a lot! Since the game server is supposed to hold over 100 players online at a time.

Any ideas why is it being so slow? Are there better ways to hold a huge amount of tiles of a game in a list to be accessed continuously without having such a huge performance hit?

sentences:
Obtain rectangle indicating 2D world space camera can see I have a 2D tile based game in XNA, with a moveable camera that can scroll around and zoom.

I'm trying to obtain a rectangle which indicates the area, in world space, that my camera is looking at, so I can render anything this rectangle intersects with (currently, everything is rendered).

So, I'm drawing the world like this:

  _SpriteBatch.Begin(
                SpriteSortMode.FrontToBack,
                null,
                SamplerState.PointClamp,        // Don't smooth
                null, null, null,
                _Camera.GetTransformation());

The GetTransformation() method on my Camera object does this:

    public Matrix GetTransformation()
    {
        _transform =
           Matrix.CreateTranslation(new Vector3(-_pos.X, -_pos.Y, 0)) *
           Matrix.CreateRotationZ(Rotation) *
           Matrix.CreateScale(new Vector3(Zoom, Zoom, 1)) *
           Matrix.CreateTranslation(new Vector3(_viewportWidth * 0.5f,
               _viewportHeight * 0.5f, 0));
        return _transform;
    }

The camera properties in the method above should be self explanatory.

How can I get a rectangle indicating what the camera is looking at in world space?

sentences:
How to execute code every x seconds in unity? So I have a flashlight battery script I created and I need to know how do you make the battery variable go down every few seconds(whatever time you set.) I tried InvokeRepeating but it was an absolute disaster (The battery variable just went down really fast and ignored my script). Anyways this is the code I have:

void Update ()
{
    if (light == false) {
        battery+=0;
    }
    if (light == true) {
        battery--;//This is what I want to have every few seconds
    }

    if (battery == 0) {
        myLight.enabled = false;
        light =false;
        battery++;
        InvokeRepeating("invoke", 1, 0.01F);
    }
}

void invoke(){
    light = false;
    myLight.enabled = false;
}

sentences:
Sniper aim prediction I'm trying to make a sniper aim prediction for an Unreal Engine 4 game. I've found this interesting question Projectile Aim Prediction with Acceleration, and I tried to implement in C++ what DMGregory said. The result I got isn't bad at all, but I've some doubts about something in his explanation.
First, what does he mean with v_T? Should I calculate it as FVector v_T = targetVelocity - myVelocity; or as FVector v_T = targetVelocity - myPosition;? The vectors myVelocity and myPosition are respectively the velocity and the position of the shooter (me).
Then, I noticed that the sniper projectile trajectory doesn't seem to be a perfect parabola, so I avoided the v_p calculation, and I've simply calculated the predicted target position as

FVector predictedTargetPosition = targetPosition + targetVelocity * deltaTime + targetAcceleration * deltaTime * deltaTime * .5f;

where the 3 vectors targetPosition, targetVelocity and targetAcceleration are relative to the game world axis.  After that, I simply added to the Z component of the predictedTargetPosition the following amount:

recalculatedTargetPosition.Z += fabs(bulletAcceleration.Z) * deltaTime * deltaTime * .5f;

in order to compensate the loss of height of the projectile in time.

What do you think about it?

Thanks in advance.

sentences:
Enemy AI with Rigidbody - Floating in the air I'm working on my enemy AI scripts and I'm using a rigidbody to have the enemies chase the player when the player gets into its aggro distance.

Two of the main problems I'm having:

When the game starts, all the enemies are floating in the air
Even when the player is outside the enemie's aggro distance, the enemy still chases the player

Code:

using UnityEngine;
using System.Collections;

public class EnemyAI : MonoBehaviour {
    public Transform target;
    public int moveSpeed;
    public int rotationSpeed;
    public int attackSpeed;
    public int maxDistance;
    public int aggroDistance;

    private Transform myTransform;
    public Rigidbody rb;
    private Vector3 dir;

    void Awake() {
        myTransform = transform;
        rb = GetComponent<Rigidbody>();
    }

    void Start () {
        character = GetComponent<CharacterController>();
        //Find playerS
        GameObject go = GameObject.FindGameObjectWithTag("Player");
        //Set player as target
        target = go.transform;

        maxDistance = 2;
        aggroDistance = 10;
    }

    void Update() {
        dir = target.position - rb.position;
        dir.Normalize();
        transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(dir), rotationSpeed * Time.deltaTime);

        if (Vector3.Distance(target.position, myTransform.position) < aggroDistance) {
            if (Vector3.Distance(target.position, myTransform.position) > maxDistance) {
                rb.MovePosition(transform.position + transform.forward * moveSpeed * Time.deltaTime);
            }
        }
    }

    void FixedUpdate () {
        rb.AddForce (dir * rotationSpeed);
    }
}

Enemy Properties:

sentences:
Disney BRDF - where is metallic factor input into BRDF? Burley states about metallic parameter:

"This is a linear blend between two different models. ..."

What are the two models? I can't see this described in the Frostbite or the Unreal papers either.

Is it simply a blend between the diffuse and specular terms or a scaling factor on the specular term?

Disney Paper

sentences:
3D Studio MAX dxf model to OpenGL and DirectX Main Question

I saw this Loading and Animating MD5 Models with OpenGL an old post explaining .md5mesh .md5anim files. Is there any similar alternate mechanisms?

Additional Questions

1.) Is there an open source tool or a Plug in for 3ds max to convert a .DXF file to such files which can be used in 3D OpenGL+DirectX game programming.

2.) If I am developing a game in this approach how to make these model files encrypted and make big single file which contains all this file, so that the user cannot crack/hack it?

3.) If I am providing an update via an online gaming server, then how to I update this models and keep it encrypted again?

sentences:
How to 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:
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:
XNA Moddable Game - Architecture Design and Reflection I've decided to embark on an XNA moddable game project of a simple rogue style. For all purposes of this question, I'm going to not be using a scripting engine, but rather allow modders to directly compile assemblies that are loaded by the game at run time. I know about the security problems this may raise.

So in order to expose the moddable content, I have gone about creating a generic project in XNA called MyModel. This contains a number of interfaces that all inherit from IPlugin, such as IGameSystem, IRenderingSystem, IHud, IInputSystem etc.

Then I've created another project called MyRogueModel. This references MyModel project, and holds interfaces such as IMonster, IPlayer, IDungeonGenerator, IInventorySystem. More rogue specific interfaces, but again, all interfaces in this project inherit from IPlugin.

Then finally, I've created another project called MyRogueGame, that references both MyModel and MyRogueModel projects. This project will be the game that you run and play. Here I have put the actual implementation of the Monster, DungeonGenerator, InputSystem and RenderingSystem classes. This project will also scan the mods directory during run time and load any IPlugins it finds using reflection and override anything it finds from the default. For example if it finds a new implementation of the DungeonGenerator it will use that one instead.

Now my question is, in order to get this far, I have effectively 2 projects that contain nothing but interfaces... which seems a little... strange ? For people to create mods for the game, I would give them both the MyModel and MyRogueModel assemblies in which they would reference. I'm not sure whether this is the right way to do it, but my reasoning goes as follows :

If I write 1 input system, I can use it in any game I write.

If I create 3 rogue like games, and a modder writes 1 rendering system, that modder could use the rendering system for all 3 games, because it all comes from the MyModel project.

I come from a more web based C# role, so having empty interface projects doesn't seem wrong, its just something I haven't done before. Before I embark on something that might be crazy, I'd just like to know whether this is a foolish idea and whether there's a better (or established) design principle I should be following ?

sentences:
What are the accessibility implications of requiring a button press or time-out on a game over screen? For simple games, is there a de-facto standard that game over screens time out after a few seconds before, or require some sort of input in order to, transition back to the main menu?

Time-out pros:

Accessibility. Mobility-impaired users may have difficulty pushing the buttons so the game should advance for them.

Time-out cons:

Accessibility. Vision-impaired users may have difficulty seeing any post-game information displayed within the allotted time.
Tweaking the time-out so it's not too long as to be annoying if the user happens to game over a lot. Also: "Don't make QA mad"

Input pros:

Accessibility. Vision-impaired users may take as long as needed to see any post-game information displayed on screen.
Makes time-outs skippable.

Input cons:

Accessibility. Motor-impaired users may have difficulty pushing buttons.

I remember reading a Microsoft article about certain best practice design decisions regarding accessibility a long time ago but can't recall the specifics.

sentences:
Plugins for creating and styling custom Editor Windows like C#/C++ Form Designer or “Web Inspector”? Unity3d allows to construct window with custom UI. Just need to use EditorGUI/EditorGUILayout classes and their static methods.
Example of custom window:

The problem is that all the components have to be added manually via script. Then need to save, switch to Editor, wait for little compile things, and then we can see the result.

In web-development people use Web Inspector (for example, we can press F12 in chrome, Tab Elements -> Styles). We can add all needed properties to element and can see the result in real-time.

EDIT. another example (better than previous): we know C# winFormApp, C++ MFC e.t.c, which has form designer. We can choose any elements and set their properties:

It would be nice to have similar plugins for Unity

So. Does Unity3d have similar tools, utilities, plugins? Utilities to inspect code and editing styles (position, margin, padding, background, width, height, color  e.t.c.)?

sentences: Are weapon names or pictures copyrighted/licensed? Will I get a copyright strike or something if I use a picture of a weapon and the name of it? (e.g. a shop where you can buy guns, AK-47 with the pic)

sentences:
ContentManager in XNA cant find any XML Im making a game in XNA 4 and this is the first time I'm using the Content loader to initialize a simple class with a XML file, but no matter how many guide I follow, or how simple or complicated is my XML File the ContentManager cant find the file; the Debug keep telling me: "A first chance exception of type 'Microsoft.Xna.Framework.Content.ContentLoadException' occurred in Microsoft.Xna.Framework.dll".
I'm really confuse because I can load SpriteFonts and Texture2D without a problem ...

I create the following XML (the most basic Xna XML):

    <?xml version="1.0" encoding="utf-8" ?>
<XnaContent>
  <Asset Type="System.String">Hello</Asset>
</XnaContent>

and I try to load it in the LoadContent method in my main class like this:

System.String hello = Content.Load<System.String>("NewXmlFile");

There is something I'm doing wrong? I really appreciate your help

sentences:
Event/Trigger System Architecture The Plan

I am up to write write an own Trigger/Event System, an event engine or how you call it. I would like to achive something similar to Blizzard's most level editors, like Starcraft 1-2, Warcraft level editors.
They are all kind of event/trigger based, you can set actions, conditions which actually control the gameplay itself. What do you think, what would be the best architecture for this event/trigger system?

The Architecture

I thought it would look something like this:

EventManager - would handle the events, checking if the conditions
meet for any event,
                  and calls the event if so.
EventHolder - would hold the list of the events.
EventEntity - would have an ID, the actions' ID and the params for
them.

Every entity, enemies, player and other stuff would have an ID in the world, which would help to get the entity itself and fire a trigger on it.
Obviously, there would be finit and pre-set BASIC actions, but that would be stored by the current project itself. The project could pass the EventSet (list of EventEntity) to the EventHolder. Thus this whole event/trigger system would be very flexible, and could compile it as a DLL for use in future projects.
Do you have any better solution for this? Or some pro tips that I could use? Would really appreciate any help! Thanks!

Edit:
This picture shows it quite well:

Edit2:
I have wrote a raw architecture of a possible "engine", but it is missing some MAIN points:

{Initializing}

//in order
[Game]--set event list--[EventManager]--requests list of EventEntity--[Game]--sends list of EventEntity--[EventManager]

{EventManager loop}

[EventManager]--checks if any of the events meet in an EventEntity
[EventManager]--if any meets--[EventManager]--checks if all of the conditions are meeting in the EventEntity
[EventManager]--if all meets--[EventManager]--fires actions of the EventEntity

{Architecture of the Models}

[EventEntity] contains
- [List of Event Models]
- [List of Condition Models]
- [List of Action Models]

[EventModel] contains
//quite similar to the ConditionModel, an event only should fire, aka check the conditions and
//fire the actions, if these special conditions, happenings, events are fired
//like a unit dies, player reaches a specific position, etc.

[ConditionModel] contains
//model must simulate AND, OR logic statements
//model must simulate IF statements

[ActionModel] contains
- [List of Targets]
- [List of Action IDs] //One action per Target, a specific Target can be listed more than once in the [List of Targets]
//something is missing

Trying to write the "system" as standalone as possible, it must not depend on any project's source. Thus I think the best would be to seperate the data from the architecture, could store the event, condition and action datas in another DLL unit, and could read from that.

sentences: AndEngine: How to add multiple fixtures into body? I want to create a custom body which have very random shape like a table. So how to add/combine multiple fixtures into a body?

sentences:
OpenGL Fragment Shader simulate LCD slow response time I have a very simple OpenGL view rendering 2 triangles with a single texture applied. The minimum setup for rendering a 2d game.

What i do is redraw the texture for every frame and easily get 60fps.

I would like to add an effect simulating LCD slow response by outputting pixels that are the average between the current and the previous frame.

The pseudo code of fragment shader would look like this

varying vec2 v_TexCoordinate;
uniform sampler2D u_Texture;

void main() {
    gl_FragColor   = (texture2D(u_Texture, v_TexCoordinate) + PIXEL_PREVIOUS_FRAME) / 2;
    PIXEL_PREVIOUS_FRAME = gl_FragColor;
};

Well, i think shaders can't keep a persistent variable like PIXEL_PREVIOUS_FRAME, then i really don't know how to tackle this problem.

Any suggestion?

sentences:
How 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:
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:
How to eliminate screen jitter in Flash game? We made a flash game with a big screen size(1000x600), and the terrain graphic will jitter while the screen scrolling(that's, camera moving with player) continuously.

What's the root cause? Or if you know how to eliminate this problem, please tell me. Any help is appreciated.

UPDATE:

The map's size is more bigger than screen, e.g 6000x1200. And the map has more than one layer, generally it has 3 layers. Terrain is composed by tiles. And FPS is 24.

If the FPS is set to 60, things will be better. But any way, it should work well at 24 FPS. I'm not sure if it is a natural problem of flash player, because some times a terrain object(e.g a house) look like a little bit distorted.

sentences:
In Unity, how do I create a drag and drop object? I have a 2d scene. I want the player to be able to pick up an object, move it around the scene and drop it somewhere. I can't find any way to do this, and all of the resources for Unity are really daunting and I can't find anything relevant to what I'm doing.

I've tried adding the drag rigidbody script to both my camera and the sprite I want to drag, to no effect.

Where can I find relevant documentation for stuff like this? Basic things like how to implement a script or what objects I need to attach these scripts to - the stuff on the unity website is a little too advanced.

sentences:
android 2d bullet-spawn (shooting) This will be a quick question since Im pretty sure I'm overlooking something small that I for some reason cant see.

My sprite is moved using a joystick, and I want my sprite to be able to shoot. I've got the direction and speed of my bullet working, but I cannot get it to shoot from the right place (my sprites location).

Code for moving sprite:

    angle = Math.atan2(touchingPoint.y - inity,
                touchingPoint.x - initx) / (Math.PI / 180);

        pointerPosition.y += Math.sin(angle * (Math.PI / 180))
                * (touchingPoint.y / 90); //Sprites y-position
        pointerPosition.x += Math.cos(angle * (Math.PI / 180))
                * (touchingPoint.y / 90); //Sprites x-position

Current code for moving bullet:

    if(shooting){
        bulletPos.y += Math.sin(angle * (Math.PI / 180)) * 2;
        bulletPos.x += Math.cos(angle * (Math.PI / 180)) * 2;
    }

Since the angle is calculated using constants I get why my bullet only spawns at one place, even tho Im moving my sprite around. My question is, how do I fix this?

First time working with vectors like this and all I can find on stack is logic for tower-defence games, if there is a duplicate of this question I apologise but really cannot find it.

sentences: How to have 3d multiple planet gravity in unity c#? Im using unity and I want to make a game where you can walk around small planets and the further away you get, the weaker the gravity, so you can go to other planets. All the tutorials so far only work with one planet, how do I code this? Is there anything I can download that does it for me?

sentences:
Have both Cubemaps and TextureArray in a single texture register? I want to have both Point Lights, aswell as Spot Lights.
For the Point Lights I have a TextureCubeArray and for the Spot Lights I have a Texture2DArray. Is it possible to combine these two into a single Texture2DArray and treat the Point Light Shadow Maps as Cubemaps, and treat the SpotLight shadow maps as single textures?
I would like to bind only one array instead of multiple ones.

sentences:
How to support JS/Python scripting a C++ game engine? I'm currently writing an Entity/Component/System architecture game engine in C++, and I have the beginnings of a lua scripting system in place, which seems to be quite popular, but I feel Javascript or Python would be better.

My requirements are:

Able to bind C++ function calls to the scripting language.
Able to return data to the calling script.
Able to support heavily templated libraries, such as glm (optional, but desirable)
Must be lightweight.
Must have open source license, or similar, with no restrictions on any potential commercial use.

How would I go about doing this, in a similar way to Lua?

sentences: UDP+RUDP or UDP+TCP? I made a library that enables client-server communication using both TCP and UDP protocols. When game developers on the #gamedev IRC channel (Freenode) knew that, they totally refused the idea. They recommended RUDP instead of TCP. Should I remove the TCP communication and use RUDP instead?

sentences:
How to save game state in C in Allegro? I'm developing my 1st board-game (go-game) in C with Allegro 5, for a course project. Part of my goal is to make a gamesave of the current gamestate. Let's say for 2 players if we exit the game, and log in the game, we want to reload the previous gamestate such that the position of the stones by 2 players to be preserved in their positions. How can I achieve this?
I will appreciate any related reference, tutorial, or a git reference I can learn more about saving the states of the game.

P.S. I checked the old questions about saving game state, but there are guides only for other languages/libraries not in C/Allegro.

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:
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:
Slide 2d Vector to destination over a period of time I am making a library of GUI controls for games I make with XNA. I am currently developing the library as I make a game so I can test the features and find errors/bugs and hopefully smash them right away.

My current issue is on a slide feature I want to implement for my base class that all controls inherit. My goal is to get the control to slide to a specified point over a specified amount of time. Here is the #region containing the code

#region Slide
    private bool sliding;
    private Vector2 endPoint;
    private float slideTimeLeft;
    private float speed;
    private bool wasEnabled;
    private Vector2 slideDirection;
    private float slideDistance;

    public void Slide(Vector2 startPoint, Vector2 endPoint, float slideTime) {
        this.location = startPoint;
        Slide(endPoint,slideTime);
    }

    public void Slide(Vector2 endPoint, float slideTime) {
        this.wasEnabled = this.enabled;
        this.enabled = false;
        this.sliding = true;
        Vector2 tempLength = endPoint - this.location;
        this.slideDistance = tempLength.Length(); //Was this.slideDistance = (float)Math.Sqrt(tempLength.LengthSquared());
        this.speed = slideTime / this.slideDistance;
        this.endPoint = endPoint;
        this.slideTimeLeft = slideTime;
    }

    private void UpdateSlide(GameTime gameTime) {
        if (this.sliding) {
            this.slideTimeLeft -= gameTime.ElapsedGameTime.Milliseconds;
            if (this.slideTimeLeft >= 0 ) {
                if ((this.endPoint-this.location).Length() != 0){//Was if (this.endPoint.LengthSquared() > 0 || this.location.LengthSquared() > 0) {
                    this.slideDirection = Vector2.Normalize(this.endPoint - this.location);
                }
                this.location += this.slideDirection * speed * gameTime.ElapsedGameTime.Milliseconds;//This is where I believe the issue is, but I'm not sure. It seems right to me... (Even though it doesn't work)
            }
            else {
                this.enabled = this.wasEnabled;
                this.location = this.endPoint;//After time, the controls position will get set to be the endpoint.
                this.sliding = false;
            }
        }
    }
    #endregion

this.location is the location of the control elsewhere defined in the class. I have looked at this blog as a huge reference and have googled around quite and have looked on many forums but can't find anything that shows how to implement it.

Please and Thanks for your time!

EDIT:

I have switched this line "this.location += this.slideDirection * speed * gameTime.ElapsedGameTime.Milliseconds;" several times to see what it does. My issue is getting the control to smoothly move to the end location. It moves after the time has expired, but It doesn't move other then that except flash in my face.

EDIT2:

I have used the first slide method with 3 parameters and it works except it doesn't do it in a period of time and once it gets to its destination, it starts moving randomly towards the previous location and the end location.

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:
Fishbowl effect correction in raycasting engine suggestions (pseudo 3d projection) I'm writing a simple raycaster in golang and I have some problems understanding perspective correction. The code is simple, the main rendering loop is this:

    curVector := playerVector.NewRotated(-curFov / 2)
    rotateStep := curFov / float64(screen.Width()) // Angles per screen row
    // Traverse each row of our screen, cast a ray and render it to screen buffer
    for i := 0; i <= screen.Width(); i++ {
        curVector.Rotate(rotateStep)

        hit, distance, tile, tileP := rayCast(curX, curY, curVector, viewDistance)

        if hit {
            // distToHeight is basically linear (screen.Height()/distance)
            drawTexturedWallColumn(screen, tile, i, distToHeight(distance, screen.Height()), tileP) // Project walls on screen
        }
        // drawSpritesColumn(screen, i, curVector, distance) // Project sprites on screen
    }

So I just cast rays with even angle intervals and get this fishbowl effect:

So, I understand that the problem is with angle intervals and sphere projected rays with the same length. I found this question How can I correct an unwanted fisheye effect when drawing a scene with raycasting? and tried to implement the same logic:

leftVector := playerVector.NewRotated(90)
    // Traverse each row of our screen, cast a ray and render it to screen buffer
    for i := 0; i <= screen.Width(); i++ {
        progress := float64(i)/float64(screen.Width()) - 0.5 // -0.5 to 0.5
        stepX := (playerVector.X + progress*(leftVector.X*2)) // *2 to make 90 FOV
        stepY := (playerVector.Y + progress*(leftVector.Y*2))
        curVector := Vector{X: stepX, Y: stepY}

        hit, distance, tile, tileP := rayCast(curX, curY, curVector, viewDistance)

        if hit {
            // distToHeight is basically linear (screen.Height()/distance)
            drawTexturedWallColumn(screen, tile, i, distToHeight(distance, screen.Height()), tileP) // Project walls on screen
        }
        // drawSpritesColumn(screen, i, curVector, distance) // Project sprites on screen
    }

But the result is almost the same (FOV variable is not used here but it's around 90, it's not important at the moment). The difference is that this one has a more "linear" fishbowl effect because of evenly spaced intervals (progress variable):

So, I don't know how to fix this, I also tried to use perpendicular distance (distance*cos).

sentences: What use for a 3d browser based multiplayer online game? Can you help me choosing the right tools for this project? It's a 3d browser based multiplayer online fighting game. A few 3d functions are necessary for positioning, but no heavy rendering will happen. It needs very low ping rates, though, as it will be very dynamic. HTML5 + three.js + some networking lib seems like a fair choice, but I'm concerned about performance and cross-browserism. It's for learning purposes but I can use it for professional showoff. Thoughts?

sentences:
How 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:
Animation-based Collision Boxes Background

I'm currently working on a top-down 2D game, roughly similar to something like Zelda for the SNES.

Certain game entities such as the player or a typical enemy will consist of multiple collision boxes. For example:

The main collision box which determines collisions with the map (i.e. walls). It also determines where the entity can be hurt.
The attack collision box which, if overlapping a main collision box, causes the owner of that collision box to take damage.

The attack collision box should only be active when the entity is actually attacking.

One Solution

The first potential solution that comes to mind is the one used in fighting games where every frame of animation has its own set of collision boxes. This can obviously work, but it feels like it may be too over-engineered for what I need.

The Actual Question

Other than the solution above, is there a standard or common approach for attack collision boxes? Or is having collision boxes tied to animation the standard way of doing things?

I would like to emphasize the term "standard". It would be great to know how games like The Legend of Zelda, Secret of Mana, and Castlevania handle it.

sentences: How can I save game "professionally"? I am a novice programmer and just learned about the concept of saving and loading games. The way I am doing it is to write data into a text file and read it afterward. However, I realize how insecure this method is. What is going to stop someone to just open the text file and edit it? Furthermore, after going through game folders of popular games, I do not seem to find any text file dedicated to saving data at all. So there must be more advanced saving methods than simply writing and reading from a text file. What are they then and how can I do something similar to that? (I mainly use Java and C++)

sentences:
unity3d - Fire bullet using AddForce is very slow This is a top-down view but in 3D coordinates, I would like to instantiate and fire a bullet from the player's gun. This script is on a spawner object at the end of the barrel.

void Fire () {

        float speed = 80;

        GameObject projectile = Instantiate (bullet, transform.position, transform.rotation) as GameObject;

        projectile.GetComponent<Rigidbody>().AddForce(transform.forward * speed);
        coolDown += Time.time;
    }

I also tried this but in this case the bullet always moves in a fixed direction (North) :

projectile.GetComponent<Rigidbody>().velocity = Vector3.forward * speed;

Bullet is an empty object and the actual bullet is it's child ( did that to overcome a rotation issue ), the problem is nomatter how high I turn up the speed the bullet travels very very slow.
Both the parent and the bullet have Rigidbody.

sentences:
Do I require a game engine  when I want to make a game? I started making a 2D game in C# and realized that I could also use a game engine or XNA. For the moment everything works fine but I'm afraid I will have problems in the future.

So do I actually need a game engine or XNA? Or will it also works without.

PS: I don't know anything of XNA so I would learn it.

sentences:
Isometric Architecture Map Game Data I'm not sure this kind of question has been answered yet, if so i'm sorry to duplicate it.

My question is rather simple :

I'm creating a simple Isometric game with libgdx, i'm using Tiled but only to design the map and render it with OrthographicMapRenderer.

The map is a static map of 6864 * 6880 pixels, one tile is 59*43 pixels

I wanted to do some pathfinding to my game, so I decided to store my map data into a simple 2D array like this : int cells[i][j] which would contains 0 if the tile is walkable or 1 if it's not, it is as simple as that !

Currently I've simply using basic formula to convert world cartesian coordinate to Isometric coord, and formula to get tile pos based on iso pos, (eg : you input a iso coord, the function return a vector like <2,5> which is the 2nd x tile and 5th y tile.

It perfecttly work as execepted, I also make it that iso tile coord is always positive ( <0,0> is at the top left corner of my world )

But here is my Question or doubt : How to handle correctly the game data tile ? Does a 2D array is sufficient, if yes, how to, for exemple write a function that get if a tile is walkable or no based on tile coord ? ( example : I click on my map, the coordinate is translated to tile coord ( < 4,5> for example,) how to check if this tile is walkable ?, i dont get on how to do it i'm really lost.

EDIT : Ive successfully implemented the isometric logic : I can convert world coordinate to tile coorinate ( eg : (5075;4851) -> (203;28)) and the reverse but i'm confused on how to fill the 2d Array, use it for A* algorithm and make the bridge between these coordinate and the 2D array

Thank you for you help,
Regard

sentences: Packaging HTML5 games as applications for iPhone/Android Is it possible to package HTML5 game for iPhone and Android as an application or does it have to be accessed through a browser?

sentences:
OpenGL pitching problem I've been trying to implement several camera movements for my application. So far yawing, rolling, strafing, walking has been working properly, but I can't get my pitching to work properly. If I continue pitching upwards, it doesn't rotate back 360 degree, and instead gets stuck looking at the top of the screen.

Here's my code for Camera class

class Camera
{
    float m[16];
    Vector dirForward, dirUp, dirRight;

    void loadCameraDirections()
    {
        glGetFloatv(GL_MODELVIEW_MATRIX, m);
        dirForward = Vector(m[2], m[6], m[10]).unitVector();
        dirUp = Vector(m[1], m[5], m[9]).unitVector();
        dirRight = Vector(m[0], m[4], m[8]).unitVector();
    }

public:
    Vector position;
    Vector lookAt;
    Vector up;

    Camera()
    {
        position = Vector(300, 0, 100);
        lookAt = Vector(0, 0, 100);
        up = Vector(0, 0, 1);
    }

    void rotatePitch(double rotationAngle)
    {
        glPushMatrix(); {
            glRotatef(rotationAngle, dirRight.x, dirRight.y, dirRight.z);
            loadCameraDirections();
        } glPopMatrix();

        lookAt = position.repositionBy(dirForward.reverseVector());
    }
}cam;

I call the gluLookAt funtion by-

gluLookAt(cam.position.x, cam.position.y, cam.position.z, cam.lookAt.x, cam.lookAt.y, cam.lookAt.z, cam.up.x, cam.up.y, cam.up.z);

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: Unity Default Shader Greyed Out I created a pland in Unity 3D and then tried to alter the material.  I looked at it's material component, but all the options are greyed out!  how do I fix this problem?

sentences:
Calculate gears rotation for a realtime simulation I'm trying to do a game with real time simulations of gears. There is a big Gear with inside a smaller gear.
I managed to draw gears with different diameters but equal size teeth, but if i try to move the smaller one inside the bigger one the movement is odd.
See the animated gif:

The biggest gear is in center C1 and the small in the center C2. I calculate C2 position in this way:
C2.x = C1.x + C1_RADIUS-C2_RADIUS) * cos(t);
C2.y = C1.y - C1_RADIUS-C2_RADIUS) * sin(t);

for t that goes from 0 to TWO_PI in n steps.
I apply as rotation the angle t, but maybe it is wrong and i have to calculate another rotation for get a perfect joint.
EDIT:
I am using radians for rotations and I think this is OK.
My main problem is that I want to achieve a perfect joint between teeth like this example. My teeth are overlapping in some odd way.
EDIT
a working example can be found here: http://www.openprocessing.org/sketch/83665

sentences:
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:
Drawing a 1 pixel thick line in Unity I'm trying to get a cross at the center of the screen (Two lines will do as well).

I have a 2048x2048 Texture which I have thrown into a canvas. Filtering is set to point. The image is set to be in the middle of the screen no matter the resolution. The image is set to 2048x2048 no matter the screen resolution which works as well.

However when I change the Screen Resolution I get results like the following, no matter what I do, the line refuses to stay at the same thickness. When I enable Bilinear filtering the lines constantly fade and thicken.

This is what I get when I use a 16x16 image:

EDIT: i tried using a black square and setting its width to 1 and height to 2048, and another one with width to 2048 and height to 1. The result i got is not what i expected:

Can someone help me to fix this please?

sentences:
Issues implementing arcball viewer My scene has a simple cube, and a camera built with the lookAt function (I'm using OpenGL). The scene renders fine, and I'm sure I have my model/view/projection matrices set up correctly.

Now I'm trying to implement arcball rotation for my camera, but I'm having some trouble. I've got it down to calculating the angle/axis rotation for a virtual sphere in normalized screen coordinates. That means when I move my mouse left to right, I get an angle around the Y axis... and moving my mouse up/down will get me an angle about X.

I'm not sure where to go from here -- what do I need to do with my axis so I can apply the angle to simulate camera rotation about its viewpoint?

If I try directly applying the axis/angle rotation the camera/view transform I get what you'd expect. The view is rotated about the world axes which the mouse moving over the virtual sphere on the screen corresponds to. So if I move the mouse up/down the view rotates about the world's X axis (what I get reminds me of a first-person view)... but this isn't what I want.

I think I need the axis I get to be transformed so it passes through the camera viewpoint and is oriented correct in reference to the camera... but I don't know if that's right or how to do that.

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:
How do I maintain the world pitch, roll or yaw of child objects? I've got an application where I'm trying to display an object in 3D, with information provided by real-world accelerometers and inclinometers - sensors that pick up the angle of the equipment, relative to ground. The trouble comes when I want to show this 'world pitch' or 'world roll' on an object that is a child of another. I'd think that there is a trivial solution to the problem, but for the life of me, I can't figure out what it is.

Let's say I've got a robot arm with several pieces - "LowerArm", "Elbow", "UpperArm" and "Hand". "Hand" is the child of the "UpperArm", and "UpperArm" is the child of "Elbow". I'd like to place "Hand" at 0 degree pitch, relative to world-space, no matter how I move the parent objects. If I grab my "LowerArm", and rotate it 90 degrees, the hand should still lay 'flat', relative to the ground; in local coordinate space, it should moved 90 degrees, to compensate.

I want it to remain attached; so it should continue to follow the other parts, in terms of roll and yaw. If I twist the arm, the hand twists with everything else - it just maintains that 0 degree world pitch. Observe the yellow object, in the below example:

How can I do this? I would have thought that there was some kind of trick, with matrices or quaternions, that could resolve it; but I've had no luck, so far. It's hard to figure out what the new 'forward' vector should be.

sentences:
Animating two characters (like a fighting game) whose animations are tied together? So, say one character grabs another and throws him against a wall. Are these two separate animations that get attached to each character? Or is this really one animation that somehow involves each character model to itself?
I'm using the Unity game engine.

sentences:
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:
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:
Sprite quickly disappears after rendering I'm currently making space invaders and I'm using the game loop pattern as described here. I have an entity class from which there is a spaceship derived class. The base entity class contains all of the general entity data such as the x/y position, speed, etc...
Currently, I have the X and Y positions initialized to (0,0) so the spaceship is rendered in the center of the screen. I tried initializing the y position to a different coordinate corresponding to a position, but for some reason, the spaceship just keep moving vertically as if the y position is just being accumulated at each frame. I think the problem is caused by the fact that in my render() method of the spaceship class, I'm translating the modelmatrix with the x and y position of the spaceship as that would explain why there isn't vertical movement when the coordinates are (0,0). I'm not sure exactly if this is the proper way to structure the render() method but I couldn't think of another way to change the object's position. Below is the relevant code:
Spaceship class definition:
class Spaceship : public Entity {
public:
    Spaceship(float xDirect, float yDirect,
        float xPosition, float yPosition, float speed, float rState, ShaderProgram* program, SheetSprite newSprite, bool movingLeft, bool movingRight):
        Entity(xDirect, yDirect, xPosition, yPosition, speed, rState, program, newSprite), movingLeft(movingLeft), movingRight(movingRight)
    {
        posY = 0.1;
    }

    virtual void Update(float elapsed) {
        // move stuff and check for collisions

        if (movingLeft) {
            posX -= elapsed* 0.001;
        }

        else if (movingRight) {
            posX += elapsed * 0.001;
        }
    }

    virtual void Render() {
        setOrthoProj();
        setObjMatrices();
        translateObj(posX, posY, 0.0);
        mySprite.Draw();
    }
    bool movingLeft;
    bool movingRight;
};

Initialization Code in main
Spaceship* spaceship = new Spaceship( 1.0f, 1.0f, -5.1f, 0.0f, 3.0f, 0.0f, program,mySprite, false, false);
    spaceship->Render();

Game Loop movement code
    const Uint8 *keys = SDL_GetKeyboardState(NULL);

    if (keys[SDL_SCANCODE_LEFT]) {
        spaceship->movingRight = false;
        spaceship->movingLeft = true;
        spaceship->Update(elapsed);

    }
    else if (keys[SDL_SCANCODE_RIGHT]) {
        spaceship->movingLeft = false;
        spaceship->movingRight = true;
        spaceship->Update(elapsed);

    }
    spaceship->Render();

For some reason, the first render() call outside of the loop isn't rendering the spaceship, only the one inside the loop works.
Given the structure of the program, what could be causing the problem?
EDIT
Translate method from Entity base class
void translateObj(float x, float y, float z) {
        posX = x;
        posY = y;
        modelMatrix.Translate(posX, posY, 0.0);
    }

void setObjMatrices() {
        glUseProgram(program->programID);
        program->setModelMatrix(modelMatrix);
        program->setProjectionMatrix(projectionMatrix);
        program->setViewMatrix(viewMatrix);

    }

sentences:
LibGDX - Rectangle Collision and Response I've been using LibGDX for the past few weeks and I have some problems that I need help on. What I need help on is understanding how to use LibGDX Rectangle class for a platformer.

I found this project on github that seems to be useful.

https://github.com/obviam/star-assault-reboot

I was able to wrap my mind around how this game worked for the most part.

The only thing I can't understand, which is the most essential part of the game, is how the collision detection and response works.

In the project, the BobController class holds the everything that's used to detect collision.

https://github.com/obviam/star-assault-reboot/blob/master/core/src/net/obviam/starassault/controller/BobController.java

I tried going to the website linked in the github project for answers, but it seems to be empty.

Maybe I'm just dumb, but I can't wrap my mind how this works. Even with the comments provided in the project, I still don't understand.

Can someone explain in greater detail how this class handles collision detection and response using the LibGDX Rectangle class.

EDIT:

This is the specific function that I don't understand:

/** Collision checking **/
private void checkCollisionWithBlocks(float delta) {
    // scale velocity to frame units
    bob.getVelocity().scl(delta);

    // Obtain the rectangle from the pool instead of instantiating it
    Rectangle bobRect = rectPool.obtain();
    // set the rectangle to bob's bounding box
    bobRect.set(bob.getBounds().x, bob.getBounds().y, bob.getBounds().width, bob.getBounds().height);

    // we first check the movement on the horizontal X axis
    int startX, endX;
    int startY = (int) bob.getBounds().y;
    int endY = (int) (bob.getBounds().y + bob.getBounds().height);
    // if Bob is heading left then we check if he collides with the block on his left
    // we check the block on his right otherwise
    if (bob.getVelocity().x < 0) {
        startX = endX = (int) Math.floor(bob.getBounds().x + bob.getVelocity().x);
    } else {
        startX = endX = (int) Math.floor(bob.getBounds().x + bob.getBounds().width + bob.getVelocity().x);
    }

    // get the block(s) bob can collide with
    populateCollidableBlocks(startX, startY, endX, endY);

    // simulate bob's movement on the X
    bobRect.x += bob.getVelocity().x;

    // clear collision boxes in world
    world.getCollisionRects().clear();

    // if bob collides, make his horizontal velocity 0
    for (Block block : collidable) {
        if (block == null) continue;
        if (bobRect.overlaps(block.getBounds())) {
            bob.getVelocity().x = 0;
            world.getCollisionRects().add(block.getBounds());
            break;
        }
    }

    // reset the x position of the collision box
    bobRect.x = bob.getPosition().x;

    // the same thing but on the vertical Y axis
    startX = (int) bob.getBounds().x;
    endX = (int) (bob.getBounds().x + bob.getBounds().width);
    if (bob.getVelocity().y < 0) {
        startY = endY = (int) Math.floor(bob.getBounds().y + bob.getVelocity().y);
    } else {
        startY = endY = (int) Math.floor(bob.getBounds().y + bob.getBounds().height + bob.getVelocity().y);
    }

    populateCollidableBlocks(startX, startY, endX, endY);

    bobRect.y += bob.getVelocity().y;

    for (Block block : collidable) {
        if (block == null) continue;
        if (bobRect.overlaps(block.getBounds())) {
            if (bob.getVelocity().y < 0) {
                grounded = true;
            }
            bob.getVelocity().y = 0;
            world.getCollisionRects().add(block.getBounds());
            break;
        }
    }
    // reset the collision box's position on Y
    bobRect.y = bob.getPosition().y;

    // update Bob's position
    bob.getPosition().add(bob.getVelocity());
    bob.getBounds().x = bob.getPosition().x;
    bob.getBounds().y = bob.getPosition().y;

    // un-scale velocity (not in frame time)
    bob.getVelocity().scl(1 / delta);

    }

sentences:
Can I clip a collection of geometry to render only inside a particular worldspace volume? I am making a VR app in Unity.  I have a giant map that I want to display on a virtual table.  The map is too large to fit on the table, and I cannot change its size.  (It is a third party asset, and does not easily have that capability.)

How can I tell the camera not to render the parts of the map that fall off of the table?  Perhaps something along the lines of:

Camera.DoNotRender(new Vector3(100, 0, 0));

I have been looking into using some MonoBehaviour messages such as OnPreRender, OnRenderObject, etc.  But I do not know which one can help me, if any.  Ideally, the pixels behind the non-rendered pixels should be rendered, but that is not my priority.

The map is made up of 100s of little renderers:

How can I have my Camera not render specific world space pixels?

sentences:
pause or freezing game screen I have a question regarding the pausing/freezing a game while a window/pausemenu will appear at center of the screen. I've already created a pausescreen class which will be called each time the back key is being pressed.

My problem is that I don't know how to freeze or put the game to pause, this becomes a problem because whenever i tried to click on the outsides of the pause window the player could move around.

sentences:
Weird issue in collision resolution of non-static bodies I'm a bit of a beginner in engine development, so I decided to write my own engine from scratch so I could learn more about what happens under everything.

I've been progressing fairly well, except the physics engine side of things have been giving me a bit of a headache.

Here's a gif of what I mean:

Essentially, the engine works just fine as long as the player is not colliding with another non-static body from either above, or from right to left.

Here's my collision resolution code written in go:

package resources

import (
  "game/pidgeot-socket/ecs"

  "github.com/bxcodec/saint"
)

type PhysicsSystem struct {
  Hub *Hub
}

func (system PhysicsSystem) Loop() {
  entities, err := system.Hub.World.AllEntitiesWithComponent(ecs.CollisionComponent)
  if err != nil { return }

  for e, _ := range entities {
    // apply impulse
    c_p, _ := system.Hub.World.GetComponent(e, ecs.CollisionComponent)
    c := (*c_p).(*ecs.Collision)

    p_p, _ := system.Hub.World.GetComponent(e, ecs.PositionComponent)
    p := (*p_p).(*ecs.Position)

    if c.WithGravity {
      // Add gravity
      c.ImpulseY = saint.Min(c.ImpulseY + 1, c.MaxSpeedY)
    }

    // apply impulse
    p.NextY = p.Y + c.ImpulseY
    p.NextX = p.X + c.ImpulseX
  }

  // resolving collisions
  for e1, _ := range entities {
    c1_p, _ := system.Hub.World.GetComponent(e1, ecs.CollisionComponent)
    c1 := (*c1_p).(*ecs.Collision)

    if c1.IsStatic { continue }

    for e2, _ := range entities {
      if e1 == e2 { continue }

      system.ResolveCollision(entities, e1, e2)
    }
  }

  // moving entities
  for e, _ := range entities {
    p_p, _ := system.Hub.World.GetComponent(e, ecs.PositionComponent)
    p := (*p_p).(*ecs.Position)

    if (p.X != p.NextX || p.Y != p.NextY) {
      p.X = p.NextX
      p.Y = p.NextY

      system.Hub.broadcast <- system.Hub.World.GetComponentMessage(e, p_p)
    }
  }
}

func (system PhysicsSystem) ResolveCollision(entities map[ecs.EID]*ecs.Component, e1 ecs.EID, e2 ecs.EID) {
  c1_p, _ := system.Hub.World.GetComponent(e1, ecs.CollisionComponent)
  p1_p, _ := system.Hub.World.GetComponent(e1, ecs.PositionComponent)
  c1 := (*c1_p).(*ecs.Collision)
  p1 := (*p1_p).(*ecs.Position)

  c2_p, _ := system.Hub.World.GetComponent(e2, ecs.CollisionComponent)
  p2_p, _ := system.Hub.World.GetComponent(e2, ecs.PositionComponent)
  c2 := (*c2_p).(*ecs.Collision)
  p2 := (*p2_p).(*ecs.Position)

  // resolve y-axis
  collidingX := IsOverlapping(p1.X, p1.X + c1.W, p2.X, p2.X + c2.W)
  collidingY := IsOverlapping(p1.NextY, p1.NextY + c1.H, p2.NextY, p2.NextY + c2.H)
  colliding := collidingX && collidingY

  if colliding {
    direction := func (impulse int) int {if impulse < 0 { return 1 } else { return -1 }}(c1.ImpulseY)
    overlap := CalculateOverlap(p1.NextY, p1.NextY + c1.H, p2.NextY, p2.NextY + c2.H)

    p1.NextY += (direction * overlap)
    c1.ImpulseY = 0
    c1.IsJumping = false
  }

  // resolve x-axis
  collidingX = IsOverlapping(p1.NextX, p1.NextX + c1.W, p2.NextX, p2.NextX + c2.W)
  collidingY = IsOverlapping(p1.Y, p1.Y + c1.H, p2.Y, p2.Y + c2.H)
  colliding = collidingX && collidingY

  if colliding {
    direction := func (impulse int) int {if impulse < 0 { return 1 } else { return -1 }}(c1.ImpulseX)
    overlap := CalculateOverlap(p1.NextX, p1.NextX + c1.W, p2.NextX, p2.NextX + c2.W)

    p1.NextX += (direction * overlap)
  }

  for e3, _ := range entities {
    if e1 == e3 { continue }

    c3_p, _ := system.Hub.World.GetComponent(e3, ecs.CollisionComponent)
    p3_p, _ := system.Hub.World.GetComponent(e3, ecs.PositionComponent)
    c3 := (*c3_p).(*ecs.Collision)
    p3 := (*p3_p).(*ecs.Position)

    collidingX = IsOverlapping(p1.NextX, p1.NextX + c1.W, p3.NextX, p3.NextX + c3.W)
    collidingY = IsOverlapping(p1.NextY, p1.NextY + c1.H, p3.NextY, p3.NextY + c3.H)
    colliding = collidingX && collidingY

    if colliding { system.ResolveCollision(entities, e1, e3) }
  }
}

Anything I could do to solve that issue?

sentences: How to manage collision between balls in Game Maker 2 (Drag and Drop) Hey there I'm using Game Maker 2 Drag and Drop for a project, I made a game like Break Out and when the ball collides with the wall it doesn't bounce, in Game Maker Studio we had Bounce Action but in GMS2 is deleted, can anyone help me about this issue?

sentences:
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:
Do videogames use numerical solutions? Do video games often use numerical solutions in their calculations, such as you might generate using software like MATLAB or Mathematica?

Perhaps for making formulas for AI, or for game physics implementations?

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:
How to procedurally (create) grow an artistic (2D) tree in real-time (L-System?) Recently I programmed an L-system module, It got me interested further. I am a Plants vs Zombies junkie as well, really liked the concept of Tree of Wisdom. Would love to create similar procedural art just for fun and learn more.

Question: How should I approach the process of creating an artistic tree (2d perhaps with  fixed camera/perspective) dynamically?

Ideally I would like to start with a plant (only a stem with a leaf) and grow it dynamically using some influence (input/user action) over its structure. These influences may result in different type of branching, curves in branches, its spread, location of fruits, color of flowers, etc. Want it to be really full of life/spirit. :)

Plants vs Zombies: Tree of wisdom
It would be great to dynamically grow a similar tree, but with lot more variation and animations happening.

My Background: Programmer, have used few game engines (Ogre3d, cocos2d, unity). Haven't really programmed directly using openGL, trying to fix that :).

I am ready to spend considerable time, Please let me know about the APIs? and how would an expert like you would take on this problem?

Why 2D? I think it's easier to solve the problem only considering 2 dimensions.

Artistic inspirations:

Only the tree, with fruits and leaves, without the shrubs at the bottom

The large tree (visible branches, green leaves, flowers, fruits, etc) on the left, behind monkey.

PixelJunk's Eden (Art style inspiration).

Procedurally Generated Apple Tree using Fractals

Please let me know if it was easy for you to understand the question, I may elaborate further.

I hope a discussion of various approach would be helpful for everyone. You guys are awesome.

sentences: How do I make spring animation for a 2D game? I want to create a realistic spring object, as a sprite, that compresses and expands when a force is applied and released, respectively. The only thing I know is that it requires some complex animation, but have no idea how to do it. I'm using the Unity engine, but otherwise, it is a general question.

sentences:
Loss in quality on downsized sprites in Game Maker I'm having an issue with sprites quality in Game Maker.

I have some sprites used for UI with an original size of 2048*512. I need to resize them in game to 512*128. But when I do, I got a loss in quality.

This is the original picture, resized to 512*128 with a third-party software:

This is the sprite, as it appears in Game Maker room editor (and in game) once resized to 512*128:

Are there general guidelines for this kind of situation?

By the way, it's on Windows. Though I tried launching the game on an Android device and the result was the same.

sentences:
What is a Fragment Pipe? I remember someone saying "24 fragment pipes on nVidia 7800" in a presentation.

Am I correct in saying that a fragment is the data that can generate a pixel in the frame buffer? Or are fragments the same thing as pixels? I'm getting confused here.

What is a fragment pipe?

sentences:
How do I get 'getchar()' to not block the input? I am working on designing a pong like game but converting a getchar() to getch() and getche(), respectively, but getchar() is blocking the input. I am using C++ code, and while there is the ncurses library, I heard that this is a better approach; I am only needing to update this one command.

How do I get getchar() to not block the input?

The code is as follows:

#include<iostream>
#include <termios.h>
#include <stdio.h>

//Prototypes
char inputReader();
void updateWorld();
void renderWorld();
void initTermios(int echo);
void resetTermios(void);
char getch_(int echo);
char getch(void);
char getche(void);

static struct termios oldChars, newChars;
int main()
{
   bool running = true;

   do
   {
      if(getche() == 'q')
      {
         running = false;
      }
      updateWorld();
      renderWorld();
   }

   while(running);
   std::cout << "I exited the loop";
   return 0;
}

char inputReader()
{
   return getch();
}

void updateWorld()
{
  std::cout << "I am updating the world" << std::endl;
}

void renderWorld() {}

void initTermios(int echo) //struct termios &oldChars, struct termios &newChars)
{
  tcgetattr(0, &oldChars); /* grab old terminal i/o settings */
  newChars = oldChars; /* make new settings same as old settings */
  newChars.c_lflag &= ~ICANON; /* disable buffered i/o */
  newChars.c_lflag &= echo ? ECHO : ~ECHO; /* set echo mode */
  tcsetattr(0, TCSANOW, &newChars); /* use these new terminal i/o settings now */
}

/* Restore old terminal i/o settings */
void resetTermios(void)//struct termios &oldChars)
{
  tcsetattr(0, TCSANOW, &oldChars);
}

/* Read 1 character - echo defines echo mode */
char getch_(int echo)
{
  char ch;
  initTermios(echo); //oldChars, newChars);
  ch = getchar();
  resetTermios();//oldChars);
  return ch;
}

/* Read 1 character without echo */
char getch(void)
{
  return getch_(0);
}

/* Read 1 character with echo */
char getche(void)
{
  return getch_(1);
}

sentences:
Replay system: record inputs or events? I read this: How to design a replay system But it don't really answer my question.

My game is built with the client "view" of the game as a separate program from the server "model" and "controller". (a bit like a mmo, or any multiplayer game built this way).
The server side is always the "truth" of the game, it only accept action requests as input from the clients and output events and "current state" messages.

The game model and rules are fully deterministic with a fixed "tick" update cycle, so on the server side I can record both the events sent to the client views, and the action requests. Both are associated to specific cycle number.

The question is: in this case, to setup a replay system, should I use the input, or user action requests (as suggested in there) or the events?

It looks to me that both would give exactly the same output. The only differences I can see are:

Events gives the real output while action requests have to be processed to give events.
Action requests might be far less data to record.

Are there other things to consider?

sentences:
How to get position of CCSprite added to CCParallaxNode? I have a CCparallaxNodeExtras that scrolls infinite (following the space game tutorial). I added as a child a CCSprite made of other CCSprite, like this:

_backgroundNode = CCParallaxNodeExtras::node();
this->addChild(_backgroundNode,-2);

    float acum = 0.0;
    back1 = CCSprite::create();
    for(int i = 0; i < num_repeats; ++i) {
        CCSprite *back = CCSprite::createWithSpriteFrameName("rock.png");
        back->setPosition(ccp(acum, 0));
        back1->addChild(back);
        acum+= back->getContentSize().width+150.0;
    }

    _backgroundNode->addChild(back1,  1 , ccp(0.1,0.1), ccp(0, winSize.height * 0.64));

now in my update I have this:

CCPoint backgroundScrollVert = ccp(-1024, 0);
_backgroundNode->setPosition(ccpAdd(_backgroundNode->getPosition(), ccpMult(backgroundScrollVert, dt)));

perfect, the background moves and disappears (that is what I want for now) but I need to get the collision between the sprites on that background and a fixed sprite as a child of the main node.

The problem is that whenever I try to get the collision by the simple way (intersecting the bounding boxes) it doesn't work, so I tried to just get the position of the sprites and all I get is the position fixed in the CCSprite (back1) composed by the sprites (back).

Now, is there a possible way to get the position of any individual sprite located in that parallax node? If i try something like:

CCSprite *tempsprite = (CCSprite*)_backgroundNode->getChildren()->objectAtIndex(0);
printf("%f\n", tempsprite->getChildren()->objectAtIndex(0)->getPositionX());

it prints always the same value, it is like the position is not being affected by the transformation of the parent in the background node... so, how do I get it correctly? how do I get the position relative to screen and not to the parent?

sentences:
I cant get my interface to work This is my first time using interfaces so I imagine I'm doing something dumb.  I have an interface called ILoadable inside ILoadable.cs;

using UnityEngine;
using System.Collections;

public interface ILoadable {
    void AssetLoader();
}

I also have a couple scripts that implements the interface, here's the small one;

using UnityEngine;
using System.Collections;

public class InputRebinder : MonoBehaviour, ILoadable {

    string upKey;

    public void AssetLoader(){
        upKey = ",";
    }
}

Then I have a script that I want to call all the instances of AssetLoader throughout my game.

using UnityEngine;
using System.Collections;

public class InterfaceControl : MonoBehaviour {
    ILoadable loader;
    // Use this for initialization
    void Awake () {
        AssetInterface();
    }

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

    }
    void AssetInterface(){

        loader.AssetLoader();
    }
}

I want all my assets to load up when the game starts. Assets in this case being links to gameobjects, so I'm essentially running a bunch of gameobject.find~ and I want to be able to summon those at will. Instead of working as advertised I'm getting this error;

NullReferenceException: Object reference not set to an instance of an object
InterfaceControl.AssetInterface () (at Assets/Resources/Scripts/Interfaces/InterfaceControl.cs:18)
InterfaceControl.Awake () (at Assets/Resources/Scripts/Interfaces/InterfaceControl.cs:9)

Which I know means I need to have an instance of loader in my interfacecontrol script. I think I could probably put in

loader = new InputRebinder(); But I don't want to just call input rebinder I want to call any script that has the ILoadable interface.

'for reference, I was following the instructions on dotnetperls.com in the interfaces section.

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:
AI parameters for Tetris like game I am building an AI to play a variation of Tetris. The rules are changed in that there are 19 different types of pieces, rotation is not allowed, and the pieces can be placed anywhere in a 10X10 grid. Also, a line is removed once it is full (all 10 cells contain some block). I was trying to figure out which parameters I might choose in order to optimise how the game is played. Some obvious parameters which I thought of:

a) A piece should be placed in a position where it forms the maximum number of full lines, as they can be removed in the next step.

b) A piece should be placed to minimise the 'bumpiness' or roughness of the topmost surface, i.e, it should be as level as possible.

c) This is arguable, but the AI should try to keep as minimum height as possible.

d) The number of columns containing atleast one block should be minimised.

But the AI is still not playing good enough and keeps getting stuck. I would like to know if there are some other important parameters which I may be missing?

sentences:
How to create loading bar for asset bundles on Unity (without changing scene)? So from the official documentation and unity forum now I know that there's async version of LoadFromFile (that I also will probably call UnityWebRequest.GetAssetBundle later for updated asset). Now the problem is where can I call it, and how to get the .progress value, converting from this:

public AssetManager()
{
    if (!useAssetBundle) return;
    foreach (var bundle_name in bundle_names)
    {
        var full_path = Path.Combine(Application.streamingAssetsPath + "/Bundle/", bundle_name);
        var bundle = AssetBundle.LoadFromFile(full_path);
        if (bundle == null) LogHelper.Critical("Failed to load AssetBundle {0}", full_path);
        bundles[bundle_name] = bundle;
    }
}

To this (that obviously wrong):

private List<AssetBundleCreateRequest> loadPro = new List<AssetBundleCreateRequest>();

private IEnumerator<AssetBundle> _loadOneAssetBundle(string full_path)
{
    var creq = AssetBundle.LoadFromFileAsync(full_path);
    loadPro.Add(creq);
    yield return creq.assetBundle;
}

public AssetManager(MonoBehaviour parent)
{
    if (!useAssetBundle) return;
    foreach (var bundle_name in bundle_names)
    {
        var full_path = Path.Combine(Application.streamingAssetsPath + "/Bundle/", bundle_name);
        var bundle = parent.StartCoroutine(_loadOneAssetBundle(full_path)).assetBundle; // NOPE T_T)
        if (bundle == null) LogHelper.Critical("Failed to load AssetBundle {0}", full_path);
        bundles[bundle_name] = bundle; // NOPE 'n')
    }
}

public void Update()
{
    var progress = 0f;
    foreach (var pro in loadPro)
    {
        progress += pro.progress;
    }
    LogHelper.Debug("Progress %f",progress);
}

sentences:
why are my client and server physics not syncing up? node.js and html5 My server looks like this -

    var timestep = 1000/30;
    var delta = 0;
    var lastFrameTimeMs = 0;

    function panic() {
        delta = 0;
    }

    var update = function(){
        currentTime = Date.now()

        if (currentTime < lastFrameTimeMs + (timestep)) {
            setTimeout(update);
            return;
        }

        delta += currentTime - lastFrameTimeMs;
        lastFrameTimeMs = currentTime;

        let numUpdateSteps = 0;

        previousTime = currentTime;

        while (delta >= timestep) {
            player.update(timestep/1000)

        }
        delta -= timestep;

        if (++numUpdateSteps >= 240) {

            panic(); // fix things
            break; // bail out
        }
        setTimeout(update, 60)
    }
    setTimeout(update, 60)

and then my client looks like -

var timestep = 1000/30;
var delta = 0;
var lastFrameTimeMs = 0;

function panic() {
    delta = 0; // discard the unsimulated time
    // ... snap the player to the authoritative state
}

function mainLoop(timestamp) {
    // Throttle the frame rate.
    if (timestamp < lastFrameTimeMs + (timestep)) {
        requestAnimationFrame(mainLoop);
        return;
    }
    delta += timestamp - lastFrameTimeMs;
    lastFrameTimeMs = timestamp;

    let numUpdateSteps = 0;

    while (delta >= timestep) {
        if(player != undefined) {
            player.update(timestep/1000);
        }
        delta -= timestep;

        if (++numUpdateSteps >= 240) {
            panic(); // fix things
            break; // bail out
        }
    }

    requestAnimationFrame(mainLoop);
}
requestAnimationFrame(mainLoop);

I've been trying to get this work for days. I'm trying to have a fixed time step on both the client and server so they both simulate physics exactly the same down to the decimal point. But for some reason my client is moving much faster than my server. I used this article as a reference.

https://www.isaacsukin.com/news/2015/01/detailed-explanation-javascript-game-loops-and-timing

Where am I doing something wrong in one of my loops? They both use a .033333333333 timestep like I want them to, but they move at different speeds. What am I doing wrong?

sentences:
Even if one client port will be simple to write without it, should I still use an engine? So the idea is to create a TRUE REAL TIME strategy game that is working as android and IOS app, and also as  web browser game. Players should be able to play on all their devices.

There will not be any physics but there will be alot of data transfering, many diferent calculations, settings. There will not be client to client direct connection, everything should go trough servers. Graphics will be simple Menus/ different pictures. Player interactions will not be graphically presented. More like raw data.

Friend's chat, team chat, Maybe global chat. Facebook/Google connection/authorization. Notifications... etc

Now after I explained the idea here are the question:

Given that the browser client will be relatively simple to write without an engine (using javascript/html/sql), should I still use a game engine to write the different clients (browser, iOS, Android); if I can avoid using an engine for one port, should I avoid using an engine at all? And, more importantly, why?

sentences: how can I make camera to follow smoothly What I meant by slow parent is that I want the camera to not move immediately my third person controller moves so it won't look as though the earth is moving. The camera is the child of the player

sentences: How do I make gameobject flip and change position when player is facing left? I attached a  a gameobject labeled "Gun" to my player's back and when the player is facing left I want the Gun to continue to look like it's still attached to his back. Right now when I play the game and the player is facing left, the gun stays in the same position it was in regardless of what direction the player is facing. How do I make the gun look like it's still on the players back if facing left? (sorry if it sounds like idk what i'm doing... I'm sorta new to game dev.)

sentences:
Cross platform data format I've got a best/common practice question about cross platform development. We're developing a Unity game and we've got a custom data format (a modified jpeg) that a C# tool we developed pumps out and gets loaded into unity using a dll. We use some nice gdi+ tricks on Windows with this file format, however when we move this to the Mac, we're running into issues that we think is the mono implementation of gdi+ is missing something.

That aside we're not sure what the best practice moving forward is. Should we develop a new file format that works cross platform and is loaded the same on both systems, or should we use a platform specific data format that allows for the use of the C# tricks on Windows and maybe a different trick on Mac?

sentences:
Mixing DirectX headers with C mod project not working I'm trying to add a DirectX 11 renderer (not sure if that is even doable in a "simple" manner) to the Return To Castle Wolfenstein source code and I'm having some problems. I have a rendering class in a header that I included in the project, and whenever I include it in one of the RTCW files I get this error:

1>c:\program files (x86)\windows kits\8.1\include\um\directxmath.h(17): fatal error C1189: #error:  DirectX Math requires C++

Now I am wondering what would be a way to use DirectX math functions/classes (and all DirectX classes actually) in a C project such as the RTCW code? Is it possible to change the entire project settings so it compiles as C++? I am using Visual Studio 2017.

This is my renderer class declaration in XD3D.h header:

#include <d3d11.h>
#include <DirectXMath.h>
#include "XGeomObject.h"
#include "XCamera.h"

using namespace DirectX;

#define GPA(d3dModule, func) GetProcAddress(d3dModule, func)

class XD3DRenderer
{
protected:
    HMODULE                     m_XD3DModule;
    ID3D11Device*               m_pD3DDevice;
    ID3D11DeviceContext*        m_pDeviceContext;
    IDXGISwapChain*             m_pSwapChain;
    ID3D11RenderTargetView*     m_pRenderTargetView;
    ID3D11Texture2D*            m_pBackBuffer;
    ID3D11Texture2D*            m_pDepthStencilBuffer;
    ID3D11DepthStencilState*    m_pDepthStencilState;
    ID3D11DepthStencilState*    m_pDisabledDepthStencilState;
    ID3D11RasterizerState*      m_pRasterState;
    ID3D11DepthStencilView*     m_pDepthStencilView;

    HWND                        m_wnd;
    int                         m_screenWidth, m_screenHeight;
    bool                        m_fullScreen;
    D3DXMATRIX                  m_world, m_view, m_proj;
    bool                        m_lightMapsOn;

public:
    XD3DRenderer();
    XD3DRenderer(HWND wnd, int screenwidth, int screenheight,bool fullscreen);
    ~XD3DRenderer();

    ID3D11Device* GetD3DDevice() { return m_pD3DDevice; }
    ID3D11DeviceContext* GetDeviceContext() { return m_pDeviceContext; }

    bool LoadDriver();
    bool CreateD3DDevice(HWND wnd, int screenwidth, int screenheight, bool fullscreen );
    bool CreateRenderTargetView();
    bool CreateDepthBuffer();
    bool CreateDepthStencilView();
    bool CreateDisabledDepthStencilState();

    bool Setup();
    bool ClearScene(const D3DXCOLOR& col);
    bool Render(XGeomObject*, XCamera*);
    bool ShowScene();
    void TurnOnZBuffer();
    void TurnOffZBuffer();
};

And I include it in the C project in the RTCW win_glimp.c file like this:

#include <assert.h>
#include "../renderer/tr_local.h"
#include "../qcommon/qcommon.h"
#include "resource.h"
#include "glw_win.h"
#include "win_local.h"

#include "../renderer/XD3D.h"

extern void WG_CheckHardwareGamma( void );
extern void WG_RestoreGamma( void );

... rest of win_glimp.c file omitted.

sentences:
Circle vs. Rect Collision accuracy problem The blue ball is dynamic and is supposed to bounce off the walls, as well as the rectangle. Currently, the green rectangle is adding an invisible line to the scene, which doesn't let my ball go where I want it to. You can see the issue on the picture below and also see my source code.

Source code for dynamic circle vs. stationary rectangle collision:

public void collisionRect() {
                double dx = Math.abs(circle1.getLayoutX() - rect1.getLayoutX());
                double dy = Math.abs(circle1.getLayoutY() - rect1.getLayoutY());
                double rect1XRadius = rect1.getWidth() / 2;
                double rect1YRadius = rect1.getHeight() / 2;

                boolean xWalls = dx <= rect1XRadius;
                boolean yWalls = dy <= rect1YRadius;

                if (xWalls) { //if the ball hits any of the X walls
                    c1SpeedX = c1SpeedX * -1; //Invert direction of X
                }
                if (yWalls) { //if the ball hits any of the Y walls
                    c1SpeedY = c1SpeedY * -1; //Invert direction of Y
                }

            }

I don't understand where I've made a mistake and how I can make my code work. Source code examples will be greatly appreciated! Thanks.

sentences: How to "repeat" a sprite in the gameworld in a random fashion? I have a platform flash game which includes a level with just two backgrounds which are flipped side by side so that a looping background effect is created. In this I have to include Obstacles. Basically, when I designed the level, that was neat and good. But now I want to make the obstacles come randomly . Another factor is that since the player character in the platformer always keeps on running, if two obstacles come almost close together, it results in an impossible condition to win the game. So i need to avoid that too, without losing the factor of making the player think that the game is random.

sentences:
Unity3D - Screen Capture of particular UI elements How can I screenshot particular UI elements?

In my case I need screen capture UI Panel with child objects like UI Text, UI Input and etc.

Please take a look at picture. Thanks in advance

sentences:
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:
My player sprite get stuck to walls while moving along Hello,

My player sprite is moving along the wall (not even diagonal, just straight down) and get randomly blocked in the corner of some walls. By blocked, I mean that the Y movement is stopped.
If I move him away from the wall, he might not be blocked again by the same wall and get blocked at some other walls, always at a corner.

The walls are all the same sprite and are of the same size.

I use 2D Box Colliders for the walls. The player sprite has a Box Collider 2D and a RigidBody 2D. I am not using any physics codes, I would just like to make it work with the built-in Unity physics.

I move the player by adjusting the velocity of the rigidbody according to Input:

RigidBody2D rb = GetComponent<Rigidbody2D>();
float horizontal = Input.GetAxisRaw ("Horizontal");
float vertical = Input.GetAxisRaw("Vertical");
Vector2 movement = new Vector2(horizontal, vertical).normalized *speed * Time.deltaTime;
this.rb.velocity = movement;

The player is set like this:

Do you have any idea why it behaves like this and how I could fix it?

Thanks for your help.

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:
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:
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: Which is faster: raycasting or shadowcasting? I'm looking to create an FoV implementation and I was wondering which algorithm is faster - raycasting or shadowcasting?

sentences: How can I tell how much of a "scratch card" has been revealed? I have developed scratch card effect.I am now working on reward system, so my question is how will I go on and implement logic which will let me know that the object behind scratch card is now visible??

sentences:
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:
Event-driven vs state synchronizing networking model I was going through the Tribes network model and the network model used in Quake3. What I understand is that Tribes is more of an event based model where as the Quake model uses game states and delta game states to sync clients. Is my understanding right?

What kind of games do these models favor? Also what are the drawbacks of one model compared to the other. I am currently developing a two player First Person maze solver game and trying to choose between the two models.

sentences:
Programatically replace color gradient on sprite Say I have the following image:

I want to tint the yellow parts on this sprites shoulder/arms by a random color. In other questions on this site, they suggest using a chroma key and replacing the constant color with whatever color I wanted, but that solution wouldn't keep the gradient.

The other solution I've seen is that I should cut out the part I want to change the color of and make it an overlay. That would work, but would require a lot of effort since I have many poses for this character + animations.

Any ideas?

sentences:
How do I create weapon attachments? My question is; I am developing a game for XNA and I am trying to create a weapon attachment for my player model. My player model loads the .md3 format and reads tags for attachment points. I am able to get the tag of my model's hand. And I am also able to get the tag of my weapon's handle. Each tag I am able to get the rotation and position of and this is how I am calculating it:

Model.worldMatrix = Matrix.CreateScale(Model.scale) *
                    Matrix.CreateRotationX(-MathHelper.PiOver2) *
                    Matrix.CreateRotationY(MathHelper.PiOver2);

Pretty simple, the player model has a scale and its orientation(it loads on its side so I just use a 90 degree X axis rotation, and a Y axis rotation to face away from the camera). I then calculate the torso tag on the lower body, which gives me a local coordinate at the waist. Then I take that matrix and calculate the tag_weapon in the upper body. This gives me the hand position in local space. I also get the rotation matrix from that tag that I store for later use. All this seems to work fine.

Now I move onto my weapon:

Matrix weaponWorld = Matrix.CreateScale(CurrentWeapon.scale) *
                            Matrix.CreateRotationX(-MathHelper.PiOver2) *
                            TagRotationMatrix *
                            Matrix.CreateTranslation(HandTag.Position) *
                            Matrix.CreateRotationY(PlayerRotation) *
                            Matrix.CreateTranslation(CollisionBody.Position) *

You may notice the weapon matrix gets rotated by 90 degress on the X axis as well. This is because they load in on their sides. Once again this seems pretty simple and follows the SRT order I keep reading about.

My TagRotation matrix is the hand's rotation. HandTag.Position is its position in local space. CreateRotationY(PlayerRotation) is the player's rotation in world space, and the CollisionBody.Position is the player's world location. Everything seems to be in order, and almost works in game. However when the gun spawns and follows the player's hand it seems to be flipped on an axis every couple frames. Almost like the X or Y axis is being inversed then put right back. Its hard to explain and I am totally stumped. Even removing all my X axis fixes does nothing to solve the problem. Hopefully I explained everything enough as I am a bit new to this! Thanks!

sentences: AndEngine: Painting on a canvas rather than composing image from objects I'm trying to implement drawing a line with a finger, similar to a Pencil tool in image editors. From what I've found on AndEngine, it seems like the recommended approach would be to create a line entity on every finger move, from the previous position to the new one. To me it seems rather inefficient to mimic this raster tool by vector graphics: apart from creating tens on objects per simple swipe, I guess that all these objects are repainted on each frame which is bad for speed. So I'm looking for a way to do all the painting on a bitmap canvas and draw it as a single entity. Am I missing something conceptually or did I just overlook some method?

sentences:
change one object into another, and then back again in Unity For example, I would like to change a cube into a sphere, then change that sphere into a capsule, by pressing the up arrow. I would also like to be able to change in the other direction. Change the capsule into a sphere, then change the sphere into a cube, by pressing the down arrow. It would be great if i could add extra objects in, say a pyramid etc.

Ultimately i would want to do this with something like a seed, sapling, and tree. Each with there own properties.

sentences:
How to enable sound on Base Game Activity in Andengine? I am developing a game using Andengine , I am using a Base Game Activity with multiple scenes. I want to load a background music in it.But I dont know how to enable sound in engine while using Base Game Activity.I found this code in net to enable sound .

return new Engine(new EngineOptions(true, ScreenOrientation.LANDSCAPE,
   new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), camera).setNeedsMusic(true));

But this one is written in onLoadScene() and I dont know how to impliment onLoadScene() in basegame actvity.Do I can override onLoadScene() in base game activity or is there any other ways to achive this please help me...

Any Suggestions are Valid to me and Advanced thanks to alll....

sentences:
Understanding Send Message I'm trying to understand the Send Message Function but I'm a bit confused. Currently I have a game object character and I want it to send a message to the main body if one of its children hits something.

On the Child object, I have:

void OnTriggerEnter2D(Collider2D col) {

    Destroy(col.gameObject);
    Debug.Log(this.name + " Hit!");
    gameObject.SendMessage("PlayerHitting", this.name);

On the Parent Object, I have

public void PlayerHitting(string Move) {
    Debug.Log("Player hits with " + Move);
}

The Destroy code and Debug.Log on the Child work, so it is colliding, but I keep getting an error that there is no reciever.

SendMessage PlayerHitting has no receiver!
UnityEngine.GameObject:SendMessage(String, Object, SendMessageOptions)

I don't quite understand how to use Send Message to send messages and notices between objects. Can someone explain?

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:
Spawning prefab on touch after previous spawn(s) had been destroyed I wrote a script which pawns an object (instantiated prefab) each time the player touches the screen.
The maximum number of these spawned objects active in the scene at once is 3, and when they are not visible they will be destroyed. I need these prefabs to be able spawn again after they had been destroyed.
I tried this but it does not work...
This script is added to a game object called "canCreator" in my scene hierarchy:
public class CreatingCan: MonoBehaviour
{
    public GameObject Can;
    public int numberOfCans;
    public bool canSpawn = true;

    private void Start()
    {
        numberOfCans = 0;
    }
    void Update()
    {
        if (Input.touchCount > 0)
        {
            Touch touch = Input.GetTouch(0);
            Vector2 TouchPosition = Camera.main.ScreenToWorldPoint(touch.position);
            if (touch.phase == TouchPhase.Began && canSpawn == true)
            {
                if (Instantiate(Can, TouchPosition, Quaternion.identity))
                {
                    numberOfCans++;
                }
            }
        }

        if (numberOfCans >= 3)
        {
            canSpawn = false;
        }

    }

}

This script is on my can prefab:
public class fallingCan : MonoBehaviour
{
    CreatingCan CC;
    private void Update()
    {

        if (transform.position.x < Camera.main.transform.position.x - 10)
        {
            Destroy(gameObject);
               CC.numberOfCans--;
        }
    }
}

sentences:
Locking object access with Allegro's threading API If I have a data structure for the Allegro threading API as shown in the example here:

https://wiki.allegro.cc/index.php?title=Allegro_5_Tutorial/Threads

And I lock the mutex, is there a way to have one of the members of that data structure be a reference to an entire object that has read/write access to its public member functions locked?

That is to say, if I have a member variable which is a reference to a non POD-type object in that data structure, will locking the mutex restrict access to all of the object's members in another thread, or will it simply lock the reference itself from being modified?

sentences:
Network tilebased game updates design I have a top/down grid based multi-player game. So I have a 2D array on the server that holds the entire map and a much smaller 2D array on the client that holds only what the client needs to see of the bigger server map. For now we'll say the client 2D is 5x5 but the server is 400x400.

When the player starts, the server see's what tile it's on and gets the 5x5 area around the player (with the player being at the center of that) and sends the tile info to them. The client then updates their 5x5 array and draws the objects in the tiles. This is all great and working.

Now, when the player moves I want to basically always keep the 5x5 array updating around them, loading and unloading the objects in those tiles from the server. Now in reality it'll be bigger than 5x5 but I'm using this for testing purposes only since it's smaller to manage.

I don't want to always send the 5x5 array (will be larger in final version) to the player because it's a waste of bandwidth to do so. If the player moves right 1 tile then the majority of the information in their 5x5 array is still the same. Really it's only the right most column that changed and needs to be updated while every other column gets shifted 1 to the left. The same happens if they move up, down, left, or any of the diagonals.

The question I'm after would be around how the server can track and easily send just the changes of tiles for clients. So on the server I send tile updates once a second, NOT when they tell me they changed tiles. When I send them data I store their current position as last position, so this means I can get the 5x5 array from their last position (which this is what their 5x5 array looks like) and I can get the new 5x5 array from their current position. I the need to know what changed from the last position 5x5 array to this new 5x5 array and only send them those changes along with how to shift their 5x5 array around to match this new 5x5 array. Is there any neat tricks out there for comparing 2 2D arrays to find out such information? Does anyone have any other ideas on how to handle this situation? I'm open to new ideas around this.

sentences:
In Unity, what does the camera script's "Behaviour missing" error mean? I started in Unity few days ago and made a cube with a tank control style. Now I'd like to create controls similar to 3D fighting games (Gunz, Blade Symphony, …): Control body direction with the mouse and walk with WASD.

However, the Camera is giving me a error called "Behaviour missing" each time I try, with all the cameras scripts I saw. I think that is a error with tagging the character movement in the camera, but I don't know how to do that.

What might be the problem?

sentences:
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:
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: Unity Editor - Adding Object Fields on button click So I am trying to make a button that will spawn an object field and a float field when clicked. Each object field being unique, so I can add gameobjects to it. I can’t think of a way to do this. This is purely Editor Scripting. Also, if there is an option to delete a row (the object field and the FloatField) that would be amazing

sentences:
Unity3D : Creating & Sharing light-baked levels without updating the game I want to give myself freedom to add more levels after releasing the game. For creating levels I broke down structure and created a tilemap like a structure. here's an example :

I will add them up to create a level and send it to server from where I can download the JSON in game and read it at run time to place things around. The problem is I want to also use Global Illumination. What I can do is send lightmap data with created level to server and download and use it for lighting after generating level. But what If my map is huge?? I don't want to have lightmap size. The other thing I can do is create light baked prefabs, suggested by this article, https://unity3d.com/how-to/light-baked-prefabs-on-mobile. But every single object has to be attached to a surface and baked because of shadows. Is there a better approach?

Thank you.

sentences:
Best way of passing game data in functions? In most programs, if we want to do something to, say, Bob, then myFun(bob) is enough. We know that the function deals with Bob and won't touch Alice.

However, in a game, everything wants to freely interact with everything else:

Option 1

killTime(bob){
  cat=bob.getNeighbor().getPet();
  bob.talkTo(cat);
}

We are forced to have every piece of data hold reference to each other. Web-shaped dependency is hard to maintain, hard to serialize. Chained dots don't look nice, either.

Option 2

killTime(bob,neighborList, petList){
  alice = neighborList.findNeighbor(bob);
  cat = petList.findPet(alice);
  bob.talkTo(cat);
}

The argument list can get long, and it is not clear what should be included. What if we want Bob to read his poem written in his notebook hidden in his drawer?

Option 3

killTime(world, bob){
  cat = findTheCatYouLike(world, bob);
  talkTo(world, bob, cat);
}

Bob could do anything to world in his small talk, not necessarily a bad thing in a game. But it doesn't feel right passing the same world to every function. Also, if we use C, then we are forced to have pointer members instead of data in world, just to reduce the compilation time of #include "world.h"

I don't think any approach I found is good. What would be the least bad solution in this situation?

================== edit ================

To elaborate my question, suppose that we have a RPG system, with world map, characters with HP, MP, so on. Now we want a simple player.walk function. position+=velocity straightforward? Not really. What if we want footprints on map? What if we deal damage to units we pass by? We now need to touch everything in game to in order to walk.

In most programming scenarios, it is assumed that function and data are coupled to each other. Only these functions work on these data, and only these data are used for these functions. Put the functions and the data into a class, and it's high cohesion.

I am looking for an architecture where the opposite is true. I have a bunch of data (hp, mp , pos, vel), a bunch of actions (walk, attack, wait). That is all I can be certain of. I want the flexibility to change my mind everyday how the actions affect the data. In my code, I actually started with option 1 and gradually slid into option 3.

sentences:
HLSL Circle all white I have been trying to get my shader code (HLSL) to draw a simple circle but after a day and a half I am getting nowhere.  It seems people are using $$x^2 + y^2 = r^2$$ and remap texcoords but I only get a white quad.

    struct VertexShaderStruct
{
    float4 Position : POSITION0;
    float2 Tex0 : TEXCOORD0;
};

VertexShaderStruct VertexShaderFunction(VertexShaderStruct input)
{
    VertexShaderStruct output;

    float4 worldPosition = mul(input.Position, World);
    float4 viewPosition = mul(worldPosition, View);
    output.Position = mul(viewPosition, Projection);
    output.Tex0 = input.Tex0;

    return output;
}

float4 PixelShaderFunction(VertexShaderStruct input) : COLOR0
{
    float dx = 2 * input.Tex0.x - 1;
    float dy = 2 * input.Tex0.y - 1;
    float hyp = (dx * dx + dy * dy);

    return (hyp == 1)? circleColor : otherColor;
}

I define circleColor as blue and otherColor as white, so it seems hyp==1 always fails.

sentences:
Change alpha value of object if it's closer to the camera than the player Ok, so - I'm a complete idiot when it comes to shader programming, and while I suspect someone with some experience here may find this easy, I'm at a bit of a loss.

I'd like to create a shader that would be applied to walls, and if the wall was closer to the camera than the player is, the wall would gain alpha transparency (probably 10-20% visible).  I had tried some things with a camera that pans, zooms, and moves overhead as needed to not occlude the player, but it's sloppy and just doesn't feel very nice.  I had used an x-ray shader, that showed an outline of the player through the wall, and while it was "cool", it also didn't quite feel right.  The camera and player will always be a fixed distance and angle apart (well, at least at a given resolution).  Is there some way to use the draw buffer or otherwise calculate world space position to determine when alpha should be applied?

Any help is very much appreciated.  Thanks!

EDIT:  I was looking and found a lot of solutions like this one:  https://forum.unity3d.com/threads/global-shader-to-apply-transparency-on-objects-depending-how-far-is-the-camera.188632/

But I'd rather have it contained entirely in the shader.  Preferably something I could build into a copy of the Standard (Specular Setup) shader in Unity - that copy being applied only to wall objects.

EDIT #2: I understand that this could be done with two separate materials, using code to swap them with Raycasting (though it seems that that would only work specifically for objects directly between the camera and the player rather than objects closer to the camera than the player).  But I'm growing more uncertain that the shader can be told anything about the position of the player as an object.

sentences:
Change the tilemap shown on stage in Flixel I am building a simple platformer using Flixel, beginning with the source code from Flixel creator's EZPlatformer . I would like to adjust the level's tilemap when the player sprite enters/overlaps with a sprite representing a door. I use Flixel's built in function to track if the player overlaps the door sprite.

exits is a class level variable: public var exits:FlxGroup;

I call this function in the Update event to check for overlap:
FlxG.overlap(exits,player,UpdateScreen);

I successfully catch when they overlap, however when I try and load the new tilemap, the old one continues to show. I use this function to attempt to update the tilemap on the screen:

public function ChangeScreen():void
        {
            //load the screen and locations of sprites(e.g. player, exits) based on current screen
            switch(currentScreen)
            {
                case 1:
                    //load tilemap
                    level = new FlxTilemap();
                    level.loadMap(FlxTilemap.arrayToCSV(data1,40),FlxTilemap.ImgAuto,0,0,FlxTilemap.AUTO);
                    add(level);
                    break;
                case 2:
                    //load new tilemap
                    level = new FlxTilemap();
                    level.loadMap(FlxTilemap.arrayToCSV(data2,40),FlxTilemap.ImgAuto,0,0,FlxTilemap.AUTO);
                    add(level);
                    break;
            }
        }

I thought that I would need to first call remove on level to take it off the stage, and then call add on it, however, when I do that, the tilemap does not show up at all. What is the correct way to do this?

sentences:
(Pacman) Loading 151 dots (picturebox) in form. What's the easy way? I'm making pacman clone for school project and I'm having a bit of a struggle with loading dots into the map. I want to put 151 dots (picturebox) onto a map to a specific location, so that later on I could check if there is collision between Pacman and dots using function intersectWith.

I feel like this isn't really the most friendly way of doing it, but currently I don't have any other idea.

So, how does one put many picturebox on a form (if there is a way), and put them in array where I could check for intersection.

This is just some brief, probably wrong code, how I'm imagining this to work:

for(int i = 0; i < 151; ++i)
{
    dot[i] = Resources.dot;
    drawingArea.Load(dot[i]);
}

Thank you all!

sentences:
Questions for QueryAABB I'm currently having trouble getting my head around QueryAABB, and hope to find some answers here.

The LowerBound of an AABB the upper-left corner (and vice versa). Why is that and what idea is behind that?
When exactly does an object count as inside the AABB and is therefor found by a query?

sentences:
Can a local UDK server have two clients connected locally? To do some basic testing on players interacting with other players I would need to have at least two players in my world. My solution is to run the server from my computer, then run two clients. When I run the second client and connect to the server, I find a weapon dropped by client 1 in the appropriate position(but no body). What happened?

server.bat:
C:\UDK\UDK-2015-01\Binaries\Win32\UDK.exe server ieTestMap?GoalScore=0?TimeLimit=0?Game=ie.ieGame  -log

client.bat:
C:\UDK\UDK-2015-01\Binaries\Win32\UDK.exe 127.0.0.1 -log

class ieGame extends UTDeathmatch;

simulated function PostBeginPlay()
{
}
defaultproperties
{
    bScoreDeaths=false
    PlayerControllerClass=class'ie.iePlayerController'
    DefaultPawnClass=class'ie.iePawn'

    bDelayedStart=false
    GameReplicationInfoClass=class'ie.ieGameReplicationInfo'
}

class iePlayerController extends UTPlayerController;
reliable client function ClientSetHUD(class<HUD> newHUDType)
{
    if(myHUD != none)
        myHUD.Destroy();

    myHUD = spawn(class'ieHUD', self);
}
defaultproperties
{
}

I have kept the other classes of my game 'bare-bone.'

sentences:
Why is my perspective layer is painted over ortho layer? The entire game takes place in ortho with the exception of the background layer which is drawn on a perspective camera.

Everything seems to be working well except that the background is displaying over the orthographic layer. I've tried fidgeting with the layers, orders and depth of cameras but I'm coming up dry.

Take a look at the pics and you may see what I mean.

sentences: Change back to initial value of rotation? I have a sprite that I can rotate and I wonder if there is a way to change the rotation back to the initial value?

sentences:
Unreal Engine 4.15 Error C++ | ERROR: UBT ERROR: Failed to produce item UE4Editor-ProjectName.dll I've already tried installing the Windows 8.1 SDK, but that did not work. Any Help? I'm running on windows 10 using visual studio 2017. I got this error when I created the project.

Error Log:

The project could not be compiled. Would you like to open it in Visual Studio?

Running C:/Program Files/Epic Games/UE_4.15/Engine/Binaries/DotNET/UnrealBuildTool.exe ThisIsGoingToWork Development Win64 -project="C:/Users/AaronX/Documents/Unreal Projects/ThisIsGoingToWork/ThisIsGoingToWork.uproject" -editorrecompile -progress -NoHotReloadFromIDE
Performing full C++ include scan (building a new target)
Creating makefile for ThisIsGoingToWork (no existing makefile)
@progress push 5%
Parsing headers for ThisIsGoingToWorkEditor
  Running UnrealHeaderTool "C:\Users\AaronX\Documents\Unreal Projects\ThisIsGoingToWork\ThisIsGoingToWork.uproject" "C:\Users\AaronX\Documents\Unreal Projects\ThisIsGoingToWork\Intermediate\Build\Win64\ThisIsGoingToWorkEditor\Development\ThisIsGoingToWorkEditor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -installed
Reflection code generated for ThisIsGoingToWorkEditor in 8.3515565 seconds
@progress pop
Performing 9 actions (3 in parallel)
[2/9] Resource ModuleVersionResource.rc.inl
[3/9] Resource PCLaunch.rc
PCH.ThisIsGoingToWork.cpp
ThisIsGoingToWorkGameMode.cpp
ThisIsGoingToWorkCharacter.cpp
ThisIsGoingToWork.cpp
ThisIsGoingToWork.generated.cpp
[8/9] Link UE4Editor-ThisIsGoingToWork.dll
[9/9] Link UE4Editor-ThisIsGoingToWork.lib
   Creating library C:\Users\AaronX\Documents\Unreal Projects\ThisIsGoingToWork\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-ThisIsGoingToWork.lib and object C:\Users\AaronX\Documents\Unreal Projects\ThisIsGoingToWork\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-ThisIsGoingToWork.exp
   Creating library C:\Users\AaronX\Documents\Unreal Projects\ThisIsGoingToWork\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-ThisIsGoingToWork.suppressed.lib and object C:\Users\AaronX\Documents\Unreal Projects\ThisIsGoingToWork\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-ThisIsGoingToWork.suppressed.exp
ThisIsGoingToWorkGameMode.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl AGameModeBase::SetPause(class APlayerController *,class TBaseDelegate<bool>)" (?SetPause@AGameModeBase@@UEAA_NPEAVAPlayerController@@V?$TBaseDelegate@_N$$$V@@@Z)
ThisIsGoingToWork.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl AGameModeBase::SetPause(class APlayerController *,class TBaseDelegate<bool>)" (?SetPause@AGameModeBase@@UEAA_NPEAVAPlayerController@@V?$TBaseDelegate@_N$$$V@@@Z)
C:\Users\AaronX\Documents\Unreal Projects\ThisIsGoingToWork\Binaries\Win64\UE4Editor-ThisIsGoingToWork.dll : fatal error LNK1120: 1 unresolved externals
ERROR: UBT ERROR: Failed to produce item: C:\Users\AaronX\Documents\Unreal Projects\ThisIsGoingToWork\Binaries\Win64\UE4Editor-ThisIsGoingToWork.dll
Total build time: 92.21 seconds (Local executor: 0.00 seconds)

sentences:
How can I access a script variable from another script in Unity? I'm creating a space shooter (think Space Invaders or Galaga) where the GameManager persists between scenes but the player and enemies don't. I need to access a boolean value from the player and enemies to define when and how the game should end. The PlayerController script contains a playerDead variable (attached to the Player GameObject) to tell the GameManager if the player has died and a enemiesDead variable to tell if all enemies have died.

Because the GameManager persists but the others don't, it loses the references when a new level is loaded. I tried to have the GameManager find the script references dynamically, to no avail. It always errors with Object reference not set to an instance of an object when a new level is loaded.

I've tried to get them with GameObject.FindGameObjectWithTag() and then using GetComponent<ScriptName>() to get the script and the variable in it. It compiles nicely and everything seems dandy, but then there's still no object reference. Am I just doing it wrong?

So how can I reference a script and get a value from it without even touching the Inspector?

EDIT:

Below is some code (everything else except the essential is scrapped) from the GameManager script, I tried to use Object.FindObjectsOfType() like this:

GameObject player;
GameObject enemies;

void Awake()
    {
        DontDestroyOnLoad (gameObject);
    }

void Start ()
    {
        Reinitialize ();
    }

void Update ()
    {
        if (enemies.GetComponent<EnemyGrid>().enemiesDead == true)
        {
            gameEnd = true;
        }

        if (player.GetComponent<PlayerController>().playerDead == true)
        {
            gameEnd = true;
        }
    }

void Reinitialize()
    {
        player = Object.FindObjectOfType(typeof(PlayerController)) as GameObject;
        enemies = Object.FindObjectOfType (typeof(EnemyGrid)) as GameObject;
    }

But there's still no object reference. My intention was to run the Reinitialize() funtion each time a new scene was loaded, so that way the GameManager would grab the new objects each time.

sentences:
Ice transition particle effect We are small indie team developing a casual mobile game.
We are trying to implement an effect like the normal-to-ice block transition in Angry Birds 2:

How can we implement an effect like this in Unity?

sentences:
What are the most common ways of closing an open world? In many open world games, there are several ways to limit them. From original ones such as Desynchronisation(Assasins' Creed) to invisible walls.

What are the most common ways to close open worlds?

sentences: Jagged shadows with default settings This is what it looks like no matter the settings I use when I try to use shadows in Unity. Changing the Bias or the Normal Bias does effect the shadows, but I cannot get the shadows to be smooth with any settings. Making the model bigger does fix this, but I would optimally not scale the model up, as it is already at 10.

sentences:
Inverse Distance Weighted interpolation between N Vector3s in Godot I have a number of Vector3s in Godot arranged in a grid, let's say they look like this (looking at them from above, with Godot Y-is-up):
z
|(0,6,2) (1,5,2) (2,3,2)

|(0,2,1) (1,A,1) (2,3,1)

|(0,2,0) (1,3,0) (2,4,0)
--------------------------x

I would like to interpolate the center Y-value marked as A based on the surrounding vectors. The thing is, the center value is not bound to the grid, so it can be closer to the lower left corner for example, so I want to weight the interpolated value based on the distance to each vector.
So, is there some clever trick in Godot using built in functions, or do I need to implement my own Inverse Distance Weighting-code?

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:
How to create custom cubemap images? I managed to use cube maps in OpenGL to get reflection and refraction effects. So far I used images from this site, however, I want to create my own set of images to use in a cubemap, the idea is just to have checker-board patter on the "floor" and the rest of a solid color.

My question is, how can I create the 6 images in order to get the cube map textures?

EDIT

I want to be able to achieve something like this picture (on top) but without the cube, sphere and so on.

sentences: Why doesn't the Source engine clear the back buffer? In the Source engine, when the map does not have a sky box, I see that typical artifact from the back buffer not being cleared. Why does the Source engine do that? Is it a performance reason, or something like that?

sentences:
Finding specific coordinates on a rotating line I'm currently working on a mobile game which mainly consists of a rotating line and a ball. The line rotates 0.500 degrees clockwise around its center every frame. The ball is at first positioned in the centre of the line. When the user touches the screen, the ball should move along the line and when the user stops touching the screen the ball should move in the opposite direction.

I have the line rotation, and the coordinates of the line(top-left corner).

I need to find the position of the ball if the ball moves along the line at a speed of 5.

sentences:
Unity: Hiding Game Objects vs Creating them My game project involves collecting items that will be displayed in trophy cases of sorts.

There could be several hundred objects as the scale of the project increases, each with their own position, rotation and scripts.

I would find it easier to place the assembled items in their correct location using the editor and set their canvas group alpha to 0 (and set booleans in the script to inactive etc) and 'activate' them when they are 'collected' rather than instantiate them from prefabs as GameObjects.

My main question is about performance, is it costly to have my Gameobjects set in scene & created but set to 0 alpha? I don't need these objects to move or be destroyed etc.

My second question is about best practices for architecture design, is this a horrible way to do things? is a workaround for instantiating prefabs just lazy and counterproductive?

sentences:
Alternatives to distance fog I'm looking for some ideas/algorithm name for alternative to distance fog.

I'm playing around an "infinite" terrain engine. I can't draw the whole map because there are no borders and I don't like the idea of hiding the terrain at a distance with fog.

sentences: How do I maintain an online users list? In a multiplayer JavaScript game client, is it a good idea to poll the server periodically to refresh online user list, or keep track of joined/left users? Is there a better option?

sentences:
How would I move an object using its velocity on a closed curve? I want that an object follows a path, in Peggle game there are some pegs that have
movement in a closed path. How can i get the same result? I guess that I can use parametric curve but I need use the velocity and not the position (x, y).

I use NAPE and I have this in my gameloop:

//circunference
angle = angle + 1*(Math.PI / 180);
movableBall.position.x = radius * Math.cos(angle)+ h;
movableBall.position.y = radius * Math.sin(angle)+ k;

It works but I can not control the velocity, each movableBall must have its own velocity.
Besides, from docs of NAPE:

  "Setting the position of a body is equivalent to simply teleporting
  the body; for instance moving a kinematic body by position is not the
  way to go about things.."

I want to use:

movableBall.velocity.x =??
movableBall.velocity.y = ??

The final idea is to follow others paths like the Lemniscate of Bernoulli.

sentences:
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:
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:
Implementing traffic conditions in TORCS I am working on a project about "Effects of Traffic conditions and Track Complexity on Car Driving Behavior".

Is it possible to implement traffic in TORCS, or should I use another car simulator? By the word "traffic" I mean there are cars running on both tracks in both directions and I can detect the distances, direction and speed of these cars. Depending on this information I can decide whether I should slow down, speed up and calculate the correct timing to overtake.

sentences:
Multiple Sprites using foreach Collison Detection in XNA (C#) Back again from my last question.  Now I was curious I use a foreach statement to use the same shot class.  How would I go about doing collison detection.

I used the tutorial here on how to shoot a fireball
XNA Development: Game Development for the masses.

I tried to put in several places a foreach to look at all of them to see if they have reached the borders of my sprite hero but doesn't seem to do anything.  If again some one might know of a good site that has tutorials to explain collision detection a little bit better that would be appriecated.

sentences:
Loading a stream/asset on Android MonoGame without ContentManager In the game I am developing, I have created a serializable class that generates a .map file for saving and loading levels. In XNA, this works great using the following code:

FileStream fileStream = new FileStream(filePath,
                FileMode.OpenOrCreate);
BinaryFormatter formatter = new BinaryFormatter();
MapInfo data = (MapInfo)formatter.Deserialize(fileStream);

Unfortunately, in android it appears that the filePath ends up at the device's root (argument being passed in as "Content/maps").
After some research, I came across this page from xamarin that explains how to properly load assets from the asset folder. However, this action takes place in a separate namespace from my main activity, and so far have not found a way to access the Assets.Open() function.

any other ways to load that asset?

UPDATE:
After playing around some more, I ended up trying to pass the Assets property of the main activity down through function calls, loading the file this way:

Stream fileStream = androidGame.Assets.Open(filePath);
BinaryFormatter formatter = new BinaryFormatter();
MapInfo data = (MapInfo)formatter.Deserialize(fileStream);

SADLY, the file still does not load. Looking at the variables in debug shows the correct address for the activity contained in the variable androidGame, but says Open is an "Unknown member"

UPDATE WITH WORKING SOLUTION:

In case anyone comes across file loading issues in Monogame Android, this is what I ended up doing:

First, make sure you copy/reference your files in the correct dir of your android build. This should appear somewhere under Assets/Content/yourfile.file or subfolder.

Then, check the properties of the file and select "AndroidAsset" for build options and "Copy if newer" for output.

Finally, open the stream using the Assets property of your main activity. This can be accessed using your Microsoft.Xna.Framework.Game class in this way:

Stream fileStream = Game.Activity.Assets.Open(path);

Turns out my issue was not the stream itself, but the deserialization which could not open a .dll in android (overlooked that one...). I ended up switching to XML serialization, since the binary serialization is build dependent

sentences:
Separating part of mesh facing upwards I really hope you can help me fix this code:
List<Vector3> verticesToExport = new List<Vector3>();//vertices of the triangles facing upwards.
        List<int> trianglesToExport = new List<int>();//new triangle facing upwards.
        //meshToCut is the original mesh, then I just try to replace it with the new data.
        int[] triangles = meshToCut.triangles;
        Vector3[] vertices = meshToCut.vertices;

        for (int i = 0; i < triangles.Length; i += 3)
        {
            Vector3 corner = vertices[triangles[i]];
            Vector3 a = vertices[triangles[i + 1]] - corner;
            Vector3 b = vertices[triangles[i + 2]] - corner;

            float projection = Vector3.Dot(Vector3.Cross(b, a), Vector3.down);
            if (projection > 0f)
            {
                verticesToExport.Add(vertices[triangles[i]]);
                verticesToExport.Add(vertices[triangles[i + 1]]);
                verticesToExport.Add(vertices[triangles[i + 2]]);
                trianglesToExport.Add(triangles[i]);
                trianglesToExport.Add(triangles[i + 1]);
                trianglesToExport.Add(triangles[i + 2]);
            }
        }
        meshToCut.SetVertices(verticesToExport);
        meshToCut.SetTriangles(trianglesToExport, 0);//probably I'm doing wrong here!

It works great by retrieving the vertices facing up, and I guess the triangles too but when I put it into a mesh filter I believe the triangles are not in order...
1.The model I'm trying to separate; the triangles facing upwards.

2. This is what happens if I just take the vertices and triangulate them again. It proves that vertices are alright!

3. The result I get from the code above:

sentences:
How can I change the script so it will not be with a while loop inside Update or using coroutine instead? The script is working fine as it is and I don't fell any performance problems and yet I wonder if it's a good idea to run a while loop inside the Update function ?
The idea is to be able to move an object over a curved lines with a lot of positions in any speed.
So I'm calculating how much positions there is next each time and it's working fine I just wonder about the while in the update.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.AI;

public class MoveOnCurvedLines : MonoBehaviour
{
    public LineRenderer lineRenderer;
    public float speed;
    public bool go = false;
    public bool moveToFirstPositionOnStart = false;

    private Vector3[] positions;
    private Vector3[] pos;
    private int index = 0;
    private bool goForward = true;
    private List<GameObject> objectsToMoveCopy = new List<GameObject>();

    // Start is called before the first frame update
    void Start()
    {
        pos = GetLinePointsInWorldSpace();

        if (moveToFirstPositionOnStart == true)
        {
            transform.position = pos[index];
        }
    }

    Vector3[] GetLinePointsInWorldSpace()
    {
        positions = new Vector3[lineRenderer.positionCount];
        //Get the positions which are shown in the inspector
        lineRenderer.GetPositions(positions);

        //the points returned are in world space
        return positions;
    }

    // Update is called once per frame
    void Update()
    {
        if (go == true)
        {
            Move();
        }
    }

    void Move()
    {
        Vector3 newPos = transform.position;
        float distanceToTravel = speed * Time.deltaTime;

        bool stillTraveling = true;
        while (stillTraveling)
        {
            Vector3 oldPos = newPos;
            newPos = Vector3.MoveTowards(oldPos, pos[index], distanceToTravel);
            distanceToTravel -= Vector3.Distance(newPos, oldPos);
            if (newPos == pos[index]) // Vector3 comparison is approximate so this is ok
            {
                // when you hit a waypoint:
                if (goForward)
                {
                    bool atLastOne = index >= pos.Length - 1;
                    if (!atLastOne) index++;
                    else { index--; goForward = false; }
                }
                else
                { // going backwards:
                    bool atFirstOne = index <= 0;
                    if (!atFirstOne) index--;
                    else { index++; goForward = true; }
                }
            }
            else
            {
                stillTraveling = false;
            }
        }

        transform.position = newPos;
    }
}

sentences:
openGL Camera setup for Zoom in/out centered at point under cursor I am trying to implement a zoom in/out navigation mode in a openGL 3dViewer. I was able to implement zoom functionality centered at screen center just by moving eye towards the center in perspective mode.

Now i am trying to do the zoom centered at arbitrary position under the cursor. I am unable to figure out how should i move my camera forward and backward such that point under cursor remains at the same screen coordinates after zoom in/out. Any help would be appreciated.

Below are the images which show the desired effect. Just to mention, I am working in a perspective mode with eye target and up vectors to control camera.

Same effect i found in google sketchup and 'zoom to mouse position' setting in blender.

sentences:
Problems with rendering in 3ds Max I am working on a project in 3ds Max, but when I render the project it looks very weird. See this picture for an example:

How can I fix this?

sentences: Using DualShock 4 motion sensor in Unreal engine (windows) Anyone know how to access the gyro/accelerometer values from a DualShock 4 controller in the Unreal engine (under windows)? Are there any plugins that do this? Does raw input work?

sentences:
Display musical symbol (unicode) in Text component not working? I downloaded and specified to use a unicode font that supports musical symbols (Musica), but when I set the text value of the Text component to "" nothing is displayed? I tried using the unicode code point with \U as well. What is going wrong?
(I could not get TextMesh Pro working either with that symbol.)

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:
Should I render all of my HUD views to a single SurfaceView? I'm using a SurfaceView and canvas to implement a game HUD, title screens etc., by overlaying standard Android view widgets over my SurfaceView. This works reasonably well and maintains an acceptable frame-rate, but it is a simple game with little happening on or off screen.

I have handlers flinging messages around and runOnUiThreads everywhere. Quite cumbersome. Can I draw all my views to the one SurfaceView, controlled by the main game thread? Is there an advantage to this?

sentences:
Is linear filtering possible on depth textures in OpenGL? I'm working on shadow maps in OpenGL (using C#).
First, I've created a framebuffer and attached a depth texture as follows:
// Generate the framebuffer.
var framebuffer = 0u;

glGenFramebuffers(1, &framebuffer);
glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);

// Generate the depth texture.
var shadowMap = 0u;

glGenTextures(1, &shadowMap);
glBindTexture(GL_TEXTURE_2D, shadowMap);
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, 1024, 1024, 0, GL_DEPTH_COMPONENT, GL_FLOAT, null);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, shadowMap, 0);

// Set the read and draw buffers.
glDrawBuffer(GL_NONE);
glReadBuffer(GL_NONE);

Later (after rendering to the shadow map and preparing the main scene), I sample from the shadow map in a GLSL fragment shader as follows:
float shadow = texture(shadowMap, shadowCoords.xy).r;

Where vec3 shadowCoords is the coordinates of the fragment from the perspective of the global directional light source (the one used to create the shadow map). The result is shown below. As expected, shadow edges are jagged due to using GL_NEAREST filtering.

To improve smoothness, I tried replaced the shadow map's filtering with GL_LINEAR, but the results haven't changed. I understand there are other avenues I could take (like Percentage-Closer Filtering), but I'd like to answer this question first, if only for my sanity. I've also noticed that other texture parameters (like GL_CLAMP_TO_EDGE rather than GL_REPEAT for wrapping) don't function for the shadow map, which hints that this may be a limitation of depth textures in general.
To reiterate: Is linear filtering possible using depth textures in OpenGL?

sentences:
Constant Buffer size mismatch on PS, fine on VS and GS I have the following C/C++ struct:

struct ShadowMapCB {
        Math::Matrix4 cropMatrix[4];
        Math::Matrix4 textureMatrix[4];
        float splitPlane[4];
    };

and my HLSL constant buffer:

cbuffer CBShadowMap : register(b4)
{
    matrix g_CropMatrix[4];
    matrix g_TextureMatrix[4];
    float g_fSplitPlane[4];
};

When i bind it to pixel shader i get an error:

  D3D11: WARNING: ID3D11DeviceContext::DrawIndexed: The size of the Constant Buffer at slot 4 of the Pixel Shader unit is too small (528 bytes provided, 576 bytes, at least, expected). This is OK, as out-of-bounds reads are defined to return 0. It is also possible the developer knows the missing data will not be used anyway. This is only a problem if the developer actually intended to bind a sufficiently large Constant Buffer for what the shader expects.  [ EXECUTION WARNING #351: DEVICE_DRAW_CONSTANT_BUFFER_TOO_SMALL ]

and infact the last 4 floats (array[4]) are messed up, the weird thing is that on the VS and GS it works fine..., and yes i did bind them with PSSetConstantBuffers and update it ofcourse.

What could be causing this?

sentences:
Cascading Shadow Maps - Spotlight Projection In all the cascading shadow map explanations I have read, the final projection into the shadow-map is done using an orthographic projection.
This makes sense for a directional light because a directional light "sees" things orthographically.

Spot lights on the other hand "see" things with a perspective transformation. Once we have our light space bounding volume, should we be performing the final projection into the shadow-map using the spotlight's projection matrix, rather than an orthographic projection matrix?

Perhaps I am missing the point here. Cascading shadow maps are necessary to provide shadow maps over large areas, thus because spotlights tend to have a very limited area of effect, perhaps cascading shadow maps are not necessary for spotlights.

sentences:
Unity scene has phantom models in every scene new and existing a like even when deleted I have asked about this over at Unity Forums but have not got a response yet.
My issues is that in the image below all there is is a light source but several of my monster models are in the scene somehow. I cannot select them or interact with them in any fashion. The are there whether it is an existing scene or I create a new scene.
If anyone has any clue what this is from it would be a great help because it is driving me madd!
Thanks!

sentences:
How do I create a view matrix directly from a quaternion and a position vector? Given a quaternionic camera such that:

typedef struct
{
    vector3 upReference;
    vector3 rightReference;
    vector3 forwardReference;

    vector3 position;
    quaternion orientation;

    float pov;
} camera_t;

Where:

upReference, rightReference, forwardReference are always (0,1,0,
1,0,0, 0,0,-1) respectively
pov is the viewing angle

and quaternion is:

typedef struct
{
    float x, y, z, w;
} quaternion;

Is there some way to create a view matrix directly from all of this and skip gluLookAt?

sentences:
Procedural Islands Voronoi Pattern I'm trying to keep this as simple as possible, as I've found out the last few days this is a very difficult topic. I'd like to generate multiple flat islands, formed by a voronoi diagram. I've followed a long and (for me) difficult tutorial of building a procedural hexagonal grid just to find out it looks to artificial.

I'd like to create a plane with faces divided in a voronoi diagram, and extrude multiple groups upwards to create islands. With that I'd like to achieve something similar as this: http://applemagazine.com/wp-content/uploads/2015/10/image2.jpg

Please help to get me started in the right direction, since my approach might be wrong in itself.

EDIT:

I've found this: https://github.com/jceipek/Unity-delaunay. Which draws lines in a voronoi diagram. Now I'm guessing the next step is to convert this to a mesh. Then I'd have to highlight random faces to be extruded to create the islands. Maybe this could be done with perlin noise, which I've just learned about. Extruding might not be the best way. Maybe deleting the faces that won't be land, and creating fall of edges (Like Wardy said).  I'm doing my best to figure this out on my own, but any help is greatly appreciated.

sentences:
Raycasting from an object to the center of the screen (crosshair) without clipping through objects Am trying to learn about Raycasting, and I thought I would start with something simple, and that was a laser that would come out of an object (think laser pointer in your hand) and always go to the crosshair.

Using ViewportToWorldPoint I found it easy to cast a ray from the center of the camera, but this had an issue as you can see in this GIF below.

The line would clip through because the ray was coming from the center, not off to the side where the laser pointer would be.

Am not sure how to solve this.

void Update(){
    Vector3 ray = Camera.main.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 0f));

    line.SetPosition(0, transform.position);

    RaycastHit hit;

    if(Physics.Raycast(ray, Camera.main.transform.forward, out hit, raylength)){
        if(hit.collider != null){
            line.SetPosition(1, hit.point);
        }
    } else {
        Vector3 pos = line.GetPosition(0);
        line.SetPosition(1, ray + (Camera.main.transform.forward * raylength));
    }
}

The closest thing I could find that I am trying to replicate for this exercise is the No Man's Sky mining tool

sentences:
Unity and the problem with calling functions from other scripts I'm not sure how everyone handles this, but I'm running into lots of instances where I want to call a nonstatic script from another script which forces me to add the nonstatic script to the gameobject that also handles the other script. Such as, I would have two classes in different scripts:

public class Example1:MonoBehaviour{
public void someMethod(){
}
}

    public class Example2:MonoBehaviour{
public void anotherMethod(){
}
}

if I wanted to call anotherMethod from someMethod, I would need to do this:

   public class Example1:MonoBehaviour{
    private Example2 exampleTwo;

void Awake(){
exampleTwo = gameObject.AddComponent<Example2>();
}
        public void someMethod(){
exampleTwo.anotherMethod();
        }
        }

Is this really how everyone is working? It just seems extremely long and complicated, making me attach a whole bunch of scripts to one gameobject at runtime, and then I run into a whole bunch of issues with multiple copies of each script (such as with mousedown functions or input functions).

sentences:
How can I generate Worms-style terrain? I'm working on a Worms-styled game and want to generate some terrain procedurally. I've previously done a lot of terrain generation using perlin noise, and this is what I started out using for this game. The only problem with it is that it's too simple and boring, giving me some hills but not the complexity I want. I'd like to have features like caves and hanging mountains and I don't mind floating islands and such. Something like this, but even crazier would be ok:

I thought of first generating the terrain using classic perlin noise, then just removing parts to create caves and what not, but I'm having trouble guiding the removal of those parts. Are there any alternatives to generating such a terrain?

sentences:
Cloth effect to boned model for XNA I'm currently working in virtual dressing project using kinect. I'm using a dress model with bone created in blender and added that to xna, placed on the customer and controlled the product movements like hand, leg using the kinect skeleton data.

I would like to add some cloth physics effect to the model like flying and shaking. What would be a best way to accomplish this. I have surfed a lot and found that can be done using physics engine but no idea about which engine and how?

Can I create the cloth effect in blender and add that to xna? or else whether I need to add some engine like bullet and Physx inside xna and create that cloth effect manually.

sentences:
What is a good file format for saving game data? I need to save some custom game data.  Map, player, etc.

All of them will have "sub objects".  For example,  a map and map will have an "array" of tiles.  ie, hierarchical data.  Hopefully nothing binary.

What would be a good format for these?

So far I'ved considered:

Serailization: This is FAST and easy, but tends to break when I change the underlying classes :(

XML: I really hate parsing this.  My test case was over 100+ lines of code and seemed likes tons of "busy work" for even a very simple format.

INI: would be really clumsy for hierarchical data.

Protobuf: Never used it, but read you have to do a lot of manual mucking around and breaks if you change the class.

Other options? That's why I'm here!

Edit: this is Java btw.

Edit 2:

I settled on "Controlled Binary Serialization" (see below).

Pros:

it's fast
it's small (on disk) and can be easily compressed/decompressed during read/write.
it's super easy to read/write from game and toolset.
I can decide what to include/exclude of the object.
Objects/Data can be nested.

Cons:

Can't edit it by hand (like XML, YAML, etc)
Can't easily read/modify it with scripts
Java Serialization by default is pretty slow/bloated compared to other implentations, but it's stable and works

sentences:
UDK : Problem with Touching Actors In my game I am trying to see all touching actors of a particular DynamicSMActor and it does return only two Actors as touching Actors - Water Volume and Player Pawn. It is ignoring all the other DynamicSMActors that are touching. I actually tried different values for collision type, Blocking type, etc,. No success.

Any help is really appreciated.

sentences:
Collision detection not working on some parts of mesh Racing game with a single mesh to act as a collider for all the track sides. Recently revised the mesh and now it is behaving strangely. The player correctly collides (bounces off) some parts, on other parts it is hit and miss whether the collider works and on others the player acts like there is no collider present at all.

I have checked that all the meshes normals are facing the correct direction and that there are no gaps in the mesh.

I have set the collisions on the player rigid body to be continuous.

Can anyone suggest what might be happening?

I was previously using the exact same technique but re-created the collider mesh to clean it up and upon importing from Blender into Unity the collider behaviour is now all over the place.

This picture shows part of the collider where the player just passes straight through the walls.

Car collider in Unity:

Track mesh collider in Unity:

sentences:
UDK, can you add your own effects? I'm new to game development and am curious to know if you can add your own cg effects? Like if I wanted to add fog to my game and UDK didn't support that, is that possible?

What kind of coding does one do, in a engine like UDK?

sentences: LibGDX, Box2D , Destroy body into parts I am developing a game using libGDX game engine and box2d physics engine. There are asteroids in my game, I want to destroy their bodies randomly and fill with texture. How can I do it?

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 Would You Animate a 3d Characters Face (With Textures) So I'd like to do a low poly style of modeling, and one of the corners I'd like to cut is on head geometry. Specifically, making the details of the face a texture (like a Mii or a character in Animal Crossing for example).

How would you go about accomplishing animating the face? Getting it onto the model in the first place?

I'm using Unreal Engine to learn and working on my 3d modeling skills at the same time, so knowing a general workflow would give me some structure to work with.

sentences:
Unit collision avoidance for RTS I'm developing an RTS, and having a little difficulty with collision detection.  From what I understand RTS generally don't bother with collision detection and just try to avoid collision, and that is what I am trying to accomplish.

My game uses a grid for static obstacles, but units are not bound to the grid for movement.  How do I allow for units to avoid collisions, both with static obstacles and with other units?  Right now my workaround is to redirect units around static obstacles every time they move from point to point (and every time a new obstruction is placed on map, units replan their routes).  This doesn't seem like an ideal solution, but it works.  I have no idea how to handle unit-unit collisions.

sentences:
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:
Replicating a worldspace sphere on screen space I have quite some struggle with a post processing shader that I'm working on.

I use Unity, and I have a shader in which I want to, in screen space as part of post processing, render a sphere that looks like it was drawn in world space.

Now, I've tried some different approaches.

For all attempts, I've given the shader a world position of the sphere,a screen position of the sphere and a camera position named:

uniform float4 _SpherePositionCamera;
uniform float4 _SpherePositionCamera;
uniform float4 _SpherePositionWorld;

That is, the same point in respectively world-space camera-space and screen-space.

I've tried to project the fragment in screen space into camera space using the inverse projection matrix, and tested in the xy coords minus the screen space center of the sphere are of length < 1. This gives a circle on the screen that does not really follow a world space shere very well.

the vertex program of the gc code is

v2f vert (appdata_img v){
                v2f o;
                o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
                o.uv = MultiplyUV (UNITY_MATRIX_TEXTURE0, v.texcoord.xy);
                o.camPos = mul (inverseProjection, float4((o.uv * 2) - 1, _SpherePositionCamera.zw));
                return o;
            }

And the fragment program is

        fixed4 frag (v2f i) : COLOR
        {
            // Get the original screen color
            fixed4 screenColor = tex2D(_MainTex, i.uv);

            if ( length(_SpherePositionCamera.xy - i.camPos.xy) < 1 )
            {
                screenColor = ( screenColor + fixed4(1,0,0,1) ) / 2;
            }

            return screenColor;
        }

I have been working on this for quite some time, so I'm sorry if I'm somewhat failing at explaining the problem, but I hope that someone has some pointer to what I'm missing.

Thanks.

EDIT

I figured a better formulation. I think it might be done by casting a ray from each fragment and testing for intersection with the sphere in world space.

So all I need now is to construct a ray that originates from the near clipping plane and is directed in the "projection" orientation.

could this easily be done?

sentences:
Optimized algorithm for line-sphere intersection in GLSL Well, hello then!

I need to find intersection between line and sphere in GLSL. Right now my solution is based on Paul Bourke's page and was ported to GLSL this way:

// The line passes through p1 and p2:
vec3 p1 = (...);
vec3 p2 = (...);

// Sphere center is p3, radius is r:
vec3 p3 = (...);
float r = ...;

float x1 = p1.x; float y1 = p1.y; float z1 = p1.z;
float x2 = p2.x; float y2 = p2.y; float z2 = p2.z;
float x3 = p3.x; float y3 = p3.y; float z3 = p3.z;

float dx = x2 - x1;
float dy = y2 - y1;
float dz = z2 - z1;

float a = dx*dx + dy*dy + dz*dz;
float b = 2.0 * (dx * (x1 - x3) + dy * (y1 - y3) + dz * (z1 - z3));
float c = x3*x3 + y3*y3 + z3*z3 + x1*x1 + y1*y1 + z1*z1 - 2.0 * (x3*x1 + y3*y1 + z3*z1) - r*r;

float test = b*b - 4.0*a*c;

if (test >= 0.0) {
  // Hit (according to Treebeard, "a fine hit").
  float u = (-b - sqrt(test)) / (2.0 * a);
  vec3 hitp = p1 + u * (p2 - p1);
  // Now use hitp.
}

It works perfectly! But it seems slow... I'm new at GLSL. You can answer this questions in two ways:

Tell me there is no solution, showing some proof or strong evidence.
Tell me about GLSL features (vector APIs, primitive operations) that makes the above algorithm faster, showing some example.

Thanks a lot!

sentences: Box2d How to connect distance joint to the ground? I have a rectangular fixed size world. I want to connect a body inside it to any place(near that body) in the world with a b2DistanceJoint. Do I need to create a large static body with the size of the world that can't collide with anything? Or is there a better method? Will it slow down simulation speed if I have around 300 bodies moving on the surface of this static body?

sentences: Android build has white image over game In unity when I am playing my game it displays fine, but when I build and run it to my nexus 5 there is this white something I don't even know over my game. Any suggestions for fixes?

sentences:
Finding average input value over time in seconds I'd like to find the average input value from a controller over the last n seconds (say the last 0.1 seconds) and do this every frame.

I can see how to do this for the past n frames by storing a list of values for the last n frames and averaging that total every frame, but I want to account for a variable frame rate as the resulting output is driving a character controller and should feel precise and consistent. I tried storing a list of value pairs containing the input value and delta time value for every frame, then counting back through the list of delta time values until they sum to n seconds, then using the total of those input values to work out the average, but it seems a bit clunky and means I have to guess how big the list should be to store enough values, is there a better way?

sentences: Getting correct direction of the Car I am building a car racing game using the coordinate system in which I have enemies's cars and the player cars. I want to ask that what is the best way to find the the direction of enemies's cars so that they would facing the player's car and move towards the player's car.

sentences:
Pre-calculating skeletal animation data I'm working on skeletal animation and so far I've got the skeleton drawn with interpolated animation working (just on the cpu still). I was thinking about changing my file format for my skeleton and animations to have fully calculated matrices stored.

Right now I calculate my matrices recursively by multiplying the parent's world matrix(absolute matrix) by the childs joint matrix, same thing with each frame of animation. I think it would be a good idea to just export all of this pre-calculated to my model format so I could just send these matrices to the shader for skinning.

Is there any reason I should not do this?

Edit: Calculating the matrices is negligible by itself on a rather small skeleton anyway but is there any reason I should calculate them at run time or just pre-calculate in my file format?  I think this sums up my question better.

sentences:
How to rotate to a target position over time I know how to do rotations to vectors, but how do I rotate over time?

For instance say I made a function

RotateTo(vec2 iPosition, float iTime);

so it rotates to iPosition over iTime - how would this look? Does anyone know simple algorithm?

sentences:
Is it bad practice to store inventory and scores in PlayerPrefs? I'm building a mobile game for a client in Unity. To save time, we started with a template game from the Asset Store that had some of the features that the client wants.

The game includes a progression system and shop, so we save the user's scores,  progress, in-game currency, inventory, etc. We currently have no plans to export the save data.

The template game uses PlayerPrefs to store all save data. Is this bad practice? Assuming we don't include a button that calls PlayerPrefs.DeleteAll(), is there any extra risk associated with using PlayerPrefs instead of external files to store the player's data?

sentences:
How to build a math module and simulate a system? For example, in the classical game SimCity:

an economic model to simulate the supply and demand of the city, then calculate how many people live in each building, how many people work there.
a traffic model to simulate the commute time of the citizens,
in another game, there'd be a whole stock market, where the player and sim-citizens can buy and sell.

Obviously, we cannot simulate every single citizen, every single car, every single trader in the market, we need some math modules and formulas.

I'm making a fake SimCity and almost finished the graphics parts. Now I'd like to know how to do the math parts, or how to build such math modules.

sentences:
How to do smooth sprite movement on WP7 XNA What's the correct technique for getting smooth sprite translations with XNA?

I've been developing the WP7 version of an app for a startup, so when we heard Angry Birds got ported today we wanted to check it out and compare. Angry Birds on WP7 had the sub-pixel blur problem with the bird sprites, whereas iPhone, Android, and Chrome all had smooth movement.

sentences:
Using copyrighted sprites Possible Duplicate:
  How closely can a game resemble another game without legal problems

I was thinking about making a pacman clone, I know there is a similar question here Using Copyrighted Images , but I know i can't use the original art from the game because it belongs to Namco, so if I design a character that has the shape of the slice circle it will look exactly like pacman, maybe if I use green instead of yellow?
Also if the game plays like the original pacman, it is wrong?
I just want to make the game as a personal project and and publish it in my site without getting in trouble

sentences:
problems getting a new position vector3 could someone explain to me why i can't get a new position that is outside the update method.

if i set what's inside the void callposic to a Start I can't get any position, only if it's inside the update

what can you do, because I don't want to use them in the update board.

https://www.youtube.com/watch?v=aNzJ5GUYAOA&feature=youtu.be

public int index;
public Vector3[] posic;
void Start()
{
    prev.onClick.AddListener(() => void1(-1));
    next.onClick.AddListener(() => void1(1));
    index = 0;

}

void Update()
{
    callposic();
}

void callposic()
{
    transform.localPosition = posic[index];
}

void void1(int value) { index = index + value; }

}

sentences: 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:
Is this technique for stat tracking without a database workable? If I wanted to create a chess game, for iOS, that tracked both player moves (for retracing the progression of a game and for player stats), what would be the simplest route to take?

To clarify, I want to track not only the moves a player has made in a particular game, but how often that player has made that move in past games. For example I want to be able to track:

How many times a given player has opened by moving the king pawn up two squares (e4) as white, on move number one.
What is the percentage of time the player responds to white's e4 opening move, with moving his own king pawn to e5?
What percentage of time does he respond by moving his queenside bishop pawn to c5?

And so on. If it's not clear, the stat tracking system should also be able to report how many times this player, as black, move his queen to h1, on move number 30.

I'm using Parse.com for my back-end as a server (BaaS) service. If I were to create a class that

writes strings that identify move number, player color, moved piece, algebraic notation of the square (e.g. "d8") to a file, locally in the file system
saves the file to Parse, and deletes the temporary file from file system
upon opening the same game in my tableview (a la a "With Friends" game), download this file from Parse, parse through it and retrieve all stats/history, assign all relevant values to variables

Is this plan viable, or is there an easier way?

sentences:
Size of .skp gets doubled after importing to Unity I have created a 3D model in SketchUp, and it is about 1.6Mb in size. After importing it to Unity, the size more than doubled to 4Mb.

Why is that?

sentences:
What Scala-oriented game frameworks exist? I'm looking into Scala game development, and wondering if there are any game frameworks oriented towards it, rather than Java.

Java has Slick2D and LWJGL, but they do not take advantage of Scala features.

sentences:
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:
Set the LineTraceByChannel to use my custom created channel? C++ I want to use LineTraceSingleByChannel function for my SightRay component which will be used for my adventure game. I want to mark certain objects in game as 'Viewable' in Trace Channel. Then the ray will only be true if it hits a 'Viewable' object.

I have created the Viewable trace channel in the Collision settings of Project Settings. But I have two problems now.

In the actual c++ code I am writing, how do I reference this new 'Viewable' channel in the ECollisionChannel parameter of the method?
How do I assign this channel to each object in the scene?

I have been trying to figure this out for hours, I've read many Unreal documentation pages and forum threads but can't get a straight answer, particularly without using Blueprint nodes.

Here is my code:

bool USightRay::GetLineTraceHit(FHitResult &OutHit)
{

FVector LineStart = UGameplayStatics::GetPlayerCameraManager(this, 0)->GetCameraLocation();
FVector LineEnd = LineStart + UGameplayStatics::GetPlayerCameraManager(this, 0)->GetCameraRotation().Vector() * LineTraceLength;
//ECollisionChannel viewable =  WHAT CAN I PUT HERE?????
if (GetWorld()->LineTraceSingleByChannel(OutHit, LineStart, LineEnd, viewable))
{
    UE_LOG(LogTemp, Warning, TEXT("HIT ME WITH YOUR RHYTHM STICK!"));
    return true;
}

return false;
}

I actually thought this would be simple before I started to code it. I've used it before but I just used ECollisionChannel::ECC_Visibility  in place of 'viewable'. This time I want to learn to filter the collisions and traces properly.

Thank you for any help.

sentences:
What causes SDL2 error 0xc00007b when running my game on other people's computers? I made a game using SDL2 and made it available for download.
However, I first tried to install and play it on a different computer, to no avail. I made sure to copy all the .dlls and install all the runtimes, yet I still get error 0xc00007b.

Am I doing something wrong?

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:
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:
Quality deterioration on a device I am using Unity. When I try the game out in the IDE everything looks pretty good:

But when I am trying to play the same game on a device the quality becomes a great deal worse and you can see it for yourself:

I am using Xiame Redmi 4X and I do not think that it is because of device.

So, how can I fix it? How can I preserve the quality?

I would like to try out this solution, but there is no Android settings in my Inspector for quality:

I would like to preserve at least colors.

And here are setting for my player sprites:

sentences:
Using LibGDX, is it necessary to clip what I'm rendering for efficiency? So I am working on a game, and I've noticed that everything in the world is sent to be rendered. Of course with the camera, only some of the world is rendered.

Does this mean there is there any expense for when I send all those extra vertices to OpenGL that don't show up on screen? Will OpenGL/LibGDX do it automatically?

If I should clip it, is ScissorStack the way to go?

sentences:
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:
Efficiently calculate 2d world position based on parent(s) recursively I am writing a small 2d html5 game engine in javascript that relies on the concept of a hierarchy. The scene is the root node or entity, and its children make up the game objects. These children can have other children, recursively. Every entity has a relative position and an absolute position. By relative, I mean in object space, and by absolute, I mean in world space - based on its own and its parents' transformations.

To calculate the world position of an entity, all I have to do is apply its transformations (translation, rotation and scale), and that of its parent, and of its parent's parent, to its local/relative position up until the root entity of the hierarchy.

The problem I'm having is when to calculate this the most efficient way. Should I calculate the world position every time I get its worldX or worldY properties? What about every time the position, scale or rotation properties of the entity or any of its parents are set? Or is there a completely different way?

Note: along with knowing an entity's world location, I also need to know its world bounding box.

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:
How to rotate a 3D character on top of a plane with an isometric picture on it How to calculate the angles of the 3d charater so that it fits into the isometric environment projektet on a 2d plane?
Also, how do you calculate the rotation of my character?
What I want to achieve:

Describing the scenario:

sentences:
Space between randomly generated objects Im not sure there is a going to be a simple answer for this question but Ill ask anyway. I am programming an endless scrolling game where the player's character is constantly "falling." As they fall  they dodge pinecones. I want the program to randomly generate pinecones (which it does right now); however, I need a way to check that there is enough space between pinecones so that the player's path is never accidentally blocked.

Simply programming a minimum distance between pinecones isn't hard. The problem is that I want to  allow some cones to be right next to each other, but still check to make sure there is space between others for the player to safely dodge pinecones. Basically, I do not want an equal amount of space between each pinecone all the time.

I've considered making a grid pattern that the pinecone spacing must abide by, but Im having trouble comparing spaces on the grid so that while some cones are allowed to be next to each other, others are not. If the question is unclear let me know and Ill try to explain better and include pictures or something.

sentences:
How do I make a more or less realistic water surface? I want to make a similar water surface like in this picture:

I need the water surface in the same view than in the picture. Is it possible to work without shaders?
I want to develop a little game for Xbox Live Indie Marketplace, Windows Phone and maybe later iPhone/iPad.

How should I make the water surface, so that it works on multiple platforms?

sentences:
Matrix transforms in XNA So in my most recent 2D game I draw objects like so.

  _spriteBatch.Draw(_sprite, Center(), null, Color.White, _rotation, new Vector2(_sprite.Width / 2, _sprite.Height / 2), _scale, SpriteEffects.None, 0);

My bounding boxes are generated using a two step algorithm where I make the transform matrix, then apply it to a Rectangle of the sprite's height and width.

    public Rectangle BoundingBoxTransformed
    {
        get
        {
            //Center and rotate our Rectangle

            Matrix m = Matrix.CreateScale(_scale) *
                Matrix.CreateTranslation(new Vector3(new Vector2((float)-BoundingBox.Width / 2, (float)-BoundingBox.Height / 2), 0.0f)) *
                Matrix.CreateRotationZ(_rotation) *
            //Move our rectangle toward the player, then recenter it by undoing the original translation (now that it's already rotated)

                Matrix.CreateTranslation(new Vector3(_location, 0.0f)) * Matrix.CreateTranslation(new Vector3((float)BoundingBox.Width / 2, (float)BoundingBox.Height / 2, 0.0f));
            return CalculateBoundingRectangle(new Rectangle(0, 0, _sprite.Width, _sprite.Height), m);
        }
    }

This is how I've been finding the new sizes for the scaled bounding boxes.

   public static Rectangle CalculateBoundingRectangle(Rectangle rectangle,
                                                       Matrix transform)
    {
        // Get all four corners in local space
        Vector2 leftTop = new Vector2(rectangle.Left, rectangle.Top);
        Vector2 rightTop = new Vector2(rectangle.Right, rectangle.Top);
        Vector2 leftBottom = new Vector2(rectangle.Left, rectangle.Bottom);
        Vector2 rightBottom = new Vector2(rectangle.Right, rectangle.Bottom);
        // Transform all four corners into work space
        Vector2.Transform(ref leftTop, ref transform, out leftTop);
        Vector2.Transform(ref rightTop, ref transform, out rightTop);
        Vector2.Transform(ref leftBottom, ref transform, out leftBottom);
        Vector2.Transform(ref rightBottom, ref transform, out rightBottom);
        // Find the minimum and maximum extents of the rectangle in world space
        Vector2 min = Vector2.Min(Vector2.Min(leftTop, rightTop),
                                  Vector2.Min(leftBottom, rightBottom));
        Vector2 max = Vector2.Max(Vector2.Max(leftTop, rightTop),
                                  Vector2.Max(leftBottom, rightBottom));
        // Return that as a rectangle
        return new Rectangle((int)min.X, (int)min.Y,
                             (int)(max.X - min.X), (int)(max.Y - min.Y));
    }

I thought that I had the transformations all figured out, but when I run the game, I can see that my bounding boxes do not match up with my sprites.

So what is it that's going on here? Are my transformations out of order? Quick edit: The purple boxes are the original bounding boxes, which are used to determine the height and width of the red (transformed, i.e. scaled and rotated) bounding boxes.

sentences:
How can I start the game with a random formation? public class SquadFormation : MonoBehaviour
{
    enum Formation
    {
        Square, Circle, Triangle
    }

    [Header("Main Settings")]
    public Transform squadMemeberPrefab;
    public int columns = 4;
    [Range(4, 100)]
    public int numberOfSquadMembers = 20;
    public float yOffset = 0;
    [Range(1, 20)]
    public int numberOfSquads = 1;
    [Space(5)]
    [Header("Formations")]
    public int squareSpace = 10;
    public int circleSpace = 40;
    [Range(3,50)]
    public float moveSpeed = 3;
    public bool randomSpeed = false;
    [Range(3, 50)]
    public float rotateSpeed = 1;
    public float threshold = 0.1f;
    public bool destroySquad = false;
    public string currentFormation;
    public bool startRandomFormation = false;

    private Formation formation;
    private List<Quaternion> quaternions = new List<Quaternion>();
    private List<Vector3> newpositions = new List<Vector3>();
    private bool move = false;
    private bool squareFormation = false;
    private List<GameObject> squadMembers = new List<GameObject>();
    private float[] step;
    private int[] randomSpeeds;
    private int index = 0;
    private int numofobjects = 0;

    // Use this for initialization
    void Start()
    {
        numofobjects = numberOfSquadMembers;
        if (startRandomFormation)
        {
            formation = UnityEngine.Random.Range(1, 3);
        }

In this case I have 3 formations. But it might later more or less formations.
Making this line is has no sense:

formation = UnityEngine.Random.Range(1, 3);

The idea is to start randomly with one of the 3 formations.

How can I get the number of formations ? The count in the enum ? And how can I select randomly one formation ?

sentences:
How can I open the map in Skyrim using Papyrus or SKSE? While making a mod for Skyrim, I'd like to allow a player to chose a location to teleport to.

Essentially, I'll be:

enabling Fast Travel if disabled
changing fast travel speed so that the travel happens near instantly in game time
opening the map to allow player to select destination
resetting fast travel speed, disabling fast travel if appropriate

It's the third dot point I need help with. I can work out the others with Papyrus script, but is there a way to open the Map using Papyrus or SKSE?

sentences:
Spotlights and Pointlights not working with Unity Render Pipeline? I'm experimenting with URP, Render Pipelines, and Shaders for the first time recently and have noticed something odd. In the scene I'm building, Point Lights and Spotlights don't work. No matter what I do, they do not affect the environment at all, for static and nonstatic objects. I can't even use a Halo component to visualize them. They exist in the scene but don't do anything and even Lightmaps don't seem to register them.

I suspect that it's because of the render pipeline, but if I go to a blank scene and put a spotlight on an object, it works. I'm just very confused what's happening.

Any idea what might be happening?

sentences:
Movement & arriving using forces 3D. Given a point mass m, inital position p0 initial velocity v0, and a desired location d, how do I apply forces (with magnitude no greater then fMax) to move m to d and stop. I know how to apply forces, it's the strategy for determining what force to apply each frame.

You would think this would be easy - but it's turned out to be difficult.

A solution that only converges at the limit is not acceptable (i.e. having the mass oscillate back/forth over the destination by smaller and smaller distance)

Edit: This is not the same as this question. Finding the stopping distance is trivial, but is (maybe) only part of the solution.

Edit: Also not the same as this question, because the highest answer is incorrect (as stated by my constraints)

sentences:
What is the purpose of the stencil buffer ? More precisely, what is a stencil in computer graphics? I read the stencil word a lot, and I don't have a clue what is its real purpose in computer graphics.

Seeing the picture in black and white on wikipedia, I'm still having problem with it.

Why do we use a stencil or a stencil buffer, and what is the difference with a Z-buffer ? Why using this word which seems to have some meaning in graphic design ?

sentences:
How to make Procedual Context Sensitive Mesh Generation during Runtime In the game that i am trying to make i essentially generate an infinitely generating maze that has no dead ends and each corridor is of the same width.

i have successfully managed to create this system however once i have created the floor tiles on which you are supposed to walk on i need to generate some walls. these walls surround the floor tiles preventing you from leaving the floor tiles. the system that i have for making these walls right now is very inefficient and redundant so, i would like to find a better way of doing so.

my current system for making these walls:

first, a Floor Builder lays out all the required floor tiles then i have a wall builder game object with numerous empty games objects in a single row that each have a script attached to them that checks if there is a collision on their current tile. if there is a floor tile nothing happens else a wall game object is spawned which is essentially a 1x1x1 cube that has a collider attached to it. once all the checks have been done the parent game object is move 1 tile upwards and the process repeats itself.

once the player is out of range of the walls that are left behind a garbage cleaner game object just destroyed them.

this system can be improved in terms of code by using arrays instead of multiple game objects however that would still not improve the performance since the cause of the performance drop on slower devices it that a lot of game objects have to be spawned and tracked. the whole system is very inefficient and produces about 100 to 500 game objects which are destroyed later on.

i have attached a picture to give an idea of how the system works ignore the cubes and other entities.

there are also other solutions i have looked into and made

Single line Builder:

basically, at the boundary, i put a single game object that starts and stops when a player is nearby or not it goes from right to left checking each 1 unit of space for a floor tile and spawning a wall if there isn't. this was a much more efficient but slow solution which i later improved on.

Smart Single line Builder:

its mostly the same as the previous one however once it is in an empty spot it fires a raycast on its left side and when that ray hits a floor tile it uses the information obtained with its current coordinates to make a single row big wall instead of multiple walls this system worked much better but was still so slow that the player is able to run faster than the system can make walls.

The kind of system that i would like to have:
a simple quad that sits below the floor tiles and moves along with the player.
the quad is essentially pulled upwards in places where there isnt a floor tile. i have no idea how to make something like this.

sentences:
Draw multiple LINE_LOOPs in one glDrawElements call The game I'm working on has OpenGL (2.1) vector graphics, and I need to draw up to 1000 enemies, each of which is composed of between 4 and 100 lines.

Each enemy can be drawn as a single line loop, so one strategy for drawing would be to call glDrawElements(GL_LINE_LOOP, ...) once for each enemy. This results in too many (up to 1000) calls of glDrawElements per frame.

Another strategy would be to separate the line-loops that form each enemy into individual line segments, and call glDrawElements(GL_LINES, ...). This results in a lot of repeated vertices though, which I would like to avoid.

Is there a way to draw multiple line loops in a single call to glDrawElements (or with some other function)? I guess I would need some indicator in the vertex/element array to mark where each line loop ended.

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:
D3D12 ConstantBuffer - Shader receives wrong values im having trouble with one constantbuffer:

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

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

inside the shader its defined like:

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

}

now viewdir is always filled with wrong buffer indices.

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

checked it in the shader like:

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

GPU Debugging shows that the constant buffer looks fine:

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

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

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

sentences:
How do I make volumetric grass? I've been extremely interested in volumetric technology, especially for grass.

Online resources are extremely scarce on this topic.

What is the difference from creating a lot of mesh billboards?
Is this shader based technology or simply a geometry type of generator?
How do I create something like this?

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:
Communication in a simple GUI (C++ / SDL2) I've spent a few months now working on a fairly simply 2D game engine with SDL and C++. I'm now trying to develop a simple but well-featured GUI suitable for most games.

Right now I'm really struggling on figuring out how I should handle communication between the GUI and the other parts of the game / engine that might want to use it.

For example, the "shop" game state may have a list of items that I want to display on a shop GUI, along with their prices and quantities, i.e "Wooden sword / 30GP / 5". Obviously I need to get this information to the GUI in order for it to be useful, along with a way of notifying the shop component which item has been clicked/given focus. Seeing as the internal representation of an object such as an "item" or an "inventory" can vary wildly, how do I get the data I want to/from the GUI in a way that doesn't require excessive coupling between the two components?

I'd really appreciate anyone's advice on how to approach this issue, and I fully appreciate that my understanding is flawed.

Finally, I'm set on developing it from the ground up as a learning exercise, so I'm not really interested in GUI libs for SDL (it seems none of them are updated for SDL2 anyway).

Thanks in advance

sentences:
Problems moving a rectangle in Pygame I'm making a game in Pygame and I want to be able to target enemy unit.
I made it so when I click on them a variable "targeted" becomes true, and stays true until I click somewhere else on the screen. I also want targeted units to have a small green circle around them, so I made it in GEDIT. I have made a function that draws everything on the screen (the background, the player, objects, etc) and in the part where it draws the units it checks if the variable "targeted" is true and if  it is it should move that little green circle over the enemy units.

here is the code that does that:

screen.blit(enemy_unit.pic, enemy_unit.rect) #draw the unit

if enemy_unit.targeted == True: #if the unit has been targeted then draw a circle over it
    target_rect.move_ip(enemy_unit.pos)  #move the circle to the unit
    target_rect.fit(enemy_unit.rect)     #there are some bigger units and some smaller ones, so we have to "scale" the circle
    screen.blit(target_pic, target_rect) #actually draw the circle

This doesn't work, when I target the unit the circle just appears for a 1/5 of second next (not on, but just next) to the unit and then disappears. I am sure that I am keeping a good track of "enemy_unit.pos" because I tested it (I added a piece of code that would print one units position and mouse's position every time i clicked the mouse and when i was near him the numbers were same).

If you could give me a hint about what I'm doing wrong. I think its in move_ip function, but I tried just move and it didn't work either (the circle didn't even show at all)!

sentences:
How to prevent clients from stuttering while keeping the game in sync in multiplayer Pong? I wrote Pong in multiplayer. The clients all run their own game, but I have an authoritative server which enforces its ball position onto the clients.

The game is in sync and playable, however, there is some stuttering on the client side even with a fast connection. I've read that clients could be configured in a way that shows a smooth experience to the player, while in fact the connection may be lagging.

I was thinking about not directly correcting the ball position when a server position update comes in, but to increase or decrease the ball's velocity based on the difference. I didn't manage to get this working properly yet.

Am I thinking in the right direction? How would I make a calculation that shows a smooth experience to the players, while keeping the game in sync?

sentences:
How to make footsteps sound sync with animation (FMOD/Wwise/similar) How do you pros out there implement footstep sounds in so that they're synced with character animation?

I have an idea in mind: an FMOD event that has two footstep playback triggers, and a parameter that controls how fast each plays back in sequence, and the event is triggered as soon as the animation is on a frame (assuming the programmer handling animation will post an event or update a param for this) where you could reasonably assume the character's foot has hit the ground.

Is this overkill, or assuming too much accuracy out of an engine?

This is not a specific project, but I am working on integrating FMOD Designer support into an existing engine and am thinking of some general effects to implement while the audio spec is being figured out. Also, I mention FMOD since that's what we're using, but if anyone's done similar syncing tasks in Wwise, XACT or anything else (or heck, even if you hand-coded it) and could share their experiences that'd be great to hear as well.

sentences:
Bug with OnColliderEnter/Exit when colliding with multiple objects at almost the same time Unity Version: 2017.4.1f1

I currently have a game with a jumping mechanic. I only want the jump to work where you're on ground, so I have planes on top of everything, which, if you are on a plane, then you can jump.

This works, however if you are in a position where you are falling and then in quick succession, hit one plane, fall off that plane (like when your centre of mass is hanging off the edge), then land on another plane, at the end of it all, it still thinks you are on the air.

Note: I don't think this is an error with the velocity of the player, at no point do you go through a collider.

So my question is, is there an error in my code (shown below) which I can fix, or should I take another approach towards jumping, thanks. Relevant code below.

private bool canJump;
private Rigidbody rb;
public float jumpStrength;

private void OnCollisionEnter(Collision collision)
{
    if (collision.collider.CompareTag("Jumpable"))
    {
        canJump = true;
    }
}
private void OnCollisionExit(Collision collision)
{
    if (collision.collider.CompareTag("Jumpable"))
    {
        canJump = false;
    }
}
private void Update()
{
    if (canJump && Input.GetKey(Keyode.W))
    {
        rb.velocity += new Vector3(0, jumpStrength, 0);
        canJump = false; // Safety measure to ensure consistent jump height
    }
}

Thanks

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

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

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

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

here is the input manager script:

public class WordInput : MonoBehaviour {

public WordManager wordManager;

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

EDIT

This is the player script where the laser is instantiated:

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

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

This is the updated laser script:

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

private Vector3 laserTarget;

private void Start()
{

}

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

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

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

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

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

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

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

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

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

sentences:
How to handle materials in an Entity/Component system My E/C implementation is the basic one where Entities are just ID's, Components are data and Systems act on the Data. Right now I'm having trouble with object materials and rendering in general. For simple objetcs I have a ModelComponent, tied to a RenderSystem, ModelComponent has the vertex buffer ids that the render system uses. A simple MaterialComponent would probably have color or specular strenght, etc, but I wanted it to be flexible enough to allow for more than one render pass and general "effects" that are not as easy as a simple variable in the MaterialComponent.

Trying to solve these problems I came up with two solutions:

1 - Super-generic Material Component

Something like this:

struct Material : public Component
{
    ShaderData* shader;
    std::vector<std::pair<std::string, boost::any>> uniforms;
    [...]
};

and in the render system I would loop and pass the uniforms to the shader. I suppose this would be slow, but fast enough for my purposes.

2 - Another layer of abstraction, MaterialData

Having a class to wrap specific materials, that could be inherited by whatever specialized  material, the base class would have something like void set_shader_constants(ShaderData* d) but the implementation is up to each class, and the MaterialComponent would have a pointer to a MaterialData object.

I'm not sure which approach I would prefer, but neither of these touch the subject of multiple passes, or other complex rendering techniques.

Any idea on how to accomplish this?

sentences:
Efficient Tile-based collision detection for a lot of squares? currently I am working on my own take of a tile-based game (think Terraria, but less fantastical (I think that's a word? Sorry if it isn't)).

Anyway, I currently have collision detection working (for corner cases even!) which was a big step for me. There is something extremely gratifying about seeing a sprite not run through a block. But then I had the idea to benchmark. Bad idea.

1,000 squares, no problem.
10,000 squares, for 3 characters was kind of laggy.
100,000 squares (really huge map), for 3 characters was unplayable.

I'm having the issue where I don't want to even consider the blocks that are too far from the player, characters, items, etc., but I don't want to load those in-out of memory constantly.

Here's my algorithm so far, feel free to criticize.

foreach (Block in level)
{
    if (distance from block to player > a specified amount)
        ignore this block;
    else
    {
        get the intersection depth between the two bounding boxes
        if (depth of intersection != Zero-vector)
        {
            check y size vs x size
            resolve on smallest axis
        }
    }
}

As you will note, when the level size get's bigger, the Order of this algorithm grows by N blocks. I would like to not even consider blocks that aren't even near the player.

I'm thinking maybe use a (0,0) to (mapWidth,mapHeight) double-array of blocks instead of a list, calculating a danger-zone depending on the person's position e.g., if player's position is at (10, 20) it will look from (0, 10) to (20, 30), or so on.

Any thoughts and considerations are awesome, thank you.

sentences:
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:
Passing information between states created at different times I have two states, a configuration state and a gameplay (simulation) state.

After configuring the game details (gametype, scoring type, win condition, etc. etc.) As each state is isolated, what is a good way to pass this data to my simulation state which will be created later?

Currently I'm storing configuration details in static variables of the gameplay class.  Then upon creation--the gameplay class is copying that into it's internal configuration.  This seems sloppy.  Could I be doing something better?

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

I tried this:

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

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

sentences: OpenGL - texture releasing If I call glDeleteTextures, will it release memory immediately? And what is the performance? I know that glGenTexture is quite cheap, because it only alocated id, but I have nor found anything about deleting.

sentences:
How should I do AABB::contains? Should an AABB "contain" a point when the point is:

Exclusive: Only exactly inside the aabb
Inclusive: Inside the aabb or exactly on the sides
Almost:  Inside the aabb or a little bit outside of the sides

sentences:
libgdx - Scalable UI without Scene2D I currently have a fairly decent framework for a side-view strategy-ish game built around libgdx. While I may have reinvented the wheel a couple of times, I believe I've done the vast majority with tools already existing in libgdx parts properly: camera, viewport, sprites, etc.

One thing I've not used at all is Scene2D, as I've simply not had a need for it (yet). Drawing the sprites at their positions is more than enough. The terrain is procedurally generated pixel art that is drawn beforehand.

Now I've come to the point where I need to implement some fairly basic UI-systems. Nothing out of the ordinary: A few buttons to click, and an area with additional info.

I haven't decided entirely on which approach to use when implementing the UI, but in the meantime I'm going with a fairly simple approach:
When everything else is drawn, I reset the projectionmatrix so that everything drawn after that never moves with the world:

    Matrix4 uiMatrix = camera.combined.cpy();
    uiMatrix.setToOrtho2D(0,0,viewport.getWorldWidth(), viewport.getWorldHeight());
    batch.setProjectionMatrix(uiMatrix);
    // Then draw the UI

This works fine, except when the aspect ratio changes and/or when the window resizes. Therefore I would like to find a more scalable way.

Is Scene2D the way to go? It currently looks like the only reasonable way of getting an UI that works well with resizing the screen and panning around.

The info I find on how to implement it either assumes a complete rewrite to use actors instead of sprites, or doesn't scale well at all.

sentences:
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:
Buggy behavior on basic hinge joint (pinball flipper) I'm trying to make a pinball flipper, but before I begin working on the script to incorporate user controls, I want to get the rotational movement working. Basically it rotates in a circle around the left-most point.

Clearly one option is to make half the flipper invisible. This is the easiest way but it leaves me still not really understanding how to work with rotation. For example:

<======o======>

where o is the midpoint.

I want it to rotate along the same axis, but without the left half of the shape:

       o======>

I have tried watching this video a couple times but am coming short of understanding how the hinge joint works. I attached one my left flipper and set the axis to 0,1,0 so it rotates along the y axis (remaining parallel to the playfield). I also moved the anchor to the leftmost position. I have left the rest of the hinge joint at its default configuration. Here is some evidence:

the placement of the hinge joint (it's the little yellow arrow at the left of the flipper)
the hinge joint config
The buggy behavior
The left paddle's rigid body (it is locked on all position and all rotation except y)

What I'm really trying to do is have the flipper rotate from it's leftmost point as the origin. I just want it to free-rotate when the ball hits it.

sentences:
Understanding normal mapping I am trying to understand the basics of normal mapping using this tutorial : http://ogldev.atspace.co.uk/www/tutorial26/tutorial26.html

What I don't get there is the following equation :
E1 = ( U1 - U0 ) * T + ( V1 - V0 ) * B

How do they came to this equation? This it out of nowhere for me. What is E1?
The tutorial say that E1 is one edge of the triangle. But I don't get it, in the equation E1 seems to be a real number, not a vector ( which an edge is supposed to be right? he have a x and y component ).

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:
Need help finding an old game I want to rewrite/port There was this old stick figure game for Windows I played a while back. You, playing as a stick figure, run around on a 2d map with guns and fight other stick figures. You can get power ups, like jetpacks, bigger guns and the like.

It's a very simple game with not much to it. I think it came with a map editor as well.

Google results only provide me with subpar flash games and some Stick War game that clearly isn't it.

I want to write a Linux port and I would like to give it another run before I start that process.

Anyone know what I'm talking about?

sentences:
new graphicsdevice returning null I tried to make a collision box visible (for testing) with spriteBatch.Draw(with a blank texture) in my TileSprite class. I needed a GraphicsDevice for this so these are my variables:

Texture2D blankTexture;
GraphicsDevice GraphicsDevice;

I used this code as my LoadContent():

public void LoadContent()
{
    blankTexture = new Texture2D(GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
    Color[] color = new Color[1];
    color[0] = Color.White;
    blankTexture.SetData(color);
}

I have one TileSprite constructor in my TileSprite class which looks like this (NOTE: this constructor is partially taken from another abstract class, named Sprite):

public TileSprite(GraphicsDevice gd, Texture2D textureImage, Vector2 position, Point frameSize, Point currentFrame)
    : base (gd, textureImage, position, frameSize, currentFrame)
{
    GraphicsDevice = gd;
    bCollisionRect = new Rectangle((int)position.X, (int)position.Y, frameSize.X, frameSize.Y);
}

And then I use this code in my Draw method to draw the box:

spriteBatch.Draw(blankTexture, bCollisionRect, Color.White);

And I have another line of code in the Game1 : Game class (variables like textureImage are written as variables in the beginning of the Game1 class):

tileSprite = new TileSprite(this.GraphicsDevice, textureImage, position, frameSize, currentFrame);

I tested this and I saw that my GraphicsDevice was returning null on a new TileSprite that used a GraphicsDevice from DrawableGameComponent.

sentences:
The XNA redistributable isn't in the prerequisites list; how do I include it when publishing? So I created a small project in XNA 4.0, and wanted to try and publish it, and so I did.
Yet when attempting to install it on a different computer it didn't seem to work.

I've read and studied about how the process of publishing works, and I saw someone in a different thread asking the same question as me, then I realized that
inside the prerequisites list which is in PROJECT -> PROPERTIES -> Publish,
the XNA redistributable wasn't there therefore it wasn't checked, and when attempting to install it on a different computer they needed to install redistributable on their own
to make it work.

Any idea why isn't the redistributable in the list? Maybe this isn't even
the problem and if that's case any ideas of what IS the problem? Thanks ahead.

sentences:
3Ds Max is exporting model with more normals than vertices I made a simple teapot with the "Create Standard Primitives" option and exported it as a collada file, ended up with this:

< float_array id="Teapot001-POSITION-array" count="1590">

< float_array id="Teapot001-Normal0-array" count="9216">

For what I know there should be only one normal per vertex, am I wrong? What am I supposed to do with that much normals? Just put them on the normal buffer all at once normally?

sentences:
How and when to split draw calls in OpenGL and OpenGL ES My application (with a modernish OpenGL >= 3.0 and an OpenGL ES 2.0 backend) renders more or less streaming data with up to millions of vertices with different vertex layouts and sizes (some simple, some quite big). Some data is indexed, some is not. I'm currently hitting the problem of draw calls and buffers (index and/or vertex) becoming too large, so I need to split them. I have a hard time understanding when and how I should correctly split draw calls. My questions:

The limits GL_MAX_ELEMENTS_VERTICES and GL_MAX_ELEMENTS_INDICES, according to the docs, tell the application the maximum value for well-performing glDrawRangeElements calls. Why is this ONLY for glDrawRangeElements, why not glDrawRangeElementsBaseVertex or even glDrawElements?! This does not make sense to me, because glDrawRangeElements is more or less glDrawElements after all. Also I've see a couple of OpenGL implementations reliably crash when rendering indices above that limit, even with glDrawElements. On the other hand some stackoverflow answers say that the limits are not relevant anymore... What else should I use to decide how to split my draw calls then?
What about glDrawArrays? Is there an upper limit (e.g. GL_MAX_ELEMENTS_VERTICES)?
For the OpenGL ES 2.0 backend I require the extension "GL_OES_element_index_uint" to use indices above the 65k limit. What limits should I choose there for draw call size?
I have decided to limit my IBO and VBO sizes to a certain limit (max. 64MB), as there's no way to ask OpenGL about what buffer size I can allocate, else than checking for GL_OUT_OF_MEMORY. That means I have to additionally split according to that buffer size (both IBO and VBO). Is there a better way to check buffer limits?
What should be the preferred way to split draw calls? Make them small in the application already, then batch them when rendering? This will lead to lots of duplicate vertices in some case, which is not ideal.
Splitting them in the render code can be complicated, because index data has to be analyzed, indices changed or memory copied, but in the end it is the only place where you can be sure all limits are respected...

I'd prefer reliable, stable solutions even if they provide lower performance. I'm targeting OpenGL Desktop hardware newer than ~2010 and Angle as a conversion layer from OpenGL ES 2.0 -> Direct3D in case of Remote Desktop connections.

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:
What's the best way to deal with platformer tile collisions? I am starting with game development and creating a basic platformer game. I already have searched a lot and found some ways to implement the platformer aspect to the game, like apply a gravity, velocity and so on.

Everything is good, but always when I implement a way to deal with the collisions, a bug appears. If I fix it, it appears at other side, etc. The main problem is when the player intersects a tile and I need push him up back. The most simple way that I found is this:

player.Y = tile.Y - player.height;

The most problems comes when you also need verify the X axis, the player is pushed out from the tile, or it is thrown at other tile position, like this issue I had when trying to implement the XNA Platformer Example. Or even pass through the tiles if you are going too fast.

After some research I found a good way to avoid all this problems: instead of move the player to the next position and deal with the tiles to push him back, calculate a safe distance and move the player following this. The "safe distance" is for example, the player.Y += player.Velocity.Y, but if any tile is at the way, the safe distance is decreased to the player don't enter in the tile.

I read this excelent article and it's what is said about the algoritm:

  The total movement of the player along that direction is then the minimum between the distance to closest obstacle, and the amount that you wanted to move in the first place.
  Move player to the new position. With this new position, step the other coordinate, if still not done.

So, the best way is use the "safe distance" method?

sentences:
How to extract the texture from an image onto a mesh? (preamble: I think this fits either here or SO with computer vision tag, I chose gamedev because I think you guys are probably really good with textures and meshes, but tell me if my decision was wrong.)

I want to accomplish the following: Given an image with an object, a 3D mesh very similar to that object, and rendering parameters that render that mesh to the exact location of this object. I want to "extract" the original texture from the image onto the mesh. (So in a later step, I could re-render the mesh from another viewpoint (of course some of the texture would be invisible/black)). My mesh has uv-coordinates for each triangle so I guess I could either "store the texture on the mesh" somehow, or directly backmap it to a 2D texture map.

So I guess what I want to do is kind of texture backmapping/remapping, kind of the inverse of what is done in game-dev when texturing objects. I was having a lot of trouble finding any useful information on Google about what I want to do, so I thought I'd ask here. Maybe I haven't found the right word for it yet. I think there's probably quite a lot of "stuff" involved because pixel in the original image won't exactly correspond to a location on the mesh.

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:
Deactivate current object in array and activate next one by using button click? How to deactivate current object in array and activate next one by using button click?

public GameObject[] gameObjects;
private int numOfgameObjects;

void Start()
{

  //current object
  gameObjects[0].SetActive(true);

  int numOfgameObjects = gameObjects.Length;

  for (int i = 0; i < numOfgameObjects ; i++)
  {
      gameObjects[i].SetActive(false);
  }

}

public void NextPrefab_ButtonClick()
{
  // Some Code to deactivate current object and activate next one
}

sentences:
New Project Basic Structure I had originally asked this on the Cryengine forums but I received no replies. I know stackexchange to be a much better community.

I am just starting out with Cryengine 5 and created my first blank C++ project. However the documentation is just a little lacking currently and I want to know the ins and outs of what has been generated for me. If there are other forum posts or specific pages in the documentation that I should be looking at but must have overlooked I'd appreciate the links.

I can very easily find documentation on the structure of the engine code. Well at least I think that is what this page refers to. But I'm more concerned with the structure for a new game project.

As far as I am aware the default template contains a single level but I don't know much more than this. Here are a list of questions that I have regarding what has been generated when I created a new project:

What is rcjob_all.xml?
What does MakeAssets.bat actually do?
Game.bat, Editor.bat and Code_CPP.bat launch the Game, Editor, and Visual Studio respectively? What else are these scripts doing?
What is the difference between the GameDll and Solutions folder under code? Where should I put my custom code? For example custom flowgraph nodes.
How is the Assets folder structured? What are entities, libs, scripts, textures/cubemaps/example and how are these related to what I see within the editor?
What is game.cfg?
The Assets folder contains Textures.pak. What is the difference between this and the terraintexture.pak within Assets/levels/example?
What am I safe to remove so that I have the bare minimum project possible? I want to remove as much cruft as possible (inc. code)

What I am aiming for here is the most basic project possible without removing common functionality i.e. player movement, game startup and rules, etc... so that I may build upon this a new level and not have unused/unnecessary files floating around.

sentences: How to implement Ragdoll physics to 2D characters in XNA? I'm starting a new project with XNA. I want to create a game where the main character is subject to ragdoll physics when killed. I was wondering if anyone can give me any tips on how should I implement the character class and apply these ragdoll physics before I start coding so I don't have to refactor my code later. No code is necessary, just a basic overview of an algorithm and some tips. I've found a lot of information about ragdoll physics in 3D but nothig about 2D in XNA.

sentences:
XNA- Transforming children So, I have a Model stored in MyModel, that is made from three meshes. If you loop thrue MyModel.Meshes the first two are children of the third one. And was just wondering, if anyone could tell me where is the problem with my code.

This method is called whenever I want to programmaticly change the position of a whole model:

public void ChangePosition(Vector3 newPos)
{
    Position = newPos;

    MyModel.Root.Transform = Matrix.CreateScale(VectorMathHelper.VectorMath(CurrentSize, DefaultSize, '/')) * Matrix.CreateFromAxisAngle(MyModel.Root.Transform.Up, MathHelper.ToRadians(Rotation.Y)) *
        Matrix.CreateFromAxisAngle(MyModel.Root.Transform.Right, MathHelper.ToRadians(Rotation.X)) * Matrix.CreateFromAxisAngle(MyModel.Root.Transform.Forward, MathHelper.ToRadians(Rotation.Z)) *
        Matrix.CreateTranslation(Position);

    Matrix[] transforms = new Matrix[MyModel.Bones.Count];
    MyModel.CopyAbsoluteBoneTransformsTo(transforms);

    int count = transforms.Length - 1;
    foreach (ModelMesh mesh in MyModel.Meshes)
    {
        mesh.ParentBone.Transform = transforms[count];
        count--;
    }
}

This is the draw method:

foreach (ModelMesh mesh in MyModel.Meshes)
{
    foreach (BasicEffect effect in mesh.Effects)
    {
        effect.View = camera.view;
        effect.Projection = camera.projection;
        effect.World = mesh.ParentBone.Transform;
        effect.EnableDefaultLighting();
    }
    mesh.Draw();
}

The thing is when I call ChangePosition() the first time everything works perfectlly, but as soon as I call it again and again. The first two meshes(children meshes) start to move away from the parent mesh.

Another thing I wanted to ask, if I change the scale/rotation/position of a children mesh, and then do CopyAbsoluteBoneTransforms() will children meshes be positioned properlly(at the proper distance) or would achieving that require more math/methods?

Thanks in advance

sentences:
Getting the Right Vector from the Forward Vector I'm currently working on a small Camera (ArcBall) and I finally am starting to understand how it will work.

I will first create a basic View Matrix using a LookAt function.

Then, I will send the Camera Position and the Camera Target to a function which will:

1: Calculate the Vector of (Camera Position - Camera Target)

2: Rotate this vector by X Pitch
3: Rotate the same vector by Y Yaw

This will determine the new Camera position. Now I need to find the Up Vector to be able to use LookAt() so I need to do the cross product of the forward and the right vector to find the Up Vector.

4: I will do (Camera Target - Camera Position) and normalize it so this will be my new Forward vector

5: ??? I need to find the right vector. How can I find the Right vector if I do not have the Up vector?

If you see flaws with my ArcBall camera, tell me, I am new to OpenGl and I'm trying to learn.

sentences:
Load FBX material data I have the following piece of C++ code which I use to load triangle vertices from an FBX file:

FbxNode *node = scene->GetRootNode()->GetChild(0);
FbxGeometryConverter fbx_converter(node->GetFbxManager());
fbx_converter.Triangulate(node->GetNodeAttribute(), true);
mesh = node->GetMesh();
int num_vertices = mesh->GetPolygonVertexCount();
FbxVector4 *fbx_vertices = mesh->GetControlPoints();
int *fbx_triangle_vertices = mesh->GetPolygonVertices();
double x, y, z;
vector<vertex> vertices;
for (int vertex_index = 0; vertex_index < num_vertices; ++vertex_index)
{
    int index = fbx_triangle_vertices[vertex_index];
    x = (double)fbx_vertices[index][0];
    y = (double)fbx_vertices[index][1];
    z = (double)fbx_vertices[index][2];
    vertices.push_back(vertex(vector3(x, y, z), material(color(1, 0.5, 0.5), 0, 0, 0, 0, 1, 0)));
}

Currently, I am only loading vertex coordinates from the file. Now I want to load the vertex's material data (instead of assigning it manually like I did in the code snippet using material(color(1, 0.5, 0.5)...).

I see that an FbxNode object has a GetMaterial() method, but I don't know how to obtain this data since I am working with fbx vertices which are FbxVector4s, not nodes.

sentences:
Component entity system - Updates and call orders In order to get components to be able to update every frame (and leave this functionality out of components that don't need to) I got the idea to make an UpdateComponent component.  Other components like MovableComponent (which holds velocity) would inherit from the IUpdatable abstract class.  This forces MovableComponent to implement an Update(gametime dt) method and another RegisterWithUpdater() that gives UpdateComponent a pointer to the MovableComponent.  Many components could do this and then UpdateComponent could call all of their Update(gametime dt) methods without having to care about who or what they are.

My questions are:

Does this seem like anything that is normal or used by anyone?  I cannot find anything on the subject.
How could I maintain an order to the components like physics then position change?  Is this even necessary?
What are other ways of insuring that components that should be process every frame are in fact processed?

EDIT
I think I will be concidering how to give the entity manager a list of types that are updatable. Then ALL of the components of that type can update rather than managing it per entity (which are just indexes in my system anyway).

Still.  My questions remain valid to me.  I don't know if this is reasonabl/normal, or what others tend to do.

Also, the people at Insomniac are awesome!
/EDIT

Boiled down code for previous example:

class IUpdatable
{
public:
    virtual void Update(float dt) = 0;
protected:
    virtual void RegisterAsUpdatable() = 0;
};

class Component
{
    ...
};

class MovableComponent: public Component, public IUpdatable
{
public:
    ...
    virtual void Update(float dt);
private:
    ...
    virtual void RegisterWithUpdater();
};

class UpdateComponent: public Component
{
public:
    ...
    void UpdateAll();
    void RegisterUpdatable(Component* component);
    void RemoveUpdatable(Component* component);
private:
    ...
    std::set<Component*> updatables_;
};

sentences:
Graphics, drawing triangles I'm very new to the world of Computer Graphics, and I'm struggling to find resources to help me understand how to draw my mesh (I have loaded everything into vertex and index buffers), I am not using a 3D API, instead I am just using C# and a 2D Graphics canvas to draw my mesh.

Everything is currently loading, but I have suspicions that I am reading my faces in as quads instead of triangles, could somebody A) Clarify whether I am draw a quad instead of a triangle B) If I am drawing quads, how do I draw a triangle? This has been a headache for me for a few hours...

for (int i = 0; i < m_numFaces; i++)
{
     Face face = m_meshData[i];

     // Draw the face
     for (int j = 0; j < 3; j++)
     {
                m_graphicsContext.DrawLine(m_pen,
                     // Get the X,Y points of this face
                     (int)face.GetPointAtIndex(j).points[0],
                     (int)face.GetPointAtIndex(j).points[1],
                     (int)face.GetPointAtIndex(j + 1).points[0],
                     (int)face.GetPointAtIndex(j + 1).points[1]);
     }
                // Draw from first point back to last line
                m_graphicsContext.DrawLine(m_pen,
                     (int)face.GetPointAtIndex(2).points[0],
                     (int)face.GetPointAtIndex(2).points[1],
                     (int)face.GetPointAtIndex(0).points[0],
                     (int)face.GetPointAtIndex(0).points[1]);
}

sentences:
How to install java 3d in ubuntu I'd recently asked a question for getting started in game development from where I was suggested for the book "Killer Game Programming-Java".

On the page there is a java 3d program which needs to be installed. I'd downloaded and installed java3d file from here and also from the sun/oracle's site. But the program given there is not working.

I would like to know how to install that java3d package in Ubuntu 10.10, and also is there any need to set environmental variable $PATH or classpath for java, and if so, how to do that?

The downloaded version of java3d is 1.5 and it is a .bin file.

sentences:
Nonsense error when increasing LightSource angle? My project has a Light Source and a Sky Sphere Blueprint.

The rotation on the y axis (Light Source) defines the position of the sun (Sky Sphere Blueprint).

Character Blueprint (increases by 10 degrees on the y-axis rotation of Light Source, the updates the position of the sun):

When you click the button (Angulo, circled in pink), the angle increases by 10 and works to a certain moment:

Image with angle increased by 10:

When it reaches 100 degrees, it starts to go wrong. Each time I click the button it goes from 90 to 100 and vice versa in an infinite loop:

I've already tried to turn it around, subtracting instead of adding, but at one point it also gives error (in the case with 110 degrees).

sentences:
Should I bake all textures to a texture atlas in a game level? I'm writing my own game engine using Java/OpenGL.  I'm creating levels in Blender 3D and exporting them in a custom file format.  I'm not going to be auto-generating any terrain - everything is going to be exported directly from Blender.

I'm trying to figure out the best way to deal with textures for the static objects in my scene (including very large objects like long ridges of cliffs, grassy fields, canyon floors, etc).  One possibility is to just use the textures at they are applied in the editor.  I have a lot of tiling textures for grass and dirt and such that are not too big and which cover large meshes.  This doesn't take up much texture memory space, but is a little inflexible from an art/design standpoint.  Also, if I want to do something special - like create a blend shader to have a dirt path run through my field - I'll need to code a unique shader to handle this case.  (To complicate things further, Blender doesn't provide support for custom GLSL shaders, so exporting unique things like this will be non-trivial).

Alternately, I can create a single texture atlas for the entire level and bake everything onto it.  This way I don't have to worry about special purpose shaders or multiple tiling textures.  The down side is that this texture would be enormous.  I'm worried such a large texture might be bigger than my device can handle.

Anyhow, I'm not sure what the best practice is in these cases.  Should I bake everything out, or have each model with its own texture?

sentences:
Understanding Torque in Unity This is (hopefully) a simple question that should avoid me asking a more complex question. This is in Unity (2D) but hopefully this is a general physics principle I am not getting.

I am applying a torque to a 2D object. The object has a scale of 1, a RigidBody2D with a mass of 1 and no angular drag or undergoing gravity. It is a CircleCollider2D with a radius of 1. There is nothing else attached to the object.

In the following code I apply a torque of Pi for one second. In linear motion (and from my understanding of torque) I would expect the angular velocity, after one second, to be Pi (or 180deg/s). However, running this code and printing out the speed at t=1.0, the speed is 90deg/s.

void FixedUpdate()
{
    if (time < 1.0f)
    {
        rigidbody2D.AddTorque(Mathf.PI);
    }
}

This is consistent, applying a torque of 2Pi gives me a velocity of 1Pi after the time. Where is this factor of 2 coming from?

sentences:
Libgdx/Box2D PolygonShape has no position... well, what now? As my prototype works perfectly fine I want to advance to more fun areas of the project and add a more complex player-character body.

So for Box2D I figured I'd need multiple fixtures, like one for the legs, one for the torso and one for the head.

Each of these fixtures will get a different sprite/texture that should be swappable dynamically if the player puts on some armour or changes cloths etc.

Until now the player-character consisted of a Box2D Body with just one single fixture.
I added the sprite like this:

   body.setUserData(this.sprite);

I rendered it like this:

 // Draw-method
  if(body.getUserData() != null && body.getUserData() instanceof Sprite) {
      Sprite sprite = (Sprite) body.getUserData();
      sprite.setPosition(body.getPosition().x - sprite.getWidth() / 2, body.getPosition().y - sprite.getHeight() / 2);
      sprite.setRotation(body.getAngle() * MathUtils.radiansToDegrees);
      sprite.draw(spriteBatch);
  }

Now that I want to have multiple sprites for different "regions" of the body I figured it's better to add them to the fixture itself. For now I just wanted to reproduce what I already had, so just the one sprite I have to the one fixture I have right now instead of the body.

I do this like that:

Fixture fixture = body.createFixture(fixtureDef);

My problem arises when trying to render this.

for(Fixture fixture : body.getFixtureList())
{
    if(fixture.getUserData() != null && fixture.getUserData() instanceof Sprite)
    {
        Sprite sprite = (Sprite) fixture.getUserData();
        //sprite.setPosition(fixture.getShape().getPosition() ... // Not gonna work, because PolygonShape has no position! :(
        sprite.draw(spriteBatch);
    }
}

As you can read in the comment, the fixture for now has a rectangular shape which is made like:

shape = new PolygonShape();
shape.setAsBox(widthInMeters / 2, heightInMeters / 2);

The problem is, that a PolygonShape has not position :/ Now when I render this, the sprite is not being drawn at the fixtures position and currently I really have no idea how to fix that.

I'd highly appreciate any help you can give me! Thanks in advance and have a wonderful day! :)

sentences: Unity Ragdoll Colliders don't collide I have a humanoid character with Ragdoll setup in Unity. However the box/capsule colliders on the various parts of the body don't collide with other static geometry. They do collide with the ground but not with any other static meshes. Is it possible to use them as colliders towards static meshes and what do I need to do for it to work?

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: How to know my lighting shaders matches famous models? I have some diffuse and specular lighting shaders based on famous models like lambert etc. Thing is, how can I know that my shader is actually implementing the correct formula? I can see my materials does reflect light but how can I be sure that my formula matches the models. Any way to test this?

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:
What are mental ray shaders and can I use them in my own game? I'm using the FBX SDK to import and display FBX models in my OpenGL app. It works fine so far with a simple phong shader and displays basic models.

However I have some FBX models that have custom (Mental Ray) Arch & Design materials. Can I render these models with such materials in my app?

My (completely noob) understanding of how this works is that the Arch & Design thing is a shader. A graphic designer edited some data fields, and the way the model is rendered is that such data is passed to the Arch & Design shader during rendering, and the shader takes care of it (ie does all the lighting calculations etc).

Is it possible for me to use that flashy Arch & Design shader in my app, so I manually parse the FBX model and send the data fields to the shader? How do I get hold of it?

Any clarification will be appreciated, you can probably tell that I'm somewhat confused.

sentences:
How to access Lit shader properties through code? Currently i'm using HDRP in my project, so i have a question.
How can i access Lit shader properties through code ? Or where i can see names of variables in this shader ?

For example:

sentences:
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:
How do I create a multiplayer server also suitable for local single-player? I've created a voxel game in C++, OpenGL and SFML, and I want to make it multiplayer.

I'd like to make it similar to Minecraft's client-server model: The single-player is just a client to the hidden server underneath; but can be configured to connect to multiplayer as well so that the single player and multiplayer code are one and the same.

Spitball-ideas:

Use a separate thread for the server logic and then share the data between a synchronized point in the code for the client.
Just send packets to local host from the server thread and collect them from the client thread.

How should I do this?

sentences:
How to increase update speed of game? I have a basic game, in which the player moves the environment around the screen, to give the gamer an impression that the player is actually moving.
I want this game to be large and have an open world, each piece of scenery is an object and each frame it updates the scenery to make itself move relative to the player. The trouble is with large amounts of objects this causes the game to slow down, but the objects HAVE to be updated otherwise they will become out of synch with the player. So how can I increase the performance of my game without splitting it up into tiny little levels?

Its a 2D top down game. The position of each object is updated each time, but when there are a large number of objects this takes a long time.

sentences:
Faster 2D Collision detection Recently I've been working on a fast-paced 2d shooter and I came across a mighty problem. Collision detection. Sure, it is working, but it is very slow.
My goal is: Have lots of enemies on screen and have them to not touch each other. All of the enemies are chasing the player entity. Most of them have the same speed so sooner or later they all end up taking the same space while chasing the player. This really drops the fun factor since, for the player, it looks like you are being chased by one enemy only. To prevent them to take the same space I added a collision detection (a very basic 2D detection, the only method I know of) which is.

Enemy class update method
    Loop through all enemies (continue; if the loop points at this object)
        If enemy object intersects with this object
            Push enemy object away from this enemy object

This works fine. As long as I only have <200 enemy entities that is. When I get closer to 300-350 enemy entities my frame rate begins to drop heavily. First I thought it was bad rendering so I removed their draw call. This did not help at all so of course I realised it was the update method. The only heavy part in their update method is this each-enemy-loops-through-every-enemy part. When I get closer to 300 enemies the game does a 90000 (300x300) step itteration. My my~

I'm sure there must be another way to aproach this collision detection. Though I have no idea how. The pages I find is about how to actually do the collision between two objects or how to check collision between an object and a tile. I already know those two things.

tl;dr? How do I aproach collision detection between LOTS of entities?

Quick edit: If it is to any help, I'm using C# XNA.

sentences:
How to implement weighted blended order independent transparency in OpenGL? I want to implement weighted blended OIT in my C++ OpenGL 3D game, but I didn't find any C++ examples about weighted blended order independent transparency.

Paper

How to clear accumTexture(framebuffer attachment) to vec4(0)?
How to clear revealageTexture(framebuffer attachment) to float(1)?

sentences:
Qt 5 - QOpenGLWidget not updating the screen I'm creating a level editor for my game using Qt for gui and i'm in really early stages. Right now i'm trying to dynamically add objects ( entities ) on screen when i click a button. So far the objects are pushed into a stack but i can't see them on screen.

When my widget inherits QGLWidget the screen is updated immediately and i can see the objects being drawn but since QGLWidget is deprecated i use QOpenGLWidget.

Strangely this class does not auto update the screen. I have also connected update() to a timer and set the interval to 0 to update the screen in real time.

connect(&timer, SIGNAL(timeout()), this, SLOT(update()));
timer.setInterval(0);
timer.start();

Am i missing something ?

sentences:
If filled polygon cannot be drawn via libgdx ShapeRenderer , then what is the work around? I know most of you would suggest me to draw a filled polygon by using combination of triangles and rectangles , but that is not possible for complex shapes . I want to basically draw a generic shape on screen , here it is

The above shape needs to be drawn in generic form , i.e
-> the width of each trapezium's upper edge is fixed .
-> the lower edge of the overall compound shape is a constant unit greater than upper edge.
-> this whole compound shape can have arbitrary length and thus number of individual trapeziums that compose the compound shape is not fixed.
I wish to draw each colored trapezium as a filled polygon .
Is there any way of achieving this

sentences:
Intellisense with PhaserJS Library in Visual Studio Code I am trying to use Visual Studio code along with PhaserJS but am confused about why the  isn't working.

I've read through http://www.johnpapa.net/intellisense-witha-visual-studio-code/ am think I am doing it correctly but still don't get auto-complete.  When Phaser gets a green underline and lightbulb, the bulb doesn't include a create reference so I created one above manually.

sentences:
Does the feature level affect multisampling? I'm using DirectX 11 with the feature level 9_3 even though my computer could run 11_0, but I want to support older hardware as well.

I'm using CheckMultisampleQualityLevels to check whether multi sampling with the given samplecount is supported or not. However it returns 1 for quality with 4samples. And with 8samples it returns 0 (so its not supported). With feature level 11_0 CheckMultisampleQualityLevels returns 1 for 8samples. I'm using a AMD/ATI Radeon HD5830. In the most DirectX9 games I can still use 8x antialiasing. So why is it not supported in DX11 with a lower feature level.

Another point is it seems like 4samples doesnt really affect the output:

With mutlisampling disabled the result is the same. I'm sure that I configurated ms correctly.. even in the Depthbuffer.

Whether I enable AntialiasedLineEnable in the RasterizerDesc or not the output is still the same.

I searched in MSDN but I couldn't find any more information about multisampling.

EDIT: The blacklines in the picture are outlines made in the pixelshader

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 you fix wobbling shadow edges? I've implemented an omni-directional shadow map and I've noticed a rather unwanted behaviour on the shadows. It seems like when the angle between the occluded points and the light source is really steap, then the egde of the shadow starts to wobble. It's almost looks like it's pulsating.

Could it have something to do with when the light source moves further away from the occluded polygons, the pixels next to each other are further away from each other than the corresponding texels on the shadow map face that I sample from which result in some sort of magnification side-effect when performing aliasing? This is just a really wild guess!

Is anyone familiar with this type of behaviour and/or have any solution to it?

Thank you!

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:
Why / how does XNA's right-handed coordinate system effect anything if you can specify near/far Z values? I am told repeatedly that XNA Game Studio uses a right-handed coordinate system, and I understand the difference between a right-handed and left-handed coordinate system.  But given that you can use a method like Matrix.CreateOrthographicOffCenter to create your own custom projection matrix, specifying the left, right, top, bottom, zNear and zFar values, when does XNA's coordinate system come into play?

For example, I'm told that in a right-handed coordinate system, increasingly negative Z values go "into" the screen.  But I can easily create my projection matrix like this:

Matrix.CreateOrthographicOffCenter(left, right, bottom, top, 0.1f, 10000f);

I've now specified a lower value for the near Z than the far Z, which, as I understand it, means that positive Z now goes into the screen.  I can similarly tweak the values of left/right/top/bottom to achieve similar results.

If specifying a lower zNear than zFar value doesn't affect the Z direction of the coordinate system, what does it do?  And when is the right-handed coordinate system enforced?

The reason I ask is that I'm trying to implement a 2.5D camera that supports zooming and rotation, and I've spent two full days encountering one unexpected result after another.

sentences:
SpriteSheet Animation with XNA Hi i'm working on my First 2D Game with XNA and I have a little problem.
To give a running effect to my Sprite, I scroll through a SpriteSheet with this code(running right):

if (AnimationDelay == 6)
{
    if (CurrentFrameR.X < SheetSizeR.X)
    {
        ++CurrentFrameR.X;
    }
    else
    {
        CurrentFrameR.Y++;
        CurrentFrameR.X = 1;
    }

    if (CurrentFrameR.Y >= SheetSizeR.Y)
    {
        CurrentFrameR.X = 0;
        CurrentFrameR.Y = 0;
    }

    AnimationDelay = 0;
}
else
{
    AnimationDelay += 1;
}

xPosition += xDeplacement;

And these are the objects used :

Point FrameSizeR = new Point(29, 33);
Point SheetSizeR = new Point(5, 1);
Point CurrentFrameR = new Point(0, 0);
int AnimationDelay = 0;

I have the same Code with different SpriteSheet when the sprite is running Left.
Everything is working fine I'd say 90% of the time but the other 10% the sprite animation stays on one Frame of the SpriteSheet, on both directions(left and right) and it stays stuck until I close the program.
The thing is I can't quite figure out why since it never happens at the same moment..Sometimes after 10,15,30 seconds and sometimes even on boot!
Any idea why?
Thanks in advance and let me know if you need any other parts of the code

sentences:
Pokemon Battle System A.I For my newest project, a Pokemon fan-edition, I need to collect much information on the game mechanics. So I need to know a few things about the A.I. implemented in the games. For the sake if simplicity here are my questions:

Do today's Pokemon games (Diamond, Pearl, Platinum, HeartGold, SoulSilver, Black, White) include an A.I. or is everything more or less random?
Has anyone information or even resources on that topic so that I can reuse this to build my battle system?

sentences:
How can I blend up to 3 textures on a polygon without blend maps? For my voxel game I need to blend up to 3 textures in the same polygon.
It would be preferable if I could specify a texture id for each vertex, but other solutions are accepted as well.

Here's an illustration of what I want.

How can I achieve this type of blending?

Multi texturing with blend maps is NOT a solution.
Also please notice that there will be a lot of different textures.

sentences:
Simple 2D Fish Obstacle Avoidance I am currently working on a simple obstacle avoidance system in unity. I have a player and a school of Ai fish that are traveling in a fixed direction (Down-Right). While swimming, I want the Ai fish to keep away from the player, and also keep away from incoming obstacles. I first thought I should use a boid flocking algorithm, but it may be overkill for what I need as I am trying to limit computation to as low as possible since it will need to run on a mobile device. the fish do not need to avoid each other and they simply need to head toward the fixed direction. Other notes: I can't use unity's NavMesh system since I am using 2d physics and obstacles will be random at runtime.

My issue is that I do not know how to efficiently steer the AI when there are multiple obstacles and players in the proximity. I have something working(Below), but I am manually steering it when it gets too close but this won't work when I have multiple obstacles to avoid within their proximity. Could someone steer (ha) me in the right direction on how to approach this?

Thank You

Below is the class I made for the Ai fish:

public class FishMoveTest : MonoBehaviour {
public float Speed;
Rigidbody2D rb;
public float MinSpeed;
public float MaxSpeed;
public float DisableDistance;
private float DistanceFromPlayer;
public GameObject Player;
 Material NormalMat;
public Material CollideMat;
 MeshRenderer MeshRend;
public UnderwaterObstacle _UnderwaterObstacle;
public float AvoidDistance;
public float SteerSpeed;
float DistanceFromObstacle;
// Use this for initialization
void Awake () {
    MeshRend =  GetComponent<MeshRenderer> ();
    NormalMat = MeshRend.material;
    rb = GetComponent<Rigidbody2D> ();
    Speed = Random.Range (MinSpeed, MaxSpeed);
}

// Update is called once per frame
void FixedUpdate () {
    DistanceFromObstacle = Vector3.Distance(transform.position, _UnderwaterObstacle.Obstacle.position);
    if (DistanceFromObstacle < AvoidDistance) {
        CastObstacleRay ();
        if (MeshRend.material != CollideMat) {
            MeshRend.material = CollideMat;
        }
        if (transform.position.y > _UnderwaterObstacle.Obstacle.position.y) {
            //Move Up-Right;
            rb.velocity = Vector3.Lerp(rb.velocity,new Vector3 (0.5f, 0.5f, 0) * Speed,SteerSpeed);

        } else {
            //Move Down
            rb.velocity = Vector3.Lerp(rb.velocity,new Vector3 (0, -1, 0) * Speed,SteerSpeed);
        }
    } else {

        rb.velocity = Vector3.Lerp(rb.velocity,new Vector3 (0.5f, -0.5f, 0) * Speed,SteerSpeed);
        if (MeshRend.material != NormalMat) {
            MeshRend.material = NormalMat;
        }
    }
}

sentences:
Random monsters move in-sync instead of individually I am making a game in which monsters spawn randomly and begin to move around randomly. I am fairly new at programming but not at game development. Through using a few tutorials I was able to make 1 creature spawn randomly and move randomly (with animations!) in a way that seemed organic instead of robotic.

So, I moved on to the next step of doing this to several creatures. However, when I executed this, I found that instead of executing their own instructions, the rest of the monsters simply mimic the relative movements of 1 central guy. Everyone moves in sync like some North Korean military parade!

I am using foreach loops and random numbers to choose their directions. Since my game is a top down 2d isometric, I am using a dictionary to store 4 directions. I have made some changes based on the suggestions here, and now all the creatures animate! But they still don't change directions or do things on their own.

How do I make them each have their own unique set of instructions instead of everyone just following the dear leader?

Below is a walkthrough of my code:

Monster Initialization:

public void AddCreatures()
{
     NewMonster = new Monster(Texture);
     NewMonster.AddAnimation("northeast", 0, 96, 48, 48, 8, 0.2f);
     NewMonster.AddAnimation("northwest", 0, 144, 48, 48, 8, 0.2f);
     NewMonster.AddAnimation("southeast", 0, 240, 48, 48, 8, 0.2f);
     NewMonster.AddAnimation("southwest", 0, 288, 48, 48, 8, 0.2f);
     NewMonster.AddAnimation("hoon", 144, 336, 48, 48, 1, 1.0f);
     NewMonster.Position = RandomPos();
     NewMonster.DrawOffset = new Vector2(49, 80);
     NewMonster.CurrentAnimation = "southwest";
     NewMonster.IsAnimating = false;
     creatures.Add(NewMonster);
}

Spawn:

for (int v = 0; v < 12; v++)
{
    AddCreatures();
}

Randomize spawn Position:

 private Vector2 RandomPos()
        {
            Vector2 location = Vector2.Zero;
            location.X = rng.Next(300,900);
            location.Y = rng.Next(200, 700);
            return location;
        }

Movements:

 public void Update(GameTime gameTime)
    {
        timenow += (float)gameTime.ElapsedGameTime.TotalSeconds;
        foreach (Monster mon in creatures)
        {
            if (mon.IsAnimating)
            {

                if (timenow - (float)gameTime.ElapsedGameTime.TotalSeconds > 0.5f)
                {
                    mon.Velocity = directions[rng.Next(1, 5)];
                    ChooseAnim(mon);
                    mon.Velocity.Normalize();
                    speed = (float)(rng.Next(0, 3));
                    diff = new Vector2(mon.Position.X - mon.GetLastPosition.X, mon.Position.Y - mon.GetLastPosition.Y);
                    if (Math.Abs(diff.X) >= 4 && Math.Abs(diff.Y) >= 4)
                    {
                        mon.Velocity = directions[rng.Next(1, 5)];
                        ChooseAnim(mon);
                        mon.Velocity.Normalize();
                    }
                    mon.Velocity.X *= speed;
                    mon.Velocity.Y *= speed;

                    timenow = 0f;
                }
                mon.MoveBy(mon.Velocity);

            }
            DoNotExit();
            mon.Update(gameTime);
        }
    }

Animation choosing method:

    private void ChooseAnim(Monster mon)
    {
        if (mon.Velocity == directions[1])
            mon.CurrentAnimation = "northeast";
        if (mon.Velocity == directions[2])
            mon.CurrentAnimation = "northwest";
        if (mon.Velocity == directions[3])
            mon.CurrentAnimation = "southeast";
        if (mon.Velocity == directions[4])
            mon.CurrentAnimation = "southwest";

    }

sentences:
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:
Android LibGDX 1.9.6 Augmented Reality captured images are black Using LibGDX for an AR application and capturing image and merging lines and texts on LibGDX with image with this code.

 private Pixmap merge2Pixmaps(Pixmap mainPixmap, Pixmap overlayedPixmap) {
    // merge to data and Gdx screen shot - but fix Aspect Ratio issues
    // between the screen and the camera
    Pixmap.setFilter(Filter.BiLinear);
    float mainPixmapAR = (float) mainPixmap.getWidth() / mainPixmap.getHeight();
    float overlayedPixmapAR = (float) overlayedPixmap.getWidth() / overlayedPixmap.getHeight();
    if (overlayedPixmapAR < mainPixmapAR) {
        int overlayNewWidth = (int) (((float) mainPixmap.getHeight() / overlayedPixmap.getHeight())
                * overlayedPixmap.getWidth());
        int overlayStartX = (mainPixmap.getWidth() - overlayNewWidth) / 2;
        // Overlaying pixmaps
        mainPixmap.drawPixmap(overlayedPixmap, 0, 0, overlayedPixmap.getWidth(), overlayedPixmap.getHeight(),
                overlayStartX, 0, overlayNewWidth, mainPixmap.getHeight());
    } else {
        int overlayNewHeight = (int) (((float) mainPixmap.getWidth() / overlayedPixmap.getWidth())
                * overlayedPixmap.getHeight());
        int overlayStartY = (mainPixmap.getHeight() - overlayNewHeight) / 2;
        // Overlaying pixmaps
        mainPixmap.drawPixmap(overlayedPixmap, 0, 0, overlayedPixmap.getWidth(), overlayedPixmap.getHeight(), 0,
                overlayStartY, mainPixmap.getWidth(), overlayNewHeight);
    }
    return mainPixmap;
}

In 1.9.6 Pixmap.setFilter(Filter.BiLinear); is not available and it does not merge 2 pixmaps correctly. I tried setting BiLinear filter for both pixmaps or one at a time but none works.

sentences: Wall Jump for 2D Platformer I've been looking for a way to implement wall-jump in my xna game, but I can't find any information about it, can someone could someone please help me out ?

sentences:
Do mods for games like Skyrim look good on a resume? As a lot of people know, Bethesda just came out with their Creation Kit for developing mods to Skyrim.

I've been developing for a while, I have a couple of games released including one that's doing well in the App Store. My goal is to get a job at a studio like Bethesda, Bioware, or Valve. Right now my work shows I can do some of the harder parts of a game engine, but I have nothing directly in the RPG field which is where I want to be.

Would building a mod for Skyrim help my resume enough to justify the time it takes to do it, or would my time be better spent making another non-RPG game from scratch? This mod would be a full side game completely separate from the game's world. My usual thought of mods is they are for fun and don't really help the resume as much as more raw projects, but with how open the creation kit is, it seems you can really go a long way in development.

Before I get any duh or subject to opinion answers, this question is about my lack of knowledge on the perception of notable mods to games. My assumption is there is a general consensus to if mods can be impressive and help a resume which already has some (decent) content for the level of job it's after. Also, I have no intention of starting an RPG from scratch if anyone is crazy enough to offer that as a solution, this is for my resume only.

Lets assume the mod I would make would be impressive for a mod. If that was up for debate, the answer to this might come out a bit gray.

sentences:
How to render a grid of dots being exactly 1x1 pixel wide using a shader? I would like to render a grid with many dots, all equally spaced and being exactly 1 pixel wide.
What I was able to achieve so far is this :

What I would like is (simulated using image editing program):

Here is the shader I wrote (which give result of 1st image).
This is rendered as a giant quad.
Shader "Custom/Grid"
{
    SubShader
    {
        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #include "UnityCG.cginc"

            struct vertInput {
                float4 pos : POSITION;
                float4 uv : TEXCOORD1;
            };

            struct vertOutput {
                float4 pos : SV_POSITION;
                float4 uv : TEXCOORD0;
            };

            vertOutput vert (vertInput input)
            {
                vertOutput o;
                o.pos = mul(UNITY_MATRIX_MVP, input.pos);
                o.uv = input.uv;
                return o;
            }

            fixed4 frag (vertOutput output) : SV_Target
            {
                float4 uv = output.uv;
                float x = step((uv.x * 100.0 + 0.025) % 1.0, 0.05);
                float y = step((uv.y * 100.0 + 0.025) % 1.0, 0.05);
                float c = min(x, y);
                return float4(c, c, c, 1.0);
            }
            ENDCG
        }
    }
}

Is it possible to achieve what I want using a shader ?
What is needed from first draft is to control the size of each dot.
I have tried to use partial derivatives (ddx and ddy) but was not able to make it work.

sentences:
After collision of two objects change the sprite and move in its direction I've searched a lot for this question but there was no answer that could solve the problem I'm having. I'm new to unity and a very naive developer.I'm making a game in unity using c# and it's like a bird that throws eggs in down projectile and when the egg hit the container it should destroy egg and the container sprite should change to a sprite which shows that the egg is inside the container.It would be really helpful if someone could answer with a example code and I can implement this. Rest of the game is working fine projectile and hit. There are check points on egg.cs in OnTriggerEnter2D that if target.gameObject.tag == "Container" now here I need to change the container to another sprite I've and this should move in the direction of container.
UPDATE:Here is the code which changes the sprite, but it changes the egg sprite not the container sprite.First the declaration:

public Sprite changedContainer; //here I've set the sprite of Changed Container
private SpriteRenderer spriteRend;

 Then in the start method:

spriteRend = GetComponent<SpriteRenderer>();

and finally my onCollision Trigger method: (Read the comment in my code)

void OnTriggerEnter2D(Collider2D target)
    {
        if (target.gameObject.tag == "Container") //if the egg collide with container
        {
            transform.GetComponent<SpriteRenderer> ().sprite = changedContainer; <br //which it did successfully
            Instantiate(changedContainer, target.gameObject.transform.position, Quaternion.identity); //as it is mentioned that target.gameobject.transform.position but it still takes the egg projectile
        }
}

So how to change the spite of container? I think I'm in the wrong class I should be doing this in the container class. But it is the projectile of egg that collides not the container that collides with egg.

sentences:
Change axis to view world from above in Unity Developing a 2d game where you view the "table" from above (think of a card game being played on a table).  I have a candlestick on the table, but I must have something wrong because when I run it, it thinks it's on a wall versus a table because the flame goes up to the top versus "at" the camera from above.

Here's the code of that "LookAt" script:

public class CameraFacing : MonoBehaviour
{
public Camera cameraToLookAt;
void Awake() {
    cameraToLookAt = Camera.main; }
void Update()
{
    Vector3 v = cameraToLookAt.transform.position - transform.position;
    v.x = v.z = 0.0f;
    transform.LookAt(cameraToLookAt.transform.position - v);
}
}

sentences:
What is a fair price to pay for music licensing for a commercial game? What is a fair price range for already existing (not custom-made) music if it's intended for a commercial game?

The music I have in mind is relatively unknown (independent music) and I'm already in contact with the label that controls the rights to it, I just need a relative price range to take with me into the negotiation.

sentences:
Rotating a Quad around it center How can you rotate a quad around its center?

This is what I am trying to do but it is not working:

    GL11.glTranslatef(x-getWidth()/2, y-getHeight()/2, 0);
    GL11.glRotatef(30, 0.0f, 0.0f, 1.0f);
    GL11.glTranslatef(x+getWidth()/2, y+getHeight()/2, 0);
        DRAW

my main problem is that it renders it off the screen..

draw code:

    GL11.glBegin(GL11.GL_QUADS);
    {
        GL11.glTexCoord2f(0, 0);
        GL11.glVertex2f(0, 0);
        GL11.glTexCoord2f(0, getTexture().getHeight());
        GL11.glVertex2f(0, height);
        GL11.glTexCoord2f(getTexture().getWidth(), getTexture().getHeight());
        GL11.glVertex2f(width,height);
        GL11.glTexCoord2f(getTexture().getWidth(), 0);
        GL11.glVertex2f(width,0);
    }
    GL11.glEnd();

sentences:
How to utilize miniMax algorithm in Checkers game I am sorry...as there are too many articles about it.But I can't simple get this.

I am confused in the implementation of AI. I have generated all possible moves of computer's type pieces. Now I can't decide the flow. Whether I need to start a loop for the possible moves of each piece and assign score to it.... or something else is to be done.

Kindly tell me the proper flow/algorithm for this. Thanks

UPDATE:

MiniMax code

Now I coded the algorithm but not getting correct moves. Please help me find out the logical error.

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:
Cannot open include file: 'linmath.h' I have set up GLFW and GLAD in Visual Studio 2017 as follows:
I created in C: directory folder GLFW-GLAD, and put in there, "glfw" (Windows pre-compiled binaries, 32-bit Windows binaries) as well "glad". Also in V.S. I created Empty Project "Project-0" and Source file "Main.cpp".
1. In project GLFW-GLAD's "Properties", Configuration: [All Configurations], Platform: [Active(Win32)], Configuration Properties:
1.1. C/C++ > General > "Additional Include Directories" window  > "C:\GLFW-GLAD\glfw\include" and "C:\GLFW-GLAD\glad\include".
1.2. Linker > General > "Additional Library Directories" window > "C:\GLFW-GLAD\glfw\lib-vc2015"
1.3. Linker > Input > "Additional Dependencies" window > "opengl32.lib; glfw3.lib; glfw3dll.lib".
1.4. Linker > System > Subsystem > Console (/SUBSYSTEM:CONSOLE)
2. In project folder "Project-0" I have pasted files: "glad.c" and "glfw3.dll".
I copied program from https://www.glfw.org/docs/latest/quick.html and pasted in Main.cpp code area. I attempted run it but failed. Output is
"fatal error C1083: Cannot open include file: 'linmath.h': No such file or directory"
Please help.

sentences:
Convert a transformation matrix from world-space to camera-space using Eigen I have a transformation matrix, in world space. I need to convert it to local(camera) space.

I have done the reverse of this (Local - to - world) using:

Eigen::Matrix3f R0; //rotation matrix
Eigen::Vector3f T0; // xyz translation values
Eigen::Vector3f C0; //result

R0.transposeInPlace();  //invert rotation matrix

C0 = -R0 * T0;   //return world-space coordinate

Can I simply run this exact same thing to invert it the other way? Or is it a different equation?

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:
How can I design an effective some sort of sequence system? I am making a story driven game right now, and I want to create a system that will allow me to code sequences easily without creating a mess from the project.
What I mean by sequences is for something like a Scene, for example, since it's story driven, the player begin in a room, which then a character walk in, display a dialogue, then walks away, does a few things, a couple of sounds and effects are played, etc.

I was wondering how I could structure a system like that, that will allow me to have hundreds of this sequences without making a big mess of my project, also, these are going to be must like scripted, is it better to keep most of the scripts in a fewer class files or it's a good idea to spread them more? (to more class files)

I hope you can understand exactly what I meant and thank you in advance.

(I am making this in C# in Unity but I am not looking for specific code, just theory how to construct such system effectively)

sentences: How to handle Tilled Map z index order with player in libgdx? The below 1st image is the example how I render tiled map with player, I can properly change the player z index, If I want to make the player below the box i just set the z index to 0. But the problem is the 2nd image below, I dont know how do I make the player above the box when the player is in the bottom then when in the top the player index should be less than the box.

sentences:
What's the proper way to use static objects and singletons in Unity? I have a GameObject in Unity, which I've attached this script to, in order to make it function as a Static Singleton :

using UnityEngine;
using System.Collections;

public class SceneStatics : MonoBehaviour {

    private static SceneStatics instance;

    public static SceneStatics Instance
    {
        get
        {
            if (instance == null)
            {
                instance = new GameObject ("SceneStatics").AddComponent<SceneStatics> ();
                DontDestroyOnLoad(instance);
            }

            return instance;
        }
    }

    public void OnApplicationQuit ()
    {
        instance = null;
    }
}

I have two other scripts that I'd like to be able to access from scene to scene. What's the proper way to do that?

Do I attach my Inventory and Room scripts to the same game object as the SceneStatics? If so, how do I access them? Can I go from SceneStatics.Instance to one of the other scripts directly via GetComponent?

Alternatively, what happens if I add two child gameObjects (each containing one of the other scripts) to the SceneStatics?

Or is the intended use that I simply make any other static items I need properties of the SceneStatics class? (I.e., add in a Public static Inventory and Public static Room attributes)?

sentences:
How do I create a sky box with OpenGL ES 2.0? Can you give me hint to any good sky box example in OpenGL ES 2.0? I have found only OpenGL and does not work for me.
I am doing it this way:
Initialization:

glUseProgram(m_programSkyBox.Program);
glGenBuffers(1, &skyBoxVertexBuffer);
glBindBuffer(GL_ARRAY_BUFFER, skyBoxVertexBuffer);

float vertices[24] = {
    -1.0, -1.0,  1.0,
    1.0, -1.0,  1.0,
    -1.0,  1.0,  1.0,
    1.0,  1.0,  1.0,
    -1.0, -1.0, -1.0,
    1.0, -1.0, -1.0,
    -1.0,  1.0, -1.0,
    1.0,  1.0, -1.0,
};

glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);

glGenBuffers(1, &skyBoxIndexBuffer);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, skyBoxIndexBuffer);

GLubyte indices[14] = {0, 1, 2, 3, 7, 1, 5, 4, 7, 6, 2, 4, 0, 1};
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);

Drawing the skybox:

glClearColor(0.5f, 0.5f, 0.5f, 1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glUseProgram(m_programSkyBox.Program);

glDisable(GL_DEPTH_TEST);   // skybox should be drawn behind anything else
glBindTexture(GL_TEXTURE_CUBE_MAP, m_textures.Cubemap);

glBindBuffer(GL_ARRAY_BUFFER, skyBoxVertexBuffer);
glVertexAttribPointer(m_programSkyBox.Attributes.Position, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
glEnableVertexAttribArray(m_programSkyBox.Attributes.Position);
glBindBuffer(GL_ARRAY_BUFFER, 0);

glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, skyBoxIndexBuffer);
glDrawElements(GL_TRIANGLE_STRIP, 14, GL_UNSIGNED_BYTE, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glEnable(GL_DEPTH_TEST);

Texture loading is working. Shader is correctly compiled and looks like this:
Vertex shader:

attribute vec4 position;
varying mediump vec3 texCoord;
void main() {
   texCoord.xyz = position.xyz;
}

Fragment shader:

uniform samplerCube Sampler;

varying mediump vec3 texCoord;

 void main() {
     mediump vec3 cube = vec3(textureCube(Sampler, texCoord.xyz));
     gl_FragColor = vec4(cube, 1.0);
 }

But I can't get the cube visible. Am I doing anything wrong?

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:
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:
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:
XNA graphics.PreferredBackBufferWidth's new value doesn't immediately change window size I set the width and height of the window in my game constructor, and then pass the graphics manager to a class to check the value. In the game's initialize function, it doesn't seem to recognize the new width and height values, so it uses the default.

Here's relevant code:

Game1.cs Constructor:

graphics = new GraphicsDeviceManager(this);
graphics.PreferredBackBufferWidth = 1600;
graphics.PreferredBackBufferHeight = 900;
Content.RootDirectory = "Content";
World = new TestWorld(Content, graphics);

Game1.cs Initialize

World.Initialize();

TestWorld Initialize

Debug.WriteLine(Graphics.GraphicsDevice.Viewport.Width);

The TestWorld Initialize outputs the default (800).

I have tried graphics.ApplyChanges(), but it does not resolve the issue.

sentences:
How do MMO servers communicate with players who are behind a NAT? I'm now planning to develop a real-time mmo in the future using udp as the transmission protocol since it has lesser overheads than tcp... I understand that between the client and the server, they have to do 2 basic things, the client needs to send server updates such as character positions..movements..hitting a monster..etc, and the server needs to update all the clients connected to render the changes on their screen...

For the client updating the server, I'll most probably do it by sending fast UDP packets to the server, but however for the server to update client, the server will send UDP packets to client containing the updates, however what if a client is behind a NAT? How do the server "push" udp packets to clients connected to a NAT-based network?

I plan to write the server in Java, I've also read about NAT hole-punching with various techniques like STUN..TURN..ICE.. however I can't seem to find a good framework/solution for it..

I also wonder how MMOs today like Maple Story..WOW..League of Legends implemented it..

sentences:
Simple collision detection for 2D match 3 gems game I'm building simple match 3 game.
I have the parts where I move the gems with the mouse only in the straight X or straight Y, up and down and both sides, no 45 degrees movements on grid.
I'm looking for simple collision detection algorithm for the situation when for example:

a gem is moved up or down or left or right and there is another gem.
How can it detect it touched a gem and which gem it is?

sentences:
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:
Why is this animation jerky? I am trying to create a simple game on android but I am unsure the best way to do the game loop.  Looking at the LunarLander sample the game loop just loops like a variable time step loop (elapsed = now-lastupdate).  I tried using this method to draw a circle that grows in size to a max radius then shrinks to a min radius and repeats.  However, when I run the program the growing stage is very choppy and slow (it takes longer than it should to get to max radius).

My Code:

    public void updateSize(double elapsed) {
        if (mGrowing == true && mRadius > mMaxRadius) {
            mGrowing = false;
        }
        if (mGrowing == false && mRadius < mMinRadius) {
            mGrowing = true;
        }

        if (mGrowing == true) {
            mRadius += mDRadius * elapsed;
        } else {
            mRadius -= mDRadius * elapsed;
        }
    }

mDRadius is the number of pixel the radius should change per second and elapsed is the number of seconds that has passed.

I tried putting in a sleep of 2ms and 5ms in my game loop and I get the same result.

I converted my loop to a fixed time step (only run physics update if now-lastupdate > TIME_STEP) and the animation was a lot smoother.

UPDATE: I change the sleep to 15ms and it's a lot smoother.  Every other example I've seen of an android game does not have a sleep in the main loop.  Is this because my sample is just so simple that it takes virtually no time to update and all other examples just have a longer update time or am I missing something?

sentences:
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:
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:
Ways to improve endless racing traffic I am looking for ways to improve my traffic AI for endless racing game.

Currently, I have hard coded situations where randomly cars will be spawned ahead of user bike depending on position of player.

The thing most bothering me is how to provide user challenging situations where he will feel fun to play. Good example of such AI can be found here,
https://www.youtube.com/watch?v=CJozc6PA9lI

What are the ways you guys would go on implementing Traffic AI for endless racing? What's your suggestion on same.

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

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

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

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

sentences:
How to wire finite state machine into component-based architecture? State machines seem to cause harmful dependencies in component-based architectures.

How, specifically, is communication handled between a state machine and the components that carry out state-related behavior?

Where I'm at:

I'm new to component-based architectures.
I'm making a fighting game, although I don't think that should matter. I envision my state machine being used to toggle states like "crouching", "dashing", "blocking", etc.
I've found this state-management technique to be the most natural system for a component-based architecture, but it conflicts with techniques I've read about:
Dynamic Game Object Component System for Mutable Behavior Characters It suggests that all components activate/deactivate themselves by continually checking a condition for activation.
I think that actions like "running" or "walking" make sense as states, which is in disagreement with the accepted response here: https://gamedev.stackexchange.com/a/7934
I've found this useful, but ambiguous: How to implement behavior in a component-based game architecture? It suggests having a separate component that contains nothing but a state machine. But, this necessitates some kind of coupling between the state machine component and nearly all the other components. I don't understand how this coupling should be handled. These are some guesses:

A. Components depend on state machine:
Components receive reference to state machine component's getState(), which returns an enumeration constant. Components update themselves regularly and check this as needed.

B. State machine depends on components:
The state machine component receives references to all the components it's monitoring. It queries their getState() methods to see where they're at.

C. Some abstraction between them
Use an event hub? Command pattern?

D. Separate state objects that reference components
State Pattern is used. Separate state objects are created, which activate/deactivate a set of components. State machine switches between state objects.
I'm looking at components as implementations of aspects. They do everything that's needed internally to make that aspect happen. It seems like components should function on their own, without relying on other components. I know some dependencies are necessary, but state machines seem to want to control all of my components.

sentences:
Pausing animation and resuming on same frame How do you stop an animation and then resume on the same frame where you paused? I tried:

if (paused) {
    anim.speed = 0;
} else {
    anim.speed = 1;
}

Sure, it pauses and plays but it doesn't resume on the frame it paused. It starts over the animation. I also tried playing around the Speed field in Animator (instead of via code) while the animation is playing and its the same way. When the animation is playing and I change the value of Speed, the animation doesn't slow down, it gets reset.

sentences: Clipping Effect in Toon Boom Harmony 15.0 I want to do similar effect like this tutorial Masking Effect. The tutorial using Toon Boom Studio 8, I'm using Toon Boom Harmony 15 and can't seem to find the Cliiping Effect they use in tutorial. Not even from Node View. Any advice to do the same effect ??

sentences: How to balance damage dealt by opponents in a strategy game? Consider the following situation: you are developing a RTS, with different races opposing each other, with different kinds of abilities (e.g. Starcraft). How should I go about in balancing the damage, speed, cool down times etc. of the respective troops/units? Are there any good resources on that or sort of test-beds?

sentences:
How to import character package in Unity I recently made a game in Unity 3D and I tried to import the FPS Controller package as the tutorial I was following said, but when I clicked Assets/Import Package the only thing I saw was a button saying 'Custom Package'

How do I get the character option when I click 'Import Package'?

sentences:
How to "reload" a TTF Text during runtime? As the title says I would like to know how to reload a TTF_SDL Text during runtime in C++.

What I want to do is to update all the values of the text each frame so I can, to example change the font size and it will instantly change it in-game as well without needing to restart the entire game.

How would I do this?

Note : I'm using textures to render the text, using the SDL_CreateTextureFromSurface() function.

This is the way I'm currently trying to update the TTF Text :

void Text::Update(SDL_Renderer* renderer)
{
    SDL_FreeSurface(m_surface);
    SDL_DestroyTexture(m_texture);

    m_surface = new SDL_Surface();

    m_surface = TTF_RenderText_Solid(m_font, m_text.c_str(), m_color_fg);
    m_texture = SDL_CreateTextureFromSurface(renderer, m_surface);
}

And in the header file the two variables look like this :

SDL_Surface* m_surface = nullptr;
SDL_Texture* m_texture = nullptr;

And I currently get an error at SDL_FreeSurface(m_surface); which looks like this :

  Thread 1: EXC_BAD_ACCESS (code=EXC_l386_GPFLT)

However, the code can also be 1 with a address that seem to change every time I run my application

However I sometimes get another error on this line :

m_surface = TTF_RenderText_Solid(m_font, m_text.c_str(), m_color_fg);

Instead, which has the following error code :

  Thread 1: EXC_BAD_ACCESS (code=1, adress=0x11)

But the address on the error codes are not the same every time I run it.

(On both lines of code)

 **Full sprite class code :**

Sprite.hpp :

//
//  Text.hpp
//  SDL_Project
//
//  Created by Someone... on 2016-03-18.
//  Copyright © 2016 Someone... All rights reserved.
//

#ifndef Text_hpp
#define Text_hpp

#include <stdio.h>
#include <iostream>
#include <SDL2/SDL.h>
#include <SDL2_ttf/SDL_ttf.h>

class Text {

public:

    Text(std::string __m_text, int x, int y, SDL_Renderer* renderer);
    void Render(SDL_Renderer* renderer);
    void Update(SDL_Renderer* renderer);

    void SetText(std::string text, SDL_Renderer* renderer);

    void Destroy();

private:

    SDL_Rect* m_rect = nullptr;
    SDL_Surface* m_surface = nullptr;
    SDL_Texture* m_texture = nullptr;
    SDL_Color m_color_fg;
    TTF_Font* m_font;

    std::string m_text;

};

#endif /* Text_hpp */

Sprite.cpp :

//
//  Text.cpp
//  SDL_Project
//
//  Created by Still made by someone on 2016-03-18.
//  Copyright © 2016 :). All rights reserved.
//

#include "Text.hpp"

Text::Text(std::string __m_text, int x, int y, SDL_Renderer* renderer)
{
    m_text = __m_text;
    m_font = TTF_OpenFont("arial.ttf", 24);

    m_rect = new SDL_Rect();

    m_rect->x = x;
    m_rect->y = y;

    m_surface = TTF_RenderText_Solid(m_font, m_text.c_str(), m_color_fg);
    if (m_surface == nullptr)
    {
        std::cout << "Failed to create text surface : " << SDL_GetError() << std::endl;
    }

    m_texture = SDL_CreateTextureFromSurface(renderer, m_surface);
    if (m_texture == nullptr)
    {
        std::cout << "Failed to create text texture : " << SDL_GetError() << std::endl;
    }

    TTF_CloseFont(m_font);
    SDL_FreeSurface(m_surface);
}

void Text::Render(SDL_Renderer* renderer)
{
    SDL_RenderCopy(renderer, m_texture, NULL, m_rect);
}

void Text::Update(SDL_Renderer* renderer)
{
    // This part throws me a error and makes the game crash.

    std::cout << "1 : " << SDL_GetError() << std::endl;
    SDL_FreeSurface(m_surface);
    SDL_DestroyTexture(m_texture);

    std::cout << "2 : " << SDL_GetError() << std::endl;

    m_surface = TTF_RenderText_Solid(m_font, m_text.c_str(), m_color_fg);
    m_texture = SDL_CreateTextureFromSurface(renderer, m_surface);
}

void Text::SetText(std::string text, SDL_Renderer* renderer)
{
    m_text = text;
    Update(renderer);
}

void Text::Destroy()
{

}

sentences:
LibGDX with SoundPool I'm developing a game for Android using LibGDX in Android Studio.
I recently found out that some sounds in my game fail to play. I noticed that every time a sound fails to play, these are the logs:

04-12 10:49:51.784 24234-24283/com.gadarts.parashoot.android E/AudioTrack: AudioFlinger could not create track, status: -12
04-12 10:49:51.785 24234-24283/com.gadarts.parashoot.android E/SoundPool: Error creating AudioTrack
04-12 10:49:52.503 24234-24283/com.gadarts.parashoot.android W/AudioTrack: AUDIO_OUTPUT_FLAG_FAST denied by client; transfer 4, track 44100 Hz, output 48000 Hz

This is the code I use to play the sounds:

public long playSound(SFX fileName, boolean loop, float volume, boolean randomPitch) {
        if (GameSettings.SOUND_TOGGLE) {
            try {
                Sound sound = prepareSound(fileName);
                if (randomPitch && GameSettings.SOUND_RANDOM_PITCH) {
                    return setRandomPitch(loop, sound, volume);
                }
                if (loop) {
                    return sound.loop(volume);
                } else {
                    return sound.play(volume);
                }
            } catch (GdxRuntimeException e) {
                e.printStackTrace();
            }
        }
        return -1;
    }
private Sound prepareSound(SFX soundFile) throws GdxRuntimeException {
        try {
            String soundPath = SFX.fileAttribute.SFX_FOLDER_NAME.getValue() + "/" + SFX.fileAttribute.SOUNDS_FOLDER_NAME.getValue() + "/" + soundFile.getParentDir().getValue() + "/" + soundFile.getValue() + "." + soundFile.getFormat().getValue();
            Sound sound;
            if (!sounds.containsKey(soundFile.getValue())) {
                sound = Main.getAssetsManager().get(soundPath, Sound.class);
                sounds.put(soundFile.getValue(), sound);
            } else {
                sound = sounds.get(soundFile.getValue());
            }
            if (sound == null) {
                throw new GdxRuntimeException("preparing sound failed - sound not found.");
            }
            return sound;
        } catch (GdxRuntimeException e) {
            throw e;
        }
    }

The sound files are in WAV format.
Any ideas how to fix it? Thanks in advance!

Update: I've found out that this problem appears only on my Nexus 5X. I tried it on Xiaomi Redmi Note 4X and it didn't happen.

sentences:
How can I make a tile appear on top of another without completely blocking the tile below? Making a small RPG with libdgx just for learning about how to draw tiled maps and move around in them.  I've got the tiles drawn and OrthographicCamera stuff figured out so I can see my world.  My question is, how can I put character on a tile, so that he appears to be standing on the tile?

My idea is to give each tile a separate texture that has the character drawn on the tile.  So for example, I would have grass.png and then I would have grass-hero.png.  And then based on where the hero is upon the next render loop, if the hero has moved to a tile that was previously "grass", instead this time draw "grass-hero".

Example:

Now, I haven't done it yet, but I'm pretty sure that would work.  My question is, is there some way that I can bypass having to use a separate "combined" tile like grass-hero, and just have my hero walk on top of the grass tile?  I imagine if I use another tool like .NET Paint I could "cut" the hero out of the black background and make the background transparent, but I still don't know how to make one tile appear on top of another.

To provide some abbreviated semi psuedo code, let me show what I have:

GameScreen (implements Screen)

@Override
public void render(float delta)
{
    worldrenderer.render();
}

WorldRenderer

public void render()
{
    spriteBatch.begin();
    drawTiles();
    drawHero();
    spriteBatch.end();
}

private void drawTiles()
{
    for (Tile tile : world.getTiles())
    {
        switch(tile.getTileType())
        {
             case GRASS:
                 spriteBatch.draw(grassTexture, tile.getPosition());
                 break;
             case FOREST:
                 spriteBatch.draw(forestTexture, tile.getPosition());
                 break;
             case STONE:
                 spriteBatch.draw(stoneTexture, tile.getPosition());
                 break;
        }
    }
}

private void drawHero()
{
    Hero hero = world.getHero();
    spriteBatch.draw(heroTexture, hero.getPosition());
}

sentences:
How to handle two players playing on one keyboard with Box2D (LibGDX)? I'm making a racing game with LibGDX and Box2D. I've been using this tutorial to implement the basic physics, and it works properly.

My main problem is to implement two different sets of keys (UP-DOWN-LEFT-RIGHT and ASDW) to control two different instances of a Car class on a same screen.

The code I have yet for handling one set of input (for KeyDown):

@Override
public boolean keyDown(int keycode) {
    if (keycode == Input.Keys.UP) {
        if (!pressedKeys.contains(Key.Up)) {
            pressedKeys.add(Key.Up);
        }
    } else if (keycode == Input.Keys.DOWN) {
        if (!pressedKeys.contains(Key.Down)) {
            pressedKeys.add(Key.Down);
        }
    } else if (keycode == Input.Keys.LEFT) {
        if (!pressedKeys.contains(Key.Left)) {
            pressedKeys.add(Key.Left);
        }
    } else if (keycode == Input.Keys.RIGHT) {
        if (!pressedKeys.contains(Key.Right)) {
            pressedKeys.add(Key.Right);
        }
    }
    return false;
}

(KeyUp):

    @Override
public boolean keyUp(int keycode) {
    if (keycode == Input.Keys.UP) {
        if (pressedKeys.contains(Key.Up)) {
            pressedKeys.remove(Key.Up);
        }
    } else if (keycode == Input.Keys.DOWN) {
        if (pressedKeys.contains(Key.Down)) {
            pressedKeys.remove(Key.Down);
        }
    } else if (keycode == Input.Keys.LEFT) {
        if (pressedKeys.contains(Key.Left)) {
            pressedKeys.remove(Key.Left);
        }
    } else if (keycode == Input.Keys.RIGHT) {
        if (pressedKeys.contains(Key.Right)) {
            pressedKeys.remove(Key.Right);
        }
    }

    return false;
}

How should I do to be able to handle UP-DOWN-LEFT-RIGHT and ASDW keys simultaneously?

Note: A Car is instantiated in the main class.

I can always add more code if needed.

sentences:
How to implement an intelligent enemy in a shoot-em-up? Imagine a very simple shoot-em-up, something we all know:

You're the player (green). Your movement is restricted to the X axis. Our enemy (or enemies) is at the top of the screen, his movement is also restricted to the X axis.
The player fires bullets (yellow) at the enemy.

I'd like to implement an A.I. for the enemy that should be really good at avoiding the players bullets. My first idea was to divide the screen into discrete sections and assign weights to them:

There are two weights: The "bullet-weight" (grey) is the danger imposed by a bullet. The closer the bullet is to the enemy, the higher the "bullet-weight" (0..1, where 1 is highest danger). Lanes without a bullet have a weight of 0. The second weight is the "distance-weight" (lime-green). For every lane I add 0.2 movement cost (this value is kinda arbitrary now and could be tweaked).

Then I simply add the weights (white) and go to the lane with the lowest weight (red). But this approach has an obvious flaw, because it can easily miss local minima as the optimal place to go would be simply between two incoming bullets (as denoted with the white arrow).

So here's what I'm looking for:

Should find a way through bullet-storm, even when there's no place that doesn't impose a threat of a bullet.
Enemy can reliably dodge bullets by picking an optimal (or almost optimal) solution.
Algorithm should be able to factor in bullet movement speed (as they might move with different velocities).
Ways to tweak the algorithm so that different levels of difficulty can be applied (dumb to super-intelligent enemies).
Algorithm should allow different goals, as the enemy doesn't only want to evade bullets, he should also be able to shoot the player. That means that positions where the enemy can fire at the player should be preferred when dodging bullets.

So how would you tackle this? Contrary to other games of this genre, I'd like to have only a few, but very "skilled" enemies instead of masses of dumb enemies.

sentences:
applying rotation and speed to move user My player has a position (vec3), rotation (quaternion) and speed.

I have a fixed time step.  At each tick, I work out from key-state etc what rotation and speed adjustments to make.

How do I now compute the new position?

And how, for the graphics which run at a different framerate, do I compute the the tweening for smooth movement?

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:
Need a reference to an [unusual?] RTS setting Imagine an RTS game where so-called basic units play the main role throughout a whole game session.

In my game basic units are actually programmable by a player (like in Colobot/Ceebot), that's why it is so important to keep them significant from the first to the last second of each session.

Problem

I found out that end-game of a typical session is quite boring, no impression of... say, development of a game since middle-game. Don't know how to describe this feeling correctly.

I'm looking for reference to other games where such problem of end-game was resolved.

Thanks in advance.

UPDATE

Some more background:

The game is about splitting tasks which are best solved by chip and by brain. Player does not have to micromanage, he or she writes algorithms (in advance) instead. Players are to make strategic decisions and give high-level orders. I.e. if you have better combat algorithms for a group of bots == you're better at micromanagement. The same goes for engineering units in home front.

The typical border between middle-game and end-game is when all "free" resource sources are conquered by one of players, resources are being drilled, roads a constructed and factories produce bots at full speed (everything is automated by players in a way they want). Frontier line is more or less clear and stable.

From this point there is no choice of rush/produce/defend, you are to collect forces, invent tricky maneuvers and attack.

At this moment there is only one work for players brains: tricky tactics. It is something human brain excels at (in comparison to algorithms).

Balance is so that frontal attacks are very costly (good defense can destroy a great amount of units if an attack is frontal). Therefore attacking from multiple directions, "red herring" и fast relocation along the front line become very important (exactly like at wars in the middle of XXth century, e.g. WWII).

Again, this is where the human brain is much better than any program, so it makes no sense [for players] to write algorithms for such tasks.

My concerns is that in end-game it becomes just like a hexagon game with a very limited amount of units since all underlying tasks are "encapsulated" by algorithms.

Supreme Commander resolves such problem by introducing experimentals, Populous does it with spells (I remind, Populous: The Beginning has only five basic units).

Again, thanks in avance :-)

sentences:
Unity WheelJoint2D will not rotate when increasing motor speed I have a wheel joint 2D attached to a game object in Unity:

In its associated wheel script I am increasing the motor speed as described in the tutorial.

public class Wheel : MonoBehaviour
{
    WheelJoint2D wheel;
    JointMotor2D motor;

    void Start()
    {
        wheel = GetComponent<WheelJoint2D>();
        motor = wheel.motor;
    }

    void Update()
    {
        if (Input.GetKey(KeyCode.RightArrow))
            motor.motorSpeed += 10;

        if (Input.GetKey(KeyCode.LeftArrow))
            motor.motorSpeed -= 10;

        //Debug.Log(motor.motorSpeed);
    }
}

The problem is that the sprite does not rotate and I am not certain as to why?

Does the wheel joint have to be attached to another rigid body in order to function?

sentences: How should I structure a design document? Should the design document be a continuous line of text, with real sentences, more like a description of the entire game, or should I structure it in simple points? What are the benefits, and are there more ways of structuring it?

sentences:
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:
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:
Player is instantly teleported back I built a teleporter that changes a players position and rotation.
He is instantly teleported back. Why?

I'm using the standard FPS Controller.

sentences:
Why are my exported illustrator graphics blurry and messy in-game? Currently I use illustrator to create artwork for my Android games.  My art size is pretty small, just 32x32. It looks OK in illustrator, but when exporting, my art is blurry and looks messy! Could you give some advice? How can you get vector-like art? And which is better for small images, pixel art or vector?

My large-size export image:

This is my exported result (The pixel is so bad when zooming):

sentences:
Implementing Separating Axis Theorem to Detect and Handle Sliding Collisions I am having a bit of difficulty detecting collisions properly with separating axis theorem. My code seems to be giving a lot of false alarms. Also, I've looked into implementing sliding collisions with the data from the theorem.

This is the resource I used for this algorithm:
https://stackoverflow.com/questions/115426/algorithm-to-detect-intersection-of-two-rectangles?rq=1

This is my code for detecting collisions:

// Note .boundingBox is a set of four vertices for each rectangle. It is:
// [Bottom Right, Bottom  Left, Top Left, Top Right]

// Also .edge is the set of four edges for each rectangle. It goes:
// [Bottom, Left, Top, Right]

// Only take two edges of each rectangle since two edges share each axis
var edges = this.edges.slice( 0, 2 ).concat( polygon.edges.slice( 0, 2 ) );

// Loop through the axes of both rectangles
for ( var i = 0; i < edges.length; i++ )
{
    var oppositeSides = true,

        // Convert the edge to an axis by finding its normal,
        // then convert the axis to a unit vector
        magnitude = i % 2 === 0 ? 50 : 25,
        normal = {
            x: -edges[ i ].y / magnitude,
            y: edges[ i ].x / magnitude
        },

        // Take one point on the current shape and find its projection onto the axis
        currentPoint = i < 2 ? this.boundingBox[ i ] : polygon.boundingBox[ i - 2 ],
        nextPoint = i < 2 ? this.boundingBox[ i + 2 ] : polygon.boundingBox[ i ],
        shape1Vector = {
            x: nextPoint.x - currentPoint.x,
            y: nextPoint.y - currentPoint.y
        },
        shape1DotProduct = shape1Vector.x * normal.x + shape1Vector.y * normal.y,
        shape1DotProductSign = shape1DotProduct >= 0;

    // Take all the points on the other shape and project their distance
    // onto the axis. If their dot product sign is opposite to the point
    // on the same shape, then there must be no collision
    for ( var j = 0; j < 4; j++ )
    {
        nextPoint = i < 2 ? polygon.boundingBox[ j ] : this.boundingBox[ j ];

        var shape2Vector = {
                x: nextPoint.x - currentPoint.x,
                y: nextPoint.y - currentPoint.y,
            },
            shape2DotProduct = shape2Vector.x * normal.x + shape2Vector.y * normal.y,
            shape2DotProductSign = shape2DotProduct >= 0;

        if ( shape2DotProductSign === shape1DotProductSign )
            oppositeSides = false;
    }

    if ( oppositeSides )
        return true;
}

return false;

Now for handling the sliding collisions, I attempted to project the rectangle's velocity vector onto the axis where there is the least overlap, then multiply that scalar dot product by the unit vector of the axis, but that seems to result in strange behaviour where the velocity goes to insane velocities.

sentences:
How to keep loading screen for minimum time? Making my first game and stuck at keeping the loading screen visible for some time. It shows for an instance and disappears. By using loadasync the previous scene runs in the background? Do i have to pause everything and then move to the next scene? Thank you! The code is as follows:

public void LoadNextLevel()
{
    StartCoroutine(LoadAsyncronously());
}
IEnumerator LoadAsyncronously()
{
    int nextSceneIndex = SceneManager.GetActiveScene().buildIndex + 1;
    loadingScreen.SetActive(true);
    AsyncOperation operation = SceneManager.LoadSceneAsync(nextSceneIndex);
    float progress = Mathf.Clamp01(operation.progress / 0.9f);
    slide.value = progress;
    yield return new WaitForSeconds(2);
    SceneManager.LoadSceneAsync(nextSceneIndex);
}

sentences:
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:
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:
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:
How do I scale room transition surfaces to fit mobile display? I followed a tutorial on how to add a left swipe room transition, which works very well. My problem is that it won't scale to my Android display. I know that it's being drawn to the GUI layer and I've tried resizing the GUI to the display width and height but I didn't see any changes. It's a really nice effect that I want to get working for my game.

Create Event:

currentframe = 0
maxframes = 45

persistent = true; // when changing room keep this object alive

// copy the old room so we can display it on the second room
sur_oldroom = surface_create(room_width,room_height);
surface_copy(sur_oldroom,0,0,application_surface);

// We have recorded what the old room looks like so we can instantly go to the next room.
room_goto(rm_game);

Destroy Event:

surface_free(sur_newroom)
surface_free(sur_oldroom)

Step Event:

currentframe++

if (currentframe > maxframes) {
    instance_destroy() // The transition has finished so destroy it
}

// We are now on the second room so record that room.
if (currentframe == 2) {
    sur_newroom = surface_create(room_width,room_height);
    surface_copy(sur_newroom,0,0,application_surface);
}

Draw GUI Event:

if (currentframe > 1) {

    // convert the number of frames that have passed into a number between 0 and the room width
    var slideamount = EaseOutQuad(currentframe,0,room_width,maxframes)

    if (surface_exists(sur_oldroom)) {
        draw_surface(sur_oldroom,-slideamount,0)
    }

    if (surface_exists(sur_newroom)) {
        draw_surface(sur_newroom,room_width-slideamount,0)
    }
}

/// I do this to hide the flicker where the next room pops up for 1 frame
if (currentframe == 1) {
    if (surface_exists(sur_oldroom)) {
        draw_surface(sur_oldroom,0,0)
    }
}

I'm using Game Maker Studio 1.4.

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:
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:
2D Collisions engine I am working on a fabric simulator at low level, I have done some work and at this point there are some points where I would appreciate help.

The input of the program is a DRF file. This is a format used in sewing machines to indicate the needles where to move.

The 2D representation is accurate, I parse the DRF info to a polyline, apply tensions and I extrude this in a openGL render.

Now I am trying to achieve the 3D ZAxis physics. I tried two methods:

1) Asuming information

First method is based on constrains about the process of  manufacturing:
we only take care of the knots where a set of yarns interact and comupte z separation in this crucial points. The result is regular: good in a lot of cases but with a lot of botched jobs in order to avoid causistincs where this is not a good assumtion (for example, doing beziers, collisions in zones between this crucial points). We desist on this alternative when we saw there was a lot os causistic we would have to hardcode,probably  creating aditional gliche.

2) Custom 2D Engine

The second attempt is to aprox the yarns with box colliders 2D, check collisions with a grid, and compute new Z in funcion of this. This is by far more expensive, but leads to a better results. Although, there is some problems:

The accuracy of box colliders over the yarn is not absolute ( there are ways to solve this but it would be great to read some alternatives)
There is not iterative process:

First we compute collisions pairwise, and add to each collider a list of colliding colliders. Then, we arrange this list and separate the Z axis in function of yarn's radius with center 0.The last step is to smooth the results from discrete z to a beziers or smoothing filters. This leads to another glitches.
If I extend this recomputation to all the collisions of the current collisions, I get weird results because z changes are bad propagated( maybe I am not doing good this point)
Some colliders are recomputed wrong ( first computed yarns have more posibilites to be altered for the last ones, leading on gliches)

some of the glicthes (mainly in the first yarns computed:

Details of bad aproximated curves:

At this point I have some questions:

Can I fix this glitches (or a great part at least)?
Glitches about bad aproximation and glitches for z recomputation
A 3D engine like ODE could do the job in a reasonable time?

If you need some specific code don't hestiate on ask for it.

Thanks a lot!

sentences:
WebGL fragment shader pixel position I have written a fragment shader, on a shape which is a square made with gl.TRIANGLE_STRIP, and which displays a radar:

To build the radar, I'm using distance from the center of the shape.

Currently, I'm using gl_FragCoord and have to pass the shader the size of the window, the position of the center of the radar, in order to determine where I am in the shape. I'm not really OK with that..

I would like to know if there is a better way to make the shader, to make it independent from display variables.

For example I thought I could use gl_PointCoord whose x and y coordinates goes from 0. to 1., but it requires to use GL_POINTS... I could give it a try by using GL_POINTS, but I'm not sure it's THE best solution.

For example, I could make a 3d scene, with lot of cubes, and display this radar on the faces of that cube. If the shader isn't independent from gl_FragCoord, it feels like it will be a nightmare to make it work.

Is there a way to get the relative position of the pixel we are giving the color, in the shape (triangle) we are rendering?
Do you have suggestions / tips?

sentences: Why create meshes instead of using Planes? I'm working on a top down 2D game in Unity and I want to create levels dynamically. All tutorials I find tend to talk about generating meshes so I've followed some great tutorials such as this one. However, here's where I'm not understanding the point. What's the difference between doing all that work to render a plane when you can just use the Plane object with the height/width configured to match what the manual creation has?

sentences: SDL2 - Why use `SDL_Window* win` and not `SDL_Window win`? Is there a reason to allocate the window on the heap and not the stack?

sentences:
Adding mesh's\objects to procedural isosurface terrain Thanks again for reading!

So following on from my last question, I have my fully working isosurface terrain and now its time to add my trees and grass and whatever to the world.

The old way I was doing it was to cast rays in a grid faceing down over the terrain, I would then read the normal from the ray hit and place things if the normal was < as value.

I would do this at different grid resolutions for each plant\tree\grass time and offset there x, z and scale by some random value then adding the object to my 2d BV tree because I was only working with height map terrain so I only had one row of bounding volumes for the tree.

I can still use the above method but as you know it will only place objects on parts of the terrain that can see the sky.

Part of building my new terrain system involved making a real octree so I no that I will use that to store my objects but what is the best way to generate my object positons.

From what I have read around I should somehow use the voxels I build but I'm not really sure how I would go about it.

sentences:
Looking for a market price algorithm for a turn based game I am new at game development and am now facing the problem for a market price algorithm in a turn based game.
What I try to achieve:

the market starts with fixed bidding and asking prices for one piece of goods. To keep it simple the minimum value is 1, the maximum 20
if the user buys/sells the same goods in too large quantities in a certain amount of turns, the prices should rise/drop; simple supply and demand logic. The maximum amount of a goods per transaction is 100
if the user doesn't trade that good for a few turns, it should adjust the price in the other direction
there are certain type of goods that can be "easily" produced by the player and are thus sold and some that are harder to get by and are usually bought.
the market can sell each good infinitely and would also buy everything, so it has no stock to take into account.

What I tried and didn't work:

if the accumulated quantity of bought/sold good reaches 500 (I use negative values for buying) the price rises or drops by 1 respectively
to factor the turns into it, I thought I just reduce the accumulated value by 10 each turn and then adjust the price if it reaches 0 again. This has one big flaw, as you can easily cheat by just selling a small amount, wait a few turns and the price will rise; repeat until the price reaches the maximum of 20.

Any simple ideas on how to fix this?
ps. I hope this is an appropriate question to ask here

sentences:
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:
Where can I find sales figures for PSN Minis? I work for a small game studio that develops games for iOS and Android currently. The engine we are building will be portable and our upcoming game is quite ambitious. Therefore we are considering porting it to PSP also, making it available at the PSN as a mini. I have been searching for days now but I am having trouble finding any numbers of what an average PSN mini game can sell. What a hit or a bad game could sell is also really interesting.
As we are trying to calculate if it is worth going into this market any clue would be helpful!

sentences:
Android Opengl: Alternate values for gl_FragColor I'm writing an Android application that utilizes opengl to perform some changes to the camera output.  I've written my code in such a way that I finally figured out what is causing the performance issue.

#extension GL_OES_EGL_image_external : require
precision mediump float;
uniform samplerExternalOES sTexture;
uniform vec4 vColor;
const int MAX_COLORS = 6;
uniform float vHues[MAX_COLORS];
uniform float vOffsets[MAX_COLORS];
varying vec2 v_CamTexCoordinate;

float rgb2hue(vec4 c) {
    vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
    vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
    vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));

    float d = q.x - min(q.w, q.y);
    float e = 1.0e-10;
    return abs(q.z + (q.w - q.y) / (6.0 * d + e));
}

bool isInRange(float a1,float a2, float vOffset) {
    if(a2 < 0.0) {
        return false;
    } else if(abs(a1-a2) < vOffset) {
        return true;
    } else if( a1 > a2) {
        return (1.0 - a1 + a2) < vOffset;
    } else {
        return (1.0 + a1 - a2) < vOffset;
    }
}

vec4 getGrey(vec4 c) {
    float grey = (c.r + c.g + c.b) / 3.0;
    return vec4(grey, grey, grey, c.a);
}

void main() {
    vec4 c = texture2D(sTexture, v_CamTexCoordinate);
    bool hasColor = vHues[0] >= 0.0;
    float hue = rgb2hue(c);
    vec4 test = getGrey(c);
    for(int i=0; i < MAX_COLORS; i++) {
       if(isInRange(hue, vHues[i], vOffsets[i])) {
          //If I uncomment this line the performance gets terrible
          //test = c;
       }
    }
    gl_FragColor = test;
}

There is a significant hit to performance (a lot of frames are skipped) when I uncomment the line above.  I basically want to use the original color sometimes and a different color depending on some condition.  It works but is there a more efficient way to do this?  Also, why does this perform so poorly?

sentences:
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:
Is there a standard way to store 3D meshes to easily communicate between libraries? In a 3D game lots of different systems need to know about geometry data, however the only way they seem to be able to agree to on in representing it by an array of triangles.

Can anyone recommend a good geometry manipulation library that will allow me to easily integrate the drawing library(OpenGL), the physics engine(Bullet), Serialization(Several 3D file formats) and my own code(objective-c++).  Focus on the a representation between the drawing library and the physics engine.  Also if the library can triangulate a mesh definition that would be very helpful.  My code can work around what exists already.

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: Rules to start and naming a game studio I would like to know if there is any copyright related rules to name a game studio specially for android appstore. I searched at the U.S. Copyright Office website and found many matches for same names. None of them are game studios though. Is it legal to choose one of those names if none of them are game studios? Also, what are the rules I need to know for starting a new indi game studio?

sentences:
How 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 you handle iPhone graphics for both high and low DPI settings? How do you guys create your game graphics for iPhone? Considering you need a retina version and a nomal one?

Do you create a big version of your image, save HD, then resize to smaller version, and save Normal?

Or do you create a vector image with say, fireworks, save HD, then resize, then save Normal?

sentences:
How do I draw non-smoothed fonts in MonoGame 3.5? I don't want to smooth the tiny fonts I'm building but even disabling ClearType system wide doesn't let me create SpriteFont files with sharp characters. There doesn't seem to be an option for smoothing in the .spritefont file I could set to "disabled". Are there any configs that affect how spritefonts are generated?

I'm using MonoGame 3.5 with Visual Studio 2015 and building the spritefonts via Content.mgcb thing that is added automatically into a MonoGame project.

I tried using Give Your Fonts Mono(spacing) tool but it doesn't have an option to disable smoothing.

Trying to follow this tutorial with BMFont generator and added the reference in the example, but the MonoGame.Extended thing doesn't appear and instead of automatically recognized importer I get [missing] [null]. After that I tried adding some other packages that come with MonoGame pipeline DLLs but no luck.

Tried to use XNA Content Compiler but it throws me an exception with some important object contentBuilder being null. Installing XNA framework doesn't fix the issue.

If there are ways to draw text without using SpriteFonts that allow to use non-smoothed characters, I'd like to know how.

sentences:
Will I lose the mesh if I delete the original prefab? I'm working in Unity 5, and I currently have the following setup:

My project contains two prefabs which we'll call "Cube" and "CubeT". Cube was imported from an FBX file generated by Autodesk 3DS Max, and CubeT was created within Unity. I want to be able to modify Cube's mesh collider, but Unity will not allow me to do so. Therefore, I've thought about adding the mesh within Cube to CubeT and removing Cube. The thing is, I'm worried that I'll lose the mesh when I delete Cube, and subsequently lose the reference to it in CubeT.

If I reference Cube's mesh in CubeT and then remove Cube from the project by deleting the asset within Unity, what will happen? Will the needed mesh remain in the project or am I going to have to find another way?

sentences:
Creating LOS zones on a 2D grid for chase AI I have a 2D grid, around 20x20, stored as an array. Each grid cell can contain an opaque object or not. I also already have an algorithm to calculate LOS between any two squares via Bresenham.

I want to implement an AI that chases the player in a step-time game. The current rules I have are (re-evaluated with this priority each step):

If we can see the player go get them (a step at a time with Dijkstra/A* pathfinding).
If we can't see the player go to where we last saw them.
If we can't see the player and are where we last saw them, give up and head home.

But I want to add a further rule:

If we can't see the player and are where we last saw them, but there is only one way they could have gone to now be hidden without coming past us, go that way.

This turns out to be really hard to detect. What I have wondered about doing is to assign each grid square one or more zone numbers, such that every square that is in a given zone can see all other squares in that zone; then if there is only one neighbouring zone than the guard has not visited the guard will move into it. However, the zones overlap and a ridiculously large number of them are generated for even simple maps (due to, for example, different parts of a room gradually becoming visible as you walk down a corridor into it) which makes this awkward or difficult, and the generation algorithm seems to be at least O(n^2) or worse. Alternatively the zones could be calculated as a navigation mesh but this seems very difficult to compute from a grid map.

Is there any way to do this without manually putting hints on the map?

sentences:
(Phaser) Preload Future States in Create? I'm a first time user of Phaser, been trying to make a simple point and click type game. I'm trying to keep things very modular, so I'm defining a list of levels (states) in a JSON, and then every level has its own JSON containing the objects within that level.

However, I'm encountering an issue in that, when changing states, I get a black flash while the assets for the next state load (this happens whether I iterate through the JSON list or define everything manually). From what I've read, all sprites should be loaded in the preload stage, however, by doing this I'm causing that tiny but noticeable black pause.

I know one way would be to simply load every asset at the start of the game, but that seems incredibly inefficient (wouldn't that fill up the memory immensely?). I would rather load a state's assets from the "parent" state. However, in my quick test (which maybe I did wrong) it seems that game.load doesn't work properly if done within the create stage? What is the best approach to doing this?

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 to create card layout in a trading card game Libgdx I am trying to create a card layout for my trading card game. Right now I use this code:

public class ClientCard extends Table {

    ClientCard(int cost, int attack, int health, String title, String description) {
        Texture texture = new Texture(Gdx.files.internal("data/"+title+".jpg"));
        Image image = new Image(texture);
        this.add(image).width(Gdx.graphics.getWidth() / 10).height(Gdx.graphics.getHeight() / 7).colspan(3);
        this.row();
        Skin skin = new Skin(Gdx.files.internal("skin/glassy-ui.json"));
        Label cardName = new Label(title, skin);
        Label cardDescription = new Label(description, skin);
        Label cardCost = new Label(cost + "", skin);
        Label cardAttack = new Label("", skin);
        Label cardLife = new Label(health + "", skin);
        this.add(cardName).colspan(3).padBottom(5);
        this.row();
        this.add(cardDescription).colspan(3).padBottom(5);
        this.row();
        this.add(cardCost);
        this.add(cardLife);
        this.add(cardAttack);
    }
}

It works, it shows the card data, but it looks pretty bad and it's not very compact, also I can't set the outer border for the Table (table.debug is not good). What I want is something like this:

I want to use scene2d so it's easier to fill the card with the data I want (life, attack etc). Any idea how I could realize this?
Thanks!

sentences:
NegaScout with Zobrist Transposition Tables in Chess I'm trying to put Transposition tables into my alpha beta scout. I do see an incremental speed boost I think toward mid or late game, however, even with a table size of 1-2GB, its may or may not be slower than just not reading from the Transpose table at all. I'm also noticing some less than efficient moves if I were to play the exact same game without the tables.

I tested my Zobrist key hashing, and they come out properly even after making and undoing moves. I don't believe they are the issue. I tried to follow the advice of these articles in designing the alpha/beta pruning.
http://web.archive.org/web/20070809015843/http://www.seanet.com/~brucemo/topics/hashing.htm
http://mediocrechess.blogspot.com/2007/01/guide-transposition-tables.html

Can anyone help me identify a mistake? Perhaps I'm not understanding the evaluation of checking alpha vs beta from the hash. Or is 1-2GB too small to make a difference? I can post more of the Transposition table code if need be.

 public int alphaBetaScout(Board board, int depth, int alpha, int beta, bool color, bool
quiscence)
{
    // !!!! With or without this specific section, and any other Transpose.Insert, doesn't make the game play or evaluate any faster.
    HashType type = HashType.AlphaPrune;
    HashEntry h = Transpose.GetInstance().Get(board.zobristKey);
    if (h != null)
    {
        if (h.depth >= depth)
        {
            if (h.flag == HashType.ExactPrune)
            {
                return h.scored;
            }
            if (h.flag == HashType.AlphaPrune)
            {
                if(h.scoredState > alpha)
                {
                    alpha = h.scored;
                }
            }
            if (h.flag == HashType.BetaPrune)
            {
                if(h.scoredState < beta)
                {
                    beta = h.scored;
                }
            }
            if (alpha >= beta)
            {
                return alpha;
            }
        }
    }

    if (board.terminal)
    {
        int scoredState = board.Evaluate(color);
        Table.GetInstance().Add(board.zobristKey, depth, Entry.EXACT, scoredState);
        return scoredState;
    }

    //May do Quescience search here if necessary && depth = 0

    Stack movesGenerated = GeneratePossibleMoves();
    while(!movesGenerated.isEmpty())
    {
        int scoredState = MAXNEGASCOUT;

        board.MakeMove(movesGenerated.pop());
        int newAlpha = -(alpha +1)
        scoredState = -alphaBetaScout(board, depth - 1, newAlpha, -alpha, !color, quiscence);

        if (scoredState < beta && alpha < scoredState)
        {
            scoredState = -alphaBetaScout(board, depth - 1, -beta, -scoredState, !color, quiscence);
        }

        board.UndoMove();

        if (scoredState >= beta)
        {
            Table.GetInstance().Add(key, depth, Entry.BETA, beta);
            return scoredState;
        }

        if (scoredState > alpha)
        {
            type = HashType.ExactPrune;
            alpha = scoredState;
        }
    }
    Table.GetInstance().Add(key, depth, type, alpha);
    return alpha;
}

sentences:
Why does collision only work sometimes when there are multiple objects in the game? when i was making a pygame in python for the first time
i kinda have a problem where sometimes the player and the object would touch and the game would not close as intended i dint seem to find the solution to this problem mostly it would work but sometimes the collision would occur but the player would clip right through
i have tried numerous collision techniques which i have heard but none seem to work as well
the problem would still exit

here is my code

import math
import pygame
import random
RED=(255,0,0)
BLUE=(0,0,255)
bg_COLOR=(0,0,0)
WHITE=(255,255,255)

pygame.init()
font = pygame.font.SysFont('monospace', 15)
wid=720
hight=600

player_size = [40,40]
flag=0
player_pos = [int(wid/2),hight-2*player_size[1]]

enemy_size = 50
enemy_pos = [random.randint(0,wid-enemy_size),0]

en_list=[enemy_pos]
speed=10
en_num=4
block_evade=0

screen = pygame.display.set_mode((wid,hight))
pygame.display.set_caption('x wing shooter alpha v1')
game_over = False

clock = pygame.time.Clock()
def score_count(block_evade,block_attack=0):
    text = font.render('score:', 1,WHITE)
    text2 = font.render(str(block_evade + block_attack),1,WHITE)
    screen.blit(text,(0,0))
    screen.blit(text2,(50,0))

def game_quit():
     pygame.display.quit()
     pygame.quit()

def spawn_en(en_list):
    delay = random.random()
    if len(en_list)<en_num and delay < 0.2:#
        x_pos=random.randint(0,wid-enemy_size)
        y_pos=0
        en_list.append([x_pos ,y_pos])

def create_en(en_list):
    for enemy_pos in en_list:
        pygame.draw.rect(screen,BLUE,(enemy_pos[0],enemy_pos[1],enemy_size,enemy_size))

def detect_col(player_pos, enemy_pos):
    p_x=player_pos[0]
    p_y=player_pos[1]

    e_x=enemy_pos[0]
    e_y=enemy_pos[1]
    x1=int(e_x+enemy_size/2)
    x2=int(p_x+player_size[0]/2)
    y1=int(e_y+enemy_size/2)
    y2=int(p_y+player_size[1]/2)
    distance =int(math.sqrt((math.pow(x2-x1,2))+(math.pow(y2-y1,2))))

    if(e_x + enemy_size >= p_x > e_x):
        if(e_y + enemy_size >= p_y > e_y):
            return True
    elif(p_x + player_size[0] >= e_x > p_x):
        if(p_y + player_size[1] >= e_y > p_y):
            return True
    elif(distance <= int(enemy_size/2)):
        return True

def fall_en(en_list):
    block_evade=0
    for idx, enemy_pos in enumerate(en_list):
        if enemy_pos[1] >= 0 and enemy_pos[1]<=hight:
            enemy_pos[1]+=speed
        else:
            en_list.pop(idx)
            block_evade+=1
    return block_evade

def col_check(en_list, player_pos):
    for enemy_pos in en_list:
        if detect_col(player_pos,enemy_pos):
            return True
        else:
            return False

while not game_over:

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
           game_quit()
           flag=1
           break
    if event.type == pygame.KEYDOWN:
        x = player_pos[0]
        y = player_pos[1]
        if event.key == pygame.K_LEFT and player_pos[0] >= 0:
            x-=10
        elif event.key == pygame.K_RIGHT and player_pos[0] <= wid-player_size[0]:
            x+=10
        elif event.key == pygame.K_DOWN  and player_pos[1] <= hight-player_size[1]:
            y+=10
        elif event.key == pygame.K_UP  and player_pos[1] >= 0:
            y-=10
        player_pos = [x,y]

    if flag != 1:
        screen.fill(bg_COLOR)

    spawn_en(en_list)
    block_evade+=fall_en(en_list)
    if col_check(en_list, player_pos):
        game_over=True
    create_en(en_list)
    score_count(block_evade,0)
    pygame.draw.rect(screen,RED,(player_pos[0],player_pos[1],player_size[0],player_size[1]))

    clock.tick(20)

    pygame.display.update()

else:
    game_quit()

sentences:
Does it make sense to use both TCP and UDP at once? After reading Is UDP still better than TCP for data-heavy realtime games?, I'm wondering if it makes sense to use both TCP and UDP at the same time, but for different things:

TCP for sending information that is sent infrequently, but should be guaranteed to arrive reliably.
Such as score updates, a player's name, or even the on/off state of a light in the game world.
UDP for transmitting information that is updated constantly and can be lost occasionally, since newer information is always on the way.
Such as position, rotation, etc.

Is this a reasonable idea?
What are the possible drawbacks?
Are there better ways to handle this?

sentences:
Resolution problems with global illumination in Unity I am pretty new to Unity and after hours of searching I have finally figured out how to set everything up for (baked) global illumination to work for my model.

However the model is an export from a CAD program and so the mesh is rather bad quality (it seems it is optimized by the CAD program for minimum number of triangles). At least I am implicitely assuming that this is a bad quality mesh because it would by standard of finite element meshes, which of course doesn't directly apply here.

So what I am observing is three resolution problems (see images):

1) the lighting in the scene is somewhat "cloudy" although the faces are evenly colored and there are no lights that could explain the patterns (see eg. area inside drawn red rectangle)

2) there are slight jumps in brightness visible at the edges of the triangles of the mesh (see red arrows and, for comparison image of mesh)

3) the shadows are pixelated (see red ellipse, yes I have already tried to change shadow quality to high in the project settings, but to no avail)

Because there are so many settings that affect lighting, I assume it will take me hours if not days with trial and error to figure that out.

Which settings are likely to be responsible for these three problems?

I found a display mode of the scene view, called: Baked Global Illumination->UV Charts that probably explains the first problem, but I don't know how to interpret it, see third image below:

sentences:
Jagged text + additive blend in openGL I am having some trouble understanding how openGL blend modes work. At first I was using
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
and it all looked fine except that I couldn't use any additive glowing effects simultaneously without changing blend modes all the time. So I was advised to use
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA) and textures with premultiplied alpha and now both additive and "normal" textures appear fine except that for some reason some textures have slightly jagged/thick outlines. I found that this only happens to images that have semi-transparent pixels but I'm not sure why.

This is an example of anti-aliased text with this kind of outline. The first is how it used to look and how I want it to look and the second is how it looks with the mode I'm trying to use. I don't want its color blended with the background. Is what I'm asking possible?

sentences:
How to reset the score to 0 when reloading the game? My scoring system uses DontDestroyOnLoad to persist between scenes:

public class ScoringSystem : MonoBehaviour {
 private int score = 0;

 public void Correct(int number){
     // If correct add score;
     score = score + number;
 }

 void Start () {
     score = 0;
 }

 void Awake() {
   DontDestroyOnLoad(transform.gameObject);
 }

 public int GetScore(){
     return score;
 }
}

Here is another script that I should include a description about:

  public void iniTag()
 {
     jawab = true;
     Time.timeScale = 0;

         GameObject objek1 = GameObject.FindGameObjectWithTag("Benar1");
         GameObject objek2 = GameObject.FindGameObjectWithTag("Benar2");
         GameObject objek3 = GameObject.FindGameObjectWithTag("Benar3");
         GameObject objek4 = GameObject.FindGameObjectWithTag("Benar4");

         if (objek1.transform.parent.tag == "Jawab4" && objek2.transform.parent.tag == "Jawab3" &&
             objek3.transform.parent.tag == "Jawab2" && objek4.transform.parent.tag == "Jawab1")
         {
             PanelBenar.SetActive(true);
             buttonNext.SetActive(true);
             GameObject.Find("QuizManager").SendMessage("Correct", playerScore);

     }}

     void Start () {
       if (GameObject.Find ("QuizManager") != null) {
         ScoringSystem scoringSystem = GameObject.Find ("QuizManager").GetComponent<ScoringSystem> ();
         gameObject.GetComponent<Text>().text = scoringSystem.GetScore().ToString ();
             } else {
         Debug.Log("No Scoring system found. To test scoring system start from the front page scene");
       }
     }

sentences:
Ideas for attack damage algorithm (language irrelevant) I am working on a game and I need ideas for the damage that will be done to the enemy when your player attacks. The total amount of health that the enemy has is called enemyHealth, and has a value of 1000. You start off with a weapon that does 40 points of damage (may be changed.) The player has an attack stat that you can increase, called playerAttack. This value starts off at 1, and has a possible max value of 100 after you level it up many times and make it farther into the game. The amount of damage that the weapon does is cut and dry, and subtracts 40 points from the total 1000 points of health every time the enemy is hit. But what the playerAttack does is add to that value with a percentage. Here is the algorithm I have now. (I've taken out all of the gui, classes, etc. and given the variables very forward names)

double totalDamage = weaponDamage + (weaponDamage*(playerAttack*.05))
enemyHealth -= (int)totalDamage;

This seemed to work great for the most part. So I statrted testing some values...

//enemyHealth ALWAYS starts at 1000
weaponDamage = 50;
playerAttack = 30;

If I set these values, the amount of damage done on the enemy is 125. Seemed like a good number, so I wanted to see what would happen if the players attack was maxed out, but with the weakest starting weapon.

weaponDamage = 50;
playerAttack = 100;

the totalDamage ends up being 300, which would kill an enemy in just a few hits. Even with your attack that high, I wouldn't want the weakest weapon to be able to kill the enemy that fast. I thought about adding defense, but I feel the game will lose consistency and become unbalanced in the long run. Possibly a well designed algorithm for a weapon decrease modifier would work for lower level weapons or something like that. Just need a break from trying to figure out the best way to go about this, and maybe someone that has experience with games and keeping the leveling consistent could give me some ideas/pointers.

sentences:
Execute a trigger after research is complete I'm making a map where I want to destroy a building when it finishes researching a certain ability.

How do I create a trigger that accomplishes this?

sentences:
Moving a camera without rolling (tumble not arcball rotation) I'm trying to move my camera around using mouse+keyboard. I'm looking for specific camera behaviour however, and I cant figure out how to get it right. What I've found, is that to get a maya/tumble style camera, I need to multiply my xrotation in world space then my yrotation. Reversing the order it looks like this:

view = cam_move * //wasd in cam_space, this works correctly
       yrot * //before = world to camera space
       view*
       xrot; //after = model to world space

This means my xrot(world) doesn't interfere with my yrot(eye), which avoids unwanted roll induced by regular cam-space x-rotation.

My problem however, is that I want the xrotation to happen around a point (as if done in eye space) but without creating unwanted roll. I do not know how to get that result.

According to my sources It should be as easy as translating inversely before xrotating, then translating back after, but its just not working. Perhaps someone knows how I can get my cam to spin (yaw) around a point, without causing the unwanted roll?

SOLUTION:

Keeping track of pitch/yaw (mouse_move.xy) seperately, as well as the camera location, and making sure to multiply the yaw before the pitch. Pitching will create unwanted roll, but yawing wont create unwanted pitch, so its a matter of which you do first here.

To move the camera in eye space, I do this:

//make a mat3 rotation matrix and multiply it with current movement
if (keys['A'] - keys['D'] || keys['W'] - keys['S']){
    camlocation += //rotated then moved
        (glm::normalize(vec3(keys['A'] - keys['D'], 0, keys['W'] - keys['S']))*move_speed)*
        mat3(glm::rotate(mat4(1.0f), pitch, vec3(1, 0, 0)))*
        mat3(glm::rotate(mat4(1.0f), yaw, vec3(0, 1, 0)));
} //which will be a value to add in world space

Then under camera update, or where I build the view matrix, I do this:

view =
    glm::rotate(mat4(1.0f), pitch, vec3(1, 0, 0))* //pitch radian float
    glm::rotate(mat4(1.0f), yaw, vec3(0, 1, 0))* //yaw also in radian
    glm::translate(mat4(1.0f), camlocation);

Just remember that in OpenGL/GLM the matrix transformations are reverse order, due to how OpenGL does column/row matrix computations. (Compared to directx it saves a transpose operation in the shader (apparently))

Making sure to yaw before pitching, and both after translating (reversed on paper) avoids the unwanted roll, wich yields the desired tumble/maya effect!

sentences:
how to use 2D noise with a voxel sphere I have a bunch of voxels, lets just say 64x64x64, that I use to create a sphere/planet. This works very well, but once I try to apply noise to create a more interesting terrain things go wrong.

3D noise works fine, but I don't always want to create terrain with caves, overhangs etc, so I figured in those cases 2D noise would be a good solution, but I can't figure out how to use it correctly.

I tried this, where pos (world position) is a float3 and x and y are the input values for the noise function:

float x = math.acos(pos.z / math.length(pos));
float y = math.atan(pos.y / pos.x);

That results in a very noticeable seam along one axis and pinching at the poles though.

Is there any way I can convert my 3D world position into 2D coordinates, so that the noise function (Perlin or Simplex) will produce a seamless result without pinching?
I don't mind in the least if this causes symmetry or repeating features.

sentences:
Usage of math.Atan2 in a 3D coordinate system with Unity I have a simple question on usage of math.Atan2 function with Unity in a 3D environment.

I found this code on Unity's documentation for Math.Atan2. I changed it a bit to fit my
needs.

Vector3 waypoint = Random.insideUnitSphere + new Vector3(Random.Range(minX+1.5f, maxX-1.5f),prevPosY,Random.Range(minZ + 1.5f,maxZ - 1.5f));  //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;

I know how it works in a normal 2D coordinate system, however when switching to a 3D coordinate system, if I would want to move my character on the x-z plane, then how does this actually work mathematically?

I am assuming that it would be the angle between z and x axis?
so in a mathematical equation would it be, angle = Atan2(z/x) or Atan2(x/z)? Would both of them work?

sentences: How do you make the first person object the main camera? How can a first person object character be made to be the primary viewing camera in unityscript? Do I remove the main camera? or just turn one or the other on/off?

sentences:
wrongly scaled on cocos2dx 3.2 when render to multiple fbo (more > 1 deep)? i have bug that only happen when retina flag disabled.

i try draw multiple render texture to achive some multi post effect:
so i have 3 render texture,

fbo 1 for final pos effect
fbo 2 for back buffer w/light
fbo 3 for light mask

i apply this using fbo mechanisms of cocos2dx
 push the fbo1 to screen
push the fbo2 to fbo1
fbo 3 just for sampler texture for render in fbo2 shader

gameplay actor will be drawn on fbo2, after that fbo2 will be rendered to fbo1 ( we can apply some effect here) then fbo1 drawn to screen, then do some gui layering.

the thing is all gp actor drawn into fbo2 , "seems" become scaled down 3 times, so its like the small game screen on left bottom corner, but the light from fbo3 or gui that directly drawn to screen normal positioned and not scaled .

i really dontknow who is scale my fbo2, but i check the matrix its all correct. but seems lot setviewport in rendertexture.h, idont know how its work actualy, so if any one know how viewport work on fbo,

no direct open gl acces for my code except attach shader
if i dont use fbo2 one, ( using fbo1 directly ), the bug doesnt happen
** this doesnt happen on retina true ( scaled 2x ) , this happen on win32 or mac when i disabled retina ,
** tracing draw order correcty
** log  below on command:
onbegin fbo1
onbegin fbo2
onbegin fbo3
( i render some sprite to this fbo first ex: alpha gradient mask)
onend fbo3
( i render gp actor here)
onend fbo2
( render attached fbo2 texture with shader carries sampler of attached texture 3)
onend fbo1
( render attached fbo1 texturee)* may caries some shader
( render gui part )

sentences:
Detect Collisions While Dragging 3D Game Object Hello i am making a game in which i have to drag a sphere on x axis and z axis on a plane with my mouse and i have created walls from cubes so that my sphere not go anywhere else in the game but while dragging my sphere is not detecting collisions with the wall i also added rigidbody but nothing is working ths is my code thanks

using UnityEngine;
using System.Collections;

public class Ball : MonoBehaviour
{
    Rigidbody r;
    private void Start()
    {

        r = GetComponent<Rigidbody>();

    }

    void OnMouseDrag()
    {

        float distance_to_screen =
Camera.main.WorldToScreenPoint(gameObject.transform.position).z;
        Vector3 pos_move = Camera.main.ScreenToWorldPoint(new
Vector3(Input.mousePosition.x, Input.mousePosition.y,  distance_to_screen));
        transform.position = new Vector3(pos_move.x, transform.position.y,
pos_move.z);

    }

  }

sentences:
How can I get my meshes to work with Bullet Physics? The problem is that I'm trying to use my meshes with Bullet Physics for the collision part of my game.

When I attempted doing this method with my GLM(model loading library by nate robins) model, I get a segmentation fault in the debug, so I figured that it doesnt like the coordinate variables of the model.

If i use blender to export my model as a collision file, what type of file should I use?

I have heard of a .bullet exporter, but i dont know hot to integrate this python script into my Blender 2.5 program.

sentences:
Collision Detection: Simulation Inexplicably Slowing Down/How To Efficiently Calculate Extremes In Each Dimension BACKGROUND: As discussed here: Fast 2D collision detection in an unbounded space I am working on a collision detection algorithm for a simulation.  The catch that makes this case unique is that the objects in the simulation could all be in a very small area (e.g. 1000x1000) or in a very large area (e.g. 9 bil x 10 bil). Moreover, changes like this could occur very rapidly because of high object velocities, so I needed a somewhat sophisticated algorithm to deal with this situation.  In the end, I went with quadtrees (http://en.wikipedia.org/wiki/Quadtree).  When I finished writing the quadtree class and determined that it was functioning correctly, I uploaded it into my simulation.

THE PROBLEM: At first, the quadtree worked wonderfully.  I was just testing it out for the first time, so instead of feeding it updated bounds every time step of the objects with the least x value/greatest x value/least y value/greatest y value, I just fed is a large area that I knew would be good enough for the test case (10 mil x 10 mil).

In a test involving 1600 objects, my simulation ran almost four times faster than the brute force solution of checking every object against itself!  (about 28 fps instead of 7 fps) Wonderful!  I then proceeded to feed the quadtree the updated "bounds" of the simulation by finding the min/max x/y each frame (this is where the problem begins).  After updating each object's position, I simply checked to see if it was the new min/max extreme in each dimension:

    double tempradius = (*getMoveableEntityVector()[n]).Retradius();
    double tempx = (*getMoveableEntityVector()[n]).Retxpos();
    double tempy = (*getMoveableEntityVector()[n]).Retypos();

    if (n == 0) { //if it's the first object initialize the variables based off it
        minx = tempx - tempradius;
        maxx = tempx + tempradius;
        miny = tempy - tempradius;
        maxy = tempy + tempradius;
    }
    else { //all other objects
        if (minx > tempx - tempradius) { //if this object has the lowest x value
            minx = tempx - tempradius;
        }
        else if (maxx < tempx + tempradius) { //if has the highest x value
            maxx = tempx + tempradius;
        }

        if (miny > tempy - tempradius) { //if has lowest y value
            miny = tempy - tempradius;
        }
        else if (maxy < tempy + tempradius) { //if has highest y value
            maxy = tempy + tempradius;
        }
    }

Running through this simple code a mere 1600 times per time step slowed the simulation back down below the speed of my original brute force implementation! (about 7 fps)

WHY THIS DOESN'T MAKE SENSE TO ME: The original brute force implementation had to run through the relatively computationally intense distance formula (http://math.about.com/library/bldistance.htm) about 1600*1600 times per time step, or more exactly, 1600*1599/2 = 1,279,200 times per time step. I would think running through the above code once would be about as computationally intensive as doing the distance formula once.  How is going through the above code only 1,600 times costing me as much processor time as going through the distance formula more than a million times?!?

EDIT: The question is not directly about the quadtree; it is about the code above that finds the objects with the least/greatest x/y coordinates. (This code feeds its calcuations to the quadtree so the quadtree knows where to start, but it is definitely not quadtree code). The quadtree code ran quite fast until I added the above helper code. The only reason I mentioned the quadtree and the background to this issue is because the quadtree/background stuff gives context on why I think that this code should be going much faster (1000 comparable checks vs 1,000,000!)

TLDR (TOO LONG DIDN'T READ):  Check out the code above.  Is there something making it take up WAY more (about 1000x more!) processor time than I think it should be taking?

Thanks in advance for the time and help!

sentences:
TextMeshPro Shader choices difference (when to use) Actually I can see the visual difference that

bitmap/sprite shows blurry text like this:

pink distance field seems like missing texture:

distance field surface grey:

and lastly distance field masking/overlay seems to show the correct/expected result:

so what's the difference between those two? (masking/overlay)

sentences:
Rendering a Voxelized Mesh I've been reading many papers about how to voxelize meshes using different GPU techniques, but I've ran into a problem that I'm not sure how to solve properly.  I understand the process of how to convert a 3D mesh into voxels stored in a 3D texture, but I don't know a very efficient way to display the voxelized mesh after this.  Many of the papers I have read gloss over this part.

The one way I can think of accomplishing this is to draw an instanced cube, one for each voxel.  Each instanced cube would have texture coordinates that correspond to it's location in the 3D texture.  Every instanced cube would also go through a geometry shader.  If the texture's entry at the current coordinates was 0 (empty voxel), then the geometry shader simply wouldn't output any triangles.

Is this an efficient method/good idea?

sentences:
What range of values can HLSL's tex2D function return? When using the tex2d function in a HLSL shader, as so:

float height = tex2D(heightMap, IN.texCoord).r;

What range of values can be returned to the height variable? Is it always a number between 0.0f - 1.0f? Or does it depend on the texture or sampler?

sentences: How to keep same aspect ratio in different devices with cocos2dx? I have been making a board game and I am using cocos2dx. There are two scenes for now, One is main menu and the other is gameplay scene. When I run the apk on tablet with EXACT_FIT resolution policy in AppDelegate.cpp sprites in the scene seems stretched out a little bit. How can I maintain the same aspect ration in all devices and also the positions of game entities? Thanks.

sentences:
How do you make a water shader? I'm working on a minecraft-like world and recently saw this video with a water shader.  I searched but couldn't find any good info on how to do something similar.  Maybe I'm just googling the wrong thing.  Does anyone have any resources on how to do something like this?

minecraft water shader video

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:
Bullet Physics Terrain Im trying to Load an RGB image (.BMP) into bullet's btHeightfieldTerrainShape

Im using a loader that creates a openGL height map, it stores the data in a vector float, but I cant get the btHeightfieldTerrainShape to accept it.

I changed the vector float into a float array which contains height data according to the debugger, when loaded it takes forever to load the terrain, and when its loaded it is a flat terrain.

It is alot of code, but I can add it if needed.

The Code

sentences:
Different kind of stamina problem I have an object that I interact with physics via:

    using UnityEngine;
using System.Collections;

public class PhysicsBall : MonoBehaviour {

    public float speed;

    private Rigidbody rb;

    void Start ()
    {
        rb = GetComponent<Rigidbody> ();
    }

    // Update is called once per frame
    void FixedUpdate () {
        float moveHorizontal = Input.GetAxis ("Horizontal");
        float moveVertical = Input.GetAxis ("Vertical");

        Vector3 movement = new Vector3 (moveHorizontal, 0, moveVertical);

        rb.AddForce (movement * speed);
    }
}

However, now I want to add a "stamina" bar, so if the user holds any of the movement keys which affect the rb, the stamina bar starts depleting. Once empty, the user can no longer affect the rb with the movement buttons.

I've tried viewing some of the classic stamina bar sprint options but they don't use the rigidbody physics like I am doing, so I wonder if anyone knows how I do it in my example?

sentences:
How can I represent rooms and associated actions and inventory in a text-based adventure game? I am just getting started learning to make games. I have created a simple text-based game where the user can walk around between rooms and interact with the objects in each room. However, I feel like my approach has led to a pile of bad spaghetti code. I'm not sure what a good way to structure a game like this would be.

My approach was to have one class with a method for each room and all the objects and interactions that could be done in that room. For example, this is the method for the study:

public static void Study()
{
    bool studyexited = false;

    while (!studyexited) {
        string usercommand = Console.ReadLine ();
        usercommand.ToLower ();

        switch (usercommand) {
        case "turn left":
            GameEventText.StudyLeft ();
            break;
        case "turn right":
            GameEventText.StudyRight ();
            break;
        case "go forward":
            Notes firstsetofclues = new Notes ("First Note");
            GameEventText.StudyFront ();
            string firststudycommand = Console.ReadLine ();
            firststudycommand.ToLower ();

            if (firststudycommand == "read note") {
                firstsetofclues.Firstnotereading ();
            }

            Console.WriteLine ("Picking up this note would prove valuable");
            string secondstudycommand = Console.ReadLine ();
            secondstudycommand.ToLower ();

            if (secondstudycommand == "pick up note") {
                if (MainClass.PlayerInventory.AddItem (firstsetofclues))
                {
                    Console.WriteLine ("The note has been added to your inventory");
                } else {
                    Console.WriteLine ("Your inventory is full");
                }

                MainClass.PlayerInventory.Inventorydisplay ();
            }
        }
    }
}

I don't feel like this is an approach that will scale; that is, I can't really write functions like this for every room. I believe that using files in some way would be a good strategy to avoid the "hard coding" that I'm currently doing. But I am not sure how I can achieve that?

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 can I obtain in-game data from Warcraft 3 from an external process? I am implementing a behavior algorithm and would like to test it with my lovely Warcraft III game to watch how it will fight against real players.

The problem I'm having is that I don't know how to obtain information about in-game state (units, structures, environment, etc.) from the running WC3 game. My algorithm needs access to the hard drive and possibly distributed computing, that's why JASS (WC3's editor language) isn't appropriate; I need to run my algorithm from a separate process.

Direct3D hooking is an approach, but it wasn't done for WC3 yet and a significant drawback of that approach would be the inability to watch how the AI performs online, since it uses the viewport to issue commands.

How I read in-game data from WC3 in a different process in a fastest and easiest way?

Precisely what I need for Warcraft 3 exists for Starcraft: BWAPI.

sentences:
Discoordinated Chromatic Aberration Effect The game Teleglitch heavily utilizes the CA effect with screen distortion.

I am trying to achieve this effect.

Issue 1. How to not apply the effect onto the floor? (solved)

They render the screen then apply the CA effect.  However, the floor is not rendered with the post processing effect.

Issue 2. How to have discoordinated position for each rendered CA effect?

Currently I have three offsets for each channel: red, green, and blue.  However, I cannot assign different offsets for the channels for certain areas only.  What would be a way to have discoordinated positions?

sentences:
Remove sprite reference before build in Unity All the the characters in my 2D game have SpriteRenderers to animate the characters.  Some of the characters are only active in their scenes sometimes, so I load their sprites asynchronously based on game state.
During edit mode, I have at least one sprite from an animation assigned to each sprite renderer so I can tell where the game object is.  The problem is that including even a single sprite will load up the entire sprite atlas at runtime if I allow the SpriteRenderer.sprite to be set.
Is there an efficient way to unset the SpriteRenderer.sprite for a build, but not during edit time?  Is there a better way to handle this?

sentences:
How to determine character's foot contact point on a uniform triangle mesh terrain? For a terrain that is modelled by a heightmap with a uniform triangle mesh, what are some techniques I could use to determine the contact point of the foot of a character standing on the terrain?

Since the terrain's Y values are altered by the heightmap, they won't be flat any more. As the character moves on the terrain, it has to know at which values of Y-value its foot should be. Conceptually, what are some methods and techniques to determine the contact point of the character's foot standing on the terrain?

sentences:
Proper way to divide a 2D climbing animation in Unity3D I've got a 2D character that's going to climb up a 2D tile to his left or right and I've got a climbing animation consisting of three parts essentially:

Animation for the character going from walking onto the ground -> climbing on the wall
The actual climbing animation when on the wall
A "climbing over the top" animation for where the character pulls himself over the top of the wall and onto the ledge above.

What is the smoothest way to handle this in Unity? Do I need three separate animation clips for each of the steps, or can I do it with one and simply loop the middle section of the clip?

For example, my initial thought would be to have one clip for the entire animation and do the following:

play the first few "climbing onto the wall" frames when climbing onto the wall
loop the actual climbing animation while the character is on the wall and isn't ready to climb over the top
transition to the final few frames when the character is ready to pull himself over the top

Is this easily doable in Unity? Or is there an easier way to do this that I'm not thinking about? This seems a bit contrived and decently complicated so that's why I'm wondering.

sentences: Can global Illumination via path tracing replace all other current lighting techniques? In the sense that you currently have algorithms like HDR, shadows, reflections, caustics, motion blur and so on, does complete path tracing take care of all these effects, or would you still have to implement these effects separately?

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:
Fast 2D collision detection in an unbounded space I'm trying to do collision detection on a large number of entities of greatly varying size in an unbounded space.  The entities are circles, so it's relatively easy to check if two are colliding.  However, with a large number of entities the simulations slows down a lot when I code it to check every entity against every other (for n entities, I believe it is n*(n-1)/2 checks, way too many!)  Here's my though process so far:

First, I considered using a grid of some sort, like described in steps 1-2 of the answer here: Fast, accurate 2d collision

There are, however, a few problems with this:

1) It is an unbounded space.  Where do I start and end the grid?  How do I determine the size of each square in the grid in a world where some objects are literally tens of millions times larger the other objects?

2) Even if I somehow manage to adjust the size of the grid every frame without using too much processing power, so that it adjust to fit the most distant objects, (unlikely that I could do this efficiently) this is still not a solution.  If tons of objects are clustered in a 10,000x10,000 space, and one object goes shooting off into space 100 billion units of distance away, the grid would "zoom out", leaving all of the objects in the smaller 10,000x10,000 space in one square, which would defeat the purpose of making a grid in the first place.

For these reasons, I'm thinking that a simple grid is not the best idea...

I looked at BSP's, and I admit that I don't fully understand the concept, but it seems like it does not apply well to my situation (especially since I am using circles and BSP seems better suited to a more complicated polygonal world).

Quad trees seem promising (something like this perhaps: http://www.youtube.com/watch?v=qJJnzSLrC1E) but I foresee at least two potential issues:

1) I can calculate the "farthest away objects" each frame to give calculate GreatestXValue, LeastXValue, GreatestYValue, and LeastYValue, for each frame. From that I have a rectangle to work with that contains all entities.  However, I will have to redo this each frame, which means that I have recreate the the entire quadtree each frame: no shortcuts on calculations done in previous frames.  Is this a problem or do most game/simulation programmers have to completely recreate the quadtree each frame anyway?

2) (Probably the bigger problem) How do I handle a massive object in the vincinity of many small objects? Think about many circles with radius 5 being very close to, resting against, or colliding with a circle with radius 100,000. That massive object will be in many, many grid squares, and it seems to me that the situation would force the creation of a tree that is far too broad and deep.

Am I on the right track with my thought process? Where do I go from here?  Thank you very much for your time and help!!

sentences:
Ideal way to instantiate abilities in a class give a dynamic list of abilities to use? I have a PlayerClass class that is used to set my Player's class. For instance, this will make him a warrior:

 PlayerClass warrior = new WarriorClass();

WarriorClass will instantiate abilities like so:

 Ability ability1 = new LeapAbility();

Now my problem is that I will eventually dynamically update my Warrior's abilities (think talent trees or perks).

So say I give warrior a list of abilities to use. How do I do this in code? Right now I need to know the Abilities before hand and hard code their instantiation in.

Put another way, how do I instantiate a dynamic list of objects? I'm open to other solutions too if this doesn't make sense or is impossible.

sentences:
CCUserDefault, iOS/Android and game updates My game uses cocos2d-x and will be published on iOS platform first, later on Android. I save a lot of things with CCUserDefault (scores, which level was completed, number of coins taken, etc...). But now I have a big doubt.

What will happen when the game will receive its first update?

CCUserDefault uses an XML file stored somewhere in the app storage space. This file is created and retained until one uninstalls the app. I am wondering what happens when the app is updated. Will the old XML file be maintained?

Because if not, how should I handle app updates (updates in the sense that 2, 3 or more new level packages will be added, but the informations about the old ones, like scores, which level was finished and which not, number of coins, etc., need absolutely not to be lost)?

sentences:
How would I go about coloring marching cubes terrain? I'm making a game with marching cubes terrain (I know very original idea) and I don't exactly know how to color it. I have a system to do it, I just need to know how to interpolate it where it's not all smoothed out.
I just want flat colors, I think it boils down to this function (this is this guys code http://www.paulbourke.net/geometry/polygonise/):
glm::vec3 VertexInterp(const float& isolevel,const glm::vec3& p1,const glm::vec3& p2, const float& valp1, const float& valp2) {
    float mu;
    glm::vec3 p;

    if (ABS(isolevel-valp1) < 0.00001)
        return(p1);
    if (ABS(isolevel-valp2) < 0.00001)
        return(p2);
    if (ABS(valp1-valp2) < 0.00001)
        return(p1);
    mu = (isolevel - valp1) / (valp2 - valp1);
    p.x = p1.x + mu * (p2.x - p1.x);
    p.y = p1.y + mu * (p2.y - p1.y);
    p.z = p1.z + mu * (p2.z - p1.z);

    return p;
}

So if anyone could help me implement a flatter or smoother variant of that function it would be very much appreciated
(I know all the rest of the things I need to do I just need help with this)

sentences:
IgnoreCollision while Dodging & Colliding I'm working on a mechanic to allow the player to dodge through enemies. However I'm running into the issue where the player is only able to dodge through enemies while their already dodging when they collide with the enemy.

I want this to work both ways, as in, when their colliding with the enemy, they should be able to dodge through then.

Here's what I've been trying:

void OnCollisionEnter (Collision col) {

    //    STOP ENEMY FROM MOVING/PUSHING
    if (col.gameObject.tag == "Enemy") {
        Debug.Log("Collided with: " + col.gameObject.name);
        target = col.gameObject;
        target.GetComponent<ZombieController>().mRigidbody.isKinematic = true;

        //    IGNORE DODGING COLLISION WHEN ALREADY COLLIDED
        if (isDodging) Physics.IgnoreCollision(col.collider, GetComponent<Collider>(), true);
    }

    /*    IGNORE DODGING COLLISION
    if (isDodging && col.gameObject.tag == "Enemy") {
        Physics.IgnoreCollision(col.collider, GetComponent<Collider>(), true);
    }*/

}

It just doesn't seem to work when the player has already collided with the enemy. Hopefully all that made sense.

sentences:
Memory game - texture on cards I'm new with Unity and I'm working on recreating memory game. I found this sample: http://xtasestudios.com/unity/samples (select "Memory"). I decided for C#.

I've created my own card in Blender, added 3 different materials (without textures), also I created flip-flop animations. After importing .blend file in Unity and assigning scripts, textures, animations, positioning camera etc..

Everything works fine, except textures on cards.
I can change color on cards, but when I want to see any texture on my card, I see only color, not whole texture. I really have no idea why is this happening and how to fix it.

Any help will be appreciated!

sentences:
Unity - Copy another object's Y location? I'm creating a Pong clone inside of Unity and was trying to figure how to copy another object (In this case being the Y co-od of the Ball Object) How would i go about doing this? I'm using vectors as my method of paddle movement and I want to create a public int AISpeed so that the AI paddle is a little slower in comparison

In my mind I assumed it was along the lines of:
rightPaddle.location.y = pongBall.location.y

How would I create this?

sentences:
Jumping a sprite while moving in a Bezier action I'm creating a game and I need the sprite to jump (move up and down basically) while it's moving on a bezier path so it moves vertically while it still follows the path. If I do this while it's moving along the bezier path:

[mySprite runAction:[CCJumpBy actionWithDuration:0.1 position:ccp(0,0) height:10 jumps:1]];

It jumps vertically but instantly it returns to the position on the path. What I want is to jump relative to the path.

Does anyone know anything about it?

It would looks something like this:

The curve is a sequence of CCBezierBy's by the way.

Thanks.

sentences:
Diagonal symmetry across a filtered array? I wrote this code to randomly generate a square terrain that somewhat resembles an island. First, I randomly populated a square with grass tiles (1s) on a plane of water tiles (0s):

Then, I looped through each tile and changed its tile type according to its neighboring tiles(if a tile is surrounded by 4 or more water tiles, it becomes a water tile, otherwise it becomes a grass tile):

The results don't seem all that pleasing; not only is the terrain filled with holes and lack overall "togetherness", it is also weirdly symmetrical diagonally.

Here's the code:

private void SmoothMap (Chunk chunk)
{
    for(int row = 1; row < chunk.rows-1; row++)
    {
        for(int col = 1; col < chunk.cols-1; col++)
        {
            //if current tile is not null
            if(chunk.GetTile(row, col) != null)
            {
                //Check its neighboring tiles
                int neighboringTiles = GetSurroundingTiles(row, col, chunk);
                //System.out.println("Position: " + row + ", " + col);
                //System.out.println("Current tile type: " + chunk.GetTile(row, col).type);
                //System.out.println("Neighboring water tiles: " + neighboringTiles);

                if (neighboringTiles > 4)
                {
                    if (chunk.GetTile(row, col) != null)
                    {
                        chunk.GetTile(row, col).texture = GetRandomWaterTexture();
                        chunk.GetTile(row, col).type = Enums.tileType.Water;
                    }
                }
                else if (neighboringTiles < 4)
                {
                    if (chunk.GetTile(row, col) != null)
                    {
                        chunk.GetTile(row, col).texture = GetRandomGrassTexture();
                        chunk.GetTile(row, col).type = Enums.tileType.Grass;
                    }
                }
            }
        }
    }
}

private int GetSurroundingTiles(int r, int c, Chunk chunk)
{
    int surroundingTiles = 0;

    for(int x = c-1; x <= c+1; x++)
    {
        for(int y = r-1; y <= r+1; y++)
        {
            if (x != c || y != r)
            {
                if(chunk.GetTile(x, y) != null)
                {
                    if (chunk.GetTileCode(x, y).equals("0"))
                    {
                        surroundingTiles++;
                    }
                }
            }
        }
    }
    return surroundingTiles;
}

Does anyone know why it is the way it is? Or a better way to approach generating an terrain like this?

Here's the GetTile() code:

public String GetTileCode(int r, int c)
{
    Tile tile;
    ArrayList<Tile> chunk_row;
    if(tiles.size() > r && r >= 0){
        chunk_row = tiles.get(r);

        if(chunk_row != null && chunk_row.size() > c && c >= 0){
            tile = chunk_row.get(c);
            return tile.isGrass() ? "1" : "0";
        }
    }
    return "0";
}

1 is grass, and 0 is water.

sentences:
OpenGL ES GL_FIXED versus GL_FLOAT I am writing an app for Android, using OpenGL ES 1.x

I am confused as to whether I should use GL_FLOAT or GL_FIXED, the priority being performance regarding GPU operations(does GL_FIXED need to be converted etc. ex: GL_FIXED fits EXACTLY with the precision I need but if it is converted to a float then using it is pointless).

This book seems to say that it is ALWAYS preferable to use GL_FIXED for vertices: "The major exception is with vertex data, which should never be given in floating point..."
Here (paragraph right above the subtitle "Vertex data")

But I have seen others saying floating point is better..

sentences:
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:
Unity Mobile: How can we safely store our API key? We're making an app in Unity. We're building it for Android and iOS.
We also have a server. In order to use our server you need to present our api key for the server.
So, we need to store that key in the build somewhere (eg. APK file)
But how can we put it anywhere where people wont be able to get it?
Eg. they can get the APK and decompile it.
SDKS for unity for facebook and so on, store an api key in the client. What do they do?

sentences:
What technology does the iPhone game "Zombie Highway" use? Does anyone know anything about the technology behind the "Zombie Highway" iPhone game?

What 3D engine does it use, especially what kind of tools did they use for the UI animations, transitions, etc.?

Also, when you go to the settings screen, they are using the native iPhone keyboard and controls. Do you think that's all UIKit overlaid on top?

It looks brilliant!

sentences:
Working with websockets in Unity: Cannot convert lambda expression to type 'IObserver' because it is not a delegate type I'm a bit stuck on a delegate error in Unity. The code works fine if I'm in a c# console app however Unity is giving me the error:

Cannot convert lambda expression to type 'IObserver' because it is not a delegate type.

client.ReconnectionHappened.Subscribe(type =>
            {
                Log.Information($"Reconnection happened, type: {type}, url: {client.Url}");
            });

I tried updating to the latest Unity for the c# 8 support but that didn't appear to fix anything. I'm guessing it has something to do with .net compatibility and Unity. Do I need to create this delegate some other way to be compatible with unity?
I've been looking at the code here.
Websockets Server for Unity3d
Using this for the client
https://github.com/Marfusios/websocket-client

sentences:
What is the simplest way to export a bezier curve created in Blender to a text file? I have created a bezier curve in Blender.

I'd like to export this curve to a text file. What I need is :

Control point + handles, three points in total.

Example :

{{ 2.3333,4.3942, 55.333 }, { 0.3234, 2.4234, 4.0332 }, { 2.534, 6.S234, 12.0332 }}

I have tried to export the scene in Collada format but it doesn't seems to include curves information.

What is the easiest / simplest way to export this curve to some readable text file format ?

sentences:
Computer Games Technolgy or Software Engineering? I'm in the last year of my college and going to university next year. Could you tell me what the difference between Software Engineering and Computer Games Technology is?

I know a bit of both but don't know the actual difference. I'm kind off in a dilemma between these two. I want to be a programmer, I'd love to go into gaming but I heard getting a job within a computer games company is really hard.

sentences:
LibGDX Cross Platform Networking Backstory:
I've been developing a game with LibGDX for the past two years, and I've seen it refactored more times than I remember.

I jumped on the iOS iKVM port as soon as it was released.
But I've been struggling with it ever since in regards to cross platform networking.
Kryonet will not port over to iOS unfortunately. So it's either I ditch Kryonet, or lose a large chunk of my target audience (iOS Users)

My question for you is:
I noticed LibGDX has cross platform classes ready for sockets and HTTP Requests, but no documentation exists for these sockets at all.

Has anyone used these sockets at all in the past, and does anyone know how they work?

sentences:
Rotate the camera around the model in XNA? How can I rotate my view around a model? My model has a rotation. If this rotation changed, my view should also change.

The camera should be behind the model everytime.

Thank you very much!

sentences:
How to calculate Camera “correct” position and distance to Frame all my Scene? Consider I have N dynamic points on my Scene, I would like to "frame" all them, with my Camera.

How can i calculate (at runtime) Vector3 Position to correctly frame all my scene ?

This is my idea:

Calculate Avarage for all my points
Move my Camera "up" / Zoom out to correctly "frame" all my points (i don't know how to calculate )
Use Unity LookAt(myAvaragePoint)

I think i've to use some trigonometryc function to calculate the Y Camera position (to zoom in, zoom out), but i don't know which!

Thanks

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:
How expensive is OpenGL Texture Binding I'm currently working on a renderer for Tiled's .tmx maps. Among one of the features there is that layers and tilesets are independent, so that a layer can use any tile set on any tile. It's not so much of a problem, though, as my Image type is basically:

data Image = Image { imageTexture :: TextureObject
                   , imageMinTex2 :: TexCoord2
                   , imageMaxTex2 :: TexCoord2
                   } deriving (Show, Eq)

Drawing an image is therefore

Bind texture
Render Quad using min/max texture coords

A quite simple implementation. However, if every Tile is an Image, in my implementation, then this would mean that on every tile, a texture is bound. Often times it will be the same, and quite often just a few tiles have entirely different texture.

So how expensive is a texture binding in OpenGL? Do I have to sort the Tiles by texture or will the OpenGL drivers do that for me?

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:
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:
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:
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:
Object destroyed when applying WebCamTexture across Photon This script turns the texture from WebCamTexture into a byte array to send across Photon as an RPC. However, when it is called, it displays the WebCamTexture for 1 frame before destroying the entire GameObject it is applied to. The gameobject is this case is a prefab with a cube that is instantiated after joining a room.
edit: I should add that it only crashed when called on a prefab. When applied to an in scene object, it works.
  using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using Photon.Pun;
  using Photon.Realtime;
  using System.Text;
  using ExitGames.Client.Photon;
  using System;
  using UnityEngine.Timeline;
  using System.Security.Cryptography;

public class CameraTry6 : MonoBehaviourPunCallbacks
{
WebCamTexture backCam;
public Texture2D CamThing;
public Texture2D _TextureFromCamera;

// Start is called before the first frame update
void Start()

{
    if (backCam == null)
        backCam = new WebCamTexture();

    if (!backCam.isReadable)
    {
        Debug.Log("Unable to read camera.");
        return;
    }

    if (!backCam.isPlaying)
    {
        backCam.Play();

    }

    if (backCam.isPlaying)
    {
        InvokeRepeating("Starter", 2.0f, 2.0f);
    }
    else
        Debug.Log("the webcam is not working. unable to send.");

}

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

}

void Starter()
{
    StartCoroutine("Camsend");
    Destroy(CamThing);

}

IEnumerator Camsend()
{
    //if (backCam.didUpdateThisFrame)

    yield return new WaitForEndOfFrame();
    Debug.Log("Frame is over");
    Texture2D _TextureFromCamera = new Texture2D(backCam.width,backCam.height);
    int[] frame = new int[3];
    frame[1] = backCam.width;
    frame[2] = backCam.height;
    _TextureFromCamera.SetPixels(backCam.GetPixels(0,0,backCam.width,backCam.height));
    _TextureFromCamera.Apply();
    //GetComponent<Renderer>().material.mainTexture = _TextureFromCamera;
    byte[] bytes = _TextureFromCamera.GetRawTextureData();
    Destroy(_TextureFromCamera);
    int id = photonView.OwnerActorNr;

    Debug.Log("Local camera bytes:" + bytes.Length + "from" + photonView.OwnerActorNr);
    this.photonView.RPC("NetMess", RpcTarget.Others, "rcving the texture from ", id);
    photonView.RPC("CamRcv", RpcTarget.All , bytes, id, frame);

}

[PunRPC]
public void CamRcv(byte[] bytes, int pid, int[] frame)
{

    //yield return new WaitForEndOfFrame();
    if (photonView.OwnerActorNr == pid)
    {
        //StartCoroutine("LoadTexture");
        //LoadTexture();

        Debug.Log("Recieved byte from " + pid + " array length: " + bytes.Length);
        //yield return new WaitForEndOfFrame();
        Texture2D CamThing = new Texture2D(frame[1], frame[2]);
        CamThing.Apply();
        CamThing.LoadRawTextureData(bytes);
        CamThing.Apply();
        GetComponent<Renderer>().material.mainTexture = CamThing;
        CamThing.Apply();
    }

     /*
    IEnumerator LoadTexture()
    {
        yield return new WaitForEndOfFrame();
        Debug.Log("Recieved byte array length: " + bytes.Length);
        Texture2D CamThing = new Texture2D(backCam.width, backCam.height);
        Debug.Log("Recieved byte array length: " + bytes.Length);
        CamThing.LoadRawTextureData(bytes);
        CamThing.Apply();
        GetComponent<Renderer>().material.mainTexture = CamThing;
        Destroy(CamThing);
    }
    */
}
[PunRPC]
void NetMess(string mess, int pid)
{
    Debug.Log(mess+pid);

}
  }

sentences:
Mapping a Vertex Buffer in DirectX11 I have a VertexBuffer that I am remapping on a per frame base for a bunch of quads that are constantly updated, sharing the same material\index buffer but have different width/heights. However, currently right now there is a really bad flicker on this geometry.

Although it is flickering, the flicker looks correct. I know it is the vertex buffer mapping because if I recreate the entire VB then it will render fine. However, as an optimization I figured I would just remap it. Does anyone know what the problem is?

The length (width, size) of the vertex buffer is always the same.

One might think it is double buffering, however, it would not be double buffering because it only happens when I map/unmap the buffer, so that leads me to believe that I am setting some parameters wrong on the creation or mapping.

I am using DirectX11, my initialization and remap code are:

Initialization code

  D3D11_BUFFER_DESC bd;
  ZeroMemory( &bd, sizeof(bd) );
  bd.Usage = D3D11_USAGE_DYNAMIC;
  bd.ByteWidth = vertCount * vertexTypeWidth;
  bd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
  //bd.CPUAccessFlags = 0;
  bd.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;

  D3D11_SUBRESOURCE_DATA InitData;
  ZeroMemory( &InitData, sizeof(InitData) );
  InitData.pSysMem = vertices;

  mVertexType = vertexType;

  HRESULT hResult = device->CreateBuffer( &bd, &InitData, &m_pVertexBuffer );

  // This will be S_OK
  if(hResult != S_OK)
     return false;

Remap code

  D3D11_MAPPED_SUBRESOURCE resource;
  HRESULT hResult = deviceContext->Map(m_pVertexBuffer, 0,
     D3D11_MAP_WRITE_DISCARD, 0, &resource);

  // This will be S_OK
  if(hResult != S_OK)
     return false;

  resource.pData = vertices;

  deviceContext->Unmap(m_pVertexBuffer, 0);

sentences:
Switching between meshes vs Loading only specific mesh I am currently developing an online multiplayer game on Unity. In the game, the character of each player will be assigned its mesh after the game receives parameters (their meshes' names) for each character from the server. Assigning each character's mesh can happen after the main scene is loaded. I am wondering whether:

I should make each character's object the same by having every mesh possible loaded into it and only activate the corresponding mesh for that player.
I should create a class that holds every mesh possible (like, mesh manager) and tell each character to use its mesh from that class.
I should delay the characters' meshes loading to wait for the parameter from the server first. Then, load the mesh after the scene has been loaded.

I am not sure if specific assets can be loaded outside of its scene in Unity. If anyone has any different solutions, feel free to suggest. Thanks in advance.

sentences:
How do I undo changing the color of an image in Slick2d? This code colors the enemy red:

enemies.get(i).image.setColor(0,1,0,0,1);
enemies.get(i).image.setColor(1,1,0,0,1);
enemies.get(i).image.setColor(2,1,0,0,1);
enemies.get(i).image.setColor(3,1,0,0,1);

if I set it to:
enemies.get(i).image.setColor(0,0,0,0,1);
it turns it pure black, and if I set it to
enemies.get(i).image.setColor(0,0,0,0,0);
it turns the enemy invisiable

How do I un-color enemy red? as in return to state as it was before it was colored.

Documentation link.

sentences:
Unity 5 Client RPC call: Failed to Invoke ClientRpc I have a Unity 5 client and server running. On the server a path is generated and I want the client to receive the position of each target node on this path. Following the Client RPC calls section here http://docs.unity3d.com/Manual/UNetActions.html I have created the following script:
public class AccessingTargetPos : NetworkBehaviour {

[ClientRpc]
void RpcPosFromServerToGoTo(Vector3 pos)
{
    UnityEngine.Debug.Log ("Going to ... " + pos);
}

public void PrintPath(Vector3 pos)
{
    if (isServer)
    {
        UnityEngine.Debug.Log (pos);
        UnityEngine.Debug.Log("Send Pos ...");
        RpcPosFromServerToGoTo (pos);
        UnityEngine.Debug.Log("Sent!!");

    }
}

}

Both the client and the server have this script, assigned to a game object. However with the above I receive the following in my console:

At the moment all I want is for the client to output the positions received. When I get this I'll move on. I have followed the link, where have I went wrong here?

sentences:
Is it possible to write a game that doesn't require a GPU? I already know many computers today have a GPU that supports DirectX and OpenGL.
But what about computers that don't? Can I write a simple 2D game that does not rely on the GPU, so that it works even on older machines?

Is there a cross-platform C or C++ game library that will let me do this? Ideally, such a library would let me toggle hardware acceleration with very few lines of code.

sentences:
2-d lighting day/night cycle Off the back of this post in which I asked two questions and received one answer, which I accepted as a valid answer. I have decided to re-ask the outstanding question.

I have implemented light points with shadow casting as shown here but I would like an overall map light with no point/light source.

The map setup is a top-down 2-d 50X50 pixel grid.

How would I go about implementing a day/night cycle lighting across a map?

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:
Point vs Convex Hull I'm trying to implement a simple collision response to a point intersecting a convex hull.

So far I can detect if the point is inside the hull.

But now I want a collision response that translates and rotates the hull away from the point so it no longer intersects.

I'd like the simplest algorithm possible, I don't want to implement a physics engine or rigid bodies.

Can someone point me in the right direction?

sentences:
How to prevent fleeing monster from backing himself into a dead end? I've been building a rogue-like for more than a year now, and so far I've only ever implemented very simple monster behaviour - such as moving toward the player when he's in the line of sight, and attacking.

I would like to implement fleeing behaviour for certain monsters that realize they're outmatched.

I have these priority based behaviour types for monsters:

Flee
Attack/Defend
Investigate (event)
Socialize / Explore / Patrol

The only code I have for fleeing is a flood fill routine which attempts to find tiles which "look" like they are doorways leading to corridors. The question is, how can I improve this to stop it from finding such tiles that deceptively look like doorways, but actually lead to dead ends?

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

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

Inside of the blueprint that handles the actual gun firing

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

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

sentences:
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:
Mapping of positions on images in different frames I am looking for a possibility to map different positions on a 2D Image which has different frames.
Let's say I have an image, consisting of three frames, which shows a spaceship.
The first frame shows the spaceship how it is tilted a little bit (say 20 to 30 degree) to the left side.
The second frame shows the spaceship just from the top.
The last frame shows the spaceship tilted a little bit to the right (the same amount as in frame 1).
Now I want to know, where for example the part which is in the middle of the second frame, is in the first and third frame.
The following painting should show what I mean (sorry, I am a bad artist):

The red arrows show example positions which I want to match.

The background is the following: I want to have the possibility to take away parts of the image while playing.
The problem is: I want that the parts which were taken away, are taken away on every frame at the right position.

I fail to imagine how to approach this problem as I cannot think of a possible solution.
Is there a possibility to achieve this goal or is it just impossible?

sentences:
How to rotate an image on touch using RotateToAction in libGDX? I want to rotate my image on touch but it never applies action, I'm using RotateToAction to achieve this.

class actorCark extends Actor
{
    Texture texture;
    Sprite sprite;
    Global g;
    GetActorByName a;
    public actorCark()
    {
        ses=new sesler();
        g=new Global();
        a=new GetActorByName();
        sr=new soruSor();
        texture=new Texture(Gdx.files.internal("images/carkifelek.png"));
        sprite=new Sprite(texture);
        setBounds(Global.screen_width / 2 - Global.screen_height * 0.9F * sprite.getTexture().getWidth() / sprite.getTexture().getHeight() / 2, Global.screen_height / 2 - Global.screen_height * 0.9F / 2, Global.screen_height * 0.9F * sprite.getTexture().getWidth() / sprite.getTexture().getHeight(), Global.screen_height * 0.9F);
        setTouchable(Touchable.enabled);
        addListener(new InputListener() {
            public boolean touchDown(InputEvent event, float x, float y, int pointer, int buttons) {
                clearActions();
                RotateToAction rotateToAction=new RotateToAction();
                rotateToAction.setRotation(360);
                rotateToAction.setDuration(2);
                addAction(rotateToAction);
                dondur();
                sesler.donmeS.play();
                return true;
            }
        });
    }
    @Override
    public void act(float delta) {
        super.act(delta);
    }
    public void draw(Batch batch, float alpha)
    {
        sprite.getTexture().setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
        sprite.setBounds(Global.screen_width / 2 - Global.screen_height * 0.9F * sprite.getTexture().getWidth() / sprite.getTexture().getHeight() / 2, Global.screen_height / 2 - Global.screen_height * 0.9F / 2, Global.screen_height * 0.9F * sprite.getTexture().getWidth() / sprite.getTexture().getHeight(), Global.screen_height * 0.9F);
        sprite.setOrigin(sprite.getWidth() / 2, sprite.getHeight() / 2);
        sprite.draw(batch);
    }
}

sentences:
Game Loop: Best way to limit the fps? My game-loop looks like this:

        public void run() {
            init();

            final double amountOfTicks = 60.0;
            double ns = 1000000000.0 / amountOfTicks;
            long time = System.currentTimeMillis();
            long lastTime = System.nanoTime();
            long now = 0;
            double delta = 0;
            int tickCount = 0;
            int renderCount = 0;

            while(running) {

                now = System.nanoTime();
                delta += (now - lastTime) / ns;
                lastTime = now;

                if(delta >= 1) {
                    tick();
                    tickCount++;
                    delta--;
                    render();
                    renderCount++;
                }

                if(System.currentTimeMillis() - time >= 1000) {
                    time += 1000;
                    System.out.println(tickCount + " Ticks, " + renderCount + " FPS");
                    tickCount = 0;
                    renderCount = 0;
                }

            }
            stop();

        }

In the variable "amountOfTicks" i can set how many ticks i want per second. The amountOfTicks are here the same as the fps which i have. With this solution my console prints "60Ticks, 60 FPS", but the problem is, that the CPU-performance with this method is too low. I have only 60 Ticks and only 60 FPS, but the whole while-loop is still running through as fast as my pc can.

The only thing how i can improve the cpu-performance is, if i let the thread for 1ms or so sleeping. But is this solution not dirty? This solution will maybe work on my (relative good pc), but on a other with with less CPU-performance the 1ms sleep maybe are waste, because of this the game maybe can not reach the 60FPS of this?

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:
How should I license my game so others may not distribute copies? I've created a game and I'm unsure how to license it or what that means.

I've heard of Creative Commons licenses. Should I use that?

I want it so that people that download my game cannot remix or distribute copies, even for non commercial purposes. What should I do in such a case?

sentences:
Particle Effect Completion In my game I use particle effect for various purposes. In that I detect the completion of the particle effect. Basically I want to do something after completion of the particle effect. But the problem is that I didn't able to find the particle effect completion. So any community member please help me.

EDIT : I was creating particle effect using following code

    pointParticleEmtitter = new PointParticleEmitter(pX, pY);

    particleSystem = new ParticleSystem(pointParticleEmtitter, maxRate,
            minRate, maxParticles, mParticleTextureRegion.deepCopy());

    particleSystem.setBlendFunction(GL10.GL_SRC_ALPHA, GL10.GL_ONE);
    particleSystem.addParticleInitializer(new ColorInitializer(0f, 0f, 1f));
    particleSystem.addParticleModifier(new AlphaModifier(1, 0, 0, 0.5f));
    particleSystem.addParticleModifier(new ExpireModifier(0.5f));
    gameObject.getScene().attachChild(particleSystem);

Using above code the particle effect was started but when finished that I want to detect. After finishing effect I want to remove the object from the scene.

sentences:
What is the simplest way to render video into memory (for drawing to a texture) in .NET? In my project I would like to be able to play back video on surfaces in the world. I intend to do this by having the video frames rendered to a block of memory, then use this  to update a texture each frame.  Everything is in place - except for the part that actually gets the video.

I have looked on Google and found that the video library world is very expansive (and geared towards video processing), and am having trouble finding a suitable one.

FFMpeg is very comprehensive, but is an entire suite and would take  a good amount of work to integrate. So far the most promising library I've found is the one based on the VLC player libraries - by virtue of it using the same resources as VLC Player it is known to be very capable; it also renders to blocks of memory, but the API (at least of the one on Codeplex) is more of a port of the C++ API rather than a managed wrapper.

The 'solution' can be any wrapper/API/library, but with characteristics that make it suitable for use in a rendering engine, namely:

Renders the video frame data to memory, so it can be picked up and
passed to a texture on the GPU easily.
Super simple - all that is needed is a way to load, jump and render a frame programatically - ideally it would use the systems codecs and not require an assortment of plugins.
Permissive license (LGPL or more free-er)
.NET bindings at least; all the better if it is natively managed

Can anyone suggest a lightweight, (.NET) library, that can take a video file, and spit out some frames into a byte[]?

sentences:
how to predict where a ball will land? For a game of table tennis, the goal is that when the player hits the ball, the opponent (the computer) will move to the position where the ball will land in order to hit it back to the player.

Said another way, given a ball in 3D space with an XYZ vector for its velocity, how can I calculate an XYZ velocity vector that will result in the position of the computer player being approximately where the ball will land?

For my coordinate system is, Y is up/down, Z is left and right of the table, and X is forward backward (toward or away from the table)...  So, I know I can simply just set the player's z velocity to match the ball's z velocity to match the direction, but I need to know how to find the appropriate X velocity so that the player will move backward / forward depending on how fast the ball is traveling + taking into account the height of the ball + gravity, etc.

UPDATE

Seeing that the initial ball height is different than the table and the floor, I did some research and learned that the quadratic formula was the best way to solve this problem...

serveToTable = (-ball.vel.y + Math.sqrt((ball.vel.y * ball.vel.y) - (4 * (gravity * 0.5) * (tableY - ball.pos.y)))) / gravity;
tableToFloor = (-ball.vel.y + Math.sqrt((ball.vel.y * ball.vel.y) - (4 * (gravity * 0.5) * (floorY - ball.pos.y)))) / gravity;
duration = serveToTable + tableToFloor;
player.pos.x = ball.pos.x + (ball.vel.x * duration);
player.pos.z = ball.pos.z + (ball.vel.z * duration);

This, kind of works..  But it seems the player will go to the ball 2-4 times and then miss the ball.  Sometimes by quite a lot.

sentences:
How to make touch events work in a match three type game In "match three" types of games like Crazy Kitchen, when the user touches an image, he can drag his finger over multiple images and create a change in each image he touches in a single gesture. You might drag your finger across 5 images and each image highlights as you drag across it.

I want to create a similar affect in my game but I can only get the first image to change in a single drag or touch event. I have a GridLayout with each cell containing a custom LinearLayout with an OnTouchListener attached. I want to have the user drag across multiple cells and have each view the user drags across change its image to a "highlighted" image.

How do I get more than the first LinearLayout to be affected by the touch event?

Here's my onTouch code:

    @Override
    public boolean onTouch(View view, MotionEvent motionEvent) {
        int action = motionEvent.getAction();
        FloorTile singleTile = (FloorTile) view;
        singleTile.getParent().requestDisallowInterceptTouchEvent(true);
        switch(action) {
            case MotionEvent.ACTION_DOWN:
                Log.i(TE, "MotionEvent = DOWN");
                //assign the new Arrow type to the FloorTile
               swapImage(singleTile);
                break;
            case MotionEvent.ACTION_MOVE:
                Log.i(TE, "MotionEvent = MOVE");
                singleTile.swapImage();
                break;
        }
        return true;
    }

public void swapImage(FloorTile mTile) {
        mTile.setBackground(this.getResources().getDrawable(R.drawable.highlight));
//the actual game will pull a Drawable ID from an enum that matches up the original image with an //appropriate highlighted version.
    }

sentences:
Disabling impact damage by Kinematic actor on non-dynamic destructibles (using NVidia APEX) I have a destructible non-dynamic object at Apex scene and am hitting the object with a kinematic actor. I do not want it to be fractured by these impacts. Is it possible?

PS: the impact damage is off when the destructible is dynamic. I have tried below settings:

physx::apex::NxDestructibleParameters destructibleParameters =
                                          destructibleActor->getDestructibleParameters();
destructibleParameters.forceToDamage = 0;
destructibleParameters.damageCap = 0;
destructibleParameters.impactVelocityThreshold = PX_MAX_F32;
destructibleParameters.impactDamageDefaultDepth = -10;
destructibleActor->setDestructibleParameters(destructibleParameters);

sentences:
Commercial 2D game engines? I know that there are several open-source/free 2D game engines out there; I am just wondering about commercial ones (if any). The idea of wanting of looking for a commercial engine is for support and continual updates.

Off the bat I know that there is DarkBasic, Blitz Basic and Torque 2D. What's else are there?

What I am looking for (technical wise):

Sprites and Animation capability
GUI (menus, dialogs, simple controls)
Math helper for usual math operations -vectors, rotation, turning an entity to face another...
Entity management
Particles
Serialization of game data
Level design tools
Deployment tools

And support wise

Documentation
Examples and Tutorials
Continual update
Support through forum/emails/private channels

sentences:
Getting an object to move in another objects direction I have a player and an enemy, both have x and y values, and I want to move the enemy to the player and have them 'touch' over time in a speed that I can determine, I tried calculating the angle between the enemy, the player, and the 0, 0 point on the canvas using trigonometry but it just doesn't work right, most the times the angle is Not A Number(NaN) or goes in a direction different that the player.
*The code is not in the same file, I copy pasted the relevant parts of the code and pasted them together.
Here is my code, any help would be greatly appreciated:

// Creating a visual triangle and storing the length of it's vertices distance(size)
    line(enemy.x, enemy.y, 0, 0);
    lineOne = dist(enemy.x, enemy.y, 0, 0);
    line(player.x, player.y, 0, 0);
    lineTwo = dist(player.x, player.y, 0, 0);
    line(player.x, player.y, enemy.x, enemy.y);
    lineThree = dist(player.x, player.y, enemy.x, enemy.y);
// Calculating the angle itself using the cosine rule
angle = acos((lineThree * lineThree + lineOne * lineOne - lineTwo * lineTwo) / (2 * lineThree * lineTwo));

//Function to move  the enemy(based on a suggestion made in this website)
this.move = function()
    {
        if(angle != NaN && angle >= 0)
        {
            this.x -= 2 * cos(angle) + sin(angle) * 2;
            this.y += 2 * sin(angle) + cos(angle) * 2;
        }
    }

The if statement that checks if the angle is not a NaN value is required because it happens a lot for some reason, it also checks if it is bigger or equal to zero, because if it isn't the enemy just doesn't show at all.

Thank you for your time!

sentences:
Why is my custom Texture2D blurry? Have some WWW object downloading a .PNG image.

((SpriteRenderer)renderer).sprite = Sprite.Create(request.texture,
         new Rect(0,0,100,100));

My sprite looks fine.

Now, let's be a bit redundant and create a Texture2D out of the bytes from the download:

Texture2D t = new Texture2D(100,100);
t.LoadImage(request.bytes);
((SpriteRenderer)renderer).sprite = Sprite.Create(t, new Rect(0,0,t.width,t.height));

Technically, this should produce something identical to the above snippet. However, the sprite is blurry (as in, low quality).

I suppose it is when calling LoadImage. What may be causing this?

sentences: Custom node editor in Unity Im currently making a game on unity, and in the game i want to make quest system to be flexible, as the game world is generated randomly. I also want to make it easy to create quests for myself and possibly modders. So i want to make a menu for creating quests, however i couldnt find any info on how to make node editor window in unity(like shader graph, vfx graph, etc.). How do I do this?

sentences:
how do i make an object in gamemaker only overlap on one side? I am making a small flash game in game maker 8.0 pro and I need some help. In my game, the character is in an office with cubicles. I need my character to be able to walk behind and in front of the cubicles with the correct overlapping for each scenario. Here are some pics. As you can see walking up to the wall from the back looks fine but it over laps the same way walking up to the wall from the wall from the front which is a problem. If anyone could help me with this problem that'd be great. Thanks]1

edit: i resolved my issue. It turns out you can use any objects position on the y axis to set its depth with: depth=-y
you might have to adjust it slightly to account for collision masks like this:
depth=-y-32

sentences: How to make a car move sharper at high speed? I am working on a car-racing game on Unity 2018.1. My car works perfectly at low speed but as it speeds up, I lose control over the car and it starts to drift independently. What can I do to prevent this?

sentences:
Supporting user-made content/add-ons I'd like to start allowing for user-made content in my game. I'd like users to be able to add their own levels, entities and quests (along with all of the assets that are required). However, I'm unsure of the best way to do so.

Currently, the game loads its levels, entities, etc. from a JSON file. This file is embedded into the executable, and whenever the user starts a new game, it is created from this file. When the new game is saved, it is saved as a JSON file of the same format.

As an example, let's say that an add-on would be a folder containing the following:

A JSON file describing any new levels, new entities, new quests.
A single script file with one function that is called to make any modifications to the default game content, since it's not directly available. This would allow the addition of portals to new levels, characters to initiate new quests, etc.
Audio, images, scripts for entities.

An editor will be provided in order to create the add-on; the author can create entities, levels, etc., so that they don't need to edit the JSON file manually.

Should the player be able to:

Load add-ons at any point during the game (game == JSON save file)?
Remove an add-on? Would the add-on author (or I) have to keep track of every new level, entity and quest that the add-on added and remove them? What if the entity is already removed?

It seems that the safest way to allow add-ons is to mandate that they be added at the beginning of a new game and cannot be removed once added. If an add-on makes a new weapon available, for example, removing the add-on once the player has already picked up the weapon would leave the game buggy. However, this seems very prohibitive.

Is this a sane approach? Is there a better one? How much responsibility should I leave with the add-on author? How have games that were designed to be customised handled this?

sentences: Determining if a Point3D passed another I have 2 points A and B in 3D space (say of type Point3D). B needs to travel towards A and then stop either when it reached or passed B. The direction between the two points is known (can be easily calculated), so velocity is easy to set. How do I determine when point A reached or "passed" (given the direction) point B?

sentences:
UDK client, C++ server (is it possible?) For example I have C++/C# server side with sockets or http web server and UDK client.

I am interesting what about experience with networking in UDK: could I connect UDK client to C++/C# socket server via UDP/TCP? Maybe some tutorials/examples?

sentences:
Why only few parts of the 2D sprite change their colour when I apply sprite color in Unity? I'm making a stickman 2D game where I have different sprites for the player.

But when I try to change the Sprite Renderer Color, it only changes few pixels of the sprite and the rest stays black as in the original sprite.

What am I missing?

sentences:
Getting player cube to move left or right in relation to camera based on camera's rotation Right now I'm trying to make the player cube move left, right, up and down in relation to the camera's rotation and position. I figured what I could do is create an empty game object, make the main camera the parent, and then get the vector pointing from the camera's child to another game object that follows the cube's exact position, and that would give me the direction the cube should roll towards.

I have my example in profile view, but in 3D view the camera should be facing the cube with the cube at the center.

So I have the following line of code code:

Vector3 forwardVector = (position1.transform.position - position2.transform.position).normalized;

If you look at the image on the right hand side, I Debug.GetLine'd the resulting vector from the cube's position and ended up with a vector pointing down. In theory though, it should be pushing off to the right hand side. Here's the rest of the code:

Vector3 perpendicularVector = Vector3.Cross (Vector3.up, resultant).normalized;

if (Input.GetKey (KeyCode.UpArrow))
{
    cube.rigidbody.AddForce ( forwardVector * moveSpeed);
}
if (Input.GetKey(KeyCode.DownArrow))
{
    cube.rigidbody.AddForce ( forwardVector * -moveSpeed);
}
if (Input.GetKey (KeyCode.LeftArrow))
{
    cube.rigidbody.AddForce ( perpendicularVector * -moveSpeed);
}
if (Input.GetKey (KeyCode.RightArrow))
{
    cube.rigidbody.AddForce ( perpendicularVector * moveSpeed);
}

As a result, when I press the up arrow key, I end up with the cube flying upwards toward the sky, and the down key brings it back down towards the plane, but my intention is for the vector to move along the XZ plane.

Also, with this line of code, I was hoping to get the line perpendicular to my intended vector and Vector3.up, but I naturally get wonky results from that.

Vector3 perpendicularVector = Vector3.Cross (Vector3.up, resultant).normalized;

If there's an easier method to achieving my goals, that's fine, but it would be nice too to figure out why the vector is pointing down instead of to the right.

It's also might be worth noting that the camera already successfully rotates around the player cube.

sentences:
Mesh shaded as single pixel I am trying to procedurally generate planets in Unity. The actual planet is already done, but now I am trying to add clouds. For this I created a PBR-Graph shader that draws the clouds based on some noise. It works fine on a quad and even on a plane.
The problem is, that I now created 6 meshes that form a sphere, using a script to go around the planet. I have applied the shaded material to the meshes, but for some reason it behaves, as if the entire mesh would be a single pixel, as in I don't get the white cloud shapes moving around with transparent parts inbetween, like I do on a plane, but instead the entire mesh is transparent or white or gray or partially transparent, like a single pixel from the plane. As the clouds move on the plane, the meshes around the planet flicker and change accordingly.
Could someone help me to figure this out?
I don't know why its doing that and its really weird.
Basically the entire mesh acts like a single pixel of the texture, while objects like planes and quads work correctly. I can even get it to work on a sphere, but only on one I created manually by doing new 3D-Object - Sphere and then applying the shaded material to it.
As I want to be able to generate planets with a script, this wouldn't work as it involves me doing something manually...
Here is my code:
This is how the meshes are created:
for (int i = 0; i < 6; i++){

        if(cloudMeshFilters[i] == null){

            GameObject meshObj = new GameObject("cloudMesh");
            meshObj.transform.parent = transform;

            meshObj.AddComponent<MeshRenderer>();
            cloudMeshFilters[i] = meshObj.AddComponent<MeshFilter>();
            cloudMeshFilters[i].sharedMesh = new Mesh();

        }

        cloudMeshFilters[i].GetComponent<MeshRenderer>().sharedMaterial = cloudMaterial;

        cloudMeshes[i] = new CloudMeshes(shapeSettings, cloudHeight, cloudMeshFilters[i].sharedMesh, resolution, directions[i]);

    }

And this is the cloudMeshes class:
public class CloudMeshes
{

int resolution;
Vector3 localUp;
Vector3 axisA;
Vector3 axisB;
Mesh mesh;
ShapeSettings settings;
int height;

public CloudMeshes(ShapeSettings settings, int height, Mesh mesh, int resolution, Vector3 localUp)
{
    this.mesh = mesh;
    this.resolution = resolution;
    this.localUp = localUp;
    this.settings = settings;
    this.height = height;

    axisA = new Vector3(localUp.y, localUp.z, localUp.x);
    axisB = Vector3.Cross(localUp, axisA);
}

public void ConstructMesh(){

    Vector3[] vertices = new Vector3[resolution * resolution];
    int[] triangles = new int[(resolution - 1) * (resolution - 1) * 6];
    int triIndex = 0;

    for(int y = 0; y < resolution; y++){
        for(int x = 0; x < resolution; x++){

            int i = x + y * resolution;
            Vector2 percent = new Vector2(x,y) / (resolution - 1);
            Vector3 pointOnUnitCube = localUp + (percent.x - .5f) * 2 * axisA + (percent.y - .5f) * 2 * axisB;
            Vector3 pointOnUnitSphere = pointOnUnitCube.normalized;
            vertices[i] = pointOnUnitSphere * (settings.planetRadius + height);

            if (x != resolution - 1 && y != resolution - 1)
            {
                triangles[triIndex] = i;
                triangles[triIndex + 1] = i + resolution + 1;
                triangles[triIndex + 2] = i + resolution;

                triangles[triIndex + 3] = i;
                triangles[triIndex + 4] = i + 1;
                triangles[triIndex + 5] = i + resolution + 1;
                triIndex += 6;
            }

        }
    }

    mesh.Clear();
    mesh.vertices = vertices;
    mesh.triangles = triangles;
    mesh.RecalculateNormals();

}

}

The ConstructMesh() method is called after the for loop at the top has run.
Sorry for any incorrect indentations, that happend when pasting the code here...

sentences:
Joystick example problem for android 2D I've searched all over the web for an answer to this, and there are simular topics but nothing works for me, and I have no Idea why. I just want to move my sprite using a joystick, since I'm useless at math when it comes to angles etc I used an example, Ill post the code here:

    public float initx = 50; //og 425;
public float inity = 300; //og 267;
public Point _touchingPoint = new Point(50, 300);  //og(425, 267);
public Point _pointerPosition = new Point(100, 170);
private Boolean _dragging = false;
private MotionEvent lastEvent;

    @Override
public boolean onTouchEvent(MotionEvent event) {

    if (event == null && lastEvent == null) {
        return _dragging;
    } else if (event == null && lastEvent != null) {
        event = lastEvent;
    } else {
        lastEvent = event;
    }
    // drag drop
    if (event.getAction() == MotionEvent.ACTION_DOWN) {
        _dragging = true;

    } else if (event.getAction() == MotionEvent.ACTION_UP) {
        _dragging = false;
    }

    if (_dragging) {
        // get the pos
        _touchingPoint.x = (int) event.getX();
        _touchingPoint.y = (int) event.getY();

        // bound to a box
        if (_touchingPoint.x < 25) {
            _touchingPoint.x = 25; //og 400
        }
        if (_touchingPoint.x > 75) {
            _touchingPoint.x = 75; //og 450
        }
        if (_touchingPoint.y < 275) {
            _touchingPoint.y = 275; //og 240
        }
        if (_touchingPoint.y > 325) {
            _touchingPoint.y = 325; //og 290
        }

        // get the angle
        double angle = Math.atan2(_touchingPoint.y - inity,
                _touchingPoint.x - initx) / (Math.PI / 180);

        // Move the beetle in proportion to how far
        // the joystick is dragged from its center
        _pointerPosition.y += Math.sin(angle * (Math.PI / 180))
                * (_touchingPoint.x / 70);
        _pointerPosition.x += Math.cos(angle * (Math.PI / 180))
                * (_touchingPoint.x / 70);

        // stop the sprite from goin thru
        if (_pointerPosition.x + happy.getWidth() >= getWidth()) {
            _pointerPosition.x = getWidth() - happy.getWidth();
        }

        if (_pointerPosition.x < 0) {
            _pointerPosition.x = 0;
        }

        if (_pointerPosition.y + happy.getHeight() >= getHeight()) {
            _pointerPosition.y = getHeight() - happy.getHeight();
        }

        if (_pointerPosition.y < 0) {
            _pointerPosition.y = 0;
        }
    }
    public void render(Canvas canvas) {
    canvas.drawColor(Color.BLUE);
    canvas.drawBitmap(joystick.get_joystickBg(), initx-45, inity-45, null);
    canvas.drawBitmap(happy, _pointerPosition.x, _pointerPosition.y, null);
    canvas.drawBitmap(joystick.get_joystick(), _touchingPoint.x - 26,
            _touchingPoint.y - 26, null);
}

    public void update() {
    this.onTouchEvent(null);
}

og= original position.
as you can see Im trying to move the joystick, but when I do it stops working correctly, I mean it still works like a joystick but the sprite dosnt move accordingly, if I for example push the joystick down, the sprite moves up, and if I push it up it moves left.

can anyone PLEASE help me, I've been stuck here for sooo long and its really frustrating.

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:
culling lines on the back of a globe I am drawing a simple outline of the world using GL_LINE_STRIPs (in WebGL).
I want to not draw those lines that are on the other side of the spinning globe.
Using Nicol Bolas approach below I am trying to determine if a point is going away from the camera or not:
scene.map = {
    vbo: gl.createBuffer(),
    draw: function(pMatrix,mvMatrix,camera,t) {
        gl.useProgram(this.program);
        gl.uniformMatrix4fv(this.program.pMatrix,false,pMatrix);
        var spin = mat4_rotation(t,[0,1,0]);
        mvMatrix = mat4_multiply(mvMatrix,spin);
        gl.uniformMatrix4fv(this.program.mvMatrix,false,mvMatrix);
        var nMatrix = mat4_inverse(mat4_transpose(mvMatrix));
        gl.uniformMatrix4fv(this.program.nMatrix,false,nMatrix);
        gl.uniform3fv(this.program.camera,camera);
        gl.uniform4fv(this.program.colour,[0,1,0,1]);
        gl.enableVertexAttribArray(this.program.vertex);
        gl.bindBuffer(gl.ARRAY_BUFFER,this.vbo);
        gl.vertexAttribPointer(this.program.vertex,3,gl.FLOAT,false,3*4,0);
        var ofs = 0, parts = this.data.ofs;
        for(var part=0; part<parts.length; part++) {
            var start = ofs;
            ofs += parts[part];
            gl.drawArrays(gl.LINE_STRIP,start,ofs-start);
        }
        gl.disableVertexAttribArray(this.program.vertex);
        gl.bindBuffer(gl.ARRAY_BUFFER,null);
        gl.useProgram(null);
    },
    program: createProgram("precision mediump float;\n"+
            "attribute vec3 vertex;\n"+
            "uniform mat4 pMatrix, mvMatrix, nMatrix;\n"+
            "varying vec3 n;\n"+
            "void main() {\n"+
            "   gl_Position = pMatrix * mvMatrix * vec4(vertex,1.0);\n"+
            "   n = (nMatrix * vec4(vertex,1.0)).xyz;\n"+
            "}\n",
            "precision mediump float;\n"+
            "uniform vec4 colour;\n"+
            "uniform vec3 camera;\n"+
            "varying vec3 n;\n"+
            "void main() {\n"+
            "   if(dot(camera,n) < 0.0) discard;\n"+
            "   gl_FragColor = colour;\n"+
            "}\n",
            ["pMatrix","mvMatrix","colour","camera","nMatrix"],
            ["vertex"]),
    data: getFile("json","data/world.json"),
};
var pts = [], deg2rad = Math.PI/180;
for(var i=0; i<scene.map.data.pts.length; i+=2) {
    var lng = scene.map.data.pts[i] * deg2rad,
        lat = scene.map.data.pts[i+1] * deg2rad;
    pts.push(-Math.cos(lat)*Math.cos(lng),Math.sin(lat),Math.cos(lat)*Math.sin(lng));
}
pts.push(0,0,0); // centre of sphere, for sprite z-culling trick
gl.bindBuffer(gl.ARRAY_BUFFER,scene.map.vbo);
gl.bufferData(gl.ARRAY_BUFFER,new Float32Array(pts),gl.STATIC_DRAW);
gl.bindBuffer(gl.ARRAY_BUFFER,null);

and to draw it:
var pMatrix = createPerspective(60,canvas.width/canvas.height,0.1,4),
    eye = [-2,0,0],
    mvMatrix = createLookAt(eye,[0,0,0],[0,1,0]);
scene.map.draw(pMatrix,mvMatrix,eye,t);

However, this is only drawing the left hemisphere rather than the front:

How can I correctly compute the normal of a point, and the position of the camera?

sentences:
anisotropic fog of war Here I am not talking about how to render fog of war, but how to model exploring of terrain in a more sophisticated way.

In a straight-forward approach, terrain explored by a game unit is simply represented by a circle whose radius is how far this unit can see. And visible area is just union of isometric circles. But I can tell that it is not the case in popular games.

Please take a look at the following screenshot from League of Legends, for example.

The sight of view is anisotropic. The shape of surrounding terrain is also taken in to account.

Any idea how this can be done?

sentences:
How can I play an animation as long as the player is on the pressure pad? I'm making a 2D platformer with Unity. Recently, I implemented a pressure pad system. Basically, when the player triggers the pad, a door near there should be opened. The system works properly but the only problem is when the player stays on the pad, the OpenWhenOn animation (an idle animation that is for the door opening) is not playing. I want to make this keep playing as long as the player is on the pad and if it exits the trigger, the DoorClosing animation should be played. I wrote this code mainly for playing the animation but it doesn't work and I get Null Reference error all the time.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;

public class PressurePad : MonoBehaviour
{
    private Animator anim;
    public UnityEvent OnActivate;
    public UnityEvent OnDeactivate;
    public GameObject door;

    public float deactivationDelay = 2f;

    int objectsInContact;
    Coroutine waitingToDeactivate;

    IEnumerator Timer()
    {
        yield return new WaitForSeconds(deactivationDelay);

        // Tell our listeners we're switched OFF.
        if (OnDeactivate != null)
            OnDeactivate.Invoke();

        // Return to ready-to-activate state:
        waitingToDeactivate = null;
    }

    void OnTriggerEnter2D(Collider2D other)
    {

        if (other.CompareTag("Player"))

        {
            anim.Play("OpenWhenOn");

        }

        door.GetComponent<Animator>().Play("OpenWhenOn");

        objectsInContact++;

        // Pressure pad pressed.
        if (objectsInContact == 1)
        {

            if (waitingToDeactivate != null)
            {
                // Cancel deactivation timer.
                StopCoroutine(waitingToDeactivate);
                waitingToDeactivate = null;

            }
            else if (OnActivate != null)
            {
                // Tell our listeners we're switched ON.
                OnActivate.Invoke();
            }

        }
    }

    void OnTriggerExit2D(Collider2D other)
    {
        objectsInContact--;

        // Pressure pad released.
        if (objectsInContact == 0)
        {
            // Start a delay before telling anyone.
            waitingToDeactivate = StartCoroutine(Timer());
        }
    }
}

 This is my Animator Controller. HasExitTime is disabled for all the transitions. The condition for the transition   between OpenWhenOn and DoorClosing is set to false.

sentences: what is the best way to make a bunch of platforms appear randomly on a JFrame but close enough the player can reach them? Hi I'm trying to make a screen that will have a bunch of platforms that will place themselves randomly around a JFrame. I know how to do the stuff to make the character jump and to deal with the collisions just not a way to place the platforms on the screen randomly so they are close enough together that the character could reach. Any help is appreciated.

sentences:
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:
Independent blending with DXGI_FORMAT_R16G16_SINT I'm implementing direct volume rendering engine with volume bricking, but I'm stuck with this problem:

For each volume brick I render to color render target [CRT] (for visualization) and to data render target [DRT] (used for isosurface object picking). DRT is of the DXGI_FORMAT_R16G16_SINT format. All works fine and smooth except wrong handling of blending DRTs of multiple volume bricks together. Closer brick always occludes further brick DRT.

Here are the pictures to illustrate my point
(if the object has proper DRT data it's outlined - as you can se in the highlighted area, there are objects/parts with no data)

Could somebody please give me a tip, how to handle this?
Of course I could always render every brick to separate DRT and write own shader to merge them properly, but isn't there a way of only properly setting blending modes?

(now I'm rendering with blending disabled for DRTs)

Thanks

sentences:
What is the most appropriate way to achieve synchronous Addressable asset loading? I am transitioning my project from Resources to Addressables. Some parts of my game just aren't worth doing asynchronously, and would just cause more problems - but I still want to use Addressables for its other benefits.

Anyway, it doesn't offer any synchronous methods in their API. Unity has an official repository with an example for "synchronous addressables" right here: https://github.com/Unity-Technologies/Addressables-Sample/blob/master/Advanced/Sync%20Addressables/Assets/SyncAddressables/SyncAddressables.cs

Although the code does appear to work in the few tests I've done The code below won't always work, and it doesn't make sense to me anyway. This is the relevant method:

    public static TObject LoadAsset<TObject>(object key)
    {
        if(!s_Initialized)
            throw new Exception("Whoa there friend!  We haven't init'd yet!");

        var op = Addressables.LoadAssetAsync<TObject>(key);

        if(!op.IsDone)
            throw new Exception("Sync LoadAsset failed to load in a sync way! " + key);

        if (op.Result == null)
        {
            var message = "Sync LoadAsset has null result " + key;
            if (op.OperationException != null)
                message += " Exception: " + op.OperationException;

            throw new Exception(message);
        }

        return op.Result;
    }

It will throw an exception if the asset didn't manage to load instantly (the !op.isDone part). Sure, that's technically synchronous, but it seems to ignore the elephant in the room: if the asset is large I would expect it to need a bit more time (i.e. freeze the game), which is fine for my current needs - but instead, the game will just end up crashing because it couldn't load immediately.

What is the most appropriate way to achieve synchronous Addressable asset loading?

sentences:
How can I improve on this engine design? I am trying to come up with a terrain visualization system and I am writing a simple graphics engine for this. For some reason, I wanted to try a new idea. Rather than using dynamic polymorphism and derive from a GameObject like class for all the entities in the screen, I go for something like this.

First, I want to have a very simple scene graph, very non-sophisticated. For this, I am using a heterogeneous vector like given here. My scene graph will be just a heterogeneous vector of possible renderable items. I will iterate through each item using visitors.

For example my Terrain class looks like following

template <typename RenderAPI>
class HeightmapTerrain
{
public:
    // constructor like things
    void render();
    void input();
    // imagine the rest
private:
    Heaightmap hm;
    Transformation tm;
    TerrainInputHandler tih;
};

Then I will have a specialization of this for OpenGL as follows

template <> class HeightmapTerrain<OpenGLAPI> {
public:
    // as an example
    void render()
    {
        BasicTerrainGLSLShader ts;
        ts.bind();
        hm.generateVBO();
        // etc.
    }
private:
};

typedef Terrain<OpenGLAPI> HeightmapOpenGLTerrain;

Assume all of these are in a file called Terrain.h. I am planing to include that file and I will add an instance of HeightmapOpenGLTerrain to my scene graph. This way, I can call render_visitor() in the render function of my scene graph and since it is a heterogeneous vector all will work, I hope.

The reason I am doing this is because if I want to extend the system with new graphics APIs, I will just create a new specialization and implement render etc. methods as

template <> class HeightmapTerrain<VulkanAPI> {
public:
    // as an example
    void render()
    {
        // Vulkan implementation
    }
private:
};
typedef Terrain<VulkanAPI> HeightmapVulkanTerrain;

With this, I can use same scene graph to render and input handle etc. but now using Vulkan. It feels like I can easily change the Input mechanism as well, with this system.

Now, what I am asking is this; I am not really that great at template programming. Is this approach feasible? What are the performance and design disadvantages compared to dynamic polymorphism approach we all know and love? Is this design downright obtuse? Lastly, can I have different private members for different specializations? Let's say I wanted to also have HeightmapTerrain<OfflineRendering> to render using path tracing. Can I add an extra private member to this specialization, like Canvas cs?

sentences:
Manipulating an animation towards a target object (ie. The hand and arm lean towards the target) I am trying to make a boxing game just for fun (I dont expect the end product to be anything decent lol) . I have my boxers in the ring and they are animated quite well so far, with Idle, and punch Left and Right. They also rotate so they are always looking at each other.

What I want to do is give the punch some aim towards the head. I will give the punch a set amount which it can move from the standard animation and move the hand bone in the direction of the targets head object. But I don't know how to do this :S

So far i have used dragged the 3 animation files into Mecanim and coded it to do the animations when a button is pressed.

Is there a way to manipulate the animation in this way? (ie. actually make the arm reach towards the target object )

sentences:
OpenGL - How to draw each nth triangle using glVertexAttribPointer I have a vertex buffer. There are situations when I don't want to render the whole mesh, but let's say each nth triangle of the mesh.
I am using VAOs and VBOs.

My data in the buffer is like this:

first triangle indx        seciond triangle indx
0 1 2   3 4 5   6 7 8    | 9 10 11   12 13 14   15 16 17 ...

What I want to do is - render first triangle, then skip second, then render 3d and so on.
Can it be done with adjusting glVertexAttribPointer() or are there some other gl methods that can manipulate the data like that, or I have to create a new buffer with skipped triangles ?

sentences:
How can I make video games if I don't like programming? I am studying C++ code in my school (my major is computer programming). Honestly, my grades are not so good, and assignments are really hard. Sometimes I feel sad that I will spend 8-10 hours per day coding (which is stressful) in the future for my job.

But I still want to make video games. Maybe this is the only reason why I am taking all of these stressful courses. I always write down plots, stories, characters, fictional gaming worlds... Once, I thought I should study artistic technology such as game design and not computer technology such as C++, C#, etc.

However, most of popular game designers (or directors) such as Kojima, Miyamoto, etc. used to be good programmers. Companies actaully assign programmers to directors because they understand how to make a game.

I've try to find other colleges or universities where they teach game design programs. However, one article that lists rank 10 game design schools in North America seems untrustful because the survey company only scores it from intervews of students.

Once, I tried to attend Art Institute of Vancouver which is rank 7 according to that article. However, one programmer who used to be an instructor in there told me the truth: the employement rate of graduated students is low.

How can I have a future making games if I don't like programming?

sentences:
How can this method to make a text mesh always face the camera be simplified? (Unity c#) Despite a fairly heafty new years I am back trying to learn a bit more coding :D

This latest feature I am trying to add is a TextMesh that floats above a gameobject when the player is looking at it.

I does all work fine (except it kinda shakes a little but I'll look into that another time). But as I wrote the method to make the textMeshObject look at my camera, I just had a niggling feeling it could be written in less lines of code.

I actually get this a lot where I write several lines and think it must be able to be simplified, and after the code having several parts like this it can look pretty messed up.

Anyways, I thought i'd ask you experts on here if it was possible to do this an simpler (NOTE: I only want it to rotate on Y Axis):

  void FaceTextMeshToCamera(){
            Vector3 origRot = textMeshObject.transform.eulerAngles;
        textMeshObject.transform.LookAt(textLookTargetTransform);
        Vector3 desiredRot = textMeshObject.transform.eulerAngles;
        desiredRot.x = origRot.x;
        desiredRot.z = origRot.z;
        textMeshObject.transform.eulerAngles = desiredRot;
  }

sentences:
Unity Canvas blocking objects in Editor I think I am missing something really basic here..., I'm creating a 2D game in unity, and the UI Canvas (with the setting "Screen Space - Overlay") is blocking exactly a quarter of my workspace. I can not select any objects on the top right part of the screen.

Is there any fix to this?, or do I have to move the camera down half of the screen?

Thanks

sentences:
Drawing lines in 3D space When attempting to draw a line in 3D space with D3DPT_LINELIST, then Direct3D gives me an error about an invalid vertex declaration, saying that it cannot be converted to an FVF. I am using the same vertex declaration and shader/stream setup as for my D3DPT_TRIANGLELIST rendering which works absolutely correctly.

How can I use D3DPT_LINELIST to render some lines in 3D space?

Edit: Here's my raw Draw call.

D3DCALL(device->SetStreamSource(1, PerBoneBuffer.get(), 0, sizeof(PerInstanceData)));
D3DCALL(device->SetStreamSourceFreq(1, D3DSTREAMSOURCE_INSTANCEDATA | 1));
D3DCALL(device->SetStreamSource(0, LineVerts, 0, sizeof(D3DXVECTOR3)));
D3DCALL(device->SetStreamSourceFreq(0, D3DSTREAMSOURCE_INDEXEDDATA | lines.size()));
D3DCALL(device->SetIndices(LineIndices));
PerInstanceData* data;
std::vector<Wide::Render::Line*> lines_vec(lines.begin(), lines.end());
D3DCALL(PerBoneBuffer->Lock(0, lines.size() * sizeof(PerInstanceData), reinterpret_cast<void**>(&data), D3DLOCK_DISCARD));
std::for_each(lines.begin(), lines.end(), [&](Wide::Render::Line* ptr) {
    data->Color = D3DXColor(ptr->Colour);
    D3DXMATRIXA16 Translate, Scale, Rotate;
    D3DXMatrixTranslation(&Translate, ptr->Start.x, ptr->Start.y, ptr->Start.z);
    D3DXMatrixScaling(&Scale, ptr->Scale, 1, 1);
    D3DXMatrixRotationQuaternion(&Rotate, &D3DQuaternion(ptr->Rotation));
    data->World = Scale * Rotate * Translate;
});
D3DCALL(PerBoneBuffer->Unlock());
D3DCALL(device->DrawIndexedPrimitive(D3DPRIMITIVETYPE::D3DPT_LINELIST, 0, 0, 2, 0, 1));

Here's my vertex declaration:

D3DVERTEXELEMENT9 BasicMeshVertices[] = {
    {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
    {1, 0, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0},
    {1, 16, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1},
    {1, 32, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 2},
    {1, 48, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 3},
    {1, 64, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0},
    D3DDECL_END()
};

The LineIndices are just 0, 1 and the LineVerts are just {0,0,0} and {1,0,0}, to represent a unit 3D line along the X axis.

sentences:
Unity's new Input system does not work after building the game I've made a test project to test the new Input system pointers (touch and mouse), in the editor, everything works perfectly however when I build the game they don't. it's like there is not an input system. I'm not sure if I'm missing a setting or something.

I've made simple sean where the Ui displays the available devices, whether they're enabled or not, and if a touch or mouse click detected it will display general information about it.

this is how it works in the editor:

And this is the android version, note that button press still works:

I did not record the PC standalone version but it still does not respond.

this is the link to the build:
https://github.com/Venay/Input_test

this is the code I used and couple of screenshots of my settings:

using UnityEngine;
using UnityEngine.UI;
using UnityEngine.InputSystem;

namespace Testing.InputDebugger
{
    public class InputDebugger : MonoBehaviour
    {
        PointerInput pointerInput;
        public Text inputText;
        public Text deviceText;
        public Text buttonText;

        private void Awake()
        {
            pointerInput = new PointerInput();
            pointerInput.General.Pointer.performed += ctx => OnPointer(ctx.ReadValue<myCompositData>());
            pointerInput.General.Pointer.canceled += ctx => OnPointer(ctx.ReadValue<myCompositData>());

            string text = "";

            foreach (var S in InputSystem.devices)
            {
                text += S.device + " : " + S.enabled + "  \n";
            }
            deviceText.text = text;
        }

        private void OnEnable() => pointerInput.Enable();
        private void OnDisable() => pointerInput.Disable();

        public void OnPointer(myCompositData data)
        {

            string n = "\n";
            string Press = "Press: " + data.Press.ToString() + n;
            string PressCount = "Press Count: " + data.PressCount + n;
            string Position = "Position: " + data.Position + n;
            string Delta = "Delta: " + data.Delta + n;
            string Radius = "Radius: " + data.Radius + n;

            string Tap = "Tap: " + data.Tap + n;
            string StartPosition = "Start Position: " + data.StartPosition + n;
            string StartTime = "Start Time: " + data.StartTime + n;

            string Scroll = "Scroll: " + data.Scroll + n;

            inputText.text = Time.time + n + Press + PressCount + Position + Delta + Radius + n + Tap + StartPosition + StartTime + n + Scroll;

        }

        public void OnButtonPress() => buttonText.text = "Pressed at:\n" + Time.time;
    }

}

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:
Unity - protect MonoBehaviour-derived classes from instantiating via new in C# When the class hierarchy grows and you deal with a lot of custom types in your project, it sometimes becomes hard to remember which types are allowed to be created via new and which types are derived from MonoBehaviour and therefore can't be created via new but must instead be attached to the GameObject as a Component.

Is it possible to have some safety-mechanism for this? The goal would be to have two base classes to control the ability to use new on a certain type. Ideally resulting in a compile-time error instead of an easy to miss warning in the console ("You are trying to create a MonoBehaviour using the 'new' keyword. This is not allowed. Blah blah.").

My attempt to make the constructor protected, like this

public class UnCreatableBase : MonoBehaviour {
    protected UnCreatableBase() {
        // using new should be not allowed
    }

    public static T Create<T>() {
        // instead this method allows object creation
        return GameObject.Instantiate (Resources.Load ("Prefabs/" + typeof(T).Name) as GameObject).GetComponent<T>();
    }
}

public class CreatableBase {
    public CreatableBase() {
        // new is ok here
    }
}

still allows me to write:

var whyDoesThisWork = new UnCreatableBase();

I can access the protected constructor even from an outside scope.

Now, the obvious solution would be to make constructors of MonoBehaviour-derived classes private. Manually. All of them. Manually. I was wondering if there's a way of achieving the same in a more generic way.

sentences:
Exported FBX Blender Model not showing up in XNA I really do apologise if this question has been asked before, but I recently created a model in Blender 2.63, exported it to an FBX file, and tried to display it in XNA (using 4.0 Refresh), but all that shows up is the standard XNA blank screen. My code for drawing the model is:

    void RenderModel(Model model, Matrix world, Matrix view, Matrix projection)
    {
        foreach (ModelMesh mesh in model.Meshes)
        {
            foreach (BasicEffect fx in mesh.Effects)
            {
                fx.World = world;
                fx.View = view;
                fx.Projection = projection;
                //fx.Texture = untagged;

                //fx.EnableDefaultLighting();
            }

            mesh.Draw();
        }
    }

where

    world = Matrix.CreateTranslation(Vector3.Zero);
    view = Matrix.CreateLookAt(new Vector3(0, 0, 10), Vector3.Zero, Vector3.UnitY);
    projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45), 800f / 600f, 0.1f, 100);

The above code worked for some other models I tried, so I'm pretty sure it's something wrong with the exported model. I exported the model from Blender using the XNA strict settings, and there are no animations, just a texture, which seems to be connected properly to the FBX from the text in the FBX file.

If anyone can tell me how I can create a simple model in Blender and make it usable for XNA, that would be great. Thanks a lot!

EDIT: Added program versions for Blender and XNA

sentences:
How can I get a raycast to hit navmesh only? In Unity, I'm trying to get the raycast to hit the navmesh only, but I cannot find an option to place navmesh on a specific layer.
Is there a way to raycast to the navmesh itself?

sentences:
How do I use a PC Dance Pad with Xna? I have a Dance Pad and I want use it in XNA as a controller. It has a USB connection.

Can someone help me?

sentences:
How do I duplicate the functionality of ugui's onClick (button component) in inspector (Unity)? I'm trying to create the same functionality that occurs when you are working with a button in uGui in Unity. I know that I have to create a custom inspector, but i'm not sure where to go from there.

Essentially the functionality allows you to drag and drop a script to it's on click portion in the inspector, and then it gives you a list of functions for that script to select. This may sound a little confusing, so here are a few pictures demonstrating the functionality i'm trying to replicate.

As you can see above the functionality allows you to drag in a script, select a function to link, and do this for as many or as little scripts as you want by pressing the + or - buttons on the bottom right.

Thanks for any help in advance!

sentences:
Is it a bad practice to add helper methods if the class is intended only for data? For example, if I have something like:

class ItemData
{
    public int cost;
    public int level;
    ...
    public List<ItemData> childItems;
}

And I'm aiming to separate data from logic, is it ok if I add methods to ItemData such as:

class ItemData
{
    ...
    public void AddChildItemData(ItemData childItem);
    ...
}

that are helper methods for setting or manipulating the data? Or should these be moved elsewhere to service classes?

sentences:
player keeps on firing (Javascript + Canvas) I'm brand new to game development (with Javascript)... I'm pretty sure my question is very simple, but I have a hard time to figure out myself... I'm starting at the very beginning, so this is pretty simplistic.

This is my whole code in javascript:

var fire = false;
function keyUp(evt) {
  switch (evt.keyCode) {
     case SPACE:
        fire = false;
     break;
     ...
  }
}
function keyDown(evt) {
  switch (evt.keyCode) {
     case SPACE:
        fire = true;
     break;
     ...
  }
}
function update() {
    ...
    if (fire) {
        playerHasShot = true;
        shot.x = player.x + player.w;
        shot.y = player.y + (player.h / 2);
        shot.vx += 2;
    }
    if (!fire) {
        playerHasShot = false;
    }
   ...
    shot.x += shot.vx;
   ...
    //Bullet
    if (playerHasShot) {
        playerHasShot = false;
    }
    if (!playerHasShot) {
        playerHasShot = false;
    }
    ...
    if (shot.vx > 4) {
        shot.vx = 4;
    }
    ...
    if (shot.x > canvas.width) {
        shot.x = player.x + player.w;
        shot.y = player.y + (player.h / 2);
        playerHasShot = false;
    }
    ...
    render();
    renderShot();
}

I hit the spacebar once, and that guy can't stop shooting... Would any of you mind telling me how to stop him, please ? I'm sure I'm close, but there's something I'm missing somewhere.... Thanks! :)

sentences: Integrating a leader board with FaceBook? Think like how Bejeweled 2 does its Blitz mode where it connects to Facebook, pulls your friends names and their top scores for the week.  Are there any libraries, etc. that already help facilitate this process?  I would rather not re-invent the wheel if necessary.

sentences:
Help on TileMapRenderer In my project, I'm trying to render a map using TileMapRenderer. But it doesn't show anything when I render it. But when I use some other files from a tutorial they are rendered correctly.

When debugging my TileAtlas instance shows the size as 0.

I have used Texture Packer UI for packing the images. Comparing with the tutorial's files, I can see that the index starts from 1 in my file and 0 in the tutorial. But changing it to 0 wouldn't work also.

map.png
format: RGBA8888
filter: Nearest,Nearest
repeat: none
Map
  rotate: false
  xy: 0, 0
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 1
Map
  rotate: false
  xy: 32, 0
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 2
Map
  rotate: false
  xy: 64, 0
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 3
Map
  rotate: false
  xy: 96, 0
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 4
Map
  rotate: false
  xy: 128, 0
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 5

Here is the begining of the tmx file.

<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" width="20" height="20" tilewidth="32" tileheight="32">
 <tileset firstgid="1" name="a" tilewidth="32" tileheight="32">
  <image source="map.png" width="256" height="32"/>
 </tileset>
 <layer name="Tile Layer 1" width="20" height="20">
  <data>
   <tile gid="2"/>
   <tile gid="2"/>

Apart from that the tutorial files and my files seems to be similar.

Can anyone help me here.

sentences:
Will unlocking the framerate in XNA/MonoGame tell me how efficient my code is? I have been unlocking the framerate in MonoGame via:

this.graphics.SynchronizeWithVerticalRetrace = false;
base.IsFixedTimeStep = false;

And using it as a basis for how efficient I am updating and drawing in the game.

At a resolution of 240 x 160 with nothing being drawn or updated except a frame counter I get an FPS value of 9,000 to 11,000 FPS.

If I add all my code back in it drops down to about 1,100 FPS.

Is this a good indication that my code is significantly slowing the GPU down (10x), and should I be concerned? The game is going to run at 60 FPS so I'm still pretty far away from that, but at what point in the unlocked frame rate should I be concerned?

GPU: AMD FirePro W5000 (FireGL V)

sentences:
Move rigidbody using WASD keys but rotate it based on camera/mouse movement I am very new to unity and my scripts are based on some scripts found on the web.

I want to make a first person view so the camera is attached to my rigidbodys head. Then i want to move my rigidbody based on keyboard input (wasd) and rotate it using the mouse movement.

Until now, i used the following code for moving my rigidbody:

void Update() {

    /* calculate rigidbody movement */
    movement = new Vector3( Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical")).normalized;

    /* calculate mouse look to rotate the rigidbody*/
    mouseDelta = new Vector2(Input.GetAxisRaw("Mouse X"), Input.GetAxisRaw("Mouse Y"));
    mouseDelta = Vector2.Scale(mouseDelta, new Vector2(sensitivity * smoothing, sensitivity * smoothing));
    smoothV.x = Mathf.Lerp(smoothV.x, mouseDelta.x, 1f / smoothing);
    smoothV.y = Mathf.Lerp(smoothV.y, mouseDelta.y, 1f / smoothing);
    mouseLook += smoothV;

}

void FixedUpdate() {

    /* apply rigidbody movement from Update() */
    transform.Translate( movement * moveSpeed * Time.deltaTime );
    /* apply rigidbody rotation from Update() */
    transform.localRotation = Quaternion.AngleAxis(mouseLook.x, transform.up);
    /* apply camera rotation from Update() */
    Camera.main.transform.localRotation = Quaternion.AngleAxis(-mouseLook.y, Vector3.right);

}

I learned today that i dont have to move a rigidbody's transform but now i am totally confused and it seems i have to restart my whole (first!) project.

So when i use MovePosition and MoveRotation, how do i rotate it based on the camera perspective/mouse movement?

I think the movement Vector is ok so i can simply rewrite the FixedUpdate to something like

rigidbody.MovePosition(movement * speed * Time.deltaTime)

but i am totally stuck on how to apply the camera rotation to my rigidbody to use it like

void FixedUpdate() {
    /* move the rigidbody */
    rigidbody.MovePosition(movement * moveSpeed * Time.deltaTime);
    /* rotate the camera */
    camera.transform.localRotation = Quaternion.AngleAxis(-mouseLook.y, Vector3.right);

    /* but how can i rotate the rigidbody based on the cameras rotation??? */
    rigidbody.MoveRotation(?????);

}

I hope its clear what i want, thank you!

sentences:
Precomputing Visibility Having noticed that UDK (Unreal) and Unity 3 include similar pre-computed visibility solutions that unlike Quake are not dependent on level geometry, I've been trying to figure out how the calculation is done.

The original Quake system is well documented: You divide the world into convex volumes that limit both the camera and the geometry. Each volume has a list of all the other volumes that are visible from it.

Visibility would be computed by firing rays at some random distribution of points in the target volume and see if any hit. And because the position of the camera in the source volume could have an effect, those thousands of rays would have to be fired from multiple places in the source cell.

So what I'm wondering is if there's any been fundamental change to this basic scheme in the intervening 15 or so years? I can see how to adapt it to a UDK/Unity scheme that has regular source volumes and deals mostly with arbitrary meshes as the targets, but is there a better way than stochastic ray testing?

sentences:
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:
Ray tracing the Next Week - Cornell Box I'm so excited to learn ray tracing and did a lot of fun. But I'm stuck at rendering empty Cornell Box scene.

It has some darker color along the bright color and it's seem different with the image in the book.
Sorry if my English confuses you because I'm still learning it.
My source code about this project for someone want to check.
https://github.com/trinhlehainam/StudyRayTracing

sentences:
Box2D body rotation problem When my player jumps, I start a rotation and I want to finish it when he gets back on the ground.

My Player is jumping off the ground and landing back on in 1 second.

My physics are updating at 10 FPS (10 times per second).

So I want to complete a 180 degree rotation for exactly 1 second. I add 18 degree to my player at every world update. I convert the degrees to radians, but the result is this:

I want him to jump with a 0 degree angle, rotate and land with 0 degree angle. Here is my code:

world.step(step, 8, 3);

if(isJumping) {
    angle -= (18*Math.PI)/180; // conver degrees to radians
    player.body.setTransform(player.body.getPosition(), angle);
}

sentences:
Finding the right directory structure for version control Recently I've started thinking about how to layout the directory structure for my game engine. And well, I kinda hit a little snag.

There's going to be 2 people working on this project. Me and one of my friends. The problem is how do I do the layout of the directories so that it works nicely with version control (I'm using Plastic SCM. It has really nice features).

I'm thinking of dividing it up into 3 separate things:

A source code respository for storing all the C++ code
An exported assets repo where my friend can store all his exported data. (Exported as in final version that can be used by the engine).
And a raw assets directory where all my friends raw assets go into. These include stuff like psd files and mb files for easier backup and versioning.

What do you think of this structure? Any comments are welcome. I'm really down in the dirt with this one.

sentences:
How do I properly use multithreading with Nvidia PhysX? I'm having a multithreading problem with Nvidia PhysX.
the SDK requires that you call Simulate() (starts computing new physics positions within a new thread) and FetchResults() (waits 'till the physics computations are done). Inbetween Simulate() and FetchResults() you may not "compute new physics".

It is proposed (in a sample) that we create a game loop as such:

Logic (you may calculate physics here and other stuff)
Render + Simulate() at start of Render call and FetchResults at end of Render() call

However, this has given me various little errors that stack up: since you actually render the scene that was computed in the previous iteration in the game loop.

Does anyone have a solution to this?

sentences:
How can I introduce time pressure on the player's decisions? I am designing a hacking game, in which the player usually can take his time thinking about how to overcome the obstacles that he/she currently faces. However, I decided that besides coming up with clever solutions, hacking should also feel intense, and that the game needs some ways to put a time pressure on the player's decisions.

First such mechanic that I added reassured me that I am going in the right direction: Sometimes the player can trigger a network trace, which lasts X seconds and can potentially kick the player out of the network unless he/she reacts quickly enough and succeeds in evading the trace. I would like to add perhaps one or two more mechanics that would put the player under a time pressure, but I am a little stuck and always seem to come up with a variations on  'Countdown', i.e. 'There will be (a punishment) in (X) seconds, unless (some action is taken)', but obviously all those mechanics end up too similar.

In abstract terms — that is, without knowing the particular mechanics in my ruleset — how can I introduce a time-pressure on the player's decisions?

sentences:
Slick 2D first trial error I followed some advices to learn Slick2D and when I started doing the "SimpleGame" I got my first error. Does anyone have any idea of what is it and how to fix?

Sun Dec 26 23:09:12 GMT-03:00 2010 INFO:Slick Build #274
Sun Dec 26 23:09:12 GMT-03:00 2010 INFO:LWJGL Version: 2.0b1
Sun Dec 26 23:09:12 GMT-03:00 2010 INFO:OriginalDisplayMode: 1024 x 768 x 16 @60Hz
Sun Dec 26 23:09:12 GMT-03:00 2010 INFO:TargetDisplayMode: 800 x 600 x 0 @0Hz
Sun Dec 26 23:09:12 GMT-03:00 2010 ERROR:Could not find a valid pixel format
org.lwjgl.LWJGLException: Could not find a valid pixel format
 at org.lwjgl.opengl.WindowsPeerInfo.nChoosePixelFormat(Native Method)
 at org.lwjgl.opengl.WindowsPeerInfo.choosePixelFormat(WindowsPeerInfo.java:52)
 at org.lwjgl.opengl.WindowsDisplayPeerInfo.initDC(WindowsDisplayPeerInfo.java:54)
 at org.lwjgl.opengl.WindowsDisplay.createWindow(WindowsDisplay.java:158)
 at org.lwjgl.opengl.Display.createWindow(Display.java:299)
 at org.lwjgl.opengl.Display.create(Display.java:848)
 at org.lwjgl.opengl.Display.create(Display.java:800)
 at org.newdawn.slick.AppGameContainer.tryCreateDisplay(AppGameContainer.java:299)
 at org.newdawn.slick.AppGameContainer.access$000(AppGameContainer.java:34)
 at org.newdawn.slick.AppGameContainer$2.run(AppGameContainer.java:364)
 at java.security.AccessController.doPrivileged(Native Method)
 at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:345)
 at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:314)
 at SimpleGame.main(SimpleGame.java:38)
Exception in thread "main" org.newdawn.slick.SlickException: Failed to initialise the LWJGL display
 at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:375)
 at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:314)
 at SimpleGame.main(SimpleGame.java:38)

sentences:
Large vertex buffer vs multiple draw calls I'm just getting started with OpenGL, and I'm attempting to use it to create a 2D game. In this game, I have a hexagonal grid made up of a very large variety of differently-colored hexagons. As a newbie OpenGL programmer, I see two ways of drawing this grid:

Using a vertex buffer with the data for a single hexagon, then using a uniform offset value and iterating on the CPU to draw the same program many times until I have a grid.
Creating a singular very large pre-calculated vertex buffer that draws all the hexagons in a single call.

What's the most efficient method? Is there a better way of doing this?

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 keep clicks from menu from interfering with game state? I ran into a problem coding my game in which when I click the play button on the newly implemented menu, it also creates a bullet from my player. The player and the menu both rely on the mouse input. How would I make it so that this doesn't occur? Perhaps how would I delay input from the mouse for a second until after the game starts?

Thank you.

public static boolean pressed = false;

public void mousePressed(MouseEvent e)
{
    int mx = (int) e.getX();
    int my = (int) e.getY();

    if(Game.state == STATE.MENU) {
        if(Menu.playButton.contains(mx, my))
        {
            // Pressed Play Button
            pressed = true;
            Game.setState(Game.STATE.GAME);
        }

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

            if(tempObject.getId() == ID.Player && pressed == true)
            {
                handler.addObject(new Bullet(tempObject.getX()+16,
                        tempObject.getY()+24, ID.Bullet, handler, mx, my, game));
                bullets_shot += 1;

            }
        }
    }
}

sentences:
How to detect when a character is walking on an item in Java? To detect if a character is on an item on the floor, I can check every item on the map and do a collision check, and repeat the process every iteration.

Is there another way to do it, without checking every item?

I'm using Java, maybe the language offers a smart way to do this.

sentences:
2D active ragdoll/physics-based procedural animation I'm trying to make a 2D quadraped robot stand and walk via physics.

My robot looks like this. (art is not mine. Source is vapgames)

It's rigged via Unity's 2D animation package and each joint/bone has it's own collider + rigidbody with the legs also having hingejoints connecting the lower part to the upper part and the upper part to the main body of the robot. I've also set up IK for both legs using the 2D IK package with the IK target being attached to their respective leg via fixedjoint and can be moved programmatically to move the legs with respect to IK.

I want it to stand up, as at the moment is just falls and acts as a generic limp ragdoll. I've tried these methods:

Adding downward force to the legs via the IK targets
Adding upward force to the torso
Animating the IK targets to try and get the bot to stand up with animatePhysics enabled.

All of these failed (downard force to legs did pretty much nothing, upward force to torso just made it float if there was no ground, animating the IK targets was too glitchy).

I'm out of ideas on how to actually do this now. I've looked around for guides but there seems to be nothing good (I keep getting this suggested to me but it doesn't help. It's in 3D and the only thing that could help, spider legs, isn't finished and probably never will be)

There's very little information on how to do this sort of stuff and even when I find people who know about active ragdolls they just say add force to the head (for a 3D active ragdoll), which I've already tried (see 2. on the list of what I've already tried) and don't explain anyt further.

If anyone could help, that'd be great!

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:
Using the Command design pattern for game AI I'm trying to learn the Command design pattern and apply it to the game I'm working on. First I read about the general implementation, and I feel like I understand it pretty well. Now I want to know how to use it in games. I started reading this book about design patterns in games and in the section about the command pattern the author says:

  We can use this same command pattern as the interface between the AI
  engine and the actors; the AI code simply emits Command objects.

and

  The decoupling here between the AI that selects commands and the actor
  code that performs them gives us a lot of flexibility. We can use
  different AI modules for different actors.

I'm trying to figure out how this pattern would be used for game AI in practice. I assume there would be an AIEngine class or something like that with GenerateCommand() function. Then the GameActor would ask the AIEngine for a Command whenever it finishes executing the previous one.

What I don't understand is how exactly it would work. In order to generate commands the AIEngine needs to keep track of all the GameActor objects anyway (or at least of the one it's generating the commands for), so what's the point of using commands? At this point the AIEngine could just manage the GameActor objects directly.

I've been trying trying to wrap my head around this for quite a while. If someone could write a example implementation of the AIEngine interfacing with GameActor it would help me a lot. I don't think I'm able to understand it without seeing some code.

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 do I implement parallax scrolling in 2D? Suppose I have three layers: a foreground, an intermediate-ground and a background.  What is involved in using these three layers to create parallax scrolling?

sentences: How to develop XBox 360 games? I understand that I can learn XNA as a hobbyist, but for top games like Fifa for example how are they witten?

sentences:
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:
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:
Unity GameObject.Find() not working in batchmode? I am trying to make GameObject.Find() work in batchmode but for some reason it returns a null object.

my code:

public class test: Monobehaviour {
    public static GameObject go;

    static void doing()
    {
        go = GameObject.Find ("testing");
    }
}
//testing is the name of the gameobject in the editor

I call it from the console on mac using: /Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -projectPath "" -executeMethod test.doing

sentences:
How can I push a button with VR hands? New programmer here.

I am currently trying to create a sample game in Unity (2019.2.11f1) where I push a button using the VR hands of my Oculus Rift (the hands follow my controllers). I can't believe how difficult is to find documentation or tutorials for said task. I've tried to read documentation but I'm at a loss here.

I have tried putting sphere colliders on the Hands, and tried to use raycast, with no success. I use the localAvatar with both grabbers as children, and the avatar is itself child of the OVR Player Controller prefab you get when you download the Oculus asset from the store.

How can I achieve this?

sentences:
Mixing Javascript with C++ for mobile development? I have a few games for the iPhone, Android, and Windows 8 that I built using native C++. This works great but is really limiting when I try to create menus and start screens.

I have read about rapid development using jQuery Mobile and Phonegap but have never used any of these frameworks. However there looks to be an advantage using this to ceate my game menus and simple screens.

Is it possible to mix my existing C++/OpenGL game code with JavaScript used for simple  navigation, obviously this would need to compile into a native binary for iOS, Android, and BB. Is this possible?

I am all ears to any of the following to solve this; a framework, technique, or any approach that can make this happen.

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: LibGDX - blurred textures when resizing Hi could anyone help me solving the problem of blurred texures? My viewport screen have 800px of height and 480-600px (for different aspect ratios) of width and when I test game on smartphone with bigger screen the textures, buttons and the text are so blurry, even if I use Linear texture filter. How can I get rid of that? What can possibly solve my problems?

sentences:
How can I find the collision response between a moving sphere and cube? I'm implementing my own algorithm for sphere and cube collision response. So far I'm able to only test if both of them overlap.

My problem is: A cube is rotating around its axes i.e x and z axes. And the sphere is moving at a velocity that being Vx,Vy and Vz in all the 3 axes. How do I find the collision response between them without considering angular velocity of cube i.e when the cube and sphere collide cube is not having an velocity but angles with 2 axes. After collision I don't want the sphere to have angular velocity.

sentences:
In GameMaker Studio, how can I make an auto-updater for my game? I would like to let players update their copy of my game by clicking a button, which would:

Check for updates
Download the update
Prompt the user to restart the game

I want to do this because my friends hate to re-download my game each time I make a change.

Is this possible with GameMaker? If so, how?

I have Dropbox premium, could I take advantage of that?

sentences:
Trying to increase the size of a sprite when it touches a pellet in Unity with C# This is my first game, and I'm trying to keep it simple, so just a simple platformer that works around the size of the player's character, and the character increases in size whenever they consume a pellet. I have the character's basic movement down, but I'm coming across some errors that I'm not so sure how to fix.

The way I have it set up is that I have a script attached to an empty object called 'LevelManager' that will execute actions once it's called upon (Like 'Respawn Player' and 'Grow Player'), there is a 'Pellet' script attached to the pellet that basically calls upon the 'Grow Player' function when the player touches the pellet's collision box.

LevelManager.cs

public class LevelManager : MonoBehaviour {
    public GameObject currentCheckpoint;
    private PlayerController player;

    // Use this for initialization
    void Start () {
        player = FindObjectOfType<PlayerController> ();
    }

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

    }
    public void RespawnPlayer()
    {
        Debug.Log ("Player Has Respawned");
    }
    public void GrowPlayer()
    {
        Debug.Log ("Player Has Grown");
        player.transform.localScale += new Vector2(0.5, 0.5);
    }
}

Pellet.cs

public class Pellet : MonoBehaviour {
    public LevelManager levelManager;

    // Use this for initialization
    void Start () {
        levelManager = FindObjectOfType<LevelManager>();
    }

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

    }
    void OnTiggerEnter2D(Collider2D other)
    {
        if (other.name == "Player")
        {
            levelManager.GrowPlayer();
        }
    }
}

Also, I'm sorry I don't have the exact errors with me, something funky happened with the editor and I'm unable to locate the window for the compile errors anymore, and when the bug report I sent get's responded to, I'll add that in to make this an easier problem to tackle.

sentences:
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:
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:
Encode world matrix as 2 float4s? On one of the slides of their presentation "Batch, Batch, Batch!" guys from NVidia suggest encoding animation matrices for pallet skinning into two float4s as:

• axis/angle
• translate/uniform scale

I wonder how can that be done (including decoding) and why do they say that this leads to:

Video memory overhead: model replication

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

sentences:
How can I divide a 3D mesh into small pieces? I'm considering a manufacturing game. A player should assemble parts of an object in given time. The object will be a 3D mesh model. I want to automatically split the 3D mesh into many small pieces to be provided to players. Each divided piece is needed to have area as similar as possible. And I want to control the number of pieces too within range about 2~6. How can I do this?

I know the method to modify a given mesh like adjusting values of vertices, indices. All I need is the algorithm.

sentences:
synchronizing client-server actions What's the usual way to handle events that are checked both on server and the client, like attacking? There's a cooldown timer to an attack of which the client is aware (so to prevent spamming server requests and attack button is held).

Next there's a cooldown timer on the authoritative server. My problem is that sometimes attacks that end up firing on the client aren't executed on the server, because the server timer (serverFrameTime - lastAttackFrameTime > attackCooldown) didnt count up to the desired time, and so those are 'blank' attacks on the client.

Is there a standard way to handle that without emiting too many messages?
This is a problem for me because i might be firing more of those events and more timers, so autoattacking without clicking is not a long term solution for me.

sentences:
What's the difference between a "Gameplay Programmer" and a "Gameplay Engineer?" I was reading some job descriptions from some AAA developers in the gaming industry, and I noticed there were jobs for "Gameplay Programmers" as well as "Gameplay Engineers."

Are those the same thing?  Do they do the same thing?

sentences: How to change the amount of Fast Linear Gaussian blur in GLSL? I implemented the GLSL from http://rastergrid.com/blog/2010/09/efficient-gaussian-blur-with-linear-sampling/, but is unclear to me how to reduce or increase the amount of blur. Has it something to do with the iterations? I don't understand how.

sentences:
Unity5 UI - How to trigger button click event while preventing menu item deselect event? So I've got a load menu using Unity's new UI system, basically just a list of save games you can select with a mouse click along with a couple of buttons at the bottom to delete or load the selected game file.

I've been disabling the Load Game and Delete Game buttons using the interactable attribute whenever a saved game item in the list is deselected:

deleteButton_LoadPanel.GetComponent<Button>().interactable = false;
loadButton_LoadPanel.GetComponent<Button>().interactable = false;

This disables the buttons fine, but when I click on a saved game and then click a button, the deselect event for each save file is triggered BEFORE the onclick event for each button. This is no good.

If I have no deselection event for each individual save file I can click on each save file and then click the load or delete buttons and every thing works fine, but the buttons never get disabled which is not ideal.

My question is:
How can I disable the buttons when an item is deselected, but still trigger the onclick event when they are selected? Are there any workarounds to this?

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:
Global variables in a multiplayer environment I would like to know what's the best approach to solve this problem.
In a racing game, i need to create the final result chart.
In a single environment i've tought something like:

private string [] arrivalOrder;

void playerArrived(string playerName) {
   arrivalOrder[arrivalOrder.getLength()+1] = playerName;
}

I would like to know how to do in a multiplayer environment.

How the client can communicate to server "my player finishes the racing"?
Thanks

sentences:
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:
Texture gets blurry when moving Box2D body I'm having this issue that is very annoying. Somehow the texture of the player body is getting blurry and leaving a slight trail with its colors when moving it. The interesting fact is, this only happens when the player is moving in the air. I set linear velocity to move the player on the ground and I'm applying force to center to move the player when he's jumping.

I also tried using just a simple sprite. I played with Texture Filters and it didn't change anything. I even tried different textures. I'm calling Gdx.gl.glClear, which should have solved this issue.

Here's the render method of my Screen class:

@Override
public void render(float delta) {
    Gdx.gl.glClearColor( 1, 0, 0, 1 );
    Gdx.gl.glClear( GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT );
    camera.update();
    game.batch.setProjectionMatrix(camera.combined);
    world.step(Gdx.graphics.getDeltaTime(), 6, 2);
    debugMatrix = game.batch.getProjectionMatrix().cpy().scale(pixelsToMeters, pixelsToMeters, 0);
    game.batch.setProjectionMatrix(camera.combined);
    tiledMapRenderer.setView(camera);
    tiledMapRenderer.render();
    game.batch.begin();
    player.update();
    player.render(game.batch);
    game.batch.end();
    debugRenderer.render(world, debugMatrix);
}

Here's the part in the player's update method where I move him if he's jumping. This is the only movement in the game that causes the texture to get blurry. Same thing for the left side except the "-" sign when applying force to center:

if (Gdx.input.isKeyPressed(Input.Keys.RIGHT) && !rightCollision) {
        playerDir = Direction.right;
        if (playerState == State.jumping) {
            playerBody.applyForceToCenter(250f, 0f, true);
        } else {
            playerState = State.walking;
            playerBody.setLinearVelocity(1.2f, 0f);
        }
    }

And here's the part that makes the player jump:

if (Gdx.input.isKeyJustPressed(Input.Keys.UP) && playerState != State.jumping) {
        playerBody.applyLinearImpulse(new Vector2(0, 500f), playerBody.getWorldCenter(), true);
        playerState = State.jumping;
    }

sentences:
Box2D `ApplyLinearImpulse` is not working whereas `SetLinearVelocity` works I need to mimic jumping behavior for the player in my game. Player consists of two fixtures with circle and rectangle shapes. Rectangle I use to detect ground and it is a sensor. Is some point for jumping I do this:

float impulseY = body->GetMass() * PLAYER_JUMPING_VEOCITY / PTM_RATIO * std::sin(PLAYER_JUMPING_ANGLE * PI / 180);
body->ApplyLinearImpulse(b2Vec2(0, impulseY), body->GetWorldCenter(), true);

and player does not jump. But when I do this:

body->SetLinearVelocity(b2Vec2(0, PLAYER_JUMPING_VEOCITY / PTM_RATIO * std::sin(PLAYER_JUMPING_ANGLE * PI / 180)));

my player jumps. Also when I change the rectangle shape to be normal (not sensor) shape, its works again. Why? Just in case here are the parameters of my rectangular sensor:

b2PolygonShape boxShape;
boxShape.SetAsBox(width * 0.5/2/PTM_RATIO, height * 0.2/2/PTM_RATIO, b2Vec2(0, -height * 0.4 /PTM_RATIO), 0);

b2FixtureDef boxFixtureDef;
boxFixtureDef.friction = 0;
boxFixtureDef.restitution = 0;
boxFixtureDef.density = 1;
boxFixtureDef.isSensor = true;
boxFixtureDef.userData = static_cast<void*>(PLAYER_GROUP);

sentences:
XNA Texture2D Copy Error I have a static class that I use to build a 3d character and render the results to a RenderTarget2D which I then return.

I'd like to store the results for later use so I need to make a copy of the returned RenderTarget. To do this I`ve tried both a Quad VertexPrimitive Effect with a tiny copy PixelShaderFunction and a SpriteBatch.Draw.

I think that the Quad render is quicker but no matter how I fiddle, the Quad never seems to get it quite right.

For example, I do use SpriteBatch to pick up a 256*256 area of a large Texture2D backdrop and Draw that to a RenderTarget2D. But if I then send that directly to the Quad render and put that result back in the same place it almost - but VERY annoyingly not quite - fits back perfectly. Using another SpriteBatch.Draw does give a perfect result but I've convinced myself that it is slower.

So my questions are twofold.

1) Is the Quad UserIndexedPrimitive quicker than the SpriteBatch.Draw for multiple iterations?

and

2) Why can`t I get the Quad render to give me back the same image when setting it as the  Effect sampler via Effect.Parameter..SetValue(RenderTarget)?

As ever, Thanks :) Stoort.

Here is the problem in png form.

The left half is the RenderTarget2D before I use a short user Effect
that just does a straight copy using

    return tex2D(texture, coord);

as the only PixelShaderFunction instruction via a quad with

    graphicsDevice.DrawUserIndexedPrimitives<VertexPositionTexture>
                (PrimitiveType.TriangleList, verts, 0, 4, ib, 0, 2);

The source and destination width and height are identical as are all the
RenderTarget2D settings for both.

As you can see the output on the right is blurred and the top and right lines are wrapped from the opposite sides.

sentences:
How do I get access to the PS4 platform tools for Unity? I know that you can go to the "Xbox ID" program to get all the resources you need for the Xbox platform (developer forums, Unity SDK, etc.). but there is not really information about how to get the PlayStation tools.

...Well other than the contact sales button in Unity which links to Unity and not Sony (oddly enough).

So where does someone who hopes to put their games onto one of the Sony platforms (PS4, Vita, PS3, etc) go to get the build tools (and other things) they need? Do Sony contact you about it if they're interested or is it really only for developers who are considered above Indy?

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:
Exception when opening new libgdx project in intellij I'm trying to learn Libgdx and I used the project creator to create a project with the default settings. I then try to open the build.gradle in the root of the project and I keep getting an exception. Anyone know what is causing this and how I can open the project?

Intellij 2018.1.4

  java.lang.NullPointerException at com.android.tools.idea.project.messages.AbstractSyncMessages.removeMessages(AbstractSyncMessages.java:79) at com.android.tools.idea.gradle.project.sync.messages.GradleSyncMessages.removeProjectMessages(GradleSyncMessages.java:50) at com.android.tools.idea.gradle.project.sync.idea.notification.GradleNotificationExtension.customize(GradleNotificationExtension.java:57) at com.intellij.openapi.externalSystem.service.notification.ExternalSystemNotificationManager.createNotification(ExternalSystemNotificationManager.java:168) at com.intellij.openapi.externalSystem.util.ExternalSystemUtil.createFailureResult(ExternalSystemUtil.java:651) at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3$3.onFailure(ExternalSystemUtil.java:517) at com.intellij.openapi.externalSystem.service.remote.ExternalSystemProgressNotificationManagerImpl.onFailure(ExternalSystemProgressNotificationManagerImpl.java:124) at com.intellij.openapi.externalSystem.service.internal.ExternalSystemResolveProjectTask.doExecute(ExternalSystemResolveProjectTask.java:94) at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:163) at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:149) at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3.execute(ExternalSystemUtil.java:542) at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$4.run(ExternalSystemUtil.java:605) at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:750) at com.intellij.openapi.progress.impl.CoreProgressManager$5.run(CoreProgressManager.java:434) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:157) at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:580) at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:525) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:85) at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144) at com.intellij.openapi.application.impl.ApplicationImpl.lambda$null$10(ApplicationImpl.java:565) at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:305) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

sentences:
How can I create a GraphQL query with nested {} I am using GraphQL plugin from https://github.com/Gazuntype/graphQL-client-unity. I have a long query from which I am parsing it to JSON to get individual values. It all works fine. Unfortunately the problem appears when using SetArgs() in a nested {}. For example, here is my query:
{
  System(ID: "1") {
    model {
      type {
        SystemModel{
          CreationModel(isModelCreated: true) {
          name
          }
         }
        }
     }
   }
}

And here is my Unity code:
public async void GetSystemID () {
        GraphApi.Query query = Graph.GetQueryByName ("System", GraphApi.Query.Type.Query);
        query.SetArgs (new { ID= "1", isModelCreated = true }); //How do I provide isModelCreated here

        UnityWebRequest request = await NestedQuery.Post (query);
        JSONNode itemsData = JSON.Parse (request.downloadHandler.text);
        var parseJSON = JSON.Parse (request.downloadHandler.text);

    }

So in SetArgs, I have to provide a list of arguments, for example ID: "1" and isModelCreated: true. I am able to provide the first argument, but unfortunately the nested query's argument - isModelCreated is not getting recognized as it treats it as:
System(ID: "1", isModelCreated: true) {}

Do I have to add multiple {} so that it comes in right order or is there a cleaner way to achieve this?

sentences:
Unity3d iOS build - where are the textures? First time building and running my Unity3D app on my iPhone and it appears that all the textures are missing.  Everything is just a solid block of whatever color I made it.  When running in Unity I see everything correctly.  See images below.

To complicate things I'm using custom shaders, and all the objects are custom procedural meshes.  Quads that I build in script.  If I switch the paper backplate shader to a built in shader I still only see white on the iPhone.

So I suspect that somehow the textures just aren't making it to the iOS project.  When I look in the iOS project I can't find any textures.  Where would they be in the iOS project?  For example in Xcode under Build Phases > Copy Bundle Resources the only thing there is the Images.xcassets, which only contains the splash screens and icons.

Surely I'm missing something simple.

I tried renaming the folder where I keep my textures to "Textures".  Also my textures are not built in to the shader but added programmatically like this:

void Awake ()
{
    meshFilterComponent = GetComponent<MeshFilter>();
    Material material = GetComponent<MeshRenderer>().material;
    material.SetTexture(0, paperTexture);
    material.color = new Vector4(1f, 1f, 1f, 1f);
}

Where paperTexture is set up in the GameObject to point to the correct texture.  Is there any way to force a texture to be part of a build?  Let's say that you swap out textures in code, like swapping themes, how would you make sure they're all there to be loaded as needed?

Running On iPhone:

Running In Unity3D:

sentences:
Rotate coplanar 3D points to XY I have a set of 3D points. All these points are on the same plane. I have the normal of the plane.

Now I need to rotate them in such a way that the Z value of all these points become zero. (that is, 3D to XY plane)

I have Googled a lot. I got very few results and most of them are very much mathematical. Few are about projection and few are with solution with OpenGL APIs.

I have seen this solution:
Rotating 3d plane to XY plane

Based on this, I have implemented something like this:

public static List<Vector3D> RotateCoplanar3DPointsToXY(IList<Vector3D> points, Vector3D planeNormal)
        {
            var zAxis = new Vector3D(0, 0, 1);
            var rotationAxis = zAxis.Cross(planeNormal);
            rotationAxis.Normalize();
            var rotationAngle = (float)Math.Acos(zAxis.Dot(planeNormal));
            var matrix = Matrix4x4.FromAngleAxis(rotationAngle, rotationAxis);
            var newPoints = new List<Vector3D>();
            for (var i = 0; i < points.Count; i++)
            {
                var p = points[i];
                var newPoint = p.Transform(matrix);
                newPoints.Add(newPoint);
            }
            return newPoints;
        }

But this implementation is not working.

I have another implementation below based on @Bálint's comment. This is also not working.

public static Vector3D Cross(Vector3D a, Vector3D b)
        {
            return new Vector3D(
                a.Y * b.Z - a.Z * b.Y,
                a.Z * b.X - a.X * b.Z,
                a.X * b.Y - a.Y * b.X);
        }

        public static Matrix4x4 GetMatrixForRotatingCoplanar3DPointsToXY(Vector3D planeNormal)
        {
            var Z_NORMAL = new Vector3D(1, 0, 0);
            var d = planeNormal;
            var u = Z_NORMAL;

            var r = Cross(d, u);
            var t = Cross(r, d);
            var matrix = new Matrix4x4(
             r.X, t.X, d.X, 0,
             r.Y, t.Y, d.Y, 0,
             r.Z, t.Z, d.Z, 0,
             0, 0, 0, 1);

            return matrix;
        }

sentences:
Generating vertices for group of hexagons I'm working on the map editor of a game, where you can create a grid of hexagons to paint. An example of a grid of radius 6:

What I want

Once map creation is done, I would like to generate a mesh for each of these islands of color, with the least possible number of vertices.

What I have so far

My approach gives me a list of outer vertices for an island and a list of inner edges, which represent holes in the mesh. Outer and inner edges never overlap.

The gray area on the right of the image above has 3 holes, so what my code gives me is a list of vertices around the gray area and 3 lists of vertices for each hole inside it.

Problems I'm having

While I can already triangulate islands without holes, I can't find a way to turn the ones with holes into meshs. How should I approach solving this problem?

sentences:
How to trust a UDP Client I'm working on a Unity project with the Lidgren UDP library for connection. I'm new to networking, so I'm not sure on general "best practices" for this area. I'm trying to figure out a good way to be able to quickly trust and verify a received UDP message.

I currently keep a dictionary of players with each player assigned an UID (uint) from the server when the player connects. This UID serves as the key in the dictionary. The player is told their UID. Nothing secret being communicated here, like usernames/passwords, so I'm not worried about things like that.

So I'm having a problem with wrapping my head around how to trust the messages. Things like position updates and user actions will be sent from client->server via UDP. I was thinking of a quick way to process these messages is by including the UID at the start of each message, checking the UID, grabbing the corresponding player from the dictionary, and then updating the players position that way.

But I'm worried that can be easily spoofed/manipulated. All it'd take is some mischief maker to figure it out, and then start inserting random position updates (for themselves or others).

Is there an efficient, more fool proof way to ensure the message is from who it claims to be? Do I have to just rely on comparing IPEndPoints to tell? Is there anything specifically to Lidgren I can or should use?

Please don't respond if all you have is "don't worry about it" or "why would anyone want to do this?" I'd rather learn proper processes now than down the road when/if it becomes a problem.

sentences:
Linear interpolation: reach moving destination regardless its speed I'm implementing a camera for a game and I'm using the LERP formula for smooth chasing. However, if the target moves fast enough, the camera can never reach it unless the t ((1 - t) * v0 + t * v1) value is high enough, but that is exactly the problem: some targets might still move faster than the current t value.
This might lead to 2 problems:

The camera will never reach the object if it's super fast
The camera will very slowly reach the object, depending on its
current speed

How do I scale up my t when the delta distance (abs(v1 - v0)) gets lower, so that the camera will starts at a slow chasing rate and increases as it gets closer (therefore no targets could run away)?

sentences:
Collision detection optimization for a top down shooter I'm relatively new to game development and have been trying to learn how collision detection is coded. I mostly work with Actionscript 3, but I'm learning C++ on the side.

I've been wondering how "bullet hell" and top-down shooters optimize their collision detection with so many objects.

Any information/theories would be great.

sentences:
how to represent a nested menu system? I'm wondering what would be a clever way of making a layered menu system, in terms of what data structures to use.

An example of what I mean: A unit has the ability to construct buildings, and to cast some spells. The selection of buildings and spells are accessed either through pressing a hotkey or clicking an icon in the user interface. What is the best way to achieve this in the code?

I'm thinking something like:

Menu base state: options are A and B. If the players clicks A: change state and display the suboptions of A, and so on. But how is this achieved in the actual code? Perhaps a dict() containing functions:

options = {
           'A' : self.change_state ('a', self.current_state),
           'B' : self.change_state ('b', self.current_state)
          }

def on_key_event(self, key):
     options[key]

def change_state(self, key, state):
     if state == state_1:
          if key == 'a':
              ...

And so on, this seems really tedious and if possible I want to avoid if / else loops and just define everything in the simplest, and shortest manner.

I'm interested in how you would do this, or if you've already made a similar system, how you solved it in your own code.

sentences:
Pass large array to pixel shader I am trying to write a Pixelshader for a curve effect in Direct2d.

A curve effect maps each color channel value to a different value by using a look up table.

For this effect I would need to pass 3 arrays to the effect.
Each array has 256 entries to map the specific color channel.

How can I pass these arrays to a Pixel shader (i.e. Direct2d Effect)?

sentences: Using gametime.ElapsedGameTime to trigger an event I have a splashscreen object that waits for a user input before loading the next screen, but I would also like the next screen to load after a certain amount of time has passed. I tried adding a check to see if the elapsed game time is greater than or equal to a set amount of time in seconds. The user input still changes the screen, but the screen will not change after that time requirement has been met. What am I doing wrong?

sentences: Personal Custom Card Game I had the idea, to make a custom card game based off an Anime i like. I was wondering if it would be legal to have such printed out (using a custom card/board game service) for personal use. I would only play it with friends and not make any money off of it.

sentences: Pygame Platform & Player collisions I am trying to create a platform game where a player jumps between platforms horizontally (using a projectile curve). Currently, I have a class that blits platforms and a background, as well as the player. However, I cannot get it to detect when a platform and the player collide. I have used actual images and then done self.rect = self.image.get_rect() for both the platform and the character. My question is have I done something wrong with my theory or have I just not coded it correctly.

sentences: How can the board fit the screen perfectly in Unity's 2D Roguelike tutorial? I follow the tutorial 2D Roguelike tutorial. I want to understand how happen that 10x10 board of 32x32 sprites covers screen perfectly? Like what does this depend on?

sentences:
Tips for writing 3D Collision detection with opengl I would like to any tips/articles/tutorials on how to write collision detection using OpenGL and C++ in 3D mainly just simple box collisions etc but also if there are any advanced resources that would be great to. i also don't wont to use any external library`s if possible.

thanks

sentences:
Good way to establish an inventory system? Fairly new to Unity as a whole, and while making a prototype game I came across the issue of setting up an inventory system. So far, I've been stuck on what sort of structure it should have, given:

Each "Mob" (player, enemy, NPC, etc.) has its own inventory
Objects can have children attached, which should be saved (e.g. Gun -> Attachment Manager -> Magazine/Rail/etc.)
Simpler items (ammunition, etc.) are stackable
An inventory has "pouches" which are available only for certain objects (magazines, health items, etc.) and have a certain volume

At first, I simply made a Mob -> Inventory Manager -> Pouch -> Item system where everything was a child of its respective parent, but obviously even with colliders/sprites disabled that's possibly hundreds of transforms per mob being shifted around each update. Right now, I'm just parenting each mob's inventory system to a static "Inventories" object to get past the issue of that many transforms, but is there a better long term solution that takes into account saving/loading and scene transitions?
Right now, I'm considering:

Turning each item with children (guns with attachments) into a prefab and saving it (not ideal)
Using an ID system to instantiate objects on load by loading the root object (gun), then the children (attachments) given certain parameters (but the variables, like the rounds loaded into a magazine, would be tricky to load)
Having different prefabs for items depending on whether or not they're equipped, on the ground, or in an inventory, and switching between them as needed

sentences:
Should I encrypt my multiplayer network traffic? My plan has been to use RSA to exchange AES session-keys with a client, which is then used for all the usual in-game stuff. Clients never connect with each other, all communication is client to server only.

The question is: Would I be wasting my time by encrypting the communication? How are big AAA multiplayer games doing it? If I do do encryption, is the basic scheme I mentioned a good start?

sentences:
Can anyone recommend an AI sandbox? I'm passionate person, who has been around AI from a long time [1] but never going in deep enough. Now it's time!

I've been really looking for some way to concentrate on AI coding but couldn't succeeded to find an AI environment I can focus on. I just want to use an AI sandbox environment which would let me have tools like:

visibility information
character controller
able to easily define a level, with obstacles of course
physics
collider management
triggers management
don't need to be a shiny, eye candy graphical render : this is about pathfinding, tactical reasoning, etc..

I have tried :

Unreal Dev Kit : while the new release announce is about C++ coding, this is about external tools and will be released in 2013
Cry Engine : really interesting as AI is presents here but coding with it appears to be an hell: did I got it wrong ?
Half Life source, C4, Torque, Dx Studio : either quite old, not very useful or costly these imply to dig in documentation (when provided) to code everything, graphics included.
Unity 3D : the most promising platform. While you also need to create your own environment, there are lot of examples. The disadvantage is, in addition to spend time to have this env. working, is the languages choice : C#, Javascript or Boo. C# is not that hard, but this implies you'll allways have to convert papers (I love those from Lars Linden) books codes, or anything you can have in Aigamedev are most often in C++. This is extra work. I've look at "Simple Path", the very good Arong Greenberg work but no source provided and AngryAnt work.
AI Sandbox : this seems to be exactly what as AI coder I want to use. I saw some preview but from 2009 we still don't know what it will be about precisely, will it be opensource or free (I strongly doubt), will I be able to buy it? will it really provide me tools I need to focus on AI ?

That being said, what is the best environment to be able to focus on AI coding only, is it even possible?

sentences:
32 Bit colors difference Im going through a tutorial to create a basic directx framework, and i've noticed that in there (and other tutorials, when i checked out) use DXGI_FORMAT_R32G32B32A32_FLOAT inside the input element description. is there any reason to use this in a program over DXGI_FORMAT_R8G8B8A8_<something> in terms of noticeable graphical difference? im thinking quadrupling the memory involved to store color would be a little heavy for larger programs.

Also, i don't know if i have this right, but pure coloring isn't used much in more complex programs, and textures are used instead. so does this really matter?

sentences:
blender imported sphere with mesh collider not collided here is the scene

i imported a sphere (the blue sphere) from blender (with a hole at back), i added a mesh collider on it but it has no effect, and there is an error message
Cooking::cookConvexMesh: user-provided hull must have less than 256 vertices!.

any ideas?

(update the collider work fine after i retry and retry, but the error message still stay)

sentences:
Dealing with keyboard input In game design how should keyboard input be handled and why?
Do i
A: check the state of keys in the main loop each iteration?
B: Read key down and key up events from the event queue.

Im using allegro 5 and using the event queue model atm, but ive seen the other method in some samples..

sentences:
How do i writing timing function for lightning flash in C++? I need to write a horror scene with lightning flash. Unfortunately I am new to both C++ and OpenGL and I am looking for efficient way to mimic lightning timing in C++/OpenGL?

I don't need graphical implementation, just algorithmic implementation.

as such, the function should return a float representing lighting intensity and the delay of lightning flash should be random (5 seconds followed by 10 seconds then 3 seconds.. etc)

I hope I made everything clear!

sentences:
Unity mouse input not working in webplayer build I have a button script with the following code

void OnMouseDown()
{
    animation.Play("button-squish");
    enlarged = true;
    audio.PlayOneShot(buttonSound);
}

void OnMouseUpAsButton()
{
    if (enlarged)
    {
        SelectThisButton();
        enlarged = false;

        animation.Play("button-return");
    }
}

void OnMouseExit()
{
    if (enlarged)
    {
        enlarged = false;
        animation.Play("button-return");
    }
}

It works great in the editor, but when I made a build and tested it in Chrome none of the buttons had any response.  Further testing revealed that it did work in Firefox.  Rather than telling people to change their browser if they want to play, I want to make the button code work.  How else can I get the buttons to know when they're being pressed if the built-in stuff isn't working?

sentences:
Independent HTML5 Physics Game: Any Feedback? I've been independently developing a physics-based HTML5 game. I haven't used any libraries or engines; all the code, including the physics, is my own. It is free for a while on the Chrome Web Store and I was hoping that I could get some feedback on it. You can get it for Chrome here: https://chrome.google.com/webstore/detail/dbnmkpcomailjochphnmfklofkmgenci.
 I know this is not a normal question, but I'm happy for answers to be abstracted/generalized for broader use. Im asking here because I don't know anyone else personally who does this stuff. Any thoughts, comments or ideas you might have would be greatly appreciated!

The physics system is written in JavaScript and works by setting up the differential equations of motion (plus a few conditions) and evaluating them numerically using the Euler method. The graphics are done through the HTML5 canvas and the music is done through the audio element. (Said music is in the public domain by the way). You can see the code by going to VIew>View Source in Chrome.

sentences:
Is there any online programmer's community, focusing on core game development? I am looking for a stricktly/mostly programming oriented game community, focusing on core graphics, middleware, and research. Any suggestions?

Edit: I am specifically looking for people/community/group, having expertise in core game engine design/programming, directx/opengl reservoir.(And specifically targetting the programming part only).(The platforms can be anything from PC to xbox360/ps3/wii and even 3ds.)

sentences:
Static "LoD" hack opinions I've been playing with implementing dynamic level of detail for rendering a very large mesh in XNA.

It occurred to me that (duh) the whole point of this is to generate small triangles close to the camera, and larger ones far away. Given that, rather than constantly modifying or swapping index buffers based on a feature's rendered size or distance from the camera, it would be a lot easier (and potentially quite a bit faster), to render a single "fan" or flat wedge/frustum-shaped planar mesh that is tessellated into small triangles close to the near or small end of the frustum and larger ones at the far end, sort of like this (overhead view)

(Pardon the gap in the middle - I drew one side and mirrored it) The triangle sizes are chosen so that all are approximately the same size when projected.

Then, that mesh would be transformed to track the camera so that the Z axis (center vertical in this image) is always aligned with the view direction projected into the XZ plane. The vertex shader would then read terrain heights from a height texture and adjust the Y coordinate of the mesh to match a height field that defines the terrain.

This eliminates the need for culling (since the mesh is generated to match the viewport dimensions) and the need to modify the index and/or vertex buffers when drawing the terrain.

Obviously this doesn't address terrain with overhangs, etc, but that could be handled to a certain extent by including a second mesh that defines a sort of "ceiling" via a different texture.

The other LoD schemes I've seen aren't particularly difficult to implement and, in some cases, are a lot more flexible, but this seemed like a decent quick-and-dirty way to handle height map-based terrain without getting into geometry manipulation.

Has anyone tried this? Opinions?

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:
Tessellation Texture Coordinates Firstly some info - I'm using DirectX 11 , C++ and I'm a fairly good programmer but new to tessellation and not a master graphics programmer.

I'm currently implementing a tessellation system for a terrain model, but i have reached a snag. My current system produces a terrain model from a height map complete with multiple texture coordinates, normals, binormals and tangents for rendering. Now when i was using a simple vertex and pixel shader combination everything worked perfectly but since moving to include a hull and domain shader I'm slightly confused and getting strange results. My terrain is a high detail model but the textured results are very large patches of solid colour.

My current setup passes the model data into the vertex shader then through the hull into the domain and then finally into the pixel shader for use in rendering. My only thought is that in my hull shader i pass the information into the domain shader per patch and this is producing the large areas of solid colour because each patch has identical information. Lighting and normal data are also slightly off but not as visibly as texturing.

Below is a copy of my hull shader that does not work correctly because i think the way that i am passing the data through is incorrect. If anyone can help me out but suggesting an alternative way to get the required data into the pixel shader? or by showing me the correct way to handle the data in the hull shader id be very thankful!

cbuffer TessellationBuffer
{
    float tessellationAmount;
    float3 padding;
};

struct HullInputType
{
    float3 position : POSITION;
    float2 tex : TEXCOORD0;
    float3 normal : NORMAL;
    float3 tangent : TANGENT;
    float3 binormal : BINORMAL;
    float2 tex2 : TEXCOORD1;
};

struct ConstantOutputType
{
    float edges[3] : SV_TessFactor;
    float inside : SV_InsideTessFactor;
};

struct HullOutputType
{
    float3 position : POSITION;
    float2 tex : TEXCOORD0;
float3 normal : NORMAL;
float3 tangent : TANGENT;
float3 binormal : BINORMAL;
    float2 tex2 : TEXCOORD1;
    float4 depthPosition : TEXCOORD2;
};

ConstantOutputType ColorPatchConstantFunction(InputPatch<HullInputType, 3>        inputPatch, uint patchId : SV_PrimitiveID)
{
    ConstantOutputType output;

output.edges[0] = tessellationAmount;
output.edges[1] = tessellationAmount;
output.edges[2] = tessellationAmount;
output.inside = tessellationAmount;

return output;
}

[domain("tri")]
[partitioning("integer")]
[outputtopology("triangle_cw")]
[outputcontrolpoints(3)]
[patchconstantfunc("ColorPatchConstantFunction")]

HullOutputType ColorHullShader(InputPatch<HullInputType, 3> patch, uint pointId : SV_OutputControlPointID, uint patchId : SV_PrimitiveID)
{
   HullOutputType output;

output.position = patch[pointId].position;
output.tex = patch[pointId].tex;
output.tex2 = patch[pointId].tex2;
output.normal = patch[pointId].normal;
output.tangent = patch[pointId].tangent;
    output.binormal = patch[pointId].binormal;

    return output;
}

Edited to include the domain shader:-

[domain("tri")]

PixelInputType ColorDomainShader(ConstantOutputType input, float3 uvwCoord :    SV_DomainLocation, const OutputPatch<HullOutputType, 3> patch)
{
    float3 vertexPosition;
    PixelInputType output;

// Determine the position of the new vertex.
    vertexPosition = uvwCoord.x * patch[0].position + uvwCoord.y * patch[1].position + uvwCoord.z * patch[2].position;

    output.position = mul(float4(vertexPosition, 1.0f), worldMatrix);
    output.position = mul(output.position, viewMatrix);
    output.position = mul(output.position, projectionMatrix);

    output.depthPosition = output.position;

     output.tex = patch[0].tex;
     output.tex2 = patch[0].tex2;
     output.normal = patch[0].normal;
     output.tangent = patch[0].tangent;
     output.binormal = patch[0].binormal;

    return output;
}

sentences:
Orthographic Camera Zooming In XNA I am using a spritebatch to render a board. I have created a camera class which can provide me a view and projection matrix. Currently I am supplying the view matrix to my sprite batch when I call begin.

I can get the view matrix to correctly move everything around and do some zooming in and out. My problem is that I want to zoom in on a specific point (for now the center of the screen) but currently zooming just zooms in on the coordinate 0,0.

Here is how I am constructing the view matrix;

        _ViewMatrix =
            Matrix.CreateTranslation(
                new Vector3(
                    (-_Position.X + _Width * _Zoom / 2),
                    (-_Position.Y + _Height * _Zoom / 2),
                    0) ) *
            Matrix.CreateScale(new Vector3(_Zoom, _Zoom, 1));

How could this be altered to make it scale correctly relative to the given point. Later I will probably want to zoom to the mouse position, but if someone has a simple example I'm sure I can work out how to adapt it.

sentences:
Attach a method to every GameObject or use a manager script I'm new to Unity but not new to development so I'm wondering what the standard way of doing this in with Unity.

In the scene from the start is an empty GameObject that has a script that contains all of the items in the game. Once the game starts, chest prefabs are going to be spawned in the game and upon interaction they will reveal some random loot from the items script.

Is it better practice to have a script on all of the chests that accesses the items script or should I create another empty GameObject as a sort of a chest manager that accesses the item script and keeps track of all of the chests in the game and what all of their loot is.

sentences:
Matte reflection effect in Unity? I'm trying to achieve that kind of scene but in real time using Unity.

It's basically composed of some primitives, a skybox, and a plane. I'm intrigued on how to do this effect in particular:

The plane acts like a mirror, but tainted and matte (and it appears to be less blurry at the bottom of the buildings... but I'm not quite sure). I have found some shaders to create mirrors in Unity but nothing about the matte effect like in this picture. Could you guide me on how to achieve this kind of effect (knowing that I'm pretty lame when it comes to write shaders but I want to learn).

Thanks.

sentences:
How to make something rotate a certain amount over an exact amount of time I'm trying to make a plane rotate down a certain amount and 180 degrees horizontally over 2 seconds.

Basically I want it to take the plane 1 second to rotate to a horizontal-facing angle, then take the other second to rotate 180 degrees around to face the other direction.

The formula I'm currently using is:

    //If you're rotating, lower the speed and rotate the plane.
    if (rotate == 1 && rotationPhase > 0) {
        //If in phase 0, figure out which phase you need too go to.
        if (angle > 90 && rotationPhase == 1) {
            //Rotation phase 2 = rotating down
            rotationPhase = 2;
            rotationAngleTime = angle - 90;
        }
        else if (rotationPhase == 1) {
            //Rotation phase 3 = rotating up
            rotationPhase = 3;
            rotationAngleTime = 90 - angle;
        }

        //After phase 0, if in phase 1 begin rotating down, if in phase 2 begin rotating up.
        if (angle > 90 && rotationPhase == 2) {
            transform.Rotate(0, 0, -rotationAngleTime * (Time.deltaTime * (rotationSpeed / 2)));
            angle -= rotationAngleTime * (Time.deltaTime * (rotationSpeed / 2));
            if (angle > 89 && angle < 91) {
                angle = 90;
                rotationPhase = 4;
                rotationAngleTime = 180;
            }
        }
        else if (rotationPhase == 3) {
            transform.Rotate(0, 0, rotationAngleTime * (Time.deltaTime * (rotationSpeed / 2)));
            angle += rotationAngleTime * (Time.deltaTime * (rotationSpeed / 2));
            if (angle > 89 && angle < 91) {
                angle = 90;
                rotationPhase = 4;
                rotationAngleTime = 180;
            }
        }

        //After you have rotated to horizontal in phase 1/2, rotate around to face the other direction.
        if (rotationPhase == 4) {
            transform.Rotate(rotationAngleTime * (Time.deltaTime * (rotationSpeed / 2)), 0, 0);
            rotationAngle += rotationAngleTime * (Time.deltaTime * (rotationSpeed / 2));
            if (rotationAngle > 179) {
                rotationAngle = 0;
                rotationPhase = 0;
                rotationAngleTime = 0;
            }
        }
    }

I've tried many different things, but I can't figure out what to do.

EDIT:
This seems to be a problem with Time.deltaTime. I can get the plane to rotate correctly, but for some reason it's not rotating over the right amount of time. I have a timer being subtracted by Time.deltaTime, and this animation happening, and the animation always finishes about half a second before the timer runs out.

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:
Revert a GameObject to a previous version Is there a way to use an old version of a scene.unity file to revert changes for specific GameObjects only?

Occasionally Unity GameObjects can lose all their references in the Inspector (If a prefab instance, it keeps the prefabs defaults).  I have the missing references committed in my previous git commit, and have not changed any scripts on that GameObjects.

If I discard all my working changes to my scene.unity file I get my inspector references back OK.

But is there a script or process which allows you to revert specific gameobjects only to HEAD.
This would be useful when GameObjects lose their settings, and also when you want to revert only parts of your scene.

sentences:
Scale one object to be cover multiple other objects I have placed and aligned several objects next to each other. For the sake of understanding, lets just say I placed 10 cubes next to each other. I snapped them all together (Move->V->Click&Drag). The cubes look great so far. Now I want to make a plane in front of the cubes, that has exactly the width of the cubes altogether.

Now, I can place a new plane in front of the, no problem. I can snap a single edge to the cube on the most right, also no problem.

But now, how can I make the size exactly the same as all the cubes together? Sure, I could eyeball it from top view, an kind of make it about the same size, but chances are, it's a little bit too short or too long.

Isn't there a possibility to snap one edge, lock it, and snap another edge making the object scale automatically to the desired width?

sentences:
How can I debug a black screen when testing on a device? I have made an Android game with Unity. But, when I opened my game, I see a black screen and a closed game.

It works on a tablet but does not work on mobile phones. I tested it on 2 mobile phones.

On the first phone I installed it on, I see nothing but a black screen and closed game.

On the second one, it installed once and worked, but when I uninstalled it and tried to install it again, I get the black screen and closed game.

What can I do to help me find out what is going on?

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:
Toggle Fullscreen at Runtime Using the library GLFW, I can create a fullscreen window using this line of code.

glfwOpenWindow(Width, Height, 8, 8, 8, 8, 24, 0, GLFW_FULLSCREEN);

The line for creating a standard window looks like this.

glfwOpenWindow(Width, Height, 8, 8, 8, 8, 24, 0, GLFW_WINDOW);

What I want to do is letting the user switch between standard window and fullscreen by a keypress, let's say F11.

It there a common practice of toggling fullscreen mode? What do I have to consider?

sentences:
How can I create color fonts to be used in Unity? I've been searching, downloaded a couple programs that lets you convert images into fonts, but none let you obtain the color. They all switch them to black and white.

While searching the internet, I found a few colored fonts. Yet, almost all games have their own fonts that are colorful.

How do they do it? Did they just opt to program the font with coded position and sizes?

I'd just like to make my own true type or open type font (ttf or otf) from some images I created. And the images aren't even that colorful, just fill and stroke color.

sentences:
Counter-clockwise angle limit I'd like to limit rotation of an object, so I've written following snippet:

if (targetRotation < constraintMin) {
    targetRotation = constraintMin;
} else if (targetRotation > constraintMax) {
    targetRotation = constraintMax;
}

It works fine when moving in clockwise direction (big chunk starting right of blue lines), however nothing I've tried works work counterclockwise (smaller chunk between blue lines) because of Math.PI -> -Math.PI jump.

Here's working outer angle constraint between -3 and 3. However I'd like to make one between 3 and -3, but cannot think of how to do that.

const SPEED = 0.05;
let div = document.querySelector('div');
let targetRotation = Math.PI - 0.1;
let rotation = 0;

const CONSTRAINT_MIN = -3;
const CONSTRAINT_MAX = 3;

function rotate(dt) {
  let deltaRotation = (targetRotation - rotation) % (Math.PI * 2);

  let constraintDiffMin = ((CONSTRAINT_MIN - deltaRotation) + Math.PI * 4) % (Math.PI * 2);
  let constraintDiffMax = ((CONSTRAINT_MAX - deltaRotation) + Math.PI * 4) % (Math.PI * 2);

  //This works for outer angle
  if (deltaRotation < CONSTRAINT_MIN) {
    deltaRotation = CONSTRAINT_MIN;
  } else if (deltaRotation > CONSTRAINT_MAX) {
    deltaRotation = CONSTRAINT_MAX;
  }

  //But how to make it constraint inner angle between MAX and MIN?

  if (Math.abs(deltaRotation) > Math.PI) {
    deltaRotation -= 2 * Math.PI * (deltaRotation / Math.abs(deltaRotation));
  }

  rotation += deltaRotation * SPEED;
  div.style.transform = 'rotate(' + rotation + 'rad)';

  requestAnimationFrame(rotate);
}

document.addEventListener('mousemove', function(e) {
  targetRotation = Math.atan2(e.y - 100, e.x - 100);
}, false);

requestAnimationFrame(rotate);
div {
  width: 100px;
  height: 30px;
  background: linear-gradient(45deg, #BADA55, red);
  transform: rotate(0);
  margin: 85px 50px 0;
}
<div>
</div>

How can I resolve this?

sentences:
What exactly are sprites and entities and what are the differences between the two? Well I was looking at a few game based tutorials, as well as articles. I found out about two terms:
Entities and Sprites. Now they seem related but different, what is each and how are they the same and/or different?
I have some basic ideas already:

An entity is an item/thing/object/person any object that can be interacted with in the world.

A sprite is like an entity, but usually for NPCs/players/monsters.

Or a sprite can be the name of a picture assigned to a specific entity.

Do I have the right idea or are sprites and entities something completely different?

sentences:
2D Terra(ria)in generation - Accidental noise I'm currently trying to implement terrain generation as described on the following page:
http://accidentalnoise.sourceforge.net/minecraftworlds.html.

But I have issues understanding how to interpret the noise function values.

1) What does the gradient function in the ANL library exactly do? I see its purpose is to create the gradient, but I don't understand what the output/input for it exactly is. You input the line segments (0,0,0,1) but what does it return?

2) How should / can perlin noise values be interpreted? In my project I have ported the 2d noise function defined by stefan gustavson to python but I don't know what to do with the values itself? People keep posting images of "perlin" noise, but I assume that are the values mapped to a RGB code?

3) For the Fractional brownian motion, is this algorithm the result of combining several noise functions with each other? (I.e the output of a perlin noise function gets combined with another perlin noise function but with different parameters?

4) In essence, I'd love (if possible!) an explanation on how the image below gets generated from the fbm fractal. (In the hopes it makes the click that I'm missing*)

sentences:
Making the player walk on walls in box2d I'm making a game in stencil where players walk form left to right along randomly generated walls. I cant use waypoints, since the walls' shapes and positions are unpredictable.

Here's a descriptive sketch:

The red line is the player's path. The red circles are what I thought might make good waypoints until  I scrapped the idea.

sentences:
Revamping my GUI to be more efficient and less brute I am building a Java game from scratch right now. So far, it runs fine, but the issue is with my GUI and how it works. Basically, it's a tile-based game. Each time the person moves a different image is displayed (basically I check to see what terrain they are on, and in what direction they moved then update that tile's Imageicon). I feel like it is a lot of brute force graphic work and I was wondering if anyone here could help me find a simpler method or class to preform the action. I use ImageIcons to basically make the game's GUI function right now. I was thinking about finding a way to have "layers", so I could have the terrain in the background and my person could just walk over it. Unless someone has a better idea.

Another long-term goal is to make the walk movement an animation. Right now, the person just pops over 1 tile, I want to implement some basic walking animation for that movement of tile to tile. I feel like that would be easier to do if I had a way make the person be a separate object compared to the terrain/map.

Any suggestions on how to do this would be very helpful! :)

IMAGE REQUEST:
Here is an older and later dated image of one region. Basically, I have a tile (ImageIcon) for each possible instance of where the hero is, and which way he is facing. But as stated, I want to get rid of that because it requires soooo much. There has to be an easier way to overlap the person and allow animation to each tile.

sentences:
How do I approach this collision model? This is the game level prototype I have already implemented. It has few objects per room to allow me to finally add some collision detection/response code into it.

VIDEO

As you can probably see, every object inside has it's own AABB, even the room itself has AABB. Also my player is inside the Room's AABB.

My player will be exactly inside the room, so he would have to collide correctly with those AABBs, so that when he hits any of those objects inside he get's a proper collision response from those AABB's.

Now I would like to hear from you what kind of collision approach should I choose in here?

How do I approach this kind of stuff:

AABB to AABB collision detection then when this is positive go with AABB - Try to find proper plane normal and calculate response ?
AABB to AABB then when positive go with AABB - AABB Side check to find proper plane normal and calculate response?
Anything else?

How do you do this ?

Many thanks.

sentences:
Local to World coordinates in 2D and back I'm getting back into hobby game programming after a long 4-year hiatus from college and I find that my understanding of coordinate systems is somewhat lacking.

I'm trying my skills at creating a simple skeletal animation system but I'm having a hard time wrapping my head around converting local coordinates (of say, a joint) to world coordinates, particularly when it comes to rotated sprites.

I'm trying to create a test app in XNA and accomplish this using their built-in matrix class.  Can anyone assist me in either linking a resource or helping me understand the operations I'd need to do to convert any point that is Scaled/Rotated/Translated from a local to a world coordinate and back?

sentences:
Networking User Interface Buttons (build queue items) I am creating a RTS with Unity/C#, and have noticed a problem synchronising build queues.  Is there an ideal solution to handle button prediction?

I think I may have overengineered the solution... Presently when the client clicks a button, it sends a request to the server.  The server validates the request (cost if applicable) and then returns the order to create the build queue item.  Consequently, when the client clicks a button there's a noticeable lag.

Is server validation for button presses, like build queues, in a client-server model overkill?  What would be the ideal solution?

sentences:
Bullet Physics - Collision not working when moving btBvhTriangleMeshShape I have a robot (btTriangleMeshShape for each component) and a chain of boxes used as a cable, which is anchored on two components of the robot. I want to rotate a robot component and when this happens, I want to twist/ roll the cable on that component. The problem is - when i rotate a robot component, collision does not work anymore with that component.

I cannot use btHullShape because of the lack of accuracy, neither btGimpact because of the complexity of computations (which gives a really unsatisfying performance). I couldn't improve enough any of these two shapes, so that is why I use btTriangleMeshShape and rotate it by code.

Also, I have replaced the btTriangleMeshShape of the rotating component with a simple static box and rotate the box. Using the box shape, collision is working with that box.

So the problem of collision not working is only when trying to rotate a (static) btTriangleMeshShape.

Here is the code I use to rotate the static body, although I don't think it's necessary (it works for box shape, not for triangle mesh shape):

   btTransform tr = m_dynamicsWorld->getCollisionObjectArray()[7]->getWorldTransform();
   static float angle = 0.f;
   angle += 0.1f;
   tr.setRotation(btQuaternion(btVector3(1, 0, 0), -angle));
   m_dynamicsWorld->getCollisionObjectArray()[7]->setWorldTransform(tr);

   m_dynamicsWorld->updateAabbs();
   m_dynamicsWorld->computeOverlappingPairs();

I have to mention that I've searched the web before and couldn't find any solution and also I'm a newbie on Bullet Physics and any graphic libraries.

Any help would by really apreciated,

sentences:
How can I move the object back to his original position after the object reached the target? InteractableItem target;
    private void Update()
    {
        if (target != null && target.name == "kid_from_space_helmet")
            objToThrow.transform.position += (target.transform.position - objToThrow.transform.position).normalized * 2f * Time.deltaTime;

        if(Vector3.Distance(objToThrow.transform.position, target.transform.position) < 1f)
        {
            objToThrow.transform.position += (objToThrow.transform.position - target.transform.position).normalized * 2f * Time.deltaTime;
        }
    }

The object is moving to the target but never moving back.
This IF is not working good :
if(Vector3.Distance(objToThrow.transform.position, target.transform.position) < 1f)

My guess is that the problem is that when the object distance is less then 1 he try to move back but then he is not less then 1 anymore. but anyway it's not working.
I want to move the object to the target then wait 1 second at the target and then to move the object back.

sentences:
Coordinates from 3DS Max to XNA 3.5 My problem is this. I have a simple box made in 3DS Max 2009, the Box is 10x10x10. I've tried to load it on XNA and traslate the camera for 15 units, but I can seem to find the values needed to see the box properly. Can anyone point me to a good resource where I can find some good introduction to XNA coordinate system and how is a simple box made in 3DS Max imported properly

Best regards,
David

sentences:
Using 2d collision with 3d objects I'm planning to write a fairly basic scrolling shoot 'em up, however, I have run into a query with regards to checking for collision.  I plan to have a fixed top down view, where the player and enemies are all 3d objects on a fixed plane, and when the enemy or player fires at the other, their shots will also be along this fixed plane.

In order to handle the collision, I have read up a bit on collision detection in 3d, as it is not something I have looked into previously, but I'm not sure what would be ideal for this situation.  My options appear to be:

Sphere collision, however, this lacks the pixel precision I would like
Detection using all vertexes and planes of each object, but this seems overly convoluted for a fixed plane of play
Rendering the play screen in black and white (where white is an object, black is empty space), once for enemies and once for the player, and checking for collisions that way (if a pixel is white on both, there is a collision)

Which of these would be the best approach, or is there another option that I am missing?

I have done this previously using 2d sprites, however I can't use the same thinking here as I don't have the image to refer to.

Edit:
For clarity, I just wanted to add some additional information.

One of the things that I would like to account for is if the player or enemy is rotated in some way, which would mean intersecting along 1 Z plane would not be completely accurate.  For example, if there is banking on the player's ship when they move from side to side, the tips of their ship would be above and below the central plane, but I would still like these parts to be possible to hit.

Secondly, I plan to have different sizes and shapes for the player's craft, where the size and shape affects the hit box and is one of the properties the player can use to choose which ship they would like to use.

sentences:
Unity Editor Scene View does not match built executable I'm trying to make my game resolution independent. I'm using Unity's 4.6 UI, and I've got custom resolutions defined at 1280 x 720, 1600 x 900, and 1920 x 1080. In-editor, if I swap between any of these resolutions, the observed scene doesn't change. It looks like this:

I then build an executable (set to only allow 16x9 resolutions), and run this scene. On 1280 x 720 (as selected from the resolution dialog), I get this:

While on 1920 x 1080 (as selected from the resolution dialog), I get this:

Which matches the editor view. (Ignore the character sprites; those are in worldspace on a separate camera and aren't relevant to this question).

What is it about the executable that causes lower resolutions to be "zoomed in" like this, even if that lower resolution is the Reference Resolution for the Canvas Scaler?

sentences:
Java Scrolling 2d Block game - Optimise my code? I have a 2d game where you look down from above and can scroll up, down, left and right using a viewport and a much bigger map.

I have been having trouble drawing a rectangle around the block under the cursor but finally cracked it more through luck than anything else but ended up with this code. Can you help me optimise it and simplify it?

int blockwidth=gridsize-2;

//Draw coloured blocks
for (int x=0;x<sizex;x++){
   int thex=-(int)locationx+(x*gridsize);
        for (int y=0;y<sizey;y++){
        int they=-(int)locationy+(y*gridsize);
        //if (thex>-blockwidth && thex<800){
            g.setColor(new Color( tiles[x][y][1]));
            g.fillRect(thex,they,blockwidth,blockwidth);
        //}
    }
 }

Especially this piece

//Cursor co-ords updated
cursorx=(int)locationx+(int)GameInput.mousex;
cursorx=(int)cursorx/gridsize;
cursorx=-(int)locationx+(cursorx*gridsize);

//Draw on screen cursor
        g.setColor(Color.yellow);
        g.drawRect(cursorx,cursory,blockwidth,blockwidth);

sentences:
How do I load Player position as new gameobject? I want to make game-like time travel, the player has the ability to go to the future by limited time, for that, I want to add some game mechanic like save the player position.

Additional information: ignore the red text.
When pressing the button the player will create a new platform and immediately teleport to the original position. After the player teleported, the player will save the new platform as the new teleport position. after 2 seconds or pressing a button. the new platform will disappear and the player will return to the platform position.
I have this _playerController Script and I already implement the save position, but I don't know how to make it like what I explain.
    public Rigidbody2D theRB;
    public float speedMovement;
    public GameObject prefabGameObject;

    [Space(10)]
    private BoxCollider2D boxCollider2D;
    [SerializeField] private LayerMask GroundMask;
    public float jumpVelocity;

    [Space(10)]
    public float past;
    public float future;

    [Space(10)]
    public float hor;

    // Start is called before the first frame update
    void Start()
    {
        theRB = gameObject.GetComponent<Rigidbody2D>();
        boxCollider2D = transform.GetComponent<BoxCollider2D>();
    }

    // Update is called once per frame
    void Update()
    {
        PlayerPosSaveLoad();
        PlayerMovement();
        PlayerJump();
    }

    public void PlayerMovement()
    {
        hor = Input.GetAxis("Horizontal");
        if (hor > 0 || hor < 0)
        {
            theRB.velocity = new Vector2(hor * speedMovement * Time.deltaTime, theRB.velocity.y);
            if (hor > 0)
            {
                transform.localScale = new Vector2(1f, transform.localScale.y);
                //Animation
                Debug.Log("ToTheright");
            }
            else
            {
                transform.localScale = new Vector2(-1f, transform.localScale.y);
                //Animation
                Debug.Log("ToTheLeft");
            }
        }
    }

    public void PlayerJump()
    {
        //animation
        if (isGrounded() && Input.GetKeyDown(KeyCode.Space))
        {
            theRB.velocity = Vector2.up * jumpVelocity;
        }
    }

    public bool isGrounded()
    {
        float extraHeighText = .1f;
        RaycastHit2D raycast2d = Physics2D.BoxCast(boxCollider2D.bounds.center, boxCollider2D.bounds.size, 0f, Vector2.down, boxCollider2D.bounds.extents.y + extraHeighText, GroundMask);
        Color raycolor;

        if (raycast2d.collider != null)
        {
            raycolor = Color.green;
        }
        else
        {
            raycolor = Color.red;
        }
        Debug.DrawRay(boxCollider2D.bounds.center, Vector2.down * (boxCollider2D.bounds.extents.y + extraHeighText), raycolor);
        return raycast2d.collider != null;
    }

    [SerializeField]
    private Vector2 saveThisPosition;

    public void PlayerPosSaveLoad()
    {
        if (Input.GetKeyDown(KeyCode.E))
        {
            saveThisPosition = transform.position;
            SpawnGameObject();
        }
        if (Input.GetKeyDown(KeyCode.Q))
        {
            SwitchWithsavedPosition();
            Destroy(prefabGameObject);
        }
    }

    private void SwitchWithsavedPosition()
    {
        Vector2 temp = transform.position;
        transform.position = saveThisPosition;
        prefabGameObject.transform.position = temp;
    }

    public void SpawnGameObject()
    {
        Instantiate(prefabGameObject, transform.position, transform.rotation);
    }

And this is the Camera Script because connected with the player.

```lang-cs
    public Transform Player;

    // Start is called before the first frame update
    void Start() { }

    // Update is called once per frame
    void Update()
    {
        transform.position = new Vector3(Mathf.Clamp(Player.position.x, -7.3f, 7.3f), Mathf.Clamp(Player.position.y, 1f, 2f), transform.position.z);
    }

sentences:
Make a basic running sprite effect I'm building my very first game with XNA and i'm trying to get my sprite to run.
Everything is working fine for the first sprite.
E.g : if I go right(D) my sprite is looking right , if I go left(A) my sprite is looking left and if I don't touch anything my sprite is the default one.
Now what I want to do is if the sprite goes Right, i want to alternatively change sprites (left leg, right leg, left leg etc..) xCurrent is the current sprite drawn xRunRight is the first running Sprite and xRunRight1 is the one that have to exchange with xRunRight while running right.
This is what I have now :

    protected override void Update(GameTime gameTime)
    {
        float timer = 0f;
        float interval = 50f;
        bool frame1 = false ;
        bool frame2 = false;
        bool running = false;

        KeyboardState FaKeyboard = Keyboard.GetState();
        // Allows the game to exit
        if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            this.Exit();

            if ((FaKeyboard.IsKeyUp(Keys.A)) || (FaKeyboard.IsKeyUp(Keys.D)))
            {
                xCurrent = xDefault;
            }

            if (FaKeyboard.IsKeyDown(Keys.D))
            {

                timer += (float)gameTime.ElapsedGameTime.TotalMilliseconds;
                if (timer > interval)
                {
                    if (frame1)
                    {
                        xCurrent = xRunRight;
                        frame1 = false;
                    }
                    else
                    {
                        xCurrent = xRunRight1;
                        frame1 = true;

                    }
                }

                xPosition += xDeplacement;

            }

Any ideas...? I've been stuck on this for a while..
Thanks in advance and let me know if you need any other part from the code.

sentences: Libgdx body passing through block then fall on it I'm using libgdx and its physic engine Box2d. My question is : how could I make my box2d body go through a block , ignore the first collison than make the block active so the ball can fall onto it. A good example is doodle jump.

sentences:
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:
How to teleport a game object to an empty game object? I am trying to make a respawn  system where if the player touches a plane, (the name of the object is tutlvl1_flrdead) they get teleported to an empty object at player spawn named "RESPAWN". But, several tutorials and unity answers threads lead me to nowhere since they were written from back in 2013 or somewhere around there.
Code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class deathfloor : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        public gameObject myObject; //You can name it whatever you want.
        myObject.transform.position = new Vector3(3.076, 1.74, -3.651);
    }
}

How can I fix this to do what I need for my game?

sentences:
How do I create a game design that can adapt to new platform environments? I'm trying to design a game that can be considered versatile enough to be adapted to different platforms and control schemes without too much difficulty.  I asked this question to try to get a handle on what to expect as far as what technologies to try and plan for, but it was closed (justifiably, I agree) for basically asking others to predict what the future technologies were.

So my question now is, instead of trying to plan a game to suit specific technologies and control methods, what should I consider in my planning if i want to design a game that can easily adapt to new platform environments?

sentences:
How to Implement Trap Damage Unity Currently, I have a 2D platformer game, and I want to implement a function that can make the player die and go back to the start or a checkpoint when he interacts with a weapon or trap.
What I have in my scene is a sprite with a Rigidbody on it and a trap sprite with a BoxCollider2D on it which is set to trigger.
How can I make my player go back to the start when he hits the trap?

sentences:
Finding x and z value in the direction of another object In my game you can drive a car and it has an arrow point to an object you need to drive towards. The arrow pops up above the car using the same x and z value as the car but adding 2 to the y value. What I am trying to do is push the arrow out a little bit toward the object it is pointing to. This way it looks like it is rotating in a circle around the car instead of rotating about it's own center point.

This is what I am doing right now:

if (!(Vector3.Angle(car.transform.forward, obj.transform.position - car.transform.position) < 40f))
{
    arrow.SetActive(true);
    temp = car.transform.position;
    temp.y = car.transform.position.y + 2f;
    arrow.transform.position = temp;
    temp = obj.transform.position;
    temp.y = arrow.transform.position.y;
    arrow.transform.LookAt(temp);
}

sentences:
What organic traffic can I expect from publishing on Google Play, without other marketing? I've just published a new Android game on Google Play. It has been a bit over 48 hours.  It's active in the store, and I can search for it by name to get to it.  However, I've had 0 organic downloads thus far, only a couple from my friends. As far as I know, it has not been shown in the "new games" list yet, and the only store listing views in the stats are the ones from myself and friends.

Is there some time by which I can expect some "organic" exposure, or will I ever?  Is promoting my game by other channels the only option?

I'm not asking for advice on promoting my game. I'm only asking about what organic exposure I can expect on Google Play.

sentences:
How can I de-rig & delete the skeleton while keeping the mesh? There is this 3D model one can download here and  then import to 3DS Max with XNALara importer. (Side note: XNALara is also known as XnaPosingStudio)

Now this model already comes with a skeleton which is rigged. But if I want to rig the mesh to a different skeleton I need to delete the current skeleton correct?

When I have tried to delete the skeleton before the mesh got deleted with it.

So what I need to do is de-rig the skeleton from the mesh and then delete the skeleton, but how do I de-rig? Does anyone here know how? It's not a CAT rig.

sentences:
Development platform for 2D web and mobile games Is there a game development platform -- similar to Torque, or Unity -- which can be used to deploy 2D games on the following platforms:

Web
iOs
Android
Xbox Live Arcade (Preferred but not required)

And which has an integrated or mature physics engine? Perhaps, even a built in editor?

I've looked at the following possibilities but I've found something missing in each one. Of course in each case I may be guilty of misconception.

Corona SDK (No web deployment, no windows support)
Torque 2D (No web deployment)
Flash + Flash Punk or Flixel (No native android deployment, and I'm not sure if it is stable on mobile platforms)
Unity + SpriteManager2 (Not really optimised for 2D games, and I haven't seen enough advanced 2D examples -- like say platformers -- to really have any confidence in using it for something like this)

Has anyone had any luck with this?

sentences:
How to automatically generate (creative) names for stuff? How can I get large number (100-1000-10 000) of names, that are at most average hard to spell for things like places, weapons (and NPCs).

Have a look at TES4 Oblivion or TES% Skyrim.

http://www.uesp.net/wiki/Oblivion:Places

Yes, I understand, that they have paid army of designers for years.

My questions is how this people are creating those names?
Is there some hints for this, like should have at least/most this amount of letters or maybe let's create three sets of words - beginnings, middle and endings, and then take one random word from each?

Can it be automatized? Do they check, if created name means anything in any language?

This question is meant as extension for other questions like this, especially: Name generation

Above question was about NPC names, I am looking for something generic, especially for places and artifact names.

I am aware of Markov chains, but even after automatic generation, I would need a way to check, if this "sounds" good and if it means anything in nay language.

As much as second thing can be probably automatized, that first one not really.

Is there any full solution? Do we know, what kind of solution does Oblivion/Skyrim use? Most important part of this question is automatizing part.

sentences:
Limiting Framerate and Input So I have been learning HTML5 canvas recently and ran into a bit of a snag. I created a proof of concept that builds a block based 2d map that you can move a character inside of using arrow keys. This works well because everything is free moving (character moves 1 pixel per frame, so the movement is fluid and looks good).

I am trying to fork off of this code to create another concept that forces grid based movement (like in a typical roguelike). I have updated my movement code to move in chunks equal to tile size.. but the issue is that the refresh rate is so fast that it just seems like the character is moving at super speed.

Here is a snippet of my code that handles animations:

function gameLoop() {
        ctx.clearRect(player.x,player.y,PLAYER_SIZE,PLAYER_SIZE);
        getInput();
        ctx.fillStyle = '#000000';
        player.draw(ctx);
        window.requestAnimationFrame(gameLoop);
}

Is using requestAnimationFrame() for this sort of movement not a good idea? Is it better to just setInterval() for this sort of thing? I found a article via Google that talks about using variables for time, delta, fps, etc to limit the framerate... but Im not sure I understand how to do that in conjunction with requestAnimationFrame(). Should I somehow hold my gameLoop() from hitting requestAnimationFrame() until some time interval is hit? That seems like it would just be a waste because I would need to force a loop of some kind... doesnt seem too elegant

sentences:
Removing FMOD from a Unity WebGL project causes an error about not being able to copy fmod_register_static_plugins.cpp When I imported the FMOD plugin into a Unity WebGL project, then removed it afterwards, I wasn't able to build it due to errors about trying to copy an FMOD file: fmod_register_static_plugins.cpp
Restarting the editor, reimporting everything, deleting Library/Temp folders did not help. Neither did deleting the FMod folder.

sentences:
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:
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:
Avoiding lag when playing sound for first time using Cue.Play In my code I'm using SoundBank.GetCue("cuename") and Cue.Play() to play my sounds.

On the xbox whenever I first play a cue I get lag of about about one second.
How can I avoid this?

I'm thinking I probably have to do something like call GetCue (without playing it) for every Cue I'm going to use, however I don't have a central place where I list all cues I'll want to play, so is there an easy way to do that?

Update: It seems calling GetCue for all sounds i want to play doesn't work. I'm still getting stuttering in various places in my game when i call GetCue....Play.

sentences:
DirectX9 fullscreen, render immediately? Is it possible, somehow to avoid the single frame of black that appears before a DirectX9 window is displayed in fullscreen? My code looks like this.

INT WINAPI wWinMain( HINSTANCE hInst, HINSTANCE, LPWSTR, INT )
{
WNDCLASSEX wc = { sizeof( WNDCLASSEX ), CS_CLASSDC, MsgProc, 0L, 0L, GetModuleHandle( NULL ), NULL, NULL, NULL, NULL, L"D3D", NULL };
RegisterClassEx( &wc );
LPDIRECT3D9         pD3D = NULL;
LPDIRECT3DDEVICE9   pd3dDevice = NULL;
int                 windowWidth = 1280;
int                 windowHeight = 1024;
int                 adapter = 3;
bool                fullscreen = true;

if( NULL == ( pD3D = Direct3DCreate9( D3D_SDK_VERSION ) ) )
    return E_FAIL;

HWND hWnd = CreateWindow( L"D3D", L"D3D Test", WS_VISIBLE | WS_POPUP, 0, 0, windowWidth, windowHeight, NULL, NULL, wc.hInstance, NULL );

D3DDISPLAYMODE d3ddm;
pD3D->GetAdapterDisplayMode( adapter, &d3ddm );

D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory( &d3dpp, sizeof(d3dpp) );

d3dpp.Windowed               = !fullscreen;
d3dpp.SwapEffect             = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat       = d3ddm.Format;
d3dpp.EnableAutoDepthStencil = TRUE;
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
d3dpp.PresentationInterval   = D3DPRESENT_INTERVAL_ONE;
d3dpp.BackBufferCount        = 1;
d3dpp.BackBufferWidth        = windowWidth;
d3dpp.BackBufferHeight       = windowHeight;
d3dpp.hDeviceWindow          = hWnd;

if( FAILED( pD3D->CreateDevice( adapter, D3DDEVTYPE_HAL, hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &d3dpp, &pd3dDevice ) ) )
{
    return E_FAIL;
}

MSG msg;
ZeroMemory( &msg, sizeof( msg ) );
while( msg.message != WM_QUIT )
{
    pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB( 255, 255, 255 ), 1.0f, 0 );
    pd3dDevice->Present( NULL, NULL, NULL, NULL );

    if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) )
    {
        TranslateMessage( &msg );
        DispatchMessage( &msg );
    }
}

if( pd3dDevice != NULL )
    pd3dDevice->Release();

if( pd3dDevice != NULL )
    pd3dDevice->Release();

UnregisterClass( L"D3D", wc.hInstance );
return 0;

}

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:
Optimized linear to sRGB GLSL I'm currently using a simple implementation of  linear to sRGB transform:

float sRGB(float x) {
    if (x <= 0.00031308)
        return 12.92 * x;
    else
        return 1.055*pow(x,(1.0 / 2.4) ) - 0.055;
}
vec3 sRGB_v3(vec3 c) {
    return vec3(sRGB(c.x),sRGB(c.y),sRGB(c.z));
}

Possibly, that the correction for small values (x <= 0.00031308) will not matter in practice.

I considered to just let ´pow(x, 1.0 / 2.4) but I'm not sure how much impact it will have.

Is there any way to optimize it?
Can be vectorization help?
Can some polynomal fitting be better?

sentences:
How to blend the surface with HTML5 canvas? I can simply blend the surface in GameMaker using these codes:

//colour with which to blend the surface.
draw_surface_ext(index, x, y, xscale, yscale, rot, colour, alpha);

or set "the Fade to a Color" property, it will looks like this:

For now I want to do the same thing with HTML5 canvas, but I don't know where to start, is there any canvas API that could do that?

sentences:
Get internal and external IP addresses in Unity 2018.2.0? Unity 2018.2.0 makes the Network class obsolete.  I have used "Network.player.ipAddress" in my code to get the local LAN IP address.

    internalIP = Network.player.ipAddress;
    externalIP = new WebClient().DownloadString("http://icanhazip.com");

What code should replace this?  What would be best practice for getting internal and external IP addresses for manual LAN and internet direct connections between server and client?

Internal/external IP addresses are needed so players can load the game, then tell their friends what their IP is to direct connect.

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:
3D/perspective Top down shooter bullet issues I'm developing a top-down shooter with multiple levels (ground for ground units, middle level for buildings, top level for air unity).

The problem is the collision. Though I can make the collider box of a bullet be long enough to reach the ground (and collide with it), the real issue is optical.

When the bullet is fired from a aircraft and collides with some object on the ground (building, ground unit) it will be optically offset due to the perspective camera, because it looks like the shot "by-passed" the target as seen below

Is there any way to make the bullets collide perspectively correct? I'm using Unity3d Engine and it offers only simple colliders (box, sphere, cylinder, mesh and wheel), though I don't think a cone-formed collider would solve this issue.

I'd need a (cheap) way to check if it's overlapping a destructible object? I thought of casting a ray from the camera through the bullet and if it hits something destructible, trigger an action, but that's quite punctual and maybe to performance heavy on certain number of bullets

sentences:
What is a good book to start programming a 2D C++ game? I have a degree in Computer Science and while I was in college, I created a simple 2D game in Game Maker.  I would like to recreate this game in C++ as a start to learning how to create games in C++.  What would be a good book to start out on programming games in C++ for someone who has a bit of C++ experience (My CS Major classes were taught using Java and I had a class in C++ to learn syntax) and knowing the concepts behind objects, methods, inheritance, etc?

This would be a hobby of mine while I build up experience until I one day could work in the Vide Game Industry.

sentences:
Assigning relative force to a projectile fired while orbiting a sphere Projectile Not Correctly Inheriting Parent Velocity (Unity3D)

So I am trying to incorporate the above person's changes into a script I am making although

I'm no great coder and
I'm not even sure their solution works best for what I am doing.

Essentially what I have right now is a high speed shooter where the player is being pushed around as a physics object on a sphere world rather than using translate for movement. I keep finding solutions that would work really well if I was just translating through xyz space. Using a physics object for my projectile has been working well (I can shoot in one direction and have the projectile hit my in the back after circling around) but once I get up to speed I'm in trouble.

I think I've successfully incorporated the projectile portion into my script but currently it keeps shooting on the positive z axis.

On top of that, I'm not even sure where to start incorporating the second half.

Emitter Script

using UnityEngine;
using System.Collections;

public class SpaceShoot : MonoBehaviour
{
public GameObject Bullet_Emitter;
public GameObject Bullet;
public GameObject target; // Player

public float Bullet_Forward_Force = 100;
public float Bullet_Life = 60;
public float fireInterval = 0.05f;

void Update()
{
    if (Input.GetKeyDown(KeyCode.Space))
        InvokeRepeating("Fire", float.Epsilon, fireInterval);
    if (Input.GetKeyUp(KeyCode.Space))
        CancelInvoke("Fire");
}

void Fire()
{
    GameObject Temporary_Bullet_Handler;
    Temporary_Bullet_Handler = Instantiate(Bullet, Bullet_Emitter.transform.position, Bullet_Emitter.transform.rotation) as GameObject;

    Rigidbody Temporary_RigidBody;
    Temporary_RigidBody = Temporary_Bullet_Handler.GetComponent<Rigidbody>();

    Temporary_Bullet_Handler.transform.Rotate(Vector3.left * 90);

    Rigidbody target_rigidbody;
    target_rigidbody = target.GetComponent<Rigidbody>();

    Temporary_RigidBody.velocity = target_rigidbody.velocity;

    Temporary_RigidBody.AddForce(transform.forward * Bullet_Forward_Force);

    Destroy(Temporary_Bullet_Handler, Bullet_Life);
}
}

Edited script as it currently stands. It mostly does what I need although I'm trying to figure out a way to clamp the distance to the origin.

sentences:
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:
Migrating from OpenGL to XNA (MonoGame)? I just started working in MonoGame with 3D code.  I've used OpenGL before in the past, and I've also built engines with 2D Sprites/SpriteBatch's in MonoGame.

However, I'm getting extremely stumped with going from GL to XNA, likely due to the fact that I believe XNA is no longer a "state" machine like GL is.

I've looked thru the tutorials by RB Whitaker and Riemers -- but most of the stuff they have written covers models, etc.  I've already migrated some of my code to build procedural meshes into a VertexBuffer.  I'd like to test it now, but I'm getting very confused as to how to setup the World, View, Projection matrices, etc.

Are there any good tutorials that either show how to move from GL to XNA -- or optionally -- any good tutorials that assume you're not using Models, etc?  I'm looking to write something fairly low-level when it comes to primitives.

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:
How to correctly solve a procedurally generated puzzle? I'm creating a puzzle game where the player must remove all colored blocks from a grid. When the player selects a block, all adjacent blocks of the same color are removed. Any blocks that have empty cells below them will then fall into those cells. Here's a simple illustration of the mechanic:
https://imgur.com/TBNrAUW
The game will procedurally generate puzzles with varying degrees of difficulty. When the player completes a puzzle the game will then score the player based on how quickly and, more importantly, how efficiently they solved the puzzle.
The problem I am having is implementing a method of determining the most efficient way of solving a puzzle (i.e. identifying the fewest number of moves possible). Here's an example of a puzzle that was generated:
https://imgur.com/RQcAgkH
As a human, I could identify that the fewest number of moves that could be made to solve this puzzle was 11. Here is a gif of the solve:
https://imgflip.com/gif/463qck
However, when I whipped up an application that just clicked blocks at random in order to solve this puzzle, the lowest number of moves that it was able to solve this in was 14. And this was over billions of iterations which took many minutes. Obviously that is not acceptable. I need to find the correct solution and it should be done within seconds.
I also tried to reverse-engineer the generation process but that doesn't work. For example, it could place a blue block in column 1, a bunch of other blocks, a red block in column 1, a bunch of other blocks, then another blue block in column 1. Column 1 could be resolved in 2 moves (by clicking the red block and then one of the blue blocks), which reverse-engineering the generation would not detect.
So, my question:
What kind of techniques or tricks can I implement that will allow the application to resolve this type of generated puzzle quickly and correctly? I'm sadly out of ideas.

sentences:
Only one triangle drawn I am trying to render a quad with gl render mode GL_TRIANGLES with using element array buffer. Here is some code to explain process. Only the first 3 elements of indices array are drawn as expected. But following indices doesn't drawn at all.

Mesh Creation

glm::vec3 vertices[] = { glm::vec3(-1, 1, 0),
                          glm::vec3(-1, -1, 0),
                          glm::vec3(1, -1, 0),
                          glm::vec3(1, 1, 0)
                        };

glm::vec2 textures[] = { glm::vec2(1, 0),
                          glm::vec2(0, 0),
                          glm::vec2(0, 1),
                          glm::vec2(1, 1)
                        };

unsigned int indices[] = { 0, 1, 3, 3, 1, 2};
Mesh* mesh = new Mesh(vertices, sizeof(vertices) / sizeof(glm::vec3), textures, sizeof(textures) / sizeof(glm::vec2), indices, sizeof(indices) / sizeof(unsigned int), texture);

Mesh Class

Mesh::Mesh(...){
    InitMesh(...);
}

void Mesh::InitMesh(vec3* vertices, unsigned int numVertices, vec2* textureCoords, unsigned int numTextureCoords, unsigned int* indices, unsigned int numIndices) {
     this->numIndices = numIndices;

    // Generate VAO and bind
    glGenVertexArrays(1, &vaoID);
    glBindVertexArray(vaoID);
    // Generate VBOs
    glGenBuffers(3, vboIDs);
    // Bind Position Buffer, Buffer Position Data
    glBindBuffer(GL_ARRAY_BUFFER, vboIDs[0]);
    glBufferData(GL_ARRAY_BUFFER, numVertices * sizeof(vec3), vertices, GL_STATIC_DRAW);
    glEnableVertexAttribArray(0);
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
    // Buffer TextureCoord Data
    glBindBuffer(GL_ARRAY_BUFFER, vboIDs[1]);
    glBufferData(GL_ARRAY_BUFFER, numTextureCoords * sizeof(vec2), textureCoords, GL_STATIC_DRAW);
    glEnableVertexAttribArray(1);
    glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, 0);
    // Buffer Indices Data
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vboIDs[2]);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, numIndices * sizeof(unsigned int), indices, GL_STATIC_DRAW);
    // Unbind VAO
    glBindVertexArray(0);
}

void Mesh::Draw() {
    glBindVertexArray(vaoID);
    glEnableVertexAttribArray(0);
    glEnableVertexAttribArray(1);
    glDrawElements(GL_TRIANGLES, numIndices, GL_UNSIGNED_INT, 0);
    glDisableVertexAttribArray(1);
    glDisableVertexAttribArray(0);
    glBindVertexArray(0);
}

sentences:
What GameEngine to choose I concider myself an amateur, but I have quite some experince in Unity3D.

Over the course of the next three years - before I can quit my job and go to colledge - I want to make ONE game.

Now the question that bothers me is which gameengine to choose:

A) Unity3D, because I know it well and the community is great (even though I didn't touch it for a year or so)

B) GoDotEngine, because it's open source, still beeing improved and very lightweight

C) Blender, because Python (though..who really uses blender for games? and I kinda hate blender)

Initially I wanted to go with GoDot, since it is  a lot like Unity and OpenSource, but I fear that the community is to small to help me out, if I get stuck and I really need to finish this, if I want to spend three years on it.

sentences:
How to achieve programming experience with PS3 or Xbox360? Possible Duplicate:
  How to get PS3/Xbox 360 experience without having access to Dev kits?

Is there a way to achieve programming experience with PS3 or Xbox360 systems without the development kit that only are selling to great videogame companies ?

There are a lot of game companies that request experience with these systems and I don't know how to achieve this.

sentences:
Pygame's rotation methods have crippling issues, but is it me or Python's pygame? http://www.youtube.com/watch?v=lNJFxvR6ex8&feature=youtu.be

On rotate and rotozoom, can't find fixes on these on the internet, anywhere.
Basically, the video is showing 4 things in this order:
1. A ring image being rotated with .rotate.
2. A simple image being rotated with .rotate.
3. The ring rotated with .rotozoom.
4. The simple circle rotated with .rotozoom.

The difference: In 1 and 2, the images do not have that slight quiver/movement, but are reduced in quality. It might be difficult to tell with the video quality, but the ring image is slightly pixelated/blurred.
                In 3 and 4, the images are of equal/better than 1&2 quality when rotated with rotozoom, but they have this VERY SLIGHT but noticeable wobble about them. This is VERY noticable with test 3, where I put my mouse next to the circle outline, and you can see it move.

ANY and all help will be greatly appreciated, AND this will help many people for a long time, i'm sure.

Here are images of the differences in picture quality of rotate vs rotozoom:

http://s189.beta.photobucket.com/user/ECSit/library/PyGame%20and%20Python

sentences:
Multiplayer FPS server side performance This is related to MMO Performance except that question is about bandwidth. This is about cpu load.

I put together a simple FPS using node.js and webGL. It's extremely simple, a lot like the BuddyMaze clone of MIDI Maze. There's very little going on, everyone moves in two dimensions (no height), shoots simple projectiles, and runs into walls.

Right now, if I make multiple connections to the server where every player shoots rapidly while spinning in circles, I can get about 15 - 20 players in the game before the server maxes out a core and slows way down. And this is when running at 30 fps on the server. At 10 fps, I get about 25 - 30 connections. This is pretty bad, since the game is going to have a lot more to do soon and I'll need to fit more players for this to be a feasible endeavor.

My brother just pointed out some stats about his coworker's TF2 server. His server is lower specs than ours, yet it runs TF2, obviously a much more complex game, at a whopping 500 ticks per second, with 36 users per core. Also, we currently consume much more bandwidth than they do, but we haven't been trying to lower that much yet.

How is this possible? What sort of tricks are there to increase server performance to this magnitude? Some things that I know of include:

Lowering framerate on the server, and interpolate positions on the client. I got some benefit, but clearly the TF2 server doesn't even bother with this.
Doing expensive things like collision detection on the client, and verify it infrequently on the server. I haven't moved this over just yet, I will tonight. Even so I don't expect such an enormous gain.
Break the playing field into regions (quad trees) to minimize calculations. Haven't had an opportunity for this yet.
I've considered the unfortunate possibility that node.js is just way slower than whatever TF2 is using, and may not be suited for this kind of high intensity task.
Is it all in the server configuration magic?

So what are the other tricks of the industry to do only the minimum required on the server but still have a flawless game experience? There's a big conflict between "defer to client to save cpu time" and "don't trust the client", so maybe it helps to know where the line is drawn in various situations?

Update

Profiling really is the only mantra I've ever found that's absolutely infallible. I quickly wrapped some timing functions around my code (thanks, FP!) and discovered what I never expected: the act of broadcasting the data to clients accounts for nearly all of the execution time. Specifically, around 90% of it. Further testing showed that this time is dependent on both the number of clients and the size of the data, but more so the latter. On a 20 user load, I cut my broadcast time 90%, from 24ms down to just over 2ms by sending only "{}" instead of the full data. But with only 5 users, broadcasting takes around 0.5 ms. So I clearly need to do some optimization here.

The first most obvious improvement is line of sight checking. This would decrease both the number of people who care about data, and also the amount of data sent to interested parties. Are there other tricks in this realm I can try, which focus on minimizing the cost of my broadcast operation?

sentences: Using Steering Wheel in Unity Is there any way to use a steering wheel in Unity? All I find online is people with the same problem. The numbering on the axis are not the same as with keyboard input. In some cases left is 1 and as you turn it more to the left it gradually goes down to 0 even though you are still turning left

sentences:
How to draw a Sprite with Touch Points in LibGDX I want to draw some path with user's touch. if users moves finger from one position to another position a path will be drawn exactly as user moved finger.

We can draw a line with by defining color but i want to draw that line with sprite. i want to use image for that. is it possible with LibGDX? if yes , how we do that? and how will i generate image to use as sprite for that?

sentences:
How can I implement a side scrolling seamless fog shader? I've run into a problem trying to code a 2d game. The way I've set up the game is that you run through underground dungeons and fight enemies, for ambiance I've added a smoke/fog shader to superimpose over the dungeon backdrop. However, the noise/fog isn't seamless. As in, the fog is always the same even when moving through the map, it doesn't move with the player/camera.

How do I make it so the fog is generated whenever the camera moves sideways/upwards while still being seamless, as in fitting in with the fog from before moving the camera?

For example, when I move right, the fog background should move left, instead of being the same backdrop anywhere I am on the map.

The shader I've set up is based on this one from Morgan McGuire/patriciogv:

// Author @patriciogv - 2015
// http://patriciogonzalezvivo.com

#ifdef GL_ES
precision mediump float;
#endif

uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;

float random (in vec2 _st) {
    return fract(sin(dot(_st.xy,
                         vec2(12.9898,78.233)))*
        43758.5453123);
}

// Based on Morgan McGuire @morgan3d
// https://www.shadertoy.com/view/4dS3Wd
float noise (in vec2 _st) {
    vec2 i = floor(_st);
    vec2 f = fract(_st);

    // Four corners in 2D of a tile
    float a = random(i);
    float b = random(i + vec2(1.0, 0.0));
    float c = random(i + vec2(0.0, 1.0));
    float d = random(i + vec2(1.0, 1.0));

    vec2 u = f * f * (3.0 - 2.0 * f);

    return mix(a, b, u.x) +
            (c - a)* u.y * (1.0 - u.x) +
            (d - b) * u.x * u.y;
}

#define NUM_OCTAVES 5

float fbm ( in vec2 _st) {
    float v = 0.0;
    float a = 0.5;
    vec2 shift = vec2(100.0);
    // Rotate to reduce axial bias
    mat2 rot = mat2(cos(0.5), sin(0.5),
                    -sin(0.5), cos(0.50));
    for (int i = 0; i < NUM_OCTAVES; ++i) {
        v += a * noise(_st);
        _st = rot * _st * 2.0 + shift;
        a *= 0.5;
    }
    return v;
}

void main() {
    vec2 st = gl_FragCoord.xy/u_resolution.xy*3.;
    // st += st * abs(sin(u_time*0.1)*3.0);
    vec3 color = vec3(0.0);

    vec2 q = vec2(0.);
    q.x = fbm( st + 0.00*u_time);
    q.y = fbm( st + vec2(1.0));

    vec2 r = vec2(0.);
    r.x = fbm( st + 1.0*q + vec2(1.7,9.2)+ 0.15*u_time );
    r.y = fbm( st + 1.0*q + vec2(8.3,2.8)+ 0.126*u_time);

    float f = fbm(st+r);

    color = mix(vec3(0.101961,0.619608,0.666667),
                vec3(0.666667,0.666667,0.498039),
                clamp((f*f)*4.0,0.0,1.0));

    color = mix(color,
                vec3(0,0,0.164706),
                clamp(length(q),0.0,1.0));

    color = mix(color,
                vec3(0.666667,1,1),
                clamp(length(r.x),0.0,1.0));

    gl_FragColor = vec4((f*f*f+.6*f*f+.5*f)*color,1.);
}

sentences:
OBB vs rectangle/quad/plane with bounds collision detection/response I am able to resolve collision between an OBB and a plane but can't get it to work when I introduce some bounds on the plane size. I want to have the plane of width and height dimensions defined by a normal and a position.
The code for detecting/resolving is fairly simple if the plane doesn't have any bounds:
function obbIntersectsPlane( obb, plane ) {
  let r = obb.size.x / 2 * Math.abs( dot( obb.right, plane.normal ) ) +
          obb.size.y / 2 * Math.abs( dot( obb.up, plane.normal ) ) +
          obb.size.z / 2 * Math.abs( dot( obb.forward, plane.normal ) );

  let s = dot( plane.normal, obb.position ) - dot( plane.normal, plane.position );

  if ( Math.abs( s ) < r ) {
    return {
      overlap: r - s,
      vector: plane.normal
    };
  }

  return false;
}

sentences:
Shuffle tiles position in the beginning of the game XNA Csharp I'm trying to create a puzzle game where you move tiles to certain positions to make a whole image. I need  help with randomizing the tiles start position so that they don't create the whole image at the beginning. There is also something wrong with my offset, that's why it's set to (0,0). I know my code is not good, but I'm just starting to learn.

My start-up tile positioning code

        spriteBatch = new SpriteBatch(GraphicsDevice);
        PictureTexture = Content.Load<Texture2D>(@"Images/bildgraff");
        FrameTexture = Content.Load<Texture2D>(@"Images/framer");

        //Laddar in varje liten bild av den stora bilden i en array

        for (int x = 0; x < 4; x++)
        {
            for (int y = 0; y < 4; y++)
            {

                Vector2 position = new Vector2(x * pictureWidth, y * pictureHeight);

                position = position + Offset;

                Rectangle square = new Rectangle(x  * pictureWidth, y * pictureHeight, pictureWidth, pictureHeight);

                Square frame = new Square(position, PictureTexture, square, Offset, index);
                squareArray[x, y] = frame;

                index++;
            }
        }

For reference, here is the square class:

class Square
{

    public Vector2 position;
    public Texture2D grafTexture;
    public Rectangle square;
    public Vector2 offset;
    public int index;

    public Square(Vector2 position, Texture2D grafTexture, Rectangle square, Vector2 offset, int index)
    {
        this.position = position;
        this.grafTexture = grafTexture;
        this.square = square;
        this.offset = offset;
        this.index = index;
    }

    public void Draw(SpriteBatch spritebatch)
    {
        spritebatch.Draw(grafTexture, position, square, Color.White);
    }

    public void RandomPosition() {  }

    public void Swap(Vector2 Goal )
    {
        if (Goal.X > position.X)
        {
             position.X = position.X + 144;
        }
        else if (Goal.X < position.X)
        {
            position.X = position.X - 144;
        }
        else if (Goal.Y < position.Y)
        {
            position.Y = position.Y - 95;
        }
        else  if (Goal.Y > position.Y)
        {
            position.Y = position.Y + 95;
        }
    }
}

sentences:
Vector2's static methods and the garbage collector I discovered that Vector2's static methods return a different Vector2 from the parameters you give them and I'm under the impression that creating new objects and dereferencing old ones on this kind of scale (100's of method calls per update) is bad for the GC.

Is this the case with C# or does XNA pool these Vector2's for use on later method calls?

I ask because I want my entities collision shapes to share the same position Vector2 as the entity itself to eliminate the need to call updateBounds() after practically every position change. However since the methods return a different Vector2 the entities position and its respective bounds' position become differing objects.

Also is it worth making my own Vector2 class and have its methods non static so I can use someVector.add(otherVector) instead of XNA's way?

sentences: Getting Model & Movement from Blender to OGRE3D I just delved myself into game development. I have created a simple character in Blender, together with its walking animation. I am planning to import the model and the movement so that I could use it in OGRE3D. How can I achieve this? Will the import thing have to separate model and movement? Is there any good and comprehensive guide for this?

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:
Figuring out which direction my object is facing on a 2D plane? My friend and I were messing around in XNA 4.0 making a 2D racing game. Kind of like this one: Ivan “Ironman” Stewart’s Super Off Road. The problem we are having is knowing which direction the car is facing to move it appropriately. We could track the direction by a enum value North, South, East, West but we don't want to do that for a number of reasons.

We were wondering if there was a way to accomplish this via math. Maybe by having an anchor point designated at the hood of the car and having the car always move towards that spot and then move that anchor point. We aren't sure. Or maybe there is a way using a 2D Vector.

I figured since we hit a hard spot, we should ask the coding community for help!

Just to be clear. I'm not looking for code; I just want to discuss some concepts of 2D movement in all directions without having to track a direction enum. I know that can't be the only way to do it.

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:
glm::perspective() with wide field of view I'm still pretty new to this GL stuff, but I've managed to put together some C and C++ code that allows me to construct simple 3D objects consisting of line segments and display them on my laptop using GLFW and the glm library. I've hooked in enough keyboard callbacks to allow me to navigate the position and orientation of an observer via glm::lookAt(). A couple of the keys allow me to grow or shrink the field of view value that gets passed to glm::perspective(), like so:
float field_of_view; // degrees, not radians

        glm::mat4 proj = glm::perspective(
            glm::radians(field_of_view),    // field of view
            1920.0f / 1080.0f,      // aspect ratio
            0.0f, 100.0f            // near and far clipping planes
        );

From my experience as an amateur photographer, I know that if one takes a photo with a camera with a wide angle lens of a scene that contains straight line near the periphery of the field of view, the physically straight lines will appear bent in the photo. They bow outward so as to create a more circular shape around the center of view.
But when I modify the field of view that gets passed to glm::perspective() such that it is a high value (approaching 180 degrees), with an orientation such that the straight line segments appear near the edges of the field, the rendered line segments never bend like I'd see with a real camera and wide angle lens. Instead, the lines remain straight but appear to get very long.
This creates very unnatural looking images.
Is there some other glm function that I should call instead in order to make the rendered lines curved like I'd expect to see in real life?
Thanks

sentences:
Should have one device per application or per form when doing MDI Forms work with XNA? I am just making a simple editor for a project I am working on and as part of this I need to add a few different MDI forms within a larger container form.

Now the XNA (4.0) example Windows Forms projects use a shared graphics device for all controls, however I was assuming I would have a graphics device per control (assuming we have an XNA-specific panel/control element).

So is there any reasons that you should share the same graphics device? As I can imagine there being problems if you are changing render states in one panel but do not want it to effect the other panels...

It would make sense to share it if the GraphicsDevice object is literally a representation of the underlying graphics card, but thats what the GraphicsAdapter is, so I wasn't sure if there would be any problems with isolating a graphics device per control.

sentences: How do I get the current location when using slick 2D library? I'm developing a map kind of simple game using slick 2D library, and I want to get the current location of the user.  When the user runs into a special location (ex: hole) to indicate that is dangerous. How can I achieve this?  I'm a new comer to games.

sentences:
Simple Water surface simulation problems (GDC2008 Matthias Muller- Hello World) Im attempting to implement a simple height field water surface simulation outlined in Matthias Muller's GDC 2008 talk. "http://www.matthiasmueller.info/talks/gdc2008.pdf"

I can't seem to see why it my implementation doesnt work. Could anyone help? Any advice or help would be much appreciated.
The main processing loop is below
The obstruction array is initialized as 1. And the source just adds 0.1f to a point.

void wave()
    {
        for( int i = 0; i<size ; i++)
        {
            height[i] += source[i];
            height[i] *= obstruction[i];
        }

        for (int i = 1 ; i<iwidth-1 ; i++)
        {
            for(int j = 1 ; j < iheight-1 ; j++)
            {

                velocityField[indexFind(i,j)] += (height[indexFind(i-1,j)] +
                                                  height[indexFind(i+1,j)] +
                                                  height[indexFind(i,j-1)] +
                                                  height[indexFind(i,j+1)])/4 - height[indexFind(i,j)];

                velocityField[indexFind(i,j)] *= dampening;

                height[indexFind(i,j)] += velocityField[indexFind(i,j)];

            }

        }
    }

    int indexFind(int x, int y)
    {
        return (x + iwidth*y);
    }

This is what happens (height field rendered as a texture on a plane)

This is the page from the link that outlines the algorithm

sentences: How do I link a GameObject activated state to a UI button being held? How do I go about this functionality: When a user taps and still holds onto a UI button, a GameObject will be set active, when they release the UI button, the GameObject will be deactivated.

sentences:
C# XNA Make rendered screen a texture2d I am working on a cool little city generator which makes cities in the isometric perspective. However, a problem arose where if the grid size was over a certain limit it would have awful lag. I found the main problem to be in the draw method. So I took the precautionary step of rendering only items that were onscreen. This fixed the lag but, not by much.

The idea I have is to render the frame once and take a snapshot. Then, display that as a texture2d on screen. This way I don't have to render 1,000,000 objects every frame since they don't change anyways.

TL;DR - I want to

Take a snapshot of an already rendered frame
Turn it into a Texture2D
Render that to the screen instead of all the objects.

Any help appreciated.

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:
Creating graphics at different angles for sprites I am developing a Java game that uses sprites for the graphics. It's just a top down shooter and our ship sprites look like the following:

These work fine, but they're hard to create and the artist who created them is no longer working on the game. I could easily create a top down view of a ship in Photoshop myself, but I'm not sure how to get all the angles.

What do you think would be the best program or approach would be for me to create more?

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:
Getting wrong value for middle of screen My mouse is able to move the camera and rotate it around my model. If the mouse is in the middle of the screen, the camera should not move.

The red circle is where my mouse has to be at in order for the camera to stay still. If I put the cursor in the middle of the screen, it rotates the camera which shouldn't happen.

    Point screenCenter;
    float scrollRate = 1.0f;
    MouseState previousMouse;
    bool moveMode = false;

    #region MOUSE
        screenCenter.X = this.Window.ClientBounds.Width / 2;
        screenCenter.Y = this.Window.ClientBounds.Height / 2;

        this.IsMouseVisible = true;

        previousMouse = Mouse.GetState();
        Mouse.SetPosition(screenCenter.X, screenCenter.Y);
        #endregion MOUSE

    if (this.IsActive)
        {
            MouseState mouse = Mouse.GetState();

            if (moveMode)
            {
                Vector3 temp = player.playerWorld.Translation;
                player.playerWorld.Translation = Vector3.Zero;
                player.playerWorld *= Matrix.CreateRotationY(MathHelper.ToRadians(mouse.X - screenCenter.X) / 75);
                player.playerWorld.Translation = temp;

                cam.up -= MathHelper.ToRadians(mouse.Y - screenCenter.Y) / 25;
            }

            if (mouse.RightButton == ButtonState.Pressed)
            {
                if (graphics.GraphicsDevice.Viewport.Bounds.Contains(new Point(mouse.X, mouse.Y)))
                {
                    moveMode = true;
                }
            }
            else
            {
                if (moveMode)
                {
                    moveMode = false;
                }
            }

            if (mouse.ScrollWheelValue - previousMouse.ScrollWheelValue != 0)
            {
                float wheelChange = mouse.ScrollWheelValue - previousMouse.ScrollWheelValue;

                cam.up += 0.7f;
                cam.backward += 0.7f;
            }
            previousMouse = mouse;
        }

Why could this be happening? the screen is 650X1000. ScreenCenter x and y are the correct values.

Now that I play with it more, it seems each time the game starts, the mouse is set to a different position. The mouse should automatically be set to the middle of the screen each time the game starts, but it ends up anywhere but the middle.

Any idea of what could be happening here?

sentences:
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: 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:
c++/openGL 3D Bouncing Cube I'm trying to write a little program with a bouncing cube but I can't find the right values for it.
I have these lines:
modelMatrix = glm::mat4(1)

modelMatrix *= Translate(x, y, z)

modelMatrix *= RotateOZ(angle)

RenderMesh(mesh["cube"], shaders["V"], modelMatrix)

I add/sub the y in a interval and the angle too.I have a problem because I don't really know with which values to increment/sub these values.

I want the same effect as in the image but at all angles [0 - 180].
EDIT++
So I want my cube to bounce while it's rotating like in the image. First the cube will have the arrow down to show what's his position first at y0 and x0. Then he will rotate in the [0 - 90] range. I want the cube to have the arrow up meaning that the cube will be rotated at 90 angle when he will hit y1 and x1/2. Then he will start to descend at an angle [90 - 180] so he will be at y0 but with at x1.
I tried incrementing the x, y and the angle with a small value like 0.1 and then decreasing the y when it hit a point. The result is close but I can see that it's not perfect.
I hope that made sense.
Thank you for your time!

sentences:
System.Runtime.Serialization.SerializationException while trying to deserialize List I'm trying to serialize / deserialize a class that holds inventory items.

The code is attached below.

First I call AddOne() void a few times, then I call SaveFile(), then I call LoadFile().

In LoadFile() the following error occurs :

  ex = "System.Runtime.Serialization.SerializationException: End of Stream encountered before parsing was completed.\r\n  at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run () [0x00288] in <1f0c1ef1ad524c38bbc5536809c46b48>:0 \r\n  at System.Runt...

Does anybody see my mistake?

Thank you for the help!

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using UnityEngine;

public enum Type
{
    undefined = 0,
    Pistol = 1,
    Magnum = 2,
    Grenade = 3,
    BlendGrenade = 4,
    FireGrenade = 5,
    PistolAmmo = 6,
    MagnumAmmo = 7,
    Rifle,
    RifleAmmo,
}

[System.Serializable]
public class Inventory : MonoBehaviour
{
    public class InventoryItem
    {
        public int Amount = 0;
        public int Row = 0;
        public int Col = 0;
        public int Rotation = 0;
        public Type ItemType = Type.undefined;
    }
    public List<InventoryItem> Items;

    public void Start()
    {
        Items = new List<InventoryItem>();
    }
    public void AddOne()
    {
        InventoryItem n = new InventoryItem();
        this.Items.Add(n);
    }
    public void SaveFile()
    {
        string destination = Application.persistentDataPath + "/save3.dat";

        if (File.Exists(destination))
        {
            File.Delete(destination);
        }
        using (Stream stream = File.Open(destination, FileMode.Create))
        {
            BinaryFormatter bin = new BinaryFormatter();
            bin.Serialize(stream, this.Items);
        }
    }

    public void LoadFile()
    {
        string destination = Application.persistentDataPath + "/save3.dat";

        using (Stream stream = File.Open(destination, FileMode.Open))
        {
            BinaryFormatter bin = new BinaryFormatter();

            try
            {
                this.Items = (List<InventoryItem>)bin.Deserialize(stream);
            }
            catch (Exception ex)
            {
                Debug.Log(ex.ToString());
            }
        }
    }
}

sentences:
Detecting wins in peer to peer RTS games like Starcraft A typical RTS game is implemented with the standard networking model: peer to peer lockstep.

Consider Starcraft 2, given that Battle.net presumably doesn't know anything about the state of game given that there is only communication between the two players in a peer to peer model, how does Battle.net know who was the winner in the end. Relying on the two peers to not try to cheat and report accurate results is naive.

sentences:
How do I apply pixel shader to specific sprite in XNA 4.0 in a spritesort FrontToBack? I have a set of sprite drawn in FrontToBack sortmode. In XNA 4.0, the effect must be as an input argument of Begin() function of SpriteBatch. However, If I reinvoke the function, then the sprite sorting is lost. Therefore, I have to find a way to implement the pixel shader within the Begin() and End() for specific texture drawn. I tried to use effect.CurrentTechnique.Passes[0].Apply(), but no pixel was shaded when I invoke this. On the other hand, if I put effect as an argument, then all of the sprites would be effected. Therefore, is there any convenient way to approach this?

By the way, what I am trying to do is to provide an overlay on an isometric tile using some kind of masking. Therefore, I want to draw such masking and programmatically change it to optional color.

Something like this (from final fantasy tactics):

I am not sure if pixel shader is the right way to approach it, but then I have to tackle the fact that I want to be able to specify optional color dynamically. Other than that, I really want it to animate, which I might approach this by creating several grayscale animated masking and saturate it using pixel shader.

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:
What's the best way to make a game launcher? I am a new game dev, and would like to make a launcher for my games. All my games would be in ONE launcher, and it'd be similar to the Minecraft Launcher. I wanna do it for free too.
The main reason I wanna do it is to update my games. I don't have a file server, so the files would be on Google Drive.
Thanks!

sentences:
Bulk level when user gets bulk exp I've been working with this for the entire week now, this is about a leveling system of my application. When a user gets the enough exp needed, it gets leveled up, everything works fine. But, when a user gets a bulk exp, it won't get a bulk level as well. The default for exp needed for every user is 1000. For example:

The user gets 1000 exp, for level 1, it gets leveled up to level 2. It works fine that way, but if it gets more than the exp needed the flow won't work the same way. Because the exp needed for level 2, is 1400. So the algorithm for this if the user gets enough or more than the exp needed, the current exp_needed for the next level is multiplied by 1.4.

if($user->level <= 19){
   while($user->curr_exp >= $user->exp_needed){
   $user->level += 1;
   $user->curr_exp -= $user->exp_needed;
   $user->prev_exp = $user->exp_needed;
   $user->exp_needed = $user->prev_exp * 1.4;
   $user->save();
  }
}
elseif($user->level >= 20){
 while($user->curr_exp >= $user->exp_needed){
 $user->level += 1;
 $user->curr_exp -= $user->exp_needed;
 $user->prev_exp = $user->exp_needed;
 $user->exp_needed = $user->prev_exp * 1.1;
 $user->save();
 }
}

Edit : The levels 1-20 and their exp_needed is working fine now, but when I'm at Level 21, I'm having troubles with the exp, because the exp_needed at level 21 should only be multiplied by 1.1,

For example,

Scenario 1:
The User will earn a curr_exp(current exp) of 2,100,000 the user will jump on to level 21 with an experience of 836,6825.55 which is wrong because the exp_needed at level 21 should be the sum of the prev_exp(level 20 = 597,630.40) multiplied by 1.1 which will be

(prev_exp of level 20) 597,630.40 * 1.1 =  657,393.44

Scenario 2:

The user gets an exp of 2,000,000 it will be on the level 20 with an exp of 508,424.01 with an exp_needed of 597,630.40 and when it gets another exp of 100,000 the user will be leveled up to 21 with an exp_needed of 657,393.44 which is correct.

So to summarize each scenarios results:

Scenario 1:

Level 21
Exp:10,793.61
Previous Exp: 597,630.44
Exp Needed for the next level: 836,682.55

Scenario 2:

Level 21
Exp: 10,793.61
Previous Exp: 597,630.40
Exp needed for the next level: 657,393.44

Scenario 2 should be the results I am seeking for but it doesn't work that way on my while loop. Any ideas how to deal with this? Thank you.

sentences:
Unity - Odd distortion on default material cube Does anyone know what causes this strange effect that looks like ripples? This is simply the default material on a cube and should be perfectly smooth. (Clear example at top right of image)

Another example:

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:
What files and libraries do I need for OpenGL and controls I am starting a 3D game, however I find OpenGL file system very confusing. OpenGL package doesn't have  one file, other package doesn't have another, so I need a summary of what files do I need to start playing with 3D. It would be good if it included keyboard and mouse controls.

Shortened question: Where can I get all files for OpenGl 4.0 and integrated controls libary?

sentences:
As an Independent Developer should I host my own official game servers My small team is approaching initial closed alpha for testing, however that has brought up the question of whether it is a good idea to host our official game instances from my home office or not. I've run a few dedicated servers before on my home PC (have 3 active as a service at the moment actually) so I'm not unfamiliar with the process. However I'm looking into building a server PC specifically to fulfill that singular purpose. I have google fiber 1000mbps so I don't think I'll have bandwidth issues. But I wonder if any of you have advice and insight into what I should expect, dangers to avoid, etc.

Here's what I anticipate, am I missing anything?:

Masking home IP via dynamic DNS service - (pointing to a website to login rather than an IP)
Running multiple VMs on a single server to easily manage server resources
Initially testing with a few selected users
Eventually open up to more users once proven stable

sentences: What is "ROAM" related to terrain rendering? I saw it mentioned on this question, but no one explained what it is.

sentences:
How to fill in crevices on a height map I am a very experienced iOS Developer, but I am beginning my very first foray into 3D graphics (specifically with SceneKit).  I'm trying to model a planet, and I have it working with a height map giving mountains and valleys to a simple sphere.

What I'm wondering now is, how might I have a variable sea level?  As I understand it, a height map only affects how the image is rendered, but it doesn't actually change the geometry of the object, correct?  So my first idea, to have a smaller sphere and scale it up or down relative to the planet so that it shows through in the lower-elevation areas, wouldn't work?

If that's the case, how else might I approach this?  I'd love a code sample if it's simple or ready-made, but mostly I'm just looking for a conceptual answer that I can go off and implement.  How might I take a height-mapped planet surface, and have an adjustable sea level that fills in the lower-elevation areas first?  For simplicity, I'm treating sea level as purely altitude-based (i.e. I don't need to factor in dams or obstacles, and maintaining a consistent volume of water isn't important).

sentences:
Achieve anisotropic filtering I want to set anisotropic filtering to my scene. I use SharpDX (DirectX 11) and C#.

How do i set up anisotropic filtering in my shader?

Currently i try that in the shader:

Texture2D tex;
sampler textureSampler = sampler_state
{
  Texture = (tex);
  MipFilter = Anisotropic;
  MagFilter = Anisotropic;
  MinFilter = Anisotropic;
  MaxAnisotropy = 16;
};

float4 PShader(float4 position : SV_POSITION, float4 color:COLOR, float2 tex0 : TEXCOORD0) : SV_TARGET
{
  float4 textureColor;
  textureColor = tex.Sample(textureSampler, tex0) * color;

  return textureColor;
}

I get my object, textured, but it is not filtered anisotropic. I can write everything in the Parameters, even invalid things and i don't get any errors. The result is the same, objects without applied anisotropic filtering.

Do i have to set that in the shader? Can i do that also with SamplerState? I tested that but i didn't get a result too.

Some steps what i have to set would be helpful.

Edit:

Here the current result. You can see the blurred planes of the cube in the middle:

As comparison the same scene in OpenGL with 16x anisotropic filtering. The planes of the cube are not blurred:

Second Edit:

Based on the idea, that in OpenGL the anisotropic filtering is a texture environment variable, maybe i have set some settings in the texture wrong?

Texture2D texture = (Texture2D)Texture2D.FromFile("Test.png");
ShaderResourceView tSRV = new ShaderResourceView(device, texture);
device.ImmediateContext.PixelShader.SetShaderResource(0, tSRV);

sentences:
Events to communicate between game objects in a component based system? I am planning to try and implement a small simple "game engine" thing, with game objects that have their components and all that. My problem is, how do they communicate with one another?

I understand event based communication is popular, but how does it work practically?
Let's say I make a platformer shooter, and the player needs to know about every platform, enemy, bullet, every frame. How will the events look? I thought the player should just say "hey scene manager, I need to know about the platforms. any chance you give me a pointer to those?" and then the player can just handle it. But generally, the address of the platforms (or any other game object) shouldn't change that much, so I am back to a situation where everyone knows about everyone else... This seems like events are useless in this case.

How are events practically used to communicate between objects? is my example the same as what is actually done in games? if not, then what do games do instead?

sentences: Edit VBO data or create a new one? I have a question: if I have a VBO, and I have to change all the data inside it (because of resizing, ...), would it be more efficient to delete the old one and create a new one (and reallocate the memory for it), or change the data inside it using glBufferSubData?

sentences:
Drawing a line between 2 vectors I was trying to implement a simple mechanic by drawing a line between the sprite and the mouse, but it's not working that well:

extends KinematicBody2D
onready var player = $CollisionShape2D
var pos_two
var pos
func _physics_process(delta):

    var vel = Vector2()
    pos_two = player.get_position()

    pos = get_global_mouse_position()
    look_at(pos)
    if Input.is_action_pressed("movethere"):
        vel = Vector2(400 , 0).rotated(rotation)
    vel = move_and_slide(vel)
func _draw():
    draw_line( pos_two ,pos, Color(255 , 0 , 0))

sentences:
Prevent Unity click go trough Canvas I'm currently facing this problem: If I click on a Button on my Canvas, the currently selected Unit moves towards the location under the Button.

Is is there any option to solve this? I'm using the A* Project for this.

Sadly, I can not provide a lot of things I've done so far as I absolutely have no clue how to solve this problem.

If I disable the Button Option "Raycast Target" ist still moves to this position but holds a bit earlier.

Also, adding this as check didn't work:

if (!EventSystem.current.IsPointerOverGameObject() )

I also checked if the Raycast hit's the layer of the GUI

My Movement code so far:

public override void MouseClick(GameObject hitObject, Vector3 hitPoint, Player controller)
    {
        base.MouseClick(hitObject, hitPoint, controller);
        if (hasAuthority && player && player.human && currentlySelected)
        {
            if (hitObject.name == "Ground" && hitObject.name != "UI" && hitPoint != ResourceManager.InvalidPosition)
            {
                float x = hitPoint.x;
                float y = hitPoint.y + player.SelectedObject.transform.position.y;
                float z = hitPoint.z;
                destination = new Vector3(x, y, z);
                //Debug.Log("Start_Move");
                StartMove(destination);
            }
        }
    }

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:
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:
Is it possible to use DirectX in pure C program? I want to try something simple with Direct Sound. Just want to know if it's possible.

Or maybe I need some other API?

sentences:
My bullets won't bounce in Unity? I wanted bullets to bounce when they hit walls. However when colliding with a wall, they just jitter about on them. I didn't want to create a new physics material as I want to keep the ball moving at a constant speed and to have them destroy themselves after they have bounced once. Thus, I wrote everything in Code.
The constraints for the bullet rigidbody's freezing position is the Y axis while the freezing rotation is X, Y, and Z axis.
I also wondered if the initial position the instantiated bullet also had something to do with the speed the bullet travels:
GameObject bulletObject = Instantiate(bulletPrefab);
bulletObject.transform.position = transform.position + (transform.forward * -1);

Here's the minimum reproducible code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class bulletMovement : MonoBehaviour
{
    private Rigidbody bulletRB;
    private Vector3 lastVelocity, initialVelocity;
    public float bulletSpeed = 10f;
    private int bounceCount;
    // Start is called before the first frame update
    private void Start()
    {
        bulletRB = GetComponent<Rigidbody>();
        bounceCount = 0;
        bulletRB.AddForce((transform.forward* -1) * bulletSpeed);
    }

    void Update()
    {
        lastVelocity = bulletRB.velocity;
    }

    // Update is called once per frame

    private void OnCollisionEnter(Collision col)
    {
        if (col.collider.tag == "Walls")
        {
            bounceCount += 1;
            if (bounceCount < 2)
            {
                Bounce(col.contacts[0].normal);
            }
            else
            {
                Destroy(gameObject);
            }
        }
    }

    private void Bounce(Vector3 normal)
    {
        var speed = lastVelocity.magnitude;
        var direction = Vector3.Reflect(lastVelocity.normalized, normal);

        Debug.Log("Out Direction: " + direction);
        bulletRB.velocity = direction * Mathf.Max(speed, bulletSpeed);
    }
}

lastVelocity = bulletRB.velocity; is required to be in Update or else the bullet won't move at all.

sentences:
Use both AddForceAtPoint and change velocity property? I'm using Rigidbody2D for some game objects. It seems that when I AddForce() or AddForceAtPoint(), the game objects are mostly affected on the Y axis and hardly at all on the x axis. I don't understand why. To really get any effect on the x axis, I need to have a very strong force like *10 000. But the effect on the y axis is then extremely strong and shoots the object out of screen, yet only nudges the game object on the x scale.

I believe that the problem with the y axis is because I use .velocity to move the character. But I don't know how to change the velocity directly without doing that.  What should I do to use both forces and set velocity on the same object?

sentences: How do I save variables and load them in Unity with JavaScript? I made a game and i want to save the high score and load it back. I need to save 3 variables and load them when the game starts. How do i do it?

sentences:
Best next step for game AI implementation I have recently finished a small framework that employs agents governed by a small hierarchical finite state machine, however I have quickly discovered the drawbacks of this approach. Namely the fact that increasing numbers of behaviours call for an exponentially complicated rule-base to govern the switches.

It occurs to me that there is probably a much better way of coding AI, where they have overall goals and can assess new information with regards to this.

I did some research but was a little overwhelmed by the amount of methodologies, and for that matter the lack of information about which techniques are more commonly used and which are best for certain situations.

what would be a good next implementation/methodology for a 3rd / 1st person shooter? such as a neural network or GOAP.

sentences:
C++:Segmentation fault (core dumped) while creating gameobject i made a small code to debug and i get this error

player inherit from gameobject

code

///main
#include "game.h"

 gameobject* pla;

int main()
{

    std::vector<gameobject*> objects;

    gameobject* pla = new player(32,32);  -----> error is here

    objects.push_back(pla);
    cout<<objects[0]->numberID<<endl;
    return 0;
}

/// gameobject
pragma once

#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include "game.h"

class gameobject
{

    public:

        virtual ~gameobject(){};
        virtual void init()=0;
        virtual void tick()=0;
        virtual void render(SDL_Renderer* ren)=0;
        virtual void destroy()=0;
        virtual void setVelx(int velx)=0;
        virtual void setVely(int vely)=0;

        int numberID=0;

    protected:

        int width = pos.w;
        int height = pos.h;
        int posx = pos.x;
        int posy = pos.y;

        float velox;
        float veloy;

        SDL_Rect crop;
        SDL_Rect pos;

        SDL_Texture* tex;

////player.h

#pragma once

#include "gameobject.h"

class gameobject;

class player : public gameobject
{

public:

    void init() override;
    void tick() override;
    void render(SDL_Renderer* ren) override;
   // SDL_Renderer* renderer;
    player(int pwidth,int pheight);

    void destroy() override{
        this->~player();
    }

    void setVelx(int velx) override;
    void setVely(int vely) override;

    int i = 0;

private:

    ~player() override;

};

/// player.cpp

#include "player.h"

player::player(int pwidth, int pheight)
{

    this->pos.w = pwidth; //width
    this->pos.h = pheight; // height
    this->pos.x = 100; //posx
    this->pos.y = 100; //posy

    // cout<<"yes iam ren : "<<ren<<endl;

    this->numberID = gameobject::numberID;

    gameobject::numberID++;
    //this->tex = IMG_LoadTexture(ren,"/home/younlok/Desktop/dash/res/pss.png");
    this->tex = game::textures[0];
    crop.x = 0;
    crop.y = 0;
    crop.w = 32;
    crop.h = 32;

    //game::hand->addObject(this);

}

void player::init()
{
}

void player::tick()
{

    this->pos.x += this->velox;
    this->pos.y += this->veloy;

}

void player::render(SDL_Renderer* ren)
{

 SDL_RenderCopy(ren,tex,&crop,&pos);

}

void player::setVelx(int velx)
{
    this->velox = velx;
}

void player::setVely(int vely)
{
    this->veloy = vely;
}

player::~player(){}

sentences:
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:
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:
Conceptual - What is the optimal way to combine steering behaviors with rigid body physics? I am working on a simple 3D space simulator that makes use of the Bullet physics engine. The spaceships are rigid bodies that have a mass and hitbox so that they can be considered for collisions. At the same time, I am trying to implement simple steering A.I. as detailed in numerous tutorials across the web. However, all of these tutorials assume zero-size points in 2D space with no orientation.

For the most part, I have succeeded in implementing the behaviors by applying a force to the rigid body in the direction of desired steering. The spaceship moves, turns, and accelerates smoothly and correctly navigates to the desired position in 3D space:

currentVelocity = body.getLinearVelocity();
tempVector = body.getWorldTransform().getTranslation();
desiredVelocity = targetPosition.sub(tempVector).normalize().scale(maxVelocity);
steeringForce = desiredVelocity.sub(currentVelocity);

body.setGravity(steeringForce); *[see footnote]

However, the spaceship does not change its orientation at all. The problem I am trying to solve is simple - to make the spaceship face in the direction that it is currently travelling.

From my research, it seems that simply setting the orientation of the object to face the direction of its velocity is really bad when using a physics engine because it may cause a rigid body to become stuck inside another one. On the other hand, using a more realistic navigation system based on thrusters is prohibitively (and needlessly) complex because the number of spaceships will be very high.

What is the best way of overcoming this problem?

Edit: Also of note is that the Bullet physics library does not allow setting the orientation of a body.

**Note: I used the function setGravity() instead of applyForce() as suggested by an admin at the Bullet physics forums because applying a force is dependent upon frame-rate. On the other hand, gravity is applied evenly according to Bullet's simulation steps, not to mention that gravity otherwise unused in a space simulator.*

sentences: What is billboarding, and can/should it be used in 3D games to create special effects for weapon blasting effects? What is billboarding, and can or should it be used to create special effects for 3D games on weapon blasting effects?

sentences:
SerializeField UntiyEvent not properly saving modifications in EditorWindow I'm making a node editor in Unity using an EditorWindow, I'm currently trying to make it so designers can add their own methods to a node using serialized UnityEvents; but I haven't been able to get it to function properly.

SerializedObject serializedObject = new SerializedObject(selectedNode.NodeState);

SerializedProperty property = serializedObject.GetIterator();
property.Next(true);

while (property.NextVisible(false))
{
    EditorGUILayout.PropertyField(property);

}
serializedObject.ApplyModifiedProperties();

serializedObject.Update();

The above code runs through all necessary fields of the class so the user can modify them.

Everything functions perfectly with the exception of UnityEvents. They almost do as I intend them to do, except they don't preserve the variable inputs of inserted object's method. If I keep working within the editor window they stay, but if I close the window and re-open the inputted variable resets.

I thought this may be caused by an issue somewhere else in my code, but all other fields work fine.

sentences:
How to create a line renderer with end point as the mouse position, but with a fixed direction I have two objects with a line going from one to the other, like this:

I want to create another line with a starting point one of the objects and an end point the mouse position, however still facing the second object, which will look like the first line is filling up to where the mouse is.

For example, I want to connect the blue shape with the green shape, so I move my mouse from one to the other. The game finds the nearest white line from the cursor and creates another line on top of it that follows my cursor, like this:

The current script is this. It draws a line from the origin shape to the mouse position, but it doesn't stay on only one direction and instead moves where my mouse goes:

public class SelectionLine : MonoBehaviour {
private LineRenderer lineRenderer;

private void Awake() {
    lineRenderer = GetComponent<LineRenderer>();
}

private void Update() {
    if (ShapeSelection.instance.selectedShape != null && ShapeSelection.instance.draggingFinger != null) {
        var originPosition = ShapeSelection.instance.selectedShape.transform.position;
        var destinationPosition = ShapeSelection.instance.draggingFinger.ScreenPosition;

        lineRenderer.SetPosition(0, new Vector2(originPosition.x, originPosition.y));
        lineRenderer.SetPosition(1, new Vector3(ShapeSelection.instance.draggingFinger.GetWorldPosition(1f).x, ShapeSelection.instance.draggingFinger.GetWorldPosition(1f).y, 0));
    }
}

}

There is no way (as far as I know) to set a direction of a line renderer in Unity, so how can I achieve this?

sentences:
2D open world MMORPG; big map memory problem I am developing an 2d open world mmorpg game for learning purposes, and have a issue with big maps.
A year ago i developed 2d open world single player / co-op game. It saved map in chunks, and AI for NPCs starts 'ticking' when specified map chunk is loaded.
In my mmorpg game, NPCs AI is handled by server, and its always 'ticking' in some specified interval. That is where my troubles begin. I want NPC to walk in random directions. For this to work, I have to check map collision for every step, so my NPC wouldn't end up in wall. Problem is when I have big map, for example 10000x10000, and every tile is represented with 6 bytes, that is about 572MB of map data my server must hold in memory all the time, and i cant load just few map chunks, like in my single player RPG because of lot NPCs AI needs to be updated all the time, even if player is not located near by.
My goal is to archive map size of 50000x50000 tiles. I know its possible because i seen 2d mmorpgs with huge open worlds, a lot bigger then 50000x50000, and I doubt that their server have 20GB of ram to waste just on maps.
If anyone have any ideas how I can lower memory usage, I woud like to hear you.

Thanks in advance, and sorry for my bad english

sentences:
Initializing OpenFeint for Android outside the main Application I am trying to create a generic C++ bridge to use OpenFeint with Cocos2d-x, which is supposed to be just "add and run" but I am finding problems.

OpenFeint is very exquisite when initializing, it requires a Context parameter that MUST be the main Application, in the onCreate method, never the constructor. Also, the main Apps name must be edited into the manifest. I am trying to fix this. So far I have tried to create a new Application that calls my Application to test if just the type is needed, but you do really need the main Android application. I also tried using a handler for a static initialization but I found pretty much the same problem.

Has anybody been able to do it? This is my working-but-not-as-intended code snippet

public class DerpHurr extends Application{

@Override
public void onCreate() {
    super.onCreate();
    initializeOpenFeint("TestApp", "edthedthedthedth", "aeyaetyet", "65462");
}

public void initializeOpenFeint(String appname, String key, String secret, String id){
    Map<String, Object> options = new HashMap<String, Object>();
    options.put(OpenFeintSettings.SettingCloudStorageCompressionStrategy, OpenFeintSettings.CloudStorageCompressionStrategyDefault);
    OpenFeintSettings settings = new OpenFeintSettings(appname, key, secret, id, options);

//RIGHT HERE
    OpenFeint.initialize(***this***, settings, new OpenFeintDelegate() { });
    System.out.println("OpenFeint Started");
}

}

Manifest

<application
    android:debuggable="true"
    android:label="@string/app_name"
    android:name=".DerpHurr">

sentences:
Find alternate shortest paths in Unity I'm developing a game in Unity. It's a simple game where the rocket has to reach the point where the player touches on the screen. The movement of the rocket is physics based. When the rocket goes off screen on right side, it appears on left side and when it goes off on left side, it appears on right side. Similar for vertical axis.

In the picture above, the user touches on the bottom right corner. The rocket could either rotate and go there (Path 1) or it would directly go up left off the screen and appear on bottom right corner and reach there(Path 2).  I want to implement the Path 2. How would it calculate the distances and determine the shorter path and then proceed in that direction?

sentences:
Event Based Render / Update Loop I'm working on a few game dev tools which use OpenGL or DirectX to render 3D models (viewing).
Consider your favorite 3D modeling software package (Softimage, Maya, 3DS Max, modo, etc.). Note that the 3D viewport does not sit in a constant render loop pegged at max FPS. It remains idle (0 FPS) until some action is taking place in the viewport such as moving the viewport camera from side to side using the mouse or pressing play for animation. If the viewport is idle, there is no drain on the CPU / GPU. I'd like to use this technique in a couple of tools I'm working on and possibly within the game.
Is there a generally accepted programming technique with OpenGL and/or DirectX (via C++) that will achieve this?
One solution would be to do a standard render loop and check for input 1000s of times per second, but that seems inefficient and hard to manage as you add more and more "events" which would trigger a updated render.
Please let me know if the question is unclear. If I knew how to describe it perfectly I could probably just search google.

sentences:
Using Ogre particle point billboards with shaders I'm learning about using Ogre particles and had some questions about how the point type particles work.

Q. I believe point type particles are implemented as a single position. Is one single vertex is passed to the vertex shader?

Q. If one vertex is passed to the vertex shader then what gets sent to the fragment shader?

Q. Can I pass the particle size to the shader? Perhaps with a custom parameter?

sentences:
Projection Matrix Breaks My Rectangle This is my vertex shader, shown below.

#version 330 core

in vec3 a_position;
in vec4 a_colour;

// FOV = 70, near plane = 0.1, far plane = 1000
const mat4 u_projection = mat4(
    1.428148, 0.0, 0.0, 0.0,
    0.0, 1.428148, 0.0, 0.0,
    0.0, 0.0, -1.0001999, -0.20002,
    0.0, 0.0, -1.0, 0.0
);

//uniform mat4 u_projection;
//uniform mat4 u_view;
uniform mat4 u_transformation;

out vec4 v_colour;

void main() {

   gl_Position = u_projection * u_transformation * vec4(a_position, 1);
   v_colour = a_colour;
}

Whenever I take out u_projection, my square appears. When I add it back, the square is malformed.

The vertices of my square are as follows, aka the contents of a_position.

float[] vertices = {
    0, 0, 0.5f,
    0.5f, 0.5f, 0.5f,
    0, 0.5f, 0.5f,
    0, 0, 0.5f,
    0f, 0.5f, 0.5f,
    0, 0.5f, 0.5f
};

The position of the square is (0, 0, 0), the rotation is (0, 0, 0) and the scale is 1. These are computed into u_transformation and uploaded. This works perfectly.

If I change the -1.0001999 and the last 0 to 1 part to 1 then the square is not hidden.

void bindAttribute(int index, String name) {
    GL20.glBindAttribLocation(program, index, name);
}
bindAttribute(0, "a_position");
bindAttribute(1, "a_colour");

sentences: Generate random number in Unity without class ambiguity I have a problem in Unity (C#) where I would like to create a random number. I wanted to use System.Random (reference: using System) but Unity complains that it's ambiguous to their own UnityEngine.Random. I can not specify the reference (using System.Random) as random is not a namespace. How do I specify that I want to use the system random and not the Unity one?

sentences:
Unity Direct Compute: Setting a struct of arrays The NVIDIA Direct Compute programming guide lists some best practices for memory management on the GPU. One tip they give on page 8 ("Structured Buffers") is to use a 'structure of arrays' (SOA) layout rather than the typical 'array of structures' (AOS) one:

struct Particle {
    float4 position;
    float4 velocity;
};
RWStructuredBuffer<Particle> particles;

vs

struct Particles {
    RWStructuredBuffer<float4> position;
    RWStructuredBuffer<float4> velocity;
};
Particles particles;

(At least, as far as I understand)

AOS layout seems to be the most popular (maybe even only) way to manage lists of stuff in the compute shader.

I haven't found a way to implement SOA from the CPU side, Unity's ComputeShader.cs doesn't have a set struct function or similar. Does Unity expose a way to set SOA structs from the CPU side at all?

sentences:
Lightning Effect PyGame I want to create a Lightning Effect Like http://www.youtube.com/watch?feature=player_embedded&v=mmU2GAYGVSU for my game.

The following blog explains it briefly but I am not able to understand the following line:

midPoint += Perpendicular(Normalize(endPoint-startPoint))*RandomFloat(-offsetAmount,offsetAmount);

UPD: I went through older question posted at gamedev.stackexchange and found following explanation:

Normalize(endPoint-startPoint):

That line gets a unit vector (vector of length 1) from startPoint to endPoint

Perpendicular(Normalize(endPoint-startPoint))

then gets a vector perpendicular to that (i.e. at right angles to the line)

I want to know  whether python has inbuilt function for

Getting a unit vector (vector of length 1) from startPoint to endPoint
Getting a vector perpendicular to that (i.e. at right angles to the line)

sentences:
Calculate UV sphere vertices (altitude) There is an fantastic answer by DMGregory here where he explains how to calculate and generate the vertices of an UV Sphere: OpenGL calculate UV sphere vertices

Based on his code, how can we change the "altitude" of each individual vertex?

To create something like this:

sentences:
Frustrum culling without per-mesh positions I am trying to implement frustrum culling in a C++ renderer im writing but I feel like I hit a brick wall.
The plan is to load the Sponza level and per mesh create a collision box using Bullet physics library, which also holds the mesh translation, scale and rotation, then get the camera planes and check if the collision box falls inside the planes. I'm loading the Sponza level using the Assimp library, it loads fine and displays correctly but every node's transformation is at 0,0,0  which leads me to believe all the vertices are pre-translated already (even without optimization flags). I checked it out in Blender and even there the translation gizmo is at 0,0,0 for every mesh. I tried a couple different sponza files, FBX too but they all lack per mesh positions. Should I just give up on this? Are there other ways to perform frustrum culling?

sentences:
Networking library compatible C++ and Java There is any networking library like eNet compatible with Java and C++?

'm trying to find a way to communicate an Android game in Java with a C + + server, but I prefer to use a network library instead raw sockets.

I've found a java-enet, but I don't know if it's a mature project or compatible with eNet C version.

sentences:
Suitable SDK to develop quick game? I'm currently undertaking a personal project at home that I need to turn around inside the next few months (which working full time and still learning programming makes it a tad difficult). I'm looking for suggestions on SDK's or tools (preferably free or that come with games, similar to steam tools) that I can use to develop a "game". I'm OK with coding but have no 3D development skills at all.

I've very little experience with mod tools or SDK's at all but I'm hoping someone can point me in the direction of one that does the following:

A decent library of prefab 3D models to build scenes.
Ability to add scripting to the scene

I've used Unity before and would prefer to continue to do so however I really have the worst 3D skills imaginable and can't waste time learning them.

I'd be looking for pre-fab items that are both industrial and possibly more lush environments (trees etc). If it makes any difference (due to licencing and what-not) I WILL NOT be selling this game or marketing it in any way and I am a University Student if any places do educations licences.

Another alternative would be to source free 3d models elsewhere but again while I'm still learning I have no idea where to look if someone could point me in the right direction I'll do the rest of the digging.

Thanks

sentences:
How do I handle my collision resolution using a delegate scheme? My physics engine is coming along quite nicely, and I'm ready to start working on some more advanced features. I'm trying to set up my collision engine so that an arbitrary delegate can be notified when a collision occurs.

Say we have object A, object B, and object C in the physics simulation. I want to be able to inform a delegate about a collision between A and B, and also inform a potentially different delegate about a collision between A and C.

I have a known interface for the delegate, I have the potential of storing a state for my collision detector, although I currently do not, and have the ability to store states in the objects, themselves. Similarly, I use this delegate model to handle collision resolution, simply setting the physics engine as the delegate for all objects by default, and allowing the user to change the delegate if desired.

I have already tried having each object store it's own collision delegate, that would be informed when a collision occurred. This didn't work, because when the objects had the same collision delegate, the same collision was handled twice. When I switched to only using the delegate of the first object (however that was decided), the order of simulation became an issue. I want to use a dictionary, but that introduces a significant amount of overhead. However, that seems like the direction I need to be heading.

How do I handle my collision resolution using a delegate scheme?

sentences:
How to get x in radius percentage value? How to find the percentage value from A to B when I know the X value in between these two points?

I created this picture to kind of illustrate what I mean better.

I wrote this function which gets the percentage, but how do I also include the center offset?

private float GetPercentage(Vector2 point, float radiusOffset, float centerOffset)
{
    float radius = Math.Min(circle.rect.width / 2f, circle.rect.height / 2f);

    radius *= radiusOffset;

    return 1f - (Math.Max(Math.Abs(point.x), Math.Abs(point.y)) / radius);
}

The radius offset is from 0-1, 0 being the 0,0 position and 1 full radius. The center offset is from 1-0, 1 being the 0,0 position and 0 being the radius border.

sentences:
If I make a 3d model in a .fbx format, do I owe any royalties/fees to autodesk for using fbx files in Unity? I'm currently making a game where every format for every asset is either opensource/freeformat, or requires no license fees to use.

I've pretty much settled happily on .ogg for audio, vorbis/webm for video, .png for pictures and openoffice for documents (or .pdf files since they were free standard since 2001?)

What I'd like to know though is, if I make a 3d model in a .fbx format, do I owe any royalties/fees to autodesk for using fbx files in Unity?

If not, does this apply to every 3d model format, or only certain ones? Do software companies like Blender/Unity pay for the privilege to import fbx files so that users like me don't have to?

sentences:
Any advantage of having chunks with sizes by the power of two? With my past experience of having my little game lag because of the size of the world, I have decided that in whatever next project I might choose to create, I will split said world into chunks. Now here comes my question : Should the chunk's width, height and depth be a power of two?

For example, in a little game called Minecraft, chunks have a height of 256 and width,depth of 16. Both numbers a power of two. Is there any advantage over having the chunk simply be 100x100x100?

Minecraft was written in Java, but I'm working in Lua. Just pointing that out in case it has any relevance.

sentences:
Unity - Where should downloaded level data be stored? I've been looking around and it appears suggestions are only to store data to UserPrefs, or PersistentDataPath.

I intend to have map files streamed to the client on demand, and saved for reuse. UserPrefs seems inappropriate for large blobs. PersistentDataPath is per computer user, thus duplicating data and space usage. I believe Program Files has access restrictions too.

What are the current best practices for storing runtime data that meet the following criteria?

Is shared across user accounts to avoid wasting disk space.
Doesn't require elevated permissions.
Doesn't annoy the user (such as data being placed in My Documents).
Can be modified at any time.

sentences:
Heightmap terrain picking I've implemented an OpenGL based terrain unsing a tesselation-shader for dividing each 'terrain-cell' into the desired tiles.
The heightmap is uploaded to the GPU and applied on the shader.

When it comes to picking, I don't really know what to do.
Testing triangles on intersection with the pick ray is not possible because only the GPU 'knows' the mesh.

Is render to texture with an unique color the way to go?
Or holding an additional mesh in RAM, only for picking/collision?

sentences:
SQL Database using Adobe Air How do you create an SQL database (I believe it's tinySQL/SQLite) using Adobe Air? I have searched around, and all sites give code, and then explains to wrap it within an xml document, for example here.

So I have created this xml file, but no one seems to explain what to do from there. I am also VERY new to database creations and management. So any super n00b friendly help would be much appreciated.

Thanks.

sentences:
Rotating Sprite Around A Point Without Messing Its Drawing Point I am trying to draw and rotate an arrow sprite based on a point,around a static circle body without messing its drawing starting point. Arrow should be  directed to the same direction with user touch point,static body center vector.

Let me explain it with an example.

This is how i calculate arrow drawing point:

fun powerIndicatorDownPointCalculator(playerPosition: Vector2,touchPosition: Vector2,distanceBetweenTouchPointAndPlayer:Float):Vector2{
  // player position is static body center,touch position is touch point.

    val playerPositionHolder = playerPosition.cpy()

    val abVector = playerPosition.sub(touchPosition);

    val normalizedAbVector = Vector2(abVector.x/distanceBetweenFingerAndPlayer,abVector.y/distanceBetweenFingerAndPlayer)

    Gdx.app.log("normalized ab vector",normalizedAbVector.toString())

    var pointToAddX  = 90*normalizedAbVector.x
    var pointToAddY  = 90*normalizedAbVector.y

    var newPointX  = playerPositionHolder.x + pointToAddX
    var newPointY = playerPositionHolder.y + pointToAddY
    Gdx.app.log("NEW POINT", Vector2(newPointX,newPointY).toString())

    return Vector2(newPointX,newPointY)

}

Here is a simple gif showing it:

https://i.ibb.co/TvHBMh9/MNML-November19-041320-AM.gif

This is how i calculate C point to use later on rotation(?)

 fun calculateAimingPoint(playerPosition: Vector2,touchPosition: Vector2):Vector2{
//playerPosition is staticbody center
        val abVector = playerPosition.sub(touchPosition);

        val secondPos = blackBody.position.cpy()
        val cPointPosition  = secondPos.add(abVector)
        return cPointPosition

}

This is what i wrote for rotation but for sure it is wrong since not working as i wanted:

var angle = atan2(aimingPoint.y - blackBody.position.y, aimingPoint.x - blackBody.position.x ) *180/ PI ;
//aiming point is C point, blackBody is static body
  if (angle > 90)
  {
      angle = 450 - angle;
  }
  else
  {
      angle = 90 - angle;
  }

// powerIndicator.setOrigin(????) // setOrigin is for rotation but i dont now what to write here.

  angle = angle*-1
  powerIndicator.rotation = angle.toFloat()

What i actually wanna achieve is this:
https://i.ibb.co/gDM9H3L/MNML-November19-042729-AM-2.gif

sentences:
How to handle a Block World like Minecraft I want to write a simple game with a block world like in Minecraft. My theoretical question is what is the best way to handle this block informations during playing. My first Idea was a huge array but this will cause running out of memory I think. Maybe I have to only load the blocks near the player.

How can I handle the loading of needed block informations from a file and the holding only of needed ones in memory?

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:
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:
CopySubresourceRegion results in no-op I'm having some trouble copying a subregion from a source texture (2D) to a destination texture.

Both textures are mipmapped 2D textures, with dimensions (at mip 0) of 512 x 32.

Rather than tell you about each parameter, it's easier to show you, according to the Visual Studio debugger, at the call site:

So, question 1: Is there anything wrong here that would cause CopySubresourceRegion to fail? There is nothing in the Debug window (the debug layer is enabled). The destination texture is a Staging resource with the CPU Read access flag.

If that seems okay to you, here's the rest of the question:

I'm making this call as part of a unit test, and attempting to read the data right out of the destination texture immediately after. If I replace the CopySubresourceRegion call with a CopyResource instead, the answer is wrong, but there is definitely data copied across. However, after making the call to CopySubresourceRegion and then using a Map/Read/Unmap chain, the data that comes back is all zeroes. The texel type is R32G32B32A32_FLOAT (or whatever it is).

I realise that the call is made asynchronously, so I added the following code between the copy and the read:

for (UINT i = 0U; i < numDeferredContexts; ++i) {
    CHECK_CALL(deferredContextPtrArr[i]->FinishCommandList(FALSE, &outCommandList));
    immediateContextPtr->ExecuteCommandList(outCommandList, FALSE);
}

And still, all zeroes. So I went one further, and changed it to the following (desperate) code:

for (UINT i = 0U; i < numDeferredContexts; ++i) {
    deferredContextPtrArr[i]->Flush();
    CHECK_CALL(deferredContextPtrArr[i]->FinishCommandList(FALSE, &outCommandList));
    immediateContextPtr->ExecuteCommandList(outCommandList, FALSE);
}
immediateContextPtr->Flush();
Sleep(10000);

But still nothing. Finally, I turned off the multithreaded rendering so it all executes on the immediate context, but even then, still zeroes.

So I'm totally stuck, and any ideas are appreciated: How can I make CopySubresourceRegion actually copy the data?

sentences:
How can I load textures in Unity and keep them between scenes? I have some textures that are used in multiple scenes and I want to keep them in memory to speed up load times between scenes.  I know about Resources.Load, but does that always keep it loaded?  If a texture is loaded with Resources.Load, will instantiating a prefab with that texture recognize that it's already loaded or will it load its own instance of the texture?

It would be better if it's a method that I can use in code so that I can make a loading screen and not freeze everyhing up.  I'm limited to an earlier version of Unity so I don't have access to LoadLevelAsyc.

sentences:
How to get several frequency ranges at the same time in fmod? After reading documentation and tutorials about fmod I still have a question about frequency ranges.

I've found how to get a frequency range using low and high pass DSP at the same time on the main channel, but I can't find how to get several ranges at the same time.
For example I want, for a specific phase of my game, to hear range 400 to 600Hz and 1000 to 2000hz of the same sound.
I tried to create a channel by range, but it doesn't seem to work (or maybe I do something wrong).
How can I do that ?

Thank you

sentences:
How can I draw a perspective-correct quad? I'm trying to draw a quad in 2D (in SharpDX, but that is basically XNA). But texture correction is not working, and I'm getting only an affine textured quad.

I'm using BasicEffect to render it.

BasicTextureEffect = new BasicEffect(Device)
{
    Alpha = 1.0f,

    TextureEnabled = true,
    LightingEnabled = false,
    VertexColorEnabled = true,

    Projection = Matrix.OrthoOffCenterLH(0.0f, ScreenWidth, ScreenHeight, 0.0f, 0.0f, 1.0f),
};

It is an 2D isometric game. I have pseudo-3D coordinates in isometric world (it's a shadow on the ground) converted to screen space, and then rendered using DrawQuad.

Do I need to set-up view (or projection?) somehow, to real 3D (emulate the isometric camera), and then draw this quad in 3D coordinates instead? How eventually? Or is there a way to correct this in 2D?

Update:

I've uploaded the actual partial screen-shot (Figure A), for you to see it's almost the same. (I cut it a bit, but it goes all to the corner)

            Figure A                                         Figure B

Update 2:

I can confirm now, that plain SharpDX (XNA) BasicEffect does this with just plain UW mapping (4 corners of a square), and plain DrawQuad. I've temporarily changed it to include center point, and I do draw 4 triangles instead of 2 (Figure B), this reduces effect to minimum, but it's still there. It still needs to be solved, because I won't be using it only on shadow.

sentences:
Change the scale-policy of OpenGL ES in Android? I currently develop a game for Android in OpenGL ES 1.0, use libgdx library. I target the 720x480 screen size.

For example, I design only one arts pack for 720x480. And what will happen in Android phones with screen-size smaller or bigger than it, 480x320 for instance? Could you please tell me how to change the scale-policy of OpenGL ES in Android? Or in libgdx specially?

Is there anything like "Resample Image" like photoshop?(Nearest Neighbor, Bilinear, Bicubic etc..) for libgdx?

Edit: I found some tutorials about texture filter in OpenGL, test it with Linear and Nearest. Linear is good for scaling but slow down the game, and Nearest is on the contrary. What should I do to get a balance between those?

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:
How can I attract & repel the mouse cursor from particular UI controls? This question came from some of my students. I wanted to share it here so others can find & improve on the solutions we've found so far.

In particular, my answer below doesn't behave as well as I'd like in windowed / editor mode - UI buttons no longer respond to hovering the cursor. I welcome alternative answers that solve this more completely.

We're making a visual novel game using the Fungus asset for Unity.

We want to add a twist where some dialogue options are easier or harder to press, because they attract or repulse your mouse cursor.

Unfortunately, we haven't been able to identify a cross-platform way to manipulate the mouse's position, nor a way to create a "Fake" mouse cursor image that can still interact with Fungus's UI buttons.

How can we pull this off?

sentences:
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:
Per fragment lighting with OpenGL 4.x tessellated model I'm experienced with OpenGL 3+. I'm dabbling with tessellation shaders and have now got to a point where I have a nicely tessellated teapot/plane demo (quick look here)

As can be seen from the screenshots, the lighting is broken (though admittedly doesn't look too bad in the image)

I've tried to add a normal map to the equation but it still doesn't come out right, I can calculate the normals, tangents and binormals per triangle in the geometry shader but still looks wrong.

I think the question would be; How do I add per fragment lighting to a tessellated model?

The teapot is 32 16-point patches, the plane is one single 16 point patch.

The shaders are here, but they are a complete mess, so I don't blame anyone who cant make sense of them. But peruse at your leisure if you like.

Also, if this question is more suited to be somewhere else i.e. Stack Overflow or the Programming stack please let me know.

sentences: Countdown Timer for Racing Game I want to make a countdown timer for my racing game such as "3... 2... 1... GO!" I'm using GLUT, OpenGL, and C++. I was wondering what the most appropriate method to handle this in C++. clock()? glutTimerFunc()? I plan on having 4 textured polygons that shrink and fade one after the other.

sentences:
Verifying that two words match — false negatives In my first game, I am trying to validate whether two words match: whether an input word matches a reference word from an array.

Unfortunately the only word for which it finds a correct match is the last value in the array I created. All the other words report an incorrect match even when input correctly.

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

public class MatchLetters : MonoBehaviour {
    public string word = null;
    public int wordIndex = 0;
    public string alpha;
    public Text WordMatch;
    public Text Question;
    public string name;
    public static string[] quest;
    int num;
    public List<string> Words;

    void Start () {
        TextAsset wordText = Resources.Load<TextAsset> ("Words");

        quest = wordText.text.Split ("\n" [0]);
    }

    void Update () {
       //  Question.text = quest[Random.Range(0, quest.Length)];
    }
    public void AlphabeticFunction(string alphabet){
        wordIndex++;
        word = word + alphabet;
        WordMatch.text = word;
    }

    public void WordsGenerate (){
        name = Question.text = quest[Random.Range(0, quest.Length)];
    }

    public void ValidateAnswer (){

        if (name == WordMatch.text) {
            Question.color = Color.green;
            Debug.Log ("Correct");
        } else {
            Question.color = Color.red;
            Debug.Log ("Incorrect");
        }
    }

    public void ResetAnswer(){
        wordIndex = 0;
        word = "";
        WordMatch.text = word;
    }
}

sentences:
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:
OpenGL float[][] not working? I have a float[][] array in my terrainFragmentShader to load render the biomes, however the code simply does not work. No errors are being cast and when I remove the code biomeMap[int(pass_textureCoordinates.x)][int(pass_textureCoordinates.y)] by either deleting that section or manually setting it, it loads the appropriate texture.

vec4 textureColour = texture(backgroundTexture, pass_textureCoordinates);

float c = biomeMap[int(pass_textureCoordinates.x)][int(pass_textureCoordinates.y)];

if(c < 0)
    textureColour = texture(sandTexture, pass_textureCoordinates);
else if(c < 32)
    textureColour = texture(stoneTexture, pass_textureCoordinates);

All three textures load just fine and are rendered when not using this method and the biomes are being properly loaded and initialized.

Loading:

public void loadBiomes(float[][] biomeMap) {
    for(int x = 0; x < Terrain.VERTEX_COUNT; x++) {
        for(int y = 0; y < Terrain.VERTEX_COUNT; y++) {
            super.loadFloat(location_biomeMap[x][y], biomeMap[x][y]);
        }
    }
}

Initializing:

    location_biomeMap = new int[Terrain.VERTEX_COUNT][Terrain.VERTEX_COUNT];
    for(int x = 0; x < Terrain.VERTEX_COUNT; x++) {
        for(int y = 0; y < Terrain.VERTEX_COUNT; y++) {
            location_biomeMap[x][y] = super.getUniformLocation("biomeMap[" + x + "][" + y + "]");
        }
    }

And finally here is the entire terrainFragmentShader:

#version 400 core

in vec2 pass_textureCoordinates;
in vec3 surfaceNormal;
in vec3 toLightVector;
in vec3 toCameraVector;
in int biomeSize;

out vec4 out_Color;

uniform sampler2D backgroundTexture;
uniform sampler2D sandTexture;
uniform sampler2D stoneTexture;

uniform vec3 lightColour;
uniform float shineDamper;
uniform float reflectivity;

uniform float biomeMap[128][128];

uniform float offsetX;
uniform float offsetZ;

const int levels = 32;

void main(void){

    vec4 textureColour = texture(backgroundTexture, pass_textureCoordinates);

    float c = biomeMap[int(pass_textureCoordinates.x)][int(pass_textureCoordinates.y)];

    if(c < 0)
        textureColour = texture(sandTexture, pass_textureCoordinates);
    else if(c < 32)
        textureColour = texture(stoneTexture, pass_textureCoordinates);

    vec3 unitNormal = normalize(surfaceNormal);
    vec3 unitLightVector = normalize(toLightVector);

    float nDotl = dot(unitNormal,unitLightVector);
    float brightness = max(nDotl, 0.25);

    vec3 unitVectorToCamera = normalize(toCameraVector);
    vec3 lightDirection = -unitLightVector;
    vec3 reflectedLightDirection = reflect(lightDirection, unitNormal);

    vec3 totalDiffuse = brightness * lightColour;

    out_Color = vec4(totalDiffuse,1.0) * textureColour;

}

Why isn't the biome not loading? Is it an issue in me not getting the appropriate [x][y] from the pass_textureCoordinates?

sentences:
Why does this exported cube have more vertices than I expected? I'm trying to export md5mesh models. Just as a test I decided to export a simple cube (i.e. with 8 vertices). When I opened the md5mesh file it lists the following:

numverts 24
numtris 12
numweights 24

Obviously the number of triangles makes sense: 6 faces * 2 to triangulate = 12.

The model only has one bone so again it even makes sense that there is one weight for each vertex. The question is though, why is the file listing 24 vertices?

Is the problem the exporter or is this normal for md5mesh's? Is it something that you have to rectify when you come to parsing the file in engine? I don't want to be parsing or drawing duplicated vertices without reason.

I'm guessing it's something to do with shading and normals. Is it a case of listing each vert 3 times, one for each facing normal?

sentences:
Unreal 4 why does reducing scalability take so long to compile? I have almost nothing in my scene--in fact, I reduced my scalability settings from "High" to "Medium" before even loading my level layout--and doing this has crashed the program multiple times. It didn't crash this time, but it is telling me it is compiling over 5000 shaders (!) and my objects' materials are not showing up in the viewport.

1) that is a ton of shaders, what shaders are these? I only made like 8 shaders.

2) What is making this take so long? it is taking forever, over 10 minutes already.

3) Is this normal?

sentences:
Transform point while keeping other points offset I have the following situation: I've got a box with its center of mass transform matrix that I'm obtaining from physics simulation, i.e. it keeps changing with time. I've also got two points (actually two transformation matrices) which are static (the simulation doesn't calculate them, neither do I want it to) that I want to 'keep in sync' with the original state (t=0 in the picture).

Any ideas how do I calculate the other two matrices when the center of mass changes, while keeping their original offsets satisfied?

I'm using jBullet for physics.

sentences:
Ensuring linear velocity remains constant even when turning I am using Ackermann steering to rotate a vehicle. The code is as follows:

    if (turningLeft || turningRight) {
        // Rotate around a dummy pivot point
        float turnDir = turningLeft ? -1 : 1;
        Vector3 turningPivotPoint =
            dummyPivot.transform.TransformPoint(
                new Vector3(turningCenterDistance * turnDir, 0, 0));
        dummyPivot.transform.RotateAround(
                    turningPivotPoint,
                    Vector3.up * gasDir * turnDir,
                    angleVel * Time.deltaTime);
    }

    // The player is pressing the gas
    if (isGas) {
        angleVel = Mathf.Lerp (angleVel, maxAngleVel,Time.deltaTime);
    }

    if (angleVel == 0) {
        turningLeft = turningRight = false;
    }

    gasVel = Mathf.Lerp(gasVel, angleVel * Mathf.Deg2Rad * turningCenterDistance, Time.deltaTime);

    dummyPivot.transform.position =
        dummyPivot.transform.position + dummyPivot.transform.forward * Time.deltaTime * gasVel * gasDir;

The issue is that the speed of the vehicle when it is turning does not match its speed when driving straight. Driving the vehicle in circles will be slower than driving the vehicle forward.

How do I fix this?

sentences:
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:
MinGW Windows Cross-Compile Error While I was developing my game on Linux (I'm using an ARM system), I decided that I want to cross-compile it to Windows. Yet, I get an error while I try to link Allegro (version 4.2) to the compiler.

I have installed MinGW32 (x86_64-w64-mingw32-c++ in the terminal) and have moved the bin / include / lib folders from the Windows Allegro version to the /usr/x86_64-w64-mingw32-c++/ folder.

When I enter into the command line:

x86_64-w64-mingw32-c++ *.cpp -o W_Survival `allegro-config --libs`

It returned to me a linking error:

/usr/bin/x86_64-w64-mingw32-ld: unrecognized option '-z'
/usr/bin/x86_64-w64-mingw32-ld: use the --help option for usage  information
collect2: ld returned 1 exit status

The compiling is all the same as I would do it using g++. the only thing different is that I have it set to compile for windows.

Is there anything that I did wrong?
All help is appreciated :)

sentences: 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:
Cross Game Engine Compatibility - Multiple Game Engines for one Game I am new to Game Development, infact getting started with it, so reading as much as I can. I came across game engines. Now atleast I have an idea of what a game engine is, and what it does.

In order of reading about game engines, I came across various game engines - Paid, Freeware, OpenSource. Some are good for physics, some are good for loading images, some for sound. At last, it always comes to performance.

Now what comes to my mind, can I use various game engines to develop one game? I mean, one for loading graphics one for animation one for physics. Is this possible?

I know, game engine is like a CPU, and what I am talking about is using various CPUs to work on one PC.

But whatever it is, can this be done? Cross Game Engine Compatibility?

sentences:
How to extend Tiled and Cocos2d to create an Isometric map that supports elevation I've been looking and looking and looking, and I cannot seem to find a solution out there for making a game that uses cocos2d and Tiled to make an isometric map that supports elevation.

I am not looking for anything super complex...

Just maybe 2 or 3 levels of elevation. (Think X-Com UFO Defense, or Final Fantasy Tactics)

I figure that since I've been unable to find a solution, I'll probably have to extend Tiled or something to support this.

For now I'll just stick with level of elevation, but I want to extend the game to support elevation eventually.

Will you share with me any good resources that you know? Where should I read to better understand how to accomplish such a thing?

sentences:
In an XNA game object, what should I use to represent a texture for serialization? While trying to save to a file a list of objects needed to run my game, I noticed that Texture2D is not serializable. Why? What was the purpose?

The object I want to serialize looks like this:

[Serializable]
public class GameObject
{
    private Vector2 position_ = Vector2.Zero;
    private float rotation_ = 0.0f;
    private Vector2 scale_ = Vector2.One;
    private float depth_ = 0.0f;

    private Texture2D texture_;

    private bool is_passable_ = true;

    private GameObject(
        Vector2 starting_position,
        string filepath,
        ContentManager content)
    {
        this.position_ = starting_position;
        this.texture_ = Content.Load<Texture2D>(filepath);
    }

    //Properties
    //Update/Draw
}

So, what should I serialized since Texture2D isn't made to be used that way?

sentences:
In Ogre, how to get the depth buffer value? I am rendering an object to a texture using the following setup code which I copied from Ogre's rendering to texture tutorial:

Ogre::RenderTexture *renderTexture = rtt_texture->getBuffer()->getRenderTarget();

renderTexture->addViewport(myViewPoint); //the original code uses mCamera, but I want
//to render the scene from a different view point.
renderTexture->getViewport(0)->setClearEveryFrame(true);
renderTexture->getViewport(0)->setBackgroundColour(Ogre::ColourValue::Black);
renderTexture->getViewport(0)->setOverlaysEnabled(false);

Is there any way I can get the depth value at runtime as seen from myViewPoint?

I tried to use:

Ogre::GLDepthBuffer *depthBuf = renderTexture->getDepthBuffer();

but it didn't compile and the compiler says GLDepthBuffer is not a member of Ogre.

sentences:
Good ways to edit arbitrary collision shapes for 2D physics engine? Assume you have several 1024x1024 textures which contain an arbitrarily shaped and relatively complex cave system whose walls need to have collision polygons defined. The polygons need to be convex to work with the physics engine.

What kind of process and tools can you think of that would make editing the vertices of these walls as efficient and painless as possible? Especially considering that the polygons need to be convex, and the designer needs to see when that is not the case.

sentences:
How do I properly use Unreal's Lens Distortion plugin? I am trying to use UE's LensDistortion plugin (seems like it's bundled with the engine but only put to use in the Compositing sample project), and following the same workflow as the sample. Essentially, the idea is to create a camera model using the standard distortion parameters (radial, tangential etc.). The plugin then 'draws' a UV displacement map according to these params, and the original image is then distorted by adding these displacements to the corresponding pixels.

The level blueprint creates the displacement map and a material uses this to distort a given image (the distortion values are written only on the R and G channels, hence the mask in the material). Both are shown in these images:

I don't understand the output I am getting. Seems to me the material function somehow ends up addressing invalid pixel values (less than 0 or greater than 1, assuming UV range is 0-1), so I see a strange 'repeating' of the image, as below:

The way the whole canvas is distorted makes sense spatially: but the pixel values corresponding to those locations are wrong. Am I doing something wrong in my material? How do I properly use this distortion plugin?

sentences:
I want the game over screen on this super mario bros C++ remake to trigger arduino/batch file I found a someone who has listed the source code in C++ for their remake of Super Mario and I would like to know how I could edit the code for the "Game over screen" to trigger my Arduino or batch file (which ever is easier). The link to this source code is below. I'm pretty new but am every interested in getting this done. Any information would help. Thank you so much!
Github project link

sentences:
what is use of ScriptableSingleton in Unity? in unity 2020.x Unity just has introduced scriptable Singleton. a class that derives from Generic Class Called ScriptableSingleton its like singleton but you only can have single instance of it and seems to be good for ScriptableObjects that need to be Forced to be Single. but there are some differences.
they can be project Specific or Shared. they can get any format and unlike usual scriptableObjects they have no visualization in the inspector. the question is how should i use them and they are appropriate for which approaches? this is the link to the reference:
https://docs.unity3d.com/2020.1/Documentation/ScriptReference/ScriptableSingleton_1.html

sentences:
Why isn't my BoxCollider2D doing anything? I'm trying to make a speech bubble appear when you approach the tutorial board.

The bubble is there and it has its animation states "Appear" and "Disappear"

  Appear is called OnTriggerEnter2D

  Disappear is called OnTriggerExit2D

The collider is on the parent, tutorial board

The animator and script are on the bubble itself.

This is the script I have attached to the bubble, the conditions script.

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

 public class Conditions : MonoBehaviour
 {

     private Animator bubblecondition;
     private BoxCollider2D boxCollider;

     // Start is called before the first frame update
     private void Awake()
     {
         bubblecondition = this.GetComponent<Animator>();
         bubblecondition.Play("Disappear", 0, 1f);
     }
     void Start()
     {
         //bubblecondition.SetBool("Here", false);
         boxCollider = this.GetComponentInParent<BoxCollider2D>();
     }

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

     }

     public void OnTriggerEnter2D(Collider2D other)
     {
         if (other.tag == "Player")
         {
             bubblecondition.Play("Appear", 0, 0f);
         }
         else
         {
             return;
         }
     }

     public void OnTriggerExit2D(Collider2D other)
     {
         if (other.tag == "Player")
         {
             bubblecondition.Play("Disappear", 0, 0f);
         }
         else
         {
             return;
         }
     }
 }

What am I doing wrong? I spent an hour trying to know why.

  I even tried to have the console write a message on collision but it's
  just dead.
  Not only that, but I also tried to make it public and referenced it, still nothing.

Help me see my mistake :)

sentences:
Security of Unity Rpc calls Im just starting to code my game in unity and have been reading up that rpc calls are not validated and can run havoc on the server. For example a modified client can connect to your server and just disconnect everyone by sending:

networkView.RPC("disconnecteverybody", RPCMode.All);

[RPC] void disconnecteverybody () {
Network.Disconnect();
}

Is there a way to validate packets?

sentences:
Binding c++ templated functions to lua I have started using Lua as a scripting language for my game engine. It works perfectly for things like input, audio etc. However, I'm now trying to bind my entity component system functions which make heavy use of templates.

For example, getting a component of an entity in c++ would look like this:

uint32 entity = 1;
Transform &transform = registry.get<Transform>(entity);

and adding a component to an entity:

registry.add<Velocity>(entity, 0.0f, 0.0f);

From what I can tell, Lua cannot handle templated functions - I would have to bind a new function for each component e.g getTransformComponent(entity). This obviously isn't great and becomes a huge pain for the end user. I've had a look around and can't find anything that is particually helpful for my problem. I see a few people suggesting things like getComponent("Transform") but I don't see how this would be implemented in c++ as my components are PODs, no base 'Component' class?

sentences:
Will an XNA "XBox 360 Project" also work on Windows? I understand that an XNA project for XBox 360 will use a specialized version of the .NET Compact Framework.  But let's say I want to release for both XBox 360 and Windows.

Will the XBox version (using compact framework) still work if distributed for Windows, or would I need to rebuild against the regular framework (or the non-Xbox CF) in order to distribute?

sentences:
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:
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:
2D game - Missile shooting problem on Android I have to make a tank that sits still but moves his turret and shoots missiles.

As this is my first Android application ever and I haven't done any game development either, I've come across a few problems...

Now, I did the tank and the moving turret once I read the Android tutorial for the LunarLander sample code. So this code is based on the LunarLander code.

But I'm having trouble doing the missile firing then SPACE button is being pressed.

private void doDraw(Canvas canvas) {

canvas.drawBitmap(backgroundImage, 0, 0, null);
// draws the tank
canvas.drawBitmap(tank, x_tank, y_tank, new Paint());
// draws and rotates the tank turret
canvas.rotate((float) mHeading, (float) x_turret + mTurretWidth, y_turret);
canvas.drawBitmap(turret, x_turret, y_turret, new Paint());

// draws the grenade that is a regular circle  from ShapeDrawable class
bullet.setBounds(x_bullet, y_bullet, x_bullet + width, y_bullet + height);
bullet.draw(canvas);

}

UPDATE GAME method

private void updateGame() throws
 InterruptedException {

 long now = System.currentTimeMillis();

 if (mLastTime > now)  return; double
 elapsed = (now - mLastTime) / 1000.0;
 mLastTime = now;

 // dUP and dDown, rotates the turret
 from 0 to 75 degrees. if (dUp)
 mHeading += 1 * (PHYS_SLEW_SEC *
 elapsed);

 if (mHeading >= 75) mHeading = 75;

 if (dDown) mHeading += (-1) *
 (PHYS_SLEW_SEC * elapsed); if
 (mHeading < 0) mHeading = 0;

 if (dSpace){

//  missile Logic, a straight trajectorie for now
       x_bullet -= 1;
       y_bullet -= 1;

//doesn't work, has to be updated every pixel or what?

 }

boolean doKeyDown(int keyCode, KeyEvent msg) {
            boolean handled = false;
            synchronized (mSurfaceHolder) {
                if (keyCode == KeyEvent.KEYCODE_SPACE){
                    dSpace = true;
                    handled = true;
                }
                if (keyCode == KeyEvent.KEYCODE_DPAD_UP){
                    dUp = true;
                    handled = true;
                }
                if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN){
                    dDown = true;
                    handled = true;
                }
                return handled;
            }
        }

}
a method run that runs the game...

public void run() {
            while (mRun) {
                Canvas c = null;
                try {
                    c = mSurfaceHolder.lockCanvas(null);
                    synchronized (mSurfaceHolder) {
                        if (mMode == STATE_RUNNING)
                         updateGame();
                        doDraw(c);
                    }
                } catch (InterruptedException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
    } finally {
                    // do this in a finally so that if an exception is thrown
                    // during the above, we don't leave the Surface in an
                    // inconsistent state
                    if (c != null) {
                        mSurfaceHolder.unlockCanvasAndPost(c);
                    }
                }
            }
        }

So the question would be, how do I make that the bullet is fired on a single SPACE key press from the turret to the end of the screen?

Could you help me out here, I seem to be in the dark here...

Thanks,

Niksa

sentences:
Should I use an SQL database to store data in a desktop game? Developing a Game Engine

I am planning a computer game and its engine. There will be a 3 dimensional world with first person view and it will be single player for now. The programming language is C++ and it uses OpenGL.

Data Centered Design Decision

My design decision is to use a data centered architecture where there is a global event manager and a global data manager. There are many components like physics, input, sound, renderer, ai, ... Each component can trigger and listen to events. Moreover, each component can read, edit, create and remove data.

The question is about the data manager.

Whether to Use a Relational Database

Should I use a SQL Database, e.g. SQLite or MySQL, to store the game data? This contains virtually all game content like items, characters, inventories, ... Except of meshes and textures which are even more performance related, so I will keep them in memory.

Is a SQL database fast enough to use it for realtime reading and writing game informations, like the position of a moving character? I also need to care about cross-platform compatibility. Aside from keeping everything in memory, what alternatives do I have?

Advantages Would Be

The advantages of using a relational database like MySQL would be the data orientated structure which allows fast computation. I would not need objects for representing entities. I could easily query data of objects near the player needed for rendering. And I don't have to take care about data of objects far away. Moreover there would be no need for savegames since the hole game state is saved in the database. Last but not least, expanding the game to an online game would be relative easy because there already is a place where the hole game state is stored.

sentences:
Implementing a sine using a bezier curve I'm developing a 2D game using Cocos2d-x.
Is possible to use CCBezierTo to parameterize a sine function?

sentences:
Unity3d iOS build restarts when regaining focus from browser I have an app made in Unity3d for android and iOS. In it, the user has the ability to link their accounts with Facebook and Twitter. For Facebook I use their Unity plugin, for Twitter, I open an external browser page that lets them accept or decline Twitter integration that then redirects to a php page the calls the app URI to return focus to Unity.

On Android this all works perfectly using an Intent in the Manifest. In IOS I'm running into issues though and I don't really know my way around XCode.

I'm using the newest version, XCode 7 Beta 2. The App runs as expected but for both the Facebook and Twitter authentications, upon returning focus to the App from the Browser, it completely restarts the App as if just launched rather then returning from a suspended state.

In the Unity build I have "Run in Background" selected. I setup the URL Scheme in XCode. Its a pretty basic app so I don't think its being closed due to Memory usage.

Any ideas or any settings I can change in XCode that might be preventing it from resuming?

*Note, if I just hit Home and send the App to the background it will properly resume, its only when called by the URI from the browser that it seems to completely restart.

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

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

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

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

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

sentences:
Complex Game AI for Turn-based Strategy Games I'm doing some research for a turn-based Strategy game project and looking for good resources on this topic. The game is a typical war game where countries can fight each other, deploy units and have these units move around on a hexagonal tilemap, attack each other, etc.

I'm particularly interested in how the AI of Civilization V is organized! According to Wikipedia the game uses four different AI systems for different layers of the game's AI:

tactical AI controls individual units
the operational AI oversees the entire war front
the strategic AI manages the entire empire
the grand strategic AI sets long-term goals and determines how to win the game

Conceptually this looks like it makes a lot of sense to achieve a complex AI and it makes me curious to find out about how these different AI systems work (and work together). The tactical AI is probably the most easy to understand since it handles the decision-making for a single unit (move, attack, repair, retreat, etc.) but I think the other AI systems are where it really gets interesting. For example what does the operational AI do and how does it do that? I'm sure these are best-kept secrets by Firaxis Games but it would be cool to get some discussion started on this to find out more about it.

Also if anyone knows any good books that handle turn-based strategy game AI it would be great to know. Obviously this is a sparsely seeded topic on the web. I got "Programming Game AI by Example" but that book is more about single agent behavior AI than high-level goal-oriented AI.

sentences:
How do I reference a particular UI Image or Sprite in my assets folder? I have an Item class, and I want to associate an Image class with it. How do I get a reference to the intended Image, from my assets folder, in order to provide it as a reference to a constructor for Item?

Here is my code:

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

public class ItemData : MonoBehaviour
{
    private List<Item> items;

    void Start()
    {
        items = new List<Item>();

        Item sword = new Item(0, "Sword", /*What goes here?*/);
        items.Add(sword);

        Item hammer = new Item(0, "Hammer", /*What goes here?*/);
        items.Add(hammer);
    }
}

public class Item
{
    public int itemID;
    public string itemName;
    public Image itemImage;

    public Item(int newItemID, string newItemName, Image newItemImage)
    {
        itemID = newItemID;
        itemName = newItemName;
        itemImage = newItemImage;
    }
}

sentences: Integrating the Steamworks API achievements into your game I'm coding a game in Visual Studio 2015 and am wondering how to go about adding steam achievements to it using the Steamworks API, do I need to have my game on steam before hand or if not what's the process of adding achievements?

sentences:
Unity material is missing after compilation I have a piece of code that signals the player that a projectile has hit its target. Everything works fine during the playmode, however after I compile it, it acts as if there was a missing material.

I did some trouble shooting, made 3 different builds with different settings, and I tried running the game with different quality, ranging from Fastest to Fantastic. Yet I can't find a cause of this problem.

IEnumerator flash() {
        rend.material.shader = specularShader;
        yield return new WaitForSeconds(flashTime);
        rend.material.shader = defaultShader;

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

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

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

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

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

sentences:
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:
Unity: Player Gets Stuck Between Tiles I am creating an endless game, which constantly spawns tiles. The problem is that after a few tiles the player gets stuck on random tile and stops moving. I noticed this problem even when i was designing a level, where when I align two tiles side by side, the player gets stuck on the junction of these two tiles. I am including a video link to my problem. Please help me and please try to be in detail because i very very new to Unity.

Video for the problem im facing.
https://photos.app.goo.gl/JrCPWkGclUA2UiMy1

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

public class TileManager : MonoBehaviour {

public GameObject[] tiles;
private Transform player;
private float SpawnLocationZ = -30.0f;
private float tileLength = 36;
private float amountOfTilesOnScreen = 5;
private float SafeZone = 45;
private List<GameObject> activeTiles;
private int lastPrefabIndex = 0;
private bool StartCompleted = false;
// Use this for initialization
void Start () {
    activeTiles = new List<GameObject>();
    player = GameObject.FindGameObjectWithTag("Player").transform;
    for(int i =0; i<amountOfTilesOnScreen; i++){
        Debug.Log("Start Method");
        SpawnTile(-1);
    }

}

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

    if((player.transform.position.z -SafeZone > (SpawnLocationZ - amountOfTilesOnScreen * tileLength))){
        Debug.Log("started");
        SpawnTile(0);
        DeleteTile();
    }
}

void SpawnTile( int prefabIndex){
    if(prefabIndex == -1){
        GameObject gor;
        gor = Instantiate(tiles[0]) as GameObject;
        gor.transform.SetParent(transform);
        gor.transform.position = Vector3.forward * SpawnLocationZ;
        SpawnLocationZ += tileLength;
        activeTiles.Add(gor);
    }else{
    GameObject go;
    go = Instantiate(tiles[Randome()]) as GameObject;
    go.transform.SetParent(transform);
    go.transform.position = Vector3.forward * SpawnLocationZ;
    SpawnLocationZ += tileLength;
    activeTiles.Add(go);
    }
}

void DeleteTile(){
    Destroy(activeTiles[0]);
    activeTiles.RemoveAt(0);
}

private int Randome(){
    if(tiles.Length <=1){
        return 0;
    }
    int randomIndex = lastPrefabIndex;
    while(randomIndex == lastPrefabIndex){
        randomIndex = Random.Range(0, tiles.Length);
    }
    lastPrefabIndex = randomIndex;
    return randomIndex;
}
 }

sentences:
How to know the point of collision with another object in Unity5 I have a small problem and it would be very helpful, which could guide me. What happens is the following, I have an enemy (evil usb) in my scene, to the collisionar this enemy with my main player threw the enemy always right falling down the map. All right up here, what I need now is to know that exact point I'm colliding my enemy to know if I should throw it to the right or left depending on the point of collision which can be at the Centre to the right or to the left of my enemy like this imagen:

I read something about contact point, but can not understand how it works and really serves me, here is the code that I have to collision and throw it to the right:

void OnCollisionEnter(Collision other){

    if (other.gameObject.CompareTag ("Inacapin")) {
       enemyrigid.AddForce (-transform.right * 500, ForceMode.Acceleration); // work fine

      /*if(point of collision right){ // I need something like that

            enemyrigid.AddForce(-transform.right * 500, ForceMode.Acceleration);

         }else if(point of collision left){
            enemyrigid.AddForce(-transform.left* 500, ForceMode.Acceleration);
            }else{
             enemyrigid.AddForce(transform.forward* 500, ForceMode.Acceleration);
          }

     }

  }

hope they can help me, thank you... ;)

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:
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:
Portal 2 mapping dimensions and measurments I am wanting to start building a portal 2 map for single player mode.

I have used the hammer world editor before but not for portal.

As far as portals are concerned will the distance I drop vertically be equal to the distance I am thrown horizontally?

So a 16 unit drop throws me 16 units forward?

sentences:
How can I get textures on edge of walls like in Super Metroid and Aquaria? Games like Super Metroid and Aquaria present the terrain with the other facing parts having rocks and stuff while deeper behind them (i.e. underground) there's different detail or just black.

I would like to do something similar using polygons. Terrain is created in my current level as a set of overlapping square boxes. I'm not sure if this rendering method will work such a system for creating terrain but if anyone has ideas I'd love to hear them. Otherwise I'd like to know how I should re-write the terrain rendering system so it actually works to draw terrain in this manner...

sentences: On Android, why would you handle expansion files yourself instead of using Google Play? Why aren't all Android games using Google Play's ability to serve their expansion files? Why some are handling it themselves inside their apps?

sentences:
How can I draw a line rotated some number of degrees away from an original line? I have a line ahead of my moving object to serve as a raycast and its aligned with the object's movement direction. But I want also some extra lines according to an angle related to the 'head' of the moving object.

This position is always changing; I also have a velocity vector to see the direction of the object as well, I use that to trace the front line ray of my object but not sure how to use to calculate this new line.

In this picture, my object is moving to the right and up. I want to trace a new line but 30 degrees from this one. How do I do that?

sentences:
Why is xcode not letting me use my static variable? I'm pretty sure I'm making some stupid mistake.
Can't seem to find it, and no good results when googling it either.

When I run my SDL project I get these errors :

  Undefined symbols for architecture x86_64:   "Input::evnt", referenced
  from:
        Input::ProcessInput() in Input.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code
  1 (use -v to see invocation)

I know these are the lines that are causing the error :

switch (evnt->type)
{
    case SDL_KEYDOWN:
        std::cout << "Key pressed" << std::endl;
        break;

}

I know it's not the "contains" of the while loop, but the while loop itself.

This is what my evnt variable looks like :

static SDL_Event* evnt;

Not sure what I'm doing wrong....

sentences:
How to change mute/unmute button? I'm saving music in libgdx preference, the following code works perfectly but if you enter the settings again you'd see the initial button up regardless if the sound is muted or not.

TextureAtlas buttonsAtlas = new TextureAtlas("ui/dialogButtons.pack");
textButtonStyle.up = skin.getDrawable("music.down");
textButtonStyle.checked = skin.getDrawable("muteMusic.up");
button.addListener(new InputListener() {
 public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
  return true;
 }
 public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
  setMusicplaying(!musicplaying);
  if (getMusicplaying() == false)
   playMusic.stop();
  else playMusic.play();
 }
});

I tried to do this, it works perfecly but doesn't switch the button, when the user is clicking on it, it only switches when the user closes the dialog

if (getMusicplaying() == true) {
textButtonStyle.up = skin.getDrawable("music.down");
textButtonStyle.down = skin.getDrawable("muteMusic.up");}
if (getMusicplaying() == false) {
  textButtonStyle.up = skin.getDrawable("muteMusic.up");
  textButtonStyle.down = skin.getDrawable("music.down");}

sentences:
How to create a 2D overlay over a 3D game? (LWJGL/OpenGL) GameDev!

I would like to create a 2D overlay over a 3D world, using LWJGL (Java version of OpenGL), to show information to the player, for example, a chat box, health bar, selected cannonball type, etc.

Currently the code I have is this (Taken from several sources on the internet):

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        glEnable(GL_BLEND);
        GL11.glMatrixMode(GL11.GL_PROJECTION);
        GL11.glLoadIdentity();
        glOrtho(0.0f, Display.getWidth(), Display.getHeight(), 0.0f, 0.0f, 1.0f);
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glLoadIdentity();
        glDisable(GL_DEPTH_TEST);
        glDisable(GL_CULL_FACE);
        glDisable(GL_TEXTURE_2D);
        glDisable(GL_LIGHTING);
        glDisable(GL_DEPTH_TEST);
        glDisable(GL_CULL_FACE);
        glDisable(GL_BLEND);
        glDisable(GL_TEXTURE_2D);
        glDisable(GL_LIGHTING);
            glBegin(GL_QUADS);
            glColor3f(1, 1, 1);
            glVertex2f(0, 0);
            glVertex2f(1, 1);
            glVertex2f(1, 0);
            glVertex2f(0, 1);
            glEnd();
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glLoadIdentity();
            glPopMatrix();
        glEnable(GL_DEPTH_TEST);
        glEnable(GL_CULL_FACE);
        glEnable(GL_BLEND);
        glEnable(GL_TEXTURE_2D);
        glEnable(GL_LIGHTING);
             glEnable(GL_DEPTH_TEST);
                glEnable(GL_CULL_FACE);
                glEnable(GL_TEXTURE_2D);
                glEnable(GL_LIGHTING);
             glDisable(GL_BLEND);
                GL11.glMatrixMode(GL11.GL_PROJECTION);
                GL11.glLoadIdentity(); // Reset The Projection Matrix
                GLU.gluPerspective(45.0f, ((float) Display.getWidth() / (float) Display.getHeight()), 0.1f, 5000.0f); // Calculate The Aspect Ratio Of The Window

                GL11.glMatrixMode(GL11.GL_MODELVIEW);
                glLoadIdentity();

However this does not show a 2D scene at all!

I would appreciate it if anybody could help me.

Thanks!

sentences:
UE4.23 - Cast of child of GameUserSettings fails I've derived GameUserSettings to add a bunch of custom properties to it. I tried making accessible in blueprint by creating a static method that returns the current GameUserSettings cast to my Child Class.

 Custom_Settings * Custom_Settings::GetCustom_Settings() {
     return Cast<Custom_Settings>(GEngine->GameUserSettings);
 }

Unforunately, the cast fails and returns null, which leads to UE complaining about trying to access none in blueprint (naturally). There was a similar question here, but that led me nowhere, since I've already set DefaultEngine.ini to use my custom settings

 [/Script/Engine.Engine]
 GameUserSettingsClassName=/Script/MyGame.Custom_Settings

I've checked whether GEngine can fetch the Settings, and it appears it can. Does anybody have an idea why the cast might be failing?

sentences: 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:
glGetFloatv – should it be avoided? Can it be replaced? Platform is OpenGL ES 1.x. I am using glGetFloatv() to get MODELVIEW matrix. This allows me to compute points, where I need to draw a shadow effect. This is very handy, as I can forget about complexity of scene (its translations, rotations, etc.) – and by simple 3x1 matrix multiplication get the points.

But here it is stated that the call should be avoided. Is it correct recommendation? Can be glGetFloatv() omitted?

sentences:
Using Minimum Translation Vector in SAT algorithm I am working on a simple rigid-body physics engine ,I've already implemented SAT algorithm for collision detection and everything works fine, Now i get to step to use MTV to calculate the distance which objects might move to,
In my case the two objects are cubes ,Actually i am a little confused about the distance and how to use it

Here is the two cubes

Both of them are on the same y-axis and z-axis, Only differs in x-axis

I am calculating MTV and i get:

samllest which refers to the smallest axis, So it looks like (x,y,z).

overlapDistance which refers to the smallest overlap distance as a double variable.

I know that overlapDistance is the distance that one of two cubes should move till no collision

But how to use it , How cubes should respond to this distance ?

Sorry if i am not clear, but for summary i know the smallest overlap distance but i don't know how to get use of it

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:
mat3x4 in webGL shaders I am porting the IQM bone animation format to Javascript and have run into a problem...

The vertex shader is failing to compile and the only error message I get out is 'mat3x4' : syntax error on the first occurance of mat3x4 in the file.  Its the very data-type name itself that is unsupported, it seems.

This happens on all machines I have access to for testing, which have a variety of Intel and ATI cards and run Linux with Firefox.  (Chrome is not available.)

If I change all mat3x4 to, say, mat3 then my shader compiles fine.

does webGL support mat3x4?  (I can find nothing via Google)
how can I work around this?  How can I package the bones into mat4, for example, and keep the code working correctly?

sentences:
In unity how can I make a checkpoint system I have a 2D platformer and if my player dies, he goes back to the start, but I want there to be checkpoints.
My current Respawn script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Respawn : MonoBehaviour
{
    public GameObject PlayerPrefab;
    public Transform SpawnPoint;

    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.tag == "Trap")
        {
            PlayerPrefab.transform.position = SpawnPoint.transform.position;
        }
    }

}

I don't know how to implement checkpoints into this.

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:
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:
pixel art tree using 3/4 perspective Is there a correct way to calculate the exact proportions for drawing a tree sprite for an RPG. These are the types of trees I am aiming to create(sorry for the huge picture, I dont how to scale it down):

The tutorial here, http://cyangmou.deviantart.com/art/Pixel-Art-Tutorial-3-The-perfect-crate-311089437, perfectly describes how to create an object using the 3/4 perspective but when I apply this method when drawing a tree it doesn't quite work. Is there a different method that I could use for creating non-rectangle shaped objects like a tree or other strangely shaped objects, or am I going about it wrong?

Thank you in advance :D.

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 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:
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:
change sprite color from properties of parent object in inspector I have a compound GameObject that is made up of 5 sprites name dot1 till 5.
I'd like to have a little script on the parent object that would allow me to change the colours of the child objects from the unity inspector. I want the colours to change directly in my scene without having to press play. This already happens when I would set the colours directly from the child objects. But I'd like to have the properties visible in my main object and set the colours from there.

So far I'm unable to make the changes visible in scene mode.

    [ExecuteInEditMode]

public class Chain : MonoBehaviour {

    public GameObject dot1;
    public GameObject dot2;
    public GameObject dot3;
    public GameObject dot4;
    public GameObject dot5;

    public Color Color1;
    public Color Color2;
    public Color Color3;
    public Color Color4;
    public Color Color5;

    void Start () {
    dot1.renderer.sharedMaterial.color = Color1;
    dot2.renderer.sharedMaterial.color = Color2;
    dot3.renderer.sharedMaterial.color = Color3;
    dot4.renderer.sharedMaterial.color = Color4;
    dot5.renderer.sharedMaterial.color = Color5;
    }

    void Update () {

    }
}

sentences:
How to encapsulate game objects (entities) in Box2d I am currently learning Box2d, a 2D physics engine within libgdx. But Box2d seems to be in every game framework these days so I am not really talking about libgdx.

I understand Box2d comes with lots of new concepts such as shape, bodydef, body, fixture, sprite, joint. But I think I can slowly but surely manage to learn about them.

My question, however, is how to organize them into a game object for better maintenance of code. Naturally, I am thinking about following fields in the game object class.

GameArea gameArea
Body body
BodyDef bodyDef;
FixtureDef fixtureDef
Shape shape;
Sprite sprite;

As for its methods, it has constructor, update, and display. But I am talking without experience. For example, I don't know how I can organize joints - maybe in GameArea. Any thought from experienced would be appreciated.

sentences:
NGUI UIInput - Reset value of password field How do I reset the value of a NGUI UIInput control that marked Is Password. If I set .text to "" I still see a bunch of ********** rather than the .defaultText.

Basically if the user types the wrong password during login, I want to clear the field and have is display the default text again.

Update

If I click into the field and back out, the default text shows, but until I do that I get the **********.

Code:

// Show the Create dialog
public void ShowCreate() {
    panelWait.gameObject.SetActive(false);
    panelLogin.gameObject.SetActive(false);
    panelCreate.gameObject.SetActive(true);

    username = loginUsername.text;
    createUsername.text = username;
    createPasswordA.text = "";
    createPasswordB.text = "";
}

Image:

sentences:
Inventory management syncronized network I'm implementing an inventory system with items in 1x1 slots in a open-world multiplayer game. But I can't decide how I want to synchronize the item management with the server. I see two options here.

Server and client are fully synced after every move.
Synchronize every action the player takes in their inventory, even the action of "lifting" items.
Server only syncs "when neccessary" An unordered list on the server keeeping track of WHAT items the player has and not WHERE (in what slot) they are. Then every time the player drops/uses/acquires or stacks/unstacks an item the client syncs their inventory including slot positions with the server.

Is there perhaps another option that's even better?

sentences:
How can I visually see changes made to a scene since the last git commit I'd like to see the changes made in a scene (.unity file) before I commit them to git.

I have looked into several GIT/Unity solutions but all of them are made for merging changes and not for showing a diff with last version.

The problem with scene files is that they use GUIDs that point to other assets and when I open a diff for a scene file I can't really make anything out of it.

For example:

Instead, I'd like to see something like this:

Is there anything existing that does this?

sentences:
How can I give the illusion of height to a ball in 2D? In 2D top down soccer games, sometimes a ball is given the illusion of being in the air, like below:

How can I achieve this?

sentences:
Java application chokes - when using MySQL If I use localhost - XAMPP, my application runs without problems.
Once I try to use real MySQL databases: db4free.net, freedb.tech.
Applications begins to choke and freezing, resulting it is nearly impossible to use.
If I choose to use paid MySQL database, will it solve problem?
public static void scanningPlayers ()
{
    updatePlayers.setNode( GameGroups.finalRoot); // does'nt matter node.
    updatePlayers.setDuration(Duration.millis(1000));
    updatePlayers.play();
    updatePlayers.setOnFinished(evt ->
    {
        GameGroups.rootPlayers.getChildren().clear();

        try
        {
            Statement stmt      = Credentials.conn.createStatement();
            ResultSet users     = stmt.executeQuery("select id, name, avatar, Xpos, Ypos from users");

            while ( users.next() )
            {
                Label playerName            = Default.Label17Light  ( "" + users.getString("name"), users.getInt("Xpos"), users.getInt("Ypos") - 25 );
                ImageView hero;

                hero            = Default.ImageView( Dir.adventure + users.getString("avatar") + ".png", users.getInt("Xpos"), users.getInt("Ypos") );

                GameGroups.rootPlayers.getChildren().addAll ( playerName, hero );

                if ( users.getInt("id") == Variables.id )
                { //identify mysel, used for centering n door.
                    Variables.Xpos = users.getInt("Xpos");
                    Variables.Ypos = users.getInt("Ypos");
                    Variables.myAvatar = hero;

                    GameGroups.rootUniverse.setTranslateX ( -Variables.Xpos  + 550);
                    GameGroups.rootUniverse.setTranslateY ( -Variables.Ypos  + 362);
                }
            }
        } catch (SQLException e) {e.printStackTrace(); }

        updatePlayers.play();
    });
}

sentences:
How do I make my character jump in any angle? My character is a square which can spin in any angle but it can not jump in certain angle.

Can anyone help?

public class Player: MonoBehaviour {

  public float maxspeed = 10f;
  bool facingRight = true;

  Animator anim;

  bool grounded = false;
  public Transform groundCheck;
  float groundRadius = 0.2f;
  public LayerMask whatIsGround;
  public float jumpFocre = 500f;

  bool doubleJump = false;

  void Start ()
  {
    anim = GetComponent<Animator> ();
  }

  void FixedUpdate () {
    grounded = Physics2D.OverlapCircle(groundCheck.position, groundRadius, whatIsGround);
    anim.SetBool ("Ground", grounded);

    if (grounded)
      doubleJump = false;

    float move = Input.GetAxis ("Horizontal");
    anim.SetFloat ("Speed", Mathf.Abs (move));

    GetComponent<Rigidbody2D>().velocity = new Vector2(move * maxspeed, GetComponent<Rigidbody2D>().velocity.y);
  }

  void Update()
  {
    if((grounded || !doubleJump) && Input.GetKeyDown ("up"))
    {
      anim.SetBool("Ground", false);
      GetComponent<Rigidbody2D>().AddForce(new Vector2(0, jumpFocre));

      if(!doubleJump && !grounded)
        doubleJump = true;
    }
  }

  void Flip()
  {
    facingRight = !facingRight;
    Vector3 theScale = transform.localScale;
    theScale.x *= -1;
    transform.localScale = theScale;
  }
}

sentences:
Quad Tree with a lot of Moving Objects I have a Quad Tree implementation that is very useful for what I am trying to do.  My problem is that when my viewport has a lot of objects, the Update for the Quad Tree takes a very long time.

It is a known fact that Quad Trees are slow for non-static objects.  I tried a few methods to try to speed things up, but the fact is, I need to update a large number of objects very often.

Is there a better algorithm I should be looking at instead?  Are there some derived Quad Tree implementations you know about that might be useful to me?

sentences:
What is the mathematical explanation behind this implementation of simulating eyeballs roll in eyes? I want to simulate eyeballs roll in eyes and I have found and forked this implementation in codepen.io. This is exactly what I need.

var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
var border = 10;
var centerX = c.width / 2;
var centerY = c.height / 2;
var radius = 40;

var radiusEye = 12;

var faceCenterX = centerX;
var faceCenterY = border+radius + 60;

var radiusEyeIn = 6;

var eyeYPosition = faceCenterY-8

var reyedx = faceCenterX+(radiusEyeIn/2)+13;
var reyedy = eyeYPosition;

var leyedx = faceCenterX-(radiusEyeIn/2)-13;
var leyedy = eyeYPosition;

var eyesgap = 4;

var eyeXGap = (radiusEye/2)+9;

var reyedxafter = reyedx;
var reyedyafter = reyedy;

var leyedxafter = leyedx;
var leyedyafter = leyedy;

function drawscreen(){

  ctx.beginPath();
  ctx.arc(faceCenterX, faceCenterY, radius, 0, 2 * Math.PI, false);
  ctx.fillStyle = 'rgba(100,100,100,0.5)';
  ctx.fill();
  ctx.stroke();

  var radiusEye = 12;
  ctx.beginPath();
  ctx.arc(faceCenterX-eyeXGap, eyeYPosition, radiusEye, 0, 2 * Math.PI, false);
  ctx.fillStyle = 'rgba(255,255,255,1)';
  ctx.fill();
  ctx.stroke();

  ctx.beginPath();
  ctx.arc(faceCenterX+eyeXGap, eyeYPosition, radiusEye, 0, 2 * Math.PI, false);
  ctx.fillStyle = 'rgba(255,255,255,1)';
  ctx.fill();
  ctx.stroke();
}

function draweyes() {

  ctx.beginPath();
  ctx.arc(reyedxafter, reyedyafter, radiusEyeIn, 0, 2 * Math.PI, false);
  ctx.fillStyle = 'rgba(0,0,0,1)';
  ctx.fill();

  ctx.beginPath();
  ctx.arc(leyedxafter, leyedyafter, radiusEyeIn, 0, 2 * Math.PI, false);
  ctx.fillStyle = 'rgba(0,0,0,1)';
  ctx.fill();
}

//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

function mouseMove(e) {
        var mouseX = e.pageX - this.offsetLeft - faceCenterX;
        var mouseY = e.pageY - this.offsetTop - eyeYPosition;

        var ratioX = Math.abs(mouseX)/(Math.abs(mouseX)+Math.abs(mouseY));
        var ratioY = Math.abs(mouseY)/(Math.abs(mouseX)+Math.abs(mouseY));

        if(mouseX > 0){
          reyedxafter = reyedx + (ratioX*eyesgap);
        } else {
          reyedxafter = reyedx - (ratioX*eyesgap);
        }

        if(mouseY > 0){
          reyedyafter = reyedy + (ratioY*eyesgap);
        } else {
          reyedyafter = reyedy - (ratioY*eyesgap);
        }

        if(mouseX > 0){
          leyedxafter = leyedx + (ratioX*eyesgap);
        } else {
          leyedxafter = leyedx - (ratioX*eyesgap);
        }

        if(mouseY > 0){
          leyedyafter = leyedy + (ratioY*eyesgap);
        } else {
          leyedyafter = leyedy - (ratioY*eyesgap);
        }

        ctx.clearRect(0, 0, c.width, c.height);
        drawscreen();
        draweyes();
}

function init() {
    //c.addEventListener('mousedown', mouseDown, false);
   // c.addEventListener('mouseup', mouseUp, false);
    c.addEventListener('mousemove', mouseMove, false);
    drawscreen();
    draweyes();
}

init();
<canvas id="myCanvas" width="500" height="400" style="border:1px solid #000000;">
</canvas>

I can just use this one but I don't understand the mathematical explanation behind this solution. I can only think of limiting the movement of the eyeballs in the eyes. Why do I have to do it like this one? What is the purpose of calculating ratioX and ratioY? Is there a simpler way to do similar simulation?

sentences:
Replace a div (with a ball picture in it) with a 3D canvas ball I am trying to make a game where you have to keep the ball on a green platform. At this point the ball is a div with a ball image. You can move the ball over the field, all works great.

See it in action here (click the 1 first).

When you use your arrow keys you can move the ball (actually you move a div). This looks kinda fake, so I want to use a real 3D canvas ball for this. I saw a nice example here. (scroll down half way to the page. You will see a smiley with a ball in it just above the title: Smoothing it out)

So how can I use this ball into my game? I have the following code for the ball:

  // build the ball and draw its texture with a 2d canvas -------------------------------------------
  var buildBall = function() {
    // create a canvas to draw the ball's texture
    var ballCanvas = document.createElement('canvas');
    ballCanvas.width = 64;
    ballCanvas.height = 64;
    var ballContext = ballCanvas.getContext('2d');

    // draw 2 colored halves of the 2d canvas
    ballContext.fillStyle = "#f8ae44";
    ballContext.fillRect(0, 0, ballCanvas.width, ballCanvas.height/2);
    ballContext.fillStyle = "#ffda4e";
    ballContext.fillRect(0, ballCanvas.height/2, ballCanvas.width, ballCanvas.height/2);

    // create the THREE texture object with our canvas
    var ballTexture = new THREE.Texture( ballCanvas );
    ballTexture.needsUpdate = true;

    // create the physijs-enabled material with some decent friction & bounce properties
    var ballMaterial = Physijs.createMaterial(
      new THREE.MeshLambertMaterial({
        map: ballTexture,
        shininess: 10,
        color: 0xdddddd,
        emissive: 0x111111,
        side: THREE.FrontSide
      }),
      .6, // mid friction
      .5 // mid restitution
    );
    ballMaterial.map.wrapS = ballMaterial.map.wrapT = THREE.RepeatWrapping;
    ballMaterial.map.repeat.set( 1, 1 );

    //THIS PART IS FOR QUESTION 2
    // create the physics-enabled sphere mesh, and start it up in the air
    ball = new Physijs.SphereMesh(
      new THREE.SphereGeometry( 30, 32, 32 ),
      ballMaterial,
      100
    );
    ball.position.y = 500;
    ball.receiveShadow = true;
    ball.castShadow = true;
    scene.add( ball );
  };

I know I have to implement three.js to make this work, but how can I get the div replaced with this 3D canvas ball keeping everything else working as is (using arrows to move, move speed of the ball, reset when fallen of the platform etc)?

sentences:
How to avoid game starting before start button is clicked? I've made a game with a Title Screen (Canvas), and a Start Button attached to the Title Screen. Points, GameOver, Restart, and even the Start Button sort of works, but it's possible to play the game before the user presses start.

Is there a way to make the GameObjects only appear after the button is clicked? I've tried to move and change the "public void StartGame()", but I can't get it right.

This is my first game ever, so hope the code provided is relevant.

Enemy.cs

 void Start()
{
        enemyRb = GetComponent<Rigidbody>();
        gameManager = GameObject.Find("GameManager").GetComponent<GameManager>();
        player = GameObject.Find("Player");
}

GameManager.cs

 public void StartGame()
{
    powerup.transform.rotation);
    score = 0;
    UpdateScore(0);
    isGameActive = true;
    titleScreen.gameObject.SetActive(false);
}

void Update()
{
    enemyCount = FindObjectsOfType<Enemy>().Length;

    if (enemyCount == 0)
    {
        roundNumber++;
        SpawnEnemyIntruders(roundNumber);
        Instantiate(powerup, GenerateSpawnPosition(), powerup.transform.rotation);
    }
}

void SpawnEnemyIntruders(int enemiesToSpawn)

{
  for (int i = 0; i < enemiesToSpawn; i++)
  {
      int enemyIndex = Random.Range(0, enemies.Length);
      Instantiate(enemies[enemyIndex], GenerateSpawnPosition(), enemies[enemyIndex].gameObject.transform.rotation);
  }
}
public void GameOver()
{
    restartButton.gameObject.SetActive(true);
    gameOverText.gameObject.SetActive(true);
    isGameActive = false;
}

PlayerController.cs

    void Start()
{
    playerRb = GetComponent<Rigidbody>();
    playerAudio = GetComponent<AudioSource>();
}

StartButton.cs

    void Start()
{
    button = GetComponent<Button>();
    gameManager = GameObject.Find("GameManager").GetComponent<GameManager>();
    button.onClick.AddListener(StartThis);
}

sentences:
Unity 3d 4 players Only 4 buttons can be pressed at a time Only 4 buttons can be pressed at a time, so players cant move sometimes

Each Player Has their own Controls

i Change, Up Arrow and the other ones for each player---v

InputsV-V-V

public string UpArrow;
public string DownArrow;
public string LeftArrow;
public string RightArrow;

    if(Input.GetButton(UpArrow))
        transform.Translate(Vector3.forward * moveSpeed * Time.deltaTime);

    if(Input.GetButton(DownArrow))
        transform.Translate(-Vector3.forward * moveSpeed * Time.deltaTime);

    if(Input.GetButton(LeftArrow))
        transform.Rotate(Vector3.up, -turnSpeed * Time.deltaTime);

    if(Input.GetButton(RightArrow))
        transform.Rotate(Vector3.up, turnSpeed * Time.deltaTime);

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:
Infinite scroll with tweens in Phaser Let's say you have a bunch of tweens running like this:

http://holbrook.no/tests/featherfall.html

Now you want to scroll them horizontally while they fall. By updating camera x, they start moving, but in the end, the camera x value will overflow. And besides, one might want to wrap some background graphics before then.

Therefore we need to periodically snap the camera back to the original position. But then the tweens will snap back too.

So the individual sprites need a transform value on top of the current tween position to correct for the camera repositioning.

I haven't found any setting in Phaser for this. Any ideas?

EDIT:

It's possible to work around it with keeping a global variable to keep track of the camera yanking, and adding it manually to the onUpdateCallback of the tween, and consolidating the difference with the next tween change. But the hack seems to be glitching sometimes, and I suspect it's slower than if an internal transform variable could be used. Anyway, here's the result:

http://holbrook.no/tests/featherfallscrolled.html

sentences:
3D models overlapping each other I have a problem at the moment when I draw some models to teach me more about 3D game programming. The models at the moment overlaps each other from some angles witch makes sense since the game at the moment draws from left to right, line after line.

However my question is: Is there any easy escape from this issue or is there any way that you could draw the in-game world from the players position?

I would really appreciate if someone could give me some answers on this.

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:
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: What's a simple way to send statistics from my game back to me? For example, I set up my game to keep track of how many times people play x, y, and z game modes, and also to keep track of how often players reach a certain point. What's a simple way to send this data to me so that I can see it?

sentences:
Making a parenting system Each Entity can have one parent and any number of children. They have a position vector and a quaternion orientation.

I know that I can make objects look like they're in a hierarchy by multiplying parent transforms all the way to the root, but how to I get the canonical coordinates out of those transformations? I need to have the real position of every Entity in the world in order to update their bounding meshes.

I would like to keep my drawing code for everything as just this:

XMMATRIX transform = XMMatrixRotationQuaternion(orientation);
transform = XMMatrixMultiply(transform, XMMatrixTranslation(position));
transform = XMMatrixMultiply(world, transform);
model->Draw(context, *states, transform, view, projection);

Eg. without relying on visual tricks to get the hierarchy looking right, so no multiplications with parent transforms while rendering.

How do I properly change a child's position and orientation with respect to the parent?

sentences:
3D isometric depth sorting How is it possible to depth sort tiles and objects in an isometric environments without any limitations? I've been researching this for a while now and there seems to be no publicly available answers to this question.

There are two obvious options for depth-sorting when doing isometric environments:

Draw all tiles from screen top to screen bottom, followed by all objects from screen top to screen bottom
Draw each tile and then each object on that tile from screen top to screen bottom

The limitations with number 1 is that tiles cant have different heights because objects will always appear on top of the tiles. Screenshot example:

The limitations with number 2 is that objects can't move between tiles on the x-axis without the tile below overlapping it (because it's drawn later). I've grabbed a screenshot to exemplify this:

I've read lots on bubble sorting and other algorithms, but none of them seem to take this into account, or if they do, they don't document how.

(Please not before answering, this is NOT about how to sort objects that are larger than 1 tile, I'm more than happy with slicing them up so they fit into a tile)

sentences:
What is the differencen between ccTouchesEnded and ccTouchEnded I'm learning cocos2d-x. Following the tutorial I found that ccTouchesEnded works perfectly in linux (and windows) but when I replace by ccTouchEnded the event isn't detected anymore.

What are differences between this two functions? And why one is detected and the other isn't.

Taking the HelloWorld project sample as a base, I add the following lines in init()

this->setTouchEnabled(true);
this->schedule(schedule_selector(HelloWorld::updateGame));

Also, add this method to my code:

void HelloWorld::registerWithTouchDispatcher()
{
    // TouchDispatcher::sharedDispatcher()->addTargetedDelegate(this,0,true);
    Director::getInstance()->getTouchDispatcher()->addStandardDelegate(this,0);
}

Then if I add ccTouchesEnded like this:

void HelloWorld::ccTouchesEnded(Set* touches, Event* event)
{
    // Choose one of the touches to work with
    Touch* touch = static_cast<Touch*>( touches->anyObject() );
    Point location = touch->getLocation();

    log("++++++++after  x:%f, y:%f", location.x, location.y);
}

it works perfectly but if I use ccTouchEnded as:

void HelloWorld::ccTouchEnded(Touch* touch, Event* event)
{
    Point location = touch->getLocation();

    log("++++++++after  x:%f, y:%f", location.x, location.y);
}

The events aren't fired.

Any help is welcome
Thanks!!

sentences:
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: Lightmap not working? So I've been exporting and re-exporting my mesh from Blender and importing it into UE4 over and over again. For some reason, even after I've generated the light map in Blender, renamed both UV maps, re-applied the UV maps, baked the textures, then changed the Light Map resolution in UE4 to 512, the Light Map Coordinate to 1, and built the lighting, my mesh is still black and I can't figure out why since I've tried literally everything I could find in my research. In the image below, the left mesh is what it's supposed to look like, and the right mesh is what it looks like after building the lighting. Please help me with this, thank you.

sentences:
Physics.CheckSphere() appears not to work in Unity My scene is simple, I have a single GameObject with the following script attached:
usings ...

public class GalaxyManager: MonoBehaviour
{
    public int numberOfStars = 300;
    public int maximumRadius = 100;

    public float minDistBetweenStars = 2f;

    void Start()
    {
        for (int i = 0; i < numberOfStars; i++)
        {
            float distance = UnityEngine.Random.Range(0, maximumRadius);
            float angle = UnityEngine.Random.Range(0, 2 * Mathf.PI);

            Vector3 cartPosition = new Vector3(distance * Mathf.Cos(angle), 0, distance * Mathf.Sin(angle));

            if (!Physics.CheckSphere(cartPosition, minDistBetweenStars))
            {
                GameObject star = GameObject.CreatePrimitive(PrimitiveType.Sphere);
                star.transform.position = cartPosition;
            }
            else
            {
                i--;
            }
        }
    }

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

    }
}

What this is supposed to do is generate 300 "stars" within the maximumRadius of 100 that are separated by at least minDistBetweenStars.
I haven't been able to figure out what's actually happening -- sometimes the check finds a collider and sometimes it doesn't.  It's almost as if the CheckSphere() check is happening before the stars get placed via the star.transform.position = cartPosition.
I'm very new to Unity and appreciate the help.  Anyone have any idea what's going on?
*edit:
Some more information, I've tried the script in both 2020.1.12f1 and 2019.4.14f1 to no avail.
I'm also aware that this will lead to an infinite loop if it can't find a placement.

sentences: Calculate angles between two other angles I am trying to implement a FOV for my light casting algorithm. In the diagram below each white line represents a ray cast from a std::vector<float> of normalized radians. How can I only include angles which lie between the two green lines? (The FOV min and max).

sentences:
Mirroring a game object to create symmetry I have a GameObject with a primitive shape that I call "body". I want to create and add a child to it with another primitive shape. I call it 'mutation'. But i want to duplicate the 'mutation' and mirror the duplicate. So they become symmetrical to the 'body'. This way it could resemble wings or legs or eyes.

I've tried to create two children to the mutation called "LeftSide" and "RightSide". I duplicated the new primitive and put one copy in each. I set the Left Side's scale to -1 for the X, Y and Z hoping that it would mirror and create a symmetry with the right side. But its not working out.

So I'm hoping for some tips on ideas on how to achieve this?

sentences:
Cross-Sections of 3D Rendered Objects I am currently trying to look into techniques that allow the calculation of arbitrary cross-sections of a 3D object or rendered volume. However, I have been unable to find much on the topic. I know of some software packages, such as the SolidWorks CAD package, that employ such techniques; as seen here:

Does anyone know of any available methods, techniques, algorithms, or tutorials that aim to achieve this result? Also, in terms of the theory of this technique and the concept of calculating it on the fly; how performant is such a technique likely to be?

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:
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:
Are frequent game updates a solution for preventing multiplayer cheating? I'm creating a game on Android where the enforcement of rules can only take place on client side (I can't shift it to server side...think aimbotting but in my case I wouldn't even be able to use heuristics to detect it!).

As I've read many times, the client side is impossible to 100% protect from modification/hacking.

I am going to include protections such as ProGuard obfuscation. But also I'm going to use a formula in the code which encrypts data from the client.

Hackers/cheaters can decompile the code and locate this formula eventually.

But how long will it take for them to uncover the encryption formula? A day, a week? Actually, how long in general does it take for a game to be modded for cheating?

Can I release updates to my game so that by the time hackers release modded versions of my app to public, they become obsolete? If I did release updates, I wouldn't require updates for single player mode, but only when they tried to do multiplayer would a message display telling them they must update.

I just really want to make multiplayer fair and not scare off players because they face opponents with uber-awesome hax.

sentences:
XNA + Windows Forms: How make them work together without making the trick of the custom GraphicsDeviceControl? What I've found is a solution where you have to code a custom GraphicsDeviceControl to put inside the form (the well known tutorial from the APPHub), but that's not what I'm searching for.

I would like to say that before start to write my question here, I "googled" a lot and I saw some questions here, but I couldn't find what I'm looking for.

I would like to have the Draw/Update loops completly managed by XNAFrameWork (with XNA project and so), and not by a custom component.

I hope you understand what I asked.

Thanks in advance.

Edit

What's the most important thing for me and wasn't shown in the tutorial of APPHub is: where I have to put the input handling? That's one the problems that wasn't covered by the tutorial.

sentences:
How to initialize once for all a static field of a custom editor in unity I have a custom editor wich has a static field.

Suppose you have a static field of type MyObject:

public class myEditor : Editor {

...

private static MyObject myObj;

...
}

I'd like to initialize the field myObj directly on the same line of the declaration, but in this way I get a TypeInitializationException.

I could initialize  the field myObj in the method OnEnable, but in this way I have to use an if statement like the following:

if ( myObj == null )
    myObj = new MyObject();

Is there a way to initialize myObj once for all without using if statement?

sentences:
Calculating other objects based on the transform of another What I want to do is create my graphics to be independent of the game framework. So basically the graphics won't know anything until it is told where things are. so the thought was that every GameObject would hold its own transform like here, but then I would also want to calculate the camera, and say a directional light based on these as well.

My thought was to in an update method:

receive a container of objects,
step through them to get the needed data to be rendered (full transform matrix, and enums resulting in model to be rendered, and texture/material to be applied)

3.0 put that data into something like a stack.
3.1. when the player object is found calculate the position of the camera behind/above the player at a determined downward angle, and a directional light in front of the player at the same orientation.

4.in the render method pop the information off the stack to be rendered to the screen.
5.possibly using the frustum of the camera to ignore some objects (can be overlooked)

I have gotten steps 1, 3.0 and 4 completely working, step 2 I can get the enums out, but I still don't know how to apply the transform matrix to be usable (answers to above link would be greatly appreciated), and then 3.1 is a total mystery to me. as stated 5 would be nice, but can be overlooked if not possible (formatting edit requested)

sentences:
MMO: In-App vs. Website Purchase Im currently writing a turn based start game, which will be played in an MMO style (players download clients, central server handling the game logic etc.) and now I need to decide how I charge my players for playing my game, since this will have some implications on how player account handling is going to work.

After looking a bit around, I found two alternative ways of doing this

a)
Classical in-app purchase, for which my clients need to be able to take the payment info, send them to my server which then charges the selected amount (using some API like stripe.com) and provides the selected services

b)
Account administration and payment via website, and then synchronization between website and game server over some database

Most MMO games I know use the website approach (b) although I assume that in-app purchase (a) is faster and easier for my players and will therefore yield higher conversion rates.

So, my question is:
Are there some major problems (security, paperwork) or drawbacks (complicated to implement) with in-app purchase I overlooked?

Im not doing a mobile game (full desktop) and Im from europe, just in case this information might be needed.

sentences:
How to stop the Unity Editor from continuously rendering? Look closely at the image below. Even though the game is not running the scene shows that green wheel is spinning. This means the scene is being rendered constantly and my battery is dying.

I know Unity used to not do this and was in fact one of the reasons I liked Unity over some other engine that defaulted to always running and would make my laptop fans start up even when just sitting idle in the editor.

Is there any way to get Unity to render on demand. Meaning, only render when I interact with it, when I move the camera or change a setting like it used it?

I saw in preferences there's an "interaction mode" setting but the best it can be set to is don't render faster than 30fps. That's not useful.

Is there some other setting to get the editor to only render when interacted with?

sentences:
Imposters in Unity - How to set which color is used as 'transparent' in the RenderTexture? I'm still working at making imposters for my Unity scenes. Here I am attempting to make a large block of stadium seating, using the one seat mesh as shown.
I'll try to explain in full what Ive done so far:

Imported 3d mesh of seat
Created RenderTexture 'seat' (default format R8G8B8A8_UNORM)
Added new Orthographic camera in front of seat. (settings: Clear Flags=Solid Color; TargetTexture='seat'
Created some quads and aligned them so I can see the textured side.
Gave the quads a new material 'seat'.

I've gone through many of the settings in the Material and other places changed many things here and there such as 'transparent' or 'cutout' and lots of the other settings but cannot get rid of the magenta color in the seating textures I created.
Also tried making that color alpha 0 but it had no effect. And tried various colors as transparent (magenta, white, black).
Am I doing this completely wrong? Hopefully I am just missing some small setting. Ideally somewhere I can just set the magenta color to mean transparent pixels.
Really do need help here honestly have been trying very hard to achieve this alone but not getting anywhere fast.

sentences:
How do developers get their money with Steam Direct? Here's what I know:
Steam is a digital distribution platform developed and owned by the Valve corporation. Steam is mostly known for its video games, XR software, and game development programs. Earlier, the products that were to be published to Steam were decided by the method of voting. This system was called Steam Greenlight. Now, a developer can just pay a sum of IN₹ 7,000 (US$ 100) and publish his/her product to Steam directly. This new system is called 'Steam Direct'.

Here's what I need to know:

In the new system of Steam Direct, do developers get any money off every copy of their product(s) sold on Steam?
If they do, what percentage of money is kept by Steam (or taken away for taxes and/or other purposes) and what percentage is given to the developers of the product?
If developers do get money by selling their products on Steam, what is the most common means by which they receive payments?

sentences:
The most popular Resolutions and Aspect Ratios in Android OS 2019 I develop the game with Libgdx framework. When I tried to deal with support multiple screen resolutions it turns out that Libgdx is not following Android approach how to deal with Screen sizes and densities (mdpi, hdpi, xhdpi, etc folders).

I found only one way to handle assets - ResolutionFileResolver.
I have to create folders with different resolutions and the Libgdx choose more appropriate texture for me automatically for each device.

Android platform has a huge amount of Phones and Tables with different screen resolutions. I have to find a good strategy on how to handle it.

For example let's take a look at the case where I have 2 folders in my game: "800x480" and "1440x2560". The device on which I run the game has "1280x720". In this case, "800x480" resolution will be chosen as more appropriate. It leads to bad quality of the Textures because of stretching.
At the same time, I can't leave only one asset with high quality. It leads to cut all older devices with a small amount of RAM.

The idea is to create 3 most popular resolutions for 3 categories:
low, middle and high resolutions.

Where can I find some statistic about the resolutions popularity of Android Devices? I know about the Android Developer Dashboard but it doesn't show Screen Resolutions.
Does anyone use Libgdx in 2019? How to deal with Multiple Screen Support in this framework?
Any real statistic about the most popular Aspect Ratio? Which aspect ratio you choose as "basic" in your games?

I would love to see any "best practice" how to cover as many devices as possible with the good quality of the view.

sentences:
Finding coordinate in radius Hello i have two points (Vector3) A and B. And have a radius r

How can i find a coords of point P in a circle by angle?

sentences:
Integrating specular, diffuse reflection and refraction I am implementing an MLT bidirectional path tracer. I have a problem integrating diffuse, specular reflection and refraction.

1) The first problem is diffuse and specular reflection. Diffuse reflection is done by sampling ray in a hemishere. But specular reflection is done by finding the ray that have an angle to the normal equal to the incident ray with the normal. However, an object can have both diffuse and specular reflection. When to use specular reflection or diffuse reflection for a ray?

2) Same as the first question but this time integrating reflection with refraction.

I've seen a few research papers and websites online where the scene have specular, diffuse reflection and refraction, but they have no tutorial on how to do this.

sentences:
How to use FrameBuffer objects (OpenGL) I want to draw a 2D scene and after the scene i want to draw some light effects.

When i draw some light, i create a FBO, draw in it and when  finished with drawing, i want to create a texture where i draw the content of the FBO.

My current code:

//////////
//Init_

//Create Texture
glActiveTexture(GL_TEXTURE0);
glGenTextures(1, out _texfbo);
glBindTexture(GL_TEXTURE_2D, _texfbo);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _screenWidth, _screenHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, null);
glBindTexture(GL_TEXTURE_2D, 0);

//Create Renderbuffer
glGenRenderbuffers(1, out _rb);
glBindRenderbuffer(GL_RENDERBUFFER, _rb);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, _screenWidth, _screenHeight);
glBindRenderbuffer(GL_RENDERBUFFER, 0);

//Create Framebuffer
glGenFramebuffers(1, out _fbo);
glBindFramebuffer(GL_FRAMEBUFFER, _fbo);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, _texfbo, 0);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, _rb);
glBindFramebuffer(GL_FRAMEBUFFER, 0);

//////////
//Loop:

glBindFramebuffer(GL_FRAMEBUFFER, _fbo);

//Draw Scene

glBindFramebuffer(GL_FRAMEBUFFER, 0);

glBindTexture(GL_TEXTURE_2D, _texfbo);

//Draw Rectangle with texture from Framebuffer

The Scene is not drawn on the screen, i think that means it's drawn in the right buffer. But i can't get someting on the screen. What is wrong?

sentences: Animating a sprite character with Multiple Parts I'm trying to animate a 2D character with interchangable parts. Right now, I have each part nested in a general part that is in turn nested in an overall parent like so; Player->Heads->Head1. I have a Controller for each part made and I feel like I should be able to pass the parameters from the Player's animator all the way to Head1's animator as they have the same parameters. I'm not quite sure how to tackle this. Using C#

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:
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:
How to calculate the position of an attached model after rotation? I'm programming a basic game on XNA. I started to place an object (eg weapon) attached to the right arm of my player. When I move my character forward behind left or right all right. But when I rotates my equipment is not positioned correctly.
I am fully understands it is necessary to recalculate the new position based on the rotation done but I do not see how.
Here is my code and pictures

        //Function that will draw the current item selection in the player's hand
private void draw_itemActionInUse(Model modelInUse)
            {

                int handIndex = skinningData.BoneIndices["Hand_Right"];

                Matrix[] worldTransforms = animationPlayer.GetWorldTransforms();

                Matrix rotationMatrixCalcul = Matrix.CreateRotationY(player.Rotation.Y);
//Here I calculate the new position of the item, but it does not work
                Vector3 newPosition= Vector3.Transform(new Vector3(player.Position.X, player.Position.Y + 4, player.Position.Z ), rotationMatrixCalcul);
                foreach (ModelMesh mesh in modelInUse.Meshes)
                {
                    foreach (BasicEffect effect in mesh.Effects)
                    {

                        effect.World =
    worldTransforms[handIndex]
    *
    Matrix.CreateScale(2)
    *
    Matrix.CreateRotationY(player.Rotation.Y)
    *
    Matrix.CreateTranslation(newPosition);

                        effect.View = View_;
                        effect.Projection = Projection_;

                        effect.EnableDefaultLighting();
                    }

                    mesh.Draw();
                }

            }

Figure A:
position: x:0;y:0;z:0
angle : 90
Figure B:
position: x:2;y:4;z:0
angle : 90

Figure A:
position: x:1;y:0;z:1
angle : 35
Figure B:
position: How calcul this position ?
angle : 35

sentences:
What is the difference between a Sprite and a Texture? I have an assignment due for University, and my task is to discuss textures used within video games, and how they have evolved.

My main question is, what is the fundamental difference between using a sprite, or using other texture methods?

Having done a little research myself, I seem to be inclined that Sprites store images in a single file, and can be used for animations etc.. and were commonly used with older video games, generally using sprites as all of their game visuals. Now, with modern games, sprites I believe tend to be less used as technology advances and other textures are available such as bump mapping. Although sprites are still used today to accommodate features such as a health bar or long distance textures.

But what are the main advantages of using textures, over sprites?

sentences:
What is the most serious limitation of Unity? Having read this heated question about Unity vs. UDK vs. ID something, I'm curious to know: what the repeatedly-hit, most crippling limitation(s) of Unity?

In order to keep this question non-subjective, again, I'm talking about the top repeated offender(s) of Unity are. This is something that, as a Unity user, you really wish someone had told you about before you started using it.

I have heard from someone that Unity does not deal well with version control, since it generates a lot of binary files (which are un-diffable). This, to me, is not really crippling as I work alone.

Thoughts?

sentences:
How should I structure my Tetris clone's code? I programmed my first game (a Tetris clone in XNA) and all my code is in a Game1.cs file with 730+ SLOC. It's fairly well-commented, and each piece of functionality has its own subroutine, but I have a feeling that I'll have to move toward a more organized approach as my games increase in complexity.

To offer some background, my current approach separates the "view" (the tetrimino sprites visible on the board) from the underlying "data" (represented by an 18x10 bool array), which determines if there is a block at some point on the grid. In other words, my "data" determines my "view." Also, here's a list of all my subroutines:

Game1()
Initialize()
LoadContent()
UnloadContent()
GetBlockType()
IsFreeBlock()
IsPossibleMovement()
GetXInBlocks()
GetYInBlocks()
StorePiece()
DeleteLine()
DeletePossibleLines()
IsGameOver()
ResetBoard()
Update()
Draw()

I hear a lot about game components in XNA, which sounds like something that could make my code more organized and extensible. Are there any organizing features of XNA that I could incorporate into my future games?

sentences:
Translate extrinsic rotations to intrinsic rotations ( Euler angles ) The problem I have is very frustrating:
I am using the Jitter Physics library which gives Quaternion rotations, you can extract the extrinsic rotations but I need intrinsic rotations to rotate in OpenTK (There are other reasons as well so I don't want to make OpenTK use a Matrix)

GL.Rotate(xr, 1, 0, 0)
GL.Rotate(yr, 0, 1, 0)
GL.Rotate(zr, 0, 0, 1)

EDIT : Response to the first answer

Like This?

GL.Rotate(zr, 0, 0, 1)
GL.Rotate(yr, 0, 1, 0)
GL.Rotate(xr, 1, 0, 0)

Or This?

GL.Rotate(xr, 1, 0, 0)
GL.Rotate(yr, 0, 1, 0)
GL.Rotate(zr, 0, 0, 1)

GL.Rotate(zr, 0, 0, 1)
GL.Rotate(yr, 0, 1, 0)
GL.Rotate(xr, 1, 0, 0)

GL.Rotate(xr, 1, 0, 0)
GL.Rotate(yr, 0, 1, 0)
GL.Rotate(zr, 0, 0, 1)

I'm confused, please give an example

sentences:
What is the simplest way to calculate distance in a 3D environment? What is the simplest way to programmatically calculate difference between two points in a 3D game environment?

I am trying to sort a list of light sources by how close they are to an entity, so that only the four closest light sources affect an entity at any given time.

sentences: How do you create a fractal cube-map? I want to create a map similar to how Mincraft and other related games do. I just haven't the faintest clue on how to do so. Can anyone point me to a decent tutorial or give me a decent run through? I program in java and use openGL.

sentences:
When serializing a class, can its fields take their defaults from the Unity editor? Can I have a custom serialized class whereby I set a value in the editor and that value persists into runtime, as happens with serialized monobehaviour fields?
Currently it sets itself to 0 or a default hard coded from within the class.
I noticed that using a struct actually works but using a struct breaks the events used in my actual use case (included below).
Example code:
public class Class1 : MonoBehaviour
{
    // this variable can be set in the editor and persist into run time
    [SerializeField]
    private float testVar1;

    // this variable can not
    [SerializeField]
    private Class2 class2;

    private void Start()
    {
        class2 = new Class2();
    }
}

[Serializable]
public class Class2
{
    [SerializeField]
    private float testVar2;
}

My use case:
[Serializable]
public class EditorFloat
{
    [SerializeField]
    public float value;
    public EventProperty<float> eventProperty;

    public EditorFloat(EventProperty<float> eventProperty)
    {

        this.eventProperty = eventProperty;
        Object.FindObjectOfType<CentralParams>().OnUiChange += Update;
        this.eventProperty.OnChanged += UpdateEditor;
    }
    public void Update()
    {
        eventProperty.Value = value;
    }
    public void UpdateEditor(float valueFromEventProperty)
    {
        value = valueFromEventProperty;
    }
}

Thanks!

sentences:
GLSL - multiplying fragment output color by normal after calling texture function displays wrong texture So I'm quite new to OpenGL/GLSL. I'm trying to make multitexturing and simple normal lighting work.
Here is a Vertex shader:

#version 130

uniform mat4 transform;

in vec3 vertPos;
in vec2 texUV;
in vec3 vertNorm;
in uint thisLayer;

out vec2 fragTexCoord;
out vec3 fragNorm;
out float fragLayer;

void main()
{
    gl_Position = transform * vec4(vertPos, 1.0f);

    fragTexCoord = texUV;
    fragLayer = float(thisLayer);
    fragNorm = vertNorm;
}

... and here is Fragment shader:

#version 130

uniform sampler2DArray texArray;
uniform uint texCount;
uniform float rTime;

in vec2 fragTexCoord;
in vec3 fragNorm;
in float fragLayer;

out vec4 color;

void main()
{
    float actual_layer = max(0, min(texCount - uint(1), floor(fragLayer + 0.5))); // Getting texture layer
    vec3 texCoord = vec3(fragTexCoord, actual_layer);

    color = texture(texArray, texCoord);
}

And it works fine:

Multiplying color.rbg by any constant works as expected:

color = texture(texArray, texCoord);
color.rgb *= vec3(0.5, 0.5, 0.5);

But if I try to multiply color.rgb by a normal, like this:

vec3 finalNorm = (normalize(fragNorm) + vec3(1,1,1))/vec3(2,2,2);
color = texture(texArray, texCoord);
color.rgb *= finalNorm;

The wall texture changes to the last texture in the array (the one on the top):

I have no idea why this happens. I normalize vertex normals and map their values into [0, 1] range, so colors will stay in [0, 1] range after multiplication as well. It is supposed to simply shift the colors intensity, like it did while multiplying by a constant, not change the texture itself, right?
I am aware of the fact that this is not how you perform normal lighting, however, this is not the correct behavior as well, and I'm ripping my hair off as to why.
Any help is appreciated. I will provide more info if needed.

EDIT:
OS is Windows 10. GPU's: Intel HD 4600/Nvidia GTX 860M (happens on both of them). OpenGL version 4.3.0 build 20.19.15.4624.

Some additional info:

I use SOIL library to load data from PNG files. I use:

glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, img_width, img_height, layer_count * 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);

to create a container for texture array, and use:

glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, i, img_width, img_height, layer_count, GL_RGBA, GL_UNSIGNED_BYTE, data);

to load data into it. One issue I have with this is that glTexImage3D takes layer_count (the number of textures) multiplied by 2, and I have no idea why as well! Maybe this is somehow related to the issue I'm having above?

sentences:
Rotating a cube with arrow keys I have a list of rotations (on a cube in 3d space with the y-Axis pointing upwards, x-Axis pointing righthand and z-Axis pointing towards you) for example

+90 deg around x-Axis followed by
+90 deg around y-Axis followed by
+90 deg around y-Axis followed by
-90 deg around x-Axis

All rotations are only of type (+- 90 deg around x / y). The list can be of any length. My goal is to break it down to only three operations. I can't figure out how to calculate the three arguments xDeg,yDeg,zDeg which i can apply in the same order to rotateX,rotateY,rotateZ to get the same result as applying the complete list one after another to the rotation-functions. i tried to build up a permutation matrix depending on the actual position in the list of rotations when i iterate over it to apply the current deg value of a list item to either xDeg,yDeg,zDeg. I couldn't make ist work.

var gTrans = (function() {

  var perm = [[1,0,0],[0,1,0],[0,0,1]];
  var set = [0,0,0];

  function rotateUp() {
    //set = math.chain(set).add(math.multiply(perm,[-90,0,0])).done();
    //set = math.chain(set).add([-90,0,0]).multiply(math.transpose(perm)).done();
    perm = math.multiply([[1,0,0],[0,0,1],[0,-1,0]],perm);
    set[0] -= 90;
  }

  function rotateDown() {
    //set = math.chain(set).add(math.multiply(perm,[90,0,0])).done();
    //set = math.chain(set).add([90,0,0]).multiply(math.transpose(perm)).done();
    perm = math.multiply([[1,0,0],[0,0,-1],[0,1,0]],perm);
    set[0] += 90;
  }

  function rotateLeft() {
    //set = math.chain(set).add(math.multiply(perm,[0,-90,0])).done();
    //set = math.chain(set).add([0,-90,0]).multiply(math.transpose(perm)).done();
    perm = math.multiply([[0,0,-1],[0,1,0],[1,0,0]],perm);
    set[1] -= 90;
  }

  function rotateRight() {
    //set = math.chain(set).add(math.multiply(perm,[0,90,0])).done();
    //set = math.chain(set).add([0,90,0]).multiply(math.transpose(perm)).done();
    perm = math.multiply([[0,0,1],[0,1,0],[-1,0,0]],perm);
    set[1] += 90;
  }
})();

The code above is written with javascript, p5js and mathjs libs. Does someone have an idea? I know it's possible to simply multiply the rotation matrices. But i need the angles and the informations if it's 750 deg (not only 750 mod 360 deg).

sentences:
Unity2D: Rendering multiple sprites as a single one I'm creating NPCs in Unity 2D using C#, and I have 16x16 sprites for body, helmet, clothes and weapon. All these have a tile set which has been split in unity. I'd like to be able to render one of each part together, so I can drag the sprite to the field, and then it will be rendered on the NPC. IE, I drag a helmet sprite into the helmet field and that is the rendered helmet.

I intend on having multiple NPCs, so I'd prefer to minimise the child objects. Multiple sprites will need rendering, however there's only one sprite renderer. Is it possible for me to combine the sprites (in code), and then render the final sprite? Or is there perhaps a better way?

Thanks in advance!

sentences:
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:
Cocos2D - How to move sprite on the X axis, using the accelerometer I'm trying to make a vertical shooter, using Cocos2D and a few tutorials. Unfortunately, most tutorials only show how to make an horizontal shooter.

Still, I tried to adapt the code from a horizontal shooter to a vertical one, but am having a few problems. Mainly, my ship keeps moving right, even when the iPhone is sitting perfectly still.

Seeing as I'm a beginner, I'm having trouble pinpointing the exact issue and I'd love if anyone could help me.

Here's my accelerometer method:

-(void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration {

    define kFilteringFactor 0.1

    define kRestAccelX -0.6

    define kShipMaxPointsPerSec (winSize.width*0.5)

    define kMaxDiffX 0.2

    UIAccelerationValue rollingX;

    rollingX = (acceleration.x * kFilteringFactor) + (rollingX * (1.0 - kFilteringFactor));

    float accelX = acceleration.x - rollingX;

    CGSize winSize = [CCDirector sharedDirector].winSize;

    float accelDiff = accelX - kRestAccelX;
    float accelFraction = accelDiff / kMaxDiffX;
    float pointsPerSec = kShipMaxPointsPerSec * accelFraction;

    _shipPointsPerSecX = pointsPerSec;

}

And my update method:

-(void)update:(ccTime)dt {

    CGSize winSize = [CCDirector sharedDirector].winSize;
    float maxX = winSize.width - _ship.contentSize.width/2;
    float minX = _ship.contentSize.width/2;

    float newX = _ship.position.x + (_shipPointsPerSecX * dt);
    newX = MIN(MAX(newX, minX), maxX);
    _ship.position = ccp(newX, _ship.position.y);

}

What could be causing this?

sentences:
How to use styles in Monogame.Extended.GUI? So i was looking at the Monogame.Extended.GUI Project and used this instructions to set it up in a .net Core Project. So far everythings works fine. I followed the example of the demo and created a button like this

var button = new Button();
button.Content = "Button1";
button.BackgroundColor = Color.Transparent;

var demoScreen = new Screen
{
   Content = new StackPanel
   {
        Orientation = Orientation.Vertical,
        VerticalAlignment = VerticalAlignment.Centre,
        HorizontalAlignment = HorizontalAlignment.Centre,
        Items = { button }
   }
};

Now i want to give this Button a style, for example disable any mouse interactions like hover or mouse presses. The button has a HoverStyle and a PressedStyle property but i don't know how to use it.

   button.Hoverstyle = ???

sentences:
How to destroy a clone of an effect attached to an object? I want to use some particle effects into a bonus object that will be destroyed upon contact with the player object. This object as its name suggests will add a certain benefit for the player for a certain amount of time. I was following a tutorial on Youtube. The code from the Tutorial worked fine but there is one problem I was not able to solve: the explosion will not be destroyed after the object is collided with player and after the script is triggered because it seems that it was cloned into the scene. The instantiation created a clone of the effect's prefab I referenced into the script.
After looking into the internet, I tried to affect the instantiation of the effect into a variable called clone and then destroyed it after the bonus is over but the problem was still present. I researched and I really did not obtain any answer.

bonus.cs
//

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

public class bonus : MonoBehaviour {

public float multiplier=2.0f;
public GameObject pickup_effect;
public float duration = 10;
private GameObject clone;

private void OnTriggerEnter(Collider other)
{
    if (other.CompareTag("Player")) StartCoroutine( pickup(other));
}

IEnumerator pickup(Collider player)
{
    Debug.Log("You picked a bonus!");
    //spawn cool effect
    clone = Instantiate(pickup_effect, transform.position, transform.rotation);
    //apply effect yo the player
    // our.score_value += 10;
    player.transform.localScale *= multiplier;
    GetComponent<MeshRenderer>().enabled=false;
    GetComponent<Collider>().enabled = false;

    //wait x amount of seconds

    yield return new WaitForSeconds(duration);

    //remove the effect from theplayer
    player.transform.localScale /= multiplier;

    Destroy(gameObject);
    Destroy(clone,4f);

}

}

//

I tried disabling the "loop" option in the effect's particle system options but it gave the same results.

I disabled the "Play on Awake" option and the effect will not play at all.

The script is added directly to the object that is a simple 3D cube with MeshCollider, Mesh Renderer and Box collider.

The effect I used is a BigExplosionEffect taken from Unity Particle Pack 5.x from the Asset Store.

I would like to know what is exactly wrong? Is it probably related to the effect itself rather than the script? Or is there a far better solution?

sentences:
How can I blend grass decals in a transparent alpha channel in 3D? LibGDX I'm new to 3D and trying to create grass simulation using decals in libGDX.

I'm following the logic outlined here.

Atm my grass decal is a billboard of grass stems with a transparent background. I've placed 3 decals together in the form of a triangle.

When I pan the camera around at times the decals blend together but most of the time you can see the outline of the decal and you can distinguish between the pngs.

Can someone please help me understand a way to blend my decals better?

The decal:
http://www.reinerstilesets.de/3dtextures/billboardgrass0002.png

The code:

public class Grass implements Screen {
    private FirstPersonCameraController camera_control;
    private PerspectiveCamera camera;

    private Mesh floor_mesh;
    private Vector<Texture> grass;

    private Vector<Decal> decals;
    private DecalBatch decalBatch;
    private Vector<TextureRegion> grass_regions;

    private ShaderProgram shaderProgram;
    private Stage stage;

    @Override
    public void show() {
        stage = new Stage();
        decals = new Vector<Decal>();
        grass = new Vector<Texture>();
        grass_regions = new Vector<TextureRegion>();

        //camera
        camera = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        camera.near = 0.01f;
        camera.far = 10f;
        camera.position.set(1, 2, 5);
        camera.update();
        camera_control = new FirstPersonCameraController(camera);
        camera_control.setVelocity(3);
        camera_control.setDegreesPerPixel(.25f);
        Gdx.input.setInputProcessor(camera_control);

        //grass
        grass.add(new Texture("billboardgrass0002.png"));

        for(Texture t : grass){
            grass_regions.add(new TextureRegion(t));
        }

        decalBatch = new DecalBatch(new CameraGroupStrategy(camera));
        for(int i = 0; i < 3; i++){
            decals.add(Decal.newDecal(0.75f, 1.25f, grass_regions.get(0), true));
        }

        //set grass
        decals.get(0).setPosition(1f, 0, 1f);
        decals.get(1).setPosition(1.1f, 0, 1.1f);
        decals.get(1).setRotationY(45);
        decals.get(2).setPosition(.8f, 0, 1.1f);
        decals.get(2).setRotationY(-45);
    }

    @Override
    public void render(float delta) {
        //gl
        Gdx.gl20.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        //Gdx.gl20.glClearColor(1, 1, 1, 1);
        Gdx.gl20.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
        Gdx.gl20.glEnable(GL20.GL_DEPTH_TEST);
        Gdx.gl20.glEnable(GL20.GL_TEXTURE_2D);
        Gdx.gl20.glEnable(GL20.GL_BLEND);
        Gdx.gl20.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
        Gdx.gl20.glCullFace(GL20.GL_NONE);

        //camera
        camera_control.update();

        //disable depth writing
        Gdx.gl20.glDepthMask(false);

        //draw grass decals
        for(Decal d : decals){
            decalBatch.add(d);
        }
        decalBatch.flush();

        //stage
        stage.getViewport().update(1280, 720, true);
        stage.act(delta);
        stage.draw();
    }

    @Override
    public void resize(int width, int height) {}

    @Override
    public void hide() {}

    @Override
    public void pause() {}

    @Override
    public void resume() {}

    @Override
    public void dispose() {
        shaderProgram.dispose();
        decalBatch.dispose();
        decals.clear();

        for(Texture t : grass){
            t.dispose();
        }

        grass.clear();
        floor_mesh.dispose();
    }
}

Edit:
disabled depth buffer writing before drawing decals,
now looks better:

sentences:
how to prevent stretched vertical shadow in blob shadow which projected by Projector of Unity I feel it's a ridiculous because projector's rotation of X is 90.

the projector is a orthographic.

how can i prevent that long stretch shadow in vertical side of a platform?

sentences:
How to map control key to a specific angle or orientation? At the moment, I basically have built out a large hash table of various angles and what direction they map to, if the user would press right, up, down, left. This is needed, in my case, as I have a collection of geometries that when the user presses right, they all go right, and when left, they all go left ...

However, when the scene containing these is rotated anything other than its original state, these controls need to be updated/reversed/etc. That is, if you're looking at the scene from behind, pressing left now has the objects all going right, etc.

I was trying to see if there is a simpler way of applying matrix transformations instead of hard coding a large hash table mapping various scene angles to keys.

sentences:
3D meshes for WPF (XAML)? I'm trying to make a WPF-3D game. WPF uses XAML.

I'm trying to find free 3D assets from the internet. :-)

What format of 3D models I should be looking for, direct XAML or 3D Studio format or what?
I know that there are some 3D Studio format to XAML -converters, but I don't know if they really work...

sentences: Why value 1 in OrthographicCamera viewPort width? So, I read that camera = new OrthographicCamera(1, h/w); creates a camera  with an appropriate width and height for the field view.. However, I can't understand that value 1 for the viewport width, does a value 1 means full width?

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:
How can you use Fractals to perturb an image? I've been playing around with Procedurally Generated World. I've so far managed to create the Height Map, and a translate map, but now i'm attempting to create Caves,
The main idea is to use another Noise map, with values being either 0 or 1, and multiply it with the Height Map.
I've managed to achieve this:

This is currently described with a float[Width, Height], which has value 0 for those points (x,y) such that (x,y) is black, or 1, for those which (x,y) is white.
I want to apply some fractal to this to achieve this:

However, i have no idea how to do this!
(I also apologize for any grammatical errors. I haven't slept in like 18 hours and i can't think straight)

sentences:
Will my game engine be compatible with physics engines? My engine supports scene handling, cameras, and has a renderer. Also, it has a class called Drawable, which has the position, the shape and the picture of an object. The picture property has width, height, rotation and a draw method. All game objects are supposed to inherit from this Drawable class, and are added to the scene, along with a map (a collection of Tiles, that also inherit from Drawable), lights, and so on and so forth.

The shape property of a Drawable is a Polygon, a collection of user defined vertices around the position of a Drawable. This is a relative coordinate system, so [0, 0] is the position of the Drawable.

With this setup, will the users of my engine (which will probably only be me) still be able to integrate physics engines such as Box2DJS into their games?

sentences:
Cannot use imported image with Unity's UI controls I know this question sounds banal but its a problem.

I received a project and opened it.

Now I try to edit it by adding my own images.

I do the import but the image does not show up when selecting images, for example, for a button:

What is the correct folder in this case?

sentences:
Should a Game include Multi-Monitor Support? I'm coding a 2D platformer in SDL2 and c++ and was wondering if there's an expectation for videogame's to support Multi-Monitor setups and if so, if it applies to 2D platformers.

As a bonus question too: Does the expectation of being able to change a game's resolution apply to 2D platformers? Thanks.

sentences:
Going up and down stairs by Unity3d's NavMesh *Purpose
I want to create a navigation mesh that is optimized for going up and down stairs and stopping.
*Question
I'm making a nav mesh to make a character go up and down stairs.
I'm making a nav mesh that makes a character go up and down stairs, but when the character stops in the middle of a step, his foot floats or his foot gets stuck in the stairs.
I'm having a hard time creating a good path for the nav mesh.
I'm wondering if you have any knowledge on how to bake a nav mesh for ascending and descending stairs.
Please let me know what you know about baking navmeshes for stair climbing and descending, and what pages or ideas I should refer to when implementing stair climbing.
Please let me know what you know about baking a nav mesh for stair climbing.
*Preparation
　Create the stairs and the ground in Probuilder so that the nav mesh can be baked.
***Case 1
　Bake the nav mesh of the stairs.
　Test result.
　　When ascending and descending the stairs, my feet sink into the ground.
Every time I ascend or descend a flight of stairs, the surrounding scenery wobbles up and down.

***Case 2
Make a board to accompany the stairs.
Bake the nav mesh with the stairs hidden and the slope displayed.
　Test result.
When ascending and descending the stairs, the feet do not sink in.
But when I stop at the step, my foot floats away.
The scenery does not wobble because you are running on a board.

***Case 3
I made a board to accompany the stairs.
I want to make the nav mesh of the step part flat.
I want to make the nav mesh of the step part flat, so I'll edit the step part with the Probuilder function.
Instead of a straight slope, lower the knot to create a slope and bake it.
　Test result.
There is not much change in the shape of the nav mesh from Case 2.
The phenomenon that the foot lifts off the ground when stopping at the step was not improved.
The scenery is not wobbly because you are running on a board.

***Navigation mesh we want to achieve

***Development environment
Unity2019.4.9f1
***Package used
ProBuilder4.2.3

sentences:
Restarting a libGDX game to apply changes to resolution How can I restart a LibGDX game to apply certain changes to the game such as changes to the resolution (going from 1920X1080 to 1280X720), or changing full screen.
Granted the resize(int width, int height) can help with the resolution change, but I need to change other settings as well so I rather restart the game and continue from the options menu instead of forcing the user to manually exit the game and then restart it.

sentences:
Does SoundEffect.CreateInstance load from file everytime? This is something which has been bugging me. If I create a SoundEffectInstance via  SoundEffect.CreateInstance() I'm meant to dispose of it when I'm finished with it. SoundEffect.CreateInstance() does not use ContentManager as far as i can tell.

So does it load from file or does it keep a copy in memory? Loading from file would obviously be very slow :-/

sentences:
Call function via ContactListener I've been creating a game on my own in LIBGDX, BOX2D and there' s a problem I can' t solve. When two World bodies collide, method "beginContact" is called in MyContactListener class that implements ContactListener interface.

How am I supposed to change player's healthpoints when it's fixture collides with other bodies' fixtures. I know I have to do this somehow through MyContactListener class, but I can' t find the way how to call the method I need..

Note: My player's body and fixture are created in "Player" class and there are methods "setRemainingHealth()" and "getRemainingHealth()".

Here's also some code, which might illuminate this situation.

MyContactListener.java

package utils;

import com.badlogic.gdx.physics.box2d.Contact;
import com.badlogic.gdx.physics.box2d.ContactImpulse;
import com.badlogic.gdx.physics.box2d.ContactListener;
import com.badlogic.gdx.physics.box2d.Fixture;
import com.badlogic.gdx.physics.box2d.Manifold;

public class MyContactListener implements ContactListener {

@Override
public void beginContact(Contact c) {

    Fixture fa = c.getFixtureA();
    Fixture fb = c.getFixtureB();

    if (fa == null || fb == null) return;
    if (fa.getUserData() == null || fb.getUserData() == null) return;

    if (isTunnelMachineCollision(fa, fb)) {
        // call somehow method "player.setRemainingHealthPoints(player.getRemainingHealthPoints-0.01f)" here
    }

}

@Override
public void endContact(Contact c) {

}

@Override
public void postSolve(Contact c, ContactImpulse arg1) {

}

@Override
public void preSolve(Contact arg0, Manifold arg1) {
    // TODO Auto-generated method stub

}

private boolean isTunnelMachineCollision(Fixture a, Fixture b) {
    return (a.getUserData()) == "terrain" && (b.getUserData()) == "machine";
}

}

TestPlayer.java

package testPackage;

import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.BodyDef;
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType;
import com.badlogic.gdx.physics.box2d.CircleShape;
import com.badlogic.gdx.physics.box2d.Fixture;
import com.badlogic.gdx.physics.box2d.FixtureDef;
import com.badlogic.gdx.physics.box2d.World;

public class TestPlayer {

private float remainingHealthPoints = 3;

private CircleShape shape;
private CircleShape defenseBarrier;
private Fixture defenseBarrierFixture;
private Fixture mainBody;
private BodyDef bodydef;
private Body body;

private float x;
private float y;
private float width;

public TestPlayer(World world, float x, float y, float width) {

    this.x = x;
    this.y = y;
    this.width = width;

    bodydef = new BodyDef();
    bodydef.type = BodyType.DynamicBody;
    bodydef.position.set(x, y);
    bodydef.fixedRotation = true;
    body = world.createBody(bodydef);

    shape = new CircleShape();
    shape.setRadius(width);
    mainBody = body.createFixture(shape, 1.0f);
    mainBody.setUserData("machine");
}

public float getRadius() {
    return shape.getRadius();
}

public BodyDef getBodydef() {
    return bodydef;
}

public CircleShape getShape() {
    return shape;
}

public Body getBody() {
    return body;
}

public void activateDefenseBarrier(World world) {

    defenseBarrier = new CircleShape();
    defenseBarrier.setRadius(width*1.5f);

    defenseBarrierFixture = body.createFixture(defenseBarrier, 1.0f);
    defenseBarrierFixture.setUserData("defenseBarrier");
}

public void destroyDefenseBarrier() {
    if (defenseBarrierFixture != null) {
        System.out.println("olemas");
        body.destroyFixture(defenseBarrierFixture);
        System.out.println(defenseBarrierFixture);
    }
    else {
        System.out.println("fixture on null");
    }
}

public Fixture getDefenseBarrier() {
    return defenseBarrierFixture;
}

public float getRemainingHealthPoints() {
    return remainingHealthPoints;
}

public void setRemainingHealthPoints(float remainingHealthPoints) {
    this.remainingHealthPoints = remainingHealthPoints;
}

}

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:
Unity3D: Efficiently loading chunks in an infinite voxel engine I'm developing a voxel engine in C# using Unity and I'm currently trying to implement infinite terrain, so I took a look at other Unity voxel engines that have infinite terrain. I've seen three different ways of doing it:

Using a dictionary to store the chunks and store the block data in another dictionary
Using a dictionary to store the chunks and store the block data on every chunk
Using a fixed size array and shifting it every time the player moves

The engines using approach 1 and 2 were pretty slow at chunk loading.
The engines using approach 3 were faster but produced lag every time the player entered a new chunk.

I've already tried to implement it using approach 1, but my chunk loading speed got slower by about 10 times, so it was really unplayable.

How is it done in efficient or popular voxel engines like Minecraft or VoxelFarm?
Do you have experience with voxel rendering and know a better approach?

Thanks in advance!

sentences:
How can I debug my game on mobile device? I've been creating this game on my computer for months and everything works fine. But when I built the project and installed it into my android device, it doesn't run as smoothly. I don't wanna use the word "lag" as I don't think that's the correct term in this case. To be more specific, my game involves as series of platforms moving continuously from one end of the screen to another. When I play it on my mobile device, the platforms look a bit "shaky", as if the speed of the platform isn't exactly constant.

It's possible that this is happening due to my computer having a more powerful processor than my phone and hence, the performance isn't on par. But I don't see why that should be the case given that my scene isn't very complex. I've released an earlier version of this game on android before with roughly the same number of objects in my scene. It ran as smoothly on my phone as on my computer. Hence, I was expecting this version to be just as smooth.

To find out the problem, I made my game less complex by removing more objects from my scene and running it on my phone. But the performance was no different. The platforms still look quite "shaky" and their movement don't feel very smooth.

How can I isolate the cause of this behaviour?

sentences:
How to make part of the Texture not to be scaled.? I am new to LibGdx, i was doing one example for my learning and struck with this question, i had searched in google but i am not able to find the answer for this.

1) How to make part of the Texture not to be scaled.

as you can see in the image i am reducing the height of bottom pipes so that the top pipe scale is reduced to fit the height given but i want the top part of the pipe not to be scaled.

in this example whole pipe is one texture, for fixing this problem i thought to split the top and body to separate texture and set height for only body but i thought there should be some other solution so that only i had put this question here.

sentences:
Sprite Body can not stop Hey i have issue regarding jump sprite body. In my code i am using moveLeft and moveRight Button and when i am press moveRight Button using following code

if (moveRight.active==YES)
    {
            b2Vec2 force=b2Vec2(4,0);
            ballBody->SetLinearVelocity(force);
    }

Its move perfectly and When i release this Button than sprite body stop using following code

else
{
      b2Vec2 force=b2Vec2(0,0);
      ballBody->SetLinearVelocity(force);
}

But when i put this else part then jump can not done. My jump code is following

if (jumpSprite.active==YES)
                {
                    NSLog(@"Jump Sprite");
                    b2Vec2 locationWorld;
                    locationWorld=b2Vec2(0.0f,4.0f);
                    double force=ballBody->GetMass();
                    ballBody->ApplyLinearImpulse(force*locationWorld, ballBody->GetWorldCenter());
                }

If i remove else part then jump will perform complete but sprite body can not stop after release button.

So what to do??

Thanks in advance

sentences:
Object generation from an existing object in a game engine To simplify, let's say in en engine I'm coding for a game, I have the Main class an Object class. In the Main class' update method, I loop through the array of all Objects in the game. I also have a pool in the Main class from where I can get and return Objects.

Main.update () { for (all Objects) { Object[i].update() } }

My question is what's a good way of creating new Objects from an existing object's update method?

Do I have to pass the Main class to the Objects? or make the Main a static class?

Also another question is how to handle object destruction where I return them to the unused pool.

Thanks in advanced.

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:
How to get the angle to an object from angle you are facing I am making an creature simulator where the creatures have a neural net for a brain.

One of the inputs to the net is the angle it has to travel to go to be facing the nearest piece of food. I can get the nearest piece of food, but I need a way of getting the angle it needs to travel to be facing the piece of food.

For example, if it was facing the food, it would be zero, and if it was facing away it would be 180. I got the creatures angle, if it is facing up it would be 0 degrees, and if its facing right its 90 degrees.

sentences:
Capsule collider triggered unexpectedly I have an object with a capsule collider on its root, with IsTrigger=true (triggered by the player). The trigger works fine, but is also triggered unexpectedly some times when the player walks near the collider, but still way out of its range.

See attached image: the capsule collider limits are wel within the round circle object. On the right you see that the player has triggered the trigger, while it was far away from the collider.

When I run circles around the collider, this will happen sometimes. Location appears to be random and it doesnt happen if the player is further away than say 10 meters.

Anyone else have this issue or can tell me what is causing it?

sentences: How does Navigation Mesh path-finding work? I want to understand how navmeshes work, how to implement them and why it is better than other types of pathing systems.

sentences: 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:
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 to make an object destructible? I have some 3d models that I have downloaded from Unity asset store. Most of the time, these objects are not "separatable" so I can't apply a destructible effect.

Is there a way to separate a model into small pieces, whether by using Blender, or a Unity script, or something else?

sentences:
frame lock networking I'm developing an RTS game and I want to add multiplayer support to my game.

I picked the easiest technique to implement for start frame locking technique.

I used server client networking architecture (I think it's my first mistake I think using peer to peer is a better one for this)
On game update every clients send their commands and maybe receive some command then render the frame and wait for all clients to send their update complete message then all of them can go for the next frame.

I send commands and all logic is calculated on the clients based on commands but the clients can go out of sync easily. Every AI controlled units make different decisions on each clients

What I have to do to sync my game?
Do you suggest me a better network architecture or technique?

sentences:
Speed from delta time not correct My game object isn't moving in correct speed calculated from deltaTime bellow. It should reach half of the screen in one second, on any device.

Devices:

tablet A7600-F - deltaTime = 0.03355443;  (res. 720x1280)
Xperia Z3 Compact - deltaTime = 0.13421772;  (res. 720x1280)

Calculation:

calc = (screenWidth / 2) * deltaTime. //I have app in landscape mode
speed = Math.round(calc);

speed on tablet - 21px per update;
speed on xperia - 86px per update;

You can see these results are very different (actualy it should be something about 8px - 20px). Game object is then extreme fast on Xperia (on tablet it's just a bit faster - speed is more than half of the screen per second).

What am I missing?

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:
Problem with scrolling background in one OpenGL loop I have 960x3000 map image in png and I'm scrolling it in a loop like this (it's called in 60 FPS loop):

glPushMatrix();
    glBindTexture( GL_TEXTURE_2D, mapTex[iBgImg]);
    glBegin(GL_QUADS);
    double mtstart = 0.0f - fBgVPos/(double)BgSize;
    double mtend = mtstart + mtsize;
    glTexCoord2d(0.0, mtstart); glVertex2f(fBgX, TOP_MARGIN);
    glTexCoord2d(1.0, mtstart); glVertex2f(fBgX + MAP_WIDTH, TOP_MARGIN);
    glTexCoord2d(1.0, mtend); glVertex2f(fBgX + MAP_WIDTH, BOTTOM_MARGIN);
    glTexCoord2d(0.0, mtend); glVertex2f(fBgX, BOTTOM_MARGIN);
    glEnd();
glPopMatrix();

unfortunately it isn't smooth when the game is in windowed mode. However, it is smooth in full screen mode. I'm using GLFW for windows. Maybe there is something wrong with my method? Is there anything better? Or could this be hardware problem?

Edit:
Window is created using

 glfwOpenWindowHint(GLFW_WINDOW_NO_RESIZE, GL_TRUE);
 glfwOpenWindowHint(GLFW_REFRESH_RATE, 60);

and main loop is using glfwSwapInterval(1) to ensure 60 FPS;

sentences:
Oblique launch within a game I'm creating a simple game in python that will follow the same logic of DDTank and Worms. The graph is formed by characters. The buildings that will be destroyed are formed by '*', players are '@' and the projectile I still did not think the character. For now I did the part that draws the buildings with a random height.

But I was thinking the logic of launching projectiles. I learned in physics classes some formulas for oblique launch. So wanted to know if these formulas would fit in a computer program or I would have to invent another logic?

Formulas:

vx = v0 . cos ?
x = vx * t
v0y = v0 * sen ?
y = v0y * t + g * t² / 2

sentences:
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:
How do I change a shape without affecting the rest of the screen? I have drawn a shape like this in OpenGL:

 glColor4f(red,green,blue);
        glBegin(GL_QUADS);
            glVertex2f(x1,y1);
            glVertex2f(x2,y2);
            glVertex2f(x3,y3);
            glVertex2f(x4,y4);
        glEnd();
glFlush();

and I want change one the vertices like

glVertex2f(x_delta,y_delta);

But how do I redraw the shape without altering the other components of the screen?

sentences:
server/client architecture, how to combine physics data, scene graph and database over the network? I'm writting a C++ server and a C++ client for a rpg game.

The client is using OpenSceneGraph for rendering the 3D. RakNet is used for communication between the client and server.

At this time, the client and the server can communicate together. I have installed bullet for physics, but I didn't added bullet to the server nor the client.

The first reason is because I would like to know what you think about my idea to put the whole physics on the server and just sending to each clients, the updated quaternions for all actors view by each clients.

My second problem is, I never really used bullet, moreover never with a 3D engine. And I don't know if I need to build a scene graph on the server, or if I have to use another strategy. More precisely, most of such games seem to use a database. I using sqlite in some other C++ projects, so I don't have some question about that, but only about the fact that I never wrote a scene graph, so the question is, should I wrote one database scene graph ? or use a scene graph in memory and using a database to save the whole scene graph ? if so, should I do that every frame ?

sentences:
Can I use my self made piano version of a popular copyrighted song as my game background music? I am making a game, the theme of the game is kind of romantic, and I, myself, have made a piano version of a modern pop song that would fit with that theme. The song in question is still under copyright, and I'm not the owner of the copyright.

Can I use it as a background in my game? Would there be any legal issue regarding copyright/IP etc?

sentences:
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:
How can I apply a mesh distortion to walls like in Dungeon Keeper 2? In Dungeon Keeper 2, the walls of the dungeon have different random shapes depending on its state (freshly dug or reinforced, and so on).

They look like they are cubes of 3x3 vertices that have a x-z planar jitter or distortion. However, the corner vertices are shared by adjacent cubes, so there must be some kind of algorithm rather than just a random jitter.

How could I achieve a similar effect?

sentences:
What is the best way to manage 'state' in Phaser? I have heard that this is not the best way to manage state in phaser

var game = new Phaser.Game(800, 600, Phaser.CANVAS,'YourGameName');
game.state.add("Boot", Boot);
game.state.add("Preload", Preload);
game.state.add("MainMenu", mainMenu);
game.state.add("Play", Play);
game.state.add("GameOver", GameOver);
game.state.start("Boot");

so what is the best way to do it. I am newbie in Phaser game development.

sentences:
Progressively loading the racing arena in a 3D driving sim I need advice and resources on a 3D car simulator.
I want to progressively load the track for the player as I'm thinking of porting the game to mobile devices.
This seems too difficult to me as I'm trying to separate the racing arena model design and the code as much as possible. Is there a structured method for achieving that for any model (arena/map). I think this is something that comes up a lot in games in general not just this instance.

sentences:
Unity 5 The Editor has stopped working Windows 7 64bit As soon as I press the play button to attempt to run any of my updates games crashes the editor immediately and I can't run my games.

Does anyone know how I could debug this or where to start? Does Unity keep a log of errors when it crashes?

I have both a 2D and 3D game that do not work and the editor is not throwing any errors or telling me there are compile time issues.

EDIT: If it makes any difference it is the 64bit version and I am using a Student Pro License

sentences:
Algorithm for units to attack each other in strategy games I am creating a strategy game with many objects, in which the objects will be able to attack each other.

If an object is within attack range of another object, it will be attacked. But I only know one way is to loop through all objects to see if it is within the scope of this object's attack. Therefore the complexity of the algorithm is O (n ^ 2). Can someone give me a better algorithm or preferably a book about algorithms like this.

Thanks !

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: How can I change the rendering backend on Windows in Monogame? I'm using MonoGame with Visual Studio 2013 Express. I'd like to switch from a SharpDX backend to OpenGL and OpenAL. How do I achieve that?

sentences:
Moving a particle around an Archimedean spiral at a constant speed I want to move a particle in a spiral at a constant speed. Note that that is not a constant angular speed. This is proving rather difficult, and I'll go through my method so far below.

The spiral in question is a classic Archimedean spiral with the polar equation r = ϑ, and the parametric equations x = t*cos(t), y = t*sin(t). This looks like this:

I want to move a particle around the spiral, so naively, I can just give the particle position as the value of t, and the speed as the increase in t. That way the particle moves round the spiral at a constant angular speed. However, this means that the further out from the centre it gets, the faster its (non angular) speed becomes.

So, instead of having my speed in the increase in t, I want my speed as the increase in arc length. Getting the arc length of a spiral is the first challenge, but due to the fact that the Archimedean spiral I am using isn't too insane, the arc length function is , where a = 1. This allows me to convert theta values to the arc length, but that is the precise opposite of what I need. So I need to find the inverse of the arc length function, and at that hurdle, Wolfram-Alpha has failed me.

So is it possible to find the inverse of the arc length function? The function is a one to one mapping, if you exclude negative values of theta.

Thanks,

Laurie

sentences:
Unity3d not allowing endpoint to save cookies So I'm using an external DLL with Unity to login to a web service and access functions from it.

The DLL works perfectly fine in a command prompt project, but when run in Unity I can log in successfully, but when I try to use any commands I get a session has expired error.

The DLL stores session cookies in the endpoint, so it appears that Unity isn't allowing this custom endpoint to store cookies.

Does anyone know how to make Unity allow custom endpoints to store cookies? Or where in an endpoint I could parse the cookie from so I could feed it in with any service commands?

For reference, here's a link to the main DLL, and here's a link to ContentService. The main DLL is compiled for .NET 3.5 so as to work with Unity.

Just as a reference, here's the exact error code I'm getting in Unity:

FaultException: Your session has expired.
System.ServiceModel.ClientRuntimeChannel.Request (System.ServiceModel.Description.OperationDescription od, System.Object[] parameters)
System.ServiceModel.ClientRuntimeChannel.DoProcess (System.Reflection.MethodBase method, System.String operationName, System.Object[] parameters)
System.ServiceModel.ClientRuntimeChannel.Process (System.Reflection.MethodBase method, System.String operationName, System.Object[] parameters)

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:
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:
Unity: Is there any way for a button to call a function of all clones? I really don't know off hand. I've got a few ideas but I'm not at my PC to test it.

like ButtonisPressed > Clone script etc()

//on every gameobject clone
void etc() {
  i = 2;
}

That way all i's in the clones will be 2. I want it to work like pacman, if all the clones(or ghosts) have i = 2 then they enter their blue state and they change colors. Except I want to call etc() function with a button
Thanks in advance. If no one figures it out, I will report back later (~12hrs)

sentences:
Intantiating objects across multiple container pages I have this script here that generates buttons based on an array and a serialized grid transform
public void InitializeUI()
{
    LevelItem[] levelItemsArray = LevelSystemManager.Instance.LevelData.levelItemArray;
    for (int i = 0; i < levelItemsArray.Length; i++)
    {
        if (i % n == 0) // sets it to 15
        {
            LevelButtonScript levelButton = Instantiate(levelBtnPrefab, levelBtnGridHolder);
            levelButton.SetLevelButton(levelItemsArray[i], i, i == LevelSystemManager.Instance.LevelData.lastUnlockedLevel);
            var page = GameObject.FindObjectOfType<UI.Pagination.PagedRect>();
            page.AddPageUsingTemplate();
        }
    }
}

Now what I'm trying to do is make that array instantiate a new page (calling the page.AddPageUsingTemplate() function which is from another script) once for every 15 items of the array.
I have 75 levels and want to instantiate the buttons on a new game object which has a grid layout group, so it would be 15 buttons on each grid with 5 pages/grids in total.
I do indeed get 5 pages when I run this code, but since the transform is only set to the first one the buttons don't get placed on the other pages.
How can I place buttons after the first 15 on the following pages?

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:
Can not play a disabled audio source? I have 5 cubes and all 5 cubes have an audiosource. When my player jumps into those cubes, the audiosource is playing just once. It was working. But then, I decided to re-organize my hierarchy and audiosource didn’t work well.
When I jump to first cube, the audio plays but then if I try to jump to the other cubes, the audio does not play. I have a prefab cube and all 5 cubes are the created from that prefab. It gives Can not play a disabled audio source and I don’t know why?  I haven’t changed about coding part.
This is my first cube component :
The other 4 cubes (actually they all the same as with the first cube):

Coding Part :
//Eğer karakter ses efekti tamamlanmadan diğer paddle'a atlarsa paddle ses çıkarmıyor. Bunu düzelt

[SerializeField] AudioSource clickSound;

bool landedorNot = false;

void Start()
{
}

private void OnCollisionEnter(Collision collision)
{
    if (collision.gameObject.name == "Ship New Pos" && landedorNot == false )
    {
        landedorNot = true;

        if (!clickSound.isPlaying)
        {
            clickSound.Play(); // this is where the error occurs according to Unity
        }
    }
}

sentences:
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:
Peer to Peer world download I am creating a multiplayer JavaScript game with a PHP central server. Each user will be able to move around in a 3D world, with other users and NPCs. It came to my attention that SQL is not going to handle all the requests being made in a reasonable time. So I cut down on SQL requests being made as often, using RAM when I can, but each user that logs into my world, or switches worlds requires a lot of data to be filtered from the server (So the client does not get any information it should not have, and so I don't have to distribute the entire world for every logon) and then uploaded to the client. So I had an idea: What if I can get the World data from the users near to the player(In the 3D world), like a BitTorrent? How to resolve syncing issues? What are my options to prevent Hacking? My ideas were: check with more than one user, get a hash from a server(will probably have syncing problems), have bots who request worlds from clients: then checks with server to see if they are being honest, how ever they all seem to have their problems, and am not sure which one(s) I should incorporate, or if there is a better way I could get correct world data from peers, with minimal server interaction.

Note: Peer to Peer is only used to get the world, block/world updates are still handled between the server and each client

sentences: Counting no.of bodies present in certain area in box2d? I am stuck on it:how can i count or find the no.of bodies present in any area in as3?would be thankful if any guys help me out.....

sentences:
2D Collision detection: rewinding to moment of first intersection I am working on a collision system in a Platformer tile-based game. All tiles are AABB.

I am trying to implement "Rewind to Moment of First Intersection" mentioned in this post's second point.

The following case is to be considered:

Without vectors for clarity:

With vectors:

I am trying to find the vector \$\vec{w}\$, which is the vector \$\color{red}{\vec{v}}\$ multiplied by a factor \$f \in (0, 1) \$. All other vectors are known.

\$\color{red}{\vec{v}}\$ represents the reversed movement (or velocity) vector between current and previous frame, whereas \$\vec{w}\$ represents \$\color{red}{\vec{v}}\$ scaled in such a way, that translating the player object over \$\vec w\$ leaves the player in the moment of first intersection.

\$\color{green}{\vec{a}, \vec{b}}, \color{blue}{\vec{c}, \vec{d}}\$ represent the penetration depths of colliding objects on corresponding horizontal/vertical axises.

Tiles' width and height is also known.

Assuming that tiles are AABB, strictly-aligned, immovable and all share the same width/height - how do I find the vector \$\vec{w}\$?

Seeing pseudocode would be awesome.

I am also having surprisingly hard time finding any collision solving learning materials that would suit my needs; if anyone knows such materials, I would be thankful for sharing.

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:
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: 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:
Why is XmlSerializer adding junk to the end of my file? I'm making a game and I am serializing the save game data. The data is simply a few lists of bools, ints and floats.

But about 50% of the time I get an error when the data tries to save or load that says "There is an error in XML document." The error is always located at the end of the file, even after it has changed size or I have added other variables.

It appears that very last part of the XML data is getting copied twice. The last line of the XML should read:

</LevelStats>

But when an error occurs it often reads

</LevelStats>>

Or

</LevelStats>tats>

Or some other small part of the last line duplicated.

Here is the class I am serializing:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using Microsoft.Xna.Framework.Storage;
using System.IO;

namespace Jetpack.Classes
{
    [Serializable]
    public struct LevelStats
    {
        // Player Bests
        public List<float?> fTimeList;
        public List<int?> iScoreList;
        public List<int?> iFuelList;

        // Time
        public List<bool> bBronzeTimeList;
        public List<bool> bSilverTimeList;
        public List<bool> bGoldTimeList;

        // Score
        public List<bool> bBronzeScoreList;
        public List<bool> bSilverScoreList;
        public List<bool> bGoldScoreList;

        // Fuel
        public List<bool> bBronzeFuelList;
        public List<bool> bSilverFuelList;
        public List<bool> bGoldFuelList;

        // Level Complete
        public List<bool> bIsLevelComplete;
    }
}

And here are my methods for saving the loading the data:

region Save & Load Level Stats
    public static void SaveLevelStats(LevelStats levelStats, string filename)
    {
        // Get the path of the save game
        string fullpath = System.IO.Path.Combine(Directory.GetCurrentDirectory(), filename);

        // Open the file, creating it if necessary
        FileStream stream = File.Open(fullpath, FileMode.OpenOrCreate);
        try
        {
            // Convert the object to XML data and put it in the stream
            XmlSerializer serializer = new XmlSerializer(typeof(LevelStats));
            serializer.Serialize(stream, levelStats);
        }
        finally
        {
            // Close the file
            stream.Close();
        }
    }

    public static LevelStats LoadLevelStats(string filename)
    {
        LevelStats levelStats;

        // Get the path of the save game
        string fullpath = System.IO.Path.Combine((Directory.GetCurrentDirectory()), filename);

        // Open the file
        FileStream stream = File.Open(fullpath, FileMode.OpenOrCreate,
        FileAccess.Read);
        try
        {
            // Read the data from the file
            XmlSerializer serializer = new XmlSerializer(typeof(LevelStats));
            levelStats = (LevelStats)serializer.Deserialize(stream);
        }
        finally
        {
            // Close the file
            stream.Close();
        }

        return (levelStats);
    }

    #endregion

Why am I getting the error above?

sentences:
Make half of the sprite transparent Guys if I have two sprites placed on the same spot. How can I show the half of each Sprite instead of the one on top? The sprites are basic circles

All sprites have basic colors, no textures.

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:
Does converting quaternion to matrix cause a lot of overhead? This is related to rendering creating a model, view, projection matrix for opengl. While matrix are fairly standard there's a lot of talk about using quaternions for rotations but why would u go from quaternions to matrix and back to matrix?

Quaternions might be faster but if you have to switch to matrix and back again doesn't that overhead eat into using just matrix only?

Is the typical workflow for using quaternions with matrix is to let the quaternion handle the rotation then create a 4x4 matrix from that rotation to concat with translation/ scale matrix in the model->view->projection matrix stack?

Does converting quaternion to matrix cause a lot of overhead?

sentences:
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:
Ethical F2P monetisation methods I am just starting out in indie game development and one thing that seems clear to me is that in the mobile space at least, unless you are already a famous developer, have a well known brand/franchise or are just plain lucky, then you need to price your game at zero to stand any chance of being installed on devices. So to make money you must use Free to play (F2P) monetisation methods. In my own experience with myself and my kids plus reading around on the Web a lot of these methods are not appreciated by the players...

My questions is: Which F2P methods do players find ethical and acceptable?

I am looking for specific game mechanics and an answer which references or is based on data/research (if there is any) and not personal opinions or anecdotal references to successful, money making F2P games like Candy Crush Saga or Clash of Clans etc.

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:
OpenGL: missing GL_SPECULAR light on the texture I'am missing specular lighting on the texture. I have #include <GL/glext.h> in the project, so basically I used glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL_EXT, GL_SEPARATE_SPECULAR_COLOR_EXT); for specular effect. My init code:

glEnable(GL_DEPTH_TEST);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glEnable(GL_CULL_FACE);
GLfloat AmbientLight[]   = {  0.3,  0.3,  0.3,  1.0 };
GLfloat DiffuseLight[]   = {  0.7,  0.7,  0.7,  1.0 };
GLfloat SpecularLight[]  = {  1.0,  1.0,  1.0,  1.0 };
GLfloat Shininess[]      = { 90.0 };
GLfloat Emission[]       = {  0.0,  0.0,  0.0,  1.0 };
GLfloat Global_Ambient[] = {  0.1,  0.1,  0.1,  1.0 };
GLfloat LightPosition[]  = { 7.0, 7.0, 7.0,  1.0 };

glLightModelfv(GL_LIGHT_MODEL_AMBIENT, Global_Ambient);
glLightfv(GL_LIGHT0, GL_AMBIENT, AmbientLight);
glLightfv(GL_LIGHT0, GL_DIFFUSE, DiffuseLight);
glLightfv(GL_LIGHT0, GL_SPECULAR, SpecularLight);
glLightfv(GL_LIGHT0, GL_POSITION,LightPosition);

glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION,  0.05f );
glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION,    0.03f );
glLightf(GL_LIGHT0, GL_QUADRATIC_ATTENUATION, 0.002f);

glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, AmbientLight);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, DiffuseLight);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, SpecularLight);
glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, Shininess);
glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, Emission);

glShadeModel(GL_SMOOTH);
glEnable(GL_LIGHT0);
glEnable(GL_LIGHTING);
glEnable(GL_COLOR_MATERIAL);
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);

My render code:

glClearColor( 0.117f, 0.117f, 0.117f, 1.0f );
glClearDepth(1.0f);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
// load texture
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_LIGHTING);
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL_EXT, GL_SEPARATE_SPECULAR_COLOR_EXT);
glColor4f(1.0, 1.0, 1.0, 0.2);
glDisable(GL_COLOR_MATERIAL);
// render geometry here
glFlush();

What is missing here?

sentences:
How to resize an image loaded using ContentManager in XNA I am new to XNA programming and I loaded the background image using ContentManager as a Texture2D object.

The background image which I have is of size 480*320. I have kept the minimum game window size as 640*480. My question is how would i resize the background image to the size of the game window.

Thanks in advance!

sentences:
Prototype experience: Unity3D vs UDK Has anyone yet prototyped a game in both Unity3D and UDK?

If so, which features made prototyping the game easier or more difficult in each toolkit?

Was one prototype demonstrably better than the other (given the same starting assets)?

I'm looking for specific answers with regard to using the toolkit features, not a comparison of available features. E.g. Destructable terrain is easier in toolkit X for reasons Y and Z.

I can code, so the limitations of the inbuilt scripting languages are not a problem.

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:
How to Implement a Very Simple Game State Manager in Unity? I’ve tried a bunch of different implementations, and trawled everything online I could get my hands on. Everything has downsides, nothing plays nicely with how Unity wants you to work.

Let’s keep it simple. You want to track in-game time. You want this to be available as a ScriptableObject. You need a MonoBehaviour to keep the time updated. You want to ensure there’s just one such GameState ScriptableObject and one such GameStateManager MonoBehaviour. You don’t want to manually add the manager to all scenes.

Is there a standard and sane way to achieve this without resorting to black magic?

To keep this grounded, here’s the boilerplate ScriptableObject:

    [CreateAssetMenu(fileName = "GameState", menuName = "ScriptableObjects/GameState")]
    public class GameState : ScriptableObject {

        /// <summary>
        /// The time passed in game, in game time, in seconds.
        /// </summary>
        public float TimePassed { get; private set; } = 0.0f;

        /// <summary>
        /// Moves the in-game time and date forward.
        /// </summary>
        /// <param name="addedGameTime">Time to add, in in-game seconds.</param>
        public void MoveTimeForward(float addedGameTime) {
            // Move the time passed forward
            TimePassed += addedGameTime;
        }

    }

And MonoBehaviour:

    public class GameStateManager : MonoBehaviour {

    /// <summary>
    /// The state of the game.
    /// </summary>
    public GameState gameState;

    // Start is called before the first frame update
    void Start() {
        // If we use a Singleton, and not drag a reference using the editor:
        gameState = GameState.Instace;
        // Mark that this should not to be destroyed when loading new scenes
        DontDestroyOnLoad(gameObject);
    }

    // Update is called once per frame
    void Update() {
        // Update the in-game time
        gameState.MoveTimeForward(Time.deltaTime);
    }

}

sentences:
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:
Unity2D: How to save volume of audio source when game is restarted? How do I save volume of my audio source (clicking the mute button) when game is restarted. You see I have one scene in my game and once the player dies there is a button the user can click on that resets the game, however it also resets the audio source, so when I play the game and click my mute button, the audio source volume is at 0 but when I die and click the reply button (the restart/reset button) the music is restarted as well, instead of staying muted (save the current volume). I tried using DontDestroyOnLoad(this) but my muted script is attached to my game over panel animation (the panel comes down when player dies) making the my game over panel animation not being destroyed when you restart the game. I tried other methods like putting my mute button script on a parent empty object and putting the object that has the audio source on under it as a child but it did the same thing.
Anyway this is my mute button script:

private bool mute;

public void Muted ()
{
    mute = !mute;
    if (mute){
        gameObject.GetComponent<AudioSource>().volume = 0;
    }else
    {
        gameObject.GetComponent<AudioSource>().volume = 1;
    }
  }
}

And this is my restart level when button is pressed (p.s. I used the OnClick method activating methods):

public void NavigateTo(int scene)
{
    Application.LoadLevel ("Game Level");
}

Thank you in advance :)

sentences:
Handling character with world object collision in libgdx and bullet I am using libgdx and bullet for my 3d mmo project. I have been able to detect collisions using a collision world with collision objects. This was working fine for things like detecting players hitting each other but I was having problems handling players hitting walls or other world objects.

After some searching I came across rigid bodies and the dynamics world. This seemed like it would solve my issue but once I got my objects converted over to rigid bodies my collision handler is no longer detecting collisions and the player is still going through walls.

I would like to not have to handle the low level details of players not going through walls but I would still like to be able to manually handle collisions of collision objects for things like spells or weapons. What is the best way to go about this? I am also seeing different bullet objects like static, kinematic, dynamic, but I am not sure which is best for my situation. I also am thinking that part of my problem may be that I am translating my character every update instead of updating its velocity.

What is the best setup for accomplishing this?

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:
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:
Blueprint script executed on tick but not on construction Below, on event tick, I am initializing a map of images once, which works fine (remember we are in a graph for a widget blueprint here).

Z Cursor Images is the map of the images. The keys in the map are an enum, and I am adding first an image for the default cursor, and then an image for when the player is targeting an object that she can pick up.
Now, when I do the same in the construction script (Event Construct), it does not throw an error but later I cannot access the textures from the map. IsValid returns false for them...
So why is the map filled on tick but not on Event Construct? And how do I solve this?

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:
Modern way of getting points within a distance? I'm making a game engine, and some components may want to interact with others based on distance. Currently, the component registers an update listener which runs on a loop, then it checks the distance for each object. This is obviously wrong.

I thought about creating a system just for spacial relations, where the component would ask every frame if there are objects within a radius to that system, and it would have something like an octree inside to accelerate the calculations. I can also just register a listener for when objects are closer than a radius, and it would update only when an object changed from one node to the other on the tree.

Is the octree appropriate or is it just better for static objects like terrain? What do physics engines use?

sentences:
Circle-line segment collision resolution I'm trying to make a side-scrolling game using this method and I'm having some trouble getting it to behave right. The collision shapes consist of multiple connected line segments and I'm checking them one at a time in order from first to last, so in one direction the collisions are resolved in the wrong order and the circle can't move over the connection point.

Is there a way of fixing this that isn't a hack, or should I try preventing the collision from happening in the first place instead?

ETA: The circle is moved straight up if the overlapping line segment is below and not too steep (approx. 50 degrees maximum) to enable it to move on slopes without resistance. In all other cases, the minimum displacement vector is used to resolve the collision.

sentences:
Tile base Farm Simulation in Unity I am thinking of creating a sprite base 2d top down farm simulation game. The game uses tiles and I was wondering (conceptually) what is the best way to handle the farm tiles. Each tiles should have the following list of features.

The player should be able to add seeds to each tile
The player should be able to plant a variety of vegetables.
Plants should have different stages of growth
The player should be able to interact with each tile (dig, cover holes, water, add fertilizer, etc).
The farm layout can have a variety of shapes (i.e. Not just a square (9 x 9) or rectangle (9 x 15) a shaped farm.)

Currently I have a script that generates a square or rectangle shaped like farm, each tile is a sprite object with a 2D collider. I have come up with a solution for planting and the different stages of growth. However, it isn't the most elegant solution. My current solution is to create prefab for each plant. Then once a seed is planted onto a tile, create a plant object in the location of the tile (using it's vector position), and make the plant a child object to that tile. Each plant will have an age counter that increase when a new day is triggered. To show the growth stage swap the texture depending on the plant's age.

My biggest problem with the implementation is that if the players farm is very large the game will have to create a hundreds object, which seem very taxing. Is that a different way achieve these features without the use of so many objects? If so, how would I implement it (conceptual of course). Thanks!

sentences:
Initial force to achieve orbital velocity I'm attempting to get asteroid to orbit a black hole that is asserting gravity. Some parts currently work, like the black hole asserting gravity, attracting asteroids in and destroying them. And sometimes the asteroids, or smaller chunks end up in orbit around the black hole. But my desire is to have them orbiting at random distances at the start of the game.

Gravity

First please note, I am certain the math behind a lot of this is off, I'm hacking a concept at the moment and once enough pieces are in place I intent to come back through and apply proper scale and units to everything.
Next, it's written in JS but concepts should be fairly universal.

  function attractBodyToBlackHole(body) {
    var sx = body.position[0];
    var sy = body.position[1];
    var bx = blackHoleBody.position[0];
    var by = blackHoleBody.position[1];

    var angleToBody = Math.atan2(sx - bx, sy - by);
    var distanceToBody = Math.sqrt(Math.pow(sx - bx, 2) + Math.pow(sy - by, 2));

    var magGrav = 0.8 - (distanceToBody / 14);
    if(magGrav < 0) {
      magGrav = 0;
    }

    body.force[1] -= magGrav*Math.cos(angleToBody);
    body.force[0] -= magGrav*Math.sin(angleToBody);
  }

This function is applied to each object on p2's step, attracting it closer to the black hole.

Asteroids

function addAsteroid() {
  var bx = blackHoleBody.position[0];
  var by = blackHoleBody.position[1];

  var a = Math.random() * (Math.PI * 2);
  var dist = 3 + (Math.random() * 3);
  var x = dist * Math.cos(a);
  var y = dist * Math.sin(a);

  var vx = ?;
  var vy = ?;

  var asteroidBody = new p2.Body({
    mass:10,
    position:[x,y],
    velocity: [ vx, vy ]
  });
}

So my question is, how can I calculate velocity x/y (or force x/y ideally) to get these objects, based on their position, distance and the force of attraction from the black hole?

sentences:
How to change particle graphics emitted by FlxEmitter? I'm working with Flixel and attempting to emit "custom" FlxParticles from a FlxEmitter.  However, my main issue is that I typically get the default Flixel image emitted instead of my custom graphic.

If I modify the FlxParticle constructor in the Flixel source code like so:

public function FlxParticle()
{
    super();
    lifespan = 0;
    friction = 500;
    makeGraphic(4, 4, 0xFFFFFFFF);
}

I can get a custom particle (a 4 x 4 white square) to emit from my FlxEmitter.

However, if I write my own class that extends FlxParticle like so:

public class EffectParticle extends FlxParticle
{
    public function EffectParticle()
    {
        super();
        makeGraphic(4, 4, 0xFFFFFFFF);
    }
}

That class won't work - I will get the default Flixel image instead of my tiny white square.  I similar thing happens if I just call "makeGraphic()" on a FlxParticle variable.

Why does this happen, and other than modifying Flixel's source code or loading in custom graphic (from an embedded image), how can I create my custom particles?

sentences:
OpenGL ES - render to texture - how to preserve original depth buffer I render to texture and attach my own depth buffer that has texture target. However, after I finish rendering I would like to set original depth buffer back.
To start rendering to texture I do:
glGetIntegerv(GL_RENDERBUFFER_BINDING, &bindedDepthBuffer); //returns 0
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &bindedFrameBuffer);  //returns 0

glBindFramebuffer(GL_FRAMEBUFFER, rttFboId);
glBindRenderbuffer(GL_RENDERBUFFER, rttDepthId);
glViewport(0, 0, rttViewPortWidth, rttViewPortHeight);

... render scene

glViewport(0, 0, origWidth, origHeight);
glBindFramebuffer(GL_FRAMEBUFFER, bindedFrameBuffer);

Now after I do:
glBindRenderbuffer(GL_RENDERBUFFER, bindedDepthBuffer);

the original depth buffer stops working and it seems as its content is empty (everything that is rendered after this point behave like the depth buffer has been cleared). This problem occurs only on some OpenGL ES devices with Android and I dont know what can cause this.

sentences:
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:
Multilayer game HTML5 canvas I've have a problem with HTML5 canvas and using multiple layers.

I'm using 3 layers. The first layer is where the player and the collision base objects are. And the second and the third layer have the rest of that objects, and that are suppose to cover the character if is behind them. But I have this problem:

The tile in the upper layer than the character cover him, even if he is in front of that object.

And I have other problem:

When is a the back of the element, there's a part of the character that appears in the middle of the poster.

How can I resolve this? I don't know how exactly do this, and I think that use layers is not very convenient.

Here's how I render the map:

function drawMap () {

for (var rowCtr = 0; rowCtr < map.tileMap[0].length; rowCtr++) {

    for (var colCtr = 0; colCtr < map.tileMap[0][0].length; colCtr++){

        var tileId  = map.tileMap[0][rowCtr][colCtr] - 1;
        var sourceX = Math.floor(tileId % 8) * 32;
        var sourceY = Math.floor(tileId / 8) * 32;

        ctx.drawImage(map.sprite.img, sourceX, sourceY, 32, 32, colCtr * 32, rowCtr * 32, 32, 32);

    }

}

finn.movement(this.ctx, this.world);

if (map.tileMap.length > 1) {

    for (var capa = 1; capa < map.tileMap.length; capa++) {

        for (var rowCtr = 0; rowCtr < map.tileMap[0].length; rowCtr++) {

            for (var colCtr = 0; colCtr < map.tileMap[0][0].length; colCtr++){

                var tileId  = map.tileMap[capa][rowCtr][colCtr] - 1;
                var sourceX = Math.floor(tileId % 8) * 32;
                var sourceY = Math.floor(tileId / 8) * 32;

                ctx.drawImage(map.sprite.img, sourceX, sourceY, 32, 32, colCtr * 32, rowCtr * 32, 32, 32);

            }

        }

    }

  }

}

And here's an example of the map:

  `[
    [0, 0, 0, 0],
    [0, 0, 0, 0],
    [0, 0, 0, 0],
    [0, 1, 1, 0]
   ],
   [
    [0, 0, 0, 0],
    [0, 1, 1, 0],
    [0, 1, 1, 0],
    [0, 0, 0, 0]
   ]`

That's the array of the layers. The first is the first layer, where the character moves, and the second element is the layer where the part of the objects which cover are drew.

Is there any solution for this without using any external Engine, only using canvas and javascript?

Thanks advance!

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:
What freeware frameworks and tools to choose if I want to build a game like Farmville or Club Penguin? Say I like to experiment with multiplayer games and I do not want to reinvent the wheel and build yet another game server. I don’t mind configuring and writing wrappers and adapters (both in c++ and java) for the server.
What server does Farmville use? Is it Java or C based?
What isometric flash engine do they use?  What other examples can I look into to learn the subject?
Thanks.

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:
Debugging a custom content pipeline processor in XNA? I'm working with a custom made content pipeline designed to work with the program Tiled (using the TiledLibrary found here). I am running into trouble with the MapProcessor class in the custom content pipeline, and would like to be able to debug it to find out what exactly is going on.

However, when I try to use lines such as Console.WriteLine(...) or breakpoints, these lines are ignored by the debugger built into Visual Studio. Is the content pipeline barred from access to things like console writing and breakpoints? If so, is there a way to fix this?

I'm a bit new to C#, XNA, and Visual Studio, so bear with me if this is a dumb question. I tried googling my problem (as well as searching this stackexchange) but was unable to find any answers. Thanks!

sentences:
2D SAT Collision - Triangle and Square Problem So I was just doing an example 2D SAT collision detection problem on paper when I encountered something unexpected. I ran the algorithm on a triangle and a square, and the result of the algorithm was that there was a collision, when indeed there was not. Take a look at this:

grey lines are the axes, red marks are extremes of projection endpoints (from both shapes) on each axis

I was under the impression that the SAT algorithm checked for overlapping vertices on all unique axes generated by both shapes sides' normals, and if no gap is found on any axis, then there is a collision. It looks like that does not work in this example. Can someone explain what I am missing? Maybe I'm understanding the algorithm wrongly.

sentences:
AI for Shogi, dealing with high branching factor due to drop rule I'm writing a Shogi program with a computer player in Java from scratch as my undergradute
dissertation project. Due to the drop rule, when the computer player captures a few pieces, the branching factor increases a lot and the running time becomes infeasible. I haven't manage to find any research or information on drop reduction and my own selection is too slow and not "selective" enough (trying to remove drops that are not safe or not protected and don't have any use like defending or attacking). Does anyone know any heuristics that can be implemented with reasonable time complexity for selecting drops that are worth adding to the game tree ? Cheers.

So, like in (western) Chess a piece can be captured and when a piece is captured the capturing player holds on to it. Now this piece can be dropped on the board anywhere on a free tile in any of the next turns (instead of moving a piece from the board). There are a lot more rules to drops but they are irrelevant. Because of this rule, when a player makes a capture, instead of a decrease in the branching factor like in chess, an increase of the branching factor happens because of the large amount of possible drops that can be made on the next turn. This results in an average branching factor of 80 (much more than Chess which has a average branching factor of 35).

sentences:
Unity3D - How to get highest value for acceleration from Input.gyro I'm trying to develop an app that can detect car acceleration, braking and cornering speed. I need to detect device acceleration. Is that acceleration high or low?. Like flo app on Google Play.

I'm using gyroscope and I need to get highest value for user acceleration (x, y, z axises) from gyroscope. Values of x, y and z are changing every frame. I need to achieve highest value of this 3 axis for later use.

Now my current code looks like this

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

public class NewBehaviourScript : MonoBehaviour
{
 public Text x, y, z;

 void Start()
 {
     Input.gyro.enabled = true;
 }

 void Update()
 {
     x.text = Mathf.Abs(Input.gyro.userAcceleration.x).ToString();
     y.text = Mathf.Abs(Input.gyro.userAcceleration.y).ToString();
     z.text = Mathf.Abs(Input.gyro.userAcceleration.z).ToString();
 }
}

Thanks for any help

sentences:
Fragment shader compiling in webGL but not in OpenGL I am programming in Haxe (language compiling to multiple platforms) and I have written some shaders.

My fragment shader runs fine in html5, but when I try to compile for native (OS X and/or Neko, a VM for Haxe) I get a shader compilation error, but no details (I am using lime which is a platform abstraction that does these things for me).

Here is the shader:

precision mediump float;

varying vec4 v_color;

void main() {
    gl_FragColor = v_color;
}

Very simple as you can see. It runs fine in webGL, but it seems it won't compile in OpenGL. I am no expert in shaders so I have no idea what might be wrong. Am I using some syntax that only exists in webGL?

Also just in case, here is my vertex shader (which compiles fine):

attribute vec3 a_position;
attribute vec4 a_color;
uniform mat4 uMVMatrix;
uniform mat4 uPMatrix;

varying vec4 v_color;

void main() {
    gl_Position = uMVMatrix * vec4(a_position, 1);
    v_color = a_color;
}

sentences:
Walk to mouse click position in Java I am very new to programming, and trying to get my player to walk to the mouse click position. I currently have this script, which "teleports" my character to the clicked position:

private void getInput() {
    xMove = 0;
    yMove = 0;

    float tempX = handler.getMouseManager().getMouseX();
    float tempY = handler.getMouseManager().getMouseY();
    float diffX = tempX - x;
    float diffY = tempY - y;

    if (handler.getMouseManager().leftPressed) {
        x = tempX;
        y = tempY;
    }
}

The first thing that came to my mind was to use the following script, for moving to a click which is to the right:

if (handler.getMouseManager().leftPressed) {
    if(diffX>0) {
        for(float counter = 0; counter = diffX; counter++)
            xMove = speed;
    }
}

However, this doesn't work. How would I go about making my player walk to the mouse click position?

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:
How would I make an air hockey AI? I am making an air hockey game for Android using AndEngine and its Box2D extension.

How would I make an AI for an air hockey game? For it to work the AI would not only need to move its paddle side to side to defend but also move forward for an attack. What kind of code would I need to implement this?

sentences:
score and high score system for multiple levels I'm trying to create a scoring system for a game with multiple levels. For this I'm using the binary formatter instead of playerprefs (I read online that playerprefs are not that secure). I have created the system but whats happening is that the score is not resetting to 0 when I load a new level. If in one level the score was 10 and I start some other level, the score in this level starts from 10 instead of 0. This is the code I have so far:

public class ScoreIncrease : MonoBehaviour
{
  public Text scoreTxt;
  public int score;

void Start()
{
    LoadScore();
}

void Update()
{
    if (Input.GetKeyDown(KeyCode.Space))
    {
        Save();
    }
}

public void Save()
{
    score++;
    scoreTxt.text = "Score" + score;
    BinaryFormatter bf = new BinaryFormatter();
    FileStream file = File.Open(Application.persistentDataPath + "/scoreContainer.dat", FileMode.Create);

    ScoreContainer scoreContainer = new ScoreContainer();
    scoreContainer.score = score;
    bf.Serialize(file, scoreContainer);
    file.Close();
}

public void LoadScore()
{
    if(File.Exists(Application.persistentDataPath + "/scoreContainer.dat"))
    {
        BinaryFormatter bf = new BinaryFormatter();
        FileStream file = File.Open(Application.persistentDataPath + "/scoreContainer.dat", FileMode.Open);
        ScoreContainer scoreContainer = (ScoreContainer)bf.Deserialize(file);
        file.Close();
        score = scoreContainer.score;
        scoreTxt.text = "Score" + score;
    }
  }
}

[Serializable]
public class ScoreContainer
  {
    public int score;
  }

How can I change this so that each level has a separate highscore and all levels have a start score of 0?

sentences: Plot HDR tonemap curves I am using a tonemapper in our project and a friend of mine asked if I could provide him with a plot of the tonemapper used (different functions are implemented). I tried in MATLAB to copy the tone-mapper function and use luma values from -5 to 5.0 to feed to the function, but the resulting plot is nothing like a classic tonemap function plot as I happen to see around. The function is totally correct, but am I missing something stupid that must be taken into account when trying to plot them?

sentences:
Map and fill texture using PBO (OpenGL 3.3) I'm learning OpenGL 3.3 trying to do the following (as it is done in D3D)...

Create Texture of Width, Height, Pixel Format
Map texture memory
Loop write pixels
Unmap texture memory
Set Texture
Render

Right now though it renders as if the entire texture is black.

I can't find a reliable source for information on how to do this though. Almost every tutorial I've found just uses glTexSubImage2D and passes a pointer to memory.

Here is basically what my code does... (In this case it is generating an 1-byte Alpha Only texture but it is rendering it as the red channel for debugging)

GLuint pixelBufferID;
glGenBuffers(1, &pixelBufferID);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pixelBufferID);
glBufferData(GL_PIXEL_UNPACK_BUFFER, 512 * 512 * 1, nullptr, GL_STREAM_DRAW);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);

GLuint textureID;
glGenTextures(1, &textureID);
glBindTexture(GL_TEXTURE_2D, textureID);
glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, 512, 512, 0, GL_RED, GL_UNSIGNED_BYTE, nullptr);
glBindTexture(GL_TEXTURE_2D, 0);

glBindTexture(GL_TEXTURE_2D, textureID);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pixelBufferID);
void *Memory = glMapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY);
// Memory copied here, I know  this is valid because it is the same loop as in my working D3D version
glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);

And then here is the render loop.

// This chunk left in for completeness
glUseProgram(glProgramId);
glBindVertexArray(glVertexArrayId);
glBindBuffer(GL_ARRAY_BUFFER, glVertexBufferId);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 20, 0);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 20, 12);
GLuint transformLocationID = glGetUniformLocation(3, 'transform');
glUniformMatrix4fv(transformLocationID , 1, true, somematrix)

// Not sure if this is all I need to do
glBindTexture(GL_TEXTURE_2D, pTex->glTextureId);
GLuint textureLocationID = glGetUniformLocation(glProgramId, "texture");
glUniform1i(textureLocationID, 0);

glDrawArrays(GL_TRIANGLES, Offset*3, Triangles*3);

Vertex Shader

#version 330 core

in vec3 Position;
in vec2 TexCoords;
out vec2 TexOut;
uniform mat4 transform;

void main()
{
    TexOut = TexCoords;
    gl_Position = vec4(Position, 1.0) * transform;
}

Pixel Shader

#version 330 core

uniform sampler2D texture;
in vec2 TexCoords;
out vec4 fragColor;

void main()
{
   // Output color
   fragColor.r = texture2D(texture, TexCoords).r;
   fragColor.g = 0.0f;
   fragColor.b = 0.0f;
   fragColor.a = 1.0;
}

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:
Collision in different layer I have a game object called gameObject1 on the screen. It holds an image called red. When I drag an image called  "animal" on  gameObject1 the collision happens correctly and destroys the "animal" in the same layer. Then I increment the score, but when I drag an image called  "animal" on  gameObject2 I want to decrement my score (with out collision). I know the collision on a different is not happening.

 void OnCollisionEnter2D(Collision2D col)
    {

            if(Input.GetMouseButtonUp(0))
            {
        if (col.gameObject.name == "Semi arid" )
        {
            //obj1.rigidbody.isKinematic = false;
                scoreCalculate.currentScore+=10 ;

                Destroy(gameObject);
                //Debug.Log ("Scored1............"+scoreCalculate.currentScore);
                Instantiate(obj1, ObjectSpawnPosition1, Quaternion.identity);
                Instantiate(green, ObjectSpawnPosition1, Quaternion.identity);
                obj1.renderer.enabled = true;
                green.renderer.enabled = true;}

sentences:
HLSL mipmapping not working I want to implement a mipmap filter in my 3D game, so that textures which are located far away are using a lower resolution than the original.
For the shader I'm using hlsl version 4_0_level_9_1 or 4_0 depends on which one I will get this running.
I have tried this:

texture Texture;
sampler diffuseSampler = sampler_state
{
    Texture = (Texture);
    MAGFILTER = ANISOTROPIC;
    MINFILTER = ANISOTROPIC;
    MIPFILTER = ANISOTROPIC;
    AddressU = Wrap;
    AddressV = Wrap;
};
[...]
Color PixelShaderFunctionTex(VertexShaderOutputTex input)
{
    return tex2Dlod(diffuseSampler, float4(input.TexCoord, 0.0, 0.0));
}

in vs_4_0 it still uses the full-res texture.
And in vs_4_0_level_9_1 it won't even compile: "texlod not supported on this target"

I could manually generate the downscaled textures, but there must be a way to only input one texture and let hlsl do the rest.

In short:
How to apply the mipmap filter in hlsl?

sentences:
Creating multiple levels in Unity without duplicating scripts I'm trying to create a falling word typing game like z-type.

I have used the code provided here

I want to create multiple levels in the game, and it seems like I need to make some changes in the code for each level.

For example, in the word display file, I want the active word to be changed to red for level 1 and blue for level 2.

So I created a copy of my level 1 scene, created a duplicate WordDisplay script file, changed the code for active word to blue....

public class WordDisplay : MonoBehaviour {
    public Text text;
    public float fallSpeed = 1f;

    public void SetWord (string word)
    {
        text.text = word;
    }

    public void RemoveLetter ()
    {
        text.text = text.text.Remove(0, 1);
        text.color = Color.red;
    }
    //...

Here's the duplicate script I made:

public class WordDisplay1 : MonoBehaviour {
    public Text text;
    public float fallSpeed = 1f;

    public void SetWord (string word)
    {
        text.text = word;
    }

    public void RemoveLetter ()
    {
        text.text = text.text.Remove(0, 1);
        text.color = Color.blue;
    }
    //...

Then I made a copy of the WordSpawner as well because I was getting an error: I had to change the method's return type to to WordDisplay1 and then got one more error which was in the Word file, leading to more changes...

public class WordSpawner : MonoBehaviour {
    public GameObject wordPrefab;
    public Transform wordCanvas;

    public WordDisplay SpawnWord()
    {
        //...

public class WordSpawner1 : MonoBehaviour {
    public GameObject wordPrefab;
    public Transform wordCanvas;

    public WordDisplay1 SpawnWord1()
    {
        //...

Then I created a duplicate of the word prefab and selected the appropriate word spawner file...

All of this seems like too many changes for a simple colour.

Is there a better way to have multiple levels without having to create a duplicate of all these files and the word prefab?

sentences:
Do I need a server if I only want to upload data to a DB? I'm currently creating a game where people get some kind of reports for their game performance on a website. Let's say, you log-in, play the game, the system gathers your performance data and this is being sent to a database so that it can be read and interpreted by an external website later. For this, I'm using a firebase real-time database and it's working fine by now.

I'm pretty noob with unity and I have read and watch tutorials on the internet where people actually create a server to achieve this but do I really need a server when the only thing I need to do is to post data to a database based on users?
This isn't really a multiplayer game, but there is some kind of information which is shared for example sometimes I need to get those data in order to get high scores and that kind of small information, but that's it.

I'm using unity webgl and firebase for the moment, and everything is working fine, but then why people always create a server for this?

PS: sorry for my bad english

sentences:
Algorithm for "healing" multiple rectangles into a smaller number of rectangles? Say I have a grid of rectangles of different shapes and colors and I want to reduce (reasonably close to optimal is fine, optimal is not necessary) the number of rectangles to represent the same layout of colors.

The image above is a very simplified case and the whitespace between the rectangles is for visualization only -- they would actually be tightly packed.

What is an approach or algorithm name (happy to google) that can help me do this?

sentences:
Is Google App Engine a good platform for an online MMO? I'm looking at some ideas of creating a smale scale MMORPG game, based in Java, this is a side/hobby project to help my learning process

I've already had a play with GAE and have put up a simple web app, I'm thinking of using this as my platform for a game

Is this a good idea? Are there any games out there that use such a platform? I can't see any limitations so far, other than Google might be able to "own" it rather than myself

sentences:
SAT Collisions: Resolving rotations Currently I have a working 2D SAT collision system with only boxes, but works with static rotations as well, leaving room for triangles. One of the issues I've been able to resolve was tunnelling, thanks to this thread's psuedocode that I got working for myself.

Problem is, this doesn't support moving rotations like a system using a minimum-translation-vector. If I rotate alongside the side of an object, the system will fail even if I'm not moving.

My first thought in solving this was to use the longest line you can draw in a square (that being the points on either side of a square) and comparing the length of that to whatever side on any axis, but even squares have different sizes on any given rotation projected onto an axis.

The system also doesn't work with multiple objects, because - while you can use the algorithm on a group of objects and find the shortest distance out of all of them - if I conserve my velocity relative to the colliding axis, diving into the crest of 2 objects means I will phase through one of them not beyond a 45 degree angle.

Is there an effective way to resolve collisions on rotations and groups of objects, while using this anti-tunnelling algorithm? I don't care if it's expensive, I'll take whatever you can think of.

sentences:
How to Get VR Controller's Velocity in Unity with SteamVR? Back when I used Unity 2017 and controller bindings weren't a thing, I simply attached a rigidbody to my Vive controller and read out the velocity of the rigidbody to know how fast the player was swinging the controller. Now, I've updated to Unity 2021.2.0a14, I went through all the effort of modifying my code to work with bindings, and it doesn't seem like I can get velocity anymore. The rigidbody always reports zero velocity. I can see the World Center of Mass vector changing so I know it registers motion, but it's just not reporting the velocity anymore. Is there a new setting in Unity I need to turn on to measure things that it doesn't personally control? Or do the new bindings options have a way to get velocity as an input? Am I forced to calculate it myself now? Thanks!
Edit: Base assumption was wrong, I did not get velocity from the rigidbody attached to the hand controller like I thought I did. I got it directly from SteamVR_Controller. So Unity is probably acting like it ever did.

sentences: building timers in strategy games I've got a web-based strategy game in which you build a city. Coding is smooth, but I'm kind of hung up on how long it takes my buildings to build. I want to keep the user playing, but have them long enough to keep them having to come back to the game. I've currently got it where each building has a base build rate that is exponentially increased by the building's level. I can adjust the times by changing the base build rate, but I was wondering if there is a better, or perhaps more widely-accepted way of doing this. I worry that a 113 day build on a level 10 building before reaching the next city level where the user has to start over will discourage further playing.

sentences:
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:
Having trouble with EOF in Xcode I'm getting an error that says "control may reach end of function" and I have gone through my code several times now and am not spotting the error. It may be something simple too.

// loop continually until the user gives a valid guess
FText GetValidGuess()
{
    EGuessStatus Status = EGuessStatus::Invalid_Status;
    do {
        // get a guess from the player
        int32 CurrentTry = BCGame.GetCurrentTry();
        std::cout << "Try " << CurrentTry << ". Enter your guess: ";
        FText Guess = "";
        std::getline(std::cin, Guess);

        // check status and give feedback
        Status = BCGame.CheckGuessValidity(Guess);
        switch (Status) {
            case EGuessStatus::Wrong_Length:
                std::cout << "Please enter a " << BCGame.GetHiddenWordLength() << " letter word.\n";
                break;
            case EGuessStatus::Not_an_isogram:
                std::cout << "Please enter a word witout repeating letters.\n";
                break;
            case EGuessStatus::Not_Lowercase:
                std::cout << "Please enter all lowercase letters.\n";
                break;
            default:
                return Guess;
        }
        std::cout << std::endl;
    } while (Status != EGuessStatus::OK); // keep looping until we get no error
}

sentences: Making a 2D TMX tile map Should there be a specific link between the characters height as well as the tile size for the tile maps? That is if a tile is 32x32 does that mean that a character sprite has to be the same size? Also does the size of tiles I use have any great impact on the game itself?

sentences:
Implementing an interaction system that can perform different tasks dependant on the object you are trying to interact with? In No Mans Sky there are objects to interact with in the world and the result of the interaction changes depending on the object. For example, if you interact with a plant it will give you resources but if you interact with the save point it will save the game. I was wondering if it would be efficient to add an 'Action' class that had different methods for each different action (save(), grab resources(gameObject)), then call each action depending on what object you are interacting with...

Another possible solution I came up with is to have a base class of 'Action' and have each action as a script that inherits from this class, then attach them as a component to the interactable objects. Then have the interaction system check if it has an 'Action' script and perform that action if required.

I am just wondering if any of my solutions would be effective, or if there is a much simpler way around this problem that I am missing.

sentences:
Transforming quaternion between coordinate systems Working in DirectX (with DirectXMath objects): If I have the rotation of an object relative to some coordinate space as quaternion Q, and I have a transformation matrix tx from that coordinate space to world space, how do I find the rotation of my object in world space?

My thinking, which has proven inaccurate, was:
Use XMMatrixDecompose on tx to get the orientation that is the rotation difference between world space and my local coordinate space (qLocalToWorld), invert it to get the rotation of the local coordinate system relative to the world (qWorldToLocal) and combine it with my local rotation Q.

XMVECTOR scale, qLocalToWorld, translation;
XMMatrixDecompose(&scale, &qLocalToWorld, &translation, tx);
auto qWorldToLocal = XMQuaternionInverse(qLocalToWorld);
auto worldOrientation = q * qWorldToLocal;

I figured for e.g. that if the local coordinate system was rotated 90 degrees with respect to the world, and my object was 5 degrees with respect to local, this would yield the 90 + 5 = 95 in world space. But I was wrong :(

I'd appreciate help in understanding the right way to do this. Thanks in advance!

sentences:
Unity's Android Notification system works on my Xiaomi, but on a Huawei every notification has an "Unknown" status? When my app starts I check whether there is a notification or not

if there isn't I create one via SendNotification(...)
if there is, I check their status:

var status = CheckScheduledNotificationStatus(notificationId);
On my Xiaomi their status is Scheduled, so I update them:

SendNotificationWithExplicitID(...)

But on a Huwaei it's always Unknown, in that case I create a new:

SendNotification(...)
And replace the old ID in the PlayerPrefs.
But on the next startup it's unknown again.

Maybe I should use SendNotificationWithExplicitID(...) as well when the status is Unknown so I can keep the ID?

Here is the code:

var notification = CreateNotification(jsonWrapper.Name, fireTime, title, text);
if (PlayerPrefs.HasKey(jsonWrapper.Name))
{
    var notificationId = PlayerPrefs.GetInt(jsonWrapper.Name);
    var status = AndroidNotificationCenter.CheckScheduledNotificationStatus(notificationId);
    if (status == NotificationStatus.Scheduled)
    {
        AndroidNotificationCenter.SendNotificationWithExplicitID(notification, "default", notificationId);
        Logger.Log($"Updated a notification: {jsonWrapper.Name} at {fireTime}.");
    }
    else if (status == NotificationStatus.Unknown)
    {
        var id = AndroidNotificationCenter.SendNotification(notification, "default");
        PlayerPrefs.SetInt(jsonWrapper.Name, id);
        PlayerPrefs.Save();
        Logger.Log($"UnknownStatus | Registered a new notification: {jsonWrapper.Name} at {fireTime}.");
    }
}
else
{
    var id = AndroidNotificationCenter.SendNotification(notification, "default");
    PlayerPrefs.SetInt(jsonWrapper.Name, id);
    PlayerPrefs.Save();
    Logger.Log($"Registered a new notification: {jsonWrapper.Name} at {fireTime}.");
}

sentences:
How do I change a background in movement in Unity? I'm developing a game and the background is moving and I wanna change to another image without losing the current speed of the movement.
File:
public class BackgroundMovement : MonoBehaviour

Material material;
Vector2 offset;
GameManager gameManager;
UIManager uiManager;
SpawnManager spawnManager;
public float speed = 0.3f;

private void Awake()
{
    material = GetComponent<Renderer>().material;
    gameManager = GameObject.Find("GameManager").GetComponent<GameManager>();
    uiManager = GameObject.Find("Canvas").GetComponent<UIManager>();
    spawnManager = GameObject.Find("SpawnManager").GetComponent<SpawnManager>();
}

// Update is called once per frame
void Update()
{
    offset = new Vector2(speed, 0);
    if(gameManager.gameOver == false)
    {
        GameSpeed();
        material.mainTextureOffset += offset * Time.deltaTime;
    }
}

In Unity, I added to the material of the background a shader "unlit/transparent" and added the background in it. The object that this material is in, is a quad.
I tried to change creating a list of background images that I wanted on the game. One of the times I tried, I managed to change the background, but the image didn't move, only the first.
This is the inspector of the background.

sentences:
How should I detect collisions with objects on a "timeline"? I'd like to replicate this game's mechanic of the player smashing walls with a precise timing to a background rhythm.

How should I check when each wall should be broken? Does the player animation use a hitbox, or does it use timing to detect if the smashing animation should play?

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:
How to draw a rectangle or curve between two co-ordinates in libGDX I am new to libGDX.I just want a Rectangle or a small curve drawn between the object and the clicked position .I know libGDX has RECTANGLE class.

I just want to draw a rectangle or a curved line to be drawn between the object and the clicked position like this >>>

click can occur anywhere inside the circle region(above red object or below the red object).
green cross represents the click position.
red one represents the object.

Problem is if i use shapeRenderer.rect(x, y, width, height); it will give me straight horizontal rectangle like the gray rectangle shown in the image. Therefore i will have to use shapeRenderer.rect(x, y, width, height, originX, originY, rotation); . I gave 0 for both originX and originY but what will be the rotation value ? I am stuck up in calculating the rotation value .

Currently i can think of two ways to do it :-

By using Rectangle >>> shapeRenderer.rect(x, y, width, height, originX, originY, rotation);
By using sprite image >>> batcher.draw(region, x, y, originX, originY, width, height, scaleX, scaleY, rotation, clockwise);

But in both the cases as u see i need the rotation value .How to calculate that ?
Or is there any other way we can achieve the same results maybe by using some sprite image or something ?

sentences:
How to implement a track for a wipeout-style game on a mobile device? I was wondering what is the best way to manage a 3D track for a game with the same mechanic as Wipeout on a mobile device. Build a track out of multiple segments and load new segments as the player advances or build just one single mesh, maybe with multiple level of details ?

I'm very unfamiliar with this kind of problems so suggestions for other approaches are welcome.

sentences:
Unity bounds includes the center of the scene I'm trying to get the bounds of an object and put a box around it.

Sounds simple right? I just encapsulate all the bounds together and use its center and size to do so.

But the problem is one corner of the box is always at the center of the scene, like a part of the object is there, unless the center of the scene is in the bounds.

This is when object is at the center

This is when it isn't

This is the code i'm using:

    public static Bounds Calculate(Transform TheObject)
    {
        Renderer renderer = TheObject.GetComponent<Renderer>();
        Bounds combinedBounds = new Bounds();
        if (renderer != null)
            combinedBounds = renderer.bounds;
        var renderers = TheObject.GetComponentsInChildren<Renderer>();
        foreach (Renderer render in renderers)
        {
            if (render != renderer) combinedBounds.Encapsulate(render.bounds);
        }
        return combinedBounds;
    }

sentences: Is ruby a suitable language for game development? I want to move into some game development, but the only language I know really well is Ruby. Most of what I have read seems to point towards lower level languages like C++ for game development, or languages for specific frameworks like C# for using XNA. Does anyone have any experience using a language like ruby for game development? If so, would you advise for or against it?

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:
Picking a specific point of a map in Direct 3D I'm trying to pick a specific point on a randomly generated terrain with bunch of tiny triangles. Right now, I'm just iterating through every triangle and picking a intersected triangle using D3DXIntersect function. It serves its function but the performance is just not tolerable.

Is there a way to pick a triangle without millions of iteration?

sentences:
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:
Places to Test Player Interest In Storyline I am working on an iPad game, and have a few different intro story lines. I would like to get gamer feedback on the intros.

What websites or techniques have others used to get such feedback?

sentences:
The name `FB' does not exist in the current context I am trying to allow the user to share the final game score on their FaceBook timeline. I am following FaceBook tutorial and examples. When I try to download and import the FaceBook SDK package (7.11-2.0) in Unity (2017.3) I get the error:

  error CD1704: An assembly with the same name 'FaceBook.Unity.Settings' has already been imported. Consider removing one of the references or sign the assembly Library/FacebookSDK/FaceBook.Unity.Settings.dll (Location of the symbol related to previous error)

I read on other posts that the latest version of Unity may have the Facebook SDK already integrated, and will not require importing the package manually.

I therefore removed the from my project. The error disappear, but when I try to initialize the Facebook SDK for Unity using the code below, I get the error:

  The name `FB' does not exist in the current context

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

public class ShareOnFaceBook : MonoBehaviour {

    // Use this for initialization
    void Awake () {

    if (!FB.IsInitialized) {
        // Initialize the Facebook SDK
        FB.Init(InitCallback, OnHideUnity);
    } else {
        // Already initialized, signal an app activation App Event
        FB.ActivateApp();
    }
}

sentences: Are square or hex grids better for pathfinding? Is there any significant difference between using a square or hexagonal grid for the area searched by a path finding algorithm. In other words, is square or hexagonal better, and if so why.

sentences:
What do you use to create sprite graphics? Possible Duplicate:
  What tools do you use for 2D art/sprite creation?

What do you folks suggest for creating sprite graphics and sprite sheets?

I fiddle with pixelformer and tilestudio.

Pixelfromer has a kicken interface, it is quick and easy to make graphics, but a bit cumbersom if you want to make a spritemap.
Tile Studio is a interesting mix or tiles and maps, but it is a bit buggy and basic.

The Adobe series, just don't really seem to handle tiny graphics well.

(there is a previous posting of this question existing,  but it is a year old and I was hoping for further/updated input from the community)

sentences:
Virtual game dimensions - how to implement? I'm creating a fighting game in LibGDX with a static board, camera moves only right<>left.

There are 5 screen aspect ratios in Android and Apple so I have created 5 different background graphics:

2560x1440 16:9
2560x1920 4:3
2700x1800 3:2
3000x1800 5:3
3200x2800 8:5

Each background width is multiplied by 1.5, cause I need to zoom-out the game when players are too far away from each other, so for example 16:9 isn't 2560x1440 but 3840x1440. (I just realised that I should expand the height too LOL, gamedev is a fantastic place).

When I load the background I check the screen size and scale the background to fit.

The thing I need to implement is: Virtual Coordinates which are the same for each device.

Let's get the screen below:

I need to set virtual board dimensions to for example 2000x1000 units/meters whatever.

When the server sends a message:
Spawn a bomb on (1000,1000), left device spawns it at x=512, right device at x=960 (both on the half).

I think working on pixels is a bad idea, cause I would need to calculate things with each move, jump etc.

If someone could help me, how should I achieve this, I would be grateful for pointing me a way.

Thanks!

sentences:
Returning a List of coords for a sphere in order of inside to outside I'm looking for any algorithm that can return a list of Vector3 coordinates that form a sphere. If you read the list from the beginning it would appear the sphere was expanding.

The only algorithms I've found are for circles, the algorithm doesn't have to make a sphere of a particular radius, just a number of coordinates would be fine.

If anyone could point me in the right direction for such an algorithm that would be great. Any language or even just sudo code for a basic algorithm would be appreciated.

sentences:
High Resolution Timer Options in Windows I'd like to know what are my options for high resolution timer in Window. I want a timer with at least 1ms precision since I need it for a rhythm game. I'm using QueryPerformanceCounter now, but I read there are many problems I can have with it (variable clock due to laptop power consuption, intel speed stepping, multi-core sync gives negative times, etc).

I tried SDL_GetTicks() but I realized it is implemented using QPC in Windows. What other options do I have?

Thanks.

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:
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:
2D maps, how to structure? I'm new to this. And I don't really understand 2D tile maps.

The tutorials I've read use arrays, but doesn't this get really difficult to manage when they get big?

And what if I want different floors, like going up/down stairs, do I need an array for every "level" of the game world?

Could anyone explain tile based maps as simple as possible please?
If you include code, please make it Javascript or pseudo code since it's all i know.

sentences:
How to make a z-depth buffer with pygame? I am making a 3d renderer with python and so far am sorting the triangles which I want to replace with a z-depth buffer. The thing is, I don't know how to make a z-depth buffer in pygame. I still want it to be playable however.
By the way, I am using pygame polygons.

sentences:
Helmet Mounted Display Math I'm trying to create a helmet mounted display as a mod for a flight simulator. Unfortunately, I've been trying to figure out the math for this, but, to be honest, I'm stuck. I've done my best to look up the math related to this, but this kind of math really isn't my thing, so I figured I'd ask here to see if anyone can provide some help.
The information I have access to is as follows:

The pilot's position
The pilot's head's rotation
The location of the "thing" I'm trying to put a box on the HMD over top of

The HMD itself is drawn in screenspace as normalized 2D coordinates starting from the bottom left corner.
From what I can find, I can treat the pilot's head like a camera in a scene, and the thing I'm trying to track as an object in that scene, which means I'd need to use a view matrix, followed by a projection matrix, which would get me all the way there aside from translating that to the screenspace coordinates; at least that's what I can determine, but as there's no real way to debug problems aside from guessing and trying to fix them, I'd really appreciate having someone confirm/deny that route and correct any misinformation.

sentences:
Alternatives to Prototype pattern for Buildings Hope some of you have ideas for this.
first I will describe the Task ahead and then go on with the my thoughts about solving it and what kind of problems I see.

1) I have a number of buildings. Their data is stored in a json file and contains stuff like name, price, maxHP, etc... all those static infos - This file can be changed or extended by additional types of buildings and my system should take them all, as long as there are no invalid data (negative health for example)

2) I need some kind of list of all buildings, that I can use to iterate over (for example to display all buildings in a build-menu)

3) I need to be able to place them somewhere and therefore create concrete instances of them in my gameworld

basically buildings can do different stuff in my game. they can create units, generate income, attack and other stuff.

my thoughts about solving it:

1) On loading my building.json, first the allowedActions of this building are looked at and the various components are added (e.g weapon component for shooting stuff) and then the actual data (like hp, damage, etc) is set and validated.

2) Currently to get a list of all my buildings and being able to place them somewhere, I do the following.
on loading buildings, I actually create an instance of each of them in order to get a List of prototypes - this prototype list is then used everywhere, where I need to be able to iterate over them, e.g. buildmenu.

3) When I then want to build it, I kind of just clone this building and update the data specific to the new clone (e.g. its actual position) and add it to my game world

So basically I'm using some kind of prototype pattern, if I understood it correct. However I don't really feel comfortable to have a list of instances of my buildings that in reality don't exist in my gameworld and for which I always have to care, that they don't ever influence the actual game (like accidently they are iterated through in a list, when I want to do something to all currently constructed buildings in my game but this will also influence the prototypes, which i clone my buildings from but are not actually constructed)

Do you have other Ideas to solve this, or is using prototypes here the right thing to do?

Thanks for any advice
Kind Regards

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:
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:
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:
Can diffuse and specular component of Phong model shine thru object? I have been implementing simple 3D engine in OpenGL, mostly based on tutorials by Tom Dalling. I have implemented the Phong lightening model as described in his tutorial, but I see light artifacts on concave shaped objects (and also when using normal mapping). I came to a point, where i don´t know if my code is broken, or this is actually normal behaviour, and you need special handling for it.

I think that these artifacts could be happening, because the normals of concave object at same points head back into the point light source, not actually considering there is a solid object in between. I tried to do a little scetch of this situation in 2D (for diffuse component):

So I need to know, if this is a common problem of this light model, or my calculations are wrong.

sentences:
Adding sub-entities to existing entities. Should it be done in the Entity and Component classes? I'm in a situation where a player can be given the control of small parts of an entity (i.e. Left missile battery). Therefore I started implementing sub entities as follow.

Entities are Objects with 3 arrays:

pointers to components
pointers to sub entities
communication subscribers (temporary implementation)

Now when an entity is built it has a few components as you might expect and also I can attach sub entities which are handled with some dedicated code in the Entity and Component classes.

I noticed sub entities are sharing data in 3 parts:

position: the sub entities are using the parent's position and their own as an offset.
scrips: sub entities are draining ammo and energy from the parent.
physics: sub entities add weight to the parent

I made this to quickly go forward, but as I'm slowly fixing current implementations I wonder if this wasn't a mistake.

Is my current implementation something commonly done? Will this implementation put me in a corner?

I thought it might be a better thing to create some sort of SubEntityComponent where sub entities are attached and handled.

But before changing anything I wanted to seek the community's wisdom.

sentences:
Box2d : How to apply a force to keep swinging from left to right? i'm losing myself in this...

Situation: Working on a game in cocos2d with box2d and I have a ropejoint between one fixed body and one dynamic body.

When I drop the dynamic body is swings from left to right and then from right to left due to the gravity in the world.

The problem: The swings are getting shorter and shorter till finally the dynamic body hangs still beneath the fixed body. This is normal behavior but I need it to keep swinging.

My thoughts: I think I need to apply a tangential force to the ropejoint in the direction of the swinging but how to do this is a mystery for now :)

EDIT 1
The swinging does not have to be in perfect balance, it just can't slowly die.

sentences:
Pre game loading time vs. in game loading time I'm developing a game in which a random maze is included.
There are some AI creatures, lurking the maze. And I want them to go in some path according to the mazes shape.

Now there are two possibilities for me to implement that, the first way (which I used) is by calculating several wanted lurking paths once the maze is created.
The second, is by calculating a path once needed to be calculated, when a creature starts lurking it.

My main concern is loading times. If I calculate many paths at the creating of the maze, the pre loading time is a bit long, so I thought about calculating them when needed.
At the moment the game is not 'heavy' so calculating paths in mid game is not noticeable, but I'm afraid it will once it will get more complicated.

Any suggestions, comments, opinions, will be of help.

Edit:

As for now, let p be the number of pre-calculated paths, a creatures has the probability of 1/p to take a new path (which means a path calculation) instead of an existing one.
A creature does not start its patrol until the path is fully calculated of course, so no need to worry about him getting killed in the process.

sentences:
Calculation of Inertia Tensors Bit of a complex and lengthy question that, I'll admit, I don't quite understand very well yet so I will try and explain as best as I can.

Short Version: Is there a general c++/physx formula out there to calculate inertia tensors based off an objects shape?

Long Version:
For our physics, we need to specify x, y and z inertia tensors. Currently the way we do it is pretty much just a ratio based off of mass. So if an object is long on the X axis and thin on Y and Z, and the mass is 10000, we will set Z and Y to 7000 and X to 3000. (This isn't exact, but just to give an idea)

This works relatively well but our biggest problem is when there is joint instability somewhere, we have to keep guessing at tensors until we figure out what works best. This can become very time consuming if we have a very big physics simulation and one out of 20+ joints is causing all the others to lose stability.

What I am working on is a function that will take the bounding box of an object and hopefully calculate relatively accurate tensors. I have taken some of the math from http://en.wikipedia.org/wiki/List_of_moment_of_inertia_tensors and made a function that basically works like the following for similar rotations below.

Or if the rotation is on an end, like this:

So, this seems to give me results that are similar to the way we have been doing it, but I dont want to switch to this way without making sure that it will work for general use. Below is the code for my function based on the first image with a cube and center pivot.

NxVec3 CalculateInertiaTensor( VisBoundingBox_cl boundingBox, float m )
{
    float width = boundingBox.GetSizeX();
    float height = boundingBox.GetSizeZ();
    float depth = boundingBox.GetSizeY();

    float xTensor = 0.083f * m*(height*height + depth*depth);
    float yTensor = 0.083f * m*(width*width + depth*depth);
    float zTensor = 0.083f * m*(width*width + height*height);

    return NxVec3(xTensor, yTensor, zTensor);
}

I can't guarantee that this is the right way to do it (as the most accurate way is to use the actual shape instead of a bounding box) and i am not very familiar with inertia tensors and the math but it seems to return numbers fairly similar to what we were using. Anyone here happen to know if there is a better way to do this?

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:
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:
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:
Create Levels using blender I am creating a game and I have a custom level format for levels in my game. I wanted to know if it is possible to create levels for that kinda format in Blender. My format is XML based and just declares the positions of certain objects. Online I have seen many people use Blender to create levels in their own custom format that blender can understand.

How do i get blender to understand my format and use blender to create levels for my game?

sentences:
How can I rotate about an arbitrary point in 3D (instead of the origin)? I have some models that I want to rotate using quaternions in the normal manner, except instead of rotation about the origin, I want it to be offset slightly. I know that you don't say, in 3d space, that you rotate about a point; you say you rotate about an axis. So I'm visualizing it as rotating about a vector whose tail is positioned not at the local origin.

All affine transformations in my rendering / physics engine are stored using SQT (scale, quaternion, translation; an idea borrowed from the book Game Engine Architecture.) So I build a matrix each frame from these components and pass it to the vertex shader. In this system, translation is applied, then scale, then rotation.

In one specific case, I need to translate an object in world space, scale it, and rotate it about a vertex not centered at the object's local origin.

Question: Given the constraints of my current system described above, how can I achieve a local rotation centered about a point other than the origin? Automatic upvote to anyone who can describe how to do this using only matrices as well :)

sentences:
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:
Wise approach to becoming good at C# XNA Would finishing an entire course about C# at HomeAndLearn.co.uk and then jumping into XNA be a wise path to take?

Ultimate goal is to create a multiplayer 2D game.

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

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

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

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

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

sentences:
Handling intro and title screen What is the best way to handle the intro, title screen, and menus? I am contemplating that each of these could be a "scene" object of sorts. Perhaps in the game loop based on what needs to be done, a specific scene is loaded and everything that is contained within is executed. When that scene is no longer needed, it is unloaded.

Am I thinking about this correctly? I am not sure if "Scene" would be the best term to use in this case, but it is the best way I can describe it. Perhaps screen objects handled by a screen manager? If there is something more appropriate, I would love to know!

Also, for example I am thinking to have:

Intro "scene"
Main menu
Settings

sentences:
Should I store ads in the background or recreate them every time I need them? I am developing an XNA game for Windows Phone 7 and 8. The game is level-based. After finishing each level a screen comes up with a bit of stats summary. I wish to embed an ad in this screen, on which I expect users to only spend a few seconds on after each level.

The ads I am using are Microsoft's pubCenter ads and AdDuplex as a backup.

Should persist instances of these ads throughout the game's operation and only make them visible on level completion? Or should I create new instances every time they are needed and destroy them once I don't want them anymore for each level?

My worry is that starting up an ad on a screen which is intermediate and lasts for a short while might not be enough time for an ad to download. On the other hand, having one or more ads running continuously in the background might not be a good thing for battery or performance.

sentences:
How do I hide the camera object in Unity Editor I have 2019 Unity Editor
I have a huge camera object that is blocking all the other objects that I need to move in the scene,
I want to hide this object, but I cannot find a hide/show menu item anywhere or when I right click on the hierarchy

sentences:
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:
WPF or WinForms for Game Development and learning resources? I'm looking to create a game framework for my own personal use...
I want to use WPF, but I'm unsure if that is a wise choice...

The games I will be writing should not require high performance graphics, so I am hoping to build on native classes...  I do not want to rely on external DLL's unless I generate them myself.

The games will be for young children, say 4 to 8.  Most will be learning puzzles or simple shooters.

The most advanced will be a platform game (non-scrolling screen like the old Atari Miner 2049er game).

I think I know how to write something like the old Atari Chopper Command (partially written and my 4 year old loves it, but I used WinForms and GDI), Pac-Man, Tetris, Astroids, Space Invaders, Slider Puzzle, but I do not really know how to write the platform game...  In my mind, I'm getting caught in collision detection and how to make a character jump and how to make a character walk up a slope or steps...

Can anyone point me to information on developing a platform game in C#?

Would you suggest WinForms or WPF for game development?

I'm not looking for great graphics and speed, just entertaining game play...

sentences:
Simple Stupid Funnel Algorithm (SSFA) for 3D Navigation tl;dr I need an algorithm similar to SSFA except for portals with 4 vertices (or n vertices if an algorithm like that exists).

I'm working on a game that requires pathfinding in 3 dimensions. By this I mean agents have full control over their position as opposed to many games where agents only control forward, back, left, right, and need to walk up stairs or ramps to go up and down.

To do this I made a "nav-mesh" using an octree that checks for collision at each region, and subdivides if there is a collision (until a certain cube size limit). So I now have a graph where each node is a cube with some size based on the octree. Using this I can run the A* algorithm for pathfinding on the graph.

Unfortunately, just moving towards the center of each node looks bad, and even moving towards the center of each connecting face of the node (the smaller of the two connected node's adjacent faces) looks bad.

In the past, I've used the SSFA for path simplification, but it only applies to situations with an edge as a portal, not a face. Is there an algorithm for this, or is there a way to make my pathing look better?

Ninja-edit: I'm already somewhat using steering behaviors, but since the center of nodes can vary wildly, based on the complexity of the octree, it still doesn't look nice.

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:
Effects to make a speeding spaceship look faster I have a spaceship and I've created a "boost" functionality that speeds up my spaceship, what effects should I implement to create the impression of high speed?

I was thinking of making everything except my spaceship blurry but I think there would be something missing. Any ideas?

Btw. I am working in XNA C# but if you aren't familiar to XNA describing some effects is still useful.

The Game is 3d and i've attached some printscreens of the game

This is in normal mode ( none boosted )

and here is the boosted mode ( the craft speeds up forward while the camera speeds in its normal speed , the non boosted speed )

sentences:
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:
Is TIN a 2D or 3D mesh? I have a TIN (Triangle Irregular Network) that was created in CAD software packages from something called DTM (essentially each point represents the height of the ground for that specific point).

The result looks like a 'blanket' of triangle, so not closed in any way. I think that's a non-boundary manifold triangle mesh but not sure. More unclear is if it is a 2D mesh (like a polygon is a 2D surface in a 3D Cartesian space even if not all vertexes are the same z). Can someone please explain what kind of geometry is a TIN?

Example (the blue triangles are the TIN):

sentences:
What does 'vertex splitting' mean? In the documentation of MeshUtility.SetPerTriangleUV2 it is said the following:

Will insert per-triangle uv2 in mesh and handle vertex splitting etc.

What do they mean by 'vertex splitting' ?

sentences:
Handling multiple agents in astar pathing When working with grid based path finding in how do you normally handle different agent types? In the game I am working on I have a regular agent, and one that occupies 2 cells on the grid, and one that can fly. The idea I have now is to use a separate AStar map to store the grid for each type. The height is max 4 units so I can use AStar for flying as well.

This keeps it possible to add new actor types as well but is it waste of memory? Also how to deal with avoiding nodes occupied by other agents? The game is turn based so I don’t want to do any object avoiding type thing. Is there a simple way to mark a node in the AStar as temporarily unwalkable?

I am using the Godot Engine and would like to use the in built astar implementation but I can create my own if really needed.

sentences:
Google Play Game Services Detecting Top 3 Players I used Google Play Services Leaderboard in my Libgdx game. This is what I want to do; I would like to give awards to the best 3 players in this table. How can I help you?
It automatically connects to the Google Play Services Leaderboard and I can show players' information in the game.
Please help

sentences:
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:
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:
Finding the "Important" nodes of a grid path On a Navmesh Grid, all nodes are essentially vertices or turn-points so the returned path is efficient in that it only involves points where an entity must change its direction.

A grid path, however, involves nodes at every point along the path. For long paths, there could be hundreds of nodes contained even though most of those nodes just follow a line and don't change the direction of the path.

Note: Paths are lists of a GridNode object.

I haven't tested this hypothetical issue in application yet so my first question is: Is this even an issue? For a game that requires real-time pathfinding for roughly 200 entities on a grid of 4,096 nodes, will the returned paths consume too much memory and resources? My main concern is related to how entities will handle paths, which is to check for reaching the target node before moving on to the next one and calculating the new direction needed. With more spaced out nodes, entities might have more leeway with following their paths if pushed off of it.

Secondly, if it is a potential issue, how would I solve it and cull out the insignificant nodes of a path?

sentences:
How to setup a client to work with a remote server or a local included server? I'm working on a Networked multiplayer game, but while developing and for testing I want to set up a local server that acts like the multiplayer server.

My thought is to approach the server as a proxy setup. Creating a class that the client sees and essentially allowing it to either load the server code in itself or to use a networking layer.

Is this a good approach? Are there other approaches to look into?
What pitfalls should I be watching for?

Update

A bit more specifically I need to do this because I am targeting the Ouya and I can't guarantee a network connection, or even a spare machine to run the server on. And inside Android it is more difficult to setup and launch a service rather than include my server code right into a client build.

sentences:
How to export an IK structure created in Blender 2.8 to Godot 3.1? I created this IK bone structure in Blender 2.8 and exported as .escn

As you can see, in Blender it's working ok.
Now, how to use it in Godot?

I've tried export with:

.dae (native)
.dae (Better Collada)
.escn
.glb

None of them worked...

Is there any tutorial for using imported IK in Godot?

sentences: I have created character human in blender. How to use it in Java/Android Title says it all pretty much. I can't find anything online which explains it in details. I have created a character model in Blender and I want to use it in Android app. I want to make it move. What's my next step here?

sentences:
Implementing Achievement System in Javascript I understand that for more complex achievements, specific code can't be avoided, but for simple ones like (player clicked 100 times) or (player earned 30 bajillion cookies) or (player played for 1 hour) it should be as simple as abstracting the achievements to something like a list of properties/values and having some event handler.

My problem is that since I'm using Javascript and there's no really clean way to do pointers, how am I supposed to create an achievement class that can be iterated through procedurally?

Ideally I'd like something like this:

Achievement class:

function Achievement(name, property, value, text, points){
  this.name = name;
  this.property = property;
  this.value = value;
  this.text = text;
}

And then I'd add an achievement like so:

achievements.push(new Achievement("Clicktastic", &numClicks, 1000, "You clicked 1000 times!");

And have some kind of function bound to a Window.setInterval that was constantly looping through all achievements and for these simple types doing something like:

for (var i = 0; i < achievements.length; i++){
  if (*achievements[i].property >= achievements[i].value){
    //deal with earning achievement
  }
}

I'm just using some C style pointer/dereferencing notation here.

Basic idea is that I'm not sure how to create a generic achievement that can arbitrarily care about specific properties without pointers.

sentences:
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:
Remove background from sprite sheet after splitting I am using libgdx to implement a Parallax background. Now I need to show some animated object over the background. I downloaded a sprite sheet(with images of objects on white background), and split it using TextureRegion.split() method. But when I draw the objects to screen, white background is shown along with the object as in this image:

I tried using batch.enableBlending() but it didn't work. Is there any way to resolve this issue? Or should I code only using individual sprites with transparent background? Here is a brief code snippet :

public class Animator extends Actor{
        int FRAME_COLS = 3, FRAME_ROWS = 3;

        Animation<TextureRegion> eagleAnimation;
        Texture eagleSheet;
        float stateTime;

        Animator(Texture sheet) {
            eagleSheet = sheet;
            TextureRegion[][] tmp = TextureRegion.split(eagleSheet, eagleSheet.getWidth()/FRAME_COLS,
                    eagleSheet.getHeight()/FRAME_ROWS);
            TextureRegion[] eagleFrames = new TextureRegion[FRAME_COLS*FRAME_ROWS];

            int index = 0;
            for(int i = 0; i < FRAME_ROWS; i++) {
                for(int j = 0; j < FRAME_COLS; j++) {
                    eagleFrames[index++] = tmp[i][j];
                }
            }

            eagleAnimation = new Animation<TextureRegion>(0.09f, eagleFrames);
            stateTime = 0f;
        }

        @Override
        public void draw(Batch batch, float parentAlpha) {
            stateTime += Gdx.graphics.getDeltaTime();

            TextureRegion currentFrame = eagleAnimation.getKeyFrame(stateTime, true);
            batch.enableBlending(); // doesn't work
            batch.draw(currentFrame, 250, 250, 264, 264);

        }

    }

This is where I call above class from :

    public class GameScreen implements Screen {

        MyGdxGame game;

        Texture eagleSheet;
        OrthographicCamera camera;
        Array<Texture> layers;
        Stage stage;

        public GameScreen(MyGdxGame game) {
            this.game = game;
            stage = new Stage(new ScreenViewport());
            camera = (OrthographicCamera) stage.getViewport().getCamera();

            layers = new Array<Texture>();

            for(int i = 1 ; i <= 6; i++) {
                layers.add(new Texture(Gdx.files.internal("parallax/img" + i + ".png")));
            }
            ParallaxBackground parallaxBackground = new ParallaxBackground(layers);
            parallaxBackground.setSpeed(1);
            parallaxBackground.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
            stage.addActor(parallaxBackground);

            eagleSheet = new Texture(Gdx.files.internal("eagle.png"));
            Animator animator = new Animator(eagleSheet);
            animator.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
            stage.addActor(animator);

        }

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

            stage.act();
            stage.draw();

        }

        @Override
        public void dispose () {
            stage.dispose();
        }

        @Override
        public void show() {}

        @Override
        public void hide(){}

        @Override
        public void resume(){}

        @Override
        public void resize(int x, int y){}

        @Override
        public void pause(){}

    }

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:
Simplify Matrix math code- Sun billboarding If was trying to set the correct position of my sun billboard in my 3d game. I tried long until it worked correctly, but I wonder why this code must be so complicated:

sun.sprite.Position = Vector3.Transform(Vector3.Transform(-sun.lightDir,
Quaternion.Inverse(world.Rotation)), Quaternion.Inverse(myRelativeRotation));

Can I simplify this expression? I tried changing it at least to this:

sun.sprite.Position = Vector3.Transform(-sun.lightDir,
Quaternion.Inverse(world.Rotation) * Quaternion.Inverse(myRelativeRotation))

But this is giving me different results, so the sun is at the wrong position.

sentences:
Unity particles rendering on top of camera space UI I'm using LWRP in Unity 2019.1.12f1. The UI is in Screen Space - Camera. The shader used for the particles is Lightweight Render Pipeline/Particles/Unlit (Transparent, Premultiply).

Any ideas?

sentences:
How 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:
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:
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:
How would I check the range against the entirety of an enemy object, and not just it's transform.position? I want to be able to do range checks against the entirety of an enemy object, and not just it's transform.position. The enemy object can have it's side or nose within range, but range detection will not determine if it's close enough to be targeted unless it's transform.position is within range.

Right now I run a quick check against all nearby units to determine their distance from a turret on the friendly unit.

I was thinking raycasts, but I imagine raycasts every frame for up to 10 detected enemies per unit (Each unit will at max hold onto references of 10 nearby enemies. I could have 100 friendly units within range of 100 enemies) would chew up a fair bit more CPU than just checking their cached transforms.

Suggestions, ideas, or comments?

Edit: More Detail

Currently a Unit has a trigger spherical collider that defines it's view range. Any enemy unit within this view range is added to a collection based on priority, with a maximum of 10 objects referenced per collection (each Unit can only be aware of 10 enemy objects). From there, each turret on ship checks the distance from itself to each of the enemies within that collection. When the distance is <= it's attack range, it will fire upon whichever enemy object gets within it's attack range first.

I used to use spherical colliders for each turret, which of course would detect the enemy as soon as any part of the enemy entered the trigger collider. The issue was the massive performance loss due to OnTriggerStay() begin called by hundreds of units, tens of thousands of times per frame when I have no need for the method. So I discarded the extra trigger colliders for a more performance friendly approach.

The issue is that the range check is that is checks the transform.position of the enemy. This does not take into account the collider that makes up the enemies shape, and will only trigger when the center of the object enters within range.

sentences:
Possible to open Hammer directly from shortcut? I want to open Hammer(for CS:GO) directly from windows shortcut, without the SDK-launch menu. Is this possible? I've only been able to open the SDK launcher from a shortcut.

And, is it possible to open a map directly as well? So, 1 shortcut that opens Hammer, with a specific map inside of Hammer?

If there exist a launch option for this, then I can use that!

sentences:
Procedural terrain generation in cylindrical (2D) world I'm fairly new to procedural terrain generation. I know that to generate terrain you would use different calculations with the x and y axis (also z if you have one).

But what if you want to generated random terrain on a 2D world that loops around itself? By that I mean a world in which you enter the right side upon leaving the left side (or the other way around). It should also be generated on the fly and not all at once.

One solution I can think of is to just generate ocean along the border, but that is not what I'm looking for. I also seem to remember that Civilization generated such types of worlds, but I'm not quite sure how that worked, it's been quite some time since I played that game.

So how exactly can one generate such a continuous world?

sentences:
No animation clips in assets folder I'm trying to import an FBX file made in Blender into Unity so I can use the actions created in Blender in a Unity animation state machine. A lot of sites seem to suggest that simply dropping the FBX file into the assets will automatically import animation clips, but that doesn't seem to be happening. Unity does however recognize the discrete actions created.

Tutorial image:

My screen image:

I used the Blender export settings "Include Animation" and "All actions", but not "Include Default Take" as people recommend.

For reference, I'm trying to follow the animator controller tutorial at unity3d.com

How can I retrieve my animation clips from the fbx file, or is there another way to insert them into the Animator?
Thanks!

sentences:
Is there an easy and automatic way of converting a Windows XNA project into a Monotouch Monogame project? I have just started with XNA development on Windows. But as I'm a fan of iOS I had to try porting my test code over to Monotouch on the Mac.
I used these instructions: http://www.facepuncher.com/blogs/10parameters/?p=42
But this is so much (manual) work!
And it really doesn't answer open topics like: why would I copy all the XNB files and in addition all the resources, like PNGs?

Is there maybe a tool that automatically converts a Windows XNA project into a Monotouch iOS project or at least creates the correct folder structure?

sentences:
Good data structure for storing graph-like map I'm creating a strategy-based kingdom expansion game, where you start with one city and try to expand as far as possible from there. All the cities fit on a hexagon-grid and are connected by the edges of the hexagons.

Here's a diagram to illustrate what I'm trying to achieve:

Each city must be connected to another city by road, which means that all the cities are connected. At this point, I began to realize that this map is very similar to a graph, with the cities being nodes, and the roads being edges. I've already done some graph theory and implement multiple algorithms. However, when implementing it in a graph format (Map<Node, List<Edge>>), I ran into 2 problems:

There is no way to force that each node can only have 3 connections, with each being a multiple of 120º
If it was stored in this format, it would be very difficult to render just loop it through for updating.
I'm wondering if any of you have any better data structures that can be used for this. Any criticism, suggestions, or advice is welcome.

Thanks!

Ps. I've seen other questions that are somewhat related, however they either do not have an accepted answer or do not solve my problem.

sentences:
GameMaker Studio 2: DnD - How do I change Idle animation to Walking Animation I have an idle animation into an object. I am able to have it moved to one point, left & right but but the problem is transitioning from Idle to Walking Forward. I did tried step but I realized that it's for animation ticks, and I can't really find any tutorials on it yet.

How do make a smooth animation transition from Idle to Walking?

sentences:
Creating a hexagonal wraparound map I'm trying to create a wraparound map for a hexagonal map, so when you exit a tile on one side of the big hexagon-shaped map, you enter a tile on the other side.

Example image from Red Blob Games article on Hexagonal Grids.

In the image, the pale tan hexagonal chunk in the center is our map. The greenish/reddish chunks around it are shifted copies of the same map. If we stand on the blue tile under the cursor and walk off the main map into the green copy to the right, that's the same as wrapping around our map to the corresponding point on the other side: here, walking from the blue tile in the lower-right-hand red copy into the bottom-right corner of the center map.

I used an approach with a lookup table first. But as soon as those maps get too big, the lookup tables get even bigger. I'm searching for a solution which works without a lookup table.

sentences:
What is the best way to implement the story functionality (dialogue and cutscene management, etc.) in an RPG? I would like to know what the best way to implement the story functionality of an RPG would be. I am writing the game in C++ using the SFML library for graphics, and I have implemented drawing tiles, level loading and player movement, but I am not sure on how exactly to go about implementing the story. How would I implement when to do cutscenes, what to do in cutscenes, changes in dialogue, and have dialogue options affect the game? I am planning to have the dialogue in JSON files in a format similar to this

"dialogue" :[
        {"type" : "dialogue", "character" : "player", "text" : "dialogue here", "result" : "next"},
        {"type" : "dialogue", "character" : "character", "text" : "more dialogue", "result" : "next"},
        {"type" : "option", "options" : [{"text" : "option 1", "result" : "goto 4"}, {"text" : "option2", "result" : "goto 5"}]},
        {"type" : "dialogue", "character" : "character", "text" : "from option 1", "result" : "next"},
        {"type" : "dialogue", "character" : "character", "text" : "from option 2", "result" : "next"}
]

Is this a good way to go about this?
Should I also consider embedding a scripting language like Lua for cutscenes and other high-level tasks?

sentences:
Does libGDX support the Xbox One controller? I just bought a Xbox one controller and i'd like to test my game with it. I use the Controllers extension from libGDX and it works fine, at least with my PS3 controller.

I get some weird results when i'm polling the axis of the controller with libGDX. The values are ok for Y axies but not for X ones. I mean, for X axis, values are really weird, sometimes, when the stick is fully pushed to the left, the value is not even negative, same goes for the right, sometimes value is negative. I don't know why but values seems inconsistent for X axies, Y axies work fine.

Concerning buttons, they are all detected except for the dpad.

I am using the drivers available here. I tested the controller with several games, it works fine so i think it's related to libGDX.

Do you think the Xbox One controller is not supported yet? Can it be a driver issue? Should I use another way to poll controller states? If yes, is there a good and up to date library to do so?

Thanks.

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: Blender modelling for a C++ game? I want to know if it were possible to integrate models created with Blender into a game written in solely C++.

sentences:
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:
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:
What is the best way to store temporary selected characters and their insertion order? I'm developing word game, similar to "Word Mole". I'm having a hard time determining how to store temporarily selected characters, which in turn, will changed into a word.

For example, say, I have the following characters:

      0  1  2  3
   0 O  B O S
   1 S  F  R  H
   2 T  N  E  Z
   3 R  B  D  I

I store all this information in a character array named playCharacter, and I also created a character array named markedCharacter, with the default value of ' ' for each element. Every time I select each cell, say cell[1,0], I set markedCharacter[1,0] = 'b' an so on, until I'm done with current word. How do I store the step information? For example, if I choose to play bored, I'll be marking:

markedCharacter[1,0] = 'b'
markedCharacter[2,0] = 'o'
markedCharacter[2,1] = 'r'
markedCharacter[2,2] = 'e'
markedCharacter[2,3] = 'd'

Do I need another array? if so, what data should I store in it?

In turn, I'll want to use this markedCharacter as a way to check

if certain moves are valid (eg, are they marked within an already marked neighbor cell?)
if stored words are valid or not (this part is already covered)
I don't need to do undo operation

sentences:
Is Windows window creation faster / more efficient than GLFW window creation? Are there any benefits to using Windows window for OpenGL or Vulkan rendering, rather than using GLFW window?

Is there any performance hits when using C++ Window creation over GLFW since it provides OpenGL and Vulkan interface?

sentences:
Allow Pushing|Boosting in free browser MMOGs? There seems to be a set of rules (or game design criteria) common to free MMOGs, to encourage fair competition. One such rule is that each player may have only a single account (despite the difficulty of enforcing this effectively). A related issue has recently come to my attention, where a player who does not themselves play often, instead of using their limited resources for their own gain transfers them to another, stronger player. Commonly these might include spouses or disinterested roommates or children, or friends who are no longer active in the game.

Does this advantage violate an essential aspect of the design of the game, or should it be permitted?

sentences:
Dynamic VBO update possibly corrupting data? I want to draw a line between two vertices.  On a mouseclick the vertex data will change and I want to update the line to use the new values.  I am using a VBO for this and it looks like the update process is somehow corrupting the VBO data.  The line is not drawing in a direction that I would expect given the values of the vertices.

There are four lines in total and I am updating only the last two vertices.  The vertex data is initialized as:

      float[] vertLineBuffer = {
          1.0f,0.0f,0.0f,//right
          0.0f,1.0f,0.0f,//top
          0.0f,0.0f,0.0f, //center
          -1.0f,0.0f,0.0f, //START
          0.0f,-1.0f,0.0f //END
            };

The init routine:

  public void setLineVBOs(GL4 gl)  throws Exception {

      vboLineHandles = new int[2];
      gl.glGenBuffers(2, vboLineHandles, 0);

      //populate the position buffer
      FloatBuffer fbData = Buffers.newDirectFloatBuffer(vertLineBuffer);
      gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboLineHandles[VERTICES_LINE_IDX]); //the vertex data
      gl.glBufferData(GL4.GL_ARRAY_BUFFER, fbData.capacity() * 4,
              fbData, GL4.GL_STATIC_DRAW);
      fbData.clear(); //don't need this anymore

      //populate the color buffer
      FloatBuffer fbColor = Buffers.newDirectFloatBuffer(vertLineColor);
      gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboLineHandles[VERTICES_LINECOLOR_IDX]); //the vertex data
      gl.glBufferData(GL4.GL_ARRAY_BUFFER, fbColor.capacity() * 4,
              fbColor, GL4.GL_STATIC_DRAW);
      fbColor.clear(); //don't need this anymore

      //set vertex array index
      IntBuffer intBuffer = BufferUtil.newIntBuffer(1);
      gl.glGenVertexArrays(1, intBuffer);
      iLineVao = intBuffer.get(0);
      gl.glBindVertexArray(iLineVao);

      gl.glEnableVertexAttribArray(VERTICES_LINE_IDX);
      gl.glEnableVertexAttribArray(VERTICES_LINECOLOR_IDX);

      gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboLineHandles[VERTICES_LINE_IDX]); //the vertex data
      // Associate Vertex attribute 1 with the last bound VBO
      gl.glVertexAttribPointer(0,3, GL2ES2.GL_FLOAT, false,0,0);

      //color
      gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboLineHandles[VERTICES_LINECOLOR_IDX]); //the vertex data
      gl.glVertexAttribPointer(1,3, GL2ES2.GL_FLOAT, false,0,0);

  }

And then I attempt to update the VBO on an event (mouseclick) like this:

  public void updateLine(GL4 gl, float[] pos)
  {
      //pos contains the new vertex data
      vertLineBuffer[9] = pos[0];
      vertLineBuffer[10] = pos[1];
      vertLineBuffer[11] = pos[2];
      vertLineBuffer[12] = pos[3];
      vertLineBuffer[13] = pos[4];
      vertLineBuffer[14] = pos[5];

      FloatBuffer fbData = Buffers.newDirectFloatBuffer(vertLineBuffer);

      gl.glBufferSubData(GL4.GL_ARRAY_BUFFER, 0, fbData.capacity() * 4, fbData);
      gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboLineHandles[VERTICES_LINE_IDX]);

      fbData.clear();

  }

The vertex shader:

#version 430

layout (location=0) in vec3 vertexPosition;
layout (location=1) in vec3 vertexColor;

out vec3 Color;

void main(void) {
    Color = vertexColor;
    gl_Position = vec4(vertexPosition, 1.0);
}

The frag shader:

#version 430

in vec3 Color;

layout (location = 0) out vec4 FragColor;

void main(void) {

    FragColor = vec4(Color, 1.0);

}

Does this look right?  Can anyone see where this might damage the contents of the VBO?

sentences:
How can I model a "weapon overheating" mechanic? I want to create a weapon overheating system very similar to the plasma rifle in Halo. You can watch a video of the plasma rifle firing.

What I want to do is to create a flexible logic that can be used for multiple weapons for different in-game feelings.  Here is my proposed system

Create a bar that is split from 0 - 100.
Each bullet has a heat value as an integer.
Every bullet adds this value to the bar.
The bar has a cooldown set as some value per second.
If the bar goes over 100 with any bullet fire the bullet still shoots but then the weapon is deactivated for a period defined as it's "cooldown."

Now this system is very simple but visually it will be very linear, with a simple growth and decay. I wanted to try to create a more exponential system that would mean the bar would jump quickly to the middle then remain and hover near the top / hot bit of the bar for a long period to create a sense of anticipation just before it overheats.

What would be a good formula to achieve that result?

sentences:
Game Networking: Client request or Server Sending I'm trying to implement a basic client-server setup for my game. But what confused me was how I would approach sending updates.

Would I do:

Server has a tickrate, let's say at 20ms. Each tick would sends an UDP package to EVERY connection with the current game state and it's entities.

OR

Client request an update from the server and the server respond with the update. When the client receives it, it asks for another update and so on.

Pro-cons:

Con: Sends a package every tickrate and in this case 20ms. What if a clients broadband connection has a triptime at 300ms? Wouldn't that overload that client and his broadband?
Pro: Consistent and fast?

Con: Requesting is done via TCP which is slower because the client has to wait before sending the next request.
Pro: no overload?

So my question would be, what I'm I missing and how would I approach sending updates about the current game state?

Cheers!

sentences:
2.5D platformer how to darken building edges? I was wondering how I could go about creating a vignette type effect / some sort of volumetric shadow for the 'cross section' parts of a 2.5D level. The effect I'm going for can be seen in 'This war of mine' where the edges of the rooms and walls / floors that are facing the camera have been darkened and blurred. (see below).

I thought about creating the edges in photoshop and then blurring them and putting them in, however the blur scales weirdly as I'm re scaling the sprites so it looks really fake and not like a visual effect. Is there perhaps a 2d shader I could use or make?

Any help on this would be appreciated!

Cheers

My photoshop attempt to recreate

sentences:
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:
Floating point determinism with respect to procedural generation, clustering and GPU offloading I've been designing a distributed procedural generation system for a while now in my spare time and one of the problem's I've been thinking about recently, with respect to the broader architecture, is that of floating point determinism inconsistency when you can't ensure that you have a homogeneous cluster of machines running a persistent world.

Part of my design requires that any given machine can regenerate procedural content as needed, allowing for unimportant but resource-hungry content to be destroyed and recreated as needed on whatever machine is available to do the work.

I have been running on the basic idea that I will use high-precision 32/64 bit integers for most things, and that generally works fine, but the standard coherent noise algorithms all use floating point values in their calculations.

Do I need to implement custom non-floating-point versions of all those algorithms (i.e. using longs) or is there a better approach?
Should I be using fixed-point types for this kind of thing, and if so, how does that impact my desire to have the option to offload some of the PCG work to the GPU, when possible? Also, are fixed point types fast enough for heavy use within a game engine?
Can I ignore floating point precision issues if I can get away with a maximum level of precision? i.e. If I'm happy to use no more than, say, six decimal places of a result, does that keep me safe across different machines and architectures?

Note: my engine is purely the simulation side of things. It doesn't matter to me if there are slight rendering inconsistencies when a user is playing the game; all that matters is that the procedurally-generated source data is consistently regenerated no matter which machine in a cluster is doing the work.

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:
Why am I seeing elapsed game time differ from total game time in XNA? I was trying three different ways of using ElapsedGameTime and TotalGameTime, because I want an exact match, so everything is updated/drawn accordingly.

As I was experimenting, I learned that the very first update, ElapsedGameTime and TotalGameTime are both 0.

Second update, ElapsedGameTime is 0.0166667, which is correct (60 updates per second). But TotalGameTime is 0, I don't understand why.

So, if I start to add from the third update (time += gameTime.ElapsedTime), ElapsedGameTime is equal to TotalGameTime, otherwise there will be always a 0.0166667 difference.

Can someone explain that to me?

UPDATED: code

    using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

using System.Diagnostics;

namespace TestTime
{
    class TimeTest2
    {
        TimeSpan totalTimeElapsed;
        TimeSpan frequency = TimeSpan.FromSeconds(5.5f);

        int times = 0;
        int timesCheckpoint = 1;

        public void load()
        {

        }

        public void initialize()
        {
            totalTimeElapsed = TimeSpan.Zero;
        }

        public void update(GameTime gameTime)
        {
            times++;
            String debug = "";
            TimeSpan zero = TimeSpan.Zero;

            if( times > 2 )
            {
                totalTimeElapsed += gameTime.ElapsedGameTime;
            }

            if( totalTimeElapsed != gameTime.TotalGameTime )
            {
                debug += " Diff time:"+times+" ["+totalTimeElapsed.ToString() + " != " + gameTime.TotalGameTime.ToString() + "]";
            }

            TimeSpan checkpoint = TimeSpan.FromSeconds(5.5f*timesCheckpoint);
            if( gameTime.TotalGameTime >= checkpoint )
            {
                debug += "5.5f MARK ";
                timesCheckpoint++;
            }

            if( !debug.Equals("") )
            {
                addDebug(debug + "  -" + gameTime.TotalGameTime.ToString());
                addDebug("");
            }
        }

        public void draw()
        {

        }

        public void addDebug(string str)
        {
            Debug.WriteLine(str);
        }
    }
}

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:
What would be a good way to scroll a large html canvas (that contains little repetition if any) What would be a good way to scroll the content of a huge html5 canvas so that the scroll is crisp and smooth, and memory consumption (and cpu load or battery consumption) is also reasonable?

any good library that can take care of it for you? Any specific plotting algorithm that will avoid a jumpy feel?

I guess the best way is to pre-plot upwards and downwards of the current viewport, but if the user quickly scrolls a whole lot up, I assume that some algorithms outperform others.

My canvas has very little repetition drawn on it, in case it matters, and the content doesn't change much. Just a very very long canvas element that also contains a lot of text, and needs to smoothly scroll in the browser viewport.

sentences:
Better way to go up/down slope based on yaw? Alright, so I got a bit of movement code and I'm thinking I'm going to need to manually input when to go up/down a slope. All I got to work with is the slope's normal, and vector, and My current and previous position, and my yaw.

Is there a better way to rotate whether I go up or down the slope based on my yaw?

Vector3f move = new Vector3f(0,0,0);
move.x = (float)-Math.toDegrees(Math.cos(Math.toRadians(yaw)));
move.z = (float)-Math.toDegrees(Math.sin(Math.toRadians(yaw)));
move.normalise();

        if(move.z < 0 && slopeNormal.z > 0 || move.z > 0 && slopeNormal.z < 0){
            if(move.x < 0 && slopeNormal.x > 0 || move.x > 0 && slopeNormal.x < 0){
                move.y += slopeVec.y;
            }
        }

        if(move.z > 0 && slopeNormal.z > 0 || move.z < 0 && slopeNormal.z < 0){
            if(move.x > 0 && slopeNormal.x > 0 || move.x < 0 && slopeNormal.x < 0){
                move.y -= slopeVec.y;
            }
        }

        move.scale(movementSpeed * delta);
        Vector3f.add(pos, move, pos);

sentences:
What's a good way to store a series of interconnected pipe and tank objects? I am working on a puzzle game with a 6 by 6 grid of storage tanks that are connected to up to 4 tanks adjacent to them via pipes. The gameplay is concerned with combining what's in a tank with an adjacent tank via the pipe than interconnects them.

Right now I store the tanks in a 6x6 array, vertical pipes in a 5x6 array, and horizontal pipes in a 6x5 array. Each tank has a reference to the object that contains both tanks and pipes and when a pipe needs to be animated filling with liquid, the selected tank just calls a method on the container object telling it to animate the pipes it is connected to (subtract 1 from row or column to find connected pipes).

This feels like the wrong way of doing it, as I've also considered just giving each tank references to the pipes connected to it to access directly.

sentences:
Draw Edges in OpenGL I use blender game engine and blender uses OpenGL for graphics. How can I draw lines around all 3D objects? Would this be a job for a filter? Mainly, I want my end result to look drawn.
I found this:
uniform sampler2D bgl_RenderedTexture;
uniform sampler2D bgl_DepthTexture;

void main()
{
   float depth = texture2D( bgl_DepthTexture, gl_TexCoord[0].xy).r;
   float depth2 = texture2D( bgl_DepthTexture, gl_TexCoord[0].xy + vec2(0,0.002)).r;
   float depth3 = texture2D( bgl_DepthTexture, gl_TexCoord[0].xy + vec2(0.002,0)).r;

   float fac = abs(depth-depth2) + abs(depth-depth3);

   float intensity = 9050;

   vec4 sub = vec4(fac*intensity,fac*intensity,fac*intensity,0);

   gl_FragColor = texture2D( bgl_RenderedTexture, gl_TexCoord[0].xy ) - sub;
}

#change float intensity

here and that seems to work, but I need it to look more sketched. So I would like some noise influence. Maybe it's called sinus displacement? Is there a way to do that?
I draw and I want the style to look like this. Thanks.
Disclaimer: I do hang out on BSE and this is not a question they are prepared to answer or is it necessarily on-topic for them, since it is about OpenGL.

sentences:
Updated Unity project from 2020.2.1f to 2021.1.7: lighting is messed up, scenes are brighter I've updated my project from 2020.2.1f to 2021.1.7 (also tried 2020.3.8), and now my scenes are much brighter for some reason:

Any tips?
Current I use the standard pipeline I think, because the Render Pipeline Asset is set as None.
I have only one realtime directional light in the scene, and no Lighting Settings set in the Lighting window. The environment is the Default-Skybox.

sentences:
Quaternion rotation around center, undefined behavior Here's my code:

vec4 qx, qy, qz;
mat4 mx, my, mz;

// rotating using quaternions
glm_quat(qx, to_radians(a->rx), 1.0f, 0.0f, 0.0f);
glm_quat(qy, to_radians(a->ry), 0.0f, 1.0f, 0.0f);
glm_quat(qz, to_radians(a->rz), 0.0f, 0.0f, 1.0f);

// turning the quaternions into matrices
glm_quat_mat4(qx, mx);
glm_quat_mat4(qy, my);
glm_quat_mat4(qz, mz);

mat4 trans = {
    1, 0, 0, 0,
    0, 1, 0, 0,
    0, 0, 1, 0,
    0, 0, 0, 1
};

mat4 rot = {
    1, 0, 0, 0,
    0, 1, 0, 0,
    0, 0, 1, 0,
    0, 0, 0, 1
};

mat4 final;

// combining the rotations into one.
glm_mat4_mulN((mat4* []){&mx, &my, &mz}, 3, rot);

// translating the `trans` matrix.
glm_translate(trans, (vec3){ a->x, a->y, a->z });

// finally combining the translation with the rotation into one.
glm_mat4_mul(trans, rot, final);

My desired behavior is that the object rotates around its center, but here is what happens instead:

So , it seems that my object is rotating around some weird other undefined point.
I have no idea why this happens.

Any ideas? Thank you.

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:
Unity3d Android - Fixed Resolution How can i set a fixed 720p resolution on any devices using unity3d android?

  unity3d version: 2018.4.5f1

sentences:
How to erase the small gaps in tilemap in Unity? I want to erase small gaps in my tilemap. The gaps look like this:

The texture I used has no gaps:

I tried by disabling anti aliasing.It didn't worked so what can I do in this case?

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:
How should I manage events in XNA on the Windows Phone 7 without impacting performance? It's best-practice to not to create lots of short-lived temporary objects the heap as it'll eventually force a garbage collection during game-play.

It is best to create short lived value objects.

Where does this leave us with event handlers?  My game object fires events quite frequently, so I don't want to create new MyThingDidSomethingEventArgs every time.

What's the alternative.  What do you use?

sentences: Eliminate unwanted "hills" in navmesh over a flat floor So in the image below you can see that my navmesh has these weird hills being formed in it. Any way to remove these? My AI gets stuck on them.

sentences:
Turning off Perspective Divide Is there a way, in OpenGL, to switch off the automatic perspective divide?
I'd like to see the effect a perspective projection has by itself.

sentences:
Explain the difference between extrapolation and interpolation http://www.unagames.com/blog/daniele/2010/06/fixed-time-step-implementation-box2d here there are two algorithms of smoothing in case of fixed time step physics simulation. I don't understand the formula of interpolation:

state = currentState * alpha + previousState * (1-alpha)

And also I don't understand the comparison figure. Please explaing what is the meaning of multiplying current state with alpha and summing with previous state with 1 - alpha.

sentences:
What is the point of caling Draw() as often as possible? From the MSDN page:

  Update and Draw are called at different rates depending on whether IsFixedTimeStep is true or false. If IsFixedTimeStep is false, Update and Draw will be called sequentially as often as possible. If IsFixedTimeStep is true, Update will be called at the interval specified in TargetElapsedTime, while Draw will continue to be called as often as possible.

What is the point of calling Draw potentially more often than Update? Why is Draw not upper-limited to the number of Update calls?

sentences:
Issue implementing proper collision in XNA Game Studio 4.0 I am building a game in XNA 4.0, where a player moves about a 2 dimensional (vertical perspective) map consisting of blocks. My issue is creating proper collision between the payer and the blocks (basic game physics.) The player moves more than 1px per frame, so .Intersects() just isn't enough, I need physical contact collision that can function in a gravity environment. The current version I currently have is a piece of garbage and only works occasionally.

Basically, all that the collision system needs to do is stop gravity when the player lands on a block, and provide some decent physics when the player hits blocks (movement in that direction ceases). The idea behind my current solution is to move the next Position around until it finds a clear spot, but it doesn't work well. I have an idea why, just have no idea how to do it properly.

I know there must be a better way to do this. What would be the best method of making this kind of collision work properly?

Thanks

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:
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:
FPS : Hands+Weapon Animation I want to create multiplayer first person shooter . Now I want to create animation where the soldier is walking with rifle .

I have separated hands from the body of the model and I have dropped hands and rifle in the camera , but when I move the camera hands don`t move with camera but the rifle does .  Hands are controlled by the bone . How can I make the walk animation + camera movement together?

sentences:
Best way to call LibGDX modules? It has been mentioned in the "Application Framework" section of the LibGDX online wiki that accessing the 6 modules (application, audio, files, graphics, input & net) in a static way is not the best practice.

The exact wording written int the wiki is below:

  The modules described earlier can be accessed via static fields of the
  Gdx class. This is essentially a set of global variables that allows
  easy access to any module of libgdx. While generally viewed as very
  bad coding practice, we decided on using this mechanism to ease the
  pain usually associated with passing around references to things that
  are used often in all kinds of places within the code base.

But almost all LibGDX applications that I have seen, modules information is fetched in a static way.
If static way is not the right way then how to access these modules?

sentences:
How can I improve the performance of this rendering code? I've created a practice application for rendering triangles/squares/cubes using VBOs. This is mainly so I can get it right before upgrading a 3D block world game I've written that currently is using display lists to cache block rendering.

I have a 3D cube rendering with an interleaved VBO and I recreated a basic chunk/block system that does the following:

Loads chunks in a 10x10 area
Each chunk creates its own float buffer and adds 16x16x16 cube vertices, colors, texture coordinates.
Each chunk then is rendered via its own VBO.

The VBO rendering code, called per-chunk, looks like this:

interleavedBuffer.flip();

glGenBuffersARB(ib);
int vHandle = ib.get(0);

glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);

glBindBufferARB(GL_ARRAY_BUFFER_ARB, vHandle);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, interleavedBuffer, GL_STATIC_DRAW_ARB);

glVertexPointer(3, GL_FLOAT, 32, 0);
glColorPointer(3, GL_FLOAT, 32, 12);
glTexCoordPointer(3, GL_FLOAT, 32, 24);

glDrawArrays(GL_QUADS, 0, vertexCount);

glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);

glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);

ib.put(0, vHandle);
glDeleteBuffersARB(ib);

clear();

This method renders everything perfectly, however it suffers from performance problems. A few chunks of 16x5x16 are fine, 60 fps. Increasing them to 16^3 and loading 10x10 chunks, the performance drops to 8fps.

I'm preparing to use VBOs on a game that loads at most 20x20 chunks of 16x128x16 dimensions so I need resolve this performance issue.

What are my choices?

I have yet to look into interfaced/indexed VBOs. I've heard those are good choices when rendering many of the same thing?
My game currently uses display lists to cache chunk rendering, and I only refresh that cache when a block change is made that requires it. Is there something similar I can do with VBOs?

For reference, my code for the chunk loading and chunk rendering can be perused.

sentences:
Understanding VAOs and adding different arrays to VAOs I'm really confused on what you do. I can do them, however I got this problem. Say you have several squares, say 1,000 squares. Now I can make a VAO for each 1,000 squares and then do some for loop to render all of the squares. I can also use shaders to move the squares.

However, is it possible to put all 1,000 squares in one VAO.

The problem is I'm going to create a voxel game. So I need to render about 10,000 cubes. However, the game will lag a lot even if I render 200 squares how I'm currently doing it.

float points[] = {
    0.0f, 0.0f, 0.0f,
    0.3f, 0.0f, 0.0f,
    0.3f, 0.3f, 0.0f,
    0.0f, 0.0f, 0.0f,
    0.0f, 0.3f, 0.0f,
    0.3f, 0.3f, 0.0f
};

float colours[] = {
    1.0f, 0.0f,  0.0f,
    1.0f, 0.0f,  0.0f,
    1.0f, 0.0f,  0.0f,
    1.0f, 0.0f,  0.0f,
    1.0f, 0.0f,  0.0f,
    1.0f, 0.0f,  0.0f
};

unsigned int points_vbo = 0;
glGenBuffers (1, &points_vbo);
glBindBuffer (GL_ARRAY_BUFFER, points_vbo);
glBufferData (GL_ARRAY_BUFFER, 18 * sizeof (float), &points, GL_STATIC_DRAW);

unsigned int colours_vbo = 0;
glGenBuffers (1, &colours_vbo);
glBindBuffer (GL_ARRAY_BUFFER, colours_vbo);
glBufferData (GL_ARRAY_BUFFER, 18 * sizeof (float), &colours, GL_STATIC_DRAW);

unsigned int vao = 0;
glGenVertexArrays (1, &vao);
glBindVertexArray (vao);
glBindBuffer (GL_ARRAY_BUFFER, points_vbo);
glVertexAttribPointer (0, 3, GL_FLOAT, GL_FALSE, 0, (GLubyte*)NULL);
glBindBuffer (GL_ARRAY_BUFFER, colours_vbo);
glVertexAttribPointer (1, 3, GL_FLOAT, GL_FALSE, 0, (GLubyte*)NULL);

glEnableVertexAttribArray (0);
glEnableVertexAttribArray (1);

//Setup shaders
std::string vertex_shader = loadshaders("test_vs.txt");
std::string fragment_shader = loadshaders("test_fs.txt");

unsigned int vs = glCreateShader (GL_VERTEX_SHADER);
const char* str = vertex_shader.c_str ();
glShaderSource (vs, 1, &str, NULL);
glCompileShader (vs);
unsigned int fs = glCreateShader (GL_FRAGMENT_SHADER);
const char* strb = fragment_shader.c_str ();
glShaderSource (fs, 1, &strb, NULL);
glCompileShader (fs);

unsigned int shader_programme = glCreateProgram ();
glAttachShader (shader_programme, fs);
glAttachShader (shader_programme, vs);
glLinkProgram (shader_programme);

// main loop
while (!glfwWindowShouldClose(window))
{
    float ratio;
    int width, height;
    glfwGetFramebufferSize(window, &width, &height);

    glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glClearColor (0.6f, 0.6f, 0.8f, 1.0f);
    glUseProgram (shader_programme);
    glBindVertexArray (vao);
    glDrawArrays (GL_TRIANGLES, 0, 6);

    glfwSwapBuffers(window);
    glfwPollEvents();
}

So how would I say add points2[], points3[] and put them into the same VAO. How can I design my shader so I can then do transformation on the points in the arrays say translate points2[] array 4 blocks right, without effecting every other point.

sentences:
How do I colour a mesh in Kiss3d? This is a question about the sebcrozet/kiss3d graphics engine for the Rust programming language. I have managed to create a mesh using group.add_mesh(). Now I want to colour my mesh with a specified colour for each vertex (or face). Does anyone know how I do this?

One possible approach seems to be to define a RgbImage with all my different colours somewhere in the image, turn that into a DynamicImage, turn that into a Texture, somehow associate the texture with the mesh, set up a UV map, and set the UV location for each vertex to map to the relevant colour.

The documentation does not go into enough detail or give a specific example. Does anyone have any example code that works?

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:
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:
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:
Unity2D: Floor tiles moved or missing I'm following the 2D Roguelike tutorial, which can be seen here. I don't want to get fancy, just follow the existing steps.

I've reached the part where all it's supposed to do is draw the playfield.  But it looks like this:

and I don't know why.

Some of the floor tiles are appearing beyod the outer wall, and others are missing (or maybe they're stacked on top of other tiles).

(EDIT: I discovered that the "missing" tiles are because I had the sprites in the wrong layer, and fixed them. I still have several appearing to the left of the outer wall, though.)

I tried to debug it in Visual Studio. The plan was to step through it line by line to see how the tiles are put down, but the debugger doesn't show the playfield until the whole thing is complete.

sentences:
UI mockups to the code My UI designer has made a lovely photoshop PSD of the UI and everything pretty. The biggest problem I'm having is converting some of the more elegant fonts used into something renderable in-game. Is there a way to convert these font styles in Photoshop to a bitmap font of some sort?

I need to be able to render text like this inside my code:

sentences:
Is it possible to update the livetile in XNA WP7 game? ( I'm not sure if this question belongs here, but since it is related to game development and I have no idea where else I should post this, I will post this here )

As the title says, what I am basically asking is if it is possible to update the livetile of an pure XNA game ( not SL + XNA hybrid )?

I've been thinking something like that whenever user launches the game, I would create an texture dynamically and then update the livetile to show that texture. Even better would be if I could schedule this code to run for example once a day, without requiring user to even launch the game.

Is this possible in WP7 or in WP8 ( is the WP8 SDK even publicly released yet? ) in pure XNA game? What about in XNA + SL hybrid?

sentences:
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:
SpriteSheets with XML and without XML I'm very new to game development, and I'm working with Godot engine.
I'm making a platform game and I downloaded a package from the web with assets, it contained some sheets.
I have used a 2D atlas importer in Godot before bt it requires a .json file which contains the coordinates.
The sprite sheet i downloaded does not have a xml or json.
How can i get sperate images from that sheet? Or any work around to make a tiled map in Godot?

sentences:
How to make a character that moves like a slinky? I have a school assignment to make a 2D platformer game, with a character that moves like a slinky:

(Animated example from the assignment linked above)

At first, the character needs to grow in height over time
When the player presses a button, the character starts to bend toward the next platform
Its height when you press the button determines whether it will hit the next platform
After that it must shrink to its initial size, and it goes over again.

How can I approach this?

sentences:
Unity - kinematic rigidbody character calling OnCollisionEnter and OnCollsionExit on every frame for specific collisions I'm encountering an issue with my character collider behavior. I have several elements that are relevant to this issue:

a "character" gameobject (capsule mesh), that is assigned with a kinematic rigidbody. It has a script with these methods:

OnCollisionEnter determines if the object has a "walkable" tag and if so, changes a "isGrounded" bool to true
OnCollisionExit is the opposite, it determines if the player has stopped colliding with this "walkable" object, and if so, turns the "isGrounded" bool to false
a "gravity" method, which applies a gravity force on the character if "isGrounded" is false

a "gravity" trigger collider, surrounding the entire game area. OnCollisionStay, this trigger applies a constant gravitational force upon the colliding character in a specified direction (in this case, the direction is -Y).
a "platform", a rigidbody with all position/rotation values locked. This is what the character object stands on top of, and when the character collides with it, the "isGrounded" value becomes true, and the character stops being affected by gravity.

This method works fine in my scene for multiple platforms. When the player lands on them, the OnCollisionEnter works, and when they are dragged off of them (in editor, no movement implemented yet), the OnCollisionExit works, and they start falling again (until they land and the collision enter triggers).

However, all those platforms which work are all either flat or sloped at a very slight angle. I am testing platforms at steeper angles, and find that at slopes of 30 degrees or higher, the player colliding with them causes both OnCollisionEnter and OnCollisionExit to be called every frame. This causes such a serious performance hit that it has even nearly crashed my computer in one instance (and my computer is able to run VR games, so it is hardly lacking in power!). I do not understand why it happens, as the object is clearly colliding with the slope, and as far as I can see, the object is not continuing to move after the initial collision (or at least the position values are not changing for the object). I thought it might be due to the object's orientation or due to the shape of the collider, but changing these variables did not have an effect on the problem.

It looks like the capsule is also never exactly hitting the ground, rather it is floating slightly above it. When I move the capsule to be inside of the platform, the error stops. The collider is the same size as the mesh, so I don't know why it is "colliding" before actually making contact. Is there something I can do to fix this problem? Reducing the collider size doesn't help either.

Can anyone offer insights as to why this problem is occurring, and tell me how I can fix it? Thank you for reading.

sentences:
How to hide a sprite on trigger when the player enters the trigger zone? I am making a roof for my 2D top down survival game, and I want to make it so that the roof disappears when the player enters the building, and re-appears when they leave.
Here is the code I've written so far:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Roof : MonoBehaviour {
    public GameObject roofGameObject;

    void OnTriggerEnter2D(Collider2D collision) {
        roofGameObject.SetActive(false);
    }

    void OnTriggerExit2D(Collider2D collision) {
        roofGameObject.SetActive(true);
    }
}

I got it to work so that, when I go in, the roof it disappears. But when I leave it stays disappeared. How can I fix that?

sentences:
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:
GameMaker: how to let the game run as fast as it is able to? I am making a game/simulator where I want the game to, upon command, run as fast as the computer can handle, that is to say, if the game can run at 60 fps, don't run at 30 fps.

What should I do to make the game do that and would this even make sense?

(Note: when I looked at the built-in variable fps, I often see the value to be higher than the room speed I set, so I thought that maybe I can allow the game to run faster than the room speed initially set.)

sentences:
Unity2D: Don't Destroy On Load UI button I have a UI button as a child under my background canvas. What I want to do is to save the button through out scene, I tried using DontDestroy OnLoad but It saved ay canvas and everything under my canvas, rather than saving just the button. Anyway this is my DontDestroyOnLoad script:

void Awake()
{
    DontDestroyOnLoad(transform.root.gameObject);
}

Thank you. :)

sentences:
Setting Window Icon Using GLFW (LWJGL 3) What's the best, cross platform, way of setting the window icon using LWJGL 3?

I have a PNG image and would like to set it to the icon present in my dock (OS X) or the application bar (Linux).

sentences:
Finding a path with minimal number of turns on a grid? There is a path, generated by my implementation of A*, where diagonals aren't allowed, and the heuristics is the Manhattan distance.

Is there a way to always or nearly always find a path with the least amount of turns? Even if it's a bit longer, and even if it costs more computationally.

Or is there a way to algorithmically "fix" a path later? Like on the image below, cut those long detours and replace them with those blue parts.

My current version is far from optimal, both length-wise, and both turn-wise.
I also tried multiplying the heuristic value of a tile, if:

it isn't going in the same direction as the line made from the previous 2 tiles. But that didn't help either.

sentences: Saving data in the local computer with cocos2d-js Making a game with cocos2d-js, is there a reliable way to create saved data in my local computer? I see that there is cc.sys.localStorage but it is removed if the user clears the browser's cache or when they simply use another browser.

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:
What is a simple algorithm for calculating evenly distributed points on an ellipse? I am looking for a simple algorithm to plot evenly distributed points on an ellipse, given the major and minor axes. This is really easy to do with a circle like so:

var numberOfPoints = 8;
var angleIncrement = 360 / numberOfPoints;
var circleRadius = 100;
for (var i = 0; i < numberOfPoints; i++) {
    var p = new Point();
    p.x = (circleRadius * Math.cos((angleIncrement * i) * (Math.PI / 180)));
    p.y = (circleRadius * Math.sin((angleIncrement * i) * (Math.PI / 180)));
}

(which creates points that are the same distance apart from their neighboring points) but I can't find or figure out a way to do this on an ellipse. (Solutions in AS3 preferred, but not required.)

sentences: How is data written from two different gpu cores to the same memory? Does each core’s data get written to the shared memory one at a time or both at the same time? For instance, when two cores that are next to each other need to write to the same memory spot does the gpu write the core from the left first, then the next core or does it happen at the same time? I’m asking because I want to know if I can get the 2nd core to check a value that the 1st core changed before writing the data.

sentences:
Problem getting mouse events while keys held down in SDL2 I'm attempting to write input capturing code using SDL2 on Windows.  However, I'm running into a problem.

Whenever a key is held down, the SDL event queue has no mouse movement, nor will the mouse move on my screen. Instead, The SDL event queue continually returns the key I am holding down as an SDL_KEYDOWN event.

Here is a simple example program which reproduces the problem exactly:

#include <SDL2/SDL.h>
#include <iostream>

int main(int argc, char** argv) {
  SDL_Init(SDL_INIT_EVERYTHING);
  SDL_Window* window = SDL_CreateWindow("Moust Input Test", SDL_WINDOWPOS_UNDEFINED,
                                        SDL_WINDOWPOS_UNDEFINED, 640, 480,
                                        SDL_WINDOW_SHOWN);
  SDL_Event event;
  for(; ;) {
    while (SDL_PollEvent(&event)) {
      if (event.type == SDL_QUIT) {
        SDL_DestroyWindow(window);
        return 0;
      } else if (event.type == SDL_MOUSEMOTION) {
        int x, y;
        SDL_GetMouseState( &x, &y );
        std::cout << "Mouse moved to: " << x << " " << y << std::endl;
      } else if (event.type == SDL_KEYDOWN) {
        std::cout << "Code of key pressed: " << event.key.keysym.sym << std::endl;
      }
    }
  }
  return 0;
}

What I would expect to happen is that, when I hold down a key (for example, 'a'), it prints exactly once:

Code of key pressed: 97

And then, while they key is held down, if the mouse is moved, it prints every time the mouse is moved:

Mouse moved to: [wherever]

Instead, I'll keep seeing over and over again:

Code of key pressed: 97

And I will not get any mouse movement whatsoever on the screen, nor will I get my mouse movement log printed, until I release whatever keys I am holding down.

Anybody know how I can capture mouse movement while I have a key held down?

The only thing I can think of which could possibly be relevant is I am compiling with MinGW using:

g++ -Dmain=SDL_main test.cpp -o test.exe -L./lib/SDL2 -lmingw32 -lSDL2main -lSDL2 -mwindows -mconsole

Thanks.

Edit: I've also just noticed that the problem persists even when the window is minimized- if I am holding a key down in this text window while my program is minimized in another Window, the mouse stops working, though my program is not printing out the key code.

sentences:
Parametric form of a cubic function After researching about curves in computer graphics (splines in my case), I have come across something I did not know: Explicit functions like: \$y=x^2+2\$ are not the best way to interpolate between points because you could get 2 or more values for y for the same x. So, parametric functions seem much better for this if we make the commonly used t parameter, the distance from origin, time, etc...
After studying a bit how to convert from explicit to parametric form I have been shocked when I have found in some texts they use these parametric cubic functions to interpolate through points:
$$\begin{align}
    x(t)&=at^3 + bt^2 + ct +d \\
    y(t)&=2at^3 + 2bt^2 + 2ct +2d
\end{align}
$$
but wait... this is the exact same form the explicit function was:
$$
    y(x)= ax^3 + bx^2 + cx + d
$$
From what I have seen for other example functions in some math books the parametric funcions where not the same form that its explicit form counterpart.
Am I missing something?
Examples of the texts I'm refering to could be:
https://www.cs.helsinki.fi/group/goa/mallinnus/curves/curves.html
http://escience.anu.edu.au/lecture/cg/Spline/parametricCubicCurves.en.html

sentences: Destroy the enemy only if the animation is played and touch the enemy I am using Unity. I want to attack an enemy with a knife. So I created an object (the knife) and put an attacking animation to it. Now I want to destroy the enemy only if the attacking animation is played and the knife touches the enemy. And if the animation is not played and the knife touches the enemy it should show a game over screen.

sentences:
How do I use this Perlin Noise texture to change the mesh? Using the Unity docs page on Perlin noise, I made this script:

// Width and height of the texture in pixels.
public int pixWidth;
public int pixHeight;

// The origin of the sampled area in the plane.
public float xOrg;
public float yOrg;

// The number of cycles of the basic noise pattern that are repeated
// over the width and height of the texture.
public float scale = 1.0F;

private Texture2D noiseTex;
private Color[] pix;
private Renderer rend;

void Start()
{
    rend = GetComponent<Renderer>();
    scale = Random.Range(15, 20);
    xOrg = Random.Range(0, 20);
    yOrg = Random.Range(0, 20);
    // Set up the texture and a Color array to hold pixels during processing.
    noiseTex = new Texture2D(pixWidth, pixHeight);
    pix = new Color[noiseTex.width * noiseTex.height];
    rend.material.mainTexture = noiseTex;
}

void CalcNoise()
{
    // For each pixel in the texture...
    float y = 0.0F;

    while (y < noiseTex.height)
    {
        float x = 0.0F;
        while (x < noiseTex.width)
        {
            float xCoord = xOrg + x / noiseTex.width * scale;
            float yCoord = yOrg + y / noiseTex.height * scale;
            float sample = Mathf.PerlinNoise(xCoord, yCoord);
            pix[(int)y * noiseTex.width + (int)x] = new Color(sample, sample, sample);
            x++;
        }
        y++;
    }

    // Copy the pixel data to the texture and load it into the GPU.
    noiseTex.SetPixels(pix);
    noiseTex.Apply();
}

void Update()
{
    CalcNoise();
}

The only difference between this code and the Unity docs example is that I added some randomness to the size and origin points of the texture.

I attached the script to a plane, and now when I run the game, the plane has a random noise texture on it.

Now I want the texture to give height to the mesh, so it will look like a terrain.
How do I do this?

sentences:
MMORPG Design Question: Best idea for adding PvP(PlayerVsPlayer) in open world MMO? Brief Explanation of game: Time Travel, one map, open world MMO called ChronoCraft. If you'd like to know more about the game, you're welcome to check out our twitter where we post some of our development: https://twitter.com/Chrono_Craft

Here are the ideas so far:

1- Safe Zones

Pros: People in major towns are safe and can fight when they leave the safety of the town
Cons: When dealing with NPC's and Quests(Non-instance ones) outside of town, someone can kill you as you are talking to them

2-PvP Zones

Pros: Instead, areas of the map where PvP is possible is limited to the "wilderness" or dangerous areas(Anything that doesnt have Quest-able NPCs)
Cons: Significantly reduces the area of allowable PvP areas

3-PvP Toggle

Pros: This allows players to turn on PvP mode in settings where only other PvP enabled players can fight eachother outside of Safe Zones
(We would make it so if you are hit, you cant turn off PvP mode until a certain time to prevent people escaping death)
Cons: Ambushing is limited, because only the people who are ready to fight will have it enabled

4-Separate servers

Pros: Having a PvE server and a PvP server. Which makes it so the player decides what gameplay he wants.
Cons: Players cant bring items or money between servers so they may have to start from scratch if they change their mind on what type of server they like playing.(This is to protect the player economy from taking all the resources from one server and bringing them to another server)

5-Time Specific

Pros: When night falls, then PvP is enabled for everywhere outside a Safe Zone
Cons: For players wanting to avoid PvP they will be forced to stay in towns half the time which might get boring unless they do fun stuff like running a shop or restaurant.

6-Special Days

Pros: When there is lighting and rain, PvP is enabled which will happen every few minecraft days in the game. Allowing PvPers to fight outside of safe zones. And a HUD display will make this clear.
Cons: Players wanting to avoid PvP will have to stay in town during the inclement weather, which they might not enjoy.

7-Level Specific

Pros: Only players with a similar skill level will be able to fight eachother. So new players dont have to worry about pros slaughtering them early on.
Cons: It would be hard to fight along friends unless you're the same skill level. "John help me kill this guy"-"Sorry cant, he is too low skill for me"

8-Arenas

Pros: Confines the fight to specific spot like a colosseum
Cons: Nearly impossible to wage huge fights like 100v100
(Colosseum will make it into the game at some point, but should it be the only PvP option)

9-PvP Everywhere
Pros: Either (A)Players can figure out their own police/protection system or (B) NPC guards in major towns spawn and nearly guarantee the death of a killer in the town.
Cons: Has alot of potential to be annoying if players dont want to get killed in the middle of business in towns. Might also turn away less PvP focused players.

-What do you think is the best?

-Can I mitigate the cons for the one you choose?

-Is there a better idea entirely?

sentences:
2D Side Scroller Game Without A TileMap I want to create a 2D side scrolling game in a similar style as the game "Castle Crashers". (Go to: http://store.steampowered.com/app/204360/ to see some pics of the game).

I have experience creating 2D games which use an array of tiles (a tilemap), to see if the player/enemies/bullets are moving to a blocked or unblocked tile by referencing the entities x and y coordinates with the tile in the corresponding location.

My question is: How do I implement collision with the "game map", in a game that doesn't use tiles, but instead shapes.

For instance: if the current "map" was a circle, the p[layer could move freely around the inside of the circle, but could not leave the circle.

Sorry if this question is long-winded and confusing, but I would really appreciate some help with this!

Thanks!

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:
Particle effect after the bullet In my game, I fire a bullet from the gun along with that I generate a particle behind the bullet so that I look like fire effect after the bullet. But my problem is that the position I got from the bullet was distance in place. So basically I want to say that the bullet speed was high for that reason I got coordinate for the particle generation was far from each other like

dot dot effect. But I want continuous flow of particle behind the bullet. So please provide any guidance for my problem

sentences:
Timing - use individual timer for every task or global timer? I'm writing a game, where a player controls a spaceship.
It regenerates energy over time. So I need to make a little timer that adds certain amount of energy to the pool per second.
My enemies also shoot at me, activate different abilities. I figured I can use separate timers for these too.
But I see how this can quickly go out of hand, since I have different engines with different energy regeneration rates - will I need to replace the timer every time?
Or if I have different energy - I have to manually track all the timers and set them anew.

I thought, maybe I can use some global singleton method that can handle all the timing in my game? It can update everything in the game, and when something new happens (like new enemy spawning) I can just send my singleton information about that object and it will handle all the timing for it?

Is this a good approach? Can I read up something about this somewhere?
Maybe you have some experience with this?

sentences:
You've killed the enemy you needed to get across. Now you have to die and retry? I am designing enemies for a platformer, and want to have enemies which the player utilises to get through levels.

I like the idea of jumping on enemies to platform across gaps, but it's problematic if they die. It feels really bad to put the player in an unwinnable state, having killed their means to platform across a level. It just feels messed up to be like, 'You've killed the enemy you needed to get across. Now you have to die and retry'.

What are some ways of fixing that problematic game state?

sentences:
Unity - Invert Movement Direction I am currently developing a 2,5D Sidescroller in Unity (just starting to get to know it).

Right now I added a turn-script to have my character face the appropriate direction of movement, though something with the movement itself is behaving oddly now.

When I press the right arrow key, the character moves and faces towards the right.
If I press the left arrow key, the character faces towards the left, but "moon-walks" to the right.

I allready had enough trouble getting the turning to work, so what I am trying is to find a simple solution, if possible without too much reworking of the rest of my project. I was thinking of just inverting the movement direction for a specific input-key/facing-direction.

So if anyone knows how to do something like that, I'd be thankful for the help.

If it helps, the following is the current part of my "AnimationChooser" script to handle the turning:

    Quaternion targetf = Quaternion.Euler(0, 270, 0); // Vector3 Direction when facing frontway
    Quaternion targetb = Quaternion.Euler(0, 90, 0); // Vector3 Direction when facing opposite way

    if (Input.GetAxisRaw ("Vertical") < 0.0f) // if input is lower than 0 turn to targetf
    {
        transform.rotation = Quaternion.Lerp(transform.rotation, targetf, Time.deltaTime * smooth);
    }
    if (Input.GetAxisRaw ("Vertical") > 0.0f) // if input is higher than 0 turn to targetb
    {
        transform.rotation = Quaternion.Lerp(transform.rotation, targetb, Time.deltaTime * smooth);
    }

The Values (270 and 90) and Axis are because I had to turn my model itself in the very first place to face towards any of the movement directions.

sentences: Line renderer's baked mesh not moving correctly with the line I used LineRenderer' Bakemesh to create a mesh around the line drawn, it is placed exactly, but when the line moves, the mesh is not following its movement.

sentences:
Monogame/XNA Making animations play once per click I'm currently making a #gbjam entry and everything has been going smoothly up to this point.

My issue being that I've implemented a shooting mechanic and along with it an animation to play as a shot is fired, however I'm struggling to make it so that the animation plays properly each click of the mouse. I only ever see sporadic flickers with no real pattern to them. I'm using an animation class and for anything else it's been working fine.

Here's my animation's Draw() method:

public void Draw(SpriteBatch sB, GameTime gT, Vector2 pos)
    {
        time += (float)gT.ElapsedGameTime.TotalSeconds;

        while (time > frameTime)
        {
            frameIndex++;
            time = 0f;
        }

        if (frameIndex >= totalFrames)
        {
            frameIndex = 0;
        }

        Rectangle source = new Rectangle(frameIndex * frameWidth, 0, frameWidth, frameHeight);

        sB.Draw(spriteSheet, pos, source, Color.White, 0.0f, origin, 1.0f, SpriteEffects.None, 0.0f);
    }

For reference the animation spritesheet is 20 frames long, each 128px by 128px.

Here is the Update() and Draw() calls that are use in handling shooting and the shooting animation:

        #region Shooting
        if (mS.LeftButton == ButtonState.Pressed && mSP.LeftButton == ButtonState.Released)
        {
            if (bCount > 0)
            {
                shooting = true;
                bCount--;
                Debug.WriteLine("Bang!" + " Rounds Left: " + bCount);
            }
            else
            {
                shooting = false;
                Debug.WriteLine("OUT OF AMMO");
            }
        }
        else
        {
            shooting = false;
        }

        if (mS.RightButton == ButtonState.Pressed && bCount == 0)
        {
            shooting = false;
            bCount = 6;
            Debug.WriteLine("RELOAD");
        }
        #endregion
        mSP = mS; //mSP being the previous mouse state and mS being the current
    }

    public void Draw(SpriteBatch sB, GameTime gT, Camera cam)
    {
        if (shooting)
        {
           revolverShoot.Draw(sB, gT, fpsPos);
        }
        else
        {
            revolverIdle.Draw(sB, gT, fpsPos);
        }
    }

If anyone could offer any ideas as to 'force' the game to complete the animation first before continuing I would be really greatful.

sentences:
How to transfer drag control from one sprite to another? (Phaser) I have some sprites that are set to horizontal drag only.

What I want to do is, if someone drags vertically up from one of those sprites, when they leave the bounds of that sprite (top edge), spawn a new sprite and be actively dragging that new sprite.  The user should not have to release the mouse button, they should just instantly be dragging the new sprite.

I can successfully calculate when the pointer is leaving the first sprite, and spawn a new sprite at that location, but I can't seem to transfer the drag control.

I tried Pointer.swapTarget, but that doesn't seem to work - the new sprite is spawned, but just sits there and I have to release the mouse button and re-click on the new sprite in order to drag it.

How can I make the transfer seamless?

sentences:
LibGDX - Managing a Minimap I'm making a top-down strategy game so I thought a minimap is a must. I'm using Scene2D to display my GUI and since the minimap is technically a part of the GUI, I used the stage camera to position the minimap. Below is how I'm rendering the minimap.

    shape.setProjectionMatrix (stage.getCamera ().combined);
    shape.begin (ShapeType.Filled);
    shape.setColor (Color.CYAN);
    shape.rect ((Constants.RENDER_WIDTH - 500) + ship.getX () / 30, ship.getY () / 30, 5, 5);
    shape.end ();

    shape.setProjectionMatrix (stage.getCamera ().combined);
    shape.begin (ShapeType.Line);
    shape.setColor (Color.YELLOW);
    shape.rect (Constants.RENDER_WIDTH - 500, 0, 500, 500);
    shape.setColor (Color.WHITE);
    shape.rect ((Constants.RENDER_WIDTH - 500) + (camera.position.x) / 30, (camera.position.y - camera.viewportHeight / 2) / 30, Constants.RENDER_WIDTH / 30, Constants.RENDER_HEIGHT / 30);
    shape.end ();

The first ShapeRenderer (shape) call renders the ship marker, which is currently a small square. The second renders the bounds of the minimap which is 500x500. RENDER_WIDTH and RENDER_HEIGHT are the width and height that I'm plugging into camera as viewport dimensions (1920x1080). The map is 15000x15000, so I'm dividing the ship location by 30 so that it is always in the range of 0-500. However, when I move the camera around I actually end up being able to see the ship before the minimap says I should, which is illustrated below. I'm fairly certain it's due to the zoom level of the camera, but I haven't figured out how to incorporate that other than multiplying the width and height of the display of where the camera is (the white box), by the current zoom level, which didn't work.

sentences:
TiledMap blocks makes Animation invisible //////////////////////////////////////////////////////////////////////////////////

Got it fixed. Thanks to anyone who tried to help me.
New Code:

mapManager.render();
spriteBatchForeground.setProjectionMatrix(Main.getGraphicsManager().getAdvCamera().getCamera().combined);
spriteBatchForeground.begin();
    worldManager.render(delta, spriteBatchForeground);
    animationManager.render(spriteBatchForeground);
    particleEffectManager.render(delta, spriteBatchForeground);
spriteBatchForeground.end();

/////////////////////////////////////////////////////////////////////////////////

I just implemented my animations but now I discovered a problem with my TiledMap.

Here some Screenshots:

Code for 1

spriteBatchForeground.begin();
// mapManager.render();

spriteBatchForeground.setProjectionMatrix(
    Main.getGraphicsManager().getAdvCamera().getCamera().combined );
worldManager.render(delta, spriteBatchForeground);
animationManager.render(spriteBatchForeground);
particleEffectManager.render(delta, spriteBatchForeground);
spriteBatchForeground.end();

Code for 2

spriteBatchForeground.begin();
mapManager.render();

spriteBatchForeground.setProjectionMatrix(
    Main.getGraphicsManager().getAdvCamera().getCamera().combined );
worldManager.render(delta, spriteBatchForeground);
animationManager.render(spriteBatchForeground);
particleEffectManager.render(delta, spriteBatchForeground);
spriteBatchForeground.end();

Issue:

The animation isn't drawing when I enable the drawing for the tiledmap.
I have no idea why this happens...

sentences: Is there any way to load pieces of a tile-map as and when needed, and not the entire map at once? I created a tile-based rpg game in java, but it runs really really slow, the reason is the big tile-map that is stored in the buffer. Is there any way to programmatically load pieces of the map when needed and not the entire map at once, so that the buffer will remain small and the game will run fast? Any sort of useful tip would be helpful.

sentences:
Is locking required to implement a seperate rendering thread? I have been reading a lot about this, but still not sure about a proper way to implement an independent render thread, using a variable time step and running in parallel to a physics thread, which uses a smaller, fixed time step. I'm familiar with the mechanics of mutexes and locking, when it comes to concurrent write access, but a render function would only read, and never modify.

Would a locking mechanism be required, at all, for using two buffers - a read buffer that is used by the renderer, while the physics engine modified the write buffer, and swapping after it's finished?

Even with only one buffer, I could imagine that you wouldn't even notice when some objects are updated, while rendering, having interpolation anyway and the much higher render frame rate. The only problem I see, with one buffer, is when objects would be deleted from physics and the renderer still trys to access them.

What is the main problem there? I am not talking about, for example, a concurrent physics and AI that both modify - only one additional render thread.

sentences:
Are any 3D design skills required for game development? I am no graphics designer, but I'm a good developer with lots of experience. So, my question is the following:

Are any 3D design skills required for game development? If not, how does one write a game with 3D characters without having to design them?

sentences:
WebGL - two different approaches to Point Light: what is the difference? So I'm studying Webgl and after directional light I'm approaching point light.

So I've seen two different approaches:

Take the directional light (diffuse and specular components) and multiply them by a falloff attenuation, for example with the attenuation function is by Tom Madams that anyway take in account the distance from the fragment surface point to the light point. This approach is spotted in this webgl light walkthrough tutorial, and I find it easier to understand. Seems also the same approach from this OpenGL tutorial (in the section Point Light)
The other approach listed here does not involve a light attenuation falloff but calculate the light direction from any fragment position and the light point source. It seems a little bit more complicated to me.

Is there something that I have totally misunderstood? What is the difference between this two approaches? When to use the first and when to use the second?

Thanks!

sentences:
Implementing a Random Picker by Supplying an Outcome Table (Similar to a Drop Table) Whilst trying to vary the draw color of some randomly positioned sprites, I really wanted to be able to just supple a table with 2 columns (colour and chance of picking) to some helper function that would do all calculations for me.

Ideally, I want to be able to do something like the follow (semi-pseudocode) :

var table = new object[]
{
    Color.White, 0.2, // Chance: 20%
    Color.Red, 0.2, // Chance: 20%
    Color.Blue, 0.5, // Chance: 50%
    Color.Black, 0, // Default, i.e. remaining chance (10%)
};

Color newColor = Pick<Color>.AtRandom(table); // Apologies if this is very wrong!

I'm fairly confident I could get something to work within the class - my issue is deciding on the correct way to supply the Pick class the chances for each possible selection. I don't want this to be specifically for Color - I want to be able to select between any type of struct / instance of a class. The last line to me doesn't seem 'possible' as in I am unsure whether or not you would require an instance of Pick or if this can be done using a static class.

The use of object[] seems like a hackerish way to implement this. It's more streamlined to use a Tuple however the chance table becomes extremely verbose when every item in the array would be along the lines of Tuple.Create<Color, double>(Color.Red, 0.2), etc.

What is the most sensible / expandable way to do this?

Thanks for your time.

sentences:
Question About Scrolling A Tilemap In C++/SDL/OpenGL I been working with scrolling this week but I recently encounter a problem that I don't understand why it's happening.

In a 2D scroller I want to scroll a tilemap pixel per pixel which gives a smooth scrolling in the game, but I encounter a weird problem, when the movement of the map corresponds with the exact size of the tile, for example, the map it's scrolling 32 pixels to the right, the map seems to jump to the next tile and not the one that corresponds correctly with the screen.

This is the code for drawing the map:

bool Tilemap::drawTilemap(GLfloat sizeTile, int indexTileset)
{
    offsetX++;
    if (offsetX >= 320.f) offsetX = 320.f;

    GLfloat widthTilesetImage = tilesetList.at(indexTileset).getWidthImage();
    GLfloat heightTilesetImage = tilesetList.at(indexTileset).getHeightImage();

    int widthMap = 40 + offsetX/32;
    int heigthMap = 23;

    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    glEnableClientState( GL_VERTEX_ARRAY );
    glEnableClientState( GL_TEXTURE_COORD_ARRAY );

    glBindTexture( GL_TEXTURE_2D, tilesetList.at(indexTileset).getTexture() );

    for (int i = 0; i < heigthMap; i++)
    {
        int startX = offsetX/32;

        for (int j = 0; j < 40; j++)
        {
            int frameIndex = layerMap[i][startX];

            if (frameIndex == 0)
            {
                continue;
            }

            frameIndex -= 1;

            const GLfloat tileX = 0.0f + ( (sizeTile)*j);
            const GLfloat tileY = 0.0f + (sizeTile*i);

            const GLfloat verts[] = {
                    tileX, tileY,
                    tileX + sizeTile, tileY,
                    tileX + sizeTile, tileY + sizeTile,
                    tileX, tileY + sizeTile
            };

            const GLfloat textureWidth = (sizeTile - offsetX/widthTilesetImage) / (GLfloat)widthTilesetImage;
            const GLfloat textureHeight = sizeTile / (GLfloat)heightTilesetImage;
            const int numFramePerRow = (GLfloat)widthTilesetImage / sizeTile;
            const GLfloat textureX = ((frameIndex % numFramePerRow) * textureWidth)+offsetX/widthTilesetImage;
            const GLfloat textureY = (frameIndex / numFramePerRow ) * textureHeight;

            const GLfloat texVerts[] = {
                    textureX, textureY,
                    textureX + textureWidth, textureY,
                    textureX + textureWidth, textureY + textureHeight,
                    textureX, textureY + textureHeight
            };

            glVertexPointer(2, GL_FLOAT, 0, verts);
            glTexCoordPointer(2, GL_FLOAT, 0, texVerts);
            glDrawArrays(GL_QUADS, 0, 4);

            startX++;

        }
    }

    glDisableClientState( GL_VERTEX_ARRAY );
    glDisableClientState( GL_TEXTURE_COORD_ARRAY );

    return true;
}

The variable offsetX it's the one that helps me move one tile at a time the map. The variable startX indicates when it's no longer drawing one tile, so in this one start in the next column of the matrix of tiles.

So, what could be wrong in my code?

Thanks for the help.

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

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

https://imgur.com/a/Zhi6pQu

Goal.

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

sentences:
Resizing the map in HTML5 canvas Say I have a big map for my HTML5 game. And it is drawn with an image repeatedly.
I want my map to be able to resize and respond to player's behaviors.

Now I can resize my map, I just multiply a scale to my maps coordinates (map.x and map.y) and the pattern image will become smaller. However I have two problems that I don't know how to resolve. Let's see what I have got so far.

My Sprite class use paintX and paintY to represent the drawing position. And they are defined as followed:

  get paintX() {
    return map.scale * this.x - frame.x;
  }

  get paintY() {
    return map.scale * this.y - frame.y;
  }

where frame is the view that follows my player when my player moves. In my game my player stays at the middle of the screen and the screen will move with my player. So when the map resizes the player's position will also change but it will stay in the middle of the screen.

In Frame class its x and y coordinates will change when the scale is updated.

init(config) {
  const self = this;
  this._x = config.x;
  this._y = config.y;
  map.on('scale_changed', () => {
      self._x = map.scale * self._x;
      self._y = map.scale * self._y;
  });
}

get x() {
    return this._x;
}

set x(val) {
    this._x = val;
}

get y() {
    return this._y;
}

set y(val) {
    this._y = val;
}

The Problems

1 I have thousands of sprites on the map. After resizing the map some sprites still stay in the same location but they are supposed to render at a scaled location. ( I use very large scale change to test so the change is like 0.2 to 0.3 just to see the result more clearly)

2 If I use very small scale change number such as 0.01 I can still see the change but I can also see some hiccups refreshing the map, then it renders OK again, but overtime it becomes messy and presents problem 1.

Without scaling none of these problems exists. I am scratching my head to find a solution for this resizing problem. Is there a standard and not so complicated solution for this map resizing problem?

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: Who use javaFX for commercial quality games? Are there any companies work with javaFX for building videos games ?

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 can I use ARB_debug_output with SDL on Windows? I'm trying to port a small GL program that I've been working on from Linux to Windows. I have the following:

window_ = SDL_CreateWindow(...);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG);
glContext_ = SDL_GL_CreateContext(window_);
glewInit();
if (GLEW_ARB_debug_output)
{
    glDebugMessageCallbackARB(&DebugCallback, nullptr);
}

I was surprised to find out that GLEW_ARB_debug_output evaluates to false. Could it be that ARB_debug_output not supported on Windows, with the latest drivers for my video card (an older Radeon HD540v)? Am I doing anything wrong? I thought this extension was rather old, and it would probably be supported everywhere by now.

Update: I added my SDL initialization code, as I needed to pass SDL_GL_CONTEXT_DEBUG_FLAG. Unfortunately, ARB_debug_output is still not supported.

Update: After initializing the context with the debug flag through SDL, I manually queried the available extensions (bypassing GLEW) and ARB_debug_output is not available! Again, could this not be supported on my implementation?

sentences: How does one optimize an HTML5 Canvas and JavaScript web application for Mobile Safari? I've created an HTML5 Canvas and JS game that runs great on a desktop or laptop in Chrome (30fps), but on mobile Safari I only get around 8 fps. Are there any simple tips or tricks to increase the framerate?

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 to manage changing Z-Index in an Entity-Component-System? If got an Entity Component System based game-project (like classic zelda).

The Player as well as Enemys are Entities with sprite- and
tranform-components.
The Weapons are also Entities with sprite- and tranform-components.
The player and the Enemies can pickup weapons.
Weapons got an ParentComponent so they will be rendered realtive to
the Carrier-Entity.
There is a script/system for that.
No everytime an player/enemy walks upwards, the weapon must rendered BEHIND/under
the carrier for the illution, that the player walks to the top of the
screen.
I will do this by switching the Z-Index of the transform-component of the carrier with the one of the weapon.
Unfortunately, the rendering system is a Sorted-Iterating-System
which holds a sorted list of all entities with Sprite-Components so
everytime Im changing the Z-Index of an Entity, I have to force the
re-sortening of the list.
This works but sorting an entire list in
java almost every gamellop-update sounds very bad.

Is this really a good idea or should I try something else?
BTW: In practice, Im using libGdx with Ashley as the ECS.

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:
When does a game idea cross the line between homage/parody to ripoff? I'm not sure where this question belongs, but as it pertains to the development of a game idea, I figured I'd try to post it here.

Recently I've been inspired to create a game based on another game I've played. However, the idea that I have is very similar to the original game. I was wondering, when does a game idea cross from being a homage or parody into the realm of being a ripoff? Are there any hard or fast rules or does this cross into a gray area?

sentences:
How do I handle packet loss in a client-server network model? In a client-server network model, the clients only send commands to the server (i.e. coordinates of a click, fire gun, etc.) and the server then runs those commands to produce a game state.

But what if the client sends a command like "fire gun" in one packet which is dropped. Does the user experience that he tapped his fire-button with nothing happening or is there some intelligent way to make sure that such commands are received by the server regardless of packet loss?

I.e continuing to send the old "fire gun" command multiple times to ensure that it at least eventually fires (tagging the command so that the server understands that it is the same command sent multiple times, not a command that is fired over and over).

I've been looking at documentation regarding Quake3, Unreal and Source Network Models but I cannot find anything on this particular problem. I do believe they have solved it though because I never fired my AWP without it actually shooting. If there was lag involved, then it just took a short while before it shot, but it's never lost the command I think.

EDIT: I've found a resource that explains one way to handle this here: http://gafferongames.com/networking-for-game-programmers/reliability-and-flow-control/

They solve it by adding a kind of loose ACK on top of UDP. I feel like there should be a smarter way to go about it however. This way of handling it is ok for the server I guess which mostly needs to make sure that it has a live connection to the and to handle things such as chat messages (which are not really time sensitive but cannot be allowed to get lost) but for the client I believe an ACK creates too much delay when a packet is lost (a full round time latency at the very least).

sentences:
Why use convex polygons and not concave ones in path-finding? I read in Unity's path-finding documentation that they use convex polygons because there won't be any 'obstruction' between 2 points. Then they add their vertices as nodes along with starting and ending points and traverse them using A* algorithm to reach the required destination.
However, I do not understand what they mean by "no obstruction between 2 points". I tried to check the differences between concave and convex polygons but only the angle differences come up (in convex the interior angles must be less than 180 degrees)

sentences: Syncing first person arms and enemy character for struggle in games Some FPS have it where your arms are struggling or doing something melee to a character model. Both the arms and the character you're interacting with are sync'd up in the animation. What's the general idea behind how that syncing is done?

sentences:
Is my game "shovelware" if it uses images from Google Image searches? I think this is a stupid question, but i want to know.

I just read Wikipedia about Steam software and i found a new word for me, that is Shovelware. Wiki says that :

  Low-budget, poor-quality games, released in the hopes of being purchased by unsuspecting customers, are often referred to as "shovelware".

So, let's say that i want to make a games. I have no budget, i use free game engine, free software and using free texture from internet (maybe from dedicated texture website like Textures.com or Poliigon.com) or download free image from google and make my own texture + material with that image using free software like GIMP.

Is my game considered as "shovelware" ?

sentences:
Creating big scene and little size chasing camera I would like to create a climb based game, so I need to have a big scene and a camera that cover only a little part of it and chase my player. This image explains easier what I want:

How can I do it? I'm trying to resize my camera size only, but I don't get the desired result.
Thank you.
s.

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: How could you use mirror in unity to network across multiple networks rather than only LAN (Port Forwarding?) I've been working on a game for my friends and I to play during quarantine but I can't figure out or find any information on networking using mirror. Everything I see gives vague answers to even vaguer questions that assume you have prior knowledge of networking. Could anyone give me any sort of direction on how to port forward using mirror or if there's a better solution?

sentences:
Per-component Shader Blend in Unity Context :
I'm writing a 2D mobile game in Unity where the graphics are essentially black lines drawn on a background image plus some lighting. Running full RGB calculations for every step seems like a waste of processing power. What I'd like to do is render everything in [grey, alpha] and then multiply by the sRGB background image in a separate shader at the end. Actually, ideally, I'd like basically to specify custom components like [grey, highlight, additive, alpha], each of which can be ignored in a given pass, and then do a custom operation with those when I apply the background image, like ceil(src*(dst.r + dst.g)) + half4(dst.b). I can figure out how to do that between 2 textures within a shader, but not between texture and screen (a.k.a. src & dst).
Question :
Basically, is there a way of writing a per-component replacement of the built-in Blend functions? Because something like Blend SrcAlpha OneMinusSrcAlpha only works with the full float4 or half4 vectors.
Or do I need to grab the screen like a texture and handle it within a pass block, and then do Blend Off or Blend One Zero? Or do something with RenderTextures perhaps? My intuition suggests that that would undo some of the efficiency I'd gained in previous steps, though...?

sentences:
Particle systems on multiplayer games I'm working on a 2D javascript/Three.js multiplayer game, using web sockets and an authoritative server currently written in Python.

The combat mechanic will be similar to Geometry Wars however i'm struggling to get my head around how to implement this in an efficient way.

There are several drawbacks/concerns I need to take into account:

Efficiency is key
Three.js particle systems aren't mutable, you cannot add or remove particles once the system has been created, only move them off screen
All calculations with respect to collision and damage must be done server side
My game currently implements entity interpolation with fixed time step updates from the server
Potentially several different weapons/projectile types

I can see several solutions:

Handle each 'bullet' particle individually

Pros

Most accurate way of doing thigs

Cons

Slow on server
Lots of bandwidth
Hard to batch draw objects, will have to draw each individually

Use ray casting on server and have some form of network synced particle emitter

Pros

Much easier on the server and network

Cons

Network synching issues
What happens when a bullet hits an object? Bullet will pass right through

Use ray casting on server for collision/damage and use raycasting on client for more accurate particles

Pros

Much easier on the server and network
Will look more accurate

Cons

May still have some synching issues
More work for the client

Obviously the amount of players currently connected will have an impact on the implementation, I would ideally like to allow hundreds of players to share a game world but there may only ever by 20 or so on screen at once.

The mutable particle system is an issue for all of these but I would still like to use it as it is more efficient that drawing each particle individually. In a test I could have over 10000 particles all moving and still get 60fps.

Any help or comments on my though process would be greatly appreciated. Is there another approach that would be better?

sentences:
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:
Unit testing graphics What is the standard (if there is one) method which professional games developers use to unit test (or closest equivalent) graphics output?

I am developing with Corona SDK and I would like to test the visual output of my game code. I don't believe it is reasonable to pre-generate screenshots, scene definitions or some such for comparison at the end of a test, I would like to know if there is a good testing mechanism for graphics in general.

sentences:
Run Game on Android Even Removed from Application stack (Unity) I am trying to develop a single demo in unity using c#, where I've put counter for minutes and seconds. When the game was in background, still it should keep counting minutes and seconds. After research on google, I've found a function to keep running application in background.

Application.runInBackground=true;

This works exactly when application exist in stack. As soon as it is removed from application stack, it stops every scripts.
What should i implement to keep running application all time in background, even when it is not in application stack.

sentences:
How to implement pathfinding in this situation So I'm creating a game for android using the libgdx library. I render the map from a tmx file and in it all the water tiles have the property of blocked. My player(a sprite) moves to where I clicked/tapped.

My problem is that I am unsure as to how to implement pathfinding. I can get in the layer with the tiles that which have the blocked property but I'm not sure as to how to stop my player from moving through them. I am using the tweenengine to move the player.

I was thinking that perhaps the code would create waypoints for the tween movement from a path finding code but again I'm not sure as to how to implement it.

I looked at A* and all the examples I was looking at were using rectangles and my player doesnt move in a uniform way(1 tile per move). So I cant really assign it values (10 for vertical/horizontal, 14 for diagonal).

If I have said anything that is not true then please correct me

sentences:
What revenue cuts will I take by using Unity combined with Facebook's platform? Basically me and a friend want to develop a Facebook game by using Unity. What I wanted to know is if we do earn any money on it, how would we be required to use the profits of said money? I remember reading that Unity requires you to pay royalty (or something like that) after having earned a certain amount of money from your product.

What confuses me is where Facebook would enter the equation? I can't seem to find any sources on royalty on such from FB-based games.

Does anyone have any sources covering FB-games made in Unity on how it all comes together?

sentences:
UNITY - Huge amount of GRAPHICS in RTS Tiled game after year of development and week of unsuccessful optimization I turn for a help from you, guys.

So, my game is turn-based strategy with hexagon map.
One hexagon consists of one texture for hexagon tile type and seven subtiles, which carry spriterenderer with graphics like piece of town. So if soldier steps on the subtile, the graphics of subtile hide.

On good machines like mine, if I zoom out maximally (45 orthographic size) on 1920x1080 and have visible around 18x16 tiles I get solid 160-200 FPS at MAX details, but on my laptop I barely get 25FPS on 1280x720 and LOW details. Each tile has resolution of 636x499.

I have tried:

Simple shader on SpriteRenderer supporting transparency, just merging    texture with color (This had those best results of 160-250FPS at    HIGH-END and 25FPS on LOW-END)
Creating separate material for each    subtile and replacing SpriteRenderer with Quad mesh, so those    subtiles are statically batched or GPU batched (but I guess they did    not batch at all, because frame debugger showed that sometimes more    fo the same pieces got rendered and then sometimes just one)

So this is just the 50x50 game, when I start large map, like 120x100, it's not really that worse, so I think the problem is just in the graphics and not in the amount of objects.

What are your suggestions I should try to get better performance on LOW-END devices? Do you think that manual GPU-instancing would make it faster? I think, there would be a lot of trouble maintaining which graphic to render and which not.

sentences:
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:
Actor not scaling from center I want to scale the start button from the center with initially scaled to 0.3 times.

    start = new ImageButton(new TextureRegionDrawable(new TextureRegion(startTex)));
    start.setTransform(true);
    start.setScale(0.3f);
    start.setOrigin(Align.center);
    start.addAction(forever( sequence(scaleTo(1.5f,1.5f,1f), scaleTo(1, 1, 0.5f), delay(0.5f)) ));
    table.add(start).expandX().colspan(2).size(start.getWidth()*0.3f);

It scales the button but not from the center.

When I remove size method from above, button scales from the center, but it starts from its initial size rather than 0.3 times.
I am stuck at this. Please help me.

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:
Is it more performant to index in the vertex shader or fragment shader? I have a shader that draws 2D quads from a texture atlas using instancing. I'd like to add a feature that allows me to map each of the RGBA channels in the texture using a 5x5 matrix. For example, the following would swap the red and green channels:

0 1 0 0 0
1 0 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1

I only need a few of these transformations, so my plan is to provide them to the GPU as a uniform and then index into this by passing an attribute to my shader for each quad. I think there are two approaches I could take:

Look up the 5x5 matrix once in the vertex shader and pass it to the fragment shader as a varying
Pass the index to the fragment shader as a varying and look up the matrix in the fragment shader

I'm not sure which of these approaches would be more performant. My inclination is 1, because then the lookup only has to happen once per instance, but does that mean there's more overhead in passing 25 floating point numbers via the varying?

By the way, my graphics pipeline is WebGL if that makes a difference.

sentences: Any Open Source Games That Can Be Ported to Android? I'm looking for some other open source games out there that I can port (easily or not) to Android.  I know that it's possible to port Wolfenstein and Doom and was wondering if there are any others out there.  I was thinking of Civilization (I remember a linux port some time back) and a few others.  It can be in C/C++ or Java.  Thanks in advance.

sentences:
How to calculate FOV with four-walled tiles? I'm working on a 2D tile-based game. I'm trying to calculate FOV and I've implemented walls so they don't take up an entire tile. Instead, they just take up a side of each tile. Similar to:

class Tile {
    bool northWall;
    bool westWall;
}

Most of the algorithms I've been looking at expect walls to take up a full tile, and the check to see if a tile is blocking tiles behind it is trivial. I'm having trouble wrapping my head around this. I've got an implementation of Recursive Shadowcasting right now, but not sure how to write my is_blocked() function. Can anyone give me some advice?

sentences:
Game Maker: Studio - Make objects avoid other instances of same object with A* pathfinding I have a game where there are multiple enemies who must chase a single player.  I have pathfinding set up using the GML A* pathfinding with mp_grid and a path.  However, these enemies can walk on top of each other when seeking the player.  To fix this, I also told the path to ignore enemies as well with mp_grid_add_instances, but then they stop moving altogether because they see themselves as obstacles, thus trapping themselves within a bounding box.  Is there a way I can add "all other enemies BUT self" with mp_grid_add_instances?

Here's my grid creation code (in a CONTROLS class for initializing variables):

global.zombie_ai_grid = mp_grid_create(0, 0, room_width / 50, (room_height - sp_dashboard.sprite_height) / 50, 50, 50);
mp_grid_add_instances(global.zombie_ai_grid, obj_obstacle, false);

This is my path initialization code (in Zombie class):

path = path_add();
alarm[0] = 5;

This is my path creation code in Alarm 0 (path updates every 2 seconds):

mp_grid_path(global.zombie_ai_grid, path, x, y, nearest.x, nearest.y, true);
path_set_kind(path, 1);
path_set_precision(path, 8);

path_end();
path_start(path, MAX_SPEED, 0, true);

alarm[0] = room_speed * 2;

sentences:
Simple Diminishing Return with Cap Problem

Player obtains 5 points per level up to level 80 with a maximum of 400.
There are 5 stats to be distributed to and no maximum limit to how much you can add to a stat.

Strength
Endurance
Intelligence
Agility
Luck - Grants critical chance and critical damage

I would like to implement a diminishing return equation on let's say Luck. For critical chance, I do not wish for the player to be able to hit 100% critical chance.

There will be a ceiling to which it will reach as the increasingly decreasing growth reaches towards 0 per point added.

Example if the maximum critical chance I want the player to have is 40%, Each point into luck will increase critical chance lesser and lesser, until the critical chance reaches around 40%. By which 1 luck will give a very very miniscule amount.

Any solutions? Thank you and your help is greatly appreciated!

sentences:
Self-set vs explicit goals and their efficacy Just curious if anyone has an insight onto the efficacy of self-set goals as opposed to explicit ones in regards to player retention.

Content requirements aside are there any anecdotal or quantitative results on which method provides a more immersive experience for a player, and thus is more likely to keep them around and playing?

sentences: Number of Impressions on Admob for Revenue Just curious for a rough estimate; how many impressions would it take to make 300 dollars, a day, in ad revenue?

sentences:
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:
increasing speed of sound as player approaches I am trying to create a sound that increases in speed as the player gets closer to the object. The sound is just a single 'ping' and will increase in frequency as we approach, once we are on top of it, it should play a different sound. I can't seem to get it to work. Here is what I've done in blueprints:

I'm not extremely experienced with Blueprints and I have almost no experience with working with sound in it. From my understanding, the blueprint should be measuring the distance between the object and the player, dividing it by .5, and then returning the sound at that speed.

Currently, I'm getting no sound whatsoever.

sentences:
How can I shoot an arrow if I know the shot power and target? I am trying to shoot an arrow at a target with a 100% success rate.  Given the initial force applied to the arrow, the gravity, the location of the archer, and the location of the target, how can I do this in Unity?

I have read How can I find a projectile's launch angle?, and it contains the equation I am using:

However, this is only accurate when I am at the maximum distance from the object given its power.  (Above the maximum distance means that the arrow cannot reach the target.)  The closer I move to the target, the less accurate the arrow shot becomes, as it travels past the target.  The angle is increased resulting in the arrow traveling a shorter distance as I'd expect, but it is not increased by enough.

The script spawns an arrow (a simple sphere) and launches it towards a target.  It fires once per second, but the closer to the target the archer is, the more inaccurate the arrow is.  The case of the archer being too far from the arrow is not handled, but that is not my concern right now.

using UnityEngine;
using System.Collections;

public class Archer : MonoBehaviour
{
    public GameObject arrow; //Simple 3D Sphere
    public GameObject target; //Simple 3D Cube
    public float power = 25.0f;
    public Vector3 aim;

    private void Start()
    {
        StartCoroutine(ShootArrows());
    }

    private IEnumerator ShootArrows()
    {
        while (true)
        {
            yield return new WaitForSeconds(1.0f);
            Vector3 spawnPosition = new Vector3(transform.position.x, transform.position.y, transform.position.z);
            GameObject arrowInstance = Instantiate(arrow, spawnPosition, Quaternion.identity) as GameObject;
            arrowInstance.GetComponent<Rigidbody>().AddForce(Aim() * power, ForceMode.VelocityChange);
        }
    }

    private Vector3 Aim()
    {
        float xAim = target.transform.position.x - transform.position.x;
        float yAim = Mathf.Rad2Deg * Mathf.Atan(((Mathf.Pow(power, 2) + Mathf.Sqrt((Mathf.Pow(power, 4) - (-Physics.gravity.y) * (-Physics.gravity.y * Mathf.Pow(HorizontalDistance(), 2) + 2 * VerticalDistance() * Mathf.Pow(power, 2))))) / -Physics.gravity.y * HorizontalDistance()));
        float zAim = target.transform.position.z - transform.position.z;
        Vector3 aim = new Vector3(xAim, yAim, zAim).normalized;
        return aim;
    }

    private float HorizontalDistance()
    {
        float xDistance = target.transform.position.x - transform.position.x;
        float zDistance = target.transform.position.z - transform.position.z;
        float distance = Mathf.Sqrt(Mathf.Pow(xDistance, 2) + Mathf.Pow(zDistance, 2));
        return distance;
    }

    private float VerticalDistance()
    {
        return Mathf.Abs(target.transform.position.y - transform.position.y);
    }
}

My best guess is that I am using the equation correctly, but I am plugging the angle into Unity wrong.  Why is my script giving me inaccurate results?

sentences:
How can I render 3d pictures synched frame by frame to a keyed video? I'm developing a software that aims to combine a keyed video with a 3D rendered one, synchronously frame by frame.

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

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

sentences:
Render Occluded pixels to gray color In 3d space, objects can be occluded by another objects.
By depth testing, the occluded faces are skipped rendering. Only the nearest(smallest) depth value pixels are drawn.
But, sometime we need to render the occluded object or pixels for game play.

To differentiate the occluded object's pixels from foreground pixels, some game use gray color to render the pixels.

This is the sample images for the case.

I guess this can be achieved by some sort of shader.
How can I make this effects in Unity 3D Engine? Any hints or idea plz.

sentences:
Why does duplicating my object cause its vertex animation shader to distort it? I used a vertex shader (based on this example) to animate a flag waving. When I have a single flag in my scene, it works correctly.

When I duplicate the flag, all of the copies become wildly distorted after I hit play.

Here is the shader code I'm using:

Shader "Custom/Flag" {
    Properties {
        _MainTex ("Albedo (RGB)", 2D) = "white" {}
        _Speed ("Speed", Range(0, 5.0)) = 1
        _Frequency ("Frequency", Range(0, 1.3)) = 1
        _Amplitude ("Amplitude", Range(0, 5.0)) = 1
    }
    SubShader {
        Tags { "RenderType"="Opaque" }
        Cull off

        Pass {

            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #include "UnityCG.cginc"

            sampler2D _MainTex;
            float4 _MainTex_ST;

            struct v2f {
                float4 pos : SV_POSITION;
                float2 uv : TEXCOORD0;
            };

            float _Speed;
            float _Frequency;
            float _Amplitude;

            v2f vert(appdata_base v)
            {
                v2f o;
                v.vertex.y +=  cos((v.vertex.x + _Time.y * _Speed) * _Frequency) * _Amplitude * (v.vertex.x - 5);
                o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
                o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
                return o;
            }

            fixed4 frag(v2f i) : SV_Target
            {
                return tex2D(_MainTex, i.uv);
            }

            ENDCG

        }
    }
    FallBack "Diffuse"
}

How can I make this work with multiple flags using the same material?

Should I use a new material instance for each object like this? It doesn't seem optimal:

    material = new Material (Shader); // Create new material
    material.SetFloat ("_Speed", _Speed);
    material.SetFloat ("_Frequency", _Frequency);
    material.SetFloat ("_Amplitude", _Amplitude);
    material.SetTexture ("_MainTex", _MainTex);
    flagObj.GetComponent<MeshRenderer>().sharedMaterial = material; // Set values

sentences:
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 do I draw a portion of a texture onscreen in OpenGL? I have a sprite sheet loaded as an OpenGL texture, and I'd like to draw a portion of that texture sequentially for animation. Is there an actual OpenGL command to draw part of a texture? I can get it done by modifying the U and V components when drawing the texture, but I'm not sure if there's a more elegant/correct method of doing this.

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: AABBs in lwjgl 2.9.3 I think I have succeeded in making an aabb out of 6 quads in opengGL but how would i get it to stay with its centre-point at the centre-point of all objects. I know it is easy for one object how would I do it automatically for all objects?

sentences:
Why does the resolution of floating point numbers decrease further from an origin? My OpenGL scene has objects that are positioned at ridiculously far distances away from the origin. When I view these objects, and pan/rotate/zoom a camera around them, they 'jitter'. That is, the vertices comprising the objects seem to snap around an imaginary 3d grid of points. I've read this is a common problem because of the amount of information that can be stored using floating point precision (which OpenGL, and pretty much everything else uses). I don't get why this happens though.

When searching for a solution, I came across the very simple 'floating origin' fix, and it seems to work. I just transform everything so my objects are in the same relative positions but whatever my camera's looking at is close to the origin. I found an explanation here: http://floatingorigin.com/, but I couldn't follow it.

So...Could someone explain why positioning my scene very far away (say 10 million units) from the origin results in the erratic behaviour I observed? And also why moving it close to the origin fixes the problem?

sentences:
Shooting function in pygame w/ 2 Players I'm trying to program a shooting function in my game using pygame. Process:

Player one will press 'Space' and shoot their type of projectile
Player two would press 'E' and shoot their type of projectile
Player one's projectile would collide with player two but not player one (and vice versa).

I'm not sure how to code this function properly. Here's my code so far:

Initalize
import pygame, math
WHITE = (255, 255, 255)
#Creating sprites

class Player(pygame.sprite.Sprite):

    def __init__(self, color, width, height):

        super().__init__()
        #Config
        self.image = pygame.Surface([width, height])
        self.image.fill(WHITE)
        self.image.set_colorkey(WHITE)

        # Draw
        pygame.draw.rect(self.image, color, [0, 0, width, height])

        # Fetch
        self.rect = self.image.get_rect()

    def right(self, pixels):
        self.rect.x += pixels
    def left(self, pixels):
        self.rect.x -= pixels
    def up(self, pixels):
        self.rect.y -= pixels
    def down(self, pixels):
        self.rect.y += pixels

pygame.init()
# Config
RED = ( 255, 0, 0)
BLUE = ( 43, 255, 230)
ORANGE = ( 255, 170, 0)
BLACK = (0, 0, 0)

SCREENWIDTH = 400
SCREENHEIGHT = 500

size = (SCREENWIDTH, SCREENHEIGHT)
screen = pygame.display.set_mode(size)
pygame.display.set_caption("Squares Fight")

group1 = pygame.sprite.Group()

player1 = Player(BLUE, 50, 50)
player2 = Player(ORANGE, 50, 50)
player1.rect.x = 5
player1.rect.y = 5
player2.rect.x = 345
player2.rect.y = 445

group1.add(player1, player2)

loop = True
startend = False
startanew = True
clock = pygame.time.Clock()
font = pygame.font.SysFont("berlinsansfb", 72)
text = font.render("Fight!", True, WHITE)

# Game Loop
while loop:
        for event in pygame.event.get():
                if event.type == pygame.QUIT:
                        loop = False

        #Logic
        keys = pygame.key.get_pressed()
        if keys[pygame.K_LEFT]:
                player1.left(3)
        if keys[pygame.K_RIGHT]:
                player1.right(3)
        if keys[pygame.K_UP]:
                player1.up(3)
        if keys[pygame.K_DOWN]:
                player1.down(3)
        if keys[pygame.K_a]:
                player2.left(3)
        if keys[pygame.K_d]:
                player2.right(3)
        if keys[pygame.K_w]:
               player2.up(3)
        if keys[pygame.K_s]:
               player2.down(3)

    collision = pygame.sprite.collide_rect(player1, player2)
    if collision == True:
            group1.remove(player1, player2)
            startend = True
    group1.update()
    if startend == True:
            pygame.display.set_caption("They destroyed eachother! Press space to do it again")
            startanew = True
    if startanew == True and keys[pygame.K_SPACE]:
            group1.add(player1, player2)
            pygame.display.set_caption("Squares Fight")
            startend = False
    # Drawing
    screen.fill(BLACK)
    screen.blit(text,
                (200 - text.get_width() // 2, 240 - text.get_height() // 2))
    group1.draw(screen)

    # Closing
    pygame.display.flip()
    clock.tick(60)
    #Indentation isnt right because how i needed to format this
 pygame.quit()

What else do I need to add to accomplish this task?

sentences:
Rotation of a cylinder between to spheres in R3 I want to connect two spheres with the coordinates [ax, ay, az] and [bx, by, bz] with an cylinder which is placed in between the spheres an rotated.
For the placement I calculate the center of the two spheres and place the cylinder there.
The cylinder spawns parallel to the Z-Axis. Since I want to connect the spheres, I thought I first need to rotate either on the Y- or X-Axis and then on the Z-Axis.

I learned that combination of rotations is easiest with quaternions since you only have to multiply them, so I decided to use quaternions. So I get the angle of the first rotation(on Y- or X-Axis) and get the quaternion of this rotation, and then I get the angle of the second rotation on the Z-Axis and the quaternion of this rotation. Then I multiply them in order to get the combined rotation, and use the resulting quaternion on the cylinder.

This seems to work, but here is the problem: the more I get to the +-45° angle between the two spheres, the more I get something which looks like an offset to me. Furthermore, the greater the distance between the points is, the more offset I get. I checked the two quaternions which are multiplied, and both are indeed a +-45° rotation about the correct axis (in this example -45° in radians)

Since this is very hard to explain with words, here are some screenshots:

This is the 45° rotation:

This is with more distant points:

The red dot on the ground marks the x-axis, the blue dot marks the y-axis.The simulation was started without gravity.

So my question is, why is this happening? And if anyone knows why, how can I fix it? Since I am new to game development and orientation in R3, this could be something obvious to an experienced developer.

I am using c++ with the Open Dynamics Engine and the drawstuff library for my program.

EDIT:
This is the resulting quaternion

EDIT2:
I add the calculation of the angles. This whole thing is in an for-loop.

        /* lengths[i][j] is the distance between two points, taking the coordinates of point 1 minus the coordinates of point 0

        For example:
        lenghts[0][0] is the distance of the x-coordinates of the first two points which should be connected
        lengths[0][1] is the distance of the y-coordinates of the first two points which should be connected
        lengths[0][2] is the distance of the z-coordinates of the first two points which should be connected
        */
        angle = -pioff + atan(lengths[i][2] / lengths[i][1]); // pioff is M_PI_2 = pi/2 = 1.5708
        if(isnan(angle))
        {
            angle = 0.0;
        }
        dQFromAxisAndAngle(Q1, 1, 0, 0, angle); // get quaternion1 of angle
        cout << "   quat Q1: " << Q1[0] << " + i" << Q1[1] << " + j"  << Q1[2] << " + k"  << Q1[3] << endl;
        cout << "   angle Q1: " << angle << endl;
        cout << "   x axis: angle = -" << pioff << " + atan(" << lengths[i][2] << " / " << lengths[i][1] << ") = " << angle << endl;
        angle = -atan(lengths[i][0] / lengths[i][1]);
        if(isnan(angle))
        {
            angle = 0.0;
        }
        dQFromAxisAndAngle(Q2, 0, 0, 1, angle); // get quaternion2 of angle
        cout << "   quat Q2: " << Q2[0] << " + i" << Q2[1] << " + j"  << Q2[2] << " + k"  << Q2[3] << endl;
        cout << "   angle Q2: " << angle << endl;
        printf("   connect xyz1(%f/%f/%f) and xyz2(%f/%f/%f)\n", xyz1[i][0] + c[0], xyz1[i][1] + c[1], xyz1[i][2] + c[2], xyz2[i][0] + c[0], xyz2[i][1] + c[1], xyz2[i][2] + c[2]);
        cout << "   z axis: angle = - atan(" << lengths[i][1] << " / " << lengths[i][0] << ") = " << angle << endl;

This is the output I get. Lenght[][] output are the elements of lengths[i][j]

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:
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 setup Authentication Database and Game Database? I'm playing around with creating a game in C# using the XNA Framework. I've decided to use technologies that I'm pretty much familiar with and create things from scratch. There are probably frameworks out there that would take away all of the difficulties that I'm encountering but I find it fun to dive into these challenges and over come them manually if you will.

My current issue is that when I play MMO type games I know the general setup. I must login (authenticate) and then select a server to begin playing on. Once I log into the server I'm generally met with a Character Select screen of some sort before I actually "log in to the game".

With that said, my initial attempt at developing a database system was this:

Authentication Database - table for user information, table for server information
Game Database - table for characters, table for inventories, items, etc...

After I created these I noticed a key missing problem. Users are linked to characters and characters are linked to a server. I currently have these pieces of information spread over 2 databases. I thought to myself, maybe this isn't a good idea?

I guess I could: Game Client can store the reference to the account identifier in the code once login was successful, but doesn't that sound like a security issue?

Anyone have thoughts or suggestions? Or a good book recommendation for development in this area?

Note I'm not trying to develop an absolute perfect system that I can release and make money off of. I'm more doing this for experience, fun and enjoyment so my solution doesn't have to be perfect, but I don't want it to be the worst possible solution either :)

sentences:
Switching lanes in an endless runner Some of you probably know the (once) popular mobile games Temple Run, Minion Rush or Subway Surfers. They all have the similarity of a lane system, which allows you to switch your position with a simple swipe to the left/right.

I am creating a game that also consists of three lanes. The only difference is your general movement going from left to right, thus making the lanes on top of each other.

As LibGDX is my preferred 2D games framework, I want to accomplish this task with mostly built-in functionality. Currently, I have two approaches, which both have flaws and resolving any of them would be a major help to me.

1) Using Actions. I could add an moveTo(upperLane.x, upperLane.y, 0.5f) if the player is in the middle, same goes for the lowerLane. But what, if he double swipes down, while being at the top? I would need so build a sequence, after the first actions started, or cancel the current action and start a new, but how to calculate the appropriate time for that large movement, while still "hanging between" two lines?

2) Implement impulses, that are able to add up in positive (up) and negative (down) directions. This would make it possible to move two steps at once, while having an appropriate time and also to move back up, while being in between two lanes, on your way down. Everything about impulses is plain speculation, as I have no further knowledge and don't want to use Box2D only for this purpose.

3) Feel free to give better suggestions! Special thanks to whom can point out the mechanic of one of the above mentioned games, which implement this feature flawlessly!

sentences: Should I learn 2d game development before 3d? I'm an iPhone app developer. I want to get into iOS gaming. The question is-should I start with learning 2D like Cocos 2D or Corona SDK before learning 3D gaming like Unity? I'm more interested in 3D gaming, but do you think that knowing 2D gaming is a prerequisite to learning 3D development?

sentences:
How do I pick tiles from an isometric map with slopes? I'm looking for a way to convert mouse/screen coordinates to isometric map coordinates, with the addition that the world has slopes and cliffs, and I have to be able to tell which quadrant of the tile is being pointed at by the mouse. The textures are handled by OpenGL, so I can't (easily) pick directly based on the tile sprite.

I've found several similar solutions, (e.g. Isometric Tiles Math, XNA Resources & Mouse Maps for Isometric Height Maps with the latter looking most promising) but none of them seem to quite fit my requirements.

My tiles look like this:

What algorithm or technique could I use here?

sentences:
How do I create the visual effect of transitioning between night and day? I am making an open-world project in Unity 4.5.5 and I want to create a visual effect of transitioning from day to night? The Legend of Zelda: Wind Waker HD has a great example of such a transition.

How can I achieve this? Can I use a script or do I need to create multiple scenes with different skyboxes to make this possible?

sentences:
Why is the timer not calling the function? I am trying to call a function every 30 seconds. I have used this before without issues so I'm not sure why it isn't working now. Any ideas? Has something changed in 4.24 maybe?

.h I have tried both public and private

UFUNCTION()
void Ping();

And the .cpp I see both logs in the output so I know its getting there. Also the ensure passes. I have also tried GetWorld which is null in a UObject and GWorld which also works but has the same problem of the ping function not being called at all.

UE_LOG(LogTemp, Warning, TEXT("start ping"))
if (ensure(GEngine))
{
    UWorld* World = GEngine->GetWorldContexts()[0].World();
    UE_LOG(LogTemp, Warning, TEXT("start ping has gworld"))
    World->GetTimerManager().SetTimer(PingTimerHandle, this, &UGameJoltApi::Ping, 30, true, 30);
}

And here is the ping function. Its not called even once. I never see the log in the output.

UE_LOG(LogTemp, Warning, TEXT("ping"))
FString Url = URLBaseApi + URLSessions + "ping/?game_id=460364&username=" + Username + "&user_token=" + UserToken;

TSharedRef<IHttpRequest> Request = FHttpModule::Get().CreateRequest();
Request->SetVerb("POST");
Request->SetHeader("Content-Type", "application/json");
Request->SetURL(GenerateUrl(Url));
Request->OnProcessRequestComplete().BindUObject(this, &UGameJoltApi::OnStartSessionResponse);
Request->ProcessRequest();

sentences:
Are there any math limitations on the near plane in a perspective matrix? I've noted that if in the perspective camera I put near plane to a low number like 0.000001 and far plane to 1000 my render has some problems, like strange depth artifacts (see images below) or division by zero during the unprojection procedure.

I'm not very skilled in math but there should be something strange because if I put near plane at 0.1 everything is working as expected.

Is there any mathematical limitation to the near plane value I'm not aware of?

I'm on WebGL with JavaScript (I'm not using Three.js; my question is related to the math, not to a particular framework). If it matters, I'm using Float32Array to store matrices, and I'm using those libraries to do the math:

https://github.com/Jam3/camera-unproject
https://github.com/stackgl/gl-mat4
https://github.com/stackgl/gl-mat4/blob/master/perspective.js

In particular the division by zero happens here:

function project (out, vec, m) {
  var x = vec[0],
    y = vec[1],
    z = vec[2],
    a00 = m[0], a01 = m[1], a02 = m[2], a03 = m[3],
    a10 = m[4], a11 = m[5], a12 = m[6], a13 = m[7],
    a20 = m[8], a21 = m[9], a22 = m[10], a23 = m[11],
    a30 = m[12], a31 = m[13], a32 = m[14], a33 = m[15]

  // DIVISION BY ZERO HERE:
  var lw = 1 / (x * a03 + y * a13 + z * a23 + a33)

  out[0] = (x * a00 + y * a10 + z * a20 + a30) * lw
  out[1] = (x * a01 + y * a11 + z * a21 + a31) * lw
  out[2] = (x * a02 + y * a12 + z * a22 + a32) * lw
  return out
}

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:
Upon import, isosphere is missing To build my tank for a Unity game, I am using Blender. Currently, I am making a turret consisting of an isosphere with half of the faces removed (I needed the bottom to be "flat") with some minor visual edits, two cylinders (one is the hatch, the other the antenna), and a cube to act as a hinge:

The inside is hollow. When I imported it to Unity (drag and drop from File Explorer straight to Unity Assets folder), the entire isosphere was missing as you can see from the preview:

I have tried to correct the normals with CTRL-N as mentioned in other Blender forum pages but it still doesn't work. How exactly do I make my isosphere appear in Unity?

NOTE: This works if imported as a .fbx file but I would much prefer the file to be a .blend file instead (which is default).

sentences:
How can I compute which chunk a coordinate is in? I am working on a video game. Everything (terrain, entities, particles) is stored in 100 by 100 chunks. Here is the array structure for the chunks:

public static final int chunkSize = 100;
public static Chunk [][][] chunks;

The world is 20,000 by 20,000.

Given a random coordinate (such as (-1244, 1353)), how can I quickly and efficiently determine what chunk the coordinate is in?

Once I know what chunk a coordinate is in, I can determine which chunks to load around a player.

sentences:
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:
Simple cartoon water shader shoreline I'm currently attempting to create a cartoon-ish water shader with a shoreline. After looking around trying to find out how other games do it i figured out it has something to do with getting the distance from the depth map (which doesn't include the water when it's render queue is set to transparent) and the and the world position of the current pixel.

From certain angles i'm actually getting very close to the desired result as show here:

The topmost island almost has the desired result, but as you can tell, the closer it gets to the camera, the more out of place the effect becomes.

here's a zoomed out top down view illustrating the problem

as per request, here's what the terrain looks like beneath the water surface (animated gif)

and of course, here is my shader code:

Shader "Custom/CartoonWater" {
 Properties {
     _Color ("Color", Color) = (1,1,1,1)
     _Glossiness("Smoothness", Range(0,1)) = 0.5
     _ShoreFade("Shoreline Distance", Float) = 1
 }
 SubShader {
         Tags{ "Queue" = "Transparent" "RenderType" = "Transparent" }
     LOD 200

     CGPROGRAM
     // Physically based Standard lighting model, and enable shadows on all light types
     #pragma surface surf StandardSpecular

     // Use shader model 3.0 target, to get nicer looking lighting
     #pragma target 3.0

     sampler2D _CameraDepthTexture;

     struct Input {
         float3 worldPos;
         float4 screenPos;
     };

     half _Glossiness;
     fixed4 _Color;
     float _ShoreFade;

     void surf (Input IN, inout SurfaceOutputStandardSpecular o) {

         o.Albedo = _Color.rgb;
         o.Smoothness = _Glossiness;

         fixed4 depth = tex2Dproj(_CameraDepthTexture, UNITY_PROJ_COORD(IN.screenPos));

         o.Albedo = _Color;
         if (distance(LinearEyeDepth(depth), distance(_WorldSpaceCameraPos, IN.worldPos)) < _ShoreFade) {
             o.Albedo = fixed4(1, 1, 1, 1);
         }

     }
     ENDCG
 }
 FallBack "Diffuse"
 }

any help is greatly appreciated :) thanks in advance.

sentences:
A number of teams playing against each other: what is a fitting game term? Basically I am looking for the right expression for a specific set (usually 2-6) of teams (a team is a group of individuals controlled by one player) in a tounament-like game. The team-set is a subset of a larger number of existing teams e.g.: there exist 10 teams t1, ..., t10. Team-Set 1 is {t1, t3, t7}, team-Set 2 is {t1, t5, t8, t10} and so on. What would be a good expression for "team-set" in a somewhat-military (fun-based combat) game context?

The teams of the set fight against each other, and not together (alongside each other). So I am looking for a somewhat confrontative term.

sentences:
ColorMaterial:AmbientAndDiffuse equivalent for CG\HLSL I have this shader written on shaderlab, which replaces Ambient and Diffuse values of the material, because I need to tweak vertices colors from the script.

Shader "VertexSimple"
{
    Properties
    {
        _MainTex ("Base (RGB)", 2D) = "white" {}
    }

    SubShader
    {
        Pass
        {
            ColorMaterial AmbientAndDiffuse
            Lighting Off

            SetTexture [_MainTex]
            {
                Combine texture * primary
            }
        }
    }
    Fallback "VertexLit"
}

I need to write an equivalent of this shader on CG\HLSL to do some other routines in it. Ideally it should be vertex\pixel shaders, not surface one. How can I do this?

sentences:
'Destroyed Actors' and 'Save Games' Background

Our team is creating an adventure platformer, and I have been tasked with creating a Save Game system.

Our game features the usual progression systems, and is relatively linear.

Approach

I have began my approach by using the EMS Easy Multi-Save plugin for Unreal.

Problem

We have a 'Switch' system:

Player takes cube to switch.
cube gets used by switch
switch can now be activated.

In stage 2, where the cube is used by the switch - the actor for the cube is destroyed in Unreal, and the switch's model is changed to one with a switch.

The EMS plugin does not provide plug-and-play functionality for keeping track of destroyed actors, which means I must do this myself.

Example problem scenario

Player approaches area with switch and cube.
Player saves game (cube present and switch deactivated)
Player picks up cube and takes to switch (cube destroyed and switch activated)
Player loads prior save game
Scene reloads with switch in the correct state, however the cube is no longer present (it has been destroyed by Unreal and is no longer tracked by EMS)

Problem solving approach

Reading around, I have been given the idea of creating my own class that keeps track of destroyed actors when they are destroyed.

This class can be saved by EMS, and then can reload these destroyed actors if needed when a game is loaded.

Question

There is a lack of real advice for the task at hand here, so I wanted to come here and ask for people's advice and opinions on the best approach to making Destroyed Actors within Unreal compatible with Save Games.

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:
How can I have parent-child transform in a component system? Before when using inheritance, I could draw all my objects using this recursive function:

void Object::innerDraw(sf::RenderTarget& target, sf::RenderStates states)
{
    states.transform *= Object::getTransform(); //translate by this object's position
    this->Draw(target, states); //draw this object
    for (Object *child : m_children)
    {
        if(child->isVisible)
            child->innerDraw(target, states); //draw all children
    }
}

However, I am now looking at a component design where the graphics component pushes it's sprite to the renderer   Renderer::toDraw.push_back(&sprite);

The renderer then draws all the sprites in it's container

for (sf::Drawable *Entity : toDraw)
{
    target.draw(*Entity, state); // (state isn't doing any transforming here)
}

How can I be able to draw things relative to parents position?

sentences:
Detecting internet Connection on Unity connection to serve ads How can you detect someone's Internet connection in Unity? I see a lot of forums where people make a request to any site (mostly google.com) to check it, but it does not seem to be an elegant solution.

With 3G/4G connections to serve Unity ads or admob interstitial, it takes a lot of time and crashes the game.

Regards!

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:
finding the angle of rotation of a 3d line I have a line segment joining two 3D points AB, and a vector V which is normal to it.
I need to know the angle of AB in the plane described with V as the plane normal, that is: in the plane of the two vectors (AB) and (AB cross-product V)
EDIT: Much more information...

The points A and B (red dots) have x,y coordinates in the camera image, and an extrapolated depth (z) from the camera itself.  The vector V (white line) is calculated from two more points with the same process.
I have successfully matched rotation around the Z axis (camera view direction) so a (Unity) 3D object will track the wrist angle as it 'waves' (rotation in that single plane).  Now I want to also include twisting motion defined as rotation around the wrist bone (blue ellipse attempting to represent rotation in a plane) like tipping a cup.
This image is from a fixed webcam, but I would like the process to also work from a mobile phone (moving camera, with translation and rotation potentially) and one of my assumptions has been that if everything is camera relative via the screen projection, this will be automatically included.
By using a 'dumb as bricks' approach I have it working when the arm is horizontal... I can't work out how to make it work at other angles e.g. vertical:
            Vector3 AB = (B - A);
            return -Mathf.Atan2(AB.z, AB.y) * Mathf.Rad2Deg;

UPDATE3:
This question now seems to have two parts:

what can I use as a fixed reference direction when the plane can be orientated in any direction?
how do I get an angle between that fixed reference and the line in that plane?

In searching I've come across both Rogrigues' Rotation Formula and this answer about rotating planes, but I haven't been able to work out how to apply either of them to this particular problem (I do feel like I'm missing a really obvious trick!)
Edit: My first idea is to rotate A and B so that V is aligned with the cartesian X axis and (ABxV) is aligned with Y, then use atan2(dy, dz).  I have just started to look for a working solution to performing that rotation.
Edit2: It's been pointed out referring to a cartesian X axis is ambiguous... I'm not sure but I think camera axis (horizontal/vertical in the image plane plus depth) might serve?

An alternative description of the geometry is that I have a cylinder with its long axis aligned with V, and the points A,B are opposite sides of the end-cap circumference... and I need to know the rotation of the cylinder around its long axis described by AB (relative to any arbitrary consistent 0 angle).
UPDATE: In case it breaks assumptions, my values are all measurements from a live camera, so the 'normal' vector V may not be exactly normal to AB... it should always be pretty close though (within a few degrees).

sentences:
Should scripts interact with an abstraction of the engine? I'm using Java and Jython, and after some research I discovered giving scripts direct access to the engine interface could be a mistake, as it would tightly couple the two.

It looks like most scripting that allows mods to create and manage entities does so through some sort of abstraction. Are these abstractions there for this reason, or is it just to provide a more intuitive way for non-programmers to mod the game?

sentences:
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:
Prevent movement cheating in MP games I have read a lot about movement in multiplayer games, but not so much on preventing cheating.

Let's say a client sends moves packets whenever the player press a movement button, then the server checks if that move is valid (that is, if the player is not colliding with anything).

At the same time, there must be some speed check, like dropping packets if the client is sending too many in a short period of time. But the server has no guarantees whether the packets received were sent at the same time or just received at the same time. Client could include a timestamp, but there are 0 guarantees it was crafted by a malicious client.

In short, how can i validate movement speed?

sentences:
Do I need more than one UDP socket on the server? I'm trying to make a UDP game server using the SDL_net library. This library offers SocketSets which are, according to the documentation, an analogy to the select function. Right now I have successfuly made a simple server which has just one UDPsocket and dumps every message to stdout.

Can I use those SocketSets somehow to make the server responsive, or am I just fine using only one UDPsocket for everything?

sentences:
Static SFML 2.2 libraries and Code::Blocks on windows 7 I am starting to program games for the first time, but I've been doing general programming for a couple years now. I have Code::Blocks, which I am fairly comfortable with, but now I am struggling with trying to add a game library to my projects.

I decided on SFML 2.2 because it has all of the features I need. I am also planning on writing this in C++ if that affects anything. I read the instructions that SFML has on their site, but I still can't seem to get it to work. I am also under the impression that having the static version of SFML implemented will make the end result program be all one executable file rather than a file that accesses other files. If that is not what this means, please correct me.

I messed with the directories settings like their site mentioned, as well as the linker settings and the compiler settings. I keep getting errors that say something along the lines of...

"Undefined reference to 'sf:VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)"

...along with many other undefined functions. Any help on implementing game libraries in general would be very helpful as well.

For reference, the tutorial I attempted to follow is at http://www.sfml-dev.org/tutorials/2.2/start-cb.php

sentences:
Keyframing or programmatically changing attachment transparency in Spine I've just recently been getting to grips with Spine and Unity 2D, porting some
of my assets from different sources (SWFs, SVGs, GIFs, Canvas animations).
Whilst I'm able to reproduce a lot of what I can do in these other systems
— very nicely I might add — one thing that seems to be alluding me
is how to animate an attachment.

Obviously Spine is still developing, so I don't expect to be able to run
full bitmap/vector animations as attachments; but one thing the software does
seem to have already is the ability to set transparency, and to set multiple
attachments to one slot. I was hoping someone out there would know if these
abilities can be combined to at least achieve a faded switch between attachments
— either using the GUI or via coding.

For example, this video shows my
character animated with the two states I wish to switch between.

I'm aware that you can key frame a switch between attachments, but this leads to
a sudden jump in what graphic is shown. I could theoretically create
8 extra attachments on each slot and set their opacity graduating from 0.1 to
0.8 — but this seems like a rather hack way of doing things, and would
also be awkward to shift along the timeline.

My fallback would be to animate the two full states of the character, export them, and leave Unity to handle switching from one to the other.

Any ideas?

sentences: How can I implement a dialogue where the words appear as if they were being typed? I'm planning on putting a dialogue system into my game, I don't really work with surface so my way of implementing SDL_Ttf is by turning it into a texture, in other words, every paragraph would be shown within the rect, is there a way to make the words appear as if they were being typed?

sentences:
Aron Granbergs Unity Pathfinding AI goes back and forth The agent goes back and forth after calculating the path with seeker.StartPath (transform.position,target.transform.position, OnPathComplete);. The gizmo shows the correct path. Please watch this short video to get an impression on what happens.
It starts after adding about 100 obstacles during runtime. Is this a known bug or am I doing something wrong? My test case is really simple. I can provide the project if necessary.

Link to the Video:
http://screencast.com/t/2ww04975l

sentences:
Shadows in html5 canvas game I'd like to ask for reference. I met an article about how to cast shadows in games. I'm using html5 canvas (currently without webgl) with javascript for my projects.

The article mentioned above is located at http://willyg302.wordpress.com/2012/11/04/2d-visibility/.

I was thinking if this method is possible to employ with canvas (without webgl) and javascript?

More precisely, I have few shapes drawn on canvas some of them are complex made by arc and similar methods. Thus I don't have a simpel way how to describe one shape with an equation where I can store only a few parametrs (i.e. circle is described as centerX, centerY, radius with these I can easily draw it but with more complex shapes I don't have such information) therefore I thought about storing the whole canvas data by pixels with context.getImageData.data, then using method described in the article (polar transformation, ..., back to cartesian system) and putting the whole scene into canvas with canvas.putImageData method.

But before actually applying this I'd like to ask if it's even possible with canvas (no webgl) and javascript to create shadows dynamically (light source moving across the screen) this way without heavy fps loss (I can imagine this method works pretty good for still objects but the moment when I need to do it each time a light source moves I'm not sure if javascript + canvas can handle this in reasonable time, especially when I found information that putImageData and getImageData are quite slow)?

Or if anyone has tried to create dynamic shadows in different way in html5+js I'd appreciate your suggestions about these as well (I do it currently in similar way as is described in http://ncase.me/sight-and-light/, though I'm experiencing some troubles with concave shapes :( ).

This is getting awfully long, I hope I explained myself well enough.

Thank you very much for any advice you can share and I'm sorry that my post grew so large, although I'm asking just one question.

EDIT: Forgot to mention, I'm looking only for 2d solution.

sentences:
Which is better for a beginner, UDK or Unity? I am just getting into game development and I would like to know which engine would be best to learn first.

In terms of my current skills, I know a good deal of javascript, but not much beyond that. This is all a learning experience for me (I am an extremely fast learner).

I am using HTML5 canvas right now as that's mostly what I was hinting at when i said javascript. I probably should have made it a bit more clear.

sentences:
Blueprint formula doesn't match material formula I'm currently working on a physical water system for Unreal. To represent the water surface, I have a simple flat grid mesh that I then apply a material to which has a formula for world position offset.

The formula currently is pretty simple, I just have a simple sine wave powered by world X position and elapsed time, however despite both formulas being, as far as I can tell, the same, they give different outputs.

As you can see below, both formulas perform the same operations, and both are powered by the same input, world position and Game Time in Seconds. In theory,  the material (second-last image) should be dividing X position by 2000 and multiplying time by 0.1, just as those values are in the material, however instead the closest I could get to having both values line up is 314* and 0.625.

It's important that these values line up, as the blueprint version is meant to be used for buoyant objects to make sure they stay on the surface of the water, and probably other calculations as I progress.

Does anyone know why these formulas don't line up like they should? Does math work differently in the material editor? Does Absolute World Position give values in a different scale compared to Actor Position?

*I thought this might be 100 * PI, but that doesn't seem to line up exactly either so may be a coincidence.

The final result here is piped directly into World Position Offset.

Time parameter is updated every frame to match the blueprint version.

Blueprint function that I need to match the material formula for accurate buoyancy and such.

Included for completeness, an example of how the water height function is used.

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:
Convert Autocad DWG to OBJ, FBX or similar I know this is only partially game development related, but couldnt find another place to ask.

How can i convert an autocad dwg or dxf file to a more 'common' format like OBJ, FBX, 3DS, etc. ?

i tried directly using autocad LT but the export options dont have any other format.s

free and oss solutions preferred.

sentences: iOS gaming with copyrighted characters? Can I use animate characters in an iOS game if I do a citation in the credits. Ex Steven univers in a fighting game and I list Rebecca Sugar in the Credits or by the character bio.

sentences:
How does Minecraft update process work? When you initially launch Minecraft you open the "launcher", which will check if your client is up to date. If it's not it proceeds to download the latest files & then runs the game.

How does this happen? Is the launcher a separate application, which can execute the main jar file?

sentences:
How to detect and prevent the resolution of fake collisions? I'm creating my own physics engine and I came across a small inconvenience. Here how it goes: when a body tries to push into something it really can't push, it gets pushed back (which is completly fine). But when it tries to push that solid plus another simple box, the box gets pushed as if the body has really moved even if it can't.

Here's a visual explanation:

My current collision resolver is solving collisions by altering position of bodies. Here is its pseudo code simplified for the question.

/**
 * Resolves the collision by pushing a body or another
 *
 */
void resolve(Collision collision) {
    float weightA = getWeight(collision.world, collision.bodyA, -collision.normal);
    float weightB = getWeight(collision.world, collision.bodyB, collision.normal);

    //This resolves who gets to push who in a collision
    DynamicBody toPush = weightA > weightB ? collision.bodyB : collision.bodyA

    Vector normal = toPush == collision.bodyA ? -collision.normal : collision.normal;

    float replaceX = normal.x * pene;
    float replaceY = normal.y * pene;

    if(replaceX != 0f) {
        //getCollisionShifting() is the total shifting done by collisions in this frame.
        //When this resolver will be done, it will be added to the position

        float dirX = signum(toPush.getCollisionShifting().x);

        if(!original || dirX != signum(replaceX))
            toPush.getCollisionShifting().x += replaceX;
        else if(dirX == 0 || replaceX * dirX > toPush.getCollisionShifting().x * dirX)
            toPush.getCollisionShifting().x = replaceX;
    }

    /* Here, exactly the same thing is done with Y */
    //...
}

/**
 * This finds the weight of a body based on his own weight plus all the bodies its colliding with in a direction
 *
 * Uses a recursive method
 * This method might not be the best but it works and only becames inefficient for really big stacks of objects
 * Since my game won't include giant stacks, its viable for now
 */
float getWeight(World world, Body body, Vector normal) {
    float weight = body.getWeight();

    for(Collision collision : world.getCollisions()) {
        if(collision.bodyB == body)
            collision = Collision.swap(collision); //turns the collision around so bodyB becomes bodyA

        if(collision.bodyA == body && collision.normal.dot(normal) == 1f)
                weight += getWeight(world, collision.bodyB, normal);
    }

    return weight;
}

I included this code for you to have a better look at my current approach but I do not ask anyone to write the solution into that code. A theoric explanation of a working solution is what I'm looking for.

Currently, collisions aren't solved in any particular order. Will I have to sort the collisions ? I hope not since it would slow down the whole thing just for this. So, how can I fix this issue ?

P.S. : Please note that this physics engine is open source and you can access the original code of this example here.

sentences:
Power Distribution amongst connected nodes In my game the map is represented by connected nodes, each node has a number of connected nodes. The nodes represent a system in which players can build structures and move units about. If you're familiar with Sins of a Solar Empire the game map is very similar.

I want each node to be able to produce power and share it with all connected nodes.
For example if A, B, C & D are all connected and produce 100 power units, then each system
should have 400 power units available. If node B builds a structure that consumes 100 power units then A, B, C & D should then have 300 power units available.

I've been working on this system all day and haven't been able to get it working quite the way I want.

My current implementation is to first recurse through each nodes's connected node adding up the power, I keep a list of closed nodes so it doesn't loop, it's quite similar to A* actually.

Pseudo code:
All nodes start with the properties

node.power = 0
node.basePower = 100 // could be different for each node.
node.initialPower = node.basePower

-

function propagatePower( node, initialPower, closedNodes )
  node.power += initialPower
  add( closedNodes, node )
  connectedNodes = connected_nodes_except_from( closedNodes )
  foreach node in connectedNodes do
     propagatePower( node, initialPower, closedNodes )
  end
end

After this I iterate through all power consumers.

foreach consumer in consumers do
   node = consumer.parentNode
   if node.power >= consumer.powerConsumption then
     consumer.powerConsumed += consumer.powerConsumption
     node.producedPower -= consumer.powerConsumption
   end
end

Then I adjust the initial power for the next propagation cycle.

foreach node in nodes do
   node.initialPower = node.basePower - node.producedPower
   node.displayPower = node.power // for rendering the power.
   node.power = 0
end

This seemed to work at first but then I came into a problem.

Say two nodes A & B produce 100Pu each, it's shared so both A & B have 200Pu.
I then make two structures that consume 80Pu each on A (160Pu).
Then the nodes power is adjusted to basePower - producedPower (100-160 = -60).
Nodes are propagated, both nodes now have 40Pu (A: -60 + B: 100 = 40).
Which is correct because they started with 200Pu - 160Pu = 40Pu.
However now node.power >= consumer.powerConsumption is false.
Whats worse is it's false for any structure that uses more that 40Pu, so the whole system goes down.

I could deduct from consumer.powerConsumption but what do I do if power is reduced elsewhere? I don't have the correct data to perform the necessary checks.

It's late so I'm probably not thinking straight but I thought to ask on here to see if anyone has any other implementations, better or worse I'd be interested to know.

sentences:
In OpenGL, what is "zero state" rendering? Recently at a job interview, I mentioned that I taught myself modern OpenGL and rendering with vertex buffer objects because my university only taught the fixed function pipeline with immediate mode rendering at the time. The interviewer briefly interrupted me to say that VBOs have effectively been replaced by something called "zero state rendering" and then let me continue.

I forgot to ask later on about what that meant, because we quickly moved onto different subjects and the interviewer had run out of time at the end due to a busy schedule.

Later, I searched online for "OpenGL zero state" and "zero state rendering" with no results that seemed relevant, mostly just things about the OpenGL state.

The organization in question is very heavily research based, so is there a chance that it is an extension with currently little support, or that the terminology used varies due to it's cutting edge nature?

sentences:
Update single variable in DirectX Shader I am trying to update a single variable within a CBuffer but I am unsure of how to do this.

I have a LightingBuffer which is passed to the GPU containing, ambient color, diffuse color etc and I want to be able to update the specularPower component of this CBuffer but not the rest.

In openGL I could just do glUniform1f and update it, however I cannot do this is DX / HLSL

How would I go about doing this?

sentences: How can I record gameplay footage as a video within Unity? I am building a traffic simulator in Unity. I need to record my game as a video, so that I can use the video for machine learning purposes. I used fraps for the same but didn't find it worked for me since it's not within Unity. How can I make a video recording of the gameplay?

sentences:
Unity, WaitUntil in a self-made message box class I managed to make a simple message box prefab with a Text and a Button through Canvas, and then instantiate it through the constructor.

public class MessageBox
{
    public MessageBox(string msg)
    {
        GameObject obj = (GameObject)MonoBehaviour.Instantiate(Resources.Load(@"MsgBox"));

        obj.GetComponentInChildren<Text>().text = msg;
    }
}

So when another script needed it, simply do

MessageBox mb = new MessageBox("This is a test message!");

This all worked fine, but then I wish to change it to like normal MessageBox where the code was suspended, but not locked, until the user click the OK or Cancel button.

I managed to do it by calling a coroutine in the calling script.

void Start()
{
    StartCoroutine("Do");
}

IEnumerator Do()
{
    MessageBox mb = new MessageBox("This is also a test message!");

    yield return new WaitUntil(() => GlobalVariables.MsgBoxClicked == true);
    //GlobalVariables is a separate class containing some static variables.
    Debug.Log("Done!");
}

(You have to set the MsgBoxClicked to false when the prefab is created and set it to true when the button is clicked, of course.)

But that means every time I needed to use the message box, I need to call a coroutine!

And that's super inefficient no matter how you looked at it!

So I tried to move the coroutine into the MessageBox class itself.

But now here comes the problem!

The MessageBox does NOT inherit from MonoBehaviour!

And you can't call a coroutine without it!

I had tried to make the MessageBox inherited from MonoBehaviour, but the Unity warned me This is not allowed every time I tried to new it! Even though the game ran smoothly.

I even tried to new the MonoBehaviour itself and call its StartCouroutine, but of course, the same warning popped up! And this time the game won't even run!

I also tried to use the old AutoResetEvent, but it locked the whole thing and crashed my game!

So, could somebody be so kind and teach me how to get around it!?

Much appreciated!

sentences:
Spherical map representation My latest game will take place on a small planetoid. I am looking for good data structure for representing cells on the surface of a sphere.
Triangles, squares, pentagons, hexagons? Which one minimises stretch the most and creates the best tiling?

Spherical mapping is the easiest but the stretch at the poles is unacceptable. Cubemapping is also fairly easy but there would still be considerable stretch near the cube corners.
Subdividing an icosahedron seems the best in terms of stretch but there is the problem of indexing many triangular arrays and finding neighbouring cells at the boundaries would be difficult.

I guess I could use a single linear array of points representing N-gons, each with an array of N neighbour indices, but that seems like a huge waste of space.

The game has RTS elements so I will be storing things like influence maps and performing A* pathfinding and convolution, so the representation has to be efficient.

sentences:
Resize sprite to match camera width? I'm trying to resize my small background sprite to match the screen width of the user's device.

This is what I'm trying

// Use this for initialization
void Start () {
    // Set filterMode
    SpriteRenderer sr = (SpriteRenderer) GetComponent("Renderer");
    sr.sprite.texture.filterMode = FilterMode.Point;

    // Get scaling
    float multiplier = Camera.main.rect.width / sr.sprite.bounds.size.x;

    // Scale
    transform.localScale = localScale * multiplier;
}

It seems there is a problem with the measure I get from the Camera width, I also tried Screen.width but it seems it returns the value in pixels.

sentences:
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:
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:
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:
Where can I share my game? I am looking for places on the web to share my game.

I'm relatively new to game development. Not looking to 'promote' my game or sell it. Just want to share it in places where there is a possibility people will download and play it.

Are there any sites that are meant to share indie games? And in general any site where I can post a download to my game will be great.

Thanks

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:
Movement on a curved planet surface I'm looking for a solution for moving a variety of objects over the uneven surface of my planet. The idea is that I will have a number of objects that follow the planetary landscape moving about in random directions.

The planet surface is made up of 6 sphere projected planes, all have been displacement mapped to create a "bumpy" surface. A grid based movement system would be ideal as it lends itself to a lot of pathfinding solutions. I am also using Unity, so leveraging the Physics engine is an option, but past experience hasn't yielded very good results.

I'm having trouble understanding the best approach for realistic movement, would it be a matter of calculating gravity and then translating the object along its forward, right etc. Or on the other hand would It be more a case of pre-calculating the path from A to B and applying that movement.

I've looked all over for some ideas on this subject but have found nothing. A few suggestions would be greatly appreciated.

Thanks.

sentences:
Puzzle design in Adventure games Creating interesting, original, logical, thoughtful puzzles is an art.

What techniques and methods do you use to create good puzzles?

Do you write storyline before designing puzzles or combine these 2 processes?

sentences:
Ball's velocity vector, reflect against a point I need to calculate the new velocity vector when the ball collides with one of the paddle's corners.
Let d be the velocity vector of the ball,
r the target velocity vector
and n the surface normal used for reflecting the velocity vector.
I found that the formula to calculate the reflection vector is:
r=d−2(d⋅n)n
My first thought was to create a vector using the coordinates of the paddle's corner and the ball's center, normalize it and use it as my surface normal n.
That way I have both d and n that I need to calculate the reflection vector.

But, after some more research I've come across the following article:
Pool Hall Lessons: Fast, Accurate Collision Detection Between Circles or Spheres
which may be better since ball - ball collision is the same as  the ball - point collision that I need.
The collisions are all elastic and forces like gravity and friction don't exist.
Is my approach wrong?
If I end up doing this in any of the aforementioned ways, what are the advantages and disadvantages of each one of them?
EDIT: I forgot to mention that the post i linked doesn't contain any collision resolutions, but only collision detections, but it is what made me to think that searching for ball - ball collision resolutions is a better approach.

sentences:
How to execute a code from many scripts I want to execute a function from many scripts attached on gameobjects  which will be spawned. Since game objects are spawned, I can't assign the script in the inspector. What i want is that, there are three gameobjects, A,B,C. C is already in the scene. A and B are spawned with different scripts,the spawned gameobject's script should call the function on the gameobject C. I can make a delegate but there are different scripts that want to call the function. So should i have to create different delegates for each script on A and B and then assign them onto the gameobject C so that A and B can call their delegates and these delegates will trigger the function on C or there is something like a event that i can call from B. If it was possible, i can create a event on A and assign it on C. Now A can call the delegate and B can also call that event and trigger the function on C, but this is not possible as event can't be called from another script.
I need something like a function that i can call from any script and it calls the function from C.
Note that function should not be static.
As i can call a static function from any script but it can call only static methods, which i don't want.

sentences:
Player being covered by glClearColor? Here is a video of the problem: https://www.youtube.com/watch?v=6vnDOB1Vk4o (this is the game I've been making for fun/practice).

You notice, in the beginning of the video, I walk off the map and into the black. When I do so the black covers the player.

I draw the player last in my code:

 // Draw the player & the world
public void draw(Graphics g, Graphics graphics, GameStateManager gsm) {
    glClearColor(0, 0, 0, 0);
    System.out.println(player.getPlayerX() + " - " + player.getPlayerY());
    glViewport(-(int)player.getPlayerX() + 350, -(int)player.getPlayerY() + 300, Display.getWidth(), Display.getHeight());
    worldGen.worldGenerator();
    // Draw the player to the screen (60, 60)
    player.draw();

}

sentences:
How can I render all objects behind a plane with a specific transparency value? I have a game where there a multiple floor levels between the player switches. The floor is not present everywhere, so you can look through it. When 'working' (playing, building stuff, etc.) on a specific floor I want to add a transparency value to everything that is NOT on the current floor.
Ho can I accomplish that, and what is the best/most efficient way to do that?

sentences:
Implementing Circular Sprite Masks So I've been scouring the interwebs for a couple of days with regards to how to implement sprite masking in XNA 4 and C#. Coming from a pet project I did in Flash, this was pretty easy as masks are part of the AS3 library, so implementing one was as simple as giving it a shape, size, and moving the X and Y co-ordinates of the mask to follow my character sprite.

Now I'm looking to do something similar in XNA. Think the Flash move in Pokemon lighting up caves, or, a better contextual example, the torch light effect in Terraria (alas, I can't find suitable pictures, but hopefully the gist is there).

So, essentially, I want to surround my sprite character with a circle - anything within that circle on the map is visible, and everything outside the circle is black.

The ways I've seen people similarly implement masks is via the StencilBuffer, Pixel Shading and via sprite overlay (You have a sprite of your "viewable area", you draw that on top of your player sprite and fill the rest of the viewport with black). Considering the latter two don't really have many directly applicable example projects that I can learn from on the internet (The one applicable StencilBuffer example I found is for WP7 dev, and no Pixel Shader stuff directly solves my problem), I've been leaning more towards the third idea of having a "viewpoint restriction" sprite that you place on top of the character sprite, then fill the rest of the map with black.

Is it possible to do this? And if so, could someone please help and link me to something relevant/give me some sample code/pseudo-code to work from. Again, I don't know if even this is the most effective way or if it's just easier to implement a proper mask with a Pixel Shader or StencilBuffer, but I have no idea how to go about that.

What do you guys think the best solution here would be?

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:
How can we test a section of a game? I'm making a clone of an old atari 2600 game, so it's simple, only slightly more complex than the original.

I'm realizing that even the simplest of games have different "parts", what is a good design method to be able to test those sections without having to "play through" to that part?

Specifically, (it's a "breakout" clone) if I'm modifying and testing code that runs when the game is beaten, I don't want to have to play through the whole game just to see if my code works. I can only imagine how complicated this kind of testing is for a game of substantial size.

How do real devs make their game such that they can test just a certain section, or test a section under certain possible in-game circumstances without having to play through to that part?

sentences:
How to publish a Unity desktop game without a security warning? When I build a Unity game as a Windows Desktop application, zip the folder, and upload the zip to itch.io, then anyone downloading the zip from itch.io and running the game gets a security warning from Windows.
Is there a way to build the game in a way that will not show this warning?

sentences:
How can I efficiently render a very large model? I have a huge model I want to draw in my XNA application; due to its size I am experiencing a tremendous loss of performance.

The model has about 50,000,000 edges and has a size on disk of 205 MB in the .x format. Yes, the model has to be this big.

Is there a way to transfer the model directly to my GPU in order to let the GPU do the drawing like when transferring a VertexBuffer? When I try to fill a vertex buffer with the object I am getting an OutOfMemoryException.

sentences:
Approach to AI in Entity Systems We are making game using Entity Systems. And we with my colleague have different opinions about what approach is better when doing AI.

Basically, he thinks that everything should be a system, where I'm not.

That is his way:

Systems:
 - Sensor System (look for a target)
 - Pathfinding System (find a path to a target which will be colliding between agents with high probability)
 - Attack System (attack target if in attack range)
 - Movement System (advance path to target, resolve colliding if can't advance)

There is my proposal:

Systems:
 - Attack System (find a target with hp > 0, write to Target component and attack if in range)
 - Movement System (find a path to target (if there isnt already) and advance)

Utility classes:
 - Sensor
 - Pathfinding

There is problem with first approach. For example, 10 units all choosed one target and attacked it (simly because it was closer). But in reality 3 units are sufficient to kill that target in an instant. So, why other 7 should attack this target too? When they choosed their target they doesn't known yet that 3 unit would suffice. They know now that target hp <= 0 but they can't choose another, because Sensor System finished his work already. If we want to fix it then problem will be in unreasonable complexity of Sensor system.
Where in latter approach we simply wouldn't select target if hp already <= 0.

Similarly, in first approach pathfinding will find paths which are colliding between them. When one unit taken grid cell another can't take it. That means he must forget his path. But he can't build a new, because Pathfinding system already finished his work. So, he advances one cell in direction of target. In latter approach, we will build path in respect to new positions of units.

Maybe there are another problems in both approaches which we couldn't foresee. So, please say something if you know.

Which way are better (both clear code and good AI)? Maybe both are wrong then please advice what is right way to make it.

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:
Unity: Unable to take screenshots in server build I am trying to take snapshots in the server build of my Unity application.
But the output image is all grey. From this post, I read that in headless mode, calling camera.Render() is necessary for rendering. I changed my screenshot logic accordingly.
Here is my script
private IEnumerator TakeSnapshot()
{
    yield return new WaitForEndOfFrame();

    var tempTexture = RenderTexture.GetTemporary(Screen.width, Screen.height);
    camOV.targetTexture = tempTexture;
    camOV.Render();

    var tex = new Texture2D(tempTexture.width, tempTexture.height, TextureFormat.RGB24, false);

    // Read screen contents into the texture
    tex.ReadPixels(new Rect(0, 0, tempTexture.width, tempTexture.height), 0, 0);
    tex.Apply();
    RenderTexture.active = tempTexture;

    // Encode texture into PNG
    var bytes = tex.EncodeToPNG();
    snapshotBase64 = Convert.ToBase64String(bytes);
    // File.WriteAllBytes("/Users/varun/Desktop/" + Time.time + ".png", bytes);
    Destroy(tex);
}

I initalize the camera in the Start() method
    camOV = Camera.main;

This works fine inside the editor but once I create a server build for Mac and try to run it I get this error.
ReadPixels was called to read pixels from system frame buffer, while not inside drawing frame.
 #0 ???
 #1 operator delete[](void*, std::nothrow_t const&)
 #2 operator delete[](void*, std::nothrow_t const&)
 #3 operator delete[](void*, std::nothrow_t const&)
 #4 operator delete[](void*, std::nothrow_t const&)
 #5  (Mono JIT Code) (wrapper managed-to-native) UnityEngine.Texture2D:ReadPixelsImpl_Injected (UnityEngine.Texture2D,UnityEngine.Rect&,int,int,bool)

Can someone give any suggestions? Thanks!

sentences:
general routine of creating real video games? i'm new to game developement and i want to fill the missing spots in the proccess of creating games for PC. my intentions are for first person action games like "return to castle wolfenstein", "hitman" or "call of duty" series. i've done some interior designs in autodesk 3ds max and also wrote web/windows programs in c#. so now i like to know how games works. here is what i came up with:

first: create models and export them in whatever format your rendering engine prefers. so any object has to be modeled seperatly no mater what kind of object it is.

second: tell the engine where and when to render which object.

Q1) what about object behaviors?do you use the 3d software built in scripting like maxscript? or is there some other way to create behaviors in advanced levels?

Q2) how do you create clipping for objects? since by default graphical shapes don't have such a feauture.

Q3) most of those games played in a virtual world. so do you have to create the world at once? or is it actually seperate pieces that will be assembled by rendering engine?

i know these are very deep questions that can't be simply answered in a few lines. so if there is any book that is not too detailed and not too general, i'll be really appreciate knowing about it. in any case i really appreciate your answers.

sentences:
Libgdx - Collision position - Box2D I'm currently developing my own game but I'm facing a little problem. I am trying to figure out how to get the position of a fixture (collision) between two entities.

For example this:

(the grey rectangle is the player and the greens is an entity (not moving)).

With this code :

        Array<Contact> contacts = levelDatas.world.getContactList();
        try {
            for(Contact contact : contacts) {
                if(contact.getFixtureA().equals(playerBody.getFixtureList().get(0))) {
                    levelDatas.bodyIsWall(contact.getFixtureB().getBody());
                }
                if(contact.getFixtureB().equals(playerBody.getFixtureList().get(0))) {
                    levelDatas.bodyIsWall(contact.getFixtureA().getBody());
                }
            }
        } catch(GdxRuntimeException exp) {
        }

I get all the collision between a player and something else. But my problem is that I want to know where the collision is happening (on the left? on the right? bottom? top?). We can see that if there is a collision between 2 entities, a little point is draw. Anyone have a tip to give me the position of the collision?

Thanks

sentences:
How to set up borders in snake game I have a snake game set up in Java and I wanted to be able to toggle between the ability to go through the sides and pop out the opposite side and the classic version where you die when you hit the border. The problem is that my snake keeps going one spot after the border; how do I fix this?

This is one of the parts of my code, that acts when the right arrow key is pressed:

if(right) {
    for(int i = lengthofsnake - 1; i >= 0; i--) {
        snakeylength[i+1] = snakeylength[i];
    }

    for(int i = lengthofsnake; i >= 0; i--) {
        if(i == 0) {
            snakexlength[i] = snakexlength[i] + 25;
        }
        else {
            snakexlength[i] = snakexlength[i-1];
        }

        if(!borderGameplay) {
            if(snakexlength[i] > 850) {
                snakexlength[i] = 25;
            }
        }
        else {
            if(snakexlength[i] > 850) {
                borderDead = true;
            }
        }
    }

    repaint();
}

borderGameplay is the variable that you can toggle to have borders on and off, and borderDead is used in this if statement:

if(borderDead) {
    if(score > highScore) {
        highScore = score;
    }
    playing = false;
    dead();
    deadGraphic(g);
}

This is my deadGraphic(g):
    public void deadGraphic(Graphics g) {
        g.setColor(Color.WHITE);
        g.setFont(new Font("arial", Font.BOLD, 50));
        g.drawString("Game Over", 300, 300);
        g.setFont(new Font("arial", Font.BOLD, 20));
        g.drawString("Press \"Space\" To Restart And \"Enter\" To Toggle Borders", 160, 340);

    if(borderGameplay) {
        g.drawString("Borders ON", 370, 380);
    }
    else {
        g.drawString("Borders OFF", 365, 380);
    }
 }

This is my dead():

public void dead() {
    right = false;
    left = false;
    up = false;
    down = false;
    dead = true;
    score = 0;
    moves = 0;
}

And finally, my 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);

If you need to see other parts of my code, please tell me; this question is already really long, and my total code is 550 lines.

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:
Unity 4.6: sprite image automatically splits to single sprites when clicking I'm viewing Unity tutorial. As in this tutorial, I see when author clicks to sprite image, they will automatically divide to each frame as below:

But in my Unity, I just can view this:

So. My question is: How can my sprite image automatically divides to each sprite.

Thanks :)

sentences: how to detect if an object is hit by a certain raycast in it's own code I have been working on a sandbox game in Unity, and I am wanting to use a raycast on the cursor, but I am needing for the blocks themmselves to detect whether the cursor's raycast is hitting. I am needing the code in javaScript. Thanks in advance!!!

sentences:
In unity, some part of mesh doesn't show only in play mode This is screenshot of not playing mode. You can see the the speedloader and bullets inside of the revolver.

And this is when playing mode.

As you can see, I can see the speedloader and bullets in scene view, but not player's camera. Sometimes, it disappears in scene view either!

I made this model same as other weapons, but others are working fine. Only this weapon causes this problem. All weapons that I made are based on same model and rigs, and I kept the weapon's scale fit as same as possible.

I tried move the camera and scale down a little bit, but still couldn't saw.

Why this is happening? How do I solve this? Any advice will very appreciate it.

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:
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:
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:
Why is my inherited class's transform always null? I have a class inherited to another class, and I can't get the transform on the inherited class.

Here's what i have and trying to do

Class A:Monobehavior{}

Class B:A{}

//somewhere else

A object = new B();

but right now, whenever I try to get the transform of object, either from a function in B or out here via object.transform, it will always return null.

How do I fix this?

sentences:
How do you triangulate an arbitrary polygon? I need to triangulate a polygon for rendering in OpenGL ES on Android (no GLU triangulation available).

Is there an already known algorithm for polygon triangulation?  The polygon can be convex or concave (with no holes).

sentences:
Convert .s file to .midi or any sound file I have a .s file from a game, I think it contains Music . I know this sounds weird but here are snippets :

(I opened it with Visual Studio and it sais it is a 'Assembler Source')

.equ    My_File_grp, voicegroup000
    .equ    My_File_pri, 0
    .equ    My_File_rev, 0
    .equ    My_File_mvl, 100
    .equ    My_File_key, 0
    .equ    My_File_tbs, 1
    .equ    My_File_exg, 0
    .equ    My_File_cmp, 1

The rest is only stuff like this:

@ 001   ----------------------------------------
    .byte       VOICE , 52
    .byte       N36   , An3
    .byte   W36
    .byte       VOICE , 58
    .byte       N48   , An3
    .byte   W48
    .byte       VOICE , 54
    .byte       N12   , Fs3
    .byte   W12

I need to listen to this but I really don't understand what these lines of code mean, please help! I want to convert this file to a file I can listen to.

sentences: How to render this stereopanorama for VR in unreal engine4 How to render this stereopanorama for VR in unreal engine4

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:
Ways to get around the limiting default terrain shaders in Unity I am trying to use the Toon Rim Light shader for Unity however there are a few problems when trying to use any custom shaders for a terrain in Unity. The most well known is of course, that all textures immediately become a blurry mess and ruins the look. The other issue is that all shading on the terrain ceases to be, and causes it to not cast shadows for both nature objects as well as characters.

I have researched methods for circumventing this problem, however all sources for troubleshooting have been inadequate in providing enough details or steps in correcting the issue and I am left to turn here for a possible better breakdown of the processes and coding involved in achieving the effect that I desire.

Thank you in advance, I appreciate any help.

sentences:
How to refresh allegro textprintf_centre_ex text upon keypress? I'm trying to print the coordinates of a drawn square upon movement. The problem is that the x value doesn't get refreshed on screen.

This is the code I have:

#include <allegro.h>

BITMAP *buffer;

void update_screen(void)
{
    blit(buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H); // blit the buffer to the screen
}

int init_double_buffering()
{
    // create the memory buffer
    buffer = create_bitmap(SCREEN_W, SCREEN_H);

    if(!buffer)
        return FALSE;

    return TRUE;
}

int main()
{
    int x, y;

    // install allegro, set graphics mode, etc
    allegro_init();
    install_keyboard();

    set_color_depth(32);
    if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640,480, 0,0))
    {
        allegro_message("Unable to set graphics mode.\n");
        return 1;
    }

    // initialize page flipping
    if (!init_double_buffering())
    {
        set_gfx_mode(GFX_TEXT,0,0,0,0);
        allegro_message("Unable to initialize page flipping.\n");
        return 1;
    }

    // default coordinates for the rectangle
    x = SCREEN_W / 2 - 5;
    y = SCREEN_H / 2 - 5;

    // main game loop
    while (!key[KEY_ESC])
    {
        // game logic
        if (key[KEY_LEFT] && x) --x;
        if (key[KEY_RIGHT] && x < SCREEN_W-10) ++x;
        if (key[KEY_UP] && y) --y;
        if (key[KEY_DOWN] && y < SCREEN_H-10) ++y;

        // you draw everything to buffer
        clear(buffer);
        rect(buffer, x,y, x+9,y+9, makecol(255,255,255));
        textprintf_centre_ex(screen, font, SCREEN_W / 2, SCREEN_H/2,
               makecol(255, 255, 255), -1,
               "X value is %d!",
               x);

        // show the offscreen page
        update_screen();
    }

    return 0;
}
END_OF_MAIN()

sentences:
Transformed Vertices have wrong Z Axis For quite some time I've been working on my open 3D game engine, to learn how this stuff works. You can see the full codebase relating to my problem here on GitHub.

I'm using an OpenGL 3.3 Core Profile Context on Mac OS X 10.10.3 and a GeForce GTX 760, if this matters.

Everything seems to work fine when submitting my vertices and MVP matrix to the Pipeline. But at two different points I try to transform vertices on my CPU, which leads to problems.

To simplify rendering the debug bounding boxes in a single frame, I transform the vertices by their MVP matrix and later submit them all to OpenGL with an identity matrix as transformation matrix:

for (auto& c : corner) {
    glm::vec4 t = VP * glm::vec4(c, 1.0f);
    vertices.emplace_back(glm::vec3(t) / t.w);
}
// ...
Shader::drawGL(vertices, colorsLine, indicesLine, glm::mat4(1.0f), gl::GL_LINES);

Most of the time, this seems to work fine. But when some vertices of a bounding box lie behind the camera, they will be "mirrored" and extend into empty space, as you can see in this screenshot:

Something similar happens with my portal based rendering approach, as described in Portals and Mirrors: Simple, Fast Evaluation of Potentially Visible Sets. Basically, I'm looking for a visible portal, and then for more portals that are visible through the already found portal. The relevant code:

for (int c = 0; c < 4; c++) {
    glm::vec3 port = portal.getVertex(c);
    glm::vec4 result = VP * glm::vec4(port, 1.0f);
    glm::vec3 vert = glm::vec3(result) / result.w;
    // ...
}

This basically works as expected, as you can see in the following screenshot:

However, as before, there is a problem with vertices behind the camera. I would expect the transformed vertices Z axis to be in the range [0;1] and vertices behind the camera should be outside of that range. What I'm really seeing, however, is that the Z part is always 1, as you can see in this screenshot (the first line is the world vector, the second is the vector multiplied with the matrix, the third is the multiplied vector divided by w):

To give you the full picture, this is how I create my projection matrix:

projection = glm::perspective(45.0f, size.x / size.y, 0.1f, 75000.0f);

And my view matrix is created using the quaternion of my camera:

glm::mat4 translate = glm::translate(glm::mat4(1.0f), pos);
glm::mat4 rotate = glm::toMat4(quaternion);
view = glm::inverse(translate * rotate);

According to every description I've read of the OpenGL transformation pipeline, I've done everything to have my world coordinates now in clipping space. But, looking at the Z axis, this seems to be false. I'm sure I'm missing something obvious with my math here.

Please help me out :)

Best Regards,
Thomas

PS: English is not my native language, please excuse any mistakes.

sentences:
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:
Problem converting FBX file into XNB I create a Monogame Content Project to convert assets into XNB. For FBX file without texture there is no problem: the file is correctly converted and when I load XNB into my project everything is ok.
The problem occours when i have associated to fbx file a texture map: in this case both FBX and PNG files are converted to XNB but when i try to load these XNB files into my project the following problem occours:

"ContentLoadException: Could not load Models/maze1 asset as a non-content file!"
Note: maze1 is the XNB file that was converted from FBX.

How can I solve this problem?
Thank you in advance

sentences:
How do I 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:
I was expecting a circle to trace a path of parabola . why isnt that the case? Why isn't the rendered shape a parabola?

@Override
public void render () {
    Gdx.gl.glClearColor(1, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    renderer.begin(ShapeRenderer.ShapeType.Filled);
    position.x += 1;
    position.y = position.x * position.x ;
    renderer.circle(position.x,position.y,radius);
    renderer.end();
}

sentences:
How do I calculate paths for objects with limited acceleration? For example, say I have a car and a car has a specific minimum turning radius and I want to drive that car from point a to point b, but the car isn't facing point b.   How do I compute a path to point b?  Being able to specify the orientation at the point b would also be good (say you want to drive to your driveway and then pull in to your garage -- it doesn't do much good if you got to your driveway by driving over your lawn and are facing sideways :)

A pointer to documentation (or even just a name) would be perfectly fine -- I'm having trouble finding anything at all.

In my attempts, they work in simple cases, but fail miserably in situations such as when point b is closer to a than the minimum turning radius.

For example, how would you determine a path similar to this (the bold path):

edit: In my actual problem, there are some simple pathing constraints, but I already have an A* algorithm in place that works, but it allows things to make instantaneous heading changes, so it looks silly seeing a car suddenly make a 90˚ turn on a dime when they get to a turn point.

sentences:
JavaScript THREE.js webgl spotlight rendering I'm playing with webgl/JavaScript/THREE and a spotlight. And I see unexpected results. And I don't understand what's going on, and I'm hoping you can point me in the right direction. In my particular case, the bizarre behavior is when the spotlight is behind the character, but the light is rendered as it's coming from the front. I apologize, I think it's best if you take a look here to see what I mean

http://dhkgames.com/games/redshifted

. Please note that in my tests This website worked in chrome and Internet Explorer, but for some reason not in Firefox. Also, please be patient, the test website is hosted in Singapore, so it may take up to one minute onto the character is downloaded and rendered in the middle of the screen

. What I'm interested in is to understand if the spotlight works as designed, or maybe I can update vertex/fragment programs.
 As a secondary goal, in the spotlight The pants and the jacket material renders somehow differently, and once again I'm not sure why, so if you have some pointers for this as well It would be much appreciated!

. Lastly, I apologize for misspellings, my arms and eyes don't work very well, and I use voice recognition software to interact with my computer…

. Thanks!

sentences:
When using transformation matrices, how does one convert orientation and scaling from a global frame of reference into a local one? Note: I'm certain I cannot be the first to answer this question. Unfortunately, the answers I need are buried under an avalanche of posts asking how to move coordinates between frames of reference, and other similar but unhelpful problems.
As part of an ongoing project, I've built a Transform object. As one might expect, this is essentially a glorified wrapper around a 4x4 transformation matrix (and various base values), and provides abstracted ways of interacting with position, orientation, and scale, as well as handling parenting to other instances to build complex hierarchies.
I am currently trying to allow the user to set and alter values of child transforms in global terms. Position is straightforward (if I'm doing it right), as this simply involves converting a coordinate from a global frame or reference to a local one.
void Transform::setGlobalPosition(const glm::vec3& newPos)
{
    glm::vec4 nlp = glm::vec4(newPos, 1.0f);
    if (m_hasParent) {
        // This gets the parent transform from the Entity-Component System.
        auto& p = p_registry->get<Transform>(m_parent);

        nlp = glm::inverse(p.m_globalTransformM) * nlp;
    }

    setPosition(nlp);
}

void Transform::alterGlobalPosition(const glm::vec3& deltaPos)
{
    glm::vec4 nlp = glm::vec4(m_globalPosition + deltaPos, 1.0f);
    if (m_hasParent) {
        // This gets the parent transform from the Entity-Component System.
        auto& p = p_registry->get<Transform>(m_parent);

        nlp = glm::inverse(p.m_globalTransformM) * nlp;
    }
        setPosition(nlp);
}

However, I have absolutely no clue how to accomplish the same for the following.
// Transform member functions.
void setGlobalScale(const glm::vec3& newScale);
void alterGlobalScale(const glm::vec3& deltaScale);
void setGlobalOrientation(const glm::quat& newOri);
void alterGlobalOrientation(const glm::quat& deltaOri);

Position coordinates are easy, but how does one approach the problem for rotations and scaling? Any help would be greatly appreciated.

sentences:
What are the advantages and disadvantages of exporting spritesheets instead of models from Spriter into Unity? I'm working on a simple 2D platformer in Unity and have been using the Spriter2Unity tool to import my Spriter animations directly into Unity.
I have noticed that this creates large hierarchies of gameobjects within the imported prefabs, basically 1 per image piece.

Since the animations are fairly simple, I am thinking it would be cleaner to import each of them as a spritesheet and hook them up with a spriterenderer on the player object rather than using the importer tool.

Would this actually result in any performance benefit at runtime or are the impacts of animating a lot of game objects at once negligible?

sentences:
Clone gameobject on drag without having to click a second time I have a standard Cube gameObject (with a BoxCollider and my CubeController.cs script) in my scene and I want to be able to click and drag on it to instantiate a new cube prefab (with a BoxCollider and my DragController.cs script) which then follows the mouse.

I have it nearly working but when the new cube prefab is instantiated at the same position as the clicked cube (but 10% bigger) you have to then click the new instantiated object again to begin dragging it. I have a debug line printing 'Prefab created' in DragController.cs so the prefab must be sensing that the mouse button is still down.

How can I do it so you click the original cube then the new prefab is created and draggable without having to click again?

CubeController.cs - placed on original Cube gameobject

using UnityEngine;

public class CubeController : MonoBehaviour
{
    RaycastHit hitInfo;
    Ray ray;

    public GameObject CubePrefab;
    private bool canCreate = true;

    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        }

        if (Physics.Raycast(ray, out hitInfo))
        {
            GameObject objectHit = hitInfo.transform.gameObject;

            if (objectHit.tag == "Cube")
            {
                createCubePrefab();
            }
        }
    }

    void createCubePrefab()
    {
        if (canCreate)
        {
            canCreate = false;
            GameObject newCube = Instantiate(CubePrefab, hitInfo.transform.position, Quaternion.identity);
            newCube.transform.localScale = new Vector3(1.1f, 1.1f, 1.1f);
        }
    }
}

DragController.cs - placed on Cube prefab that is going to be instantiated

using UnityEngine;

public class DragController : MonoBehaviour
{
    private Vector3 screenPoint;
    private Vector3 offset;

    // Start is called before the first frame update
    void Start()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Debug.Log("Prefab created");
        }
    }

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

    void OnMouseDrag()
    {
        Vector3 cursorPoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z);
        Vector3 cursorPosition = Camera.main.ScreenToWorldPoint(cursorPoint) + offset;
        transform.position = cursorPosition;
    }
}

sentences:
In general how often and when should I optimize my code? In 'normal' business programming optimization step is often left until really needed.  Meaning you should not optmize until it is really needed.

Remember what Donald Knuth said "We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil"

When is the time to optimize to make sure I am not wasting effort.  Should I do it a method level?  Class level?  Module level?

Also what should my measurement of optimization?  Ticks?  Frame Rate?  Total Time?

sentences:
Fade into scene in Unity / SteamVR I am using this code below for a gradual fade into a scene/next level in Steam VR (HTC Vive)
The whole idea is to cover up the scene loading icon which is viewable for 3-4 seconds, and the default Steam landscape scene. The fade (to red) works fine…BUT it comes in after the loading icon so this defeats the whole purpose of it. Is there any simple way to fix this? thanks

public class NewFade : MonoBehaviour {

private float _fadeDuration = 4f;

private void Start()
{
    FadeFromWhite();
}

private void FadeFromWhite()
{
    //set start color
    SteamVR_Fade.View(Color.red, 0f);
    //set and start fade to
    SteamVR_Fade.View(Color.clear, _fadeDuration);
}

}

sentences:
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:
Articles about a plot in an open world There are plenty of articles about open world game design and writing plots. But have you guys come across articles or blog entries about designing an engaging plot in an open world game? What i mean by this? In TES:Morrowind you're introduced to mechanics and are given the "main quest" within the first 5 minutes and then you're free to go, learn, kill, do whatever you want. I've spent hundreds of hours playing the game, but i have never got to doing the "main quest" and i'm sure alot of people are in the same situation, be it Morrowind, Oblivion or Skyrim. Maybe it's the power of TES games and a true testiment to how great RPGs they are, however for me, thinking as a designer, it seems like a massive design failure. Maybe it's the fact that there's no actual threat that needs to be dealt with, maybe it's that, amongs all the well designed and interesting quest within the game, the "main quest" just doesn't seem so interesting.

I've got a game idea in the back of my head, i want to create an action platformer, but the "level selection" would be open world style "dunegons" like you find in MMOs. This is a vague and undeveloped idea, so don't focus on it, i didn't give this design much thought, however an issue arose, i can't figure out, in general, how to make the player care about the open world aspect (f.e. dealing with roaming, pillaging parties, doing a gauntlet run to get some special armor, clearing a water source from enemies, etc.) while "forcing him" to finish the game, carrot-on-a-stick kind of way. There are "crazy" people who will go search everywhere between cutscenes in FF games, but i'm aiming at the general audience. I want to create  a subtle system for guiding people throughout the game to a goal, while giving them an option of gaining power any way they want. This may aswell be impossible, but it doesn't hurt to ask.

I'm looking for articles or musings on this matter. Not solutions (since there's no design document, no direct solutions matter at this point), just thoughts from other people, probably with other games as a reference.

sentences:
Understanding diffuse lighting in The Division Here is a screenshot of the main character walking under a bright lamp:

His hat, that was originaly dark grey, turns completely white. My question is how can such lightsource do this without making everything around it superbright? Cuz that's what my humble attempts resulted in.

I can only think of two options:
 - they either use a standard diffuse formula (it has got to be diffuse light as it does not react to camera movement) and have a lightsource that fades extremely quickly (fastar than the standard quadratic attenuation model.
 - or they use some clever shaders for clothes to make them "catch light" so fast.

Maybe there is an easier solution?

Here are two more shots, the floor is not nearly as bright as the character that goes under the lamp:

UPDATE: I think I got my problem - they have a different attenuation formula. I think if I improve my attenuation I whould be able to achieve similar results.

sentences:
how to change the number of rendered frames in Blender i´m using blender to render an animation in single pictures and i want to make an 16 frames animation out of an 24 frames one without changing the set keyframes. Is there an option to skip every 3rd frame and just render the rest? I only found the frame step option, which allows you to render every 3rd, but not 2 frames and skip the 3rd.
If anyone could help, thank you very much!

sentences:
Why Are These 3D Square's Pixels Spaced? So i'm currently attempting to write a 3D renderer. From no prior knowledge because I want to challenge myself. But I'm stuck here, and thought I'd bring it to StackExchange because I always see brilliant solutions! If more code is needed please just ask!

This Is My Square Render Code:

public void renderSquare(int xPos, int yPos, float zPos, int width, int height, int color) {
    clearArray();

    for(int y = 0; y < height; y++ ) {
        int yy = y + yPos;

        for(int x = 0;x  < width; x++) {
            int xx = xPos + x;

            float xS = -1f, yS = -1f;

            if(xx < centerX ) {
                xS = ((xx / zPos)) + centerX;
            }else {
                xS = ((xx / zPos)) - centerX;
            }

            if(yy < centerY) {
                yS = ((yy / zPos) - 0.5f) + centerY;
            }else {
                yS = ((yy / zPos) - 0.5f) - centerY;
            }

            setPixel((int)xS, (int)yS, color);

        }
    }
}

Plus How I Set Pixels:

public void setPixel(int xPix, int yPix, int color) {
    if(xPix < 0 || xPix > width || yPix < 0 || yPix > height)
        return;
    try {
        render_buffer[xPix + yPix * width] = color;
    }catch(Exception e) {
        return;
    }
}

Any help is appreciated]1

sentences:
World texturing techniques in FPS game Texturing for small objects (pickups and enimies) can easily be done UV-unwrapping the model, and use a texture of reasonable size to make the model look good. But how can texturing be done for the world? Covering a large building with one texture would require a huge texture (otherwise it will look blurry), and a lot of it will be repeated (brickwall textures, wallpapers ...), so that approach seems inefficient. Assigning different textures to different faces may be slow, since there cannot be a texture switch within the draw call.

I am targeting OpenGL 4 or later. I prefer good looking stuff rather than extremely high framerate: I aim for 30 fps, but perhaps with motion blur (which I guess requires four times that).

About tiling:

Tiling would work, but then there are some parts of the mesh which requires some other texture. And then I need to switch texture.

sentences:
How to add the sound effect of a ball rolling, based on his velocity? I have a ball which roll (like all ball does :) ) ...

My ball can roll on different type of surfaces (2 or 3) and at different velocity.

I don't know how to approach to reproduce in my game the sound effect.

I can assume to do :

Get an Sfx of a rolling ball
Run in loop if my ball is moving

then ?

Well.. i need some help.

Thanks

sentences:
Build SDL_Surface before blitting it I have a function in which I'm looping y and x over my array of sprites. That's a lot of loops, and it is very slow; I'd like to improve the performance.

I would like to only have to build the surface once, calling a buildMap method at the start, and referencing the resulting surface each time I need to blit it without having to loop to find the correct sprite and position.

int aff_map(t_exe *exe)
{
    int         sprite_idx;
    int         y, x;
    SDL_Rect    srcrect, dstrect;

    dstrect.y = 0;
    srcrect.y = 0;
    srcrect.w = TILE;
    srcrect.h = TILE;

    for (y = 0; y < HEIGHT; y++)
    {
        dstrect.x = MARGE_X;

        for (x = 0; x < WIDTH; x++)
        {
            for (sprite_idx= 0; sprite_idx< NB_TILES; sprite_idx++)
            {
                if (exe->map[y][x] == g_assoc_map[sprite_idx].key)
                      srcrect.x = g_assoc_map[sprite_idx].idx * TILE;
                if (SDL_BlitSurface(exe->sprite, &srcrect, exe->screen, &dstrect)
                        < 0)
                    return (err_sdl(SDL_GetError()));
            }

            dstrect.x += TILE;
        }

      dstrect.y += TILE;
    }

  return (EXIT_SUCCESS);
}

Is it possible to build an SDL_Surface before blitting it?

sentences:
Guidance for building a proper in game economy I'm seriously thinking of building a space opera game which would share some of Machiavelli The Prince aspects regarding commerce: each player will be able to extract/build/buy/sell/donate a wide range of products (from ore to spaceships roughly).

However, I'm struggling with the economy aspect of it. Should the game define the prices once and for all? Should each player be able to determine his own buy/sell prices, and if so, how? How can I avoid over engineering this game economy mechanism, while still making it attractive for users?

Edit: thanks to your very nice input, some more information about the setup:

it's a "player only game," with no "computer managed player."
players start with a planet and some resources/units and then (try to) expand
players can be of multiple "species" with no proper relationship apart from the one they might make up => no possible notion of "central bank" or similar in the first place
consequently, I would prefer "not magic" on the economy, by that I mean a standard currency whose value would be determined by the system. However then I don't see how trading would be appealing, since bartering would be the only way, which feels a bit clumsy for the players. I was thinking of having some rare metal as the standard exchange medium, but then I wonder how would to include other basic economic attributes, such as the population's wealth...

Hopefully it doesn't look too daunting...

sentences:
Find format of data from Steam API using Python I have some user data downloaded using the Steam API (I am following the approach described here) and I need to find the format for each entry of the CSV file I generated (available here).
Using Python, the solution I came up with is the following:
import pandas as pd
import sys

df1 = pd.read_csv("./data/csgo_cheater_data_01_14_21_full.csv")
for ii in range(189):
    print(df1.columns[ii], type(df1[df1.columns[ii]].values[0]))

Running this snipped, the result is that most variables are float64, plus a few int64. Does it make sense? Is this the real format of the data or are they somehow converted when retrieved using the API?

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:
How can I simulate the effects of network latency to test my lag compensation? I am trying to observe the effects of lag compensation in my game by increasing my ping to 200+, adding loss, and by the limiting bandwidth to simulate wide area network delays using Network Emulator for Windows Toolkit.

It seems no matter the degree of latency that is applied I never see any visual changes to my character position on the server, as the lag compensation / interpolation method is always able to predict my exact position.

But in real-world situations, players connected from a far distance away do have poor synchronization. How can I produce the same poor synchronization that I witness in players connected from a far distance so that I can choose the ideal lag compensation technique for my game.

For reference, I'm making this game using Unity 3D and it's a fast-paced, twitch shooter game.

sentences:
Making a 2D Game: Figuring out sprite sizes? I'm currently making a 2D game as a school project using Game Maker and its language. My concern however is around the spriting and art...

I can't figure out how to correctly size everything so it shows up correctly on the end product.
I originally used a temporary 32x32 character but it looks very small when I have the "Room Size" in Game Maker set to 720p...

Is this something that I need to change size-wise on Game Maker, such as changing how far in the perspective/camera is, or do I have to set actual dimension rules? I'm unsure of how to do this properly.

sentences:
Disabling and re-enabling the clicked child objects I am currently working on 2D platform game. The following script adding the child objects inside the array and identifies the child object I click on and checks the tag on it. Now I don't know how to disable the child object that I have clicked and I want the disabled child object to be re-enable when I click on another child object inside the same parent object. Any help would be appreciated.

public class SelectedPlatform : MonoBehaviour {

    public GameObject platform;
    void Start()
    {
        Transform[] children = new Transform[transform.childCount];
        for (int i=0; i<transform.childCount; i++)
        {
            children[i]=transform.GetChild(i);
        }
    }

    void Update()
    {
        if(Input.GetMouseButtonDown(0))
         {
            RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);

            if(hit.collider.gameObject.tag == "Platform")
            {
                Debug.Log ("Target Position: " + hit.collider.gameObject.transform.position);
            }
         }
    }
}

sentences:
Drawing sprites to the screen in 65816 Assembly I am trying to create a SNES game in assembly on the WLA-65816 assembler. However, I can't quite figure out how to draw sprites to the screen or figure out what software to use. At the minute, whenever I have scoured the internet for answers, I have only got results for a different compiler which uses different syntax to the one I am using. It would be really useful to have some code like a subroutine or something for drawing sprites.

Thankyou in advance.

sentences:
Perspective projection computation I'm learning OpenGL from arcsynthesis and I don't understand something about perspective projection (http://www.arcsynthesis.org/gltut/Positioning/Tut04%20Perspective%20Projection.html).

When the author gives the example "2D to 1D Perspective Projection Diagram", is R a 2D point or a scalar? When I saw the figure I thought it was a scalar because of the title and I thought that P is projected in a line (the Projection Plan). But later, when I saw the perspective computation, I realized that R has the same number of coordinates of P, because, from that equation, R is a product of the vector P with a scalar, so basically, I don't understand how many coordinates has R.

I don't know where that equation (the perspective computation) comes from, if someone could just give me some information about it I would appreciate it.

sentences:
Texture Packer - Any way to make it combine intelligently I am making a Pokemon Clone, using libgdx. I have the different types of sprites: e.g. Back, front, back shiny, and front shiny.

The current way the Texture Packer combines the textures seems to be semi-randomly. I would like to be able to tell it to put the sprites together based on number, because my sprites go:

003
003b
003bs
003s

Where the 003 is the pokedex number, and the b is for back, and s for shiny.

Two questions here:

Is there a way to get it to sort the textures in some way?
Is there a benefit to this sorting?

sentences:
Elevation model for hexagonal game grids TL;DR:

Where should elevation be anchored on a civ-style hexagonal grid? Center, side or vertex? (Or more complex?)

Question proper:

Consider for a moment a classic game we all know and love (maybe?), Sid Meier's Alpha Centauri. The map model introduced the brand new concept of visible terrain elevation to the classic Civ formula. In SMAC, every vertex of the game board had an elevation, allowing the map beautiful rolling hills, a complete necessity, considering the mind worm boils waiting around every corner.

Would a vertex-only elevation map translate neatly to a hexagonal grid?

The obvious alternatives are side-based elevation mapping and center-based elevation mapping; as well as inner-vertex elevation mapping (giving the opportunity for cliffs! Yay!)

The last option is applying a triangular lattice to the game grid encompassing centers and vertices, and having vertex-only or inner-vertex elevation.

Which of these options is likely to work well? Which are likely to suck all the juice out of the CPU and RAM in a hurry?

sentences:
Intentionally using "worse machines" to develop a game? I am developing a game intended for desktop computers.
I am afraid of developing a game that will be too costly in aspects of performance, so I am wary of using a machine that might be better than the target devices.
However, I don't know yet what the target devices will look like when my game is finished in 5 years.
How do Indy developers choose a device for developing their game in order not to get carried away with its performance?
Just an example to make it more clear:
If a developer had access to a quantum computer, I guess they shouldn't use it. Else they would lose their ability to estimate the performance on the target devices.
Or is the "developer machine selection approach" not how it's done, and instead, there is simply a certain tri count limit for everything? (I remember that for RE4, there was simply a hard limit for tri count for meshes)

sentences:
The Command pattern and multiple inputs per frame? I'm reading Game Programming Patterns by Robert Nystrom. As a test I've implemented the command pattern, but a little farther in he changes it to return commands, rather than instantly executing them.
An example of the first command pattern:
void InputHandler::handleInput()
{
    if (isPressed(BUTTON_X)) buttonX_->execute();
    else if (isPressed(BUTTON_Y)) buttonY_->execute();
    else if (isPressed(BUTTON_A)) buttonA_->execute();
    else if (isPressed(BUTTON_B)) buttonB_->execute();
}

Changing it to return commands:
Command* InputHandler::handleInput()
{
  if (isPressed(BUTTON_X)) return buttonX_;
  if (isPressed(BUTTON_Y)) return buttonY_;
  if (isPressed(BUTTON_A)) return buttonA_;
  if (isPressed(BUTTON_B)) return buttonB_;

  // Nothing pressed, so do nothing.
  return NULL;
}

// Executed in game loop:
Command* command = inputHandler.handleInput();
if (command)
{
  command->execute(actor);
}

My question is, how would I go about processing multiple user inputs each time input is handled? In my sample implementation, I check with an if on each button, instead of how he does it using an else if. I can see the benefits of returning the command (execute the command on any game actor you send to it), but it appears to be limited to one command process per loop.

sentences:
How can I implement an infinite parallax background like in Slither.io? I am trying to replicate the endless scrolling of slither.io but, I can't figure out how to implement it. Since the players can move to any direction and the background needs to be available during player's displacement.

All the parallax background scrolling tutorials show only moving on one axis, either x or y, but my case it could be to any possible direction like an arrow compass.

Can some one point me in the right direction about how I can implement this effect?

EDIT: User can move to any possible direction like an arrow in a compass.

Custom Camera Controller that follows the player

public class CameraController : MonoBehaviour {

    public GameObject Player;

    private Vector3 offset;

    // Use this for initialization
    void Start () {

        offset = transform.position - Player.transform.position;
    }

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

        transform.position = Player.transform.position + offset;
    }
}

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:
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:
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:
Trouble in 3DS MAX 2016 exported ogre.mesh file refering the correct .material Actually we have some trouble in exporting ogre mesh + material files correctly from 3dsmax.
We are using "Easy Ogre Exporter V 2.40" for the export to ogre format.
And actually just testing its features by displaying the images in Cegui-Meshviewer
(http://www.ogre3d.org/tikiwiki/tiki-index.php?page=CEGUI+Mesh+Viewer).

The problem is, the mesh itself refers to a material file, which has added "default" on to it. So for example if we exported "stone.mesh" the exported material would be "stone.material" which is fine. But when inspecting the mesh inside any mesh viewing tool run on ogreengine, the mesh itself is related to a so called "stoneDefault.material" which if I want to get its attributes listed just has no attributes set. But when I inspect the material itself ("stone.material") In those mesh viewers, I can see the correct UV map related to the material and the other attributes fit to what is expected aswell. But the mesh it self seems to be using an non existing "stoneDefault.material" (thats at least the name related to it) And I also checked if it changes anythign when I just change the name of "stone.material" to "stoneDefault.material" But this jsut resaulted in 2 different materials with the same name isnide the viewer.

So my Question is: Is this probably a bug in the viiewers/exporter?
Or am I missing/missunderstanding soemthing?

we selected for testing portability ogre version 1 as exporting file format.

sentences:
Shadow Glitch on Mesh Stitches I use LWRP, one Directional Light and Hard Shadows with 1024 resolution. When I imported this super simple mesh from blender this happened:

What is this weird line on the stitch of the mesh and how do I fix it? I tried using Soft Shadows with higher quality but it did not help.

sentences:
Libgdx Get Font Height with a Wrap is possible to get the 'Height' of a font drawed with the drawWrapped methods (with a wrapWidth) ?

getMultiLineBounds only works when \n is used, but when drawing with drawWrapped it doesn't give the right Height.

Text

String text = "hello this is very lonnnnng text without new line";
float wrapWidth = 100;

Display code :

 font.drawWrapped(batch, text, x, y, wrapWidth, alignment);

My 'get the displayed height code' :

 font.getMultiLineBounds(text).height;

Output :

 hello this is very
 lonnnnng text without
 new line

Problem :

How to have the total height of the displayed text by the methods : DrawWrapped

Can you help me please ? thanks you

sentences:
How can I load a large tile map with cocos2d? I am try to design a cocos2d game with a big world. The world's tile map is very big, maybe 20 iPad screen sizes worth of tiles.

I want to know how to load this using a CCTMXTiledMap? If I directly add it to screen, will it use too much memory? If so, is there a solution to solve this problem?

sentences:
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:
What basic non-games related computer knowledge should a games programmer possess? So the question will very likely need re-phrasing. I thought about asking this for a while, but held off because it's a tad vague.

To explain - I have been a programmer for 4 years and only begun doing it when I took a university course. Now that I'm working as a programmer, I find that often people assume you know a number of things that I feel people who have been messing around with computers know by default, and I don't.

Things like shell commands, how to use subversion, stuff about how websites work at their base level, how to use databases and so on.

What I would like to know is some of the basic stuff, the nitty gritty that people in a programming job are expected to have encountered and know how to do.

Also, I'm sorry if people feel this question is not a perfect match for the Q and A format - please let me know how I can improve it - or just edit it heavily.

Thank you in advance.

sentences:
SharpDX - How do I write multiple streams to Texture2D? I'm working on a 3D map that is cut as a simple grid of textures. The idea is to draw only one object with all those textures, instead of having a tile object for each of them. Correct me if I'm wrong, but only one big call is preferable to many small calls in terms of speed. Considering that textures loaded and shown are based on the camera view, ideally, it's not such a huge call.

Problem though, I need to put the corresponding textures altogether in a single Texture2D object I can pass to the shader. So I was thinking of having a rendertarget to create this Texture2D, but this beats the purpose of having only one draw call.

So basicaly, what I thought about is to load each texture, get their data and copy all of them in a new ordered Texture2D I can then pass to the object. Only thing is I have no idea on how to do that.

Any sample or suggestions on the matter? Or maybe someone tell me this is terribly wrong.

Thank you!

sentences:
Unity Optimization: Creating Multiple Similar Scenes Effectively I've been working on a mobile game that uses the same framework for each level in the game, and I was wondering what would be the most efficient way to store all those levels in Unity. Should I only use one scene and save all the level data somewhere in the filesystem so that each level can be loaded on demand? Or, should each level have its own scene in Unity? Or is there another, more efficient way to do this?

I just worry that creating multiple scenes with nearly identical assets will take up far too much memory and space on someone's device for such a simple game, but I can't figure out a better way to do it. Any ideas?

sentences:
How to make an animation play when a button is pressed once? I have added an idle and jump animation to a character in unity. I can make the animation happen when the button is pressed. If the button is up middle at the animation the character goes to the idle position. But I want the whole animation happen in one press to the button and then go back to the idle position. My current script and Animator views are:

if (Input.GetKeyDown(KeyCode.Space))
    {
        Anim.SetBool("is_jumping", true);
        ApplyInput(moveAxis, turnAxis);
    }
    else if (Input.GetKeyUp(KeyCode.Space))
    {
        Anim.SetBool("is_jumping", false);
    }

sentences:
Can you help me resolve a bug in mesh collision code? I have entities which walk along a 3D mesh. I move the units along their x,z axis, and every frame I update their y-position according to the quad or triangle they are standing on, using Barycentric coordinates. They do walk along the mesh, however every time they enter a new quad or triangle, they "bob" up and down on the y-axis.
Height testing is done by finding the "bottom-left" vertex of a "sqaure" of four vertices made by converting the unit's x,z position into a 1d index into an array of vertices.
They move smoothly until they enter a new part of the mesh, where it looks like their y-coordinate shifts once very noticeably and then keep moving smoothly. It happens both when testing against the square made by the four vertices around the unit, and with testing against triangles of mesh.
Here is the code to find y-coordinate on a square:
float px = batchTranslation[ i ].Value.x;
float pz = batchTranslation[ i ].Value.z;

int index = ( int ) ( ( math.floor( pz / MAP_SCALE ) ) * MAP_SIZE + ( math.floor( px / MAP_SCALE ) ) );

int bL = index;
int bR = index + 1;
int tL = index + MAP_SIZE;

float3 p1 = vertices[ bL ];
float3 p2 = vertices[ bR ];
float3 p3 = vertices[ tL ];

float3 normal = math.cross( ( p2 - p1 ) , ( p3 - p1 ) );

float py = ( normal.x * ( p1.x - px ) + normal.z * ( p1.z - pz ) + normal.y * p1.y ) / normal.y + HALF_HEIGHT;

batchTranslation[ i ] = new Translation { Value = new float3( px , py , pz ) };

Here is the code for finding the y-coordinate on the triangles of the mesh:
float px = batchTranslation[ i ].Value.x;
float pz = batchTranslation[ i ].Value.z;

int index = ( int ) ( ( math.floor( pz / MAP_SCALE ) ) * MAP_SIZE + ( math.floor( px / MAP_SCALE ) ) );

int bL = index;
int bR = index + 1;
int tL = index + MAP_SIZE;
int tR = index + MAP_SIZE + 1;

float3 V1 = vertices[ bL ];
float3 V2 = vertices[ bR ];
float3 V3 = vertices[ tL ];
float3 V4 = vertices[ tR ];

float py = batchTranslation[ i ].Value.y;

if ( IsInside( V1.x , V1.z , V2.x , V2.z , V3.x , V3.z , px , pz ) )
    py = CalcY( V1 , V2 , V3 , px , pz );
else if ( IsInside( V1.x , V1.z , V2.x , V2.z , V4.x , V4.z , px , pz ) )
    py = CalcY( V1 , V2 , V4 , px , pz );

batchTranslation[ i ] = new Translation { Value = new float3( px , py , pz ) };

private float Area( float x1 , float z1 , float x2 , float z2 , float x3 , float z3 )
{
    return math.abs( ( x1 * ( z2 - z3 ) + x2 * ( z3 - z1 ) + x3 * ( z1 - z2 ) ) / 2.0f );
}

private bool IsInside( float x1 , float y1 , float x2 , float y2 , float x3 , float y3 , float x , float y )
{
    float A = Area( x1 , y1 , x2 , y2 , x3 , y3 ); // Calculate area of triangle ABC
    float A1 = Area( x , y , x2 , y2 , x3 , y3 ); // Calculate area of triangle PBC
    float A2 = Area( x1 , y1 , x , y , x3 , y3 ); // Calculate area of triangle PAC
    float A3 = Area( x1 , y1 , x2 , y2 , x , y ); // Calculate area of triangle PAB
    return ( A == A1 + A2 + A3 ); // Check if sum of A1, A2 and A3 is same as A
}

// Returns y coordinate of point on triangle given point x and z coordinates
private float CalcY( float3 p1 , float3 p2 , float3 p3 , float x , float z )
{
    // determinant
    float det = ( p2.z - p3.z ) * ( p1.x - p3.x ) + ( p3.x - p2.x ) * ( p1.z - p3.z );

    float l1 = ( ( p2.z - p3.z ) * ( x - p3.x ) + ( p3.x - p2.x ) * ( z - p3.z ) ) / det;
    float l2 = ( ( p3.z - p1.z ) * ( x - p3.x ) + ( p1.x - p3.x ) * ( z - p3.z ) ) / det;
    float l3 = 1.0f - l1 - l2;

    return l1 * p1.y + l2 * p2.y + l3 * p3.y;
}
```

sentences:
XNA GameComponent.Initialize() not called I have a game which creates an object in its Initialize() method:

    private GameComponent1 _thingy;
    protected override void Initialize() //Game1.Initialize()
    {
        base.Initialize();
        _thing = new GameComponent1(this);
    }

In the GameComponent1 class:

    public GameComponent1(Game1 game) : base(game)
    {
        _game = game;
        game.Components.Add(this);
    }

    public override void Initialize() //GameComponent1.Initialize()
    {
        //Do stuff here
        base.Initialize();
    }

However, in this case, _thing's Initialize method is not called. Why is this?

It behaves fine when the object is created in, say, Game1's Update method...

sentences:
Flash Game not working on Android I am not sure if I will be able to provide enough information for someone to answer this question, but any ideas might help.

I am creating a tower defense game in Flash and I eventually want to make it run on Android. Just for testing purposes, I have been running it on Android's browser and different Android .swf player apps.

Recently, the game stopped working correctly. When it gets to the second wave of enemies, they get about four tiles in and stop moving. I can get them to start moving again by constantly clicking on parts of the screen. It's almost like the game loop has quit updating.

Trying to solve the problem, I have updated the gameloop from Flash's standard events to a NativeSignal event (didn't solve the problem but the game runs much faster overall).

The game works fine on my PC, I can't figure out the Android problem though. Any ideas or help would be appreciated. I didn't want to supply code since I wouldn't know where to start that would be helpful.

sentences:
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:
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:
Getting Rendered Sprite Size I need the rendered dimensions of a sprite, I'm calling Draw in the class below:
public class Ship
{
    public Ship(Texture2D texture)
    {
        Width = texture.Width;
        Height = texture.Height;

        Texture = texture;
    }

    public int Width { get; set; }

    public int Height { get; set; }

    public float Scale { get; set; }

    public Vector2 Position { get; set; }

    public Texture2D Texture { get; }

    public Rectangle Rectangle => new Rectangle((int)Position.X, (int) Position.Y, Width, Height);

    public void Draw(SpriteBatch batch)
    {
        var origin = new Vector2(Texture.Width / 2, Texture.Height / 2);
        var scale = new Vector2(Scale, Scale);
        var rotation = GetRotationInRadians();

        batch.Draw(Texture, Position, null, Color.White,
            rotation,
            origin,
            scale,
            SpriteEffects.None, 0f);
    }
}

The problem is Width and Height are based off the source (see the constructor) Texture size, so after drawing they are not actual dimensions. Is there away to determine the scaled sprite size?
Side note: I'm using these dimension to detect if an sprite was clicked on by the mouse. Maybe there is a better way to detect clicks?

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:
Unreal Engine 4 -- Casting I am currently developing my first classes in Unreal Engine 4. Coming from using UScript extensively, I'm getting a little bit confused by how typecasting works in pure C++. More specifically, class/object casting.

I am currently putting together a switch statement in MyCustomGameMode which calls upon MyCustomPlayerController for MyCustomPlayerControllerVariable.

The function in question that I am overriding is this one: virtual UClass* GetDefaultPawnClassForController(AController* InController);

Currently I'm trying to call the variable with the following line of code, which I know is incorrect, but I'm not sure why:

Cast<MyCustomPlayerController>(InController).MyCustomPlayerControllerVariable

I am interested in casting the "InController" to MyCustomPlayerController but Cast<MyCustomPlayerController>(InController) doesn't seem to work, what am I doing wrong here?

sentences:
Calculate Orbit Path/Ellipse given mass, velocity, and distance (2body) Calculate and draw the path of an orbit in a 2 body problem given the mass, current velocity, and distance of both bodies?

We're working in Unity and will be using the default rigidbody.mass to start while we craft a deterministic and event driven gravitational orbit calculation system.

We've got a lot of this done but need to know if anyone here speaking from experience can suggest the most optimal and the most accurate route for going about this.

Okay, so here's the intended system.

Objects have a collider-trigger sphere which represents their sphere of gravitational influence. When objects enter an SOI, they begin to be effected by that object's gravity. This represents an "encounter" event and this is where we grab initial values to determine the trajectory the object will take with those initial parameters. It will take this path as long as nothing changes. We only worry about "significant bodies" such as planets and large asteroids. We're not giving every ship an SOI but we do give them mass values so we can properly perform consistent calculations.
When a "path change event" occurs, the system will recalculate when the event is over and new velocities are established. This prevents the system from constantly calculating the force on objects every physics step and greatly reduces the overhead of the system.
The system has a way to "snapshot" everything for saves. positions, velocities, and paths. Basically from what I understand, we'd be getting arrays of velocities that we lerp between based on an array of position vectors. I was talking about how the system would to the motion, there.

So, instead of using Unity's built-in physics and forces, we bypass that for a much more efficient and customizable system. Instead of applying constant force to effect the positions of objects, we calculate the path ahead of time and assume the object will follow that path until something changes.

sentences: OpenGL Viewport inside of a Viewport I'm creating a labyrinth in opengl, and I'm trying to create a minimap. For that, I thought of creating a viewport inside of a viewport. I already tried following a tutorial from Lazy Foo, and I can create the second viewport, but instead of putting a map inside the second viewport, it  puts my whole game there. How can I fix this?

sentences:
How can I scroll my tile maps? I've been trying to understand how I can use matrix to implement a smooth tile scrolling system but I fail miserably.

So I have a pretty big world stored in a multi-dimensional array which is drawn like this :

 for (int i = 0; i < screenHeight / 32; i++)
            for (int j = 0; j < screenWidth  / 32; j++)
               spriteBatch.Draw( texture[i + offsetY][j + offsetX] , screenRectangle[i + offsetY][j + offsetX] , Color.White );

Can somebody give me some tips on what to do or at least explain the logic behind the matrix translation?
Thank you.

sentences:
Fastest way to draw quads in OpenGL ES? I am using OpenGL ES 2.0
I have a bunch a quads to be drawn, would love to be able to have to pass only 4 vertices per quad as if I were using GL_QUADS, but basically I just want to know the best way of drawing a bunch of separate quads.
So far what I've found I could do:

GL_TRIANGLES(6 vertices per quad)
Degenerate GL_TRIANGLE_STRIP(6 vertices per quad)

Possibilities I've found:

GL_TRIANGLE_STRIPS with a special index value that resets quad strip(this would mean 5 indexes per quad, but I don't think this is possible is OpenGL ES 2.0)

sentences:
Sphere UV mapping. Texture Streched I am trying to write a sphere mesh algorithm. Unfortunately, is the texture stretched vertically at the very end of the image. This should be near U 0.99~.

Below is the code used for the sphere creation. In the Image below that you can see a sphere created by Maya with the correct textures applied to it. Therefore, the issue is defiantly the UV map created by this code.

If I increase the number of parallels that are wrongly called meridians. Then the texture looks nearly spot on, but one thin line of garbage.

Hope someone sees the issue. I worked on it for 2 days now :(
There is a live version online for a closed examination of the object.
https://upmkuhn.github.io/AGAV/AGAV/

Btw what is the correct terminology for such an issue?

function makeSphere(radius, numParallels, numMeridians)
{
    var index = 0;
    var grid = [];
    var vertecies = [];
    var normals = [];
    var texture = [];
    var faces = [];

    for (var p = -1; p < numParallels; p++)
    {
        var row = [];
        var parallel = Math.PI * (p +1) / numParallels
        for (var m = -1; m < numMeridians; m++) {
            var meridian = 2.0 * Math.PI * m / numMeridians
            var cartesian = sphericalToCartesian(radius, meridian, parallel);
            var vec3xyz = vec3.create(cartesian);
            vertecies.push(cartesian);

            //NORMALS
            vec3.normalize(vec3xyz, vec3xyz);
            normals.push(vec3xyz);

            x = vec3xyz[0] == 0 ? 0 : vec3xyz[0];
            y = vec3xyz[1] == 0 ? 0 : vec3xyz[1];
            z = vec3xyz[2] == 0 ? 0 : vec3xyz[2];
            //UV
            var u = (Math.atan2(x, z) / (2 * Math.PI) + 0.5);
            var v = y * 0.5 + 0.5;

            texture.push(u,v);
            row.push(index++);
        }
        grid.push(row);
    }

    for (var i = 0; i < texture.length;i+=2)
    {
        var u = texture[i];
        var v = texture[i+1];
        if (Math.abs(u-v) < 0.5)
        {
        }
    }

    for (var p = 0; p < (numParallels ); p++) {
        for (var m = 0; m < numMeridians; m++) {

            if (m < numMeridians) {
                var p1 = grid[p][m];
                var p2 = grid[p + 1][m];
                var p3 = grid[p][m + 1];
                faces.push(p1, p3, p2, grid[p + 1][m + 1]);
            }
        }
    }

    return {
        vertecies: vertecies,
        normals: normals,
        texture: texture,
        faces: faces
    }
}

function sphericalToCartesian(radius, azimuth, elevation)
{
    var x = radius * Math.sin(elevation) * Math.cos(azimuth)
    var y = radius * Math.sin(elevation) * Math.sin(azimuth)
    var z = radius * Math.cos(elevation)
    return [x , y , z];
}

sentences:
Deferred contexts and inheriting state from the immediate context I took my first stab at using deferred contexts in DirectX 11 today. Basically, I created my deferred context using CreateDeferredContext() and then drew a simple triangle strip with it.

Early on in my test application, I call OMSetRenderTargets() on the immediate context in order to render to the swap chain's back buffer. Now, after having read the documentation on MSDN about deferred contexts, I assumed that calling ExecuteCommandList() on the immediate context would execute all of the deferred commands as "an extension" to the commands that had already been executed on the immediate context, i.e. the triangle strip I rendered in the deferred context would be rendered to the swap chain's back buffer.

That didn't seem to be the case, however. Instead, I had to manually pull out the immediate context's render target (using OMGetRenderTargets()) and then set it on the deferred context with OMSetRenderTargets().

Am I doing something wrong or is that the way deferred contexts work?

sentences:
What ways are there for making vector types available in scripting? I use Google V8 engine to embed Javascript into my game for scripting. As interface to my native code, I already registered some C++ functions to the scripting context.

In the native code, I make intense use of the C++ library GLM which adds vector types and geometry functions. The naming is in a style that may be known from shader code, for example vec3, uvec2, normalize(), length(), and much more.

Now I would like to make these types available in scripting. That would be useful because of both, the geometry functions and the vector types. Especially, I want to use the vector types as parameters in the C++ functions I mapped to the Javascript context. At the moment I'm using arrays like float[3] instead of the vectors like vec3.

So I am looking for possible ways to bring GLM functionality into Javascript. This is what I can think of.

Create the most important types by hand, either in a Javascript file or injected from C++ code using object templates. Unfortunately, I cannot do this for all of the many functions in GLM. But it would better than nothing.
There might already be a GLM port of Javascript, which I haven't found on the internet.
I could pick a different geometry library for use in Javascript. For bound C++ functions, I'd have to translate their types into GLM ones then.
What can you think of...

Maybe there is a cool way to all the functionality of GLM over to Javascript. Are there things like C++ to Javascript source code converters? Or automatically binding a whole C++ namespace to scripting? I don't think that is possible. But Javascript is such a dynamic language, there must be a way to make the GLM types available for it.

What ways are there for making the vector types, and preferably also the useful geometry helper functions, available in scripting?

sentences:
Yet another frustum culling question This one is kinda specific. If I'm to implement frustum culling in my game, that means each one of my cubes would need a bounding sphere. My first question is can I make the sphere so close to the edge of the cube that its still easily clickable for destroying and building? Frustum culling is easily done in XNA as I've recently learned, I just need to figure out where to place the code for the culling. I'm guessing in my method that draws all my cubes but I could be wrong. My camera class currently implements a bounding frustum which is in the update method like so

   frustum.Matrix = (view * proj);

Simple enough, as I can call that when I have a camera object in my class. This works for now, as I only have a camera in my main game class. The problem comes when I decide to move my camera to my player class, but I can worry about that later.

    ContainmentType CurrentContainmentType = ContainmentType.Disjoint;
    CurrentContainmentType = CamerasFrustrum.Contains(cubes.CollisionSphere);

Can it really be as easy as adding those two lines to my foreach loop in my draw method? Or am I missing something bigger here?

UPDATE: I have added the lines to my draw methods and it works great!! So great infact that just moving a little bit removes the whole map. Many factors could of caused this, so I'll try to break it down.

    cubeBoundingSphere = new BoundingSphere(cubePosition, 0.5f);

This is in my cube constructor. cubePosition is stored in an array, The vertices that define my cube are factors of 1 ie: (1,0,1) so the radius should be .5. I least I think it should. The spheres are created every time a cube is created of course.

    ContainmentType CurrentContainmentType = ContainmentType.Disjoint;

        foreach (Cube block in cube.cubes)
        {
            CurrentContainmentType = cam.frustum.Contains(cube.cubeBoundingSphere);

    ///more code here

     if (CurrentContainmentType != ContainmentType.Disjoint)
            {
                cube.Draw(effect);
            }

Within my draw method. Now I know this works because the map disappears, its just working wrong. Any idea on what I'm doing wrong?

sentences:
Why does accessing a uniform float make my shader more than twice as slow? My fragment shader was significantly slowed down by a recent change, and I've been trying to understand why.

I isolated the main slow-down to accessing a single particular uniform float. If I include this line:

float not_used = my_uniform;

then the shader runs more than twice as slowly as it does without this line. The not_used float is never referenced again.

Why would this be happening? I hope to understand it so that I can try to come up with a workaround that runs more quickly.

I'm running this on a mac with Intel HD Graphics 3000. I'm measuring the performance by making OpenGL timestamp queries before and after executing my glDraw calls and looking at the ms intervals. I can provide more specs / details if it would be helpful in diagnosing the problem.

sentences:
Real Time Dynamic Pathfinding? I'm currently doing some pathfinding research and my simulation is the following:
I have a 3d scene with a start and end point represented, I'm capable of creating navigational meshes, waypoints and polygons to aid with pathfinding.

I've tried an A* algorithm and some of its variants and they work perfectly.
However, now I'm more interested in 'dynamic' pathfinding.
For example, while finding a path from point A to point B, if a new obstacle suddenly appears, i want my algorithm to immediately be able to re-plan a path and not start searching from scratch again.

I've done some reading on the D* algorithm and wondering if this would be appropriate for what I need or would this seem like an overkill.

So my questions basically are:
What algorithm would be best for Real Time Dynamic Pathfinding?
OR what combination of techniques could I use instead?

sentences:
High performance screenshots in LWRP I'm trying to capture some screenshots for my game. They need to be saved as jpgs to a folder, latency is not an issue, I don't care if it happens over 10 seconds. My number one priority is to keep the game at a steady framerate.

Some things I've tried:

I've tried ScreenCapture.CaptureScreenshot but that is super slow and the game hangs for a split second.
I've tried the old method of texture2d.ReadPixels() and EncodeToJPG() but that was unbelievably slow.
I also found a relatively new feature: https://docs.unity3d.com/2018.3/Documentation/ScriptReference/Rendering.AsyncGPUReadback.html

I found a repo using this feature to capture screenshots asynchronously: https://github.com/keijiro/AsyncCaptureTest
This requires the use of OnRenderImage(), but I'm using LWRP and OnRenderImage() isn't supported in scriptable render pipeline.

Pulling my hair out

Some metrics from my testing:

ScreenCapture.CaptureScreenshot is ~200ms.
ReadPixels() is 40-70ms.
Texture.Apply() is ~5ms.
EncodeToJPG() is 35-50ms.
File.WriteAllBytes() is <1ms.

Also posted this question here and here:

sentences:
Word game - board implementation? I'm working on a boggle type game for android, using libgdx. The user is presented with a 4x4 grid of letters and must find words by dragging their finger over the letters.

Unlike boggle I want used letters to disappear. Remaining letters will fall down (to the bottom of the board, screen orientation is fixed) and the board is refilled from the top. Users can rotate the board to try and put hard to use letters in a better place by strategic word selection.

An example:

d g a o
u o r T
h v R I
d G n a

If i selected the word GRIT, those letters would disappear and the remaining fall down:

d
u g a
h o r o
d v n a

and then get replaced by new letters

d w x y
u g a z
h o r o
d v n a

I'm stuck figuring out how to represent the board and tiles.

I tried representing the board as a matrix to keep track of tiles selected and valid moves and the tiles stored in a matrix as well so that there was an easy mapping. This works, but I had to write some convoluted code to rotate the board.

How do other games handle this problem?

EDIT:
So thinking about it, I should really just process my touch point according to the board rotation so cells stay constant. Attached an image of what I'm thinking.

sentences:
Experienced coder/designer moving into game development - what's involved? I am interested in moving into game development once my current project is done, as it's nearly at a point where it will pay my bills and allow me to hire someone else to take the driver's seat, meaning that, for the first time in my working life, I'll be in a position to devote a proper amount of energy to getting into game development, which has been something I've wanted to do for a long time but forced myself to wait on, as there are only so many hours in the day to devote to projects.

I am an experienced web developer (12 years) with most of my experience programming in C# and .Net (8 years). I am also a capable graphic designer. I have a surface knowledge of C++, though it's been 10 years since I wrote any C++ code. I also played with the DirectX 5 API back then as well.

I am happy to outsource graphics and sound, leaving me with coding, game design, level design and so forth.

Do I need to learn C++ properly, or can I rely on my C# and .Net knowledge?
If I'm going to leave C++ out of the equation, am I seriously limiting myself with regards to platform agnosticism?
Given that my memory of mathematics (high school level) is hazy at best, how much time I do I need to devote to pure maths self-education, or can I pretty much figure it out as I go?

In a nutshell, I'd love to get some idea of what the best approach for me would be, including DO's and DON'T's that might slow me down. I know that baby steps will be required at first, but it would be nice to get some advice as to what path I should follow to get myself up to speed quickly so that I am able to create decent indie games with nice looking 3D graphics, AI, particle effects and so forth.

sentences:
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:
most flexible way to implement a buff /debuff system for a RPG game I'm making an RGP board game where I have different heros, each one of them belongs to some types

for example ("Aatrox" is a Dragon and a Ninja hence he belong to these two types),and each player has a

list of champion with fixed attirubtes like basicAttackDamage,criticalstrike/chance/ability..etc

and i have what are called as buffs, a buff gets activated to player when his some of his heros

belong to certain types

eg: if a player gets two Dragons or more , then every hero whose type is Dragon gets double Damage

Attack, TrueDamage(Ignore magic resist and armor), Attack..etc

so i was wondering what would be the most flexible way to implement these sort of buffs considering the

fact that each champion could only use his attack/ability once in each round and there are buffs that

gets added with a certain chance "this buffs gives the hero 40% chance to stun the enemy with basic

attack, and buffs which add health to heros ("this buffs give the hero 250 extra health") etc..

my current approach is to add tags on buffs and apply these buffs when attacking or defending an attack

so this would look something like

enum BuffsType{
OnHit,OnAttack
}

but this approach kinda fails at complex buffs like "a chance to hit extra

attack/extra enemy/". I have seen some discussions about this but none of the answers seemed to be REALLY flexible, most of them failed at complex buffs

design-patterns software-design

sentences:
Java multiple player objects/enemy objects? NOTE: I'm a beginner and learning :D

Alright, so in my game I have a class for the player (with the parameters of x, y, color, width, height, and health, same parameters with the enemy). But I have a problem. So, in my player class, I have a draw method which sets the color and fills a rectangle with the variables specified in the parameters. In my main class, I create an instance of that player, and call the draw method from there, too. However, when I try to create more than 1 player object, it just renders the second one, rather than both, even if the x, y, color, and pretty much everything is different.

Basically, I can't draw more than 1 player to my screen. Same thing with the enemy.

sentences:
What to watch out for when creating a autobiographical game? I plan to create a game which depicts various events from my life.

During these events, some people I know do not appear in a very positive light. I am afraid that these people might feel that it is an infraction on their personality rights. I also plan to unveil some of my own actions which they didn't know before and which could make them angry if they knew of them.

The story of the game as I currently plan it will be written in a way that if they know I made the game, they would realize that they are the ones depicted. Even if they have different names and appearance.

But despite these risks I feel that this project is important for me and might help me to cope with some events from my past.

What should I watch out for when I write and publish the game to make sure I won't ruin my relationship with these people?

sentences:
How to programmatically place objects in an arc and rotate them? I have created an arc of circles from the inspector without any issues, but I need to create them programmatically. The image below shows what I'm looking for.

How can I get the positions at which to instantiate them, and how would I easily rotate them around the circle path, so that the arc ends up on the other side of the circle?

sentences:
How can you make custom direct3D11 calls in Unreal Engine 4? I have some custom code that renders to Direct3D11 texture.  Is it possible to use this texture on an object in unreal 4?  Or alternatively, is it possible to draw custom geometry directly to the scene in unreal 4 using raw Direct3d?

So far, it seems like I need to make a custom instance of UPrimitiveComponent which creates and returns an FPrimitiveSceneProxy.  In the FPrimitiveSceneProxy::CreateRenderThreadResources I can call RHIGetNativeDevice and cast its return to ID3D11Device and use it to create Direct3D instances, however, I'm not sure where to put my per-frame draw calls.

sentences:
Playing NSF music in FMOD.net So, as the title says, I want to be able to play NSF files using FMOD, because my project already uses FMOD and I'd rather not replace it. This will involve figuring out how existing players and emulators work and porting it. I haven't yet found an existing player that uses FMOD.

My starting point is the MyNes source from http://sourceforge.net/projects/mynes/. There are two big steps between here and what I'm looking for.

MyNes plays from a ROM, not NSF. So, I have to rip out the APU and get it to play NSF files.
The MyNes APU uses SlimDX, so I have to convert that to FMOD.NET.

I am really stuck about how to go about either of these, because I'm not that familiar with audio formats and it's hard finding resources online. So here are a few questions:

From what I can tell from the NSF spec at http://kevtris.org/nes/nsfspec.txt, it's just contains the relevant memory section of the ROM, plus the header. If anyone can verify or correct this that would be great.
The emulator APU uses data from the rest of the emulator to play, including things like cycle counts. I'm not sure what replaces this in a standalone player. Can't I just load all the music data at once into a stream and play it?
Joining #1 and #2, does the header data from the NSF substitute for some of the ROM data in the emulator code?
Using FMOD, will I be following the usercreatedsound example for loading a stream? And does this format count as PCM? Specifically MyNes says PCM8. Any tips on loading / playing the stream in FMOD are appreciated.

As an aside, I don't really understand the loading / playing sections of the spec I linked at all. It seems to apply to 6502 systems / emulators only and not to my situation.

I know it's a long shot for anyone here to have enough experience in this area to help, but anything you can provide is definitely appreciated. A link to an existing .NET library that does this would be even better, but I don't believe one exists.

sentences:
Why should I choose to design a health bar rather than heart containers? When designing any hero-based game, be it adventure, RPG, brawler, or similar, you eventually need to decide on your health system. Barring any regenerative systems with zero UI (like Call of Duty), should you use a discrete set of heart containers, Zelda-style, or a continuous health bar, like Street Fighter?

Here are some points of contention that I've been thinking about:

Hearts are easier to understand (very clear how many hits you can take)
Hearts give a better sense of accomplishment when expanding (A whole extra heart! Rather than just a slightly longer bar (or worse, no change))
Hearts grow to take up a lot of screen real-estate, while health bars can stay compact
Health bars allow for really fine control over health/damage balancing (using float rather than int)

Since I haven't been able to find any relevant game design articles on the subject, I'd really appreciate if everyone with some knowledge on the matter, or even just some insightful links would contribute, thanks!

sentences:
Sprite Sheet Texture not being rendered I'm making space invaders (in OpenGL/SDL) and I've run into a problem
when trying to draw the sprite for the spaceship from the spritesheet.
In my entity class, I have a pointer for the sprite that belongs to the current instance of the object. In main, I make an instance on the heap of the
sheetSprite, passing in the u,v,width, and height of the sprite for
the parameters and then storing this reference in the mySprite field
of the spaceship entity.

The coordinates provided by the texture atlas are:                      <SubTexture name="playerShip2_green.png" x="112" y="866" width="112" height="75"/>

To draw the spaceship, I call the draw method from its "mySprite"
attribute. For some reason, only a white square is being rendered
without the actual texture. What could be causing the problem? The relevant code is below:

class SheetSprite {
public:

    SheetSprite(unsigned int textureID, float u, float v, float width, float height, float size, ShaderProgram program)
        :textureID(textureID), u(u), v(v), width(width), height(height), size(size), program(program) {}

    void Draw() {
        //glBindTexture(GL_TEXTURE_2D, textureID);
        glUseProgram(program.programID);
        GLfloat texCoords[] = {
            u, v + height,
            u + width, v,
            u, v,
            u + width, v,
            u, v + height,
            u + width, v + height
        };
        float aspect = width / height;
        float vertices[] = {
            -0.5f * size * aspect, -0.5f * size,
            0.5f * size * aspect, 0.5f * size,
            -0.5f * size * aspect, 0.5f * size,
            0.5f * size * aspect, 0.5f * size,
            -0.5f * size * aspect, -0.5f * size ,
            0.5f * size * aspect, -0.5f * size };
        glBindTexture(GL_TEXTURE_2D, textureID);
        //float vertices2[] = { -0.5, -0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5 };
        glVertexAttribPointer(program.positionAttribute, 2, GL_FLOAT, false, 0, vertices);
        glEnableVertexAttribArray(program.positionAttribute);
        //float texCoords2[] = { 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0 };
        glVertexAttribPointer(program.texCoordAttribute, 2, GL_FLOAT, false, 0, texCoords);
        glEnableVertexAttribArray(program.texCoordAttribute);
        glDrawArrays(GL_TRIANGLES, 0, 6);
        glDisableVertexAttribArray(program.positionAttribute);
        glDisableVertexAttribArray(program.texCoordAttribute);
    }
    float size;
    unsigned int textureID;
    float u;
    float v;
    float width;
    float height;
    ShaderProgram program;
};

class Entity {

public:
    Matrix modelMatrix, projectionMatrix, viewMatrix;
    float width, height = 1.0;
    float xDir, yDir = 0.0;
    float posX, posY = 0.0;
    float objSpeed = 0.0;
    float rotState = 0.0;
    float u, v, spr_width, spr_hght, spr_size = 0.0;
    unsigned int textureID;
    ShaderProgram program;
    //GLuint spriteSheetTexture = LoadTexture("sheet.png");
    SheetSprite* mySprite;

    Entity(float wid, float hght, float xDirect, float yDirect,
        float xPosition, float yPosition, float speed, float rState, ShaderProgram program) : width(wid), height(hght),
        xDir(xDirect), yDir(yDirect), posX(xPosition), posY(yPosition), objSpeed(speed), rotState(rState), program(program) {}

//Extra methods
};

//instantiation of sheetSprite in main

Entity spaceship(0.1f, 0.7f, 1.0f, 1.0f, -5.1f, 0.0f, 3.0f, 0.0f, program);
    spaceship.objSpeed = 10;

    GLuint spriteSheetTexture = LoadTexture("sheet.png");
    spaceship.mySprite = new SheetSprite(spriteSheetTexture, 112.0f / 1024.0f, 866.0f / 1024.0f, 112.0f / 1024.0f, 75.0f / 1024.0f, 0.7, program);

//in the game loop

spaceship.mySprite->Draw();

sentences:
Put a coroutine on potentially infinite loop I have several coroutines always running.

I want to put these coroutines on hold as I set the game to pause mode.

Consider the content of these coroutines as follows

while (timeleft > 0)
        {
            if (pause)
            {
                continue;
            }
            ...
            timeleft -= Time.FixedDeltaTime;
            yield return null;
        }

I thought that would be okay to insert the if(pause) clause to have the coroutines to wait while pause is up.

What, insted happens is that (I guess) these infinite loops make unity not responding so that I have to kill the process.

Can I be right in thinking that the system does not like coroutines to be in a potential infinite loop? Or that is just okay and I have to heavily debug somewhere else?

sentences:
Are dice-rolls for damage calculation bad design for a tactic focused game? I'm trying to come up with a combat system for a turn-based RPG that is inspired by pen & paper RPGs, but with more importance on positioning and strategy.

I feel like in games where a good strategy is important, a dice roll for damage calculation like in Dungeons & Dragons, etc is really bad, because your best strategy can and (eventually) will be ruined by a bad roll or a very good roll of the enemy.

The two most obvious solutions to prevent the player from this frustration are to do a fixed damage calculation without dice or to reduce the impact of the dice rolls, but they both just don't feel right.

So is it considered bad design to do a dice-based calculation model or is there a better approach to combine those two key features?

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:
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:
Collision detection with multiple polygons simultaneously I've written a collision system which detects/resolves collisions between a rectangular player and a convex polygon world using the Separating Axis Theorem. This scheme works fine when the player is colliding with a single polygon, but when I try to create a level made up of combinations of these shapes, the player gets "stuck" between shapes when trying to move from one polygon to the other.

The reason for this seems to be that collisions are detected after the player has been pushed through the shape by its movement or gravity. When the system resolves the collision, it resolves them in an order that doesn't make sense (for example, when the player is moving from one flat rectangle to another, gravity pushes them below the ground, but the collision with the left hand side of the second block is resolved before the collision with the top of the block, meaning the player is pushed back left before being pushed back up).

Other similar posts have resolved this problem by having a strict rule on which axes to resolve first. For example, always resolve the collision on the y axis, then if the object is still colliding with things, resolve on the x axis. This solution only works in the case of a completely axis oriented box world, and doesn't solve the problem if the player is stuck moving along a series of angled shapes or sliding down a wall.

Does any one have any ideas of how I could alter my collision system to prevent these situations from happening?

sentences:
How do game developers make their game available for most of the resolutions? I'm developing a game with Java using Slick2D and I want to make a game that could target all the recommended resolutions, as you can see in almost every game you could have an option of changing the resolution. I would like to know how game developers make their game assets once and use different screen resolutions and it still looks good.

My only guess is that when you're in game (playing-moving, jumping) the viewport of the camera is set to some size at the same aspect ratio of the player's monitor.

How do game developers do this? Not just in-game, even when just browsing the menu.

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 to design a Skill/Monster/Item etc. dictionary for a game? I am trying to build a turn-based RPG where party members and enemies can cast skills and use items. How could I implement a modular list of skills/items/monsters (and maybe character classes, if I get there) so that each PartyMember or Enemy could choose a skill/item from the list and cast it?

My first attempt was this:

public static Dictionary<int, Skill> SkillDictionary = new Dictionary<int, Skill>
{
    {1, new Skill1()},
    {2, new Skill2()},
    {3, new Skill3()},
};
public abstract class Skill
{
    int skillIndex;
    public abstract void CastSkill();
}
public class Skill1 : Skill
{
    public Skill1(){skillIndex = 1;}
    public override void CastSkill(){};
}
public class Skill2 : Skill
{
    public Skill2(){skillIndex = 2;}
    public override void CastSkill(){};
}
public class Skill3 : Skill
{
    public Skill3(){skillIndex = 3;}
    public override void CastSkill(){};
}

As my code currently stands, each skill is instantiated only once, before Main (due to the dictionary being static). Is there a way to do lazy loading so I won't have to instantiate the skill until called? Is lazy loading favorable to what I have so far? (in case I get to the point where I have LOTS of items, monsters, etc.) Furthermore, suppose I were to make a MonsterDictionary. Then would it be wise to call a Clone method in order to make a new instance of a monster? Perhaps:

public Monster
{
   string name;
   int otherStats;
   public Monster(Monster clone)
   {
      this.name = clone.name;
      this.otherStats = clone.otherStats;
   }
}

And to create a new instance of the monster in battle, for example:

Enemy e = new Monster(MonsterDictionary["Slime"]);

Or - the golden question - is there a better design pattern altogether? Would an Enum be adequate instead of a dictionary in some of these cases? I'm relatively new to C# and game development, so I would like some feedback if possible. I'm curious to see how others organized their game data.

sentences:
Jitters in collision reaction I'm working on a project for school and I'm having some trouble solving a bug.
When the player collides with a rectangle the sprite/hitbox keeps jittering while the player has momentum in the direction.

I'm guessing that the reaction sometimes moves it so that they are right next to each other and sometimes it makes it so that there is a 1 pixel space between. Is this because I'm using float and it sometimes rounds up? If so what is a good way to solve it?

The order it happens in gameloop is:

Update player position
Check collision (move if there is one)
draw player to window

The code I use for collision detection and reaction is:

void Collider::collisionTest(Player &player, sf::RectangleShape &rec2, float push) {
    float intersectX;
    float intersectY;
    float deltaX;
    float deltaY;

    if(AABBCollision(player.getHitbox(),rec2, intersectX, intersectY, deltaX, deltaY))
    {
        push = std::min(std::max(push,0.0f), 1.0f);

        if(intersectX > intersectY){
            if (deltaX > 0.0f){
                player.playerMoveCollision(intersectX * (1.0f - push), 0.0f);
                rec2.move(-intersectX * push, 0.0f);
            }else
            {
                player.playerMoveCollision(-intersectX * (1.0f - push), 0.0f);
                rec2.move(intersectX * push, 0.0f);
            }
        }else{
            if (deltaY > 0.0f){
                player.playerMoveCollision(0.0f,intersectY * (1.0f - push));
                rec2.move(-intersectY * push, 0.0f);
                player.setIsJumping(false);

            }else
            {
                player.playerMoveCollision(0.0f,-intersectY * (1.0f - push));
                rec2.move(0.0f, intersectY * push);

            }
        }

    };

}

bool Collider::AABBCollision(sf::RectangleShape& rec1, sf::RectangleShape& rec2, float& intersectX,float& intersectY,float& deltaX,float& deltaY) {
    sf::Vector2f rec1Position = rec1.getPosition();
    sf::Vector2f rec1HalfSize = rec1.getSize() * 0.5f;
    sf::Vector2f rec2Position = rec2.getPosition();
    sf::Vector2f rec2HalfSize = rec2.getSize() * 0.5f;

    deltaX = rec2Position.x - rec1Position.x;
    deltaY = rec2Position.y - rec1Position.y;
    intersectX = abs(deltaX) - (rec2HalfSize.x + rec1HalfSize.x);
    intersectY = abs(deltaY) - (rec2HalfSize.y + rec1HalfSize.y);

    if (intersectX < 0.0f && intersectY < 0.0f){
        return true;
    }
    return false;
}

Edit:

So i kinda solved it in whats probably a bad way.

The problem was using abs(deltaX/deltaY) as i shaved off the decimal point of the float.

What i did to solve it was:

intersectX = abs(deltaX) - (rec2HalfSize.x + rec1HalfSize.x);
intersectY = abs(deltaY) - (rec2HalfSize.y + rec1HalfSize.y);

into

if(deltaX < 0)
{
    intersectX = (deltaX * -1) - (rec2HalfSize.x + rec1HalfSize.x);
}else
{
    intersectX = deltaX - (rec2HalfSize.x + rec1HalfSize.x);
}

if(deltaY < 0)
{
    intersectY = (deltaY * -1) - (rec2HalfSize.y + rec1HalfSize.y);
}else
{
    intersectY = deltaY - (rec2HalfSize.y + rec1HalfSize.y);
}

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:
Physics not working when game is running on device Unity I have my bouncing ball game. The ball bounces up when it hits the ground and when it hits the left wall it changes direction to right and when it hits the right wall it changes direction to left and continues to bounce. Now the problem is that sometimes physics system does not register the collision between the ball and left/right wall, so the ball just passes through them and goes out of play, I have no idea whats going on. I will attach two pictures, one from game view and other from scene view.

Again I say everything works great, the ball bounces and hits the wall then changes the direction but sometimes the collision between a wall and a ball is not registered and the ball just passes through the wall like there is no physics and goes out of camera view.

sentences:
Command Ordering Architecture of Dwarf Fortress What is the most elegant way to implement a command ordering system for AI? for example in dwarf fortress when you mark a forested area for wood cutting, the dwarfs then would do the following sequence:

Go to the tree
Chop the tree
Deliver wood to the stockpile
Go to another tree
and so on..

I already have a stack command working no. 1 which goes from idle state to reaching the destination tile of the tree.

What I'm afraid of is how this would get messy when I create more orders like this:

Build a house

Go to stockpile
bring wood to construction area
go back to stockpile
Bring stone to construction area
animate building sprite

Planting

Go to stockpile
bring seed to farm plot

Brewing

Go to stockpile
Bring plant to still
animate brewing sprite

So my question is, how do I implement a command ordering system like dwarf fortress and avoiding spaghetti code at the same time? are there any data structures that I need to study? Do I need to put the command sequence on a separate xml file?

sentences:
How to make a snake game where each snake tile follows it's connected tile I want to make a basic snake game. It has a head and a series of tails that occupy a tile in a grid. The first tail in the series is adjacent to the head. and each tail that comes after is adjacent to the previous tail. Head can move in four directions and the first tail moves to head's previous position, and each other tail moves to the previous position of the previous tail, as they follow each other.
How can I model this as data, and update it for movement.
I've tried this but that's a little doesn't work.
p = {
  x=0,
  y=0,
  tails={}
}

function init_tail(dx,dy)
   return {
      x=0,
      y=0,
      dx=dx,
      dy=dy
   }
end
-- Initialization
add(p.tails, init_tail(0,1))
add(p.tails, init_tail(0,1))
add(p.tails, init_tail(0,1))

local last = p
for tail in all(p.tails) do
   local tx = last.x + tail.dx
   local ty = last.y + tail.dy
   tail.x = tx
   tail.y = ty
   last = tail
end
-- Movement
local last = p
for tail in all(p.tails) do
   tail.dx = -last.dx
   tail.dy = -last.dy
   local tx = last.x + last.dx + tail.dx
   local ty = last.y + last.dy + tail.dy
   tail.x = tx
   tail.y = ty
   last = tail
end

This is what I have so far:

sentences:
How to determine what difficulty is right for the game? I am targeting mass casual audience as I am developing the hyper-casual game. The problem is that I have played Helix Jump and Color Bump 3d and those games have a pretty big difference in difficulty level (well at least for me). They are both considered hyper-casual, both target mass casual audience and both have market success.

If two so similar games have such decent difference in difficulty how to determine that the difficulty of my game is just right? It's easy to say that it's subjective but when you invest so much time in your project you need to have at least some benchmark to work with. How to define this benchmark?

sentences:
Structure gameobjects and call events I'm working on a 2D tile based game in which the player interacts with other game objects (chests, AI, Doors, Houses etc...). The entire map will be stored in a file which I can read. When loading the tilemap, it will find any tile with the ID that represents a gameobject and store it in a hashmap (right data structure I think?).

    private static HashMap<Integer, Class<GameObject>> gameObjects = new HashMap<Integer, Class<GameObject>>();

How exactly would I go about calling, and checking for events? I figure that I would just call the update, render and input methods of each gameobject using the hashmap.

Should I got towards a Minecraft/Bukkit approach (sorry only example I can think of), where the user registers an event, and it gets called whenever that event happens.

Or should I just loop through the entire hashmap looking for an event that fits?

I'm using Java and LWJGL.

Thanks waco

sentences:
XNA Required information to represent 2D Sprite graphically I was thinking about dividing my game engine into 2 threads: render thread and update thread (I can't come up on how to divide update thread from physic thread at the moment).

That said, I have to duplicate all Sprite informations, what do I really need to represents a 2D Sprite graphically?

Here are my ideas (I'll mark with ? things that I'm not sure):

Vector2 Position
float Rotation ?
Vector2 Pivot ?
Rectangle TextureRectangle
Texture2D Texture
Vector2 ImageOrigin ? (is it tracked somewhere else?)

If you have any suggestion about using different types for datas, it's appreciated

Last part of the question: isn't this a lot of data to copy in a buffer?what should I really copy in the buffer?I'm following this tutorial:

http://www.sgtconker.com/2009/11/article-multi-threading-your-xna/3/

Thanks

UPDATE 1:

Newer values at the moment:

Vector2 Position
float Rotation
Vector2 Pivot
Rectangle TextureRectangle
Texture2D Texture
Color Color
byte Facing (can be left or right, I'll do it with an enum)

I re-read the tutorial, what I was doing wrong is not that I need to pass all those values, I need to pass only changed values as messages.

UPDATE 2:

Vector2 Position
float Rotation
Vector2 Pivot
Rectangle TextureRectangle
Texture2D Texture
Color Color
bool Flip
uint DrawOrder
Vector2 Scale
bool Visible ?

Mhhh, should Visibile be included?

sentences:
How to target specific material with Unity VideoPlayer? I've modeled the following tv-monitor:

This monitor has two materials. The "frame" that makes up the monitor, called MonitorFrameMaterial and the black screen material, called MonitorScreenMaterial.

I've added the Video Player to the monitor and would like to play a video "on the screen material".
Here's a screenshot of the inspector:

I've already searched the web for some time to find an answer, but I can't seem to find a way to play the video on the screen. Whenever I add a video now, it actually targets the monitor-frame (probably because it's the first material?).

Is there any way to change this, and if yes, how?
Thanks!

sentences:
How should I store a city map on disk? I'm working on a game where players travel in a city.

This city is defined by streets (names, positions...), points of interest (cinemas, restaurants...) and different zones (high criminality zones, rich zones, poor zones...). I still don't know if this city will be based on a real one (using OpenStreet map data) or made by game designers. In either case, I need to be able to modify the map data (add a cinema here, move a restaurant there...).

I also want to be able to search it for stuff like "Where is the closest restaurant?" or "How long would it take to travel to that street?".

How should I best store such information on disk, to be loaded or modified later?

(I'm working with Unity, but this isn't a Unity-specific question.)

sentences:
Unity 2019.2.5: Convert Mouse Rotate/Pan/Zoom camera to touch I have a Unity C# script that uses the mouse to rotate/pan/zoom a camera around a scene with a main focal point (PC Build). It works very well for me, but I need to convert it for a kiosk touch screen (windows Surface Pro) and have had no luck modifying the script or finding answers. Would some kind soul please save me from this hell!

My current working mouse script is below.

Any assistance is GREATLY appreciated!

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

public class MouseOrbit : MonoBehaviour {
    public Transform target;
    public float maxOffsetDistance = 2000f;
    public float orbitSpeed = 15f;
    public float panSpeed = .5f;
    public float zoomSpeed = 10f;
    private Vector3 targetOffset = Vector3.zero;
    private Vector3 targetPosition;

    // Use this for initialization
    void Start() {
        if (target != null) transform.LookAt(target);
    }

    void Update() {
        targetPosition = target.position + targetOffset;

        if (target != null) {
            targetPosition = target.position + targetOffset;

            // Left Mouse to Orbit
            if (Input.GetMouseButton(0)) {
                transform.RotateAround(targetPosition, Vector3.up, Input.GetAxis("Mouse X") * orbitSpeed);
                float pitchAngle = Vector3.Angle(Vector3.up, transform.forward);
                float pitchDelta = -Input.GetAxis("Mouse Y") * orbitSpeed;
                float newAngle = Mathf.Clamp(pitchAngle + pitchDelta, 0f, 180f);
                pitchDelta = newAngle - pitchAngle;
                transform.RotateAround(targetPosition, transform.right, pitchDelta);
            }
            // Right Mouse To Pan
            if (Input.GetMouseButton(1)) {
                Vector3 offset = transform.right * -Input.GetAxis("Mouse X") * panSpeed + transform.up * -Input.GetAxis("Mouse Y") * panSpeed;
                Vector3 newTargetOffset = Vector3.ClampMagnitude(targetOffset + offset, maxOffsetDistance);
                transform.position += newTargetOffset - targetOffset;
                targetOffset = newTargetOffset;
            }

            // Scroll to Zoom
            transform.position += transform.forward * Input.GetAxis("Mouse ScrollWheel") * zoomSpeed;

        }
    }
}// CLASS ```

sentences:
Look rotation viewing vector is zero in Unity when making UI How can I tackle the problem: Look rotation viewing vector is zero?

Here is how I get it:

I add an Image from UI.
When the Image is added I click on it in the Hierarchy view.
When focus is on an Image I take the Canvas border and move it left.
I get the Exception.

Here are some screenshots of the process which takes place:

In the last screenshot I selected the Canvas and tried to focus on it by pressing F in the Scene view. As you can see I am not able to resize the canvas anymore. That means that I would have to create a new Canvas and copy everything into it, which is pretty tiresome and error prone. That is a reason I am concerned with the Exception. Will appreciate any attention.

sentences:
Drag Gestures - fractional delta values I have an issue with objects moving roughly twice as far as expected when dragging them.

I am comparing my application to the standard TouchGestureSample sample from MSDN.

For some reason in my application gesture samples have fractional positions and deltas.

Both are using same Microsoft.Xna.Framework.Input.Touch.dll, v4.0.30319.

I am running both apps using standard Windows Phone Emulator.

I am setting my break point immediately after this line of code in a simple Update method:

GestureSample gesture = TouchPanel.ReadGesture();

Typical values in my app:

Delta = {X:-13.56522 Y:4.166667}
Position = {X:184.6956 Y:417.7083}

Typical values in sample app:

Delta = {X:7 Y:16}
Position = {X:497 Y:244}

Have anyone seen this issue? Does anyone have any suggestions?

Thank you.

sentences:
Irrlicht engine game wont compile on linux. Undefined refrences(opengl and xfree) I'm trying to port over my game I'm developing to Linux. But when i compile i get a lot of undefined references to mostly functions that look like they belong to OpenGL. Most are titled gl...  But one of them is called XFree.

I compiled it with this command:

g++ main.cpp -L../../../LIB/irrlicht-1.8.3/lib/Linux/ -lIrrlicht -I../../../LIB/irrlicht-1.8.3/include/

one of the errors:

/home/owner/LIB/irrlicht-1.8.3/source/Irrlicht/COpenGLDriver.cpp:3746: undefined reference to `glVertex3f

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: How do you implement input handling in a C game engine? I am starting to learn C programming, though I have a lot of experience using higher-level languages. I want to write a game engine using C and OpenGL. I think I understand the graphics rendering part, but now I'm curious about how to receive and process keyboard, mouse and controller input. How does one implement this sort of thing in C?

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 there an equation to determine when to invoke extrapolation in response to lag? I've implemented interpolation to smooth character drawing in my networked game.  But now I want to fall back on extrapolation if too much time has passed from a user sending an update and the interpolation buffer has been used up.

I'm just wondering if there is an equation that suites the following :

If it has been X since this user's last update, extrapolate the user position using the current time.

That determines the optimal amount of time for X.

I could try lots of different things like "we have surpassed the standard deviation of the last 100 moves + a constant", but I'm convinced there has to be an optimal strategy for deciding when we need to extrapolate.  Surely this is a solved problem, is my thinking.

I've searched thoroughly but have found nothing.  Also, for reference, I'm interpolating and extrapolating on the client.

sentences:
Animated dice framework for XNA? I'm looking for a reusable 3d animated dice component I can reuse in my XNA board game.

I know it might be wishful thinking in hoping such a component exists, but at the same time worthwhile checking.

I'm looking for something that can give a realistic dice animation and return the dice result that matches the animation.

Does such a thing exist?

sentences:
Retrieving shared video memory using SharpDX I am trying to retrieve the total available video memory using SharpDX via DXGI, using the Description of the best available adapter.

The DedicatedVideoMemory is correct (1GB in my case), but the SharedSystemMemory value is wrong - and in fact is a negative number (-1073549312, in case that's of interest). The correct value should be 3072MB, as reported by my system information and when running the Microsoft VideoMemory_2012 example application (which also queries DXGI).

Any ideas what might be going on? Or is there another way to get this information using SharpDX? I need to scale some textures according to the available resources, and I need to know the shared component as well as the dedicated.

sentences:
Input Handling and Game loop So, I intercept the WM_KEYDOWN and other messages.

Thing is, my game can't/shouldn't react to these messages just yet, since my game might be currently drawing to the screen or in the middle of updating my game entities.
So the idea is to keep a keyboardstate and mousestate, which is updated by the part of my code that intercepts the windows messages. These states just keep track of which keys/buttons are currently pressed.
Then, at the start of my game's update function, I access these keyboard and mouse states and my game reacts to the user input.

Now, which is the best way to access these states? I assume that windows messages can be sent whenever, so the keyboard/mouse states are constantly being edited. Accessing say a list of currently pressed keys in the keyboard state the same time another part of the code is editing the list would cause problems.

Should I make a deep copy of a state and act on that?
How would I deal with the garbage generated though, this would take place every frame.

sentences:
C# - console application, array problem I have problem in very simple console app, code looks like this.

int x - player moving and changing axis "x" and I want make full history of moving via array. See code(only example) below...

Thank you for your help and answer

  int round = 0;

  while(infinity){

  int[] PosXSave = new int[round + 1]; //theoretically infinity size of arrray.

  PosXSave[round] = x; //every round i want save current value of x, but
                       //only last save have propertly value and rest are
                       //zero or other number

  round++

  }

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:
Easing towards stepped value I'm currently developing this rhythm game in lua (on top of a c++ engine) and I'm having trouble keeping a steady playhead position for the song currently playing.

The playhead position that the engine gives me updates in steps, so I get a fresh one every 2, 3 or 4 frames. But I need to have a steady one for sprites moving smoothly with the rhythm and stuff.

So I just keep track of my own playhead variable, which I initialize in 0 and then constantly add delta time to it. This variable eventually gets out of sync with the actual playhead, so every time I get a fresh playhead (or a "new step"), I correct my variable using the average between these two.

This however results in choppy movement.

I've seen many easing functions out there but I'm not sure which one would work in this case, nor when should I call it.

What would be the best way to ease my playhead variable into the stepped one?

This is the code I excecute every frame:

-- add delta to my own playhead variable

playhead = playhead + delta_time

-- if there's a new stepped_playhead value, correct my playhead

if stepped_playhead ~= last_stepped_playhead then
    playhead = (playhead + stepped_playhead) / 2
    last_stepped_playhead = stepped_playhead
end

sentences: AngelCode's Bmfont about widths In AngelCode's Bmfont is there a way to make it so that all of the widths are equal?

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:
Problem with alleg42.dll / program crashes / Allegro & Codeblocks I'm having a serious problem with allegro. The program should display random pixels on the screen and when I build and run it I get the following error message:

Below is the full code of my program:

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "allegro.h"

#define Text_Color_Red makecol(255,0,0)
int main()
{
    int ret;
    int color_depth = 32;
    int x;
    int y;
    int red;
    int green;
    int blue;
    int color;

    //init allegro
    allegro_init();

    //install keyboard
    install_keyboard();

    //set color depth to 32 bits
    set_color_depth(color_depth);

    //init random seed
    srand(time(NULL));

    //init video mode to 640 x 480
    ret = set_gfx_mode(GFX_AUTODETECT_WINDOWED,640,480,0,0);

    if(ret !=0)
    {
        allegro_message(allegro_error);
        return 1;
    }

    //Display string
    textprintf(screen,font,0,0,10,0,Text_Color_Red,"Screen Resolution is: %dx%d -- Press ESC to quit !",SCREEN_W,SCREEN_H);

    //display pixels until ESC key is pressed
   //wait for keypress
    while(!key[KEY_ESC])
    {
        //set a random location
        x = 10 + rand() % (SCREEN_W-20);
        y = 10 + rand() % (SCREEN_H-20);
        //set a random color
        red = rand() % 255;
        green = rand() % 255;
        blue = rand() % 255;
        color = makecol(red,green,blue);
        //draw the pixel
        putpixel(screen, x, y, color);
    }

    //quit allegro
    allegro_exit();
}

END_OF_MAIN()

Error message: AllegroPixels1.exe has encountered a problem and needs to close.  We are sorry for the inconvenience.

Error signature: AppName: allegropixels1.exe    AppVer: 0.0.0.0    ModName: alleg42.dll
ModVer: 4.2.3.0    Offset: 0006c05c

I am using Windows XP inside a virtual machine under Parallels 7.0

sentences:
Conversation tree and question locking/unlocking I have been having issues with managing a conversation tree. I am using PAWN as a scripting language (I have no other options, unfortunately) and I use MySQL databases to store user and game data.

My current issue is storing game conversation trees using SQL. Currently, I have the following table:

TABLE NAME: dialogue
ID: global ID of conversation option
Prompt: question or sentence shown on player's screen
Answer: NPC's answer
[some other stuff related to conditions and mood checks, etc.]

Now, my problem is the following. Suppose I greet the NPC, this would be something like this:

ID: 1
Prompt: Hello there.
Answer: Hi, how's it going?

I want my conversation tree to progress after the player greets the NPC. This is not problematic, I simply use an additional SQL table for that:

TABLE NAME: dialoge_unlock_lock
ID: global ID of dialogue element
Unlocks: option this element unlocks
Locks: option this element locks.

My problem is the following: suppose I greeted the NPC, this would unlock 5 conversation options for the player to choose from (they would have IDs 2-6 for this NPC, and perhaps 241-245 for another NPC). I choose question #2, this would unlock question #8 and lock question #7.

How could I check what questions the player has locked in the current dialogue tree? In this example, I don't want the player to just see question #8, but I want him to see every question that is currently available to him (that is, questions 2-6 & 8).

I have been sitting on this for days and I can't figure out a way to do it. This pretty much sums up my attempts, any help would be greatly appreciated.

sentences:
How can I prevent cheating in a distributed multiplayer game? A problem I've been thinking about recently is how it might be possible to create a multiplayer game without a centralised game server.

Is it possible to distribute "server" responsibilities across players? I feel like it would be too easy for modified/hacked clients to change the multiplayer experience, are there any ways around this?

sentences: 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:
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: Box2D: Making it Determinsitic? From articles on the web, I found that floating point math generally has accuracy of at least 6 digits. With this in mind, is it possible to make Box2D which uses floats fully deterministic through the use of heavy rounding (i.e. 1st or 2nd decimal place)?

sentences: Should I learn OpenGL 1.5? I want to start learning OpenGL with a book I have since a long time ago (Beginning openGL Game Programming) and it uses OpenGL 1.5 so my question is, should I learn OpenGL using this book and then learn a higher version? or should I start learning a higher version at once? are the same core concepts applied to higher versions?

sentences:
Lasers in 3D space game I am creating this little 3d space shooter and am somewhat unsure on how to implement the laser beams.

I'm thinking about something along Star Wars and the like where mostly you shoot rather short laser beams but very many of those.

Should I create a "tube" for each of the beams, render them via instancing and give them a better look just with the shader?

How would you go on about this? I was rather perplexed that there was no good tutorial on this matter out there.

sentences:
How do I show the current view from the viewport on my map? I'm doing HTML5 Canvas development and currently have a large viewport (on the left) and a map (on the right). Like this:

I need to show on the map what is currently being viewed in the left. And I'm at a lost on how to calculate this. This is how I want it to be:

I am manipulating the main viewport via a transformation matrix. like [1, 0, 0, 1, 0, 0]

This is decently common functionality in different games and apps. So I assume there are resources on how to do it. But I haven't been able to find any.

sentences:
Blending Two different animations I'm sure there are articles around on this but I'm not really sure what they are called.

animation blending tends to give me the blend between two different complete animation such as walk and run.

what I'm after is having a player with that has a walk/jump animation and a firing gun animation. Is this still animation blending?

Can anybody enlighten me to how this process could be achieved?

sentences:
Rotate entity to match current velocity I have an entity in 2D space moving around, lerping between waypoints. I would like to make the entity rotate around its own origin to face the current direction that it is going, I.E. towards the next waypoint in the list.

In case the waypoint movement code is needed, I'm using the following (this is contained inside of the entity that is following the waypoints) :

    private void GoToWaypoint() {
        if (waypointList.Count > 0) {
            Vector2 origin = helper.GetOrigin(position, width, height);
            int nodeWidth = 50;
            int nodeHeight = 50;

            if (moveToPosition != waypointList[0]) {
                moveToPosition = waypointList[0];
                moveToPositionOrigin = helper.GetOrigin(moveToPosition, nodeWidth, nodeHeight);
                distanceToPosition = moveToPositionOrigin - origin;
            }

            if ((Math.Ceiling(distanceToPosition.X) < 0)) {
                position.X -= moveSpeed;
                distanceToPosition.X = (int)Math.Round(distanceToPosition.X + moveSpeed);
            }
            else if ((Math.Floor(distanceToPosition.X) > 0)) {
                position.X += moveSpeed;
                distanceToPosition.X = (int)Math.Round(distanceToPosition.X - moveSpeed);
            }

            if (Math.Ceiling(distanceToPosition.Y) < 0) {
                // Check if the entity moves below the top boundary
                if (position.Y > 0) {
                    position.Y -= moveSpeed;
                    distanceToPosition.Y = (int)Math.Round(distanceToPosition.Y + moveSpeed);
                }
                else {
                    distanceToPosition.Y = 0;
                }
            }
            else if (Math.Floor(distanceToPosition.Y) > 0) {
                // Check if the entity moves below the bottom boundary
                if (position.Y < 550) {
                    position.Y += moveSpeed;
                    distanceToPosition.Y = (int)Math.Round(distanceToPosition.Y - moveSpeed);
                }
                else {
                    distanceToPosition.Y = 0;
                }
            }

            // If the entity gets in the waypoint, or the distance to the waypoint is 0 on both axis (which can occur due to screen boundaries)
            if ((helper.InNode(position, moveToPosition, width, height, nodeWidth, nodeHeight)) || ((distanceToPosition.X == 0) && (distanceToPosition.Y == 0))) {
                waypointList.RemoveAt(0);
            }
        }
    }

I know this may have been asked elsewhere, and the bit of searching that I did on this type of problem, didn't really help me. I'm slightly math retarded, so I don't understand the explanations that don't really explain what the math is exactly achieving. So any help that breaks down the math and functions needed to achieve this would be greatly appreciated.

Thanks.

sentences:
How To Deselect (Unfocus) All gameObjects in a Unity Scene View? When I'm done with moving and rotating gameObjects in a Unity scene, I want to deselect everything to not accidentally change it. How?

In some applications ESC key does the trick, in others 'D' (deselect) comes to rescue. But I don't know any remedy in Unity. My workaround is that I click somewhere in the Project View (I don't like this approach because it brings up the inspector for that asset).

sentences:
Splitting a large number of FLAs into multiple gifs I currently have a large number (300 or so) FLAs that I wish to convert to GIFs for a HTML5 game I'm creating.

Each one of these FLAs contains multiple animations in the timeline, and they all have the same basic structure (Animation one in frames 1-25, animation 2 in frames 26-34, etc.)

Is there a way I could automate splitting them up and converting them into the GIFs?

I am on a Mac, but do have access to a Windows machine, so any solution will work, basically. I don't have the Windows version of Flash though, so that is annoying.

Thanks in advance, and if this the wrong StackExchange to ask in, then I apologise in advance.

sentences:
how taxes work on steam? I have been developing a game for some time thinking of distributing it on steam.

I had a question about taxes. And is that since I am not a resident of the United States, I made my tax questionnaire and I have a 10% rate for the sale of video games due to the treaty with my country.

And was I reading that every country has a tax? special? (VAT) or something like that, for example United Kingdom 20%

Which means that if I sell a game of 10 (€) I think this should happen

Scenario 1:

1 Unit Sale  ---  10.00 €
- (VAT)            1.66 €
-------------------------
Sale w/o VAT       8.33 €
- Steam 30%        2.50 €
-------------------------
S w/o Steam cut    5.83 €
- ISR USA (10%)    0.58 €
-------------------------
Sale revenue       5.25 €  (Less taxes from my country later calculated, this amount is the one deposited by steam)

Scenario 1 considers that each subtraction is made on a non-total balance

Or

Scenario 2:

The percentage is fixed on the total sale

1 Unit Sale  ---  10.00 €
- (VAT)            1.66 €
- Steam 30%        3.00 €
- ISR USA (10%)    1.00 €
-------------------------
Sale revenue       4.33 € (Less taxes from my country later calculated, this amount is the one deposited by steam)

Does anyone know how this situation is handled ?, or where could I get more information?

sentences:
share assets beetween platforms What is the good way to share assets between platforms (android, desktop, etc) ?

by default there is an assets folder in each platform folder.

sentences:
Pick Up Object disapppears I'm trying to work with picking up and throwing objects. So far I've come up with a solution which does pick up the object but the same time disappears the object also. Please check to the functionality I've used.

public class pickupobject : MonoBehaviour {
     //GameObject mainCamera;
     bool carrying;
     GameObject carriedObject;
     Camera cam;
     public float distances;
     public float smooth;

     // Use this for initialization
     void Start()
     {
         cam = GameObject.Find("MainCamera").GetComponent<Camera>();
     }

     // Update is called once per frame
     void Update () {
         if(carrying)
         {
             carry(carriedObject);
         }
         else
         {
             pickup();
         }

     }

     private void pickup()
     {
         if(Input.GetKeyDown(KeyCode.E))
         {
             int x = Screen.width / 2;
             int y = Screen.height / 2;
             Ray ray = cam.ScreenPointToRay(new Vector3(x, y));
             RaycastHit hit;
             if(Physics.Raycast(ray, out hit))
             {
                 pickupable p = hit.collider.GetComponent<pickupable>();
                 if(p!=null)
                 {
                     carrying = true;
                     carriedObject = p.gameObject;
                 }
             }
         }
     }

     void carry(GameObject o)
     {
         o.GetComponent<Rigidbody>().isKinematic = true;
         o.transform.position = o.transform.position + cam.transform.position + cam.transform.forward * distances;
     }
 }

sentences:
Rotating sprite around another sprite I am building a pool game, and I want to make the cue rotate around the white ball.

Here is the live code:

http://199.26.84.223/nocol.html

Here is the code for the white ball:

balls = game.add.group();
balls.enableBody = true;
balls.physicsBodyType = Phaser.Physics.P2JS;
wball = balls.create(350, 240 , 'ballW');
wball.body.setCircle(15);
wball.body.setCollisionGroup(wballCollisionGroup);
wball.body.collides([wballCollisionGroup, ballsCollisionGroup , sidesCollisionGroup , holesCollisionGroup , playerCollisionGroup]);
game.physics.p2.setImpactEvents(true);

Here is the code for the cue, which I call player:

    player = game.add.sprite( 0   , 0   , 'player');
    game.physics.p2.enable(player , true );
    player.enableBody = true;
    player.body.setCollisionGroup(playerCollisionGroup);
    player.body.setZeroVelocity();
    player.body.createBodyCallback(wball, ballHit , this);
    player.anchor.setTo(-0.5, 0.5);
    player.pivot.x = wball.x +150;
    player.pivot.y = 0;

    player.body.x = wball.x  ;
    player.body.y = 240 ;

The problem is that all pivot or anchor does is change the sprite image position. I got the cue to appear in the right place by using both pivot/anchor and it seems to work fine... the cue was rotating around the ball, but after enabling debug mode here is what I saw:

Basically only the position of the image has been changed but the sprite still rotates around the center which is the red part. If I run this code, the ball and cue are already colliding and the ball jumps around without player doing anything.

How can I rotate the cue around the ball without them colliding?

sentences:
How should I attenuate sound in a 2D game where you can zoom in and out? In my 2D game, I have some ambient sounds like the noise of a waterfall or the humming of a generator. However, it is not practical to play these sound all the time at full volume as in a large level the overlap of many of such noises would be quite unpleasant to the ear.

I am currently thinking about a system that modulates the volume of certain sounds depending on their distance to the player. However, this is partly not a great solution as (for example) in a zoomed state the player might be quite far away from the sound source (like a water fall) but still be able to see it on screen but not hear it (due to the distance) which is quite awkward.

Is there a solution for such a problem?

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: Unity - Scripting Runtime Version Option Missing I have been trying to open and run my couple-months old project in Unity3D, and I'm getting about 500 errors. So idecided to reinstall Unity. On the tutorial for the project, it tells us to make sure the "Scripting Runtime Version" is set to 4.x equivalent. Only problem for me is I cannot see such an option in Unity5.5.4p4. How can I set .NET 4.x in Unity for good?

sentences:
Assigning a colour to imorted obj. files that are being used as default material I am having a problem with assigning a colour to the different meshes that I have on one object.
The technique that I have used is the first approach on this site.
Is it possible to export a simulation (animation) from Blender to Unity?

So what I would like to do is the following.
I have about 107 meshes that are different frames from my shape key animation of my blender model.  What I would like to have is that the first mesh will be bright green and up to the  40th mesh the colour turns to be white /greyish...

the best would be if I could assign every mesh by hand a colour, however they are all default materials. And if I assign the object a colour, the whole "animation" is going to be in that colour

sentences:
How can I transfer this code (originally for FPS template) for use in a Third Person Template? I learned how to create a blueprint for making a character be able to pick up and drop objects:

It did not work, and I believe the reason is because it was originally made to work for the FPS template that Unreal comes with.  I decided to use the Third Person template, and I think that's why it's not working.
Am I correct?  What blueprint coding should I be looking at?  What's missing, or what's preventing this from working?
Thanks!

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:
Synchronize points from UI and server I am sorry in advance if it's not perfectly clear.

I would like to make a game with let's say the following map (in real it will be a 3D globe).

Now this map contain point, and each point is a place where user can build stuff.

The distance between point is very important, and also, the location of each one of them (not on water and equally distant to each others)

The problem I face, is I don't know how to sync the point with the server. explaining :

I want the point to be equally distant between each others, and only on lands. Generate them is easy from the game itself. but since the game will have a server that control what is build on each case by multiple player, I should generate them in the server. but I don't know how can I do this. since only the game itself know the map and where it can place the point.

Should I generate them in the game, than copy the amount I can fit and write it in the server like if i can fit 200points, I make the server generate 200 points with id from 0 to 200 and the UI will draw them in order ?

I need a little help to find the good direction to explore.

Thank you

sentences:
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:
How should I handle missing resources? Your game expects a certain asset to be loaded, but it isn't found. How should the situation be handled? For example:

Texture* grassTexture = LoadTexture("Grass.png"); // returns NULL; texture not found
Mesh* car             = LoadMesh("Car.obj");      // returns NULL; 3D mesh not found

It might have been accidentally deleted by the user, corrupted or misspelled while in development.

Some potential responses:

Assertions (ideally only during development)
Exit the game gracefully
Throw an exception and try to handle it.

Which way is best?

sentences:
Terrain collision detection How should I go about making terrain collision system without hightmap ?

What I have tried is building a heightmap from a blender model, but that works only if the vertices are evenly spaced. Mine are not and I am not sure how to proceed from here.

How do i store the mesh info ? Do I store a Plane object for every triangle in the mesh and then plug those in some kind of grid/quad tree etc ? Is that the best thing to do ? My terrain has around 2000 faces, wouldn't that be too much ?

sentences: Unity, positioning with ints instead of floats I round my transform.position to the nearest integer at the end of every frame so it's never a decimal number. I would like to know if there's a way to make unity store the position in ints instead of floats to prevent floating points precision problems.

sentences: Creating a large amount of sprites and animations For my AP U.S. Government and Politics class, I am making a spinoff of Mortal Kombat. Because of time constraints, I'm using an open source version of the game and want to create new characters.  I have about two weeks to do the project and can invest about 1-4 hours most days. I want it to look as nice as it can with the limited knowledge, skill, and time that I have. What programs or techniques would be best for a beginner with my time constraint?

sentences:
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:
How to represent a modular FSM for AI using ECS? I am considering to implement AI using ECS which actually contradicts working with naive FSMs. My current idea is to have multiple components which represent the particular state an Entity that has a AIControllerComponent is currently in.

Let's say an enemy starts out with the mentioned AIControllerComponent as well as a EnemyIdleComponent. Now an EnemyIdleSystem would handle all those idle enemies and if it happens that a player comes too close it'd replace the EnemyIdleComponent with an EnemyChasePlayerComponent leaving the handling of this to EnemyChasePlayerSystem.

This approach is rather generic and I would basically end up with a bunch of enemies that have the very same behaviour. I was curious to know how I should combine this approach with some more modular states. At first I thought about adding an enum variable to AIControllerComponent which holds the type of the enemy but I can't really think of a decent solution to call different implementations inside of the EnemyFooSystems based on that particular enum value. Do you have any suggestions?

// EDIT: I am using pure ECS patterns and Jobs, as such MonoBehaviours and non-blittable types inside of IComponentData are not usable.

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:
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:
Blender mesh mirroring screws up normals when importing in Unity My issue is as follows:

I've modeled a robot in Blender 2.6. It's a mech-like biped or if you prefer, it kindda looks like a chicken. Since it's symmetrical on the XZ plane, I've decided to mirror some of its parts instead of re-modeling them. Problem is, those mirrored meshes look fine in Blender (faces all show up properly and light falls on them as it should) but in Unity faces and lighting on those very same mirrored meshes is wrong. What also stumps me is the fact that even if I flip normals in Blender, I still get bad results in Unity for those meshes (though now I get different bad results than before).

Here's the details:

Here's a Blender screen shot of the robot. I've took 2 pictures and slightly rotated the camera around so the geometry in question can be clearly seen:

Now, the selected cog-wheel-like piece is the mirrored mesh obtained from mirroring the other cog-wheel on the other (far) side of the robot torso. The back-face culling is turned of here, so it's actually showing the faces as dictated by their normals. As you can see it looks ok, faces are orientated correctly and light falls on it ok (as it does on the original cog-wheel from which it was mirrored).

Now if I export this as fbx using the following settings:

and then import it into Unity, it looks all screwy:

It looks like the normals are in the wrong direction. This is already very strange, because, while in Blender, the original cog-wheel and its mirrored counter part both had normals facing one way, when importing this in Unity, the original cog-wheel still looks ok (like in Blender) but the mirrored one now has normals inverted.

First thing I've tried is to go "ok, so I'll flip normals in Blender for the mirrored cog-wheel and then it'll display ok in Unity and that's that". So I went back to Blender, flipped the normals on that mesh, so now it looks bad in Blender:

and then re-exported as fbx with the same settings as before, and re-imported into Unity. Sure enough the cog-wheel now looks ok in Unity, in the sense where the faces show up properly, but if you look closely you'll notice that light and shadows are now wrong:

Now in Unity, even though the light comes from the back of the robot, the cog-wheel in question acts as if light was coming from some-where else, its faces which should be in shadow are lit up, and those that should be lit up are dark.

Here's some things I've tried and which didn't do anything:

in Blender I tried mirroring the mesh in 2 ways: first by using the scale to -1 trick, then by using the mirroring tool (select mesh, hit crtl-m, select mirror axis), both ways yield the exact same result
in Unity I've tried playing around with the prefab import settings like "normals: import/calculate", "tangents: import/calculate"
I've also tired not exporting as fbx manually from Blender, but just dropping the .blend file in the assets folder inside the Unity project

So, my question is: is there a way to actually mirror a mesh in Blender and then have it imported in Unity so that it displays properly (as it does in Blender)? If yes, how?

Thank you, and please excuse the TL;DR style.

sentences:
How can I tell whether an object is moving CW or CCW around a connected path? Lets say we have a jagged shape:

And two creatures moving along it's outline.

Then we smooth the shape completely by pulling the corners out.

We get this:

It is easy to see now that Orange is moving CW and green CCW. How can I tell in which direction they are moving without smoothing out the shape?

New image

sentences:
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:
Unity Vector3 position inside collider I am trying to create a "wander" action that will make my NPC walk to a random position.

The catch is that the NPC should only go positions inside of a collider.

I have a huge Sphere that has a collider on it now I only want my NPC to go to positions that are inside that Sphere collider.

My question is how do i find a random position inside of a colider?

Update

So after testing i am unable to use colliders because the sphere is too big here is an image of my gameobject:

As you can see from the image I have a huge sphere that my NPC's will have to stay inside when wandering

In order to use the Collider.ClosestPoint() the collider has to be a Box, sphere or a mesh collider with a convex.

Sadly this is not feasible for me because the sphere should not collide with other objects.

So my question is how do I find a point inside this gameobject?

sentences:
How do I make a quest requiring a certain number of a specific item? I'm trying to create a quest (in RPG Maker MV) where the player has to collect 35 berries.  But when I go to create the conditional branch, this is what I see:

It does not let me add a number limit, so basically all the player has to do
is collect 1 berry to complete the quest.

How can I change this so the player has to collect 35 berries in order to complete the quest? Is this a limitation of RPG Maker MV?

sentences:
Android Game - Screen Flickers When an Entity Removed From The List I am using Canvas in my android game. When I remove a no longer displayed entity in my entity list, all other entities are flickering for a brief time. When it's not removed, there is no such problem. But since I am not a big fan of memory leaks, that's not an option.
The canvas rendering system is already double-buffered by design and I have utterly no idea how to fix such a problem.
I have thought maybe it is because the list is sorting itself after the item removal and tried changing it to a Set, but that didn't work either.
Does anyone have any idea why this might be happening and how to fix it?
Structure of the code:
private val gameObjects: List<GameObject> = mutableListOf()

    fun update(deltaTime: Long)
    {
        gameObjects.forEach {
            it.update(deltaTime)
    }

 fun render(canvas: Canvas)
    {
      gameObjects.forEach {
         when (getVisibilityStatus(it.virtualY))
         {
            VisibilityStatus.VISIBLE -> it.render(canvas, virtualToPhysicalY(it.virtualY))

            VisibilityStatus.BELOW_SCREEN ->
            {
              if (virtualToPhysicalY(it.virtualY) > screenSizePairXY.second)
                gameObjects.remove(it)

            }
         }
    }

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:
UE4 C++ Variables in my custom class change for no reason after a while I've made a class extending UObject to store player stats, and provide some static utility functions and variables.
It gets instantiated in my PlayerController:

APuzzleProjectPlayerController::APuzzleProjectPlayerController() {
    playerStats = NewObject<UPlayerStats>();
    playerStats->setStrenght(4);
    playerStats->setSpeed(1);
    playerStats->setStamina(1);
}

Everything compiles fine and the game logic works perfectly except for the fact that after a while (1 or 2 minutes of gaming) the non-static private variables change their value.

In the following code I've added some Dummy variables just to make sure that nothing was accessing/changing them during execution. They are only accessed by GEngine->AddOnScreenDebugMessage to show their value.

UCLASS()
class PUZZLEPROJECT_API UPlayerStats : public UObject
{
    GENERATED_BODY()

    // Stats Const
    static const uint8 MIN_STAT_VALUE = 1;
    static const uint8 MAX_STAT_VALUE = 7;

    // Stamina Pool Const
    static const uint8 BASE_STAMINA_POOL = 199;
    static const uint8 STAMINA_POOL_STEP = 8;
    static const uint8 STAMINA_RECOVERY_VALUE = 3;

    // Stats
    uint8 strenght = 1; // Becomes 221
    uint8 speed = 1; // Becomes 221
    uint8 stamina = 1; // Becomes 221
    uint8 staminaPool = BASE_STAMINA_POOL; // Updated by a function, still unconsistent after a while since stamina dependent

    // These are never modified by my code, but get modified after a while like the Stats variables
    uint8 dummyA = 3; // Becomes 221
    const uint8 dummyB = 4; // Becomes 221
    int dummyC = 5; // Becomes -572662307
    const int dummyD = 6; // Becomes -572662307

    public:
    enum SpeedSteps {WALK, RUN, SPRINT};
    static const float TIMER_PRECISION;
    static const uint8 MIN_STAMINA_POOL = 0;
    static const uint8 MAX_STAMINA_POOL = 255;
    static const float DELTATIME_STAMINA_RECOVERY;
    static const float DELTATIME_STAMINA_LOSS;
    static const uint8 STAMINA_RUN_LOSS = 2;
    static const uint8 STAMINA_SPRINT_LOSS = 32;

    UPlayerStats();
    uint8 getStrenght();
    uint8 getSpeed();
    uint8 getStamina();
    uint8 getStaminaPool();
    static uint8 getStaminaDelta(SpeedSteps speedStep, bool isIdle);
    void setStrenght(uint8 value);
    void setSpeed(uint8 value);
    void setStamina(uint8 value);
};

Now, I'm a bit rusty with C++ (I work as Java & PL/SQL programmer), but I really don't know what's wrong here. The variables in the other three classes I have (default third person game mode, character and custom player controller) don't seem to be affected by the same issue.

Thanks for any suggestion you might have.

sentences:
Optimised server structuration I've been wondering a lot lately about how to make an optimised server structuration, and i came to the conclusion that i severely lack knowledge on the subject.

I'll be doing this with either C, C++ or C#, with a preference for the latter.

Context:

I have a server that can operate more than 3K clients at one time.

This server is a game server, hence it only receives key inputs from the clients, for security measures.

Therefore the server is doing every operation on the user's data, and send back enough information to the client in order to display a personal GUI. (The server is of course a console application, don't get me wrong.)

Approaches:

1- 1 Client = 1 Logic Thread

(The thread does the player calculation)

Pros: every client runs his own server code, the server is more responsive to a particular client's request.

Cons: I do not have the insurance that a particular client will iterate its code 14 times while another would have iterated it 10, (so the two players, side by side, if it was for a movement operation, can become 4 squares afar, which should not be the case, as every player should move at an exact same speed)

Locking every thread to perform actions until a next logic loop happens can be quite devastating if something bad happens on any of the client, leading to severe lags in worst cases.

2- 1 Client = 1 Entry Thread, Main logic loop

(The thread receives the keys pressed by its client)

Pros: As the logic is all in the same loop, there is no desynchronization problems anymore.

Cons: Iterating ALL the game logic in one loop will most probably cause severe latency if the operations becomes advanced.

Moreover, if many clients are to catch up with all the current data being processed (sudden peak of connections), it would also cause additional latency, a partial solution would be to retrieve those datas in the Entry Thread.

3- 1 Client = 1 Entry Thread, X Logic threads, 1 Logic Thread synchronizer

(Entry thread receives keys, register the client in the concerned threads (One for each kind of action (Moving, Acquiring user data, Battle, Etc...)), Those threads gives the information whenever they can, and the Logic thread synchronizer ensures that tasks that needs to be "Ordered" in time are ordered.)

Pros: Share computation resources among all the Logic Threads, ensuring minimum latency for clients.

Cons: High vulnerability to resources concurrency, and if a particular task is done faster than another task that is to be synchronized with it, becomes as slow as the latter.

Question:

As i said earlier, i certainly lack knowledge about networking, threading, and concurrency, to efficiently order the structure of my program. Therefore, I'm asking it here:

What would be the best approach to take, and how should the global skeleton should be ordered to minimize latency, and permits a large number of synchronous users to play on the server.

Additional information

Maybe a bit of information about the idea behind this all will help.

My goal here is to create a server that will be used to run a simple RPG, which needs to have movement synchronization on the map (old school square-to-square movements), turn by turn instanciated battle (e.g. Dragon Quest, Final Fantasy, Pokemon), and exchange of user data (seeing X's profile, see how many monsters he killed, his guild, etc.)

If i'm asking for more than 3K clients at the same time, it is because i do not want to make a pile of junk that holds in place by a miracle. I want to further my knowledge on networking and its applied logic, would it be programmative logic or structuration logic.

So basically the problem is "Having a maximum of clients, on a minimally powerful server, therefore optimizing it as much as possible."

sentences:
How to know when to use UIViews and other Quartz2d features and when to use OpenGL ES? When starting a new 2d project on the iOS framework, it seems pretty to start creating UIView subclasses and having fun with Quartz to create very quick prototypes, but I am guessing there will be times where it will be impractical(or impossible) to use such powerful(and wasteful compared to openGL ES) abstractions.

I know a couple dozen subviews work allright, but there must be a point where having more than X is just impossible to keep a good frame rate.

How do you know if it would be a good idea to drop the UIKit and start doing some more powerful stuff on openGL?

sentences:
What 3D engine supports real-time editable 3D terrain loaded in from a server? I'm currently having a problem choosing an engine for a game project I have since a few years.
What I'd need is to be able to load a terrain from a remote server (which I can take care of) and display it dynamically, if possible with paging.
The terrains should also be able to be edited in realtime (locally or remotely and transmitted by the server).

I can take care of the network part but need a 3d engine flexible enough to support the terrain features detailed above.
Would you know a 3D engine which could support this ? I'd prefer programming with .NET but C++ is also fine.

sentences:
How is a moving object like a platform represented in a 2d Tilemap I'm having trouble understanding how I would implement a moving platform in the actual map file.  Lets say its a file of character's and maybe the letter 'P' would stand for Platform.  Then, how would the game know which direction it moves, how far it's suppose to move before returning, what size it is, etc...  Am I even suppose to represent it in the map file?

I'm coming from the approach of making the game handle the maps as dynamically as possible, where you could basically make a new map file and play it in the game without having to hard code any special information for that map.

sentences:
Transparent alpha mode in Shader Graph creates unwanted jagged outline I am currently working on a transparent shader and noticed that all my works have a jagged dark outline. I guess I've used the wrong settings somewhere, but I've been fiddling around with a couple settings without any success. I have created a basic shader, which shows the shader settings I use and the problem.

It might be a little hard to see on the screenshot, so please have a look in full resolution. There's a small black outline around the circle on the yellow background.

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:
Align Object With Triangle I currently am trying to figure out how rotate an object so it's aligned with a triangle along the Z Axis. I have the world matrix of the object and a triangle, which has it's 3 points and the normal. My goal is to try and get the y axis of the object to face the same as the triangle's face normal.

Currently, what I have works on normals that are facing the positive y, however if it's facing downward (<0) the the object will rotate the until it's is facing the opposite direction as the triangle's normal.

Here's what I'm doing:

compWorld.GetYAxis( axis );
result = axis.Cross( triColWith->vNormal );
compWorld.Rotate( D3DXToDegree( result.x ), 0, D3DXToDegree( result.z ) );

I would like to thank you in advance for any help you could provide me. If anything needs more explanation, feel free to ask.

sentences:
Unity move arrows along path I am not sure how to go about what might be a simple task. I want directional arrow sprites to move along a curved path in 2d to show the player when to go.

I can use DoTween to create a path. But not sure if I should Instantiate a load of sprites(arrow) and move them along. Its seems wasteful.

sentences:
How to instantiate a sprite from a sprite sheet using script in unity? We are creating a 2D top down rpg, and we have multiple textures, and we need to be able to change which sprite sheet its reading from in order to change the look of the walls and floor in each room. It has the same basic tiles just they need to look different. Like the corner of a cabin, to the corner of an office building.

At the moment we are taking the sprite sheet, splitting it up, and making prefabs out of it for placement by script in the game. Is there a way to do this automatically because we have a lot of textures, and its too many to make into prefabs.

sentences:
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:
Calculate an AABB for bone animated model I have a model that has its initial bounding box calculated by finding the maximum and minimum on the x, y and z axes. Producing a correct result like so:

The vertices are then stored in a VBO and only altered with matrices for rotation and bone animation. Currently the bounds are not updated when the model is altered. So the animated and rotated model has bounds like so:

(Maybe it's hard to tell, but the bounds are the same as before, and don't accurately represent the rotated/animated model)

So my question is, how can I calculate the bounding box using the armature matrices and rotation/translation matrices for each model? Keep in mind the modified vertex data is not available because those calculations are performed on the GPU in the shader.

The end result I want is to have an accurate AABB the represents the animated model for picking/basic collision checks.

sentences:
Unity blocked after changing Time region I reinstalled Windows then Installed Unity. Then I changed my timezone from US Pacific to Europe where I actually live. Unity got blocked: "Expired licence" even though I use the free version. https://forum.unity.com/threads/expired-license-on-free-version.90072/

If I change my timezone back to US Pacific Unity works (Took me 2 hours to figure out it was the timezone btw). I tried reinstalling Unity from scratch, didn't work. How can I change timezone back to Europe without locking up my Unity licence?

sentences:
UE4 - custom template can only start with blueprints I tried making a custom template for UE4 to help save some time during gamejams.
I follow this tutorial:
https://docs.unrealengine.com/en-US/Engine/Basics/Projects/CreatingTemplates/index.html
It works alright, even though some minor things don't work, like saving custom folder colors. But what really bothers me is this:

Normally, the options are Blueprint and CPP. I tried making a new template with a different config file, but nothing changes. Is there a way to fix it?

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:
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:
How do I make dialogue text appear with a beeping effect? I'm interested in old-school RPG dialogue boxes, where text appearing in dialogue boxes is accompanied by a subtle beeping sound. This is demonstrated in a video here.

Is this morse code translated to audio?

How can I achieve such an effect?

sentences:
Proper Line of Sight in tile based game My rendering engine currently takes "xMin, yMin, xMax, yMax" to render a rectangular region of tiles, and will automatically scale based on the size of the panel it is rendering to.

However, I am having an issue rendering based on line of sight. Currently (I know this is inefficient but it is simply the best option as of right now) I use Bresenham's line algorithm. However, that results in

As you can see, the walls invisible. How should I go about updating the algorithm to have it make the walls visible as well?

If I render tiles that end where the raytrace ended, I get

This implies that a floating point solution would be preferred.

Of note, I will accept suggestions on how to improve the rendering engine if it would make this more possible.

sentences: How to keep player rotated toward a sphere when within a certain radius? In my game the player can fly to multiple spheres, I want to make it so that when the player gets within a certain distance of the sphere, (maybe using a bigger is trigger sphere collider around it?) their feet will stay pointing towards the sphere until they leave the radius, (maybe using a quaternion?) then if they get within the radius of a different sphere, their feet will point towards that too. How can I make this work? I don't know too much about c#, so any example code would help a lot too!

sentences:
Designing PHP RPG game: Should I use multiple classes for each type of item or a single table? I'm making a text-based role playing game written in PHP.

I have a hard time figuring out how to handle items in game - there will be a few types of objects (weapon, machine, tool, building etc) each of these types will have its own stats, attributes etc, and items itself.

My initial plan was to make a interface and abstract class called Object

interface IObject
{

   public function takeObject() {};
   public function dropObject() {};
   public function examineObject() {};
   // etc
}

abstract class WeaponObject implements IObject
{
   // Some generic properties valid for this type of objects
   public $name = "";
   public $weight = 0;
   public $damage = 0;

   // etc
}

and then make another class for each item that extends the base Object

e.g

class HuntingBow extends WeaponObject
{
   //
}

But there's a problem I think. There's going to be a lot of objects in the game - and that means a lot of classes, and composer need to load them all. So I think that performance may decrease significantly?

My second idea was to make a generic table called objects

In which I would store every item. But setting up object attributes, handling stats, etc, would be a nightmare.

Is the first idea the best way to approach the problem? Is there a better way of doing thins that I don't about?

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:
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:
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:
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:
Separate rotation transform from parent I have a hierarchy like this

Body
  - Head
  - Arms

Currently this works fine in that the Body's transformation is reacting as it should. Being children, the Head and Arms match the Body's transform. Is it possible however to separate just the rotation transform? I would like the head to translate with the body but not necessarily rotate the same way.

I tried using Transform.DetachChildren but that removes the translate transform which is a bit of an issue as I move the object using physics so there's a chance the head and arms would react differently and physically separate from the body.

Thanks

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: Optimizing spawning 500 objects every 3 seconds Using Object Pooling, assuming I'll like to spawn 500 cubes once every three seconds. How do I make it performance friendly? I need ideas, not the code itself.

sentences: How are multiplayer mods created? How do you make a single player game into a multiplayer one? For example: SA-MP San Andreas Multiplayer and the new Just Cause 2 Multiplayer. Before making the mod, did they need permission? How did they even know what to code without having the games source code? I have some ideas but I have no idea where to really start.

sentences:
Bold black bar on right side of game in Unity (Android) I am trying to create an endless runner. I have already created a system to generate infinite backgrounds from an array of some. However, on running the game, I get huge black bar on the right side of the screen, both on PC and on Android phone.

Here are the screenshots :

One more thing, on Android, it doesn't even display the left side of the game, i.e, where the character is. It looks like the things are displaced towards left.

Also, the game is a scrolling on and everything is scrolling but behind that bar. It just doesn't go.

I hope I can get some help. Ask me if you need any piece of code.

EDIT :

"CameraFollow" script

 using UnityEngine;
using System.Collections;

public class CameraFollow : MonoBehaviour {

    public GameObject targetObject;
    private float distanceToTarget;

    // Use this for initialization
    void Start () {
        distanceToTarget = transform.position.x - targetObject.transform.position.x;

    }

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

        float targetObjectX = targetObject.transform.position.x;

        Vector3 newCameraPosition = transform.position;
        newCameraPosition.x = targetObjectX + distanceToTarget;
        transform.position = newCameraPosition;
    }
}

My "GeneratorScript"

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

public class GeneratorScript : MonoBehaviour {

    public GameObject[] availableRooms;

    public List<GameObject> currentRooms;

    private float screenWidthInPoints;

    // Use this for initialization
    void Start () {
        float height = 0.0f * Camera.main.orthographicSize;
        screenWidthInPoints = height * (Camera.main.targetDisplay);
    }

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

    }

    void FixedUpdate()
    {
        GenerateRoomIfRequred ();
    }

    void AddRoom(float farhtestRoomEndX)
    {
        int randomRoomIndex = Random.Range (0, availableRooms.Length);

        GameObject room = (GameObject)Instantiate (availableRooms [randomRoomIndex]);

        float roomWidth = room.transform.FindChild ("floor").localScale.x;

        float roomCenter = farhtestRoomEndX + roomWidth * 3.0f;

        room.transform.position = new Vector3 (roomCenter, 0, 0);

        currentRooms.Add (room);
    }

    void GenerateRoomIfRequred()
    {
        //1
        List<GameObject> roomsToRemove = new List<GameObject>();

        //2
        bool addRooms = true;

        //3
        float playerX = transform.position.x;

        //4
        float removeRoomX = playerX - screenWidthInPoints;

        //5
        float addRoomX = playerX + screenWidthInPoints;

        //6
        float farhtestRoomEndX = 0;

        foreach(var room in currentRooms)
        {
            //7
            float roomWidth = room.transform.FindChild("floor").localScale.x;
            float roomStartX = room.transform.position.x - roomWidth * 6.0f;
            float roomEndX = roomStartX + (roomWidth * 13.0f);

            //8
            if (roomStartX > addRoomX)
                addRooms = false;

            //9
            if (roomEndX < removeRoomX)
                roomsToRemove.Add(room);

            //10
            farhtestRoomEndX = Mathf.Max(farhtestRoomEndX, roomEndX);
        }

        //11
        foreach(var room in roomsToRemove)
        {
            currentRooms.Remove(room);
            Destroy(room);
        }

        //12
        if (addRooms)
            AddRoom(farhtestRoomEndX);
    }

}

(I tried playing with the numbers on GeneratorScript, but nothing seemed to help.

sentences:
Pixel perfect collisions for platforms I'm trying to create pixel perfect collision detection but I don't know how to handle collisions when there is a jump. Here I have one image of a sample map:

But maybe I had a bad supposition assuming that all the pixels are little collision points.

I mean , there is no differences between y-axis collision and x-axis collision in my collision map.

I have been treating each axis collision split, but that is bad done when diagonal jump have been made, cause you'll get an error in x or in y while correcting the position.

Then I thought that maybe I was wrong in my supposition that I didn't need to split for pixel collision type.

I will resume it in 2 questions:

how can I handle pixel perfect collisions for a platformer?
if I'm doing it well, How to manage the x-axis, y-axis problem?

P.S: My 'player' uses a box collider.

sentences:
LibGDX Android version I am trying to use the LibGDX UI Project creator to create LibGDX projects, but it doesn't allow me to choose the Andorid version for the project.  This is a problem for some android features.  For example I want to hide the action bar, so I wanted to set the Theme:

Theme.Holo.Light.NoActionBar.Fullscreen

...but if I do that I get the error message

  @android:style/Theme.Holo.Light.NoActionBar.Fullscreen requires API level 13 (current min is 5).

My idea is to manually set up the projects so I can choose freely the versions and API levels.  But I think I can't choose what I want, because then LibGDX would have problems.

How can I correctly set the android version using UI Project creator?

sentences:
Convert Global Space 3D Location to Local object space? I'm trying to find a formula that could convert my 3D global coordinates into local object space.
Here are the inputs I have
A Location

B Location
B Rotation
B Scale

I need a Location output, corresponding to my A Location in B Space, according to B Location, Rotation, and Scale. I'm working in a 3D Space
So far I didn't found any formulas online, anyone can point me in the right direction?
Bests
If possible, i'd need a formula that doesn't use any matrix calculation, it's not supported by the nodal system of my engine (I'm using blender geometry node, but my problem is more generic as you can see)

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:
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 / Calculate edges of a 3D object - C # I need to get all vertices in the edge position of a determinate object 3D (in this case a path).

See the image:

My question is, how can I get only the edges vertices, like the image?

sentences:
Synchronizing input, update and rendering threads How do you synchronise the input-handling, state-updating and rendering threads?

If a sprite position is modified due to input, the wrong position of the sprite might be drawn to the screen if the render thread draws the sprite before the update thread finishes its collision resolution routine.

How can this be done?

(The only solution I can think of would be to store input events as they are created and consume them in the update/render threads.)

sentences:
How to pass values in UE2Runtime to UnrealScript? We have a game that launches via vbscript and calls UE2Runtime:

set demofile = filesys.GetFile("..neuro2\Inifiles\"&usrFoldername&"\LostWorld.ini")
'WShell.Run "..\System\UE2Runtime.exe LW1_basic.urt?Class=neuro2.Exp2Subject -log=" & usrName & "_training.log"

How do you grab the value in usrName that is passed to UE2Runtime to a console command in UnrealScript 2 when certain events are triggered in the game?

Many thanks in advance

sentences:
Why are coordinates converted to [-1, 1] during mouse 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;

    ...

I don't understand why this is necessary, could somebody please explain it?

Here's the rest of the function, for context:

    // Adjust the points using the projection matrix to account for the aspect ratio of the viewport.
    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;

    // 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()));
    // Calculate the direction of the picking ray in view space.
    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);

    // 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:
libgdx universal tween engine how to control the tweening speed? How can i control the speed of a tweening sprite? Here is the code:

in create ()

/*try tween*/
            w = Gdx.graphics.getWidth();
            h = Gdx.graphics.getHeight();

            texture = new Texture("nube_png_by_diieguiitoh-d4vhyzb.png");
            texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);

            sprite1 = new Sprite(texture);
            sprite1.setPosition(50,0.25f*h);

            Tween.registerAccessor(Sprite.class, new SpriteAccessor());
            manager1 = new TweenManager();
            Tween.to(sprite1,SpriteAccessor.POSITION_X,1000f) //** tween POSITION_X for a duration **//
                    .target(w-100) // ** final POSITION_X **//
                    .ease(TweenEquations.easeInOutQuad) //** easing equation **//
                    .repeat(10,1000f) //** ten more times **//
                    .start(manager1); //** start it
            startTime = TimeUtils.millis();
/*try tween*/

In render()

        batch.begin();

        delta = (TimeUtils.millis()-startTime)/1000; // **get time delta **//
        manager1.update(delta); //** update sprite1 **//
        sprite1.draw(batch);

        batch.end();

sentences:
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:
Why can't I put a source image in my Image component? I can't put an image here as source image, and I have trouble figuring out why.

What did I miss?

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: Implementing a 2D destructible landscape (like Worms) What steps would be involved in constructing a destructible 2D landscape, like in Worms? Ideally, What are some ways that this process could be made efficient as possible?

sentences:
Draw image layer in tmx map - libgdx I created a map only with an image layer in tiled map editor.

When I want to load the map the layer isn't shown. Only the background color.

Followed the tutorial from
http://www.gamefromscratch.com/post/2014/04/16/LibGDX-Tutorial-11-Tiled-Maps-Part-1-Simple-Orthogonal-Maps.aspx

Here the code (left out empty overrides):

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.InputProcessor;
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.TiledMapRenderer;
import com.badlogic.gdx.maps.tiled.TmxMapLoader;
import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer;

public class Main extends ApplicationAdapter implements InputProcessor  {
TiledMap tiledMap;
OrthographicCamera camera;
TiledMapRenderer tiledMapRenderer;

@Override
public void create () {
    float w = Gdx.graphics.getWidth();
    float h = Gdx.graphics.getHeight();

    camera = new OrthographicCamera();
    camera.setToOrtho(false,w,h);
    camera.update();
    tiledMap = new TmxMapLoader().load("C:/Users/Robin/Desktop/map.tmx");
    tiledMapRenderer = new OrthogonalTiledMapRenderer(tiledMap);

    Gdx.input.setInputProcessor(this);
}

@Override
public void render () {
    Gdx.gl.glClearColor(1, 0, 0, 1);
    Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    camera.update();
    tiledMapRenderer.setView(camera);
    tiledMapRenderer.render();
}
}

I added a tileset and tried again (just a little test). Only the tiles are visible:

Any ideas how to set the layer visible?

Greetings
Kaito

sentences:
How to disable depth buffer in Directx11 For now i know what i must use OMSetDepthStencilState. In the beginning i must create two states and change them every time i need another. For now i have this and it doesn't work, i.e. objects rendered in order i draw them:

D3D11_DEPTH_STENCIL_DESC depthStencilDesc;
depthStencilDesc.DepthEnable = TRUE;
depthStencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
depthStencilDesc.DepthFunc = D3D11_COMPARISON_LESS;
depthStencilDesc.StencilEnable = FALSE;
depthStencilDesc.StencilReadMask = 0xFF;
depthStencilDesc.StencilWriteMask = 0xFF;

// Stencil operations if pixel is front-facing
depthStencilDesc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
depthStencilDesc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_INCR;
depthStencilDesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
depthStencilDesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;

// Stencil operations if pixel is back-facing
depthStencilDesc.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
depthStencilDesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_DECR;
depthStencilDesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
depthStencilDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;

ID3D11DepthStencilState *m_DepthStencilState;
HR(m_Device->CreateDepthStencilState(&depthStencilDesc, &m_DepthStencilState));
m_ImmediateContext->OMSetDepthStencilState(m_DepthStencilState, 0);

sentences:
Unity sprites and layouts I am trying to learn Unity for a simple board game. The question is, is it possible to use grid layout group (or any layout component) with sprites? The goal is to fit a board into my view regardless of the aspect ratio of the device.

The following grid should contain 7 by 7 sprites and it should scale up and down (no more then lets say 100 px) and have an aspect ratio of 1. I've tried adding a canvas and a panel that has a grid layout group component but it seems like sprites are not affected when added to the panel.

Also it seems like when I try to work with a panel or a canvas they have a fixed sizes in units. Having fix sizes feels a little bit off.

Is there a way to use layout components so sprites can have relative distances between them.

So far I am stuck and lost in tutorials and feeling like the answer should not be this complicated.

Any push to the right direction is welcome.

sentences:
Procedural terrains in 3D: what has been done ? Are there common algo and/or theories about it? Besides programming, modeling an environment takes a great deal of time.

I don't know about the work time involved, for example, in a WoW dungeon level, or other beautiful city-like, future environment, jungles, fantasy, etc, but this kind of work is made from scratch by artists.

What are the techniques involved in the TorchLight level randomizer, and does other titles have similarities with this ? Is there a family name for such techniques ?

sentences:
Libgdx drawing semi-transparent circle on pixmap I am currently working on an android game using libgdx and would like to add a joystick to its interface. For this I use the built-in touchpad class. Untill now I have used external images for rendering the background and joystick. Now, I would like to dynamically draw the background of the joystick. This would make it possible to make the background of the joystick semi-transparent and to change the color of the background dynamically.

To do this, I implemented the following:

public class Joystick{
    private Touchpad touchpad;
    private static TouchpadStyle touchpadStyle;
    private Skin touchpadSkin;

    public Joystick(GameWorld world, GuiComponent gui) {
        touchpadSkin = new Skin();
        touchpadSkin.add("touchKnob", new Texture("data/touchKnob.png"));

        touchpadStyle = new TouchpadStyle();
        touchpadStyle.knob = touchpadSkin.getDrawable("touchKnob");;

        Pixmap background = new Pixmap(200, 200, Format.RGBA8888);
        background.setColor(1, 1, 1, .6f);
        background.fillCircle(100, 100, 100);
        touchpadStyle.background = new TextureRegionDrawable(new TextureRegion(new Texture(background)));

        touchpad = new Touchpad(10, touchpadStyle);
        touchpad.setBounds(15, 15, 200, 200);

        gui.inputStage.addActor(touchpad);
    }
}

As you can see, this code provides a joystick with a semi-transparent background: Joystick with semi-transparent background

However, this background has some inexplicable lines that are not transparent. Does anybody know what causes this? I thought it could have something to do with the format of the pixmap, but after trying with some other formats, there was not much improvement.

sentences:
How to Render an xml tile grid in java So i decided to write my games data files in xml since a lot of people recommend it security wise for an online game, but how exactly does one render an xml tile grid in java?

format will be as follows:

<Data>
   <Tile X="1" Y="1" Value="12"></Tile>
</Data>

sentences:
Writing via content pipeline in Xbox game project I'm creating an Xbox application and I have this problem with the content pipeline. Loading .xnb files is not a problem but I can't seem to find any helpful tutorials on writing via the content pipeline. I want to write an XML whenever the user presses a custom made "save" button. I've searched the web for "saving game sate" etc. but so far I haven't found a solution for my case.

So, summarized: is there a way to write data (in XML format) via the content pipeline, if my Save() method is called?

Cheerz

sentences:
"Hold to jump higher" suddenly outputs a much higher jump I'm programming my first game in Unity and I'd like to make a very controllable jump.

The idea is to apply an upward force while the player is still pressing the jump button, and then after some time ignore jump input. Kinda like how Mario and Mega Man jump.

Problem is, somehow, my character occasionaly jumps much higher than it normally does.

I set three variables on the inspector:

jumpImpulse: the initial speed after pressing the jump button;
riseAcc: the acceleration applied to the character while holding the jump button;
maxJumpHoldTime: the longest possible time one might hold the button while still rising.

if ((onGround || onPlatform) && Input.GetButtonDown("Jump")){ //GetButtonDown prevents holding jump and keeping jumping

    rb.AddForce(Vector2(0,(jumpImpulse/rb.mass)), ForceMode2D.Impulse); //force that starts the jump itself.
                                //  /rb.mass makes F=ma into F=ma/m ==> F = a, so "Force" is actually acceleration.
                                //  This is to better control mass and jump mechanics.
    jumping = true;

    //DEBUG
    debugJumped = true;
}

if (jumping && Input.GetButton("Jump")){

    rb.AddForce(Vector2(0,(riseAcc/rb.mass)), ForceMode2D.Force); //first acceleration

    jumpHoldTime += Time.deltaTime;

    if (jumpHoldTime >= maxJumpHoldTime) {
        jumping = false;
    }

} else {

    jumping = false;
    jumpHoldTime = 0;

}

//Made this so I know how high the character jumps.
if (debugJumped && (!onGround) && rb.velocity.y <= 0){
    Debug.Log ("Jump height is: " + transform.position.y);
    debugJumped = false;
}

In the console, the jump height is listed normally as 2.376213, but sometimes it appears as 5.008272. It appeared once as 2.377432. Also, this variation seems to appear more frequently when I'm also moving the character left or right.

And I'm not sure if this is related, but there are many times when I press the jump button and the character simply doesn't jump.

Also, I put everything here under the FixedUpdate function.

sentences:
OpenGL: What to do after running glBufferData? I am interested in understanding a bit more behind how OpenGL does its memory management and what are some good practices before I start heavily coding and back myself into a corner.
The real question I have is regarding memory. I have a class called Mesh that consists of a pointer to some vertex data, a pointer to the face data, as well as the number of vertices and faces. I am familiar with one possible process that OpenGL uses to get these drawn on the screen: generate a buffer for vertices and a buffer for faces, bind them as GL_ARRAY_BUFFER and GL_ELEMENT_ARRAY_BUFFER, call glBufferData to move the data to the buffers, and lastly call glDrawElements to draw them. From here I can understand how I can load several Mesh objects and draw them on screen, and I have no issue there.
My question then lies in where the memory is stored and what I should be doing in order to conserve memory. My assumption is that after the call to glBufferData, the data is copied to the GPU (or to some other register to later be copied to the GPU). Is it safe for me to delete the original Mesh object that was used with the buffer calls? In my head, the mesh data is retained inside the GPU so the data is not lost, and so long as I do not need to reload this data using OpenGL later then I won't miss this data at any point. Also in my head, this frees up RAM space for other uses, so my Mesh, in some sense, now totally lives in GPU memory and nowhere else, and I can do my drawing solely by making OpenGL calls to the correct buffers (so I obviously need to save the generated buffer IDs, but that part goes without saying).
If someone could tell me if this is correct/incorrect logic, as well as good/bad game dev practice?

sentences:
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:
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:
Game AI move towards player while avoiding an obstacle I'm trying to move enemy towards player, while enemy also tries to avoid an obstacle if it's in its path. Here's a simple illustration of what I want to do:

What I've tried:

Making circular collision around the obstacle. It works but that
makes the enemy impossible to hit.
I think going with an A* pathfinding algorithm might be a bit overkill
especially since it's designed for multiple obstacles, where in my
case there is only the mouse and wall collision concerned.
Moving the enemy towards the player, while also moving away from the
obstacle at a slower speed. This works better because you can
actually hit the enemy, but also slows down enemy if obstacle if it's
in its path.

My questions:

Is there a better way to go about doing this?
Anything you would've done differently with my code to either improve or optimize?

Here's the code I have currently in my game logic and a fully-working example on jsFiddle.

// Calculate vector between player and target
var toPlayerX = playerPosX - enemyPosX;
var toPlayerY = playerPosY - enemyPosY;

// Calculate vector between mouse and target
var toMouseX = mousePosX - enemyPosX;
var toMouseY = mousePosY - enemyPosY;

// Calculate distance between player and enemy, mouse and enemy
var toPlayerLength = Math.sqrt(toPlayerX * toPlayerX + toPlayerY * toPlayerY);
var toMouseLength = Math.sqrt(toMouseX * toMouseX + toMouseY * toMouseY);

// Normalize vector player
toPlayerX = toPlayerX / toPlayerLength;
toPlayerY = toPlayerY / toPlayerLength;

// Normalize vector mouse
toMouseX = toMouseX / toMouseLength;
toMouseY = toMouseY / toMouseLength;

// Move enemy torwards player
enemyPosX += toPlayerX * speed;
enemyPosY += toPlayerY * speed;

// Move enemy away from obstacle (a bit slower than towards player)
enemyPosX -= toMouseX * (speed * 0.4);
enemyPosY -= toMouseY * (speed * 0.4);

sentences:
Coding for a really, really high-resolution display array I've been tasked with building a real time "full screen" demo to run on a 5x2 array of 60+ inch LED TVs: or, in other words, a 20 megapixel display.

We've got a machine built that can run a single Win7 desktop spread across the displays at full resolution, and some pretty decent video cards.

My question is: aside from the ridiculous amount of work that my pixel shaders are going to be doing, are there any other limitations of DX10.* that would come into play here that wouldn't on a more sanely sized viewport? I won't have access to the hardware until next week but I'd like to have something written by then that I can use to benchmark the system.

Update

While Imanaged to get this working on a single machine with a bunch of AMD EyeFinity (6 output) cards - to keep things working smoothly, the "easiest" way turned out to be to create a DX window per display as having a window span displays caused some performance issues - I also got it working pretty well by distributing the task across a group of machines, each of which drives two displays.

It was surprisingly easy. For my test XNA app, I added a GameComponent that captures some game state (camera position/orientation, etc.) and UDP-spams it across the local subnet per frame.

That component has a Mode switch (send or receive). If it's in Receive mode, it catches UDP datagrams and updates the game state with the information from the sender. Send mode just sends state packets, and, via a service/daemon, causes nodes to start or stop the client app. Any client can act as a "master", and switching a client into Send mode requests all other nodes to switch into Receive. It's pretty entertaining to see what happens when people are fighting over control.

Another neat benefit: I created a console app which processes a series of keyframe state definitions - location, time, etc. - interpolates as needed, and sends them using the same code as is used in the game engine. This lets me easily script movement, submit transforms from a web browser, etc.

All in all, it took about 50 lines of code to keep multiple copies of the app running in sync. Some additional complexity came from off-setting the camera position for each machine and correcting some perspective/projection annoyances, but most of that came down to a per-node configuration file.

sentences:
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:
Can't Get .enabled to Work for Children Sprites. What Gives? So I have an object with a few children. I want to be able to disable/enable 2 of their SpriteRenderers via one of my scripts. I feel like I'm doing things right, but apparently I'm not. And yes, my game objects have the appropriate tags that are being searched for in my code. I'll paste the relevant bits of code below:

public bool isAiming = false;
Animator playerAnim;

GameObject arm;
GameObject weapon;

SpriteRenderer armRenderer;
SpriteRenderer weaponRenderer;

void Start()
 {
     playerAnim = gameObject.GetComponent<Animator>();

     arm = GameObject.FindGameObjectWithTag("Arm");
     weapon = GameObject.FindGameObjectWithTag("EquippedWeapon");

     armRenderer = arm.GetComponent<SpriteRenderer>();
     weaponRenderer = weapon.GetComponent<SpriteRenderer>();
 }

void Update()
 {
     CheckIfAiming();
 }

void CheckIfAiming()
 {
     if (Input.GetButton("Fire2")) // Holding right click
     {
         isAiming = true;

         armRenderer.enabled = true;
         weaponRenderer.enabled = true;

         playerAnim.SetBool("isAiming", isAiming);
     }
     else
     {
         isAiming = false;

         armRenderer.enabled = false;
         weaponRenderer.enabled = false;

         playerAnim.SetBool("isAiming", isAiming);
     }
 }

What gives? I want to just enable the sprite rendering when I hold down the right mouse click. SetActive(false/true) is not an option as I still want code to affect them while they're not visible.

Am I just trying to access the SpriteRenderers incorrectly?

sentences:
OpenGL Reconstructing Position from Depth I know this has been asked a lot of time before but none of those answers fixed my problem.
I try to implement deferred shading and to do so I need to reconstruct the world space position from the depth. (Having a position texture in the gbuffer would be a waste of data)

The calculation works fine for rotationing the camera (-> moving the mouse) but as soon as I move the camera (-> pressing wasd) they get weird.

GLSL:

vec4 screenSpacePosition = vec4(pass_Texture * 2.0 - 1.0, texture(gbuffer_texture[2],     pass_Texture).r, 1);
vec4 worldSpacePosition = invertedViewProjection  * screenSpacePosition;
vec3 finalPosition = worldSpacePosition.xyz / worldSpacePosition.w;

gbuffer_texture[2] is the depth attachment of OpenGL.
invertedViewProjection is the matrix I used to render the scene inverted on the CPU.

sentences:
ReorderableList in Unity with Enums I'm trying to setup a simple ReorderableList in Unity 2017.3 for a list of enums. Adding items workes fine but selecting, dragging and deleting items from the list does not (see gif).

Here is my code:

[Serializable]
public enum RoofType { HIP, GABLE, FLAT, NONE }

UnityEditorInternal.ReorderableList roofTypeList = new UnityEditorInternal.ReorderableList(roofTypes, typeof(RoofType), true, true, true, true);
roofTypeList.drawHeaderCallback = (Rect rect) =>
{
   EditorGUI.LabelField(rect, "Roof types");
};
roofTypeList.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) =>
{
   roofTypes[index] = (RoofType)EditorGUI.EnumPopup(rect, roofTypes[index]);
};
roofTypeList.DoLayoutList();

Any ideas why this does not work? My guess it is because I use enums and not classes but it is not documented anywhere.

sentences:
Stopping player from spamming movement keys which causes glitches Unity C# I wrote a script for the player movement in c#. Whenever the player presses A or D, it moves him/her to the left or right by 12 units and when the player presses W or S, it moves him/her up or down by 12 units. My script works fine, but if a person starts to spam all of the keys at once, it glitches out and the player object is not in line with the level anymore. I want to have the script check if there a movement is currently happening before executing the movement on the keypress. Here is my script:

void Update () {

    transform.Translate(Vector3.forward * ForwardSpeed * Time.deltaTime);

    if (Input.GetKeyDown (KeyCode.A) && side > maxSideLeft) {
        MoveObjectTo(this.transform, new Vector3(this.transform.position.x - 12, this.transform.position.y, this.transform.position.z + 10), movementSpeed);
        side -= 1;
    } else if (Input.GetKeyDown (KeyCode.D) && side < maxSideRight) {
        MoveObjectTo(this.transform, new Vector3(this.transform.position.x + 12, this.transform.position.y, this.transform.position.z + 10), movementSpeed);
        side += 1;
    }

    if (Input.GetKeyDown (KeyCode.W) && level < maxLevelHeight) {
        MoveObjectTo(this.transform, new Vector3(this.transform.position.x, this.transform.position.y + 12, this.transform.position.z + 10), movementSpeed);
        level += 1;
    } else if (Input.GetKeyDown (KeyCode.S) && level > minLevelHeight) {
        MoveObjectTo(this.transform, new Vector3(this.transform.position.x, this.transform.position.y - 12, this.transform.position.z + 10), movementSpeed);
        level -= 1;
    }

    if (Input.GetKeyDown (KeyCode.R) || Input.GetKeyDown(KeyCode.Space)) {
        SceneManager.LoadScene ("Scene1");
        Time.timeScale = 1;
    }
}

private void MoveObjectTo(Transform objectToMove, Vector3 targetPosition, float moveSpeed)
{
    StopCoroutine(MoveObject(objectToMove, targetPosition, moveSpeed));
    StartCoroutine(MoveObject(objectToMove, targetPosition, moveSpeed));
}

public static IEnumerator MoveObject(Transform objectToMove, Vector3 targetPosition, float moveSpeed)
{
    float currentProgress = 0;
    Vector3 cashedObjectPosition = objectToMove.transform.position;

    while (currentProgress <= 1)
    {
        currentProgress += moveSpeed * Time.deltaTime;

        objectToMove.position = Vector3.Lerp(cashedObjectPosition, targetPosition, currentProgress);

        yield return null;
    }
}

sentences:
XNA Guide text input - maximum length so I am using Guide.BeginShowKeyboardInput to get the user to enter their username. I would like this to be limited to 20 characters, and it seems to break expected behaviour to let them input whatever they like and trim it later - so how would I go about limiting what they can input in the text box itself? I have the following code:

public string GetKeyboardInput(string title, string description, string defaultText, int maxLength)
    {
        if (input.CheckCancel())
        {
            useKeyboardResult = false;
            KeyboardResult = null;
        }

        if (KeyboardResult == null && !Guide.IsVisible)
        {
            KeyboardResult = Guide.BeginShowKeyboardInput(PlayerIndex.One, title,
                                                          description, defaultText, null, null);
            useKeyboardResult = true;
        }
        else if (KeyboardResult != null && KeyboardResult.IsCompleted)
        {
            string result = Guide.EndShowKeyboardInput(KeyboardResult);
            KeyboardResult = null;
            if (result == null)
            {
                useKeyboardResult = false;
                return null;
            }

            if (useKeyboardResult)
            {
                KeyboardResult = null;
                return result;
            }
        }
        else //the user is still entering inputs
        {

        }

        return null;
    }

I assume the code I need would go in that final, empty else{} block, but I can't see any way to do this. Does anyone know how?

sentences:
How to know which methods are associated with an event? In Unity events are used as enhanced delegates.
This is extremely helpful in developing clean concise event management scripts.

However, when debugging said scripts and complex arrangements, is there a way I can see which methods are in an event at any one time?

Simplified Example:

Game manager

using UnityEngine;
using System.Collections;

public class EventManager : MonoBehaviour
{
    public delegate void ClickAction();
    public static event ClickAction OnClicked;

    void someMethod()
    {
        if(whatever = true && OnClicked != null)
        {
            //this is the event delegate:
            OnClicked();
        }
    }
}

gameObject script
(one of several scripts that can add methods to an event )

using UnityEngine;
using System.Collections;

public class TeleportScript : MonoBehaviour
{
    void SomeMethod()
    {
        EventManager.OnClicked += Teleport;
    }

    void SomeOtherMethod(){
        EventManager.OnClicked += Horses;
    }

    void OnDisable()
    {
        EventManager.OnClicked -= Teleport;
        EventManager.OnClicked -= Horses;
    }

    void Teleport()
    {
        Vector3 pos = transform.position;
        pos.y = Random.Range(1.0f, 3.0f);
        transform.position = pos;
    }

    void Horses(){
         instantiate(horses, new Vector3.zero, Quaternion.identity);
    }
}

etc. etc.,

I have used Debug.Log(OnClicked.Method); but this only returns one of multiple methods associated with an event.

So my issue is, that for debugging and general error resolution, how can I find out which method(s) are in the OnClicked() event delegate without/before running this delegate?

For example:

Debug.Log(OnClicked(listMethods));

  //Output to log:
  void Teleport();
  void Horses();

sentences:
Why shouldn't I permit changing the field of view, if the technology allows for it? This is less of a question aimed at developing a game and more about the technology behind it. A number of gaming journalists and pro gamers (both in the tournament and the home entertainment sector) often hammer on the matter that any first or third person game should have a way to change the field of view, and I agree with them. The main reason they mention this is because a pretty large number of players get motion-sickness related headaches and eyestrain if they play with an overly constrained field of view.

I can understand if an indie developer does not allow this due to budget constraints, because they need to add support to the engine for that. However, a number of developers use high profile third party engines like Frostbite, Unity, Unreal, or Cryengine, but don't offer an option for changing the field of view.

Why shouldn't I permit changing the field of view, if the technology allows for it?

sentences:
Using Delta for a stopwatch, delta too fast than real time seconds I search for methods to create a stopwatch on libgdx and came across with this:

public void trigger(float delta){

    playTime += delta;
    playTimeRounded = ((double)Math.round(playTime * 100) / 100);
    Gdx.app.log("deltaTime", delta + "");
}

But its not accurate and its much faster. How can i create an accurate stopwatch?

sentences:
Saving and Loading the Game (Automatically or Manually) via Internal Storage Only (Tablet PC Issues) Here is my question. When making a game app for Android, I considered first the device. It's no problem to save progress everything (from levels to records) on a smartphone because it has an SD Card slot. Exception to this, the tablet PC, it can really nothing but on internal only storage.

For example, I'm using this tutorial for audio spectrum (see http://www.youtube.com/watch?v=5cN1VzZXcdo) that involves copying from internal to external in order to detect frequency. It works on the desktop but not on the Android device (Tablets only [i.e. Google Nexus Tablet]).

Is there a way to optimize save/load game problems due to internal/external device issues? Plus, additionally, what's the reason why my device won't work on tablets, except the desktop, while testing the audio spectrum code and why? Also, is it the same with saving/loading game?

sentences:
What is a lobe, in reference to lighting and graphics I sometimes see references to lobes when talking about lighting, especially with specular lighting, but also with spherical harmonics which doesn't do specular.

Can anyone explain what exactly a lobe is?

sentences:
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:
Using the same font with different sizes in libgdx I am using BitmapFonts, LabelStyles and Labels for my texts.

I want to resize some labels, so i use this.

fontType.scale(-.6f);

LabelStyle style = new LabelStyle(fontType, Color.WHITE);

titleLabel = new Label("Points", style);
titleLabel.setColor(Color.RED);
titleLabel.x = 260;
titleLabel.y = 310;

but when i want to resize another label, all the labels containing that font resize (I create a new LabelStyle). So i resize the label instead of the font, but that doesnt solve the problem, because it doesnt resize the label, any idea?

sentences:
Problem in nested parent-entity relationship in ecs In the given flow, the character is the parent entity, gun is child of character and bullet is child of gun. I've got a component called NodeComponent which has the storage of child entities and a NodeSystem that iterate the children then update its position relative to its parent. The problem is when the iteration reach to the bullet, it takes some time to update the bullet position. So when I move the parent the bullet is noticeable. How do I handle the parent-child relationship transformation without losing or slowing down the update from top to bottom?

Character >>
             Gun >>
                    Bullet

sentences:
How to pause and unpause the Particular action of a sprite? My game has a sprite representing a character.  When the character picks up an item, the sprite should stop moving for a period of time.

I use CCbezier to make the sprite move, like this:

sprite->runaction(x)

Now I want the sprite to stop its current action (moving) and later resume it.
I can make the sprite stop by using:

sprite->stopaction(x)

but if I do that, I can't resume the movement.
How can I do that?

sentences:
What is DirectX 11's equivalent of D3DCAPS9::MaxVertexIndex of DirectX 9? I'm porting a DirectX 9 program to DirectX 11. How do I get the value in DirectX 11 that is retrieved using

D3DCAPS9::MaxVertexIndex

in DirectX 9?

Thanks in advance.

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:
Quaternion based camera pitch freaking out, and Z-axis drift This is the code I use to control my (first person) camera's movement and
rotation. Translation successfully keeps orientation in mind, so that up and
left and such are always in the expected directions, and 'mouselook' controlling
rotation around the Y (yaw) and X (pitch) axes starts out working fine as well.

My problems are two-fold;

First, rotating around the Y and X axes slowly builds up rotational drift around
the Z axis. Now what I think I need to do to correct this is to keep track of an
additional 'up' vector, and to rotate the quaternion so that the camera's up
direction always coincides with this up vector (which would only change when
intended, instead of by drift). But I have no idea how to go about doing this.

The second problem is more clearly a bug. When rotating around the Y (yaw) axis,
the rotation around the X (pitch) axis starts to freak out. At Y 180 degrees, the
up and down motion of the camera's pitching are precisely inverted. And at 90
degree Y angles from the starting orientation, it's as if pitch has become roll
instead, rotating around the Z axis.

So, how do I 'roll up', and what's going on with the pitching?

glm::quat mOrientationQuaternion;
glm::vec3 mPositionVector;
glm::mat4 mViewMatrix;

/*
 *  Takes a translation value for each axis, turns it into a vector, then
 *  rotates that vector by the current orientation in the quaternion, before
 *  adding the result to the position vector.
 */
void Camera::translate(float x, float y, float z)
{
    glm::vec3 translation(x, y, z);
    translation = translation * mOrientationQuaternion;
    mPositionVector += translation;
}

/*
 *  Takes three angles in degrees, and creates a quaternion via an
 *  intermediate vector to represent their rotations. Then the orientation
 *  quaternion is multiplied by this new rotation quaternion to get the new
 *  orientation.
 */
void Camera::rotate(float x, float y, float z)
{
    glm::vec3 angles(glm::radians(-x), glm::radians(y), glm::radians(z));
    glm::quat rotation(angles);
    mOrientationQuaternion = glm::normalize(mOrientationQuaternion * rotation);
}

/*
 *  Creates the view matrix from the orientation quaternion, then translates
 *  it by the position vector.
 */
void Camera::buildViewMatrix()
{
    mViewMatrix = glm::mat4_cast(mOrientationQuaternion);
    mViewMatrix = glm::translate(mViewMatrix, mPositionVector);
}

sentences:
Implementing Light Volume Front Faces I recently read an article about light indexed deferred rendering from here:

http://code.google.com/p/lightindexed-deferredrender/

It explains its ideas in a clear way, but there was one point that I failed to understand. It in fact is one of the most interesting ones, as it explains how to implement transparency with this approach:

  Typically when rendering light volumes in deferred rendering, only
  surfaces that intersect the light volume are marked and lit. This is
  generally accomplished by a “shadow volume like” technique of
  rendering back faces – incrementing stencil where depth is greater
  than – then rendering front faces and only accepting when depth is
  less than and stencil is not zero. By only rendering front faces where
  depth is less than, all future lookups by fragments in the forward
  rendering pass will get all possible lights that could hit the
  fragment.

Can anyone explain how exactly you need to render only front faces? Another question is why do you need the front faces at all? Why can't we simply render all the lights and store the ones that overlap at this pixel in a texture? Does this approach serves as a cut-off plane to discard lights blocked by opaque geometry?

sentences:
How to organize a game engine in C++? Is my use of inheritance a good idea? I'm a beginner both in game developping and programming.

I'm trying to learn some principle in the building of a game engine.
I want to create a simple game, I'm at the point where I'm trying to implement the game engine.

So I thought my game engine should control this things:

- Moving the objects in the scene
- Checking the collisions
- Adjusting movements based on collisions
- Passing the polygons to the rendering engine

I designed my objects like this:

class GlObject{
private:
    idEnum ObjId;
    //other identifiers
public:
    void move_obj(); //the movements are the same for all the objects (nextpos = pos + vel)
    void rotate_obj(); //rotations are the same for every objects too
    virtual Polygon generate_mesh() = 0; // the polygons are different
}

and I have 4 different objects in my game: plane, obstacle, player, bullet and I designed them like this:

class Player : public GlObject{
private:
    std::string name;
public:
    Player();
    Bullet fire() const; //this method is unique to the class player
    void generate_mesh();
}

Now in the game engine I want to have a general object list where I can check for example for collision, move objects, and so on, but I want also that the game engine will take the user commands to control the player...

Is this a good Idea?

class GameEngine{
private:
    std::vector<GlObject*> objects; //an array containg all the object present
    Player* hPlayer; //hPlayer is to be read as human player, and is a pointer to hold the reference to an object inside the array
public:
    GameEngine();
    //other stuff
}

the GameEngine constructor will be like this:

GameEngine::GameEngine(){
    hPlayer = new Player;
    objects.push_back(hPlayer);
}

The fact that I'm using a pointer is because I need to call the fire() that is unique to the Player object.

So my question is: is it a good idea? Is my use of inheritance wrong here?

sentences:
Vertex Snapping on a mesh with an armature I've made a selection of modular walls for a game i'm working on and some of the pieces have moving parts, like doors and flaps, but the moving pieces with an armature attached don't use vertex snapping like all of the other pieces and it leaves ugly gaps in the walls.
I've tried everything I can think of to get them lined up, the closest I can get is lining them up by eye and this leaves small gaps when in game and isn't perfect.
Does anyone know of a way to get vertex snapping to work with meshes that have an armature attatched?
I've attached a picture to try and explain:

sentences:
Megatexturing : Evolution from Quake Wars to Rage I remember John Carmack talking about how they initially used Megatexturing for Quake Wars: Enemy Territory.
The technology has since evolved quite a bit in Rage.

I was wondering if somebody here can give some technical details on the specifics on what and how it has evolved since then.

sentences:
How do I calculate rotation caused by bounce friction? Following on from my previous question: I have the ball quite realistically bouncing from surfaces it hits. Now I'd like to make it spin from the friction of the hit.

Showing this is simple enough: I rotate the ball by its angular velocity every tick and apply the same rotation when it's rendered.

When a ball hits a wall, I know that the speed of rotation is affected by...

the ball's initial speed when hitting the surface
the friction coefficients of the ball and surface (physical constants)
the angle of incidence (the angle between the ball's incoming velocity vector and the surface normal).

The angle of incidence is approximated by the dot product of the ball's impact and exit velocity vectors. (1 meaning high spin, -1 meaning no spin, and everything else relatively in between)

Multiplying all of the above together and making sure they were then transformed to the range 0 - 1, and multiplied by max rotation speed, the ball seemed to respond in rotation speed as expected. Except for one thing: It would always rotate clock-wise (because of positive values).

Is this a good method? Can you think of a simpler way?

If this method seems fine, what am I missing? How do I know when the ball should be rotating counter-clockwise?

sentences:
Optimizing large number of ModelRenderable cubes with ARCore? I am creating an ARCore Android app that involves rendering up to thousands of cubes, of course using a Node and ModelRenderable object for each. Understandably, I'm unable to do that without running into memory issues, so I'm looking for ways to optimize. Ideas I've had so far are:

Removing all of the cubes that had no empty space around them since they would be invisible.
Investigating into some sort of culling (which I don't know much about) to not render the sides of the cubes that are invisible. I don't know if ARCore will already do this.
Hiding all of the cubes that are hidden behind other cubes. I don't yet understand the math behind this.
Grouping cubes of the same type into larger cubes. In one example, there might be 16x16x16 rendered on the screen. Each cube is an individual unit with its own type. So in relation to my grouping idea, I would take all the cubes that have the same type would be replaced with one larger cube or cuboid.

I've tried removing all of the cubes that have no empty space around them, as those will not be visible. Long term, however, this will be insufficient.

I don't have a lot of code to show that's related as this question is more looking for ideas to write code, but basically I'll be having a very large number of:

// Where position is a Vector3 and material is a Material object.
ModelRenderable cube = ShapeFactory.makeCube(new Vector3(CUBE_WIDTH, CUBE_WIDTH, CUBE_WIDTH), position, material);
Node node = new Node();
node.setRenderable(cube);

I'm not creating a new material every time, I generate those at startup.

I understand there are lots of questions already answered about this kind of optimization, but I haven't been able to find much about the implementation of things such as culling and hiding blocked cubes in the context of ARCore. Would I be better off using Unity?

If anyone has advice or ideas, I'd love to hear them.

sentences:
Automatically create C# from manually created game objects I have created 2 gameobjects along with its properties in the Unity Inspector.
I have attached a screenshot below.

For prototyping, I like the Inspector very much, but for runtime I prefer doing everything by scripts. This way nothing can go wrong: I don't have to carry so many files around, and I find it easier to understand everything.

I would now like to change this so that these 2 components are created at runtime by script.

Is there perhaps a way to automatically create the script that would create these game objects?

I would appreciate it very much if I could save some time with such an automatic script creation.

Thank you for any input.

sentences:
Masking cameras for Voronoi splitscreen I would like to mask a camera to only render to a certain (non-square) region of the screen, to be used as an overlay, for splitscreen, or any other application.
The goal is obviously to prevent any unnecessary rendering from that camera, so I specified performance, but I'm also happy to hear the easiest to implement option as well.
What I'm considering so far:

Stencil shader on a mesh in front of the camera - but my understanding is that doing so would require modifying all shaders on world objects, which isn't ideal. Is there an easier way I'm missing?
Transparent mesh with a cutout - I could cut out a hole in a mesh and the solid part would block rendering of objects behind it, but I'm not sure how to make that part be transparent so other things can render

I'm using Unity 2019 LTS and the built-in render pipeline
I feel like there must be a simple answer I'm missing but maybe I'm wrong?

sentences:
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:
Javascript Canvas Drawing Efficiency I have just recently started some experiments with game development in Javascript/HTML5, and so far it has been going pretty well.  I have a simple test scene running with some basic input handling, and a hundred-ish drawImage() calls with a few transforms.  This all runs great on Chrome, but unfortunately, it already chugs on Firefox.  I am using a very large canvas ( 1920 x 1080 ), but it doesn't seem like I should be hitting my limit already.  So on that note, I was hoping to ask a few questions:

1) What exactly is done on the CPU vs. the GPU in terms of canvas and drawImage()?  I'm afraid the answer is probably "it depends on the browser", but can anybody give me some rules of thumb?  I naively imagined that each drawImage call results in a textured quad on the GPU with the canvas effectively being a render target, but I'm wondering if I'm pretty far off base there...

2) I have seen posts here and there with people saying not to use the translate(), rotate(), scale() functions when drawing on the canvas.  Am I adding a lot of overhead just by adding a translate() call, as opposed to passing in the x,y to drawImage()?  Some people suggest using "transate3d", etc., which are CSS properties, but I'm not sure how to use them within a scene.  Can they be used for animated sprites within a single canvas?

3) I have also seen a lot of posts with people mentioning that pre-building canvases and then re-using them is a lot faster than issuing all the individual draw calls again.  I am guessing that my background should definitely be pre-built into a canvas, but how far should I take this?  Should I maintain an individual canvas for each sprite, to cache all static image data when not animating?

Thank you much for your advice!

sentences:
OpenGL depth problem I am drawing two cubes, first a red one and then a green one in front of the red one. When I rotate the camera I can see the green cube through the red cube.

I have enabled depth test and I clear depth buffer. I'm using OpenGL 4.4 core profile and a simple diffuse shader by the way.

sentences: 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:
Kinematic rigidbodies push each other in unet https://youtu.be/j3f44E-ExLc
I have a bunch of rigidbodies on each player, ALL set to kinematic. And this stuff happens. All the sword swinging is animation state driven, and basic back and forth and sideways motion is using Rigidbody.MovePosition. There is not supposed to be any rotation on the players' local x axis. This only seems to happen using Unet networking . Any ideas how to fix this?? Thanks!

sentences:
How to set the z axis bound of the collider of child of an instantiated object to zero I have attached a script to an empty GameObject to instantiate a prefab and the script is:
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using UnityEngine;

public class Circles : MonoBehaviour
{
    [SerializeField] float Xmax;
    [SerializeField] float Xmin;
    [SerializeField] float Ymax;
    [SerializeField] float Ymin;

    [SerializeField] float outsideMaxsize;
    [SerializeField] float outsideMinsize;
    float insideMaxsize;
    float insideMinsize;

    public GameObject[] enemy;
    GameObject enemyObject;

    int enemyNo;

    float Xpos;
    float Ypos;
    float outsideSize;
    float insideSize;

    // Start is called before the first frame update
    void Start()
    {
        enemyNo = Random.Range(0, 4);

      instantiator();
    }

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

    }
    public void instantiator()
    {
        Xpos = Random.Range(Xmin, Xmax);
        Ypos = Random.Range(Ymin, Ymax);

        outsideSize = Random.Range(outsideMinsize, outsideMaxsize);

        Vector2 circlePos = new Vector2(Xpos, Ypos);
        transform.position = circlePos;

        enemyObject = GameObject.Instantiate(enemy[enemyNo], transform.position, transform.rotation,transform.parent) as GameObject;

        var enemies = enemyObject.transform;
        var outsideComponent = enemies.GetChild(0);
        var insideComponent = enemies.GetChild(1);
        outsideComponent.transform.localScale=new Vector2(outsideSize, outsideSize);
        insideMaxsize = outsideSize * 0.5f;
        insideMinsize = 0.15f;
        insideSize = Random.Range(insideMinsize, insideMaxsize);
        insideComponent.transform.localScale = new Vector2(insideSize, insideSize);

        enemyNo = Random.Range(0, 4);
    }
}

And I have attached a script to the prefab which is being instantiated and that script is:
 using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class destroyer : MonoBehaviour
{

    Circles circles;

    CircleCollider2D collider1;
    Collider2D collider2;

    private void Start()
    {

        circles = FindObjectOfType<Circles>();

        print("1 max"+collider1.bounds.max);
        print("1 min" + collider1.bounds.min);
        print("2 max" + collider2.bounds.max);
        print("2 min" + collider2.bounds.min);

    }

    private void OnEnable()
    {
        collider1 = gameObject.transform.GetChild(0).GetComponent<CircleCollider2D>();
        collider2 = gameObject.transform.GetChild(1).GetComponent<Collider2D>();
    }

    void OnTriggerStay2D(Collider2D other)
    {
        print("star max"+other.bounds.max);
        print("star min" + other.bounds.min);

        if (collider1.bounds.Contains(other.bounds.max) && collider1.bounds.Contains(other.bounds.min))
       {

            if (other.bounds.Contains(collider2.bounds.max) && other.bounds.Contains(collider2.bounds.min))
            {

                    Destroy(other.gameObject);
                    Destroy(gameObject);
                    circles.instantiator();

            }

        }
    }
}

the problem is that the z axis bounds of the colliders are coming out to be 15.8
when the prefab is instantiated and when I drag the prefab to scene then the z axis bounds of the collider is 0. I want the z axis bounds of the colliders to be 0 when the prefab is instantiated

sentences:
Bilinear filter in repeating texture, HLSL I have a repeating texture that I'm using as a scroll surface.  The idea is that as I pan the surface I adjust the texture coordinates, filling in what gets wrapped on the right as it disappears from the left.  This is all working quite well.

When bilinear filtering is switched on (D3DTEXF_LINEAR) I think the repeat filters the edge of the texture with the corresponding pixels on the other side given the wrap.  This is wrong of course.

I've had a look around for bilinear filtering shaders that ignore edge texels but can't seem to find anything.  Does anyone have an ideas about how to do this?  Is there a way of configuring a sampler to ignore edge texels when filtering?  Is there a bilinear filtering shader knocking around I can use as a reference?

sentences:
Unity UNET, problems spawning and then destroying that instantiated prefab I am very new to networking, and have ran into an issue, read below.

I have multiplayer system setup, where players can spawn, they can pick up weapons and drop them, there is an object representing a pickup with network identity component attached and local player authority enable, the player can come up to it and press "E", which will destroy the pickup object, then the player can press I to to "drop" that weapon, which instantiates it infront of the player, now this is what should happen, and it works on single player, but when there's 2 players, for second player(client only) it doesn't work as it should.

I have 1 script weapon manager and another small, Pickup (on pickup object child with trigger).

Below is the code and according description of my attempt so far:

Below is PickUp script (on 1st child of pickup object with trigger enabled)

private void OnTriggerStay(Collider other)
{
    if (other.CompareTag("Player"))
    {
        if (Input.GetKeyDown(KeyCode.E))
        {
            //Call pickup function on player, passing the weapon id and parent gameobject
            other.GetComponent<WeaponManager>().PickUpWeapon(weaponID, transform.parent.gameObject);
        }
    }
}

Below is WeaponManager script (on player)

public void PickUpWeapon(int id, GameObject go)
{
    CmdDestroyObj(go);

    //... (other code, not relevent)
}

[Command]
void CmdDestroyObj(GameObject obj)
{
    RpcDestroyObj(obj);
}

[ClientRpc]
void RpcDestroyObj(GameObject obj)
{
    // HERE obj is NULL   (!!ERROR!!)
    Destroy(obj);
}

Above in RpcDestroyObj() obj is null

void Update(){
  if(isLocalPlayer)
  {
    if (Input.GetKeyDown(KeyCode.I))
    {
       if (slots[currentActiveSlot] != null)
       {
          CmdDropWeapon();
       }
    }
  }
}

Then here's CmdDropWeapon() function:

[Command]
void CmdDropWeapon()
{
    RpcDropWeapon();
}

Here's RpcDropWeapon() function:

[ClientRpc]
void RpcDropWeapon()
{
    GameObject _drop = (GameObject)Instantiate(drops[currentGun.GetComponent<WeaponStats>().id], transform.position + transform.forward, Quaternion.identity);
    _drop.GetComponent<Rigidbody>().AddForce(transform.forward * 25000f * Time.deltaTime);

    CmdDestroyWeaponHeld() //Destroy currently held weapon (don't pay attention, not relevent to current problem

    currentGun = null;

    if (isLocalPlayer)
    {
        GetComponent<PlayerSetup>().playerUIInstance.GetComponent<PlayerUI>().SetInventorySlotFill(currentActiveSlot, -1);
        emptyHanded = true;
    }
}

On single player (so host & client), everything works besides destroying the pickup prefab that is Instantiated.

On multiplayer, second player (client only), can pick up and drop weapons as well as the originally spawned weapon is destroyed, but destroying the newly instantiated (so after player drops it) pickup object doesn't work.

(In the console there are no errors when UnityEditor is the Lan host/server, when 2 players are playing and I try picking up and dropping weapons several times from client side)

Why is this not working? I would appreciate any help/assistance in getting this right and sync over network for all players.

My guess is that, rpc function Instantiates the drop prefab but it's kind of different on all clients, so the server or another client doesn't have exactly the same object in the scene which means it will not find it and return null.

Let me know if you need any additional information.

Thanks a lot in advance!

sentences:
what exactly is the logic behind 6502 and precise clock cycle emulation? Key questions to consider based on page 10 of this document:

http://archive.6502.org/datasheets/rockwell_r650x_r651x.pdf

What does page 10 imply by "Add 1 to N if page boundary is crossed"?
What does page 10 imply "Add 1 to N if branch occurs on the same page?"
What does it mean by add 2 to N if branch occurs to different page?
Does read and write to other devices ie.RAM cause any irregularities in clock cycles?
Are there any other factors that could affect clock cycles on the 6502 (more specifically the NES) ?

sentences:
How to achieve the top-down (oblique) projection of textures using an OrthographicCamera? This question is related to (How to calculate the initial velocity of projectile motion by a given distance and angle from point A to B) question.

Details

In the below image is the graphical projection of top-down (oblique).

And this is the pattern that I used to reference.

Currently

From the answer, the Coordinate systems describes how the oblique projection works.

screenPos.x = (worldPos.x - cameraOffset.x) * zoomFactor;
screenPos.y = (worldPos.y + worldPos.z - cameraOffset.y) * zoomFactor;

From the related question, currently the camera that I'm using is OrthographicCamera.

Additional question

In the above GIF animation, do I need to customize OrthographicCamera class to achieve the oblique projection? Or do I need to create a new ObliqueCamera class that extends Camera? (If yes, what pointers do I need to review to be able to do it, because I am new to graphical projection).

sentences: Lighting, shader and GI is messing up the materials in Unity3D Hello Guys I am not very sound with Unity3D Lightmapping. Currently I have a set of low poly items in my scene. Textures on my models are getting washed out. They totally look absurd. here is a picture of expected (Right) vs current result (left)

sentences:
Create 2D sprites with libGdx using a shape and a texture separately I am creating a 2D game with LibGdx that will have creatures that are generated from dozens of characteristics with potentially millions of unique combinations. For each segment of each creature, I want to use two sprites so that I can mix shapes and colors and cut down on my resources. I would like one sprite to be a black and white (or grayscale) of the shape of the body part while the second sprite is just a color pattern. I think I may need to write a shader that splices the color pattern onto my shape to give me the sprite I need. I just need some guidance on how to get started.

Another way of explaining this is with the example of clothing. I want to be able to draw a shirt shape, and pants shape, a socks shape, etc. and also draw different fabric patterns. Then I would mix and match the clothing with the pattern instead of drawing every possible combination. How can I accomplish this with LibGdx?

sentences:
Should I be using Lua for game logic on mobile devices? As above really,

I'm writing an android based game in my spare time (android because it's free and I've no real aspirations to do anything commercial).

The game logic comes from a very typical component based model whereby entities exist and have components attached to them and messages are sent to and fro in order to make things happen.

Obviously the layer for actually performing that is thin, and if I were to write an iPhone version of this app, I'd have to re-write the renderer and core driver (of this component based system) in Objective C.

The entities are just flat files determining the names of the components to be added, and the components themselves are simple, single-purpose objects containing the logic for the entity.

Now, if I write all the logic for those components in Java, then I'd have to re-write them on Objective C if I decided to do an iPhone port. As the bulk of the application logic is contained within these components, they would, in an ideal world, be written in some platform-agnostic language/script/DSL which could then just be loaded into the app on whatever platform.

I've been led to believe however that this is not an ideal world though, and that Lua performance etc on mobile devices still isn't up to scratch, that the overhead is too much and that I'd run into troubles later if I went down that route?

Is this actually the case? Obviously this is just a hypothetical question, I'm happy writing them all in Java as it's simple and easy get things off the ground, but say I actually enjoy making this game (unlikely, given how much I'm currently disliking having to deal with all those different mobile devices) and I wanted to make a commercially viable game - would I use Lua or would I just take the hit when it came to porting and just re-write all the code?

sentences:
Detecting collisions with a wall before Update I'm making a script in unity to control (movement) a character in 3rd person and 3D space.

For that I'm using the CharacterController component.

All pretty standard: inside the update method a Vector3 which will be passed to CharacterController.move is crafted based on the input and collisions, movement and jumping are perfectly fine but I ran into an issue when trying to make a wall jump.

There are 3 steps involved in this:

Get the wall to jump of.
Check if the player pres the jump button.
Move the player in the desired direction.

An this is how I'm doing it:

void OnControllerColliderHit(ControllerColliderHit hit) {
   if(mController.collisionFlags==CollisionFlags.Sides) {
       //Get wall normal
       wallNormal=hit.normal;
       isOnAWall=true;
   }
}

Now inside Update

if(Input.GetButtonDown("Jump")&isOnAWall) {
    //jump...
}

And this work fine in most cases but only if player is giving input or last wall has a similar normal as current so obviously the normal isn't refreshing properly, but why?

Well, after some testing, I discovered that the OnControllerColliderHitis called after the Update method, and this is what I think is happening:

Physics engine detect the collision and stops the player
Update method not having any input just send it downwards
The OnControllerColliderHit method is not triggered(this part I am
sure)

Are my conclusions correct?

How can I fix this? (make the player jump without need to move the stick and just with the button)

sentences:
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:
margin of error trying to check if a point lays on line Working with floating point values it is as easy as breathing to run on approximation errors by comparing quantities which should be the same. I want to know if there is a way built in some MSDN (or even external) library for c# to ignore the problem.

An example could be: more than comparing 2 float values like this

if(myVector3.X == anotherVector3.X)

I would appreciate something like this

if(myVector3.X.isInTheNeighbourhood(anotherVector3.X))

This is not well-written, I know. That is just to simplify the explaination. What I am exactly doing is checking if a point (Vector3) lays on line segment. So basically the calculations I make are nothing more than

(x - x1)/(x2 - x1) = (y - y1)/(y2 - y1) = (z - z1)/(z2 - z1)

But these values won't be always the same, so I need to write down some code which includes a sort of tolerance a sort of Neighbourhood mathematical concept to accept values close enought to the line.

Hope that I made myself clear.
Has anyone a solution for this?

sentences:
Efficient path-finding in free space I've got a game situated in space, and I'd like to issue movement orders, which requires pathfinding. Now, it's my understanding that A* and such mostly apply to trees, and not empty space which does not have pathfinding nodes. I have some obstacles, which are currently expressed as fixed AABBs- that is, there is no unbounded "terrain" obstacle. In addition, I expect most obstacles to be reasonably approximable as cubes or spheres.

So I've been thinking of applying a much simpler pathfinding algorithm- that is, simply cast a ray from the current position to the target position, and then I can get a list of obstacles using spatial partitioning relatively quickly. What I'm not so sure about is how to determine the part where the ordered unit manoeuvres around the obstacles.

What I've been thinking so far is that I will simply use potential fields- that is, all units will feel a strong repulsive force away from each other and a moderate force towards the desired point. This also has the advantage that to issue group orders, I can simply order a mid-level force towards another entity. But this obviously won't achieve the optimal solution.

Will potential fields achieve a reasonable approximation given my parameters, or do I need another solution?

sentences:
How do I move many "static relative to each other" objects around? I'm currently building an Elevator Bank simulator in Unity3d and I'm stuck on how to reduce the amount of objects it's going to generate when it's done. The simulator will consist of one player (for now) walking into a building, calling an elevator, picking a floor, going up/down and getting out of the elevator again.

To illustrate the problem, I'll sketch 2 scenario's. One where there's no problem whatsoever. One where I simply scale upwards and create a mess. But first, a list of what's inside the simulator (excluding the player).

One hull of elevator shafts (3D .obj model).
One elevator car per shaft (3D .obj model).
One group of hall buttons per shaft per floor (one button for the top & bottom floor, two for the rest).
One group of control buttons per elevator car (door open, door closed, etc.). At least 3 buttons.
One floor call button per elevator car per floor.
Two doors per elevator car.
Two doors per shaft per floor.

A simple set-up of 3 shafts and 4 floors will already create 75 objects of which 30 are moving. Take 20 floors, 2 rows of elevators, 3 cars per row and I'm over 600 objects already.

Now. The Empire State building has 102 floors and 73 elevators. Which means multiple banks, a whole lot of floors, a whole lot of buttons and a whole lot of cars. Scaling my current set-up to support that will create a mess at best and simply won't work at worst.

Since this is an elevator simulator, the whole point of it is to make sure every elevator is active from starting the scene to ending the scene. So no tricks like only spawning what's in range of a camera, hibernating objects, object pooling and what not are out.

Now, objects in the same elevator car are static relative to each other. If the car moves up, everything moves up the same amount. So I hope I can move them as a group. Except I have no clue how to do such a thing in Unity. Prefabs may be part of the solution, but that still won't link their movements together. I've considered linking them together like a Snake game, but the amount of objects involved is orders of magnitude more. Luckily, all moving objects (except for the player) will only move on one axis. Doors only slide open/closed, elevator cars and their buttons go up and down. All rotations are fixed.

How do I move so many objects around in a single scene without creating a mess of variables in a performance-wise good way?

sentences:
Can't get AABB Collision to work properly This is the code I'm using to resolve collisions on the players left side. It works when I'm on the ground, but if I'm falling, it does not work.

public static boolean onWall(Rectangle rect1, Rectangle rect2){

    if(rect1.x > rect2.x && rect1.x <= rect2.x + rect2.width && ((rect1.y > rect2.y && rect1.y < rect2.y + rect2.height) || rect1.y + rect1.height > rect2.y && rect1.y + rect1.height < rect2.y + rect2.height)){
        rect1.x = rect2.x + rect2.width;
        return true;
    }

    return false;

}

sentences:
PHP browser game energy recover time I would like to create something very simple. A browser game, where user can waste its energy and ability points. Unlike other games here there won't be no levels. So energy and ability points restore with the time.

How can I do that in the most efficient way?
For example, i have 100 energy points, one point restores every 2 min.

I was thinking about cron-jobs, but that will be not so efficient.

Thank you in advance!

sentences:
Exporting Blender bones' transform matrix I use this simple python script to export bones transformation:

bones = armature.pose.bones
# for eaach bone in bones
SystemMatrix = Matrix.Scale(-1, 4, Vector((0, 0, 1))) * Matrix.Rotation(radians(-90), 4, 'X')
if (bone.parent):
  Export_babylon.write_matrix4(file_handler, "matrix", bone.parent.matrix.inverted() * bone.matrix)
else:
  Export_babylon.write_matrix4(file_handler, "matrix", SystemMatrix * bone.matrix)

I'm using a left handed Y up system but I should forget something about rotation because the result is not correct :(

Original (under Blender):

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:
How to find position of the edge of an object? I have two planes and I want to put both planes one after another so that I can form a road. I set them from the editor and that was very easy but I wanted to do this from code. So in the code:

void Start() {
  secondRoad.position = firstRoad.position;
}

But this just set the second plane in the center of the first plane, kind of overlapping. But I want the second plane to be placed next to the first plane where it ends right the edge of the first plane. How will I do this?

sentences:
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 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:
Get width of a 2D GameObject in Unity I'm trying to get the width and height of a 2D GameObject.
My GameObject is simply a prefab created using sprite.

I have tried solutions from other posts but they don't work for me:

Vector2 size = myGameObject.GetComponent<CircleCollider2D>().bounds.size;
float width = size.x;
float height = size.y;

and

Vector2 size = myGameObject.GetComponent<Collider2D>().bounds.size;
float width = size.x;
float height = size.y;

My prefab has a Circle Collider 2D but x and y always returns 0

I'm using Unity 5.5.0f3, not sure if previous solutions apply to this version.

sentences:
How do I avoid 3D AABB collision response getting stuck at block edges? I want the player to be able to slide along cubes, but without getting caught at the seam between 2 adjacent cubes.  I've gotten it so that I can do x collision, with sliding, and y, and z, but I can't do them together, probably because I don't know how to resolve it correctly.

Here's an example:

[]
[]
[]
[]O
[]

Pretend all the tiles are touching. O is the player (moving upward). The methods I was trying would get the player stuck between the cubes because the z axis was responding and kicking me out.

I don't know how to resolve this in all 3 directions, like how would I go about telling which direction I have to resolve in.  My previous methods involved me checking 4 points in a axis aligned square around the player, I was checking if these points where inside the cubes and if they where fixing my position, but I couldn't get it working correctly.

sentences:
Android Loading Screen: How do I use a stack to load elements? I have some problems with figuring out what value I should put in the function:

int value_needed_to_figure_out = X;
ProgressBar.incrementProgressBy(value_needed_to_figure_out);

I've been researching about loading screens and how to use them. Some examples I've seen have implemented Thread.sleep() in a Handler.post(new Runnable()) function. To me, I got most of that concept of using the Handler to update the ProgressBar, while pretending to do some heavy crunching work. So, I kept looking.

I have read this thread here: How do I load chunks of data from an assest manager during a loading screen?

It said that I can try using a stack it needs to load, and adding a size counter as I add elements to the stack. What does it mean? This is the part where I'm totally stumped.

If anyone would provide some hints, I'll gladly appreciate it. Thanks in advance.

sentences:
Is there a tool to automatically pack individual textures into one big png? I'm currently was working on a texture pack for minecraft (but this question is not restricted to that). All terrain textures are squared and stored in one big terrain.png. (FYI that's from Glimmar's Steampunk pack). I'd like to store each texture in an individual file and have same automated process pack them into the terrain.png later on (maybe leaving the not yet created ones their default). At the moment I do this manually by copy/pasting them with gimp (at least the raster helps a lot here) but I'd really like to do this automatically. Basically this seems to be what happens behind the scenes of the Painterly pack customizer already. So,

  Is there a tool that replaces some squarespolygons* in a png file with new ones (also png), the position of which might be configured in a separate file?

edit Some automated resizing for different resolution versions might be nice as well...

edit2 Meanwhile I learned that "position [...] configured in a separate file" means atlas, and since the question originated from Minecraft texture packs (IIRC the format got changed meanwhile), the ideal tool would allow for using an existing atlas to replace some of the tiles

*) might as well ask the general case

sentences:
Why can't I create an unordered access view of a R32G32B32_UINT buffer? So I'm trying to create an unordered access view for a buffer having with three component elements, but it fails with this warning:

D3D11 ERROR: ID3D11Device::CreateUnorderedAccessView:
The format (0x7, R32G32B32_UINT) cannot be used with a Typed Unordered Access View.
[ STATE_CREATION ERROR #2097343: CREATEUNORDEREDACCESSVIEW_INVALIDFORMAT].

This is my code:

void test(ID3D11Device* dev_ctx) {
  D3D11_BUFFER_DESC buff_desc;
  memset(&buff_desc, 0, sizeof(buff_desc));

  buff_desc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS;
  buff_desc.ByteWidth = 1024 * 12;
  buff_desc.CPUAccessFlags = 0;
  buff_desc.MiscFlags = 0;
  buff_desc.StructureByteStride = 12;
  buff_desc.Usage = D3D11_USAGE_DEFAULT;

  ID3D11Buffer* buff_ptr = nullptr;
  dev_ctx->CreateBuffer(&buff_desc, nullptr, &buff_ptr);

  if (!buff_ptr)
    return;

  D3D11_UNORDERED_ACCESS_VIEW_DESC uav_desc;
  uav_desc.Format = DXGI_FORMAT_R32G32B32_UINT;
  uav_desc.ViewDimension = D3D11_UAV_DIMENSION_BUFFER;
  uav_desc.Buffer.FirstElement = 0;
  uav_desc.Buffer.Flags = 0;
  uav_desc.Buffer.NumElements = 1024;

  ID3D11UnorderedAccessView* uav_ptr = nullptr;
  dev_ctx->CreateUnorderedAccessView(buff_ptr, &uav_desc, &uav_ptr);

  if (!uav_ptr)
    return;
  }

It fails for any resource with three components (R32G32B32_*), but it works
if the resource has 1/2/4 components. So what could be the problem?

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 to implement friction in a physics engine based on "Advanced Character Physics" I have implemented a physics engine based on the concepts in the classic text Advanced Character Physics by Thomas Jakobsen. Friction is only discussed very briefly in the article and Jakobsen himself notes how "other and better friction models than this could and should be implemented."

Generally how could one implement a believable friction model on top of the concepts from the mentioned article? And how could the found friction be translated into rotation on a circle?

I do not want this question to be about my specific implementation but about how to combine Jakobsens ideas with a great friction system more generally. But here is a live demo showing the current state of my engine which does not handle friction in any way: http://jsfiddle.net/Z7ECB/embedded/result/

Below is a picture showing and example on how collision detection could work in an engine based in the paper. In the Verlet integration the current and previous position is always stored. Based on these a new position is calculated. In every frame I calculate the distance between the circles and the lines. If this distance is less than a circles radius a collision has occurred and the circle is projected perpendicular out of the  offending line according to the size of the overlap (offset on the picture).

Velocity is implicit due to Verlet integration so changing position also changes the velocity. What I need to do know is to somehow determine the amount of friction on the circle and move it backwards parallel to the line in order to reduce its speed.

sentences:
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:
How to render models using a personalized projection matrix? I'm creating a game with a great sprite demand. Out team is considering automatizing the sprite generation using 3D models. The problem is we have a very particular ortographic projection:

We have already set up a good projection matrix. The problem is none of the 3D renderer of nowadays have an option for using custom matrixes.

How is this kind of problem dealt with?

sentences:
Unity UI subpixel rendering/antialiasing with Image.fillAmount? I'm using DoTween to tween the fillAmount of a UI Image. When I check the value, it changes smoothly, and in the scene view it appears to transition smooth.
However it appears jerky in the game view, and seems to step for each pixel, so it seems resolution dependent. Is there any way to have the UI render subpixels (?) or antialiased so it uses colors between green/white to have it appear to move more smoothly?
Thanks!

sentences: How can I import an Excel file in an Unity WebGL game? Currently, we have a project that runs on Windows and uses an Excel spreadsheet to save/retrive some data/information. Now we want to build that project for WebGL. The problem is that file reading support is not available on the WebGL platform.  How do I solve this problem? Do I need to write a backend or there another way to use excel in WebGL platform even though the file reading API of the .NET framework is not supported on WebGL?

sentences:
GameMaker: Studio - Slow down calculations I currently have an orbital simulator, with a brilliant answer in another Game Development question here, and would like to know how to slow down the calculations of Game Maker, to be able to do more precise ones as my orbits suffer variably intense Apsidal Precession.

Examples of this can be found in games such as Kerbal Space Program and
Universe Sandbox 1/2. In KSP, you have the Max Physics Delta Time which allows slower gameplay, but more calculations. In Universe Sandbox you are able to change the accuracy of calculations causing orbits to go crazy and extremely precise.

How am I able to implement such a thing into GameMaker: Studio?

sentences:
State of the art in image compression? I'm looking for good algorithms for compressing textures offline (ie decompressing them at install or load time, I know about using DXT/3DC to save runtime video memory, but these create awful visual artifacts while often being larger in disk than a lossless format like JPEG-LS, even after using LZMA or something for entropy). Since the data will only need to be read by my program, I don't need a portable format like JPEG, which means I'm open to more experimental algorithms. To be clear, I'm concerned with reducing the download size of my game; I will be using them uncompressed on the video card.

I'm looking for formats that support different features... For example, 10 bits-per-channel color (HDR) for higher color fidelity under dynamic lighting conditions, normal map formats(16 bits in X and Y), alpha channels, etc, etc...

NOTE: My particular use case is for 2.5D backgrounds. In their uncompressed format, they are 10 bytes per pixel stored in 3 textures:

4 bytes - color  - D3DFMT_A2R10G10B10
4 bytes - normal - D3DFMT_G16R16F
2 bytes - depth  - D3DFMT_R16F

I store these in 1024x1024 tiles, and since every area has a different background, these can get really large really fast. However, I think knowing more about image codecs in general will help with finding an efficient method to compress these.

sentences:
Programmer career roadmap this is my first post on this SE, and I have noticed the large numbers of closed/downvoted career-related questions, so I will try to ask in a fashion most gingerly.

What would the career roadmap for a video game programmer be like? There seems to be a consensus that the video game industry is not so structured, and a roadmap would not be useful at all.

To be more specific, I understand the difference between role and title, IE there may be one person with the title "Engine Programmer", but he may do other things, and other people may do his role as well.

How would I chart out my career road map? Would it be simply moving from a junior programmer in a certain field, to a more senior position on that field, or are there certain fields which are inherently more senior than others?

Notes:

I am currently studying for a degree in video game programming
This is for an assignment, and I am told to consult real developers to be able to better perform.

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:
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:
ASP.NET MVC & SQL Server vs. PHP & MySql I'm going to develop a strategy browser-based game with ASP.NET MVC and SQL Server.

However, as I explored the web to get some ideas and patterns from existing games, I found out that none of them developed by .NET tools.

So, it made a question for me that what's the reason behind this...:

1) Is there any big draw back for microsoft technologies in this area?

2) Why all of games in this field are developed with PHP & (maybe1?) MySql?

3) Is there any performance issue with above mentioned microsoft technologies in this area?

Thanks in advance

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: Phaser Editor / Phaser 2 Resize State I’m working with Phaser Editor, and I was wondering if it was possible to resize the scene with the editor or just plain Phaser 2. I want to resize the world, by which I mean to make a camera follow the player past the screen, but I can’t figure out how in the docs for phaser 2 or phaser editor. Can someone help?

sentences:
3D Studio Max biped restrictions? I have a stock biped character in 3D studio max which has a jump animation.

The problem I have with the jump animation is that there is actual y offset happening inside it which makes it awkward to play while the character is jumping since it's not only jumping in the game world but the jump animation is adding its own height offset.

I'm tryuing to remove the jump animations height offset, so far I've found the root node and deleted all its key frames which has helped a bit.

The problem I'm having now is that the character still has some height offset and if I try to lower it it has a fake 'ground' that isn't at 0 and the limbs sort of bend on the imaginary floor, si there a way to remove this restriction just for the jump animation?

Here's what I mean: http://i.imgur.com/qoWIR.png

Any idea for a fix? I'm using Unity 3D if that opens any other possibilities...

sentences:
FB.Init() is not accepting in my c# Script I am trying to connect fb with my game. its first time i am connecting fb with game. i downloaded fb SDk  7.3.0 and i am using unity 5.2.1f1. i imported the sdk in my game asset. then i created a new c# script "FBholder". in Awake() i tried to use FB.Init(). but its not accepting. all other scripts used inside the game are calling correctly, only the scripts came with fb sdk is not working.

 using UnityEngine;
 using System.Collections;

public class Fbholder : MonoBehaviour {

// Use this for initialization
void Awake() {
    FB.Init (SetInit, OnHideUnity);// This line is not accepting
}
}

i Used this Video for my referance

sentences:
Math.Clamp won't limit my position until movement is ceased The program is in a top down view, with Y going up (or forward depending upon how you see it), and X going from left to right based on the camera view. I am attempting to set the minimum and maximum values of my main character's x/y-axis movement through the float "clamp", under the struct "Mathf".

When my ship passes the minimum/maximum value on either axis, it doesn't stop it. If you release the movement key after passing the point, the character will appear directly on the minimum/maximum point that was passed. See the gif below.

Gif here http://gph.is/22fdHv4

Below is the current script running for both player movement and the boundary, attached to the main character.

using UnityEngine;
using System.Collections;

public class ShipMovement : MonoBehaviour {

public float xMin;
public float xMax;
public float yMin;
public float yMax;
public float speed = 2f;
public float shotSpeed = 4f;
public float nextFire1;
public float nextFire2;
//Animator anim;
public GameObject shot;
public Transform shotSpawn;
public float fireRate = 0.25f;

void Start () {

//anim = GetComponent<Animator> ();
}

void FixedUpdate () {

        GetComponent<Rigidbody> ().position = new Vector3 (
            Mathf.Clamp (transform.position.x, xMin, xMax ),
            Mathf.Clamp (transform.position.y, yMin, yMax),
            0.0f
        );

        if (Input.GetKey (KeyCode.W)) {
        transform.Translate (Vector2.up * speed * Time.deltaTime);
        //anim.SetBool ("moving", true);
    }
        if (Input.GetKey (KeyCode.S)) {
        transform.Translate (Vector2.down * speed * Time.deltaTime);
        //anim.SetBool ("moving", true);
    }
        if (Input.GetKey (KeyCode.A)) {
        transform.Translate (Vector2.left * speed * Time.deltaTime);
        //anim.SetBool ("moving", true);
    }
        if (Input.GetKey (KeyCode.D)) {
        transform.Translate (Vector2.right * speed * Time.deltaTime);
        //anim.SetBool ("moving", true);
    } else {
        //anim.SetBool ("moving", false);
    }

    if (Input.GetKey (KeyCode.Space) && Time.time > nextFire1)
    {
        nextFire1 = Time.time + fireRate;
        Instantiate(shot, shotSpawn.position, shotSpawn.rotation);
    }

    if (Input.GetKey (KeyCode.X) && Time.time > nextFire2) {
        nextFire2 = Time.time + fireRate;
        Instantiate (shot, shotSpawn.position, shotSpawn.rotation);
    }

    if (gameObject == null) {
        Application.Quit ();
      }
   }
}

Although I am not sure, I suspect it may have something to with the way I am controlling the movement. I have had issues with what I have written in the past, especially with animations and moving left/right while also moving up/down. (Hence why I have all of the animation code commented out, and I am using a Capsule instead of a ship).

If anything else is needed, I can provide it.

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:
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:
Red5 or zendZMF or BlazeDS or Cirrus? I've been trying to develop a multiplayer turn based game which is mostly free to play - I just want to see if the game idea is appreciated - hence I want to do it with minimal cost and I'm confused which one of these to use: red5, zendamf, BlazeDS or Cirrus.

Red5 seemed the best option for me initially but getting a media server to host seems to be quite expensive. Same reason why I couldn't use Electroserver - cost. Both are very attractive options though.

ZendAMF then looked a feasible option since it supported remoting. But how do I let the other players get updates on actions of one player through zendAMF, which as far as I know does not do data push. I'll have to do it by polling - asking server constantly for updates - which wont look very real time.

Then I heard about BlazeDS which does support data push. Now I have to learn java if I want to use that and get a new web host because my existing host does not have tomcat.

Then I heard about cirrus which is still in 'codename cirrus' stage. It looks like a very feasible option since its peer to peer with miniamal server support needed. Is it good for a mutiplayer game?

Well if anyone has experience developing multiplayer flash games I'd like to know if a turn based multiplayer game with more than two players participating can be implemented using zendamf. ZendAMF because I know PHP and AS3.

sentences:
How to initiate a TCP secure connection using LibGdx to a remote server? Can anyone point to a link or share with me a piece of code which does:
- Base on LibGdx (Gdx.net package)
- Use a TCP secure connection to connect to a remote server

Many thanks

sentences:
algorithm to change the center of the image I need and algorithm in Java if possible to change the center of the image when scaling.What is happening to me is represented in the first image:
when I scale the image the image scale according to the center point of the image, what I want to do is on image2, I want to create a point A and make the image scale using that point on the horizontal line (y=540).

I have the screen size(1920x1080) the horizontal line y=540, the length and width of the rectangle, image_X=0,image_Y=0 will put the center point o x=0 and y=0, (on the image example x=1000)

Every time I do scale_image=2 the image is reduced to half the size, which is fine but it does that using center point. What I want to do is to adjust image_Y so it uses point A as the new center.

sentences:
Unity3d wheelcollider falling through terrain I have created simple project with 3D car and terrain. I have added 4 Wheel Colliders on model wheels. But when I run project wheels falling through terrain.

Before run:

After run:

I am sure that at start wheel colliders above the terrain and not intersect it. Configuration is:

In what problem is? I have tried a lot of different things but I can't find a solution.

sentences:
Returning The Position Of A Sprite Drawn & Updated By A List My problem is this, when iceBoy hits any of the newGrounds in the ground.groundAmmount list, it will return the specific position of this newGround so that i can set iceBoy's position based on the newGround that he touched. Here is the code that i have for this:

foreach (Ground newGround in ground.groundAmmount)
{
      if (HitGround())
      {
           iceBoy.position.Y = newGround.position.Y;
      }
}

but like Byte56 this will only loop through all of the newGrounds in the list and then iceBoy.position.Y will only equal the last newGround added to the list. how could i create another method that will have a return value of the position of the exact newGround that iceBoy is touching?

sentences:
Processing Vs Memory Optimization I'm creating a game with a lot of elements. Should I store all components that I'll eventually access on class variables (memory) or should I access them when running the script(processor)?

Example:

private SpriteRenderer sprite;

void Start () {
   sprite = GetComponent<SpriteRenderer>();
}

public void StartMovement()
{
    sprite.doSomething();
}

VS

void Start () {

}

public void StartMovement()
{
    GetComponent<SpriteRenderer>().doSomething();
}

sentences:
Combining several animations into a single FBX I'm trying to figure out a workflow for preparing character animations for Unity so that they are all combined in a single FBX file. The advantage as far as I see it is that it then uses only a single skeleton where multiple animation files would each have their own skeleton (which I think is unnecessary and would increase size considerably).

I've tried using Maya for this but haven't been successful so far. Then I tried Motionbuilder and I can get the animations (takes) together into a single file but many of the animations don't look right afterwards.

So I was wondering does anyone know of a solid workflow to achieve this? I'm having a hard time finding information about what I'm trying to achieve. This is probably a piece of cake for experienced animators but I'm just starting with animation now.

So how do you combine several animation FBX files into single one (whith either Maya, Motionbuilder, or 3DSMax) and make sure that the animations are all properly retained like they should? I'm sure there are some additional things to take care of but I don't know exactly what they are.

sentences:
How to import Cocos2d-x in codeblocks ide? Is it possible to import cocos2d-x in codeblocks just as in xcode ?? How can I do that ?

I use ubuntu. It is not possible to use xcode in ubuntu. Cocos2dx is in c++. How can I use codeblocks for game development with cocos2dx??

Thanks

sentences:
The camera goes up and down when following a rolling sphere I have this CameraController script attached to my camera, to follow a sphere that moves using WSAD.

public class CameraController : MonoBehaviour
{

    public GameObject player;

    private Vector3 offset;
    // Start is called before the first frame update
    void Start()
    {
        offset = transform.position - player.transform.position;
    }

    // Update is called once per frame
    void FixedUpdate()
    {
        transform.position = player.transform.position + offset;
    }
}

It follows the object fine, but it bounces up and down on the Y axis when it's moving, and I don't know how to stop the camera from doing it.

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:
How can I rotate a bitmap without D3D or OpenGL? I've just figured out on my own how to scale a portion of a bitmap using PutPixel. I would like to know the mathematical theory behind rotating a bitmap on my own, using per-pixel operations like PutPixel.

I am not interested in using OpenGL or Direct3D to accomplish this, I'd like to know what the fundamental math and programming technique behind the operation is?

sentences:
Need Feedback for PHP & MySQL Saving Game Progress My team is planning to create a simulation game using Javascript, CodeIgniter and MySQL for the backend.

It will be mostly click based, ie: There will be buttons for activities like Eat, Play, Study, etc, and in the game environment, one day will contain 3 phases, day, noon, night . And for each phase, users can pick between those activities and those activities will increase certain character parameters (Intelligence, Focus, Fun, etc) then the game will progress to the next phase. Once it's night, the game will progress to the next day.

So I need feedbacks on how to saving the game progress. Here's what I had in mind :

There will be a table for Users (obviously) that will contain users' data including the parameters/stats, money, etc. Do you think the stats etc must be separated to another table so there will be a history of stat increases?

For the saving, I'm thinking of using a Logs table that record every activity is by users. So if in day 1 phase 1 (phase day) the user picks Eat, I will insert to this logs table more or less like : user_id = 1, day = 1, phase = 1, activity = eat. So for example when the user stops playing and exits the game after day 1 phase night, the database will have :

user_id = 1, day = 1, phase = 1, activity = eat
user_id = 1, day = 1, phase = 2, activity = play
user_id = 1, day = 1, phase = 3, activity = sleep

And when they continue the game, I will read from this table and get the latest row of this user_id, and after checking that the latest row is day 1 phase 3, the game interface will display day 2 phase 1. However, this means that the phases for a day must be fixed from the start, so I can't include, for example, random additional time phases outside these phases (think of it as an extra opportunity to increase the stats).

So what do you think? I hope the explanation is clear enough.

sentences:
Raycast wrong direction I use Physics.Raycast and transform.forward to shoot a ray in front of my gameobject, but the ray gets cast downwards instead.

if (Physics.Raycast(transform.position, transform.forward, out var hit, range))
{
   Debug.Log(hit.transform.name);
}

Debug.DrawRay(transform.position, transform.forward * 50, Color.green);

What's wrong with my code?

sentences:
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:
Should I call SDL_ConvertSurface right before SDL_CreateTextureFromSurface? Is there a significant benefit (or any benefit at all), when I convert SDL surface and create a texture from optimized surface?

Here is example of what I mean:

loadedSurface = IMG_Load(path);
optimSurface = SDL_ConvertSurface(loadedSurface, SURFACE_FORMAT, 0);
loadedTexture = SDL_CreateTextureFromSurface(renderer, optimSurface);
//return loadedTexture and destroy the rest

/*  VS  */

loadedSurface = IMG_Load(path);
loadedTexture = SDL_CreateTextureFromSurface(renderer, loadedSurface);
//return loadedTexture and destroy the rest

According to SDL2 documentation

  This function is used to optimize images for faster repeat blitting. This is accomplished by converting the original and storing the result as a new surface. The new, optimized surface can then be used as the source for future blits, making them faster.

Its tied with surface blitting, but I can't say its effect "within" texture.

Thank you

sentences:
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:
TMX crashes in Tablet 10″ Android 7.0 with Andengine I've developed a video game that has worked fine so far. When testing it in a Samsung Galxy A6 tablet (10" resolution with Android 7.0), I get the following error and the map won't load:

  Blockquote
  12-09 12:49:20.940: E/AndroidRuntime(9369): Process: cam.main, PID: 9369
  12-09 12:49:20.940: E/AndroidRuntime(9369): java.lang.NullPointerException: Attempt to read from field 'org.anddev.andengine.opengl.texture.region.TextureRegion org.anddev.andengine.entity.layer.tiled.tmx.TMXTile.mTextureRegion' on a null object reference
  12-09 12:49:20.940: E/AndroidRuntime(9369):     at org.anddev.andengine.entity.layer.tiled.tmx.TMXLayer.drawVertices(TMXLayer.java:220)
  12-09 12:49:20.940: E/AndroidRuntime(9369):     at org.anddev.andengine.entity.shape.Shape.doDraw(Shape.java:102)
  12-09 12:49:20.940: E/AndroidRuntime(9369):     at org.anddev.andengine.entity.Entity.onManagedDraw(Entity.java:991)
  12-09 12:49:20.940: E/AndroidRuntime(9369):     at org.anddev.andengine.entity.shape.Shape.onManagedDraw(Shape.java:120)
  12-09 12:49:20.940: E/AndroidRuntime(9369):     at org.anddev.andengine.entity.Entity.onDraw(Entity.java:875)
  12-09 12:49:20.940: E/AndroidRuntime(9369):     at org.anddev.andengine.entity.Entity.onManagedDrawChildren(Entity.java:1008)
  12-09 12:49:20.940: E/AndroidRuntime(9369):     at org.anddev.andengine.entity.Entity.onDrawChildren(Entity.java:1000)
  12-09 12:49:20.940: E/AndroidRuntime(9369):     at org.anddev.andengine.entity.Entity.onManagedDraw(Entity.java:993)
  12-09 12:49:20.940: E/AndroidRuntime(9369):     at org.anddev.andengine.entity.scene.Scene.onManagedDraw(Scene.java:233)
  12-09 12:49:20.940: E/AndroidRuntime(9369):     at org.anddev.andengine.entity.Entity.onDraw(Entity.java:875)
  12-09 12:49:20.940: E/AndroidRuntime(9369):     at org.anddev.andengine.engine.Engine.onDrawScene(Engine.java:517)
  12-09 12:49:20.940: E/AndroidRuntime(9369):     at org.anddev.andengine.engine.Engine.onDrawFrame(Engine.java:509)
  12-09 12:49:20.940: E/AndroidRuntime(9369):     at org.anddev.andengine.opengl.view.RenderSurfaceView$Renderer.onDrawFrame(RenderSurfaceView.java:154)
  12-09 12:49:20.940: E/AndroidRuntime(9369):     at org.anddev.andengine.opengl.view.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:617)
  12-09 12:49:20.940: E/AndroidRuntime(9369):     at org.anddev.andengine.opengl.view.GLSurfaceView$GLThread.run(GLSurfaceView.java:549)
  12-09 12:49:21.531: E/ApplicationPackageManager(4011): checkSettingsForIconTray value : 0

Rest of screens that are Android native work well. Please help!

sentences:
How to handle animations for a turn based deterministic game? I have a turn based combat system where all monsters act one turn, then all players, etc. The combat mechanics are completely deterministic - I can pre-calculate the outcome of a turn.

I'm interested if I should do all calculations ahead of time (monster A will be at X, monster B will be at Y), and then just play a bunch of animations based on these calculations:

(Calculate for A)
(Calculate for B)
(Animate A move to X)
(Animate B move to Y)

OR do one animation per calculation?

(Calculate for A)
(Animate A move to X)
(Calculate for B)
(Animate B move to Y)

sentences: Anyone know of an online resource with spritesheets from classic games? I'm looking for spritesheets for classic retro games, and old home computer games (c64, amiga etc.) Does anyone know of a source online?

sentences:
Lib-GDX GWT build will not load without Flash on some browsers I am trying to load my LibGDX application. Using Firefox without Flash on a  freshly installed Ubuntu system, it does not load.

I get this printed in the console:

SoundManager: No Flash detected. Trying HTML5-only mode. soundmanager2-jsmin.js:32:357
SoundManager V2.97a.20130512 (AS3/Flash 9) + HTML5 audio soundmanager2-jsmin.js:32:357<br/> SoundManager 2: soundManager: Fatal error: Flash is needed to play some required formats, but is not available. soundmanager2-jsmin.js:32:357
SoundManager 2 HTML5 support: mp3 = false (using flash), mp4 = false (using flash), ogg = true, opus = true, wav = true soundmanager2-jsmin.js:32:357
soundManager: No Flash response within expected time. Likely causes: Flash blocked or JS-Flash security error. soundmanager2-jsmin.js:32:357
soundManager: Waiting indefinitely for Flash (will recover if unblocked)...

And this on my screen:

I am assuming this is because of the lack of Flash and the fact that these audio formats are not supported in this version of Firefox. However, I am not using any audio in my game at all.

In my LibGDX HtmlLauncher, I have:

public GwtApplicationConfiguration getConfig () {
    GwtApplicationConfiguration config
        = new GwtApplicationConfiguration(getWindowInnerWidth(), getWindowInnerHeight());
    config.preferFlash = false;
    return config;
}

This did not fix anything. I am on the latest version of LibGDX, and the latest GWT SDK version. How do I fix this?

sentences:
Need help projecting 2D projectile motion in 2.5/isometric 2D game So I’ve been researching this a lot and have hit a road block. I’ve read pretty much every thread on here regarding this and while I understand the concept I don’t understand how to implement it. For reference I’m using Godot, but the explanation does not need to be in gdscript or anything.
Basically I have a projectile launcher and an isometric perspective. The best way I can describe what I am trying to achieve is a 8/16 bit Baseball game which many did this quite well. Visually simulating height and 3D physics in a 2D game.
I understand and have in my code the basic kinematic equations. So I can input variables such as initial velocity and the angle. I then get the X and Y position output as variables that update each processing tick, in this case 60 fps.
I’m using kinematic equations because I want to use those values in other places like the total distance and max height.
But this is in a 2D plane, basically from the side view, which would be perfect if I was making a side scroller.
I am having trouble projecting this XY position into the isometric view of my game.
Basically I have a distance and a height of my projectile.

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:
Use ARCore to detect marker and show information I'm new to AR, and am trying to use Google's ARCore to build a simple AR prototype. Basically if a logo is detected, I like to place some real-time charts or text information on the screen. Similar to this demo for placing a car on a logo using other SDKs.

Am I able to do this in ARCore (with Android Studio)? Is there any samples or examples showcasing similar concept?

sentences:
Make a door in a cube-wall I have created a wall using a cube in Unity. Now I want to create a door in it.

How can I make a door in that cube?

Consider that the cube is automatically generated, so i have to generate the door in a C# script.

sentences:
Using XNA ContentPipeline to export a file in a machine without full XNA GS My game uses the Content Pipeline to load the spriteSheet at runtime. The artist for the game sends me the modified spritesheet and I do a build in my machine and send him an updated project. So I'm looking for a way to generate the xnb files in his machine (this is the output of the content pipeline) without him having to install the full XNA Game studio.

I don't want my artist to install VS + Xna (I know there is a free version of VS but this won't scale once we add more people to the team).
I'm not interested in running this editor/tool in Xbox so a Windows only solution works.
I'm aware of MSBuild options but they require full XNA

I researched Shawn's blog and found the option of using Msbuild Sample or a new option in XNA 4.0 that looked promising here but seems like it has the same restriction: Need to install full XNA GS because the ContentPipeline is not part of the XNA redist.
So has anyone found a workaround for this?

sentences:
Facial expressions capabilities in various engines For a research project, I am developing a small game focused on non-verbal communication clues, like facial expressions (smiling, frowning, looking bored, etc), eyegazing, proxemics, etc. My main issue is facial expressions, as I can't find detailed info on various engines capabilities on that point.

I usually believe that the engine/language used doesn't matter, as you can more or less do anything with any engine/language, but in this case I need something as efficient as possible (I am time limited).

I have reduced my options to 4:

UDK
Unity
Skyrim Creation Kit
Source Engine

So, what are the capabilities of these 4 regarding facial expressions? And let's be honest, in which of them are they the easiest to implement/manipulate?

If there is another engine more appropriate, I'll be glad to hear about it too.

Thanks!

sentences: How control probability of win-lose in tile-matching games? In a random puzzle game, such as a match-three game, how can you control the probability of a winnable starting condition?

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 to create post-processing effects in Slick2D? As I get closer and closer to the end of the feature development for my game and the beginning of the graphical overhaul, I keep thinking of ideas for graphical effects that would make my game even better, but Slick2D is so limited in terms of graphical capabilities. The LWJGL layer is exposed, and thus, basic OpenGL functions, but I don't know anything about the various blending functions and other functions available to me.

A couple of the most basic things I need to be able to do are to be able to properly blend images and primitive shapes together, and to be able to create a proper lighting system. As of right now, I simply have a black and white "stencil" for my flashlight that I blend with a flat black layer that's drawn over everything and set its opacity so it sort of looks like a flashlight. However, I'd like it to look better and to be able to have other light sources in the scene.

Also, I'd really like to be able to have "glow" effects, such as electricity or fire that brighten up the scene and don't just look like flat pixels. Is it as simple as additively drawing these images/shapes to the scene? Or is there more to it?

I know Slick2D is horribly outdated and no longer supported and I never should have used it, but it's definitely the last time I'll be using it. I only went to it because Java has limited game libraries available and LibGDX was giving me a lot of trouble getting started.

I'd appreciate any articles and examples.

EDIT: As an example of the "glow" effect, here's a neat explosion effect created in Unity that I found on /r/gamedev. It would be great if I could get something like this in my game.

https://www.reddit.com/r/gamedev/comments/8wurqc/stylized_explosion_shader_breakdown/

sentences:
How 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: For a 2D XNA game, should I use the built in Vector2 or Vector3 or port my own class from ActionScript? I use a lot of 2D vectors in my Flash games - basically all velocities, positions etc I store in this way. My Vector2D class has lots of built in functions for rotation, dotproduct, projectOnto etc. The native Vector2 class doesn't seem to have half of this stuff, but it is used in a lot of places. The Vector3 has all this stuff, but has an extra dimension I don't need. So should I use either of the built in ones or port my AS3 class? Or should I try to extend Vector2 and add the extra functionality I need. Could that cause any problems?

sentences:
Translating Viewmatrix is inverted, why? So I've defined a Projectionmatrix, Viewmatrix and a Modelmatrix using OpenGL (LWJGL).

But when I translate my Viewmatrix to +X it moves my object to the right (hence my camera is moving to the left), and when I move it to -X the object moves to the left (camera moving to the right). Same goes for Y movement, Z works as it should though.

My matrices are as follows:

Projectionmatrix

perspectiveMatrix = new Matrix4f();
perspectiveMatrix.setIdentity();

float aspectRatio = WIDTH / HEIGHT;
float zRange = zNear - zFar;

//COLUMN / ROW
perspectiveMatrix.m00 = (float) (1.0f / (aspectRatio * Math.tan(degreesToRadians(fieldOfView / 2.0f))));
perspectiveMatrix.m11 =  (float) (1.0f / (Math.tan(degreesToRadians(fieldOfView / 2.0f))));
perspectiveMatrix.m22 = (-zNear - zFar) / zRange;
perspectiveMatrix.m23 = 1;
perspectiveMatrix.m32 = (2 * zFar * zNear) / zRange;

Viewmatrix

Matrices.viewMatrix = new Matrix4f();
    Matrix4f.setIdentity(Matrices.viewMatrix);

    //Initialize all vectors
    this.xAxis = new Vector3f();
    this.yAxis = new Vector3f();
    this.zAxis = new Vector3f();
    this.newPos = new Vector3f();
    this.currPos = new Vector3f();

    /*
     * position.xyz = 0, 2, 7
     * target.xyz = 0, 0, -1
     * up.xyz = 0, 1, 0
     */
    //Set all values to the Camera-class values
    position.negate(this.currPos);
    target.normalise(this.zAxis);
    up.normalise(this.yAxis);

    Vector3f.cross(target, up, xAxis);
    Vector3f.cross(xAxis, target, yAxis); //Recalulate yAxis to make it valid coordinate system.

    /*
     * This defines the View Matrix. This is calculated and explained here:
     * http://ogldev.atspace.co.uk/www/tutorial13/tutorial13.html
     *
     * m(Column)(Row)
     */
    Matrices.viewMatrix.m00 = xAxis.x; Matrices.viewMatrix.m10 = xAxis.y; Matrices.viewMatrix.m20 = xAxis.z;
    Matrices.viewMatrix.m01 = yAxis.x; Matrices.viewMatrix.m11 = yAxis.y; Matrices.viewMatrix.m21 = yAxis.z;
    Matrices.viewMatrix.m02 = zAxis.x; Matrices.viewMatrix.m12 = zAxis.y; Matrices.viewMatrix.m22 = zAxis.z;
    Matrices.viewMatrix.m33 = 1;

    Matrices.viewMatrix.translate(this.currPos);

Modelmatrix

Identity

sentences:
Surface of Revolution with 3D surface I have to use this function to get a Surface of Revolution (homework).

newVertex = (oldVertex.y, someFunc1(oldVertex.x, oldVertex.y), someFunc2(oldVertex.x, oldVertex.y));

As far as I know (FIXME) Surface of Revolution means rotations of a (2D)curve around an axis in 3D.
But this vertex computing gives a 3D plane (FIXME again :D), so rotation of this isn't
obvious.

Am I misunderstanding something?

sentences:
How do 2D volumetric lights work? Context

So in my current project (written in Java using LWJGL / OpenGL, so GLSL for shaders) I added lighting quite a few months ago, which was already an interesting challenge, having never done something like that before. Now I did my research, and in the past few days I found absolutely nothing particularly helpful about this subject (which was really surprising, I thought this to be a much more common problem), which is why I am asking here. Anyway, after a lot of searching around and asking for help, this is what the current lighting system looks like:

Desired effect

The current lighting is somewhat neat but not good enough, as I would like it to have an additional parameter for something like light width (currently there are already color, intensity, angle, smoothness and linear + quadratic attenuation parameters).

What I would like to achieve is an effect along the lines of this (paint.net mockup, but should make it clearer):

It sounds like such a simple thing to do and yet I can't get my head around how to do it (I thought about somehow having two different light positions and tracing lines between that or rotating the current fragment point in the fragment shader, but both seem incredibly slow and I don't even know where to start with them).

Edit

Here as requested the part of the fragment shader that's responsible for lighting:

for (int i = 0; i < numLights && i < MAX_LIGHTS; i++)
{
    if (lightColor[i].a > 0.0 && myDepth >= minAffectedDepth[i] && myDepth <= maxAffectedDepth[i])
    {
        if (isSpotLight[i])
        {
            lightDistance = lightPosition[i] - myPos;
            distance = length(lightDistance);
            spotEffect = dot(normalize(spotDirection[i]), normalize(-lightDistance));

            if (spotEffect > spotCosCutOff[i])
            {
                spotEffect -= spotCosCutOff[i];
                spotEffect /= (1.0 - spotCosCutOff[i]);

                spotEffect = pow(spotEffect, spotExponent[i]);
                attenuation = spotEffect / (1.0 + linearAttenuation[i] * distance + quadraticAttenuation[i] * distance * distance);

                color += attenuation * lightColor[i] * ownColor * lightColor[i].a;
            }
        }
        else
        {
            color += ownColor * lightColor[i] * lightColor[i].a;
        }
    }
}

TLDR;
I want to add "volumetric" lighting to my 2D project with GLSL, so a width parameter to the lighting system, which currently consists of punctual light sources (and for some reason, light sources in real life usually aren't perfectly punctual ;)).

sentences:
How do I allocate to a C# dictionary having a string key and an integer 2D array or transform for value? I'm working in C# on a Unity 2D game that spawns a shape that has only one correct landing place. There are 7 basic shapes but the component 4 squares of each shape are unique, with each bearing, say, a unique number. There are many more than 7 unique shapes because any component square is unique to the shape set. So the shapes have squares bearing a unique number (1,2,3,4 on a square; 5,6,7,8 on another square; 9,10,11,12 in a line (I-shape), 13,14,15,16 in another line (I-shape), etc. each of these shapes must be moved (by dragging, dropping or rotating) to its particular place in the grid.

I need to swiftly (1) indicate whether a shape has landed correctly and, if not, (2) move the misplaced (and possibly mis-rotated) shape to its proper location so that remaining falling pieces are not blocked from attaining their correct placements.

For (1), I'm  using a dictionary with a string for the key that identifies the square component of the shape and an integer 2D array for the grid location values. Here is the declaration:

Dictionary<string, int[,]> dictOfProperLocations = new Dictionary<string, int[,]>();

Visual Studio is OK with that. But I am unable so far to allocate key-value pairs to the dictionary. I've tried the following and variants to indicate that a straight shape (an I-shape) bearing the numbers 1-4 belongs at the origin at its left end and stretches straight to the right:

dictOfProperLocations.Add("1", [0,0]);
dictOfProperLocations.Add("2", [1,0]);
dictOfProperLocations.Add("3", [2,0]);
dictOfProperLocations.Add("4", [3,0]);

But Visual Studio objects to that. I find many examples for C# dictionaries with string-keys and 1D-array-values, but no examples for this case with 2D-array-values.

Or might this be better handled with a 2D Transform[,] for the values representing the proper grid locations? Thank you.

sentences:
Can I use quaternions to control an helicopter? I'm trying to make a simplified helicopter (for the moment, it's a cube) simulation in 3D and I'm having some problems with rotation. An helicopter can rotate along the three axes :

rotate on itself using the rear propeller : y axis rotation
tilt left and right to go left or right : z axis rotation
tilt up and down to go backward or forward : x axis rotation

I need  to be able to control each axis individually. So far I've tried using euler angles, but whatever the order of rotation I use, either I run into a gimbal lock or some axes "switch places".

I seems that I need to use quaternions, but I don't know how to control each individual axis, since quaternions uses a direction and an angle. Should I create three quaternions and multiply them together? Wouldn't I end up with the same problems?

The weird thing is, if I use my finger to represent the three axes of my helicopter (thumb up = y, index = z, middle = x), I don't seems to run into those problems. Why?

sentences:
Unity3d: calling a web service in unity editor works, but not in standalone. Why? I have this line of code:

   SDE3D _webService = new SDE3D();
   int result = _webService.UserLogin(txtLoginUsername.text, hashString);

My UserLogin function looks like this:

[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://www.something.com/UserLogin", RequestNamespace="http://www.something.com/", ResponseNamespace="http://www.something.com/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public int UserLogin(string username, string password) {
    object[] results = this.Invoke("UserLogin", new object[] {
                username,
                password});
    return ((int)(results[0]));
}

In the Unity Editor it works well.

At runtime, in my Unity game build, it doesn't work and doesn't return any error message!

What is the issue?

Thanks

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:
How do 3d engines add textures to objects? I was wondering how 3d engines like Unity or OpenGL added textures to objects.

Example:

How would Unity add this texture to the side the arrow is pointing to?

sentences:
How do you manage versioning across platforms in Unity? I'm just beginning to look into versioning games in Unity and noticed that Unity seems to offer different things depending on the platform you are building for. For instance, Android and iOS seem to have their own individual properties for versioning while Desktop has no versioning functionality at all out of the box.

Since I'm working on a game that has builds for PC, Mac, Android, and iOS, I need to determine how we want to manage version numbers within our game without having to manually manage individual version for each platform. How do you solve this?

sentences:
How to fix this NullReferenceException error? I am trying to fix an error that says "Object reference not set to an instance of an object". The purpose of this script is to spawn a prefab that follows the mouse when you click a UI button. The script works fine despite showing the error(yellow triangle), but when I add a line referencing another scripts array(marked >>>) in the HandleNewObjectHotkey function) the game refuses to run(red stop sign). For context, this script shown is attached to an empty game object. The button retrieves the script from this game object, and specifically uses the HandleNewObjectHotkey Function. I would like to know how I can fix the placeable Object Prefab from producing an error, or a suggestion to bypass it.
Things I've tried: making placeableObject prefab public, removing serialize field, attaching the prefab to the script itself in assets, change everything from private to public.
[SerializeField]
private GameObject placeableObjectPrefab;           // shows error here in visual studio, suggesting to make read-only (doesn't fix the problem)

private GameObject currentPlaceableObject;
private float mouseWheelRotation;
public int objectsSpawned;

// -------------- Money stuff

private float money;
private MoneyDisplay moneyDisplay;
private ObjectCostDisplay objectcostDisplay;

private void Awake()
{
    moneyDisplay = GameObject.FindObjectOfType<MoneyDisplay>();
    objectcostDisplay = GameObject.FindObjectOfType<ObjectCostDisplay>();
}

private void Update()
{

    if (currentPlaceableObject != null)
    {
        MoveCurrentPlaceableObjectToMouse();
        RotateFromMouseWheel();
        ReleaseIfClicked();
    }
}

private void ReleaseIfClicked()
{
    if (Input.GetMouseButtonDown(0))
    {
        currentPlaceableObject = null;
    }
}

private void RotateFromMouseWheel()
{
    mouseWheelRotation += Input.mouseScrollDelta.y;
    currentPlaceableObject.transform.Rotate(Vector3.up, mouseWheelRotation * 10f);
}

private void MoveCurrentPlaceableObjectToMouse()
{
    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

    RaycastHit hitInfo;
    if (Physics.Raycast(ray, out hitInfo))
    {
        currentPlaceableObject.transform.position = hitInfo.point;
        currentPlaceableObject.transform.rotation = Quaternion.FromToRotation(Vector3.up, hitInfo.normal);
    }
}

public void HandleNewObjectHotkey()                                             //error says issue is in this function.
{
    money = objectcostDisplay.CostsList[0];   // >>>   adding this is what causes unity to refuse to run the game due to error mentioned. Deleting this lets game run, error still present.

    if (objectsSpawned <= 3 && money <= moneyDisplay.currentMoney)
    {
        if (currentPlaceableObject == null )
        {
            currentPlaceableObject = Instantiate(placeableObjectPrefab);
            objectsSpawned++;
            moneyDisplay.UpdateMoney(money);
        }
    }

    if(objectsSpawned == 3 && money <= moneyDisplay.currentMoney)
    {
        Debug.Log("You have reached the limit for this item!");
    }

    if(objectsSpawned <= 3 && money > moneyDisplay.currentMoney)
    {
        Debug.Log("You don't have enough money for this!");
    }
}

}

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 do I clear a specific render target when more than one are set?  Or how do I keep the depth but clear the color? Let's say I set two render targets

GraphicsDevice.SetRenderTargets(rt0, rt1);

If I call

GraphicsDevice.Clear(Color.Transparent);

both render targets will be cleared.

Therefore, how can I clear a render target at a specific index?  For example just 'rt1' and not 'rt0'.

I would like to avoid texture baking the contents of 'rt0' to another render target and copying them back to 'rt0'.  This is because PreserveContents on the XBOX 360 can only hold one render target in memory.

EDIT:

Is there any way just clear the color for a render target?  I would like to keep the depth for depth reading.

sentences: How would I implement a level transition when reaching a cave in Raylib? I am the developer of an upcoming 2d/3dRPG. I have a simple scene setup where there is a bridge over some acid and a cave entrance-like thing that I want to change the level with. I have used C and C++ in the past, and considered state machines, but I actually have no idea how to do this in raylib. plus I heard it's only that good for transitioning from a title to a game or something, not loading levels on collision. also, the acid has to destroy the player.

sentences:
How do I change x,y,z coordinates if I want to make a perspective projection? How do I supposed to modify x,y,z coordinates to make the perspective projection? I'm talking not about matrix, could you explain me each coodinate specifically? Like, x =... y=... z=...
I'm asking because the structure of my project does not contain matrix and vectors.

sentences:
How to update UI after changing text in a view After applying a text change to a scrolling view, how do you get the new height of the text, resize other UI elements around the changed text length, etc?

Many have posted this question. Some have noted that the rect size doesn't change or that they have to wait multiple frames to then react to the UI updates.

sentences:
Unity3D: Firing a projectile from orbit I am dropping bombs from a spaceship orbiting a planet. My camera is affixed to the ship.
I fire bombs by instantiating a bomb at the position of the camera, which is at all times facing toward the planet, however, the bomb is not intended to move directly toward the planet center. Rather, there is a movable crosshair between the camera and the planet and I want the bomb to move from the camera in the direction of the crosshair. My bomb script looks like this:
public class bomb : MonoBehaviour {

    public float speed;
    GameObject crosshair;

    // Use this for initialization
    void Start () {
        crosshair = GameObject.Find ("Crosshair");
        transform.SetParent (null);
        transform.LookAt (crosshair.transform);
    }

    // Update is called once per frame
    void Update () {
        transform.Translate (transform.forward * Time.deltaTime * speed);
    }

 }

My expectation is that the bomb instantiates at the camera, disassociates from its parent (the camera), turns to face the crosshair and then moves in that direction until it hits the planet.
But that's not what happens.
For reasons unknown, the projectile travels due left of the camera. So I adjust my projectile to move transform.right instead of transform.forward. And this works - half of the time.
Here's what it looks like on the West (working):

Here's what it looks like on the East (not working):

The projectiles are kind of small, but trust me, they're there.
As mentioned, my ship is orbiting the planet. If it is orbiting on one hemisphere (0:180), it shoots toward the planet, but if it is on the other hemisphere(0:-180), it shoots directly away from the planet. I can't explain this, because the camera continuously looks toward the planet, and the crosshair is always between the two, and the bomb disassociates from them anyway.

sentences:
When and how should I apply forces in a Cocos2D + Box2D game? I have some small circles just rolling across the bottom of the screen in my Cocos2D/Box2D iOS app.  The bodies are dynamic... so I make them roll by applying a horizontal force to the center of mass (when the linear velocity is below the max velocity).

Currently I apply this force in -(void) tick: (ccTime) dt.  Is this the best place to apply it?  Or should I subclass something and implement an update function somewhere?  Please keep in mind I'm very new to Cocos2D/Box2D.

sentences:
How to create Half hemisphere 3D model I already have an hemisphere.obj 3D model. But I'm trying to build a half-hemisphere (quarter sphere) model. How can I do that? What is the easiest way to do that?

Generally, is there any easy way to create 1/n of sphere?

sentences: How do I integrate Nvidia Ansel into my Unity game? I want to be able to use the super high resolution image capabilities that ansel have to offer but I don't know how to add it as the only thing that i can find are C++ libraries on their website.

sentences:
Is there an advantage to creating a tileset instead of multiple content items? I'm using MonoGame to build my first game (yes, I'm new to game development). I'm trying to start by creating a 2D platformer so I want to have different "tiles" for the ground, walls, ceiling, etc.

I don't recall which tutorial I was reading, but I do know that they mentioned creating a tileset.png file and they gave a code sample of how to draw a specific tile from the tileset. I found a tileset on https://opengameart.org/ that I want to use for now, until I can replace the tileset.

I'm curious, is there any advantage to creating a tileset compared to creating, for example, multiple png content files?

sentences:
Keeping game model and graphics/animation separate but in sync Suppose I'm building a chess game where I want to have animations.  Pieces glide to their new squares when moved.  Pieces perform attack animations when capturing other pieces.

I'm not sure how to effectively separate the data and logic needed for these animations and the actual game model (in the MVC sense).  The pieces themselves should ideally not have to worry about their pixel coordinates or current animation frame.  At the same time, many changes to the model are effectively driven by animations.  A moved piece changes its position after (before?) its sprite is done gliding.  A piece is removed from the board after the capturing piece is finished its attack animation.

How would you suggest I manage the game model, the graphics and animations, and their relationships?  For example, where would the animations "live"?  How would animations be created and managed in response to player moves?  How would animations drive updates to the game model, or how would the game model drive animations?

sentences:
In A star, do I use the sum or the edge cost? When you add a new node to the closed list, you need to check all the adjacent nodes. If you find any adjacent nodes on the open list, you have to check if G would be lower if you went through the current node to get there.

My questions is, when checking if the G would be lower if you went through the current node, do you add up from the last node or start from 0?

Say you're using G = 14 for diagonal and G = 10 for horizontal. Last one on the closed list's G was 20. Your current node is one block lower from the last one on the closed list, and has an adjacent one that's on the open list with G = 34. Are you supposed to check if the G would be lower if you went through your current node by doing 20 + 10 + 14 = 44, 44 !< 34. Or, are you supposed to start from 0, so 0 + 10 + 14 = 24, 24 < 34?

I'm pretty sure it's the latter as with the former, the number is never going to be lower. But if it's the latter, wouldn't the number be lower every single time after a certain point?

sentences:
Decentralized Matchmaking in Unity? I'm making a card-playing game, similar to Magic Workstation. I've been looking into several options for networking. I have a working LAN version with the build in Unity networking, as well as Photon Cloud. Though I was now looking for a more decentralized way of doing multiplayer on the internet. It would be very very cool if there were no servers involved in finding other people. I would still let players host their own game-rooms others can join.

I Googled around for this, and everything I found was at least several years old. So I was wondering if anything new has popped up since then. I've seen several decentralized chat programs and even voice/video chat without any servers. But nothing for video games yet.

I did find some problems with this kind of networking. Mainly the lack of anti-cheat, but in my case the players check the moves themselves so this shouldn't be a problem. Other than that it's probably a bit slower, but card games are generally not very high-paced :P

Lastly, I'm making it in Unity using c#. I'll probably be running it in the webplayer (and later WebGL). So I'm mostly looking for c# library, or javascript. But any promising projects that do this are welcome.

Thanks a lot!

sentences:
Changing textures on a Model messes up antialiasing? (XNA) Here is a code sample:

        blockModel = game.Content.Load<Model>("Models/Cubes/Cube"); //this is a .fbx file, made in blender

        absoluteBlockTransforms = new Matrix[blockModel.Bones.Count];
        blockModel.CopyAbsoluteBoneTransformsTo(absoluteBlockTransforms);

        /*
        foreach (ModelMesh mesh in blockModel.Meshes)
        {
            foreach (BasicEffect effect in mesh.Effects)
            {
                effect.Texture = game.Content.Load<Texture2D>("Textures/Cubes/CubeLayout"); //this is the texture it's already using, but copy-pasted into a different directory
            }
        }*/

This looks fine

Now if I uncomment the lines above, somehow everything gets screwed up?

Somehow just setting the Texture property messes something up, but I'm not sure what exactly (aside from the symptoms).  Note that framerate doesn't actually change; the small difference is just a coincidence.  Also, the multisampling property is set after this is called, so it's not an issue of it somehow changing the graphics property.

sentences:
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 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: XNA 2D camera just part of screen Is it possible to use the 2D camera, but just for a part of the screen? Perhaps I want some info on the screen about score and other things, but I want that at a fixed place, just like when not using a 2D camera?

sentences:
How do you manage / collaborate on a project in Unreal with Developers and Designers? We have a team of 3 designers and 2 developers with no prior industry experience working on a Unreal Engine 4 project. The designers will be creating assets & laying the scene out in the editor while developers work on the functionalities in C++ side. What's a general strategy of partitioning work for such setup? More specifically, how do you have the team collaborating so that the project can be worked in parallel with minimal conflicts?

I understand that you can partition the map into sublevels and make sure that only one sublevel is being worked at a time. Well, what if you needed the designer to modify the scene while the developer adds some functionality to a sublevel? Is this not possible in Unreal?

Then there's the matter of source control. Ideally, I'd like to setup a git repository but the designers probably doesn't know how git works at all. Do game companies generally educate the designers so that they at least have working knowledge of source control to do what they need?

I'm just very confused about what the proper workflow should be.

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:
why is my OpenGL texture transparent? I have a terrain in OpenGL, and two textures which I am combining using GLSL mix() function.
Here are the textures I am using.

Now I am able to combine and mix these two textures, but for some reason, when I render the textures on the terrain, the terrain becomes transparent.
I render the LHS texture first, and then I render the RHS texture with alpha channel, I don't understand why it is transparent.

Here is an interesting fact, in the screenshot, you can see the result of the terrain when rendered on Nvidia GPU, when I render the same thing on interl HD 3k, I get different result.
This result is how it is supposed to be, nothing is transparent in this following screenshot.

Here is my fragment shader code..

void main()
{
vec4 dryTex   = texture( u_dryTex, vs_texCoord *1 );
vec4 grassTex = texture( u_grassTex, vs_texCoord *1 );
vec4 texColor1= mix(dryTex, grassTex , grassTex.a);
out_fragColor = texColor1;
}

sentences:
Load scene without being in build settings and without using AssetBundle This is the closest I've gotten:

    EditorSceneManager.OpenScene(
        AssetDatabase.GUIDToAssetPath(
            AssetDatabase.FindAssets(
                "t:SceneAsset " + MenuSceneName,
                new string[] { "Assets" }
            )[0]
        )
    );

However this generates an error at runtime:

InvalidOperationException: This cannot be used during play mode, please use SceneManager.LoadScene()/SceneManager.LoadSceneAsync() instead.

I can't follow its suggestion because those functions require the scene to be in build settings or an asset bundle. So, is there any other option?

I wonder how (and if) Addressables achieve this? Note: I'm not willing to switch to Addressables - I'm quite enjoying working with AssetBundles.

Why?

My game uses AssetBundles for general loading of EVERYTHING, so there's only one blank scene in build settings. However, during development I'd rather not have to continuously build and load from AssetBundles, so I'm trying to dynamically load scenes WITHOUT having to add them to build settings.

sentences:
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:
What is the correct way to seperate (react) view from state? I would like to know the correct implementation to declare game logic and view logic:

I see 3 ways of implementing this:

1.Storing (eg writing preprocessing to store the change to a property) property changes to data entities that are dispatched to listener(s) of the data entity. The main listener being the view, where the view contains the declared rendering logic (ie changing the entities animation based on a property change, changing the entities render object position).

  State Model (x,y,z,state) -> View (listens to change in
  x,y,z,state)->Scene graph object (x,y,z,animation, gets set by the View)

The issue with this is that it becomes evident that game engines are executing a lot of char[] switch statements (eg the names of properties) in the View.

2.Declaring the view as updating to the entirety of the model. Eg, instead of saving the changes as specified in 1) the view updates the render objects on every tick by inspecting the entire model, as opposed to the provided changes of 1). The tradeoff between 1 and 2 is the necessity of the additional execution of storing the property changes on the state tick.

3.Declaring animation logic in the state logic. Eg, instantiated member render objects are dummy objects when rendering is not performed.

The questions:

As specified in the title, what is the correct implementation to reacting to the game state  in the sense of where should one declare display/rendering/animation (view) logic that reacts to the game state?
What is the implementation used in most game engines that facilitate large projects? (if possible, please specify for specific engines: SupremeCommander/clones, SC2, Unreal, ID, Frostbite, Anvil)
Which implementation do studios implement to architect projects using said engines? It's apparent that it is possible to not seperate model from view in the above engines. Eg, if you implement an entity, you would presumably want it to be viable in multiplayer, coop, and single player.

The questions regarding other engines deals with the fact that perhaps it has been evaluated that it is not a sufficiently optimized implementation to consume the state in a View as opposed to executing direct calls to render objects.

So, on tick we update the game data simulation. For example:

  The state of a unit's weapon is updated to firing. However, updating
  the view of the weapon to firing (by for example, setting the animation of the weapon and animating the hand) is not necessary in all
  instances of the simulation.

sentences:
Trigger scene loading in one device from another device using Unity WWW class I have a master device and client device. I want to load a scene in the client device by pressing a button in the master. My method is, when the button is pressed in the master device, a data is stored in a server using the WWW class and in the client device it is checked whether the data is there, through a coroutine.

But, in the client device, the coroutine is not waiting for the trigger from the master. Instead it continues the execution. Because in the yield return statement, it says downloading is complete. Can I make it to wait for a trigger from the server?

sentences:
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:
relationship between the model and the renderer I tried to build a simple graphics engine, and faced with this problems:

i have a list of models that i need to draw, and object (renderer) that implements IRenderer interface with method DrawObject(Object* obj). Implementation of renderer depends on using graphics library (opengl/directx).

1st question: model should not know nothing about renderer implementation, but in this case where can i hold (cache) information that depends on renderer implementation? For example, if model have this definition:

class Model
{
public:
    Model();

    Vertex* GetVertices() const;

private:
    Vertex* m_vertices;
};

what is the best way to cache, for example, vertex buffer of this model for dx11? Hold it in renderer object?

2nd question: what is the best way for model to say renderer HOW it must be rendered (for example with texture, bump mapping, or may be just in one color). I thought it can be done with flags, like this:

model->SetRenderOptions(RENDER_TEXTURE | RENDER_BUMPMAPPING | RENDER_LIGHTING);

and in Renderer::DrawModel method check for each flag.

But looks like it will become uncomfortable with the options count growth...

sentences:
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:
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: game mod security question So I'm in the process of building a game in C++ for the engine and Python for behavior and moddability. One of the planned major features is that when the game client connects to a game server with mods, the server will tell the client where to get the mods. This introduces a security problem for the client as a mod with malicious code could be downloaded. How can I limit python so that mods can not affect the system outside of the game?

sentences:
Unity runs custom AssetPostProcessor every time on save I've written a AssetPostProcessor script that make some changes to prefabs and materials on import in some specific folders. I'm using this method to do that:

private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromPath)
{
   // if the importedAsset is a prefab
   GameObject obj = (GameObject)AssetDatabase.LoadAssetAtPath(objName, typeof(GameObject));
   if (obj) {
        if (AssetDatabase.GetAssetPath(obj).Contains("Assets/Tiled2Unity/Prefabs")) {
            // Here's some code that changes the asset
        }
    }
}

For some reason, every time I save this AssetPostProcessor is run which is something I don't want because this is lost time for something that isn't needed. What can I do to stop this?

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:
Parse/Write JSON with Unity iOS anybody know a tutorial or maybe can help me to develop a parser/reader for JSON compatible with Unity iOS pro? I've already tried different third part libraries but without luck (i've tried json.net, jsonfx, litjson).

Im pretty in hurry of doing a simple parser/writer that i can use also under iOS and not only in Desktop.

P.s. i can also use third part library, but please, first of suggest be sure that it will work under iOS!
Thank you all

sentences:
How to fade in and out a game object with two child game objects I have been fading game objects in and out using the following code. Now I want to fade out a game object with two child game objects. How can I do this?

    IEnumerator FadeToForGO(Material material, float targetOpacity, float duration, GameObject gameObj, bool isEnabled) {

    // Cache the current color of the material, and its initiql opacity.
    Color color = material.color;
    float startOpacity = color.a;

    // Track how many seconds we've been fading.
    float t = 0;
    if (isEnabled) {
        gameObj.GetComponent<BoxCollider2D> ().enabled = isEnabled;

    }

    while(t < duration) {
        // Step the fade forward one frame.
        t += Time.deltaTime;
        // Turn the time into an interpolation factor between 0 and 1.
        float blend = Mathf.Clamp01(t / duration);

        // Blend to the corresponding opacity between start & target.
        color.a = Mathf.Lerp(startOpacity, targetOpacity, blend);

        // Apply the resulting color to the material.
        material.color = color;

        // Wait one frame, and repeat.
        yield return null;

    }

    if (!isEnabled) {
        gameObj.GetComponent<BoxCollider2D> ().enabled = isEnabled;

    }

}

sentences:
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: Make an animation repeat X times I am using Unity Mecanim and I would like an animation ( walking animation about 2 seconds longs ) to repeat X times before moving to the next animation. How can I achieve this?

sentences:
Should all primitives be GL_TRIANGLES in order to create large, unified batches? Optimizing modern OpenGL relies on aggressive batching, which is done by calls like glMultiDrawElementsIndirect. Although glMultiDrawElementsIndirect can render a large number of different meshes, it makes the assumption that all these meshes are made of the same primitives (eg. GL_TRIANGLES, GL_TRIANGLE_STRIP, GL_POINTS).

In order to most efficiently batch rendering, is it wise to force everything to be GL_TRIANGLES (while ignoring possible optimizations with GL_TRIANGLE_STRIP or GL_TRIANGLE_FAN) in order to make it possible to group more meshes together?

This though comes from reading the Approaching Zero Driver Overhead slides, which suggests to draw everything (or, presumably, as much as possible) in a single glMultiDrawElementsIndirect call.

sentences:
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:
My game is just about finished! What do I do now? I have an HTML5/canvas game just about finished and ready to launch. It's a 2d game in which you explore and disrupt a procedurally-generated landscape, crafting items and structures to survive. I have to finalize the 'ending' and fix a few bugs, but the game is pretty much ready for players.

The game will be free to play on the web, and I plan to begin working versions for iOS and the Mac App Store. I will also continue to add content to the game even after it launches.

Can anyone recommend things that I should remember to do before launching the game? Thanks!

sentences:
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:
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:
XNA - Static classes from game libraries executing after content pipeline extensions, how to avoid the problem? Alright, formulated this way I'm sure it sounds obscure, but I'll do my best to describe my problem.

First, let me explain what's wrong with my real source code.

I'm making a platformer, and here are the current components of my game: a Level, which is holding its own grid of tiles and also the tile sheets and a Tile, which just keeps the name of its tile sheet and index within the tile sheet. All these are within a separate XNA game project, named GameLib.

Here is how my levels are formatted in a text file:

x x . . . . .

. . . b g r .

. . . . . . .

X X X X X X X

Where . represents an empty tile, b represents a blue platform, X represents a block with a random color, etc.

Instead of doing all the work of loading a level within the Level class, I decided to take advantage of the content pipeline extension and create a LevelContentPipelineExtension.

As soon as I started, I quickly realized that I didn't want to hard-code 20+ lines of the kind:

if (symbol == 'b')
    return new Tile(/*...*/);

So, in the hope of at least centralizing all the content creation into one class, I made a static class, called LevelContentCreation, which holds the information about which symbol creates what and all this kind of stuff. It also holds a list of all the asset paths of the tile sheets, to load them later on. This class is within my GameLib game library project.

The problem is, I'm using this LevelContentCreation static class in both my Level class (to load the actual tile sheets) and my content pipeline extension (to know which symbol represents what tile)...

And here's how my LevelContentCreation class looks like:

public static class LevelContentCreation
{
    private static Dictionary<char, TileCreationInfo> AvailableTiles =
        CreateAvailableTiles();

    private static List<string> AvailableTileSheets { get; set; }

    /* ... rest of the class */
}

Now, since the LevelContentCreation class is part of the game library, the content pipeline extension tries to use it but the call to CreateAvailableTiles() never happens and I'm unable to load a Level object from the content pipeline.

I know this is because the content pipeline executes before the actual compilation or something like that, but how can I fix the problem?

I can't really move the LevelContentCreation class to the pipeline extension, because then the Level class wouldn't be able to use it... I'm pretty lost and I don't know what to do... I know these are pretty bad design decisions, and I'd like it if somebody could point me in the right direction.

Thank you for your precious time.

If anything is not clear enough or if I should provide more information/code, please leave a comment below.

A little more information about my projects:

Game - XNA Windows game project. Contains references to: Engine, GameLib and GameContent
GameLib - XNA game library project. Contains references to: Engine
GameContent - XNA content project. Contains references to: LevelContentPipelineExtension
Engine - XNA game library project. No references.
LevelContentPipelineExtension - XNA content pipeline extension. Contains references to: Engine and GameLib

I know close to nothing about XNA 4.0 and I'm a little bit lost about how content works now. If you need more information, tell me.

sentences:
Java LERP but with whole pixel values I have a formula which returns a Lerp Vector3 value in integers but the problem is it never reaches the desired target value. It's converting to pixel values first by multiplying by PPM which is float 32f.

private Vector3 lerp(final Vector3 source, final Vector3 target, float alpha) {
    Vector3 sourcePPM = new Vector3(source.x * PPM, source.y * PPM, 0);
    Vector3 targetPPM = new Vector3(target.x * PPM, target.y * PPM, 0);
    sourcePPM.x += Math.round(alpha * (targetPPM.x - sourcePPM.x));
    sourcePPM.y += Math.round(alpha * (targetPPM.y - sourcePPM.y));
    source.x = sourcePPM.x / PPM;
    source.y = sourcePPM.y / PPM;
    source.z = 0;
    return source;
}

I initialize my vector variable source to new Vector3(0.0, 0.0, 0.0). Then, each frame I update it like this:

source = lerp(source, new Vector3(26.0, 29.0, 0.0), 0.06f);

But instead of eventually reaching the target, the value plateaus at a certain point:

Target destination: (26.0,29.0,0.0)
Actual final destination: (25.75,28.75,0.0)

Falling short of the target destination. If I don't round the values then it gets there fine but I need it to be in whole pixels.

The final line of intermediate values (too many to add all of them):

(25.0,27.90625,0.0)
(25.0625,27.96875,0.0)
(25.125,28.03125,0.0)
(25.1875,28.09375,0.0)
(25.25,28.15625,0.0)
(25.28125,28.21875,0.0)
(25.3125,28.28125,0.0)
(25.34375,28.3125,0.0)
(25.375,28.34375,0.0)
(25.40625,28.375,0.0)
(25.4375,28.40625,0.0)
(25.46875,28.4375,0.0)
(25.5,28.46875,0.0)
(25.53125,28.5,0.0)
(25.5625,28.53125,0.0)
(25.59375,28.5625,0.0)
(25.625,28.59375,0.0)
(25.65625,28.625,0.0)
(25.6875,28.65625,0.0)
(25.71875,28.6875,0.0)
(25.75,28.71875,0.0)
(25.75,28.75,0.0)

sentences:
3D Translations relative to 3D Rotations I'm trying to program camera movement to be relative to camera rotation. (Forward is always forward, regardless of pitch, yaw, and roll)
I want to be able to move forward, backward, left, right, up, and down.

I do not want to use a matrix.

I want to use sin and cos from the standard math library.

The camera rotates on all 3 axis.
The rotation order is z(roll), y(pitch), x(yaw).
When all rotations are 0, positive z is forward, positive y is down, and positive x is left.

So far I've gotten forward and backward movement to work with:

velZ = speed * cos(rotX) * cos(rotY);
velY = speed * sin(rotY);
velX = speed * sin(-rotX) * cos(rotY);

If somebody knows how to do this or knows where I can find information on this, it would be greatly appreciated.

sentences:
Is it okay to update the graphical handlers in the same function where you render them? I have a class called 'GraphicalHandler' that all my graphical handlers inherit from the main game loop.
The class manages a static vector of pointers to all instances of itself. I can then call the member fucntion GraphicalHandler::drawAllInstances() to draw everything to the screen.
But since my graphical handlers need to update their graphical objects, as well as rendering them, I figured I would change the function to updateAndDrawAllInstances(). I know that game logic and rendering should be as separated as possible, but since updating the graphical handlers doesn't seem like game logic I figured it would be valid.
So my question is if this is 'accepted' in game development, i.e. to update and render the graphical objects in the same function.

sentences:
Many OpenGL declarations are not occured in GLESv3 gl3.h I created a small OpenGL renderer in C++ and I want to move to Android so I prepared eclipse with all suitable platforms and create a Native Activity project then add the NDK to the includes and successfully executed and run a sample which color the screen, once I imported the files from the C++ project (copy them to jni folder) and fixed the includes I found many GL declarations are not occurred for example "Function 'glDrawBuffer' could not be resolved", I opened the gl3.h file and discovered that they are not occurred in that file, in my desktop version I use glew library and the file glew.h contains all those definitions so I tried to copy the definition from glew.h

GLAPI void GLAPIENTRY glDrawBuffer (GLenum mode);

to gl3.h

GL_APICALL void GL_APIENTRY glDrawBuffer (GLenum mode);

but still have the same error.
is these functions and constants are not occurred in the ES version of OpenGL or I need to update something? I have NDK r 15, SDK 22, Eclipse neo and GCC compiler with Android Builder.

Edit:

I found this definition in the same file

GL_APICALL void GL_APIENTRY glDrawBuffers (GLsizei n, const GLenum *bufs);

I think it is the same function but different number of arguments so I can guess there are many differences between OpenGL and the ES3 so the is same code will not run and must be changed?

also is there a place where I can find the equivalent functions or constants?

sentences:
LibGDX Box2dlights - Body Shadow Problem While playing around with the box2dlights with libGDX, I have managed to get it all up and running, but have a problem with the shadow rendering.

This is what I currently have atm:

With the lighting on:

With the lighting off:

What I want is to have the shadow be rendered so that the body is visible when the light is shone upon it, so that the platform is visible.

Here's some of my code that I use to create and render my lighting:

    // world lighting creation
    rayHandler = new RayHandler(physicsWorld, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    rayHandler.setBlurNum(0);
    rayHandler.setBlur(false);
    rayHandler.setAmbientLight(.05f);

    // world lighting rendering
    rayHandler.setCombinedMatrix(cameraWorld.combined.scale(PIXELS_TO_METERS / SCALE_TO_SIZE, PIXELS_TO_METERS / SCALE_TO_SIZE, 0),
            cameraWorld.position.x / PIXELS_TO_METERS * SCALE_TO_SIZE, cameraWorld.position.y / PIXELS_TO_METERS * SCALE_TO_SIZE,
            cameraWorld.viewportWidth, cameraWorld.viewportHeight);
    rayHandler.updateAndRender();

    // player torch light creation
    torchLight = new ConeLight(rayHandler, 50, Color.WHITE, 50 / SCALE_TO_SIZE, x / SCALE_TO_SIZE, y / SCALE_TO_SIZE, angle, 35);
    torchLight.setStaticLight(false);
    torchLight.setSoft(false);

Any thoughts?

sentences:
How to get object or its index from mouse coordinates? Basically, I have a NumPy array of rectangles that store their colour and position.
I want to be able to compare my mouse position and clicked on the rectangle's position and get the index or the object itself from the array.
Do I have to iterate through every square in the array and compare item's coordinates?
The structure looks like:
Cube[Face][Horizontal-Line][Square] = np.array([colour, coordinates])
What's the most efficient way to do it? I'm thinking of using colliderect() method, but I don't know how to implement it.

sentences:
Examples of TIN-based terrain formats in FPS games Do you know of any terrain formats for FPS games that use a triangulated irregular network (TIN) instead of a grid for elevation representation? Or at least a game whose development tools accept a TIN as input for terrain elevation?

The only example I have is the ASCII Scene Export (ASE) format that can be used as input in the terrain editor for the Unreal engine (UnrealEd). I am mainly looking for formats that support terrain holes (both visually and in collision detection) and allow underground models. I want to avoid having to carve and cover gridded terrain elevation grids to place underground models.

sentences: Best way to solve tile drawing in 2D side scroller? What i still can't figure out is which would be the more sane way / easier and faster way to draw the map on the screen.. I mean i will use many tiles for my maps in my side scroller.. But problem is should i make the maps in whole images like one .png file for each map (Example) or should i draw the tiles by code like a for loop in c++.. Which way is most recomended or where can i read about which way is the best.

sentences:
Right way to get reference from across scene object in unity I need a reference for the game-object from another scene but the problem is that the scene object by default is off. So I thought that
I should place its reference in another script and get a reference from it. But it will introduce me to a new script (third script) which means a new dependency. Now here is the triangle to solve the issue (which i don't like and posting here)

First scritp where the refrence is require

The actual refrence (Script/game-object) reside in a separate scene.

The reference holder

My consideration is that this is not the right way to do this job as its required dependency. How can i efficient and more professionally deal with it?

sentences:
Unity - How to make grass details look good from top-down I have an issue with the terrain details. Since it only draws a single plane per texture, it looks quite crappy with a angled top-down camera, for example for an RTS camera.

Is there some way around this, I know one solution people use is to angle the grass towards the camera a bit, but that isnt possible with the terrain details painter.

The issue is circled in red:

If there is no solution to this, are there some techniques I can use to make some interesting-looking grass for an RTS camera?

sentences:
How would I create a save function to my random generated game? I'm making a 2D Tower Defense and currently looking into making a save feature. The problem is that my game is procedural generated (based on the rogue-like tutorial posted by Unity):

At runtime I generate a random amount (approx 7k) tiles of treasures, obstacles and different enemies at random locations. Some tiles will also be destructible and not exist when destroyed.

What should I do to save the position of each tile and values such as "Level" and "Gold"?

This is a list of what I need to be saved:

Player value (position, gold, level, health, inventory)
Building values (Tower/Building positions, health value etc)
Wave values (wave_level)
Board values (all tile positions such as obstacles, treasures etc)

NOTE: Every tile is a GameObject.

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:
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:
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:
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:
When updating to Universal Render Pipeline an Error occurs I updated to the Universal Render Pipeline and despite of using the auto upgrade from project an error messages appears in the console. Here is the error:
In order to call GetTransformInfoExpectUpToDate,
RendererUpdateManager.UpdateAll must be called first.
UnityEngine.Rendering.RenderPipelineManager:DoRenderLoop_Internal(RenderPipelineAsset, IntPtr, AtomicSafetyHandle)

sentences: How does A* pathfinding work? I would like to understand on a fundamental level the way in which A* pathfinding works. Any code or psuedo-code implementations as well as visualizations would be helpful.

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:
Implementing multithreaded loading screens Ok, I have fairly little multi-threading experience, but i have done a similar thing before without issue...but this has me stumped.

This is in C++, Directx9 Visual Studio...

My game basically runs in one thread, apart from loading screens. When I want to load a new game, I fire up a new thread which goes through and does all of the simulation and asset loading stuff. Meanwhile, the original (base) thread displays an animated loading screen.
Once the loading is finished, the loading thread sets a flag in tjhe loading screen saying it's done, and during the loading screens Draw() it spots the flag, ends the 'loading' thread, and starts the main game.

All of this works perfectly, in debug and release.

Except fullscreen...

For some reason, if I run the game in fullscreen mode, it goes wrong. The game hangs at the end of loading, and it looks like the flag in the loading screen is never getting set. if I force a debug break into the base thread, it seems to always be inside the D3D flip().

I can't see what I'm doing wrong. The loading thread does zero rendering. It creates some directx assets but never uses them. The flag I'm using to communicate between threads is a simple int, and it's read/write should thus be atomic.
I've done a very similar thing in my previous games with no problems, but this has me stumped. Should I really be using CriticalSections etc for something this simple?
Help!

sentences:
player teleporting into other levels So I basically want to load another map once the player collides with a object, specifically a "Portal" in my game. Which is really making the player move onto other levels. I don't want to jumble up my code with a bunch of function like "go_to_level_9" or something so I'm planning to use a list or dictionary or something. So how to those game devs out there do that? Code for main.py is here: https://pastebin.com/rpddq1MP. The part with the portal stuff, walls and a few others:
    for tile_object in self.map.tmxdata.objects:
        obj_center = vec(tile_object.x + tile_object.width / 2,
                         tile_object.y + tile_object.height / 2)
        if tile_object.name == 'player':
            self.player = Player(self, obj_center.x, obj_center.y)
        if tile_object.name == 'zombie':
            Mob(self, obj_center.x, obj_center.y)
        if tile_object.name == '#':
            Obstacle(self, tile_object.x, tile_object.y,
                     tile_object.width, tile_object.height)
        if tile_object.name in ['health', 'shotgun']:
            Item(self, obj_center, tile_object.name)
        if tile_object.name == 'portal':
            self.map = TiledMap(path.join(self.map_folder, tile_object.type))

how do you do it? I'm currently using Tiled and pygame so I'm also using pytmx.
Edit: When I run the code, it just gives me an error about my other file, tilemap.py.
Error:
File "D:\coding\my_coding_stuff\python\games\pygames\little rpg\tilemap.py", line 49, in apply return entity.rect.move(self.camera.topleft) AttributeError: 'TiledMap' object has no attribute 'rect'
Tilemap.py:
import pygame as pg
import pytmx
from settings import *

def collide_hit_rect(one, two):
    return one.hit_rect.colliderect(two.rect)

class Map:
    def __init__(self, filename):
        self.data = []
        with open(filename, 'rt') as f:
            for line in f:
                self.data.append(line.strip())

        self.tilewidth = len(self.data[0])
        self.tileheight = len(self.data)
        self.width = self.tilewidth * TILESIZE
        self.height = self.tileheight * TILESIZE

class TiledMap:
    def __init__(self, filename):
        tm = pytmx.load_pygame(filename, pixelalpha=True)
        self.width = tm.width * tm.tilewidth
        self.height = tm.height * tm.tileheight
        self.tmxdata = tm

    def render(self, surface):
        ti = self.tmxdata.get_tile_image_by_gid
        for layer in self.tmxdata.visible_layers:
            if isinstance(layer, pytmx.TiledTileLayer):
                for x, y, gid, in layer:
                    tile = ti(gid)
                    if tile:
                        surface.blit(tile, (x * self.tmxdata.tilewidth,
                                            y * self.tmxdata.tileheight))

    def make_map(self):
        temp_surface = pg.Surface((self.width, self.height))
        self.render(temp_surface)
        return temp_surface

class Camera:
    def __init__(self, width, height):
        self.camera = pg.Rect(0, 0, width, height)
        self.width = width
        self.height = height

    def apply(self, entity):
        return entity.rect.move(self.camera.topleft)

    def apply_rect(self, rect):
        return rect.move(self.camera.topleft)

    def update(self, target):
        x = -target.rect.centerx + int(WIDTH / 2)
        y = -target.rect.centery + int(HEIGHT / 2)

        # limit scrolling to map size
        x = min(0, x)  # left
        y = min(0, y)  # top
        x = max(-(self.width - WIDTH), x)  # right
        y = max(-(self.height - HEIGHT), y)  # bottom
        self.camera = pg.Rect(x, y, self.width, self.height)

sentences: camera.render reads a file in the middle of a gameplay Why does camera.render read a file in the middle of a gameplay? This causes a lag in my game:

sentences:
Reading a word list into an array I am making a simple hangman game, I have a small list of words in a .txt file separated by new lines. I put the word list into the assets folder. How can I find the path to the word list so I can use:

string[] wordlist = System.IO.File.ReadAllLines("pathToFile");

Or is there another solution of converting the word list into a string array?

sentences:
6DOF camera: inverted yaw and roll when orientation changes Whenever I change the orientation of the camera, yaw and roll become inverted (or correct); the strafing, movement and pitch do remain correct however.

Can you tell what is causing this and how to fix it ?

private Vector3 _cameraOrientation;
private Vector3 _cameraPosition;
private Matrix _matrixProjection;
private Matrix _matrixView;

protected override void Update(GameTime gameTime)
{
    var state = GamePad.GetState(PlayerIndex.One);
    if (state.Buttons.Back == ButtonState.Pressed ||
        Keyboard.GetState().IsKeyDown(Keys.Escape))
        Exit();
    if (state.Buttons.Start == ButtonState.Pressed) _cameraPosition = _cameraOrientation = Vector3.Zero;

    var right = state.ThumbSticks.Right;
    var left = state.ThumbSticks.Left;

    // get position/orientation deltas from gamepad
    var position = new Vector3
    {
        X = left.X,
        Y = state.Buttons.A == ButtonState.Pressed ? -1 : state.Buttons.Y == ButtonState.Pressed ? 1 : 0,
        Z = -left.Y,
    };
    var orientation = new Vector3
    {
        X = -right.Y,
        Y = -right.X,
        Z = state.Buttons.X == ButtonState.Pressed ? -1 : state.Buttons.B == ButtonState.Pressed ? 1 : 0
    };

    // update position according orientation
    _cameraOrientation += orientation;
    var cameraReference = Vector3.Forward;
    var cameraRotation =
        Matrix.CreateRotationX(MathHelper.WrapAngle(MathHelper.ToRadians(_cameraOrientation.X))) *
        Matrix.CreateRotationY(MathHelper.WrapAngle(MathHelper.ToRadians(_cameraOrientation.Y))) *
        Matrix.CreateRotationZ(MathHelper.WrapAngle(MathHelper.ToRadians(_cameraOrientation.Z)));
    _cameraPosition += Vector3.Transform(position, cameraRotation);

    // update matrices
    var cameraPosition = _cameraPosition;
    var cameraTransformedReference = Vector3.Transform(cameraReference, cameraRotation);
    var cameraTarget = cameraPosition + cameraTransformedReference;
    var cameraUpVector = Vector3.Transform(Vector3.Up, cameraRotation); // Vector3.Up;
    _matrixView = Matrix.CreateLookAt(cameraPosition, cameraTarget, cameraUpVector);
    _matrixProjection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45),
        _graphics.GraphicsDevice.Viewport.AspectRatio, 0.01f, 100000f);

    base.Update(gameTime);
}

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:
3D BSP rendering for maps made in 2d platform style I wish to render a 3D map which is always seen from top, camera is in sky and always looking at earth. Sample of a floor layout:

I don't think I need complex structures like BSP trees to render them. I mean I can divide the map in grids and render them like done in 2D platform games. I just want to know if this is a good idea and what may go wrong if I don't choose a BSP tree rendering here. Please also mention is any better known rendering techniques are available for such situations.

sentences:
How to create a realistic 2D Role-Playing game collision detection? I’ve always wanted to create an old-fashionned 2D Role-Playing Game like Star Ocean, Final Fantasy, Sword of Mana and even the “Tales of” series, and I guess a lot of people do. But before even writing a single line of code I did a lot of research, drawing and tryouts.

I've found almost all the answers to my questions but there is a problem I haven’t been able to solve: How do you create a realistic but yet simple collision detection, like in the games I named before?

I already know several ways of calculating collision detection, look at the following examples:

None of these satisfy my needs.

Tile-based collisions are way too simple and suits more a Zelda than a Star Ocean. Plus, the drawing of each tile needs to fill up all space in order to look realistic.
Pixel-perfect has too many constraints. If your tile has some pixel here and there,  the player will most likely get stuck in the midle of nowhere(ie: in some games you get stuck on a 2 pixels width tree root).
And binary masks uses too much memory and settings imo.

I've read alot of documentation but I never found something that looked good to me. And all my tryouts didn't look close to what I used to play with. So if you have any good links or tutorials on how evolved 2D RPG work please let me know.

sentences:
Using circles to create a sphere I've been working on creating spheres in a 3D space recently, and have successfully created cylinders. I've just run into a little problem. For some reason, my "Spheres" end up looking like very thick star shapes. I can't seem to figure out what's wrong, and I could not really find any algorithms to reference off of. My code:

public static void createCircle(int xoff, int yoff, int zoff, int FOV, ArrayList<Point3D> Points, int radius) {
    for(int j=0;j<Math.PI*2;j++) {
        int x = (int) (radius * Math.cos(j));
        int y = (int) (radius * Math.sin(j));
        Points.add(new Point3D(x+xoff, y+yoff, zoff, FOV, 900, 600));
    }
}
public static void createSphere(int radius, int height, int FOV, ArrayList<Point3D> Points, int posx, int posy, int posz) {
    for(int z=0;z<height;z++) {
        createCircle(posx, posy, posz+z, FOV, Points, (int) (radius*(Math.sin(z)*2)));
    }
}

Here's what it ends up looking like:

sentences:
Calculating the angular direction from velocity I'm trying to calculate the angular direction of a projectile, knowing it's X and Y velocity I can find the magnitude of its movement, but I'm having a hard time wrapping my mind around getting the angular direction (in radians) that it is moving...

I assume there is a tan or a sin involved, but I'm a bit clueless otherwise...

sentences: Where can I find indie "teams" I'm looking to work over the internet in a team of people to make a game. I'm not looking to make a profit, I just want the experiance. Where can I find similary minded persons?

sentences:
Can I use music I made in GarageBand or FL Studio in a commercial game? I'm a beginning developer and I'd like to make music for my game. I've searched this question on the site, and when it comes to music in games, I see many people suggesting programs like FL Studio, Reaper, GarageBand, etc.

What are the legal implications of using music made with them in a commercial game? Is it okay to use music I've created on my computer with one of these programs (I was thinking of FL Studio) in a game I plan to profit from?

sentences:
Minecraft like blocky-clouds We are working on a minecraft-like block-based engine/lib. Lately I've started working a blocky-clouds as in minecraft;

So it appers that in minecraft, clouds are not procedural. I'm still looking if it is viable to procedurally generate blocky-clouds.

I tried something like but it doesn't quite fit for clouds.

float octave1 = SimplexNoise.noise(x * 0.004f, 1000, z * 0.004f) * 0.5f;
float octave2 = SimplexNoise.noise(x * 0.003f, 1000, z * 0.003f) * 0.25f;
float octave3 = SimplexNoise.noise(x * 0.02f, 100, z * 0.02f) * 0.15f;
this.Clouds[x, z] = (octave1 + octave2 + octave3 > 0.6);

Any ideas or suggestions?

sentences:
Logging of method calls for recreation Some games have the option to let you play offline and sync with a server once you have internet again. To prevent cheating and validate if it was an authentic play, usually some sort of log of all input actions is sent and validated afterwards on the server.
In my case I would be interested in a single MonoBehaviour and having all its method calls logged with the its parameters values. Giving this input, the game result output should be the same. (There is no random involved and no physics interaction)

One way would be just a writer at the start of each method that logs the timestamp, method name and paramter
Another would be maybe something like a multi delegate inbetween that calls both my method and a writer class

Is there something build-in in Unity that does this already like an annotation for the methods I want to track or something like an audit interface?

sentences: What is a rim shader used for? What does a rim shader do and what is it used for? In what cases would it make sense to utilize a rim shader?

sentences:
How to export from Blender to unity3d I have a simple object created from PLANE, in BLENDER version 2.72, where I edged the edges to the height. How do I correctly export the model to Unity3d I have version 4.7 to make all walls visible? Figure 2. Sorry for the wrong English. Thanks for your advice

Picture 1 in Blender

object export .obj in unity

sentences:
How to get translation from view matrix How can I retrieve the camera's world-space position from its view matrix?
The only answers I've seen to this question suggest the translation is in the last row/col but this wouldn't work since the matrix contains [x (dot) right, y (dot) up, z (dot) look]

sentences:
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:
Unity/VS debugging only with UnityVS? Hi,

this one thing isn't clear to me:
Is it possible, to debug C# of Unity 4.3 with Visual Studio 2013 without any plugin?

If no, what or how else should I debug then?

sentences:
Particle System in XNA - cannot draw particle I'm trying to implement a simple particle system in my XNA project. I'm going by RB Whitaker's tutorial, and it seems simple enough. I'm trying to draw particles within my menu screen. Below I've included the code which I think is applicable.

I'm coming up with one error in my build, and it is stating that I need to create a new instance of the EmitterLocation from the particleEngine. When I hover over  particleEngine.EmitterLocation = new Vector2(Mouse.GetState().X,      Mouse.GetState().Y); it states that particleEngine is returning a null value. What could be causing this?

/// <summary>
/// Base class for screens that contain a menu of options. The user can
/// move up and down to select an entry, or cancel to back out of the screen.
/// </summary>
abstract class MenuScreen : GameScreen

    ParticleEngine particleEngine;

    public void LoadContent(ContentManager content)
    {
        if (content == null)
        {
            content = new ContentManager(ScreenManager.Game.Services, "Content");
        }
        base.LoadContent();
        List<Texture2D> textures = new List<Texture2D>();
        textures.Add(content.Load<Texture2D>(@"gfx/circle"));
        textures.Add(content.Load<Texture2D>(@"gfx/star"));
        textures.Add(content.Load<Texture2D>(@"gfx/diamond"));
        particleEngine = new ParticleEngine(textures, new Vector2(400, 240));

    }

    public override void Update(GameTime gameTime, bool otherScreenHasFocus,
                                                   bool coveredByOtherScreen)
    {
        base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);

        // Update each nested MenuEntry object.
        for (int i = 0; i < menuEntries.Count; i++)
        {
            bool isSelected = IsActive && (i == selectedEntry);

            menuEntries[i].Update(this, isSelected, gameTime);
        }

        particleEngine.EmitterLocation = new Vector2(Mouse.GetState().X,      Mouse.GetState().Y);

        particleEngine.Update();
    }

    public override void Draw(GameTime gameTime)
    {
        // make sure our entries are in the right place before we draw them
        UpdateMenuEntryLocations();

        GraphicsDevice graphics = ScreenManager.GraphicsDevice;
        SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
        SpriteFont font = ScreenManager.Font;

        spriteBatch.Begin();

       // Draw stuff logic

       spriteBatch.End();
       particleEngine.Draw(spriteBatch);

    }

sentences:
XNA - Link between Create Rotations matrices A friend of mine have been coding some rotations on my XNA project, but the order of the matrices rotation are not good. Some are of form :

Matrix.CreateRotationZ(1.21f) * Matrix.CreateRotationY(-0.13f)

and other:

Matrix.CreateRotationY(1.01f) * Matrix.CreateRotationX(-0.5f) * Matrix.CreateRotationZ(0.80f)

How can I find the values X, Y, Z so the rotations are in the correct order: (X,Y,Z) ?

Matrix.CreateRotationX(X) * Matrix.CreateRotationY(Y) * Matrix.CreateRotationZ(Z)

sentences:
Why is my sphere jumping? I got a sphere that moves with an angular velocity of -2000 in the X axis, I need that sphere moves on 130 platforms, all those platforms have -0.0182175 in the Y axis.

The problem is that when I play, the sphere starts normally but as it advances starts make some jumps, first shorts but then more large, and it is as if the platforms did not have the same value in the Y axis.

Can someone help me, please?

I've put some images.

Very thanks

Hey people!!
I've uploaded a video to show you clearly the problem.

Here's the link: Platforms, sphere and sphere script

Sorry for my english by the way.

sentences:
Unity: Z-position issue on gameobject with subcomponents I'm following this tutorial from Ryan Miller on how to create a rig of sorts from a sprite atlas sheet.

My intention was to put the panda behind a bamboo, but this is what happened:

The bamboo's Z-position has been set to 2, whilst the Panda's has been set to 6.

Here's a 3D look at the problem:

How do I fix this?

sentences:
How do I refer to the two types of loading screen? I'm troubleshooting some issues beyond the scope of this forum, and I'd like to be able to talk about certain parts of the gaming experience, specifically the two types of loading screen I see in Prey.
Both are shown in this short video I made.
The first type with the loading bar is what I usually think of as the "loading screen", but what do I call the second "loading screen" that happens right after with the moving squares in the bottom-right? To be clear, I'd like a term to be used with non-game-devs.

sentences:
Is it possible to debug a Unity Android game directly on a device? I'm working on my game and every time I make changes to it I send the game to my mobile device to debug it.

I want to know how I can directly debug my game using an Android device instead of the MonoDevelop editor?

sentences: How to go back to the old input system? I have tried using Unity's new input system, but it's incredibly hard to learn, the documentation is poor, and the old system is much easier to work with.  I would like to revert my project back to the old system, but I am unsure how to do that.  How do i disable the package and reconfigure my project so it will accept code using the old system?

sentences:
Move Particle to touch position on android I am attempting to make a Particle start moving to the position of my finger on the touch of the screen.

I have been using this as the basis so far:

public void update()
{
    deltaX *= .9;
    deltaY *= .9;

    this.x += this.deltaX;
    this.y += this.deltaY;
}

public void moveTo(int newX, int newY)
{
    float dx = newX-this.x;
    float dy = newY-this.y;

    float length = (float) Math.sqrt(dx*dx+dy*dy);

    dx/=length;
    dy/=length;

    dx *= 10;
    dy *= 10;

    deltaX = dx;
    deltaY= dy;
}

now while it does move the Particle, it is rarely in the direction of my finger.
How can I make the particle have the correct amount of velocity to get to the position of my finger, but no farther?

Thanks in advance!

sentences:
Detect which object conceals another one I've searched for a while for a good solution and if I'd have found one I wouldn't be here. So there are the details:
I have been working on my 2D game using XNA, and I'm aware of the way XNA renders objects(If "a" was drawn after "b", it will draw "a" above "b").
In the game I'm making there's a character that is able to move left, right, up and down.
I'm, using Rectangle's "Intersects" method, when the rectangle on the character is placed on his feet, to detect collision detection.
I would also like the character to be able to move behind a house(Just like you can in real life, and the house will hide a part of the character that is hidden behind the house).
So far, all the things that I've mentioned are accomplished. Now, I would like to hear how would you recommend detecting whether the character is standing in front of the house, and hiding the part of the house that his standing in front of, or whether the character is standing behind the house. I understand it might be a little hard to understand, therefore I added a picture that will simulate the situation. (No I'm not the one doing the drawing)
Any help, advices, or criticism would be appreciated. Thanks ahead!

sentences:
How to implement a hint-system for nearby matches (in a Match-3 puzzle game)? Taking Candy Crush as an example:

In a Match-3 game, how would you figure out which nearby tiles are 1 move away from creating a match?

Do you basically have to do it by trial-and-error on every single possible moves (behind-the-scenes) to see which resulting matches it would create?

sentences:
Rendering a model with transparent or translucent uv map applied doesn't work Before I try to make anything transparent, the model renders nicely. When I change the uv layout so that one piece of the model will be transparent, it renders horribly. This is the result with a translucent green texture:

I did transparency with OpenGL when I did 2D games and everything worked nicely because of these two lines:

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

Now, I fear, this won't be enough, right? Or maybe I should use some other technique?

sentences:
Difference between shader input element classification between D3D12 and Vulkan I'm confused about the difference between the shader input element classifications in D3D12 and Vulkan. For example, in Vulkan I could have the following declarations:
struct vertex
{
    glm::vec3 pos;
    glm::vec3 col;
};

VkVertexInputBindingDescription input_binding_description
{
    .binding = 0,
    .stride = sizeof(vertex),
    .inputRate = VK_VERTEX_INPUT_RATE_VERTEX
};

std::array<VkVertexInputAttributeDescription, 2> input_attribute_descriptions {
    VkVertexInputAttributeDescription{
        .location = 0,
        .format = VK_FORMAT_R32G32B32_SFLOAT,
        .offset = offsetof(vertex, pos)
    },
        VkVertexInputAttributeDescription{
        .location = 1,
        .format = VK_FORMAT_R32G32B32_SFLOAT,
        .offset = offsetof(vertex, col)
    }
};

Here the input rate is specified per vertex and not per attribute. On the other hand, in D3D12, we would have
struct Vertex
{
    XMFLOAT3 pos;
    XMFLOAT3 col;
};

std::array<D3D12_INPUT_ELEMENT_DESC, 2> input_element_descs =
{
    { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0,
    D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 },
    { "COLOR", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12,
    D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }
};

And as you can see, the input rate is specified per attribute. Why is that? Is there a difference between the meaning of the input classification in D3d12 and Vulkan that I'm missing? I'm not familiar with D3D12, but at first glance, it doesn't make sense to me to have different input classifications for the attributes of a vertex.

sentences:
How do I get the local player? I'm using Mirror as UNet is deprecated.
How can I get the local player GameObject in my code?

sentences:
Managing many draw calls for dynamic objects We are developing a game (cross-platform) using Irrlicht. The game has many (around 200 - 500) dynamic objects flying around during the game. Most of these objects are static mesh and build from 20 - 50 unique Meshes.

We created seperate scenenodes for each object and referring its mesh instance. But the output was very much unexpected.

Menu screen: (150 tris - Just to show you the full speed rendering performance of 2 test computers)
a) NVidia Quadro FX 3800 with 1GB: 1600 FPS DirectX and 2600 FPS on OpenGL
b) Mac Mini with Geforce 9400M 256mb: 260 FPS in OpenGL

Now inside the game in a test level: (160 dynamic objects counting around 10K tris):
a) NVidia Quadro FX 3800 with 1GB: 45 FPS DirectX and 50 FPS on OpenGL
b) Mac Mini with Geforce 9400M 256mb: 45 FPS in OpenGL

Obviously we don't have the option of mesh batch rendering as most of the objects are dynamic. And the one big static terrain is already in single mesh buffer. To add more information, we use one 2048 png for texture for most of the dynamic objects. And our collision detection hardly and other calculations hardly make any impact on FPS. So we understood its the draw calls we make that eats up all FPS. Is there a way we can optimize the rendering, or are we missing something?

sentences:
How to layer the Worley noise like this? Recently I'm trying to implement Siggraph15_Schneider_Real-Time_Volumetric_Cloudscapes_of_Horizon_Zero_Dawn, you can also find this in GPU Pro 7, (part II Lighting, chapter 4, Real-Time Volumetric Cloudscape).

I can make the first Worley noise above and increase the frequency, I can get another Worley noise, but how to blend the two noise to get the middle noise and finally, the third noise"?

The last image is two single frequence worley noise and the result I blend them.You can try your method with them.

My formula is this:

tmp = (worley1 + smoothstep(0, 1, worley1)*worley2*0.5) / (1 + smoothstep(0, 1, worley1)*0.5);
tmp = ReMap(0, 1, 0, 0.7, tmp);

ReMap is:

double ReMap(double oldMin, double oldMax, double newMin, double newMax, double src);

Note that worley1 and worley2 is worley noise range from 0 to 1.The result is close in the first glance,but it's not the same apparently. I think the formula is TOO tricky and maybe I got something wrong.

sentences:
Should I combine multiple tiles of terrain as one mesh in Unity3D? I have a tiled terrain, generated by multiple noise algorithms. Currently, each tile is it's own GameObject, that has a handler for an OnMouseOver event. The area that is loaded at a time consists of 9 chunks that each contain 4096 tiles. This totals to 36864 tiles that are loaded at a time. On top of this, there are actual objects on top of these tiles.

Is there any considerable performance difference if I were to combine some of these tiles into a single GameObject and mesh?

sentences: 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:
Isometric - precise screen coordinates to isometric I'm trying to translate mouse coords to precise isometric coords (I can already find the tile the mouse is over, but I want it to be more precise). I've tried several different methods but I seem to keep falling short.

For drawing I use:

batch.draw(
    texture,
    (y * tileWidth / 2) + (x  * tileWidth / 2),
    (x  * tileHeight / 2) - (y * tileHeight / 2))

This is what I currently use for figuring out a tile position:

 float xt = x +  camPosition.x - (ScreenWidth/2) ;
 float yt = (ScreenHeight) - y + camPosition.y - (ScreenHeight/2);

 int tileY = Math.round((((xt) / tileWidth) - ((yt) / tileHeight)));
 int tileX = Math.round((((xt) / tileWidth) + ((yt) / tileHeight))- 1);

I'm just wondering how I could update these to allow for more precise coordinates, instead of tile only.
EDIT:
Following what ccxvii said below, and removing the -1 from tileX, the object follows my mouse just like I had wanted. Just going to re-examine the math and figure out if that change will result in other messes =o

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:
Gamemaker Running Animation Flashing, showing single frame, and displaying jump and run sprites at same time EDIT: I changed the origin of the run sprite to the center, and it is no longer hovering above the jumping sprite. It now flashes in the same location as the run sprite when moving to the side. Everything else is the same.

When I move side to side, the jump sprite moves along the ground while a single frame of the running sprite animation shows up above it and to the side. Both of the sprites flash when this happens. While moving sideways, the sprite slowly sinks into the floor. Jumping works just fine.

I'm very new to game maker and programming in general, so I'm probably making some dumb mistakes. Everything was working fine before I added the "animate" section. Here's the code I'm using:

//get player input
key_right = keyboard_check(vk_right);
key_left = -keyboard_check(vk_left);
key_jump = keyboard_check_pressed(vk_space);

//react to imput
move = key_right + key_left;

hsp = move * movespeed;

if (vsp < 10) vsp += grav;

if (place_meeting(x,y+1,obj_wall))
{
    vsp = key_jump * -jumpspeed
}

//horizontal collisions
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 collisions
if (place_meeting(x,y+vsp,obj_wall))
{
    while(!place_meeting(x,y+sign(vsp),obj_wall))
    {
        y += sign(vsp);
    }
    vsp = 0;
}

y += vsp;

//animate

if (move!=0) image_xscale = move;

if (place_meeting(x,y+1,obj_wall))
{
    if (move!=0) sprite_index = spr_player_run; else sprite_index = spr_player_idle;
}
//else
//{
   if (vsp < 0) sprite_index = spr_player_jump //; else sprite_index = spr_player_fall;

   if (vsp > 0) sprite_index = spr_player_jump
//}

sentences:
Collision detection in games in 3D - edge to edge cross product I am having trouble understanding why, in a game collision detection, separating axis determination requires checking for the cross product of edges of the two polytopes as additional potential separating axes. In 2D the process is much more intuitive, in that it only checks the edges normals as potential separating axes.

I have been thinking about this very hard but I cannot visualize this at all, nor can I find a good motivating example or explanation.

sentences:
How to assign separate controller axes to Player1, Player2? I need to have two players moving in a level for a school project and my player controller is already set up for using axis inputs (as opposed to discreet buttons) for directional input. I already know I can assign custom key inputs from the inspector if I just declare a public variable (initialization optional because there is a drop-down list in the inspector):

public KeyCode jumpInput = KeyCode.Space;

How can I assign custom directional axis inputs from the inspector? I already have alternative horizontal and vertical axes defined in my preferences, I just need to know how to assign them.

Been putting this project together for 36 CONTIGUOUS hours and I am ready to put it (and myself) to bed. Thank you in advance for your time.

EDIT: My confusion was coming from (beyond being awake too long) thinking that I needed a special data type (like KeyCode) for an Axis, and couldn't find it in the reference. But I didn't consider making a public string and plugging that into the input. This way, I just need to know what I named the new axes and use that for the public string.

sentences:
How exactly do you deconstruct the Tiled Map Editor exported tile ID? I am trying to build 2D maps with Tiled Map Editor for my game, and I export them under text format, so a tile can look like this:

1,2,3,15,2,12,2
5,23,1,6,2,3,4,6

and so on, for many rows. In this link you can see an example of a map, to get a better idea.
Now let's say I have 3 layers, each using its own tileset. The numbers in the layer represent the ID of the tile, basically the number of the tile in the sheet. If grass is the 2nd tile, then the ID is 2, and so forth.
However, as you can see in the link, different tilesets will export different IDs per layer, notice how in the object layer I can have IDs such as 81, when in fact the ID is only 1, so it adds up 80 or so.
Since I am trying to make my map system as flexible as possible, I need the real ID in order to make some calculations. How does tiled export these sort of IDs? I simply want to determine what number to substract in order to get the id, like so:

tile.id = currentid - something_strange;

sentences:
Shadowmapping with multiple light sources I am using shadow-mapping to add shadows to my world.
Currently, I use one lightsource, which means I have to draw my world twice: once in the lightview, once in the camera view.
I want to add more light sources to the world, I want at least 2 sources, maybe 3 or 4.
My world geometry is large, roughly 1M triangles, so drawing them comes at a large cost.
Are there any shortcuts I can take to avoid drawing the geometry for every light source?
Would it be possible to write to multiple depth textures in a single pass? E.g. pass several lightview matrices to a vertex shader and somehow write several framebuffers in one go?
I am using OpenGL core profile.
What I've tried: I looked at Multiple Render Targets, but it seems that every attached buffer will share the same vertex transformation, which would not help in my situation: every light view has a different transformation.

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:
zoom, scale, pan etc in an application and printing I have a C# windows application where I display photos for editing. The displayed
image is scaled to fit the screen. I allow pan, zoom, rotate, crop operations. Once
the editing is done, I would like to print. Now since the displayed image is scaled
before any of these operations, how can I print the photo correctly?

one option is to do the operations on the original image and then scale it and display it.

Is it what is normally done?

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 do I make an arrow line up with a bow when rotating them? I am trying to create a bow and arrow animation in which the player can drag downwards to increase the bow strength (see the image) and release it to hit a target. I can't get the arrow to align with the bow when the arrow's height is changed (third image). I am rotating both the bow and arrow around their respective origins (w/2, h/2).

What is the correct way to do it?

sentences: Invert colors Java rendering I am making a 2d platformer in java using the slick2d engine. I only use 2 colors: black and white. I want to implement a feature were i invert the colors of certain entities. However i can't find a way to do this. Anyone knows of an easy way or function?

sentences:
Gradient Banding in Unity Android In an Android game, I have a gradient background that changes color over time. This was achieved by creating a 1x2 pixel texture in code, and stretching it over a large quad with bilinear filtering.

This all works fine in the editor, but as soon as it is viewed on an Android device, the banding is ridiculously noticeable and annoying.

Since this texture is generated in code, I cannot set the compression to "truecolor" like most other post suggest, nor can I tick the "Generate Mipmap" option.

Here is how the gradient look on the phone :

Code to generate gradient (stripped of unimportant stuff):

Texture2D gradient;
MeshRenderer render;
Color HSV1, HSV2;
Color primaryColor, secondaryColor;

render = GetComponent<MeshRenderer>();

Update() {
    HSV1.x += 0.01F * Time.deltaTime;
    HSV2.x = HSV1.x;

    if (HSV1.x > 1)
        HSV1.x = HSV1.x - 1;

    if (HSV2.x > 1)
        HSV2.x = HSV2.x - 1;

    primaryColor = Color.HSVToRGB(HSV1.r, HSV1.g, HSV1.b + HSVdifferece);
    secondaryColor = Color.HSVToRGB(HSV2.r, HSV1.g - HSVdifferece, HSV1.b - HSVdifferece);

    gradient.SetPixel(0, 0, primaryColor);
    gradient.SetPixel(0, 1, secondaryColor);
    gradient.filterMode = FilterMode.Bilinear;
    gradient.Apply();

    render.material.SetTexture("_MainTex", rainbow);

}

The color banding is really obvious and annoying. How can I fix this?

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:
How to check mouse coordinates and mouse events I'm building a simple game where if the mouse's X coordinate is greater than 200, and you click, the screen will turn red. Here's the code:

var mouseX = event.clientX;
  var mouseY = event.clientY;

function startGame(){
 if(mouseX > 200){
  document.body.style.backgroundColor = "red";
 }
}
document.addEventListener("onmousedown", startGame);

Am I using an incorect way of finding coordinates or am i using an incorrect way of finding mouse down or what? I can't use Jquery btw.

sentences:
Calculate path of laser beam? Lets say we have a laser beam emitter that has a position and an angle (in a 2D world to simplify things). The laser emitted from that emitter will start at that position, and continue heading in the direction of the angle until it intersects with an object (some arbitrary polygon). If that object is reflective, the laser should bounce off the surface that it first intersects. This continues until the laser hits a non-reflective surface.

I guess the problem here can be divided into two problems: finding the first intersection and calculating the new angle from that intersection. I'm not exactly sure how to solve the first problem, but I figure the second one can be solved by finding the angle between the laser and the normal vector (i think that's what it's called) and calculating the new angle using that.

sentences:
Moving a big set of box2d bodies in an iOS endless side-scroller game (such as Canabalt) I am working on an iOS endless-running game (Robot Unicorn, Canabalt, etc). I'm using box2d for the Physics and Collision Checking and cocos2d for graphics.

To achieve the notion of an endless level, I instantiate "boards" which encapsulate a set of box2d bodies (floors, enemies, etc). I place two of these "boards" alongside and I check for their current position every frame. When they leave the visible area of the iPhone screen, I move the board and it's set of bodies to a new position, further ahead.

To do this I use the SetTransform() method of the b2Body class.

I also put all my bodies to sleep before doing this.

My issue is that every time I perform this task, the FPS has a noticeable drop.

I ran the Profiler and it seems the problem is within the SetTransform(). Apparently, box2d is removing and inserting leafs in the dynamic tree.

I am moving around 50 bodies in one frame.

My question to you guys is if anyone knows of a more convenient way to translate bodies without it taking a toll in performance. Perhaps it's cheaper to create new bodies, instead of moving the existing ones? Am I missing some kind of flag I should activate before calling SetTransform()?

Thanks in advance!

sentences:
How fill gutter using ID3DXTextureGutterHelper interface? Using UVAtlas (Direct3D 9) Packed charts are separated by a
  user-specified gutter width. The gutter width is the amount of
  separation between charts, and allows for bilinear interpolation and
  mip-mapping to avoid rendering artifacts at chart boundaries. D3DX
  provides an interface for automatically filling in these gutters - see
  ID3DXTextureGutterHelper for more information.

How I can do that? I call ApplyGuttersTex, after calling ResampleTex but nothing changed.

sentences:
libGDX without android dependancies I want to create a game that due to some assumptions doesn't make sense as a tablet game.

I already created some frame (controllers, autowiring, build scripts, etc.) that would help me later on, but since Slick2D, that I currently basing it on, is no longer really supported I am considering switching to libGDX while it still not time expensive.

My question is: is it possible to easily get rid of all of Android dependencies? GUI scaffold generator doesn't allow to do that and I would like to know is it just generator's issue or is the library itself tied to Android dependencies?

It's my main concern that would help me decide whether or not switch from Slick.

EDIT:

Basically when I use GUI generator to scaffold project it creates at least 3 Eclipse projects:

core project,
Android project - depending on core,
desktop project - depending on Android.

While it shouldn't a be problem to merge them into 1 bigger project and remove virtually dead code, I want to know if there would be left some Android dependencies that I couldn't remove to make it still runnable on desktop.

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:
Android Game Idea loop So I'm a beginner in developing android gaame. I already developed a game, it's intended for kids. Basically, the game has 4 stages. In each stage, it has 15 questions. If the user chooses the correct answer, he will proceed to the next question, otherwise, will be given 3 trials to choose the correct answer/object.

Below is the structure of my game:

Home
Menu
    >>> Stage 1 | Stage 2 | Stage 3 | Stage 4

Stage 1_1.class
Stage 1_2.class
....

Stage 2_1.class
Stage 2_2.class
....

Stage 3_1.class
Stage 3_2.class
....

Stage 4_1.class
Stage 4_1.class

I know it's very noob, that's why I ask for your help to translate this to a more consistent, and efficient game or just give me an idea. I want to put each stage's main loop only in ONE ACTIVITY. Help is truly appreciated. Thanks.

sentences:
How can I fade something to clear instead of white? I've got an XNA game which essentially has "floating combat text": short-lived messages that display for a fraction of a second and then disappear.

I've recently added a gradual "fade-away" effect, like so:

 public void Update()
        {
            color.A -= 10;
            position.X += 3;
            if (color.A <= 10) isDead = true;
        }

Where color is the Color int the message displays as. This works as expected, however, it fades the messages to white, which is very noticeable on my indigo background.

Is there some way to fade it to transparent, rather than white? Lerp-ing towards the background color isn't an option, as there's a possibility there will be something between the text and the background, which would simply be the inverse of the current problem.

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: How to model chess knight movement in GameMaker? I am making a chess game in GameMaker, and I have the basic movement down for all of the other pieces except for the knight. I am using a system where I have an if statement that checks if the mouse is in a location that it can move too, then if it moves the piece there. For example, the rook code is (mouse_y div 64) *64 == y || (mouse_x div 64) * 64 == x. What would be an expression that would work for knights? Would this strategy even work for knights?

sentences:
Godot - Get button node in click event not working How we can get the button reference on the event function that is connected?
My connect signals never works

extends PanelContainer

onready var hbox_container = $ScrollContainer/HBoxContainer
var btn

func _ready():
    createbutton()

func createbutton():
    btn = Button.new()
    btn.set_name("button 1")
    btn.text = "button 1"
    hbox_container.add_child(btn)
    btn.connect("toggled", self, "button_toggled", [btn])

func button_toggled(toggled, target):
    print("which button = ", target.get_name())
    if toggled == true:
        print("Button ist pressed")
    else:
        print("Button is released")

sentences:
Using Racing Wheel force feedback with a JavaScript game I have a Thrustmaster T80 Racing Wheel that I am using while developing an online game with ThreeJS.

I have already made it so I can drive the car with the wheel and the game knows when I crash the car. But looking online I couldn't find a way to make the wheel 'rumble' or shake when the car crashes.

The wheel does support this on other (downloaded exe) games but it would be amazing if it was possible to achieve in a JS game, but I couldn't find any mention of doing this online.

sentences:
How to create fun and interactive menus with cocos2d? Possible Duplicate:
  How to make animated buttons in a menu with Cocos2d?

How do I make fun and interactive menus with cocos2d, all the tutorials are just for simple clickable menus. Can any one help me learn this?

It would be see the menu flip or slide away, I know you can do this with scenes but how do I make this with just the menu?

Let's say the menu is a bunch of cards and I want them to flip over like the sub-menu is on the backside of the card, how would I do this?

Or, make the Main menu slide in from the left, right, top or bottom side and then when a button is selected it slides away the same way and switch to a sub-menu (settings, Score etc)?

Anyone?

David

sentences:
Consistent Space Gravity Simulation I have done some reading into this subject but haven't been able to come to a conclusion that I'm really satisfied with so far, so here is the situation. I have a game set in space, its top down and essentially 2D as far as physics is concerned and it revolves around the gravitational interaction between planets and black holes. I'm using Unity, so I have the ability apply forces to bodies. However, I have to do all the gravity calculations myself... This is where I get stuck.

Now it's not the maths that I'm having trouble with, maths I can do, its general game "feel" that is the sticking point. Originally I tried Newtons standard gravitational equations but I found that to a general user they produce unexpected behaviour. If you place two different mass planets on either side of a central black hole, both the same distance away, they will reach the central black hole at the same time (which "feels" odd). I also played around with more primitive implementations that just manipulate distance and mass in different ways but I always ended up with the same issue; as the planets im using undergo dramatic shifts in mass over the course of the game, the effect of the black holes always starts off being overly erratic (at low body masses) and then moves to being overly sluggish (at high masses) giving the game a very inconsistent feel at the moment.

Has anyone run into the same issue here and come out with a good way of simulating gravity in space? Does anyone know of examples of where this has been done before? What are some things that I may have overlooked or may want to take into consideration in the calculations?  Remember that realism isn't the main concern here, its game "feel".

I'm open to any and all suggestions here so don't hesitate to put forward any sort of crazy answers!

sentences:
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:
How can I do Mouse Selection In OpenGL 3.0? Hello I'm pretty good programmer I've made my own 2D games in SDL and made a gui in 3D using Old OpenGL and Modern OpenGL but.. I'm having problems with trying to click 3D models with opengl I have no idea what to do too be honest.

Do I read the area that I've clicked?

or what do I do?

100% shore this has been asked before but I just don't know what to do...??

using :

OpenGL 3.0

WIN32 API

C++

sentences:
Shooting intervals with variable framerates lets say i have a gun which fires at a rate of 10 shots every seconds.

so i every gameloop frame, i check if the necessary time has passed and instantiate a new shot.

now what if the framerate of the game actually drops below 10 fps. then the player will have a disadvantage because his gun doesnt fire accordingly anymore.

what is the usual workaround of this problem?

thanks!

sentences:
Problem with diagonal collision response using PyGame So I have been having this problem for the last few days and it has me really frustrated. What I am trying to do is resolve collisions with custom hitboxes in PyGame and it looks something like this:

Everything works fine until I collide with something diagonaly, then I get a weird bug where the character suddenly teleports to the opposite axis side of what I am colliding with, like this:

https://gyazo.com/62c53cc4f3a944c317a951c0f8ae14ea

I have read a lot about this the last day and from what I have gathered this has to do with the fact that I don't resolve the x and y axis independently? maybe?

If I have a print("x") and print("y") statement in their respective code I get this when colliding with something on the "y" axis:

The bug seems to come from that somewhat random "x" in the middle there. The code resolves a collision as if the character was colliding with something on the "x" axis when in fact it was the "y" axis. It is worth nothing that this ONLY happens when diagonaly colliding with the last axis I check (y in this case). So I suppose that is my question really, why does this happen?

Here is my collision handling code:

def collide(self, direction):

    hits = pg.sprite.spritecollide(self, all_sprites_wall, False, rectconverter)
    if direction == "x":
        if hits:
            print("x")
            if self.vx > 0:
                hits[0].update()
                self.x = hits[0].hitboxrect.left - self.rect.width - camera.camera.x
                self.hitboxrect.right = hits[0].hitboxrect.left
            if self.vx < 0:
                self.x = hits[0].hitboxrect.right - self.rect.width + self.hitboxrect.width - camera.camera.x
                self.hitboxrect.left = hits[0].hitboxrect.right
            self.rect.x = self.x

    if direction == "y":
        if hits:
            print("y")
            if self.vy > 0:
                self.y = hits[0].hitboxrect.top - self.rect.height - camera.camera.y
                self.hitboxrect.bottom = hits[0].hitboxrect.top
            if self.vy < 0:
                self.y = hits[0].hitboxrect.bottom - self.rect.height + self.hitboxrect.height - camera.camera.y
                self.hitboxrect.top = hits[0].hitboxrect.bottom
            self.rect.y = self.y

And here is the players update function:

def update(self):
    self.move()

    self.hitboxrect.y = self.y + camera.camera.y + self.rect.height - self.hitboxrect.height
    self.rect.y = self.y
    self.collide("y")
    self.hitboxrect.x = self.x + camera.camera.x
    self.rect.x = self.x
    self.collide("x")

I think the problem lies somewhere in this code, but if you think otherwise feel free to say so and I would happily add more code!

sentences:
Rendering perspective independent polygons in perspective view I am creating an editor where I have "grabhandles" that can be dragged to transform a primitive object.

My problem is that I can't find the correct solution to show these grabhandles in a perspective view.

They need to have the correct position AND same size independent of where they are,how far away they are on the perspective viewport and independent of what the viewport dimensions are.

In orthographic mode I do not have this problem as I create the handle polygons by multiplying it with a zoom factor.

sentences:
What are good, simple action games/action RPGs to emulate? There is standard advice for game development to start off emulating simple games you know and build up from there. Which makes me wonder. What are good examples of action games or action RPGs that are very simple to begin with to try and emulate? What is necessary and what is superfluous?

Please link to the game's site (or Wikipedia page if it's defunct) if you can, and only one game per answer please.

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:
When scaling the camera with the player, how can I make it more noticeable? I am making a game where you play as fish. When you eat food you become larger. I am counting the camera scale as follows:

camera.scale = (player.originalWidth / player.width)

Then I apply it as a transform to the whole world. Now when the fish grows up you don't see any change on your sprite, only on the surrounding world. I want to achieve that you will see the growing a little bit. How should I modify this equation?

sentences:
Unity 3D [C#] - How to properly reset a scene I have a problem when I try to reset a scene. It doesn't seem to run, I have a script (of all scripts that have Awake and Start methods on that scene) that on the Awake method starts a coroutine, but when reseting the scene it doesn't even run it. I've read that it may be a problem of using the DontDestroyOnLoad method, but that doesn't seem to solve the problem since that script on the start takes a lot of references of objects that are only on the scene that I want to restart. I don't use any static variables on any script.

I made an unitary test trying to restart a scene with just one object and one script attached, on its Start method it also starts a coroutine but even in that test it doesn't even run the coroutine.

Here's the script of the unitary test:

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

public class LoadingSceneController : MonoBehaviour
{
    void Awake()
    {
        DontDestroyOnLoad(this.gameObject);
    }
    //Scene scene;
    // Use this for initialization
    void Start()
    {
        //scene = SceneManager.GetActiveScene();
        DontDestroyOnLoad(this.gameObject);
        useStartCoroutine();
    }

    void useStartCoroutine()
    {
        StartCoroutine(loadScene());
    }

    IEnumerator loadScene()
    {
        yield return new WaitForSeconds(3);
        SceneManager.LoadScene("gameplayScene 1");
        //SceneManager.LoadSceneAsync("gameplayScene 1");
    }
}

sentences: What kind of game is prisonblock? Any open source that I can learn the math behind it? What kind of game is prisonblock?  Any open source that I can learn the math behind it for user actions/gameplay?

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:
Issues with OpenGL rotation matricies and shaders I am having an issue with my rotations in my opengl shaders. My program works fine before I add in my rotation matrices. Here is an example, at YouTube. After I add rotations to my shaders, there are issues. Here is an example.

Here is my vertex shader:

    #version 130

in vec3 position;
in vec4 color;
in vec2 texcoord;
uniform mat4 view_array;
uniform mat4 end_array;
uniform mat4 projection_matrix;
uniform mat4 trans_matrix;
uniform mat4 x_rotation_matrix;
uniform mat4 y_rotation_matrix;
uniform mat4 z_rotation_matrix;

out vec4 pos;
out vec2 texture_coordinate;
//out vec4 color_value;
void main()
{
     mat4 vw_matrix = mat4(1.0);
     mat4 rotation_matrix = x_rotation_matrix * y_rotation_matrix;
     mat4 model_matrix =  trans_matrix * rotation_matrix;//
     pos = projection_matrix * vw_matrix * model_matrix *  vec4(position, 1.0);
     gl_Position = pos;
     texture_coordinate = texcoord;
     //color_value = color
}

Here are the values for my matrices:

// rotation matrices

x_rotation_matrix[0] = 1;
x_rotation_matrix[1] = 0;
x_rotation_matrix[2] = 0;
x_rotation_matrix[3] = 0;
x_rotation_matrix[4] = (float) cos(-yaw * (PI / 180));
x_rotation_matrix[5] = (float) -sin(-yaw * (PI / 180));
x_rotation_matrix[6] = 0;
x_rotation_matrix[7] = (float) sin(-yaw * (PI / 180));
x_rotation_matrix[8] = (float) cos(-yaw * (PI / 180));
x_rotation_matrix[9] = 0;
x_rotation_matrix[10] = 1;
x_rotation_matrix[11] = 0;
x_rotation_matrix[12] = 0;
x_rotation_matrix[13] = 0;
x_rotation_matrix[14] = 0;
x_rotation_matrix[15] = 1;

y_rotation_matrix[0] = (float) cos(-pitch * (PI / 180));
y_rotation_matrix[1] = 0;
y_rotation_matrix[2] = (float) sin(-pitch * (PI / 180));
y_rotation_matrix[3] = 0;
y_rotation_matrix[4] = 0;
y_rotation_matrix[5] = 1;
y_rotation_matrix[6] = (float) -sin(-pitch * (PI / 180));
y_rotation_matrix[7] = 0;
y_rotation_matrix[8] = (float) cos(-pitch * (PI / 180));
y_rotation_matrix[9] = 0;
y_rotation_matrix[10] = 1;
y_rotation_matrix[11] = 0;
y_rotation_matrix[12] = 0;
y_rotation_matrix[13] = 0;
y_rotation_matrix[14] = 0;
y_rotation_matrix[15] = 1;

z_rotation_matrix[0] = (float) cos(-pitch * (PI / 180));
z_rotation_matrix[1] = (float) -sin(-pitch * (PI / 180));
z_rotation_matrix[2] = 0;
z_rotation_matrix[3] = (float) sin(-pitch * (PI / 180));
z_rotation_matrix[4] = (float) cos(-pitch * (PI / 180));
z_rotation_matrix[5] = 1;
z_rotation_matrix[6] = 0;
z_rotation_matrix[7] = 0;
z_rotation_matrix[8] = 0;
z_rotation_matrix[9] = 0;
z_rotation_matrix[10] = 1;
z_rotation_matrix[11] = 0;
z_rotation_matrix[12] = 0;
z_rotation_matrix[13] = 0;
z_rotation_matrix[14] = 0;
z_rotation_matrix[15] = 1;

GL20.glUniformMatrix4fv(
    GL20.glGetUniformLocation(programID, "x_rotation_matrix"), true, x_rotation_matrix);
GL20.glUniformMatrix4fv(
    GL20.glGetUniformLocation(programID, "y_rotation_matrix"), true, y_rotation_matrix);
GL20.glUniformMatrix4fv(
    GL20.glGetUniformLocation(programID, "z_rotation_matrix"), true, z_rotation_matrix);

Here is my transformation matrix:

trans_matrix[0] = 1;
trans_matrix[5] = 1;
trans_matrix[10] = 1;
trans_matrix[12] = x;
trans_matrix[13] = y;
trans_matrix[14] = z;
trans_matrix[15] = 1;

What am I doing wrong?

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:
How should I store a Game Database on Android? I'm looking at creating a game for Android and while I have most of the ins and outs worked out, the one thing I'm struggling with is how to store data for the game.

Ultimately, the game will be based off of a lot of pre-defined data and statistics so the obvious choice to me would be something like SQLite, but as I'm pretty new to the realm of Android and Game Development, I'm not 100% certain if this is the right route to follow.

The data will be general pre-defined data as well as player data (along the lines of careers stats - what place finished, etc).

I was wondering if there was a better/best practice solution that wasn't SQLite and that would provide said functionality and if so, could you point me in the right direction?

sentences:
How to Keep Unity From Changing Sprite When Changing Orthographic Size? so I have a simple X animation, and at the end (when it looks like a full X), it looks good on one orthographic size, but bad on another. Here's what it looks like when the size is 3:

Now you can notice, there are a few pixels that look a bit off, but it still looks pretty good. Here's what it is supposed to look like:

So if you look closely, it is a bit different, and that's the point. However, if you change the orthographic size to.. say 5, you get this horrid thing:

Why is Unity doing this, and how can I fix this so that it looks how it's supposed to? Also, in this, my X is upscaled x2. Would it fix it just to have it made to the right size, and then upscaled x1 (e.g none)?

sentences:
Surprisingly, in SpriteKit game engine, "deltaTime" is not frame time? In Apple's cocos-like 2D enginer, SpriteKit, they have what they call a custom field:

testField = SKFieldNode.customField{
      (position: vector_float3, velocity: vector_float3,
      mass: Float, charge: Float, deltaTime: TimeInterval) in

            print("deltaTime \(deltaTime)")
            return vector_float3(0,0,0)
        }
addChild(testField)

the values printed out are simply the cumulative time, not the frame delta time!

Interestingly the documentation is ambiguous or just wrong:

https://developer.apple.com/documentation/spritekit/skfieldforceevaluator

notce there it uses the argument name "time", however
however, the documentation-writer wrote "time that has passed since the last time the simulation was executed" (ie, the usual frame time you'd expect), and
each Apple code fragment I've dug up uses "deltaTime" as the argument name, and the author treats it as a normal frame time like you'd expect in any game engine setting

I've tried it on as many devices/OS as at hand - has anyone found the definitive resolution of this?  Is it really meant to be (fairly uselessly) time rather than deltaTime?

Question, Does anyone definitively know if the value returns cumulative time, or, delta time?

(If the former it would appear that the doco is completely wrong.)

Question, In the so-called "deltaTime" argument of Apple's spriteKit, what is returned?

sentences:
Do SDL surfaces get reused? In SDL, lets say I'm rendering text to a surface. Then I blit it with the scene's main surface to form a composite image to flip.

I get the text surface into a class-level member called 'messageSurface':

messageSurface = TTF_RenderText_Solid( ..... );

So, do I have to call

SDL_FreeSurface(messageSurface);

on every loop to prevent memory leaks? Or will SDL "reuse" the old surface the next time around?

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:
Unity 5 Closing Menu On Multiple GameObjects When A New Menu is Opened? I am trying to make a menu system for each GameObject, and when a GameObject is clicked it will close all other menus and open the one for that GameObject. I am using one script for this:

using UnityEngine;
using System.Collections;

public class BlockMenus : MonoBehaviour
{
Vector3 point;

public Transform block;
public GameObject activeBlock;

bool buttonActive = false;
bool activeBlockActive = false;

string hitObject = "";

void Update()
{
    point = Camera.main.WorldToScreenPoint(block.position);
}

void OnMouseDown()
{
    hitObject = this.gameObject.transform.tag;

    buttonActive = !buttonActive;
    activeBlockActive = !activeBlockActive;

    activeBlock.SetActive(activeBlockActive);
}

void OnGUI()
{
    if(buttonActive)
    {
        switch(hitObject)
        {
            case "mine":
                GUI.Box(new Rect(((point.x) * (1.08f)), ((Screen.height - point.y) * (0.1f)), (Screen.width * (0.3f)), (Screen.height * (0.5f))), "");
                GUI.Button(new Rect(((point.x) * (1.08f)), ((Screen.height - point.y) * (0.87f)), (Screen.width * (0.05f)), (Screen.height * (0.06f))), "Build Mine");
                break;
        }
    }
}
}

sentences:
FBO Depth Buffer not working I'm trying to get the depth buffer for my 2D game working by offsetting the z value of the rectangles. For some reason, my depth buffer is coming back empty. The value is always 0. I'm assuiming there is something wrong with how I attach the depth buffer to the FBO? But I've looked over that code many times and don't see anything wrong with it. Let me know if you need more information.

I have depth testing enabled with GL_LEQUAL.
I have znear and zfar set to 1.f, -10.f and I have 9 quads setup at three different depths.
I have set glClearDepth(1.0) and I clear bot the COLOR_BUFFER_BIT and DEPTH_BUFFER_BIT before I draw to the FBO, however the value is still 0.

FBO setup:

RenderTarget::RenderTarget(int width, int height) {

    mWidth = width;
    mHeight = height;
    mVbo = 0;

    // Create the color buffer
    glGenTextures(1, &mTextureId);
    glBindTexture(GL_TEXTURE_2D, mTextureId);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, mWidth, mHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);

    // Create the depth buffer
    glGenTextures(1, &mDepth);
    glBindTexture(GL_TEXTURE_2D, mDepth);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, mWidth, mHeight, 0, GL_RED, GL_BYTE, NULL);

    /*glGenRenderbuffers(1, &mDepth);
    glBindRenderbuffer(GL_RENDERBUFFER, mDepth);
    glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT32, mWidth, mHeight);*/

    // Create the frame buffer
    glGenFramebuffers(1, &mFbo);
    glBindFramebuffer(GL_FRAMEBUFFER, mFbo);

    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mTextureId, 0);
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, mDepth, 0);

    GLenum err = glCheckFramebufferStatus(GL_FRAMEBUFFER);
    assert(err == GL_FRAMEBUFFER_COMPLETE);

    glBindFramebuffer(GL_FRAMEBUFFER, 0);

    createVbo();
}

Fragment shader

#version 120

uniform sampler2D diffuseMap;
uniform sampler2D lightmap;
uniform sampler2D depthMap;

varying vec4 texCoord[2];

void main()
{
    vec4 color = texture2D(diffuseMap, gl_TexCoord[0].st);
    vec4 light = texture2D(lightmap, gl_TexCoord[0].st);
    vec4 depth = texture2D(depthMap, gl_TexCoord[0].st);

    vec4 final = color * vec4(0.1);
    final += color * light;
    gl_FragColor= vec4(depth.r, depth.r, depth.r, 1.0);
}

Method to draw sprites to the screen/framebuffer

void GraphicsDevice::drawSprite(ISprite *sprite, float x, float y, float z, Material::TextureType type, Color c) {

    glActiveTexture(GL_TEXTURE0);
    glEnableClientState(GL_VERTEX_ARRAY);
    glEnableClientState(GL_TEXTURE_COORD_ARRAY);

    glBindBuffer(GL_ARRAY_BUFFER, sprite->getVbo());

    glBindTexture(GL_TEXTURE_2D, sprite->getMaterial()->getTexture(type)->getId());

    glPushMatrix();
    glTranslatef(x, y, z);
    glColor4f(c.r, c.g, c.b, c.a);

    glVertexPointer(3, GL_FLOAT, sizeof(Vertex), (void*)offsetof(Vertex, x));
    glTexCoordPointer(2, GL_FLOAT, sizeof(Vertex), (void*)offsetof(Vertex, tx));

    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

    glPopMatrix();

    glBindBuffer(GL_ARRAY_BUFFER, 0);
    glDisableClientState(GL_TEXTURE_COORD_ARRAY);
    glDisableClientState(GL_VERTEX_ARRAY);

}

sentences:
How do I rotate individual shapes on an html5 canvas? So I am doing a basic Asteroids clone as an intro to HTML5 canvas. I want to be able to rotate the main player while leaving the other objects on screen alone. Currently I am using transform and rotate on the canvas to allow the player to move, which works well.. but since it rotates the entire canvas it affects other shapes on screen. Is the general way to do this, to instead have each shape keep track of its own positions and perform manual transformations on the shape itself while leaving the canvas alone? Can I possibly give my shape a CSS class and control it on its own that way? Should I be using more than 1 canvas so that I can control rotations individually? Not sure what the accepted way is to handle multiple on screen images/shapes all with their own movement and rotation patterns simultaneously. My gut is telling me to have each shape track its own positions and just perform the math on the shape object itself... but then I would not be using the Canvas APIs rotate at all.

My app currently: https://jsfiddle.net/0o2pwLhn/

And a code snippet for the rotation:

// player draw test
    function drawShip() {
        ctx.beginPath();
        ctx.moveTo(shipStartX, shipStartY);
        ctx.lineTo(shipStartX + 8, shipStartY + 20);
        ctx.lineTo(shipStartX, shipStartY + 15);
        ctx.lineTo(shipStartX - 8, shipStartY + 20);
        ctx.lineTo(shipStartX, shipStartY);
        ctx.translate(shipStartX, shipCenterY);
        ctx.rotate((Math.PI / 180) * shipMoveDegree)
        ctx.translate(-shipStartX, -shipCenterY);
        ctx.stroke();
        ctx.closePath();
    }

Do the save() and restore() methods on the CanvasRenderingContext2D maybe come into play here? I have tried experimenting with it but havent gotten anywhere. I tried using save() and restore() but the issue is that once I restore, the player just gets set right back to its original spot.. since I am never actually changing its position... just rotating the entire canvas. The similar question here Is it possible to rotate an image on an HTML5 canvas, without rotating the whole canvas? explains how to use save() and rotate() which I think is on the right track.. but does not solve the issue I have because the player location is reset back to the start when the key is lifted, because I set the degrees back to 0 on keyup. How can I maintain the current rotation of a single shape regardless of the rest of the canvas?

sentences: CCD in C++ Console application I am writing a game in a c++ console application. I would like to detect whether or not there is a collision between two objects, and displace them accordingly. All sprites are simply strings drawn on screen (Ex. a sprite with x 5, y 5, width 3, height 3 and the image "XXXXOXXXX" would create a 3-by-3 box of X's with a O in the middle). All objects have a x, y, length, and width which can aid in looking for potential collisions; however I would like to look at the actual string for finer collision detection. I am relatively new to the concept of continuous collision detection and I am having trouble finding the answer via Google. Does anybody know how I would go about doing this? Thanks in advance.

sentences:
XNA 4: GetData from Texture2D and Set it into Texture3D with specific order I am trying to convert my color grading 2d lookup texture into 3d LUT. When I simply use:

ColorAtlas.GetData(data);
ColorAtlas3D.SetData(data);

I get this:

I tried building my 2d atlass horizontally but it did not helped - the data was messed up in a different way.

So my question is how can I influence the order of the data I get from the 2d atlas and how can I properly pass it into my 3d atlas?

Update: I know that I can GetData from a specific Rectangular area and put it into several arrays, but the result is still the same. This is what I tried:

        Color[] data2D = new Color[0];

        for (int i = 0; i < 32; i++)
        {
            Color[] data = new Color[32 * 32];
            GraphicsDevice.SetRenderTarget(null);

            ColorAtlas.GetData(0, new Rectangle(0, i*32, 32, 32), data, 0, data.Length);

            int oldLength = data2D.Length;

            Array.Resize<Color>(ref data2D, oldLength + data.Length);
            Array.Copy(data, 0, data2D, oldLength, data.Length);
        }
        ColorAtlas3D.SetData(data2D);

sentences:
Enemy awareness for Tower Defense 1I have a thesis project about dynamic difficulty in games and I'm focusing on Tower Defense genre. My plan let the enemy units or each units in a wave know that a tile on a path is dangerous (or many units have died there). When an enemy unit with a skill(for example area shield boost) pass or walks to a tile with the most units killed in that tile it will trigger the skill to prevent minimal damage to the wave. What algorithm would be suitable to achieve that?

PS: is this a good idea for a dynamic difficulty, if not suggestions are accepted.

sentences:
How to file down a fingernail mesh? I am creating a nail salon 3D game where I need to implement nail filing mechanics. I have tried out approaches including mesh deformation but I'm concerned about performance as I am targeting mobile platforms.
How can I shape a nail efficiently for mobile devices?

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:
Should the content pipeline tools be embedded in the engine? How minimal should a games engine be?  How much of the content pipeline should be embedded in the engine?

Some use cases where the super engine might be useful:

When loading user content, the user isn't required to package up his textures, the engine will do it at load time.
A script requests a font at a much larger size than was pre-generated, the engine could parse the ttf file ad build a new texture atlas.
Halo forge.

None of this is free of course.  This requires your content pipeline tools to written in C++.  Support libraries you use in the pipeline need to be compiled for use on the device.  It requires the content generation to be not buggy.  And it generally makes your engine larger and unwieldy.
What are some other pros and cons?
Do the pros outweigh the cons?

Some specific questions:

Should engine be capable of loading various image formats?  A TGA only loader is pretty easy to hand code.
What about audio formats?  Is it feasible to only support loading wav files?  What about ambient music files which are often huge.
Should the engine be capable of dynamic TTF parsing and atlas generation?
Texture packing.

sentences:
Where is the “Test Login Needed” in App review in Google Play? I recently uploaded a new app in the google play console to review, then I was receive an email that say:

  Please provide login credentials to the support team before you submit
  any updated version for another review (select “Test Login Needed” and
  include the test login account and password details in the open box
  field).

I can´t find the “Test Login Needed” to select it.

Can anybody tell where is this option?

sentences:
Why are my game ticks longer than expected? I was working on my game, adding stuff to it, when I noticed my ticks were in the low 50's when I had set it to do a constant 60. This is my run method.

public void run() {
    init();
    long lastTime = System.nanoTime();
    final double amountOfTicks = 60.0;
    double ns = 1000000000.0 / amountOfTicks;
    double delta = 0;
    int updates = 0;
    int frames = 0;
    long timer = System.currentTimeMillis();

    while (running){
        long now = System.nanoTime();
        delta += (now - lastTime) / ns;
        lastTime = now;
        if (delta >= 1) {
            gameUpdate();
            updates++;
            delta--;
        }

        try {
            Thread.sleep(2);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        gameRender();
        frames++;

        if (System.currentTimeMillis() - timer > 1000) {
            timer += 1000;
            frame.setTitle(title + "   |   " + "Frames Per Second: "
                    + frames);
            System.out.println(updates + " Ticks, " + frames + " Frames");
            updates = 0;
            frames = 0;
        }
    }
    stopGame();
}

I've tried removing all the code I added before this occurrence happened and it didn't help. Suggestions would be great!

sentences:
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:
GLSL Shaders-> How to manage? As your game get's bigger and bigger, you will use more and more different shader effects.
Let's take an easy example:

I have clouds in my voxel-based world, and I want to give it a blue-ish tint with a shader. Do I create a new shader, disable the default shader, enable the cloud-shader, draw the cloud, disable the cloud shader and enable the default one again?

If your game starts to get huge, how on earth can you use 300 shader effects enabled for 1 voxel and disabled for the other?

I know the question may sound strange, but it really makes me think.

I now have a Vertex- and Fragmentshader, for the matrix calculations, and basic lighting. If I want to add a shading-effect for for example water blocks, what to do?

I hope someone can help me with this mystery.

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:
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:
How to test for BoxCollider2D intersection in Unity? I have a Player object with a BoxCollider2D component and a Ladder object also with a BoxCollider2D component. Each object has a script, and in each script, I set up references to the box colliders in the normal way.

public BoxCollider2D box_collider;

void Start ()
{
    box_collider = GetComponent<BoxCollider2D>();
}

My player script is called "PlayerController", so that's the class defined in the script.

In my Ladder's script I have the following:

void Update ()
{
    GameObject player = GameObject.Find("Player");
    PlayerController player_controller = player.GetComponent<PlayerController>();
    if (player_controller.box_collider.bounds.Intersects (box_collider.bounds))
        Debug.Log ("collision");
    else
        Debug.Log ("no collision");

}

This script invariably returns "no collision" and I'm not sure why.

Any ideas?

sentences:
What are registers in HLSL for? I've read this document about HLSL registers, but it's more of a syntax description and not a purpose explanation.

What are registers in HLSL, actually? How and when do I use them? What happens if I don't (what's the default)?

sentences:
Debug logging in Factorio mod I'm writing a Factorio mod, and I'm trying to figure out why it doesn't work. Can I do some kind of error / debug logging somewhere? Both manual (printing variables) and simple error reporting (accessing a property that doesn't exist) would be great. I know about the player.print method, but I can only get it to print string literals, not objects:

script.on_event(defines.events.on_player_created, function(event)
    pcall(function()
        local player = game.get_player(event.player_index)
        player.print("Hi player") -- works
        player.print(player) -- does not work. Any error message would be nice
    end)
end)

I've also tried the log file in the application folder, and the various debug modes (F5/F6 in game), but so far haven't found anything useful.

sentences:
How can I write data to a file that users can't easily edit? Possible Duplicate:
  How can I protect my save data from casual hacking?

While working on game saving and loading I figured I could just write all the variable values to a file and then load that file from it's default location anytime.

However from the very beginning it sounded like an odd job. I know about serialization and boost, but that seems so complicated, I figured I'd keep it simple, but I've ran across this huge issue: No matter what file I can write with C++, the user can get their hands on it, they can edit their position, they can remove a boss, or add new weapons for themselves.

My question here is: How can I create a file in C++ which cannot be editted or openned with a text editor such as Notepad (I'm not trying to make a file which is impossible to open, but a file which will give the user a headache if he tries to edit it through usual methods.)

sentences:
Programmatically creating new tags in Unity I'm writing a custom editor script to add tags programmatically.

I got the error of IndexOutOfRangeException: Array index is out of range from the lines below:

SerializedObject tagManager = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/TagManager.asset")[0]);
SerializedProperty tagsProp = tagManager.FindProperty("tags");

These are my codes:

SerializedObject tagManager = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/TagManager.asset")[0]);
SerializedProperty tagsProp = tagManager.FindProperty("tags");

// Adding a Tag
string s = "Instantiated";

// First check if it is not already present
bool found = false;

for (int i = 0; i < tagsProp.arraySize; i++)
{
    SerializedProperty t = tagsProp.GetArrayElementAtIndex(i);
    if (t.stringValue.Equals(s)) { found = true; break; }
}

// if not found, add it
if (!found)
{
    tagsProp.InsertArrayElementAtIndex(0);
    SerializedProperty n = tagsProp.GetArrayElementAtIndex(0);
    n.stringValue = s;
}

Latest Update:
Error IndexOutOfRangeException: Array index is out of range is solved by resolving file location in my original script. I apologized for that.

Fixed:
Added a line in the script to update the properties

if (!found)
{
    tagsProp.InsertArrayElementAtIndex(0);
    SerializedProperty n = tagsProp.GetArrayElementAtIndex(0);
    n.stringValue = s;
    tagManager.ApplyModifiedPropertiesWithoutUndo();
}

sentences: How to implement bullet physics in libgdx I am new at game development want to know that how can I implement bullet physics in libgdx. I searched lot of things on Internet but nothing found worthy.

sentences:
Is there a way to make the boundary between materials wavy? I have a sea trading game that I'm working on developing. Right now, my world looks like this:

There are 4 different "biomes", with more to be added. Internally, this is a large mesh which has 4 different types of materials added to it, to make it work. Each region has a material associated with it.

The problem that I'm trying to overcome is to make it look less squary, I believe the process is known as bitmasking. The traditional way to do so I believe is to use images to show the boundary between each one, having one for each possible curve. That doesn't work with my current mesh architecture so far as I can tell. What I'm wondering is if there is a way to make the edges of the mesh to be curvy instead of straight lines. I assume it would have to be a shader of some kind, but my mind isn't quite figuring out the specifics of how to make it work. Any tips? Thanks!

sentences:
Semi-procedural mission generation I want to generate missions out of more or less predefined smaller chunks. Example mission structure:

Mission type: Rescue

Travel through forest
Gather intel
Choice:

Sneak into castle (if it fails, switch to fight)
Fight your way into castle
Use clever disguise (if entry method available for castle and it was discovered in 2)

Rescue princess

The travel block is generic and could be applied to a number of different landscapes, giving different random encounters or events.
Same goes for other types of blocks, the castle could be replaced with another building/location, the princess could be someone else etc.

As the example hints I want to do some more advanced things than just randomly link up a few mission chunks:

Show expected mission layout to the player before accepting it
Have optional blocks or choice between different blocks
Change mission layout during the mission: "the princess is in another castle" = add one more travel block and one enter + rescue block
Be able to increase variety later by adding additional objects like more location types
Be able to inject special story blocks into the dynamic missions that will always happen eventually

Part of the strategy element in the game is choosing which missions you accept so a lot of them will be discarded and there must be enough variation to make this choice meaningful. You might be badly equipped for forest encounters, but well equipped for sneaking into castles. And rescuing a princess is high-reward so the mission could be worth taking - this is the kind of decision I want the player to make.

I could probably just code this together in a way that works for now, randomizing a mission type, starting with the end block and work backwards from there to the start block. There will be some dependencies, like available location types depending on terrain type or available block types depending on the overall mission type. This seems like the hard part, figuring out what needs to depend on what and where to start from.

Other dependencies that come into play are:

Some missions types not becoming available until later in the story, easy to handle
Overworld location does not have much effect on the abstract "map" generated by a mission, except that some terrain types will be more common depending on where you are
Player may have access to various means of transport that will impact mainly the travel blocks
Factions exist and are somewhat tied to terrain, like elves in forest
If game world has a war between two faction I may want to spawn more combat missions against one or both of them depending on player allegiance

So do I generate elven enemies because I generated forest terrain first or do I change around my mission generation logic to look at target factions before terrain? (just an example of the kind of compromise I need to deal with).

Another model I considered but is not very keen on is having predefined fixed templates of missions to fill with blocks of appropriate types. I feel this could have me doing too much work the RNG could do for me instead and I might also have to consider template to mission type relationships.

My question is basically: Is there a strategy that would help me achieve this kind of mission generation in a relatively clean and maintainable way? A similar situation from your game that you can share lessons learned from?

Maybe there is not a perfect solution, but there are likely more or less good ways the problem can be approached in.

Game is a turn-based RPG/strategy game with OO design, but I don't think the details have a major impact for the concept I ask about. My object relationships are not set in stone yet. I think the dynamic mission-generation is a key factor in the game and if I find a good way to deal with that I may very well adapt other parts to work well with that model.

sentences:
Health bar without image collapsing to the centre in Unity 2D I am trying to create a health bar that collapse symmetrically to the centre. The color palette of my game is minimal and the health bar is only one color that does not change with size. I am new to Unity and am not sure how to achieve this.

This video uses a GameObject with an Image component, adds the health bar sprite to the image, makes the Image type fill and then changes the fill amount from the script.

I have two questions for my particular case,

I would prefer not to use an image. Since the bar is one color I can use color selector to make the bar, but then it does not have the fill type. Is there a way to do using only color?
The the bar is anchored at one end left or right. I want to anchor it at the centre. One work around is to use two objects side by side and fill them in opposite directions to get the desired effect. Is there a better way?

sentences:
Raycasting from 3D object to UI canvas! I have a world space canvas in front of the player and I want to shoot a ray towards an enemy (in the direction of the enemy) and create and object where Raycast hits the UI canvas.
I know that the physics engine doesn't interact with UI elements and event system is not the answer for me since it depends on pointer events and their position.
So how can I do this?
If possible, I would like to draw the ray or the line as gizmo to see if it's working.
My Current Code is this:

void OnDrawGizmos()
{
    foreach (AeroplaneAiControl item in GameObject.FindObjectsOfType<AeroplaneAiControl>())
    {
        Gizmos.color = Color.magenta;
        Gizmos.DrawLine(transform.position, item.transform.position);
        Vector3 Direction = transform.position - item.transform.position;
        RaycastHit rch;
        Ray r = new Ray(transform.position, Direction);
        Physics.Raycast(r, out rch);
        if (rch.collider != null)
        {
            Gizmos.color = Color.cyan;
            Gizmos.DrawLine(transform.position, rch.point);
            Gizmos.DrawSphere(rch.point, 0.1f);
        }
    }
}

it draws the magenta line but not the cyan line and no spheres.

sentences:
minecraft mapping from tibia OTBM file I am new to minecraft modding but i program for a living and it looks quite simple to get around. I have this fantasy and a quick internet search shows im not the only one. For those of you who do not know tibia is an MMORPG first released in 1997. It is a 2d tile based game and i would like to see it in 3D. since it is a tile based game it fits nicely with the minecraft architecture. Tibia is a close sourced game but there is TibiaOT which is developed by the community and the map file format is OTBM (open tibia binary map). This is a set of 15 2D grids where each grid represents a floor or the height of the grid, the file comes with two more files with monster spawns and default item locations like chests.

There is a tibia texture pack for minecraft called "Tibian texture pack", so we got the materials covered.

all in all we have the following: a native tibia map and a minecraft texture pack

people have been building tibia maps manually for years now, it seems stupid because we have a binary file for the real map. what we need is a way to map the OTBM file to a minecraft map. i am looking for tools and any other tips a on how to digest the files into a minecraft map file. an explanation of minecraft map file format would also be very helpful.

sentences:
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:
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:
How can i press the key, show the text and choose if i want to take the item? It's working fine right now, showing the text and then press the key and it takes the item but, i want something like resident evil, the text is not showing until you press acction button. How can i do that?

The key script:

var TheKey : GameObject;
private var playerNextToKey = false;
//var showMessage : boolean = false;
//var nearKey : boolean = false;
 var hasCollided : boolean = false;
 var labelText : String = "";

 function OnGUI()
     {
         if (hasCollided ==true)
     {
          GUI.Box(Rect(140,Screen.height-50,Screen.width-300,120),(labelText));
     }
 }

function Update ()
{
    if (Input.GetKeyDown(KeyCode.E) && playerNextToKey == true)
    {
    TheKey.active = false;

    }
}

function OnTriggerEnter (theCollider : Collider)
{
    if (theCollider.tag == "Player")
    {
        //nearKey = true;
        playerNextToKey = true;
        hasCollided = true;
        labelText = "¿Vas a coger la llave?";

    }
}

function OnTriggerExit (theCollider : Collider)
{
    if (theCollider.tag == "Player")
    {
        //nearKey = false;
        playerNextToKey = false;
        hasCollided = false;

    }
}

sentences:
Recursive Unity Coroutine I have a co-routine which is heavily reliant on calling itself to get the task done. I have tested it and the code works fine, the problem is that the co-routine will return every time that it enters itself recursively.

IEnumerator test(arg1, arg2)
{
    // I want to pause here
    yield return null;

    // I don't want to pause on any of these
    yield return test(arg1, arg2);
    yield return test(arg1, arg2);
    yield return test(arg1, arg2);
    yield return test(arg1, arg2);
}

In the example above I have a yield return at the top that is hit and pauses the co-routine, thats fine. Then there are the calls to itself below which also pause the co-routine. How do I avoid pausing the co-routine on the recurcive calls?

sentences: How do I make an entity move once per second in crafty.js I am trying to implement "Snake" using crafty.js but I can't seem to get the snake entity to move just once in a second. How do I do this?

sentences:
How do I animate a tilemap in Flixel? I am trying to animate a tilemap using Flixel 2.55. I found this code that apparently enables the use of sprites as tiles.

To my understanding, this loops over the tilemap's graphic and replaces the tile's pixels with the sprite's pixels each time they change. I have implemented the class and it's working, but not completely; the tiles get replaced, but do not animate unless the camera moves. Here's is the relevant part from LevelLoader.as, which only instantiates the AnimatedTilemaps (piece of code from forum) and pushes sprites into an array:

// AnimatedTile is just an extended FlxSprite
private var _waterTop1:AnimatedTile;

// Create ground tilemap
_groundTilemap = new AnimatedTilemap();
_groundTilemap.loadMap(_rawXML.Ground, Assets.OverworldGround, 8, 8);
FlxG.state.add(_groundTilemap);

_waterTop1 = new AnimatedTile(8, 8, Assets.WaterTop, 100);
// .Animate only adds and plays an animation, with a startAtFrame param.
_waterTop1.Animate('run', [0...47], 10, true, 0);

It seems as though the sprites are updating. I tried tracing the update()s, and they are running for both the sprites and the tilemap. The sprites are even changing frames. Using only AnimatedTiles and hard-placing them (giving a x and y) works and animates. What troubles me is that they only update when the camera moves.

I've been stuck on this for a week now. I am also open to other solutions for animating tilemap tiles.

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:
How can I convert a 3ds Max .max to a Cinema 4D .c4d and maintain the animation? I have recently purchased this asset from the3dstudio.com:

http://www.the3dstudio.com/product_details.aspx?id_product=193089

It has a corrupt .3ds file available, and a .max (as well as what appears to be a broken .dfx and a textureless and animation-less .obj).

I wrote the site administrator, who attempted to make me a new .3ds file from his master copy (I'm assuming the working .max file) but said:

"The .3ds export doesn't seem to be completed so normally we would just re-export it but I can't get a good export on this model. Only the low-poly control mesh wants to export so I emailed the author to see if they can get us a better file and will let you know as soon as they reply.

"With any non-max format you will not have any rigging in the model as common formats (3ds, dxf, obj, etc) do not support things like rigging (which are program specific) so any export to 3DS (and thus C4D) would just be the geometry, textures, and basic materials."

So it was my understanding based on my very limited knowledge and this e-mail I got that none of the formats that I'd be able to get into Cinema 4D would be able to carry animation data. Then I saw this Elance job posting:

http://www.elance.com/j/convert-3d-studio-max-animation-cinema-4d/19612175/

Now obviously that's not, like, internet canon: I realize just because there was a listing on some site somewhere that made it seem like it was possible doesn't make it true. But it looks like that team in India was willing to do it for sixty bucks, which makes it hard to believe it could be that in-depth of a process. But maybe that's my naïveté about either 3D or American to Indian currency conversion rates or both.

So, is this possible?

sentences:
How to load a png file without alpha premultiplying in ios? I am making a game in which I use the alpha value, in some cases for transparency, in others for occlusion, and for HDR in others.

I'm loading the images like this (this is MonoTouch, but objective-c can be easily converted to c#):

CGImage bitmap = new UIImage(resourcePath).CGImage;
width = bitmap.Width;
height = bitmap.Height;
IntPtr pixels = Marshal.AllocHGlobal(bitmap.Width * bitmap.Height * 4);
using (var context = new CGBitmapContext(pixels, bitmap.Width, bitmap.Height, 8, bitmap.Width * 4, CGColorSpace.CreateDeviceRGB(), CGImageAlphaInfo.PremultipliedLast))
{
    var dest = new RectangleF(0, 0, bitmap.Width, bitmap.Height);
    context.ClearRect(dest);
    context.DrawImage(dest, bitmap);
    GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, width, height, 0, PixelFormat.Rgba, PixelType.UnsignedByte, pixels);
}
Marshal.FreeHGlobal(pixels);
bitmap.Dispose();

However, this butchers all my pixels by premultiplying them by the alpha value.

The reason behind this is that I'm creating CGBitmapContext with CGImageAlphaInfo.PremultipliedLast. I tried with CGImageAlphaInfo.Last, but creating the context fails. Core Graphics only works with premultiplied alpha, as explained here.

I tried using CGDataProviderCopyData, as well as pngcs. However, they both simply decode the bitmap, and don't convert the pixels to RGBA, which is relevant when you're storing 8-bit, 24-bit PNGs, or indexed PNGs (I have lots of these, which are the result of optimizing my PNG files for size).

So I'm lost. I need a way to decode PNG files in a way that they are converted to RGBA without premultiplying my colors by the alpha value. Is that too much to ask? GDI, GDI+, System.Drawing, DirectX, Mono for Android as well as PSM do it just fine...

Also, why does iOS development has to be so picky?

sentences:
Game State with sqlite + MySql I am building out my first android game, after some utility app development.

I want to be sure I am not moving into a direction that is not a best practice, so please (constructively) criticize my plan.

My game will have many NPCs that will be added often (>150) in increments of 10-15. Each will have their own stats associated with them and the user will have a unique interaction with each.

Is it possible to put all of the NPC character information into a MySql database and have my app download the new information when it understands that the servers contain new information (via C2DM). Including a link to a file I will host containing the png files for each NPC. This way when there are new NPCs to be added to the game, the user doesn't have to grab an update from the market/Google Play.

Furthermore is sqlite/MySql a preferable method to save the user's game state. I want to be able to save it locally so that it can be loaded without a network connection. And periodically updated on the server to allow the user to play the same game both on a phone and tablet for example.

If I sound like I'm on the right track with my plan, what opensource projects exists from which I can learn/analyse the methods they use to accomplish a similar task? I have been unable to find anything like this as of yet.

EDIT: by >250NPCs I mean that the game will start out with perhaps ten enemies. Each has their own stats (health, strength, magic etc). And since I plan on adding more than 150 types of enemies, I'd like the game to be able to update at run time rather than require an update with Google Play - since many users simply do not update their software on a timely basis, they will be missing out on the added value.

The reason I favor SQL is so that I can easily view my game characters and modify their stats/qualities on the fly should I see the game become unbalanced.

sentences:
To what extent it is legal to declare support of third party commercial products' assets? Is it legal to say that MyGame supports other (specific) games' textures, sounds and models?

I'd like to get involved into an open source game project and implement support for Quake's weapon models (for example), but the owners of the project don't know about the legal aspect of it, so I'm asking here.

sentences:
What is the right way to use a QStateMachine for a text adventure game? I have seen a couple topics about this already but they were a bit vague for me so I decided to make this. I'm working on a little adventure game just for fun in Qt, its basically just text on the screen and the player inputs commands into a line edit widget which I then process and do the related action/event. Thing is, I am a little confused on how to approach this. I don't want to dig myself a hole by manually coding in lots of commands and events per room because it seems to just be a pain later on. So then I thought about using some sort of database to store the information but which one should I use? I would love some advice from people who have tried something similar.

And here, these pictures are a rough outline of what I am trying to do.

Edit: I should add, the tiles for the level basically work like this. The light gray is a direction the player can move in, the dark gray parts are walls and the colors are various different actions you can do.

I don't particularly care for code, but I would like suggestions on what tools to use for this and maybe how to set them up right.

sentences:
Get 3D quad rotation matrix from points I have 4 3D points which represent a even quad in space. (So 3 points are sufficient)
I need to get all the individual transformations (translation, rotation, dimensions) so that I can build that quad in my CSS 3D engine. So the default normal vector for a quad is [0, 0, 1].

What I have so far:

// 4 points
p0, p1, p2, p3

// normal
normal = cross(p1 - p0, p2 - p0)

// axis and angle
axis = cross([0, 0, 1], normal)
angle = arccos(dot([0, 0, 1], normal))

// rotation matrix
rotationMatrix = matrix4.fromAxisAngle(axis, angle)

// width and height
width = sqrt((p2.x - p1.x)^2, (p2.y - p1.y)^2, (p2.z - p1.z)^2)
height = sqrt((p1.x - p0.x)^2, (p1.y - p0.y)^2, (p1.z - p0.z)^2)

// translation
x = (p0.x + p1.x + p2.x + p3.x) / 4
y = (p0.y + p1.y + p2.y + p3.y) / 4
z = (p0.z + p1.z + p2.z + p3.z) / 4

It almost works, but some rotations are wrong or more specifically one rotation axis is missing. This is logical because the rotation is only build from the normal. So how can I get the full rotation?

Here you see that the top and bottom quads are just rotated around the x axis but the y axis rotation is missing:

sentences:
Casting a directional line of which an object is coming from I want to create a directional line ( curve / linear ) depending where the direction is coming from.

In some games, similar to Angry Birds, a dotted guideline is shown to provide where the gameObject is going.

I want to create something like that. But not from the starting point.
When i mean starting point, it simply means a dotted guideline from where the gameObject is released.

What i want is a dotted guideline from the end point. However, this end point is fixed.
How i imagine this is, i have a gameObject. When this gameObject is near to land around this end point, it will show the dotted guideline.

Am i asking too much ? Sorry if i am, a structural guideline of how to write this code would be great.

Thanks.

Edit

So this how i want it visual.
In Diagram ( A ) it shows a dotted line through the whole course of the path.

However what i want is shown in Diagram ( B ). It is split into two parts, a orange and red path. I only want the red path. But for a clear understand i included the red path. I only want the object to land or around that spot of Diagram ( B ).

What i dont want is from Diagram ( C ). Because it is not landing in the spot of Diagram ( B ). I dont want it to show anything. I only want the red dotted line from Diagram to appear when it is near or going to land in that spot of Diagram ( B ).

Thanks

sentences:
How to identify performance issues with large numbers of mods? My current problem is with RimWorld, but in the past I had the same issue with Minecraft. Basically the game gets more fun with more mods, up until the point where performance becomes unmanageable. Most mods are open source and I am confident that I could fix many of these performance issues if I could only identify where the hotspots are.

So as a modder, how can I figure out where I should try and help out?

200+ mods, though obviously I would add more if I could.
I don't have access to the core game source code.
I don't have access to a debug version of the core game.
I probably have source code access to a given mod.
I'm looking for ways to help the community, not ways to make the game faster for just me (like adding more memory).

sentences:
3D line segment AABB collision, with hit normal? I'm embarrassed I can't find this, but I'm wanting to detect intersection with a 3D line segment (not an infinite ray) with a 3D AABB, the AABB being defined as two Vec3f's which represent the Min and Max extents.  So the AABB can be arbitrarily-sized.  I also need the surface normal of the AABB, if there was a hit.

From looking at similar algorithms I at least know it seems good to calculate the inverse direction of the line beforehand, at least, if you're needing to check against multiple AABBs per frame.

I have

struct AABB
{
    VEC3F min;
    VEC3F max;
};

// a and b representing start/end points of the line segment
// returns true if intersects, also fills out "normal" if true
bool LineIntersectsAABB(const VEC3F& a, const VEC3F& b,
    const VEC3F& inv_dir, const AABB& aabb,
    VEC3F* normal);

The implementations I've found either do not find the hit normal, and/or they're intended for boxes/cubes where the three dimensions of the box are always equal length, which doesn't work for me.  Implementations seem to vary greatly, which is confusing for me (since I'm still trying to learn it), and, considering that I need the hit normal, I'd imagine that that may rule out certain implementations.

sentences:
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: What's the difference between mesh and a model? Which one is created first? For example if a team worked on a graphical asset of a car, what would be a model and what would be a mesh of the car?

sentences:
get View from LibGDX for Android I am making a LibGDX app, and I need to get the view to put to an Android app.
Here is the code to get the view:

package jangkoo.game.shadowfiend.android;

import jangkoo.game.shadowfiend.ShadowFiendGame;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
public class LibGdx extends AndroidApplication {
    private static final String TAG = "LibGDx";
    public View view;
    Bundle savedInstanceState;
    @Override
    protected void onCreate (Bundle savedInstanceState) {
        if(savedInstanceState == null)
        this.savedInstanceState = getIntent().getExtras();
        Log.e(TAG,savedInstanceState + "");
        super.onCreate(savedInstanceState);

        AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
        view = initializeForView(new ShadowFiendGame(), config);

    }
    public LibGdx(){
        onCreate(new Bundle());
    }

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);

        }
}

And I want to get the libGDX.view from this,for a class that doesn't extend AndroidApplication.

protected void onCreate (Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    interstitialAd = new IntestialAds(this);
    inflater = LayoutInflater.from(this);
    config = new AndroidApplicationConfiguration();
    libGdx = new LibGdx();
    Log.e(TAG,libGdx.view + "");
}

However, the onCreate function has nullpointer exception. How can I handle this?

sentences:
XNA & HLSL - rendering a model with its original materials (colors) I am currently trying to code my own HLSL effect file, in order to render an FBX model I made with Autodesk maya, and to which I have applied some materials (colors).

before trying to write an effect file, I have tried using XNA's BasicEffect, which rendered the model as expected with the materials I had set in maya.
Now though, when I'm using my own HLSL effect file, there's always an error saying that my model doesn't have any colors:

  The current vertex declaration does not include all the elements
  required by the current vertex shader. Color0 is missing.

My HLSL effect file (partially leared from riemers.net):

float4x4 xWorldViewProjection;

float4x4 xWorld;
float3 xLightPos;
float xLightPower;
float xAmbient;

struct VertexToPixel
{
    float4 Position     : POSITION;
    float4 Color        : COLOR0;
    float3 Normal        : TEXCOORD0;
    float3 Position3D    : TEXCOORD1;
};

struct PixelToFrame
{
    float4 Color        : COLOR0;
};

float DotProduct(float3 lightPos, float3 pos3D, float3 normal)
{
    float3 lightDir = normalize(pos3D - lightPos);
        return dot(-lightDir, normal);
}

VertexToPixel SimplestVertexShader(VertexToPixel input)
{
    VertexToPixel Output = (VertexToPixel)0;

    Output.Position =mul(input.Position, xWorldViewProjection);
    Output.Normal = normalize(mul(input.Normal, (float3x3)xWorld));
    Output.Position3D = mul(input.Position3D, xWorld);
    Output.Color = input.Color;

    return Output;
}

PixelToFrame OurFirstPixelShader(VertexToPixel PSIn)
{
    PixelToFrame Output = (PixelToFrame)0;

    float diffuseLightingFactor = DotProduct(xLightPos, PSIn.Position3D, PSIn.Normal);
    diffuseLightingFactor = saturate(diffuseLightingFactor);
    diffuseLightingFactor *= xLightPower;

    Output.Color = PSIn.Color* (diffuseLightingFactor + xAmbient);

    return Output;
}

technique Simplest
{
    pass Pass0
    {
        VertexShader = compile vs_3_0 SimplestVertexShader();
        PixelShader = compile ps_3_0 OurFirstPixelShader();
    }
}

And my XNA code:

foreach (ModelMesh mesh in MainRoom.Meshes)
    foreach (ModelMeshPart meshPart in mesh.MeshParts)
        meshPart.Effect = roomEffect.Clone();

...

private void DrawModel(Model model, Matrix world)
{
    Matrix[] bones = new Matrix[model.Bones.Count];
    model.CopyAbsoluteBoneTransformsTo(bones);

    foreach (ModelMesh mesh in model.Meshes)
    {
        foreach (Effect currentEffect in mesh.Effects)
        {
            Matrix worldMatrix = bones[mesh.ParentBone.Index] * world;

            roomEffect.CurrentTechnique = roomEffect.Techniques["Simplest"];
            currentEffect.Parameters["xWorldViewProjection"].SetValue(worldMatrix * camera.view * camera.projection);
            currentEffect.Parameters["xWorld"].SetValue(worldMatrix);
            currentEffect.Parameters["xLightPos"].SetValue(lightPos);
            currentEffect.Parameters["xLightPower"].SetValue(lightPower);
            currentEffect.Parameters["xAmbient"].SetValue(ambientPower);
        }
        mesh.Draw();
    }
}

I'm fairly new to HLSL (but not to XNA though), any help would be nice.

EDIT: I have also tried rendering a different model with materials, but it just gives the same error.

Solution: Thanks to Cole Campbell's answer and, the full working code can be found here

sentences:
Should I make my games graphics lower quality so everyone can play it? The game I'm working on targets lower end graphics capabilities machine users.

Should I make my game's graphics lower quality so that everyone can play it or make its graphics high quality so that people must go and buy a new GPU to play it?

sentences:
How to render realistic ice? I am trying to write an ice shader in Unity that looks good and at least semi-realistic.

If the following shot (found on Google) was CG, what would its shader include? (the foreground cave). I might be wrong but it looks like it even has a different lighting model than the default diffuse.

sentences: Is PID considered Steering Behavior? So I've recently used a PID controller to build a bot for a 2d physics based game. I also did a bit of reading on steering behavior but am still confused over one thing: Is a PID controller considered an implementation of steering behavior? Or are they two completely unrelated things?

sentences:
Rendering colors from a texcoord output I'm trying to implement a faster alternative to super-sampling for my isometric 2d monogame game (for when the view is zoomed out). The idea was that I would render the texture coordinates to the render target like so:
output.Color = float4(input.TexCoord.xy, 0, 1);

...And then I would sample the sprite using the surrounding pixels' texture coordinates to get an anti-aliased color. I first tried my method by only sampling the original pixel to see if I could replicate the original output first, but I can't make it work. This is the result I got:
output.Color = sprite.Sample(spriteSampler, tex.Sample(texSampler, input.TexCoord).xy);

I used point filtering, I tried disabling mipmaps, I tried offsetting the texture coordinates, and it just doesn't work. For some reason the sampled texture coordinates are linearly interpolated, which gives out nonsense texture coordinates at the edges of textures, producing black lines.
However, if I zoom in close enough and align the camera somewhat, I get the correct output:

So what is causing those black lines? What can I do to remove them?
Additional info:
Sprite dimensions:   2048 x 2048
Render target format for texcoords:   Vector2
Vertex declaration for the screen quad (not indexed):
vertices = new VertexPositionTexture[6];
vertices[0].Position = new Vector3(-1, 1, 0);
vertices[1].Position = new Vector3(1, 1, 0);
vertices[2].Position = new Vector3(-1, -1, 0);
vertices[3].Position = new Vector3(1, 1, 0);
vertices[4].Position = new Vector3(1, -1, 0);
vertices[5].Position = new Vector3(-1, -1, 0);

vertices[0].TextureCoordinate = new Vector2(0, 0);
vertices[1].TextureCoordinate = new Vector2(1, 0);
vertices[2].TextureCoordinate = new Vector2(0, 1);
vertices[3].TextureCoordinate = new Vector2(1, 0);
vertices[4].TextureCoordinate = new Vector2(1, 1);
vertices[5].TextureCoordinate = new Vector2(0, 1);

This is the code that converts the the computed coordinates for the blocks to screen space:
float4 PixelToScreen(float4 position)
{
    position.x = position.x * ((scale * 2) / resolution.x) - 1;
    position.y = position.y * ((scale * 2) / resolution.y) + 1;

    return position;
}

sentences:
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:
Make a variable go down as another goes up? I am making a JavaScript game called "Spoop: The Clicker", and I have a variable shown by text:

stroke("blue");
fill("purple");
textSize(30);
text("Spoop Cash: §" + spoopCash, 130, 10);

This is inside the draw loop, as it is always shown.

The thing is, I need textSize to be set shrink as my other variable spoopCash increases. How could I do that? If you can, please include a way to stop it from going too small (such as size 10 being the smallest allowed.)

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:
A comparison of graphics libraries and their respective programming languages A comparison of graphics libraries and their respective programming languages. A.K.A. "Which do I pick? With a twist."

I'm a long time professional programmer who never gave up on programming as a hobby. 3D programming has always appealed to me, but after some trial and error I always came back to (and got stuck on) the same question:

Which to choose?

C# with XNA.
C++ with DirectX.
Java with OpenGL.

All three appeal to me:

XNA, because it's managed, of high quality and very complete.
DirectX, because it's de facto standard for large games.
OpenGL, because it's open. It has a proven track record of high quality games built using it. + Eclipse hotswap functionality is sexy.

Keep in mind here that I will:

Use the above library and language for hobby use.
Will want to develop both 3D games and 3D tooling.
Might seek a job in a 3D programming industry.

For the sake of the argument, assume I am equally well versed in C#, C++ and Java. And have no preference for any of the three mentioned libraries. In reality I have a slight preference for one of those three, but the quality of the code I produce in the languages is the same.

Replies with sources as links are preferred! OGRE and Irrlicht (and similar) are also contenders, but not preferred because it introduces additional depencies on other developers.

sentences:
NavMesh moving is not smooth I have two car in game one of them is cop that chase player, i put a NavMesh on cop with these values:

when the cop get close to player (player speed is 10 ) , movement will go jittery and not smooth.
Note: cop will not collide with player because i have changed stopping distance in script instead of editor.
Note 2: this jittery movement is not only in camera its also on scene view.
now how i must make movement smoother? where is the problem?

sentences:
How should I setup my Minecraft-like world rendering for the best performance? I want to know what technique will give me most fps in game. I have minecraft-like world and I need to display it. Now I have only one cube, created as VBO and if i need to display cube I just display it. But now I want to know what will be faster:

Create for each cube type VBO (even for each side of it) or to create new VBO each frame for whole mesh to display?

I am very new to subject so if there are other faster techniques let me know. Thanks in advance.

sentences:
Frame rate independent gameplay implementation in pure Java I've been looking up on FPS independent movement recently, and I somewhat understand the concept. But I'm having trouble implementing it in pure Java.

Any one have any idea of how I could implement is as well as abstract it in its own class such as "Time" class?

So, I tried implementing the suggestions in my game loop. but even though i am getting steady 60 FPS, my "deltaTime" has values of around 0.6 - 0.9, but for 60 FPS it should be 0.01 !

What is going wrong here?
Should I calculate "deltaTime" at 1 or 2?

Code :

long lastTime = System.nanoTime();
    double delta = 0.0;
    double ns = 1000000000.0 / 60.0;
    long timer = System.currentTimeMillis();
    int updates = 0;
    int frames = 0;
    while (running) {
        long now = System.nanoTime();
        delta += (now - lastTime) / ns;

        // 1

        deltaTime = ((now - lastTime) / 1000000d);

        lastTime = now;

        if (delta >= 1.0) {

            // 2 :
            System.out.println(deltaTime);

            update();
            updates++;
            delta--;
        }
        render();
        frames++;
        if (System.currentTimeMillis() - timer > 1000) {
            timer += 1000;
            //System.out.println(updates + " ups, " + frames + " fps");
            updates = 0;
            frames = 0;
        }
        if (glfwWindowShouldClose(window))
            running = false;
    }

sentences:
Isometric graphics with fake perspective Diablo 2 is a game with isometric graphics. However, unlike other isometric games, D2 has the option to activate perspective. Obviously, the D2 developers found a clever trick to convincingly fake perspective in their isometric engine. It has to be a fake, because D2's graphics assets consist of pre-rendered isometric 2D tiles.

I want to implement a similar effect in my isometric graphics engine, but was unable to find out how to deal with the more subtle issues of applying perspective. A similar question has been asked on this site before. Unfortunately, the answer to that question does not help with the specific problems I am facing.

Let me explain my approach in detail. I use two dimensional tiles for floor and walls that look like this:
(Note that the floor tile is not actually part of the wall tiles. I added it just for clarity.)

These tiles can be assembled in 2D to create an isometric scene:

It is actually pretty easy to fake perspective in such an isometric scene. Slightly enlarging objects at the bottom of the screen and shrinking objects at the top makes them seem close or distant, and creates a subtle illusion of perspective. This is easily achieved in a vertex shader and works very well for floor tiles: .
The floor looks good, but the walls do not. Vertical lines get distorted. I can fix this by applying uniform scaling to objects, instead of distorting them like floor tiles. The scale factor depends on the object's y-position. This works well for character sprites and front facing walls, but fails for diagonal walls and more complex objects.

Now the actual question:

A front facing wall can be scaled by the y-coordinate of points A and B, which is the same. However, this does not work for corners or diagonal walls where the points have different y-coordinates.
It seems, for an accurate perspective effect, each wall tile needs to be treated differently so they can fit seamlessly together. This does not seem feasible to me. Ideally, I want to treat all wall tiles equally.

Is it possible to scale wall tiles so they fulfill the following criteria?

they should become continuously smaller the further up on the screen they are
they should not appear to move or jitter when the viewpoint changes
they should seamlessly fit together

Any help is appreciated. I've been worrying about this for days, but maybe I'm thinking too complicated :)

update:

Isometric view with increasing perspective. Note what happens when wall tiles are simply scaled. This works well for front facing walls only.

I want to approximate perspective correction so that all wall tiles fit seamlessly.

sentences:
Preventing banding textures in DirectX I have a 3D scene that I've tried rendering in Direct3D 10 and using WPF's 3D framework. Obviously, going directly to Direct3D is producing far better performance but I am getting banding which doesn't appear using the same scene in WPF.

Does anyone have any tips on removing this type of artifact? It's obviously possible because WPF doesn't have it... If you have any questions about my Direct3D setup I will be please to add that information.

WPF:

Direct3D:

sentences:
Project updates don't show up on mobile device I've made a small application with libgdx framework, which works perfectly on desktop. It runs on Android too, however once I change something in my main project and try to recompile it on my phone, it seems like the Android still runs the old version.

I've tried to re-install the app, but it does not help. The only way I can see the changes on my phone is to recreate a different Android project.

Any ideas what might be causing this kind of behavior?

My projects are created the way it is shown here: http://code.google.com/p/libgdx/wiki/ProjectSetup

EDIT: Not sure why, but everything seems to work fine after "re-installing" Eclipse

sentences:
How to avoid recursive and or infinity loop monogame return function This piece of code is returning on a infinite base how to fix?

public GuiElement MoveElement(int x, int y)
{
    GUIRect = new Rectangle(GUIRect.X += x,GUIRect.Y += y,GUIRect.Width,GUIRect.Height);
    return MoveElement(x,y);
}

this is where i set the values i have in my Other class

        gm.Add(new GuiElement("BackGround"));

        gm.Add(new GuiElement("Play_Button").MoveElement(150, 50));

        gm.Add(new GuiElement("HighScore_Button"));

        gm.Add(new GuiElement("Quit_Button"));

basicly i want a to be able to move some elements using that MoveElement

it creates a infinite loop

An unhandled exception of type 'System.StackOverflowException' occurred in giftman.exe

sentences:
"Binding" script functions to C++ functions I appreciate the answer to this question might be a little too broad for SE, but hopefully someone can point me in the right direction.

I'm developing a small scripting language for use in my game engine, and naturally in order to do really useful things with it, it needs to hook into actual C++ functions in my game.

For example, say I have an Inventory class, with a public function, checkItem(itemID) that is designed to check whether a certain item is in the current inventory or not.

I'd love to be able to define a scripting function that calls the built-in checkItem function for its value during some script's lifetime. Is there a standard / simple-to-implement procedure for doing this? Something that has a similar effect to LuaBind, for example?

I can of course add instructions to my scripting VM that call the functions internally, but this will make the VM a bit of a mess and require implementing separate operations for each function I wish to call.

sentences:
Resizing a tiledmap when using phaser var cw = window.innerWidth;
        var ch = window.innerHeight;
        var game = new Phaser.Game(cw, ch, Phaser.AUTO, 'game', { preload: preload, create: create, update: update });

        function preload() {
            game.load.tilemap('Background', 'https://gist.githubusercontent.com/anonymous/c61b37df015a0b2af1d7/raw/172bf9c2d4c20c56699eacce263525409caaf743/54996634e4b0a35d00c9b516.json', null, Phaser.Tilemap.TILED_JSON);
            game.load.image('tiles', 'http://i.imgur.com/gmWQIFK.png');
            game.load.image('player', 'http://i.imgur.com/tCCrLyh.png');
        }

        var map;
        var layer;
        var player;
        var _keyboard;
        var playerJumping;
        function create() {
            player = game.add.sprite(0, ch - 32, 'player');
            game.world.setBounds(0, 0, cw, ch);
            game.physics.startSystem(Phaser.Physics.ARCADE);
            game.physics.arcade.gravity.y = 300;
            game.physics.enable(player, Phaser.Physics.ARCADE);
            player.body.collideWorldBounds = true;
            game.stage.backgroundColor = '#787878';
            map = game.add.tilemap('Background');
            map.addTilesetImage('smb_tiles', 'tiles');
            layer = map.createLayer('Tile Layer 1');
            layer.resizeWorld();

            _keyboard = game.input.keyboard.createCursorKeys();
            game.camera.follow(player);
        }
        function update()
        {
            player.body.x += 2;
            if (_keyboard.up.isDown && player.body.onFloor()) {
                playerJumping = true;
                player.body.velocity.y = -2;

            }
            else {
                playerJumping = false;
            }
        }

As you can see the tiled Map start at a height of 320px bcs originally the map have this height  and if I change the game height to 320px everything works fine , but my question is if i want to make the tiledMap responsive to innerHeight and width for the screen how can i do this so the tiled map start at the bottom of the screen and not at the 320px

you can see how the tiled map layer is starting in the middle of the screen . is there by any chance something i can do to make it start at the bottom of the screen

sentences:
Projectile Direction Unity I want to shoot a projectile in the direction the gun is facing.

With my current script it only shoots vertically. (I can also make it go horizontally but that's it).

This is my GunController class:

public Transform guntip;
public GameObject bullet;

float fireRate = 0.5f;
float nextFire = 0f;

void Update ()
{
    //playershooting
    if (Input.GetAxisRaw("Fire1") > 0)
    {
     fireRocket();
    }
}

void fireRocket()
{
    if(Time.time > nextFire)
    {
        nextFire = Time.time + fireRate;

        Instantiate(bullet, guntip.position, Quaternion.Euler(new Vector3(0, 0, 0)));
    }
}

This is my ProjectileController class:

Rigidbody2D MyRB;
public float rocketSpeed;

 void Awake()
{
    MyRB = GetComponent<Rigidbody2D>();

    MyRB.AddForce(new Vector2(0, 1) * rocketSpeed, ForceMode2D.Impulse); // explosive force, change vector 2 for horizontal shooting

}

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:
What is the best practice for future proofing my editor enumerations? I would like to know the best practices for handling the following situation:

Suppose the project you are working on is split in to two sub-projects; the game engine library, and the editor GUI.

You have the method bool Method( const MethodParams &params ) that will be called during game-level initialization; it is a method that belongs to the game engine library. The parameters of this method, passed as a reference to the structure MethodParams, can be decided via the editor in the level design phase. The MethodParams structure is as follows:

enum Enum1
{
    E1_VAL1,
    E1_VAL2,
};

enum Enum2
{
    E2_VAL1,
    E2_VAL2,
    E2_VAL3,
};

struct MethodParams
{
    float   value;
    Enum1   e1;
    Enum2   e2;
    // some other members
}

The editor should present a dialog that will allow the user to set the values in the MethodParams structure. The editor needs to present a text box for value, and let the user set the fields e1 and e2 using a combo box, for example. Every enum option should be mapped to a string, so the user can make an informed selection (normally, the names used in the enum would be more meaningful). One could even want to map every enum to a more informative string (so, for example, E1_VAL1 could map to "Image union algorithm", and E1_VAL2 could map to "Image intersection algorithm").

The editor will include all the relevant game engine library files (.h, etc.), but this mapping is not automatic, and I am confused by how to handle it in a way that where code change will be minimal, if I add further enum options in the future.

sentences:
Can a .exe file ported from a program like NW.js or Electron be put console stores? I'm early in development working on a game in HTML5/JavaScript canvas, and I wondering if porting the game with some HTML/JS to .EXE converter would allowed it to be posted on consoles?

I think it should be possible, since Downwell(though made with an entirely different language) is a .EXE file, and is available on Switch and Playstation.

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:
I need to access a variable from another script in Unity I have been trying to aimlessly make a unity game around a 3d aim trainer and I have been trying to set up the targets that pop up. For now, I just wanted to create targets that pop up once every second at a maximum of 3 targets at one time ever. I have already set up the random spawn of the targets and the removal of them with the help of raycast shooting and made a max of 3 targets, however, to make the max of 3 targets I used an integer with a simple targetCount += 1 and the deletion of the target is being done on a different script as seen below. My problem is making the targets respawn once being shot after spawning the first 3 targets. I tried to use getComponent to reach the targetCount variable in my Target code to just simply targetCount -= 1 every time I delete a target so that as long as the variable doesn't reach 3, it will continue to spawn targets however I was having some troubles.
Please let me know if you have any ideas
This is my target spawning code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GenerateEnemies : MonoBehaviour
{
    public GameObject theTarget;
    public float xPos;
    public float yPos;
    public int targetCount = 0;

    void Start(){
        StartCoroutine(TargetDrop());
    }

    IEnumerator TargetDrop()
    {
        while (targetCount < 3)
        {
            xPos = Random.Range(-6, 11.5f);
            yPos = Random.Range(2.4f, 9);
            Instantiate(theTarget, new Vector3(xPos, yPos, 13.5f), Quaternion.identity);
            yield return new WaitForSeconds(1);
            targetCount += 1;
        }
    }
}

And this is my Code attached to my target
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Target : MonoBehaviour, IDamageable
{
    [SerializeField] private TargetStats targetStats;

    private int currentHealth;
    /*
    public GenerateEnemies generateEnemies;

    private void Awake()
    {
        generateEnemies = GetComponent<GenerateEnemies>();
    }
    */
    private void Start()
    {
        currentHealth = targetStats.maxHealth;
    }

    public void DealDamage(int damage)
    {
        currentHealth -= damage;
        CheckIfDead();
    }

    private void CheckIfDead()
    {
        if(currentHealth <= 0)
        {
            Destroy(gameObject);
            /*GenerateEnemies.targetCount -= 1;*/
        }
    }
}

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:
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:
How to set player rotation to direction the player is moving? I'm having an issue with my click to move mechanic. I want the player to move to a specific position in the game when the mouse is clicked (and it does just that) but the issue I'm having is that the player doesn't face the direction in which it is travelling.

Lets say I click a position diagonally right to where the player is. Immediately after clicking that point, the character will face that direction and run to it, instead of facing the direction it has to take to get there... if that makes sense.

Here's my code snippet:

public void moveToTargetPosition() {
    Seeker seeker = GetComponent<Seeker>();
    seeker.StartPath (transform.position, targetPlayerPosition, OnPathComplete);

    transform.rotation = Quaternion.Lerp (transform.rotation,  Quaternion.LookRotation(targetPlayerPosition - transform.position), Time.fixedDeltaTime * lookSpeed);
}

Obviously I'm missing some modifier in here.

Any ideas?

Thanks!

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:
Elliptical orbit modeling I'm playing with orbits in a simple 2-d game where a ship flies around in space and is attracted to massive things. The ship's velocity is stored in a vector and acceleration is applied to it every frame as appropriate given Newton's law of universal gravitation. The point masses don't move (there's only 1 right now) so I would expect an elliptical orbit.

Instead, I see this:

I've tried with nearly circular orbits, and I've tried making the masses vastly different (a factor of a million) but I always get this rotated orbit.

Here's some (D) code, for context:

void accelerate(Vector delta)
{
    velocity = velocity + delta; // Velocity is a member of the ship class.
}

// This function is called every frame with the fixed mass. It's a
// method of the ship's.
void fall(Well well)
{
    // f=(m1 * m2)/(r**2)
    // a=f/m
    // Ship mass is 1, so a = f.
    float mass = 1;
    Vector delta = well.position - loc;
    float rSquared = delta.magSquared;
    float force = well.mass/rSquared;
    accelerate(delta * force * mass);
}

sentences:
XNA C# Texture Atlases Fairly new to XNA and not an expert on C# either. So I was following a tutorial, specifically this one http://rbwhitaker.wikidot.com/texture-atlases-1, and there is a bit of code I am unfamiliar with.

public void Draw(SpriteBatch spriteBatch, Vector2 location)
{
    int width = Texture.Width / Columns;
    int height = Texture.Height / Rows;
    int row = (int)((float)currentFrame / (float)Columns);
    int column = currentFrame % Columns;

Mostly all of this I am familiar with. However, the line that says

int row = (int)((float) currentFrame / (float) Columns);

This line is not familiar to me and I would appreciate if someone could explain what this does. Clearly it is designed to find out what row the program is on in the texture atlas but what how does it do that with that code? What is it calculating?

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:
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:
Extrapolation breaks collision detection Before applying extrapolation to my sprite's movement, my collision worked perfectly.  However, after applying extrapolation to my sprite's movement (to smooth things out), the collision no longer works.

This is how things worked before extrapolation:

However, after I implement my extrapolation, the collision routine breaks.  I am assuming this is because it is acting upon the new coordinate that has been produced by the extrapolation routine (which is situated in my render call ).

After I apply my extrapolation

How to correct this behaviour?

I've tried puting an extra collision check just after extrapolation - this does seem to clear up a lot of the problems but I've ruled this out because putting logic into my rendering is out of the question.

I've also tried making a copy of the spritesX position, extrapolating that and drawing using that rather than the original, thus leaving the original intact for the logic to pick up on - this seems a better option, but it still produces some weird effects when colliding with walls.  I'm pretty sure this also isn't the correct way to deal with this.

I've found a couple of similar questions on here but the answers haven't helped me.

This is my extrapolation code:

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

     }

        extrapolation = (float)(System.currentTimeMillis() + skipTicks - nextGameTick) / (float)skipTicks;

        render(extrapolation);
}

Applying extrapolation

            render(float extrapolation){

            //This example shows extrapolation for X axis only.  Y position (spriteScreenY is assumed to be valid)
            extrapolatedPosX = spriteGridX+(SpriteXVelocity*dt)*extrapolation;
            spriteScreenPosX = extrapolationPosX * screenWidth;

            drawSprite(spriteScreenX, spriteScreenY);

        }

Edit

As I mentioned above, I have tried making a copy of the sprite's coordinates specifically to draw with.... this has it's own problems.

Firstly, regardless of the copying, when the sprite is moving, it's super-smooth, when it stops, it's wobbling slightly left/right - as it's still extrapolating it's position based on the time.  Is this normal behavior and can we 'turn it off' when the sprite stops?

I've tried having flags for left / right and only extrapolating if either of these is enabled.  I've also tried copying the last and current positions to see if there is any difference.  However, as far as collision goes, these don't help.

If the user is pressing say, the right button and the sprite is moving right, when it hits a wall, if the user continues to hold the right button down, the sprite will keep animating to the right, while being stopped by the wall (therefore not actually moving), however because the right flag is still set and also because the collision routine is constantly moving the sprite out of the wall, it still appear to the code (not the player) that the sprite is still moving, and therefore extrapolation continues.  So what the player would see, is the sprite 'static' (yes, it's animating, but it's not actually moving across the screen), and every now and then it shakes violently as the extrapolation attempts to do it's thing....... Hope this help

sentences:
Unity: How to make an array of video clips and play them? I have 26 video files which I have to put in an array and play for different objects. So far I have written this from what I know:

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

public class videomanager : MonoBehaviour {

    public VideoClip[] vids;

    private VideoPlayer vp;

    // Use this for initialization
    void Start () {

        vids = new VideoClip[25];
        vp = gameObject.GetComponent<VideoPlayer> ();
    }

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

    }
}

I have attached this script on a plane on which I am playing the video.

Before that, I had 26 different planes, one for each different video, but I think it would be better if I could play them on a single plane and change the video according to logic.

I am not sure how I should load them into my player and play them.

sentences:
How do I resolve the inability to get an input stream from URL? I am unsure if anyone has ever had problems with this, but I am having difficulty trying to get the URL to work properly however, this is what the logs says

javax.imageio.IIOException: Can't get input stream from URL!
at javax.imageio.ImageIO.read(Unknown Source)

I am unsure now what to do and I hope some of you would be able to assist me.

https://drive.google.com/open?id=0B8TpyQpSFyEPaGtxQzAxYzdRMFE

sentences:
3d level creation for small teams What sort of tools and techniques are available out there for 3D level creation?

In particular for small teams where you might not have the time and resources to make your level creation tools from scratch. I know you could use Blender or any other 3D modeling app for the geometry, but how do you manage the necessary metadata, triggers, game objects, etc?

sentences:
Distributed C++ game server which use database My C++ turn-based game server (which uses database) does not stand against current average amount of clients (players), so I want to expand it to multiple (more then one) amount of computers and databases where all clients still will remain within single game world (servers will must communicate with each other and use multiple databases).

Is there some tutorials/books/common standards which explain how to do it in a best way?

sentences:
Unity: Interrupting Animations When I interrupt an Animator Controller during an Animation and reopen it the Armature gets stuck (more or less) at the point where the previous Animation was interrupted. How can I safely and instantly quit an animation without destroying it?

Please watch the Video to fully comprehend the problem: https://youtu.be/O9X5SBATHRw

Screenshot of Problem:

Screenshot of Animator Controller:

Part of the Weapon Switch Script:

disableWeaponModel(weaponNameList[activeWeapon]); //Disable active Weapon Model

if (holsteredWeapon == -1) //If player carries only 1 weapon
    holsteredWeapon = activeWeapon; //Active Weapon is holstered
else //Player already carries 2 weapons
    actionDropGun(); //Active Weapon is thrown (New LOD generated)

activeWeapon = getWeaponIDfromLOD(targetName); //Active Weapon is set to Target LOD

setWeaponVars(activeWeapon); //Set all variables to the active Weapon
setWeaponModel(weaponNameList[activeWeapon]); //Set Weapon Model to the active Weapon
setAnimator(weaponNameList[activeWeapon]); //Set Animations to the active Weapon

setAnimator(string name) Function from above (last code line):

void setAnimator(string name)
{
    //Add new guns here
    if (name == "MP5A3")
        currentWeaponAnimation = MP5A3_Animation;
    else if (name == "Rpk-74")
        currentWeaponAnimation = Rpk74_Animation;
    else if (name == "Skorpion")
        currentWeaponAnimation = Skorpion_Animation;
}

Variables from setAnimator(string name):

sentences:
How to make expanding ring with constant thickness? I need to generate this burst or (donut-shaped) pulse.
I'm having a difficult time how to generate such shape.
At first, I was thinking of scaling the image but that didnt work out because the line or "diameter" of the donut shape gets bigger accordingly..

https://www.youtube.com/watch?v=ewnEE5mt1ZM

sentences:
How to copy morphs from one SkeletalMesh to another in UE4? I would like to enable modders to copy morphs from one SkeletalMesh to another.
I wrote simple Python script to do that. The inspiration came from here.
#Takes the last element of all selected stuff in the Content Browser
#Copies all morph targets from selection - excluding the last element - to the last element

#array = [ from1,from2,from3, ... , lastElementThatTakesAll]

import unreal as ue
from unreal import SkeletalMesh, MorphTarget

# create unreal class instances
editor_util = ue.EditorUtilityLibrary()
#material_util=unreal.Material()

# get the selected assets
selected_assets = editor_util.get_selected_assets()

lastmesh=selected_assets[len(selected_assets)-1]

morphtargets=lastmesh.morph_targets
print("lastmesh morphs: ")
print(lastmesh.morph_targets)

for morphlist in selected_assets:
    if(morphlist==lastmesh):break
    print("List: ")
    print( morphlist)
    for morph in morphlist.morph_targets:
        print("Morph: " )
        print(morph)
        morphtargets.append( morph)

lastmesh.morph_targets=morphtargets

It does work, I can see the sliders on the Receiver mesh in Persona...
The issue is it only works with duplicated meshes... Not very useful...
If I import the same mesh with different settings the morph target sliders don't do anything, even though the mesh topology is identical.
I wrote BP node to do the same thing, but the results are the same... sliders are present, but aren't doing anything.
bool UVictoryBPFunctionLibrary::AddMorphTargetToSkelMeshFromSkelMesh(USkeletalMesh* Receiver, USkeletalMesh* Sender) {
    auto senderMorphs = Sender->MorphTargets;

    for(auto morph : senderMorphs)
    {
        Receiver->MorphTargets.Add(morph);
    }

    return true;
}

I tried the RegisterMorphTarget function as well, but this one just crashed the editor.
Tried calling both in the construction script/beginplay as well.
bool UVictoryBPFunctionLibrary::AddMorphTargetToSkelMeshFromSkelMesh(USkeletalMesh* Receiver, USkeletalMesh* Sender) {
    auto senderMorphs = Sender->MorphTargets;

    for (auto morph : senderMorphs)
    {
        bool valid=Receiver->RegisterMorphTarget(morph,false);

        //GEngine->AddOnScreenDebugMessage(-1,15.0f,FColor::Red,"morph name:  "+morph->GetName());
    }
    return true;
}

EDIT:
This line causes the crash in the editor:
Receiver->InitMorphTargets();

sentences:
How do I find the 2D direction to a 3D location? I'm writing a 3D space flightsim, and I'm trying to display a 2D arrow on screen that points to the player's selected target. To clarify, the arrow needs to point in the direction that the player has to turn to reach the target.

I've tried several approaches but I can't seem to make this work for all cases. My current attempt involves constructing a plane from the player's local X/Y, projecting the target position onto it (to make the calculation 2D) then calculating the angle between the player's up and the vector to the projected target position.

I can't help but think I'm over-thinking this and there must be a better, simpler way. Anyone have any suggestions?

UPDATE:

Based on Sam's answer, I've tried the following code:

//Find the direction to the target, and normalize it
kglt::Vec3 target_dir = (target_pos - ship_pos);
target_dir.normalize();

kglt::Vec3 v1, v2;
v1 = ship_up.cross(ship_dir);
v2 = ship_up.cross(target_dir);
v1.normalize();
v2.normalize();

//Get the angle of rotation for the arrow
float angle = kmRadiansToDegrees(atan2(ship_up.dot(v1.cross(v2)), v1.dot(v2)));

But the returned angle is always around 180.0 (although normally -179.xx). Is there any obvious error somewhere? I'll continue debugging and update if I figure it out!

UPDATE2

Nevermind, the bug isn't in this section of code. My bad!

sentences:
How do I add a Rigid body and a box collider component to a Texture2D? I am making a snake game. I'm basing it on a basic tutorial game, which does no collision detection, wall checking or different levels.

All snake head, piece, food, even the background is made of Texture2D. I want the head of the snake to detects 2D collisions with them, but Rect.contains isn't working. I'd prefer to detect collisions by onTriggerEnter() for which I need to add BoxCollider to my snakeHead.

sentences:
How to calculate the closing speed of two objects I have the 2D positions and 2D velocity vectors of two objects. How do I calculate the closing velocity ? I want to get the closing speed.

Think of one jet tracks another jet with radar and you want to yield the closing speed, which is actually the distance-change / unit. (In this example Δmiles/h)

sentences:
Problem with transparent textures in SFML I have been told that this is kind of a common problem with transparent textures, but didn't get any further information on how to solve it.

In my code, I'm trying to render this texture (a square with rounded corners, where rounded corners have some alpha)

What I get instead is this

Notice those greyish places on the corners of the textures - where rounded corners are supposed to be.

What could be causing this? I have a pure-white texture, so I don't expect a single pixel to get any darker than the background. All pixels should have at least the color of background, but as you can see, there is something darker.

Zoomed even more:

Any help would be highly appreciated.

sentences:
Finding correct index of triangles I'm generating a basic terrain and it looks something like this:

// Load the vertex and index array with the terrain data.
    for (j = 0; j<(m_terrainHeight - 1); j++)
    {
        for (i = 0; i<(m_terrainWidth - 1); i++)
        {
            index1 = (m_terrainHeight * j) + i;          // Top left.
            index2 = (m_terrainHeight * (j + 1)) + i;      // Bottom left.
            index3 = (m_terrainHeight * j) + (i + 1);      // Top right.
            index4 = (m_terrainHeight * (j + 1)) + (i + 1);  // Bottom right.

            // Top left
            vertices[index].position = glm::vec3(m_heightMap[index1].x, m_heightMap[index1].y, m_heightMap[index1].z);
            vertices[index].texture = glm::vec2(m_heightMap[index1].tu = 0.0f, m_heightMap[index1].tv = 0.0f);
            indices[index] = index;
            index++;

            // Bottom left.
            vertices[index].position = glm::vec3(m_heightMap[index2].x, m_heightMap[index2].y, m_heightMap[index2].z);
            vertices[index].texture = glm::vec2(m_heightMap[index2].tu = 0.0f, m_heightMap[index2].tv = 1.0f);
            indices[index] = index;
            index++;

            // Top right.
            vertices[index].position = glm::vec3(m_heightMap[index3].x, m_heightMap[index3].y, m_heightMap[index3].z);
            vertices[index].texture = glm::vec2(m_heightMap[index3].tu = 1.0f, m_heightMap[index3].tv = 0.0f);
            indices[index] = index;
            index++;

            // Top right.
            vertices[index].position = glm::vec3(m_heightMap[index3].x, m_heightMap[index3].y, m_heightMap[index3].z);
            vertices[index].texture = glm::vec2(m_heightMap[index3].tu = 1.0f, m_heightMap[index3].tv = 0.0f);
            indices[index] = index;
            index++;

            // Bottom left.
            vertices[index].position = glm::vec3(m_heightMap[index2].x, m_heightMap[index2].y, m_heightMap[index2].z);
            vertices[index].texture = glm::vec2(m_heightMap[index2].tu = 0.0f, m_heightMap[index2].tv = 1.0f);
            indices[index] = index;
            index++;

            // Bottom right
            vertices[index].position = glm::vec3(m_heightMap[index4].x, m_heightMap[index4].y, m_heightMap[index4].z);
            vertices[index].texture = glm::vec2(m_heightMap[index4].tu = 1.0f, m_heightMap[index4].tv = 1.0f);
            indices[index] = index;
            index++;
        }
    }

Now If I wanted to find which grid square the player is on, we could simply (if the camera position is relative to the terrain)

    //Grid square the camera is on
    int gridX = (int)std::floor(cameraX / gridSquareSize);
    int gridZ = (int)std::floor(cameraZ / gridSquareSize);

Continuing, we know that each face consists of two triangles, and the top triangle is represented by three vertices which index corresponds to top left, bottom left and top right. The bottom triangle would then be top right, bottom left and bottom right. Now I'm having a hard time trying to find height values (y-values) at these points because if I try to do

//Top left triangle
glm::vec3(0, vertices[(m_terrainHeight * gridZ) + gridX].position.y, 0) //Top left
glm::vec3(0, vertices[(m_terrainHeight * (gridZ) + 1) + gridX].position.y, 1) //Bottom left
glm::vec3(1, vertices[((m_terrainHeight * gridZ)) + (gridX + 1)].position.y, 0) //Top right

we conclude that the top left and bottom left position will be okay, but the top right position won't get the correct index, because as it is now (if we say that gridX = 0 and gridZ = 0), the index will generate a value of 1, which is not the correct height value at that position because the index we want should be 2 (top right). So, is there a way I could write the code so I would get the correct index for the triangles of the terrain?

sentences:
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:
Design suggestions for my Entity module I need some advice on how to design the Entity module in my game, how to apply the MVC pattern and generally how the Entity should interact with its controller and its representation.

First some details about the game: it's a 2D action-platformer, it's data-driven (or rather, I'd like it to be data-driven — it isn't yet) and the Entities should be scriptable (I'll be using Python).

I'm still at the very beginning of the development and I have some general ideas about how the Entity module should work, but I get stuck on the details. Here's roughly what I have up until now:

class Entity
{
  private:
    // The representation holds the actual animation and sounds that
    // are used to render the entity. The representation can read the
    // Entity's state but it cannot alter it.
    EntityRepresentation* representation_;

    // The controller handles events and changes the Entity's state
    // based on these events.
    EntityController* controller_;

    // Here's some of Entity's attributes
    struct Vector{ float x, y; } position_;
    float directionRadians_;
    float speed_;

  public:
    void handleEvent(const Event& e) {
        controller_->handleEvent(e, this); // It's obvious what it does :)

        // The representation needs to handle events so it can change the
        // current animation, queue up a sound for playing, etc. In my
        // current setup it doesn't yet need to take 'this' as a parameter.
        representation_->handleEvent(e);
    }

    void update(unsigned long timePassed) {
        position_.x += speed_ * timePassed * std::cos(directionRadians_);
        position_.y += speed_ * timePassed * std::sin(directionRadians_);
        // .. And any other updates I might need to do...
    }

    void render(DrawingContext* context, unsigned long timePassed) {
        representation_->render(context, timePassed, position_.x, position_.y);
    }
};

There are a few things I think could be problematic in this setup. For one, if you look at the Entity::handleEvent() function you will see that the Entity forwards the event to the controller as well as to the representation. The controller uses the event to alter the state of the Entity; the representation however uses it to alter its own state (to use some other animation, to decide whether it should play a sound, etc.).

This means the representation has a state of its own which is characteristic to this Entity only. Do you think it's bad that each representation can only be used for one Entity? (Note: this does not mean that in case there are two entities using the same sprite, that sprite is loaded twice in memory: the sprite itself is a common resource.)

Another thing I'm having problems with the deciding how to organize the actual entity data on disk. Where should the bounding box info be read from: the animation or somewhere separate? should there be a single animation file for each character? should scripts be separate from the data or should everything related to one type of entity be stored in a single folder (scripts and animation and sounds)?

tl;dr Can you give some some general advice on how the Entity should interact with its controller and its representation (i.e. sprites and sounds). Also, do you have any advice on how the data itself should be organized on the hard-drive?

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:
How to increase fighting stats of a player without increasing HP? I'm currently making a simple game that requires a fighting system. The game consists of many (more than 100) levels that the player needs to go through to get to the end. In each level you get to fight creatures and monsters, and you evolve your skills by doing so (there are also other ways to do that but they're not relevant for the purpose of this post). The problem I'm having is that when the player reaches the higher levels, the fights become very hard to balance:

To calculate the damage the player does to the enemy, I was basing it on the player's fighting skill (which goes up with each fight) and the opponent's fighting skill (which is based on the level). However, if I make it so the damage is proportional to the ratio of the skills, when both skills are high, neither of them will do much damage. On the other hand, if I base it on the difference of these skills, a player with less stats than a monster can't to any damage to it (which is not what I want, as some monsters may have more fighting skills but you have more health, and vice-versa).

My question is if there's any easy way to calculate the damage that would scale well when both parties are very strong.

sentences:
Texture dimensions guidelines I have 3 related questions:

What are the main optimizations related to power of 2 dimensions for 1D/2D/3D textures? This question gives some answers like mipmapping, but are not well explained and the list of optimizations does not seem to be complete. I want a complete ordered list from most important to less of the optimizations with complete explanations, with references replacing full explanations only where full explanation would overwhelming, and proper references (paper/graphics official page [OpenGL/Vulkan/CUDA]) for every statement about explained optimization. When the comparation is not direct, take a guess based on the one that would improve overall performance most in majority of computer graphics applications. Furthermore I want to specify which of this optimizations are available at least for OpenGL and CUDA. More specifications would be acclaimed.
What benefits exists for divisible by 8 dimensions? This article states the rule as an alternative/complement to the power of 2 one but does not give explanations nor references.
Is there any benefit for divisibility by a larger number? This article uses divisible by 32 dimensions. I know that CUDA has a warp size of 32 and that blocks should be multiple of 32 to have a good overall average utilization, but I do not know if this could be related to texture sizes and would like to know if the answer is no.

In many places posibilities for texture optimization are loosely stated and not properly documentated. This question aims at solving this issue.

sentences: animate a drawn 2D image to move I am trying to make a game where the person can create their own character, but instead of using a character builder, i want the person to be able to draw their character. how do i code that in c# so that they only have to draw their character once, and the code can animate that character without the player having to do very much except draw their character on the screen?

sentences:
What is the best toolchain for ActionScript3 social networks game development? I'm new to flash and web development too. But I have some background in c#/c++/Qt/python. So, I want to know, what is the best toolchain for quickest dive into.

My task is to write a game for facebook.com/vkontakte.ru. I already have the design doc, great artist and game-designer, so, the coding is the only stumbling block we met. There are no significant obstacles at server-side, but, since we have not much time, I decided to ask some help on suitable toolchain definition.

I think, that web-services (maybe WCF) are perfect for the backend, so, some of them should transfer JSON-ed data from/to client, incapsulate game-logic, and... here is the place I stuck. What next, what should I learn, what tools/toolsets will provide learing/productivity curve that meat least action principle.

Maybe I'm on the wrong way and missing some basic and obvious (for web-devs) things... I do not know, so, any advices will be highly appreciated.

Yes, this is the copy of my question on SO, but it seems, that here is the really proper place to post it.

sentences:
How to change the version code in application created by the GameMaker? Code that I can not change:

Image of the error:

Inside the red square is written: Upload failed You already have an APK or Android App Bundle with version code 1000000. Use another code.

It turns out that I do not know how to change. At least not by GameMaker. I've been in the settings, preferences, but I do not think so at all. This tutorial below Google itself is useless. I already contacted, I sent an email to the support for more than 1 week and no response.

https://support.google.com/googleplay/android-developer/answer/7159011?hl=pt-BR

sentences:
How to avoid an applied force from effecting one particular Rigidbody2D I am creating a 2D side-scroller car race game with zombies. In this game, I set up a feature through which the player can shoot the zombies from the car, as well.

The problem is that when I apply force to shoot the bullet towards the right, the car also gets effected by that force, i.e it just moves a lot in reaction to the bullet shot. I don't want this behavior. I want the car to remain calm and just shoot.

Is there any way to exclude one particular rigidbody, i.e the rigidbody attached to the car, from applying the force the bullet rigidbody is using?

sentences:
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:
What is causing these texture edge artifacts on some video cards? I have a 2d heightfield converted into a very simple mesh and textured with tiles from a texture atlas.  The tiles texture is drawn with:

glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP);

On my integrated Intel card, it draws as I intend (top picture).  On a friend's ATI card, it has very visible edges (bottom picture).

What causes this, and how can I avoid it?

Extra info:

glColor4f(1,1,1,1) has been called before drawing the mesh
the texture atlas is a simple vertical strip, so the right-side of each tile has x=1.0f
the vertices are being shared so there isn't really a 'hole' between my rows
the resolution on both systems is the same
the vertices and texture coordinates are all passed as GL_FLOAT
the tiles atlas is mipmapped

sentences:
Defining collision response in an Entity system I'm building a really simple top-down 2d shooter which uses an Entity Component pattern.

I've added several different entities to a level and given them different collision groups. I have an entity to represent a teleporter (assigned to collision group A), a player entity (group B), and a bunch of enemies (Group C).

I understand that the actual collision response should be decided in the collision System based on the groups that the colliding entities belong to. What I can't figure out is how to define the specifics of a collision.

For example, if a player collides with a teleporter I need to move the player across the level. Where do I store the target location? I'd assume in a component on the teleporter. Should I create a whole new component just for that data? I feel it should be stored in the teleporters collision component but no all entities that use the collision component will require this data.

Could someone please try to enlighten me?

Thanks

sentences:
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:
UPS and FPS - What should I limit and why? I'm currently writing a game using C++ and SDL2 and there's one thing that I'm wondering about - does it make sense to limit my frames per second (FPS) and/or my updates per second (UPS)?

I get the idea that if you limit the UPS, you essentially control the speed of the game - if the player moves 1px per update and you always update it 30 times per second, he'll move at a speed of 30px/s and you'll probably also relieve the CPU since the amount of calculations per second decreases. If you limit the FPS, the amount of drawcalls per second decreases, therefore you relieve your GPU. I hope I understood all of that correctly, if not, feel free to correct me.

My question is - what am I supposed to limit in my game? FPS? UPS? Both? Neither? Is there another, better approach to this? How is this done in most games and why?

Answers are greatly appreciated!

sentences:
How to use a mask texture with Kobold2D I am an iOS developer but I'm new to cocos2d. I'm working on new game, I use Kobold2D, have cocos2d installed too, and I want to make this effect:

I know how is done with Flash, but can't make it with Kobold2D. There's 2 images with the same size: one is a low-res image for the background and the second is a hi-res over the first one. When the "reticle" mask moves, it reveals the second image inside the circle and the background is visible outside only. I googled with no success, saw some Ray Wenderlich projects they weren't helpful.

sentences:
How to make gameObjects in Unity move in predefined patterns easily I am trying to make a bullet hell game. I want my 2D enemies to move in predefined, curving patterns. How should I do this?

The difficulty I have is being able to quickly produce enemy movements that are

(A) predefined, not random

(B) curved

(C) easy to make, with little coding

(D) visually able to see what is going on, maybe in the inspector?

Perhaps a 3rd party tool may be warranted?

sentences:
Moving object along X and Z plane relative to camera Using keys, I'm trying to move a cursor object across the X and Z plane, keeping it relative to a camera that I can orbit around the playfield.

This is my code so far, and apologies...I'm about 2 days into learning Unity. This code is on my cursor object.

        if (Input.GetAxis("Horizontal") > 0f) {
            transform.position = transform.position + Camera.main.transform.right * moveSpd * Time.deltaTime;
            }

        if (Input.GetAxis("Horizontal") < 0f) {
            transform.position = transform.position - Camera.main.transform.right * moveSpd * Time.deltaTime;
            }

        if (Input.GetAxis("Vertical") < 0f) {
            Vector3 dir = Camera.main.transform.forward;
            dir.y = 0.01f;
            dir.Normalize();
            transform.position = transform.position - dir * (moveSpd*1.5f) * Time.deltaTime;
            }

        if (Input.GetAxis("Vertical") > 0f) {
            Vector3 dir = -Camera.main.transform.forward;
            dir.y = 0.01f;
            dir.Normalize();
            transform.position = transform.position - dir * (moveSpd * 1.5f) * Time.deltaTime;
        }

        transform.position = new Vector3(transform.position.x, 0.01f, transform.position.z);```

It works, but the vertical axis affects the Y plane so I had to do another transform at the end.

What is the best way of doing this?

I'd also like the cursor to snap to grid co-ords. I've tried turning them to int but it doesn't do what I want.

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:
How can I obtain the file size of a Unity build at runtime? I'm wondering if it is possible to obtain the filesize of a game's build at runtime.
Searching this topic only yields results for reducing the build size, which is not at all what I'm looking for.

sentences:
Is there a place in games for people with financial engineering or operations research backgrounds? I just started my first year in college in an engineering school. I haven't had any classes about programming, and although I'm in an engineering school I'm not that good at (and don't enjoy) physics or chemistry. For me, the way to go is math related majors, which are Financial Engineering or Operations Research.

Although I believe I will be somewhat good in those areas I definitely don't want to get sucked into the "financial blackhole" with extreme work hours and stress levels. I want to have creativity in my life.

So I am wondering what kind of jobs can I find in the gaming industry with a background of Financial Engineering or Operations Research? Can I join the creative groups of game development companies?

sentences:
How to make high quality gifs of Unity game play I've seen several Unity game play gifs, mostly on twitter. Are there any tools for making high quality gifs in Unity that are quite flexible? For example, I video recording tool that captures the game window and allows users to make gifs of portions, possible specifying the desired quality. Generally, I am looking for a tool that is quite flexible (has a lot of options for capturing gifs) and possibly game window video.

UPDATE

Some examples are here and here. Generally, several of the gifs that are hash-tagged madewithunity a really high quality.

sentences:
Unreal Engine - Scaleform - How do I capture a button click event? I'm new to Unreal Development.

In a nutshell, how do I create a button, install it in a basic game, and capture the button click event?

sentences:
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:
Game ideas for a platformer I have created a platformer which currently has the features listed below. I would greatly appreciate any further ideas which I could implement! (I don't play a lot of games which is why I require help)

Walking/jumping/movement
player can shoot lasers
enemies also walk, fly, and shoot lasers
water (you can swim in this)
mud (slows you down on contact, and stops you from jumping)
ladders
damage when falling from a large height, unless falling into water
moving platforms
springboards (jumping on them shoot you into the air)
growing platforms (allow you to reach new places)
key and door system
gem and coin collection system
teleporting
turrets

sentences:
Sprite/Tile Sheets Vs Single Textures I'm making a race circuit which is constructed using various textures.

To provide some background, I'm writing it in C++ and creating quads with OpenGL to which I assign a loaded .raw texture too. Currently I use 23 500px x 500px textures of which are all loaded and freed individually.

I have now combined them all into a single sprite/tile sheet making it 3000 x 2000 pixels seems the number of textures/tiles I'm using is increasing.

Now I'm wondering if it's more efficient to load them individually or write extra code to extract a certain tile from the sheet?

Is it better to load the sheet, then extract 23 tiles and store them from one sheet, or load the sheet each time and crop it to the correct tile?

There seems to be a number of way to implement it...

Thanks in advance.

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: Do developers watch player match recordings for their online games? When developers plan and decide on new buffs and nerfs, do they gather information from online game matches, recorded secretly from their servers' data feeds and reconstructed / analyzed offline - for such data as player movement trajectories and popular paths, weapon preferences and gamestyle behaviour?

sentences:
Moving towards and switching targets in Unity with collision I have these nodes set up for a ship to move towards over time with out looking stops then repeats in a sequence.

like so:

1 2 3 1 2 3 1 2...

THE PROBLEMS i keep having either come from the inability to switch direction or the ship ignores all collision which i would like to be able to shoot it with actual objects.

Ignores all Collision:

Vector3 currentPosition = thisShip.transform.position;
    Vector3 directionOfTravel = targetPosition - currentPosition;
    directionOfTravel.Normalize();
    thisShip.MovePosition(currentPosition + directionOfTravel * speed * Time.smoothDeltaTime);

This one works perfectly but because MovePosition is a kin to translate and actually teleports objects it ignores all collision which i need.

Can't Switch Direction:

Vector3 currentPosition = thisShip.transform.position;
        Vector3 directionOfTravel = targetPosition - currentPosition;
        directionOfTravel.Normalize();
        thisShip.AddRelativeForce(currentPosition + directionOfTravel * speed * Time.smoothDeltaTime, ForceMode.Force);

so in this one i try to stop the rigid body by returning its velocity to zero and it does stop for a second but continues in its original direction anyways.

thisShip.velocity = Vector3.zero; // Use this to pause object

I believe i need another method of movement (maybe use a CC) or maybe i can make AddRelativeForce work and be able to switch targets like MovePosition does. I'd really like to get this one thing done so i can move on to other parts of the project.

sentences:
Branching quest system I've started working in a quest system for my game, but I stumble in a zone where I have to many, if/else conditions to handle a quest, whether you have X and Y item in your inventory, whether you have already talk with a NPC, or whether some other quest stage is a given value and so on.

This end ups making the code very unclean, hard to fix and extend.

I'm wondering what's a good way to handle this.

I've read that keeping your quest as XML file is a good practice, but I've never worked with XML before(I know what they are, but I'm unfamiliar with how to properly make one)

I made a template quest to handle fetch/talk quests in a CSV file. Which looks something like this:

But I'm not that I'll end-up shooting my own foot with this custom system.

The branches of a quest can depend on items, previous quests, npc status, player status... So, what's a good way to deal with this?

EDIT:

This is not a duplicate of this question since the answers for this question are either using XML (which I said I don't have the know-how) or use multiple if/else conditions, which is my start problem.

sentences:
Adjusting collision hitbox size with Pygame So I coded a 2d sidescrolling platform, everything is fine except this:

As you can see, the sprite is standing at the platform when her feet is not in the platform anymore. I want to adjust the collision hitbox size so that when her feet is not on the platform, she falls to the ground.

Below is the code for sprite initiation:

    class Player(pygame.sprite.Sprite):

    #Initiating the player (23 / 5)
    #because there is only one character right now, it will have no case for character selection (23 / 5)
    def __init__(self):
         super().__init__()

         #width and height of character (23 / 5)
         width = 80
         height = 120

         #character sprite goes here (23 / 5)
         self.image = pygame.image.load("Malahayati.jpg").convert_alpha()
         self.image = pygame.transform.scale(self.image,(width,height))

         #hitbox (23 / 5)
         self.rect = self.image.get_rect()

         #character speed (23 / 5)
         self.vx = 0
         self.vy = 0

         #references to the list of sprite we bumped against (24 / 5)
         self.level = None

         #current state: 0 is idle, 1 is moving right, 2 is moving left, 3 is dashing
         self.status = 0

         #character status (24 / 5)
         self.rank = 1
         self.health = 220
         self.attack = 50
         self.defense = 20
         self.speed = 52.5
         self.exp = 0
         self.jumpspeed = 125

sentences:
Why doesn't my simple HLSL shader work? I'm using Monogame to draw 2D primitives to the screen. To do that, rather than use included structures like VertexPositionColor, I wrote my own vertex class for 2D.

public struct VertexColor : IPositionable, IVertexType
{
    private static readonly VertexDeclaration Declaration = new VertexDeclaration
    (
        new VertexElement(0, VertexElementFormat.Vector2, VertexElementUsage.Position, 0),
        new VertexElement(8, VertexElementFormat.Color, VertexElementUsage.Color, 0)
    );

    public VertexColor(Vector2 position, Color color)
    {
        Position = position;
        Color = color;
    }

    public Vector2 Position { get; set; }
    public Color Color { get; set; }
    public VertexDeclaration VertexDeclaration => Declaration;
}

Here's my associated HLSL shader, meant to simply translate vertices from normalized space to screen space.

#define VShaderModel vs_4_0_level_9_1
#define PShaderModel ps_4_0_level_9_1

matrix Projection;

struct VertexShaderInput
{
    float4 Position : SV_Position0;
    float4 Color : Color0;
};

struct VertexShaderOutput
{
    float4 Position : SV_Position0;
    float4 Color : Color0;
};

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
    VertexShaderOutput output = (VertexShaderOutput)0;

    output.Position = mul(input.Position, Projection);
    output.Color = input.Color;

    return output;
}

float4 PixelShaderFunction(VertexShaderOutput input) : Color
{
    return input.Color;
}

technique Technique0
{
    pass Pass0
    {
        VertexShader = compile VShaderModel VertexShaderFunction();
        PixelShader = compile PShaderModel PixelShaderFunction();
    }
};

Where Projection is an orthographic matrix computed in code and passed to the shader based on current window size. However, when I attempt to draw primitives, I receive the following exception:

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, COLOR0.

Now, I'm familiar with this exception and I understand what it means. The exception is telling me that my shader does not include all required elements based on the current vertex declaration. However, as you can see, my shader does include those two elements (SV_Position0 and Color0).

What am I missing here?

sentences:
Younger audiences and chat Most multiplayer games have some sort of way to communicate. It is usually verbal, written, or emotive gestures.

If I were to allow young children, from 11 to 13, access to a game I'm creating where anyone can type anything, what would I need to do?

The things I can think of are; hide all chat, only allow other young players to talk to each other with a list of censored words, or just allow predetermined sentences and actions to be used.

sentences:
HTML5 - multiple animations, different fps I want to create an html5 game which contains multiple sprites.

For different elements I want to create an fixed fps.

For example:

Walk - 10 fps, so 10 sprites will be shown within 1 second

Run - 15 fps

Attack - 3 fps

How can I create this with requestAnimationFrame and not using set timeout or setinterval.

sentences:
How to copy FrontBuffer to BackBuffer in DirectX11 I want to render the surface base on the the last surface.
So I try to copy FrontBuffer to BackBuffer, but it does not work:
//Get the BackBuffer(it will be FrontBuffer after SwapChain swapped the BackBuffer and FrontBuffer)
ID3D11Texture2D* backBufferTexture1 = NULL;
swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&backBufferTexture1);
D3D11_MAPPED_SUBRESOURCE mapResource1;
HRESULT result1 = m_pID3DContext->Map(backBufferTexture1, 0, D3D11_MAP_READ, 0, &mapResource1);
assert(result1 == S_OK);

swapChain->Present(1,0); //swap the BackBuffer and FrontBuffer

//Get the BackBuffer
ID3D11Texture2D* backBufferTexture2 = NULL;
swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&backBufferTexture2);
D3D11_MAPPED_SUBRESOURCE mapResource2;
HRESULT result2 = m_pID3DContext->Map(backBufferTexture2, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapResource2);
assert(result2 == S_OK);

//Copy the FrontBuffer to the BackBuffer
memcpy(mapResource2.pData, mapResource1.pData, sizeof(mapResource1.pData));
m_pID3DContext->Unmap(backBufferTexture1, 0);
m_pID3DContext->Unmap(backBufferTexture2, 0);

The result1 and result2 both return E_INVALIDARG One or more arguments are invalid. How could I get this to work?

sentences:
How can I synchronize state in my Asteroids game with many networked players? Wondering how state synchronization works in games with lots of players like MMOs. It seems like a hard problem to solve and I am not aware if there are standard solutions. Specifically, synchronizing game clients (users playing game) with an array of centralized servers, and then broadcasting and merging the state with all the same connected clients. How it is done (and how efficiencies are implemented) typically, and what the structure of the game state is like.

To simplify this question, I am thinking in terms of a simple asteroids game:

You have n number of players, and the asteroids, players, and bullets are synchronized across clients. I am not familiar with how the game state should be modeled (if it's some quadtree thing you are sending around, or just a vector of patch/updates, etc.). There could be players all over the world, so latency is a factor.

sentences:
How do I use delta-times to determine the speed of a frame-by-frame animation? I have a character spritesheet with 8 images. How do I animate it?

At the moment, the sprite changes to a different image every frame, which makes the animation speed vary with framerate.  I have a delta time that calculates the time in ms between each frame.  Is there a smart way to make sprite animations use it?

I'm using JavaScript and canvas on my own engine, for practice.

sentences:
Why am I getting this "tag not defined" error? In the log, it says

UnityException: Tag: car is not defined.
  at PlayerController.OnTriggerEnter (UnityEngine.Collider other) [0x00000] in <filename unknown>:0

I'm checking against the tag car when colliding, why does this happen? I have tagged the object, see picture below

heres some code

void OnTriggerEnter(Collider other)
{
    if (other.gameObject.CompareTag("car"))//error here
    {
        //more code
    }
}

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:
Missing textures after making a build in Unity I am working with a 2D game, in Unity. I am able to see the texture, in the Unity editor, but after taking the desktop build the texture is not visible to the scene.

What could be the problem?

sentences:
What happens if I make more than $100k with the free Unity license? If an indie game developer makes more than $100,000 using the free version of Unity, what happens to the money that goes over $100k? How will Unity people come to know how much money they are making?

What precautions should I take just in case a game is a great success?

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:
detecting the coordinates where a bullet hits a mesh I have a lot of complex objects in a scene and I'm looking for an efficient way to find which object a fired bullet hits, and to find the hit coordinates.

It would be best if there was a lightweight library to do this.

It seems that PhysX can do this, but I didn't find a way except to give every face in every mesh a PhysX system, and that seems to become a bottleneck.

sentences:
Client-Server Game Communication (w/ Protobuf, Relevancy and Delta Compression) So, I have reached another problem while trying to implement my client-server communication. From everything I've read there are three main ways to minimize packet size:

Only send what has changed to the client (Delta Compression)
Only send what gameobjects are relevant to the client (Relevancy)
With large packets, zip/compress them (L4Z?) [Not key for this question]

I have already implemented a delta compression scheme throughout my codebase using dirty bits and some interfaces. It's not as easy to use as I'd like, but it is decent and it works. Now I need to figure out how to add relevancy. I can certainly determine relevancy for each GameObject, but keeping track of all these deltas and which client has received them I think could get inefficient and complicated.

I considered having Players keep a NetworkComponent that tried to keep track of sending and maintaining what hasn't been sent, but I feel that could get complicated.

Advice on how to implement or improve either of these?

sentences:
Monogame pipeline tool: "Build failed: 1 is not a supported code page." I've previously done some coding with Monogame 3.6 in VS 2015 on Windows 10 without any problems, including using the pipeline tool. Last week I was forced to reinstall my whole system and now have VS 2017 + Monogame 3.6. Suddenly the pipeline tool does not do anything anymore, instead of a report on the build success of the various items i only get the following output (which only shows up when I disable the "filter output" setting):

  Build failed:  1 is not a supported code page.
  Parameter name: codepage

I'm rather lost with this one and google did not return anything useful. Since I reinstalled the whole system I guess it could also be something missing which is not directly installed by VS or Monogame and got on my old system some other way.

Any ideas what is going wrong here?

sentences:
Null Reference Exception error occurs when trying to override AndroidManifest file in unity? So I Created A manifest file in Assets/Plugin/Android/. The File contains:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
 <activity android:name="com.unity3d.player.UnityPlayerActivity" android:windowSoftInputMode="stateHidden"></activity>
</manifest>

Error Occurs when building:

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

  UnityEditor.AndroidManifest.SetApplicationFlag (System.String name,
  Boolean value)

  UnityEditor.AndroidManifest.SetDebuggable (Boolean debuggable)

I followed the docs from here, about Overriding the Android Manifest.

The apk builds fine when the manifest is removed.

Complete Error:

  NullReferenceException: Object reference not set to an instance of an object
  UnityEditor.AndroidManifest.SetApplicationFlag (System.String name, Boolean value)
  UnityEditor.AndroidManifest.SetDebuggable (Boolean debuggable)
  UnityEditor.Android.PostProcessor.Tasks.GenerateManifest.PatchManifest (UnityEditor.Android.PostProcessor.PostProcessorContext context, System.String manifest)
  UnityEditor.Android.PostProcessor.Tasks.GenerateManifest.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.Build.Reporting.BuildReport report)
  UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties)
  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.Build.Reporting.BuildReport report) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:286)
  UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

UNITY 2018.3.4f1

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: What does glBlendFunc(GL_DST_COLOR, GL_ZERO); mean? I need to write a description about a filter method I made but I don't know what glBlendFunc(GL_DST_COLOR, GL_ZERO); means.

sentences:
How do I create particles that react to the player and enemies? I'm currently making a game with my own game engine which I've written in C++ and I'm using the most recent directx SDK.

The game is a top down space shooter (with a pretty interesting twist) and I'm looking to have a sort of nebula effect that the player will fly through. I really want to try and nail that nice tactile feel of hundreds of particles moving out of the way of the player ship as it flies into them. Somewhat like how particles would move out the way of the player in Geomtry Wars on XBLA.

I'm an experienced programmer when it comes to C++. I don't know, however, how to start implementing this effect. Does anyone have any cool ideas or design choices I might want to look into? Feel free to answer to any degree of depth you fancy.

sentences:
With what projection matrix should I render a portal to a texture? I'm using OpenGL. I have problem with my engine's portal implementation. To create the first portal I do:

create a virtual camera with the position of the second portal and the correct orientation
render whole scene from virtual camera to the texture using FBO
render the first portal using the texture created before.

The problem: The virtual camera is rendering to the texture with the main projection view, so when I use this texture to render the first portal, everything is rescaled. The virtual camera should only render some part of the view to prevent scaling.

The problem could perhaps be solved by changing the virtual camera's projection matrix, but I don't know how to calculate such a matrix.

Here's how it looks:

This picture shows one portal (the texture is a little bit deformed on bottom and top, but that's not important now) and some other objects. The second portal is behind the camera, and the camera is in the middle between the two portals.

We can clearly see that the portal texture is rescaled down to the portal size. As I said before, I think the virtual camera should have another projection matrix, but how do I calculate it? Or is there a better way?

sentences:
XNA: Non-overlapping shadows I want to create an effect similar to the following in XNA / MonoGame:

There's a background and a semi-transparent shadow consisting of several objects (two circles in this example). However, the shadows merge without darkening their overlapping region!

My current approach was the following:

Render all required shadow objects using a DepthStencilState and a AlphaTestEffect.
Then, render a single-pixel semitransparent black texture over the entire screen using another DepthStencilState to display shadows.

However, it didn't work as expected: the shadow objects get rendered to the target, and the stencil buffer seems unaffected.

Here's what I want:

A way to render a sprite to Stencil Buffer only, with absolutely no visible modifications to the target.
A way to render a semitransparent texture using the stencil buffer.

Stencil states and effects are initialized as follows:

StencilCreator = new DepthStencilState
{
    StencilEnable = true,
    StencilFunction = CompareFunction.Always,
    StencilPass = StencilOperation.Replace,
    ReferenceStencil = 1
};

StencilRenderer = new DepthStencilState
{
    StencilEnable = true,
    StencilFunction = CompareFunction.Equal,
    ReferenceStencil = 1,
    StencilPass = StencilOperation.Keep
};

var projection = Matrix.CreateOrthographicOffCenter(0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 0, 1);
var halfPixel = Matrix.CreateTranslation(-0.5f, -0.5f, 0);

AlphaEffect = new AlphaTestEffect(GraphicsDevice)
{
    DiffuseColor = Color.White.ToVector3(),
    AlphaFunction = CompareFunction.Greater,
    ReferenceAlpha = 0,
    World = Matrix.Identity,
    View = Matrix.Identity,
    Projection = halfPixel * projection
};

MaskingTexture = new Texture2D(GameEngine.GraphicsDevice, 1, 1);
MaskingTexture.SetData(new[] { new Color(0f, 0f, 0f, 0.3f) });

What am I doing wrong?

sentences:
Make a laser beam effect with Ogre and a BillboardChain http://www.lpi.usra.edu/lunar/missions/apollo/apollo_15/images/laser_beam_lg.gif

I want to be able to such an effect, but I don't really know how the BillboardChain class works or how I can use it, examples for this class seems to be rare.

sentences:
How do I check if a surface is sloping? I'm implementing gravity over a 3D terrain and I'm struggling with how to check if surface "under your feet" is flat or sloping.

I read some tutorials but gravity is always considered along a single axis.

How do I proceed?

sentences:
Game architecture / design question - building an efficient engine while avoiding global instances (C++ game) I had a question about game architecture: What is the best way to have different components communicate with each other?

I do really apologize if this question has already been asked a million times, but I can't find anything with exactly the kind of information I'm looking for.

I've been trying to build a game up from scratch (C++ if it matters) and have observed some open source game software for inspiration (Super Maryo Chronicles, OpenTTD and other). I notice that a lot of these game designs use global instances and/or singletons all over the place (for things like render queues, entity managers, video managers, and so forth). I'm trying avoid global instances and singletons and build an engine that is as loosely coupled as possible, but I'm hitting some obstacles that owe to my inexperience in effective design. (Part of the motivation for this project is to address this :)  )

I've built a design where I have one main GameCore object that has members that are analogous to the global instances I see in other projects (ie, it has an input manager, a video manager, a GameStage object that controls all the entities and game play for whatever stage is currently loaded, etc). The problem is that since everything is centralized in the GameCore object, I don't have an easy way for different components to communicate with each other.

Looking at Super Maryo Chronicles, for example, whenever a component of the game needs to communicate with another component (ie, an enemy object wants to add itself to the render queue to be be drawn in the render stage), it just talks to the global instance.

For me, I have to have my game objects pass relevant information back to the GameCore object, so that the GameCore object can pass that information to the other component(s) of the system that needs it (ie: for the situation above, each enemy object would pass their render information back to the GameStage object, which would collect it all and pass it back to GameCore, which would in-turn pass it to the video manager for rendering). This feels like a really horrible design as is, and I was trying to think of a resolution to this. My thoughts on possible designs:

Global instances (design of Super Maryo Chronicles, OpenTTD, etc)
Having the GameCore object act as a middleman through which all objects communicate (current design described above)
Give components pointers to all other components they will need to talk with (ie, in the Maryo example above, the enemy class would have a pointer to the video object it needs to talk to)
Break the game into subsystems - For example, have manager objects in the GameCore object that handle communication between objects in their subsystem
(Other options? ....)

I imagine option 4 above to be the best solution, but I'm having some trouble designing it... perhaps because I've been thinking in terms of the designs I have seen that use globals. It feels like I'm taking the same problem that exists in my current design and replicating it in each subsystem, just at a smaller scale. For example, the GameStage object described above is somewhat of an attempt at this, but the GameCore object is still involved in the process.

Can anyone offer any design advice here?

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:
NullReferenceException until tile is spawned I have a tile and tile has enemies spawn positions, and spawner script in it. Everything works fine when tile is spawned, my ray hits the collider in tile and enemies get spawned, but my spawn script is in tile my ray script is in my player so im reaching from my PlayerMove script to spawner script, but until my tile is spawned i get this error NullReferenceException: Object reference not set to an instance of an object because tile is not spawned yet after its spawned error stops, but after tile is deleted it starts again how can i get rid of this error.

PlayerScript

private Spawner spawner;
private RaycastHit hit;

private void Update()
{
  spawner = GameObject.FindGameObjectWithTag("Spawner").GetComponent<Spawner>();
  DrawRay();
}

private void DrawRay()
{

    Ray ray = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));

    if(Physics.Raycast(ray,out hit))
    {
        if(hit.collider.tag == "SpawnerCollider")
        {
            if(hit.distance < 5)
            {
                Destroy(hit.collider);
                spawner.Spawn();
            }
        }
    }
}

SpawnerScript

public Transform[] spawnPos;
public GameObject fireBall;

public void Spawn()
{
    for (int i = 0; i < spawnPos.Length; i++)
    {
        Instantiate(fireBall, spawnPos[i].position, Quaternion.identity);
    }
}

sentences:
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:
Using server timestamp to synchronize actions across clients tl;dr
The question is rather simple: how unsynchronized can internal clocks be between different machines?

Context
We have a "hybrid" approach where the Clients are authoritative on certain things, and the Server on some others. That is to make our life easier because the gameplay doesn't need to be too tight about certain things.
In this case, the Server will pre-determine a sequence of Enemy Types to be spawned at different locations with pre-determined delay between the spawns. We would then let the Clients handle the rest during the gameplay.
However, if we want the Clients to be mostly synched on the display of the enemies, they would need to initiate this sequence at the very same time, and thus we cannot rely on the network to have transmitted the data at the very same time for all Clients.
The idea we had was to send a timestamp of the format returned by System.currentTimeMillis() which would indicate when to begin the sequence.
But then one question remains in the way: how unsynchronized can internal clocks be between different machines?

sentences:
Accurately record and play back game sessions in an MMO - timing issues? In order to detect and reproduce bugs in an MMO, recording game sessions on the server can help.

How can such recording and replay of the data be implemented to be accurate, i.e. be 100% deterministic / produce exactly the same result on each replay?

I intend to record timestamped incoming messages as the only data necessary, if possible.
The playback would use the database snapshot as present at the beginning of the recording.

Details about the MMO

mainly I/O driven (act on incoming network messages plus simple periodic AI)
2D
C++ and Lua, RDBMS for storage.
Clients send updates at around 1-3 times per second due to the simple nature of the MMO

In particular, consider timing issues:

If run-time for computations on playback differ from the run-times when recorded, frame times will also differ and can for example affect the movement of NPC units (move 3px instead of 1px).

How to make sure that in the replay AI has the same time constraints compared to when recorded? Fixed time-step? Record the time deltas between each frame and on replay make sure those deltas determine the actual frame time?

sentences:
SDL Sprite Customization I am currently working in C++ with SDL2. I plan on making a game that utilizes character visual customization. More specifically, equipping clothes and items changes the appearance of characters. However I don't know how to approach this situation. With that being said, how would I achieve this character customization in SDL2?

Right now I have two ideas...

Create a sprite sheet for every possible combination.( Way too much
time).
Break the sprite into different rects to draw each article of clothing or item. (Not sure if this is efficient)

sentences:
How can I throttle certain player actions? Background
I have a variable time step, component based game, with components that collectively hold an entity's properties and different systems that act on entities with certain required components.
The player controls a ship that can fire bullets. I have an input system that works on entities with a PlayerControlComponent (nothing more specific yet) and creates an entity every frame if a key is held down.

Question
How should I manage limiting or throttling this so that it can't occur closer than 1 second apart in a reusable way?

sentences:
Tile based collision detection errors if player is smaller than tiles I have implemented a tilemap where each tile is at a non-negative x and y position. (So at the moment think like chess)

At the moment a tile is 16, 16 pixels in size

Tile 0,0 is at the left bottom corner

Some tiles should be collidable. I've never implemented something like that and during research stumbled upon: https://jonathanwhiting.com/tutorial/collision/

The general idea + collision response handling:

let mut new_pos = Point2::new(curr_pos.x + x_offset, curr_pos.y);

let collision_on_x = collide_with_world(&new_pos, &world);

if !collision_on_x  {
    transform.translate_x(x_offset);
}

new_pos.y = curr_pos.y + y_offset;

let collision_on_y = collide_with_world(&new_pos, &world);

if !collision_on_y  {
    transform.translate_y(y_offset);
}

The collision detection

fn collide_with_world(new_pos: &Point2<f32>, world: &World) -> bool {
    // TODO make these sizes i16 instead so we can grow in any direction!
    let mut left_tile: u16 = (new_pos.x / TILE_SIZE_IN_PIXELS as f32) as u16;
    // -1 so that we do not collide until we are exactly at the thing
    let mut right_tile: u16 = ((new_pos.x + PLAYER_WIDTH - 1.0) / TILE_SIZE_IN_PIXELS as f32) as u16;
    let mut top_tile: u16 = ((new_pos.y + PLAYER_HEIGHT - 1.0) / TILE_SIZE_IN_PIXELS as f32) as u16;
    let mut bottom_tile: u16 = (new_pos.y / TILE_SIZE_IN_PIXELS as f32) as u16;

    println!("new_pos: {:?}, left {}, right {}, top {}, bottom {}", (new_pos.x, new_pos.y), left_tile, right_tile, top_tile, bottom_tile);

    // Useless as long as we use unsigned coordinates
    //if left_tile < 0 {
    //    left_tile = 0;
    //}

    if right_tile > WORLD_WIDTH_IN_TILES {
        right_tile = WORLD_WIDTH_IN_TILES;
    }

    // Useless as long as we use unsigned coordinates
    //if bottom_tile < 0 {
    //    bottom_tile = 0;
    //}

    if top_tile > WORLD_HEIGHT_IN_TILES {
        top_tile = WORLD_HEIGHT_IN_TILES;
    }

    let mut any_collision = false;

    for i in left_tile..=right_tile {
        for j in bottom_tile..=top_tile {
            let tile = world.get_tile(i, j);
            println!("tile at {:?} is {:?}", (i, j), tile);

            match tile {
                Some(tile) => {
                    if tile == WALL {
                        println!("hit a wall at {:?}!", (i, j));
                        any_collision = true;
                    }
                }
                None => (),
            }
        }
    }

    return any_collision;
}

I basically took (or tried to take) the optimised version of the linked blog-entry.

Now to the problems:

If PLAYER_WIDTH and PLAYER_HEIGHT are both 16.0 - collision works fine

But note that I had to put -1.0 in the calculation of the right_tile and top_tile, else the collision for UP and RIGHT would occur one pixel to early (so the player would never touch walls to their top or right)

This change alone makes me a bit suspicious - looks like I made an error there.

The real problems start if the player is smaller than a tile:

In the following screenshots the following rules apply:

*) the PLAYER_WIDTH and PLAYER_HEIGHT are both 8
*) Greenish tiles are the only walls!
*) All the screenshots were taken in ONE run - no parameters were changed during this run!

1)  -> Trying to collide with right tile -> overlapping
2)  -> Trying to collide with top tile -> cannot go any nearer than 4 pixels (half the height of the player)
3)  -> Trying to collide with left tile -> cannot go any nearer than 4 pixels (half the width of the player)
4)  -> Trying to collide with top tile -> suddenly overlapping although different tile didn't collide?
5)  -> Trying to collide with bottom tile -> cannot go any nearer than 4 pixels

I cannot grasp 2 and 4 at the moment.

sentences:
Speech recognition in Unity 5 for Android I've been working on a game in which the player have to say particular words to perform various tasks. For example, if the player says "boat", a boat pops up in the game. The game I'm building is specifically for offline play, on an Android device. Just for reference, there is a game titled "Pah!" which implemented this offline speech recognition for one specific word. In this game, when you say "pah", the GameObject moves jumps.

I've tried everything from speech-to-text to forums, and even tried Google and used using Windows.Speech, but nothing works. From what I've learned, I need to use the Google speech API for Android speech recognition. I am a bit new, when it comes to Java. I gave it a try and created a basic script, which I thought might take at least one input in speech from the player, but Unity disagrees and says it couldn't recognize the script. I created another script in C#, by taking help from tutorials, but when I switch the platform from Windows to Android it doesn't work, because Unity.Windows.Speech is a Windows namespace

I am blank, and hence, this question. I have googled, visited forums, and even looked at YouTube videos for an answer. I came across a few Unity assets which I paid for, and they are all garbage. If anyone could help me, how do I implement speech recognition in Android, using Unity 5?

sentences:
DX11 render 800x600 scene without a window Normally I would create a hidden overlay window and render my DX scene into that, but I think it is possible to render without a window at all as well, is this true? The goal for me is to render on top of all running Windows applications without using a TOPMOST window.

Does someone know how this would approximately be achieved? Thanks!

sentences: Rushing water in Unity How would I go about creating a river with rushing water?  I can do the texture around it but I'm stuck on the actual water part.  This is in Unity3D.

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:
websockets authentication security Im doing a online game havingclient, js html5, and server, nodejs with websockets.
I've read some blogs about websockets security, and its limitations, but no real implementation or example.

Could JWT tokens in the messages sent to the server, be a good option? Meaning when the clients connect to the server, it gets a token and passes it around on every message? And use wss instead of ws.

Thanks in advance!

sentences:
Lua GameDev iOS - Code on win and mac I am searching for a simple framework like http://getmoai.com where you can simply code a game in lua for iOS. I want to build it along with a friend. I am using a Mac, he prefers windows so the fw needs to be used in Windows 7. Preferably something like LOVE2D but then offcourse also for iOS!

Thanks in advance

sentences:
SFML Texture issue removing from memory I am currently working on loading tmx levels into my game, all is going well and i have layers being loaded textures being loaded and all the data being loaded such as level name, tile sizes etc.

The issue

Loading 1 texture for tiles is perfectly ok, but loading more than 1 the texture seems to get removed from memory (only white squares are displayed) I'm not going to include all my code as there's lot's of it but i will include a couple of snippets.

//code inside load function.
Texture texture;
texture.loadFromFile(src);
Texture *t = addTexture(texture);
loadTileSheet(twidth, theight, t);

Texture* Level::addTexture(Texture texture){
    Level::textures.push_back(texture);
    return & textures[textures.size() - 1];
}

I am then outputting all the information to the console of the tileset this is as follows:
mem adress 1 is the texture creation and mem adress 2 is the adress in the vector.

Tileset Information: nametileset2 | src G:/C++/Workspace/test/res/tileset2.png | tWidth: 32 | tHeight32 | MemAdress 1: 0x85d028 | MemAdress 2: 0xa81848

currently this works,  loading in a second texture outputs this and breaks all the first set of textures.

Tileset Information: nametileset2 | src G:/C++/Workspace/test/res/tileset2.png | tWidth: 32 | tHeight32 | MemAdress 1: 0x85d028 | MemAdress 2: 0x82522b0

I'm pretty sure this is something simple that i have over looked, and I'm pretty sure the first texture is somehow being removed from memory when the second one is created somehow.

Thanks in advance:

Jordan

sentences:
OpenGL 2D Origin in Upper Left Corner I got an OpenGL Context Working in SDL, and I'm trying to set it up so I can render with pixel coordinates of the screen. I got this trying to fill the entire screen with a white rectangle:

glViewport(0, 0, MonitorWidth, MonitorHeight);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, MonitorWidth, MonitorHeight, 0, -1, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

glClearColor(0, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glColor3f(1, 1, 1);

glBegin(GL_QUADS);

glVertex2f(0, 0);
glVertex2f(MonitorWidth, 0);
glVertex2f(MonitorWidth, MonitorHeight);
glVertex2f(0, MonitorHeight);

glEnd();

It doesn't work, and the entire screen appears black. What's wrong with this?

sentences:
Why even use coroutines in Unity? I have been thinking about the use of Unity's coroutines recently, and while I've used them in the past, and am already aware of their bad reputation (although I've also seen posts on the unity forums of people who seem to absolutely swear by them), the more I think about it, I'm kind of struggling to see any compelling reasons to use them at all instead of simply creating a new component and simply performing the logic of the coroutine in said new component's Update method. By using a IEnumerator coroutine inside of another component, it seems to me like all it accomplishes is decreasing the cohesiveness of individual components and the re-usability of the component using them.

Is there any convincing argument to actually use coroutines in Unity and would I be missing out by simply not using them? Are there any scenarios I'm overlooking where their use would either be required or prove incredibly useful?

sentences:
Enable debug to show values in the flowchart editor I am starting to learn to use CryEngine V, and have found documentation lacking, in some aspects.

Following the initial game logic tutorials, I observe the instructor selecting "debug" from the menu. The flow chart instantly comes to life, displaying all of the values going in and out of each function.

Unfortunately, when I follow this instruction, nothing happens. Clicking on the "debug" button results in no apparent action. I have looked around for further instructions, but all I can find is the general assumption that it will just work, without any additional action. As you can see from my recording, this assumption is not accurate to my situation.

Without this working, it is rather difficult to even know if I am following the flowchart creation process properly. How do I enable visual debug in the flowchart editor?

sentences:
What are some good game programming short courses? I'm from Brazil, and I want to take a short course on game programming, 2 months at most, in a country that lectures are given in english. I'm almost a BSc in Computer Science alredy.

Can you tell me what you think about this courses?
What are some good courses in that format?

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 to render a large number of colored dots in 3d space? I would like to create a game similar to Scanner Sombre. The player is in a dark environment and can't see their surrounding unless they use a scanner. That scanner sends out rays which mark little dots on all surfaces, creating 3D map of environment.

I tried to just paint visible dots on transparent textures, but that does not work because the dots are supposed to always face the player.

I considered to instantiate a new game object for every single dot. But as the game progress, the player will see billions of these dots at once, and that would likely be terrible in terms of performance. Can someone suggest a possible technique to do this?

sentences:
Where can I find tutorials for LWJGL? I don't know if this is against the FAQ so if you close this, it'll be no surprise.
I have done research but all the tutorials I have seen have been to hard to follow; I reckon there are better ones out there.
If you could tell me, that would be great but if you close it, I understand.
Thank you

sentences:
Attaching objects on collision in Unity? I'm trying to make a game where the player can connect objects Lego style with objects becoming children of any object they come into contact with, so if the parent object is moved the child is moved too, but the child object can be dragged away to disconnect it.

What is the best way to go about doing this?

sentences:
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:
What type of document for game design? What type of support/format do you use to store and diffuse your game design documentation?
Wiki? Doc files? Files in Repository? Shared folder? Google Doc?

Please provide pros and cons for each one.

sentences: In gamemaker studio, how do I make text boxes? How to make text boxes in gamemaker studio?

sentences:
Drawing particles as a smooth blob I'm new to game/graphics development and I'm playing around with particles (in 2D). I want to draw particles close to each other as a blob, just as liquid/water. I do not want to draw big circles overlapping as the blob won't be smooth (and too big). I don't really know physics but I assume what I want is something looking similar to surface tension.

I haven't been able to find anything on stackexchange or on Google (maybe I do not know the correct keywords?). So far I have found two possible solutions, but I am unable to find any concrete information about algorithms.

One of them is to calculate the concave hull of particles I consider being a blob. I can calculate the blob by creating an equivalence class (on the relation "close to each other"). Strangely enough I haven't been able to find any algorithm explaining how to calculate the concave hull. Many posts (and among stackexchange) links to libraries or commercial products that do this (I need libraries to work in C#), but never any algorithm. Also this solution might have a problem with a circle of particles, which would not detect the empty space in the middle.

While researching concave hull I stumbled upon something called alpha shapes. Which seems to be exactly what I want to do, however just as with concave hull I haven't found any source explaining how they actually work. I have found some presentation materials but not enough to go on. It's like a big secret everyone knows except me :-/

After calculating the concave hull or alpha shape I want to make it a Bézier curve to make it smooth and nice.

Although I do find my approach a bit too complex, maybe I am trying to solve this the wrong way? If you can either suggest any other solution to my problem, or explain the pieces I am missing I would be very happy and grateful :-)

Thanks.

sentences:
Player won't move correctly due to gravity force pushing him into the ground I am making a tilemap platformer with pygame ad I defined the X and Y movement for the player and also a Y force that represents the gravity force to make it jump correctly. However, when my player falls off to the ground and the game begins, it doesn't move correctly neither to the right nor to the left direction due to the gravity force that keeps pushing him to the down. In addition to that, when the player jumps and i move it to the right, it's like it doesn't recognize the collision with the bottom rect of the wall (see gif below for a visual explanation of that).

I tried disabling that gravity force when the player hits the ground and enable it when the player jumps but it didn't work as expected and I've got problems managing collisions (also, it doesn't make sense to disable gravity, right?)

Here's a gif of the issue i'm facing with:

Here's my Player class:

class Player(pg.sprite.Sprite):
    def init(self, game, x, y):
        self.groups = game.sprites
        pg.sprite.Sprite.init(self, self.groups)

    self.game = game

    self.image = pg.Surface((TILESIZE, TILESIZE))
    self.image.fill(GREEN)
    self.rect = self.image.get_rect()

    self.move_left = self.move_right = False

    self.pos = pg.math.Vector2(x, y)
    self.acc = pg.math.Vector2(0, GRAVITY)
    self.vel = pg.math.Vector2(0, 0)

def jump(self):
    self.vel.y -= 3

def update(self):
    self.vel.x = 0

    if self.move_left:
        self.vel.x = -PLAYER_SPEED
    if self.move_right:
        self.vel.x = PLAYER_SPEED

    self.vel += self.acc

    self.pos += self.vel
    self.rect.x = self.pos.x * TILESIZE
    self.rect.y = self.pos.y * TILESIZE

    if self.vel.y > 0.5:
        self.vel.y = 0.5

    hits = pg.sprite.spritecollide(self, self.game.walls, False)
    if hits:
        if self.vel.x > 0:
            self.pos -= self.vel
            self.rect.right = hits[0].rect.left
            self.vel.x = 0
        if self.vel.x < 0:
            self.pos -= self.vel
            self.rect.left = hits[0].rect.right
            self.vel.x = 0

    hits = pg.sprite.spritecollide(self, self.game.walls, False)
    if hits:
        if self.vel.y > 0:
            self.pos -= self.vel
            self.rect.bottom = hits[0].rect.top
            self.vel.y = 0
        if self.vel.y < 0:
            self.pos -= self.vel
            self.rect.top = hits[0].rect.bottom
            self.vel.y = 0

sentences:
Overuse of Canvas in Unity3D I'm currently trying a new approach on a Card Game in Unity.

To capsuling my Card Prefab i have a root GameObject with the Canvas Component.

I'm highly count on the Canvas behavior which should render things after the main scene rendering.

  Elements on a canvas are rendered AFTER scene rendering, either from an attached camera or using overlay mode.

Before i further proceed, i want to know if there are any disadvantage of this, when my Game Logic approximately generate 100-200 of this GameObjects?

Should the Canvas Component not be overused in Unity?

sentences: How to scale game with orthographic camera correctly? During porting to android I encountered that the game does not fit on the screen in portrait mode. It uses an orthographic camera. How could I scale to game to fit the screen in portrait mode?

sentences:
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: 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:
Restrict object movement inside irregular shaped container I want to restrict object movement inside an area. My object follows cursor position.

I have already done that for the area border using Mathf.Champ to the translate because the borders are square shaped (got the idea from Unity: Restrict movement inside a gameobject (2D)). The thing is that inside the box area there can also be other shapes (colliders) which I don't want my object to go over.

I know people suggest using physic collisions, but my game needs a unit perfect positions so I can't use physics due to physics' default contact offset (the one physics use to detect collisions).

Here is a short video of what I have:

https://gfycat.com/cookedsmartannelid

As you can see, movement is restricted (clamped) inside the box area but I want the movement to also be restricted to not go over the black area.

Is there a way to be able to do this with just clamping or do I need a raycast system or something like that?

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:
Problem WIth Enemies Bullets PyGame I am trying to make my enemy shoot my player but for some reason the bullets arent showing nor they are shooting at the player I don't even know why, I even draw the bullets on my window  VIDEO

bulls = []
runninggame = True
while runninggame:
    clock.tick(FPS)
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            runninggame = False

    for bull in bulls:
        if bull.x < 500 and bull.x > 0:
            bull.x += bull.vel  # Moves the bullet by its vel
        else:
            for enemys in enemying:
                if playerman.x - 100 <= enemys.x <= playerman.x + 100 and playerman.y - 100 <= enemys.y <= playerman.y + 100:
                    bulls.pop(bulls.index(bull))
                    bulls.append(enemybullets(round(enemys.x+enemys.width//2), round(enemys.y + enemys.height//2), 6, (0,0,0), facing))

then I called it below

    for bull in bulls:
        bull.draw(window)

my enemy projectile class

# enemys bullets
class enemybullets(object):
    def __init__(self,x,y,radius,color,facing):
        self.x = x
        self.y = y
        self.radius = radius
        self.color = color
        self.facing = facing
        self.vel = 8 * facing

    def draw(self,win):
        pygame.draw.circle(win, self.color, (self.x,self.y), self.radius)

```

sentences:
Making a symbol appear on any colour I'm developing an RPG/roguelike-style game. Instead of having maps like:

.........
.........
....@....
...h.....

Oh look, a dwarf.

I was having solid background tiles, So sort of a tile based RPG without drawn tiles. I like the idea of having ascii tiles for creatures and things. It saves a lot of artist time. I can change the tiles so I get some kind of symbol slightly more...related? But better than having 4 directions for each separate thing.

If I did this in white, and had a snow area, you wouldn't be able to see. So make it black. As soon as you reach a dark place, you're again stuck as to where your character is. Is there an algorithm or something that can say 'this is too dark between the tile and the NPC' and change the colour to something seeable, but not going to a bright cyan from a pale pink or whatever?

sentences:
How to generate water pools on a 2D tile grid? I'm coding a algorithm that generate a map, fixed size 2D matrix of tiles (32x32, 64x64, ...), for a game. The game map contains 2 elements, ground and water tiles. I'm trying to flood some water pools on the map, but I don't come to any ideal conclusion.

I can do it with this steps:

Fill the map with Ground
Get a random position (x,y)
Set (x,y) as Water
Walk on, in spiral sequence, from the (x,y) point to a limit of N random steps, setting randomly  tiles as Water
Jump to step 2, making K more random water pools

This is a good approach? I think not! That algorithm will make pools with ground on the inside, with irregular borders and square shape.
But I desire random shaped lakes.

Anyone can give me a idea of a better solution?

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:
Android local multiplayer I am working on a FPS game for Android and I want to make a support for local multiplayer with no additional devices or server required. One of the player's devices would serve as a server, getting and distributing all the messages, OR every device broadcasts messages to everyone inside the group.
First I was thinking bluetooth or wifi direct, but I am running into many problems with both. The plan was to support up to 10 players,  so I am not sure bluetooth can handle that (broadcast messages and similar). If it is possible, let me know.
Also, I heard of an option to make a wifi hotspot on one device, and connect all other devices to it that way, but I have no idea how that would work.
Does anyone have any real experience with this, or any advice on how to implement it?
Thanks in advance.

PS. yes, I've ran through everything on android developers site, but their wifi direct example is kinda bad and only supports 1-way data transfer.

sentences:
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:
Unity-UI not scaling correctly on android My UI appears extremely small when i build and launch my game on my android device. Im working with unity 4.6. I've tried changing the UI scale mode of my canvas to all 3 types. Scale with screen size option and constant physical size option makes it too big. Constant pixel size makes it too small.
With constant pixel size this is what it looks like on my mobile:

I could increase the scale factor but then it looks like this on PC. Also, I don't think it would look right on a tablet then.

sentences:
Shadows in Android using Unity 5 The point lights in my scene cast shadows when it's in the editor mode but the light passes through walls in the build or play mode.
I checked the quality settings and set it to hard and soft shadows for all quality settings but that didn't fix it.
It does work when I increase the quality when I build it for Standalone but not when I build for Android.
I've removed the dx11 option in the PC/Mac Standalone settings.
I've changed both forward and deferred rendering options.
I'm testing it on a Moto G 1st Gen [XT 1033].

sentences:
How to make a gui button follow a path after a touch? I would like a button in my gui menu to follow a specific path if we selected it, I am wondering how I could do it: if we touch the button, then it can only move on the specific path, it is an arc such as this path :

Would you know how to achieve this?
I am using Unity, but I think the theory should be the same for other software/language ?

Thanks for your help

__

EDIT:

here is the code for the bezier curve in unity : Where should I put the script?

using UnityEngine;
using System.Collections;

public class DrawBezierHandle extends Editor {

    public Transform startT;
    public Transform endT;

    function Start(){
        startT = GameObject.Find("start").GetComponent("Transform") as Transform;
        endT = GameObject.Find("end").GetComponent("Transform") as Transform;
    }

    function OnSceneGUI() {

        var width : float = HandleUtility.GetHandleSize(Vector3.zero) * 0.1;
        Handles.DrawBezier(startT.position,
                        endT.position,
                        startT.position * 5 * Vector.up,
                        endT.position * 5 * Vector.up,
                        Color.red,
                        null,
                        width);
    }
}

sentences:
Double touch joysticks I am developing a mobile game where I need to control main character in any direction using touch analog joystick (https://pineight.com/mw/images/6/6f/Ipoc_dpad.png). It's ok but I also want my character to fire in any direction. Thus I am looking for best solution of control.

There are some variants, but no one is ok:

Target and fire by pointing finger to exact point of the screen (not comfortable, because player will need to hold device by one hand and use second hand to move over the whole device).
Fire to direction where the character moves. This case will limit characters' freedom on move and target. Not good.
Use second touch joystick (under opposite hand) to select fire direction - this variant looks better than previous two, however I still not sure how comfortable it will be. I've tried by myself and it looks a bit complex for me to follow both controls at the same time.

Did you saw any games achieving the same goal? What you can recommend?

sentences: What are the pros and cons of HLSL vs GLSL vs cg? What are the pros / cons of the three?

sentences:
Modern OpenGL, 2D only, should I be using uniforms or VBOs for sprite transformation? I'm new to OpenGL, I'm currently building a 2D game engine. Right now I'm only using one shader as I only draw textured quads (basically sprites).

The thing is... I don't know if should I be using uniforms or VBOs with glBufferSubData.
Edit: My concern is efficiency, more specifically CPU overhead.
Edit2: I want to make the best out of OpenGL and the GPU, and to have as little CPU overhead as possible.

The way I have it setup right now is that I create a single VBO, VAO and EBO.
This is my VBO (vec2 for position [center of the screen] and another vec2 for texture coordinates, times 4)

{
    -0.5f,  0.5f, 0.0f, 0.0f,
     0.5f,  0.5f, 1.0f, 0.0f,
     0.5f, -0.5f, 1.0f, 1.0f,
    -0.5f, -0.5f, 0.0f, 1.0f
}

And this is the EBO which I use to draw the quad with glDrawElements with the above VBO:

{
   0, 1, 2,
   2, 3, 0
}

This is all static and I currently use uniforms for transformation (position, camera, rotation, etc.) and color.

So every frame, for every sprite, I update the uniforms with glUniformMatrix4fv and glUniform2fv and I draw the quad (I batch sprites with identical transformation and color attributes, to minimize the amount of these calls).

And I have no idea if this is bad or not. I have no prior experience in OpenGL.

I know the VAO will always be the same (as I only render textured quads with a single shader), but should I not use uniforms and instead create a VBO for each sprite object and update the needed data in the VBO with glBufferSubData?

P.S.
If both ways are not good and there's a better way to do this please let me know.

Update (kind of an answer):
Using the method above made it impossible to use spritesheets as the UV was static.
I didn't think of that when I began working on it.
So what I did instead was implementing a completely different approach that I came across last week by reading some books.
I'm still using a single shader, a single VBO, a single VAO and a single EBO.
The VBO consists of positions, UVs and colors.
Except that the VBO and EBO are large (predefined MaxVertices variable determines how large).
I initially allocate memory with glBufferData (only once). To the VBO with GL_DYNAMIC_DRAW and to the EBO with GL_STATIC_DRAW.
I upload the data to the EBO once, which is just static indices to the VBO (using 4 vertices to draw a quad by drawing them with that EBO and glDrawElements, same method as before).
I have a Begin(), Draw(...) and End() calls, which are similar to a typical sprite batch class.
Whenever the amount of vetices exceeds the predefined MaxVertices variable, or when End() is called, the vertices that were batched are actually uploaded (with glBufferSubData to avoid memory reallocation) and drawn.
For now, I found this to be the most efficient way to do what I want. If batched correctly, each batch will have the least amount of CPU and GPU overhead by "sacrificing" (more like utilizing) GPU memory.
I am still not sure if this is the most optimal way to reduce overhead, but so far it's a big improvement over what I've previously done. And it makes it so I can use spritesheets which I completely forgot about :P
I would appreciate any input on this implementation. :)

sentences:
game-state update structure and distribution in MMO? I'm developing an MMO, which has to maintain a global game-state.

Now I want to distribute the updates, which the players make to this state, to players which can see those updates (area of interest etc.)

Is there a common structure/format for these updates and for a global game-state?

Like, every action a player sends to the server has to include a type, the coordinates etc.

And are the updates, which gets distributed from the server to the players in the same format or are they different?

Also should I include timestamps or use the receive-time from the server to check which action came first and which sencond etc.?

And what should I send back to the player if he send an invalid action?

sentences:
simple 2d car AI unity I have a top down Car Game. how can I implement AI for the Cars? how the car follow the way points?
I want AI cars also rotate itself along the path.

I tried this solution

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

public class waypoint : MonoBehaviour {

    public List<Transform> waypoints;
    private Transform currentWaypoint;
    public float speed = 5f;
    private float closeEnouth = 0.5f;
    int point = 0;

    void Start()
    {
        currentWaypoint = waypoints[point];
    }
    // Update is called once per frame
    void Update()
    {

        Quaternion rotation = Quaternion.LookRotation(waypoints[point].position - transform.position, transform.TransformDirection(Vector3.forward));
        transform.rotation = new Quaternion(0, 0, rotation.z, rotation.w);
        float dist = Vector3.Distance(waypoints[point].position, transform.position);
        transform.position = Vector3.MoveTowards(transform.position, waypoints[point].position, Time.deltaTime * speed);
        if (Vector3.Distance(this.transform.position, waypoints[point].position) < closeEnouth)
        {
            if (point + 1 < waypoints.Count)
                point++;

        }
    }
}

and the car moved in the path but it moves reversed and if arrives the final node it stops and corrects its direction and console displays "Look rotation viewing vector is zero" error.

Thanks in advance

sentences:
Is it a good idea to use high-level API's in order to develop game engines? I have been looking around the internet finding articles that talk about what you should learn to develop a game engine. Something that I keep hearing in many articles is that you should learn low-level graphics API's such as OpenGL or D3D11 (great article for example: https://www.haroldserrano.com/blog/how-to-become-a-game-engine-developer) for graphics rendering for instance.

NOTE: I will be using graphics rendering as an example for my question since it makes the most sense to me here.

This got me thinking. Is it really necessary to re-invent the wheel by creating your own framework for just rendering graphics? Isn't it sufficient to learn a library like babylon.js for graphics rendering on the web? If the main goal of creating a game engine is to lay a software framework to build video games, then spending time on developing an entire framework for graphics shouldn't be an issue if others have solved the problem for you via their graphics libraries.

sentences: How to move a body from one world to another? I have a Box2D world for each level in my game. When a level is completed, I want the player to be removed from the completed level's world and added to the next level's world. How do I do this?

sentences:
How to support all iOS device screen sizes / resolutions in my game I made this game. Right now the game supports all iOS devices except iPhone 5.

The definition of each level of the game is kept in a plist. The creation of each level is done through a graphical level editor. Each device family has its own plists. So, right now the game has 100 levels and 200 plists; 100 plists for the iPhone family and 100 plists for the iPad family.

In order to support the iPhone 5 I need to create 100 new plists and adjust the plists accordingly, which is time consuming, not to mention the creation of new levels...

The editor for creating and editing the levels is solely based on the manipulation of UIViews that describe the game elements. So, this is the code that I wrote to save and restore the state of each UIView in one level of the game.

- (void)encodeWithCoder:(NSCoder *)aCoder {
    // Save the screen size of the device that the view was saved on
    [aCoder encodeCGSize:self.gameView.bounds.size forKey:@"saveDeviceGameViewSize"];

    // ****************
    // ALL properties are saved in normalized coords
    // ****************

    // Save the center of the view
    CGPoint normCenter = CGPointMake(self.center.x / self.gameView.bounds.size.width, self.center.y / self.gameView.bounds.size.height);
    [aCoder encodeCGPoint:normCenter forKey:@"center"];

     // I rely on view bounds NOT frame
    CGRect normBounds = CGRectMake(0, 0, self.bounds.size.width / self.gameView.bounds.size.width, self.bounds.size.height / self.gameView.bounds.size.height);
    [aCoder encodeCGRect:normBounds forKey:@"bounds"];

     // Here I save the transformation of the view, it has ONLY rotation info, not translation or scalings
    [aCoder encodeCGAffineTransform:self.transform forKey:@"transform"];
}

- (id)initWithCoder:(NSCoder *)aDecoder {
    self = [super initWithCoder:aDecoder];
    if (self) {

        // Restore the screen size of the device that the view was saved on
        saveDeviceGameViewSize = [aDecoder decodeCGSizeForKey:@"saveDeviceGameViewSize"];

        // Adjust the view center
        CGPoint tmpCenter = [aDecoder decodeCGPointForKey:@"center"];
        tmpCenter.x *= self.gameView.bounds.size.width;
        tmpCenter.y *= self.gameView.bounds.size.height;
        self.center = tmpCenter;

        // Restore the transform
        self.transform = [aDecoder decodeCGAffineTransformForKey:@"transform"];

        // Restore the bounds
        CGRect tmpBounds = [aDecoder decodeCGRectForKey:@"bounds"];
        CGFloat ratio = self.gameView.bounds.size.height / saveDeviceGameViewSize.height;
        tmpBounds.size.width *= (saveDeviceGameViewSize.width * ratio);
        tmpBounds.size.height *= self.gameView.bounds.size.height;
        self.bounds = tmpBounds;
    }
    return self;
}

I am really stuck here. I cannot explain what is wrong with this code. The UIViews are correctly positioned when restored on the same device. This is not true when the level is opened on another device. There are slightly misplaced elements and distortions.

Here are two pairs of screenshots demostrating the issues:

What is the correct approach to handle the scaling of the levels on different screens? Should I rely on AutoResizingMasks (I need to support iOS 4 and later)? In any case I would like to give a solid paradigm on how to achieve this.

sentences:
How can I adjust my code to make the objects start dropping at a certain speed and then increase that speed over time? I'm making a game in LibGDX where the player dodges falling objects. At the moment, my code makes each object (in this case 'DROPS') fall at random speeds. I'm wondering if anyone can suggest how to amend this code to make all the objects start falling at the same speed and have this value increase over time. Here is my current code:

for (int i = 0; i < amount; i++) {
        float x = MathUtils.random(0, ManicMeltdowns.WIDTH - TextureManager.DROPS.getWidth());
        float y = MathUtils.random(ManicMeltdowns.HEIGHT, ManicMeltdowns.HEIGHT * 3);
        float speed = MathUtils.random(2, 5);
        addEntity(new Drops(new Vector2 (x, y), new Vector2(0, -speed)));
}

I assume you have to adjust 'float speed', but I'm not sure how.

Many thanks.

-Edit- Here is the drops class:

public class Drops extends Entity{

public Drops(Vector2 pos, Vector2 direction) {
    super(TextureManager.DROPS, pos, direction);

}

@Override
public void update() {
    pos.add(direction);

    if (pos.y <= -TextureManager.DROPS.getHeight()) {
        float x = MathUtils.random(0, ManicMeltdowns.WIDTH - TextureManager.DROPS.getWidth());
        pos.set(x, ManicMeltdowns.HEIGHT);
    }

}

}

And here is the entity class:

public abstract class Entity {

protected Texture texture;
protected Vector2 pos, direction;

public Entity(Texture texture, Vector2 pos, Vector2 direction) {
    this.texture = texture;
    this.pos = pos;
    this.direction = direction;
}

public abstract void update();

public void render(SpriteBatch sb) {
    sb.draw(texture,  pos.x,  pos.y);
}

public Vector2 getPosition() {
    return pos;
}

public Rectangle getBounds() {
    return new Rectangle(pos.x, pos.y, texture.getWidth(), texture.getHeight());
}

public void setDirection(float x, float y) {
    direction.set(x, y);
    direction.scl(Gdx.graphics.getDeltaTime());
}

}

sentences: How to modify Game1.cs out of an object it contains? Assuming I Have a List<SomeClass> myList; in my Game1-class. It also contains an object of SomeOtherClass otherClass;. How would I modify myList (Add/Remove) out of the otherClass's logic? Or in other words how to get access to the Game1-instance in this situation?

sentences:
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:
Using heavyweight ORM implementation for light based games I'm just about to engulf myself in an MVC-based/Component architecture in C#, using MySQL's connector/Net for the data storage, and probably some NHibernate/FluentNHibernate Object-relational-mapping to map out the data structure. The goal is to build a scalable 2D RPG.

Then I think about it...and I can't help but think this seems a little "heavy weight" for a 2D RPG, especially one which, while I plan to incorporate a lot of functionality and entertaining gameplay, may be ported to something like Windows Phone or Android in the future.

Yet, on the other hand even a 2-Dimensional RPG can become very complicated, and therefore must incorporate a lot of functionality. While this can be accomplished with text/XML/JSON for data storage, is there a better way? Is something such as Object-Relational-Mapping useful in such an application?

So, what do you think? Would you say that there is a place for such technologies? I don't know what to think...

sentences:
How to set a Label position after a timer ends, in a repetitive structure? I have this fragment of code. It moves a pawn on a board.

while(i<end)
{
    try
    {
        Thread.sleep(1000);
    }
    catch (Exception e)
    {
       System.out.println(e);
    }
    Label.setBounds(x+i, y, xsize, ysize);
    i++;
}

My problem:
The Label gets set only once, after all the time(end seconds) passes.

Also tried:
1:

while(i<end)
{
    for(int v;v<9999999;v++);
    Label.setBounds(x+i, y, xsize, ysize);
    i++;
}

2:

while(i<end)
{
    for(int v;v<9999999;v++)
    {
        Label.setBounds(x+i, y, xsize, ysize);
    }
    i++;
}

With same result.

sentences:
Label not properly centered in TextButton I'm using LibGDX v1.1.0 and I see that the label of a TextButton is not properly centered. I have the following code:

m_resumeButton = new TextButton("resume", skin);
m_resumeButton.addListener(new ChangeListener() {
    public void changed(ChangeEvent event, Actor actor) {
        m_state = GameState.RUNNING;
        getGame().getWorld().pauseWorld(false);
    }
});

The default TextButtonStyle is defined as:

"com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle": {
    "default": {
        "up": "menu-button",
        "down": "menu-button-down",
        "checked": "menu-button-down",
        "disabled": "menu-button-disabled",
        "font": "font24",
        "fontColor": "white"
    }
}

The menu button images are simple 240x48 bitmaps saved as 9-patch images. An image can be found here to illustrate the problem:

https://www.dropbox.com/s/cwuhu5xb9ro5w6m/screenshot001.jpg

Am I doing something wrong? Or is there a problem with the button images I'm using?

sentences:
Managing data for large number of levels in Unity? I am making a Unity game vaguely in the vein of Candy Crush Saga for a client and am moving in circles trying to decide how to manage the data for all of their levels.

In brief, they want to divide the game into multiple regions that each have 100 levels. For example, you might go to the world map, select Teddy Bear Islands, and then go to the winding-path style level select screen similar to King's "Saga" games. My goal is to have the levels be procedurally generated, so the data for each level will consist of dozen or so parameters instead of hundreds of variables. There will only be one scene, and the levels will be built by running the parameters through an algorithm.

The game isn't a match-3, but for comparison, imagine if your level data for a match-3 was just basic parameters like the number of each type of piece and the target score, and each time you started a level it would randomly arrange pieces based on the input parameters (instead of you manually declaring the position of each piece). The data for a level will look something like:

int targetScore
int levelType
float difficultyModifier
int numPieceA
int numPieceB
int numPieceC
int numPieceD

I haven't worked with such a large data set (in terms of the number of levels) in Unity before and am unsure how to structure it. In a less editor-driven engine, I would probably just store all of the levels in XML files. However, since this is a Unity project I feel like I should be making an editor-based solution that will be easier for the client to work with in the future.

With an XML-driven approach, I imagine that I would have an XML for each region containing all of the 100 levels in that region, and each location on the world map would be linked to one of the XML files. When the user selected a region, it would read the levels into an array, and link each of the 100 level buttons to an array index.

For a more editor-driven approach, I might create custom editor windows where the regions and levels can be defined, and then link the region and level buttons to the data from the editor window (I haven't done much with editor windows yet and am not entirely sure how to tackle this approach). Or I could create a serializable LevelData type and a simple MonoBehavior with a public array of LevelData so that the levels could be defined on GameObjects in the inspector.

Each solution has pros and cons, and I'm stuck on what to do. Is there a conventional approach for managing such a large number of levels in Unity? Should I try one of the above approaches, or is there a better solution?

sentences: Player movement vs world movement in infinite runner game? Well I'm developing a Temple Run or Subway Surfer style infinite runner game. Which is more good? -Moving the player and make the Main Camera follow, or keep the player in one position and move the generated worlds? And the generated paths or worlds will have many animations in it. So which choice ouuld be good and why?

sentences:
Bullet Physics Scaling rotational part of 6DoF Spring Damper I am currently trying to scale up my setup (consisting of two rigid bodies connected by a btGeneric6DofSpring2Constraint) to fall within the suggested dimensions for a concise simulation.

In order to do so, I followed to the provided Wiki http://www.bulletphysics.org/mediawiki-1.5.8/index.php?title=Scaling_The_World.

I scaled all the linear properties and concerning the resulting forces, everything turned out physically consistent.
Note that I did not scale up the liner and angular stiffness and damping values.

However I encountered significant deviations concerning the spring-related torques resulting due to a angular spring offset. I guess that this issue arises due to the fact that the torques should be scaled (*scale^2) as well. However I do not see a way of scaling the internal torque representation of the btGeneric6DofSpring2Constraint. Should i simply scale up the angular spring stiffness and spring damping by a factor (*scale^2) or is there a better more elegant way to retrieve physically consistent results (forces, torques, motion) when trying to scale a world containing the btGeneric6DofSpring2Constraint?

EDIT:
I was able to boil it down to the following:

The rotational stiffness and damping vales are chosen independent from the scale.

The stiffness itself does not alter the behavior of the system. The deviations are caused entirely by the damping part. An experiment with altering the scale and non-existent damping showed results independent from the scaling factor, just as desired (K_stiff = 20.0, K_damp = 0.0):.
]

However when repeating the same experiment with no stiffness and a positive damping factor, significant differences arise when scaling up. (K_stiff = 0.0, K_damp = 9.0): The image denotes the system responses for different scales.

I found the corresponding code snippet in

        btScalar fs = ks * error * dt;
    btScalar fd = -kd * (vel) * (rotational ? -1 : 1) * dt;
    btScalar f = (fs+fd);

    info->m_constraintError[srow] = (vel + f * (rotational ? -1 : 1)) ;

    btScalar minf = f < fd ? f : fd;
    btScalar maxf = f < fd ? fd : f;

    //printf("%.3lf\n",f);
    if(!rotational)
    {
        info->m_lowerLimit[srow] = minf > 0 ? 0 : minf;
        info->m_upperLimit[srow] = maxf < 0 ? 0 : maxf;
    }
    else
    {
        info->m_lowerLimit[srow] = -maxf > 0 ? 0 : -maxf;
        info->m_upperLimit[srow] = -minf < 0 ? 0 : -minf;
    }

    info->cfm[srow] = cfm;
    srow += info->rowskip;
    ++count;
}

Interestingly, the scaling works just fine if the if clause is commented out. Any sugestions why this happens?

sentences:
Use Stage's draw() method to invoke Actor's draw method in Libgdx Question :
In the following snippet, I wish to draw different shapes such as rectangles, circles, triangles etc. I will be creating different class files for each of such objects, as I did for Rectangle class here.

I've been trying to invoke the draw method of Rectangle object from Stage object, but I am unable to do so. If I make a plain call to the draw method of the Rectangle object, I can draw the object.

Can some one suggest me how is this possible ?
Also, I had many other queries which I'd tried to put in comments. Please have a look at them and kindly help me in figuring out the concept beneath it.

Disclaimer : I am new to game programming, started with Libgdx.

Following is the Scan class :

package com.mygdx.scan.game;

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
import com.badlogic.gdx.scenes.scene2d.Stage;

public class Scan extends ApplicationAdapter {
private Stage stage;
public static ShapeRenderer shapeRenderer;

@Override
public void create () {
    stage = new Stage();
    shapeRenderer = new ShapeRenderer();
    Rectangle rect1 = new Rectangle(50, 50, 100, 100);
    stage.addActor(rect1);

}

@Override
public void render () {
    Gdx.gl.glClearColor(1, 1, 1, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    shapeRenderer.setProjectionMatrix(stage.getCamera().combined);
    shapeRenderer.begin(ShapeType.Filled);
    shapeRenderer.setColor(Color.BLACK);
    //new Rectangle(50, 50, 100, 100).draw();
    shapeRenderer.end();
    // This should call Rectangles draw method. I want a Shapetype.Filled Rectangle.
    // But I'm unable to invoke this method if I add the actor in stage object and invoke it's draw method.
    stage.draw();
}

public void dispose() {
    stage.dispose();
}
}

Following is the Rectangle Actor class :

package com.mygdx.scan.game;

import com.badlogic.gdx.scenes.scene2d.Actor;

public class Rectangle extends Actor {

float xcord, ycord, width, height;
public Rectangle(float x , float y , float width, float height) {
    this.xcord = x;
    this.ycord = y;
    this.width = width;
    this.height = height;
}

// This needs to be called in the Scan class. I just want the draw       method to be invoked.
// Also I wish to draw many such rectangles. What is the best practice to get hold of ShapeRenderer object from Scan class ?
// Should I use one instance of  ShapeRenderer object in Scan class or should I create ShapeRenderer object for each of the Rectangle object ??
// I also plan to repeat the activity for another object such as circles. So I would like to know the best practice here.
public void draw() {
    Scan.shapeRenderer.rect(this.xcord, this.ycord, this.width, this.height);
}

}

sentences: Is there a way to apply euphoria physics (ragdoll) to rigged Sprites in Unity2D? With euphoria physics I mean the realistic object interaction and freefall as seen in most games like recent GTAs. But I want to do that in 2D. (I am a beginner :P).

sentences:
how to make turret only shoot when pressing in specific location? im using this code to shoot bullets from turrets, it is working perfectly but what i want to do is that, if i ll click mouse at the bottom of it it will still shoot i want it to only shoot if i will click on those positions i ll attach image to explain what i want to do here is my code:

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

public class shoot : MonoBehaviour {
    public Rigidbody2D projectile;
    public Transform fireTransform;
    public GameObject missilePrefab;
    public float fireForce = 90000;
    public Transform projectileSpawnPoint;
    public float projectileVelocity;
    public float timeBetweenShots;
    private float timeBetweenShotsCounter;
    private bool canShoot;
    protected Animation Animation;

    void Awake() {
        Animation = GetComponent<Animation> ();
    }
    void Start () {
        canShoot = false;
        timeBetweenShotsCounter = timeBetweenShots;
    }

    void Update () {
        if (Input.GetMouseButton(0) && canShoot)
        {
            GameObject missile = Instantiate(missilePrefab, fireTransform.position, transform.rotation);
            Animation.Play ();
            Rigidbody2D missileBody = missile.GetComponent<Rigidbody2D>();
            AudioSource audio = gameObject.AddComponent < AudioSource > ();
            audio.PlayOneShot ((AudioClip)Resources.Load ("sh"));
            missileBody.AddForce(transform.forward * fireForce);
            canShoot = false;
        }
        if (!canShoot)
        {
            timeBetweenShotsCounter -= Time.deltaTime;
            if(timeBetweenShotsCounter <= 0)
            {
                Animation.Stop ();
                canShoot = true;
                timeBetweenShotsCounter = timeBetweenShots;
            }
        }
    }
}

sentences:
Simple 2d tile based lighting in xna I am currently trying to implement simple lighting into my game. My world is represented in a 2d array of numbers, each number being a certain tile. I am changing the color parameter in the spritebatch.Draw method to dim the tiles, and that is working quite well for me(I don't know how to use shaders).Each tile can have a light level from 0 to 5, and depending on its level it will be brighter/darker. The problem I have is that I used this code to simulate lighting:

public void Update()
    {
        foreach (NonCollisionTiles tile in nonCollisionTiles)
        {
            foreach (NonCollisionTiles otherTile in nonCollisionTiles)
            {
                if (otherTile.Rectangle.X  == tile.Rectangle.X && (otherTile.Rectangle.Y / size == tile.Rectangle.Y - 1 || otherTile.Rectangle.Y / size == tile.Rectangle.Y + 1))
                {
                    if (tile.Light < otherTile.Light)
                    {
                        tile.Light = otherTile.Light - 1;
                    }
                }
                else if (otherTile.Rectangle.X / size == tile.Rectangle.Y && (otherTile.Rectangle.X / size == tile.Rectangle.X - 1 || otherTile.Rectangle.Y / size == tile.Rectangle.X + 1))
                {
                    if (tile.Light < otherTile.Light)
                    {
                        tile.Light = otherTile.Light - 1;
                    }
                }
            }
        }
    }

But I'm not sure if it works or not and it lowers my FPS to 1. I have no idea as to how I can implement my lighting system. Essentially, I want it to look like a torch in Minecraft, but in 2d. Here is the code for my tiles:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;

namespace Tile_Map
{
class Tiles
{
    protected Texture2D texture;
    protected int light = 1;
    public int Light
    {
        get { return light; }
        set
        {
            light = value;
        }
    }
    protected Color color;
    private Rectangle rectangle;
    public Rectangle Rectangle
    {
        get { return rectangle; }
        protected set { rectangle = value; }
    }
    private static ContentManager content;
    public static ContentManager Content
    {
        protected get { return content; }
        set { content = value; }
    }

    public void Update()
    {
        color = new Color(light*51,light*51,light*51);
    }
    public void Draw(SpriteBatch spriteBatch)
    {
        spriteBatch.Draw(texture, rectangle, null, color, 0, Vector2.Zero,SpriteEffects.None,0f);
    }
 }

class CollisionTiles : Tiles
{
    public CollisionTiles(int i, Rectangle newRectangle)
    {
        texture = Content.Load<Texture2D>(@"Images\Tile" + i);
        this.Rectangle = newRectangle;
    }
}
class NonCollisionTiles : Tiles
{
    public NonCollisionTiles(int i, Rectangle newRectangle)
    {
        texture = Content.Load<Texture2D>(@"Images\Tile" + i);
        this.Rectangle = newRectangle;
    }
}
}

This is what I am trying to do:

Any help is appreciated!

sentences:
Common ways to keep up with character state in a 2D game? I am currently developing a 2D Blockdude clone for learning purposes and am wondering about storing character state in the game. For example, the character can be facing either right or left. What are some common ways of handling character state? Unfortunately, the question is so broad none of my searches have come up with anything (or maybe I'm searching for the wrong terms). Should I be using a state machine?

How I'm doing it now using the "character facing" example (code is Java):

enum CharacterFacing {
    RIGHT, LEFT
}

class Character {
    CharacterFacing facing;

    Character() {
        // start with the character facing right
        facing = CharacterFacing.RIGHT;
    }

    // called when the player hits the left arrow
    void moveLeft() {
        facing = CharacterFacing.LEFT;
    }

    // called when the player hits the right arrow
    void moveRight() {
        facing = CharacterFacing.RIGHT;
    }
}

Because the "facing" state is so simple, I've also thought about just a boolean:

class Character {
    boolean facingRight;

    Character() {
        // start with the character facing right
        facingRight = true;
    }

    // called when the player hits the left arrow
    void moveLeft() {
        facingRight = false;
    }

    // called when the player hits the right arrow
    void moveRight() {
        facingRight = true;
    }
}

sentences:
How to implement swooping movement? I am trying to code some swooping behavior for a flying enemy in my 2D platformer.

The ideal behavior has the enemy starting from an arbitrary height above the ground, then accelerating downward and horizontally until flush with the ground, after which he slows and comes to a rest.

I would like to code this in such a way that I can adjust a parameter controlling the steepness of the curve.

In other words, I want a kind of asymptotic movement, similar to this:

https://www.mathsisfun.com/algebra/asymptote.html

How can I code this kind of movement in such a way that my enemy can start from any height and smoothly and elegantly accelerates down this kind of curve before gracefully stopping?

I have recourse to all the usual stuff (for example, acceleration, velocity, friction, raycasts, etc.). I would prefer to code the movement using this stuff, rather than hardcoding movement along a curve or path.

I was thinking it might be possible to achieve what I want by raycasting downward and getting the enemy's distance from the ground, and using this distance to adjust accelerations and velocities, but I'm not exactly sure how to go about it.

I work in Godot, but would like an engine-neutral explanation of how to achieve this kind of behavior.

sentences:
Spawning 5 bullets at once and checking if alive, gives an error I am developing a game for my University project and came across a problem with pointers. I have a vector of bullets that has every bullet checked for collisions. But, when I try to spawn 5 bullets at once (shotgun shot), it spawns everything correctly, then I go through the vector and check if the bullet is alive. For some reason it finds a NULL pointer or a corrupted data of a pointer. Would be really appreciated if someone knew how to fix this. Thanks!

Bullet check:

void Bullet::checkOutOfRange()
{
    if(type == "enemy_bullet")
    {
        if(body->GetPosition().x <= -10.0f)
        {
            alive = false;
        }
    }
    // checks if the body is out of the window size
    else if (body->GetPosition().x > 510.0f || body->GetPosition().x < -10.0f || body->GetPosition().y > 291.0f || body->GetPosition().y < -10)
    {
        alive = false;
    }
}

Bullet collision detection:

class MyContactListener : public b2ContactListener
{
    void BeginContact(b2Contact* contact) override
    {
        if (contact && contact->IsTouching())
        {
            Entity* A = static_cast<Entity*>(contact->GetFixtureA()->GetBody()->GetUserData());
            Entity* B = static_cast<Entity*>(contact->GetFixtureB()->GetBody()->GetUserData());

            //------
            if((A->type == "player_bullet" && B->type == "enemy") || (A->type == "enemy" && B->type == "player_bullet"))
            {
                Bullet *bullet = nullptr;
                Enemy *other = nullptr;
                if (A->type == "player_bullet" && B->type == "enemy")
                {
                    bullet = dynamic_cast<Bullet*>(A);
                    other = dynamic_cast<Enemy*>(B);
                }
                else if (A->type == "enemy" && B->type == "player_bullet")
                {
                    bullet = dynamic_cast<Bullet*>(B);
                    other = dynamic_cast<Enemy*>(A);
                }
                if ((A && B) || (B&&A))
                {
                    other->bodySprite.set_animation("death");
                    bullet->alive = false;
                    other->alive = false;
                }
            }
        }
    }
}

Bullet check in game:

    for (auto itr = player_bullets.begin(), itrEnd = player_bullets.end(); itr != itrEnd; ++itr)
    {
        (*itr)->checkOutOfRange(); // go to declaration to see where the bullets stop
        (*itr)->bodySprite.set_position((*itr)->body->GetPosition().x, (*itr)->body->GetPosition().y);
        (*itr)->bodySprite.set_rotation((*itr)->bulletDir * 180 / PI);
        (*itr)->moveBullet(20.0f);
        if ((*itr)->alive == false)
        {
            input_world->DestroyBody((*itr)->body);
            delete *itr;
            itr = player_bullets.erase(itr);
        }
    }

Shotgun shot spawn:

void spawnShotgunShot(float x, float y, float dir, b2World *world)
{
    // maybe bad pointer management?
    Bullet *bullet_ptr1 = new Bullet(x, y, dir, world, "player_bullet", PLAYER_BULLET, ENEMY);
    player_bullets.push_back(bullet_ptr1);
    Bullet *bullet_ptr2 = new Bullet(x, y, dir + 0.5, world, "player_bullet", PLAYER_BULLET, ENEMY);
    player_bullets.push_back(bullet_ptr2);
    Bullet *bullet_ptr3 = new Bullet(x, y, dir + 0.25, world, "player_bullet", PLAYER_BULLET, ENEMY);
    player_bullets.push_back(bullet_ptr3);
    Bullet *bullet_ptr4 = new Bullet(x, y, dir - 0.5, world, "player_bullet", PLAYER_BULLET, ENEMY);
    player_bullets.push_back(bullet_ptr4);
    Bullet *bullet_ptr5 = new Bullet(x, y, dir - 0.25, world, "player_bullet", PLAYER_BULLET, ENEMY);
    player_bullets.push_back(bullet_ptr5);
}

And here is a testbuild with the sln in it:
Link to testbuild

sentences:
Specular light for DirectX11 I illumine model through model illumine of Phong. Ambient and diffuse light’s constituent work well, but specular works wrong. Under this message I sent screenshoots:
1) ambient and diffuse

2) ambinet + diffuse + specular.

Code shader's. Vertex's:

    cbuffer ConstantBufferVS
    {
    matrix World;
    matrix View;
    matrix Perspective;
    }

    struct VS_INPUT
    {
    float4 Pos: POSITION;
    float3 Normal: NORMAL;
    float4 Color: COLOR;
    };

    struct VS_OUTPUT
    {
    float4 Pos: SV_POSITION;
    float3 Normal: TEXCOORD0;
    float4 Color: COLOR0;
    float3 WorldPos: TEXCOORD1;
    };

    VS_OUTPUT main(VS_INPUT input)
    {
    VS_OUTPUT _out = (VS_OUTPUT)0;
    _out.Pos = mul(input.Pos, World);
    _out.Pos = mul(_out.Pos, View);
    _out.Pos = mul(_out.Pos, Perspective);
    _out.Normal = (float3)mul(float4(input.Normal, 1), World);
    _out.Color = input.Color;
    _out.WorldPos = (float3)mul(input.Pos, World); // position vertex in world
    return _out;
    }

Pixel's:

    cbuffer ConstantBufferPS
    {
    float4 Direction;
    float4 Color;
    float4 factors;
    float4 View; // position camera, 0, 2, -3
    }

    struct VS_INPUT
    {
    float4 Pos: SV_POSITION;
    float3 Normal: TEXCOORD0;
    float4 Color: COLOR0;
    float3 WorldPos: TEXCOORD1;
    };

    float4 main(VS_INPUT input): SV_Target
    {
    // ambient
    float4 ambient = (Color * factors.x) * input.Color;

    // diffuse
    float4 diffuse = saturate(dot((float3)Direction, input.Normal) * Color);

    // TODO
    // specular
    float4 specular = 0.0;
    float3 vView = normalize((float3)View - input.WorldPos); // vector from pixel towards eye
    float3 vReflect = reflect((float3)normalize(Direction), normalize(input.Normal)); // merror vector direction light
    // нормалью
    float spec = pow(dot(vReflect, vView), 64); // calculate spec
    specular = spec * factors.y * Color; // calculate specular light

    // multiply light's component's
    float4 out_color = (ambient + diffuse + specular) * input.Color;
    out_color.a = 1;

    return out_color;
    }

All the moments are commented on.

sentences:
Creating 2D billiard game with realistic movement I'm new to XNA and game programming.

I'm creating a 2D billiard game and I want to add balls with realistic movement (like 3D). Is it possible to achieve this without using 3D models? I only want to use 2D. Please give me examples.

sentences: Do I need an Indie Studio Name? I've recently been making a mobile game which I'm going to publish to Google Play. Google Play requires a Developer Name. Most Google Play Developer use their game studio name like Gameloft, Supercell, etc. But some indies use their names as the developer name like Scott Cowthon, FNAF Developer. I was wondering what are the advantages and disadvantages of each type to me as the only developer of my game?

sentences:
Timer in turn based game I'm writing a small turn-based game using libgdx.
How to make a timer on the player turn to make it work even when the game loses focus??

Or maybe there are some other ways to do it???

sentences: Chess engine on which to apply a custom-made OpenGL skin Is there any open source chess engine that I can use to practice my OpenGL skill-set? I think it would be a neat exercise.

sentences:
Game Physics: Implementing Normal Reaction from ground correctly I am implementing a simple side scrolling platform game. I am using the following strategy while coding the physics:

Gravity constantly acts on the character.
When the character is touching the floor, a normal reaction is exerted by the floor.

I face the following problem:

If the character is initially at a height, he acquires velocity in the -Y direction. Thus, when he hits the floor, he falls through even though normal force is being exerted. I could fix this by setting the Y velocity to 0, and placing him above the floor if he has collided with it. But this often leads to the character getting stuck in the floor or bouncing around it. Is there a better approach ?

sentences:
SFML game loop and FPS problems I've been building an SFML engine and I've been very confused on the FPS, frame independent movement and game loop.

My particular problem is that I have a variable set to 60 for the frame limit but changing this value doesn't seem to change the frame limit. I used the built in SFML window function to set a limit and it seems to work.

Am I doing something wrong with this loop?

while (mWindow.isOpen())
{
    time=renderClock.getElapsedTime();
    float fFps=1000000/time.asMicroseconds();
    std::stringstream s;
    s<<fFps<<" fps";
    fps.setString(s.str());
    renderClock.restart();

    const sf::Int64 frameTime = 1000000/FRAMES_PER_SECOND;
    sf::Clock c;
    sf::Time t=c.getElapsedTime();
    sf::Int64 nextFrameTime=t.asMicroseconds()+frameTime;

    int loops = 0;
    while( t.asMicroseconds() < nextFrameTime && loops < MAX_FRAMESKIP)
    {
        processEvents();
        updateTime=updateClock.restart().asMilliseconds();
        update(updateTime);
        t=c.getElapsedTime();
        loops++;
    }

    render();
}

Here's a link to my full code: https://github.com/csharpest94/SFML/blob/master/src/Game.cpp

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:
Configuring Implicit Multi-GPU Rendering Driver Settings Programmatically What is available to game developers to take advantage of implicit multi-GPU rendering technologies as of 2016? For this question I will only be asking about Nvidia's SLI and AMD's Crossfire technologies as they apply to rendering in OpenGL and Direct3D, specifically non-ancient versions of these APIs like OpenGL core 3.3+ and Direct3D 10.0+.

What tools do developers have access to, to programmatically detect and alter the state of implicit multi-GPU rendering for their game?

A key component of this question is what is openly available to independent developers, SLI and Crossfire aren't problems to AAA developers who get GameReady drivers tweaked to enhance the performance of their game and have SLI profiles included within the driver. What is available for smaller developers to take advantage of multiple GPUs?

At the very least, is there anything that developers can do to reduce the negative effects that these technologies can cause? Is there a way to avoid a FPS drop or artifacts that come with SLI/Crossfire bugs, can a developer programmatically disable SLI or Crossfire?

With all of this, how is the cross-platform support? Is there a solution for these issues that will work across Windows, Linux, and OSX? Will it work with OpenGL and Direct3D? Can it run out of the box or packaged with your game?

sentences:
Opengl rotate around global axis I want to create a game in which I rotate a cube around 2 fixed axes(x and y) using my mouse.

Here is what I want to do. Just use the mouse to see what kind of rotation I want.

I calculated my yaw and pitch values according to mouse movement and they work fine when I try to rotate only around one axis(x or y), but when I try to rotate around both axes it doesn't work(because OpenGL rotates axes when you apply a rotation). How do I make them both work at the same time? Here my code:

glm::mat4 model;
glm::mat4 view;
glm::mat4 projection;

float cameraDistance=3.0;

glm::vec3 center=glm::vec3(0.0f, 0.0f, 0.0f);
glm::vec3 cameraFront = glm::vec3(0.0f, 0.0f, -1.0f);
glm::vec3 cameraUp    = glm::vec3(0.0f, 1.0f,  0.0f);
glm::vec3 modelDistance= glm::vec3(0.0,0.0,3.0);

int oldX,oldY;
GLfloat yaw   = 0.0f; // Yaw is initialized to -90.0 degrees since a yaw of 0.0
                      // results in a direction vector pointing to the right (due
                      // to how Euler angles work) so we initially rotate a bit
                      // to the left.
GLfloat pitch =   0.0f;

while (running)
{
    oldX=sf::Mouse::getPosition(window).x;
    oldY=sf::Mouse::getPosition(window).y;

    yaw=oldX*0.1;
    pitch=oldY*0.1;

    projection = glm::perspective(45.0f, (GLfloat)WIDTH / (GLfloat)HEIGHT, 1.0f, 100.0f);

    view=glm::mat4();
    view = glm::lookAt(center+modelDistance, center+modelDistance + cameraFront, cameraUp);

    model= glm::mat4();

    //Here is the problem,how do i use both at the same time?
    model=glm::rotate(model,glm::radians(yaw),glm::vec3(0.0,1.0,0.0));
    model=glm::rotate(model,glm::radians(pitch),glm::vec3(1.0,0.0,0.0));
    //
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    ourShader.Use();

    GLint modelLoc = glGetUniformLocation(ourShader.Program, "model");
    GLint viewLoc = glGetUniformLocation(ourShader.Program, "view");
    GLint projLoc = glGetUniformLocation(ourShader.Program, "projection");

    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, 27*n*n);

sentences:
XNA Shader Texture Memory I was wondering about texture optimization in XNA 4.0.

Will the the contentmanager send the texturedata to the GPU directly when the texture gets loaded or do I send the texture data to the GPU when I declare a texture in my shader.

If that's the case, what happens if I have 5 shaders all using the same texture, does that mean that I send 5 instances of that texture data to the gpu or am I simply telling the GPU what preloaded texture to use?

Or does XNA do the heavy lifting in the background?

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

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

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

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

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

sentences:
How to do starcraft pathfinding? I've been trying to figure out how to implement something like the pathfinding in Starcraft 2. I'm not looking for all the sophisticated features like flocking, queueing, etc. In fact I like how in Starcraft 1 the units would interfere with each other. But I do want a path finder better than that used in Starcraft 1.

From the Google searches I've done the various answers have something to do with A* over a navigation mesh and/or dealing with some kind of "visibility graph". But I've gotten somewhat conflicting or unclear answers on what I should do.

One thing I read about has something to do with doing A* over the vertices of a triangle mesh (the navigation mesh). And then somehow "straightening out the path" which I don't know how to do. But that doesn't guarantee optimality right?

Another question I had is how does the starcraft 2 pathfinding deal with the fact that the units are discs with a finite radius and not points when dealing with corners? And how to deal with dynamic obstacles like idle units or even other moving units.

I'm looking for some gritty detailed explaination and not the generic super high level overviews that are typical in search results.

If it matters I've already looked at Amit’s Notes about Path-Finding. I've heard of but not read Computational Geometry: Algorithms and Applications. And a blog post about a AI navigation presentation at GDC 2011 mentioned that Starcraft 2 uses a constrained delaunay triangulation for a navmesh. Although the blog post mentions Boids steering and "horizon analysis", it doesn't mention exactly how the core pathfinding is done on the navmesh.

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:
How to get Entitas components from gameObject.getEntityLink() I'm new to Entitas. I have a DamageSystem that should Physics.Raycast() toward the target and if tag is enemy it should reduce enemy health.

I have HealthComponent:

public class HealthComponent: IComponent{

public float value;

}

In DamageSystem I wanna do something like:

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

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

}

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

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

sentences:
What is the velocity of a translating projectile in 2D? What I'm trying to do.

So I want to have a projectile that starts at point (x1, y1) and head in the direction of my mouse say point (x2, y2).

To clarify I'm pretty sure it's a vector but I don't know much about them.

Language / Librarys

I'm making the game in Java and LibGDX so Java.MathUtils would come in to play i'm pretty sure. If anyone that can answer don't know these languages, psuedocode will be just fine.

How I've tried it

I'm pretty sure the formula is something alongs the lines of
velX := cos(radians) * speed
velY := sin(raidans) * speed

And radians starts out as Pi/2 though the tutorial was pretty rough.

Then it would be x += velx * deltatime  and same with y.

Can anyone help me out with the translation formula

sentences:
Simplest way to make a car follow a route To get the cars to follow the circuit, I mapped the circuits to several points. And using the move_towards_point function I make everything happen correctly.

In addition, I use two objects: object 1 / pink square => to be followed by the cars, object 2 \ green square => to reset the car collision with object 1 (so that the collision with object 1 only happens once).

Sometimes I have to make an adjustment in the position of object 2, because it has to be in the path between two objects 1, otherwise it will not clear the collision.

I thought there would be another solution considering that I've seen in video tutorials a platform games function (usually used on villains so they do not fall into the void).

If I am not mistaken, it is as if at any moment the object throws a particle, and if it did not reach anything until a certain moment or height (y), the object would turn around and run in the opposite direction.

I imagine there is a function similar to this to use in my case. So that you detect the circuit object and do not let the car get out of it.

It's hard enough to have to put up points, then move the position of each of them to the code (I had to do this, because I preferred to create only one object and keep repeating it all over the circuit, I could have created several. Ex => point 1, point 2, ...).

Not wanting to plagiarize, but an example of what I want for my game, is this game:

Game: https://play.google.com/store/apps/details?id=com.moz.flracing2016.pro&hl=pt_BR

Video of game: https://www.youtube.com/watch?v=knZRQZI25Fo

sentences:
A.I. dependencies based on components I'm working on a turn based game in Unity. I need to perform field/grid analysis(2D grid) when i'm iterating trough each unit "entity". The A.I. should be able to plan ahead and therefor needs to consider the components each unit have. Not every unit will have the same ability. These abilities are defined as components.

I want to make it flexible in the sense that I can plug in new abilities and my A.I. will take it into consideration.

While user control is somewhat implemented, A.I. hasn't even been written. So I'm open to any suggestion.

Q : What is a way for the A.I. system to collect all abilities of one unit and make decisions depending on each component?

edit:
I know there is the "null" checking method to see if the gameobject contains a component. But this is highly inflexible because you are hard coding a stack of if else. Something I want to prevent.

sentences:
Flow effect to static water on a isometric city Hello everyone I want to give the idea that the river in my city is flowing but I am having an hard time to figure how.

Do you have any idea of what I should look into to?

sentences: 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:
How to sample from six cubemap images for a skybox in Shader Graph? I'm trying to update a skybox shader to URP and reimplement it in Shader Graph.  The shader code itself is pretty straightforward, but I don't know enough about Shader Graph yet to set up the basic skybox.

It's a standard cubemap skybox made up of six textures for +x, -x, +y, -y, +z, and +z.

Trying to Google different variants of "unity shader graph cubemap skybox" turns up tons of noise and nothing actually useful that I can see.

Does anyone know what the basic node setup is I would need to input six images and output a skybox?

sentences:
Rotating Weapon Towards mouse.position OK guys i have tried lots of things and researched but cannot find a solution please someone give me hope.. So on my phone when i am playing i want to shoot with a screen button in the canvas that is the entire screen size, and when i click it i can shoot towards where my finger is clicked "This works"... now my problem is whilst i am shooting when i also use my up and down button to move my player at the same time my gun stops moving towards my finger and instead moves towards my up and down buttons.. What can i do to fix this?

public void ShootButton()
    {

    timer = 0;
    Face = true;
    //if finger is press on Shootbutton
    //then activate this
    Vector3 difference = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position; // subtracting the position of the player from the mouse position.
    difference.Normalize(); //normalizing the vector meaning all the sum of the vector will be = to 1.

    float rotZ = Mathf.Atan2(difference.y, difference.x) * Mathf.Rad2Deg;//find the angle in degree.
    WeaponTrans.transform.rotation = Quaternion.Euler(0f, 0f, rotZ + rotationOffset);
    if (reloading == false)
    {
        if (fireRate == 0)
        {
            {
                Shoot();
            }
        }
        else
        {
            if (Time.time > timeToFire)
            {
                timeToFire = Time.time + 1 / fireRate;
                Shoot();
            }
        }
    }
}

sentences:
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: What makes in-game tutorials effective? Has there been any research into how to maximize in-game tutorials effectiveness? Any blogs, articles or research papers would be appreciated.

sentences:
Unity / Box2D / Raycasting and Performance Im currently using the Unity Engine and the Box2D Physics Engine.

I have this line of code:

    "RaycastHit2D ray = Physics2D.Raycast(origin, direction, distance);"

Im planning to use this line of code ... like "a lot" times (maybe like 100.000 times per frame)

And I have 3 simple Questions about Raycasting and Performance:

How much does 1 Raycast cost (approximately).
Is the Raycast processed by the CPU now or by the GPU?
Does the number of the BoxColliders affect the cost of the Raycast? (for example:
If I have 1000.000 Tiles on the map which have box Colliders, does one ray has the same performance cost as if i would have 1 single Tile?
And if I have 1000.000 tiles - is the cost millionfold then?

sentences:
Trying to understand exactly how the server sends data to the client to prevent malicious actions I recently started coding a game with one of my friends and he is taking care of the front end and I am doing the back end.

I read many blogs/articles/tutorials on how the back end communicates with the client side and they all show different ways of doing this.

In our game the player can move his character by right clicking where they want to go. Does this mean the movement happens on the client side or should the client send a coordinate to the server and the server checks if its valid and responds with 'move_verified' which then allows the client side to carry out the action?

If this is the case how does collision take place because it will have many calculations and can cause major stress on the server. but doing it client side will make it vulnerable to malicious scripts.

The game needs to be in real time and 10 people will be playing simultaneously in a single match.I know the coords of all players have to be constantly sent to the client from the server so each player can see all players.

We are using Unity and socket.io. We successfully got communication with one another. But I just want to make sure I am on the right track before I start going deeper into the code.

I can show my code if its needed but its bare bones connections.

Thanks in advance!

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:
box2d rendering performance degrading extremely even with sleeping bodies? I'm working on my first smartphone game, a simple 2D platformer built with libgdx. Game maps use the Tiled level format, so a map is just a bunch of blocks. I recently started using box2d to implement character collision and movement.

So this is probably naive, but what I did is for a level consisting of 64x50 (= 3200)  blocks, I added a static body for every block to represent the physics for this geometry. I set these blocks to sleep, which I thought would be a hint for box2d to disregard these blocks when stepping the simulation unless they're actually interacting with the player (the only dynamic body), so this shouldn't hinder performance very much? I recall reading in the box2d manual that it employs a spatial algorithm to only even look at the bodies relevant to render the current frame.

Yet having these 3500 sleeping static bodies degrades performance to such a degree that even when running the game on my MacBook Pro 2012 in a Genymotion emulator, I get about 5 FPS.

I suppose I'm doing something terribly wrong. My questions would be:

when dealing with bodies in the thousands, am I supposed to remove/add box2d bodies for my level geometry dynamically to improve performance, e.g. based on a fixed box around the player? that sounds painful and I'm wondering why the library wouldn't be able to figure out itself
maybe I've just made a mistake mapping map tiles to box2d bodies? I've posted my setup code below

Any help appreciated.

Here's how I attach the static bodies to the level geometry; it just walks the map and creates a static body for every block:

private void addB2Bodies(World b2World) {
    for (int row = 0; row < blocksLayer.getHeight(); row++) {
        for (int col = 0; col < blocksLayer.getWidth(); col++) {
            BodyDef bodyDef = new BodyDef();
            bodyDef.type = BodyDef.BodyType.StaticBody;
            bodyDef.awake = false;
            bodyDef.position.set(col + 0.5F, row + 0.5F);

            final PolygonShape shape = new PolygonShape();
            shape.setAsBox(0.5F, 0.5F);
            FixtureDef fixtureDef = new FixtureDef();
            fixtureDef.shape = shape;
            fixtureDef.friction = 0;

            final Body body = b2World.createBody(bodyDef);
            body.createFixture(fixtureDef);
            blocks[col][row] = body;
        }
    }
}

I only have one dynamic body, the player. As for the simulation, I step it at 1 / 60, with the default/recommended iteration counts of 6 and 2.

sentences: Simulated 3D hit point from surface normal Here is an illustration describing what I'm trying to do...

sentences:
Canvas tile grid, hover effects, single tilesheet, etc I'm currently in the process of building both the client and server side of an HTML5, canvas, and WebSocket game.

This is what I have thus far for the client: http://jsfiddle.net/dDmTf/20/

Current obstacles

The hover effect has no idea what to put back after the mouse leaves. Currently it's just drawing a "void" tile, but I can't figure out how to redraw a single tile without redrawing the whole map.
How would I go about storing multiple layers within the map variable? I was considering just using a multi-dimensional array for each layer (similar to what you see as the current array), and just iterating through it, but is that really an efficient way of doing it?
Currently the "borders" encroach on one another. I'm not sure what I'm doing wrong? If you hover over and off of the bordering "tree" tiles, you'll notice how it removes part of the neighboring tiles border. This shouldn't need to happen.
Outside of the map, what would be an elegant way of adding Players to the render scene? I've seen a few places that recommend you use multiple canvas's, would you recommend that since they'll probably be moving much more? In addition to that, how can I confine player movement to the grid, similar to how in the pokemon gameboy games, when you tap the left arrow, you always move one "space" that direction. It's not a halfway type deal.
Camera. What would be a good way about adding a "camera" to the equation, so the viewport can pan around a larger map area?
Obstacles. In the newer version of the map, you'll notice an empty obstacles array. Assuming players get added well, what do you think would be good for adding movement obstacles?

Side note

The tile sheet being used for the jsfiddle display is only for development. I'll be replacing it as things progress in the engine.

If you guys have any pointers for my JavaScript, feel free. As I'm more or less learning advanced usage as I go, I'm sure I'm doing plenty of things wrong.

Note: I will continue to update this post as the engine improves, but updating the jsfiddle link and updating the obstacles list by striking things that have been solved, or adding additions.

Edit

Updated link from http://jsfiddle.net/dDmTf/7/ to http://jsfiddle.net/dDmTf/17/ - this handles the "hover" problem, and it's been striked out.

Edit

Updated link from http://jsfiddle.net/dDmTf/17/ to http://jsfiddle.net/dDmTf/19/ - fixes the out of bounds issue with the tiles

Edit

Updated link from http://jsfiddle.net/dDmTf/19/ to http://jsfiddle.net/dDmTf/20/ - adds multiple layers to the equation

sentences:
Scene doesn't load in editor but loads perfectly fine in final build When my character dies the game is supposed to load a new scene. The code is perfectly fine because it does this when I make a web build for it. But in the editor I get this:

I have no idea what the issue could be, everywhere I've looked online seems to have the opposite problem (IE: it works fine in the editor but not in the final build). Any help would be appreciated.

sentences:
Best way to store items with statistics in an mysql database? Im currently working on an multiplayer game. Therefore using MySql for my game to store different data ( For example players, resources and so on ).

Lately i implemented items, players receive them by gathering resources for example, later they should also be able to craft them or even equip them if its a sword or an armor piece.

My problem is that due to my small experience with MySql, i have no clue how to add different statistics ( Equipable, Damage, Different Effects and so on ) to the items. Not every item should have them ( For example "Wood" shouldnt have statistics ).
How should i modify my tables ? Any help would be appreciated ! Thanks !

My current table structure looks like this :

ItemCategories ( ID, Name )
ItemTypes ( ID, Name, ItemCategories_ID )

For more information, how i actually manage/spawn those items in... here two more important tables.

This table contains resources ( For Example "Basic Tree" ) and the item it drops when gathered.

Resources( ID, Name, ItemTypes_ID, gatheringTime, gatherAmount, spawnWeight)

This table contains the items in the players inventory.

PlayerInventory( ItemTypes_ID, Player_ID, amount)

sentences:
How can I get the color of a pixel in a SharpDX Direct2D bitmap or render target? I am working on a simple drawing game and I need to get a Flood Fill algorithm working for a Paint Bucket tool.

I have the game running on WinForms at the moment which is extremely slow, but I have a working Flood Fill algorithm there, I could get the code to support SharpDX if I could get the color of a pixel (either from a SharpDX.Direct2D1.Bitmap or from a SharpDX.Direct2D1.RenderTarget), but I can't find a way to do so.

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:
Why does PIX crash while creating render target views in my D3D11 application? I'm trying to use PIX to debug my Direct3D11 application. PIX crashes and gives the following stack trace:

Frame 000001 ........PRE: <this=0x054338e0>IDXGISwapChain::GetBuffer(0, IID_ID3D11Texture2D, 0x00B3E0F0)
Frame 000001 ........POST: <S_OK><this=0x054338e0> IDXGISwapChain::GetBuffer(0, IID_ID3D11Texture2D, 0x00B3E0F0)
Frame 000001 ........PRE: <this=0x05433978>ID3D10Texture2D::Map(11788512, Unknown D3D10_MAP, 1843764804, 0x00B3EA08)
Frame 000001 ........POST: <E_INVALIDARG><this=0x05433978> ID3D10Texture2D::Map(11788512, Unknown D3D10_MAP, 1843764804, 0x00B3EA08)
Frame 000001 ........PRE: <this=0x054b70d0>ID3D11Device::CreateRenderTargetView(0x05433978, NULL, 0x00B3E0F4)
Frame 000001 ........POST: <E_INVALIDARG><this=0x054b70d0> ID3D11Device::CreateRenderTargetView(0x05433978, NULL, 0x00B3E0F4)

What can I do to get around this problem so that I can debug my application?

sentences:
Old tv effect in shader graph I am trying to use Unity's shader graph to create this old tv effect:

I thought about using a noise node, and somehow randomize the noise's seed.

Can anyone help me?

sentences:
What is the bare minimum I need to set up the Android SDK for Unity development? I want to import my Unity project to Android, and I need to download the Android SDK, but I do not want to download any unnecessary components.

Do I need to download all platforms, or just the latest one? I am worried about the size of Android 7.1.1 (API Level 25); the SDK Manager reports this as the latest version, but I am not sure.

I only want to import my project for Android smartphones, with no plan of publishing it. I do not want to build to Android TV or Android Wear, for example. Do I need to download all of the contents under the specific platform? I ask because there are Android TV and Android Wear system images, and the files can get quite large.

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

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

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

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

sentences: Send a prefab over network in Unity I want to instantiate an object on only the server and one client. This means Network.Instantiate is out of the question and I have to instantiate it manually. Since Network.Instantiate takes a prefab, there must be some way of identifying a prefab over a network( you can't send a reference in an rpc. ) How can I do this? Drag and dropping the prefab from the inspector is also not an option, since the component with this reference is on the server only( the client doesn't have a local reference. )

sentences:
VRTK ignores IsTrigger VRTK allow collision detection by adding the VRTK_HeadsetCollision, VRTK_BodyPhysics, VRTK_HeadsetFade and VRTK_HeadsetCollisionFade scripts into Unity.

This works so that in VR when I walk through a wall, the scene fades to black as expected.

However, I would also like to trigger events when I enter certain spaces in VR. Usually I would use a Unity BoxCollider with IsTrigger checked, but unfortunately, VRTK seems to ignore the IsTrigger value as it still fades to black when I enter the "zone".

How can I trigger a Unity event when the VR player enter's a zone with VRTK?

sentences:
Libgdx crash on dispose()? Whenever I try to manually call the dispose method in one of my screen my game just crashes.

My dispose looks something like this

@Override
public void dispose() {
    battletheme.dispose();
    renderer.dispose();
    bg.dispose();
    enemy.dispose();
    dialouge.dispose();
    GameTools.fontText.dispose();
}

and I use

this.dispose();

When I switch to another screen, otherwise my memory begins to pile up. Is there any reason for this?

EDIT: My spritebatch called "renderer" seems to crash on dispose, any reason?

sentences:
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:
How does one specify raster operations in XNA? I'm looking for a way to add a sprite using a particular logic operation (like XOR). I can't find anything on Google and I'm not sure where to look in the documentation.

I've looked into SpriteBatch.Begin(...) and its Draw method and several options in the GraphicsDevice class, but I'm not recognizing anything capable of this. I'm still pretty new to XNA so I may just not have recognized the terminology to do this.

sentences:
Export Spriter animations to Unity I want to use bone animations in my 2D game for Unity (5.0 beta). I am trying Spriter. Apparently, it has no official Unity support. There was some guy, back in 2014, who posted a plugin to convert Spriter files to Unity prefabs here: http://brashmonkey.com/forum/index.php?/topic/3365-spriter-for-unity-43-updated-integrated/.

However, the plugin does not seem to work (perhaps it is because I am using 5.0 beta).

There are deprecated lines, like

AnimationUtility.SetAnimationType(animClip, ModelImporterAnimationType.Generic);

Or

 UnityEditor.Animations.AnimatorController.AddAnimationClipToController(controller, animationClip);

If you remove them, of course it won't be able to properly export your files.

So my question is: is there a reasonable to use Spriter animations in Unity? I know I could just export to a spritesheet, but I was hoping to use bones for super fluid animations (I have several characters so I don't really want to make lots of spritesheets). Or perhaps there is a better bone-based solution for 2D animation in Unity?

sentences:
Stretch line on bow using touch I have drawn a line on sprite representing the string of a bow. I want to stretch it with finger touch input, using onTouch. I have added a Physics body but I don't understand how to stretch the line.

It's a bow and arrow demo:

Here is the code I use:

protected Scene onCreateScene() {
        this.mEngine.registerUpdateHandler(new FPSLogger());
        mScene = new Scene();
        mScene.setBackground(new Background(0.3f, 0.8f, 0.9f));
        float centerX = CAMERA_WIDTH/2;
        float centerY = CAMERA_HEIGHT/2;

        Sprite sprite = new Sprite(centerX,centerY,this.regionBow, this.getVertexBufferObjectManager());
        mScene.attachChild(sprite);

        PhysicsWorld physicsWorld = new PhysicsWorld(new Vector2(0, 300), false);
        Line line = new Line(99, 10, 99, 240, 4, getVertexBufferObjectManager());
        line.setColor(0f,0f,0f);

        FixtureDef lineFixtureDef = PhysicsFactory.createFixtureDef(1, 4f, 0.5f);
        Body body = PhysicsFactory.createLineBody(physicsWorld, line, lineFixtureDef);
        mScene.getLastChild().attachChild(line);

        PhysicsConnector physicsConnector = new PhysicsConnector(sprite, body, true, true);
        physicsWorld.registerPhysicsConnector(physicsConnector);

        mScene.setOnAreaTouchListener(new IOnAreaTouchListener() {
            @Override
            public boolean onAreaTouched(TouchEvent pSceneTouchEvent, ITouchArea pTouchArea, float pTouchAreaLocalX, float pTouchAreaLocalY) {
                return false;
            }
        });

        return this.mScene;
    }

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:
The rightmost part of the game screen is truncated in HTML I created a game that, when I play it in Unity, looks like this:

But when I build it in WebGL, the rightmost part of the screen (with the red player character in it) is truncated:

Play it in-browser on itch.io to confirm. It looks the same when I open the HTML file locally, so the problem is with the WebGL version and not with itch.

Only when I click the "full screen" button, the rightmost part is shown.

What am I doing wrong?

sentences: Collision prediction of 2 moving objects I have to 2 objects with Collider2D. Both objects are moving, in the very next frame they will either overlap each other or not. How to predict if they would collide on the next frame? I'm thinking of instantiating a temporary object then use collider.Overlap(). But maybe there are better ways to do this.

sentences:
Word Search Game Issue I am developing a game like word search. I have used AndEngine for this and for displayig grid of words I have used TiledMap. In this game, we need to join letters to make a word as we drag our fingure it will draw line on tiles and make connection between letters. I am able to draw lines vertically and horizontally accurately but as I try to draw line diagonally it goes to the nearby tile and draw line from last touched tile to nearby tile. But as I carefully move to the diagonal tiles it draws line accurately.

Can any one help me to solve this issue?

e.g.
----------------
|1   2   3   4 |
|5   6   7   8 |
|9  10  11  12 |
----------------

as shown in above e.g.

I am able to draw line for "1234" & "159", It means all horizontal and vertical positions works accurately.
But for "963" its not as accurate as i draw for horizontal and vertical.

I want to draw line on one board as shown above. There will be letters below lines and need to connect correct words.

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: Unity Mesh and Collider not aligned on rotation I have a GameObject with a mesh and a collider. When I rotate the object the mesh and the colider do not act the same way and when the GameObject is rotate 65 degrees on the z axis the mesh and the colider are no longer aligned. This must affect game play. I don't understand why this happens and how it is supposed to be fixed.

sentences:
cross resolution level design advice I was looking for some beginner advice regarding level design across multiple resolutions.

I believe the answer is likely "it depends", but any input from anyone with real experience is very appreciated.

Basically, I am building a 2D Super Metroid type game. If rooms/levels are to be a tiled grid, what are some general best practices for designing rooms when taking into account different resolutions?

Since more or less tiles could fit vertically on a single screen depending on the resolution, is it better to design towards possibly having more of the room visible depending on the screen (with a bare minimum needed for gameplay), or should I fix the design at a certain tile height and scale the graphics?

sentences:
Implementing Scrolling Background in LibGDX game I am making a game in LibGDX. After working for whole a day..I could not come out with a solution on  Scrolling background.

My Screen width n height is 960 x 540. I have a png image of 1024 x 540. I want to scroll the background in such a way that it contuosly goes back with camera

x-- as per camera

I tried many alternatives... drawing the image twice ..did a lot of calculations and many others....
but finally end up with this dirty code

if(bg_x2 >= - Assets.bg.getRegionWidth())   {
//calculated it to position bg .. camera was initially at 15
                bg_x2 = (16 -4*camera.position.x);
                bg_x1=bg_x2+Assets.bg.getRegionWidth();
            }
            else{
                bg_x1 = (16 -4*camera.position.x)%224;  // this 16 is not proper
//I think there can be other ways
                bg_x2=bg_x1+Assets.bg.getRegionWidth();
            }

//drawing twice
       batch.draw(Assets.bg, bg_x2, bg_y);
        batch.draw(Assets.bg, bg_x1, bg_y);

The Simple idea is SCROLLING BACKGROUND WITH SIZE SOMEWHAT MORE THAN SCREEN SIZE SO THAT IT LOOK SMOOTH. Even after a lot of search, i didn't find an online solution. Please help.

sentences: How to disable spring joint in unity 3d How can I disable Spring joint in unity 3d, since disabling feature only available in 2d mode, I am not able to find any way to disable it via script

sentences:
Unity 5 C# - onClick.AddListener in a foreach loop using lambda expressions I'm trying to dynamically create Unity 5 UI buttons that each set a global variable decision_id to a different value when clicked.

The problem I'm having with this implementation is that they all set decision_id to the exact same value right now. That value being the last one in my foreach loop.

Here's my code:

IEnumerator make_decision(XmlNode options_node) {
    // reset decision_id
    decision_id = "nothing";

    // spawn a button for each option_node in options_node
    int i = 1;
    var new_option_1 = Instantiate(option_1);
    var new_option_2 = Instantiate(option_2);
    var new_option_3 = Instantiate(option_3);
    var new_option_4 = Instantiate(option_4);
    foreach (XmlNode option_node in options_node) {
        XmlNode temp_option_node = option_node;
        string option_id = temp_option_node.Attributes["id"].Value;
        Debug.Log(option_id);
        switch (i) {
            case 1:
                new_option_1.GetComponentsInChildren<Text>()[0].text = option_node.InnerText;
                new_option_1.GetComponent<Button>().onClick.AddListener(() => set_decision_id(option_id));
                new_option_1.transform.SetParent(canvas.transform, false);
                break;
            case 2:
                new_option_2.GetComponentsInChildren<Text>()[0].text = option_node.InnerText;
                new_option_2.GetComponent<Button>().onClick.AddListener(() => set_decision_id(option_id));
                new_option_2.transform.SetParent(canvas.transform, false);
                break;
            case 3:
                new_option_3.GetComponentsInChildren<Text>()[0].text = option_node.InnerText;
                new_option_3.GetComponent<Button>().onClick.AddListener(() => set_decision_id(option_id));
                new_option_3.transform.SetParent(canvas.transform, false);
                break;
            case 4:
                new_option_4.GetComponentsInChildren<Text>()[0].text = option_node.InnerText;
                new_option_4.GetComponent<Button>().onClick.AddListener(() => set_decision_id(option_id));
                new_option_4.transform.SetParent(canvas.transform, false);
                break;
            default:
                Debug.Log("Too many option nodes! Should only be four per options section");
                break;
        }
        i++;
    }

    while (decision_id == "nothing") {
        yield return new WaitForSeconds(.5f);
        // the button will change decision_id for us eventually
        // decision_id = "monarchy";
    }

    // despawn each button spawned above
    Destroy(new_option_1);
    Destroy(new_option_2);
    Destroy(new_option_3);
    Destroy(new_option_4);

}

I've searched this issue and have found lots of talk about the lambda's capturing instances instead of values... but I've already gone out of my way to prevent this by capturing both the XmlNode itself AND the id string in local variables.

Is there something super obvious that I'm missing here?

sentences:
Design to handle logic within a state I am designing a new game and I am trying out the entity-component design where entities are comprised of groups of components holding a bunch of attributes. I also have a stack of 'game states' and 'game systems'. On creation, a new state grabs a bunch of (singleton) system s from a provider of systems. The systems are created at the beginning and maintain a list of entities that are relevant to it by inspecting what components are on the entity. At the moment I have the game logic within a bunch of 'systems', the state simply maintains a list of systems to update/draw.

I realize that the state should really be holding all information relevant to the state. For instance the state should be holding the information on who's turn it is e.t.c. I have it so the system stores all information on the state at the moment and accesses it via the observer pattern. This is turn leads to all sorts of problems as it pretty much couples the system s to the state + it makes the code pretty messy and inefficient.

For instance I have a movement system that is interested in entites with the 'movable' component. The system needs to read from the state who can move at this point. How far they are allowed to move and also controller input to actually do the move. For each of these things I must access the observer methods to modify the state from the system.

The game is turn based at the moment and one of the states is a movement state, it has two systems registered to it, a movement system and a camera system which it updates in turn.

At the moment the movement system gets from the state an entityId representing the 'selected' entity and checks input to see if the player is moving it. If moved the 'location' component is updated on the entity and the system stores the location onto the state via the observer. The camera system then looks up this location on the state and updates the entity with the 'camera' component with this location.

The solution I have at the moment does not seem elegant at all and it is extremely long winded to implement even simple functionality. I am thinking I am doing something fundamentally wrong with the design. I have a few questions that come to mind:

Should the state hold the list of entities and do the logic?

The systems should maybe only be pure logic calls at this point that hold no variables.
How would I handle entities in this situation? I can envisage a state holding loads of entities only to be used for specific segments of the logic.

Should the components hold the logic?
Should I just make the systems into 'micro-states'? Which is to make them separate instances and have them hold local variables needed for the state.

sentences:
Why won't Unity drop objects to the origin position? It seems that my objects drop to the middle of the scene, not a global position of (0, 0, 0).

Why is Unity behaving like this?

sentences:
Why does the Debug.DrawRay return these weird lines I am working on a small feature of a 2D mobile game where a indicator points towards a object in 2D space. I am trying to make the indicator turn towards the object, however the vector I am trying to construct that points towards the object is off a bit.

When I decided to draw a debug ray from the indicator position to the objects position it was also off a bit. I then decided to draw the debug ray the other way around which gave me a different line. If my understanding is correct, if you switch the starting point and the end point of a ray the line should stay exactly the same right?

using UnityEngine;
using System.Collections.Generic;

public class Tracker : MonoBehaviour {

public GameObject goToTrack;
private List<Renderer> renderers = new List<Renderer>();

void Start(){
    foreach (Transform child in transform) {
        renderers.Add (child.gameObject.GetComponent<Renderer>());
    }
}

void Update () {

}

void OnGUI(){
    Vector3 v3Screen = Camera.main.WorldToViewportPoint(goToTrack.transform.position);

    // if the target is within the viewable screen the indicator shouldn't be rendered)
    if (v3Screen.x > -0.01f && v3Screen.x < 1.01f && v3Screen.y > -0.01f && v3Screen.y < 1.01f) {
        foreach (Renderer renderableObject in renderers) {
            //renderableObject.enabled = false;
        }
    }
    else
    {
        foreach (Renderer renderableObject in renderers) {
            //renderableObject.enabled = false;
        }

        v3Screen.x = Mathf.Clamp (v3Screen.x, 0.01f, 0.99f) -0.04f;
        v3Screen.y = Mathf.Clamp (v3Screen.y, 0.01f, 0.99f) -0.04f;
        transform.position = Camera.main.ViewportToWorldPoint (v3Screen);

        Debug.Log ("Target planet position: " + goToTrack.transform.position.ToString());
        Debug.DrawRay(Camera.main.ViewportToWorldPoint (v3Screen), goToTrack.transform.position, Color.red, 5.0f);
        Debug.DrawRay(goToTrack.transform.position, Camera.main.ViewportToWorldPoint (v3Screen), Color.green, 5.0f);

        //Debug.Log ("Tracker angle: " + angle);
        //transform.Rotate(0,0, angle, Space.Self);
    }

}
}

Output:

UPDATE:
I have noticed that when i substract the second vector with the first vector of the Debug.DrawRay it draws the ray like i want it to.

From this I am taking that the Debug.DrawRay function draws the second vector on top of the first vector. (kind of like the the first vector is Vector(0,0,0) and the second vector is the actual ray you want to draw)

sentences:
Unity2D: Pressing my mute button twice in order for it to set music back to 1 So far my mute button works, its just that I have to press my button twice (when game is restarted) in order for it to put my volume back to 1. Does anyone knows the problem. Anyway this is my script:

public bool mute;

void Start()
{
    // check if the player has a music volume preference
    if (PlayerPrefs.HasKey("musicVolume"))
    {
        // if yes, apply it.
        GetComponent<AudioSource>().volume = PlayerPrefs.GetFloat("musicVolume");
    }
}

private void Muted ()
{
    AudioSource audioSource = gameObject.GetComponent<AudioSource>();

    mute = !mute;
    if (mute) {
        gameObject.GetComponent<AudioSource> ().volume = 0;
       // PlayerPrefs.SetFloat("mute", 0);
    }
    else
    {
        gameObject.GetComponent<AudioSource> ().volume = 1;
       // PlayerPrefs.SetFloat("mute", 1);
    }
    // write new music volume preference to persistent storage
    PlayerPrefs.SetFloat("musicVolume", audioSource.volume);
}

Thank you. :)

sentences:
2D Top down acceleration vector I have been wanting to solve the issue of movement once and for all... with all that I have learnt and read through, should be a piece of cake one would have thought... , seems it isn't.  Having rummaged through stackoverflow, I have found this link https://stackoverflow.com/questions/7312773/mathematical-vectors-and-rotations-topdown-java-game-dev-physics-problem and the bottom solution which explains how I exactly how I want acceleration to act as a 2D vector.

Moving on to the fact that the answer lies in the last post; that is having two vectors totaling to the acceleration vector, I am now faced with a simple yet unanswerable problem with the code I am using.  The problem lies in the fact that considering an angle of 0 and 360 degrees both pointing north respectively, I cannot for the life of me figure out why moving up will not keep the angle constant to 0. (apart from the fact that this angle is given through Math.toDegrees(Math.atan2(y, x)))

If we take this code for example ( a direct result of the last thread on stackoverflow )

double secondsElapsed = deltaTime / 1000.0;

double forwardDirection = velocity.angle() + 90;
double leftDirection = forwardDirection + 90;

double forwardAccel = 0;
if (up)
   forwardAccel = 100;
if (down)
   forwardAccel = -100;

double leftAccel = 0;
if (right)
   leftAccel = 100;
if (left)
   leftAccel = -100;

double fDir = Math.toRadians(forwardDirection - 90);
double lDir = Math.toRadians(leftDirection - 90);

Vector2D forwardUnitVector = new Vector2D (Math.cos(fDir), Math.sin(fDir));
Vector2D leftUnitVector = new Vector2D (Math.cos(lDir), Math.sin(lDir));

Vector2D acceleration = forwardUnitVector.scale(forwardAccel);
acceleration.add(leftUnitVector.scale(leftAccel));

Vector2D deltaV = acceleration.scale(secondsElapsed);

velocity.add(deltaV);
position.add(velocity.scale(secondsElapsed));
angle = velocity.angle() + 90;

the angle and motion with the upwards press is set to give acceleration on the x axis (which is fine considering my angle is 90 degrees pointing east).  Now realizing that we want a forwardUnitVector of (0,-1) (to get me poiting to the north) I was thinking something along the lines of a resulting degree of 270 (Math.sin(Math.toRadians(270)) = -1 which would be used along the y axis to create motion in the top direction.  However, having set the forwardDirection to 360 which would give me the desired result of forwardUnitVector(0, -1) I am given a velocity and an angle which acts as a rotation instead of a simple magnitude on the y axis.

Can anyone please explain to me why my concept of having motion towards the north is flawed?

Thanks for bearing with me!

sentences:
android game saving game state I'm developing a game and i've ran into some questions about saving and resuming the game. Let's say i have 10 animated sprites drawn every frame (which move side to side) and everytime i press the home button or back button and then go back to my game, it starts drawing the sprites at the starting position rather than in the position before the back/home press.

Do i have to save every sprite and animation position in order to achive resuming the game where i left off (using Bundle, onSaveInstanceState and onRestoreInstanceState())? Or can this be achived some other simpler way.

I'm using the lunarlander example which handles the drawing in a thread and when the user presses the home/back button(onPause) the state is saved and then reloaded on resume.But if i move all the drawing methods to SurfaceView (LunarView) and just call them from a thread(LunarView.draw()), the sprites stay in the exact same position as before the back/home button pressed without saving anything. Can someone explain why this happens? Is it something i should avoid(calling SurfaceView.draw() from a thread) or is this the anwser to my question how to save game state?

Thanks for the reply's.

Regards, J.

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:
Can I my iOS-based editor save .plist files that my Mac game can read? I want to make an editor on iOS which will record touch positions into a file. That file (in the .plist format) will eventually be used for positions in my Mac connect-the-dots game.

Can I save one .plist file to my Mac from an iOS app?

sentences:
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:
Is It Better To Generate A Pre-Generated Map or A Randomly Generated Map When Using Tile Properties? So I am contemplating whether or not to add a Pre-Generated Map or a randomly generated map into my game. But I also need to add Tile properties into the map (i.e. so that water tiles aren't being walked on by the player, etc.). Which way is better, to add tile properties to an existing image file or to add tile properties to a randomly generated map?

I want to make it so that I can add Tile properties to a pre-generated map as I already have one ready to go, but is it even possible to add tile properties to a pre-generated map?

I am using Java and the Slick2D gaming engine.

sentences:
Accessing Canvas and Button components in a scene I have a scene with the following hierarchy:

This is game scene and the game manager is a singleton with the following variable fields:

// canvas
public Canvas PauseCanvas;
public Canvas MainMenuCanvas;

Before implementing singleton, I assigned them from the inspector. Now that the game manager is singleton, I need to assign them through script on level load. I can see one solution to this situation:

Getting all canvas components through GetComponents<Canvas>() and then iterating and checking their name fields to assign them accordingly or maybe using LINQ.

What I want to ask is: Is there a name-based search method just like finding game objects with name GameObject.Find("Name") that is applicable for Components?

sentences:
How do I make a moving object stop smoothly at the end of a path? There are a dozen ways I could word this question, but to keep my thoughts in line, I'm phrasing it in line with my problem at hand.

So I'm creating a floating platform that I would like to be able to simply travel from one designated point to another, and then return back to the first, and just pass between the two in a straight line. However, just to make it a little more interesting, I want to add a few rules to the platform.

I'm coding it to travel multiples of whole tile values of world data. So if the platform is not stationary, then it will travel at least one whole tile width or tile height.
Within one tile length, I would like it to accelerate from a stop to a given max speed.
Upon reaching one tile length's distance, I would like it to slow to a stop at given tile coordinate and then repeat the process in reverse.

The first two parts aren't too difficult, essentially I'm having trouble with the third part. I would like the platform to stop exactly at a tile coordinate, but being as I'm working with acceleration, it would seem easy to simply begin applying acceleration in the opposite direction to a value storing the platform's current speed once it reaches one tile's length of distance (assuming that the tile is traveling more than one tile-length, but to keep things simple, let's just assume it is)- but then the question is what would the correct value be for acceleration to increment from to produce this effect? How would I find that value?

sentences:
Circular Bullet Spread Is Not Even I'm creating a bullet shooter much in the style of Touhou. Right now I want to have a very simple circular shot being fired from the enemy.

However, the spacing is very uneven, which isn't very good if you want to survive.

The code I'm using is this:

private function shoot() : void
{
    const BULLETS_PER_WAVE : int = 72;
    var interval : Number = BULLETS_PER_WAVE / 360;

    for (var i : int = 0; i < BULLETS_PER_WAVE; ++i)
    {
        var xSpeed : Number = GameConstants.BULLET_NORMAL_SPEED_X * Math.sin(i * interval);
        var ySpeed : Number = GameConstants.BULLET_NORMAL_SPEED_Y * Math.cos(i * interval);

        BulletFactory.createNormalBullet(bulletColor_, alice_.center, xSpeed, ySpeed);
    }

    canShoot_ = false;
    cooldownTimer_.start();
}

I imagine my mistake is in the sin &  cos functions, but I'm not entirely sure what's wrong.

sentences:
Point welding on generated terrain I am converting two 2D images (A Voronoi graph and a Diamond Square noise map) into a 3D object.

However when finding the corner points of the Voronoi I am left with gaps, so I thought to drop these by calculating adjacency to existing nodes before creating the vertex. However no matter which algorithm for the weld I use, or the tolerance level of the distance I can't seem to get it to work.

This has led me to believe I am doing something wrong.

Image of the issue:

These gaps do not appear if I run without the weld, they are created by the weld jumping to spots, but then later welds not finding that spot.

I have even tried to increment the weld distance to a maximum of 10, if a suitable node wasn't found. But this is far to aggressive and has the effect of simplifying the mesh instead and creating more gaps.

My Repo for the full code is here: https://github.com/HughAJWood/TerrainGenerator

private void CalculatePolys()
{
    var nodesForEdges = new List<VNode>();
    foreach (var region in _regions)
    {
        foreach (var point in region)
        {
            if (point == null)
            {
                continue;
            }
            // We calculate where the voronoi node corners are, and pass them into the region
            var diff = ColoursDifferent(point);
            if (diff > 1)
            {
                RenderNodePointsOnImage(point);

                // Points are 2D, so to translate to 3D they are set to the Z property of the 3D node
                var node = new VNode
                {
                    X = point.X,
                    Z = point.Y
                };
                // Weld points within 1 unit from each other by determining if we already have one that exists
                // then using the existing node instead
                // A weld is calculated by determining the X,Z distance to see if we have a node stored already
                // that is within 2 units of the node we are creating
                VNode existingNode = Nodes.FirstOrDefault(n => n.Adjacent(node));
                if (existingNode == null)
                {
                    // Optimise node creation by skipping perlin lookup and ID iteration for only when needed
                    node.ID = VNodeId;
                    node.Y = _perlin.GetPixel(point.X, point.Y).R;
                    Nodes.Add(node);
                    Mesh.ControlPoints.Add(new Vector4(node.X, node.Y, node.Z, 1));
                }
                else
                {
                    node = existingNode;
                }
                nodesForEdges.Add(node);
            }
        }
        //if (i++ > 20) return;
        AddNodesToMeshAsPolys(nodesForEdges);
        nodesForEdges.Clear();
    }
}

The adjacency method is currently simplified to the fact I want to ignore the height of the node.

internal static bool Adjacent(this VNode a, VNode b, int tolerance = 3)
{
    var distance = Math.Abs(a.X - b.X) + Math.Abs(a.Z - b.Z);
    return distance < tolerance;
}

[UPDATE]

I have tried sorting the points by distance and fuzzy distance, both sort in the correct order. Then I tried taking the first point and using that as the welding point. Same effect.

I tried to average the points at the intersections at the image level and pass that back as the point every time, then weld. Same effect.

Clearly there are many approaches I can take for this, the problem arises when there are 2 points close to each other on the edge of a voronoi region. Sometimes they weld and create a gap. Sometimes however in some variances of the algorithm that the points don't weld even though their X,Z coordinates are very close to each. I'm still stumped as how to approach this.

sentences:
How do I choose the scaling factor of a 3D game world? I am making a 3D tank game prototype with some physics simulation, am using C++. One of the decisions I need to make is the scale of the game world in relation to reality. For example, I could consider 1 in-game unit of measurement to correspond to 1 meter in reality. This feels intuitive, but I feel like I might be missing something.

I can think of the following as potential problems:

3D modelling program compatibility. (?)
Numerical accuracy. (Does this matter?) Especially at large scales, how games like Battlefield have huge maps: How don't they lose numerical accuracy if they use 1:1 mapping with real world scale, since floating point representation tend to lose more precision with larger numbers (e.g. with ray casting, physics simulation)?
Gameplay. I don't want the movement of units to feel slow or fast while using almost real world values like -9.8 m/s^2 for gravity. (This might be subjective.)
Is it ok to scale up/down imported assets or it's best fit with a world with its original scale?
Rendering performance. Are large meshes with the same vertex count slower to render?

I'm wondering if I should split this into multiple questions...

sentences: Rotating voxels in 3d space amongst the x axis I have a very simple voxel engine and so far it works based on coordinates, e.g. x, y, z. I was wondering if there is a formula for rotating groups of voxels/coordinates from the x axis(e.g. [0, 1, 0][1, 0, 1] rotates to [1, 0, 0][0, 0, 1] when rotated 90 degrees anticlockwise along the x axis) from a certain point, but I hear it involves matrixes and quaternions which sound scary.

sentences:
DX11 Camera not working properly I'm currently trying to implement a ArcBall Camera which should fly around a given XMFLOAT3 position stored in a cb with a spezified distance to the position. I used the code from Allen Sherrod for this but the constant buffer that should pass the viewmatrix and the second one for the position to the shaders doesn't update. Any ideas?

This should return the view mat:

    XMMATRIX ArcCamera::GetViewMatrix()
{
    XMVECTOR zoom = XMVectorSet(0.0f, 0.0f, distance_, 1.0f);
    XMMATRIX rotation = XMMatrixRotationRollPitchYaw(xRotation_, -yRotation_, 0.0f);

    zoom = XMVector3Transform(zoom, rotation);

    XMVECTOR pos = XMLoadFloat3(&position_);
    XMVECTOR lookAt = XMLoadFloat3(&target_);

    pos = lookAt + zoom;
    XMStoreFloat3(&position_, pos);

    XMVECTOR up = XMVectorSet(0.0f, 1.0f, 0.0f, 1.0f);
    up = XMVector3Transform(up, rotation);

    XMMATRIX viewMat = XMMatrixLookAtLH(pos, lookAt, up);

    return viewMat;
}

The rotation (xRotation, yRotation) increases every frame.

The shaders:

Texture2D colorMap : register( t0 );
SamplerState colorSampler : register( s0 );

cbuffer cbChangesEveryFrame : register( b0 )
{
    matrix worldMatrix;
};

cbuffer cbNeverChanges : register( b1 )
{
    matrix viewMatrix;
};

cbuffer cbChangeOnResize : register( b2 )
{
    matrix projMatrix;
};

cbuffer cbCameraData : register( b3 )
{
    float3 cameraPos;
};

struct VS_Input
{
    float4 pos  : POSITION;
    float2 tex0 : TEXCOORD0;
    float3 norm : NORMAL;
};

struct PS_Input
{
    float4 pos  : SV_POSITION;
    float2 tex0 : TEXCOORD0;
    float3 norm : NORMAL;
    float3 lightVec : TEXCOORD1;
    float3 viewVec : TEXCOORD2;
};

PS_Input VS_Main( VS_Input vertex )
{
    PS_Input vsOut = ( PS_Input )0;
    float4 worldPos = mul( vertex.pos, worldMatrix );
    vsOut.pos = mul( worldPos, viewMatrix );
    vsOut.pos = mul( vsOut.pos, projMatrix );

    vsOut.tex0 = vertex.tex0;
    vsOut.norm = mul( vertex.norm, (float3x3)worldMatrix );
    vsOut.norm = normalize( vsOut.norm );

    float3 lightPos = float3( 0.0f, 500.0f, 50.0f );
    vsOut.lightVec = normalize( lightPos - worldPos );

    vsOut.viewVec = normalize( cameraPos - worldPos );

    return vsOut;
}

float4 PS_Main( PS_Input frag ) : SV_TARGET
{
    float3 ambientColor = float3( 0.2f, 0.2f, 0.2f );
    float3 lightColor = float3( 0.7f, 0.7f, 0.7f );

    float3 lightVec = normalize( frag.lightVec );
    float3 normal = normalize( frag.norm );

    float diffuseTerm = clamp( dot( normal, lightVec ), 0.0f, 1.0f );
    float specularTerm = 0;

    if( diffuseTerm > 0.0f )
    {
        float3 viewVec = normalize( frag.viewVec );
        float3 halfVec = normalize( lightVec + viewVec );

        specularTerm = pow( saturate( dot( normal, halfVec ) ), 25 );
    }

    float3 finalColor = ambientColor + lightColor * diffuseTerm + lightColor * specularTerm;

    return float4( finalColor, 1.0f );
}

Must I update all subresources and stuff before every time I call the context's draw method to render every my objects by the way?

sentences:
Artifacts on crosshair in game view with FXAA I have a transparent grid texture that I am displaying on a quad using the URP's built in unlit/Transparent Shader. The intersections render as desired in the scene view, but have artifacting in the game view (even after play is pressed).
Scene View:
As you can see, the scene view renders clean intersections

Game View:
The intersections display some artifacting. (This screenshot was taking after zooming in the game view panel, but the artifacts are still visible at 100% zoom)

Note: I do not think that this is related to PNG transparency. I have written a custom procedural grid shader that exhibits similar artifacting in the game view:

The problem seems to be due to my enabling FXAA, which is smoothing the sharp corners. Disabling FXAA immediately solves the problem.
However, this is somewhat of an inconvenient solution, because anti-aliasing is nice to have enabled. Is there a way to make the artifacts disappear without disabling AA completely?
How do I configure the URP/anti-aliasing to render my grid texture as it does in the scene view? I have tried changing the compression level and the filtering algorithm, to no avail.

sentences:
Deleting/Cleaning Screen-Objects with all child-objects in libGDX For my game, Im using

libGDX
Ashley (ECS)
Box2D

Ive got a lot of screens but for simplification: MainMenuScreen and InGameScreen.

In InGameScreen Im init the ECS (Ashley) and create a lot of entities. Some have PhysicsComponent. The PhysicsSystem will catch them and call Box2D to spawn some objects based on the parameters within the PhysicsComponents.

So far so good.

Now, when the player dyes, I run setScreen(new MainMenuScreen()); from my "Main"-Class (MyGame.java).

the game starts and MyGame loading at first the MainMenuScreen
than the InGameScreen will get loaded (when player presses a key)
than the player dyes
MyGame recognized it and loading again (throu calling setScreen(...)) the MainMenuScreen
When Player press key: MyGame loading another round (setScreen(new InGameScreen))

I guess I have to do something like a complete clean up between switching screens. But how should I implement this? Just "deleting" the old InGameScreen-Object shouldent be enought, right?

Do I have to use the dispose()-Method?
Is it enough to instantiate everything new (in the init from InGameScreen) since it will instantiate all child-object new for its own like Box2DWorld world = new World();

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:
Getting a TOISolver ArrayIndexOutOfBoundsException creating a tile based game I've been making a tile-based game on java using jBox2D.For adding tiles to physical world I use static bodies which are stored in updating ArrayList(i use PhysicBlock class as a wrapper). Whenever I call body.setTransform(...) only half of the blocks is being added(there is always a 1-block-gap between them).When I try to insert a block between or under any of them  I get the following when a dynamic body collides with any of them:

Exception in thread "Thread-2" java.lang.ArrayIndexOutOfBoundsException: 8
at org.jbox2d.dynamics.contacts.TOISolver.initialize(TOISolver.java:99)
at org.jbox2d.dynamics.World.solveTOI(World.java:1235)
at org.jbox2d.dynamics.World.solveTOI(World.java:1053)
at org.jbox2d.dynamics.World.step(World.java:565)
at org.projectez.world.World.updateActiveBlocks(World.java:40)
at org.projectez.world.World.update(World.java:94)
at org.projectez.core.UpdateThread.update(Core.java:117)
at org.projectez.core.UpdateThread.run(Core.java:87)
at java.lang.Thread.run(Unknown Source)

Fragment of the World class(not jbox2d world,this class represents all blocks and GameObjects in game, it has jbox2d world as a field:

...
public ArrayList<PhysicBlock> activeBlocks=new ArrayList<PhysicBlock>();
public World(int x,int y)
{
    worldX=x;worldY=y;
}
public void updateActiveBlocks()
{
    physWorld.step(1/100f,2, 2);
    for(PhysicBlock pb : activeBlocks)
    {
        pb.nullify();
    }
    int counter = 0;
    for(int i=0;i<=100;i++)
    {
        activeBlocks.get(counter).redefine(i, 10, BlockRegistry.blockStone);
        counter++;
    }
    for(int i=1;i<=100;i++)
    {
        activeBlocks.get(counter).redefine(i, 11, BlockRegistry.blockStone);
        counter++;
    }
    ...

PhysicBlock class:public class PhysicBlock
{
    public BodyDef boxDef;
    public Body box;
    public FixtureDef boxFixture;
    public int i;
    public int j;
    public PhysicBlock(int i,int j,org.jbox2d.dynamics.World physWorld, Block block)
    {
        boxDef=new BodyDef();
        boxDef.position.set(i/2+0.25f,-j/2-0.25f);
        boxDef.type = BodyType.STATIC;
        PolygonShape boxShape = new PolygonShape();
        boxShape.setAsBox(0.25f, 0.25f);
        box = physWorld.createBody(boxDef);
        boxFixture = new FixtureDef();
        boxFixture.density = 1;
        boxFixture.shape = boxShape;
        boxFixture.restitution = 0f;
        box.createFixture(boxFixture);
        box.setFixedRotation(true);
        if(block==null) box.setActive(false);
    }
    public void redefine(int i,int j,Block block)
    {
        this.i=i;
        this.j=j;
        box.setTransform(new Vec2(i/2+0.25f,-j/2-.25f),0f);
        if(block==null) box.setActive(false);
        else box.setActive(true);
    }
    public void nullify()
    {
        box.setActive(false);
    }
}

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:
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:
How to serve user generated levels? What is the easiest way to store online and serve user-generated levels? What client-server architecture should I use? Will I need backend code, or just a database? What database would be the easiest to use with C++ front-end? Are there any suitable cloud services that would help to minimize the effort?

I am looking for something that can be used on both mobile and desktop.

The game we're going to make will be fairly simple, the levels can fit into one screen, each level is basically collection of integer coordinates of cubes of different types. Any tips on how and where to store such levels?

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:
C++ text based football -- lookup table and AI logic help I am trying to develop a one-player text based football game in C++ strictly in the console without graphics. I am developing the game logic here below vs the CPU and I also need to do the vice versa (CPU vs User). How could I do this without a ton of if statements. I am not sure how to accomplish this same code below as a lookup table and I know I need some randomness so it is not predictable.

For this example below, the scenario would be which down are we in (4th in this example), how many yards to go (2 yards), the offensive's team running attribute (choice = Bears), the defense run attribute (o_choice = Bengals) and the play called (playbook_choice = 1 which is QB Sneak). Any help would be much appreciated, I have been banging my head against on the wall on this. I have not incorporated the attributes ratings below into the code below because I am not sure how. The Bears would have offensive running and pass ratings, and defensive running and pass ratings (so 4 ratings in total), same goes for the Bengals.

    //test logic
if (playbook_choice == 1 && choice == 1 && o_choice == 2) { //if qb sneak is called by the user controlled bears vs the cpu bengals

    int current_down_yards = 0,down = 4 ,yards = 2; // current down is 4th and 2  --- setting the down and distance
    cout << "It is 4th down and 2 yards to go" << endl; // print it out to the user --- setting the down and distance

    if (down == 2 || down == 3 || down == 4 && yards < 3) { //if its 2nd , 3rd of 4th down  and less than 3 yards to go
        current_down_yards = rand() % 16; // give a rate of completion of randomness from 1-15 yards for a QB sneak --- need to take account for the strength
        // of the defense's attribute rating and offense's running rating -- to include for a loss as well as a gain in yardage
        cout << "The QB ran for " << current_down_yards << " " << "yards" << endl;
    }
}

sentences:
Finding the "top" of a mesh representing the terrain I'm generating a low-poly mesh for terrain, and for a given world coordinate I'd like to know where the "ground" is.

My game uses fairly standard infinite terrain - I generate noise values for world coordinates and use them to generate this mesh procedurally. This is done in chunks of 16x16.

I'm planning to begin decorating the terrain with plants and such and I need a good way to determine how high the ground is.

So for example, if I want a rock at x: 5, z: 5, what's the best/most efficient way to figure out the "height" of the ground at that location?

I've considered trying to inspect the mesh vertices, or maybe using a top-down ray cast and picking the collision point, but I'm looking for advice before I begin.

I've tried the raycast method, and it works perfectly, I'm just not sure how efficient that is. I'll profile if any alternatives seem worth comparing.

sentences:
Converting between Spiral Honeycomb Mosaic and axial hex coordinates There seems to be quite a lot of logic in dealing with hexagonal grids using a system of axial coordinates like the one described here.

In doing some reading about hex grids, though, I ran across the notion of the Spiral Honeycomb Mosaic (the links on that mirror are broken; the content is copied from here, about halfway down the page). It seems to be used mostly in image processing, but it's interesting from the standpoint that it assigns each hex a unique, sequential base-7 number as its identifier.

I'm not sure that it's actually useful for anything, but I'm wondering: is it possible to convert back and forth between the SHM numbering system and axial coordinates?

Both systems have methods to convert from a hex to the Cartesian coordinates of its center, so presumably one could calculate that out of one system, and then into the other. But that's messy and inefficient, and I'm convinced it's possible to do better.

Because of the fractal nature of the SHM, the conversion routine in the sample code provided relies on a loop; it seems like the general solution might involve a series?

sentences:
Get Prefab Asset From Gameobject in Edit Mode I want to get a prefab asset (that resides in Project Window) and assign it to a field like the one you get when you manually drag the prefab asset from Project Window to GameObject field:

But when I try to do the same thing in code (and in Edit Mode) with this function:

GameObject prefab_instance = PrefabUtility.GetNearestPrefabInstanceRoot(gameobj) as GameObject;

I get a prefab instance but not a prefab asset:

How do I get a reference to prefab asset from the gameobject that was created from it?

sentences:
How to make a delayed mouse input? I have a car game and the idea is that the player is drunk. I want to have a delayed input from the mouse, where you move the mouse side to side to turn.

How can I setup a constant delay between the input the user gives and the turn amount of the car?

Right now I have this:

h = Mathf.Lerp(h, (((Input.mousePosition.x / Screen.width) * 2) - 1), Time.deltaTime * 2);

What happens is the turn is delayed, but is very slow, in other words, if I move the mouse very fast, the car turns very slowly, but if I crank up the multiplier for Time.deltaTime, the car turns faster, but delay effect is minimized.

How else could I do this?

sentences:
How do I use Libgdx viewport for UI? I am using LibGDX to make a game for Android and I am using 2 Viewports. One for UI and one for the actual game content. My problem is I can't find a good way to scale my UI using a Viewport.

This is a picture of my UI using a FitViewport:

As you can see it adds space on the top and bottom to fit the screen, but I want my pause button to stay on the top of the screen. I tried using a StretchViewport and that worked well for the pause button, but then the joysticks were no longer circle because they were distorted.

Is there a way to make a StretchViewport that only stretches the middle? (since nothing will be in the middle I don't care about that. Should I make a custom Viewport? And if so, how would I go about that? Thank you for any help!

sentences:
How to figure out if I'm on the right path I'm a software developer from Israel, I've been programming professionally since 2011, my first job was in HP software and lasted 2 years after which I decided that I want to pursue my dream in working in game development and focusing on C++.
for a year an a half I worked for a mobile kids games company, doing small mobile games for kids using C++ and Cocos2d-x.
Unfortunately I was laid off last December and since then I've been focusing my free time on studying Unreal engine 4, studying openGL and computer graphics and working on my C++ skills while searching for a new job.

I'm very passionate about computer & console games and especially the rendering part and my dream job would be to work on AAA games and to be a graphics programming specialist.
The problem is that there aren't any AAA game companies in Israel so I started looking at positions in Europe and also in other jobs that involves computer graphics but aren't necessarily in games.

Last week I got a job offer for a small start up making a game in the "Clash of Clans" genre, the company seems nice, its not my type of games but I'm sure it presents all kinds of challenge but my biggest concern is the fact that the game is implemented in Unity and Python, which are two technologies I'm not so crazy about.

I wonder if I should take the job or keep looking for something that involves more C++,OpenGL,DirectX etc.
Do you think that taking a Unity\Python job will take me too far from the OpenGL\DirectX goal I'm trying to reach?

I know that good software developers aren't supposed to limit themselves to a certain programming language but I think its good to become really professional at something specific instead of changing language every 2 years.
I guess its being a specialist vs. a generalist question.

What do you guys think? should I take this job even though I have some concerns? should I keep searching? maybe doing some freelance work in the meantime?

any advice will be appreciated.

sentences:
Efficient skeletal animation I am looking at adopting a skeletal animation format (as prompted here) for an RTS game.  The individual representation of each model on-screen will be small but there will be lots of them!

In skeletal animation e.g. MD5 files, each individual vertex can be attached to an arbitrary number of joints.

How can you efficiently support this whilst doing the interpolation in GLSL?  Or do engines do their animation on the CPU?

Or do engines set arbitrary limits on maximum joints per vertex and invoke nop multiplies for those joints that don't use the maximum number?

Are there games that use skeletal animation in an RTS-like setting thus proving that on integrated graphics cards I have nothing to worry about in going the bones route?

sentences:
Know if you're fully utilizing the GPU I render ~17.000 VAOs each frame. 2.840.386 triangles. Only applying texture, nothing else.

I have three computers and the performance across them is not as expected.

Cheap laptop(i3-4010U & Intel HD 4400) runs at ~20 fps.
Desktop1(FX-9590 & GT 630) runs at ~65 fps.
Desktop2(i7-5820k & GTX 970) runs at ~105 fps.

As the game is in a pretty early stage, the only CPU task each frame is to loop through a 3-Dimensional map containing VAO ids, and then render them.

When I look at the CPU Benchmarks and the GPU Benchmarks of my systems, I would expect a much bigger difference between my Desktop2 and the two other systems. The GTX 970's 3D score(8662) is more than 15 times better than the Intel HD 4400's (546), though it only run 5 times as fast. Even more ridiculous the GTX 970's 3D score is ~11 times better than the GT 630's (797), but run 1.6 times faster.

Even without taking the benchmarks into consideration I would still expect bigger difference. When I compare the performance differences in other games(Like GTA V) across my systems, there's a much bigger difference. Therefore I know the problem is my game, and not a hardware/driver related issue.

Am I right that I would expect larger differences between the different systems, if yes: How may I find the issue and how can I solve it?

Edit: I've read that GTX 590 is capable of 3.2 Billion triangles/second, where as my game is only able to squeeze ~300 million of a GTX 970.

Edit 2: I've tested my desktop1(GT 630) that runs 1080p at 65fps and if I change the resolution to 1 * 1, I only get a performance boost of 20fps(85fps).

sentences: Is it possible to develop a game with Lua/Löve and have the source code compiled? I've been looking at Lua and Löve for developing simple 2D games. But since Lua is interpreted and I know it can be compiled to some point, but how secure is that to decompiling. Or is there a better way to distribute the game?

sentences:
Generating Mesh using Compute Shaders I am working on a game project in unity which has a procedurally generated terrain made up of 16*128*16 chunks of blocks. The map size is going to be finite (Possibly up to ~100*100 chunks). Currently the data for the chunk is stored in a 1D Array, and takes a couple milliseconds to generate. But generating the mesh takes longer, averaging 30-40ms. So generating terrain as it enters the range of the camera isn't feasible as it's too slow, and generating all the meshes on load up would take a lot of memory as well as a long time. I've thought about attempting to try it on the GPU through Compute Shaders (although I don't have any experience with them).

Would generating the mesh for each chunk in a Compute Shader be viable/efficient? (The chunks could be made smaller if would be more performant)

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

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

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

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

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

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

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

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

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

public class BackToMainMenu : MonoBehaviour
{
    public int sceneIndex;

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

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

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

sentences:
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: What information should be stored in a database for a MOBA game? I'm wondering what information should be stored in a database when developing a MOBA like game? For example: the current item a unit has, how much gold a player has, etc...

sentences:
ARCore: Differentiate between two planes detected in adjacent vertical walls in the room I'm working on Vertical plane detection.
When I'm pointing at wall 1 of my room, plane1 here is the vertical plane detected in wall 1...
I'm recording the quaternion via this formula
 val quat =  Quaternion(plane1.centerPose.qx(), plane1.centerPose.qy(), plane1.centerPose.qz(), plane1.centerPose.qw())

Now, when I point my phone to the other wall (adjacent) of my room and check its rotation, I get the same values, I assumed this is the world rotation. Let me know if I'm wrong.
Is there any other way where I could differentiate between vertical planes detected in adjacent walls
I'm using this to loop through the detected planes
 for (plane1 in frame.getUpdatedTrackables(Plane::class.java)) {
                if (plane1.trackingState === TrackingState.TRACKING) {
                    val type: Plane.Type = plane1.type
                    if (type == Plane.Type.VERTICAL) {

sentences:
Render Queue Sorting, HOW? Recently I'm trying to implement a render queue sorting system, i.e., ordering my renderable objects in an array in such a way that the overhead of OpenGL state changes are minumum. After some googling, the most ideal one (to me) is to generate an integer key value for each renderable object, and the sorting is based on that value. Once done sorting, objects that have similar rendering states (same shader, texture, distance, etc.) will be close to each other, so we can just loop through the object array and submit the draw calls for rendering.

Here's a detailed explanation: Order your graphics draw calls around!

My problem is, how do I loop through the renderable object's array to submit their draw calls for actual rendering? Do I need to keep track of the current OpenGL states manually?

What have come to my mind is:

(for each renderable object)
{
    if(objects[i].getShader() != m_currentShader)
    {
        m_currentShader = objects[i].getShader();
        m_currentShader.bind();
    }

    if(objects[i].getTexture() != m_currentTexture)
    {
        m_currentTexture = objects[i].getTexture();
        m_currentTexture.bind();
    }

    // ... and so on

    object[i].getMesh().draw();
}

Seems not so performance-friendly to me, but I can't find any further explanation on how to submit the actual draw calls form the object's array either on the article I've provided or other sites I can find. Perhaps there's something I have missed?

sentences: Right way to dispose of a WWW IEnumerator after it has completed - Unity What is the "right" way to dispose of an Ienumerator coroutine after it has completed?

sentences:
How do I simulate color blindness for accessibility testing? Is there an application I can download (or some configuration of Windows, or something) that will let me see how my game will appear to users with different color-blindnesses?

There are already good questions about how to avoid badly-designing your game for colour blindness. There's also a Photoshop filter from VisCheck is a nice idea, except their image-processing upload service is down.

Is there, therefore, a tool I can use to simulate colour blindness and see how things look? Ideally, I would like to try different types (red/green, blue/yellow, mild/severe).

If not, how do other game developers test/avoid this problem, other than ignoring it, or having access to a color-blind person (which I don't)?

sentences:
ScriptableObject not working after build in Unity? I have a GameObject with a ScriptableObject on it, stats. It works fine in editor but when I try to build I get a message,

A script behaviour (script unknown or not yet loaded) has a different serialization layout when loading.

What is wrong here?

sentences: Is there any way to bring animation into unity without a rig/bones? I am developing for mobile and to make the game run on lower spec mobiles, I was only going to import bones/rig for the main character. There are other humanoid characters in the scene which do move about and are rigged already in my 3d app but since they wont be controlled in anyway by the player in the game, I just wanted to bake and import their animations alone without the bones. I know unity can handle blendshapes but I am more comfortable with rigs and also cos these characters are already rigged properly.

sentences:
AI remembering obstacles without a grid For some research purpose I've build a small tanks game where you have 1 tank controlled by a player and one or more NPC tanks.

Now I want these NPC tanks to navigate through a field which they have no knowledge of. They can detect obstacles if they are in a certain range. If they detect those obstacles they should save them in a certain data construct that's easy to query. So that they can take them in account in pathfinding.

Now here is where I'm stuck : if my field would be a grid (level discretized in tiles) it would be quite easy for me, I would just save which tiles the obstacle is on.

But I haven't really worked with a grid, my tanks just move forward a few pixels depending on their speed, so a tank can be located on any pixel combination. Is this bad game design?

I could probably make a grid just for my obstacles, but that restricts a bit the kind of obstacles I can have.

Any suggestions/tips ? Please ask more information if needed, I was not really sure what to include.

sentences: How to squash stretch the Bounding box so as to get Good Physics effect I have Surrounded a game Object with a rectangular Box and applied Physics properties to that Box so that load on the computation gets reduced. But i have a problem, whenever in animation if the Game objects body part goes out of the Box then it will not collide, Is there any solutions?

sentences:
Making Save and Load Windows using SDL I've been working on a world builder project recently and I've finished most of the work but there is just one thing I can't think of how to do.

For example in a strategy game's world builder when you want to save a map and click the save button a window pops up and you can enter a name you want and save the map with that name, or overwrite a map you can chose by clicking one of the pre-saved maps in the list in the window. Or load a map again by clicking a map name in a load window.

How can I render a text while I'm writing it with SDL 2.0.3(when you're saving a map you need to see the name you give) and save that file with that name and also show other save files' names in a list?Is there a way to do it with SDL_ttf library or should I use bitmapfonts?

How can I decide if I want to overwrite a map or create a new one (I need to overwrite a map when it's name is clicked and create a new one when the bar to write the new map's name is clicked)?

In the load menu how can I load the specific save file I've chosen?

And just one more question: I'm currently writing the save data in a .txt file, is there a better way of doing that that you suggest?

I'm using SDL with C++.

Thanks.

sentences:
Lerp vs Vector math: one better than the other? In Unity3D (all versions, I believe), there is a static function for the Vector3D class called "lerp".  It interpolates a point between two points a point, based off a provided percentage related to the desired distance between the two.

Alternatively, I could just get the direction I want to go as a point, subtract it from my current position, Normalize() the resulting vector, then multiply that times a speed value.

So:

Is one way faster than another?

and

Is there a third better/faster/easier/more efficient way I don't know about?

Thanks.

sentences:
How do I portray characters with a bum leg properly in an action game like Devil May Cry, without making him a liability? Right now, I'm designing a character for a 2D action platformer game. The problem is that said character has a bum leg due to an accident a few years prior to the game's setting, but was the first one to be dragged into a dungeon formed by the newly developing incident, and had to escape on his own.

What I've thought about until now about this:

The character will move slower than the normal movement speed, cannot double jump, and have a lower jump height than the normal jump height.
However, he would use a sword that doubles as a retractable whip, allowing his melee attacks to have a wide coverage. Said sword-whip has low damage by default, however.
There's also that his melee attacks are less focused on launching enemies upwards and more focused on knocking them back - and maybe apply bleeding (non-elemental damage over time).
He would also have a shotgun that can be 'charged' to maximize the damage output, very much like the Gunslinger Style Shotgun in DMC3 and 4.

My problem is that this character will be one from around eight (for now), and the other seven characters don't have such a disability - two of them I intend to have the ability to glide mid-air.

The game will have a feature of switching between three characters chosen to engage the other dungeons, so he can be switched out for sections that require double jumping, but I'm not sure that's an optimal solution, especially considering the lower damage his weapon deals (making him a non-optimal pick for boss battles).

Should I just make each character fulfill a specific niche in terms of mobility options, melee attack options, and ranged attack options? How does one design the map and bosses for these cases, without making it seem like giving him too much of a break?

P.S. Can a grappling hook be involved, without ending up making him the best option to navigate the map (like refreshing it only after landing)?

EDIT: I also have a thought of integrating this grappling hook into the sword-whip, being able to pull enemies towards him, or him towards them. Is it possible to use this as a melee charge attack? Because I still think that it doesn't feel right.

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:
Raycasting in Unity3D? I have a game object on screen represented by a cube (but say it was a quad or something else all the same).

How do I raycast to check intersections? Keeping in mind I may not be raycasting fora  physical object, just a gameobject of any sort.

Another question I have is, how can you raycast in Unity3D just to check against an intersection against anything in general (say the first gameobject to be hit)?

sentences:
Unity: Sprite stretch issue I have a simple png square 8px x 8px. In Unity I've left the pixels per unit at 100 and added the image to the scene to create a prefab of the item.
I then add four items to the screen like so:
    var block = Resources.Load("Prefabs/Block", typeof(GameObject));

    Instantiate(block, new Vector3(1f, 0f), Quaternion.identity);
    Instantiate(block, new Vector3(0f, 1f), Quaternion.identity);
    Instantiate(block, new Vector3(2f, 0f), Quaternion.identity);
    Instantiate(block, new Vector3(0f, 2f), Quaternion.identity);

The results (as shown in the image below) seem to stretch the image dependant on where the prefab is placed. Is this normal behaviour? Is there a way round this or something I'm missing?

sentences:
What makes aiming on a PC first person shooter feel good? I liked this question:
What makes aiming in a console first person shooter feel good?

So here it is for PC (and its not a dupe because a mouse is hugely different from an analog stick)

You've probably noticed some games "feel better" than others when it comes to aiming using the mouse.  Why is that?

Some of the best engines are the original Half Life 1 engine and the Quake 3 engine.

What is the biggest problem?  Laggy input response?

sentences:
MySQL Recursive Query (kind of) help to determine tech tree prerequisites I'm trying to figure out how to do what I can only call a recursive query (my knowledge of MySQL is extremely limited). The game I'm designing has a tech tree with items to research that will grant you stronger stuff down the line. The prerequisites are broken down in another table, since each tech item can have 0 or more prereqs.

CREATE  TABLE IF NOT EXISTS `tech` (
  `id` INT NOT NULL ,
  `name` VARCHAR(45) NULL DEFAULT NULL ,
  PRIMARY KEY (`id`) );
CREATE  TABLE IF NOT EXISTS `prereq` (
  `src_id` INT NOT NULL ,
  `prereq_id` INT NOT NULL );
INSERT INTO tech (`id`,`name`) VALUES(1001, 'Logic');
INSERT INTO tech (`id`,`name`) VALUES(1002, 'Classical Physics');
INSERT INTO tech (`id`,`name`) VALUES(1005, 'Global Economics');
INSERT INTO tech (`id`,`name`) VALUES(1008, 'Solar Power Collector');
INSERT INTO prereq (`src_id`,`prereq_id`) VALUES (1008,1005);
INSERT INTO prereq (`src_id`,`prereq_id`) VALUES (1005,1001);
INSERT INTO prereq (`src_id`,`prereq_id`) VALUES (1005,1002);
INSERT INTO prereq (`src_id`,`prereq_id`) VALUES (1001,NULL);
INSERT INTO prereq (`src_id`,`prereq_id`) VALUES (1002,NULL);

With this set up, I can query the tables and find that if I want solar power, I need to first research Global Economics:

SELECT t.name, t.id, GROUP_CONCAT(p.prereq_id ORDER BY p.prereq_id ASC)
FROM tech t LEFT JOIN prereq p on t.id=p.src_id
WHERE t.id=1008
GROUP BY t.name, t.id
ORDER BY t.id

What I'm trying to get at is a result set that include the next level of prerequisites, then the next, until we hit nodes that have NULL. So I'm looking for this:

id     name
1008   Solar Power Collector
1005   Global Economics
1001   Logic
1002   Classical Physics

Is this even possible within MySQL? I tried to use a cursor, but was unsuccessful. I could handle this within the actual code, but I'd rather it be done server side somehow.

Any help in pointing me in the right direction would be greatly appreciated!

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:
Performance of manipulating a mesh in realtime Does Unity allow streaming mesh data that can be continuously changed?

I have a level that is dynamically changing based on some parameters. The number of triangles stays the same, they just change positions.

I'm speaking of around 2000 triangles that need their position updated each frame (they follow a spline that is computed on CPU), running on mobile phones.

I can't use a TrailRenderer because the object is a whole level. I can't use bones, because I need to know the final position for each vertex for my custom collision code.

The mesh should be marked Mesh.MarkDynamic.

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:
Is Pushdown Automata better for user input than Hierarchical State Machine? I saw an example of code using HSM for user input, but to me it seems that Pushdown Automata would be a better fit. I'm confused.

If I'm right, then after Hierarchical State Machine exits a superstate via substate, and comes back, it must start at a default state and cannot return to the substate it left earlier(unless of course, that default state is the substate). And then, if I'm right, Pushdown Automata could replace that need, as it can return to an older state via its stack and discarding of states.

Say I have an actor I control, and it has several states that use user input as transitions. It supports jumping, ducking, standing and walking. When you are standing or walking, you can jump or duck, after which you return to the state you were in, thus standing or walking. If I were to use an HSM to prevent the duplication of code, I could not return to the last state. But if I used a Pushdown Automata, I could put jumping or ducking on top of the stack and discard them after they are done, and that way I could return to the state I was in.

Correct me if I'm wrong, and suggest me better options for user input than these two, if there is. Also, please don't post options like duplicating the FSM as the amount of states could vary and my question is related exactly to how to prevent that duplication.

Thanks,

me.

sentences: How to achieve a hard edge at this geometrical intersection? Im trying to make this edge appear smooth, soo that the faces on each side seem to meet up smoothly. But I want the green edges around this to be hard and sharp. I am using 3ds max, and this is the result.

sentences:
Understanding SpriteBatch.Draw overload XNA I'm talking about the
public void Draw (Texture2D texture, Vector2 position, Nullable sourceRectangle, Color color, float rotation, Vector2 origin, float scale, SpriteEffects effects, float layerDepth) method.

My Sprite has Scaling, Position and Rotation.  I want it to rotate from the center, towards the mouse.

This is the method I've tried using so far:

public void RotateTo(Vector2 point)
{
    var angle = AngleBetween(Position, point);
    Rotation = MathHelper.ToRadians((float)angle);
}
public static double AngleBetween(Vector2 first, Vector2 second)
{
    double sin = first.X * second.Y - second.X * first.Y;
    double cos = first.X * second.X + first.Y * second.Y;
    return Math.Atan2(sin, cos) * (180 / Math.PI);
}

But as you can imagine, this didn't work well. First of all, the origin of the sprite wasn't the center. I've tried changing the origin parameter in the Draw method to sprite.Texture.Bounds.Center.ToVector() (ToVector is an extention method) but that also didn't work. The sprite was rotating in a weird way, not focusing around the mouse, because it seemed that the sprite was rotating around a different center point, not the mouse itself.

I didn't manage to find in depth explanations about SpriteBatch.Draw, so I hoped someone here would have the knowledge and experience to help me.

Thanks for reading, and thanks in advance for the help!

sentences:
Too many neighbors when pathfinding in Sparse Voxel Octree Imagine we have upto 9 or so layers (that is depth), and due to some big colliding platform in the level, one of the empty nodes close to the root have all much smaller nodes as neighbors at one of its faces. If my calculations are not wrong, in the worst case scenario the number of neighbors on a face would be equal to power(2, absolute(depthA - depthB) * 2). For example, power(2, absolute(8 - 2) * 2) = 4096 little neighbors in direction of only one of the faces of the bigger node.

I'm implementing a linear tree (just saving all location codes in a set). I know how to find neighbors. I have no idea how to deal with high number of neighbors in cases like this when running A*. Both, finding all neighbors and iterating over all of them would take too much time.

I have taken a look at the GDC "Getting of the NavMesh by Daniel Brewer", but their example for neighbors of different sizes was only for difference of 1, which would return only 4 neighbors per face.

sentences:
Tips for implementing MMO quest mechanics? What tools, patterns, or best practices would you recommend to implement the quest mechanics given below listed requirements?

I am talking about software architecture (how generic should you be) and choices for object wiring, event subscription, and representation of conditions. Mentioning of tools / libraries you have successfully used are welcome.
Edit: If you are using scripting, what setup do you recommend?

Requirements:

simple 2D mmo(rpg)
all the game data, including quests, is stored in a relational database
any event in the game could trigger a new quest for players or advancement of existing quests
a quest can have an arbitrary number of conditions that must be met before the quest is available to players
a quest can consist of an arbitrary number of sub-quests / steps with arbitrary conditions
quests would range from simple:

talk to A - kill 5 B - talk to A - permanently increase health
to quite involved:

use item in area X - go to area Y - a bot will spawn - kill bot without taking more than 10% damage - bot drops item - pick up item - portal unlocks - deliver item to J behind the portal - receive gold and experience - allow to pass portal once more - lock portal for this player
level instances are a possibility (players can complete certain quests in teams or isolation which will spawn the level location just for those participants)
Quests should preferably be manageable using a world editor without scripting or programming knowledge (Edit: not advocating against scripting in general though)
I assume C++ as the language of implementation

I was thinking that if I could combine any chain of events and conditions we could model more complex and thus possibly more engaging quests.
I experimented with rolling my own ECA (Events-Conditions-Actions) engine but that might be overkill. It has been particularly difficult to model generic conditions without using any sort of scripting.

sentences:
How do I know when the app is launched, loses focus and gets focus again on mobile? I searched in Unity Documentation but there are no information. I'd like to know which methods is called and what it returns in the following scenarios on Android:

App initially starts
App goes in the background
App is brought forward after being in the background

As for IOs I know that the scenarios should be the following:

App initially starts:

OnApplicationFocus(true) is called
App goes in the background:

OnApplicationFocus(false) is called

OnApplicationPause(true) is called
App is brought forward after being in the background:

OnApplicationPause(false) is called

OnApplicationFocus(true) is called

sentences:
TextAsset thinks file is ~6856 bytes when it is 120123 bytes So I've created a text asset in Unity of a binary file which i'm attempting to read in as a byte array.

The result I'm getting is a byte array tht is almost half the size it's supposed to be.

The file is a serialized mesh file from here: http://wiki.unity3d.com/index.php?title=MeshSerializer2

What I do then is find the file unity created, move it to the assets folder and drag it into a component as a TextAsset. For smaller files it works but larger ones appear to fail to load completely.

If I load the same file separately from a C# console application using filestream it loads correctly.

sentences:
Where and how to store players collection in a computer card game? I am developing a trading card game ( something like Hearthstone but not as complex) and I am faced with the following problem: I don't know what is the optimal way to store players collections and decks (the cards that they have available).

I thought of storing their collections on a local file on their device, but that seems bad, as they could probably modify that file and get themselves cards that they shouldn't have.

The second idea is that i could save all their decks and collection in a database. But having one table for each player isn't possible. Having one table with all that data something like PlayerCards(id, cardId, playerName, deckName) seems like it might work, but the table would be huge, and containg quite a bit of redundant data (cards that are in the same collection but are in multiple decks).

What would be the proper way to do it?

sentences:
2d array with empty elements I am working on a game with a number of different grid components. Each grid would be about 15 squares wide by 15 squares tall. Each of the squares may either contain an item or not.

Is there any way to create this array and only include the components that have a value. Example (for a 5x5 array):

[
   [5,3, , ,3],
   [ ,1,0,2,2],
   [ , , , , ],
   [5, , ,2, ],
   [ , , , ,1]
]

Is there any way to do this in JavaScript or should I just add a bunch of NULL values to the array?

A simplified version of this, might be an Xs and Os game. Before the game starts all squares are empty. Over time, some of the grid may have either Xs or Os in specific squares.

sentences:
How to bundle a HTML5 JavaScript game as native Windows application? As the web browsers evolve, HTML5 game development with JavaScript, Canvas, webgl is increasingly becoming popular. The advantage of web-based games compared to native apps is that they run on multiple platforms, and you don't have to fiddle with OS-specific libraries or programming environments.

You can already sell your web games via the chrome web store, but I think it's too unpopular yet for being profitable for indie game developers.

I think you may reach a larger crowd by selling your games at the Mac App Store or Steam, but therefore you have to bundle it as standalone application.

For mac, you can easily bundle your HTML5 games as native app by using the Apple's WebView component. Here is an example on how to do that.

Now I wonder: is there an equivalent way for Windows platform?

sentences:
Cocos 2D putting things on the cocos thread or not? We are using Cocos 2D for Android and are unsure if it's a good thing to execute our non-ui tasks on the Cocos thread as a way to get the animations in our game to pause.

What is the recommended practice?

sentences:
How do I write a game server with single-threaded networking? I want to write a game server with one thread for clients message handling and use something like epoll to accept network messages. All I/O and database access will be processed in a thread pool and they are asynchronous and non-blocking.

Given such a scheme, how should I handle other events/messages (physics, game logic, etc)? Can I implement methods to handle these messages as a blocking interface in the main thread?

What simple, popular servers exist (using Cocos*d/Unity as client) that I could look at for an example of this?

sentences:
DRY 0-bandwidth-overhead-serialization in C#: virtual, delegates or reflection? I'm (de)serializing some datastructures for a network-multiplayer game, and for each datastructure that's to be (de)serialized, I want to define the order of (de)serialization only once for maintainability without any additional bandwidth overhead, and as little performance cost and extra typing as possible.

I can use C#'s abstract class methods to achieve my goal, but there's several problems with doing so:

performance: adding an additional abstract method call to each (de)serialization operation isn't ideal
extra typing: I have to needlessly initialize all variables I'm deserializing because C# won't allow me to pass "ref" and "out" parameters interchangeably

How can I avoid duplicating the definition of a datastructure's (de)serialization while also avoiding some or all of the above issues, and continuing to avoid any additional bandwidth cost?

(ProtoBufs and BinaryFormatter both seem to use some additional bandwidth for metadata to describe the "payload" data, and XmlSerializer, DataContractSerializer and NetDataContractSerializer are all xml based and therefore more bandwidth intensive than a straight binary serialization. I also toyed with delegates and reflection, but this solution came to me most readily):

public struct ControllerSnapshot
{
    public Vector2 m_lStick;

    static private void Op(ref float lStickX, ref float lStickY, Op<float> op)
    {
        //define (de)serialization order here once and only once
        lStickX = op.Invoke(lStickX);
        lStickY = op.Invoke(lStickY);
    }
    public ControllerSnapshot(uLink.BitStream bitStream)
    {
        OpRead<float> opRead = new OpRead<float>(bitStream);
        float lStickX,lStickY;
        lStickX = lStickY = 0.0f;//2.can't use "out"; have to match Op's "ref" params
        Op(ref lStickX,ref lStickY,opRead);

        m_lStick = new Vector2(lStickX,lStickY);
    }
    public void Serialize(uLink.BitStream bitStream)
    {
        OpWrite<float> opWrite = new OpWrite<float>(bitStream);
        Op(ref m_lStick.x, ref m_lStick.y, opWrite);
    }
};

//in order to make the above work this needs to be defined:
abstract class Op<T>
{
    public Op(uLink.BitStream bitStream)
    {
        m_bitStream = bitStream;
    }
    abstract public T Invoke(T arg);

    protected uLink.BitStream m_bitStream;
}
class OpRead<T>:Op<T>
{
    public OpRead(uLink.BitStream bitStream) : base(bitStream) { }
    override public T Invoke(T arg)
    {
        return m_bitStream.Read<T>();
    }
}
class OpWrite<T>:Op<T>
{
    public OpWrite(uLink.BitStream bitStream) : base(bitStream) { }
    override public T Invoke(T arg)
    {
        m_bitStream.Write<T>(arg);
        return arg;
    }
}

//by contrast, the "obvious" code duplicates the order of (de)serialization, which I
//want to avoid, especially as (de)serialization becomes increasingly complex:
public ControllerSnapshot(uLink.BitStream bitStream)
{
    float lStickX,lStickY;
    lStickX = bitStream.Read<float>();
    lStickY = bitStream.Read<float>();

    m_lStick = new Vector2(lStickX,lStickY);
}
public void Serialize(uLink.BitStream bitStream)
{
    bitStream.Write<float>(m_lStick.x);
    bitStream.Write<float>(m_lStick.y);
}

sentences:
What is a good approach to dynamically change actor Position? In my card game there are 2 players with each player having a hand(a ListArray of  of Cards.In this case its handPlayer1).
The Card class extends Actor.This is the code I use to deal the cards to the first player(I call this in the show() method) :

 for (int i = 0; i < 6; i++) {
        handPlayer1.get(i).setPosition(20 + i * 35, TABLE_HEIGHT - CARD_HEIGHT - 30);
    }

For now whenever a player plays a card it is removed from their hand and moved to the table.If the player draws a card it is added to the hand of the player like so :

deck.get(deck.size() - 1).addAction(Actions.moveTo(handPlayer1.get(handPlayer1.size() - 1).getX() + 20, 30, 0.1f));

But the problem is that sometimes the cards go out of screen bounds when the player has too much cards and are not visible.

.What is a good way to manipulate the positioning of Actors so that the hand stays in the center and all cards are a set distance from one another? I have read up on Groups but I don't know if adding the cards to a Group would change anything.(Picture below for reference)

sentences:
Given a base class and many derived classes with additional features, what's the best practice for accessing those features? This might sound strange, but let me explain. Say I want to write a safari program.
In this safari there is an object pool of 10 animals (Animal*): 2 ostrich, 5 mosquitos, 2 spiders and a snake. Each of these inherits Animal. Both snake and spider are venomous so they have data reflecting it—let's say they additionally inherit IVenomous. The mosquito inherits IFlyer. The ostrich is left out in the cold with none of these additional features.
With venomous animals around, we'd want to prepare antivenom for the safari. So let's have prepareAntidote(). This function's job would be to check what kind of antivenom is needed and simply print it out. As part of implementing IVenomous, spider and snake each have the method const std::string& getVenomName(). The base animal class doesn't have this feature.
The issue then becomes: how do we access the getVenomName() method when all we know we have is a list of Animal, and we don't know which ones implement IVenomous and have a getVenomName() method available? What's considered good practice here?
I've considerd a brute force approach of making use of dynamic_cast<IVenomous*> while iterating over all animals, but this seems wasteful. And as bad is the fact that prepareAntidote() function needs to know what an animal is to handle the pool. So it would most probably be better for it to work on a container<IVenomous*>&, wouldn't it?
My idea is to have each interface's constructor register itself with some storage class which keeps a container of pointers for each interface, and de-registers itself on destruction, so we could access a list of IVenomous animals directly. So far an unordered_map looks the most reasonable for that job, with roughly constant time for access and removal, as well as not invalidating anything except on rehash. The pointer being its own key value.
It's actually the same problem with composition like components for example in games. (That's why I'm writing it here, because of that, chances may be higher to find answers here.) In this case it screams for "object pooling" of course, but let's cast aside memory locality in this case, that should be quite easy to add in later with overloading operator.

sentences:
How to apply steering to a physics body correctly when using a physics engine? I have a top down 2d game that uses a physics engine (Farseer).

I'm using the standard steering behaviors to make the AI move around but I'm not sure the correct way to take the so called "steering force" calculated by the steering behavior and apply it to the physics bodies.

For example:

The steering behavior SEEK returns

return desiredVelocity - currentVelocity;

So it is returning a difference of two velocities (in meters per second).

I need to convert this into the force (in Newtons) that I need to apply to my physics body, taking into account its mass and acceleration etc.

I know it should be simply but I'm getting confused! :)

sentences:
Load a simple text file through asset manager in libgdx It's easy to load a simple text file from the internal:

Gdx.files.internal("data/colors.txt");

But I currently use an AssetManager to load assets that are defined in an array of AssetDescriptor<?>s while a loading screen (with a progress indicator) is shown. So I'd like to use something like this in my array of descriptors:

...
new AssetDescriptor<_type_>(Gdx.files.internal("data/colors.txt"), _type_.class),
...

I'd like to load the file through an asset manager, so the overall progress can be displayed as the data/colors.txt file can get very large and therefore take longer to load (I use an tool to automatically generate a very long list of color definitions: RRR,GGG,BBB,AAA, each in the range of 0-255).

Is there a good way of doing this?

sentences:
OpenWorld SceneGraph management and optimization I have a SceneGraph class which for now is just a simple list implementation, and the only optimization I've planned so far is a check is something like this:

//GetDistance returns the distance between 2 objects
float maxViewDistance = 10.0f;

for(int i = 0; i < sceneList.count; i++)
{
    if(GetDistance(sceneList[i], playerObject) < maxViewDistance)
    {
        Renderer.Draw(sceneList[i]);
    }
}

I plan on filling the SceneList when loading the game from a file which has a bunch of objectIDs and their positions, and then loading each object data (like .FBX, .BMP) somewhere (in another file).
But since I don't intend on having loading screens (except when the game starts), wouldn't it become too much to iterate when drawing? For example if I have a sceneList with a million objects for the entire game, even if it's just checking an if for each objects, wouldn't that hurt performance?

I was thinking in making a sublist that will get populated only for the objects I'm currently drawing (that are less than the maxDistance I set), but then I'd need to update this subList everytime the player takes a step, and I'd need to check for all objects in my entire objectList to see which are going to be draw next, so I don't think it'll help anyhow.

Also, for physics, I was also iterating through my sceneList and forcing every object to my physics rules (only gravity for now), but if I add for collision checks, what's the best way to do it?

//Inside my game update function
for(int i = 0; i < sceneList.count; i++)
{
    UpdatePhysics(sceneList[i]);
}

[...]

void UpdatePhysics(Object* object)
{
    //I'd need to check for collisions against **all** objects inside my sceneList again? Isn't there a better way to do this?
}

How games such as WoW (open world with no loading screens between large amounts of zones) do?
And for Physics, such as Deus Ex, where any object you throw in the air will be affected by gravity and will have collision against wherever is in it's path?

sentences:
Is 2 lines of push/pop code for each pre-draw-state too many? I'm trying to simplify vector graphics management in XNA; currently by incorporating state preservation. 2X lines of push/pop code for X states feels like too many, and it just feels wrong to have 2 lines of code that look identical except for one being push() and the other being pop().

The goal is to eradicate this repetitiveness,and I hoped to do so by creating an interface in which a client can give class/struct refs in which he wants restored after the rendering calls.

Also note that many beginner-programmers will be using this, so forcing lambda expressions or other advanced C# features to be used in client code is not a good idea.

I attempted to accomplish my goal by using Daniel Earwicker's Ptr class:

    public class Ptr<T>
    {
        Func<T> getter;
        Action<T> setter;

        public Ptr(Func<T> g, Action<T> s)
        {
            getter = g;
            setter = s;
        }

        public T Deref
        {
            get { return getter(); }
            set { setter(value); }
        }
    }

an extension method:

        //doesn't work for structs since this is just syntatic sugar
        public static Ptr<T> GetPtr <T> (this T obj) {
            return new Ptr<T>( ()=> obj, v=> obj=v );
        }

and a Push Function:

        //returns a Pop Action for later calling
        public static Action Push <T> (ref T structure) where T: struct
        {
            T pushedValue = structure; //copies the struct data
            Ptr<T> p = structure.GetPtr();

            return new Action( ()=> {p.Deref = pushedValue;} );
        }

However this doesn't work as stated in the code.

How might I accomplish my goal?

Example of code to be refactored:

    protected override void RenderLocally (GraphicsDevice device)
    {
        if (!(bool)isCompiled) {Compile();}

        //TODO: make sure state settings don't implicitly delete any buffers/resources
        RasterizerState oldRasterState = device.RasterizerState;
        DepthFormat oldFormat = device.PresentationParameters.DepthStencilFormat;
        DepthStencilState oldBufferState = device.DepthStencilState;
        {
             //Rendering code
        }
        device.RasterizerState = oldRasterState;
        device.DepthStencilState = oldBufferState;
        device.PresentationParameters.DepthStencilFormat = oldFormat;
    }

sentences:
How to find all possible destinations, within a certain walking distance of a unit? I have a standard 2D grid that i use for pathfinding.
I already use A* to find the path of my units when I want to move them around.

What I need to implement now is a preview of all possible destinations of the unit when it is selected.

Here is what I want to achieve.

The yellow/orange cells represent the possible destinations.

I want to make this as optimized as possible, because it can be executed on very big maps and for multiple units.

I have something in mind but I wonder if there is better approach for this.

Here is my idea:

Get a list of all cells that are walkable in a square around my unit.
The square will be from Unit.X - Unit.Speed to Unit.X + Unit.Speed for X axis and Unit.Y - Unit.Speed to Unit.Y + Unit.Speed for Y axis.
For each element in this list, execute A* search to see if it is possible to find a path.

By doing the search for only the cells that are within my unit range I should be able to do this on big maps.

Basically this is the same feature that we have in games like Heroes 3 and many other turn based games.

Screenshot:

I was also wondering when it is a good idea to execute this pathfinding logic.
When you select a unit (might result a spike) or when something moves on the map to update the list of all possible destinations of all units on the map.

sentences:
Can I use quaternions and do a partial multiplication? I have some code that rotates an object around an axis. It does this by creating a quaternion for a rotation and then multiplying by the old orientation:

nextRot = QuaternionRotationAxis( axis, rotSpeed * elapsed )
newOrient = QuaternionMul( oldOrient, nextRot )

This need to create the rotation quaternion each time seems like it may be redundant. Is it possible to somehow create a quaternion and somehow apply elapsed to it? That is I would prefer code like this:

nextRot = SomeOp( fullRotationQuat, elapsed )

In this way I can store fullRotationQuat in my object and simply apply it partially on each time step.

I know that if I apply nextRot twice, it would be like doulbing the ellapsed time. So I'm guessing I might want some kind of quaternion exponentation. Is this a define op? More importantly, is its performance still acceptable (or faster) than creating from an axis/angle each time?

sentences:
Difference and interaction between Viewport and Camera I'm very very confused about some very basic concepts in game/grafical developing. The interaction between the individual components (camera, viewport, window-sizes, gameworld-sizes, ...) when rendering graphical things are still confusing me.

As far as I understand:

A camera "filming"/viewing something as long it is between the near- and the far-clipping plane
Camera has a Width and Height which defines the area of what will get "viewed"... ?

The viewport can connect to an camera
the viewport is the area which will get shown withing the window
the cameras view will get projected onto the viewport
so if the camera has a size of 1024x768 and the viewport ist only 300x400, the 1024 pixels will get upset on 300 "real" pixels

As you may have have recognized Im very unsure about this. Maybe you can help me with that.

I want to run the test-app down bellow in a way, that the picture will not get stretched. Also Im wondering what "game coordinates" are in that context.
For Demo-Cases and learning I've just created a piece of src:

package com.mygdx.game;

import ...

public class MyGdxGame extends ApplicationAdapter {
    public PerspectiveCamera cam;
    public Model model;
    public ModelBatch modelBatch;
    public ModelInstance instance;
    private FitViewport viewport;

    @Override
    public void create() {
        modelBatch = new ModelBatch();

        // creating a camera; gets width and height from the window
        // so it will "fit" best in the current window
        cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        cam.position.set(10f, 10f, 10f);
        cam.lookAt(0, 0, 0);
        cam.near = 1f;
        cam.far = 300f;
        cam.update();

        // creating viewport; width n height r not really necessary since it gets new
        // values within
        // the rezise() method; correct?
        viewport = new FitViewport(1920, 1080, cam);

        ModelBuilder modelBuilder = new ModelBuilder();
        model = modelBuilder.createBox(5f, 5f, 5f, new Material(ColorAttribute.createDiffuse(Color.GREEN)),
                Usage.Position | Usage.Normal);
        instance = new ModelInstance(model);
    }

    @Override
    public void render() {
        Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);

        // what is happening here?
        cam.update();

        modelBatch.begin(cam);
        modelBatch.render(instance);
        modelBatch.end();
    }

    @Override
    public void dispose() {
        model.dispose();
    }

    @Override
    public void resize(int w, int h) {

        // putting new values into the viewport
        // and updating it will "resize" the camera ... ?
        float aspectRatio = (float) w / (float) h;
        // viewport.update((int) (h * aspectRatio), h);
        viewport.update(1920, 1080);
        viewport.update(w, h);
    }
}

sentences:
Arbitrary Rotation about a Sphere I'm coding a mechanic which allows a user to move around the surface of a sphere. The position on the sphere is currently stored as theta and phi, where theta is the angle between the z-axis and the xz projection of the current position (i.e. rotation about the y axis), and phi is the angle from the y-axis to the position. I explained that poorly, but it is essentially theta = yaw, phi = pitch

Vector3 position = new Vector3(0,0,1);
position.X = (float)Math.Sin(phi) * (float)Math.Sin(theta);
position.Y = (float)Math.Sin(phi) * (float)Math.Cos(theta);
position.Z = (float)Math.Cos(phi);
position *= r;

I believe this is accurate, however I could be wrong.
I need to be able to move in an arbitrary pseudo two dimensional direction around the surface of a sphere at the origin of world space with radius r. For example, holding W should move around the sphere in an upwards direction relative to the orientation of the player.

I believe I should be using a Quaternion to represent the position/orientation on the sphere, but I can't think of the correct way of doing it. Spherical geometry is not my strong suit.

Essentially, I need to fill the following block:

public void Move(Direction dir)
{
    switch (dir)
    {
        case Direction.Left:
            // update quaternion to rotate left
            break;
        case Direction.Right:
            // update quaternion to rotate right
            break;
        case Direction.Up:
            // update quaternion to rotate upward
            break;
        case Direction.Down:
            // update quaternion to rotate downward
            break;
    }
}

sentences:
numeric identifiers associative array edit: clarified my question. I also realized that I didn't pick a very conclusive question title, which unfortunately I cannot change anymore, sorry.

Hey everyone,

to improve my programming skills a little and getting familiar with good design patterns, I'm trying to program a litte turn based strategy game, and I am at the point to choose a good data structure for the configuration of different terraintypes and unittypes etc. which do exist.

What I have implemented so far is a big "Game Object" with knowledge about everything in the game, and many of its properties are big associative arrays (I'm using PHP, but my question doesn't really have to do much with the language), for example an arrays of units, a map array.... What my array structure is comparable to is the type object pattern mentioned here.

Example: A single unit is of a certain type, say 'Infantry', and shares many data with all the other infantry untis on the field. Instead of copying all these values, I give every unit a "type" so it can look up the details there. Similar with terraintypes. Example:

terraintypes = array()
terraintypes[0] = array()
terraintypes[0]['name'] = 'Forest'
terraintypes[0]['capturable'] = false

unittypes = array()
unittypes[0] = array()
unittypes[0]['name'] = 'Infantry'
unittypes[0]['movecost'] = array()
unittypes[0]['movecost'][0] = 5 //Movementpoints needed for forest
unittypes[0]['movecost'][1] = 7 //Movementpoints needed for terraintype 1

A specific unit or tile on the map wouldn't know its movement costs or name, but would be able to look that up in the unittypes array. Example:

sometile = array();
sometile['owner'] = whatever
sometile['type'] = 0; //this tile is a forest

someunit = array()
someunit['type'] = 0 //This is an "Infantry".

The problem is that getting any kind of information will produce very verbose code, for example finding out how much it costs for a unit to move onto a tile will be

unittypes[unit['type']]['movecost'][tile['type']]

I am trying right now to move to using more objects and classes, so if I give a unit a reference to its unittype, it can lookup information itself, for example

terraintypes[0] = new Terraintype('Forest')
unittypes[0] = new Unittype('Infantry')
someunit = new Unit(unittypes[0])

Now, if I ask a unit something only its unittype would now, the unit can look it up itself, e.g. someunit.getName() will be implemented in the unit like this.unittype.getName().

So far so good. However, how could a unittype store its movecost on the different terrains? Basically I would need an array indexed with terraintypes, but as that is not possible, I will have to swhich back to translate everything to numeric keys, and have a movecost value for every pair (terraintype, unittype).

Who assigns these numeric keys and where? Will every single unittype need to store some kind of identifier which is unique among all the unittypes?
Should I use some constants like const FOREST = 0; const ROAD = 1; const INFANTRY = 0; const VEHICLES = 1 etc?

Another of my problems for finding a good data structure is that if I don't give the game all the data directly, but break everything down to smaller parts, then many parts will need to know about the same objects.

For example, if the Map object knows about all tiles of the map and the units on it, then the game doesn't really know anything about the units, it only knows about the map, and every command in the game which affects a unit needs to be passed to the map, even though its not actually a "map task", like healing units.

This seems like breaking the single responsibility pattern. However, storing references to all the units in several places (so both the Map and something else store references to units) seems to be troublesome with bookkeeping.

To sum it up a little, can you hint me to data structure which are suitable to represent what I am describing? Thanks in advance!

sentences:
Finetuning movement based on gradual rotation towards a target I have an object which moves towards a target destination by gradually adjusting its facing while moving forwards. If the target destination is in a "blind spot", then the object is incapable of reaching it.

This problem is ilustrated in the picture below. When the arrow is ordered to move to point A, it will only end up circling around it (following the red circle) because it is not able to adjust its rotation quickly enough.

I'm interested in a solution where the movement speed is multiplied by a number from 0.1 to 1 in proportion to necessity. The problem is, how do I calculate whether it is necessary in the first place? How do I calculate an appropriate multiplier that is neither too small nor too large?

    void moveToPoint(sf::Vector2f destination) {
        if (destination == position) return;

        auto movement_distance = distanceBetweenPoints(position, destination);
        desired_rotation = angleBetweenPoints(position, destination);

        /// Check whether rotation should be adjusted
        if (rotation != desired_rotation) {
            /// Check whether the object can achieve the desired rotation within the next adjustment of its rotation
            if (Radian::isWithinDistance(rotation, desired_rotation, rotation_speed)) {
                rotation = desired_rotation;
            } else {
                /// Determine whether to increment or decrement rotation in order to achieve desired rotation
                if (Radian::convert(desired_rotation - rotation) > 0) {
                    /// Increment rotation
                    rotation += rotation_speed;
                } else {
                    /// Decrement rotation
                    rotation -= rotation_speed;
                }
            }
        }

        if (movement_distance < movement_speed) {
            position = destination;
        } else {
            position.x = position.x + movement_speed*cos(rotation);
            position.y = position.y + movement_speed*sin(rotation);
        }
        updateGraphics();
    }

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:
Zoom camera on player I am developing a simple side scrolling game. I want to target and zoom camera on player when he dies. But it rotates the screen, and I want to prevent it. I'm copying the snippet of code here :

IEnumerator ZoomIn()
{
    while (GameCamera.orthographicSize > 2) {
        yield return new WaitForSeconds (0.01f);
        GameCamera.orthographicSize -= 0.2f;
    }
}

public void ZoomCamera()
{
    CameraZoomSource.Play ();
    StartCoroutine (ZoomIn ());
}

public void TargetPlayer()
{
    transform.LookAt (PlayerTransform);
    GameCamera.orthographicSize = 3;
    GameCamera.transform.Rotate (0, 0, -2);
}

Should I change anything in this?

sentences:
How do I add a sprite to an object layer? I am using Tiled to create a map which I am then using for a game written in Phaser.

I cannot figure out how to add a Sprite into the Object layer using the Tiled editor.   I am having to do it with code but that's not ideal as I want to see the sprites in their positions on the map when I edit it.

I know this is very simple but I cannot see how to add/see sprites in Tiled.  Is Tiled not able to do this or not designed to do this?

sentences:
Accessing a C++-based optimization library in FlashPunk Some time ago I launched my FlashPunk primer, an adaption of Asteroids, which mainly served as a basis for trying out a simple optimization algorithm.

Now I'm planning to take this concept a level further and program a version of Lunar Lander. This would require to incorporate a sophisticated external C++-based numerical optimization library into my Flash Punk code.

When looking for a solution I came across the Crossbridge compiler. If I got it correctly, it would allow for writing native C++, accessing flash functions via the AS3 header and have it compiled to a *.swf-file.

Would that mean I have to give up FlashPunk and write the whole piece in C++/AS3?

sentences:
Collision between player and heightmap Im programming a small project, an opengl height map.
It is build of triangles, which points are fit to the right y position (read out of an image).

The player is represanted by a cuboid. (p1, p2, ... p8).
now, i want to implement collision detection between the player and the heightmap.

I thought about split the whole world in cubes, and this cubes again in cubes, and then distribute the triangles of the heightmap in this cubes (then check for the big cube, the smaller cube, which contains the player, and then check all triangles for collision).

But which collision detection method would be the best here, and how could i implement it?
(By the way, im using lwjgl [java])

sentences:
Implementing a score cheating prevention system in an offline game with an online score board: How to protect game fairness? This is hopefully a very simple question. It isn't about loading assets (which is all I found while searching)

Basically I have a template, say Object_Monster that has stats, abilities, etc. But I don't want to abstract it and create Object_Monster_Witch, Object_Monster_Ghoul and so on.

I want to know the best way to store data for loading many "different" monsters for one monster class. But I don't want the data to be editable by players.

For example. Lets say a Ghoul has 50 max health, the name "Ghoul" and the Consume ability. I would want all those variables listed somewhere to then be loaded into Object_Monster so he can act as a Ghoul.

I hear people use XML for this sort of thing, but that is of course, edited on the fly. Should I be using just an in-code list of #defines? An array of monster data?

sentences:
How can I find the minimum required radius to draw a visible circle? The problem is that if for example xradius and yradius are set to 5 and the object is too big the circle will be hide under the object and won't be visible.
So I want to find the minimum radius require to draw a visible circle.

So I'm trying to use a recurse and loop over all the childs including the root objects to find what is the biggest radius and then to draw a circle according to the biggest radius.

I created a new method FindRadius.
The problem is how to get from this method the biggest radius from the List and then how to draw the circle on this radius size ? What xradius and yardius will be after finding the biggest radius ?

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

[RequireComponent(typeof(LineRenderer))]
public class DrawCircle : MonoBehaviour
{
    [Range(0, 50)]
    public int segments = 50;
    [Range(0, 50)]
    public float xradius = 5;
    [Range(0, 50)]
    public float yradius = 5;
    public bool minimumRequireRadius = false;
    LineRenderer line;
    private List<float> radiusList = new List<float>();

    void Start()
    {
        FindRadius(transform);

        line = gameObject.GetComponent<LineRenderer>();
        line.positionCount = segments + 1;
        line.useWorldSpace = false;
        CreatePoints();
    }

    void Update()
    {
        CreatePoints();
    }

    void CreatePoints()
    {
        float x;
        float y;
        float z;

        float angle = 20f;

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

    private float FindRadius(Transform root)
    {
        foreach (Transform child in root)
        {
            TraverseHierarchy(child);

            var rend = child.GetComponent<Renderer>();
            if (rend != null)
            {
                float radius = rend.bounds.extents.magnitude;
                radiusList.Add(radius);
            }
        }

        return radiusList[0];
    }
}

This is for RTS games too when selecting a unit and there should be a circle around it mark that the unit have been selected.

For example now there is a circle drawn on the MissilesTurret the problem is that the circle radius is xradius 5 and yradius 5 the circle is too short and hiding under the turret base part so it can't be seen only if I will make a lot of zoom in:

And this is after making zoom in to the base part:

Now if before running the game I'm changing the radius of the circle from 5/5 to for example xradius and yradius to 10 now you can see the circle:

My problem is how do I know what radius the circle should be drawn for each unit/s ? Each unit have another radius/size. I don't want to draw it with the mouse for selecting yet I want it to be drawn and selected automatic. So I thought to calculate the minimum required radius for drawing the circle to be see it.

sentences:
Why does my character stop a little before landing on the ground? I made a little game with side-scrolling and a box (the player) jumping across the level. The simple physics are almost done, but I have two problem with the way things behave:

On landing, the box takes a little time to reach the floor
When the box hit a roof, there is always a little space between it and the object.

Here is my collision code (in the player's Step Event):

myGravity = 0.5;
if (vspeed > 10)  vspeed = 10;

speedAir = abs(vspeed+1);

//ON_FLOOR = !(place_free(x, y + speedAir));
ON_AIR = place_free(x, y + speedAir);

FREE_RIGHT = place_free(x + speedScreen, y);
FREE_UP = place_free(x, y - speedAir);

KEY_UP = keyboard_check(vk_up);
KEY_LEFT = keyboard_check(vk_left);
KEY_RIGHT = keyboard_check(vk_right);
KEY_FIRE = keyboard_check(vk_space);

/* JUMP */
if ON_AIR
{
    gravity = myGravity;
    gravity_direction = 270;

    if !(FREE_UP)
    {
        vspeed = 0;
    }
}

else // if ON_FLOOR
{
    gravity = 0;
    gravity_direction = 270;
    vspeed = 0;

    // JUMP
    if KEY_UP & FREE_UP
    {
        vspeed = -10;
    }
}

/* LATERAL */
if (FREE_RIGHT)
{
    x += speedScreen; // screen side-scrolling
}

How can I do this correctly?

sentences:
How should I store trading cards? I'm working on a Magic-esque TCG in Unity. Currently, the cards themselves are all prefabs: I have a Satyr Archer prefab, a Candle Wisp prefab, etc. This works fine for now, since I only have a few cards, but by the time I get to several hundred, I feel that this may become unwieldy.

Are prefabs a good way to store a large list of cards? Should I be making those prefabs using an XML document and a script?

sentences:
Issue calculating new angle for player to look at some 3d world object I am working on a Unity game where the Euler angles of the player display some weird behaviour that I cannot understand. There seem to be two full 360 degrees rotations, one positive and one negative. Depending on the direction you go when you are at 0 degrees, it will either take the negative path or the positive path. This means the player can have totally different yaw values depending on if it takes the green or red path. See the following image to get an idea of what is happening:

The issue now comes when I want to calculate the new angle for the player to look at some specific object in the 3d world space. I calculate this angle using some simple math:

// make player the origin, so the target is relative to the player
Vector3 delta = player.angles - target.angles;

float magnitude = delta.Length();

float pitch = asin((delta.y) / magnitude) * (180 / M_PI);
float yaw  = -atan2(delta.x, -delta.z) * (180 / M_PI);

This will give me back correct angles, but the yaw is from 0 to 180, then -180 to 0 again. I correct for this doing:

// this makes sure the calculated angle is from 0-360
if (yaw < 0) {
    yaw += 360; // normalize yaw
}

So, right now this is aligned with the red rotation line illustrated in the picture above. If I would set the players rotation to the new calculated angle, it would look correctly at the target object directly. But ONLY when the player is on the red rotation path.

If the player for example is on the green rotation path the calculated angle doesn't fit for the current users rotation. If I would set the rotation now, things get quirky. Somehow I need to compensate the calculated new player angle.

What is going on here? and is it possible to manipulate the new calculated angle (which ranges always from 0-360) so it is based on the current players rotation path (either green or red)?

I hope my question makes sense, I found it quite hard to follow what is going on. I hope someone could explain me the situation and ultimately help me out to fix the new calculated angle so it adjusts to the current player rotation path!

Any help is appreciated, thanks in advance!

EDIT
So I came up with the following to make sure the player is always rotated the shortest amount, taking both green and red rotation paths into consideration:

// normalize angles for when using negative rotation
if (localAngles[1] < -180)
{
    angles[1] -= 360;
}

double diffPitch = (angles[0] - localAngles[0]);
double diffYaw = (angles[1] - localAngles[1]);

// this makes sure we always take the shortest amount of degrees to target
if (diffYaw < -180)
{
    diffYaw += 360;
}
if (diffYaw > 180)
{
    diffYaw -= 360;
}

I will have to test some more to be sure this is the solution.

sentences:
How do I program a fan in a platformer game? Fan physics

I have a platformer game and want to have fans in it that blow in a given direction and if the player presses the jump button they can go even further.

How do I do this?

side note:

I am working with godot engine

EDIT

My character moves on the two axes using two variables, both multiplied by speed: move_dir and y_velo. gravity affects y_velo and the arrow keys affect move_dir

sentences:
How to move vertices of matrix in order to cast a 2d shadow? I am trying to add shadows to my 2D xna game. Currently I have created a "shadow" using the texture of the caster with a transparent gray color, rotated, and stretched using a matrix. This, though, does not look like a real shadow, obviously. What I'm pretty sure I have to do is individually move the vertices of the matrix somehow in order to create a parallelogram so that the top and bottom sides are always parallel to the ground.

So, here are my questions:

1) Is this the correct way to cast shadows in a 2D game?

2) If so, how do I make a parallelogram out of the matrix? I've tried a vertex shader but that didn't go very well. I've also seen some people talk about using bones and using DynamicVertexBuffer, but I have no clue how to use them and can't find a tutorial on them.

3) If it isn't the correct way of casting shadows, then how should I do it? I don't want shadows like in Catalin's method, I want them to look like the shadow caster.

EDIT: I also just learned that the transformation I think I need to do is skew the matrix. XNA unfortunately does not include methods to do that, though.

EDIT 2: Here's a picture of the type of affine transformation I want to do (skewing):

I have sort of solved the problem and in-case anyone else wants to know how to skew horizontally here is how:

Matrix skew = Matrix.Identity;
skew.M12 = (float)Math.Tan(Math.PI / 4); // replace Math.PI / 4 with the radian amount you want

I need to skew vertically (which I can do by rotating and rotating back, but is there a more efficient way?), though and would still like to know if this is the correct way of going about creating shadows in a 2D game, though

EDIT 3: Here's what I have done in my game, and this is how the shadows should look. I've used a bunch of math and transforming to achieve the matrix for the shadow. Hopefully I've done it the right way

sentences:
What rendering techniques would I use to draw a drop shadow effect for cards in a card game? What type of shading algorithm might be used to create shadows like these?

the one I'm making is similar but it is all done with a 2D drawing API powered by OpenGL so there is no Z coordinate.

In addition, for the hand itself, I'd really like to get a shaded feel like seen here:

I'm just not sure how to achieve a shaded look close to that.

The number of cards is bound to change and the cards get thrown onto the table so I can't use any type of light map of sorts.

What sorts of algorithms should I look into (aside from blur which I know 'll need to do?)

Thanks

Update

I'm making a 2D card game. I want to add dropshadows offset from the cards, a bit like:

The way I'm thinking of doing it is:

Keep a texture that is the same size as the backbuffer.
Draw dark rectangles as makeshift cards to that texture.
Blur that texture.
Draw my cards to that texture.
Do additional lighting on the cards.
Draw this texture to the backbuffer.

My questions are:

Is this the right way to do this?
Is there a way to do it without render to texture (keeping a bitmap
as big as the backbuffer)?
Is it safe to assume that the maximum texture size will not be
exceeded by the backbuffer size? (What I mean is, if the backbuffer
is 2000x3000, then is it safe to say that I can create a texture in
video memory of that size?

Thanks

sentences: Snapping of irregular images in iphone puzzle app I am working on puzzle app in which i need to snap irregular shapes as they come in contact of one another as i am new to game development so i dont have any idea how to achieve this functionality in my app.Any suggestion would be highly appreciated.

sentences:
How 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:
XNA a Simple 2D Point Light I want to make a 2D Point Light in XNA, I was able to find some helpful information but it is too advance for me, since i know nothing about Shaders

http://www.soolstyle.com/2010/02/15/2d-deferred-lightning

So my best aproximation is use a texture and use alpha blending, but im not happy with this result.

So I was wondering, what is the most simple method to make a simple 2d point light? I'd rather code examples.

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: Is it true that to test a game on the iPhone or iPad, we either need to pay $99 to join Apple Developer program, or jailbreak the iPad? To test a program for iPhone or iPad, seems like the only way is to join the Apple Developer program and pay $99 per year?  Can you also jailbreak the iPhone or iPad and be able to test it?

sentences:
How to code sprite sheets? First of all, the XNA Framework works on my computer, but I do not wish to use it for reasons.  I am set with the task of coding my own sprite sheet class.  I do not know if a class is the best way to do it, but I have tried my best.  I am not an advanced C# user, but I know enough to have got this far with the class:

class Spritesheet
{
    //w: 50px h: 96px
    Bitmap sheet;
    int fWidth, fHeight;
    int framesPerRow, framesPerCol;
    int x, y;
    public Bitmap curState;

    public Spritesheet(string path, int width, int height)
    {
        sheet = new Bitmap(path);
        fWidth = width;
        fHeight = height;
        framesPerRow = sheet.Width / fWidth;
        framesPerCol = sheet.Height / fHeight;
        curState = new Bitmap(path);
    }

    public void playSprite(int frameSpeed, int endFrame, int row)
    {
        int curFrame = 0;
        int count = 0;
        bool play = true;

        while (play)
        {
            if (count == (frameSpeed - 1))
            {
                curFrame = curFrame++ % endFrame;
                Rectangle cloneRect = new Rectangle(row * fWidth, curFrame * fHeight, fWidth, fHeight);
                System.Drawing.Imaging.PixelFormat pFormat = sheet.PixelFormat;
                Bitmap curState = sheet.Clone(cloneRect, pFormat);
            }

            count = (count + 1) % frameSpeed;
        }
    }
}

I am aware that class variables should never be public, but this is just until I get it working.  My Form1 looks like this:

public partial class Form1 : Form
{
    Spritesheet player = new Spritesheet("Content/Sprite/charzera.png", 700, 270);

    public Form1()
    {
        InitializeComponent();
        pb_char.Image = player.curState;
    }

    private void timer1_Tick(object sender, EventArgs e)
    {
        player.playSprite(5, 13, 0);
        pb_char.Image = player.curState;
    }

}

The form builds but doesn't launch now.  I am just lost on where to go with this now.  I want a spritesheet to be created for the main character, and from there I want to be able to pick a row based on what action is happening and then the game to run along the row animating the PictureBox that I am using for the character.

I've never done this before, so its probably completely wrong.

sentences:
How can I fill a Color[] from a Texture2D given a Rectangle in SharpDX? I used to fill a Color[] using XNA's

Texture2D.GetData<T>(int, Rectangle?, T[], int, int)

method, but there doesn't seem to be an equivalent overload on SharpDX's Texture2D. Anyone know how I can get this same functionality with SharpDX?

EDIT

How can I fill a Color[] from a SharpDX.Toolkit.Graphics.Texture2D given a Rectangle in SharpDX?

sentences: How can I implement dialog trees into my game? What is the best way to implement a dialog tree system in my game? I want an NPC to give the player different sets of responses, some which may only appear when the Player has an item or a previous event has occurred.

sentences: Unity 2.5D Character Movement I'm wondering if anyone can point me in the right direct as to how to take a 2D character/sprite in Unity and have said character turn corners in a 3D style. Solutions or resources welcome.

sentences:
Enemy AI chase twitching left and right to move vertically I'm making an enemy follow the player based on his possition and attack if he is within a distance and his last movement (if the enemy last moved to the left, it will attack to the left, etc.). It attacks just fine left and right but not up or down. I tried watching frame by frame to see what happened and discovered that the enemy was twitching left and right to get to the player even if it was above or below him, which is the reason it is recording the last move to the left or right and not attacking top or bottom.

This is the code I use to update the position to where the enemy is going to move (pposX and Y is the player's current position and stillLock the last direction to where the enemy moved)

        xMove = 0;
        yMove = 0;

        if(pposY < y){  //UP
            yMove = -speed;
            stillLock2 = 3;
        }
        if(pposY > y){  //DOWN
            yMove = speed;
            stillLock2 = 4;
        }
        if(pposX < x){  //LEFT
            xMove = -speed;
            stillLock2 = 1;
        }
        if(pposX > x){  //RIGHT
            xMove = speed;
            stillLock2 = 2;

And this is the method I call to create a rectangle with the range of the attack if the cooldown limit is met and hurt the player if it intersects it's collision bounds. (attack is a boolean var indicating enemy is ready to attack)

public void checkAttacks(){
    attack2Timer += System.currentTimeMillis() - lastAttack2Timer;
    lastAttack2Timer = System.currentTimeMillis();
    if(attack2Timer < attack2Cooldown){
        return;
    }

    Rectangle cb = getCollisionBounds(0, 0);
    Rectangle ar2 = new Rectangle();
    int arSize = 50;
    ar2.width = arSize;
    ar2.height = arSize;

    /*
     * Still lock diagram
     * 1 = Left
     * 2 = Right
     * 3 = Up
     * 4 = Down
     */

    //creates collision rectangle

    if(attack && stillLock2 == 3){          //UP
        ar2.x = cb.x + cb.width / 2 - arSize / 2;
        ar2.y = cb.y - arSize;
    }else if(attack && stillLock2 == 4){    //DOWN
        ar2.x = cb.x + cb.width / 2 - arSize / 2;
        ar2.y = cb.y + cb.height;
    }else if(attack && stillLock2 == 1){    //LEFT
        ar2.x = cb.x - arSize;
        ar2.y = cb.y + cb.height / 2 - arSize / 2;
    }else if(attack && stillLock2 == 2){    //RIGHT
        ar2.x = cb.x + cb.width;
        ar2.y = cb.y + cb.height / 2 - arSize / 2;
    }else
        return;

    attack2Timer = 0;

    //if something above happened, check collisions
    if(handler.getWorld().getEntityManager().getPlayer().getCollisionBounds(0, 0).intersects(ar2)){ //damages if player is there
        handler.getWorld().getEntityManager().getPlayer().hurt(1);
        return;
        }
    }

I would appreciate so much if anybody had an idea of how to fix this! (And I'm trully sorry about the code dump).

sentences:
Accesing depth buffer from shader I read this presentation and on 6th slide I found that is not need to use multiple render targets and depth can be taken directly from depth buffer.

From which version of DirectX or OpenGL can be the feature used? How to do that?

sentences:
ArgumentException: The Object you want to instantiate is null I am trying to copy data over from a binary file but when trying to instantiate a gameobject, it comes out as "null".

static void LoadBuildings(SaveBuilding[] buildings)
    {
        if (buildings.Length == 0)
            return;
        foreach(SaveBuilding b in buildings)
        {
            if(b.type.ToString() == "Farm")
            {
                Farm build = Instantiate(Resources.Load("Farm")) as Farm;
                Debug.Log("Build: " + build);
                build.position.x = b.positionX;
                build.position.y = b.positionY;
                build.level = b.level;
                build.levelText = build.GetComponentInChildren<Text>();
            }
        }
    }

The debug line shows there is no object and when the next line tries to execute I get an error ArgumentException: The Object you want to instantiate is null.

I initially had it as Farm build = Instantiate(build.prefab) as Farm; as I get an error "Use of unassigned local variable".

I tried adding a prorperty above the if statement "GameObject build", I tried doing Farm build = new Farm() above the if statement also but still get the initial error.

I have a folder titled "Resources" and confirmed a prefab labelled "Farm" is there also.

Could it have anything to do with the "static" prefix for the method?

sentences:
Keeping instantiated grid in the centre of the screen? everyone, I'm making a mobile game and I need help.
In the game, I instantiate a grid of dots as seen in the first attached file below.
My problem is the grid is not in the centre of the screen
I could just position my main camera so the grid is in the centre the only problem with this approach being that the grid changes in size depending on your level as shown in attachment 2

here's my spawn code

  for (int x = 0; x < gridX; x++)
         {
          for (int y = 0; y < gridY; y++)
             {
                 SpawnDelay = Random.Range(0.2f, 0.5f);
                 yield return new WaitForSeconds(SpawnDelay);
                 Instantiate(Dot, transform.position, transform.rotation);

                 NumberOfdots++;
        transform.position = new Vector2(transform.position.x + distanceBetween, transform.position.y);
                 if (y % MutpleNum == ByMutpleNum)
                 {
                     transform.position = new Vector2(GridoffsetX/2, transform.position.y + GridoffsetY);
                 }
             }

         }

Is there anyway I can have the grid centre regardless of its size

Thanks,

David

sentences:
Unity 5 disabling a script I'm using Unity 5 and want to disable a script called Unit based on whether the instance is a client or a server. I have tried using:

GetComponent("Unit").enabled = false;

However I get hit with this error:

  Assets/Scripts/DisablingUnitScriptIfPlayer.cs(14,46): error CS1061: Type UnityEngine.Component' does not contain a definition for 'enabled' and no extension method 'enabled' of type 'UnityEngine.Component' could be found (are you missing a using directive or an assembly reference?)

Looking at some tutorials, this worked in previous versions, but I can't find how to make this work for Unity 5. What do I need to change?

sentences:
Computing uv coordinates on a sphere approximated from an octahedron Right now I'm texturing the octahedron with the formular from wikipedia(Finding UV on a sphere): UV Coordinates Wikipedia

That unfortunately leads to heavy distortion right at the beginning, which of course leads to a lot of distortion when splitting up the triangles when approximating it to a sphere.

The upper and lower triangles are okay, the left and right ones are distorted.
Now I'm looking for different formulars to calculate the uv's. Are there any other easy formulars? Or would another approach be much more complicated?

sentences:
Making icons for a Google Play Store game I'm a little confused.

I've created a game using the Unreal Engine and I plan to publish in about a month. I knew my app needed an icon, but I was on Google's developer site yesterday and I saw a whole BUNCH of guidelines for icons, and there are several kinds. They say something about placing different versions of the icon in my 'resources' directory, but I didn't develop in Android Studio. I thought I would just be making one 512x512 icon, and uploading my APK (plus the other info).

Could someone who has used Unreal and published to the Play Store please help me :) Do I really have to make so many icons?

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:
Bird flight simulation (physics) I tried to search something about bird-like animal flight simulation but it looks like everything is spammed with flappy bird 2D questions.

I want to have in my 3D game bird-like animals with realistic flight, for example we have a scene where player attacked by predator birds and he must attack them with gun. When I say bird-like, I mean that animal has wings.

As I understand I need to apply force to bird object to compensate gravity force, but if I do this strictly, it looks very unnatural. So could someone provide good description or maybe links to good articles about such simulation for 3D game?

sentences:
Unity 5.1 audio issues (no sound in back channels) I've trying to bring in surround sound audio into my project. I've set my computer up to run in 5.1 and when I play a 6 channel audio through windows media player (it's a test audio that does left speaker, right speaker etc) it works fine.

However, when I run it through Unity, all I get is the front 3 channels. I've set it in the Edit -> project settings -> audio to be 5.1 in there. I even set it in code with following:

void Start()
{
 AudioSettings.speakerMode = AudioSpeakerMode.Mode5point1;
}
How ever, when I run a debug line of:

print ( AudioSettings.driverCaps);
It tells me that Unity is only playing in stereo. Is there something I'm still not doing?

I should also add I've ran 10 different tests using the 3D audio pan and spread options. I've set both to either being fully off, half way on and full. Still the same results.

sentences:
How to transform a matrix's local space position into another's local space When looking at an example to learn how to do per pixel collision, I came across this:

// Calculate a matrix which transforms from A's local space into
// world space and then into B's local space
Matrix transformAToB = transformA * Matrix.Invert(transformB);

I have a (very) basic understanding of matrices, so I'm not too sure how this works, how can you convert the local space of one matrix to another by multiplying by the others inverted?

sentences:
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:
Text Mesh Pro Text edges are not smooth form orthographic camera I have a minimap camera (orthographic camera) which is rendering text mesh pro but the problem is the text edges are not smooth. Here is the screenshot:
[
The camera orthographic rendering on render texture.
Edit:
Some basic Orthogrphic camera setting are:
transform.localPosition = new Vector3(-26853f, 1165f, 24669f);
            transform.rotation = Quaternion.Euler(90f, -175.45f, 0f);
            miniMapCamera.orthographicSize = 110000;

Here is my text mesh pro, inspector:
[
Text mesh pro font size is 80.

sentences:
Animation imported from Blender into Unity via FBX doesn't play? I started building this model in Blender and gave it a simple animation that rotates the board about the axel.

...I exported it as FBX and imported it into Unity. I can see the animation is stored in the file when I import, but I can't find an animation file after I drop it in the scene, and there is no controller for the Animator controller it generated, either. I can watch the animation play in the FBX preview thumbnail but nowhere else.

How can I get my animation working?

sentences:
Is there any way of creating primitive 2D shapes in unity? I have read the whole unity manual and watched the videos on sprites but I have a question. Is there any way of creating primitive 2D shapes in unity? (I will be assigning trigger colliders to these as well). Or does one need to have a 3rd-party program even for basic primitive 2D shapes? My game really is very minimalist.

I did think about using particle system in a clever way but that won't have triggers and may not be as memory efficient for the several basic shapes that I am after.

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:
File format for animated scene I've got a custom OpenGL based rendering engine and I'd like to add support for cinema-type scene animation. The artist that is helping me uses primarily 3DSMax. I'd like a file format for exporting and importing this data. I'm also in need of a file format for skeletal animation data, which may have an impact here.

I've been looking at MAXScript to manually export this stuff, which would buy me the most flexibility, but I have virtually no experience with 3DSMax itself, so I get a little lost when it comes to terminology.

So I'd like to know what file formats exist for animated scene data, and whether they are appropriate for my use (my fear is that they will be way too broad for my fairly simple needs.)

The way I view animated scene data is basically a bunch of references to [animated] models with keyframe-based matrices describing their orientation over time. And probably some special camera stuff to handle perspective. I might also want some event type stuff for adding/removing objects. Is this a sane concept?

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 Subscribe to Events from Unity's VRInput Script I am new to Unity and trying to modify the Unity tutorial Interactive 360 Sample. I want to be able to call a function when a user swipes using an Oculus Go Controller. I noticed that the VRInput script is included in the project, which seems to be able to detect swipe gestures.  But where do I attach that script, and how do I subscribe to the OnSwipe event.

I am currently trying by making an empty game object, and attaching the InputVR script as well as my own script called "GestureHandler" (I'm not sure whether InputVR is already attached to something else in the sample project, or whether I need to attach it at all). In my GestureHandler script I currently have the following:

using System.Collections;
using System.Collections.Generic;
using Interactive360.Utils;
using UnityEngine;

public class GestureHandler : MonoBehaviour {

    void onEnable(){
        VRInput.OnSwipe += HandleSwipe;
    }

    void onDisable(){
        VRInput.OnSwipe -= HandleSwipe;
    }

    void HandleSwipe(){
        Debug.Log("swipe");
    }
}

and currently have the following errors:

An object reference is required for the non-static field, method, or property 'VRInput.OnSwipe' [Assembly-CSharp]

No overload for 'HandleSwipe' matches delegate 'Action<VRInput.SwipeDirection>' [Assembly-CSharp]

An object reference is required for the non-static field, method, or property 'VRInput.OnSwipe' [Assembly-CSharp]

No overload for 'HandleSwipe' matches delegate 'Action<VRInput.SwipeDirection>' [Assembly-CSharp]

sentences: How to use/apply class inheritance in Enchant.js You're developing a game using Enchant.js and you just need an Enemy class which multiple enemy classes derive from and every enemy has its own sprite and stuff.

sentences:
How should I learn about collision detection? If I want to use physics engine for my game then how should I go to learn collision-detection algorithms?

When I read AI book for games, the book talks about collision detection, so I want to learn it, but what kind of book would be best?

If I had to choose to go and learn it what would you advise me to read?

A physics book. (Game physics H.Ebrely)
A real-time collision detection book. (Same author)

I don't know much about algorithms, some people say it's better to start with a physics book, because real-time collision detection book depend heavily on algorithms.

sentences:
Simple mobile multiplayer game. TCP/UDP? I'm tying to dive into multiplayer game programming.

The game is quite simple, it's a 2D scroller mobile game, the player need to touch the screen in order to move 1 step and it could contain up to 4 players at max. 1 of the player could create a room for other players to join.

I was thinking that I would use TCP for this and will only send packets when 1 of the player trigger an event like moving or exiting the game. Is my approach is correct? Since from what I've read, many games are created in UDP instead of TCP.

In case of UDP, what is sent between the clients and the server? The position of each entity in the game at a fix time interval?

I'm really new multiplayer programming. I'd appreciate if someone would share their story.

Thank you.

sentences:
Java Slick2d - How to translate mouse coordinates to world coordinates I am translating in my main class render. How do I get the mouse position where my mouse actually is after I scroll the screen

public void render(GameContainer gc, Graphics g) throws SlickException
{
    float centerX = 800/2;
    float centerY = 600/2;
    g.translate(centerX, centerY);
    g.translate(-player.playerX, -player.playerY);
    gen.render(g);
    player.render(g);
}

playerX = 800 /2 - sprite.getWidth();
playerY = 600 /2 - sprite.getHeight();

Image to help with explanation

I tried implementing a camera but it seems no matter what I can't get the mouse position.
I was told to do this worldX = mouseX + camX; but it didn't work the mouse was still off.

Here is my Camera class if that helps:

public class Camera {
public float camX;
public float camY;

Player player;

public void init() {
    player = new Player();
}

public void update(GameContainer gc, int delta) {
    Input input = gc.getInput();

    if(input.isKeyDown(Input.KEY_W)) {
        camY -= player.speed * delta;
    }
    if(input.isKeyDown(Input.KEY_S)) {
        camY += player.speed * delta;
    }
    if(input.isKeyDown(Input.KEY_A)) {
        camX -= player.speed * delta;
    }
    if(input.isKeyDown(Input.KEY_D)) {
        camX += player.speed * delta;
    }
}

Code used to convert mouse

worldX = (int) (mouseX + cam.camX);
worldY = (int) (mouseY + cam.camY);

Tile class

public class TileGen {
Block block;
public Block[] tiles = new Block[2];
public int width, height;
public int[][] index;
int mouseX, mouseY;
int worldX, worldY;
boolean selected;

Image dirt, grass, selection;
SpriteSheet tileSheet;

int startX, startY, stopX, stopY;

Camera cam;
Player player;

public void init() throws SlickException {
    tileSheet = new SpriteSheet("assets/tiles/tileSheet.png", 64, 64);

    grass = tileSheet.getSprite(0,0);
    dirt = tileSheet.getSprite(1,0);
    selection = tileSheet.getSprite(2,0);

    tiles[0] = new Block(BlockType.Grass, new Vector2f(0,0), grass, true);
    tiles[1] = new Block(BlockType.Dirt, new Vector2f(0,0), dirt, true);

    width = 50;
    height = 50;

    index = new int[width][height];

    cam = new Camera();
    player = new Player();

    Random rand = new Random();
    for (int x = 0; x < width; x++) {
        for (int y = 0; y < height; y++) {
            index[x][y] = rand.nextInt(2);
        }
    }
}

public void update(GameContainer gc) {
    Input input = gc.getInput();
    mouseX = input.getMouseX();
    mouseY = input.getMouseY();

    worldX = (int) (mouseX - player.playerX);
    worldY = (int) (mouseY - player.playerY);

    if(input.isMousePressed(Input.MOUSE_LEFT_BUTTON)) {
        selected = true;
    } else {selected = false;}

    for (int x = 0; x < width; x++)
    {
        for (int y = 0; y < height; y++)
        {
            if(IsMouseInsideTile(x, y) && selected) {
                if(tiles[index[x][y]]== tiles[0])
                    index[x][y] = 1;
            }
        }
    }

    startX = (int) (cam.camX/64);
    startY = (int) (cam.camY/64);

    stopX = startX + (gc.getWidth()/64)  + 2;
    stopY = startY + (gc.getHeight()/64) + 2;
    System.out.println(worldX);
}

public void render(Graphics g, GameContainer container) {
    for (int x = startX; x < stopX; x++) {
        for (int y = startY; y < stopY; y++) {
            tiles[index[x][y]].texture.draw(x * 64, y *64);
            if(IsMouseInsideTile(x, y)) {
                selection.draw(x * 64, y * 64);
            }
        }
    }
}

public boolean IsMouseInsideTile(int x, int y)
{
    return (worldX >= x * 64 && worldX <= (x + 1) * 64 &&
            worldY >= y * 64 && worldY <= (y + 1) * 64);
}

}

sentences:
pause Menu only working in one scene and not in others Hi I'm working on a game for a school project but I'm still pretty new at game dev, I decided to add a pause menu to my game but for some reason, it only works in one of the scenes in unity, and I can't tell why it won't work on any of the other ones
Here is a video showing the problem: https://youtu.be/28fD9UEtfpg
and here is my script just in case
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PauseMenu : MonoBehaviour
{
public static bool GameIsPaused = false;

public GameObject PauseMenuUI;

// Update is called once per frame
void Update()
{
    if (Input.GetKeyDown(KeyCode.Escape))
    {
        if (GameIsPaused)
        {
            Resume();
        }
        else
        {
            Pause();
        }
    }
}

public void Resume()
{
    PauseMenuUI.SetActive(false);
    Time.timeScale = 1f;
    GameIsPaused = false;
    Cursor.lockState = CursorLockMode.Locked;
    Cursor.visible = false;
}

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

sentences:
Why do console games not allow completely custom key bindings? So I plugged in my PlayStation 2 for the first time in ten years and realized that I could not customize my key bindings, only pick from select pre-sets that the developers put in, which I thought was strange. So I checked through a few of my games on Xbox 360, PlayStation 2, and Nintendo 64 and realized that none of them had customizable controls, only control schemes (if even that)!
Why is this? Is it a limitation of the consoles or is it policy from Sony's and Microsoft's part that games should only offer select pre-sets, not completely customizable key bindings? The same games have customizable key bindings on PC and have no issues with binding to my Xbox 360 PC controllers.
I don't own any more modern consoles, so maybe it's different nowadays. If so, why did the old consoles have these limitations that the new ones do not have?

sentences:
In Unity, how to hide objects from specific cameras without using Layers The situation is that there are multiple players that can collect items. When a player collects an item, the item will disappear from that player's screen but still be visible to other players. I know I can use LayerMask to achieve this effect. However, what if there are more than 32 players? (Unity Layer has 32 bits). How can I still hold this effect?

I tried using OnWillRender() to check which camera is rendering the object in order to disable its renderer. This does not work because once the renderer has been disabled, OnWillRender() will not be called again for other cameras.

sentences:
3dsMax to Mudbox - Import Warning: UV not a complete set I'm exporting my 3dsMax model to Mudbox. The import gives me a warning that the UV set is incomplete.

First, what does this mean?  That I haven't got all the UVs unwrapped?  Web searches have brought nothing.

Also if this is the problem, is there a way to check if all UVs are unwrapped?

I'll post my map if you need it.

sentences:
How to rotate an object so that it is aligned with a vector? I have the following Scenario:
Two moving objects (A and B in the picture) need to appear "connected" by a third one (C in the picture). I set the position of the connecting object C as "halfway" between A and B, but how do I rotate it in such a way that it is alined with the vector that connects them (i.e. the result of A - B)? I've tried with D3DXMatrixLookAtRH(&rotate, &eye, &look, &UP_VECTOR) where eye = (0,0,0),look = A's position - B's position and using the rotate matrix as a rotation matrix for C but the result doesn't look as what I expect.

sentences:
Particle System is not Playing I made a simple spaceship that has a particlesystem. When I press "space" button, spaceship should fly and particle system should instantiate and play. But it's not playing. It seems in hierarchy as clone but not playing.
As you see, particle effect is instantiating but not playing. It should play at bottom of spaceship
Those are codes
void FlyShip()
{

    if (Input.GetKey(KeyCode.Space))
    {

        rb.AddForce(Vector3.up * jumpForce);

        if (!takeoffSound.isPlaying)
        {

            // _rocketJetParticle is gameobject.
            _rocketJetParticle = Instantiate(rocketJetParticle, new Vector3(transform.position.x, transform.position.y - 4, transform.position.z), transform.rotation);
            takeoffSound.Play();

        }

    }

    else
    {
        //Destroy(_rocketJetParticle);
        takeoffSound.Stop();

    }

}

sentences:
Mapping a Texture to a 2d Quadrilateral I want to map a 2d picture onto an arbitrary 2d quadrilateral, for the purpose of particle system. To do that, I split the picture into two triangles, and then linearly interpolated  u,v along the triangle edges, using the following code:

struct tlerp {
  double x,i;
  double u,v;
  double ui,vi;
} tlerp;

void tlerp_init(tlerp *l
                      , double first_step, double steps
                      , double sx, double ex
                      , double su, double eu
                      , double sv, double ev) {
  l->i  = (ex - sx) / steps;
  l->ui = (eu - su) / steps;
  l->vi = (ev - sv) / steps;
  l->x = sx + first_step*l->i;
  l->u = su + first_step*l->ui;
  l->v = sv + first_step*l->vi;
}

void tlerp_advance(tlerp *l) {
  l->x += l->i;
  l->u += l->ui;
  l->v += l->vi;
}

But the result is garbled. My guess is that linear interpolation can't be used here, because the space inside quadrilateral is obviously non-linear (on the attached picture it gets more compressed the closer it gets to the top). Is there some way to make it linear again?

As always, I'm not using an OpenGL/DirectX, so can't use any built-in solution.

sentences:
Textures in build duplicated, despite they're packed into atlases I have a simple SpriteAtlas: "UIAtlas" which is located in the Resources folder.
It points to a folder "UIAtlas" which contains my menu textures.
All of my batching is working perfectly, everything is being batched, because of the atlas.
When I build an iOS version, in the Editor.log I can see this:

Build Report
Uncompressed usage by category:
Textures 299.5 mb (30%)
Meshes 0.0kb (0%)
...
Used Assets and files from the Resources folder, sorted by uncompressed size:
16.0 mb 1.6% Built-in Texture2D: sactx-2048x2048-Uncompressed-UIAtlas-312aba98
...
345.3 kb 0.1% Assets/Resources/UIAtlas/medal.png
... more entries like this ...

Please notice that this texture (medal.png), along with the other textures belongs to this atlas, which is already included in the build-executable.
I feel this is wrong.
If I pack things, they should be packed into that texture and only that 2048x2048 texture should be in the build, right?
What's wrong here?

sentences:
Why is Unity UI Image color not being animated? Animation is changing the color of an UI Image but the color only changes only in the inspector but not Game/Scene view.

In this video I demonstrate the problem clearly.

sentences:
C++ Saving and Loading From Text File In my C++ program I am trying to develop a simple saving and loading function for my game. I can easily get the save function on it, but the loading part of it really stumps me.

What I need is to load the numbers on the file (line by line) and insert them into different variables for my player. I'm just not able to figure that out. I've even looked all around the inter webs.

Here is the code for the player save and load functions:

void Player::Save()
{
    std::ofstream savePlayerFile;
    savePlayerFile.open("Save/playerSave.dat", std::ofstream::trunc);

    savePlayerFile << x << "\n" << y << "\n" << prevX << "\n" << prevY << "\n" << health << "\n" <<
    health  << "\n" <<  mana  << "\n" <<  gold  << "\n" <<  level  << "\n" <<  maxHealth << "\n" <<
    maxMana << "\n" << strength << "\n" << defense;

    savePlayerFile.close();
}

void Player::Load()
{
    std::ifstream loadPlayerFile;
    loadPlayerFile.open("Save/playerSave.dat", std::ofstream::in);

    /*std::string line;
    while(std::getline(loadPlayerFile, line))
    {
        std::istringstream iss(line);
        */
    loadPlayerFile >> ( x && "\n" && y && "\n" && prevX && "\n" && prevY && "\n" && health && "\n" &&
    health && "\n" && mana && "\n" && gold && "\n" && level && "\n" && maxHealth && "\n" &&
    maxMana && "\n" && strength && "\n" && defense);
}

sentences:
How do I efficiently choose the terrain chunks to render based on the player position? Well, I have an array with all the terrains. How do I render them? I just add them to a List of terrains that are sent to the Renderer. There, every terrain of the list is rendered.

The problem is that if I add all the terrains of the array to the list (let's call it toRenderList), my computer explodes because of the number of terrains.

What I've tried to achieve it's to add to the list ONLY the terrains that are into a certain range. This is what I've done:

private static Terrain[][] terrains;
private List<Terrain> toRenderList;
private static final int NUMBER_CHUNKS = 3; //Number of terrains that are added to the list.

public void update(Player player){
    if(player.hasChangedTerrainPosition()){
        toRenderList.clear();
        for(int x = player.getTerrainPosition()[0]-NUMBER_CHUNKS;
            x == player.getTerrainPosition()[0]+NUMBER_CHUNKS; x++){
            for(int y = player.getTerrainPosition()[1]-NUMBER_CHUNKS;
                y == player.getTerrainPosition()[1]+NUMBER_CHUNKS; y++){
                terrainList.add(terrains[x][y]);
                System.out.println("Terrain "+x+","+y+" added!");
            }
        }
    }
}

Just to clarify, the method player.getTerrainPosition returns a int[] with the current terrain coords in where the player is standing. The method player.hasChangedTerrainPosition returns true if the player has changed of  terrain.

The problem of this method is that for example if the player is in the position [0,0] it pops an error of ArrayIndexOutOfBounds because of a negative number.

I don't know if I've been specific. This is more basic Java than GamePrograming, but any help will be appreciated. Thanks!

sentences:
What is more efficient: Using matrix translation to move a character, or using a vector/scalar? In 2D or 3D, matrix transformations are used for rotation, scaling, and sheering. However, when it comes to movement, should I go out of my way to use and implement scalar/vector movement, or just stick to matrix translations?
Thanks.

sentences: Unity create water issue I use daylight water in my project but by the default it has not got any waves or light tracing effects. But in some tutorials I see how the user add standard water asset and it has got beautiful world reflection on the surface and beautiful waves. Is this issue because that I am using not a PRO version?

sentences:
Zelda like multiplayer combat I have in mind coding a multiplayer game with a similar combat to zelda's. Since i will use flash, i'm limited to use TCP. My question is, is this goal possible? It's not as fast-paced as some shooters, but i'm not sure if it's too much for tcp?

tl;dr: TCP for zelda-like multiplayer combat style?

sentences:
A lot of memory taken by meshes In the Unity Profiler, it says my meshes are taking over 200 mb memory. Thing is, I don’t have meshes in my scene. The only place they exist is in my list. Would that be it? Do prefabs on a list take memory?

I tried clearing the list, turning it to null, doing = new List. Yet they still exist in the profiler. My list derives from another class, which is serializable if that matters. Like List();

I hope I can get some help!

sentences:
Combine skin material to two elements without a visible seam Software used: 3ds max 2015 and Photoshop CC 2014.

I have two elements of the head, the "FaceHead" and "UpperHead". I used unwrap UVW for both elements and used Photoshop to add a skin color (eye and lips for "FaceHead") and the same skin color for "UpperHead". I created an image for both elements in Photoshop and added the image to the elements using the Material Editor (with Bitmap option). The problem is, that there is a visible seam between the 2 elements, although I used the same color for both. Is there a solution to solve this?

What I tried:

Used of MaterialByElement
Used of different color
Extend to 2 pixel from the border using Photoshop when applying Paint.

sentences:
HDRP project error - unity i just created a new HDRP project and my scene is blank. Pls Help!!!
Unity view:

Error: RenderTexture.Create failed: format unsupported for random writes - RGBA16 SFloat

sentences:
Particles emit even though emission is disabled I have created a basic particle system which is a single burst around a sphere.

I have a script that disables this emission upon Start.

If I don't disable the emission, then the particles continuously emit in bursts.

However when I disable the emission, it does not completely prevent particles from being emitted. There is still a single burst at the beginning.

Here is how it looks with emission disabled:

Here is the script which is setting emission.enabled = false. This is attached to the sphere and the particle system is a child of the sphere.

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

public class BalloonPop : MonoBehaviour
{
    public new Renderer renderer;
    public ParticleSystem emitter;
    public float explosionTime = 0.5f;

    private ParticleSystem.EmissionModule emission;

    void Start() {
        if (!renderer) { renderer = GetComponentInChildren<Renderer>(); };
        if (!emitter) { emitter = GetComponentInChildren<ParticleSystem>(); }
        emission = emitter.emission;
        renderer.enabled = true;
        emission.enabled = false; // <===================================== this
    }
}

All I want to do right now is to make it not emit any particles at all.Then I'll add an event to re-enable the emission, but that's not the issue I'm asking about here. I also tried emitter.enableEmission = false, which is deprecated, and it didn't work.

Here is the particle system in the inspector:

sentences: Unreal Engine 4 DefaultInput.ini mappings not showing in editor The mappings from DefaultInput.ini are not showing up in the editor. I had originally added them in the editor project settings, but it lost the mappings except for 2 of them Jump and Reset VR. They still show up in the DefaultInput.ini file. How do I get the editor to recover them (or read them from the .ini file?

sentences:
Unable to list target platforms. Please make sure the android sdk path is correct. (Error) When i am trying to build an apk from unity. Than its show me some error something like this :-

CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct.
E:/DEWA/msgs/Kunal/android-sdk-windows-1.6_r1\tools\bin\avdmanager.bat list target -c

stderr[

]
stdout[

ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jdk1.8.0_121\lib\tools.jar;C:\Program Files\Java\jre1.8.0_141\lib\rt.jar;

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.RunAndroidSdkTool (System.String toolName, System.String arguments, Boolean updateCommand, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.ListTargetPlatforms (UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit)
UnityEditor.Android.AndroidSDKTools.GetTopAndroidPlatformAvailable (UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit)
UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK+SDKPlatformDetector.GetVersion (UnityEditor.Android.AndroidSDKTools sdkTools)
UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK+SDKComponentDetector.Detect (UnityEditor.Android.AndroidSDKTools sdkTools, System.Version minVersion, UnityEditor.Android.PostProcessor.ProgressHandler onProgress)
UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.EnsureSDKComponentVersion (System.Version minVersion, UnityEditor.Android.PostProcessor.Tasks.SDKComponentDetector detector)
UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.EnsureSDKComponentVersion (Int32 minVersion, UnityEditor.Android.PostProcessor.Tasks.SDKComponentDetector detector)
UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Build completed with a result of 'Failed'
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
  at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x0020e] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:181
  at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00065] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:88
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Error building Player: CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct.
E:/DEWA/msgs/Kunal/android-sdk-windows-1.6_r1\tools\bin\avdmanager.bat list target -c

stderr[

]
stdout[

ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jdk1.8.0_121\lib\tools.jar;C:\Program Files\Java\jre1.8.0_141\lib\rt.jar;

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
]
exit code: 1

sentences:
Why is shadow mapping the standard? Though I am a programmer by trade, I have barely touched game development at all. I've had this question for some time, and now that I'm looking into game development I thought it would be a good time get ask.

Why does shadow mapping seem to be the exclusive way games use to make shadows?
To be blunt, it looks terrible. Even modern games with shadow settings maxed have jagged block-y shadows that are very distracting.

Doom 3, made 11 years ago used shadow volumes that looked much better than any shadow map implementation I have ever seen, that includes AAA games released the same week this question is being posted. Third party mods for Doom 3 even softened the edges of the shadows, making them even more visually impressive.

Is there some kind of technical problems or limitations with implementing things like shadow volumes? Are shadow maps just so easy to implement that devs don't even consider anything else?

The only information I've been able to find on the subject is that the polygons that make up the the volumes can be quite large, becoming more demanding. Perhaps shadow volumes have much higher system requirements, but if that is the case how did they get away with using them in 2004?

This question isn't specific to shadow mapping vs shadow volumes, They are simply the only 2 I've seen used in full products and I just haven't been able to find much information on any other techniques.

sentences:
Fastest way to create a simple particle effect I am looking to the fastest way to create really simple particle effect that will be spammed like hell on the game...

Basically, my game looks like a vectrex game, made mostly of lines... I want to make some small explosions that will be really common.

There are something faster than just moving around some points and rendering with GL_Point?

sentences:
Handling touch input with Event Trigger I wrote a simple script to control my 'Player' object:

using UnityEngine;
 using System.Collections;

 public class PlayerMovement : MonoBehaviour {

     public float jumpVelocity = 10;

     private Transform groundCheck;
     private Animator anim;
     private Rigidbody2D rigidbody2D;
     private bool grounded;
     private Physics2D gravity;

     [SerializeField] private LayerMask whatIsGround;

     const float groundedRadius = .2f;

     void Awake () {

         // Setting up references.
         groundCheck = transform.Find("GroundCheck");
         anim = GetComponent<Animator>();
         rigidbody2D = GetComponent<Rigidbody2D>();

     }

     // Use it for Graphic & Input
     void Update () {

     }

     //Physics and ground check
     void FixedUpdate () {

         grounded = false;

         Collider2D[] colliders = Physics2D.OverlapCircleAll(groundCheck.position, groundedRadius, whatIsGround);
         for (int i = 0; i < colliders.Length; i++)
         {
             if (colliders[i].gameObject != gameObject)
                 grounded = true;
         }

     }

     //Jump function
     public void Jump () {

         if (grounded)
             rigidbody2D.velocity = jumpVelocity * Vector2.up;
     }

     //Gliding function
     public void GlideON () {

         rigidbody2D.gravityScale = 1;
         Debug.Log ("Graviti is on");
     }

     public void GlideOFF () {

         rigidbody2D.gravityScale = 0;
         Debug.Log ("Graviti is off");

         if (!grounded) {
             rigidbody2D.velocity = ( -jumpVelocity / 10 ) * Vector2.up;
         }
     }

 }

To operate touch screen I used GUI function like this:

What I want to achieve:

One click - Player jump
Hold button - Player starts glide.
Player can not glide when he's grounded.
It does not matter whether I start from 'PointerClick' or 'PointerDown'. If player is grounded the first action should be 'Jump' always.
If we start with 'PointerDown', Player should jump and after reaching the maximum height he starts glide.
If we start with 'PointerClick' Player should jump.
If Player is not grounded and we want to start glide - we have to touch screen and hold it.

Where is the problem:

When I start with 'PointerDown', my Player begins infinite jump until 'PointerUp'.

I would be grateful for your help and suggestions.

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:
Addressable Asset Loading with Queue And Coroutine I have around 17000 addressable assets (prefab) tiles that I am loading near the position of the camera.
Here is my algorithm

Get all Reference of the 17000 tiles in the array
Loop through the array and get the tiles that are within the proximity of my Player and queue It.
Based on the first enqueue item, start downloading the tiles with Addreessabl.Instantiate. Load one by one and wait for the first item download to finish.

here is the main loop that is doing the work:
 public IEnumerator StartDownloading()
    {
             isDownloadStarted = true;
        while (singleAbLoader.Count > 0)
        {
            SingleADLoader singleAbLoaderCurrent = singleAdLoader.Dequeue();
            if (abLoaderUnloaderManager.GetTilesWithinPlayerRange(singleAbLoaderCurrent) == true){

                Debug.Log("Starting to call " + singleAbLoaderCurrent.gameObject.name);
                yield return singleAbLoaderCurrent.DownloadAB();
                Debug.Log("Finsihed to call " + singleAbLoaderCurrent.gameObject.name);
                loadingSlider.value = sliderIncrementValue;
            }else
            {
                Debug.Log("escaping the download" + singleAbLoaderCurrent.name);
                yield return null;
            }
        }

        isDownloadStarted = false;
    }

whereas the DownloadAD()
public IEnumerator DownloadAD()
{
    AsyncOperationHandle<GameObject> handle = Addressables.InstantiateAsync(prefabToLoad);
    yield return handle;
}

The tiles are loading fine but the problem is they are way too slow. I mean it takes much time to load tile.

sentences:
SDL2 - Inconsistent FPS with VSYNC I'm working on a game using SDL2. Today I noticed the game has some jolty issues when not fullscreened so I made an extremely simplified program that simply moves a square from left to right to see if the result is the same.

I expected the squares movement to be very smooth but instead it's very jolty/laggy (when not fullscreened).

At first I thought it was to do with how I was calculating the time between each frame but after outputting the 'ftime' I can see the time each frame takes ranges from 13 to 30(ish) as opposed to a consistent 16/17.

Here's the code:

#include <iostream>
#include <SDL.h>

const int GAME_WIDTH = 1920;
const int GAME_HEIGHT = 1080;

//frame independent movement variables
double old_time = 0;
double current_time = 0;
double ftime = 0;

#undef main
int main(int argc, char** argv)
{
    SDL_Window* mainWindow;
    SDL_Renderer* mainRenderer;

    SDL_Init(SDL_INIT_EVERYTHING);

    mainWindow = SDL_CreateWindow("MiracleSquare", 50, 50, GAME_WIDTH, GAME_HEIGHT, 0);
    mainRenderer = SDL_CreateRenderer(mainWindow, -1, SDL_RENDERER_PRESENTVSYNC);

    SDL_Rect miracleRect; //creating the SDL square
    miracleRect.x = 0;
    miracleRect.y = 400;
    miracleRect.w = 100;
    miracleRect.h = 100;

    bool running = true;

    while (running)
    {
        old_time = current_time;
        current_time = SDL_GetTicks();
        ftime = current_time - old_time;

        std::cout << ftime << std::endl;

        SDL_Event e; //stops crashing on input
        if (SDL_PollEvent(&e))
        {
            switch (e.type)
            {
            case SDL_KEYDOWN:
                break;
            default:
                break;
            }
        }

        miracleRect.x += (ftime / 1000.0f) * 100.0f;
        if (miracleRect.x> 1920) miracleRect.x = 0;

        SDL_SetRenderDrawColor(mainRenderer, 0, 0, 0, 255);
        SDL_RenderClear(mainRenderer);
        SDL_SetRenderDrawColor(mainRenderer, 255, 255, 255, 255);
        SDL_RenderDrawRect(mainRenderer, &miracleRect);
        SDL_RenderPresent(mainRenderer);
    }

    return 0;
}

Am I doing something wrong? As far as I can tell this should produce a smooth movement.

Any help would be greatly appreciated!

Edit: Since posting this I've figured out it has something to do with my use of dual monitors. If, for example, I have a video playing on chrome on my secondary monitor, the lag issue is very prominent. I'm now looking into if this issue is avoidable, or if I'll just have to ignore it.

sentences:
How 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:
How to Iterate thru game object and access scripts by name? I'm using a "toggle visibility" script on many objects in my scene, and in my gameController class I'm storing references to them in an array like this:
public Fields[] fields;

then I access them by the array index:
fields[0].setVisibility(true);

This works fine, but this list is growing and everything is getting unmaintainable.
So I would like to iterate thru the references to the objects, find the script by its game object name, and call the required function setVisibility(state).
A call, if possible should look like this:
GameObjectName.ScriptName.FunctionCall.State

In this way, I would have a clear overview of my code.
Is this possible in Unity C#?

sentences:
How can I 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: Chances of landing a job as a (AAA or medium sized studio) game programmer? How competitive are these jobs? If I am a fresh college graduate with a degree in CS and I have a portfolio that consists of one self-published and self-developed game with a little over 1k units sold, would that put me way ahead of the curve or no (let's assume for the sake of completeness that the game in question is quality enough to showcase and be proud of on an interview)?

sentences:
How do I make a racing car turn more smoothly when traversing waypoints? In a racing game, I have set up waypoints for the player to follow.

I have added many waypoints to give an illusion of curved movement.

However, the player car turns instantaneously when passing each point, which is especially jarring because the camera is following their rotation.

How can I make the player's movement a more natural curve?

I'm using C# in Unity.

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:
Integration my application with Facebook So I recently developed this game which I would like to launch into Facebook but am having a hard time figuring out how on earth do I get the basics right. Like extracting user data i.e friends playing the game. Compile a global leader board and such. Also I was wondering if I want to keep a live update on who has got the highest score on the leader board, how do I go about doing that!?

Any suggestions and links to material explaining Facebook application integration for dummies will be a great help! Thanks...

sentences:
Rotate around an axis function for euler angles representation For a 3d game i need a function to rotate an euler representation around an arbitary axis by an angle.
For example an object is rotated with euler angles (0,90,0). Now the object should be rotated by 100 degrees around the axis (0,1,0). The resulting angle will be (0,190,0) using rotation order YXZ.
In this case I can add the angle to the euler value of the axis, however for an arbitary axis this will not work.
Problem with Quaternions & Rotation matrices:
With these representations the resulting rotations will always be smaller that 180 for each axis. I need the rotation to be lerped afterwards for example from (0,0,0) to (0,720,0).
Basically I am searching for a way to display euler angles like most of the 3D editors. When you rotate an object around any arbitary axis rotation might be larger than 360 in the editor, like (420,720,15).

sentences:
Why am I having trouble, combining color attachments to implement bloom? I'm trying to implement bloom in the same manner as this tutorial, but I am having difficulties. I have the blur buffer blurring correctly, but I can't seem to combine the two images.

Below, you will find my code. The commented-out lines just render one or the other buffer to the screen, so I know these are correct. For now, I am just trying to combine them together; not fix them with HDR. I just add together both textures, but no matter how I change things around, all I get is the one on the left.

blurShader.use();
glUniform1i(glGetUniformLocation(blurShader.program, "horizontal"), true);
glBindFramebuffer(GL_FRAMEBUFFER, pingpongFBO[1]);

long blurCount = 5;

for(long i=0; i<blurCount; i++)
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glActiveTexture(GL_TEXTURE0);

    // bind texture of other framebuffer (or scene if first iteration)
    glBindTexture(GL_TEXTURE_2D, pingpongColorbuffers[i%2]);

    RenderQuad();
    glBindFramebuffer(GL_FRAMEBUFFER, pingpongFBO[i%2]);
}

glUniform1i(glGetUniformLocation(blurShader.program, "horizontal"), false);

for(long i=0; i<blurCount; i++)
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glActiveTexture(GL_TEXTURE0);

    // bind texture of other framebuffer (or scene if first iteration)
    glBindTexture(GL_TEXTURE_2D, pingpongColorbuffers[(i+1)%2]);

    RenderQuad();
    glBindFramebuffer(GL_FRAMEBUFFER, pingpongFBO[(i+1)%2]);
}

glBindFramebuffer(GL_FRAMEBUFFER, 0);

//renderScreenQuad(colorBuffers[0]);
//renderScreenQuad(pingpongColorbuffers[1]);

// 2. Now render floating point color buffer to 2D quad and tonemap HDR colors
// to default framebuffer's (clamped) color range
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
bloomShader.use();
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, colorBuffers[0]);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, pingpongColorbuffers[1]);
glUniform1i(glGetUniformLocation(bloomShader.program, "bloom"), bloom);
glUniform1f(glGetUniformLocation(bloomShader.program, "exposure"), exposure);
RenderQuad();

#version 330 core
out vec4 FragColor; in vec2 TexCoords;

uniform sampler2D colorTexture; uniform sampler2D bloomTexture;
uniform bool bloom; uniform float exposure;

void main() {
    vec3 firstColor = texture(colorTexture, TexCoords).rgb;
    vec3 secondColor = texture(bloomTexture, TexCoords).rgb;
    FragColor = vec4(firstColor+secondColor, 1.0f);
}

#version 330 core
layout (location = 0) in vec3 position; layout (location = 1) in vec2 texCoords;

out vec2 TexCoords;

void main() {
    gl_Position = vec4(position, 1.0f);
    TexCoords = texCoords;
}

Basically, what happens is that the first image bound goes through, and is accessible. Then, the second is the same as the first! If I change the order in which I bind the images, then the other image becomes the one sent in.

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, pingpongColorbuffers[0]);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, pingpongColorbuffers[1]);
glUniform1i(glGetUniformLocation(bloomShader.program, "bloom"), bloom);
glUniform1f(glGetUniformLocation(bloomShader.program, "exposure"), exposure);
RenderQuad();

The above code is the section I'm talking about. Each of the pingpongcolorbuffers is attached to its own FBO. I am trying to send those in. Is there some reason that would limit me to sending in only one?

Here is the combined result, before HDR:

sentences:
Game clock Synchronization in python I am working on a network game project in python which we want to keep synchronized. I would assume we should use Network Time Protocol to cater for different levels of lag.

That being the case, is there an implementation for Network Time Protocol in python?

sentences: Adjusting a skeleton to a Specific Stance Imagine having a climbing wall and you take 4 adjacent handholds and footholds where  together they create a stance. Is there any algorithm or technique with which it would give you a realistic human pose? Currently im adjusting the skeleton by firstly finding the center of the 4 holds where then i construct the chest shoulder and pelvis accordingly. And by the use of IK i give position to the remaining limbs being which the arms and legs. Is there any other more elegant/better technique how to do such positioning of a skeleton ? As how i am adjusting the skeleton isnt so much of a realistic pose.All is done in 2D

sentences: Would making a satirical version of someone else's character get me sued? Licensing the rights to a popular character is definitely a hard process. Rather than licensing the rights to (insert hero here), what if I were to make a satirical version of the IP owner's character(s) like Spaceballs did? What sort of legal trouble could I face for making a satirical rip-off of a character?

sentences:
With a Texture Atlas that has 128x128 tiles, how can I use that in Unity3D? So I've got a working texture atlas that has tiles fitting 128x128. However, I can't quite figure out how to use them. I know it's probably got something to do with

    TileRenderer.material.SetTextureScale("_MainTex", new Vector2(0.25f, 0.25f));
    TileRenderer.material.SetTextureOffset("_MainTex", new Vector2(0 * 0.25f,0));

but I'm not sure where to take it from there. Can anyone offer some advice? The size of the image is 1024x128 if that helps, which I think it might.

sentences:
What AI algorithm to use to find hidden shapes in a Battleships-like game I'm developing a game similar to Battleships, only using different shapes. A single type of shape will be used within a game session, by both the human player and AI. There will be several objects spread out on the map (10x10 grid).

I want to find a way to guess the location and position of the human player's "ships" after I have one or more hits.

I'm aware that there will be a lot of randomness involved, but I want the AI to be smart enough to pose a challenge to the human player.

I'm thinking about having the AI "sweep" the map and evaluate each possible shape, somehow assign a probability to a certain position and maybe refine the guess by additional sweeps (thus a higher difficulty). But I need some ideas on what logic to use, I don't want to check every possible combination.

Thank you.

sentences:
What is the difference between "stealth" and "social stealth?" I was recently researching the stealth mechanics of several games and I stumbled across the distinction of "stealth" (eg. Splinter Cell series) vs "social stealth" (eg. Assassin's Creed series).

What exactly is the difference between these two terms?

sentences:
Where should complex state logic in an ECS reside? I've been using ECS for a while, at the moment I'm using my own, but it's pretty standard.  Components are data only, Entities pretty much just a Map with some additional metadata and Systems that match combinations of components and contain the logic.

You have combinations of components that result in the more general functionality.  For example Position + Graphics gives me some nice static background image.  Position + Graphics + Physics gives me a entity that can move around etc etc

This question is about the various options for implementing more specific game logic.

But say I want to implement a Door.  It has Position, Graphics and a Collidable Hull but it needs 2 states, open and closed.  When its open it has texture A and its Collidable Hull is disabled, and when its closed it has texture B and its Collidable Hull is enabled.  Lets say the state change should be triggered across some internal channel in the engine.

What are the options for implementing this state change?

Option 1 is to create Door component, with say 2 variables, door state and state change channel. I'd also need a door system that handled the logic to manipulate the components when it receive the open/close message.

Option 2 would be to create a FSM.  The FSM is probably also a component with a corresponding FSM System.  Logic and state would need to reside somewhere, possibly by sub-classing the FSM or having a generic property map in the FSM and static logic functions for the Door defined elsewhere.

There are more exotic alternatives to FSM's i.e. Actions Lists or Behaviour trees, but they are similar to option 2.

What considerations are there for choosing a full component/system over an more generic FSM type solution?  What if I had 100 different game objects with different behaviours? Would you really expect 100 component/system pairs for each one or would you try and create a more generalized solution? Are there any other options?

sentences: SDL and software/hardware rendering. How to go about it? I know that SDL 1.2 does software rendering (CPU) and not hardware rendering (GPU). My question is, how do I use SDL but with hardware rendering? How do I not use its rendering API (software) and rather a hardware rendering API like OpenGL?

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:
Throwing a grabbed object I'm trying to throw the carried object in the direction of the first person controller, but unable to make it. I could make the carried object drop, but the same time i need to instantiate velocity to the carried object, so that i could forward. I'm building up a bowling game and trying to make the ball behave like the same when the player throws the ball. It should hit the alley and move forward to hit the pins. Below is what so far I've tried.

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

public class pickupobject : MonoBehaviour {
    GameObject mainCamera;
    //public GameObject empty;
    bool carrying;
   public GameObject carriedObject;
   // Camera cam;
    public float distances;
    public float smooth;
    float speed = 1000f;

    // Use this for initialization
    void Start()
    {
        //cam = GameObject.Find("MainCamera").GetComponent<Camera>();
        mainCamera = GameObject.FindWithTag("MainCamera");
    }

    // Update is called once per frame
    void Update () {
        if (carrying)
        {
            carry(carriedObject);
            CheckDrop();
        }
        else
        {
            pickup();
        }

    }

    private void pickup()
    {
        if(Input.GetKeyDown(KeyCode.E))
        {
            int x = Screen.width / 2;
            int y = Screen.height / 2;
            Ray ray = mainCamera.GetComponent<Camera>().ScreenPointToRay(new Vector3(x, y));
            RaycastHit hit;
            if(Physics.Raycast(ray, out hit))
            {
                pickupable p = hit.collider.GetComponent<pickupable>();
                if(p!=null)
                {
                    carrying = true;
                    carriedObject = p.gameObject;
                }
            }
        }
    }

    void carry(GameObject o)
    {
        o.GetComponent<Rigidbody>().isKinematic = true;
        o.transform.position =  mainCamera.transform.position + mainCamera.transform.forward * distances;

    }

    //void ThrowBall()
    //{
    //    GameObject go = (GameObject)Instantiate(carriedObject,transform.forward, Quaternion.identity);
    //    pickupable to = go.GetComponent<pickupable>();
    //    to.Throw(carriedObject.transform.forward * speed);
    //}

    void CheckDrop()
    {
        if(Input.GetKeyDown(KeyCode.U))
        {
            Drop();
        }
    }

    void Drop()
    {
        carrying = false;
        // carriedObject = Instantiate(carriedObject, new Vector3(transform.position.x, transform.position.y, transform.position.z), transform.rotation);
        carriedObject.GetComponent<Rigidbody>().isKinematic = false;
        gameObject.GetComponent<Rigidbody>().AddForce(carriedObject.transform.forward * 100);
       // carriedObject.GetComponent<Rigidbody>().AddForce(0,0,1f);
        //carriedObject.gameObject.GetComponent<Rigidbody>().isKinematic = false;
        carriedObject = null;

    }
}

Thanks in 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:
is unity DOTS mature enough to build a whole project on it? maybe you assume this question opinion based but its not. please read the whole question.
the question has 2 aspects.

are all features implemented? just better say, can i do everything or any gameplay i did on monobehaviours, on the DOTS? all are needed features implemented? including Ai, navigation, physics, animations and...

the bigger problem about DOTS and ECS is software engineering. DOTS gives us much better performance in memory and performance and parallel processing but it takes all good OOP practices from us.

as you may know, DOTS is not OO and uses its own architectures. most of references values are gone in dots to make data more compact. so there is no solid principles. dependency injections and all those OO design patterns. instead we have a hardly coupled code and entities.
the question is: does DOTS and ECS really lacks software engineering or its just we dont know enough about it and there are standards about it?
many people say that you should make all project on old monobehaviours and you can migrate section that are expensive to DOTS.
im not really sure what is the right approach for using with new technology.

sentences:
Multiple render targets and pixel shader outputs terminology I'm a little confused on the jargon: does Multiple Render Targets (MRT) refer to outputting from a pixel shader to multiple elements in a struct? That is, when one says "MRT is to write to multiple textures", are multiple elements interleaved in a single output texture, or do you specify multiple discrete output textures?

By the way, from what I understand, at least for DX9, all the elements of this struct need to be of the same size. Does this restriction still apply to DX11?

sentences:
How do I move the paddle with the arrow keys? I am making a pong game using gdi+ and c#. I want to move the paddle using the arrow keys by using the move variable, but it does not work; the paddle does move when I use the int move=0; global variable.

I am thinking about nesting my methods.

Is it possible to nest the Form1_Paint into the Form1_Keypress method?

    int move = 0;

    public void Form1_KeyPress(object sender, KeyPressEventArgs e)
    {
        if (e.KeyChar == (char)56)//key 8
        {
            move--;
        }

        if (e.KeyChar == (char)50)//key 2
        {
            move++;
        }
    }

    public void Form1_Paint(object sender, PaintEventArgs e)
    {
        Graphics g = e.Graphics;
        SolidBrush blueBrush = new SolidBrush(Color.Blue);
        SolidBrush redBrush = new SolidBrush(Color.Red);
        SolidBrush whiteBrush = new SolidBrush(Color.White);
        Rectangle rect1 = new Rectangle(0, 250, 35, 100); //blue paddle
        Rectangle rect2 = new Rectangle(750, 250 + move, 35, 100); //red paddle
        Rectangle rect3 = new Rectangle(390, 290, 10, 10); //white ball
        g.FillRectangle(blueBrush, rect1);
        g.FillRectangle(redBrush, rect2);
        g.FillRectangle(whiteBrush, rect3);
        g.Dispose();
    }

sentences:
My game's title is similar to other game's title. Will I get sued? I have a game called 'Shapes Dodge' which is still in development. I figured out the name back in February when I began developing it. Since then I've been checking monthly the Google Play Store for games with similar titles and today I saw my worst nightmare coming true - there are a few games with a similar name:
https://play.google.com/store/search?q=shapes%20dodge&c=apps

I am worried about the first two games which both have the name 'Shape Dodge'.
So will I get sued if I publish my game with the name 'Shapes Dodge' ('shapes' with 'S' at its end) on the Google Play Store?

I want to emphasize that the content of my game is very different from these games' (different controlls, gameplay, graphics, music, etc), only the title is similar.

Please answer me as simple as possible because I am not very familiar with legislation, laws, copyright, trademark and so on.
Thank you! :)

Edit

So after serios consideration and brainstorming I figured out a new name for my app: 'Dodgy Shapes'. Obvously the amount of similarity with the other apps which contain these keywords (https://play.google.com/store/searchq=shapes%20dodge&c=apps) is much less. But do you think it is enough difference so that I won't have any problems in the future?

Again, thanks to all who responded. :)

sentences:
addressables unity unknown async error public AssetLabelReference imgs;
List<IResourceLocation> myImgs = new List<IResourceLocation>();
[SerializeField]List<Texture2D> loadedImages = new List<Texture2D>();
private void Start()
{
    Addressables.LoadResourceLocationsAsync(imgs.labelString).Completed += imgReady;
}
void imgReady(AsyncOperationHandle<IList<IResourceLocation>> op)
{
    myImgs = new List<IResourceLocation>(op.Result);
    insta();
}
 void insta()
{
    Addressables.LoadAssetsAsync<Texture2D>(myImgs, cb);
}
void cb(Texture2D s)
{
    loadedImages.Add(s);
}

I get the locations of the images but not the asset themselves
I get an error of

  Exception encountered in operation Resource(Man.png): Unknown error in AsyncOperation
  UnityEngine.ResourceManagement.Util.DelayedActionManager:LateUpdate() (at

sentences: In Hammer 3.4 where do I find the 'null' texure? I'm using Valve's Hammer Editor v3.4 to make maps for Counter-Strike 1.6.  I want to learn to use the 'null' texture to optimize my map by not drawing surfaces the player won't see, but when I search for it in the list of textures, I don't see it.  I'm guessing I'm not loading some WAD that I need, but I'm not sure which one it is.

sentences:
How to manage maps in 2D MMO? I'm curious about how I should be drawing my game world. I'm going to have a map, let's say 1000 by 1000 tiles in size, with many players on it. Each player will be at a position in a map, and when they move I want their sprite to stay in the centre of the screen (so I want the map itself to move).

Is it efficient to do this by drawing a map 1 square bigger on each edge than the game window itself, then having the extra bits chopped off? Or should I be slicing and dicing sprites?

If you're curious as to what sorta thing I'm looking at, think tibia.com crossed with Pokemon, with graphics somewhere in between, and a turn-based attack / defence system.

sentences:
Stuck trying to decompress sections in Minecraft Anvil files (.mca) I've been trying to write some Java code to read .mca files, based on the information at http://wiki.vg/Map_Format and http://wiki.vg/User:Sprenger120 . I am at the point where I can read in the header correctly, and read the header for each section, telling me its compression mode and size. I am now trying to inflate the NBT blob that is the actual section, but it's not working at all. I just get "java.io.IOException: Not in GZIP format".

I'm starting the deflation stream five bytes into the memory segment specified by the header, and given that I am consistently getting sane section sizes and compression types, it seems like I'm managing to parse correctly up to this point, but now I'm stuck.

The code is at: https://github.com/Zarkonnen/Ager/tree/master/src/ager

I don't know if this is the correct forum to ask this kind of question - if it isn't, I apologise and would be very thankful if someone could direct me to a good place to ask it.

sentences:
Implementing DirectX 7 light attenuation in Unity's Universal Render Pipeline I am create a modern Unity based client of an old MMO from 2000, and I am working on implementing their lighting system. Based on the data I have reverse engineered, it looks like they used a custom attenuation formula. The original client uses DirectX 7. I have found a reference sheet for DX7 light.
http://developer.download.nvidia.com/assets/gamedev/docs/GDC2K_D3D_7_Vert_Lighting.pdf
The relevant info starts at page 17. In the URP, in Lighting.hlsl, I have set up linear attenuation:
float range = rsqrt(distanceAndSpotAttenuation.x);
float dist = distance( positionWS, lightPositionWS);
half attenuation = 1.0f - dist/range;

Looks good! https://i.imgur.com/5bfJ5fF.png
Everything looks good. Now I am trying to (based on the document) recreate the same linear attenuation. It should look something like this:
// DX 7
float range = rsqrt(distanceAndSpotAttenuation.x);
float dist = distance( positionWS, lightPositionWS);
half c0 = 1.0f;
half c1 = 1.0f;
half c2 = 0.0f;
half d = dist/range;
half attenuation = 1.0f / ( c0 + c1 * d + c2 * d * d );

This should give me linear attenuation according to the doc, but it ends up bleeding light way past the range of the light. So I am convinced the distance is wrong. What kind of value is expected here? Normalized distance? It doesn't specify. I have played around with the distance a lot. Set it to the attenuation in the first code example, to the raw value, and a bunch of other values. No luck: https://i.imgur.com/JWJ0HF2.png
Does anyone have any ideas?

sentences:
Does an inventory limit in an MMORPG make sense? I am currently developing a simple 2d MMORPG. My current focus is the inventory system.

I am currently wondering if I should implement a limit on what a player character can carry. Either in form of a maximum weight, a limited number of inventory slots, or a combination of both. Almost every MMORPG I ever played limits inventory space. But plausibility aside, is this really necessary from a gameplay point of view? Maybe it would in fact improve the game experience when I just let the players carry as much stuff as they want.

tl;dr: What is the game development rationale behind limiting carrying capacity of player characters?

Edit:
Thanks for all the answers so far. They all were very insightful. After your input I decided to go for a limited inventory to prevent people from carrying too many healing items and too much specialized equipment into dungeons. To avoid the problem of loot overload and having to return to the town all the time, I plan to give players the ability to send items from their inventory directly to their storage (but not the ability to retrieve them in the field). I accepted the answer by Kylotan for now, but do not let this discourage you from posting additional answers, when you feel that some interesting aspect wasn't covered yet.

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 can I get rid of the diagonal wires in wireframe boxes? I create a box with a material and set that material to be wire framed.

Box b1 = new Box(new Vector3f(1.0f, -2.0f, 1.0f), 1.0f, 1.0f, 1.0f);
Geometry geom1 = new Geometry("Box", b1);
Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat1.getAdditionalRenderState().setWireframe(true);
mat1.setColor("Color", ColorRGBA.Blue);
geom1.setMaterial(mat1);

However, because the box is drawn using triangles there are diagonal wires visible:

How can I get rid of these diagonal wires (not draw them)?

sentences:
Client projectile ignores camera Y-axis in multiplayer shooter I'm able to spawn the bullet and make it move. But the problem is, only the host can shoot the bullet in the way the camera is facing(takes both X-axis and Y-axis correctly). The client takes only the X-axis of the camera and keeps the Y-axis at zero.

Here's the code for spawning and applying velocity:

[Command]
void CmdFire()
{
    GameObject fb = Instantiate(fireBall, spawnPoint.position, spawnPoint.rotation);
    fb.GetComponent<Rigidbody>().velocity = gameObject.GetComponentInChildren<Camera>().transform.forward * fireSpeed;
    NetworkServer.Spawn(fb);
}

And the code for the camera attached to the player:

void Update()
{

    mouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime;
    mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;

    //Horizontal Looking
    playerBody.Rotate(Vector3.up * mouseX);

    //Vertical Looking
    xRotation = xRotation - mouseY;
    xRotation = Mathf.Clamp(xRotation, -90f, 90f);
    transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);

}

sentences:
Implementing debug "overlay" info This question is actually about GameEngine2D which is part of PSM SDK (for PlayStation Vita development), however as stated in documentation it's loosely based on cocos2d library. I hope that my question is generic enough to be answered by other cocos2d users, so that's why cocos2d tag. Feel free to check my question on Sony forum.

Basically I'm trying to implement "debug layer" functionality, i.e. if I press, for example, "Triangle" button some debug information (like FPS) would apper "above" current Scene.

Currently I've implemented it this way:

I have a DebugNode : Node class, that performs necessary drawing,
it's instance is created on app init, and reference is stored in a
"global-like" Game class.
On Trianle press I check Director.Instance.CurrentScene.Children, and if does not contain DebugNode instance add it, or remove otherwide (so it's a toggle).

It's working fine, but it have issue I don't like, on a scene switch new scene does not have DebugNode, and also I need to remove DebugNode from CurrentScene before scene change, because Node can't have multiple parents. The solution to this could be by having multiple DebugNode instances, but that is also solution I don't like.

I have 2 questions regarding this:
1. Is my approach to a task is generraly reasonable? Is it done if not the best way, but at least reasonable way?
2. How my approach could be improved, particularly in case of Scene switching?

sentences:
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:
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:
AI algorithm for avoiding bullets in a shoot-em-up game I am working on a shoot-up-game in XNA, it is going to be my final project in school. I was thinking of utilizing the minimax algorithm for AI agents for making tactics. However, I realized that the most important issue in such a game is to avoid bullets(fired by the player). An AI agent making tactics but no good at avoiding bullets would be useless in a shoot-em-up game I guess.

So, I need your help about what algorithm to utilize. It's not going to be a bullet storm like game, but it's fast(thanks to XNA). I have read about using threat maps and also pathfinding algorithms but couldn't figure out which one is ideal in such a game. I mean it needs to be simple enough for a fast paced gameplay, but it should also help AI agents act intelligently.

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 to get an ESRB rating for my game? What does it take to get an ESRB rating for my game?

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:
JBullet - How can I make my object float on the water? I'm trying to use JBullet for a ship PVP game.

I've got two ships which are meant to rest on the water. Obviously these ships will be colliding, but the problem I have currently is "water" collision.

Water cannot be a "solid" object, and I cannot work anything out that will allow it to have the ship resting in it without falling over or having some sort of speed dampening effect.

Also, the ships keep being launched upwards or downwards depending on the collision. The problem here is that I cannot set a weight for the ships, because if I did, they would currently be sinking into what JBullet believes to be nothingness.

How would I simulate water in this collision world?

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:
movement control with the 2D driving game I am working on a 2D driving game.I have a button(forward).I need to move the vehicle by pressing on the button.
When the button is pressed the vehicle should accelerate upto its maximum speed and when the button is release  the vehicle should gradually slow down.

float rotateSpeed=0.1f;
float speedForce = 15f;
float torqueForce = -200f;
float driftFactorSticky = 0.9f;
float driftFactorSlippy = 1;
float maxStickyVelocity = 2.5f;
float minSlippyVelocity = 1.5f;

bool moveForward=false;
bool moveBackward=false;
bool turnLeft=false;
bool turnRight=false;

Vector3 myRot;
void FixedUpdate () {
    Rigidbody2D rb = GetComponent<Rigidbody2D>();
    float driftFactor = driftFactorSticky;
    if(RightVelocity().magnitude > maxStickyVelocity) {
        driftFactor = driftFactorSlippy;
    }
    rb.velocity = ForwardVelocity() + RightVelocity()*driftFactor;

    //Move rover forward and backward
    if(Input.GetKey(KeyCode.UpArrow) || moveForward==true ||  Input.GetButton("Accelerate") ) {
        Debug.Log ("Uparrow....................................................");
        rb.AddForce( transform.up * 0.3f);

    }
    if(Input.GetKey(KeyCode.DownArrow) || moveBackward==true || Input.GetButton("Brakes")  ) {
        Debug.Log ("break....................................................");

        rb.AddForce( transform.up * -speedForce/30f );

    }
    float tf = Mathf.Lerp (0, torqueForce, rb.velocity.magnitude / 2);
    rb.angularVelocity = Input.GetAxis ("Horizontal") * tf;

    if (Input.GetKey (KeyCode.RightArrow) || turnRight==true) {

        transform.Rotate(0,0,-0.5f);
    }
    if (Input.GetKey (KeyCode.LeftArrow) || turnLeft==true) {
        transform.Rotate(0,0,0.5f);

    }

}

Vector2 ForwardVelocity() {
    return transform.up * Vector2.Dot( GetComponent<Rigidbody2D>().velocity, transform.up );
}

Vector2 RightVelocity() {
    return transform.right * Vector2.Dot( GetComponent<Rigidbody2D>().velocity, transform.right );
}

this is working fine but the problem is that when I release the forward button the speed of vehicle is not getting slow down.

Can anybody help me please

sentences:
Separating game data/logic from rendering I'm writing a game using C++ and OpenGL 2.1.
I was thinking how could I separate the data/logic from rendering.
At the moment I use a base class 'Renderable' that gives a pure virtual method to implement drawing. But every object has so specialized code, only the object knows how to properly set shader uniforms and organize vertex array buffer data. I end up with a lot of gl* function calls all over my code.
Is there any generic way to draw the objects?

sentences:
How do I prevent XNA from pausing Updates while the window is being resized/moved? XNA stops calling Update and Draw while the game window is being resized or moved.

Why? Is there a way to prevent this behaviour?

(It causes my network code to desynchronise, because network messages aren't being pumped.)

sentences:
Pressing the jump button also makes my character fire their weapon In my game I want my player jump without firing their weapon, but when I press the button it jumps and also fires too in same moment.

In this Update method, I used Input.GetButton so my player will fire continuously while holding the button.

void Start () {
    isJumped = true;
}

// Update is called once per frame
void Update(){
    if (!transform.GetChild (0).gameObject.GetComponent<PlayerHealth> ().hasDied) {

        if (Input.GetButton ("Fire1") && Time.time > firespeed && isJumped == true) {
                nextFire = myTime + firespeed;
                newProjectile = Instantiate (projectile, transform.position, transform.rotation) as GameObject;
                nextFire = nextFire - myTime;
                myTime = 0.0F;
                //  EnergyCharging ();
            }
        }
    }

void JumpButton(){
if(!transform.GetChild(0).gameObject.GetComponent<PlayerHealth>().hasDied){
        if (grounded) {
            grounded = true;
            myRigidBody.AddForce (new Vector2 (0, jumpPower), ForceMode2D.Impulse);
            if(myRigidBody.velocity.y > jumpPower){
                myRigidBody.velocity = new Vector2 (0, jumpPower);
            }
            animator.SetBool ("isGrounded", grounded);
        }
    }
}

sentences:
What is an acceptable GC frequency for a SlimDX/Windows/.NET game? I understand that the Windows GC is much better than the Xbox/WP7 GC, being that it's generational and multithreaded -- so I don't need to worry quite as much about avoiding memory allocation.

SlimDX even has some unavoidable functions that generate some amount of garbage (specifically, MapSubresource creates DataBoxes), yet people don't seem to be too upset about it.

I'd like to use some functional paradigms to write my code too, which also means creating objects like closures and monads.

I know premature optimization isn't a good thing, but are there rules of thumb or metrics that I can follow to know whether I need to cut down on allocations? Is, say, one gen 0 GC per frame too much?

One thing that has me stumped is object promotions. Gen 0 GCs will supposedly finish within a millisecond or two, but if I'm understanding correctly, it's the gen 1 and 2 promotions that start to hurt. I'm not too sure how I can predict/prevent these.

sentences:
Space partitioning when everything is moving Background

Together with a friend I'm working on a 2D game that is set in space. To make it as immersive and interactive as possible we want there to be thousands of objects freely floating around, some clustered together, others adrift in empty space.

Challenge

To unburden the rendering and physics engine we need to implement some sort of spatial partitioning. There are two challenges we have to overcome. The first challenge is that everything is moving so reconstructing/updating the data structure has to be extremely cheap since it will have to be done every frame. The second challenge is the distribution of objects, as said before there might be clusters of objects together and vast bits of empty space and to make it even worse there is no boundary to space.

Existing technologies

I've looked at existing techniques like BSP-Trees, QuadTrees, kd-Trees and even R-Trees but as far as I can tell these data structures aren't a perfect fit since updating a lot of objects that have moved to other cells is relatively expensive.

What I've tried

I made the decision that I need a data structure that is more geared toward rapid insertion/update than on giving back the least amount of possible hits given a query. For that purpose I made the cells implicit so each object, given it's position, can calculate in which cell(s) it should be. Then I use a HashMap that maps cell-coordinates to an ArrayList (the contents of the cell). This works fairly well since there is no memory lost on 'empty' cells and its easy to calculate which cells to inspect. However creating all those ArrayLists (worst case N) is expensive and so is growing the HashMap a lot of times (although that is slightly mitigated by giving it a large initial capacity).

Problem

OK so this works but still isn't very fast. Now I can try to micro-optimize the JAVA code. However I'm not expecting too much of that since the profiler tells me that most time is spent in creating all those objects that I use to store the cells. I'm hoping that there are some other tricks/algorithms out there that make this a lot faster so here is what my ideal data structure looks like:

The number one priority is fast updating/reconstructing of the entire data structure
Its less important to finely divide the objects into equally sized bins, we can draw a few extra objects and do a few extra collision checks if that means that updating is a little bit faster
Memory is not really important (PC game)

sentences:
Should components have sub-components in a component-based system like Artemis? I am designing a game using Artemis, although this is more of philosophical question about component-based design in general. Let's say I have non-primitive data which applies to a given component (a Component "animal" may have qualities such as "teeth" or "diet").  There are three ways to approach this in data-driven design, as I see it:

1) Generate classes for these qualities using "traditional" OOP. I imagine this has negative implications for performance, as systems then must be made aware of these qualities in order to process them. It also seems counter to the overall philosophy of data-driven design.

2) Include these qualities as sub-components. This seems off, in that we are now confusing the role of components with that of entities. Moreover out of the box Artemis isn't capable of mapping these subcomponents onto their parent components.

3) Add "teeth", "diet", etc. as components to the overall entity alongside "animal". While this feels odd hierarchically, it may simply be a peculiarity of component-based systems.

I suspect 3 is the correct way to think about things, but I was curious about other ideas.

sentences:
How do I make a flickering engine exhaust animation using only bone animation? I'm trying to replicate the flickering engine exhaust animation in this SketchFab model.  SketchFab doesn't support particle systems, so the animation must be a simple bone animation.

Can someone help me understand how to achieve such an effect?

My best guess is animated opacity, but I don’t know how to replicate it.
My final goal is to use it in a Unity 5 mobile game.

sentences:
Development decision: how to proceed regarding OpenGL There is a 3D app developed by someone with OpenGL almost 2 years ago. The development is not finished by the previous developer and I'm assigned the task to finish it, based on customer requests.

I started the development almost a week ago and I've fixed some OpenGL-related issues and added some features. But, there is something that really bothers me and I just thought I'd need advice.

The voices/noises in my head/mind that bother me:

If we stick to our OpenGL, eventually we will lose the Apple ecosystem, and will consequently lose being cross-platform.
OpenGL is low-level, for a simple thing like detecting user-clicks on 3D objects, I need to spend much development time.
If we get high-level: with Unity engine or Unreal engine, we have no problem with any platform even VR/AR. The development time with these engines appears to be much faster. Even with regard to licensing, they are flexible and provide free ones.
As people say, Unity/Unreal is like buying a car and OpenGL/Metal/D3D is like buying a wheel. Maybe my life as a developer would be much easier if Unreal/Unity engine is used rather than a lower-level tool like OpenGL.

Now, I'm goint to talk to my boss regarding above thoughts. I want to ask him if it makes sense to let OpenGL go and just switch to an engine. But before talking to my boss, I just thought I'd ask here to see if it makes any sense or if I'm missing something.

sentences:
Calculating a matrix to have the model follow terrain So I've been messing around with 3D graphics in Java (using lwjgl), and I've hit a bit of a roadblock. I have a heightmap and a cube, and I want to find a way to have the cube rotate to follow the terrain smoothly. At the moment, the cube can rotate freely around the y axis (up is 0,1,0), and it can move directly in the direction it's facing.

Here's my idea: find the plane formed by projecting the bottom corners of the cube onto the terrain. That's the plane that I want to rotate my cube's bottom face into, so I took a cross product with the up vector and the normal vector of that plane. Then I took the angle between the two, and calculated an axis-angle rotation matrix around that plane. I mulitplied the y rotation matrix by that matrix, and used that as my model matrix:

    Matrix4 upTransform = Matrix4.createRotateY(yrot);
    // calculate plane of cube
    Vector3 bl = new Vector3();
    bl.x -= SCALE / 2;
    bl.z -= SCALE / 2;
    bl = upTransform.transform(bl);
    bl.y = game.getMap().getY(position.x + bl.x, position.z + bl.z);
    Vector3 tl = new Vector3();
    tl.x -= SCALE / 2;
    tl.z += SCALE / 2;
    tl = upTransform.transform(tl);
    tl.y = game.getMap().getY(position.x + tl.x, position.z + tl.z);
    Vector3 br = new Vector3();
    br.x += SCALE / 2;
    br.z -= SCALE / 2;
    br = upTransform.transform(br);
    br.y = game.getMap().getY(position.x + br.x, position.z + br.z);
    Vector3 normal = Vector3.cross(Vector3.diff(br, bl),
                                   Vector3.diff(tl, bl)).normalize();
    // calculate rotation axis
    Vector3 axis = Vector3.cross(normal, up).normalize();
    // calculate angle between plane of cube and plane of texture
    float angle = (float)Math.acos(Vector3.dot(up, normal));
    // calculate rotation
    Matrix4 terrainTransform = new Matrix4().setRotate(axis, angle);
    Matrix4 rot = Matrix4.multiply(upTransform, terrainTransform);

game.getMap().getY(x, z) returns the height of the map at the x,z coordinate provided. Vector3.diff(a, b) returns a - b, and Matrix4.multiply(A, B) returns A * B.
My issue is that the cube rotates weirdly and has strange shear effects.
Does anyone have comments on my general approach, or on my implementation? I'm really not sure what to do here, as this is pretty much where my linear algebra knowledge reaches its limits.

sentences:
Simple heart container script for 2D game (Unity)? I'm attempting to create a simple mobile game (C#) that involves a simple three-heart life system. After searching for hours online, many of the solutions use OnGUI (which is apparently horrible for performance) and the rest are too complicated for me to understand and add to my code. The other solutions involve using a single texture and just hiding part of it when damage is taken. In my game, however, the player should be able to go over three hearts (for example, every 100 points).

Sebastian Lague's Zelda-Style Health is what I'm looking for, but even though it's a tutorial there is way too much going on that I don't need or can't customize to fit in mine.

What I have so far is a script called HealthScript.cs which contains a variable lives. I have another script, PlayerPhysics.cs which calls HealthScript and subtracts a life when an enemy is hit. The part I don't get is actually drawing the hearts.

I think I understand what needs to happen, I just am not experienced enough with Unity to know how.

The Start function should draw three (or whatever lives is set to) hearts in the top right corner. Since the game should be resolution-independent to accommodate the various sizes of Android devices, I'd rather use scaling rather than PixelInset.
When the player hits an enemy as detected by PlayerPhysics.cs, it should subtract from lives. I think that I have this working using this.GetComponent<HealthScript>().lives -= 1 but I'm not sure if it actually works. This should trigger a redraw of the hearts so that there are now two hearts.
The same principle would apply for adding hearts when a score is reached, except when lives > maxHeartsPerRow, the new hearts should be drawn below the old ones.

I realise I don't have much code to show but believe me; I've tried for quite some time to figure this out and have little to show for it. Any help at all would be welcome; it seems like it shouldn't take that much code to put an image on the screen for each life there is, but I haven't found anything yet.

Thanks!

sentences:
What happens to deleted or added assets in your app when updating to a new version in the Google Play Store and iOS App Store? So let's say I used Unity and built an app and uploaded it to the android and iOS app store, it is 100 MB and lots of people downloaded it. So now I want to update it to the newer version, however along the way I decided a lot of features were unnecessary so I remove about 50 MB worth of assets and the new build is 50 MB so I uploaded it to the respective app stores.

Will the people who already had my 100 MB app and now update to the new 50 MB version continue to have 100 MB of storage space taken up, even though the new one is half the size or will their app size be reduced to 5 MB according to the new build?

Essentially, how does app store updating work? Is the whole old app deleted and new one downloaded? Are matching files and assets retained and only differences in files and assets deleted or updated? Or are new assets and files just piled on top?

Additionally, for larger games, where the whole game is too big to be allowed on the app store, and where the player has to download more stuff once they have downloaded the game, how does it work? Is the additional, no-longer-needed content left on user's device kept there? Is it automatically removed?

sentences:
Help Reading this Data in XML as a List (ContentReader) Edit:

So i'm going to rephrase the question a bit, seeing as now i think know how i'm going to read this data. Looking at this example as my guide:
http://forums.create.msdn.com/forums/p/53404/323877.aspx

This is pretty much what i'm currently doing, and to be clear and show you guys:
http://pastebin.com/GxqQcBDg, that's how i'm loading my data.

So looking at that guys example from his post, he has a similar layout, his "Enemies" can equal my element "Animated_Tiles" and then his "Items" could be equal to my "Tile" objects, at least if you compare my data to his they look extremely similar, and yes i did update the Data as Richard Marskell - Drackir suggested,
But i'm wondering if i can have "Type" definitions like the guy has in his example, to show what i mean:

  <Animated_Tiles Type="System.Collections.Generic.List[Namespace.Class]">

Can that be done? Or is it only the "Asset" element that can have the Type definition?
Currently this is what my new data layout looks like:
http://pastebin.com/i42166ZQ

But currently, it seems to start reading it but i get this error by the first "Tile" Element. So the only difference i see between his & my layouts are that he has the Asset containing the List definition whereas i have "Animated_Tiles". So i'm unsure can any element can have the "Type=Blah" definition?

sentences:
Is there a expected set of button mappings games commonly use? I am making a game that will support a XBox 360 controller but I would like to try and keep the default button mappings to be what is expected from a user's past history from playing other games. Is there a set of guidelines from Microsoft on what should map to what (do you use A for fire or left trigger?), or has the gaming community picked up a common set of controls that is just not written anywhere, everyone just "knows" it (like WASD for movement).

The hardest thing for me is I have walking movement, vehicle movement, and airplane movement. I plan on allowing custom configuration of each, but I don't know what to set as the defaults.

sentences:
How do I make an HTML5 canvas tiled map with tiles which have other than squared edges? I'm creating an HTML canvas map and I'm trying to have the edges of the tiles not appear square, as in the tiles merge in to each other.  I've scoured the internet for hours but can't seem to find anything.  How would I go about doing this?

Dropbox link to project

I've included the used images so when the project is downloaded and run on the browser, the map should look like the following picture.  This is not how I want it to look but how it currently looks.

I know it's probably not possible to get this exact effect using a tile based map, and it's not a perfect representation, but here's a general idea of what I want to accomplish.  Notice how the corners are no longer squared but have a more rounded look and appear to be blending in with the next color tile.  That's my goal.

  Thanks in advance.

sentences:
How do multiple render targets get rendered onto the back buffer(s) then screen? I'm using DX11. I understand how render targets are created, set, and why they are used, but I am really unsure how this all plays together with presenting it to the screen.

Does the GPU automatically flatten all render targets onto the back buffer, and how does this work with multiple back buffers?

If I were to have multiple render-targets for deferred rendering, or some customized post processing shader (using a ping-pong model) how do multiple render targets get presented accordingly?  I assume I have to set the final render-target used to be presented to the screen. But I am not sure.

sentences: 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:
Java Game Loop Efficiency I'm quite new to java.

I was watching 2 video tutorials on how to make java game and read a couple articles about game loop. However, I'm still confused about how game loop actually works.

The first tutorial used code that looked like this (I modified some codes from the tutorial and commented on top):

/*
 * Game Loop of the game. It uses fixed timestep.
 * Optimal time represents time needed to update one frame.
 * Update time represents time actually taken to update one frame.
 *
 * By calculating the difference between optimal and actual time,
 * we can let Thread to sleep for the exact time we are aiming for, which is 60 FPS.
 */

public void run() {
    long now;
    long updateTime;
    long wait;

    final int TARGET_FPS = 60;
    final long OPTIMAL_TIME = 1000000000 / TARGET_FPS;

    while (isRunning) {
        now = System.nanoTime();

        update();
        render();

        updateTime = System.nanoTime() - now;
        wait = (OPTIMAL_TIME - updateTime) / 1000000;

        try {
            Thread.sleep(wait);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}

This is quite easy to understand and I have no problem with using this game loop. However, the second tutorial used more complex game loop that I had a hard time understanding it:

public void run() {
    long lastTime = System.nanoTime();
    double amountOfTicks = 60.0;
    double ns = 1000000000 / amountOfTicks;
    double delta = 0;
    long timer = System.currentTimeMillis();
    int frames = 0 ;
    while (running) {
        long now = System.nanoTime();
        delta += (now - lastTime) / ns;
        lastTime = now;
        while (delta >= 1) {
            tick();
            delta--;
        }
        if(running)
            render();
        frames++;

        if(System.currentTimeMillis() - timer > 1000) {
            timer += 1000;
            System.out.println("FPS: " + frames);
            frames = 0;
        }
    }
    stop();
}

I do not understand the use of timer and frames variable and how delta is being used. Is timer and frames simply used for printing out the FPS on the console screen? Also, help me clarify the use of delta variable in this code.

The use of delta variable is quite different from the other game loop that I know of. From the articles that I read, I've seen a different use of delta. Here is what I tried to come up with on my own after reading the articles:

/*
 * Delta is ratio of how fast computer is running.
 * It is achieved by calculating:
 * (actual time) / (optimal time)
 *
 * This is passed to update method to calculate time taken
 */

public void run() {
    long lastLoopTime = System.nanoTime();
    final int TARGET_FPS = 60;
    final long OPTIMAL_TIME = 1000000000 / TARGET_FPS;

    while (isRunning) {
        long now = System.nanoTime();
        long updateTime = now - lastLoopTime;
        lastLoopTime = now;

        double delta = updateTime / (double) OPTIMAL_TIME;

        update(delta);
        render();
    }
}

Will the above code be fine as it is?

Out of these three sets of codes, which game loop would be the most optimal to use? I feel like the first set of code is too simple that it might not be as efficient as other two (not that it actually is, but just a feeling that I get).

sentences:
Box2d: Is there a way to have collisions but ignore the accompanying forces? To begin, I know that you can use filtering or isSensor to remove physical collisions. However, I would like to retain the ability to, say for example, stop when trying to move past another player. Essentially, I don't want one player to be able to push another dynamic body with the force that normally accompanies a collision. I've tried static and kinematic bodies, but both obviously have their own problems with trying to have collisions.

An example might be a topdown game such as League of Legends of Starcraft, where units can impede on eachother's movements, but don't apply any force upon collision.

sentences:
Dynamic audio score/music I'm interested in developing a game who's background music changes with the mood and scenario of the game's action. Of course many existing games do this (halo for example), but I was interested in any resources/papers/articles talking about the techniques to develop a system like this.

I have some ideas, and I understand that this will be equally challenging to implement at the code level as it will be to come up or acquire music that fits this model. Any links or, answers with ideas in them would he appreciated.

Edit: this is the kind of info I'm looking for :)
http://halo.bungie.org/misc/gdc.2002.music/

sentences:
Keep track of VoxelData/NPC in parallel Level Background

I'm tring to make a First-Person-Shooter Game in a Voxel-World (Finit Size) with Unity3d.

The Player has some kind of a Base that he has to protect against Enemy units. There are also one or more enemy Bases that the Player has to destroy, but in a different Level/Map.

The Game has multiple Levels that are connected through predefined Ports. So the Player and other Units can travel from Level to Level. There are a couple of Levels to explore. (Maybe there could be infinit Levels in the future.)

At game start I create a LevelManager and all Levels as Children of them. They can spawn an manage the Units and Voxel-Blocks independently. One ChunkManager renders always the current Level where the Player is in. He creates multiple Chunks which itself generate the Mesh from the current Voxel-Data of the Level. This works all very well and I'm also able to travel between the Levels. (This runs all in one Scene.)

At the moment I try to implement some kind of a Worm unit. They spawn from time to time anywhere in each level and can move randomly around and modify the Voxel-World by eating the Blocks away... type of random enviroment event.

Problem

The problem I can't solve is how to simulate all the Worms in parallel Levels? And the Blocks they have eaten? Same problem would occur for the enemy bases if they grow and build new defences and so on.
Because when the Player enter a Level there should be some differences since his last visit.

My attempt

All my Units and Buildings have already separated logic and rendering components. So they can work properly even when not rendered by the ChunkManager. Its working for maybe 3 Levels and a handfull of worms but if I increase the amount of Levels it gets starting to go laggy (4-10FPS). So this would not be the right way to go or is it and my code is crap?

Has someone any suggestions for me how I can solve this?

Edit

I disable now all none active Levels and reactivate always the current Level where the Player is in. So I can better manage the objects that realy need computation time.

The problem I get now is how can I simulate the progress in a Level since start? Example for the worm unit. He would have moved across the Level and left a path of removed voxels. Should I made a seperate method to calculate the path that would be made or the last X minutes or should I just call the Update method multipletimes to match the missed calls since last X minutes? This should then be made by all Objects that can modify the Level or produce something.

sentences:
How do I raycast for a spherical harmonic shader using the iOS GPU? I am beginning an Spherical Harmonics shader project for an iOS app I am writing. I have begun by reading this excellent in-depth paper on the subject.

The paper describes a scene pre-processing step that involves ray-casting (one bounce, shadow feeler). Can someone describe how ray-casting can be performed using GLSL on iOS?

sentences:
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:
How "fake" do invented names of a football game have to be in order to avoid copyright infringement? I know that real player names cannot be used in videogames unless the authorization (generally very expensive) has been given by the holders of the rights (players, teams etc.)

as explained here and here.
There is a discussion here about possible sources that can be consulted in order to figure out whether you are infringing any copyright issue, but it does not say anything specific about my problem (at least as far as I understood it, given my poor comprehension and expertise on the matter).

my question is very simple: is there any rule that determines the amount of difference (in characters, sound, length, phonological features, whatever) from a real name to a fictitious (or fake) name in order for the latter to be considered really fake?

For example, if I created a football videogame in which there is a strong offensive midfielder that has Cristiano Ronaldo's features (with respect to characteristics, statistics etc. not physical appearance) how could I call this player to avoid copyright infringement?

Cristian Ronald?
Cristo Romaldi?
Christiano Ronnaldo?

there was a famous release of ISS PRO (football game) employing fake names - here's the list - that were very similar to real ones.

Is there a specific rule/law that says which is good and which is not?

sentences:
Triangulating a bunch of squares I have a set of squares (pixels coming in from an image) that I want to triangulate.

I narrowed my choices down to 2 possible routes:

A, breaking the squares into lager rectangles, or
B, generating a set of vertices and triangulating them.

B is better, as it generates fewer vertices.

I'm dumb, and couldn't find a way to implement route A. But oddly enough, I found it simpler go with route B and generate the vertices. I'm checking neighbor pixels and using a simple lookup table to determine where to place a vertex. That is done and easy.

But with that collection of vertices, I'm stuck. It might contain holes, or be composed of multiple islands of polygons. So from there, I don't know where to go. Any ideas?

Also, if it makes any difference, I'm using these triangulated images to build up a voxel mesh, marching through the voxel data in 6 directions and looking at it in cross sections. At the end, I'll piece them all back together. It's kind of similar to the "trixels" used in Fez.

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:
How do I create a manual object with colors for each vertex? How do I create a shaded manual object with colours for each vertex?
Eg if ogreObj is the Ogre::ManualObject :

ogreObj->begin("BaseWhiteNoLighting", Ogre::RenderOperation::OT_TRIANGLE_LIST);

will allow me to select each vertex's colour with ogreObj->colour(r, g, b)
after each ogreObj->position(x, y, z) and ogreObj->normal(x, y, z) call.

However, if I change the material to BaseWhite, color() instructions are ignored.
I read that you must disable lighting int the .material script, but I need it active...
Any advice?

ANSWER: This Ogre forum's thread has a simple .material script that works for this purpose:

material Voxel/Default
{
   technique
   {
      pass
      {
         diffuse vertexcolour
         specular vertexcolour
         ambient vertexcolour
         lighting on

      }
   }
}

sentences:
Lighting Covering Up Sky ( XNA / C# ) I have a 2D tile-based lighting system which is drawn onto a Render Target.
I am also drawing a background which involves mountains, sun/moon, and clouds.
There is also the unlit game; blocks, character, etc.

Here is the order in which everything is drawn:

1. Background
2. Game World
3. Lighting

The problem is that the LIGHTING is covering up the BACKGROUND when it's dark:

Although it's perfectly fine in the day because the light is full:

You might ask, well, why don't you just blend each block, not drawing the lighting on a RenderTarget?

Because that would prevent me from performing smooth lighting, as seen in the pictures. To produce the smooth lighting, I draw squares of light onto a RenderTarget, perform a Gaussian blur and then draw that RenderTarget.

How about not drawing a square of light in empty spaces?

The light blurs onto any adjacent blocks, and not all objects in my game affected by lighting are square, so they would look like a sprite with a blurry square on top of it.

Light NOT being drawn in empty spaces:

Light being drawn everywhere:

Is there any way to keep the background visible, or something else that would help my predicament?

USING THE STENCIL BUFFER

I put in the stencil buffer code that you said should cause "little overhead"

As you can see the background blocks, due to the effect, are not darkened like they should be. The FPS here is ~15 as opposed the the steady 60 FPS it runs at without the stencil method. Also the character is somehow not being drawn correctly.

It does in fact work though despite the more than annoying lag.

sentences:
Not able to upload to Oculus Store I am building for Quest and signing the package with V2. I am also creating store-based Android Manifest file. Unfortunately the upload stops at 2nd step where I receive the error -
"The APK was signed with the V1 signature system, previously marked with V2 and signed again with V1. Such APKs are considered corrupted and cannot be installed."
Here is my Android Manifest file:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.VR.VRCube"
android:versionCode="1" android:versionName="1.0" android:installLocation="auto">
<application>
<meta-data android:name="com.samsung.android.vr.application.mode" android:value="vr_only"/>
<meta-data android:name="com.oculus.supportedDevices" android:value="quest|quest2"/>
<activity android:screenOrientation="landscape"
     android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
     android:configChanges="density|keyboard|keyboardHidden|navigation|orientation|screenLayout|screenSize|uiMode"
     android:launchMode="singleTask"
     android:resizeableActivity="false">
</activity>
</application>
<uses-sdk android:minSdkVersion="21"/>
<uses-feature android:glEsVersion="0x00030001" />
<uses-feature android:name="android.hardware.vr.headtracking" android:required="true" android:version="1" />
</manifest>

sentences:
Update total enemy counter after single enemy is defeated? So I have a list that counts how many enemies are in the area. But when I kill an enemy, the list shows that that element in that array is missing, and doesn't reduce the enemy counter. How can I get it to reflect when an enemy is defeated?

Code:

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

public class EnemyCount : MonoBehaviour {
public List<Transform> enemies;

void Start () {
    enemies = new List<Transform>();
}

void Update () {
    FindAllEnemies();
}

public void FindAllEnemies () {
    GameObject[] go = GameObject.FindGameObjectsWithTag("Enemy");

    foreach (GameObject enemy in go) {
        //Checks for duplicates
        if (!enemies.Contains(enemy.transform)) {
            AddEnemiesToList(enemy.transform);
        }
    }
}

public void AddEnemiesToList (Transform enemy) {
    enemies.Add(enemy);
}
}

sentences:
How to do collision detection in Unity between Character Controller, Rigidbody Collider and a NavmeshAgent? I would like to know more about how collision detection works in Unity especially when character controllers and NavmeshAgents get involved.

For example, how can I detect collision between NavmeshAgent and a CharacterController?
I have added a sphere collider to my NavmeshAgent, but it doesn't seem to detect a collision unless I set it to "IsTrigger".
I have tried OnCollisionEnter(), OnControllerColliderHit() and OnTriggerEnter().
OnTriggerEnter() seems to be the only one that works and only when I enable "IsTrigger".

How come the other two don't work? Shouldn't they? What if I didn't want to make the collider a trigger?

sentences:
How to stop an animation on last frame until condition is met in Unity? I have an animation (fishing) I want to play backwards when the player catches something or cancels the action.

Playing the animation backwards is as simple as setting the speed to -1, ie:

anim.SetFloat("direction", -1.0f);

However, my fishing animation keeps playing until I have caught something, or cancel the animation. This means that the last frame of the animation is showing, but the time of the animation is still going.

So

the animation reaches the last frame
then I stand there for 8 seconds,
I catch something, so I change anim speed to -1
anim will now reverse those 8 seconds I was "standing still" first, before it even reaches the actual animation.

I need to stop the animation time on the last frame (without leaving the animation), so that reverse will be instant. And to not exit the animation until the reverse is finished. Maybe there is some other way to do it, but I can't figure it out.

I could create a seperate animation for when I want it to go backwards, but that seems sloppy.

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:
Is it safe to set FPS rate to a constant? I learned from game class that in update function, every movements must be time dependent for the sake of linearity in movement.

We made a simple game. Every move like going left, right or jump is written time dependent.

But, in some other computers, our game is worked very differently. For example, our character jumps higher than it should be. I guess this is because each computer has different FPS rate according to its specification.

My question is that what should we do to make this game work in same way in every computer? Setting FPS rate to a constant is a solution?

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:
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:
Canvas not visible in my GearVR Project with Vuforia (Unity) I created a simple AR project with vuforia and my Samsung GearVR, like described here : https://developer.vuforia.com/library/articles/Solution/Integrating-Gear-VR-and-the-AR-VR-Sample-in-Unity-5-3-and-above . This works fine so far. Now I want to add some canvas elements, I don't want them to move, just fixed canvas elements. I tried to place my canvas on different positions in the scene :

Root
Child of CameraRig
Child of LeftCamera
Child of TrackableParent
Child of an ImageTarget in TrackableParent

But for all of these cases the canvas is not visible. I know, this question is really specific, but maybe someone with knowledge in this specific thing can help me.

This is my Canvas :

sentences:
How do I open the camera in a CCScene node in a Cocos2D application? I am new to Cocos2D and I can't find the way to open the camera from the library. I want to open the camera in the my game, can any one help me with with this?

Thank you in advance.

sentences:
How to crop or mask a sprite to a specific shape in Unity (2D)? I'm trying to do a procedural 2D terrain generation. I've managed to make the function to generate the points, and I've been testing/debugging by creating the terrain using a 2D polygon collider on an object.

Now that it's done, I want to use this shape to crop a large sprite using the shape so that I obtain the shaped terrain. If I have a square terrain sprite, is there any way to crop the top or mask it to the shape of the polygon collider (or the shape of the function I'm using).

sentences:
QuadTree-based pathfinding for a volume body I want to make a game where a player follows a mouse pointer. The game is not tile-based. I use quadtree for a collision detection and everything works fine. But now I want to develop a player pathfinding algorithm. I.e. when a user clicks somewhere the player should find the most expected way to go there and follows it. And I stuck with situations like on the picture:

Player is not just a dot. He has got specified size (2D volume). If I use centres of the quadtree regions as a path trajectory, then this tunnel looks impassable. But when I control the player directly from the keyboard, he of course, is able to pass through this place.

How can I make quadtree-based pathfinding works for such situations? Or should I use another technique to solve this problem maybe?

sentences:
How can I use the graphics pipeline to render volumetric data based on a density function? Both graphics APIs (OpenGL and DirectX) devise a well defined pipeline in which several stages are programmable. These programmable stages require to take a fixed minimum amount of data and are supposed to do a well defined range of operations on it, and output some defined minimum output, so that data can be passed on to the next stage correctly. It seems as if these pipelines are designed to work with only a limited amount of types of geometric data, which in the case of both D3D and OGL are vertex data and texture co-ordinates.

But, if given a case when the application I plan to make doesn't use vertices ( or even voxels ) to represent its geometric data and does not exactly do transformations or projections or rasterisation or interpolation or anything like that, such limitations of the APIs or the pipeline make things difficult.

So, is there a way in which we can change graphics pipeline in a way so that the functionality of what each stage does to the data and the type of data that is outputted in each stage is changed to my advantage? If not, then is there a way by which I can use the 'raw' API functions to construct my own pipeline? If not, then please mention why it isn't possible.

EDIT : My Application uses density functions to represent geometry. The function has a value at each point in space. I divide the frustum of the camera into a 3d grid, each block can be projected as a pixel. On each block, I integrate the density function and check if its value is more than a required value. If yes, then its is assumed that something exists in that block and that pixel corresponding to that block is rendered.
 so, now in my renderer, I want to pass the function ( which i represent with a string ) to the graphics hardware instead of vertex data in vertex buffers. this also implies that the vertex shader won't have vertices to transform into homogeniouse clip space and the fragment shader doesn't get pixel info. instead, now most of the looking up and evaluation happens per pixel.

sentences: Force Unity To not use computer gpu for testing purpose I want to check that how my game behaving in GPU less pc. For this reason, i want to ask that is there any way to test it? Currently, i am using two pc for this purpose. One is without the GPU. Can i use my same pc and force unity to not use GPU?

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:
Swap between first person and eagle eye view cameras, hiding the FP controller Not sure what has to be done to correctly swap between a generic fps controller camera, to something like an eagle eye view.

The idea is to have the player use the FPS controller, then when he get in a control seat; I want to switch to a larger view; kinda like a RTS view from the top (I call it "eagle eye", not sure about the technical name).

I did check around and from my research, I have to swap active camera parameter; but when I do so, the FPS remain active, while I would like to hide it, and also disable it completely, since the player will use the mouse at that point.

If I destroy the FPS, that works, but when the player leave the control seat, I have to re-create it, which bring a whole level of pain, to restore its state.

How do you disable temporarily a FPS, so it won't be neither visible nor it will interact with anything?

sentences:
Name doesn't exist in current context in Unity I'm currently making a collectible heart in unity, the kind that updates your health bar when you collide with it, and I made two scripts:

This one is called 'healthmonitor':

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

public class healthmonitor : MonoBehaviour {

public static int HealthValue;
public int InternalHealth;
public GameObject Heart1;
public GameObject Heart2;
public GameObject Heart3;

void Start () {
    HealthValue = 1;
}

void Update () {
    InternalHealth = HealthValue;

    if (HealthValue == 1) {
        Heart1.SetActive (true);
    }
    if (HealthValue == 2) {
        Heart2.SetActive (true);
    }
    if (HealthValue == 3) {
        Heart3.SetActive (true);
    }

}
}

This one is called 'hearstscript':

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

 public class heartscript : MonoBehaviour {

public int Rotatespeed;
public AudioSource CollectSound;
public GameObject thisheart;

void Update () {
    Rotatespeed =10;
    transform.Rotate(0, Rotatespeed, 0, Space.World);
}

void OnTriggerEnter () {
    CollectSound.Play ();
    HealthMonitor.HealthValue += 1;
    thisheart.SetActive (false);
}
}

Here is a picture of my UI:

I made an empty game object and named it HealthMonitor and applied the healthmonitor script to it. Here's a picture of the inspector panel:

The problem is that with heartscript I get the following error;

  Name "HealthMonitor" doesn't exist in current context.

I believe it relates to this line:

HealthMonitor.HealthValue += 1;

P.S. I am trying to refer to the empty game object, not the script.

sentences:
Game engine with good Lua entity creation/management I'm looking for an engine that constructs it's entities using Lua or other scripting language. This is in order to find inspiration and do it in my own engine as well.

I know that CryEngine does use Lua to make their entities, but I wanted to know if there are some other alternatives that I can look up.

Thanks!

sentences:
OpenGL: Transformations I'm not sure if I correctly understand 3D transformations in OpenGL. Let's assume I'm using the typical matrix stack.

It seems like you move the world X units over, drop in a bag of verts (a mesh) and move the world back by popping the matrix off the stack, then you repeat the process to place another model?

Say I wanted to place a model at (10, 0, 0) and another at (0, 10, 0). I think I would...

PUSH move(10,0,0);
DRAW model A;
POP;
PUSH move(0,10,0);
DRAW model B;
POP;

Some questions come to mind, like for example what does loading an identity matrix do in the stack?

Am I right to assume that these operations in effect move the world around, then you draw the mesh at 0,0,0 in world space when you've moved the world to your liking?

Or is it the other way around, does GL "apply" the matrix stack to your mesh as you draw it?

Thanks, -Cody

sentences:
How can we achieve Earthquake Simulation in Unity - Simulation of P and S Waves I Cannot use Water waves as P and S Waves are different than water waves. I tried to use it but not satisfied with the result.

I am trying to simulate how Earthquake takes place in real time which you cannot simulate in the real world. Here is the reference link to understand the basics of Earthquake and to understand better here is the better-simulated Example. I wanted to Simulate P and S Waves. My first attempt will be simulating with mesh instead of showing lines, I don't know how to compress mesh (P Waves) but I found out a good example to simulate wave like effect (S Waves).

The solution I am looking forward to is :

Any idea of how I can compress - decompress mesh in Unity (P Waves).
wave like effect (S waves), I have an example but it moves only Plane, in my case, i want to do more like a deformation of mesh, so it gives me an real effect like S Waves.

sentences:
Unity 2D camera behaviour I am trying to create camera behavior where camera moving slightly forward the player along his movement direction to extend the visible area.

For camera movement, I use an empty object which moves as the player object by Input.GetAxis() and clamps in some borders around the player for the later to stay in camera area.

But I don't want to simply snap camera to the target object. I want the camera to smoothly lerp forward in player's movement direction and if there is no movement anymore - smoothly lerp back to the player object.

Problem is - I can't detect presence or absence of movement of the empty target object. I thought of using this method https://answers.unity.com/questions/907078/how-to-detect-movement.html  if(Mathf.Abs(rigidbody2D.velocity.y) < 0.001)

It didn't work at first because I moved my target point with transform.Translate(). When I tried rigidbody2D.Addforce() and it didn't work neither. I noticed that applied force actualy isn't reducing per time it stays the same. Then I tried rigidbody2D.MovePosition() and it also isn't working also velocity on every axis stays 0 and clamp isn't working with this method. Here is the code:

public class TargetPointBehaviour : MonoBehaviour{

[Tooltip("Used as origin point for camera movement.")]
[SerializeField]
private GameObject playerObject; //Used as origin point for camera movement

private Transform playerTransform; //players transform
private Vector2 playerPosition; // x, y player position

private Rigidbody2D targetPointRB2D; //rigidbody2D of target point object

//========================================================================================================

[Tooltip("Value to offset the camera from the player")]
[SerializeField]
private float offsetFromThePlayer; //value to determine how far target to interpolation will be

void Start()
{
    playerTransform = playerObject.GetComponent<Transform>();
    targetPointRB2D = GetComponent<Rigidbody2D>(); // assigning RigidBody2D component to variable
}

void FixedUpdate()
{
    MoveTargetPoint();
    ClampMovement();
    MoveTargetPointToPlayerPosition();
}

private void MoveTargetPoint() // moves targetPoint object by player controls
{
    GetComponent<Rigidbody2D>().MovePosition((new Vector2(Input.GetAxis("Horizontal") * 100,
        Input.GetAxis("Vertical") * 100))); // moves object by player controls
}

private void ClampMovement() //moves target point in defined borders GetComponent<Rigidbody2D>().AddForce
{
    transform.position = new Vector2(Mathf.Clamp(transform.position.x, playerTransform.position.x - offsetFromThePlayer, playerTransform.position.x + offsetFromThePlayer),
    Mathf.Clamp(transform.position.y, playerTransform.position.y - offsetFromThePlayer,
    playerTransform.position.y + offsetFromThePlayer)); //constraints movement by offsetFromThePlayer value

}

//checks if movement of targetPoint stops and when returns it to player object coordinates
private void MoveTargetPointToPlayerPosition()
{
    Debug.Log("Velocity Y: " + targetPointRB2D.velocity.y + ". Velocity X: " + targetPointRB2D.velocity.x);

    if (Mathf.Abs(targetPointRB2D.velocity.y) < 0.01f && Mathf.Abs(targetPointRB2D.velocity.x) < 0.01f)
    {
        StartCoroutine(DelayBeforereturningToPlayerObject());
        transform.Translate(playerTransform.position.x, playerTransform.position.y, 0);
    }
}

private IEnumerator DelayBeforereturningToPlayerObject() //delay for some time befor target returns to player object
{
    yield return new WaitForSeconds(0.1f);
}}

I didn't implemented actual camera movement yet cause don't see the point while the target for the camera isn't working. But maybe there is a more efficient way to implement what I want?

sentences: I'm a single developer making a game made of blocks. Can I make 3d characters made of blocks without looking like Minecraft? I would like to differentiate the look as much as I can but yet it has to be within the limits of what is reasonable for a single programmer can do.  I have alot of ideas that would make the game itself different but I'm afraid the look of the blocky world and blocky characters are going to be too much like Minecraft.  I've toyed around with the idea of giving the characters big heads, or skinny bodies, or elbows and knees.

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 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: How do I make my prefabs spawn behind the UI? I'm making a game where three characters spawn in specific locations. I made three gameobjects called stations so I could take the transform positions and spawn the three caracters there. And I have a UI element that is supposed to stay in front of everything. But the problem is that when I hit play, the three characters spawn in front of the UI element. I already checked the positions related to the camera but it doesn't seem to be it. Does anyone know how to help me?

sentences:
TiledMap taking a lot of time to load in libgdx I am developing a game using libGdx in which a level has 2400 * 450 tiles Map and each tile is of 4 pixels. I am also using box2d in my game.

My problem is that when I run the game on my phone it takes a lot of time to load the screen (more than a minute).
How can I reduce this loading time?

I created tilemap using Tiled and I am using Android Studio.

Below is my code (SCALE is 2.0f and PPM is 4)

@Override
public void show() {
    w = Gdx.graphics.getWidth();
    h = Gdx.graphics.getHeight();

    camera = new OrthographicCamera();
    camera.setToOrtho(false, w / SCALE, h / SCALE);
    camera.update();
    viewport = new FitViewport(w / SCALE, h / SCALE  ,camera);
    viewport.apply();
  .
  .
  .

    map = new TmxMapLoader().load("maps/lvl3.tmx");
    tmr = new OrthogonalTiledMapRenderer(map, 1/SCALE);

}

@Override
public void render(float delta) {
    update(Gdx.graphics.getDeltaTime());

    //Render
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    tmr.render();

    .
    .
    .
    b2dr.render(world, camera.combined.scl(PPM));
}

public void update(float delta) {

    world.step(1 / 60f, 6, 2);
    cameraUpdate(delta);
    tmr.setView(camera);
    batch.setProjectionMatrix(camera.combined);
}

@Override
public void resize(int width, int height) {
    camera.setToOrtho(false, width / SCALE, height / SCALE);

    viewport.update( width , height );
}

Please help and thanks in advance

sentences:
My isometric game looks flat; how can I improve this? Being bored I decided to make my game isometric by applying a simple filter effect.

    g.scale(1f, 0.5f);
    g.rotate(400, c.getHeight() / 2, 45);

It works great, but now everything appears... flat.

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:
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:
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:
What makes a game look "good"? I am working on a 3D space game using OpenGL and C++ and I am planning to focus on giving the game modern, eye-catching graphics, but the more I think of it the more I realise I don't really know what makes graphics "good". Sure, I can go and play some well known AAA games and bask in the amazingly put together graphics, but I don't really know how the graphics looks good. (this is why I consider games to be an art!)

This is what I can think of now:

High quality textures
High quality models
A good lighting model
Bumpmapping + specularity mapping
High quality UI, if applicable
A wealth of not-overdone posteffects

I'm asking here in the hope of an experienced game developer who has produced games and know how they work inside and out can explain some techniques that warrant a game's graphics to look "good", and some not-well-known quirky tips. That'd be awesome.

Thanks!

sentences:
Interaction between GUI and character(s) This is more a question about architecture. Not sure if there's a right or wrong:

Let's assume I have some gameobjects:

GUI: A menu containing some elements like "Go to position". It's opened when right clicking in the game
Main Camera
Characters: Characters in the game which can be controlled by the player

Now I was thinking about the following scenarios:

A character is clicked. It's highlighted yellow. This should definitely be done in the script of the character.
When a character is highlighted (or selected) and the right mouse button is clicked, the GUI will be shown. Where does this have to be implemented when talking about clean code? In the character? But then the character has to know about the GUI. I'm not sure if this is clean. In the GUI? Then then the GUI has to know if a character was highlighted (or selected). Doesn't feel clean too.

sentences:
2D platformer:How to avoid "bouncing descend" when walking down slopes? I've been working on implementing slope collision by SAT(Separating Axis Theorem). And then I have a trouble. When my character walks down slope, it moves like a bouncing ball:

The slope has 3 sprites (45°):

Here is my current code with JavaScript:

slopes.forEach((slope) => {
    //Minimum Translation Vector
    let mtv = character.collidesWith(slope);

    if(mtv.overlap !== 0) {
        character.velocityY = 0;
        character.positionY -= mtv.overlap;
    }
});

It works good when moving up, but bouncing when down, I have no idea how to keep the character stay on slope when walking down. Please, any help would be appreciated.

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:
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:
RPG Game Graphics Help/Review I've been working on an simple RPG game and I'm having troubles figuring out how my graphics should look.

I'm wondering if any of you could give some advice on how they are/could be more pleasing to the eye.

Here is a couple of screen shots of the game itself:

Any suggetions/comments!

Thanks!

Sorry, I'm unable to post more pictures, because of my repution :(

Edit:
 After some working on the look of the game here is where I got to...

sentences:
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 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:
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:
balloon ligher than air with libgdx, impementation of FixtureDef.density, gravityScale, linearDamping? I use libGdx/box2d's physic. My intention is to create a balloon filled with helium (a body, what hovers above a surface, if we apply a little force to it - it moves fast but not far, if we push against a obstacle - it collide and jump back (restitution)).
I was suggested to use linearDamping or gravityScale to achieve similar behavoir.
So far I achieved a ball behavior: it hovers, it moves (not as intended, just simple move), but no restitution. Here my code:

        mBallDef = new BodyDef();
        mBallDef.type = BodyType.DynamicBody;
        mBallDef.position.set(x, y);

        mShape = new CircleShape();
        mShape.setRadius(radius);

        mFixDef = new FixtureDef();
        mFixDef.shape = mShape;
        mFixDef.density = 0.7f;
        mFixDef.friction = .5f;
        mFixDef.restitution = .8f;

        mBall = world.createBody(mBallDef);
        mBall.setActive(true);
        mBall.setAwake(true);

        mBallFix = mBall.createFixture(mFixDef);
        mBall.setGravityScale(.2f);
        mBall.setLinearDamping(5.5f);

Touch implementation (just moves a balloon up, it's for test, nothing special)

Gdx.input.setInputProcessor(new InputHandler()
    {
        @Override
        public boolean touchDown(int screenX, int screenY, int pointer, int button)
        {
            mBall.applyLinearImpulse(0, 15.5f, mBall.getWorldCenter().x + mShape.getRadius(),mBall.getWorldCenter().y - mShape.getRadius(), true);
            mBall.setAngularVelocity(0);

            return true;
        }

    });

When I use for gravity - .2f and for linearDamping - 5.5f, a ball hovers, but I loose a restitution for my balloon. The restitution is available only for linearDamping below 1.5f. And I was told that it's not good practice to keep gravity far away from 1.
My experiment with FixtureDef.density failed, changing it to various values (grom -2 to 2) has no visible effect.
The questions are:
1) What's use of density? It doesn't provide visible affect.
2) What values I should declare to create balloon ligher than air?

sentences:
How or why are major video games programmed so reliably? It seems like every five minutes, you come across yet another installer which fails to install certain components, another .NET application that throws up an unhandled or semi-unhandled error message, a web site whose links are broken or whose JavaScript doesn't work with the most recent IE, popular apps and Flash games that freeze on occasion, etc.  Time and again you come across programs that, though they work most of the time, you will come across occasional serious errors with them, wherein they are either dead in the water or close to it.

I remember seeing a lot of glitches back in the NES days, but since around the early- to mid-90's, major video games seem to have been mostly free of things like this.  I know there are exceptions, but basically unless you are really trying to perform some sort of hack you read about online, you just don't see any issues with them freezing, throwing unhandled exceptions, or doing anything else like that.  At worst it tends to be tiny, momentary graphical anomalies that don't really matter.

In other words, major video games seem to be built to a much higher standard in reliability than most other things out there, aside from development software, despite the fact that they tend to be very large and complex pieces of software - often written in C++, no less.  You just do not have the same sorts of problems with them that you do with software in other fields.

Why?  How?  I know this could just be a result of quality control, plus just using programmers who were at the top of their class, but I've grown doubtful of this.  To me, it seems like even these measures would not ensure consistently more reliable software in situations in which it should be much less reliable.  Are people really just doing their jobs that much better, or is there something more to the picture here (such as a business practice or a development technique that these companies tend to employ)?

I know that this isn't the most scientific question out there, but I still want to make sure I'm not just missing something.  Thanks.

sentences:
How to convert point coordinate when taking a snapshot? Can anyone explain me please how to convert point from Screen-coordinate system to Texture 2D?
The screen size say for example 700x500 and Texture2D must be of size 1024x768. I am getting points from scene, convert them with camera.WorldToScreen and then multiply by ratio, which doesn't work correctly for some reason.
Here is my code:

//PROCESSING POINTS
cam_pts[i] = detector.WorldToScreenPoint(pts[i]);
cam_pts[i].y = Screen.height - cam_pts[i].y;
cam_pts[i].x = cam_pts[i].x * (ImageWidth/(float)Screen.width);
cam_pts[i].y = cam_pts[i].y * (ImageHeight/(float)Screen.height);

//SAVING CAPTURE SCREEN
RenderTexture rt = new RenderTexture(ImageWidth, ImageHeight, 24);
detector.targetTexture = rt;
Texture2D screenShot = new Texture2D(ImageWidth, ImageHeight, TextureFormat.RGB24, false);
detector.Render();
RenderTexture.active = rt;
screenShot.ReadPixels(new Rect(0, 0, ImageWidth, ImageHeight), 0, 0);
detector.targetTexture = null;
RenderTexture.active = null;
Destroy(rt);
byte[] bytes = screenShot.EncodeToPNG();
string filename = string.Format("Screenshot_{0}.png", counter);
System.IO.File.WriteAllBytes(filename, bytes);

The red points must be at the corners of the pallet.
I am new in Unity and C# and will be thankful if someone explains me how to do it right.

sentences: Keeping Android device awake I currently program a game in which the user don't need to interact with the screen. Is there any way to keep the screen awake?

sentences:
What is adaptive super-sampling? I'm trying to implement anti-aliasing into a raytracer with super-sampling.

What exactly is adaptive super sampling? I'm picturing it as just sampling all of the pixels which are on the edge of each object. Is that a correct explanation?

Also, is adaptive super sampling a type of MSAA? To my understanding, MSAA is essentially an anti-alising process that does not sample every pixel more than needed/is adaptive.

sentences:
Want some limits in Bullet firing and its stop when i press the shoot button I want some limits or range when my player fire the bullets and when i press the shoot button my fire as been stopped. I use the GetButtonDown from this its fire continuously but its not stopped. and if i use Input.GetButton than its hold the button and fire continuously but in fire there is no gap. So, my problem is that how i stop the bullet fire when i press the shoot button and if choose this (INPUT.GETBUTTON) and its hold the shoot button and its fire continuously than i  want some gap on that fire and some limits or range of fire.

void Update(){
        if(Input.GetButtonDown("Fire1"))
        {
            shootRoutine = StartCoroutine(PlayerShoot());

        }else if(Input.GetButtonUp("JumpButton"))
        {
            StopCoroutine(shootRoutine);
            shootRoutine = null;

        }
    }

    void JumpButton(){
        if(!transform.GetChild(0).gameObject.GetComponent<PlayerHealth>
            ().hasDied){
            if (grounded){
                grounded = false;
                myRigidBody.AddForce (new Vector2 (0,
                    jumpPower), ForceMode2D.Impulse);
                if(myRigidBody.velocity.y > jumpPower){
                    myRigidBody.velocity = new Vector2 (0,
                        jumpPower);
                }
                animator.SetBool ("isGrounded", grounded);
            }
        }
    }

PlayerShoot method

IEnumerator PlayerShoot()
    {
        while(true)
        {
            if (!transform.GetChild
                (0).gameObject.GetComponent<PlayerHealth>().hasDied)
            {
                if (energy >= 5f)
                {
                    //energy -= 5f;
                    energyLevel.value = (int)
                        energy;
                    energyText.text = (int)energy
                        + "%";

                    GameObject newProjectile =
                        Instantiate(projectile, new Vector3(transform.position.x + 1.5f, transform.position.y - 0.02f,
                            transform.position.z), Quaternion.identity) as GameObject;
                    if
                        (GameController.instance.isMusicOn)
                    {

                        AudioSource.PlayClipAtPoint(MusicController.instance.audioClips[2],
                            newProjectile.transform.position);
                    }
                }
            }

            yield return new WaitForSeconds(shootDelay);
            //Wait for 'shootDelay' seconds before starting over again.
        }
    }

sentences:
Can I use the HD Graphics 3000's quad list primitive type via D3D? I was studying some technical documentation on the Intel HD Graphics 3000 GPU, which I'm using as a lower-end reference for my 2D game engine. I noticed the hardware supports a nice "Quad List" topology, where every 4 vertices in a vert buffer are interpreted as an independent quad. My engine draws nothing but sprite quads, so that would be a nice optimization in my case, to eliminate the need for copying / caching / processing an accompanying index buffer with 12 bytes per quad of trivial triangle edge definitions (I'm using indexed TriangleList primitives at the moment).

From what I can tell though, DirectX 9 doesn't expose quad list, and after some cursory peeking around in DX10/11 (which I don't plan to support at this point) it seems they don't expose this feature either.

Does anyone know if there's a way to use Quad Lists in DirectX? I'd be curious about OpenGL also, if anyone has experience on that side.

sentences: Runtime resolution changing with GLFW3 I've been trying to figure out the correct method for changing the resolution/fullscreen state of a GLFW window for a while now, but after searching all I found were references of how to do it with older versions of the library such as this. I suspect you'd just destroy the window object and re-create it, but was not sure because of how some functions such as glfwSetKeyCallback take a GLFWwindow* as a parameter, and I don't know if that'd continue to work after it has been re-created. The documentation also does not have any examples on doing such a thing, so any help would be appreciated.

sentences:
Other games that employ mechanics like the game "Diplomacy" I'm doing a little bit of research and I'm hoping you can help me track down any games, other than Diplomacy (online version here), that employ all or some of the mechanics in Diplomacy (rules, short form). Examples I'm looking for:

Simultaneous orders given prior to execution of orders

In Diplomacy, players "write down" their moves and execute them "at the same time"

Support, in terms of supporting an attacker or defender "take" a territory.

In Diplomacy, no one unit is stronger than another you need to combine the strength of multiple units to attack other territories.

Rules for how move conflicts are resolved

Example, 2 units move into a space, but only one is allowed, what happens.

I may add to this list later, but these are the primary things I'm looking for. If you need clarification on anything just let me know.

  Note: I tried asking this on GamingSE, but it was shot down. So, I am unsure where else I could post this. Since I am researching this for game development purposes, I assume this post is on topic. Please let me know if this is not the case. Please also feel free to re-categorize this. Thanks!

sentences:
2D Rectangle Collision I want to make a small 2D game.
In the game you can go in all directions(with the bird's-eye view) and can shoot.
(A little bit like BoxHead http://de.y8.com/games/box_head_2play)
My problem there is the collision detection and especially the response, in which the detection of a collision is not really the problem(I use for that a quad tree).
The real problem is the response to the collision.
For simplifying it, all objects in the game are rectangles that cannot rotate, no shapes or circles.
The rectangles are represented by a vector for the left bottom corner and a vector for the right top corner.
The origin of the coordinate system is in the left bottom corner(I know in games its often on the left top corner but I prefer the bottom corner).
So now a object in the world is composite with a rectangle and a velocity vector.
The algorithm for now is, change the velocity(For example if the user press a key) from a object(In this case the player), add the velocity on the object and at last check for collision(I leave fro now the acceleration alone).

The real question now:
How I response to the collision now ?
What should I do, if the quad tree detect a collision ?
Is the basic algorithm right ?

Still a small question: How I can detect collision in a endless world with a quad tree(Quad trees was always limited to a specify size) ?

You see I have a lot of questions.
I don't know where to start and handle/detect the collision.
I hope you can help me to get started.

EDIT:
I don't need/want advanced collisions/physics.
I only want that a player cant go through walls and detect if a bullet hits something.

sentences:
How can I find a good fixed ratio between buying and selling prices for the player in an in-game market? I'm developing a single player game containing gathering and crafting where I'm still struggling to find base values for the prices of gathered resources and crafted items. (But this is part of Constructing a game stock market)
Since it's a single player game and just one in-game market that offers items, I do not want to use dynamic pricing, I'm looking for a reasonable ratio between the buying and selling price. I was not able to find any hints on how to determine a good starting point.
Is for example 2:1 a reasonable ratio between the buying and the selling price for the player?
Things to consider:

Of course the buying price has to be higher than the selling price or otherwise players could just make fortune by buying and selling the same item.
Only some randomly chosen items will be available to buy in a certain time period and rarer items will be seen less often in the shop to buy.
The offer should be reasonable enough to tempt the player to buy the item instead of farming the ingredients and craft the item for themselves.

Updated the question to fit the constraints.

sentences:
How to store shader output to VRAM? This is really ungrateful question to Google.

Basically, I would like to know, regarding openGL, what are various methods to do some kind of computation in one of the shaders and have the results stored in VRAM to be used and accessed at a later time?

sentences:
Effect of merging sprite I want to create the effect of merging of colours if they are overlapping.

My game is a tile-based game. For all intents and purposes, lets consider a tile from (0,0) to (1,1) in the entire example.
A square sprite (lets say red) will start moving from either the diagonal edges, or the centre of the sides and will move to the centre of the tile and fill it.

In this image, 1 red sprite is moving from top centre, and the other one from bottom right.

If 2 blocks of the same colour are moving into that tile, and they overlap, they should change the colour, but only of the overlapping area.

Is this possible? If so, with sprites, or do you recommend materials and textures?

Side note: The shape may not necessarily be square. They can be rounded squares, triangles, etc. Also, the red squares may not look so plain. They may have a few inner-shadow and other effects. Also, colour of the 2 blocks might not be the same. E.g.:
Red and black would merge to form orange.

Any suggestions would be great. Phrasing the question was a little tough. Ask me for any details if something was not clear. Thanks in advance :)

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

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

This is the script:

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

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

    [Space(5)]

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

    private int currentCamera = 0;

    [Space(5)]

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

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

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

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

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

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

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

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

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

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

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

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

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

sentences: Problems setting up dx12 I'm following the Frank Luna directX12 book, I have installed the windows 10 SDK etc but now, when I compile any project from his demo they wont build. Error I am getting is Cannot open source file  which I have never had a problem including before I installed windows 10 SDK, any suggestions? If any more info is needed let me know

sentences: 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: How do I find at least the closest penetrating point with SAT? For more accurate simulations, I want to find the closest point of another polygon to one polygon's center when they collide. Is this possible with the SAT algorithm? Is it a good strategy at all for semi-accurate physics simulations (more accurate than the normal between the 2 polygons' centers)?

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:
How well (or badly) does Minecraft SMP scale? Has anyone tested and collected some data about how well does Minecraft SMP scale, with an increasing number of players (up to large amounts of players)?

I.e. the bottlenecks are:

mostly in the server or in the client or both
if the players are all in the same area, or if they are in different areas, or it is irrelevant where they are

sentences:
How to check if the bottom side of one object touches the top side of another object? How can I check if the bottom side of one object touches the top side of another object? Like on the image:

I tried this:
foreach (tile t in tiles)
        {
            foreach (tile t2 in tiles)
            {
                if (t != t2)
                {
                    if (t.rect.Intersects(t2.rect))
                    {
                        if (t.rect.Center.Y < t2.rect.Center.Y)
                        {
                            kill_tiles_list.Add(t2);
                            kill_tiles_list.Add(t);
                        }
                    }
                }
            }
        }
    }

It will work to tell me that there has been a collision, but it will not tell me about which parts collided.

sentences:
Method Animator.SetBool sometimes is not working (or not triggering) in Unity2D I have trouble with Animator in Unity2d. I have a main character for my game. The character has his own animation clip for fighting. When the player touches the screen, i am starting animation. When the player touches the screen slowly (every second) - everything is working fine, but when the player touches the screen fast, the animation clip is playing about 10 times, and then nothing happens (the clip isn't playing). I've checked - the touch event is triggered normaly, may the problem is with animator. Does anyone have ideas how to fix this issue?

public bool UseAxisInput = false;
private Animator Anim;

// Use this for initialization
void Start () {
    Anim = GetComponent<Animator>();
}

// Update is called once per frame
void Update () {
        for (var i = 0; i < Input.touchCount; ++i)
        {
            if (Input.GetTouch(i).phase == TouchPhase.Began)
            {
                Anim.SetBool("IsFighting", true);
            }
        }
}

May be this is because of that at the end of my animation i have an animation event which calls the method, that stops animation.

This is my method, that is called, after the animation ends

public void stopFighting()
{
    Anim.SetBool("IsFighting", false);
}

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

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

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

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

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

        Pass
    {
        Blend SrcAlpha OneMinusSrcAlpha

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

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

        sampler2D _MainTex;
    float4 _MainTex_ST;

    fixed4 _Color;

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

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

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

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

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

    return col;
    }
        ENDCG
    }

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

sentences:
FPS drops when I maximize the game tab in Unity Editor I have a simple unity scene with some primitive objects like cubes and spheres. Most of the objects are static and I made backed GI for lighting, The light is a point light. I also used unity post-processing asset for the depth of field.
 FPS in normal game window size is about 500 but when I maximize the Game tab, FPS goes around 30. Why does this happen?
FPS 500

FPS 30

sentences:
Sprite collisions in android andengine I'm developing a simple game by andengine. I have 10 balls which are moving randomly on screen.i'm importing the balls as picture in sprites.if they move at the same coordinate , they pass though their own insides.but i want: if they move at the same coodirnates ,they should change their directions.so they cannot pass through their insides.how can i do that?

 private Runnable mStartCircle = new Runnable() {
  public void run() {
    int i = circleNumber++;
    Scene scene = Level1Activity.this.mEngine.getScene();
    float startY = -64.0f;
    float startX = randomNumber.nextFloat()*(CAMERA_WIDTH-70.0f);
    float a= randomNumber.nextFloat()*(CAMERA_WIDTH-70.0f);
    circles[i] = new Sprite(startX, startY, textRegCircle[i]);
    circles[i].registerEntityModifier(
            (IEntityModifier) new SequenceEntityModifier (
                        new MoveModifier(10.0f, circles[i].getX(),  a,
                                circles[i].getY(),CAMERA_HEIGHT+64.0f)));
    }
    scene.getLastChild().attachChild(circles[i]);
    if (circleNumber < 10){
        mHandler.postDelayed(mStartCircle,1000);
    }
}

};

sentences:
creating a UI menu in c++ Im currently working on a 2D Game where the users can interact with specific nodes and are able to edit certain bits of information and I also plan for the users to be able to click buttons to set specific information.

My problem is that I do not know how to write code to create a side menu/UI system where information can be passed to it and displayed and also be edited by the system.

If anyone has any tutorials or material that they would be able to point me towards that they think would be helpful with this would be very appreciated as I do not know where to begin with this. Note that at the moment I am willing to swap from DirectX to OpenGL if that would be easier though I would prefer to stick to DirectX if possible

Thanks

sentences:
How do I create this type of mixed 2D/3D character model? I'm interested in how this little Lively Hamster Flash game's character is modelled and animated.

The head seems 3D. The back always shows a black outline, so I assume it is 2D.

Is this a Flash-provided effect? How could I create such a model?

sentences:
How can I store additional attributes on DCEL edges? I am currently working on a city generator, and I've ran into some issues with data storage while working on the roads. I currently use a doubly-connected edge list (DCEL for short), to store the road data. Each road would consist of two half edges, each connecting to a vertex.

The advantage of a DCEL is that I can easily access the space partitions of the roads, or the faces contained by the half edges. However, I am running into trouble storing additional data for roads.

I currently store (alongside the DCEL) a vector that simple contains all the roads as simple pairs of the indices of their beginnings and ends. However, I only use this vector to access data in bulk (for a bounding box test or rendering), nothing specific.

I want to store additional information about roads as some struct, but I don't know where to store it. I would need to access it easily through the DCEL, but I don't want to duplicate the data between the two half edges. What should I do?

sentences: Is it reasonable to write a game engine in C? Even though C++ appears to be king, from what I've been told C is still widely used in games, especially on the consoles. However, would writing an entire game engine in C be unreasonable today? What are, if any, some advantages that C has over C++? Why would someone possibly want to use C over C++?

sentences:
Negamax Checkers not working properly I'm trying to implement negamax in my checkers game. Sometimes the IA does the appropriate move, sometimes don't. Here is my code:

private int evalPawns(ArrayList<Pawn> pawns, int turn){
    int whiteCount=0;
    int blackCount=0;
    int who2move;
    if(turn == GameData.PLAYER1)
        who2move = -1;
    else
        who2move = 1;
    for(Pawn pawn:pawns){
        if(pawn.getPlayer() == GameData.PLAYER1){
            whiteCount++;
        } else {
            blackCount++;
        }
    }
    return  (whiteCount-blackCount) * who2move;
}

public int negaMax(ArrayList<Pawn> pawns, int depth, int turn){
    ArrayList<Pawn> pawnTemp;
    pawnTemp = copyPawns(pawns);

    Move[] legalMoves = getLegalMoves(turn, pawnTemp);
    int maxScore = Integer.MIN_VALUE;

    if(depth == 0 || legalMoves == null)
        return evalPawns(pawns, turn);

    for(Move move:legalMoves){
        makeMove(move, pawnTemp);
        int score = -negaMax(pawnTemp, depth-1, opponent(turn));
        maxScore = Math.max(maxScore, score);
    }
    return maxScore;
}

public Move findMaxMove(Move[] legalMoves, ArrayList<Pawn> pawns){
    int maxScore = Integer.MIN_VALUE;
    Move bestMove = null;
    for (Move move:legalMoves){

        makeMove(move);

        int newScore = -negaMax(pawns, 5, GameData.PLAYER2);
        if (newScore > maxScore){
            maxScore = newScore;

            bestMove = element;
        }

    }
    return bestMove;
}

Here are 2 moves examples:

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: moving from Glut to SDL2 I'm using Glut with OpenGL for drawing. Glut is very simple and straightforward but I have to give up Glut and move on toward SDL2. I'm reading SDL for Game Development, good book. I need to speed up a bit, so I'm looking for a list of comparisons between Glut and SDL2. At least with common similarities between the two. For example, in Glut we need for drawing Display() to be passed to glutDisplayFunc(). My understanding so far for SDL2 is that SDL_Renderer is like Display() in Glut. Is this correct? Also, what do exactly SDL_Surface and SDL_RenderPresent mean?

sentences:
Parsing "pick up" action in a text-based RPG I’m coding a text-based RPG and I have my controls working: I have a string checking what you write in against an array of if statements.

It can get it right with everything other than my pick up action.

My if statements are set out as follows:

int game_main() {

    string PlayerOption;

    //I have a few lines of cout statements just for my gui/hud

    cin >> PlayerOption;

    if (PlayerOption == "look") {
        //it’s then just calling a script from a separate header file
    }
    else if (PlayerOption == "pick up") {
        //another script from that header
    }

My look command and all my others work but I don’t know how to set it up right.

I've tried putting it like "pick up", I tried it like "pick"" ""up" and a couple other ways but I don’t know how to properly write the expression.

Even then my problem might be with my string and not my if statement so any suggestions would be greatly appreciated.

And I think @DMGregory might be right about the word boundaries because even with that command if I make it accept "pick" it works it’s only when I ask it for two words it really breaks

Is there any way I could get around that?

sentences:
Dealing with multiple scenes /levels Overview

I have a scene manager in my game and in each 'Scene' I have a render() and a update() method for drawing and updating my game's logic.

Basically, when I want to switch to another scene, let's say, when the player progresses to the next level or going from game-over back to the main menu, I just do something like this:

SceneManager.getInstance().setCurrentScene(level2); //Where level 2 is a 'Scene' class.

I have a 'MainGame' scene who's sole purpose is to house all the methods I call from my individual levels.  So I might then do something like this:

Current method

public class Level1 extends MainGame implements Scene {

    private Resources res;
    private MyGLRenderer r;

    Level1(MyGLRenderer r, Resources res){
        super(r, res);
        this.res = res;
        this.r = r;
    }

    @Override
    public void render() {
        draw(background);
        draw(playerSprite);
        draw(blue-enemies);
    }

    @Override
    public void update(){
        super.movePlayer();
        super.moveEnemies();
        super.checkCollision();
    }

}

However, in my game, when the player survives for a certain amount of time, I want to introduce more elements into the game, so I might then have a 'level2' Scene (although strictly, from the player's perspective, the game is perceived to be one big rolling level).....

    public class Level2 extends MainGame implements Scene {

        private Resources res;
        private MyGLRenderer r;

    Level2(MyGLRenderer r, Resources res){

        super(r, res);
        this.res = res;
        this.r = r;
    }

    @Override
    public void render() {
        draw(background);
        draw(playerSprite);
        draw(blue-enemies);
        draw(pink-enemies);  //New!!!! *********************************
    }

    @Override
    public void update(){

        super.movePlayer();
        super.moveEnemies();
        super.checkCollision();
    }

}

So, as you can see, Level2 is exactly the same as Leve1 but now I'm also drawing my 'pink-enemies', I can keep doing this for 'levels' 3 through 10 but I'll end up duplicating and simply adding to each level each time.  Seems like a lot of effort just to introduce 1 or 2 new things every 'level'.

Using conditions within my render / logic?

Is there a cleaner / tidier way of achieving that which I'm trying to achieve?  I could do away with all my individual 'Level' classes altogether and just work straight out my MainGame class's Render() and Update() methods, but then I would have to have something like:

Render(){

    //Render elements common to all levels
    draw(background);
    draw(playerSprite);
    draw(blue-enemies);

    //Render specific level objects

    Switch (Level){

        case 4:{draw(giantAlienSpaceship);}
        case 3:{draw(orange-enemies);}
        case 2:{draw(pinkEnemies);break;}
    }
}

And then a similar switch in my logic.  I'm not sure about this however, as it adds additional switch/conditional statements in my rendering and seems somewhat 'amateur' however, I could be completely wrong and this may be an acceptable method that people do use.

Am I missing any other obvious cleaner / cleverer way to do this (similar to my first method but without the duplicated super method calls)

sentences:
Questions about dynamic loading and unloading of assets and game state I've wondered about this for a while as I worked on my project, but couldn't quite come up with the best way to expose my problem. I'll start with some context.
Context
I have a game that is divided into rooms. So from an asset point of view, it makes sense to load and unload them on a room by room basis. In my case this boils down to all the textures and audio files required by that room.
However, player triggered events can change the state of any dynamic object in the world, even those that are not on the current room. Furthermore, since the game is multiplayer, even if I'm not seeing the changes immediatly, other players might. So, even if the assets aren't loaded, I still need some way to register that change in state.
The way I'm currently handling this is to keep the entire game world state in memory since the start of the game, and only bother about dynamically loading and unloading its assets.
Which leads to the following questions related to resource management.
Questions

Loading and storing the entire game state at once seems reasonable for the scope of my games, but I get the feeling it wouldn't scale very well to larger projects. So how is this usually implemented in massive games such as MMOs that need to update a large amount of entities that are far away from the player?

Assets that are guaranteed to be needed for a particular room (such as the room's scenario and static objects) can be loaded when the player enters the room - possibly with a transition or a loading screen in between. But what about assets for unpredictable game entities that might suddenly come into your current room at any time, such as other players?
Would it be reasonable to treat those separately, load them all at once when the game starts, and keep them in memory the entire time, or would it be better to load them and unloaded dynamically in a separate thread? And in that case, does XNA handle loading assets from another thread well?

sentences:
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: Unity objects not rotating around pivot point Suddenly, for some reason, objects in the unity editor started rotating around their center of gravity (at least that's what I think is going on) instead of their pivot point. I tried placing the object inside an empty object which would serve as the new pivot point, like usual, but this did not change anything. Is this some setting or some updated feature? How can I stop it?

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:
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:
MonoGame HLSL fx using Multiple Textures I'm converting an old XNA title to MonoGame and one of the HLSL fx files uses two textures. But no matter what I do, it only ever uses the screen texture while rendering the effect in MonoGame, or else draws nothing.

I can see in debug mode that I'm trying to pass in the correct textures in C#, plus it works correctly in the XNA version. So why is my shader only using the screen texture in Monogame?

HLSL

Texture2D ScreenTexture;
sampler2D ScreenSampler = sampler_state
{
    Texture = <ScreenTexture>;
};

Texture2D DistortionMap;
sampler2D OffsetSampler = sampler_state
{
    Texture = <DistortionMap>;
    AddressU = Clamp;
    AddressV = Clamp;
};

float4 PixelShaderFunction(float4 pos : SV_POSITION, float4 color1 : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
{
    // Use the DistortionMap to alter the location of the ScreenSampler output.
    // DistortionMap's rg at a position correspond to that position's xy distortion.
    return tex2D(ScreenSampler, texCoord + (tex2D(OffsetSampler, texCoord).rg * 2 - 1));
}

technique Technique1
{
    pass Pass1
    {
        PixelShader = compile ps_4_0_level_9_1 PixelShaderFunction();
    }
}

C#

public static void Draw(SpriteBatch spriteBatch)
{
    // Update the Offsets map texture.
    UpdateVertices();

    // Set up the current render target to draw to the other render target
    Game1.RenderSetToA = !Game1.RenderSetToA;
    ThisGame.GraphicsDevice.SetRenderTarget(Game1.RenderSetToA ? Game1.RenderTargetA : Game1.RenderTargetB);
    RenderTarget2D renderTargetToDraw = Game1.RenderSetToA ? Game1.RenderTargetB : Game1.RenderTargetA;

    // Draw the old render target with the distortion effect to the new render target.
    DistortionEffect.Parameters["ScreenTexture"].SetValue(renderTargetToDraw);
    DistortionEffect.Parameters["DistortionMap"].SetValue(Offsets);
    spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Opaque, null, null, null, DistortionEffect);
    spriteBatch.Draw(renderTargetToDraw, Vector2.Zero, Color.White);
    spriteBatch.End();
}

sentences:
How can I scale player/enemy stats to balance the difficulty just right? I'm creating an old school top-down grid based RPG, where you enter random encounters every few steps.  I want to know what kind of systems or guidelines there are for creating the leveling and stats system for such a game.  Right now I'm just sort of guessing based on intuition and it's clear that that isn't going to work for very long.

For example, let's say I have a max level cap of 50, and 10 dungeons.  The ideal would be that the player should need to gain about 5 levels per dungeon in order to stand a chance in the next dungeon, but that the monsters in the current dungeon can't provide enough XP to skip the next dungeon (within a reasonable amount of time anyway).

The easy route that I can think of would be to just define every enemy as worth 1 XP, and then set the amount of XP required for the next level in increasing increments, so that I only really have to track number of kills (level 1 --> 2 would be 10 XP, or 10 kills, level 2 --> 3 would be 12 XP, or 12 kills, etc.).  But that's boring.  As a player myself, I like to see the numbers related to my actions get larger over time (i.e. at level 1 --> 2 as 10 XP, but level 2 --> 3 as 150 XP, etc.).

And that's not even counting for stats like Strength, Vitality, and so on.  But that in itself is a whole other question: are there any kinds of formulas for stats and their effects on each other?  For example, enemy has 50 armor, and my guy has 30 strength.  That is considerably more armor than strength, so I would expect my hit to be pretty weak...but how can I calculate those statistics to get a final damage number?

Are there any guides or any kind of "standards" for such basic systems?  Even if "every game is different," I still need to learn the absolute BASIC ideas for "most" games.  I have questions such as, "if you have an agility-like stat, what is a common way to determine dodge rate?" and so on.

EDIT: I found this after posting, but I'm gonna include the link here if someone else stumbles across this with similar questions.  Balancing Player vs. Monsters: Level-Up Curves

sentences:
How can I implement beam effects like these? I am interested in the techniques I could use to create the following effects:

Can I accomplish this with a particle system or a series of texture quads, or what?

You can see this effects in action here in this video.

sentences:
How can I increase framerate, when drawing tiles to a HTML canvas? I am using the HTML 5 canvas to make a simple platformer game. I am currently drawing the tiles using a for loop that runs through a list of tiles and checks if they will be drawn to the screen.

for (var i = 0; i < tiles.length; i++) {
    if (tiles[i].x + scale > pos.x - (canvas.width / 2)
            && tiles[i].x < (pos.x + scale) + (canvas.width)) {
        canvas.drawImage(tiles[i].x - pos.x, tiles[i].y - pos.y, scale, scale,
                "img/Tiles/" + tiles[i].Tile + ".png")
    }
}

I am also using this custom library to draw the image to the screen:

this.drawImage = function(x, y, width, height, src, alpha) {
    if (alpha) {
        ctx.globalAlpha = alpha
    }

    if (document.getElementById(src) == undefined) {
        document.head.innerHTML
                += ''
    }

    var img = document.getElementById(src)
    ctx.drawImage(img, x, y, width, height);
    ctx.globalAlpha = 1.0
    document.getElementById(src).outerHTML = ""
}

When I run the for loop, the frame rate of the game seems to drop. Is there an alternate option to going through every element of the array that I'm not aware of?

sentences:
Vertex definitions and shaders I noticed that from looking at other examples like say .. riemers tutorials he takes a buffer with a bunch of vector3's in it and ties it to a shader which expects a float4 ... why does this work in his situation and not mine?

Also is there a simple fix for this situation that will allow me to do this with the shader  determining the w component as to my game logic this means nothing but is obviously crucial to the gpu.

Riemers code is here:

http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series4/Textured_terrain.php

and mine (key parts only) ...

CPU Code:

public struct TexturedVertex: IVertex
{
    public Vector3 Position { get; set; }
    public Vector2 Uv { get; set; }

    public TexturedVertex(Vector3 position, Vector2 uv) : this()
    {
        Position = position;
        Uv = uv;
    }
}

Shader Code:

struct VS_IN
{
    float4 pos : POSITION;
    float2 tex : TEXCOORD;
};

struct PS_IN
{
    float4 pos : SV_POSITION;
    float2 tex : TEXCOORD;
};

Texture2D picture;
SamplerState pictureSampler;

PS_IN VS(float4 inPos : POSITION, float2 uv : TEXCOORD)
{
    PS_IN output = (PS_IN)0;
    output.pos = mul(inPos, mul(World, ViewProjection));
    output.tex = uv;
    return output;
}

How do the two tie together?

I am however using sharpDX not XNA so my code for setting up the buffers is different slightly ...

I created my own mesh class that does this:

VertexBuffer = Buffer.Create(device, BindFlags.VertexBuffer ,Vertices.ToArray());
context.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(VertexBuffer, Utilities.SizeOf<TexturedVertex>(), 0));

sentences:
How to handle multiple events in SDL2 and C++? I'm working on an entity component based game and I ran into this problem.
I've got a component called PlayerControlComponent:

void PlayerControlComponent::HandleInput() {
    SDL_Event event;
    while(SDL_PollEvent(&event) != 0) {
        if(event.key.keysym.sym == SDLK_RIGHT) {
            Entity->MoveRight();
        }
        else if(event.key.keysym.sym == SDLK_RIGHT) {
            Entity->MoveLeft();
        }
        else {
            Entity->Stay();
        }
    }
}

and I've got a GameManager class that handles the input for the window, like if you hit escape it will quit:

void GameManager::HandleInput() {
    SDL_Event event;
    while(SDL_PollEvent(&event) != 0) {
        switch(event.key.keysym.sym) {
        case SDL_QUIT:
        case SDLK_ESCAPE:
            Quit();
        }
    }
}

After I put everything in my main function, it looks like this:

while(GameManager::GetInstance().IsRunning()) {
        //Inputs
        GameManager::GetInstance().HandleInput();
        player->GetComponent<PlayerControlComponent>()->HandleInput();
        //Update, Draw, etc..

My problem is that wich ever I put first gets executed only. So in this example the player won't handle inputs. If change it up and put the player first like so:

while(GameManager::GetInstance().IsRunning()) {
            //Inputs
            player->GetComponent<PlayerControlComponent>()->HandleInput();
            GameManager::GetInstance().HandleInput();
            //Update, Draw, etc..

..my player will move but than the window won't quit if I hit escape. For some reason wich ever input handling function is called first, gets executed. I figured out it has something to do with SDL_PollEvent(). So I created a global SDL_Event variable and changed up the code a bit so there is only 1 SDL_PollEvent() call wich happens in main:

while(GameManager::GetInstance().IsRunning()) {
        //Inputs
        while(SDL_PollEvent(&event) != 0) {
            GameManager::GetInstance().HandleInput();
            player->GetComponent<PlayerControlComponent>()->HandleInput();
        }
        //Update, Drawing, etc..

So as I said, the event variable is now global and both GameManager and Player uses the (only) same event variable.b Now everything works fine, but is that really the only option? (If so, than I don't know why would they allow us to declare multiple SDL_Events.)
So my question is:

Is there a way around this, can I handle multiple input events?

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:
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:
Are there .NET bindings for Autodesk's FBX SDK? I'm writing a tool in C# that needs to open FBX files (and the XNA content pipeline isn't a suitable solution). I note that Autodesk only provides it's FBX SDK as a C++ class library.

Before I write it myself I thought I'd ask if anyone knows of existing .NET bindings for this SDK?

sentences:
Why even use shaders? assuming I want my game to have a Cel-shaded look. There are plenty of tutorials how to implement Cel-shading in hlsl f.e.
But what is the point? If I am creating my assets with Blender or 3d-max I have a lot of possibilities to add materials and shaders in the modeling software.

So why write shaders?

sentences:
The type or namespace name `OpenCVForUnity' could not be found I am working on face traching in unity3D

I have downloaded and imported the sample project on "FaceTracker Sample using OpenCV for Unity".

But when I tried to runned the project,its showing me the error.Below is the screen shot of the error

What will be the issue?can anybody help out please?

I am using unity(5.0.0f4(64 bit))

sentences: Trouble programming JInput for game controller Due to lack of reasonable documentation, I have not been able to program inputs for using a game controller. The most I have ever found was how to detect if a controller is found and what it's name is. Does anyone know of a reliable tutorial on how to program controller buttons to perform any actions?

sentences:
How to create endless scrolling landscape using coco2d's CCParallaxNode I created a horizontally scrolling landscape using CCParallaxNode. However it does not seem to support endless scrolling in one direction. As soon as the first image "ends" the background shines through. Adding an unlimited number of images is of course not an option. I thought about the usual way, namely adding two sprites for each parallax layer next to each other, and simply moving one at the end of the other at the appropriate time.

However, I have two issues:

parallax child nodes can't seem to be
re-positioned
the position of the child nodes vs
how far they have moved seem to be in
no relation to the parallax factor

This is how I set up the parallax node using 4 sprites with identical horizontal width:

CGPoint topOffset = CGPointMake(0, screenSize.height);
CGPoint midOffset = CGPointMake(0, screenSize.height / 2);
CGPoint downOffset = CGPointZero;

// Create a parallax node and add the sprites to it.
CCParallaxNode* paraNode = [CCParallaxNode node];
[paraNode addChild:para1 z:1 parallaxRatio:CGPointMake(0.5f, 0)
positionOffset:topOffset];
[paraNode addChild:para2 z:2 parallaxRatio:CGPointMake(1, 0) positionOffset:topOffset];
[paraNode addChild:para3 z:4 parallaxRatio:CGPointMake(2, 0) positionOffset:midOffset];
[paraNode addChild:para4 z:3 parallaxRatio:CGPointMake(3, 0) positionOffset:downOffset];
[self addChild:paraNode z:0 tag:ParallaxSceneTagParallaxNode];

Did anyone succeed in using CCParallaxNode for seamlessly endless scrolling?

sentences:
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:
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:
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:
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:
Submit scores for multiple players to Game Center from one iPhone I have a quiz game, which i would like to integrate Game Center for. This is a "local" multiplayer game with the possibility to play six players per match.

Is it possible to submit scores to the Game Center leaderboard for all six players in this setup given that it is only one player, the one that owns the device, that is logged on to Game Center?

If so, how is that done?

sentences:
How can tell if a player has performed some action in UDK? For simplicity, let's say that I want bots to kill me when I enter a room without greeting them. So in this case I would need to store, somewhere, the variable didGreet, which should be changed when I send the message "Hello." Then, when any pawn sees me, he will check the didGreet variable and if this was false he would start firing at me.

I've heard that this should be done using the GameInfo class, but unfortunately I don't know how to create, access and change variables there. How can I accomplish this?

sentences:
FBO result not drawing to screen I recently added framebuffer rendering to my game and rendering to the FBO works (verified with glGetTexImage), but when I go to render a quad to show the result nothing is drawn to the screen. I'm using OpenGL 3.3 Core, so I'm drawing using vertex buffers for the quad and I have two simple pass-through shaders to display the quad. I apologize for the amount of code that follows, but I felt it was all necessary for anyone who ends up looking at this.

Quad generation:

// create vertices
// Vertex(position, normal, tex coord)
quadVertices.Add( Vertex( Vector3( -1.0f,  1.0f, 0.0f ), Vector3(), Vector2( 0.0f, 1.0f ) ) );
quadVertices.Add( Vertex( Vector3( -1.0f, -1.0f, 0.0f ), Vector3(), Vector2( 0.0f, 0.0f ) ) );
quadVertices.Add( Vertex( Vector3(  1.0f, -1.0f, 0.0f ), Vector3(), Vector2( 1.0f, 0.0f ) ) );
quadVertices.Add( Vertex( Vector3(  1.0f,  1.0f, 0.0f ), Vector3(), Vector2( 1.0f, 1.0f ) ) );
quadVertices.SendData(); // gl*Buffer* methods wrapper

// create indices (quadIndices is a buffer of 16-bit integers)
quadIndices.Add( 0 );
quadIndices.Add( 1 );
quadIndices.Add( 2 );
quadIndices.Add( 0 );
quadIndices.Add( 2 );
quadIndices.Add( 3 );
quadIndices.SendData();

Quad rendering:

glDisable( GL_DEPTH_TEST );
glDisable( GL_CULL_FACE );

// bind the texture
glActiveTexture( GL_TEXTURE0 );
glBindTexture( GL_TEXTURE_2D, framebuffer.GetColorHandle() );
_shader.Seti( "texture0", 0 );

 // projection matrix is glm::ortho( -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f );
_shader.Set( "proj", _projection );

// get attributes
int vertex   = _shader.GetAttribLoc( "vertex" );
int texCoord = _shader.GetAttribLoc( "texCoordV" );

// bind buffers
quadVertices.Bind();
quadIndices.Bind();

// enable arrays and point to data
glEnableVertexAttribArray( vertex );
glVertexAttribPointer    ( vertex,   3, GL_FLOAT, GL_FALSE, sizeof( Vertex ), (void*)( 0 ) );
glEnableVertexAttribArray( texCoord );
glVertexAttribPointer    ( texCoord, 2, GL_FLOAT, GL_FALSE, sizeof( Vertex ), (void*)( sizeof( Vector3 ) * 2 ) );

// draw!
glDrawElements( GL_TRIANGLES, quadIndices.Size(), GL_UNSIGNED_SHORT, 0 );

// disable arrays
glDisableVertexAttribArray( vertex   );
glDisableVertexAttribArray( texCoord );

// unbind everything
quadVertices.Unbind();
quadIndices.Unbind();
glBindTexture( GL_TEXTURE_2D, 0 );

glEnable( GL_CULL_FACE );
glEnable( GL_DEPTH_TEST );

Vertex shader:

#version 330 core

in  vec3 vertex;
in  vec2 texCoordV;
out vec2 texCoordF;

uniform mat4 proj;

void main()
{
    texCoordF = texCoordV;
    gl_Position = proj * vec4( vertex, 1.0 );
}

Fragment shader:

#version 330 core

layout(location=0) out vec4 fragColor;

in vec2 texCoordF;

uniform sampler2D texture0;

void main()
{
    fragColor = texture( texture0, texCoordF );
}

sentences:
How do Axis-Aligned Bounding Boxes update with rotations? I have a bounding box class with a min (x,y,z) and max point (x,y,z). The object that is being rotated has a rotation matrix (3x3 matrix), but I don't know how to update the bounding box with rotations.

I'm also a little confused if I should be using Oriented Bounding Boxes instead. For example, if the 3D object is a cube then the bounding box would rotate with it so they share the same 8 vertices at whatever rotation the cube is in.

What's the best way to represent the bounding box for rotations and test for collisions?

sentences:
Most effective approach when creating % chance of something When dealing with % chance in a game what are the most effective ways to achieve this? When I use random.random()[python] or Math.random()[javascript] and use an if/elif/else conditional it seems like the things with a very low chance of happening, happened far more often than they should have.

For example, a python game I worked on used something like this:

qaul_eq = random.random()
if qual_eq <= .5:
   quality = common
elif qual_eq <= .75:
   quality = uncommon
elif qual_eq <=.9:
   quality = rare
elif qual_eq <=.97:
   quality = epic
else:
   quality = legendary

Javascript DEMO

There is a 2% chance that quality will be legendary yet when printed 20 times every time it is run at least 1 item in almost every test run is legendary. In my python game it isn't uncommon for 2 or 3 of the items to be legendary. I'd chalk it up to good luck if not for the large amount of test runs I have conducted.

sentences:
When should a bullet texture be loaded in XNA? I'm making a SpaceWar!-esque game using XNA. I want to limit my ships to 5 active bullets at any time. I have a Bullet DrawableGameComponent and a Ship DrawableGameComponent. My Ship has an array of 5 Bullet.

What is the best way to manage the Bullet textures? Specifically, when should I be calling LoadTexture? Right now, my solution is to populate the Bullet array in the Ship's constructor, with LoadTexture being called in the Bullet constructor. The Bullet objects will be disabled/not visible except when they are active. Does the texture really need to be loaded once for each individual instance of the bullet object? This seems like a very processor-intensive operation.

Note: This is a small-scale project, so I'm OK with not implementing a huge texture-management framework since there won't be more than half a dozen or so in the entire game. I'd still like to hear about scalable solutions for future applications, though.

sentences:
Physics.CheckSphere never returning true despite being called to where a hitbox is I'm trying to create a random level generator where I have a load of rooms 16x10 and I generate them when the player enters the room. I want to check the space where I want to place a room, in this case up for if there's already a room there. I've written this code to do that but it doesn't appear to be working. Currently it should ALWAYS return true (and not run the code) because the object it is on has a hitbox. I want it to hit triggers because then I don't need a physical block in the centre of every room (hard when the rooms are even both ways)

Can you see what's wrong here? The code does spawn a block in the correct place.

if (!Physics.CheckSphere(new Vector2(transform.position.x, transform.position.y), 1f, 6, QueryTriggerInteraction.Collide))
        {
            //Get list of open bottoms
            getList("Assets/Room Lists/bottom.txt");
            //Make a random number from the list
            int newRoomIndex = random.Next(0, prefabObjects.Count);
            //Get that object
            GameObject newRoom = prefabObjects[newRoomIndex];
            //Place it in the world in the correct position
            Instantiate(newRoom, new Vector3(transform.position.x - 8, transform.position.y + 15, transform.position.z), Quaternion.identity);
        }

sentences:
LibGDX: Shape from ShapeRenderer won't show up when put in another class I am currently trying to make a little snake clone as my second project with LibGDX. I want to draw the borders of the screen with a ShapeRenderer. The Shape gets displayed flawlessly when I create/draw it in the render method of my game. I wanted to outsource the code into an own "Border"-Class, to get a single object for collision and graphics, but if I do this, the shape does
not get displayed anymore.

Working code before outsourcing to a Border-Class:

public void render(float dt){

...
borderRenderer = new ShapeRenderer();
    borderRenderer.begin(ShapeRenderer.ShapeType.Filled);
    borderRenderer.setProjectionMatrix(gameCam.combined);
    borderRenderer.setColor(1.0f, 0.3f, 0.3f, 1);
    borderRenderer.rect(x , y , width, height);
    borderRenderer.end();
}

ShapeRenderer outsourced, gets not displayed anymore:

public void render(float dt){
...
for (Border border : borders) {
            border.draw();
        }
}

public class Border {
    private ShapeRenderer borderRenderer;
    private OrthographicCamera gameCam;
    private float x, y, width, height;

    public Border(float x, float y, float width, float height, OrthographicCamera gameCam){
        this.gameCam = gameCam;
        this.borderRenderer = new ShapeRenderer();
    }

    public void draw(){
        borderRenderer.begin(ShapeRenderer.ShapeType.Filled);
        borderRenderer.setProjectionMatrix(gameCam.combined);
        borderRenderer.setColor(1.0f, 0.3f, 0.3f, 1);
        borderRenderer.rect(x , y , width, height);
        borderRenderer.end();

    }

}

The border also gets properly initialized in the constructor.

As I was writing this I recognized that using assets for this would probably be a better idea, but I'm still curious.
Thanks in advance for your help !

sentences:
How to draw a line based on an angle with a defined size? I have a game where the player shoots a projectile based on the mouse direction when clicking, which travels 500 pixels.

I wish I could draw a line exactly where the projectile will be destroyed.

What I can do is draw a line from where the projectile is created to where the mouse is when it is clicked.

That is, the line may be longer or shorter than the path taken by the projectile.

The code is something like this:

draw_line(x,y,mouse_x,mouse_y);

Result in game:

Below an image explaining:

These blue dots would be the click of the mouse. That no matter where it went, the line drawn (green) would be the same (ending in pink x).

I know how to get the direction and how to calculate the distance, but I don't know how to implement it in line drawing.

sentences:
How can I draw a shadow under my character? I created a 2D tile-based jump and run game for Windows Phone and I want to draw a shadow under the character. How can I do that? The shadow must also be drawn on the tiles if the character jumps. The character and the tiles are rectangles.

How can I draw a shadow under my character?

The shadow should look similar to the shadows in this picture:

UPDATE:
I tried to solve the problem like described in Gamefreak0's answer, but it's not working.
I created a ShadowChecker object and I check in a foreach-loop if it collides with a platform. If it collides, the variable ShadowPosition gets changed.
But it's not working correctly. I made a picture, and in this picture you see that the shadow isn't on a platform. Why is the shadow not getting drawn on the pink platform?

The character(black rectangle) is above the pink platform, so the shadow should be on the pink platform.

I update the shadow's position with this code:

 protected override void Update(GameTime gameTime)
    {
        Rectangle CollisionRect = new Rectangle(-1000, -1000, 0, 0);
        ShadowChecker = CharacterRect;

        //FloorRect is the brown rectangle at the bottom. There is no other platform under the FloorRect.
        while ((CollisionRect.Height == 0) && (ShadowChecker.Bottom <= (FloorRect.Y + FloorRect.Height / 2)))
        {
            ShadowChecker.Y += 1;
            foreach (Rectangle r in PlatformRectangles)
            {
                if (ShadowChecker.Intersects(r))
                {
                    CollisionRect = r;
                    break;
                }
            }
        }
        if (CollisionRect.Height != 0)
        {
            // Draw the shadow on this position
            ShadowPosition = new Vector2(CharacterRect.X, CollisionRect.Y - CollisionRect.Height / 2);
        }

        base.Update(gameTime);
    }

sentences:
LibGDX: Box2d hovering, rotating body Hello I am working on a hovering triangle (equilateral triangle). The triangle should allways rotate at a constant speed and hover over the ground. The problem is if I setAngularVelocity it does rise and fall to the ground (repeatingly).

I have been following this tutorial for the hovering.
I rely have bad knowlege about RayCast and box2D (basics).

private float targetHeight = 7;
private float springConst = 100;
private float distanceAboveGround;
private HoverTest callback;
private Vector2 start = new Vector2(),
                end = new Vector2(),
                vec = new Vector2(0, -targetHeight);

private void physics(float delta) {

    float frameTime = Math.min(delta, 0.25f);
    accumulator += frameTime;
    while (accumulator >= Const.TIME_STEP) {
        playerBody.setAngularVelocity(1);

        start = playerBody.getPosition();
        end = playerBody.getWorldPoint(vec);
        world.rayCast(callback, start, end);

        if (callback.isHit()) {
            distanceAboveGround = start.sub(callback.getPoint()).len();
        }

        if (distanceAboveGround < targetHeight) {
            distanceAboveGround += 0.25f * playerBody.getLinearVelocity().y;

            float distanceAwayFromTargetHeight = targetHeight - distanceAboveGround;
            playerBody.applyForceToCenter(0, springConst*distanceAwayFromTargetHeight, true);
            playerBody.applyForceToCenter(0, playerBody.getMass() * -world.getGravity().y, true);
        }

        world.step(Const.TIME_STEP, 8, 3);
        accumulator -= Const.TIME_STEP;
    }
}

EDIT: I found that if i flip the triangle on a other side it falls and then does nothing. I think that has to dowith the end vector (is no longer pointing down).
How could I get it allways point down?

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:
How to move a car model on a plane? I want to create a 3 dimensional car game. But i have a problem in moving a car in other directions and accelerating.

I have a car model and a road model placed appropriately. To move car forward, I translate the road model to negative X-axis so my car looks like it moving forward in my case as my car and road track is along the positive X-axis. Now, in the middle I want to turn left or right and for that I rotate the road model, (let's 90 degree). When I do that the car should move away from the road in sideways direction (or, we can say road to be moved), but it does not. As road was being translated to negative x-axis, after rotating the road I thought to be translated along negative x-axis relative the camera but I think the X-axis of the road object is fixed. So what should I do to solve it?

I just want to move a car which can go forward and when it turns left or right it should move forward accordingly.

P.S. I know, my question may not be clear but that's all I could elaborate it. Anyone can notify me if it's not clear and I will try again to clarify my question again.

sentences:
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:
Fitting 3D points representing bones to a BVH animation file I am developing a motion capture animation system and I want my data to be stored within a BVH file. At the moment I have measured the size of the actor so I can create the hierarchy of the BVH file. I also have points in 3D representing the relative positions and orientations of the middle of certain bones such as the lower leg, foot e.t.c.

I was wondering what the best approach would be to map the bones into the BVH motion frames. I have to take into account slight inaccuracies in the 3D positions, for instance the foot might be plotted in 3D space 1cm off the actual location in the realworld.

Furthermore I was wondering how to recover lost 3D points. For instance if I have the left foot and left thigh, is it possible to recover the estimated position of the left shin?

Any help would be greatly appreciated.

Thanks

sentences:
Animation workflow between Blender and Mecanim I've recently started learning Unity. Not being able to add custom animations to the standard FBXs you get from Unity's app store is really really slowing me down. When I import one into Blender, it brings none of the animations with it. I also purchased 3D Studio Max and, while a little better, it's still a steep learning curve.

Can I create an animation in Blender or 3D Studio Max and apply it to an existing Mecanim model?

Do I need to manually create and rig a basic model, import it, then move its animation to another character, or is there an easier way?

sentences:
New Input System Differs Between Editor and Runtime? I'm sure the problem is me.
Here is a simple look script (from a tutorial, actually).
I'm getting inconsistent results between editor and runtime. I'm guessing its a framerate thing.
Code:
using UnityEngine;
using Mirror;
using Cinemachine;

public class PlayerCameraController : NetworkBehaviour
{
    [Header("Camera")]
    [SerializeField] private Vector2 maxFollowOffset = new Vector2(-1f, 6f);
    [SerializeField] private Vector2 cameraVelocity = new Vector2(4f, 0.25f);

    [SerializeField] private Transform playerTransform = null;
    [SerializeField] private CinemachineVirtualCamera virtualCamera = null;

    private Controls controls;
    private Controls Controls {
        get {
            if (controls != null) { return controls; }
            return controls = new Controls();
        }
    }
    private CinemachineTransposer transposer;

    public override void OnStartAuthority()
    {
        transposer = virtualCamera.GetCinemachineComponent<CinemachineTransposer>();
        virtualCamera.gameObject.SetActive(true);

        Controls.Player.Look.performed += ctx => Look(ctx.ReadValue<Vector2>());

        enabled = true;
    }

    [ClientCallback]
    private void OnEnable() => Controls.Enable();

    [ClientCallback]
    private void OnDisable() => Controls.Disable();

    private void Look(Vector2 lookAxis) {
        float deltaTime = Time.deltaTime;

        float followOffset = Mathf.Clamp(
            transposer.m_FollowOffset.y - (lookAxis.y * cameraVelocity.y * deltaTime),
            maxFollowOffset.x,
            maxFollowOffset.y);

        transposer.m_FollowOffset.y = followOffset;
        playerTransform.Rotate(0f, lookAxis.x * cameraVelocity.x * deltaTime, 0f);
    }
}

The code seems right. Watching the values of Vector2 lookAxis reveals that the numbers are slightly different coming into the function based on environment.
Is there something wrong with this code that would give different results between editor and runtime?

sentences:
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:
Unity - Quaternion.AngleAxis for two axes I am creating a character controller where the camera follows the rotation of the player, and allows the user to click and drag to rotate the camera around the player, and lerps back when its released. The part I am struggling with is being able to rotate the camera on both the x and y axes using the Quaternion.AngleAxis method. It gives me the functionality I want on the one axis, but I want to be able to move freely around x and y. I am able to do this when I am not clicking and dragging because I am just lerping the camera to the offset position.

My code is below:

if (Input.GetMouseButton(0))
    {
        Vector2 mouseInput = new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y"));

        // This only handles rotation around x axis
        currentOffset = Quaternion.AngleAxis (cameraSpeed * mouseInput.x, Vector3.up) * currentOffset;

        Vector3 newPosition = target.position + currentOffset;

        // This is where I am just temporarily setting the y position to look down at the character.
        newPosition.y = target.position.y + 2.0f;

        transform.position = newPosition;
        transform.LookAt(target);
    }
    else
    {
        Vector3 targetPosition = target.position - target.forward * cameraDistance;
        Vector3 newPosition = transform.position;
        newPosition.x = Mathf.Lerp(newPosition.x, targetPosition.x, 3.0f * Time.deltaTime);
        newPosition.z = Mathf.Lerp(newPosition.z, targetPosition.z, 3.0f * Time.deltaTime);
        transform.position = newPosition;
        transform.LookAt(target);
        currentOffset = transform.position - target.position;
    }

As you can see I am just temporarily setting the position to 2 units above the target position so the camera slightly looks down at the player. What I would like to do is be able to move both axes to get full observational control around my player. I am not sure if AngleAxis is the right method to be using, but its given me the closest results so far.

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:
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:
Getting Started with Component Architecture: DI? TLDR:  if I have entities like Ship and Bullet and components like Positionable and Drawable, should I create interfaces for each component and inject them into my entities using DI, or should I be doing something else?

(In this case, Ship would extend IPositionable and have an instance of a PositionableComponent which is injected by DI. Any calls to ship.getX or ship.setX would be implemented as myPositionable.getX or myPositionable.setX.)

I just moved away from MVC towards something more component-architecture-like. I have no concept of messages yet (it's rough prototype code), objects just get internal properties and values of other classes for now.

That issue aside, it seems like this is turning into an aspect-oriented-programming challenge. I've noticed that all entities with, for example, a position component will have similar properties (get/set X/Y/Z, rotation, velocity).

Is it a common practice, and/or good idea, to push these behind an interface and use dependency injection to inject a generic class (eg. PositionComponent) which already has all the boiler-plate code?

(I'm sure the answer will affect the model I use for message/passing)

Edit: The DI model I'm proposing is as follows.

Create entity classes like Ship and Bullet
Create interfaces to represent these components. Eg. I can expect a PositionableComponent.getX method.
Create component classes like PositionableComponent, DrawableComponent which implement my interface
Entities like Ship will have components like PositionableComponent. They will implement the methods by internally keeping an instance of a positionalbleComponent and redirecting all interface calls to the component.
My DI framework will (presumably automatically) wire up components by interface, eg. Ship._positionableComponent = new PositionableComponent(). This is how NInject works, which is the only framework I've ever used (and I'm working in Haxe now).

This will allow me to work on a higher level (ships contain components), and reduce boilerplate code (component implementations), but introduces duplicate code (redirecting to the internal component). Since I'm working in Haxe, I may be able to avoid writing that boilerplate by hand.

However, the advantage is that I can override component behaviours. If undeadMonster.IsAlive() should return true when its HP is above -100 (instead of 0), I can easily code this, and the change becomes very visible from the code level.

But I'm not sure if I'm solving this correctly.

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

sentences:
Character getting slow when reached to speific path point I have manually placed some cube on the floor and aim to walk my character on those cube as they are appearing in the hirarchey and here is the walk code.

 if (Vector3.Distance(pathPositions[pathIndex], walkingCharacter.transform.position) > 0.5f)
        {
            Vector3 newPosition = pathPositions[pathIndex] - walkingCharacter.transform.position;
            walkingCharacter.transform.position += newPosition * Time.deltaTime * walkingSpeed;
            walkingCharacter.transform.rotation = Quaternion.LookRotation(newPosition);
        }
        else {
            pathIndex++;
        }

I have walk in place animation which is working fine and the above code moving my character to specific points but not smoothly. As my character approach to specific path point it get slow then suddenly move towards next point. What i am doing wrong. Here is the video of the problem maybe it will helpful to understand the problem.

sentences:
timing rendering to monitor screen update I have an application with a very light rendering loop, taking a predictable and small time to execute. Right now, I have two solutions. The first solution uses Vsync: after a screen update, my application renders one frame immediately and then waits for the next screen update. This adds approximately one frame of latency. The second solution simply renders continuously, consuming the whole CPU and relying on OpenGL-style triple buffering to catch the correct frame.

Is there a way for me to acquire the monitor screen update timepoints, preferably through some kind of callback? My current workflow is GLFW with OpenGL, but other solutions are welcome too. I wish to produce a hybrid solution: after a screen update, it should wait for nearly an entire frame, render one frame, and then the screen update will catch this just-rendered frame. GLFW's glfwSwapInterval is almost what I want, but it works in the opposite way, by swapping the buffer right after the screen update instead of before.

With the screen update timepoints, I will be able to implement what I want, by measuring confidence intervals around my rendering loop's execution time and waiting for the correct duration.

sentences:
Network client-server message exchange and clock synchronization help i'm doing a fast paced physics game that is a  table hockey. With two mallets and one puck. The game runs on iphone / ipad and i'm doing the multiplayer part through GameCenter.

This is how the network system works. The client wich stars the match, will be settled as the server and the one that accepts the match request is the client.

The 'server' has the physics running and the response is immediate and the client also has their physics running so it looks smooth between messages exchange. What i do as the server, is that i send to the client my puck velocity and my position and the client adjusts his puck velocity/position related to the server to keep it sync. Otherwise the physics desynchronizes and it screws it up.

When the network latency is good, bellow 100ms the results are pretty good, i got a smooth playable game on the client side and the weird behavior are minimum. The problem happens when the lag is around 150 to 200ms. In that case, happens that my client puck already hitted a edge and inverted direction but it receives a delay message from the server and it backs a bit causing a weird feeling to the ball behavior.

I've readed a few things about it:

Pong Network Example

Click Synchronization Example

Wikipedia on Clock Sync

So, how can i solve this? As far as i've read the best option that i have is to do a clock synchronization on the server/client with a timestamp so that when i get delay messages related to my clock, i just ignore then and let the clients simulation do the job. Do you guys agree with that? And since im sending data unreliable (UDP) i may get delayed messages or messages out of order.

If that is the best approach, how do i implement the clock synchronization. I've read the steps on how to but i didn't quite understand it.

It says that:

Client stamps current local time on a "time request" packet and sends to server.
Upon receipt by server, server stamps server-time and returns
Upon receipt by client, client subtracts current time from sent time and divides by two to compute latency. It subtracts current time from server time to determine client-server time delta and adds in the half-latency to get the correct clock delta. (So far this algothim is very similar to SNTP)
The client repeats steps 1 through 3 five or more times, pausing a few seconds each time. Other traffic may be allowed in the interim, but should be minimized for best results The results of the packet receipts are accumulated and sorted in lowest-latency to highest-latency order. The median latency is determined by picking the mid-point sample from this ordered list.
All samples above approximately 1 standard-deviation from the median are discarded and the remaining samples are averaged using an arithmetic mean.

Following this example i would have this:

Lets pretend the game has loaded and my client time is 0 now, so i send to the server that my time is 0.

The messages takes 150ms to get to the server but the server's clock had already started and is 1 second ahead of the client. When the server get the message the time will be:
1.15 and sends that time to client, are we good?
Lets pretend our lag is constant at 150ms.

Now the client receives the time 1.15 and subtracts current time from sent time and divides by two to compute latency. Wich is: 0.3 - 0 = 0.3/2 -> 150ms.

It subtracts current time from server time to determine client-server time delta and adds in the half-latency to get the correct clock delta:
Client time: 0.3 Server time 1.15
0.3 - 1.15 = .85 + latency(.15) = 1

How is that synchronized? What am i missing?

It's my first time on multiplayer and network experience, so i'm a bit confused.

Thank you.

sentences:
Is there a significant importance in what axis I chose in my top down 2.5D game? I have read several posts stating what seems like a "standard" in how to chose your 2d axises in a 3d engine. It is often Y up on screen and X right on screen. However, in these examples I often see that it's a scene set up like a platformer, where the player sees the world from the side.

I'm developing a top down 2.5D (locking depth axis but keeping perspective on camera) game and I have it setup so that Z is up on the screen and X is right on the screen. To me it makes sense as Y is height in the world and thus would approach the camera. I will make use of the 3d world at certain times and I feel that it would be confusing to not have the standard axises then...

Is there something I'm not thinking about here?

sentences:
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:
Good map file structure? I need a map file structure for my game but does anyone know a good way to map it out? I was thinking something like this:

name=MyMap
add[floor[stone]][solid][20, 640]
add[playerspawn][20, 620]

sentences:
How to fit a bitmap to a random size rect so it does not strech? (Android Studio) I'm trying to fit a bitmap to a random size rect but I don't want the bitmap to be streched out. I've tried using BitmapShader and tile it but it become animated and not fixed.

Here is my code without BitmapShader.

 public void draw(Canvas canvas) {
      Paint paint = new Paint();
      canvas.drawBitmap(spike1, null, rectangle, paint);
      canvas.drawBitmap(spike1, null, rectangle2, paint);
 }

Here is my code with BitmapShader.

 public void draw(Canvas canvas) {
    Paint paint = new Paint();
    paint.setShader(new BitmapShader(spike1, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT));
    canvas.drawRect(rectangle, paint);
    canvas.drawRect(rectangle2, paint);
}

Here is a picture of my problems

Can somebody tell what I need to do so the image is fix but not stretched?

sentences:
How can I make an soundsystem with Slick? My question would be, how can I develop an easy-to-use sound system under slick-util?
Under the function

a.playAsSoundEffect(1, 1, true, x, y, z);

it already works to create a static position for the source. But if I adjust my CameraPosition in-game. So how can I change the position of the listener in Slick?

Answers would be awesome :)
Thanks,
Mineorbit!

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:
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: What is an efficient packing algorithm for packing rectangles into a polygon? I need to put as many rectangle of same size as possible inside a polygon. The algorithm can put rectangles in different orientation(angle). But they cannot overlap. This is image is an example of the end result:

sentences:
Why isn't my player moving? Why is my code not working?

using UnityEngine;
using System.Collections;

public class NewBehaviourScript1 : MonoBehaviour
{
    public float moveSpeed;
    public Vector3 input;
    public Rigidbody rb;

    void Start ()
    {
        rb = GetComponent<Rigidbody>();
    }

    void FixedUpdate ()
    {
        moveSpeed = 2;
        input = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
        rb.AddForce(input * moveSpeed);
    }
}

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:
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:
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:
How to test if procedurally generated level for infinite runner can be passed? I have a 2D infinite runner platformer game built in Unity 5, where the level procedurally generates itself. I need to check if it is possible to pass the holes on the level.

How could I do that?

sentences:
3D Modeling Software for Programmer I've recently learned how to make games for Unity3d, and now I want to start making games! I can't wait to start!

However, before I can make 3D games, I need to learn 3D modeling for character design, level design, and some animation.

What is the easiest 3D modeling software, compatible with Unity3d?   I do not want to spend too much time learning the software.  From what I've heard, Blender is a bit complicated to use. Maya and 3dsMax seem very powerful.

Could someone point me in the right direction?  I don't want to spend a lot of time learning.  I know its not that easy, but you guys have experience, you guys probably know out of all which one is easier and powerful.  Could you recommend a software?

Many Thanks!

sentences:
Quest and NPC System Design I am developing a quest system for a game and am looking for the most abstract way to go about connecting the system to the NPC conversation system. This isn't much of a question about the code to do it, but more looking for input on designs for it.

Structuring of the quest system and NPC conversation system has already been completed. What I'm trying to figure out is with my current NPC system, what is the best way to integrate the conversations and quests for the NPC.

Assume that, given my conversation system, the Conversation object holds a tree of all conversation nodes that the user will go through. I assume that each NPC will be given a Conversation object to go through in some way (whether this is directly or through a quest object is what I'm trying to decide). Some NPCs may have a standard conversation they have with a user and other NPCs might have a quest which contains conversations within it that the NPC should step through dependent on their current step in the quest. But then some NPCs might have a standard conversation and a quest or even an NPC with multiple quests and a standard conversation.

What I'm trying to figure out is what is the best way to "connect" these systems so that is abstract, dynamic, and clean. Any suggestions to help me think it out would be great.

sentences:
Quaternion LookAt for camera I am using the following code to rotate entities to look at points.

glm::vec3 forwardVector = glm::normalize(point - position);
float dot = glm::dot(glm::vec3(0.0f, 0.0f, 1.0f), forwardVector);

float rotationAngle = (float)acos(dot);
glm::vec3 rotationAxis = glm::normalize(glm::cross(glm::vec3(0.0f, 0.0f, 1.0f), forwardVector));
rotation = glm::normalize(glm::quat(rotationAxis * rotationAngle));

This works fine for my usual entities. However, when I use this on my Camera entity, I get a black screen. If I flip the subtraction in the first line, so that I take the forward vector to be the direction from the point to my camera's position, then my camera works but naturally my entities rotate to look in the opposite direction of the point.

I compute the transformation matrix for the camera and then take the inverse to be the View Matrix, which I pass to my OpenGL shaders:

glm::mat4 viewMatrix = glm::inverse(
    cameraTransform->GetTransformationMatrix()
);

The orthographic projection matrix is created using glm::ortho.

What's going wrong?

sentences:
How do I make camera move at same speed when rotating and moving forward I made a camera in DX9. To move forward I press the Up arrow. To rotate on the Y axis I use the mouse. When I perform these movements on their own the camera moves at the speed I want.

However, if I hold down Up and move the mouse at the same time then the camera moves a lot faster than it should. I want it to move at the same speed as it does when only the Up arrow is pressed.

I think I need to normalize something somewhere but not sure what and not sure where. Have tried various combinations without success so if anyone can point me in the right direction that would be great. Thanks.

I've post code below.

#define KEY_DOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)

LRESULT WINAPI MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
    if( KEY_DOWN(VK_UP))    MovePlayer(D3DXVECTOR3(0, 0, -1.0f));
    if( KEY_DOWN(VK_DOWN))  MovePlayer(D3DXVECTOR3(0, 0, 1.0f));

    switch( msg )
    {
        case WM_MOUSEMOVE:
        ProcessMouseInput();
    }
}

void  MovePlayer( D3DXVECTOR3 in_vec )
{
    D3DXMATRIX CameraRot;
    D3DXMatrixRotationY(&CameraRot,D3DXToRadian(AngleY));
    D3DXVECTOR3 CameraRotTarget;
    D3DXVec3TransformNormal(&CameraRotTarget,&in_vec,&CameraRot);
    CameraPos +=  (m_timeElapsed * CameraRotTarget);
}

void ProcessMouseInput()
{
    GetCursorPos( &CurrentMouseState );

    if ((CurrentMouseState.x != GameMouseState.x) || (CurrentMouseState.y != GameMouseState.y))
    {
        int dx = CurrentMouseState.x - GameMouseState.x;
        int dy = CurrentMouseState.y - GameMouseState.y;
        AngleY+=m_timeElapsed*dx*7.0f;
    }
    GameMouseState = CurrentMouseState;
    // Set back to window center in Render function
}

VOID UpdateCamera()
{
    D3DXVECTOR3 CameraOrigTarget(0, 0, -1);
    D3DXVECTOR3 CameraOrigUp(0, 1, 0);

    D3DXMATRIX CameraRot;
    D3DXMATRIX CameraRotX;
    D3DXMatrixRotationX(&CameraRotX,D3DXToRadian(AngleX));
    D3DXMATRIX CameraRotY;
    D3DXMatrixRotationY(&CameraRotY,D3DXToRadian(AngleY));
    CameraRot = CameraRotX * CameraRotY;
    D3DXVECTOR3 CameraRotTarget;
    D3DXVec3TransformNormal(&CameraRotTarget,&CameraOrigTarget,&CameraRot);

    D3DXVECTOR3 CameraTarget;
    CameraTarget = CameraPos + CameraRotTarget;

    D3DXVECTOR3 vUpVec( 0.0f, 1.0f, 0.0f );
    D3DXMatrixLookAtLH( &matView, &CameraPos, &CameraTarget, &vUpVec );
    g_pd3dDevice->SetTransform( D3DTS_VIEW, &matView );

    D3DXMatrixPerspectiveFovLH( &matProj, D3DX_PI / 4, 1.0f, 1.0f, 100.0f );
    g_pd3dDevice->SetTransform( D3DTS_PROJECTION, &matProj );
}

sentences:
For a custom game engines, what should I do if my core data is malformed or missing? I'm writing a custom engine for a game. I started this game well before I understood why I should use middleware, instead, and it's too far along to rewrite.

The vast majority of my data comes from external files, and I don't just refer to assets; I define all of my game objects through .JSON.  But, alas, I am human; occasionally my data files are invalid, or I change the format but forget to update the file, or the loader itself is flat-out buggy.

If, for whatever reason, an attempt to load some form of asset in a custom engine fails, what options do I have?

This is not a duplicate of How should I handle missing resources?, as that question is about user-facing assets like models or textures.  Bad textures can be replaced with a checkerboard, bad sounds with silence, and bad text with "ERROR".  My problem lies with data that's critical to the game even running, such as levels, game object definitions, and GUI layouts.

sentences:
(Java) Trying to animate an arraylist of coins with a (working) animation class I have a coin class which takes in an integer numOfCoinsand an enum LayoutType, which can be linear or curved. A linear layout displays the coins in a straight line one after the other - we'll work with this since the method is small and straight forward.

My constructor looks like this:

public Coin(float xPos, float yPos, int numOfCoins, LayoutType layout) {
        setType(ObjectType.COIN);
        coinList = new ArrayList<Coin>(); // arraylist of coins
        setPos(xPos, yPos); // set starting position of coin(s)
        if (layout == LayoutType.LINEAR)) {
            linearLayout(); // display coins in a straight line
        } else if (layout == LayoutType.CURVE{
            curveLayout();
        }

}

And my linearLayout() method looks like this

public void linearLayout() {
        //draw numOfCoins amount of coins in a straight line
        for (int i = 0; i < numOfCoins; i++) {
            Coin coin = new Coin(xPos, yPos);
            coinList.add(coin);
            xPos += 50; // place coins 50 pixels apart
        }
}

I have a working animation class and a spritesheet for the coins - however, the way I have modelled my coins is in such a way that 1 coin object can contain numOfCoins amount of coins, so I can't just directly call the animation in the draw method.

The class' draw() method is in an abstract class GameObject which Coin extends. It looks like this:

public void draw(SpriteBatch batch) {
    // if the object is a coin iterate through the list of coins
    // and draw the sprites, if it isn't a coin, simply draw the objects sprite
    if (type == ObjectType.COIN) {
        for (Coin coin : getCoinList()) {
            coin.getCoinList().draw(batch);
        }
    } else {
        sprite.draw(batch);
    }
}

This draw() method is called in World.render().

How would I create an animation using my Animatorclass for each coin if I have 6 coins in a straight line for instance? I can't seem to find a way. Highly grateful for any help, thanks.

sentences:
How to properly handle attacks in an 2D Platformer? I am building an 2D Engine in JavaScript and if my actor attacks an enemy, a hitbox appears for a certain amount of time and then disappears. If the target keeps standing inside of the hitbox he gets drained down for each frame. So for example if the hitbox does 3 points damage and the target only has 9 HP he will be dead after 3 frames. That's too fast.

I've come up with two solutions, both of them are not ideal:

Set the enemy as unattackable for a certain amount of time after each hit.
Save an reference to the enemy that gets deleted after the hitbox disappears.

My explanation is pretty bad but posting my code would be worse since it's way too much.

sentences:
Which approach is better: Frequent small updates, or occasional large ones? I recently released the first publicly available free Alpha for my top-down shooter: Dread

I'm trying to decide whether a weekly / bi-weekly small update release schedule is better than the more traditional monthly (or longer) large updates.

The more frequent schedule would mean that players would have a new build to play more often, but the new builds would likely only have a few bug-fixes / feature additions at a time. Would players grow tired of the constant updating, or would they feel more attachment as they are more involved in the development process?

I'm thinking that, due to the somewhat experimental nature of my game, it might be a good thing for people to have the opportunity to suggest tweaks to the new features during their infant stages. But I don't want my desire for feedback to bias my decision.

What are your thoughts / experiences on the matter?

sentences:
Is there a way to duplicate the windows desktop zooming in SDL to make low res pixels look like stylyzed cartoon art? When you hit the Win key and numpad plus key at the same time it opens the desktop magnifying glass and the effect of this on low res pixel art is to make it look like super cool stylized cartoon art. I want the game to look like this all the time. Is there a way to do this permanent i SDL or DirectX or OpenGL?

How I have achieved this image is to run the game in a small windows and have the windows 10 magnifying glass hoover over it and I hit print screen. And I want the game to look like this all the time in full screen.

Ps. This is the Gradius 3 ship that I use for place holder graphics for question asking purposes.

sentences:
Statemachine to behaviour tree? Background
I was able to convert simple statemachines like this...

Into a BT looking like this (Notation describtion)...
root
  sequence  #After another
    playAnimation name:idle
    sequence
      walks? # Breaks current sequence if false
      playAnimation name:walk
    sequence
      runs?
      playAnimation name:run

Goal
But how do we convert more complex multi-layered animation states into a behaviour tree ? How would such a BT look like ? The difficult parts here are transistions between the different states, something i couldnt solve in an BT.

Question
Is it possible to convert every statemachine into a behaviour tree ?
What does the theory says and how does it look like in practice ?

sentences:
Unity3d: Get a direction vector parallel to plane I need to send a raycast from my camera which is parallel to the plane (Ground) and in the same direction of its forward vector (Represented by the black color vector)

I cant use world space direction because the global forward vector of the camera points at the same direction no matter how much I rotate it (Since its a VR camera)

I tried to use Vector3.ProjectOnPlane, but not sure how it works.

Can someone help me?

sentences: 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:
How can I add up the Transform/GameObjects in the Array of Waypoints in Unity? I come up with this code and I try to get the waypoint + 1 when I reach the waypoint and it adds up till the last waypoint. I get Array is out of Index error. I guess I need and foreach loop of waypoints ?

Code:

public float speed;
public float turnSpeed;

public Transform[] waypoints;
private int currentWp = 0;

void FixedUpdate ()
{

    if(waypoints.Length >= currentWp)
    {
        return;
    }

    player.position = Vector3.MoveTowards(player.position, waypoints[currentWp].transform.position, speed * Time.deltaTime);

    var rotation = Quaternion.LookRotation(waypoints[currentWp].transform.position - player.position);
    player.rotation = Quaternion.Slerp (player.rotation, rotation, turnSpeed * Time.deltaTime);

    float distance = Vector3.Distance(player.position, waypoints[currentWp].position);

    if(distance <= 10)
    {
        currentWp++;
    }
}

sentences: 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: Keyboard input vs character movement encapsulation In our game created with c++ and sdl we are having difficulty delegating how the main character should be controlled.  We have a keyboard class and a sprite class for the main character, but are unsure if the main character should have an instance of the keyboard class or if keyboard input should be done through the game loop.  If you need anymore information I would be happy to provide it, thanks in advance for any help.

sentences: How to use the testbed with box2dflash? I have made games with box2dflash, but how much ever i have wanted to try out the test bed, the resources on the net don't help me. I have a folder called Testbed and various Test???.as files inside it. It would be a great help if somebody could just jot down how the testing of a box2dflash game is done. Thank you

sentences:
How to implement turn-based game engine? Let's imagine game like Heroes of Might and Magic, or Master of Orion, or your turn-based game of choice. What is the game logic behind making next turn? Are there any materials or books to read about the topic? To be specific, let's imagine game loop:

void eventsHandler(); //something that responds to input
void gameLogic(); //something that decides whats going to be output on the screen
void render(); //this function outputs stuff on screen

All those are getting called say 60 times a second. But how turn-based enters here? I might imagine that in gameLogic() there is a function like endTurn() that happens when a player clicks that button, but how do I handle it all? Need insights.

sentences: How can I make a global scoring system in C++? How do I make it so that in a multiple-level game the score will stay where it was from the previous level?

sentences:
Benefit of storing chunks as Octree leafs vs single block as Octree leaf I saw many voxel game developers opt for a strategy that involves using an octree whose leaf nodes include a 16x16x16 (or 32^3 or 64^3) chunk instead of having leafs represent a single voxel.
What is the reason for this? I also don't understand how this will coincide with LOD, if the leaf is a 32x32x32 chunk, how does the tree manage LOD levels inside the chunk?
If it doesn't, then wouldn't you lose a lot of detail when considering this chunk as 1 voxel? I can't wrap my head around the benefits of doing this :)
I implemented my own version of Octree (Single voxel leaf) with face culling between nodes and I can get the following result (512 ^ 3 voxels):

This takes about 50 MB of RAM (60 FPS) and when transitioning to 1024 ^ 3 it jumps up to 190 MB of RAM (60 FPS).
I am trying now to optimize memory that's why I wanted to start experimenting with LOD but the more I researched the more I found mentions of chunks as leafs.

sentences:
What are the differant techniques to deal with different world and story states, in metroidvanias? I am trying to figure out what is the best way to handle persistent changes in game world. Metroidvania games keep track of the player actions within a level, for example "this boss has been defeated", "this power up has been taken", "this button has been pushed", etc. In "Cave Story", some completed actions will change the state of the main village, and some NPCs will have dialog specific to what the player has done, before.

I can think of two different ways to handle this functionality:

Having a copy of the same map, for each state; this sounds resource heavy, and inefficient.
Using some kind of "chapter" definition that allows me to load/initialise each object of the map in regards to the current chapter. For example, multiple versions of the same NPC would exist, on the map, at various locations, with a chapter attribute. The map can start to get messy, and it can be hard to test.

In regards to the second option, different behaviors and the object loading code would look like this:

if (object.currentChapter == currentChapter) {
    object.load()
}

I am using Tiled, and as proposed, it can then be possible to load the object layer corresponding to the current game state or chapter:

loadMap(map, chapter) {
    ...
    createObjects(map, objectLayerName)
}

As an example, in object_chapter_1, the wizard is outside of a laboratory. In object_chapter_2, the wizard is inside of the laboratory, preparing some magic potions.

I can't really figure out what is the best solution, and what techniques can be used to deal with this problem. What are the differant techniques to deal with different world and story states, in metroidvanias?

sentences:
Compressing language for Game use to save Packets Given ASCII is 8 bits (1 byte), UNICODE is 32 bits (4 bytes).

An idea came to my mind to support multiple language by isolating certain UNICODE Letters to support multiple language for my chat(game) program.

It will be composed of [4 bit (Language trigger)] + [8 bits (255 possible characters) x 16]

Example:

trig|message per character, each 8 bit is character depending on trigger, language changes
0001|00000000|00000000|00000000|00000000|00000000....

Trigger for characters: (example purpose only)

0001 Normal Latin
0010 European Latin
0011 Historic Latin
0100 Japanese
0101 Chinese
etc...

The characters at UNICODE not present at my list will make a special character... I'm thinking a Box (which will be present at the 0001 character list).

My in-built character table will supply the character depending on the trigger. Of course the User can only use one set of trigger and not mixed character using different triggers.

I also want to use this character for my Account Server Creation and Queries. Note that other character format do not support multi-language characters.

Result Comparison: Instead of sending 512 bits (32 bit x 16). I am actual sending 132 bits (4 bit + (8x16)) only.

Is this feasible and currently in use or am I doomed to use UNICODE? I am open for better ideas than the ones above.

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:
Awesomium custom surface scroll I have a custom Awesomium::Surface implementation, and I need to create a Scroll function for it. The function asks me to manually move some pixels of my texture by the indicated X and Y offset.

How can I move/access pixels inside a SDL_Texture since SDL_LockTexture() provide write-only pixels?

sentences:
Accessing C++ class members with LuaPlus I've implemented LuaPlus in my engine eventmanager successfully and really like the flexibility I gained. But I'm still not exactly where I want to be, because I can't link my c++ classes to a Lua class.

For example, I have a Actor class in C++, and I want to be able to create the same class in Lua and gain access to members with LuaPlus, but I can't figure how I can achieve that.

Is this actually LuaPlus built-in functionality, or do I have to write my own interface that exchanges data tables between C++ and Lua?

My current approach would be to fire an event in Lua that creates an new actor class in C++ code, and transfer its ID and the data I need to back to Lua. When I modify the data I send the modifications back to C++ code again, but I actually thought there's something in LuaPlus that exposes this functionality already.

sentences:
How can I load multiple scenes in background? I want to queue the loading of multiple scenes in background and show all of them at the same time when all complete their loading.
The only idea I have by reading the docs is to root all objects in every scene I want to load this way in a single GameObject that is disabled by default and when all my LoadSceneAsync finishes its work, I can them activate each scene root GameObject.
Without doing that, I have all related scenes being loaded and being showed in the screen at different times and this is just not acceptable.
I'm creating this question because I believe there must be a better way to accomplish that rather than rooting all the scene into a single game object.

sentences:
GPGPU physics & game logic I'm wondering about gpu accelarated physics after reading about Erwin Coumans presentation on GPU accelerated physics: http://www.gdcvault.com/play/1018185/GPU-Rigid-Body-Rigid-Body
(demo video here: http://www.youtube.com/watch?v=ZkF4yMmP0R8)

While it certainly looks like a massive performance boost, I don't have any expirience with gpgpu programming, so I'm wondering how practical this is for games. You'd have to manage communication between the different parts of the game engine. I know there are facilities to have opencl & opengl share memory, that covers the rendering part.. but what about the other parts of a typical game engine? Let's say we have a fixed timestep physics simulation (lets say 60hz) and corresponding game logic (which also runs at 60hz) that needs to act on certain events triggered by the physics engine. Game logic is not necesarily suited for execution on the gpu, it may for example be very branching intensive. This would mean a readback from the gpu to the cpu, wouldn't this create too much latency to have our game logic proceed at 60hz?

sentences:
Top down four directional movement snap to tiles, not feel like crap I want to make a topdown rpg movement, I need to update these parameters based on user input:
User input four directions: ⬆⬇⬅➡ .
Update parameters

Position: x, y,
Flip sprite: flipx, flipy,
Sprite number: s, eg: 1 for horizontal sprite, 17 for vertical sprite
Sprite Animation: si, eg: 1 to 4 for walking animation

This is my crappy implementation:
function _init()

p = {
   t=0,
   x=0,
   y=0,
   dx=0,
   dy=0,
   mtimer=0,
   s=1,
   si=0,
   flipx=false,
   flipy=false
}
end

function _update()

   local input_x = 0
   local input_y = 0

   if btnp(⬆) then
      input_y = -1
   elseif btnp(⬇) then
      input_y = 1
   end

   if btnp(⬅) then
      input_x = -1
   elseif btnp(➡) then
      input_x = 1
   end

   if p.dx == 0 and p.dy == 0 then
      if input_x != 0 then
         p.dx = input_x
         p.mtimer=4
      elseif input_y != 0 then
         p.dy = input_y
         p.mtimer=4
      end
   end

   if p.mtimer > 0 then
      p.mtimer -= 1
      p.t += 2
      p.x += p.dx * 2
      p.y += p.dy * 2
      if p.mtimer == 0 then
         p.dx = 0
         p.dy = 0
      end
   end
 p.t += 0.5

   if p.dx != 0 then
      p.s = 1
   elseif p.dy != 0 then
      p.s = 17
   end

   p.flipx = p.dx == 0 and p.flipx or p.dx < 0
   p.flipy = p.dy == 0 and p.flipy or p.dy < 0

   p.si = flr(p.t % 30 / 30 * 4)

end

function _draw()
   spr(p.s + p.si, p.x, p.y, 1,1, p.flipx, p.flipy)
end

This is the end result:

As you can see it's so bad looking, I want you to implement this movement so it's fun and juicy. Or what can I do to improve the looks and feel of this.

sentences:
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: In a team of 2 people (one front end, one scripting), is there any way I could write scripts without the use of Unity all together? So, I'm curious whether or not it would be possible to write scripts for a Unity game without using Unity itself, but using a third-party IDE, such as Visual Studio. My reason for this would be the following: I have a very low-end laptop, so I can not run Unity in any usable fashion. So I'm wondering if I could do the programming only part for the game without using Unity? By this, I mean writing the actual code and sending it over some online platform to be integrated with the Unity environment. And I know, this would not be productive at all.

sentences:
Separating logic and data in browser game I've been thinking this over for days and I'm still not sure what to do. I'm trying to refactor a combat system in PHP (...sorry.) Here's what exists so far:

There are two (so far) types of entities that can participate in combat. Let's just call them players and NPCs. Their data is already written pretty well.
When involved in combat, these entities are wrapped with another object in the DB called a Combatant, which gives them information about the particular fight. They can be involved in multiple combats at once.
I'm trying to write the logic engine for combat by having combatants injected into it.
I want to be able to mock everything for testing.

In order to separate logic and data, I want to have two interfaces / base classes, one being ICombatantData and the other ICombatantLogic. The two implementers of data will be one for the real objects stored in the database, and the other for my mock objects.

I'm now running into uncertainties with designing the logic side of things. I can have one implementer for each of players and NPCs, but then I have an issue. A combatant needs to be able to return the entity that it wraps. Should this getter method be part of logic or data? I feel strongly that it should be in data, because the logic part is used for executing combat, and won't be available if someone is just looking up information about an upcoming fight. But the data classes only separate mock from DB, not player from NPC. If I try having two child classes of the DB data implementer, one for each entity type, then how do I architect that while keeping my mocks in the loop? Do I need some third interface like IEntityProvider that I inject into the data classes?

Also with some of the ideas I've been considering, I feel like I'll have to put checks in place to make sure you don't mismatch things, like making the logic for an NPC accidentally wrap the data for a player. Does that make any sense? Is that a situation that would even be possible if the architecture is correct, or would the right design prohibit that completely so I don't need to check for it?

If someone could help me just layout a class diagram or something for this it would help me a lot. Thanks.

edit

Also useful to note, the mock data class doesn't really need the Entity, since I'll just be specifying all the parameters like combat stats directly instead. So maybe that will affect the correct design.

sentences:
How to Calculate Velocity in a 2D space game I am currently using

screenpos.X = (float)(screenpos.X + velocity * Math.Sin(r));
screenpos.Y = (float)(screenpos.Y - velocity * Math.Cos(r));

For my Movement with r being the Rotation in Radians. However, I want to know how I can calculate my velocity realistically based on values of Thrust and Mass.

Any Idea's?

sentences:
How to generate a "loop room" in a platformer game (by Unity)? I want to build a level with a room whose left edge is linked to right edge in a 2D platformer game in Unity.

My goal is let all objects disappear in one side will appear in other side of the room.
Just like this:

Both sides should have collision with other objects.

Right now I'm doing this by cloning objects on the other side, but it is too complicated. Is there any other good way to solve this?

sentences:
Jump a gameobject when a key is pressed I am working on a platform game,When I press the space bar  the object should jump and  when I release the space bar it should come down.

The code I have used for jump is

void Update () {
    transform.Translate(Vector3.right*Time.deltaTime);
    if(Input.GetKey(KeyCode.Space))
    {
        rigidbody2D.AddForce(Vector3.up*3);
    }

    if(Input.GetKeyUp(KeyCode.Space))
       {
        rigidbody2D.AddForce(Vector3.down);
    }

}

But when I release the space bar the object is not coming down

sentences:
Correcting Lighting in Stencil Reflections I'm just playing around with OpenGL seeing how different methods of making shadows and reflections work.

I've been following this tutorial which describes using GLUT_STENCIL's and MASK's to create a reasonable interpretation of a reflection.

Following that and a bit of tweaking to get things to work, I've come up with the code below.

Unfortunately, the lighting isn't correct when the reflection is created.

glPushMatrix();
plane();                                                //draw plane that reflection appears on

    glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
    glDepthMask(GL_FALSE);
    glEnable(GL_STENCIL_TEST);
    glStencilFunc(GL_ALWAYS, 1, 0xFFFFFFFF);
    glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);

plane();                                                //draw plane that acts as clipping area for reflection

    glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
    glDepthMask(GL_TRUE);
    glStencilFunc(GL_EQUAL, 1, 0xFFFFFFFF);
    glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);

    glDisable(GL_DEPTH_TEST);
    glPushMatrix();
    glScalef(1.0f, -1.0f, 1.0f);
    glTranslatef(0,2,0);
    glRotatef(180,0,1,0);

sphere(radius, spherePos);                              //draw object that you want to have a reflection

    glPopMatrix();
    glEnable(GL_DEPTH_TEST);
    glDisable(GL_STENCIL_TEST);

sphere(radius, spherePos);                              //draw object that creates reflection
glPopMatrix();

It looked really cool to start with, then I noticed that the light in the reflection isn't correct.

I'm not sure that it's even a simple fix because effectively the reflection is also a sphere but I thought I'd ask here none-the-less.

I've tried various rotations (seen above the first time the sphere is drawn) but it doesn't seem to work. I figure it needs to rotate around the Y and Z axis but that's not correct.

Have I implemented the rotation wrong or is there a way to correct the lighting?

sentences:
Need Help With My Script And Animator. I am encountering a few bugs with it Okay so I have created a player archer character which when he using the arrow keys, faces those directions and upon hitting space when in that direction, the bow attack animation is played.

The code works fine but there are some nerve-wrecking problems:

when I unpress an arrow key, the character always returns to his default direction and when I press space when no arrow key is pressed, the right bow attack animation is played and also when i press the up arrow key and the space bar, the up bow attack animation does not play and instead again,the right bow attack animation is played.

I have looked at everything again and again but I can't seem to find anything wrong. The animation's assigned are okay and the code is okay too. Don't know what's wrong. I have been stuck at this problem all day.

I have attached some screenshots so you can see how I have achieved this:

my animator here

my blend tree in the idle state is here
and so far, this is my script:

public class PlayerDirectionAndShooting : MonoBehaviour
{
     Rigidbody2D rbody;
     Animator anim;

     void Start ()
     {
         rbody = GetComponent<Rigidbody2D>();
         anim = GetComponent<Animator>();
     }

     void Update ()
     {
         Vector2 direction_vector = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));
         anim.SetFloat("input_x", direction_vector.x);
         anim.SetFloat("input_y", direction_vector.y);

         if (Input.GetKeyDown("space"))
         {
            if (anim.GetFloat("input_x") <= -1)
            {
                anim.SetBool("is_shooting_left", true);
            }
         }
        else
        {
            anim.SetBool("is_shooting_left", false);
        }

        if (Input.GetKeyDown("space"))
        {
            if (anim.GetFloat("input_y") <= -1)
            {
                anim.SetBool("is_shooting_down", true);
            }
        }
        else
        {
          anim.SetBool("is_shooting_down", false);
        }

        if (Input.GetKeyDown("space"))
        {
            if (anim.GetFloat("input_y") <= 1)
            {
               anim.SetBool("is_shooting_up", true);
            }
        }
        else
        {
            anim.SetBool("is_shooting_up", false);
        }

        if (Input.GetKeyDown("space"))
        {
            if (anim.GetFloat("input_x") <= 1)
            {
                anim.SetBool("is_shooting_right", true);
            }
        }
        else
        {
            anim.SetBool("is_shooting_right",false);
        }
    }
}

sentences:
Android Swipe In Unity 3D World with AR I am working on an AR application using Unity3D and the Vuforia SDK for Android. The way the application works is a when the designated image(a frame marker in our case) is recognized by the camera, a 3D island is rendered at that spot. Currently I am able to detect when/which objects are touched on the model by raycasting. I also am able to successfully detect a swipe using this code:

if (Input.touchCount > 0)
{
         Touch touch = Input.touches[0];

         switch (touch.phase)
         {
                case TouchPhase.Began:

                    couldBeSwipe = true;

                    startPos = touch.position;

                    startTime = Time.time;

                break;

                case TouchPhase.Moved:

                    if (Mathf.Abs(touch.position.y - startPos.y) > comfortZoneY)
                    {

                        couldBeSwipe = false;

                    }
                    //track points here for raycast if it is swipe
                break;

                case TouchPhase.Stationary:

                    couldBeSwipe = false;

                break;

                case TouchPhase.Ended:

                    float swipeTime = Time.time - startTime;

                    float swipeDist = (touch.position - startPos).magnitude;

                    if (couldBeSwipe && (swipeTime < maxSwipeTime) && (swipeDist > minSwipeDist))
                    {

                        // It's a swiiiiiiiiiiiipe!

                        float swipeDirection = Mathf.Sign(touch.position.y - startPos.y);

                        // Do something here in reaction to the swipe.
                        swipeCounter.IncrementCounter();
                    }

                break;

            }

         touchInfo.SetTouchInfo
          (Time.time-startTime,(touch.position-startPos).magnitude,Mathf.Abs (touch.position.y-startPos.y));
       }

Thanks to andeeeee for the logic. But I want to have some interaction in the 3D world based on the swipe on the screen. I.E. If the user swipes over unoccluded enemies, they die. My first thought was to track all the points in the moved TouchPhase, and then if it is a swipe raycast into all those points and kill any enemy that is hit. Is there a better way to do this? What is the best approach?

Thanks for the help!

sentences:
Getting any type in Unity Inspector I am developing a SaveManager system for my games. Basicly what it should do is;

1) Gets the "ANY" user created Serializable class by Drag&Drop to inspector. (save data).

2) Writes that class to a file using either BinaryFormatter or XMLSerializer.

I want to be able to use it in my future games. So it should be save data class(type) independant (like serializers). I will use it like an asset, import the SaveManager, give serialized class as parameter, and let it do the rest. But as i said, it should be able to use any user created serialized class.

So the problem is, since that "serialized class" will be written by the user in the "game project" (not in the SaveManager project), and i don't have that "serialized" class type in my SaveManager project, i don't know how to make the SaveManager, reference the class from inspector.

So lets say i create this class in the game project (not in the SaveManager project)

[System.Serializable]
public class SaveData
{
    public string Name = "Name";
    public int Number = 5;
}

Now when i import the SaveManager project (asset) into my "game" project, i should be able to drag and drop the script to the SaveManager inspector and let it do the rest. Since BinaryFormatter works for every Serializable type, the name of the type is actually doesn't matter. I mean BinaryFormatter is type free as long as the type is serializable. I want to use that feature, and make the SaveManager type free too.

So in future if i want to use, say "MyNewSaveData" serialized class, "in an another game", i want to be able to drag and drop this to SaveManager inspector and let it do the rest.

Now the thing is, if i use

public object _SaveData;

in SaveManager script, unity inspector doesn't show it.

if i use

public Object _SaveData

it casts the user created type to an Object, and i lose the type i need.

I tried to use System.Type, but unity doesn't show it too.

Basicly what i want to do is, get "any" serialized class as reference. Like

public SerializedClass _SaveData;

or something like

public Script _SaveData;

That reference should accept "any" serialized class. Gets it's type, then casts it to that type.

When i use

public Object _SaveData

if i use _SaveData.GetType(), i get the type the "user created".
I have the type, in my hands, but i can't cast Object to that type. I don't know how to use that type for casting.

What ever i do, it either doesn't show up in inspector, or it casted to another type and i lose the data.

What should i do?

sentences:
Keeping track of onscreen objects in opengl es on Android In a small game Im working on I was able to implement ray picking with an opensource 3d engine called min3d but I cant figure how to keep track of what object is onscreen. I will some times have upwards of 120 objects to render within my scene and the raypicking is off occasionally. What id like to do is keep track of how many screen objects are within the camera and being rendered onscreen and set a boolean value based on that to add or remove objects from my arraylist I iterate through when the screen touch is registered and the ray picking method goes off.

So how can I check for which objects are onscreen and offscreen in opengl es on android.

sentences:
Custom extensible file format for 2d tiled maps I have implemented much of my game logic right now, but still create my maps with nasty for-loops on-the-fly to be able to work with something. Now I wanted to move on and to do some research on how to (un)serialize this data. (I do not search for a map editor - I am speaking of the map file itself)

For now I am looking for suggestions and resources, how to implement a custom file format for my maps which should provide the following functionality (based on MoSCoW method):

Must have

Extensibility and backward compatibility
Handling of different layers
Metadata on whether a tile is solid or can be passed through
Special serialization of entities/triggers with associated properties/metadata

Could have

Some kind of inclusion of the tileset to prevent having scattered files/tilesets

I am developing with C++ (using SDL) and targetting only Windows. Any useful help, tips, suggestions, ... would be appreciated!

Result of the discussion below

I have been designing my map file format the last few hours and came up with a skeleton (contains only layers for now - I'll leave the rest to everyone designing his/her own format) which I wanted to share with everyone interested - if you have the same intentions you can get some kind of inspiration. The full-size screenshot can be downloaded at Imgur.

sentences: 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:
Why does simply trying to add sound break literally everything So I have a script for an object that when shot explodes and it worked literally perfectly until I tried to add sound at which point it not only didn't play the sound but also stopped exploding, which was pretty rude of it.

Here's my code since I have no idea what's wrong:
(Unity C#)

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

public class ShootyTarget : MonoBehaviour
{
    public float health;

    public GameObject destructionPrefab;

    public GameObject explosion;
    public GameObject shockwave;
    public GameObject debris;

    public AudioSource splodeSound;

    void Start()
    {
        splodeSound = gameObject.GetComponent<AudioSource>();
    }

    void FuckingDie()
    {
        splodeSound.Play();

        Instantiate(explosion, transform.position, transform.rotation);
        Destroy(gameObject);
        Instantiate(shockwave, transform.position, Quaternion.Euler(new Vector3(90, 0, 0)));
        Instantiate(destructionPrefab, transform.position, transform.rotation);
        Instantiate(debris, transform.position, transform.rotation);
    }

    public void takedamage(float amount)
    {
        health -= amount;
        if (health <= 0f)
        {
            FuckingDie();
        }
    }
}
```

sentences:
How do i create bounding boxes with XNA 4.0? I am having some trouble making bounding boxes for my models I am using within XNA 4.0. The way it was done in XNA 3.1 seems to be obsolete as you can no longer access parameters that were used before in XNA 3.1. Has anyone got any decent links I have been looking around the net for a while now and all I am finding is things for XNA 3.1 or below.

Help much apprechiated.
Regards
Mark

EDIT:

Hey, the problem i am having is getting the min and max points for my model i load through the content pipeline. as articles i have seen on how to do it tell you to do such things as VertexPositionNormalTexture[] vertices= new VertexPositionNormalTexture[mesh.VertexBuffer.SizeInBytes / mesh.MeshParts[0].VertexStride; but i can no longer call size in bytes and vertex strides within XNA 4.0

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:
How to make an object which position is not on the world origin rotate around the world orgin in threejs? I've loaded an object and set its position on vector(5,2,-5) by threejs. And I wanted it to rotate around the origin point in the world coodinate system. I found a method in class Object3D called 'rotateOnWorldAxis', so I had a try on it but it didn't work, it still rotate on it own space. I want to know why it didn't work and how to make this right.

The code is like this:

var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
var renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
//resize event
window.addEventListener("resize",function(){
  var width = window.innerWidth;
  var height = window.innerHeight;
  renderer.setSize(width,height);
  camera.aspect = width / height;
  camera.updateProjectionMatrix();
});

camera.position.set(0,0,15);

var ambientLight = new THREE.AmbientLight(0xffffff,0.8);
scene.add(ambientLight);

var mesh;
var fgxloader = new THREE.FBXLoader().
load("asset/source/1520514930250.FBX",function(object){
  object.position.set(5,2,-5);
  scene.add(object);
  mesh = object;
},function(xhr){
  console.log("object "+(xhr.loaded/xhr.total*100)+"% loaded");
},function(error){
  alert(error);
});

var rotateSpeed = 0.1;
var update = function(){
  if(mesh===undefined)
    return;
  mesh.rotateOnWorldAxis(new THREE.Vector3(0,0,0),rotateSpeed);
  //mesh.rotateOnAxis(new THREE.Vector3(0,1,0),rotateSpeed);
  //mesh.rotateY(rotateSpeed);
  //mesh.rotation.y += rotateSpeed
};

var render = function(){
  renderer.render(scene,camera);
};

var GameLoop = function(){
  requestAnimationFrame(GameLoop);
  update();
  render();
};

GameLoop();

sentences:
How to slow down this rotation My goal here is simple. I am making a top down shooter kind of game, and I want the player to simply rotate in one axis, towards where the mouse is on the screen. I got it working, but it rotates so fast that everything is out of control. The following method is called in Update() on my player's game object

void RotatePlayer()
{

    var targetPosition = new Vector3(Input.mousePosition.x, Input.mousePosition.y, 100);

    targetPosition = Camera.main.ScreenToWorldPoint(targetPosition);

    targetPosition.y = transform.position.y * Time.deltaTime;

    transform.LookAt(targetPosition);

}

That rotates in the direction of the mouse, but like I said it rotates so fast that you cannot control it.

As you can see I tried to multiply by delta time, but that did not seem to do anything. Also, changing that last parameter of "100" to a lower number also does not do anything.

Any help is greatly appreciated.

sentences:
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:
Rotate an object to face a point with glm::lookAt I want to rotate an object to face a point, such as the monster look at the player.

For that I've decided to use the glm::lookAt function. However the following does not yield good results:

const glm::mat4 transformation = glm::lookAt(ghostPosition, cameraPosition, glm::vec3(0, 1, 0));
ghost.transformation = transformation;

The ghost is correctly oriented to the player but is located to the world origin.
However the following works correctly (position and orientation):

const glm::mat4 transformation = glm::inverse(glm::lookAt(ghostPosition, cameraPosition, glm::vec3(0, 1, 0)))

But I don't get why I need to inverse the matrix ?

sentences:
Base class undefined? I have no idea why I'm getting this error except that it has to do with the includes.

Base class header file:

#pragma once

#include "Player.h"
#include "TestObject.h"
#include <glm\glm.hpp>
#include <GL\glew.h>

class GameObject
{
//unrelated code
};

Derived class header file:

#pragma once

#include "GameObject.h"
#include <glm\glm.hpp>
#include <glm\gtc\matrix_transform.hpp>
#include <glm\gtc\type_ptr.hpp>

class Player : public GameObject
{
//unrelated code
};

error message:

Error   C2504   'GameObject': base class undefined

And here are the includes for both cpp files:

base:

#include "GameObject.h"
#include "Player.h"
#include <iostream>
#include <glm\glm.hpp>

derived:

#include "Player.h"
#include "GameObject.h"
#include <iostream>
#include <glm\glm.hpp>

sentences:
SDL 1.2 reports wrong screen size I have a multi-monitor setup with two displays, both 1920x1200. In games, I can only select resolutions > 1920x1200 (like 2560x1200) which makes games unusable.

Full screen doesn't work either because it switches one display to 800x600 which means I can't reach the close button... I have to kill the game and then, I have to restore my desktop because all windows are moved/resized.

How can I force SDL to use any resolution that I want?

sentences:
How can I test if my rage game's hardest levels are achievable? I love rage games and have made a rage game too, but I always wondered how to test if levels in these types of games are too hard or not, since it's ironically too hard to test.

For example: If I were making a game similar to Super Hexagon or Super Meat Boy, do I need to take all the time and effort to go through and beat the whole game? Or are there some easier, but valid workarounds?

I had this problem in a game I made a few years ago. It has 4 difficulties: easy, normal, hard and insane. Before release I'd only completed easy mode and post-release I completed normal, but I'm not sure if hard and insane are achievable.

Here's the game in case you want to see it:

https://gamejolt.com/games/30-seconds-to-survive/30107

sentences: In Unity, how do I set up a delay before an action? I want an object to rotate after a delay. I tried using StartCoroutine, yield and WaitForSeconds, but failed. How can I do it?

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

sentences: Fixed camera rotate to follow character I have  a camera in a fixed position in the middle of a field, and I would like to rotate the camera to follow the character as it moves around. There is no point lower than the camera, but I would like it to follow vertically as well. Given the point/euler angle of the camera, and the point of the character, what math could I use to implement this?

sentences: Unity DirectoryInfo not working in OSX standalone build So I'm building an application in unity which I hope to use at a market day coming up soon at my school (it's not a game, it's basically like a checkout app, kind of...) Anyway, I'd like to be able to import images from the app and to have the option to change them while the app is running. Currently I have the images in a folder and I'm using DirectoryInfo to get the contents of that folder and load the images. Works like a dream inside the editor but as soon as I build the app (on OSX), everything is blank. Other people seem to have similar issues but I'm a little unsure as to how they fixed it. Could someone please help me, this is kind of urgent!

sentences:
Supercover line algorithm from corners instead of the square's center? I need to check whether a cell in a 2D grid is visible to the starting cell. I'm currently using amit's supercover line algorithm, this one https://www.redblobgames.com/grids/line-drawing.html#supercover
The algorithm works but I need  the cells that are intersected by the top-left corner-to-corner line instead of the center-to-center.
This shows what I mean:

The green square is the start point and red is the end point
The white dots represents the cells that are visited by the line drawing algorithm I'm using
I want to get the cells that are intersected by the blue line. It's drew from the top-left corner of the start cell to the top-left corner of the end cell.

This is my implementation of the amit's algorithm in gdscript
func _line_of_sight(p0, p1):
    var dx = p1.x - p0.x
    var dy = p1.y - p0.y

    var sx = 1 if dx > 0 else -1
    var sy = 1 if dy > 0 else -1

    var p = Vector2(p0.x, p0.y)
    _points.append(p)

    var x = 0
    var y = 0
    var nx = abs(dx)
    var ny = abs(dy)

    var result = true
    var blocked_cells = _tilemap.get_used_cells()

    while x < nx or y < ny:
        var px = (1+2*x) * ny
        var py = (1+2*y) * nx

        if px == py:
            p.x += sx
            p.y += sy
            x += 1
            y += 1

        elif px < py:
            p.x += sx
            x += 1
        else:
            p.y += sy
            y += 1

        if blocked_cells.has(p):
            result = false

        _points.append(p)

    return result

I've also tried Bresenham's line algorithm and the Bresenham supercover modification, this and this, as well as this, but none did the trick
Any insight would be appreciated - thanks in advance!

sentences:
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:
Time critical events based on framerate Problem Description

Basically, I've made a "programming game" in which I've made my own scripting language. It is a completely standard Lunar Lander game, though instead of directly controlling the lander using keyboard input, it instead fires a sequence of commands you have provided through the scripting language I made. This all works, and I've hit a critical problem.

So essentially, using the scripting language, you specify something like After 5 seconds, activate thrust for 10 seconds, and then after 2 seconds, rotate the lander for 4 seconds. The goal is then to chain together a sequence of commands which will get you to land the lander safely.

Of course, this comes with one problem. If you repeat the sequence of commands, each command will have to be fired at exactly the same spot in the level, that is, after x amount of seconds, but also with the lander being in the exact same spot. If you did not use timer-based movement, sure you could indicate that a command should activate after 5 seconds, but the lander moving at 60 FPS would have moved way further than a lander moving at 30 FPS.

Why of course, I thought I would simple just make the lander use timer-based movement so it is independent of FPS (I am using the very standard approach of taking the amount of time passed last frame, and multiplying it to a constant move speed). Then I would count seconds using the system clock. So the after x amount of seconds, the lander would be in the same spot in the level when the command activates.

Unfortunately, this approach do not work. Every time I run a sequence of commands, they will be activated with, sometimes very slight, variations, making it impossible to actually get a consistent and reliable path for the lander.

My Question

So my question is, am I tackling this problem a completely wrong way? What exactly do you do when it is absolutely critical that timed events defined by the user will activate at exactly the same time and spot in a level? I seem to be quite stuck with this question.

sentences: How are writing shaders different in Unity's scriptable render pipeline vs the standard pipeline? So I want to start learning how to write shaders because the shadergraph seems very limited at the moment. I've done some research and it seems that I should learn the HLSL language which is used by Unity. I'm becoming confused though how this will carry over between pipelines. I read that standard pipeline shaders aren't supported in URP so I'm confused how the shader language is different in URP if they both use the HLSL language. I was wondering if someone with a better grasp on this could explain the difference between them and if the skills carry over, as most tutorials online seem to be for writing shaders in the standard pipeline. Thanks.

sentences:
Single player game into Multiplayer game I developed a Single player game in Flash (Tic Tac Toe) and in the Multiplayer mode i will be able to do both player playing on the same system with out network.

I would like to extend it and make it enable to play the Multiplayer game for two player playing it online.

How i can be made give me some ideas , How test the Multiplayer game playing along with different computers(I do not have internet connection in home).

How I able to change the single player game into Multiplayer game , any minor changes required or I have to change the code base completely.

In which way i can make it possible.

sentences: Are there special APIs used to make PS4 games? Game engines can build games for PS4, but how are those engines written to support it? Is there any special kind of support, API or something provided by the PS4? Does it have like a new programming language or new specification like OpenGL or DirectX?

sentences:
Pixelated Normal Generation I am generating normals for each vertex in a standard 512*512 quad. Yet when I do using the following code:

public Vector3f[] normals(Vector3f[] surface){
Vector3f[] normals = new Vector3f[surface.length];
for(int i = 0; i<normals.length; i+=4){

    Vector3f n1 = surface[i];
    Vector3f n2 = surface[i+1];
    Vector3f n3 = surface[i+2];
    Vector3f n4 = surface[i+3];

    Vector3f p1 = n1.subtract(n2);
    Vector3f p2 = n3.subtract(n2);
    Vector3f p3 = n3.subtract(n4);
    Vector3f p4 = n1.subtract(n4);

    Vector3f norm1 = (p2.cross(p1)).normalize();
    Vector3f norm2 = (p4.cross(p3)).normalize();
    normals[i] = (norm1.add(norm2)).divide(2);
    normals[i+1] = norm1;
    normals[i+2] = (norm1.add(norm2)).divide(2);
    normals[i+3] = norm2;

    }
    return normals;
}

I get the following from this:

Any ideas what is causing this? Thanks in advance.

sentences:
What is the AlphaToCoverage blend state useful for? Alright, just finished most of my early UI stuff and I wanted the windows to have some transparency. So I expanded my application to initialize and bind blend states so that my UI shader could implement alpha blending. I was initially having no luck but I got the blend state configured to achieve my purpose, however the way it is configured doesn't make sense to me so I must be missing something.

Here is how I initialize my blend state.

bool BlendState::StartUp() {
    D11DeviceManager* _pDeviceManager = D11DeviceManager::GetSingleton();

    D3D11_BLEND_DESC _desc;
    _desc.AlphaToCoverageEnable = false;
    _desc.IndependentBlendEnable = false;

    _desc.RenderTarget[0].BlendEnable            = true;
    _desc.RenderTarget[0].SrcBlend               = D3D11_BLEND_SRC_COLOR;
    _desc.RenderTarget[0].DestBlend              = D3D11_BLEND_DEST_COLOR;
    _desc.RenderTarget[0].BlendOp                = D3D11_BLEND_OP_ADD;
    _desc.RenderTarget[0].SrcBlendAlpha          = D3D11_BLEND_SRC_ALPHA;
    _desc.RenderTarget[0].DestBlendAlpha         = D3D11_BLEND_DEST_ALPHA;
    _desc.RenderTarget[0].BlendOpAlpha           = D3D11_BLEND_OP_ADD;
    _desc.RenderTarget[0].RenderTargetWriteMask  = 7;

    return !FAILED(_pDeviceManager->GetDevice()->CreateBlendState(&_desc, &pBlendState));
}

Right now my alpha blending only works when the AlphaToCoverage bool is set to false... I thought this was just a bool enabling the pixel fragment blending (which upon retrospection would be redundant considering the BlendEnable flags...) but looking at the MSDN documentation is appears to do this...

  You can use the AlphaToCoverageEnable member of D3D11_BLEND_DESC1 or D3D11_BLEND_DESC to toggle whether the runtime converts the .a component (alpha) of output register SV_Target0 from the pixel shader to an n-step coverage mask (given an n-sample RenderTarget). The runtime performs an AND operation of this mask with the typical sample coverage for the pixel in the primitive (in addition to the sample mask) to determine which samples to update in all the active RenderTargets.

Could someone explain this to me and how it differs from when the AlphaToCoverageEnable bool is false? I see that it adds a new mask to the fragment but I don't quite follow what the mask exactly is.

sentences:
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:
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:
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:
Unity VR: How to draw camera on top of VRSettings.showDeviceView mirroring We're using VRSettings.showDeviceView = true to mirror the VR display to the main window. We also have a camera that we'd like to draw over top of the main window's mirrored VR image. This other camera renders an overlay for people who are watching the mirrored VR view.

Right now the overlay camera has a depth of 5 and the VR camera has a depth of 0, but as far as I can tell I think the overlay camera of depth 5 is being overwritten by the mirror drawn by showDeviceView = true.

Anyone know an easy trick to get this behaviour?

Thanks for your time,

Allen

sentences:
How do i initialize and use a Texture Array? LibGDX First of all, I am new to Java and LibGDX..

What I am trying to do is Load my texture images into an array so that I can reference them in my drawing code by number, rather than by name.
I am drawing a tile map.

Instead of this:

tile1 = new Texture(Gdx.files.internal("grass.png"));
tile2 = new Texture(Gdx.files.internal("dirttile.png"));
tile3 = new Texture(Gdx.files.internal("watertile.png"));

I would like it to be more like:

tile[1] = new Texture(Gdx.files.internal("grass.png"));
tile[2] = new Texture(Gdx.files.internal("dirttile.png"));
tile[3] = new Texture(Gdx.files.internal("watertile.png"));

..so that later I can draw them by which tile I need..such as

tileType = worldMap[i][j]; //will be an int number
batch.draw(tile[tileType], tileX, tileY);

I can't figure out how to initialize array and load textures into it though in order to do this, without getting errors.

Basically I need to draw my map based on numbers I have in a tile map like this:

 int worldMap[][] = {
            { 1,1,1,1,1,1,1,1,1,1 } ,
            { 1,1,1,1,1,1,1,1,1,1 } ,
            { 1,1,1,1,1,1,1,1,1,1 } ,
            { 1,1,1,3,3,3,1,1,1,1 } ,
            { 1,1,1,3,3,3,1,1,1,1 } ,
            { 1,1,1,3,3,3,1,1,1,1 } ,
            { 1,1,1,1,1,1,1,1,1,1 } ,
            { 1,1,1,1,1,1,1,1,1,1 } ,
            { 1,1,1,1,1,1,1,1,1,1 } ,
            { 1,1,1,1,1,1,1,1,1,1 } ,
    };

I need to draw the map tile based on the numbers in that map... 1 = grass 2 = dirt 3 = water etc....
Still no luck getting the array working.

sentences:
Sending changes to a terrain heightmap over UDP This is a more conceptual, thinking-out-loud question than a technical one. I have a 3D heightmapped terrain as part of a multiplayer RTS that I would like to terraform over a network. The terraforming will be done by units within the gameworld; the player will paint a "target heightmap" that they'd like the current terrain to resemble and units will deform towards that on their own (a la Perimeter).

Given my terrain is 257x257 vertices, the naive approach of sending heights when they change will flood the bandwidth very quickly - updating a quarter of the terrain every second will hit ~66kB/s. This is clearly way too much.

My next thought was to move to a brush-based system, where you send e.g. the centre of a circle, its radius, and some function defining the influence of the brush from the centre going outwards. But even with reliable UDP the "start" and "stop" messages could still be delayed. I guess I could compare timestamps and compensate for this, although it'd likely mean that clients would deform verts too much on their local simulations and then have to smooth them back to the correct heights. I could also send absolute vert heights in the "start" and "stop" messages to guarantee correct data on the clients.

Alternatively I could treat brushes in a similar way to units, and do the standard position + velocity + client-side prediction jazz on them, with the added stipulation that they deform terrain within a certain radius around them. The server could then intermittently do a pass and send (a subset of) recently updated verts to clients as and when there's bandwidth to spare.

Any other suggestions, or indications that I'm on the right (or wrong!) track with any of these ideas would be greatly appreciated.

sentences:
Giving a Bomberman AI intelligent bomb placement I'm trying to implement an AI algorithm for Bomberman. Currently I have a working but not very smart rudimentary implementation (the current AI is overzealous in placing bombs).

This is the first AI I've ever tried implementing and I'm a bit stuck. The more sophisticated algorithms I have in mind (the ones that I expect to make better decisions) are too convoluted to be good solutions.

What general tips do you have for implementing a Bomberman AI? Are there radically different approaches for making the bot either more defensive or offensive?

Edit: Current algorithm

My current algorithm goes something like this (pseudo-code):

1) Try to place a bomb and then find a cell that is safe from all the bombs, including the one that you just placed. To find that cell, iterate over the four directions; if you can find any safe divergent cell and reach it in time (eg. if the direction is up or down, look for a cell that is found to the left or right of this path), then it's safe to place a bomb and move in that direction.

2) If you can't find and safe divergent cells, try NOT placing a bomb and look again. This time you'll only need to look for a safe cell in only one direction (you don't have to diverge from it).

3) If you still can't find a safe cell, don't do anything.

for $(direction) in (up, down, left, right):
    place bomb at current location
    if (can find and reach divergent safe cell in current $(direction)):
        bomb = true
        move = $(direction)
        return

for $(direction) in (up, down, left, right):
    do not place bomb at current location
    if (any safe cell in the current $(direction)):
        bomb = false
        move = $(direction)
        return

else:
    bomb = false
    move = stay_put

This algorithm makes the bot very trigger-happy (it'll place bombs very frequently). It doesn't kill itself, but it does have a habit of making itself vulnerable by going into dead ends where it can be blocked and killed by the other players.

Do you have any suggestions on how I might improve this algorithm? Or maybe I should try something completely different?

One of the problems with this algorithm is that it tends to leave the bot with very few (frequently just one) safe cells on which it can stand. This is because the bot leaves a trail of bombs behind it, as long as it doesn't kill itself.

However, leaving a trail of bombs behind leaves few places where you can hide. If one of the other players or bots decide to place a bomb somewhere near you, it often happens that you have no place to hide and you die.

I need a better way to decide when to place bombs.

sentences:
As3 Flash How to check if a bitmapdata is completely set to transparent using an eraser? I'm trying to make a window-cleaning game with flash as3 on the timeline.
(Sounds boring I know, but I realy have some fun idea's with it)

So I have: A dirtywindow movieclip on the bottom layer
and a clean window movieclip on layer 2(mc1) on the layer above.

To hide the top layer(the dirty window) I assign a mask to it.

// this creates a mask that hides the movieclip on top
var mask_mc:MovieClip = new MovieClip();
addChild(mask_mc)

//assign the mask to the movieclip it should 'cover'
mc1.mask = mask_mc;

With a brush(cursor) the player wipes of the dirt ( actualy setting the fill from the mask to transparent so the clean window appears)

//add event listeners for the 'brush'
brush_mc.addEventListener(MouseEvent.MOUSE_DOWN,brushDown);
brush_mc.addEventListener(MouseEvent.MOUSE_UP,brushUp);

//function to drag the brush over the mask
function brushDown(dragging:MouseEvent):void{
    dragging.currentTarget.startDrag();
    MovieClip(dragging.currentTarget).addEventListener(Event.ENTER_FRAME,erase) ;
    mask_mc.graphics.moveTo(brush_mc.x,brush_mc.y);
}

//function to stop dragging the brush over the mask
function brushUp(dragging:MouseEvent):void{
    dragging.currentTarget.stopDrag();
    MovieClip(dragging.currentTarget).removeEventListener(Event.ENTER_FRAME,erase);
}

//fill the mask with transparant pixels so the movieclip turns visible
function erase(e:Event):void{
    with(mask_mc.graphics){
        beginFill(0x000000);
        drawRect(brush_mc.x,brush_mc.y,brush_mc.width,brush_mc.height);
        endFill();
    }

}

I hope you can help me with the following problem:
The game-aspect of this should be the points the player get's for cleaning/erasing all the dirt.

Can anyone tell me how I can check if all pixels are set to transparency?  So how to check if all the dirt has been erased? And than for example trace ("window cleaned")

I tried the compare() function but didn't have much luck with it :(...

sentences: Fast zoom in and out in Unity Editor Is it possible to zoom out and zoom in in Unity Editor in Scene View faster than just with the help of scroll wheel on the mouse? I hope there are exist some shortcut for that. Am I right?

sentences:
Object is moving more than it should I have the following code for Food:

exports.Food = function(x, y) {
this.MOVE_X_FROM_POSITION = 10;
this.ACCELERATION = 0.05
this.image;
this.firstX = x;
this.firstY = y;
this.x = x;
this.y = y;
this.width = 10;
this.height = 10;
this.velocity = {
  x: 0,
  y: 0
}
this.acceleration = {
  x: this.ACCELERATION,
  y: 0
};
this.render = function(ctx) {
  if (typeof this.image != undefined) ctx.drawImage(this.image, this.x - this.width / 2, this.y - this.height / 2);
  return this;
}
this.update = function() {
  this.velocity.x += this.acceleration.x;
  this.velocity.y += this.acceleration.y;
  this.x += this.velocity.x;
  this.y += this.velocity.y;
  if (this.x >= this.firstX + this.MOVE_X_FROM_POSITION) {
    this.acceleration.x = -this.ACCELERATION;
  } else if (this.x <= this.firstX - this.MOVE_X_FROM_POSITION) {
    this.acceleration.x = +this.ACCELERATION;
  }
}

... and so on

I want the food to move 10 steps from it's first location one side and 10 steps the other side. The problem is that if the script is running longer it becomes to move far more than 10 steps from it's original position. PS: update function is called in the loop every 30 times per second

Where could be the problem? Thank You in advance

EDIT

Here is actually a demonstration of my problem:
https://jsfiddle.net/02jbmxnw/1/

sentences:
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:
Implementing a skybox with GLSL version 330 I am trying to get a skybox working with OpenGL 3.3 and GLSL version 330.

I could not find a completely modern OGL skybox tutorial anywhere on the web, so I modernised an older one (using glVertexAttribPointer() instead of gl_Vertex for vertices, etc.). It's mostly working, but for 2 major details:

The skyboxes are more like sky triangles, and the textures are badly warped and stretched (they are supposed to be star fields, I get while lines on a black background). I'm 99% sure that this is because I didn't port the old tutorials completely correctly.

Here is my skybox class:

static ShaderProgram* cubeMapShader = nullptr;

static const GLfloat vertices[] =
{
    1.0f, -1.0f,  1.0f,
    1.0f,  1.0f,  1.0f,
    1.0f,  1.0f, -1.0f,
    -1.0f, -1.0f,  1.0f,
    -1.0f, -1.0f, -1.0f,
    -1.0f,  1.0f, -1.0f,
    -1.0f,  1.0f,  1.0f,
    -1.0f,  1.0f, -1.0f,
    1.0f,  1.0f, -1.0f,
    1.0f,  1.0f,  1.0f,
    -1.0f,  1.0f,  1.0f,
    -1.0f, -1.0f,  1.0f,
    1.0f, -1.0f,  1.0f,
    1.0f, -1.0f, -1.0f,
    -1.0f, -1.0f, -1.0f,
    1.0f, -1.0f,  1.0f,
    -1.0f, -1.0f,  1.0f,
    -1.0f,  1.0f,  1.0f,
    1.0f,  1.0f,  1.0f,
    -1.0f, -1.0f, -1.0f,
    1.0f, -1.0f, -1.0f,
    1.0f,  1.0f, -1.0f,
    -1.0f,  1.0f, -1.0f
};

Skybox::Skybox(const char* xp, const char* xn, const char* yp, const char* yn, const        char* zp, const char* zn)
{
if (cubeMapShader == nullptr)
    cubeMapShader = new ShaderProgram("cubemap.vert", "cubemap.frag");

    texture = SOIL_load_OGL_cubemap(xp, xn, yp, yn, zp, zn, SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_MIPMAPS);

    glBindTexture(GL_TEXTURE_CUBE_MAP, texture);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
    glBindTexture(GL_TEXTURE_CUBE_MAP, 0);

    glGenVertexArrays(1, &vaoID);
    glBindVertexArray(vaoID);
    glGenBuffers(1, &vboID);
    glBindBuffer(GL_ARRAY_BUFFER, vboID);
    glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
    glEnableVertexAttribArray(0);
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
    glBindVertexArray(0);

    scale = 1.0f;
}

Skybox::~Skybox()
{

}

void Skybox::Render()
{
    ShaderProgram::SetActive(cubeMapShader);
    glDisable(GL_DEPTH_TEST);
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_CUBE_MAP, texture);
    cubeMapShader->Uniform1i("SkyTexture", 0);
    cubeMapShader->UniformVec3("CameraPosition", Camera::ActiveCameraPosition());
    cubeMapShader->UniformMat4("MVP", 1, GL_FALSE, Camera::GetActiveCamera()->GetProjectionMatrix() * Camera::GetActiveCamera()->GetViewMatrix() * glm::mat4(1.0));
    glBindVertexArray(vaoID);
    glDrawArrays(GL_QUADS, 0, 24);
    glBindVertexArray(0);
    glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
}

Vertex Shader:

#version 330
layout(location = 0) in vec3 Vertex;

uniform vec3 CameraPosition;
uniform mat4 MVP;

out vec3 Position;

void main()
{
    Position = Vertex.xyz;
    gl_Position = MVP * vec4(Vertex.xyz + CameraPosition, 1.0);
}

Fragment Shader:

#version 330 compatibility

uniform samplerCube SkyTexture;

in vec3 Position;

void main()
{
    gl_FragColor = textureCube(SkyTexture, Position);
}

Here's an example of the glitches. If anyone could take a look who knows GLSL well (I'm still learning it), or skyboxes, I would appreciate any help you could give. Also, kudos if you can teach me how to use non-deprecated functions in the fragment shader so I don't have to use the compatibility profile of glsl 330.

EDIT: Immediately found the problem with the stretching textures: I was using Position = Vertex.xyx instead of Position = Vertex.xyz in the vertex shader. Oops. But the triangle error still exists.

sentences:
Client/Server networking for mobile games I am currently considering the pros and cons of two different approaches for networking an Android game.

First, I will specify some details about the game and its requirements, and then I will explain the considered approaches.

The game is a mobile game currently being developed for Android (but may be a port to iPhone in the future). The game is being built on the Unity3D engine using the Android Basic license, which does not allow direct access to .NET sockets.

The core functionality of the game consists of basic matchmaking, and the gameplay during a match. Matches are turn based. When another player finalizes his/her turn, each other player will receive the update and will see it rendered. The client will collect the turn from the player and send it off to the server. Nothing too special here.

The first approach I am considering is a mixture of a REST service and Google's Cloud2Device Messaging. With this, the general flow would be:

Collect the turn from the user.
Send the turn to the server via an HTTP POST to a REST service.
The server processes the turn and saves the match state, assigning it an "event id."
The server uses Cloud2Device messaging to send a notification down to each client. The notification consists of an "event id."
Upon receiving the notification from the Google servers, the client will perform a GET to the game server's REST service asking for details for the respective event id.

Given this approach, the pros I see are:

REST services are easy to write (much of my experience is in REST services).
No custom socket work, as Google's service is used to notify clients.
Easy to implement within Unity's Android Basic license.
Cloud2Device Messaging allows an app to be "woken up" if it is not currently running (could be helpful in certain cases, I suppose).

The cons I see are:

Networking code is at the mercy of Google's service.
If Google delivers the "turn start" notification too late, a player may miss his/her turn.
Porting to the iPhone would require a heavy rework of network management.
Google likely will begin charging for Cloud2Device Messaging.

The alternative approach is to use a workaround to the lack of .NET socket support within Unity Android Basic. This would basically use Android's built-in socket support mixed with some custom-made Unity plugins to allow sending/receiving of network messages.

The general flow of this approach would be a straight-forward client/server socket approach, where each user playing the game has a connected socket.

The pros I see for this are:

All networking is handled by my services (not Google's).
Easier porting to other platforms (iPhone, iPad, etc.)
Potential to show more real-time player actions, rather than receiving all turn data after the turn has been committed.

The cons I see are:

Very little personal experience writing socket servers for games (this point scares me the most right now).
Debating whether this is necessary or not, as a turn-based game does not exactly need constant socket communication. A REST service may be all I need.
Constant socket communication may require an unnecessary amount of CPU or network data for a mobile device (or does having a socket open not require many resources expect when transmitting data?).

My observations and speculations aside, can anybody weigh in on this issue? I do not have much experience when it comes to game networking (especially for mobile) and would much appreciate advice on this issue. Let me know if more details are needed.

Thanks!

sentences:
Enemy doesn't fire at player My script looks pretty good but it says Target variable has not been assigned value.

public GameObject AntagonisticElement;
public GameObject Target;
public float bulletSpeed;
public float enemySpeed;
public float bulletDestroyTime;
public GameObject explsn;
public GameObject bulletPrefab;
public Transform bulletSpawn;

Vector3 pos;

public float min = 20;
public float max = 10;

public int MaxCounter;
public int CounterStatus;
int numberofEnemy;
// Use this for initialization

void Start()
{

}

// Update is called once per frame
void Update()
{
    if (CounterStatus <= 0)
    {
        if (numberofEnemy < 3)
        {
            Vector3 creationPoint = transform.position;
            creationPoint.y = -0.5f;
            Instantiate(AntagonisticElement, creationPoint, transform.rotation);

            CounterStatus = MaxCounter;
            numberofEnemy++;
        }
    }

    else
    {
        CounterStatus--;
    }

    transform.LookAt(Target.transform.position);

    if (Vector3.Distance(transform.position, Target.transform.position) >= min)
    {
        transform.position += transform.forward * 4 * Time.deltaTime;

    }
    if (Vector3.Distance(transform.position, Target.transform.position) <= max)
    {
        shootAt();
    }

}

    void shootAt()
    {

        Instantiate(explsn, bulletSpawn.position, bulletSpawn.transform.rotation);
        var bullet = Instantiate(bulletPrefab, bulletSpawn.position, bulletSpawn.rotation);
        bullet.GetComponent<Rigidbody>().velocity = bullet.transform.forward * bulletSpeed;

    }

sentences:
How to tell if a glut window has focus from c# How can I tell if a glut window has focus? Im using c#/tao, Ill use p/invokes if necessary.

Basically I want to ignore input if it doesn't have focus.

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:
What is a good free "game development organisation" site? I'm searching for a site that will help me to design a game. I don't have a development team in the same location. They are all located somewhere over the world. I am searching for a kind of site that allows people to post ideas and suggestions, but moreover to have control over who has the control over what. For example, one makes the graphics and has several people "under" him that can get a certain task to make a certrain graphic. This has to be easily found on this site.

Does anyone know a good site like this? I prefer it to be free.

sentences:
How to 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:
Are there any disadvantages of using Distance Squared checks rather than Distance? I use distance squared checks for basically all my distance (vector3 length) checking, due to the performance increase from not incurring a square root (like in plain length checks).

From the looks of it, squared distance checks work fine in every situation:

if x^2 < y^2, then x < y, even when 0 < (x or y) < 1

I am not considering situations where x or y is less than 0, as distance and distance-squared is always going to be positive.

Since this works, it looks like distance checks are never ever needed, but I have a nagging feeling that i'm missing something. Will this still hold up in accuracy-critical situations?

sentences:
What are Game Maker drawbacks? I actually make games only programming (SFML atm), but I was taking a look at game maker features and it looks very powerful.

What are Game Maker drawbacks? any reason why I shouldn't move into it?

It works for little games, but still it work fine with bigger projects? is it internally fast?

Thanks

sentences:
Why moving platform script is not working? I have some code attached to a moving platform:

public Transform pos1, pos2;
public float speed;
public Transform startPos;

Vector3 nextPos;
// Start is called before the first frame update
void Start()
{
    nextPos = startPos.position;
}

// Update is called once per frame
void Update()
{
    if (transform.position == pos1.position)
    {
        nextPos = pos2.position;
    }
    else if (transform.position == pos2.position)
    {
        nextPos = pos1.position;
    }
    transform.position = Vector3.MoveTowards(transform.position, nextPos, speed * Time.deltaTime);
}

private void OnDrawGizmos()
{
    Gizmos.DrawLine(pos1.position, pos2.position);
}

But my platform does not go to the pos2 when it reaches the pos1. What is wrong here?

sentences:
How can I adapt A* pathfinding to work with platformers? I have an A* implementation that works in "top down" situations where gravity is not taken into account for pathfinding. But, I am looking to modify to work in a 2d platformer situation. I am using the Unity Engine in C# but any examples or even pseudocode would be really helpful. I have found a source so far but it haven't been that helpful as I am not understanding the way they have adapted A*, I have listed them below.

http://gamedevelopment.tutsplus.com/tutorials/how-to-adapt-a-pathfinding-to-a-2d-grid-based-platformer-theory--cms-24662 (Very specific to authors implementation and hard to understand)

sentences:
What is an efficient method of collision detection for handling lots of objects? In my game, I have plenty of objects that can collide. Literally, most of them can collide with each other. The problem I'm facing is that I can't come up with some good collision detection. How can I resolve collisions for lots of objects in such way that I don't end up with class that has more than 1000 lines of code with enormous conditional constructs like this?

    if (firstBodyUserData == "rocket"
            && secondBodyUserData == "car_body") {
        resolveRocketAndCarBodyCollision(firstBody, secondBody, contactData);
    } else if (firstBodyUserData == "rocket"
            && secondBodyUserData == "gas_tank")
        resolveRocketAndGasTankCollision(firstBody, secondBody, contactData);
    //...many more dumb lines of code for every particular object in my game

And don't forget about all these "resolving methods" after if statements.

To make question more specific, I use Box2D  with its ContactListener and Artemis-odb entity-component-system framework so I don't really have classes for my entities and that kind of exacerbates the problem but main question is in resolving bunch of different types of collisions.

sentences:
How to create rotating mode selection knob on multimeter I want to create something looks similar to this for electrical and electronic troubleshooting simulationw.
I need to know how to program the drag interaction that and rotates the knob to select the mode of operation.
I checked several videos including this one, but this is not what I'm looking for. I am hoping to drag and rotate the knob in a circle.
I also need to know how to set the operating mode based on rotation. For instance, if the knob is pointing at 0-5 degrees (after drag and release), the knob position is set to 0, and the device is in off mode; if it is at 85-95 degrees then angle=90 degrees, and the device is set to resistance measurement mode.

sentences:
How can i change the cube scale only on Y and only to up? This is the script I am working with:

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

public class Raise : MonoBehaviour
{
public GameObject Ladder;

float mfX;
float mfY;
float mfZ;
// Use this for initialization
void Start()
{
    mfX = Ladder.transform.position.x - Ladder.transform.localScale.x / 2.0f;
    mfY = Ladder.transform.position.y - Ladder.transform.localScale.y / 2.0f;
    mfZ = Ladder.transform.position.z - Ladder.transform.localScale.z / 2.0f;
}

// Update is called once per frame
void Update()
{
        Vector3 v3Scale = Ladder.transform.localScale;
        Ladder.transform.localScale = new Vector3(v3Scale.x + 0.1f, v3Scale.y + 0.1f, v3Scale.z + 0.1f);
        Ladder.transform.position = new Vector3(/*mfX + Ladder.transform.localScale.x / 2.0f*/0, mfY + Ladder.transform.localScale.y / 2.0f, mfZ + Ladder.transform.localScale.z / 2.0f);
}
}

The way it is now it's making the whole cube bigger and bigger.

But I want to make the cube grow only UP on Y. To keep the cube capacity/ extent
But to make the scale change only up.

If I'm doing:

Vector3 v3Scale = Ladder.transform.localScale;
Ladder.transform.localScale = new Vector3(0, v3Scale.y + 0.1f, 0);
Ladder.transform.position = new Vector3(0, mfY + Ladder.transform.localScale.y / 2.0f, 0);

I will see it go up in scene if I select the cube in the hierarchy but if not I will not see the cube at all.

Can't figure out how to make is grow up only up side.

sentences:
ScreenSize vs. WorldSize While programming a game with LibGDX, I came across a problem. My OrthographicCamera wasn't centering in the right place. I was trying to center the camera by using the line of code:

gameCam.position.set(gamePort.getScreenWidth() / 2, gamePort.getScreenHeight() / 2, 0);

But that centered the camera at (0, 0) so that you could see all four quadrants of the coordinate table.

Here is the image:

NOTE: I am using a FitViewport that was initialized like gamePort = new FitViewport(MarioBros.V_WIDTH, MarioBros.V_HEIGHT, gameCam);

Also: public static final int V_WIDTH = 400;
    public static final int V_HEIGHT = 208; (in the MarioBros class)

But after some fiddling with the code, I changed the line of code to this:

gameCam.position.set(gamePort.getWorldWidth() / 2, gamePort.getWorldHeight() / 2, 0);
I changed it from ScreenSize to WorldSize and got this result:

I'm still unsure of what using WorldSize changed.

What's the difference between the two?. Also, why did one work while the other didn't?

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:
Can a local multiplayer iOS game display differently for each device? I've seen games which display different data for two devices, but not more than two.

If possible, can it be accomplished using GameKit?

EDIT:
More specifically, I was thinking local multiplayer via bluetooth or wi-fi on an iOS device. Most games I've seen display the same screen synchronized across all of the devices.

I understand games that network across the internet do this, often using a server, but I haven't seen any examples of a 3+ device local multiplayer iOS game. I just want to make sure it wasn't some kind of limitation.

sentences:
How to make an Actor follow my finger I'm back with another question that may be really simple.

I've a texture drawn on my spritebatch and I'm making it move up or down (y-axis only) with Libgdx's Input Handler: touchDown and touchUp.

@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
    myWhale.touchDownY = screenY;
    myWhale.isTouched = true;
    return true;
}

@Override
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
    myWhale.isTouched = false;
    return false;
}

myWhale is an object from Whale Class where I move my texture position:

public void update(float delta) {
    this.delta = delta;
    if(isTouched){
        dragWhale();
    }
}

public void dragWhale() {
    if(Gdx.input.getY(0) - touchDownY < 0){
        if(Gdx.input.getY(0)<position.y+height/2){
            position.y = position.y - velocidad*delta;
        }
    }
    else{
        if(Gdx.input.getY(0)>position.y+height/2){
            position.y = position.y + velocidad*delta;
        }
    }
}

So the object moves to the center of the position where the person is pressing his/her finger and most of the time it works fine but the object seems to take about half a second to move up or down and sometimes when I press my finger it wont move.

Maybe there's another simplier way to do this. I'd highly appreciate if someone points me on the right direction.

sentences:
Why does my frames per second function return inconsistent results? I have a FPS function that:

private static void runGameFPS2() {
    long beginTime; //The time when the cycle begun
    long timeDiff; //The time it took for the cycle to execute
    int sleepTime; //ms to sleep (< 0 if we're behind)
    int fps = 1000 / 40;

    beginTime = System.currentTimeMillis();

    //Update game state
    updateGame();
    //Render state to the screen
    renderScreen();

    //Calculate how long did the cycle take
    timeDiff = System.currentTimeMillis() - beginTime;

    //Calculate sleep time
    sleepTime = fps - (int)(timeDiff);

    if (sleepTime > 0) {//If sleepTime > 0 we're OK
        try { Thread.sleep(sleepTime); }catch(InterruptedException e){}
    }else{
        //suppose will not be
    }
}

public static void main(String[] args){
    while(true){ runGameFPS2(); }
}

When I run my code, Java works at different speeds on same computer or on different computers.

How can I write a consistent code, that Java will always work "same time" (for example 40 FPS) on mycomputer or any computer?

Note: suppose sleepTime will never be sleepTime < 0

sentences:
How to use multiple UV maps with ShaderLab (Unity) I want to layer one texture over top of another on the same mesh, but map the textures to different UV maps.

The example for Detail Maps in the Surface Shader Examples looks almost identical to what I want, but it seems that it uses the same UV map as the albedo texture, multiplied by 2.

I will admit I am very new to ShaderLab, but I am willing to put the work in and research: I just haven't seemed to be able to find the right documentation for what I want to do, or at least I do not understand how to use it.

I have achieved this result in blender this way, though I understand obviously there isn't a 1:1 conversion here.

I also have it working with ShaderGraph, which is neat, but I need it to work using the internal Unity shader for the project I am working on, so unfortunately ShaderGraph is out.

My understanding is that I would declare the UV maps under the Input struct like

struct Input {
    float2 uv_MainTex : TEXCOORD0;
    float2 uv2_Detail : TEXCOORD1;
};

and then grab the textures from the Properties input by doing

sampler2D _MainTex;
sampler2D _Detail;

and then use the inputs similarly to the _MainTex call which is

fixed4 c = tex2d(_MainTex, IN.uv_Detail).rgb * _Color;

I have also seen this answer but it doesn't really seem to solve the problem for me, it still doesn't seem to access my second UV map.

I do know that there is some confusion with how UV maps are used in HLSL vs. in Unity. Generally speaking I'm not concerned about overwriting UVs with lightmaps or stuff like that, and if that is an issue I can just add dummy maps when I export from blender to put my custom UV map as the 4th index.

My question is: how do I make one image map use a certain UV Channel and a second image use a second UV channel? Currently my setup is basically just a standard Lit Shader that I added the properties for the detail map to.

Right now it is only displaying the _MainTex on UV0.

Code in full here.

sentences:
Handling commands or events that wait for an action to be completed afterwards Say you have two events: Action1 and Action2. When you receive Action1, you want to store some arbitrary data to be used the next time Action2 rolls around. Optimally, Action1 is normally a command however it can also be other events. The idea is still the same.

The current way I am implementing this is by storing state and then simply checking when Action2 is called if that specific state is there. This is obviously a bit messy and leads to a lot of redundant code. Here is an example of how I am doing that, in pseudocode form (and broken down quite a bit, obviously):

void onAction1(event) {
    Player = event.getPlayer()
    Player.addState("my_action_to_do")
}

void onAction2(event) {
    Player = event.getPlayer()

    if not Player.hasState("my_action_to_do") {
        return
    }

    // Do something
}

When doing this for a lot of other actions it gets somewhat ugly and I wanted to know if there is something I can do to improve upon it.

I was thinking of something like this, which wouldn't require passing data around, but is this also not the right direction?

void onAction1(event) {
   Player = event.getPlayer()
   Player.onAction2(new Runnable() {

       public void run() {
           // Do something
       }

   })
}

If one wanted to take it even further, could you not simply do this?

void onPlayerEnter(event) { // When they join the server
    Player = event.getPlayer()
    Player.onAction1(new Runnable() {

       public void run() {

           // Now wait for action 2
           Player.onAction2(new Runnable() {
               // Do something
           })

       }

    }, true) // TRUE would be to repeat the event,
             // not remove it after it is called.
}

Any input would be wonderful.

sentences:
Do I need to call Release() on D3D objects when I use them in another function? For example, I have an IDirect3DSurface9 * Surface and IDirect3DSurface9 *BackBuffer.

If I were to use them directly in the render_frame function, I would need to release them on the closeD3D function. However, if I use them in a function in same file or in another .h and .cpp file, when I call Release in closeD3D it gives me an error.

So, do I not need to release them if I'm using them in a function, or am I doing something wrong?

sentences: Can SpriteBatch be used to fill a polygon with a texture? I basically need to fill a texture into a polygon using the SpriteBatch. I've done some research but couldn't find anything useful except polygon triangulation method, which works well only with convex polygons (without diving into super math which is definitely not something I'm pretty good at). Are there any solutions for filling in a polygon in a basic way? I of course need something dynamic (I'll have a map editor that you can define polygons, and the game will render them (and collision detection will also use them but that's off topic), basically I can't accept solutions like "pre-calculated" bitmaps or anything like that. I need to draw a polygon with the segments provided, to the screen, using the SpriteBatch.

sentences:
How does CharacterMovementComponent::PerformMovement work? I'm developing an adventure platformer. As such, the manipulation etc. of the CharacterMovementComponent is going to be crucial to the game.

I have seen the more top level explanations of the MovementComponent however none of them provide any insight into how PerformMovement is coded.

I'm trying to work through it and understand it myself, however as i'm not completely familiar with the component, it's a little hard for me to understand.

So I was wondering if anyone on here knew anything about this MovementComponent, could tell me how the function really works, or could point me in the right direction for the development of our movement systems.

sentences:
Box2DLights - the center of sprites are always 100% unlit (black) unless Xray is on I'm using a ConeLight at 180 degrees, with this setup:
pl = new ConeLight(rayHandler, 256, new Color(0.5f, 0.5f, 0.5f, 1f), 280f, 400 - x, 300 - y, 0, 180);
And the object I'm casting a shadow on (with?) is set up like so:

sprite = new Sprite(new Texture(imgP));

BodyDef bodyDef = new BodyDef();
bodyDef.type = BodyType.DynamicBody;
bodyDef.position.set(x - 392.5f, y - 292.5f);

body = Main.world.createBody(bodyDef);

PolygonShape pushBlock = new PolygonShape();

pushBlock.setAsBox(((float) w / 2), ((float) h / 2));

FixtureDef fixtureDef = new FixtureDef();
fixtureDef.shape = pushBlock;
fixtureDef.density = 0.5f;
fixtureDef.friction = 0.8f;
fixtureDef.restitution = 0f;

Fixture fixture = body.createFixture(fixtureDef);

body.setUserData(sprite);
body.setGravityScale(0);
body.setFixedRotation(true);
body.setLinearDamping(40f);

pushBlock.dispose();

The problem is that the light creates the shadows in a sort of glob form in the center of the square (not casting nicely around the corners as I've seen in others' projects), also leaving nearly the whole sprite black. I require the ambient colour to be black, and also require shadows, so Xray is out. I've messed around with filters but haven't been able to achieve what I want - being able to cast shadows without overshadowing the sprite.
Is it possible? How might I do this, if possible?

Edit: I took a screenshot.

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:
What does "~" in front of a function name inside a class mean? I added a class using the 'add class' item in Visual Studio Express and it generated two functions in the .cpp file with the same names. But the second has the ~ character in front of it.

What does it mean?

sentences:
How to modify A* so that it takes into account the number of movement point left? Context : turn based game, grid system

Let this graph here :

(A)-2-(B)-1-(C)
 |    /|   /
 1  2  2  1
 | /   |/
(D)-1-(E)

My unit is at A and wants to go at C. He currently has 1 point left, therefore he cannot go onto tile B until next turn.

A*star could say that the best path is A-B-C and say that the next move is go to B. But my unit cannot. It should've gone to D, as it would move closer to C and use all of its remaining movement point.

Right now, I have done a workaround in which I give a set of tiles to ignore, these tiles are neighbouring tiles that cannot be access given a number of movement point left. This works OK because my tiles either cost 1 or 2 MP, and my units have a maximum of 2 MP.

I would like something that is more general.

I have currently thought of something. I will now stop adding tiles to the frontier for which the cost so far is superior to my current movement point left. Once the frontier is empty, I iterate over all the already seen tiles and select the one with the best heuristic and get the path from there. Would that work?

sentences:
Passing data between engine layers I am building a software system (game engine with networking support ) that is made up of (roughly) these layers:

Game Layer
Messaging Layer
Networking Layer

Game related data is passed to the messaging layer (this could be anything that is game specific), where they are to be converted to network specific messages (which are then serialized to byte arrays).

I'm looking for a way to be able to convert "game" data into "network" data, such that no strong coupling between these layers will exist.

As it looks now, the Messaging layer sits between both layers (game and network) and "knows" both of them (it contains Converter objects that know how to translate between data objects of both layers back and forth).

I am not sure this is the best solution.

Is there a good design for passing objects between layers? I'd like to learn more about the different options.

sentences:
New Unity Post Processing - Default Project '3d With Extras' - What effect is causing this transparency in distant objects? I've recently seen in Unity you can start a new project with Extras included. Which is basically some post processing to make it look nicer as standard, as well as some assets/materials etc to get you started.

I have started a new project like this. And you can drive a car around a fixed camera. But if the car goes a few metres (well maybe 10-30 metres or so) into the distance there is a sort of grey fog there and it makes much of the cars mesh become more and more transparent the further you go.

It doesnt look nice at all because parts of the car (like the windscreen) can still be seen,  whilst the car body is not visible.

My question is, what is this effect called and where do I alter/disable it:

sentences:
How to have separate UI section in Monogame? So I have a game, and you can move and attack and move the camera around, etc...but I want to have a section of the screen dedicated to Character info like health, etc.

How do I make a fixed section for that and have the game window next to it?

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:
Texture mapping on gluDisk I'm trying to map a brick texture on the edge of a fountain and I'm using gluDisk for that. How can I make the right coordinates for the disk? My code looks like this and I have only found a function that takes the texture along with the camera.

I want the cubic texture to be alongside of the fountain, but gluDisk does a linear mapping. How do I get a circular mapping?

void Fountain::Draw()
{
    glPushMatrix(); // push 1
    this->ApplyWorldMatrixGL();
    glEnable(GL_TEXTURE_2D); // enable texturing
    glPushMatrix(); // push 2
    glRotatef(90,-1,0,0); // rotate 90 for the quadric

    // also drawing more here...

    // stone texture
    glBindTexture(GL_TEXTURE_2D, texIDs[0]);
    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_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

    glPushMatrix(); // push 3
    glTranslatef(0,0,height);

    // spherical texture generation
    // this piece of code doesn't work as I intended
    glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
    glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
    glEnable(GL_TEXTURE_GEN_S);
    glEnable(GL_TEXTURE_GEN_T);

    GLUquadric *tub = gluNewQuadric();
    gluQuadricTexture(tub, GL_TRUE);
    gluDisk(tub, radius, outerR, nrVertices, nrVertices);
    gluDeleteQuadric(tub);
    glDisable(GL_TEXTURE_GEN_S);
    glDisable(GL_TEXTURE_GEN_T);

    glPopMatrix(); // pop 3
    // more drawing here...
    glPopMatrix(); // pop 2
    // more drawing here...
    glPopMatrix(); // pop 1
}

To refine my question a bit. This is an image of what it is at default (left) and of what I want (right). The texture should fit in the border of the disk, a lot of times. If this is possible with the texture matrix, than that's fine with me as well.

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:
How can I randomly pick points on a triangle? Please can help me for a geometry query, I am working out fast mesh to voxel algorithm without using rays and complex maths...

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

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

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

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

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

Thanks for any info's you may provide!

sentences:
Get object position on texture I'm rendering a 3D object to texture (2048x1600) and show this texture on a panel (1600x285) using a RawImage (2048x1600) component as child. This texture is rendered successfully on screen.

This 3d object contains several mountpoints as empty objects. Now I want to show several sprites to visualize those mountpoints on the texture (panel) at their corresponding screen position (must not pixel perfect).

I tried several camera transforms, but could not get the correct position values:

  var main = camera.WorldToScreenPoint(slot.mountpoint.position);
  Debug.Log("Maincam screenpos: " + main.ToString());

  RectTransform rect = this.GetComponentInParent<RectTransform>();
  Debug.Log("Rect size delta: " + rect.sizeDelta.ToString());

  Vector2 viewPos = camera.WorldToViewportPoint(slot.mountpoint.position);
  Debug.Log("Viewport pos : " + viewPos.ToString());

  Vector2 localPos = new Vector2(viewPos.x * rect.sizeDelta.x, viewPos.y * rect.sizeDelta.y);
  Debug.Log("Viewport pos local : " + localPos.ToString());

How I could realize this?

sentences:
How does 3D games work so fluent provided that each mesh's size is so big? I'm surprised to find that each mesh takes at least 5-6 MB,

how can a 3D game be so fluent when there are hundreds of models?

I'm expecting it will simply go out of memory or something else that makes the game un-playable..

What's the trick employed here?

sentences: When using MVC, what is the proper way to handle a view refresh when the model isn't ready? I'm about to start building a game and am having trouble understanding the proper course of action when it's time to refresh the screen, but the model hasn't finished its calculations. I assume this isn't a huge problem for my little 2d platformer, but with many complex games there must be some hefty calculations that don't render in 1/30th of a second - I see these games stutter, but what's going on? Is the view just skipping this cycle? Is it an observer that's waiting for the model and will hang until the model is ready? Or will it display the models current state without regard to the computations ongoing? What's the correct way to handle this situation?

sentences:
How 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:
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 to make one 3D object face another? I'm writing a simple 3D engine myself and I cannot figure out how to make one object face another. The problem begins with identifying which direction the target object is in relation to the second. Actually rotating an object is not a problem, but essentially identifying the direction a particular object is facing (let's say, by identifying the global direction a key facet is facing) is a problem.

sentences:
2D: Scaling a character with multiple RigidBody2Ds? So, this example is in the Godot Engine, but other engines porbably have this kind of problem, too:

I have a character with multiple RigidBody2Ds, that also has a bone skeleton for animation over them. Now, the problem is, that Godot's physics engine handles the transforms of the bodies, so they won't scale properly. If you scale the children (CollisionShape2Ds and Sprites) the positions will be off. Is anybody aware of a proper way to work around this? Being able to scale these kind of characters would be awesome.

Thanks for all your answers.
Greetings, Footurist

sentences:
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:
FLIXEL: hexagonal tiles not seamlessly tiling with each other I'm making a hex grid for our project using as3. I wonder why my hex grid isn't tiling properly.

Running my code within Flash CS6 produces seamless tiling

but on FlashDevelop it looks like this

Here is my code (in FlashDevelop):

    public class PlayState extends FlxState {
    private var player:PlayerSprite;
    private var hexMap:GenerateGrid;

    protected var hexagonWidth:int = 128;
    protected var hexagonHeight:int = 132;
    protected var hexagonNumber:Number = 0;
    protected var gridX_Size:int = 7;
    protected var gridY_Size:int = 10;

    public function PlayState() {

    }

    override public function create():void {
        FlxG.mouse.show();

        for (var yPos:int = 0; yPos < gridY_Size; yPos++) {
            for (var xPos:int = 0; xPos < gridX_Size; xPos++) {
                var hexagonX_Pos:Number = hexagonHeight * xPos + (yPos % 2) * hexagonWidth / 2;
                var hexagonY_Pos:Number = hexagonHeight * yPos / 4 * 3;
                hexagonNumber = xPos + yPos * gridX_Size;
                hexMap = new GenerateGrid(hexagonX_Pos - hexagonWidth, hexagonY_Pos - hexagonHeight);
                this.add(hexMap);
            }
        }

And for the class where the hex tiles are drawn

    public class GenerateGrid extends FlxSprite {
    [Embed(source = "../res/hextile_grass.png")] private var HexGrassPng:Class;

    public function GenerateGrid(X:Number = 0, Y:Number = 0):void {
        super(X, Y);

        var hex:FlxSprite = new FlxSprite();
        hex = loadGraphic(HexGrassPng, false, false);
        hex.x = X;
        hex.y = Y;
    }

    override public function update():void {
        //super.update();
    }
}

Any help would be greatly appreciated.

EDIT :
EDIT: I have noticed my mistake a while ago. Code should be var hexagonX_Pos:Number = hexagonWidth * xPos + (yPos % 2) * hexagonWidth / 2;

sentences:
Texturing (or seeing through) the back of a plane I've got a basic textured quad forming a plane. When I move the camera or rotate the plane to see the back of it, there is no texture there.

The effect I want is as if the plane were a clear piece of glass, so that I'd be seeing the texture from through the other side. I was hoping this was going to happen automagically. Is there an easy way to accomplish such a thing, or am I going to have to manually flip the texture and assign it to the back?

Thanks!

sentences:
Unable to remove class information in serialized json file using libgdx I am encountering a problem in serializing an array of objects to json file. Please let me know where I'm making the mistake.

Object to be serialized :

package components;

public class UserGameInfo {
private int level;
private boolean isLocked;

public UserGameInfo() {

}

public UserGameInfo(final int level, final boolean isLocked) {
    this.level = level;
    this.isLocked = isLocked;
}
public int getLevel() {
    return level;
}
public void setLevel(int level) {
    this.level = level;
}
public boolean isLocked() {
    return isLocked;
}
public void setLocked(boolean isLocked) {
    this.isLocked = isLocked;
}
}

Object definitions:

  public class LevelsInfoFileReader {
  private Json fileJson;
  private Logger logger;
  private Array<LevelObjects> levelObjectsList;
  private Array<UserGameInfo> userGameObjectsList;
  ....
  }

Code for serializing the object :

    //write to the file
    try {
        FileHandle newFile = Gdx.files.local(userInfoFilePath);
        fileJson.toJson(userGameObjectsList, Array.class, UserGameInfo.class, newFile);
        System.out.println(fileJson.prettyPrint(userGameObjectsList));
    } catch (final Exception e) {
        logger.error("Could not save user data to the filepath", e);
    }

1st approach :

File contents after serialization :
[{level:1},{level:2},{level:3,isLocked:true},{level:4,isLocked:true},{level:5,isLocked:true},{level:6,isLocked:true},{level:7,isLocked:true},{level:8,isLocked:true},{level:9,isLocked:true},{level:10,isLocked:true}]

The problem here is that, though no class information is displayed, the boolean variable is not shown for level1 and level2 in the serialized json file. However, I put a debug point and checked the array object before serialization. It does contain the list properly as shown int the attached snapshot
2nd approach
The second approach I tried was with pretty print. However, the class information of the array elements is also displayed in the .json file :

Following is the .json file content :

[
{
class: components.UserGameInfo
level: 1
}
{
class: components.UserGameInfo
level: 2
}
{
class: components.UserGameInfo
level: 3
isLocked: true
}
]

My final expected output is :

[
{
"level": 1,
isLocked : false
}
{
"level": 2.
isLocked : false
}
{
"level": 3,
isLocked: true
}
]

sentences: Learning to think like a programmer I'm pretty interested in game development and I've tried a couple of platforms and languages. Including libgdx and game maker studio, all without any real success. I'm currently using unity and it's the farthest I have ever gotten, but it just doesn't feel right. I follow tutorials and learn how to do certain things, but it just feels like I'm a parrot learning a new word I don't really understand what I'm doing just kind of memorizing stuff. I'm trying to become a good game developer, but I just don't know how to practice c# in a way where I will gain actual understanding and not just memorize a bunch of syntax. Thanks in advance I really need help.

sentences: How to do moving Rorschach using Perlin noise in c# without shaders? I want to be able to make a moving Rorschach using Perlin noise like in this question but I know nothing about shaders. Is there a way to do it in just c#?

sentences:
How do you handle aspect ratio differences with Unity 2D? I've gotten a lot of answers to this question, but they are all generic and generally not very useful.  None of the tutorials talk about aspect ratio and dealing with mobile devices and there are a zillion ways to do it, all seem to have gotcha's and flaws.

I really would love to know what successful games have used to handle different aspect ratios on iOS and Android without making a zillion different sized assets.

I am strictly speaking mobile, not desktop, specifically with Unity and I don't care about the UI, I only care about the gameplay canvas.

Issues I have in mind is when there are key things that have to be in certain places and cannot fall off the screen.  Using black bars on top or bottom is unacceptable these days.

sentences:
When should I load my resources? I'm making a game, and right now I'm working on the user interface. I'm just wondering when I should be loading my resources.

Should I do it in small pieces at a time?

Load resources for part 1 of menu
Run part 1 of menu
Free resources for part 1 of menu
Load resources for part 2 of menu
Run part 2 of menu
Free resources for part 2 of menu
(So on)

Or all at once?

Load resources for all parts of menu
Run part 1 of menu
Run part 2 of menu
(So on)
Free resources for all of menu

It would seem to me that the pros of the first method are that my code can be much cleaner, as I can isolate the resources to specific parts of my class:

class UI {
    method run() {
         part1();
         part2();
    }
    method part1() {
         // part1's resources can be declared here
    }
    method part2() {
         // part2's resources can be declared here
    }
}

Whereas with the second method, it will probably run faster, but then all my resources have to be global:

class UI {
    // resources are declared here
    method run() {
        part1();
        part2();
    }
}

I'm using OpenGL, so right now what I'm doing is loading all my textures and audio at once, but I'm allocating and freeing my Vertex Buffer Objects as they're needed. For those of you who have more experience writing games, what method do you think I should use?

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:
GLSL Core Functionality Geometry Shader examples I'm doing some research on geometry shaders and am having problems finding code examples/tutorials that does not use one of the extensions introduced before it was core functionality of OpenGL 3.2.

I'm looking for more modern approaches that doesn't use an extension.

Can anyone point me in the right direction?

I've already read the spec, but am looking for actually code examples.

sentences:
Unity MouseWheel weapon change I am trying to make a simple weapon change in Unity3D. The best way to do this is with the mouse scroll wheel, as far as I can see.

I googled on how to do this and found that I have to use Input.GetAxis("Mouse ScrollWheel"); I use this piece of code and print it. Still, I always get an value of 0.
any ideas? I just need to solve how to get the value first, I'll figure out the rest myself.

Code idea:

function Update () {
    print(WeaponNumber);

    if(Input.GetAxis("Mouse ScrollWheel")){
    WeaponNumber += Input.GetAxis("Mouse ScrollWheel");
    }
}

sentences:
Problems with converting from Screen Space to World Space I have an unproject function I've written, which takes in x and y values between -1 and 1, and a z value between 0 and 1 (0 is near plane, 1 is far plane).  I create a vector off of this, and multiply it onto Matrix.Invert(ViewMatrix * ProjectionMatrix) to get the world-space coordinates of that screen position at that depth.  The problem I'm having is that the given depth values don't result in the right position (at least as I understand it).

Above is a rough sketch of what I'm seeing.  The black lines are the frustrum edges, red lines are near and far plane, and green line is the plane drawn at the given z depth.  My assumption was that the depth would be linear, with z = 0.5 being halfway between the near and far plane, however the values all sit very close to the near plane until z is real close to 1, at which point it rapidly approaches the far plane.  Am I doing my calculations wrong somewhere?  Or did I just misunderstand how projections work?

sentences:
Procedurally generated 2d terrain for side scroller on Sega Genesis hardware? I'm working on the Sega Genesis that has a 8mhz Motorola 68000 CPU.

Any ideas on how to generate fast and decent 2d tile terrain for a side scroller in real time? The game would generate new columns or rows depending on the direction the player is scrolling in. The generation would have to be deterministic. The same seed value would generate the same terrain.

The style of game would be a platformer like Sonic The Hedgehog. Maximum size would be around 1024 x 1024 tiles, but smaller could also work.

A column or row doesn't have to be calculated every frame, just when a new one is needed. If the player moves 1 pixels a frame, then a new column is only needed every 8 frames.

I'm looking for algorithms that would satisfy the memory and CPU constraints of the hardware.

sentences:
Difference between texture.Load() and texture.Sample() methods in DirectX? The question is simply that: What is the difference between texture.Load() and texture.Sample() in DirectX?

I've used a Texture2D to store the depth in a pass of a DirectX Shader (with SharpDX), and now that I want to extract the depth from the texture I'm not sure which of the two methods I should use

sentences:
Canvas Infinite Map: How to have reappearing objects at static X,Y even when looping I made a html canvas example of an infinite scrolling map with objects in static places. As you can see in the Fiddle below, when you move left with the Arrow Keys, you can see that the map does not show the other ends tiles and the objects do not appear either.

After the position is changed to the opposite edge of the map, the tiles appear and the object from that side of the map appears.

I made this Fiddle by modifying another Fiddle but it gets my point across.
https://jsfiddle.net/n8d5kbau/

Is there any way to duplicate the one edge of the map or am I approaching this the right way? I have been searching for this all over the place, finally deciding to ask here.

Thanks in advance.

sentences:
Offset direction stops working when I get too close I have a script trying to get the gun aim at the target instead of the origin:

It's partially working.

but when I get too close with the mouse the player starts spinning

I would appreciate a help regarding why it happens and how to fix it.

sentences:
LibGDX - Turning TiledMapTiles into objects I'm working on a harvest moon type game and I've already created lots of assets and have a working player. Now the issue is with the tile map. I use Tiled Map Editor to make the map and it renders  fine.

But if I want to be able to turn grass into farmland and plant seeds and such to allow crops to grow, how would I do that?

It would be rather simple using different classes like a Farmland and Crop class and make so that Farmland has a Crop currentCrop; attached to it.
But putting this together while still using a Tilemap editor seems rather difficult, since I don't actually get any Tile objects from the .tmx.

The way I could do it with Tiled is in my MapManager class I could have a

public void setCell(int x, int y, int type) {
    Cell cell = new Cell();
    switch(type) {
    case 0:
        cell.setTile(map.getTileSets().getTile(0);
    break;
}

etc.

But it feels like that would be a pain to keep track on how much thing have grown and so on and just feels like a clumsy system.

Am I going about this the right way?

Thanks in advance!

sentences:
Causing Update loop with Coroutine Unity Total Noob Alert! < 7 days with C# and Unity

My Win Game screen becomes SetActive and my Player is SetActive false when you are standing in a trigger and crouch. That all works fine except you cant see the crouch animation because he is IMMEDIATELY SetActive false.

I tried to delay this by creating a coroutine. The problem with that is this is all happening in the Update function (or whatever it's called) because of the getkeydown for crouch. That gets called once per frame so my coroutine is trying to go off once per frame.

I tried creating a bool called isCoroutineStarted and set it to false and then set it to true in the Coroutine to break the loop but that didn't work either.

Don't know what to do so I reverted it back to before where it doesn't show my crouch animation.

Here's my script (It's attached to a Game Object with the trigger):

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

public class xxxxxx : MonoBehaviour {

    public bool xxx = false;

    [SerializeField]
    private GameObject youWinUI;

    [SerializeField]
    private GameObject player;

    // Determines whether or not the player is standing on the xxxxx
    void OnTriggerEnter2D (Collider2D other)
    {
        xxx = true;
    }

    void OnTriggerExit2D (Collider2D other)
    {
        xxx = false;
    }

    //Turns on Win screen and makes player disappear when crouch on xxx
    void Update ()
    {
        if (Input.GetKeyDown (KeyCode.S) && xxx == true) {
            youWinUI.SetActive (true);
            player.SetActive (false);
        }
    }
}

P.S. ignore the x's no stealsies lol. Also this piece of script works as intended I just want a delay so you can see the crouch animation.

sentences:
Ball bouncing and throwing, how to? I was given a task to make a 3D game for Android, but since I never programmed games and opengl until now I'm totally lost on how and where to start.
Right now I'm using libgdx framework to ease my development or at least I thought it would.
I looked into invaders libgdx demo, but everything is so confusing and not consistent with latest version of framework, and it also looks that it's not very clean and scalable approach.

I have two 3D models, ball and basket. Now I need to animate ball throwing with all the math for hitting the basket, bouncing from basket and floor etc.
So my question is can somebody please help me out or direct me to some useful resources about those kind of games.

I somehow managed to get ball moving by rendering ball model and calling glTranslatef to move it, but that's it, all it do is just moves constantly in same direction. I would like to pick it and throw it in arc to hit the basket.

sentences:
Spell Effects/Shaders I want to be able to achieve spell effects that cause a fragmenting/discoloring effect on the sprite. The first couple seconds of this video http://www.youtube.com/watch?v=HNCFh7mkvuc shows what I mean. When the enemy gets hit by an electric attack, the effect I'd like to achieve activates (in yellow).

I'll have to use shaders to do this (if I don't, other, practical ways to do it would be extremely helpful). I have no idea where to start with a shader like this (beyond the obvious - using time and base color as parameters), and was curious if someone had something similar I could use as a base, or had a good idea where to start. I know the basic of glsl, but was hoping to spare myself some pain if someone has something like this already or could provide a starting point.

Any help would be appreciated,

thanks

Just to clarify, I'm looking to apply this against a 2D texture in OpenGL using glsl shaders

sentences:
Calculate XP needed for next Level using this simple algorithm? I am currently calculating the Levels in my game using the following forumla:

player.level = mathFLOOR(mathMAX(1, 0.05 * mathSQRT(player.score)) * (1 + player.kd / 10));

So the level is based on the persons total score and their kd. However I am now trying to figure out a formula for calculating the percentage of the score/kd you need to progress to the next level. If this is not possible, how could I do it with just this formula:

 player.level = mathFLOOR(mathMAX(1, 0.05 * mathSQRT(player.score)));

Thank you for your time.

sentences:
Two Gameloops instead of one, wouldn't it be better? I have been thinking about this a lot and don't know if i'm thinking incorrectly.

Most games have one game loop that can be split into three functions.
A basic game loop would look something like this:

while(true){
    handle_Input();
    update();
    render();
}

It's good when the handle_Input() and update() function are called as often as possible to create more responsive controls. But there is no point in calling the render() function more often then your monitor refresh rate. You could of course limit the speed of the loop in order to hit your monitor refresh rate but it would make the controls less responsive.

Wouldn't it be better to create two game loops?

The first game loop would call the handle_Input() and update() function as fast as possible, while the second game loop would take the latest frame the first game loop calculated and only call the render() function.
The speed at which the secend game loop runs would be limited by the monitor refresh rate. In order for the concept to work, the game loops should be running on separate processor cores.

Wouldn't this create a lot less overhead for both the CPU and GPU by not wasting time on the worthless render() calls? And allow the game to either run with a higher fps count or better graphics? Wouldn't it also allow to give unbalanced systems, which have a weak GPU compared to the CPU, a more playable experience, because the weak GPU would only limit the fps you see but not the handle_Input() and update() calls?

I have never seen somebody implement a concept like which make me think something like this wouldn't work.

sentences:
How to stream a game inside an app I would like to build an app like the onw downloadable from here https://playhatch.com/.
How is it possible, technically speaking, to achive such result? Need I to implement some instant app feature? Need I to instantiate a kind of android runtime like a "mini docker image"? What's the technical concept which allows to implement such a feature?

Many thanks

sentences:
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:
Arcball Problems with UDK I'm trying to re-create an arcball example from a Nehe, where an object can be rotated in a more realistic way while floating in the air (in my game the object is attached to the player at a distance like for example the Physics Gun) however I'm having trouble getting this to work with UDK.

I have created an LGArcBall which follows the example from Nehe and I've compared outputs from this with the example code.

I think where my problem lies is what I do to the Quaternion that is returned from the LGArcBall.

Currently I am taking the returned Quaternion converting it to a rotation matrix. Getting the product of the last rotation (set when the object is first clicked) and then returning that into a Rotator and setting that to the objects rotation.

If you could point me in the right direction that would be great, my code can be found below.

class LGArcBall extends Object;

var Quat StartRotation;
var Vector StartVector;
var float AdjustWidth, AdjustHeight, Epsilon;

function SetBounds(float NewWidth, float NewHeight)
{
    AdjustWidth = 1.0f / ((NewWidth  - 1.0f) * 0.5f);
    AdjustHeight = 1.0f / ((NewHeight - 1.0f) * 0.5f);
}

function StartDrag(Vector2D startPoint, Quat rotation)
{
    StartVector = MapToSphere(startPoint);
}

function Quat Update(Vector2D currentPoint)
{
    local Vector currentVector, perp;
    local Quat newRot;

    //Map the new point to the sphere
    currentVector = MapToSphere(currentPoint);

    //Compute the vector perpendicular to the start and current
    perp = startVector cross currentVector;

    //Make sure our length is larger than Epsilon
    if (VSize(perp) > Epsilon)
    {
        //Return the perpendicular vector as the transform
        newRot.X = perp.X;
        newRot.Y = perp.Y;
        newRot.Z = perp.Z;

        //In the quaternion values, w is cosine (theta / 2), where
        //theta is the rotation angle
        newRot.W = startVector dot currentVector;
    }
    else
    {
        //The two vectors coincide, so return an identity transform
        newRot.X = 0.0f;
        newRot.Y = 0.0f;
        newRot.Z = 0.0f;
        newRot.W = 0.0f;
    }

    return newRot;
}

function Vector MapToSphere(Vector2D point)
{
    local float x, y, length, norm;
    local Vector result;

    //Transform the mouse coords to [-1..1]
    //and inverse the Y coord
    x = (point.X * AdjustWidth) - 1.0f;
    y = 1.0f - (point.Y * AdjustHeight);

    length = (x * x) + (y * y);

    //If the point is mapped outside of the sphere
    //( length > radius squared)
    if (length > 1.0f)
    {
        norm = 1.0f / Sqrt(length);

        //Return the "normalized" vector, a point on the sphere
        result.X = x * norm;
        result.Y = y * norm;
        result.Z = 0.0f;
    }
    else //It's inside of the sphere
    {
        //Return a vector to the point mapped inside the sphere
        //sqrt(radius squared - length)
        result.X = x;
        result.Y = y;
        result.Z = Sqrt(1.0f - length);
    }

    return result;
}

DefaultProperties
{
    Epsilon = 0.000001f
}

I'm then attempting to rotate that object when the mouse is dragged, with the following update code in my PlayerController.

    //Get Mouse Position
    MousePosition.X = LGMouseInterfacePlayerInput(PlayerInput).MousePosition.X;
    MousePosition.Y = LGMouseInterfacePlayerInput(PlayerInput).MousePosition.Y;

    newQuat = ArcBall.Update(MousePosition);

    rotMatrix = MakeRotationMatrix(QuatToRotator(newQuat));
    rotMatrix = rotMatrix * LastRot;

    LGMoveableActor(movingPawn.CurrentUseableObject).SetPhysics(EPhysics.PHYS_Rotating);
    LGMoveableActor(movingPawn.CurrentUseableObject).SetRotation(MatrixGetRotator(rotMatrix));

sentences:
MonoGame not all letters being drawn with DrawString I'm currently making a dynamic user interface for my game and are setting up having text on my buttons. I'm having an odd issue where, when i use a specific piece of code to determine the text position, it will not render all of the text passed to DrawString. Even weirder, is if i insert another DrawString after this, drawing more text at a different place, different parts of the text will be drawn.

The code for drawing my button with the text attached is:

public override void Draw(SpriteBatch sb, GameTime gt)
{
    sb.Draw(currentImage, GetRelativeRectangle(), Color.White);
    sb.DrawString(font, text,
        new Vector2(this.GetRelativeDrawOffset().X + this.Width / 2 - font.MeasureString(text).X / 2,
            this.GetRelativeDrawOffset().Y + this.Height / 2 - font.MeasureString(text).Y / 2), textColor);
}

The methods in the creation of the Vector2 simply get the draw position of the button. I'm then doing some calculation to center the text.

This produces this when the text is set to 'Test':

And when i enter this piece of code below the first DrawString:

sb.DrawString(font, "test", new Vector2(500, 50), Color.Pink);

I should mention that that grey square is being drawn in the same spritebatch, before the button and the text.

Any ideas as to what could be causing this? I have a feeling it may be due to draw order, but i have no idea how to control that.

sentences: Help me to find a simple 3D game development tutorial in Unreal Engine 4 I am looking already several hours to find a UE4 tutorial that creates a simple 3D game from scratch, but not using Blueprint. Instead I would like to see complete C++ tutorial. Cannot find any resource! Maybe unreal gurus can help on this? A single link of a game from scratch that is being created using C++ with UE4.

sentences:
How to create a perspective field of view matrix? Hey, hello. I am learning a little of WebGL (OpenGL ES 2.0) through the http://learningwebgl.com tutorials, but it uses a third party library to create the View, Projection and transformation matrices (glutils.js). Well, I don't really like the idea of depending on a non standard library, so I am trying to learn how to create these matrices by myself.

I've already managed to understand most of it, and although I can't really tell why these matrices work if someone asks me, at least I know how to build them when I need to. Now I have my own lib to work with 4x4 matrices. I can create translation, scale, rotation and the lookAt matrix, but, I am having a hard time finding out how to create the perspective matrix. Anyone could help me out?

Here is my lib: http://pastebin.com/csMi9GuC

sentences:
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:
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 can I store point voxel terrain in octrees I am writing a voxel engine in LWJGL3 - binding for OpenGL 4 for JVM.
Recently I implemented an octree storage of cubic voxels.
In my implementation each leaf node of an octree has one voxel, voxels can't overlap each over.
But now I changed my mind and my goal is to create a dynamic point voxel engine.
How can I store point voxels in an octree ?
My reference is EverQuest Next Landmark.

sentences:
What is the difference between a sprite sheet and a texture atlas? I wondering what the difference is between a sprite sheet and a texture atlas?

Aren't both the same? In a sprite sheet you have some Sprites and in a texture atlas you also have some sprites, so what's the difference?

sentences: Source control for storing everything of game project? Is it usual to manage not only source code, but all assets, textures, art, documentation files, etc under git repository for version controlling? For example I wanna to get back old version of texture. If it is very bad practice what tools do you use for version control of assets and other stuff?

sentences:
How to predict where the soccer ball should be intercepted by an AI player after being kicked? This question has been asked many times before, but most of the answers give solution to the problem where ball (target) is assumed to be moving at a constant velocity.
In my scenario, I'm making a football game. When I kick the ball into a direction by applying some force to the ball's rigidbody, I want a second AI player to find the point in the ball's path where he can intercept the ball. Now this ball can keep slowing down per frame, it does not keep moving with a constant speed.
I have attached an image for visualisation.

I know the ball's position, ball's current velocity, AI player's position, AI player's constant speed. How do I find such a point, where AI player can intercept the ball?
I am able to calculate such a point with the current velocity of the ball, but that point is not accurate, and changes as ball's current velocity changes per frame, as the ball can keep slowing down after every frame. This makes the AI player act kind of like a homing missile. Instead, I want the AI player to predict a point and just run to it.
Here's the C# (Unity) Code I have till now:
public Vector3 CalculateIntercept()
{
     Vector3 pos = Ball.GetInstance().transform.position;
     Vector3 dir = Ball.GetInstance().GetVelocity();
     dir.y = transform.position.y;

     float dist = (pos - transform.position).magnitude;
     return pos + (dist / 6.17f) * dir; //6.17 is the AI player's constant speed.
}

There's no drag on the ball, but there is a physics material with friction. I suppose to solve this, I might need to account for acceleration maybe.
Please help me figure this out. Thanks!

sentences:
Making an object hang This image is pretty self explanatory I hope:

How can I achieve this effect without animating it? I want to avoid animations as there are many objects hanging and I dont want them to move the exact same way.

sentences:
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:
Mesh contents get flipped I am using below shader with my mesh object that is showing a webpage. It is showing fine but the problem is the web page has flipped:
 Shader "UI/Default_OverlayNoZTest"
 {
     Properties
     {
         [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
         _Color ("Tint", Color) = (1,1,1,1)

         _StencilComp ("Stencil Comparison", Float) = 8
         _Stencil ("Stencil ID", Float) = 0
         _StencilOp ("Stencil Operation", Float) = 0
         _StencilWriteMask ("Stencil Write Mask", Float) = 255
         _StencilReadMask ("Stencil Read Mask", Float) = 255

         _ColorMask ("Color Mask", Float) = 15
     }

     SubShader
     {
         Tags
         {
             "Queue"="Overlay"
             "IgnoreProjector"="True"
             "RenderType"="Transparent"
             "PreviewType"="Plane"
             "CanUseSpriteAtlas"="True"
         }

         Stencil
         {
             Ref [_Stencil]
             Comp [_StencilComp]
             Pass [_StencilOp]
             ReadMask [_StencilReadMask]
             WriteMask [_StencilWriteMask]
         }

         Cull Off
         Lighting Off
         ZWrite Off
         ZTest Off
         Blend SrcAlpha OneMinusSrcAlpha
         ColorMask [_ColorMask]

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

             struct appdata_t
             {
                 float4 vertex   : POSITION;
                 float4 color    : COLOR;
                 float2 texcoord : TEXCOORD0;
             };

             struct v2f
             {
                 float4 vertex   : SV_POSITION;
                 fixed4 color    : COLOR;
                 half2 texcoord  : TEXCOORD0;
             };

             fixed4 _Color;

             v2f vert(appdata_t IN)
             {
                 v2f OUT;
                 OUT.vertex = mul(UNITY_MATRIX_MVP, IN.vertex);
                 OUT.texcoord = IN.texcoord;
 #ifdef UNITY_HALF_TEXEL_OFFSET
                 OUT.vertex.xy += (_ScreenParams.zw-1.0)*float2(-1,1);
 #endif
                 OUT.color = IN.color * _Color;
                 return OUT;
             }

             sampler2D _MainTex;

             fixed4 frag(v2f IN) : SV_Target
             {
                 half4 color = tex2D(_MainTex, IN.texcoord) * IN.color;
                 clip (color.a - 0.01);
                 return color;
             }
         ENDCG
         }
     }
 }

I am using above shader so that the mesh should be shown on top of everyting.

sentences:
Algorithm for chase by multiple enemies If I have one enemy that should chase the player, I can use a path-finding algorithm such as BFS to find the shortest path from the enemy to the player (taking into account obstacles along the way), and advance the enemy along the path.

But if there are two enemies, this is not necessarily the most efficient strategy. For example, if there is a large obstacle, instead of both enemies chasing the player from the east, it may be more efficient for tnem to cooperate, one of them should go chase the player from the east while the other blocks the player's escape route from the west.

My question is: what is an algorithm for efficiently coordinating the chase behavior of two enemies?

sentences:
The math behind Variance Shadow Maps - moments I am not asking how to implement them (that's not particularly difficult), but I'm having a bit of trouble understanding why the moments used in Chebyshev's inequality (indirectly) are equal to the depth value and the depth squared respectively.

To grasp why things are like this, I tried to understand what the random variable one computes the moments for is, and what is its density (the p(x) in those integrals used to compute the moments). Now that one can equate the moments to the depth and depth^2 is the magic behind this approach, hence the key of justifying it mathematically. Can anyone please explain what p(x) is, and why is the first moment equal to the depth value? I can probably pick up from there and easily understand the second moment.

sentences:
Character movement resetting x & y position in HTML5 game I have an HTML5 game I'm working on and I'm at the point where I'm trying to make the character move.  For the most part, the character(A rectangular square) is moving, but it's not moving from its starting position.  Instead, when I hit the move key the character's x position and y position are reset to 0, 0.  My question is, why is the character's position being set to 0, 0 before it starts moving?

I've included a link to the dropbox with the project so it's easier to see what's going on, but here's the movement script for reference.

initMap.js Script, lines 81 - 92

case "Player":
    gameObjectsLayerCtx.fillStyle = "rgb(0, 0, 0)";
    gameObjectsLayerCtx.fillRect(xPos, yPos, destWidth / 3, destHeight / 3);
    window.onkeydown = function(ev){
        var key = ev.key;
        if(key == "w"){
            yPos += 5;
            gameObjectsLayerCtx.clearRect(0, 0, gameObjectsLayer.width, gameObjectsLayer.height);
            gameObjectsLayerCtx.fillRect(xPos, yPos, destWidth / 3, destHeight / 3);
        }
    };
    break;

Project

The script is the initMap.js script and the movement functionality is from lines 81 - 92

The character's starting position

Where the character moves to when pressing the move key

sentences:
clamp a 2D coordinate to fit within an ellipse I need to clamp a 2D coordinate to fit within an ellipse.

Call of Duty: Modern Warfare 2 does something similar where capture points are translated from a 3D vector in the world to a 2D screen coordinate and then the 2D coordinates are clamped within an ellipse.

When the capture points are in view they're within the bounds of the ellipse.

When they're behind you they are clamped to be within the bounds of the ellipse.

Given a 2D coordinate that could be off screen, etc, what is the math behind clamping it within an ellipse?

sentences:
How do I use render targets in XNA? I'm trying to render text (or whatever) off screen. But I have a strange issue where the render target size matches the window size and not the render targets size. Yes, it is a contradiction! Here's the render target:

And here's the code, chopped up and put together to demonstrate what's happening in one place :

UserInterface.SpriteBatch.Begin(SpriteSortMode.Immediate,
                                BlendState.AlphaBlend,
                                SamplerState.PointClamp,
                                DepthStencilState.None,
                                RasterizerState.CullNone);

RenderTarget2D rt = new RenderTarget2D(UserInterface.GraphicsDevice, 200, 200);
UserInterface.GraphicsDevice.SetRenderTarget(rt);

UserInterface.GraphicsDevice.Clear(Color.Blue);

Rectangle rect = new Rectangle(0, 0, 200, 200);
UserInterface.SpriteBatch.Draw(pixel, rect, Color.White);

renderTarget.GraphicsDevice.SetRenderTarget(null);

UserInterface.SpriteBatch.End();

if (frame == 0)
    rt.SaveAsJpeg(File.OpenWrite("renderTarget.jpg"), rt.Width, rt.Height);

The render target is created at 200x200, I then set the render target on the graphics device. I clear it to blue and draw a pixel at 200x200 (in white). Lastly, I save off the render target.

But why does the sprite batch render the pixel in proportion to the window (just take my word that it is rectSize / WindowSize * RTSize) rather than filling the render target which I believe it should do in this case?

sentences:
Best practices for client-server communication in an online Android game I'm developing an online RPG game for my "Object-Oriented Programming" module laboratory project. The client part must be written in C#, also using Unity 3D as a graphics engine.

The problem is that I don't know how to make the client-server communication rapid. How to achieve that every player sees other players' actions in real time on his device.

I want to get some recommendations on how to implement the client-server communication so that everything happens very quickly, i.e. when some player changes his position in a game, this change is immediately sent to all the other players' devices.

Of course, I also want to save all the players' current states in a database, so that they start where they left off the last time they logged out.

For the server side development, I'd prefer linux environment, but the language in which the server part will be written doesn't really matter to me. I just want it to be very fast.

sentences:
Achieving 2D Lighting for Terraria-Like Game I'm trying to achieve the fog-of-war lighting style that Terraria and Starbound have. Terraria's lighting system seems to be more blocky/tile based, but Starbound's is a lot more smooth.

The Desired Effect:

Starbound is using a shader to render its lighting, but how it's going about that is quite a mystery to me.

The idea I had on how to achieve the desired effect is the following: Create a texture that is black and somehow calculate the area that is white, storing this in a light map render texture, finally doing an Additive Blend of both the main texture and the light map texture to achieve a similar effect to Starbound's. (However this does not take into account lights in the world, which I also have absolutely no clue how to include in my calculation to the light map render texture)

I say somehow in italics because I have no clue as to how I can create this "Mask" effect in the light map render texture. How I can do calculations necessary to create the mask is beyond me; I don't even know how I can begin to translate the game world's data, relative to the what the camera sees, and update the texture accordingly.

TLDR: How can I achieve lighting similar to that of either Terraria or Starbound in Unity 2D?

sentences:
Drawing realistic 2d waves with SDL2 and Rust I am making a very simple 2d topdown sailing simulator with Rust and rust-sdl2. I am having a very hard time figuring out how I should implement wave rendering. My current idea is to use a Vec<Spring> and render all of the wave shading on top of these springs. But I have no idea how this rendering should be done. Here is an image which mostly represents the effect I want:

Most questions here are to do with OpenGL which I have no experience with and don't understand at all. Any pseudocode would be particularly helpful!

sentences:
Unity - Trying to copy the render texture for the scene rendered by a camera but it is blank? I'm trying to copy the scene rendered by a particular camera to a render target.  I know this should be possible to do without using the camera's target texture as I read through this official Unity article about Command Buffers which avoids any use of them.

Instead, I found that they use the following code in the renderer for blurry refractions (CommandBufferBlurRefraction.cs) to copy the scene to a render target.

    buf = new CommandBuffer();
    buf.name = "Grab screen and blur";
    m_Cameras[cam] = buf;

    // copy screen into temporary RT
    int screenCopyID = Shader.PropertyToID("_ScreenCopyTexture");
    buf.GetTemporaryRT(screenCopyID, -1, -1, 0, FilterMode.Bilinear);
    buf.Blit(BuiltinRenderTextureType.CurrentActive, screenCopyID);

The problem is that I can't get this to work for myself using a very simple scenario of:

Camera renders the entire scene which is a single hexagonal sprite
The command buffer assigned to the camera grabs the BuiltinRenderTextureType.CurrentActive (Scene Render Target)
The command buffer then copies that to another render target
That render target is then drawn in the upper left of the screen on a yellow background

This results in the scene render target being completely blank and not including the white hexagon.

The code I am using is

Camera cameraUsedToRender;
CommandBuffer commandBuffer;
RenderTexture debugRT;
Texture2D debugRTBackground;

void Awake()
{
    // Create debug texture to render
    debugRTBackground = new Texture2D(2, 2);
    debugRTBackground.SetPixels(new Color[4] { Color.yellow, Color.yellow, Color.yellow, Color.yellow });
    debugRTBackground.Apply();

    cameraUsedToRender = Camera.main;
    cameraUsedToRender.orthographicSize = 10f;

    // Create debug render texture to render to using our camera
    debugRT = new RenderTexture(cameraUsedToRender.pixelWidth, cameraUsedToRender.pixelHeight, 16);
    debugRT.Create();

    // Create command buffer
    commandBuffer = new CommandBuffer();
    commandBuffer.name = "Debug";

    // Add the camera buffer to the main camera
    cameraUsedToRender.AddCommandBuffer(CameraEvent.BeforeImageEffectsOpaque, commandBuffer);
}

void OnRenderObject()
{
    // Clear the command buffer
    commandBuffer.Clear();

    // Set the render target
    commandBuffer.SetRenderTarget(debugRT);

    // Clear the render target
    commandBuffer.ClearRenderTarget(true, true, Color.blue);

    // Copy scene into a render target
    // RenderTarget.active = SceneView RT (UnityEngine.RenderTexture)
    commandBuffer.Blit(BuiltinRenderTextureType.CurrentActive, debugRT);

    // Release the render target
    commandBuffer.SetRenderTarget(null as RenderTexture);
}

void OnGUI()
{
    // Draw the debug render target (which should have the SceneView RT copied to it)
    GUI.DrawTexture(new Rect(0, 0, 130, 130), debugRTBackground);
    GUI.DrawTexture(new Rect(1, 1, 128, 128), debugRT);
}

The complete small, simple project that demonstrates this issue can be found here.

Does anyone have an idea how to resolve this as I'm finding the Unity rendering pipeline to be rather confusing at this point?

sentences:
Is this a correct backward Euler implementation? I want to simulate a mechanic object like this:

init acceleration a;
init velocity v;
init position x;
loop {
  get delta time dt;
  v = v + a*dt;
  x = x + v*dt;
}

I use the velocity (which is the derivative of position) at the end of each time step to approximate the new position. So this should be exactly what the backward euler method does.

Do I have an error in reasoning?

sentences:
LibGDX How to set spacing between list items in a Scene 2D Select Box Widget? I have created a Select Box (Scene2D widget) which holds a list of items, to be selected. My code works fine, but I would like to make a little more spacing between each list item in the dropdown list in the select box. How can I achieve that??

My code for the list box is this.

List.ListStyle selectBoxListStyle = new List.ListStyle();
selectBoxListStyle.background = new NinePatchDrawable(new NinePatch(this.selectBoxListBackgroundTexture, 10, 10, 10, 10));
selectBoxListStyle.font = this.textFieldFont;
selectBoxListStyle.fontColorSelected = Color.WHITE;
selectBoxListStyle.fontColorUnselected = Color.BROWN;
selectBoxListStyle.selection = new TextureRegionDrawable(new TextureRegion(this.textFieldSelectionTexture));

SelectBox.SelectBoxStyle selectBoxStyle = new SelectBox.SelectBoxStyle();
selectBoxStyle.background = new TextureRegionDrawable(new TextureRegion(this.selectBoxMiddleBackgroundTexture));
selectBoxStyle.backgroundOpen = new TextureRegionDrawable(new TextureRegion(this.selectBoxMiddleActiveBackgroundTexture));
selectBoxStyle.font = this.textFieldFont;
selectBoxStyle.fontColor = Color.WHITE;
selectBoxStyle.listStyle = selectBoxListStyle;
selectBoxStyle.scrollStyle = new ScrollPane.ScrollPaneStyle();

SelectBox<String> selectBoxWidget = new SelectBox(selectBoxStyle);
selectBoxWidget.setItems("Test 1", "Test 2", "Test 3");

sentences:
How do games implement client/server frame rate? Do games have a frame rate at X fps that updates logic and also renders?

Or do games update logic at a much slower frame rate than rendering?  Let's say 20-25 fps for logic, and 60+ fps for rendering.

I am writing a game engine and I am a bit confused on how frame rate is handled.

If I were to run logic slower than rendering, then wouldn't I just be wasting the rendering frames because it is rendering the same thing over and over...? Unless I also interpolate the rendering with a delta.

I have read some game servers run at a much slower frame rate (let's say 20 FPS), so shouldn't the client also run logic at 20 FPS?

sentences:
How can I consistently identify location on a mesh from a raycast hit? I am using RaycastHit.triangleIndex to identify a location on a mesh (very low poly). However, I have discovered that a given triangle on the mesh does not have the same triangleIndex value from one execution of the game to the next (index "1" maps to location "A" on the first run, but location "B" on the second run). It is consistent within a given game, but for my mapping to work I need it to be consistent across games.

Given that I am using Raycast, how can I consistently identify the same logical location on the model?

Notes:

The game object must be instantiated from a prefab (there are a variable number of them), so it could be that this is why the vertex order changes? Is there a way to instantiate with consistent vertex order?
If I need to ask the artist to recreate the asset with submeshes for each location, will I be able to consistently identify those?

sentences:
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:
How to go about an intermediate collision resolution system? I would like to know a better way of collision resolution than I am currently doing. My current collision system stores the current positions and previous positions of each object. When an object collides with another it sets the current positions to the previous positions.

This would work fine if objects could only move in four directions, but when they can move in more than four directions the system doesn't work. For example if you are moving an object_A up and right and it collides with and object_B above it, the object_A stops moving even if still going up and right. In most 2d games however if this scenario happened the object_A would stop moving up but continue to move right. This is the kind of collision resolution that I would like to implement. I don't need anymore complicated physics right now this will do.

I'm just using rectangles so that would be the only shape I need to worry about.

sentences:
jMonkeyEngine ignores keyboard input Created a game login form using the Nifty GUI. The interface reacts to the movement and clicking of the mouse, but ignores the input in the text fields. Whether the program is looking for a click handler, instead of typing, or I don’t know what. What could be the case and how to fix it?

Interface/screen.xml:

<?xml version="1.0" encoding="UTF-8"?>
<nifty xmlns="http://nifty-gui.lessvoid.com/nifty-gui" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://raw.githubusercontent.com/void256/nifty-gui/1.4/nifty-core/src/main/resources/nifty.xsd
https://raw.githubusercontent.com/void256/nifty-gui/1.4/nifty-core/src/main/resources/nifty.xsd">
    <useStyles filename="nifty-default-styles.xml"/>
    <useControls filename="nifty-default-controls.xml"/>
    <screen id="start" controller="mygame.LoginScreen">
        <layer id="background" childLayout="center">
            <image filename="Interface/start-background.jpg"></image>
        </layer>
        <layer id="foreground" childLayout="center">
            <panel id="panel" height="25%" width="75%" align="center" childLayout="horizontal">
                <panel id="panel_left" height="100%" width="25%" align="left" childLayout="vertical">
                    <text text="E-mail:" font="Interface/Fonts/Default.fnt"/>
                    <text text="Password:" font="Interface/Fonts/Default.fnt"/>
                </panel>
                <panel id="panel_center" height="100%" width="50%" align="center" childLayout="vertical">
                    <control name="textfield" maxLength="50" font="Interface/Fonts/Default.fnt"/>
                    <control name="textfield" maxLength="100" passwordChar="*" font="Interface/Fonts/Default.fnt"/>
                </panel>
                <panel id="panel_right" height="100%" width="25%" align="right" childLayout="vertical">

                </panel>
            </panel>
        </layer>
    </screen>
    <screen id="hud" controller="de.lessvoid.nifty.screen.DefaultScreenController">

    </screen>
</nifty>

src/mygame/Main.java:

package mygame;

import com.jme3.app.SimpleApplication;
import com.jme3.renderer.RenderManager;
import com.jme3.niftygui.NiftyJmeDisplay;
import de.lessvoid.nifty.Nifty;

public class Main extends SimpleApplication {

    public static void main(String[] args) {
        Main app = new Main();
        app.start();
    }
    public String driver = "org.apache.derby.jdbc.EmbeddedDriver";
    public Nifty nifty = null;
    @Override
    public void simpleInitApp() {
        NiftyJmeDisplay niftyDisplay = NiftyJmeDisplay.newNiftyJmeDisplay(assetManager, inputManager, audioRenderer, guiViewPort);
        nifty = niftyDisplay.getNifty();
        nifty.fromXml("Interface/screen.xml", "start");
        guiViewPort.addProcessor(niftyDisplay);
        inputManager.beginInput();
        flyCam.setDragToRotate(true);
    }

    @Override
    public void simpleUpdate(float tpf) {
        //TODO: add update code
        nifty.update();
        inputManager.update(tpf);
    }
}

src/mygame/LoginScreen.java:

package mygame;

import com.jme3.app.Application;
import com.jme3.app.state.BaseAppState;
import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.screen.Screen;
import de.lessvoid.nifty.screen.ScreenController;

public class LoginScreen extends BaseAppState implements ScreenController {

    @Override
    protected void initialize(Application app) {

    }

    @Override
    protected void cleanup(Application app) {

    }

    @Override
    protected void onEnable() {

    }

    @Override
    protected void onDisable() {

    }
    @Override
    public void update(float tpf) {

    }

    @Override
    public void bind(Nifty nifty, Screen screen) {

    }

    @Override
    public void onStartScreen() {

    }

    @Override
    public void onEndScreen() {

    }
}

sentences:
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:
Activate and Deactivate Mouse Cursor on UI I have a player with a character controller component.

When the player is generally interacting with the UI I would like to stop the character and camera controller and show the cursor to the player in order to (e.g select a weapon) and when they're done I would like it to switch back.

How do I address this issue?

sentences:
How do you get the player's last car in GTA IV? I am developing a car control plugin for GTA IV and everything is working except the lock/unlock doors feature.

Despite using the Player.LastVehicle handle, the code only works while the player is in the car. How can I get the code to work when the player is inside or outside the car?

Here's what I have so far:

'Lock/Unlock
        If e.Key = Keys.OemPipe AndAlso e.Control Then
            'Lock Codes: 1 - Unlocked; 2 - Locked (Player & NPCs); 3 - Locked (Player); 4 - Locked (Player, Inside); 7 - Locked (Can Break Into)
            If DoorLock = False Then
                Player.LastVehicle.HazardLightsOn = True
                Wait(1000)
                Player.LastVehicle.HazardLightsOn = False
                Native.Function.Call("LOCK_CAR_DOORS", Player.LastVehicle, 2)
                DoorLock = True
                Game.DisplayText("Vehicle Locked")
            Else
                Player.LastVehicle.HazardLightsOn = True
                Wait(2000)
                Player.LastVehicle.HazardLightsOn = False
                Native.Function.Call("LOCK_CAR_DOORS", Player.LastVehicle, 1)
                DoorLock = False
                Game.DisplayText("Vehicle Unlocked")
            End If
        End If

sentences:
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:
When should I use instancing versus a constant buffer? I've heard something about instancing and understood it's useful for drawing the same object many times with slight changes. It's faster because you call the draw function once per frame and update the buffer (in this case the instance buffer) once per frame too while with constant buffers, for example, if you need a world matrix you have to update your constant buffer once per object.

But if I have only one object, would instancing be faster (or at least as fast as) using a constant buffer? With instancing, you have to call only an update buffer function (for the vertex-instance buffer) while with CB you need two calls: one for the vertex buffer and one for the constant buffer.

Another question about instancing:

Since I have to update the instance buffer once per frame, I need to create it with DYNAMIC_USAGE and with a byte width representing the maximum number of objects I can draw with one call. For example, if I want to pass a matrix, I need insBufferdesc.bwitdh= sizeof(matrixtype)*maxNumObjs. Is this right? Given that maxNumObjs is 20 and I want to render only 10 objs, I've should just update the first 10 matrices of the buffer and call drawInstanced(..., 10). Will I get some error if I don't use all of the buffer?

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

Is it because I am passing the smart pointer incorrectly?

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

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

sentences:
How do I get the mouse position relative to the window, not the whole screen? I am developing an XNA game. I run it in window mode.

I need to handle mouse events, but when I use the Mouse class from Xna.Framework.Input.Mouse, I get the the mouse position on the whole screen.

I use this code:

MouseState state = Mouse.getState();
Point position   = new Point(state.X,state.Y);

Rectangle hitbox = new Rectangle(180, 410, 14, 14);

if (area.Contains(mousePosition))
{
    //fire event
}

How do I detect the mouse position within the current game window?

sentences:
How to handle focus on a custom actor in Unreal Engine? I created a custom actor, placed it on my scene and selected it.

When I press "F" to focus on it, the camera zoom back very far from the scene, probably because I didn't implement the method supposed to return the bounding box of my actor.

How can I do that?

Update

I implemented a custom component which delegates all drawing functions to an internal ULineBatchComponent member. I unregistered this ULineBatchComponent member. The custom component is not even attached to the actor root component.

But its bounding box is still taken into account when focusing on the actor.

UPBLineBatchComponent.h

UCLASS()
class UPBLineBatchComponent : public UObject
{
    GENERATED_UCLASS_BODY()
public:
    virtual FBoxSphereBounds CalcBounds(const FTransform& LocalToWorld) const;
    void SetTransform(const FTransform &Transform);
    virtual void DrawLine(...);
    virtual void DrawPoint(...);
    void Flush();
    ULineBatchComponent* LineBatchComponent;
    FBox LocalBounds;
};

UPBLineBatchComponent.cpp

UPBLineBatchComponent::UPBLineBatchComponent( const FObjectInitializer& ObjectInitializer )
        : Super( ObjectInitializer )
{
    LineBatchComponent = CreateDefaultSubobject<ULineBatchComponent>(TEXT("LineBatcher"));
    LineBatchComponent->UnregisterComponent();
    LocalBounds = FBox(0);
    LineBatchComponent->Bounds = FBoxSphereBounds(EForceInit::ForceInitToZero);
}

FBoxSphereBounds UPBLineBatchComponent::CalcBounds(const FTransform& LocalToWorld) const
{
    LineBatchComponent->Bounds = FBoxSphereBounds(LocalBounds.TransformBy(LocalToWorld));
    return FBoxSphereBounds(LocalBounds.TransformBy(LocalToWorld));
}

void UPBLineBatchComponent::SetTransform(const FTransform& Transform)
{
    LocalBounds = LocalBounds.TransformBy(Transform);
    LineBatchComponent->Bounds = FBoxSphereBounds(LocalBounds);

    bool bDirty = false;
    for (FBatchedLine& Line : LineBatchComponent->BatchedLines)
    {
        Line.Start = Transform.TransformPosition(Line.Start);
        Line.End = Transform.TransformPosition(Line.End);
        bDirty = true;
    }

    for (FBatchedPoint& Point : LineBatchComponent->BatchedPoints)
    {
        Point.Position = Transform.TransformPosition(Point.Position);
        bDirty = true;
    }

    for (FBatchedMesh& Mesh : LineBatchComponent->BatchedMeshes)
    {
        for (FVector& Vert : Mesh.MeshVerts)
        {
            Vert = Transform.TransformPosition(Vert);
            bDirty = true;
        }
    }

    if (bDirty)
    {
        LineBatchComponent->MarkRenderStateDirty();
    }
}

void UPBLineBatchComponent::DrawLine(const FVector &Start, const FVector &End, const FLinearColor &Color, uint8 DepthPriority, float Thickness, float LifeTime)
{
    LineBatchComponent->DrawLine(Start, End, Color, DepthPriority, Thickness, LifeTime);
    LocalBounds += Start;
    LocalBounds += End;
    LineBatchComponent->Bounds = FBoxSphereBounds(LocalBounds);
}

void UPBLineBatchComponent::DrawPoint(const FVector &Position, const FLinearColor &Color, float PointSize, uint8 DepthPriority, float LifeTime)
{
    LineBatchComponent->DrawPoint(Position, Color, PointSize, DepthPriority, LifeTime);
    LocalBounds += Position;
    LineBatchComponent->Bounds = FBoxSphereBounds(LocalBounds);
}

void UPBLineBatchComponent::Flush()
{
    LineBatchComponent->Flush();
    LocalBounds = FBox(0);
    LineBatchComponent->Bounds = FBoxSphereBounds(EForceInit::ForceInitToZero);
}

Update 2

If I use

LineBatchComponent = NewObject<ULineBatchComponent>();

instead of

LineBatchComponent = CreateDefaultSubobject<ULineBatchComponent>(TEXT("LineBatcher"));

I can focus properly on the actor, but I can't see the lines anymore.

sentences: Pop up screen on libgdx Hi I want to make a pause and credits screen for an android game with libgdx the idea I have is creating a new screen like a popup that pauses the background screen and then, I can render the screen I want to show. Please give me some info or ideas for this.

sentences:
Storing player data for multiple players in libGDX I'm working on a game (in libGDX) that would allow multiple player accounts. I need to store some simple user data (several key-value pairs).
I think JSON is the best for my needs, but I'm wondering how this data should be organised. I'm thinking about two possibilities:

single file for each player seems better design-wise, but I'm not sure if real-time file creation won't lead to issues
one big file with player id as key and organised array of values - safer, but would require loading data for all players on initial read and each update (although there shouldn't be that many accounts on a single game instance). Also harder to maintain due to necessity of keeping values in proper order, etc.

Perhaps there are better ways to do it, that I didn't think about.

sentences:
Using XBox 360 controller in Unity game - game doesn't recognize axis movement I have a problem with the usage of XBox controller in Unity game. I connected the controller to the PC and it works fine, I also managed to use it in the game itself - I'm using "A" button to fire and Start to start the game and they work properly. However the game doesn't recognize the x-axis movement. I'm not sure if the problem is in the input settings or my code. This is how the Horizontal movement is defined in the game:

This is the code that handles the movement:

   float x = Input.GetAxis("Horizontal");
        Vector3 newPosition = new Vector3(transform.position.x + x*playerXMoveSpeed, 0, 0);
        newPosition.y = transform.position.y;
        newPosition.z = 0;

        transform.position = Vector3.Lerp(transform.position, newPosition, playerXMoveSpeed * Time.deltaTime);

        var limit = animator.SpriteRenderer.bounds.extents;
        if (transform.position.x - limit.x < leftBorder)
        {
            var capped = transform.position;
            capped.x = leftBorder + limit.x;
            transform.position = capped;
        }
        else if (transform.position.x + limit.x > rightBorder)
        {
            var capped = transform.position;
            capped.x = rightBorder - limit.x;
            transform.position = capped;
        }

        OnMove(gameObject);

All variables are more or less self explanatory, the OnMove is a delegate that just applies the transform to the gameObject in question. The entire code is inside a void method called Move(). That method is called inside an if statement:

if ((Input.GetAxis("Horizontal") != 0.0f || Input.GetButtonDown("Horizontal")) && !IsContinueDisplayed)
        {
            FollowTouch();
        }

Like I said, the game recognizes the other buttons, but not the x-axis, it doesn't move the character. The Input.GetButtonDown is there just so keyboard input would be supported also (and it works properly).
Can you see the problem with this code or settings? Please advise.

sentences:
Rotating Cannon's Mouth Toward Player I am trying to make my cannon mouth rotate towards player, but the rotation is messed up and up I don't know how to fix it.
class enemyshoot:
    def __init__(self,x,y,height,width,color):
    # [...............]
         self.look_at_pos = (x,y)

 def draw(self):
      # [............]
        self.rect = self.shootsright.get_rect(topleft = (self.x, self.y))

        dx = self.look_at_pos[0] - self.rect.centerx
        dy = self.look_at_pos[1] - self.rect.centery
        angle = (180/math.pi) * math.atan2(-dy, dx)
        self.image = pygame.transform.rotate(self.shootsright, angle)
        self.rect  = self.image.get_rect(center = self.rect.center)

    def lookAt( self, coordinate ):
        self.look_at_pos = coordinate

My full enemyshoot class
shotsright = pygame.image.load("canss.png")
class enemyshoot:
    def __init__(self,x,y,height,width,color):
        self.x = x
        self.y =y
        self.height = height
        self.width = width
        self.color = color
        self.health = 10
        self.hitbox = (self.x + -20, self.y + 30, 31, 57)
       #-------------------------------------------------------
        # Make a Reference Copy of the bitmap for later rotation
        self.shootsright = pygame.image.load("canss.png")
        self.shootsright = pygame.transform.scale(self.shootsright,(self.shootsright.get_width()-150,self.shootsright.get_height()-150))
        self.image    = self.shootsright
        self.rect     = self.image.get_rect()
        self.position = pygame.math.Vector2( (x, y) )
        self.isLookingAtPlayer = False
        self.look_at_pos = (x,y)
    def draw(self):
        self.rect.topleft = (self.x,self.y)
        window.blit(self.image, self.rect)
        self.rect = self.shootsright.get_rect(topleft = (self.x, self.y))

        dx = self.look_at_pos[0] - self.rect.centerx
        dy = self.look_at_pos[1] - self.rect.centery
        angle = (180/math.pi) * math.atan2(-dy, dx)
        self.image = pygame.transform.rotate(self.shootsright, angle)
        self.rect  = self.image.get_rect(center = self.rect.center)

        # ------------
        self.hits = (self.x + 20, self.y, 28,60)
        pygame.draw.rect(window, (255,0,0), (self.hitbox[0], self.hitbox[1] - 60, 100, 10)) # NEW
        pygame.draw.rect(window, (0,255,0), (self.hitbox[0], self.hitbox[1] - 60, 100 - (5 * (10 - self.health)), 10))
        self.hitbox = (self.x + 200, self.y + 200, 51, 65)
    def lookAt( self, coordinate ):
        self.look_at_pos = coordinate

black = (0,0,0)
enemyshooting = []
platformGroup = pygame.sprite.Group
platformList = []
level = ["                                                                                p               p           p                         p                        p        ",
         "                                       ",
         "                             ",
         "                                      ",
         "                                  ",
         "                           ",
         "                                      ",
         "                                      ",
         "                                    ",
         "                                   ",
         "                    ",]
for iy, row in enumerate(level):
    for ix, col in enumerate(row):
        if col == "p":
            new_platforms = enemyshoot(ix*10, iy*50, 10,10,(255,255,255))
            enemyshooting.append(new_platforms)

This is where the cannons rotate towards the player, wherever they are
        for enemyshoot in enemyshooting:
            if not enemyshoot.isLookingAtPlayer:
                enemyshoot.lookAt((playerman.x, playerman.y))

sentences:
shadow mapping and linear depth I'm implementing ominidirectional shadow mapping for point lights. I want to use a linear depth which will be stored in the color textures (cube map). A program will contain two filtering techniques: software pcf (because hardware pcf works only with depth textures) and variance shadow mapping. I found two ways of storing linear depth:

const float linearDepthConstant = 1.0 / (zFar - zNear);
//first
float moment1 = -viewSpace.z * linearDepthConstant;
float moment2 = moment1 * moment1;
outColor = vec2(moment1, moment2);
//second
float moment1 = length(viewSpace) * linearDepthConstant;
float moment2 = moment1 * moment1;
outColor = vec2(moment1, moment2);

What are differences between them ? Are both ways correct ?

For the standard shadow mapping with software pcf a shadow test will depend on the linear depth format.
What about variance shadow mapping ?

I implemented omnidirectional shadow mapping for points light using a non-linear depth and hardware pcf.
In that case a shadow test looks like this:

vec3 lightToPixel = worldSpacePos - worldSpaceLightPos;
vec3 aPos = abs(lightToPixel);
float fZ = -max(aPos.x, max(aPos.y, aPos.z));
vec4 clip = pLightProjection * vec4(0.0, 0.0, fZ, 1.0);
float depth = (clip.z / clip.w) * 0.5 + 0.5;
float shadow = texture(ShadowMapCube, vec4(normalize(lightToPixel), depth));

I also implemented standard shadow mapping without pcf which using second format of linear depth: (Edit 1: i.e. distance to the light + some offset to fix shadow acne)

vec3 lightToPixel = worldSpacePos - worldSpaceLightPos;
const float linearDepthConstant = 1.0 / (zFar - zNear);
float fZ = length(lightToPixel) * linearDepthConstant;
float depth = texture(ShadowMapCube, normalize(lightToPixel)).x;
if(depth <= fZ)
{
     shadow = 0.0;
}
else
{
     shadow = 1.0;
}

but I have no idea how to do that for the first format of linear depth. Is it possible ?

Edit 2: For non-linear depth I used glPolygonOffset to fix shadow acne. For linear depth and distance to the light some offset should be add in the shader. I'm trying to implement standard shadow mapping without pcf using a linear depth (-viewSpace.z * linearDepthConstant + offset) but following shadow test doesn't produce correct results:

vec3 lightToPixel = worldSpacePos - worldSpaceLightPos;
vec3 aPos = abs(lightToPixel);
float fZ = -max(aPos.x, max(aPos.y, aPos.z));
vec4 clip = pLightProjection * vec4(0.0, 0.0, fZ, 1.0);
float fDepth = (clip.z / clip.w) * 0.5 + 0.5;
float depth = texture(ShadowMapCube, normalize(lightToPixel)).x;
if(depth <= fDepth)
{
     shadow = 0.0;
}
else
{
     shadow = 1.0;
}

How to fix that ?

sentences:
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:
What kind of projection is ScreenX=X/Z, ScreenY=Y/Z? I have an existing class which transforms 3D vectors and projects them on a 2D plane (Camera). The code is all written in C without help from an external library.

To project a single vector (X,Y,Z) on the screen, the code first applies the View matrix of the camera and then for the actual projection does the following:

ScreenX=X/Z;
ScreenY=Y/Z;

ScreenX and ScreenY are then used as the screen coordinates (after additional scaling and translation).

What kind of projection is this?

Since it uses the Z coordinate to adjust the X and Y coordinates, I would think it is a perspective projection, but I'm not sure. If it's indeed a perspectice projection, then what would be the FOV for this?

I'm just trying to understand how the existing code works so that I can rebuild it using standard libraries and using a standard projection matrix if possible.

Any idea?

Edit - Some more information:

After this division, the coordinates are multiplied (scaled) by the "lens resolution" (pixels per unit) and translated by the lens center (X,Y coordinates in pixels):

ScreenX = ScreenX * Res + CenterX;
ScreenY = ScreenY * Res + CenterY;

Res is a large number and I'm guessing it defines the projection plane, letting the coordinates scale from 0 to the size of the actual image in pixels.

sentences:
How should I pay people who work on my game development project? What is the proper way to pay your team for a game development project? For example, how would you pay to a graphics artists or a musician for their work, especially in the context of today's app marketplaces like the Apple App Store or the Android Market?

It is better to pay in advance, or to share the incomes proportionally as an app becomes successful?

sentences:
Call a BlueprintImplementableEvent from c++ in unreal editor? I created a custom actor:

BPTest.h:

#include "GameFramework/Actor.h"
#include "BPTest.generated.h"

UCLASS(Blueprintable, BlueprintType)
class ABPTest : public AActor
{
    GENERATED_BODY()

public:
    ABPTest();

    virtual void BeginPlay() override;

    UFUNCTION(BlueprintImplementableEvent, meta = (DisplayName = "Custom event"))
    void CustomEvent(float Value);
    void CustomEvent_Implementation(float Value);
};

BPTest.cpp:

#include "ProBuilderPrivatePCH.h"
#include "BPTest.h"

ABPTest::ABPTest()
{
    PrimaryActorTick.bCanEverTick = true;
}

void ABPTest::BeginPlay()
{
    Super::BeginPlay();
    CustomEvent(0.f);
}

void ABPTest::CustomEvent_Implementation(float Value)
{
    UE_LOG(LogTemp, Warning, TEXT("CustomEvent_Implementation: %f"), Value);
}

I then created a blueprint from this actor class.

I added an instance of this blueprint actor in my level.

I would like to call this custom event from c++ in the editor, not when the game is started.

I tried this in a custom editor mode (extending FEdMode):

bool FProBuilderEdMode::InputKey(FEditorViewportClient *ViewportClient, FViewport *Viewport, FKey Key, EInputEvent Event)
{
    for (TActorIterator<ABPTest> ActorIterator(GWorld); ActorIterator; ++ActorIterator)
    {
        ActorIterator->CustomEvent(1.f);
    }
    return FEdMode::InputKey(ViewportClient, Viewport, Key, Event);
}

but it does not work. I assume the game has to be started (hit play) in order for the blueprint event to be taken into account. Is my assumption correct?

How can I call a blueprint function from c++ when the game is not started (Is it even possible)?
I have seen UObject::CallFunctionByNameWithArguments but it seems dirty.

sentences:
How do I include the gizmo in my simulation? My company is developing 3D simulation program using Unity 5.x and we need a gizmo in our solution. My goal is to displaying that a factory is building.

I don't know how do programmatically use Unity Engine. How do I include a gizmo like the gizmo in the scene view, or the one in the image?

sentences:
Is it a good idea to render many textures into one texture? I'm making a 2D game with OpenGL. In order to avoid changing the state machine and binding at runtime, I want to make consolidate my textures into bigger textures,

for example, taking 4 128x128 textures and making 1 big 512x512. I could then just render part of the texture rather than binding a new one.

Is this a good idea? Could my newly created texture get lost, or are there major faults in doing  this?

Thanks

sentences:
Correcting imported animation to avoid hand going through the face of character I've imported an animation from Mixamo called standing draw bow.
When I use it with my character in Unity the hand goes through the face of my character.
Is there a way to move hand a little outside the face of the character using Blender or Unity?  Or am I required to make up the animation myself?
I tried modifying parameters Mixamo offers but doesn't resolve the problem.
I actually tryed to solve the problem with IK by adding a Multi-Parent constraint ( cause i didn't manage to have multi-postion constraint to work ) and tried to move lowerarm_r Bone a little bit off the face of the character but it only did force the bow to stay in the position and rotation of the "Target" while being buggy in certain keyframes. my aim is to force that bone to not rotate more than certain degree to not go through the face while executing the animation. I believe the problem is coming from the fact that animation is made for normal head character not big head ones.

sentences:
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:
How can I stop this fixed update from executing so I want this FixedUpdate() Method to stop executing when the Method OnMouseDown() is executed.
A bool doesn't work a if() statement also doesn't work
Please use my whole code
Please help :)
Thanks,

 private void FixedUpdate()
    {
            int random = Random.Range(1, 4);
            if (random == 1)
            {
                m_SpriteRenderer = GetComponent<SpriteRenderer>();
                m_SpriteRenderer.color = Color.green;
            }
            if (random == 2)
            {
                m_SpriteRenderer = GetComponent<SpriteRenderer>();
                m_SpriteRenderer.color = Color.blue;
            }
            if (random == 3)
            {
                m_SpriteRenderer = GetComponent<SpriteRenderer>();
                m_SpriteRenderer.color = Color.yellow;
            }

    }
    private void OnMouseDown()
    {
        shouldexecute = false;
    }

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: Do I need to implement IPv6 support for my game? I'm going to implement network features for the game I'm currently working on, now I'm wondering if I need to implement IPv6 support or just having support for IPv4 is enough?

sentences:
How 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 have an arrow follow different height parabolas depending on how long the player holds down a key? i'm trying to throw an arrow in my game, but i'm having a hard time trying to realize how to make a good parabola.

What I need:
The more you hold "enter" stronger the arrow goes.
The arrow angle will be always the same, 45 degrees.

This is what I have already have:

    private float velocityHeld = 1f;
    protected override void Update(GameTime gameTime)
    {
 private void GetKeyboardEvent()
        {
            if (Keyboard.GetState().IsKeyDown(Keys.Enter) && !released)
            {
                timeHeld += velocityHeld;
                holding = true;
            }
            else
            {
                if (holding)
                {
                    released = true;
                    holding = false;
                    lastTimeHeld = timeHeld;
                }
            }
        }

        if (released && timeHeld > 0)
        {
        float alpha = MathHelper.ToRadians(45f);
        double vy = timeHeld * Math.Sin(alpha);
        double vx = timeHeld * Math.Cos(alpha);

        ShadowPosition.Y -= (int)vy;
        ShadowPosition.X += (int)vx;
        timeHeld -= velocityHeld;
        }
        else
        {
            released = false;

        }
       }

My question is, what do I need to do to make the arrow to go bottom as it loses velocity (timeHeld) to make a perfect parabola?

sentences:
Raycast Movement on a sphere so I'm working on a mobile game where I have touch input from a Asset from the asset store. It all works perfectly fine, except for one thing:
I want to implement a "drag and drop" feature so when I pick up an Item it should follow to the position of my finger. But because the playground is a sphere, I have to do the movement with a Raycast. So my plan is that the item should follow the Raycasts position. My current attempt looks like this:

public void DragTo(float screenX, float screenY)
{
    if (draggingObject == null)
    {
        return;
    }

    Debug.Log("Dragging");

    //Converts the screen space to world space
    Vector3 mousePosFar = new Vector3(screenX, screenY,      Camera.main.farClipPlane);
    Vector3 mousePosNear = new Vector3(screenX, screenY, Camera.main.nearClipPlane);

    Vector3 mousePosF = mainCam.ScreenToWorldPoint(mousePosFar);
    Vector3 mousePosN = mainCam.ScreenToWorldPoint(mousePosNear);

    //shoots an ray to the world space
    RaycastHit hit;

    if (Physics.Raycast(mousePosN, mousePosF - mousePosN, out hit))
    {
        float step = speed * Time.deltaTime;
        draggingObject.GetComponent<Rigidbody>().MovePosition(hit.point);
    }
}

I already have tried the following options:

draggingObject.GetComponent<Rigidbody>().MovePosition(hit.point);
draggingObject.GetComponent<Rigidbody>().MovePosition(hit.normal);
draggingObject.transform.position = hit.point;
draggingObject.transform.position = normal;

They all work, but they all have really buggy and strange behaviors.
Also when I dont freeze the z. axis on the Rigidbody the item just "flies" up on the z axis, until it reaches the camera. Then it teleportes again down and it all starts again. So its flying up on the ray.
So if you have any Ideas why this happens let me know.
Any help is appreciated.
(Also dont forget that its all happens on a sphere)

UPDATE:
It works now. When the dragging began i changed the layer from the object to "Ignore Raycast" and when it end changed it back to "Default".

sentences:
What are good questions for design interns? I've recently been interviewing design interns and been pitching what I consider fairly easy practical design questions to measure their skill level. I've been shocked by poor quality of answers. Now this may be the quality of the applicants.

What questions do you ask an entry level games designer to probe for their skill level?

sentences: Has piracy ever resulted in a developer getting shut down? Has piracy EVER resulted in a developer getting shut down? That is, has piracy ever been so detrimental that it brought about the downfall of a game studio? If I were to release a game, should I be extremely wary of pirates and plan accordingly, or is it safe to assume that it won't damage me or my studio whatsoever?

sentences: How to render depthmap image in 3d? I'm new to game development and XNA. I have this depthmap image and I want to render it in 3D, how do I do it, any tutorial or blog post would be helpful.

sentences:
Multiplayer online game engine/pipeline I am implementing online multiplayer game where client must be written in AS3 (Flash) to embed game into browser and server in C++ (abstract part of which is already written and used with other games).

Networking models may differ from each other, but currently I'm looking toward game's logic run on both client and server parts but they're written on different languages while it's not the main problem.

My previous game (pretty big one - was implemented with efforts of ~5 programmers in 1.5 years) was mainly "written" within electronic tables as structured objects with implemented inheritance: was written standalone tool which generated AS3 and C++ (languages of platforms to which the game was published) using specified electronic tables file (.xls or .ods). That file contained ~50 tables with ~50 rows and ~50 columns each and was mainly written by game designers which do not know any programming languages. But that game was single-player.

Having declared problem with my currently implementing MMO, I'm looking toward some vast pipeline, where will be resolved such problems like:

game objects descriptions (which starships exist within game, how much HP they have, how fast move, what damage deal...)
actions descriptions (what players or NPCs can do: attack each other, collect resources, build structures, move, teleport, cast spells) - actions are transmitted through server between clients
influences (what happens when specified action applied on specified object, e.i "Ship A attacked Ship B: field "HP" of Ship B reduced by amount of field "damage" of Ship A"

Influences can be much more difficult, yes, e.i. "damage is twice it's size when Ship has >=5 allies around him in a 200 units range during night" and so on. If to be able to write such logic within some "design document" it will be easily possible to:

let designers to do their job without programmer's intervention or any bug-prone programming
validate described logic
transfer (transform, convert) to any programming language where it will be executed

Did somebody worked on something like that?
Is there some tools/engines/pipelines which concernes with it?
How to handle all of this problems simultaneously in a best way or do I properly imagine my tasks and problems to myself?

sentences: How do I detect the intersection of a curve with itself? I'm developing a game in which the player can draw a line. I want to detect if that line intersects with itself. How would I do this?

sentences:
unity and maya - how to export/import fbx animation with rootmotion and non-rootmotion clips? I've started learning about and playing around with animations in Unity and I've installed the Basic Motions Pack by Kevin Iglesias. I wanted to know how they work and to see if I can modify them so I've looked at the animation files which are .fbx. The animation hierarchy in Unity looks like this

where BasicMotions@Walk01 is the in-place animation and [RootMotion] is the root motion variant which has velocity. I've looked into what root motions are and I think I've grasped what they are, but here's where things have gotten interesting.
I've imported the BasicMotions@Walk01.fbx into Maya and it looks like this

it has a root joint for root motion and the animation moves the rig in each keyframe. So far so good! I've modified the animation so that it plays in reverse, basically made a sketchy reverse walk animation. Exported it to .fbx with the following parameters

And then opened that in Unity, however when I import the animation and rig it it only has one clip and it's the Root motion clip, and I can't get the non-rootmotion clip.
The Root Transform Position (XZ) Loop match is always red and if I don't bake it into pose the animation functions like the Kevin's RootMotion animations, but I don't know how to get the non-RootMotion clip. What am I doing wrong here?

sentences:
How do you maintain content size vs. content quality in a mobile application? I am developing my first Cocos2d iPhone/iPad game that includes quite a few sprites, I would need approximately 80 different. As this is for both normal and HD displays I have 2x of each sprite. I am using TexturePacker to optimize the thing.

I would like to ask if there are any rules-of-thumb, tricks, ideas etc. to adjust to in regards to size of content, quality and how you maintain high-quality HD-based graphics due to its size vs. the device memory sizes?

Also, is it a good idea to only have one copy of the sprites and scale it using code?

sentences:
Is an extra collision-mesh for level-data worth the hassle? What is the optimal approach for collision-detection with the environment in an 3D engine (with triangle mesh based geometry, no bsp)?

A) Use the render mesh

[+] no need for additional work for artists to fiddle with collision detection
[-] high detail is harder for physics calculation
[+/-] maybe use collidable flags for materials
[+/-] compute the collision-mesh from the render-mesh

B) Use an additional collision mesh

[+] faster/more optimal collision-detection
[-] additional work (either by the artist or by the programmer who has to develop an algorithm to compute it from the render-mesh)
[-] more memory useage

How do AAA title handle this?
And what are the indie dev's approaches?

sentences:
How to draw Alpha Masked fragments' depth to depth buffer? I feel like an absolute idiot for asking this. But how exactly do safely draw the depth of a fragment featuring a Masked ( Alpha 1) texture on it's surface?

So far I've literally been doing a depth test on truly opaque geometry.

Here's a logarithic Z-bufer from GTA. And yes... it's strange that I know that and how to do it... but not a alpha mask depth.

EDIT: From this, it looks like it's actually possible to write solid texture data to the depth buffer, and ignore the binary transparency.

Here's an image that's an example of the problem I would like to solve.

sentences:
How do I draw my particles when an enemy is killed? I have enemies that move left and right.
I was wonder how I could make my particles show up when the enemy is killed?
Here is my particle class
    class explode:

        def __init__(self,x,y,height,width,color):
            self.x = x
            self.y = y
            self.height = height
            self.width = width
            self.explode = [
            pygame.image.load("spark_01.png"),
            pygame.image.load("spark_02.png"),
            pygame.image.load("spark_03.png"),
            pygame.image.load("spark_04.png"),
            pygame.image.load("spark_05.png"),
            pygame.image.load("spark_06.png"),
            pygame.image.load("spark_07.png")]

            self.explode = [pygame.transform.scale(image,(image.get_width()//7,image.get_height()//7)) for image in self.explode]

            self.rect = pygame.Rect(x,y,height,width)
            self.direction = "blobright"
            self.anim_index = 0
        def draw(self):

            self.rect.topleft = (self.x,self.y)
            if self.direction == "blobright":
                window.blit(self.explode[self.anim_index], self.rect)
                self.anim_index += 1
                if self.anim_index == len(self.explode):
                    self.anim_index = 0

    black = (0,0,0)
    explode1 = explode(400,450,50,50,black)
    explodes = [explode1]

This is where I delete my enemies when they are killed. How can I add my particles after it's deleted and remove the particles afterward?

        #--------------------------------------------------------------------------------------------------------- enemys

                # enemys 2
            for enemys in enemying:
                for bullet in bullets:
                    if bullet.rect.colliderect(enemys.hitbox):
                        if enemys.health > -4:
                            enemys.health -= 1
                            minusenemyhealthtext()
                            bullets.pop(bullets.index(bullet))
                        else:
                            enemyscore += 1
                            del enemying[one]
                            enemyors = font.render("" + str(enemyscore), True, (0,0,0))
                            enemydors.center = ((130,125))

sentences:
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:
Creating an OpenGL FPS camera: I have the position and orientation vectors, now what? I have been struggling to create a first person camera in OpenGL ES 2.0 without using gluLookAt(). I grab the camera's orientation vectors (the way it's looking) from the current modelview matrix, and use that to calculate the new forward/backward (Z) translation value. I then calculate the strafe (X) value from the dot product of Z and Y (which is always 1.0). So, I have all the information I need to create a view matrix, but how do I do that without using gluLookAt? Almost all the examples I've seen use gluLookAt, but no such function exists in OpenGL ES 2.0. Besides, one of the moderators on cprogramming.com mentioned that gluLookAt is not appropriate for FPS cameras:

http://cboard.cprogramming.com/game-programming/135390-how-properly-move-strafe-yaw-pitch-camera-opengl-glut-using-glulookat.html

I am really confused by all the conflicting information I'm getting. I just want to create a first person camera that goes forward (W,S keys), side-to-side (A,D keys) and rotates around its center (Y axis only), Wolfenstein style.

Here's more-or-less my existing code:

vec4 cur_look,dir_move,dir_strafe,cam_pos;
mat4 mat_modelview,mat_rot,mat_temp;
float lr; //left/right keypress increment value
float ud; //up/down keypress increment value

//grab current camera orientation (look at) from the modelview matrix
cur_look[0] = mat_modelview[8];
cur_look[1] = mat_modelview[9];
cur_look[2] = mat_modelview[10];
cur_look[3] = mat_modelview[11];

//rotate the direction vector using the rotation matrix
mat4_identity(mat_rot);
mat4_identity(mat_temp);
mat4_rotate_Y(mat_rot,mat_temp,lr); //create rotation matrix

//multiply the current direction vector by the rotation
//matrix and place the result in dir_move
mat4_mul_vec4(dir_move, mat_rot, cur_look);

//normalize the fwd/back direction vector
vec4_norm(dir_move,dir_move);

//calculate strafe vector using cross product of Z and Y
vec4_cross(dir_strafe,dir_move,(vec4){0.0,1.0,0.0,0.0});

//normalize strafe vector
vec4_norm(dir_strafe,dir_strafe);

//detect key input

//FWD/BACK
if(key_pressed == 'w'){
    cam_pos[2] += (dir_move[2] * -INPUT_SENS_Z); //z
}
if(key_pressed == 's'){
    cam_pos[2] += (dir_move[2] * INPUT_SENS_Z); //z
}

//ROTATION
if(key_pressed == LEFT_ARROW){
    lr += INPUT_SENS_ROT;
}
if(key_pressed == RIGHT_ARROW){
    lr +=  -INPUT_SENS_ROT;
}

//build new modelview matrix
mat4_identity(mat_modelview);

//multiply modelview matrix by rotation matrix
mat4_mul(mat_modelview,mat_modelview,mat_rot);

//create translation matrix
mat4_translate(mat_tran,-cam_pos[0], 0.0, -cam_pos[2]);
//multiple modelview matrix by translation matrix
mat4_mul(mat_modelview,mat_modelview,mat_tran);

//update uniforms and draw scene using glDrawArrays()
glUniformMatrix4fv(loc_modelview, 1, GL_FALSE, mat_modelview);

Any help on this would be much appreciated!

sentences:
Can i use shaders in allegro without opengl? I'm currently learning opengl but it seems quite complicated so i considered using some library like sdl or allegro. I noticed that allegro has some built in functions to create and attach shaders.

But my question is: do my shaders "shade" everything i render with allegro or they are only functions to ease the work of loading shaders with opengl/directx?

Any help apreciated!

sentences:
How can I implement a renderer that can draw many kinds of primitives? This is somewhat linked to a question I previously asked concerning the drawing of indexed primitives.

My problem was that I was only drawing one cube when I wanted to draw many. I was told that the problem was that I was overwriting the vertex and index buffers with each new instantiation of Cube and that instead I should create one at the origin and then draw many, passing through a transformation matrix to the shader that makes it appear in different places. This worked beautifully.

I now have a new problem though: how would I draw many different types of primitives?

Here is my code from the previous question:

Cube::Cube(D3DXCOLOR colour, D3DXVECTOR3 min, D3DXVECTOR3 max)
{
// create eight vertices to represent the corners of the cube
VERTEX OurVertices[] =
{
    {D3DXVECTOR3(min.x, max.y, max.z), colour},
    {D3DXVECTOR3(min.x, max.y, min.z), colour},
    {D3DXVECTOR3(min.x, min.y, max.z), colour},
    {min, colour},
    {max, colour},
    {D3DXVECTOR3(max.x, max.y, min.z), colour},
    {D3DXVECTOR3(max.x, min.y, max.z), colour},
    {D3DXVECTOR3(max.x, min.y, min.z), colour},
};

// create the vertex buffer
D3D10_BUFFER_DESC bd;
bd.Usage = D3D10_USAGE_DYNAMIC;
bd.ByteWidth = sizeof(VERTEX) * 8;
bd.BindFlags = D3D10_BIND_VERTEX_BUFFER;
bd.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE;
bd.MiscFlags = 0;

device->CreateBuffer(&bd, NULL, &pBuffer);

void* pVoid;    // the void pointer

pBuffer->Map(D3D10_MAP_WRITE_DISCARD, 0, &pVoid);    // map the vertex buffer
memcpy(pVoid, OurVertices, sizeof(OurVertices));    // copy the vertices to the buffer
pBuffer->Unmap();

// create the index buffer out of DWORDs
DWORD OurIndices[] =
{
    0, 1, 2,    // side 1
    2, 1, 3,
    4, 0, 6,    // side 2
    6, 0, 2,
    7, 5, 6,    // side 3
    6, 5, 4,
    3, 1, 7,    // side 4
    7, 1, 5,
    4, 5, 0,    // side 5
    0, 5, 1,
    3, 7, 2,    // side 6
    2, 7, 6,
};

// create the index buffer
// D3D10_BUFFER_DESC bd;    // redefinition
bd.Usage = D3D10_USAGE_DYNAMIC;
bd.ByteWidth = sizeof(DWORD) * 36;
bd.BindFlags = D3D10_BIND_INDEX_BUFFER;
bd.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE;
bd.MiscFlags = 0;

device->CreateBuffer(&bd, NULL, &iBuffer);

iBuffer->Map(D3D10_MAP_WRITE_DISCARD, 0, &pVoid);    // map the index buffer
memcpy(pVoid, OurIndices, sizeof(OurIndices));    // copy the indices to the buffer
iBuffer->Unmap();

//this is simply a single call to the update method that sets up the scale, rotation
//and translation matrices, in case the cubes are static and you don't want to have to
//call update every frame
Update(D3DXVECTOR3(1, 1, 1), D3DXVECTOR3(0, 0, 0), D3DXVECTOR3(0, 0, 0));
}

Clearly if I duplicated and modified the code to be a different object or shape, the last shape to be initialized would overwrite the vertex buffer, wouldn't it?

Do I use multiple vertex buffers? Do I append the new vertex buffer to the old one and use the appropriate indices to draw them? Can I do either? Both?

sentences:
What's the best way to draw gizmos in build I currently use Unity gizmos for many debugging purposes, but I'd like almost all of them to be visible to the player in-game (when the game is built).
For example, when a player is dragging to place a wall along a grid, I use Gizmos.DrawCube.
I know of a couple of options:

ALINE - an asset on Unity asset store, but currently doesn't work with 2D Experimental URP
Line renderer - seems very manual and tedious to do, and I'm unsure how I could modify it using code
Placing pictures as UI elements over selected tiles (seems pretty expensive to do?)

Any suggestions are appreciated!

sentences:
Getting UV maps from UDK? I have created a map using UDK and I am exporting it as a .fbx for use within an XNA project.

My question is, can I generate a UV map for texturing the map or is there an easier way to texture a map made within UDK to be used in an XNA project?

Thanks.

sentences:
Setting a uniform float in a fragment shader results in strange values, is this a type conversion? How can it be fixed? First, some details:

I'm learning OpenGL from the tutorials on https://open.gl
My computer is running Linux Mint 18.1 Xfce 64-bit
My graphics card is a GeForce GTX 960M
OpenGL Version: 4.5.0 NVIDIA 375.66
GLSL Version: 4.50 NVIDIA
Graphics Card Driver: nvidia-375 Version: 375.66-0ubuntu0.16.04.1
CPU: Intel Core i7 6700HQ
The code I'm working on can be found here: https://github.com/Faison/sdl2-learning/blob/8a61032d20edf91cfa60f665e1bb4d72e58f634b/phase-01-initial-setup/main.c (Makefile is located in the same directory)

In a fragment shader, I'm trying to make an image do a sort of "flipping mirroring" animation (lines 44-57):

#version 450 core
in vec3 Color
in vec2 Texcoord;
out vec4 outColor;
uniform sampler2D tex;
uniform float factor;
void main() {
 if (Texcoord.y < factor) {
    outColor = texture(tex, Texcoord) * vec4(Color, 1.0);
  } else {
    outColor = texture(tex, vec2(Texcoord.x, 1.0 - Texcoord.y));
  }
}

When factor is 1, the image should be right-side up and has some color on it.
When factor is 0, the image should be upside down and has no color added to it.
When factor is 0.5, the top half should be right-side up and the bottom half should be upside down.

Currently, that is only the case if I replace factor with the number.

When I set the uniform factor with glUniform1f(), I'm getting very strange results. To illistrate, I added some debug code to lines 188-197 that sets the uniform with one number, retrieves the number from the uniform, and outputs both values to try and see what's going on.

Here's the code:

GLfloat factorToSet = 1.0f;
GLfloat setFactor = 0.0f;
GLint uniFactor = glGetUniformLocation(shader_program, "factor");

while (factorToSet > -0.1f) {
  glUniform1f(uniFactor, factorToSet);
  glGetUniformfv(shader_program, uniFactor, &setFactor);
  printf("Factor of %.1f becomes %f\n", factorToSet, setFactor);
  factorToSet -= 0.1;
}

And here are the results:

Factor of 1.0 becomes 0.000000
Factor of 0.9 becomes -2.000000
Factor of 0.8 becomes -0.000000
Factor of 0.7 becomes 2.000000
Factor of 0.6 becomes 0.000000
Factor of 0.5 becomes -0.000000
Factor of 0.4 becomes 2.000000
Factor of 0.3 becomes -36893488147419103232.000000
Factor of 0.2 becomes 0.000000
Factor of 0.1 becomes 36893488147419103232.000000
Factor of -0.0 becomes -0.000000

So with what little I understand about OpenGL and the way scalar types are stored in binary, I'm thinking that this issue is caused my GLfloat getting converted into something else on the way to the shader's uniform float. But I'm grasping at straws.

What could be causing this strange conversion between the number I send to the uniform float and the value that the uniform float becomes? What could I do to fix it if it's possible to fix?

Thanks in advanced for any help and leads, I really appreciate it :)

An additional note after receiving a working answer

George Hanna provided a link to a post where someone had a similar issue. I read over the comments and someone said to use -DGL_GLEXT_PROTOTYPES as a CFLAG. So I rolled back my local code to use glUniform1f() again, added -DGL_GLEXT_PROTOTYPES to the Makefile, and everything worked! Even crazier, all the compiler warnings I had for implicit declarations of OpenGL functions were gone!

So in addition to the answer below, if you have this issue, try adding -DGL_GLEXT_PROTOTYPES to your CFLAGS.

(You can also get this affect by adding #define GL_GLEXT_PROTOTYPES before any OpenGL #includes)

sentences:
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:
Why the AnchorPoint doesn't affect the `CCLayer` Positioning? I think there is a difference between the CCLayer and CCNode behavior when I change their AnchorPoint.

I will describe what I mean and please somebody explain it.

Scenario:
I start with CCNode

CCNode *node = ...;
node.setContentSize(ccp(W,H));
// 1.
node.setAnchorPoint(ccp(0,0));
node.setPosition(ccp(X,Y); // This line will move the node in a way that its (0,0)-point will be placed at (X,Y).
// 2.
node.setAnchorPoint(ccp(1,1));
node.setPosition(ccp(X,Y); // This line will move the node in a way that its (0,0)-point will be placeed at (X-W,Y-H).
//In other word, this line will move the (W,H)-point of the node to (X,Y)

In addition to the Positioning, all actions (like Rotating, Scaling) are based on this anchor point.

This policy is fair enough and you won't get confused when moving a scaled node (setScale(X)) to some position because the node's position ( and not node's contents!) will not change in the screen after any actions.

( PS: We knew that rotating/scaling a node will rotate/scale internal node contents)

Let's continue with CCLayer:

CCLayer *layer= ...;
layer.setContentSize(ccp(W,H));
// 1.
layer.setAnchorPoint(ccp(0,0));
layer.setPosition(ccp(X,Y); // This line will move the layer in a way that its (0,0)-point will be placed at (X,Y)
// 2.
layer.setAnchorPoint(ccp(1,1));
layer.setPosition(ccp(X,Y); // Unfortunately, This line will move the layer in a way that its (0,0)-point will be placeed at (X,Y).

Although CCLayer also use the anchor point for scaling, rotating and ... purposes, It does NOT use its anchor point for positioning!!!

Question >>>>  WHY? and How can I have the same CCNode-like setPosition() behaviour for CCLayer?

PS: I've also tried ->ignoreAnchorPointForPosition(true) but it didn't help.

(@cocos2d-x version is 2.2.3)

sentences:
WebGL Redirecting URL If player's browser don't support WebGL, I want to redirect Web Player version. I think it's possible in UnityLoader.js file but how?

function CompatibilityCheck(){hasWebGL?mobile?confirm("Please note that Unity WebGL is not currently supported on mobiles. Press Ok if you wish to continue anyway.")||window.history.back():-1==browser.indexOf("Firefox")&&-1==browser.indexOf("Chrome")&&-1==browser.indexOf("Safari")&&(confirm("Please note that your browser is not currently supported for this Unity WebGL content. Try installing Firefox, or press Ok if you wish to continue anyway.")||window.history.back()):(alert("You need a browser which supports WebGL to run this content. Try installing Firefox."),window.history.back())}

I just want to add a URL redirect here.

sentences:
Error suddenly when compiling Desktop on Android Studio - all projects - nothing changed - LibGDX I have just gone into Android Studio to open a project. It will run in Android but not my Desktop configuration.
Nothing of the code has been changed and I have now tried 3 projects, also a brand new project straight from the LibGDX Project Generator .jar file.

The error I get in Studio is:
Exception in thread "LWJGL Application" java.lang.NullPointerException
    at com.badlogic.gdx.backends.lwjgl.LwjglGraphics.createDisplayPixelFormat(LwjglGraphics.java:322)
    at com.badlogic.gdx.backends.lwjgl.LwjglGraphics.setupDisplay(LwjglGraphics.java:216)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:142)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:124)

Process finished with exit code 0

Please can anybody help me here? thanks

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:
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:
I'm having resolution issues; does my math suck? There are a lot of scripts involved so I'm just going to give a generalized description of the process.

First, a 1x1 square tile is created. Second, that tile is placed out of the way, and 16 x 10 (160) new tiles are created starting at the (0,0) position and building outward in positive numbers. Now, the camera is a 16:10 display.  At this point, I wanted to scale up the tiles. If I want to scale the map up I start by scaling the camera by 100, and then I scale the tiles, and align their position (edge to edge).  At this point, scaling the tiles by 100 seems logical, but that didn't work correctly, for some reason. Scaling by 50 almost works, but the resolution is no longer a 16:10 grid like it was before the scaling.

What am I doing wrong?  I am using Unity.

sentences:
Example/Tutorial of passing structured data over network C++ This is very general question, about strategies how to pack same information about state of my game-world on server ( e.g. position/orientation of players, projectiles, etc. ) into data stream so that I can sent them over network and unpack them on the client side to draw on screen.

I know it's called serialization. But still I have many doubts.

My game already has some structure of objects. I do not want to re-design it ( too much ) in order to use some automatic serialization. I also do not want to make dependency on an other library (such as boost::serialize ) if not necessary
My classes/objects e.g.(class Airplane) contain some properties which should be passed over network to the client ( e.g. position and orientation ) but also some which should not ( e.g. some temporary variables relevant just for computations on server; pointers to nearest neighbor objects; array of Lift and Drag coefficient for set of angles-of-attack )
If I pack more objects into one message/packet I will probably need some protocol and parser to unpack the objects properly on the other side. The client should know of which Class type data are and to which instance it should be assigned.

Probably by trial and error I can figure it by myself, but it would take some time, and it would be helpful to have some example solution of similar problem to start with.

background - I have some skill with physics and graphics programming (Java,C++,Frotran,GLSL,OpenCL...), but I know absolutely nothing about networking. I have done some games into which I would like multiplayer. Just simple games with only few players and moving objects (projectiles). For reference consider something like LIERO

sentences:
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:
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:
Drawing a 2D Coordinate Map I'd like to draw a 2Dimensional coordinate system using C#. Unfortunately, in terms of a graphics rendering engine, XNA is out of the question since I'm running Linux. Thus, is this possible without XNA? How exactly would I go about doing this? My goal is to have something which allows the user to click on any specific area and have a dot appear in the spot where the mouse has clicked.

If I can't do this in C#, how would I go about coding it in C++?

sentences:
How do I implement Unreal-like object serialization? Recently, I've been working on the core of my engine, and as I'm moving forward I find myself developing throwaway code to read files and simple data into the engine. This got me thinking about how I should implement a file management system.

After a bit of googleing I came across the Unreal Package format, and boy does it look like the perfect one.

I think it's good because the way how it allows you to separate different assets into different packages and allow something like a level to reference the different packages.

I was just wondering, is this possible with C#? Because the built-in serialization API in .NET does not seem to support any form of this, only reading and writing to a single file.

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:
How to draw chunks of a map within view of camera I want to draw chunks of a map in the screen when it's visible by the camera.
I can draw a single chunk using:
map(celx, cely, screenx, screeny, 16, 16)

This draws the chunk celx cely to the screen position screenx screeny.
I can move this map where it's drawn using:
camera(camx, camy)

This will offset the map by vector camx camy.
This is basic PICO-8 api.
For my problem, I define a world by chunks of the map:
pworld = {
   0, 1, 2, 0, 3, 4, 0, 1, 2,
   0, 3, 4, 0, 3, 4, 0, 3, 4,
   0, 1, 2, 0, 1, 2, 0, 1, 2,
   0, 1, 2, 0, 1, 2, 0, 1, 2
}

World is laid out by chunks of 8x4 units.
0 means chunk where celx=0 cely=0
1 means chunk where celx=1 cely=0 and so on.
Now when the camera is at say x=10,y=10 I have to draw the portion of the world indexes 1,2,9,10:
I tried to calculate this using:
function v_map(x, y)
   local i = pworld[flr(y/16)*8+flr(x/16)+1]

   local my = flr(i/8)
   local mx = i%8

   return {
      {x=mx,y=my},
      {x=mx+1,y=my},
      {x=mx,y=my+1},
      {x=mx+1,y=my+1}
   }
end

and draw using:
function _draw()

  camera(cam.x, cam.y)

  local vm = v_map(camx, camy)
  map(vm[1].x, vm[1].y, 0, 0, 16, 16)
  map(vm[2].x, vm[2].y, 0, 0, 16, 16)
  map(vm[3].x, vm[3].y, 0, 0, 16, 16)
  map(vm[4].x, vm[4].y, 0, 0, 16, 16)
end

But this is wrong and I don't understand how this even should work.
How do I know the indexes of the chunks to draw?
How do I know at what screen position to draw the chunks?
How does this work well with moving the camera?

sentences:
How can I simulate a "Hot Swap" betwen Audio Clips? I have a Unity project with 3 separate looping Audio Clips and a single Audio Source. Based on certain events, I swap between which of them are playing.

This works fine, but whenever I swap between Audio Clips, the AudioSource stops playing, and must be restarted... which means it starts over from the beginning.

As the Audio Clips are the same length, how should I handle the logic to pickup where the previous Clip last left off? Neither Unity's AudioClip nor AudioSource classes seem to have either a "PlayFromTime()" or "GetPercentPlayed()" method that would facilitate using a single Audio Source.

What's the expected way to handle such a scenario? Simultaneously "play" from 3 AudioSources at once, muting 2 of them and leaving the last the only one that is actually heard?

sentences:
How do I create a 3D model based on 2D drawings? I'm a programmer. I have a great draftsman, but I don't know how to take his drawings to 3D.

My gut feeling is to have him draw different view angles, then work based on those, adding each dimension to the model turn. But really I'm just guessing here.

How do I do this methodically and correctly?

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:
Clamping large content to smaller area I'm using OpenGL (with LWJGL) in Java, but the question is language independent.

I have some region (a rectangle for simplicity), and, let's say, a big tiled map which I want to show in this area. The area is not the whole screen, I want to render something around it.

I can think of two approaches, but they are not very good and hard to do.

Render the whole tiled map and everything else, including background and the frame,
on top - leaving the window. Yes, works, but it'd be pain.
Render only visible tiles and only the visible portions of the border tiles.
This is not possible if I for example render a font using external library - there I don't have such fine control.
Some OpenGL trick?

Please, guide me.

sentences:
Quaternion rotations & transforms from global to local space I am trying to solve this problem and getting no where,
could really use some assistance.
Rotation is defined as X (rotate left/right), Y(rotate up/down), Z(roll)
Coordinates are X: Forward/backward, Y: Left/right, Z: up/down

I have two objects in simulated space, both have galactic coordinates (XYZ)
and a quaternion representing their rotation.

ObjectA
  Coordinates: 0.593 0 0 (directly ahead of ObjB)
 RotationQuat: w: 0, x: 1, y: 0, z:0 (Rotated 180 yaw, facing backwards)

ObjectB
 Coordinates: 0 0 0
 RotationQuat: w: 1, x: 0, y: 0, z: 0 (No rotation, facing towards ObjA)

Given the above information, how do I translate ObjA's location into ObjB's
 local space?

If ObjA fires at ObjB (or vise versa), I need to calculate which side will be
 hit. Forward, Aft, Port, Starboard, Ventral or Dorsal.

My project is written entirely in C. Actually this is an old project, created
by someone else that I am converting to using quaternions due to gimbal lock.

Any advice?

sentences:
Sending state diffs (deltas) and unreliable connections We're building a realtime multiplayer game, in which each player is responsible for reporting its state on every iteration of the game loop.

The state updates are broadcasted using unreliable UDP.

To minimize state data sending, we've come up with a system that will send only deltas (whatever state data that was changed).

This method however is flawed, since a lost packet will mean that other players will not receive the delta, making the game behave in an unexpected way.

For example:

Assume that state is comprised of: { positionX, positionY, health }

Frame 1  - positionX changed --> send a packet with positionX only.
Frame 2 - health changed // lost !
Frame 3 - positionY changed --> send a packet with positionY only.

// Other players don't know about health change.

How can one overcome this issue then? sending the entire data is not always feasible.

sentences:
Deciding when to switch focus between UI elements I've been coding a simple logic game recently and there is a UI decision that has been bothering me.

Since certain blocks of logic are going to be used across many levels (e.g. logic to reverse the input queue) I decided to add a template feature, allowing the user to name and save blocks of logic.

As it stands, I simply have a text field in which to enter the template name. While the game is primarily played with the mouse, some keys are used as controls (w, a, s, d, space, delete). This creates the requirement of deciding when to take focus away from the text field. Some decisions are obvious (e.g. when the user presses the New Template button and the template is created) but others, not so much. For example, the user clicks the text field, then decides not to create a template.

While one option is to simply pop up a dialog and remove the text field from the main UI altogether, I was trying to avoid this. Does anyone have any thoughts on what would be a good trigger for taking focus away from the text field? Or do you think I should just drop the field and go with the dialog?

sentences:
Does swf provide better compress rate than zlib for png image? Somebody told me that when a png image is stored in swf, it's separated to several layer, hence the alpha channel can be compressed better. Is it true? Or, once png image is imported into a swf, it's format is changed, e.g converted into bitmap data, and than compressed by swf's compress algorithm. That's, it is not in png format anymore.
I don't know how swf packing its resource, please tell me if you know.

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:
cylindrical coordinate point in origin I have a camera which has the following attributes:

pos (position of the camera in the scene)
look(either direction in which camera will face, or target vector)
up vector( y axis)

I am using cylindrical coordinates system for moving camera around centre of scene. my question is 'how can I find look vector of the camera in a such a way that it will be pointing out in the origin of the scene under 45 degree?'.

According to this thread there is not such a way.

  And you can never look directly down at the focal point, no matter how high up you go.

P.S: I need somehow to get look vector if it's possible.

Thank you for you attention

sentences: What advantages does DirectX 11 have over DirectX 10? What advantages does DirectX 11 have over DirectX 10?  Most of the new features seemed to be for directcompute from what I can tell, and how much more are you limiting your market by if you use DX11 compared to DX10 (assuming you don't add DX10 support).

sentences:
GraphView: Dragging a Blackboard causes it to get stuck offscreen I'm playing around with learning GraphView, and running into some strange problems with the Blackboard component. Here's a very simple repro:
using UnityEditor.Experimental.GraphView;
using UnityEngine.UIElements;

public class MyGraphView : GraphView
{
    public override Blackboard GetBlackboard()
    {
        var result = new Blackboard(this);
        /* COMMENTED OUT BLOCK #1
        var c = result.capabilities;
        result.capabilities = c & ~Capabilities.Movable;
        */
        /* COMMENTED OUT BLOCK #2
        result.RegisterCallback<MouseDownEvent>(OnMouseDown);
        result.RegisterCallback<MouseUpEvent>(OnMouseUp);
        result.RegisterCallback<MouseMoveEvent>(OnMouseMove);
        */
        return result;
    }

    public override void ReleaseBlackboard(Blackboard toRelease)
    {
        toRelease.RemoveFromHierarchy();
        /* COMMENTED OUT BLOCK #3
        toRelease.UnregisterCallback<MouseDownEvent>(OnMouseDown);
        toRelease.UnregisterCallback<MouseUpEvent>(OnMouseUp);
        toRelease.UnregisterCallback<MouseMoveEvent>(OnMouseMove);
        */
    }

    private static void OnMouseDown(MouseDownEvent e)
    {
        e.StopImmediatePropagation();
    }

    private static void OnMouseUp(MouseUpEvent e)
    {
        e.StopImmediatePropagation();
    }

    private static void OnMouseMove(MouseMoveEvent e)
    {
        e.StopImmediatePropagation();
    }
}

using System.Collections.Generic;
using System.Linq;
using UnityEditor;

public class MyGraphEditor : GraphViewEditorWindow
{
    protected MyGraphView _view;

    public override IEnumerable<GraphView> graphViews {
        get
        {
            yield return _view;
        }
    }

    private void OnEnable()
    {
        _view = new MyGraphView();
        this.rootVisualElement.Add(_view);
        _view.style.height = new StyleLength(new Length(100, LengthUnit.Percent));
    }

   [MenuItem("Tools/Graph Editor Test")]
   public static void ShowWindow()
    {
        var graphViewWindow = CreateInstance<MyGraphEditor>();
        var graphView = graphViewWindow.graphViews.FirstOrDefault();
        if (graphView != null)
        {
            var blackboard = graphView.GetBlackboard();
            graphView.AddElement(blackboard);
        }
        graphViewWindow.Show();
    }
}

Clicking the new menu item causes the window to open, just a blank editor window with a blank Blackboard. Clicking on the title bar of the Blackboard and attempting to drag it, though, causes it to immediately disappear. Checking in the UIElements Debugger shows that this is because it's somehow gotten its World Bound Y set to -79, so it's disappeared off the top of the window.
A bit of checking in the reference source suggests that if the Blackboard was not Movable, it couldn't be dragged around. Not ideal, but a temporary workaround at least. But if you uncomment the code that sets this up, (commented out block #1,) it breaks the editor entirely: clicking on the Blackboard causes Unity to stop responding to mouse clicks. Attempting to minimize the damage with the other two commented out blocks has no effect.
Anyone have any idea what's going wrong here and how to fix it? What do I need to do to have a Blackboard that can be dragged around properly?

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: 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:
How do you approach resolution independence in raster based graphics content? Those games that are not fortunate enough to run on a locked platform spec, like handhelds, need to run across various resolution formats and aspect ratios.

In a 3D game you might have a HUD or menu GUI based on raster graphics, and in a 2D game you might have a bunch of quads which are vessels for sprites.

So my question is, how do you approach designing and operating content across various resolutions and aspect ratio? Let's assume you have a sprite character that is 300x400 pixels sprite and surrounded by a level made of tiles. On different resolutions/aspect ratios you'd see a different FOV altogether. Or if you have a HUD or a GUI menu, you'd want to keep some stuff at same positions and of same size relative to the screen. Yet, graphics source is raster bitmaps, not vector.

Obviously, problem has been addressed numerous times. I'm interested to hear abut various approaches that worked for you so far. Do you keep an arbitrary dimension agnostic 'pixel' unit that you magically transform into needed dimensions via formula based on res and aspect ratio or other approaches?

edit:

So, conclusion is to enumerate your aspect ratios. Lowest combination of aspect:resolution is the one you design important stuff into. A safe area if you will. Same aspect ratios, but higher resolutions are simple scaling issues. Art content is designed for highest resolution. Larger aspect ratios simply show more of level/FOV with information presented which is not critical as is the one in safe area. Something like in this image I made.

sentences: 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:
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 is the simplest 3D file format to parse? I want to parse Blender-Made Files directly into my homemade Lisp program. I've been pulling data out of .X3D files manually. Is this the best format to focus on writing a parser for?

Thanks!

sentences:
Game Loop delay the right way and game speed I am a newbie game developer. I am trying to find a right way to create my game loop.

Consider following example.
Simple Android Game
I have a game with a simple gameplay - bouncing ball.

I want to have a control of the ball speed.
Also I want my game to have the same framerate (framespeed) on all devices.

Where the speed logic should be implemented ? In my case I have simple ball object with a velocity vector. I can change the velocity vector properties in order to make my ball move faster or slower, am I right ?
The Main Loop. I have read a lot of about this part of a game. I found this article http://gameprogrammingpatterns.com/game-loop.html . And decided to use this code example

    double previous = getCurrentTime();
    double lag = 0.0;
    while (true)
    {
    double current = getCurrentTime();
    double elapsed = current - previous;
    previous = current;
    lag += elapsed;

    processInput();

    while (lag >= MS_PER_UPDATE)
    {
    update();
    lag -= MS_PER_UPDATE;
    }
   render();
   }

I have a lot of questions about this example.

I have the similar loop in my game.

 @Override
        public void run() {
            while (mIsRunning) {
                processGameInput();
                updateGameState();
                drawGame();
            }
        }

I cannot understand while update(); is called while waiting for a constant delay ? Why not the render method ?
Maybe I am missing something.

Here is how my update for the ball looks like.

   public void updatePosition() {
        mCenterX += mVector.x;
        mCenterY += mVector.y;
    }

As you could see, each time I increase the position of the ball by the value of the velocity vector.

But as can guess, in case of using the example from the article, the update method will be called for instance 100 times. And the render method only once per 100 update method calls.
So in this case I guess, I the ball will be changing its position lagging.

My goal is to control the speed of the ball, for example from 0.1s - 2s.

How can achieve this ?

Please help to understand this topic. Any help would be highly appreciated.

sentences: How to get normals from volume density grid? I am meshing my volume density data with marching cubes. The density data is a flat array and it's elements contain a) distance from surface, b) a normal (xyz). However this normal is for the density grid point, no the calculated vertexes. So having this data can i calculate normal for each vertex?

sentences:
Side detection on Rectangle collision detection? How can I determine which of the sides on a Rectangle that was hit by another Rectangle (or Circle if that's easier)?

I originally tried creating 8 subrectangles for my main rectangle - one for each side and corner - with the appropriate length and width of one pixel. This didn't work out very well though, to my understanding it was thwarted by the speed and update frequency...

Any thoughts?

sentences:
Dealing with alpha for 2D per pixel lighting Right now I've got a simple light shader. Every bitmap I draw goes through it to make up the scene. I only draw quads.

   texture tex;
   sampler2D s = sampler_state {
      texture = <tex>;
   };

bool use_tex;

float x = 0.1;
float y = 0.3;

   float4 ps_main(VS_OUTPUT Input) : COLOR0
   {
float4 p = Input.vPosition / Input.vPosition.w;
      float4 color = 0;
      float a = color.a;
      if(!use_tex)
        {
           color = Input.Color;
        }
        else
        {
           color = Input.Color * tex2D(s, Input.TexCoord.xy);
        }
      p += 1.0;
      p /= 2;
      p.y = 1.0 - p.y;

      float3 lightAttenuation = float3(0.05,4.0, 0.0);
     // float4 color = Input.Color * tex2D(s, Input.TexCoord.xy);
      float2 aux = float2(x,y) - p.xy;
      float dist = length(aux);
      float attenuation=1.0/(lightAttenuation.x+lightAttenuation.y*dist

+lightAttenuation.z*dist*dist);

      float3 lightAttenuation2 = float3(0.05,3.0, 0.0);
      float2 aux2 = float2(0.5,0.4) - p.xy;
      float dist2 = length(aux2);
      float attenuation2=1.0/(lightAttenuation2.x

+lightAttenuation2.y*dist2+lightAttenuation2.z*dist2*dist2);

      color = (float4(attenuation,attenuation,attenuation,1.0) * color * float4(1.0,0.8,0.8,1.0)

* 0.8)  + (float4(attenuation2,attenuation2,attenuation2,1.0) * color * float4(1.0,0.8,1.0,1.0)

* 0.2);

      return color;
   }

The shader calculates based on the current pixel's screen position.

The problem is when the pixel's alpha is != 1.0

It this case it would need to be multiplied by what is already in the backbuffer at that pixel location  in order to get the correct final pixel.

What can I do to fix the alpha issue and deal with the alpha case?

Thanks

PS2.0 hlsl.

Edit

Here are 2 images, the bright one is when the whole scene is rendered to texture then the shader is applied. The second is when I apply the shader on each fragment as the scene is rendered. This is an area where there is a dark shadow  on the ground. The shadow is a semi transparent bitmap. Thus it makes the lighting effect weaker and it makes it look weird.

What I want is a way for it to look like the first one, but still letting me do per fragment shading.  What I was saying was that I thought of maybe looking at what is already in the backbuffer, then multiplying it by the current pixel, then taking that result, applying the shader to it, then obviously you set the alpha to 1.0.

Im not sure if or how that could work. Im wondering either how to do that, or a better way to get the same result.

Here is my shader source:

   texture tex;
   sampler2D s = sampler_state {
      texture = <tex>;
   };

bool use_tex;

float x = 0.1;
float y = 0.3;

   float4 ps_main(VS_OUTPUT Input) : COLOR0
   {
float4 p = Input.vPosition / Input.vPosition.w;
      float4 color = 0;

      if(!use_tex)
        {
           color = Input.Color;
        }
        else
        {
           color = Input.Color * tex2D(s, Input.TexCoord.xy);
        }
     float a = color.a;
      p += 1.0;
      p /= 2;
      p.y = 1.0 - p.y;

      float3 lightAttenuation = float3(0.05,4.0, 0.0);
     // float4 color = Input.Color * tex2D(s, Input.TexCoord.xy);
      float2 aux = float2(x,y) - p.xy;
      float dist = length(aux);
      float attenuation=1.0/(lightAttenuation.x+lightAttenuation.y*dist+lightAttenuation.z*dist*dist);

      float3 lightAttenuation2 = float3(0.0,2.1, 1.0);
      float2 aux2 = float2(-1.5 + x,0.4 + y) - p.xy;
      float dist2 = length(aux2);
      float attenuation2=1.0/(lightAttenuation2.x+lightAttenuation2.y*dist2+lightAttenuation2.z*dist2*dist2);

      float4 c = (float4(attenuation,attenuation,attenuation,1.0) * color * float4(1.0,0.9,0.9,1.0) * 0.2) + (float4(attenuation2,attenuation2,attenuation2,1.0) * color * float4(1.0,0.8,1.0,1.0) * 0.2);

      color = c;

      color.a = a;

      return color;
   }

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:
What's a good Flash game development tutorial, in FlashDevelop, for an absolute beginner? Ok, here's my situation: I'm tutoring a 14yo homeschooled student with very little previous programming experience, and I'd like to teach her how to program.  I think that Flash Actionscript 3 is a good resource for her to start out with, mostly because she seems to have an interest in game development.

I've decided that FlashDevelop, used alone, is the best interface for her to use, especially as she becomes more proficient in Flash.  The trouble is, while I am an extremely competent Web programmer in other languages, I have no experience with Actionscript at all, and I can't find a good tutorial for her to use.

The tutorial doesn't need to have the algorithmical basics of programming, like the concept of loops, if statements, OOP, etc; I can teach her those.  What I need is a tutorial that teaches Actionscript SYNTAX and walks you through the steps of game development in FlashDevelop.  Once I have that, I can do everything else.

Can anyone help me?

sentences:
Problem with moving player through a secript by a set distance I am currently trying to add a sort of "dash"-ability to my sidescroller.

What I try to do, is to let the player press a key where a simple key-press causes the player to move quickly into one direction by a predefined distance. During that dash, the character controller is disabled so the player is not able to cancle the dash itself. after the dash, the character controller is enabled again and the dash ability is disabled, so to say on cooldown.
Though the "predefined distance" is what isn't working.

The code for it I have so far is as following.
I have a script for choosing the animations and reacting to key Input, this script includes the following in it's Update method ("a" and "d" are set for the Dash). pstats is my object for the variables in the Player-script.

        float dashing = Input.GetAxis ("Dash");

    if (Input.GetKey ("a") && pstats.dashUsable)
    {
        pstats.DashLeft();
    }
    if (Input.GetKey ("d") && pstats.dashUsable)
    {
        pstats.DashRight();
    }
    if (!pstats.dashUsable)
    {
        dashing = 0.0f;
    }

My Playerscript contains:

    public bool dashUsable = true;
public bool dashUsing = false;
public bool attacking = false;

private IEnumerator WaitForNextDash() {
    yield return new WaitForSeconds(1.0f);
    dashUsable = true;
    Debug.Log("WaitForNextDash Done");
}

private IEnumerator WaitForDashToEnd() {
    yield return new WaitForSeconds(1.0f);
    Debug.Log ("dashUsable being changed");
    dashUsable = false;
    dashUsing = false;
    attacking = false;
    controller.enabled = true;
    StartCoroutine (WaitForNextDash ());
    Debug.Log("WaitForDashToEnd Done");
}

// The two lines below are to create the proper facing-direction for the player
Quaternion targetf = Quaternion.Euler(0, 270, 0);
Quaternion targetb = Quaternion.Euler(0, 90, 0);

public void DashLeft()
{
    attacking = true;
    dashUsing = true;
    controller.enabled = false;
    Debug.Log ("Dash-Left-Skill in use");
    transform.rotation = Quaternion.Slerp (transform.rotation, targetf, Time.deltaTime * 5000.0f);
    transform.position = Vector3.MoveTowards (transform.position, Vector3.right * -100f, 20 * Time.deltaTime);
    StartCoroutine (WaitForDashToEnd ());
}

public void DashRight()
{
    attacking = true;
    dashUsing = true;
    controller.enabled = false;
    Debug.Log ("Dash-Right-Skill in use");
    transform.rotation = Quaternion.Slerp(transform.rotation, targetb, Time.deltaTime * 5000.0f);
    transform.position = Vector3.MoveTowards (transform.position, Vector3.right * 100f, 20 * Time.deltaTime);
    StartCoroutine (WaitForDashToEnd ());
}

(Sorry for the large blocks of Code, but I thought to better include both)

The problem now is that instead of one button press causing a movement by a set distance... like 100 on the x-axis, the player moves as long as the key is hold. Also, the cooldown for some reason is direction dependant, meaning, if I dash to the right, the cooldown works for the right side, though I can dash to the left directily after without cooldown.

What I am trying to get is to have the WaitForDashToEnd to have a duration that fits the duration of the dash movement itself, I can fix that up as soon as I have the actual dash working. Since the dash movement doesn't work as intented yet, the "stun" during the dash isn't fully functional yet either, but that should more or less fix itself once the dash works.

So... how can I manage to have the dash work as a movement over a predefined distance, no matter how long the key is held?

edit: on a sidenote, during dash, the player is oddly lifted a bit above the ground, is there a way to fix that too? In either case, the dash itself has priority.

sentences:
How to make balls (water, or fluid) through pipe I'm working on a project and get stuck for days. I want to make balls going through the pipe like this game:

You can watch this Youtube video for more detail.
How can i replicate this game machenis?

sentences: How to use GLX from Java? I am trying to use Clojure to create an opengl window under Linux. Is there a tutorial on how to use GLX and X Window directly. I'd rather learn how to do this directly, which I already know how under Windows with win32 sdk, instead of relying on a wrapper.

sentences:
How can I reduce this code? Could you help me to reduce this code as much as possible?
public GameObject[] TextPage;

public void Skin0()
{
    foreach (GameObject go in TextPage)
    {
        go.SetActive(false);
    }
    TextPage[0].SetActive(true);
}
public void Skin1()
{
    foreach (GameObject go in TextPage)
    {
        go.SetActive(false);
    }
    TextPage[1].SetActive(true);
}
public void Skin2()
{
    foreach (GameObject go in TextPage)
    {
        go.SetActive(false);
    }
    TextPage[2].SetActive(true);
}

sentences:
How to display and hide complex object part in 2.5D I am working on a 2.5D mechanical app. I use 3D software like Blender to render the 3D model to create the 2D assets for the 2D game engine (which's cocos-creator , but it doesn't matter for this case).

How can I hide a part of object which's covered by another object with in the game engine? A sort of mask or something else, I am not sure.

For it has hundreds of object in the scene, like a car engine with all parts. So the solution I am looking for need to be automatic or half-automatic generated by 3D software (eg.Blender, etc), instead of full manual work like using Photoshop to create the mask.

sentences:
Follow Camera to Two objects at different time I am developing simple 2D game in unity. I am locked with the camera movement for last two days. I've camera script that is working as follows:

Follow the player to X and Y direction
If player stops moving, Camera must find the nearest enemy and should move to that direction

Both of the above function works fine, but separately.

Camera finds and follows the enemy, when there is no input from player for last 10 seconds.

But after few seconds (When stops following enemy), Camera retains the player's position. That creates unlikely effect in the scene. I want the camera to have a last position and started following player from there.

For your reference I'm writing my Camera Script.

public class MultipleTargetCamera : MonoBehaviour {   public List<Transform> targets;
[ReadOnly]
public GameObject closestEnemy = null;

public EnemyController closestEnemyController = null;

public Vector3 offset;
public float smoothTime = 0.5f;

private Vector3 velocity;

Vector3 camPosition;

// Update is called once per frame
void LateUpdate()
{
    /* if (targets.Count == 0)
         return;*/
    if (!TheGlobals.instance.movingTowardsEnemy)
    {
        MoveCamera();
    }
    else
    {
        MoveAsEnemy();
    }
}

void MoveAsEnemy()
{
    camPosition = new Vector3(transform.position.x + closestEnemyController.xDiff,
            transform.position.x + closestEnemyController.yDiff,
            transform.position.z);
    transform.position = Vector3.SmoothDamp(transform.position, camPosition, ref velocity, smoothTime);
}

void MoveCamera()
{
    Vector3 centerPoint = GetCenterPoint();

    Vector3 newPosition = centerPoint + offset;

    transform.position = Vector3.SmoothDamp(transform.position, newPosition, ref velocity, smoothTime);
}

Vector3 GetCenterPoint()
{
    Vector3 targetPos= new Vector3(targets[0].position.x,
        targets[0].position.y,
        transform.position.z);

    if(targets.Count==1)
    {
        return targetPos;
    }

    var bounds = new Bounds(new Vector3(targets[0].position.x,
        targets[0].position.y,
        transform.position.z), Vector3.zero);

    for(int i=0;i<targets.Count;i++)
    {
        bounds.Encapsulate(new Vector3(targets[i].position.x,
        targets[i].position.y,
        transform.position.z));
    }

    return bounds.center;
}

public void FindNearestEnemy()
{
    GameObject[] gos;
    gos = GameObject.FindGameObjectsWithTag("Enemy");

    float distance = Mathf.Infinity;
    Vector3 position = transform.position;
    foreach (GameObject go in gos)
    {
        Vector3 diff = go.transform.position - position;
        float curDistance = diff.sqrMagnitude;
        if (curDistance < distance)
        {
            closestEnemy = go;
            distance = curDistance;
        }
    }
    closestEnemyController = closestEnemy.GetComponent<EnemyController>();
    targets[0].parent = this.transform;
    StartCoroutine(StopMovingTowardsEnemy());
}

IEnumerator StopMovingTowardsEnemy()
{
    yield return new WaitForSeconds(0.01f);
    TheGlobals.instance.movingTowardsEnemy = false;
}

}

I hope I did explain well. Looking for the answer. Thank you in advance!

sentences:
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:
Bullet softbody nodes messed up positions I recently switched from Havok physics to Bullet because I wanted to have soft body collisions, but I don't have any budget to license the (superior?) Havok solution, I couldn't even try those functions out there so it is completely new to me.
I want to create a soft body from an arbitrary mesh and for that I use the soft body helper:

btVector3* btVerts = new btVector3[vertices.size()];
for(int i=0;i<vertices.size();++i)
    btVerts[i] = (btVector3(vertices[i].pos.x,vertices[i].pos.y,vertices[i].pos.z));
const int iCount = indices.size();
const int tCount = iCount/3;
int* btInd = new int[iCount];
for(int i=0;i<iCount;++i){
    btInd[i] = (int)indices[i];
}

btSoftBody* softBody = btSoftBodyHelpers::CreateFromTriMesh(
        ((btSoftRigidDynamicsWorld*)dynamicsWorld)->getWorldInfo()
        ,(btScalar*)btVerts
        ,&btInd[0],tCount
        ,false
    );

Where vertices and indices are vector references coming from my graphics engine. I fill out the mesh with that information and seemingly I can create it without problem. After I step the physics world I connect my BULLET softbody nodes to my vertices in the graphics engine, then updating the vertex buffer.
I get the information from the softbody nodes by their tNodeArray m_nodes this way:

btSoftBody::tNodeArray&   nodes(softBody->m_nodes);

    for(int j=0;j<nodes.size();++j)
    {
        verticesIn[j].pos=XMFLOAT3(nodes[j].m_x.getX(),nodes[j].m_x.getY(),nodes[j].m_x.getZ());
        verticesIn[j].nor=XMFLOAT3(nodes[j].m_n.getX(),nodes[j].m_n.getY(),nodes[j].m_n.getZ());
    }

The problem: However I do not get correct vertex positions and neither correct normals. I am using a simple quad mesh with 4 vertices (the positions):
{ (-1,0,-1), (1,0,-1), (1,0,1), (-1,0,1) }
But if I get values from the softbody's nodes after creation, but before stepping any physics I don't get back my original values from the nodes (the positions):
{ (-1,0,-1), (0,1,0), (-1,0,1), (0,1,0) }
I even noticed the node vertices kind of resemble the originals, just "overlapped" somehow or not sure how can I describe if it is even the case, but it is like the second vector has an extra zero at the beginning and the whole mesh got screwed up.
Could it be something is not right with my loading? Or do I miss something in the concept of soft body physics?
I have studied the bullet soft body sample which is quite informative and they sure load their meshes like I do (the bunny mesh for instance), at least it seems like it. I don't have any idea and got stuck here for a day now. Without connecting to the softbody, my mesh remains correct.

sentences:
Can i use the same name for a spell in my game that already exists in another game what does trademarks and copyrights contain.
how similar can a name be to a name that already exists.

sentences:
How do I make a puzzle piece move smoothly between locations? I'm building a 2048 clone to sharpen my Libgdx skills, but I don't know how to ease a tiles between board locations. When I slide my finger, the tile moves rather swiftly. How I can make the movement smoother?

This is the code I'm using to make it move to the left:

 for(float t=0;t<getMax(currentTile);t++
 {
  shapeRenderer.begin(ShapeType.Filled);
  shapeRenderer.setColor(230/255.0f, 220/255.0f, 230/255.0f, 1);
  shapeRenderer.rect(q-t, r, a, b);
  shapeRenderer.end();
 }

sentences:
Know any 3D game makers that work on chromebooks? Ok so I make flash games using a website named scratch.mit.edu, and it used to be a downloadable program in 2013. They have had 3 major updates to the site since 2013. Understand that this site is for people ages 8 and up. It teaches you a type of flash coding with blocks. Like IF, Space key pressed, Wait 20 seconds, then change sprite 2's costume to #3. I'm not sure if any of that is a good enough base for actual coding. There are people, more professional, who have managed to use it too make 3D imaging and animations on the site and it's really amazing but I have no idea how to do that or if I want too based on the amount of lag.

So I have two questions:

One, what is the best way to learn coding without college.
 (preferably free)

Two, are there any 3D game creators that don't need coding experience and can actually work using a Samsung Chromebook?

I know i'm not a professional but I couldn't find the amatuer game developer site, if you could direct me there that would be great.

sentences:
Unity3D: Disable player input but not character movement? I'm trying to code a dash/air dash for a 2D platformer. In my character controller's FixedUpdate(), I have various if statements that cause certain actions when a button is pressed.

To disable player input while the dash was happening, I tried putting Dash() in an IEnumerator with a simple test code like this:

IEnumerator Dash() {
    if (player.GetAxis("Horizontal") < 0)
        {
            thePlayer.GetComponent<HeroController>().enabled = false;
            yield return new WaitForSeconds(0.5f);
            move = move * 2;
            thePlayer.GetComponent<HeroController>().enabled = true;
    }
}

But since the character's physics are inside the character controller, both the player's input and the character's movements are stopped when the controller is disabled. How can I disable inputs while still allowing the character to dash?

sentences:
Collision Detection in Direction (SFML) I am experiencing a problem with collision detection, an efficiency problem. Right now I want to make it so that my player square stops traveling in the direction of collision into the static object. I followed what a guy did in a tutorial when he checked this type of collision but it's long and hard to understand let alone read. Is there an easier way to tackle this issue?

sf::RectangleShape player;
player.setSize(sf::Vector2f(50, 50));
player.setFillColor(sf::Color::Cyan);
player.setPosition(width / 2, height / 2);

sf::RectangleShape object;
object.setSize(sf::Vector2f(100, 100));
object.setFillColor(sf::Color::Green);
object.setPosition((width / 2) - 200, (height / 2) - 120);

sf::Vector2f velocity(0, 0);
float gravity = .1;

bool jumping = true;

sf::Event event;
while (window.isOpen())
{
    while (window.pollEvent(event))
    {
        if (event.type == sf::Event::Closed)
            window.close();

        if (event.type == sf::Event::KeyPressed)
        {
            if (event.key.code == sf::Keyboard::Space)
            {
                if (jumping == false)
                {
                    velocity.y = -3.5;
                    jumping = true;
                }
            }
            else if (event.key.code == sf::Keyboard::Right)
            {
                velocity.x = 3;
            }
            else if (event.key.code == sf::Keyboard::Left)
            {
                velocity.x = -3;
            }
        }
    }

    //Move the player
    player.move(velocity);

    //Gravity

    if (player.getPosition().y < height / 2)
    {
        velocity.y += gravity;
    }
    else if (player.getPosition().y >= height / 2)
    {
        player.setPosition(player.getPosition().x, height / 2);
        jumping = false;
    }

    //Check collision with object
    sf::FloatRect player_boundingBox = player.getGlobalBounds();

    if (player_boundingBox.intersects(object.getGlobalBounds()) && player.getPosition().y + 50 < object.getPosition().y + 5 && player.getPosition().y + 50 > object.getPosition().y && player.getPosition().y < object.getPosition().y)
    {
        player.setPosition(player.getPosition().x, object.getPosition().y - 50);
    }
    else if (player_boundingBox.intersects(object.getGlobalBounds()) && player.getPosition().x > object.getPosition().x + 90 && player.getPosition().x < object.getPosition().x + 99)
    {
        player.setPosition(object.getPosition().x + 100, player.getPosition().y);
        velocity.x = 0;
    }
    else if (player_boundingBox.intersects(object.getGlobalBounds()) && player.getPosition().x + 50 < object.getPosition().x + 10 && player.getPosition().x + 50 > object.getPosition().x)
    {
        player.setPosition(object.getPosition().x - 50, player.getPosition().y);
        velocity.x = 0;
    }
    else if (player_boundingBox.intersects(object.getGlobalBounds()) && player.getPosition().y > object.getPosition().y + 97 && player.getPosition().y < object.getPosition().y + 99)
    {
        player.setPosition(player.getPosition().x, object.getPosition().y + 100);
        velocity.y = 0;
    }

    window.clear(sf::Color::White); //Clear

    window.draw(player);
    window.draw(object);

    window.display(); //Display
}

sentences:
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:
Why was my Facebook game rejected with the note that "your app icon must not overlap with content in your cover image?" My FB game just recently got rejected for two reasons. The first I fixed, but I just can't see to figure out what they mean by the second, and I was hoping someone else got the same issue and did know what they meant.

The remaining error is:

  Cover Image

  Your app icon must not overlap with content in your cover image.  Click on 'Web Preview' in the 'App Details' section to check for overlap prior to submitting your app.  See more here.

All I know is that the rejection has something to do with the cover image, not the icons or the screenshots.

The web preview of my game looks like this now:

Please let me know what to do to get approved.

sentences:
What does the term "channel" mean when used in regards to computer graphics? I was studying terminology for computer graphics, and this statement came up that confused me.

  The image can have alpha channels for transparency.

I tried searching for the meaning of the term "alpha channel," but I got really confused by the definition which used another concept called a "channel." I'm not really sure what this means, so could someone be kind enough to please explain this term to me?

sentences:
Pygame Import Error, Python 3.2 I'm having an issue with the Pygame module. I run Python 3.2 and installed the respective Pygame file, but now when I try to import it in the IDLE, it gives me this error:

>>> import pygame
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import pygame
  File "C:\Python32\lib\site-packages\pygame\__init__.py", line 95, in <module>
    from pygame.base import *
ImportError: DLL load failed: %1 is not a valid Win32 application.

Any help will be appreciated.

sentences:
Alpha blending is too smooth I got the exercise to create a color map from a heightfield and given normals with alpha blending.
Therefore I have to blend 4 textures (deep-flat, deep-steep, high-flat, high-steep) depending on the height and slope.

First I'm calculating the 3 alpha values (lowest layer is fully opaque, does not need to be blended -> gras texture)

//slope:= 1.0f - normal.z at current pixel

￼void calcAlphas(float height, float slope, float& alpha1, float& alpha2, float& alpha3) {
   alpha1 = (1-height) * slope; //low-steep ->  dirt texture
   alpha2 = height;             //high-flat ->  pebbles texture
   alpha3 = height * slope;     //high-steep -> rock texture
}

After that I'm getting the color at the current pixel of all four textures and calculating the final color:

3 = 3 ∗3 +(1−3)∗(2 ∗2 + 1−2 ∗(1∗1 + 1−1 ∗0))

The result looks pretty good but it's very smooth. To compare my result I got a pattern how it should be.

Orignal:

My own color map:

sentences:
How do I fix this access violation when I exit my custom OpenGL game engine? I'm writing an game engine, where the engine is written in a project and exports a .dll file. In another project, in the same solution as the engine, there is a sandbox project which uses the engine. However, there is a bug.

I run the sandbox project in debug mode with the engine dll. When I spam my mouse and keyboard for a few seconds, and close the program via the exit button, the program crashes with an error:

  Exception thrown at 0x00000043 in phantom-sandbox.exe: 0xC0000005: Access violation executing location 0x00000043.If there is a handler for this exception, the program may be safely continued.

I found the source of the bug. Since I'm currently writing the engine for OpenGL, I have to initialize GLEW, and I need to create a HGLRC. If I don't initialize this HGLRC, everything works.

This is not the ideal solution, since I need to use OpenGL for my engine. I went forth without exporting the .dll from the engine, making the engine an application, instead. I made a main.cpp, and wrote it to use the engine, enabling OpenGL rendering. I tried to recreate the bug, but everything works!

I thought it might OpenGL, but then now I'm thinking it might be my engine. How do I fix this?

Here is my code, where it errors:

    int const main_result = invoke_main()

    __telemetry_main_return_trigger(nullptr);

    if(!__scrt_is_managed_app())
        exit(main_result)l

    if(!has_actor) // < this is the line being sent to the call stack
        _cexit();

    __scrt_unititialize_crt(true, false);
    return main_result;
}

__except (_seh_filter_exe(GetExceptionCode(), GetExceptionInformation()))
{
    int const main_result = GetExceptionCode();

    if(!__scrt_is_managed_app())
        _exit(main_result);

Here is the call stack:

sentences: DirectX the same across platforms? Various versions of DirectX are available on both Windows and Xbox. Are the libraries the same on both platforms? Obviosly I'm talking about the interfaces — such as the ones for working with windows, input, etc —, not their actual implementation.

sentences: Effect of graphics card on game programming I know the question can be pretty funny to some, but I have been thinking, does a gaming  graphics card like agtx and a professional graphics card like quaddro have any effect on game development during texture rendering, materials, importing assets, shader compilation, etc..

sentences:
Using SurfaceFormat.Single and HLSL for GPGPU with XNA I'm trying to implement a so-called ping-pong technique in XNA; you basically have two RenderTarget2D A and B and at each iteration you use one as texture and the other as target - and vice versa - for a quad rendered through an HLSL pixel shader.

step1: A--PS-->B
step2: B--PS-->A
step3: A--PS-->B

...

In my setup, both RenderTargets are SurfaceFormat.Single.

In my .fx file, I have a tachnique to do the update, and another to render the "current buffer" to the screen.

Before starting the "ping-pong", buffer A is filled with test data with SetData<float>(float[]) function: this seems to work properly, because if I render a quad on the screen through the "Draw" pixel shader, i do see the test data being correctly rendered.

However, if i do update buffer B, something does not function proerly and the next rendering to screen will be all black.

For debug purposes, i replaced the "Update" HLSL pixel shader with one that should simply copy buffer A into B (or B into A depending on which among "ping" and "pong" phases we are...).
From some examples i found on the net, i see that in order to correctly fetch a float value from a texture sampler from HLSL code, i should only need to care for the red channel.

So, basically the debug "Update" HLSL function is:

float4 ComputePS(float2 inPos  : TEXCOORD0) : COLOR0
{
  float v1 = tex2D(bufSampler, inPos.xy).r;
  return float4(v1,0,0,1);
}

which still doesn't work and results in a all-zeroes ouput.
Here's the "Draw" function that seems to properly display initial data:

float4 DrawPS(float2 inPos  : TEXCOORD0) : COLOR0
{
  float v1 = tex2D(bufSampler, inPos.xy).r;
  return float4(v1,v1,v1,1);
}

Now: playing around with HLSL doesn't change anything, so maybe I'm missing something on the c# side of this, so here's the infamous Update() function:

_effect.Parameters["bufTexture"].SetValue(buf[_currentBuf]);
_graphicsDevice.SetRenderTarget(buf[1 - _currentBuf]);
_graphicsDevice.Clear(Color.Black); // probably not needed since RenderTargetUsage is DiscardContents
_effect.CurrentTechnique = _computeTechnique;
_computeTechnique.Passes[0].Apply();
_quadRender.Render();
_graphicsDevice.SetRenderTarget(null);
_currentBuf = 1 - _currentBuf;

Any clue?

sentences:
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:
Load all materials with loadallassetbundles before objects? I have a lot of objects as assetbundles and they're growing.
I didn't want to have the user to download the materials for every asset because they all share their materials. so I put all the materials in an assetbundle and load it by LoadAllAssets() in the Awake() function so they are present in the game for the assets to use.
The problem is that asset load without materials. the ones that have material don't have shader. Is LoadAllAssets() not the answer? what should I do?

sentences: Slick2D drawString with coordinates from bottom-left corner For OpenGL text drawing I use Slick2D library. Default Slick2D 0:0 coordinates are at upper-left corner. But in my project I use bottom-left corner for 0:0. Is it real to configure Slick2D with bottom-left corner as starting point?

sentences:
Unity: how to apply programmatical changes to the Terrain SplatPrototype? I have a script to which I add a Terrain object (I drag and drop the terrain in the public Terrain field).

The Terrain is already setup in Unity to have 2 PaintTextures: 1 is a Square (set up with a tile size so that it forms a checkered pattern) and the 2nd one is a grass image:

Also the Target Strength of the first PaintTexture is lowered so that the checkered pattern also reveals some of the grass underneath.

Now I want, at run time, to change the Tile Size of the first PaintTexture, i.e. have more or less checkers depending on various run time conditions. I've looked through Unity's documentation and I've seen you have the Terrain.terrainData.SplatPrototype array which allows you to change this. Also there's a RefreshPrototypes() method on the terrainData object and a Flush() method on the Terrain object. So I made a script like this:

public class AStarTerrain : MonoBehaviour {

    public int aStarCellColumns, aStarCellRows;

    public GameObject aStarCellHighlightPrefab;
    public GameObject aStarPathMarkerPrefab;
    public GameObject utilityRobotPrefab;
    public Terrain aStarTerrain;

    void Start () {
            //I've also tried NOT drag and dropping the Terrain on the public field
            //and instead just using the commented line below, but I get the same results
        //aStarTerrain = this.GetComponents<Terrain>()[0];
        Debug.Log ("Got terrain "+aStarTerrain.name);

        SplatPrototype[] splatPrototypes = aStarTerrain.terrainData.splatPrototypes;
        Debug.Log("Terrain has "+splatPrototypes.Length+" splat prototypes");
        SplatPrototype aStarCellSplat = splatPrototypes[0];
        Debug.Log("Re-tyling splat prototype "+aStarCellSplat.texture.name);
        aStarCellSplat.tileSize = new Vector2(2000,2000);
        Debug.Log("Tyling is now "+aStarCellSplat.tileSize.x+"/"+aStarCellSplat.tileSize.y);
        aStarTerrain.terrainData.RefreshPrototypes();
        aStarTerrain.Flush();
    }

//...

Problem is, nothing gets changed, the checker map is not re-tiled. The console outputs correctly tell me that I've got the Terrain object with the right name, that it has the right number of splat prototypes and that I'm modifying the tileSize on the SplatPrototype object corresponding to the right texture. It also tells me the value has changed. But nothing gets updated in the actual graphical view.

So please, what am I missing?

sentences:
LibGDX HexagonalTiledMapRenderer wrong stagger index? Im using Tiled map editor, Hexagonal(staggered) map, libgdx version 1.9.9

If I set staggeredIndex = even in tiled map editor, libgdx seems to render odd

If I set it to odd in map editor, libgdx renders even

Screen Shots:

Here's the code:

@Override
public void create () {
    map = new TmxMapLoader().load("mapa.tmx");
    cam = new OrthographicCamera(Gdx.graphics.getWidth(),Gdx.graphics.getHeight());
    mapRenderer = new HexagonalTiledMapRenderer(map);

}

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

    cam.update();
    mapRenderer.setView(cam);
    mapRenderer.render();
}

sentences:
Should I Open/Close SpriteBatch with different settings? I'm still new in game developpement, and I'm trying to complete my 1st game. Its a simple 2d game, but i'm trying to add lots of differents techniques in it.

It's all good when you take a single tutorial (I followed some tutorials for the screen managers, for diffuse lightning, for camera, HUD, particles, spritesheet animations, etc. )
It's all quite simple to get it to works and run in a simple game.cs file.

the problem I have is when its time to all mix it toghether. I cant find any good pointers on how I should handle the spritebatch orderings. Should I use different spritebatch, or reuse the same over and over ? I was told I need to utilise as little spritebatch as possible ...

** I KNOW i could test it and start to wonder about it only if I have a problem ... but instead I'd prefer to learn to do it right the 1st time I try it. If I get into a bigger project and this way of doing it only works on easy small 2d game ... its not much better than saying I've never done anything.

More specificly, I'm wondering if I keep my main Draw set up like this :

 graphicsDevice.Clear(Color.Black);

 spriteBat.Begin(paramteres set up for my camera);
   for each screen in screenmanager {
     screen.draw(spritebatch);
   }
 spriteBat.End();

  spriteBat.Begin(paramteres set up for my HUD);
     //draw hud stuff
  spriteBat.End();

....

and in my screens draw method ... i'll end up with :

void Draw(spritebat Spritebatch)
{
     //draw screen "normal" item affected by camera
  spriteBat.End();

  spriteBat.Begin(paramteres set up for particle);
    for each particlelist in particlemanager {
      for each particle in particleList
        particle.draw(spritebatch);
      }
    }
   spriteBat.End();

 spriteBat.Begin(paramteres set up for my light FX);
    //draw diffuse light and shadows stuff
 spriteBat.End();

 spriteBat.Begin(paramteres set up for my camera);
}

is this correct ?

sentences:
How to make an illusion where the contents of a 3D shape change based on which face you look through? I remember coming across a Unity 3D tutorial where there was a technique where the contents of a 3D shape change based on which face you are looking at, similar to this screenshot from Antichamber:

What is this techique called? And how do I implement it into a Unity 3D project?
Thanks in advance.

sentences:
Having issues with pong physics, is my approach wrong? I've been working on a pong clone, i've made games in the past but they have all been very hacky. This time I was trying to go for a better approach in terms of using OOP or patterns. So far the games not posed many issues, I am however having problems thinking about the collision system and ball physics. In my main loop the collision code is as follows:

if (ball->Y < 0)
{
    ball->direction = -ball->direction;

    if (ball->ballSpeed < 700)
    {
        ball->ballSpeed += 25;
    }
}

if ((ball->X + ball->width > player2->X)
    && (ball->X + ball->velocityX) + (ball->width) < player2->X + player2->width
    && (ball->Y + ball->velocityY) + (ball->height) > player2->Y
    && (ball->Y + ball->velocityY) + (ball->height) < player2->Y + player2->height)
{
    ball->direction -= 70;

    if (ball->ballSpeed < 700)
    {
        ball->ballSpeed += 25;
    }
}

if ((ball->X + ball->width) > player1->X
    && (ball->X + ball->velocityX) + (ball->width) < player1->X + player1->width
    && (ball->Y + ball->velocityY) + (ball->height) > player1->Y
    && (ball->Y + ball->velocityY) + (ball->height) < player1->Y + player1->height)
{
    ball->direction += 70;
    if (ball->ballSpeed < 700)
    {
        ball->ballSpeed += 25;
    }
}

The program checks the points of the objects rect's to see if they have passed any of the paddles and then applies changes to the balls public variables. Here is the ball update code:

if(move)
{
velocityX = int(cos((direction + 0.0) * M_PI / 180.0) * (ballSpeed *deltaTime));
velocityY = int(sin((direction + 0.0) * M_PI / 180.0) * (ballSpeed *deltaTime));

    rect.x += velocityX;
    rect.y += velocityY;
}

X = rect.x;
Y = rect.y;
width = rect.w;
height = rect.h;

This PARTIALLY works however the ball goes in weird directions sometimes, on top of that the ball can actually go through the bottom portion of the paddle (it seems that from the bottom of the paddle, there is a gap the ball can exactly fit through). Really the physics of the ball just seem weird and not fluid at all. I'm not brilliant at maths so I don't really know of any other way to go about this. Help would be greatly appreciated.

sentences:
How do I get the number of Steam friends online programmatically? How can I get the current number of Steam friends online in order to insert it into a script or program? I'm looking to use this value to do something like changing an LED colour or for providing data for a desktop widget etc.

Is this possible? How do I get access to that number?

P.S. I got my idea from here: Xbox Live Traffic Light Notifies You When Friends are Gaming

sentences:
XNA: Placing a "field of view" rectangle on a minimap I'm building a top-view 3ed person shooter. I have a HUD and in the HUD I have a minimap. I'm trying to draw on this minimap a rectangle which shows me my "visual field", meaning i see on the minimap which part of the map I'm currently seeing.

I've nearly achieved this, except for a scaling problem. Here's my code:

float distX = ScreenWidth - Tools.MapToCamera(Camera.pos.X, Camera.pos.Y).X;
float distY = ScreenHeight - Tools.MapToCamera(Camera.pos.X, Camera.pos.Y).Y;

Vector2 topLeft = new Vector2((calcX((Camera.pos.X - distX) / (Bg.Width / Tools.minimap.Width) + Tools.minimap.X)),
            (calcY((Camera.pos.Y - distY) / (Bg.Height / Tools.minimap.Height) + Tools.minimap.Y)));

Vector2 rightBottom = new Vector2 ((calcX((Camera.pos.X + distX) / (Bg.Width / Tools.minimap.Width) + Tools.minimap.X)),
            (calcY((Camera.pos.Y + distY) / (Bg.Height / Tools.minimap.Height) + Tools.minimap.Y)));

Tools.DrawLine(topLeft, new Vector2 (rightBottom.X, topLeft.Y), Color.WhiteSmoke);
Tools.DrawLine(topLeft, new Vector2 (topLeft.X, rightBottom.Y), Color.WhiteSmoke);
Tools.DrawLine(new Vector2 (topLeft.X, rightBottom.Y), rightBottom, Color.WhiteSmoke);
Tools.DrawLine(new Vector2 (rightBottom.X, topLeft.Y), rightBottom, Color.WhiteSmoke);

ScreenWidth/ScreenHeight are the current PreferredBackBuffer sizes.
Bg means BackGround, contains height/width, etc. of the map.
calcX(float num) : multiplies num by the current scale of the HUD.

HUD scale is measured by: hudScale = ScreenWidth / hudWidth

calcY:
float calcY(float y)
{
return y * hudScale + (ScreenHeight - (hudHeight * hudScale));
}

internal static V2 MapToCamera(float X,float Y)
{
    return new V2(X * (Tools.w / Bg.Width), Y * (Tools.h / Bg.Height));
}

public static void DrawLine(V2 start, V2 end, Color clr)
{
    sb.Draw(pointTex,start, null, clr,(float)Math.Atan2(end.X - start.X, start.Y - end.Y),
        new V2(0.5f, 1), new V2(1, (start - end).Length()), SpriteEffects.None,0);
}

pointTex = new Texture2D(gd, 1, 1); (Color set: White)

These are all the functions in use.
The end result is a rectangular frame around my position on the minimap. It follows me and i'm mostly in it's center.

The problem is, this rectangle comes out about twice larger than it should be.

Anyone care to help me with this?

  P.S: I don't use any scaling on the map or the other sprites. Scaling is done only on the HUD and it's objects. Although, I use a zoom factor for my Camera class.

Thanks in advance.

sentences:
Get world coordinate under mouse (at a ground plane for Warcraft 3 like movement) I want to let a unit follow the mouse like in any RTS (Warcraft 3, Starcraft, ...). For that I have a "ground plane" which is defined through 2 vectors, the X and Z axis. Now I need to get the world coordinate of the mouse click on this plane in order to move the unit. I'm using OGRE & C++.

How can I get the coordinates of the mouse click on the ground plane?

sentences:
Is using sprite sheets and drawing specific part the way to go? I'm programming in Java.

I have more than 200 MB of images used in my games, something like 100000 40x40ish images. I initially wanted to load them all during app initialization but it took like 2 minutes to do so.

Since I do not need them all at the same time I may load the ones I need before entering a new game state (quick loading screen), but there is still a delta time that I can't afford, so I was wondering if it wouldn't be better to gather them into larger images (sprite sheets) to reduce the cost of I/O. But here I am : if I do so, what is the best approach for rendering : splitting these big images back into smaller ones, or keeping the sprite sheets in memory and rendering the needed parts of these sheets directly using Graphics#drawImage?

I will test a simple game loop using the second option to see what happens performance-wise, and come back to compare with what you advice me to do.

I hope I was clear, don't hesitate to ask me to reword an incomprehensible of mine.

EDIT: I just tested loading using sprite sheets and I was able to do load my 200 MB in less than 10 seconds, which means that if rendering little parts of an image can be done at high rate my problem is solved.

sentences:
How do I determine the rotation of a Tile using Tilemap in Unity 2d? I want to know the rotation of the tile in C# in order to do some logic on another object that is sitting on the tile. The rotation matters for the logic. I don't see anything except GetTileData in the doc, but that doesn't actually seem to "Get" the tile data. I could cast to Tile but not all tiles are Tile. Alternatively, I think I can get the rotation if I can get the GameObject for the tile but I have no idea how to do that either from a BaseTile.

Anyone have any suggestions? Maybe I'm trying to do this wrong and I should make different tiles for each orientation or extend BaseTile or some other solution instead of trying to determine rotation. Any help or ideas would be greatly appreciated!

Additional info: When I inspect around in the Unity editor I see that the rotation is stored in Z in something called "Grid Selection" but I can't find a programmatic way of accessing that.

sentences: Would using Lua scripts to define game logic for an MMO server be a lot slower than compiled in C++? I am using an entity system for my MMO server and I was thinking about defining the behavior of "actions" using Lua scripts. The server is written in C++. I am not very familiar with the speed/memory usage of Lua in C++ but I have used it for scripting the GUI of the client. Would using Lua to define the game logic on the server side cut the performance by a lot?

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:
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:
I don't understand code that builds 3D sphere I'm trying to learn some lwjgl and opengl, and I was trying to make a 3d sphere etc, I found a code to do that, but I don't 100% understand the code and the math behind it and would like to get some deeper explanation about it.

This is my draw sphere method:

public void drawSphere(float radius) {
    final float PI = 3.141592f;
    float x, y, z, alpha, beta;
    int gradation = 100;
    for (alpha = 0.0f; alpha < Math.PI; alpha += PI / gradation) {
        glBegin(GL_TRIANGLE_STRIP);
        for (beta = 0.0f; beta < 2.01f * Math.PI; beta += PI / gradation) {
            x = (float) (radius * Math.cos(beta) * Math.sin(alpha));
            y = (float) (radius * Math.sin(beta) * Math.sin(alpha));
            z = (float) (radius * Math.cos(alpha));
            glTexCoord2f(beta / (2.0f * PI), alpha / PI);
            glVertex3f(x, y, z);
            x = (float) (radius * Math.cos(beta) * Math.sin(alpha + PI / gradation));
            y = (float) (radius * Math.sin(beta) * Math.sin(alpha + PI / gradation));
            z = (float) (radius * Math.cos(alpha + PI / gradation));
            glTexCoord2f(beta / (2.0f * PI), alpha / PI + 1.0f / gradation);
            glVertex3f(x, y, z);
        }
        glEnd();
    }
}

I understand the general idea of this, and I understand how the x, y, z are calculated, but what I don't understand is the 2 nested loops aka:

for (alpha = 0.0f; alpha < Math.PI; alpha += PI / gradation)

and

for (beta = 0.0f; beta < 2.01f * Math.PI; beta += PI / gradation)

One more thing, is the glTexCoord2f that I don't quite understand the math behind it, so an explanation about this would be really nice as well for:

glTexCoord2f(beta / (2.0f * PI), alpha / PI);

and

glTexCoord2f(beta / (2.0f * PI), alpha / PI + 1.0f / gradation);

sentences:
Deal Damage to Player I have to make a simple "avalanche" game to show I know how to use the physics and creating terrain. But I actually wanted to go a little above and beyond and actually give the player health so there is a actual purpose to dodging the sphere objects. I found a very useful guide on how to set up player health, the only thing is I don't know how to set up the player taking damage when he collides with a sphere. Here is the code I have for the players health

#pragma strict

public var health : float = 100f;                           // How much health the player has left.
public var resetAfterDeathTime : float = 5f;                // How much time from the player dying to the level reseting.
public var deathClip : AudioClip;                           // The sound effect of the player dying.

private var anim : Animator;                                // Reference to the animator component.
private var playerMovement : PlayerMovement;            // Reference to the player movement script.
private var hash : HashIDs;                             // Reference to the HashIDs.
private var sceneFadeInOut : SceneFadeInOut;            // Reference to the SceneFadeInOut script.
private var lastPlayerSighting : LastPlayerSighting;    // Reference to the LastPlayerSighting script.
private var timer : float;                                  // A timer for counting to the reset of the level once the player is dead.
private var playerDead : boolean;                           // A bool to show if the player is dead or not.

function Awake ()
{
    // Setting up the references.
    anim = GetComponent(Animator);
    playerMovement = GetComponent(PlayerMovement);
    hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent(HashIDs);
    sceneFadeInOut = GameObject.FindGameObjectWithTag(Tags.fader).GetComponent(SceneFadeInOut);
    lastPlayerSighting = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent(LastPlayerSighting);
}

function Update ()
{
    // If health is less than or equal to 0...
    if(health <= 0f)
    {
        // ... and if the player is not yet dead...
        if(!playerDead)
            // ... call the PlayerDying function.
            PlayerDying();
        else
        {
            // Otherwise, if the player is dead, call the PlayerDead and LevelReset functions.
            PlayerDead();
            LevelReset();
        }
    }
}

function PlayerDying ()
{
    // The player is now dead.
    playerDead = true;

    // Set the animator's dead parameter to true also.
    anim.SetBool(hash.deadBool, playerDead);

    // Play the dying sound effect at the player's location.
    AudioSource.PlayClipAtPoint(deathClip, transform.position);
}

function PlayerDead ()
{
    // If the player is in the dying state then reset the dead parameter.
    if(anim.GetCurrentAnimatorStateInfo(0).nameHash == hash.dyingState)
        anim.SetBool(hash.deadBool, false);

    // Disable the movement.
    anim.SetFloat(hash.speedFloat, 0f);
    playerMovement.enabled = false;

    // Reset the player sighting to turn off the alarms.
    lastPlayerSighting.position = lastPlayerSighting.resetPosition;

    // Stop the footsteps playing.
    audio.Stop();
}

function LevelReset ()
{
    // Increment the timer.
    timer += Time.deltaTime;

    //If the timer is greater than or equal to the time before the level resets...
    if(timer >= resetAfterDeathTime)
        // ... reset the level.
        sceneFadeInOut.EndScene();
}

public function TakeDamage (amount : float)
{
    // Decrement the player's health by amount.
    health -= amount;
}

Thanks for the help guys, and helping me to learn unity.

sentences:
How do you implement AABB? I am having some trouble peforming an overlap test on a axis aligned bounding box.

Here is my code

public boolean overlapps(AABB other) {
    return false;
   }

}

I don't know how to implement this method.

Here is what I tried

public boolean overlapps(AABB other) {
    if(min.x <= other.max.x && max.x >= other.min.x) {
        if(min.y <= other.max.y && max.y >= other.min.y) {
            if(min.z <= other.max.z && max.z >= other.min.z) {
                return true;
            }
        }
    }
    return false;
}

sentences:
Simplex Noise flat land and hills I'm using the simplex noise to create Minecraft like terrain.
I can only achieve hills like this.

Does anyone know how to use simplex to make more dynamic landscapes?

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:
ParticleEffectPool.obtain() not resetting particles I want to use ParticleEffectPools in libGDX but I'm running into an odd issue where the effects don't seem to be reset when obtained by the pool. The code below looks for an existing ParticleEffectPool for the named effect, creates one if necessary, and then obtains a particle effect for the newly created Actor. The particle effect should be reset in the obtain function (if you look at the source it does so). What happens is the first effect works as expected but every subsequent one flashes very briefly on the screen as if its run out of duration.

public class ParticleEffectActor extends Actor {

    private static final Map<String, ParticleEffectPool> ParticlePools = new HashMap<>();
    private final PooledEffect effect;

    public ParticleEffectActor(String effectName, float rotation) {
        if(!ParticlePools.containsKey(effectName)) {
            ParticleEffect particleEffect = new ParticleEffect();
            particleEffect.load(Gdx.files.internal("resources/particles/" + effectName + ".p"), Images.Atlas);
            ParticlePools.put(effectName, new ParticleEffectPool(particleEffect, 10, 50));
        }

        this.effect = ParticlePools.get(effectName).obtain();

        rotation -= 90f;
        for(ParticleEmitter emitter : effect.getEmitters()) {
            emitter.reset();
            ParticleEmitter.ScaledNumericValue angle = emitter.getAngle();
            angle.setLow(rotation - 35, rotation + 35);
            angle.setHigh(rotation - 35, rotation + 35);
        }
    }

    @Override
    public void draw (SpriteBatch batch, float parentAlpha) {
        effect.draw(batch);
    }

    @Override
    public void act (float delta) {
        super.act(delta);
        effect.setPosition(getX(), getY());
        effect.update(delta);
    }

    @Override
    public boolean remove() {
        effect.free();
        return super.remove();
    }
}

sentences:
How do I represent projectiles in a video game? I'm making a simple fixed shooter game, similar to "Galaga",) as part of a presentation I'm doing. I'm wondering what strategies and data structures would people use for tracking projectiles, like lasers fired from the spaceship.  A super simple implementation that I've used, before, is to just represent each projectile as a point, and check for collisions with all objects in the scene.

However, this seems costly, in large scenes with many projectiles; I'm wondering what other types of strategies or implementations are used for this type of use case.  What do games like FPS use for tracking projectiles (bullets, tank shells, etc)?

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:
Low-level game engine renderer design I'm piecing together the beginnings of an extremely basic engine which will let me draw arbitrary objects (SceneObject). I've got to the point where I'm creating a few sensible sounding classes, but as this is my first outing into game engines, I've got the feeling I'm overlooking things. I'm familiar with compartmentalising larger portions of the code so that individual sub-systems don't overly interact with each other, but I'm thinking more of the low-level stuff, starting from vertices working up.

So if I have a Vertex class, I can combine a list of those with a list of indices to make a Mesh class. How does the engine determine identical meshes for objects? Or is that left to the level designer? Once we have a Mesh, that can be contained in the SceneObject class. And a list of SceneObject can be placed into the Scene to be drawn.

Right now I'm only using OpenGL, but I'm aware that I don't want to be tying OpenGL calls right in to base classes (such as updating the vertices in the Mesh, I don't want to be calling glBufferData etc).

Are there any good resources that discuss these issues? Are there any "common" heirachies which should be used?

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:
manipulate textures in real time using GPU I'm looking for some way (tutorial, library or build in option) to draw texture on JMonkey in real time. So I have 2 images one a normal texture that is fairly big(4000x4000) and another much smaller texture (100x100) the second texture is white(or we can set alpha high) with something drawn on it (say a tree) now I would like said drawing (tree) to be drawn on the bigger texture in such a way that it does not massively slow down the system and that it easily ignores the unused pixels.

I already know I can use a for loop to change each value of a texture but that is a CPU computation I would much rather, if possible, offload this to the GPU.

sentences:
2D terrain with midpoint displacement and collision I followed this theory Here to implement a simple scrolling 2D terrain for my running game. I am used to dealing with collision via a tile system but am looking for a good theory on how to perform terrain collision (keeping the player on-top the land) with a midpoint displacement 2D terrain

I am not worried about the physics aspect but how to determine if a character intersects an array of points generated by the theory above. Example if I have an array of points

Points[]

these points are used to draw lines to make a terrain. Now in my mind I would first find the player center. Take the center X and see which two points it is between. So if X is 4.6 lets say it is between points that lay on X=3 and X=6.

Player X = 4.6
Point1 X = 3, Y = 3
Point2 X = 6, Y = 5

So now knowing this I somehow need to calculate  what Y would be giving that X = 4.6. And once I have Y ensure that the Player Y > CalculatedY. If it is not push the player up to what Y the player should be.

So I guess what I a saying is

X = 3, Y = 3
X = 6, Y = 5
X = 4.6, Solve for Y

sentences:
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:
vertex is bending inwards I am trying to draw a picket fence, but the center of the picket vertex looks bent in the middle,

why is the picket bending inwards to the left?

// draw fence pickets
float a;
for (a=-25; a<=25; a+=0.256) {

    glBegin(GL_POLYGON);
    glColor3f(  1,  1,  1 );
    glVertex3f( a,       25, 0 );
    glVertex3f( a+0.128, 25, 0 );
    glVertex3f( a,       25, 1 );
    glVertex3f( a+0.128, 25, 1 );
    glEnd();

}

sentences:
Gamemaker studio 2 getting error message I'm currently using gamemaker studio 2 following a youtube guide on making my first game. I am very new to coding and need some help.

Im getting this error message attached to my code and I'm not sure why.

sentences:
how do i make the JS/jquery tic tac toe squares only clickable once? As i have it now my script makes the 3x3 grid clickable, and I dont know exactly how to turn on the click once it has been clicked. This is using jQuery and a simple if else statement to switch between turns.

    $(document).ready(function(){
  var turn = 0;
    $("#cell11, #cell12, #cell21,  #cell22, #cell13, #cell23, #cell31, #cell32, #cell33, ")
            .click(
            function(){
                var cell = $(this);
                if(turn===0){
                    turn = 1;
                cell.css("background","url(images/o.png)");
                }
                else{
                    turn = 0;
                    cell.css("background","url(images/x.png)");
                }
            })
});

sentences:
XNA/MonoGame/SharpDX: Pixel shader with sprite sheet I've searched around for two days now on the internet but cannot find a solution. I've also read up on Pixel Shaders on MSDN with no luck.

I'm trying to apply a simple pixel shader to a sprite batch for alpha masking. It worked fine when I used two separate textures; one for the sprite and a matching one for the shader.

Problem is I don't want to do this. I'd like to use my sprite sheet and source rectangle and use a separate mask from a sprite sheet of masks.

However it doesn't work. The sprite draw perfectly but the mask does not and appears to be using a sprite at a different locating in the mask sheet. It has something to do with getting the coordinates of the mask.

My idea was if the sprite to draw was at 200*200 in the sheet, subtract the correct tex coordinates from it to get the pixel, then add this to the mask.

pos = texCoord - sprite start = offset + mask start = location of mask from current pixel

EG;
pos = 200*200 - 200*200 = 0 + maskPos = 440*330
pos = 201*201 - 200*200 = 1 + maskPos = 441*330

UPDATE: It is definitely converting the coordinates of the sprite to the mask that is the issue. I've tried numerous methods to try and convert this and normalize the coordinates to singles with no luck.

The result after masking
The mask being applied
The actual mask that should be applied

I have no idea why the result is being botched and section cut out like shown in image one.
22 is the width and height of both masks and sprites. 512 is the width and height of both sprite sheets.

To calculate the pos in the mask that generate the botch:

float maskPixelX = (inCoord.x * 512) + X pos to draw the tile;
float maskPixelY = (inCoord.y * 512) + X pos to draw the tile;
float2 maskCoord = float2((maskPixelX - maskpos.x) / 22, (maskPixelY - maskpos.y) / 22);

Pixel shader:

uniform extern texture ScreenTexture;
sampler screen = sampler_state
{

    Texture = <ScreenTexture>;
};

uniform extern texture MaskTexture;
sampler mask = sampler_state
{
    Texture = <MaskTexture>;
};

float2 startpos;
float2 maskpos;

float4 PixelShaderFunction(float2 inCoord: TEXCOORD0) : COLOR
{

    // Get the matching pixel offset in mask.
    float2 pos = inCoord - startpos;
    pos = pos + maskpos;

    float4 color = tex2D(screen, inCoord);
    float4 color2 = tex2D(mask, pos);
    if (color2.a > 0) color.rgba = 0;
    return color;
}

technique
{
    pass P0
    {
        PixelShader = compile ps_2_0 PixelShaderFunction();
    }
}

And here is the draw call:

  mask.Parameters("MaskTexture").SetValue(maskSheet) ' Sprite sheet with mask.
  mask.Parameters("startpos").SetValue(New Vector2(200, 200))
  mask.Parameters("maskpos").SetValue(New Vector2(440, 330)) ' Postion of mask in sheet.
  Dim source As New Rectangle(200, 300, 22, 22)
  spriteBatch.Draw(sprites, Vector2.Zero, source, Color.White, 0.0F, New Vector2(0, 0), 1.0F, SpriteEffects.None, 1.0F)

sentences:
How should I organize 2D sprites? I'm using a Unity Tilemap in my 2D game, and I have several hundred 32x32 sprites.  Most of the examples I've seen using sprites have a few consolidated sprite sheets that contain all of the game's sprites.  For instance, I'd have a few 1024x1024 sprite sheets that contain all of my game's sprites.
 Those examples all say that the reason to do it this way is that performance is improved when sprites are packed together like that.

The problem with these large consolidated sprite sheets is that it's difficult to find the sprites that I want when I'm making a tile pallet or animated/scripted sprite.

For example, I have two 1024x1024 sprite sheets called "House Interior 1" and "House Interior 2" that contain all my walls, floors, furniture, doors, windows, and miscellaneous interior objects.  Now I want to create one Unity tile pallet that has only tiles for western-style houses and one tile pallet that has only tiles for eastern-style houses.  Each tile pallet is going to require some, but not all, sprites from both of my sprite sheets (House Interior 1 and House Interior 2).  Additionally, I want to create some animated tiles.  Each animated tile will use a few sprites from somewhere in the middle of one of the large sprite sheets.

My problem is that each sprite sheet image has so many child sprites that it becomes very tedious and time consuming to visually scan through each huge sprite sheet to find the tiles I want, and then drag each of them individually onto my tile pallet.  Making animated tiles results in the same problem because when I assign each animation frame, I have to find the correct sprite from a huge list of sprites that are named House Interior_1, House Interior_2, House Interior_3, and so on.

I'd like to have smaller sprite sheets that only contain one specific type of sprite, rather than huge sprite sheets of often unrelated sprites.  For example, I'd like to have one sprite sheet that has only masonry walls, one that has only brick walls, one that has only the animation frames of a fireplace, and so on.  That way it'll be easier to build up Unity tile pallets by dragging several sprite sheets into the tile pallet in the Inspector, and it'll be easier to find my animated tiles because I can easily find the sprites named Fireplace_1, Fireplace_2, and Fireplace_3.

So my questions are:

How big of a performance hit will I experience if I don't pack my tiles together into a few big spritesheets?  Is it even worth taking this into account considering modern devices are so powerful compared to what is necessary to do sprite-based graphics?
Is this a case of balancing the pros and cons of both methods, or is it generally strongly recommended that I large consolidated sprite sheets?

sentences: Custom Unity launcher localization I would like to localize Unity launcher using own texts. At the very least I would like to change "play!", "quit", "Graphics" and "Input" to own arbitrary labels. How can I achieve that?

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:
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:
Making an interactive 2D map So recently I have been working on a Legend of Zelda: A Link to the Past clone, and I am wondering how I could handle certain map interactions (like cutting grass, lifting rocks, etc).

The way I am currently doing the tilemap is with 2 PNGs. The first is the "tilemap" where each pixel represents a 16x16 tile and the (red, green) values are the (x, y) coords for the tile in the second PNG (the "tileset"). I am then using the blue channel to store collision data.

Each tile is split into 4 8x8 tiles and represented by a 2 bit value (0 = empty, 1 = Jumpdown point, 2 = unused right now, 3 = blocking). 4 of these 2 bit values make up the full blue channel (1 byte). So collisions work great, and I am moving on to putting interactive units on the level; but I am not sure what a good way is to do it.

I have experimented with spawning an entity for each grass and rock, but there are just WAY to many; FPS just dies even if I confine it to the current "zone" the user is in (for those who remember LTTP it had zones you moved between). It does make a difference that this is a browser-based JavaScript game.

tl;dr: What is a good way to have an interactive map without using full blown entities for each interactive item?

sentences:
Can you sync screen update on vertical retrace with OpenGL? In OpenGL, is there a way to ensure I get exactly, no more nor less, 60 (or whatever rate my monitor is set for) frames per second?

Of course given that the new frame can be calculated in less than 1/60 second.
I was thinking Windows more than Linux or Mac OSX, even though it is interesting to keep an eye on portability.

sentences:
How to create a color aura around actors in libGDX? Is there an easy mechanism to create a color aura around an actor in libGDX?

Thanks for all tips!

sentences:
Handling an item database with procedurally generated items? Let's say you have an item database which has every item in your game.
This works fine for regular items like a Health Potion, a normal Iron Sword etc, because these items have ItemID's so we can get an exact copy of this item.
But what if we have an Iron Sword with an enchantment: '+5 Fire Damage'? (or whatever)

If you were to save that item to a player's inventory, exit the game and load the game, the item will load as a regular Iron Sword, because it still has that ID.

Specifically, how would you save that item to a file? I'm using Unity, so to save the Player's inventory, I use:

PlayerPrefs.SetInt("Inventory " + i, inventory[i].ItemId );

Would you create a custom item ID for every item with enchantments or is there a better way around this?

sentences:
get position of GameObject on rendertexture from camera I'm rendering the camera output to an rendertexture on a plane.  This works fine. But I want to put GameObjects on the rendertexture on positions of world objects that are visible on the camera.

camera.WorldToViewportPoint(obj.transform.position)

shows the correct positions, but is not mapped to the rendertexture. How can I do this?

So it's GameObject in world > camera input >  plane with RenderTexture > world or local position of gameobject on top of rendertexture plane.

sentences: Unity3d simple material color display correctly in windows built but yellow color turns to blue in android build? I have a simple roll a ball game as shown in unity 3d tutorials, and I have set the wall color as a shade of yellow using the standard shader and material. This runs flawlessly in windows application, however when running in android phone( Nexus 5 MM) the wall turns into a blue color. Can anyone tell me how to fix it?

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:
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: What is the general strategy to pre-load game data(entities/map) I'm new to games programming and am wondering what tactics games use to pre-load entity and map data. Will a game initialise with the fundamental map data stored in memory?

sentences:
How to create animation using sprite sheet in C++ and SFML 2.0? I was wondering how do animation using a sprite sheet. I have a sprite sheet and the size is
height:400
width:601

The code I am using is:

#include<SFML/Graphics.hpp>
#include<iostream>
#include <string>
int main() {

sf::RenderWindow Window;
Window.create(sf::VideoMode(980, 760), "Game Engine");
sf::Texture Ptexture;
sf::Sprite playerImage;
if (!Ptexture.loadFromFile("spritesheetIdle.png")) {
    std::cout << "error file not found\n";
}
playerImage.setTexture(Ptexture);
while (Window.isOpen()) {
    sf::Event Event;
    while (Window.pollEvent(Event))     {
            switch (Event.type)
            {
            case sf::Event::Closed:
                Window.close();
                break;

            }
                }
    Window.draw(playerImage);
    Window.display();
            }

        }

If you could then can you please try to explain me about sf:IntRect() too?

sentences: glBindVertexArray very occasionally causes crash I'm writing a game in an engine of my own design. Very occasionally, and without much cause, when I come to render the post processing result to a quad, the glBindVertexArrays crashes. It actually doesn't crash on that thread, it crashes in the nVidia GPU thread on an instruction called "INT E29".. I don't know machine code very well. Anyway reading up about this, it looks like it could be something to do with putting the wrong stuff in VAOs but when this crash happens I will have rendered it for a good minute at 400+ fps already, and the VAO wouldn't ever been called other than on initialisation. Any ideas?

sentences:
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:
Find transformation to align two polygons at fixed points? Problem

I have a source image (arbitrary width and height c) shown here as a rectangle [X1,X2,X3,X4]. It contains two points C and D (both known coordinates within the image - X4 / top left).

Then I have a target image (might have different height a and width b than source image) that contains two points A and B (|AB| doesn't necessarily equal |CD|). There's also a source of projection S.

I need to somehow calculate coordinates of a transformed rectangle (polygon) such that:

Point C will always be mapped to A (therefore A will be equal to C) and D will be mapped to B (B = D)
Point X3 of this newly calculated polygon will lie on a line between S and A/C (now identical)
Point X4 will lie on a line from S to B/D.
Distance from parallel lines [X1,X2] and [X3,X4] will be still c. (If it turns out that it's not always possible to construct such a polygon the condition 4. can be dropped, and [X1,X2] don't need to be parallel to [X3,X4] as well)

(see below)

What I've tried

I thought I will solve it by:

shrinking width of source image by ratio of |AB| and |CD|
aligning C with A (move source image)
finding angle difference  between AB and CD
rotating source image by angle  (with center in C/A)
calculating X3 and X4

But it doesn't work universally. Steps 1-4 work well, but then changing X3 and X4 moves C (resp. D) away from A (resp. B).

sentences:
Kickstarter and 2D smartphone games I am about to launch a Kickstarter project as, after 14 months of full time development on my first iOS game, I run out of money. I developed an iOS game that needs few more months to be ready (the game structure is there but haven't yet worked on balancing the difficulty of the various levels).

I have a feeling that most of the computer games founded on Kickstarter are for console, PC or Mac and not for smartphones. The category that many people seem to like is RPG style games.

I have done tons of work over a year and collaborated with musicians and illustrators to get top quality graphics and music. The game looks cool to be an iOS 2D game but, compared to what I've seen on Kickstarter, I feel so little and humbled.

I have searched for smartphone game projects on Kickstarter but haven't found many. I believe that the reason is that people are not keen in backing an APP that is normally sold for 0.99$ as they perceive is not something big. Am I the only one having this feeling?

Could anyone please share a list of references to some successfully backed kickstarter smartphone game projects? (In this way the question will not become a "chat" and will fulfill the requirements to be a gamedev question).

Any other article or authoritative answer will be welcome.

sentences:
Spawning large numbers of navmeshagents causes them to jump position Cross posted on StackOverflow

I'm making a tower defense style game in 3D using Unity. I'm experiencing a frustrating issue with spawning large numbers of characters in an area of navmesh where if I spawn too many near the same location many of them will 'teleport' immediately after instantiation to near the navmesh destination.

Here's a doodle of one of the levels:

The black spot is the player base the NPCs have to get to. The green scenery has no navmesh and uses mesh colliders. Scenery is mostly steep hills forming a valley the NPCs should path through. It is composed of multiple meshes marked Unwalkable in navigation. The large blue spot is the first spawn location I tried, I later tried a larger area indicated in the right side of the image (see 'things I've tried' below).

When instantiating at the original spawn location if I spawn more than about 20 NPCs at once many of them will jump to the the area indicated by the red spots.
The NPCs have a radius of about 1.5m, as do their colliders and navmeshagents avoidance property.

Things I've tried:

Spawning to a random position inside a circle with a radius of 50m.
Adding a large new hidden area of navmesh as in the image above,
defining an array of vector positions spread well apart and spawning
at each position in turn so no two navmeshagents spawn near each
other.
Adding a delay to navmeshAgent.SetDestination(playerBase)
after instantiation hoping this would prevent the immediate jump to
near the destination.
Reducing navmeshagents avoidance radius. This sometimes
reduces the problem a little but still, even with a radius of 0.1 any
more than around 50 NPCs triggers the problem.
Turning avoidance off althogether (setting to none in navmeshagent), again, can spawn more but problem still happens
Turning off auto traverse links and auto repath in navmeshagent
Increasing the time between instantiations, a large gap of several seconds works but makes the game too easy
Not setting a destination - oddly they still teleport to near the player base,  so I guess destination is not a factor

How can I spawn large numbers of navmeshagents in a short timeframe, avoiding this 'teleporting' behaviour?

sentences:
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:
IndexOutOfRangeException: Array index is out of range even though the inspector clues otherwise I am currently making a randomized infinite platform with GameObject already made platforms in 3 arrays. In the inspector everything is obviously running quite smoothly but I keep weirdly keep getting uncalled for errors like: IndexOutOfRangeException: Array index is out of range.

Here is my code:

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

public class BackFloorSetter : MonoBehaviour {

    public GameObject[] gameBackFloorsOne;
    public GameObject[] gameBackFloorsTwo;
    public GameObject[] gameBackFloorsFinal;

    public Vector3 nextPosition;

    public float unroundedFinalOrTwo;
    public int finalOrTwo;

    public float unroundedTwoFloor;
    public int twoFloor;

    public float unroundedFinalFloor;
    public int finalFloor;

    public GameObject currentSpawnFloor;

    public float floorSpawnCounter;

    public int counterGoal = 5;

    void Start()
    {
        nextPosition = new Vector3(0, 0, 0);
        Instantiate(gameBackFloorsOne[0], nextPosition, Quaternion.identity);
    }

    void Update()
    {
        floorSpawnCounter += 1 * Time.deltaTime;

        if(floorSpawnCounter == counterGoal)
        {
            floorSpawner();
            counterGoal += 5;
        }

        unroundedFinalOrTwo = Random.Range(0.6f, 2.4f);
        finalOrTwo = Mathf.RoundToInt(unroundedFinalOrTwo);

        unroundedTwoFloor = Random.Range(-0.6f, 3.4f);
        twoFloor = Mathf.RoundToInt(unroundedTwoFloor);

        unroundedFinalFloor = Random.Range(-0.6f, 4.4f);
        finalFloor = Mathf.RoundToInt(unroundedFinalFloor);

        if (finalOrTwo == 1)
        {
            currentSpawnFloor = gameBackFloorsTwo[twoFloor];
        }
        if (finalOrTwo == 2)
        {
            currentSpawnFloor = gameBackFloorsFinal[finalFloor];
        }
    }

    public void floorSpawner()
    {
        nextPosition.x -= 232;
        Instantiate(currentSpawnFloor, nextPosition, Quaternion.identity);
    }

    public void flatGroundSpawner()
    {
        nextPosition.x -= 232;
        Instantiate(gameBackFloorsOne[0], nextPosition, Quaternion.identity);
    }

}

sentences:
Problem disposing content from a screen's content manager I have a problem with my game. I am using multiple classes for different screens, for exemple: Main Menu is one screen, When playing is another, and so on...

I decided to use multiple ContentManagers, different content for each screen, so the game won't consume very much RAM, and to load the screen's content when the user will navigate on that screen, and unload/dispose the content when user navigates away.

I have created different content managers for each screen that I had to, but for exemple if I navigate from main menu, to the playing screen, then back to the main menu (when the content from playing screen gets disposed), and then back to the playing screen, I get this error:

An exception of type 'System.ObjectDisposedException' occurred in MonoGame.Framework.DLL but was not handled in user code

Additional information: Cannot access a disposed object.

I googled this problem, and the only answer that I found was not to dispose the Content Manager, but each texture on that screen.

Is this the only way that I can handle this? To dispose each texture from the screen, when user navigates away?

Thanks.

sentences:
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:
Establish a person's genuine interest in game programming I teach on a 3rd level, 4 year games programming degree (B.Sc. in Computer Games Development). We find that new and prospective students often conflate interests and abilities in game-playing, game-design and game-programming. (I know the title could be a a lot more specific or descriptive, but there are internal reason why we can't change it). We do have an open day when prospective students can come and talk to faculty and current students.

This results in a lot of students signing up for our programme who find themselves with interests and/or abilities mis-aligned with their chosen degree. We have options for them to change major, but the are almost just as programming intensive. We don't have any options for students who really wanted to to game related art or design. So some students just stick at it for 4 difficult/unhappy years, as it is the closest degree available to them in gaming.

We outline the content of the programme in our prospectus, but most incoming students have little programming experience, so topics titles like data-structures, software engineering or 3D Graphics don't really mean much to them.

  "I didn't expect so much math in 3D Graphics, I assumed it would be,
  like, drawing..."

Is there any way to help establish a person's genuine interest in game programming, so that they can make a more informed decision about their education?

sentences:
How do I avoid losing prediction responsiveness due to client interpolation? In my online game, I am using client prediction and client interpolation to give the illusion of responsiveness over a networked connection.

The client prediction applies inputs that haven't yet been acknowledged by the server to incoming server states. When the input is acknowledged, the client's entity will already be in the final position.

The client interpolation works by buffering world snapshots and rendering the entities 100 ms in the past. While new snapshots arrive within the next 100 ms, there will always be valid data to interpolate between.

My problem is that the responsiveness gained from client prediction is lost due to client interpolation. The client's local inputs are applied to incoming server states. However, those incoming states aren't actually rendered on the client until 100 ms later, due to the client interpolation. The result is that there is always a 100 ms lag between pressing a key and rendering the change to the screen.

How can I get the best of both worlds, rendering entities in the past, but rendering the client's inputs instantly?

sentences:
Getting a Ranged AI "In Range" to shoot In my game, ranged units and melee units have the same behavior. Ranged units try to maintain a fixed distance r, from their targets. If they're within r + d of the target (where d is a small value) they stop and shoot it. Note that this means the ranged unit can't be closer than r - d. Melee units are the equivalent of ranged units, but with r set to zero.

Right now, my AI for ranged units is as follows:

Find a path to the target using A*.
Walk along the path until you are within [r - d, r + d] of the target.
Stop and shoot. If the target is dead, quit.
If you are still within [r - d, r + d], goto 3.
Otherwise, move away/towards the target until you are within r + d again. Goto 4.

Here's a sort of diagram.

My problem is, if there are obstacles and the target moves, step 5 causes a lot of problems. Ranged units will end up backing into walls, unable to shoot. If instead of going to step 5 I go back to step 1 (planning a path), the problem still isn't solved, because walking toward the target will only decrease the range, not increase it.

How can I get ranged units to successfully follow and shoot their targets?

sentences:
Display canvas in front of player I have stuck in this simple problem but unable to understand that why i am unable to control it.

I have these line of code which is displaying my canvas object in front of my player(camRotationToWatch object name in code) at certain rotation of the player.

if (camRotationToWatch.transform.localEulerAngles.x >= navigationCanvasXMinmumLimit && camRotationToWatch.transform.localEulerAngles.x <= navigationCanvasXMaximumLimit)
        {
            if (!navCanvasHasDisplay)
            {

                navigationCanvas.SetActive(true);
                //Debug.Log(camRotationToWatch.transform.forward);
                Vector3 navCanvas = camRotationToWatch.transform.position + camRotationToWatch.transform.forward * navCanvasDisplayDistanceFromCam;
                navCanvas = new Vector3(navCanvas.x, 2f, navCanvas.z);
                navigationCanvas.transform.position = new Vector3(navCanvas.x, navCanvas.y, navCanvas.z);

                navigationCanvas.transform.rotation = camRotationToWatch.transform.rotation;

                navCanvasHasDisplay = true;

            }
        }

        else
        {
            //navigationCanvas.SetActive(false);
            if (locationPanel.activeSelf == false && infoPanel.activeSelf == false) {
                navigationCanvas.SetActive(false);
                navCanvasHasDisplay = false;
            }
        }

This code is actually work fine when camRotationToWatch object rotate from down to up and Canvas show at correct position but as I try to to rotate camRotationToWatch from up to down it display(active) Canvas at very top position. How can I restrict canvas to show at same position (No matter player rotate from up to down or down to up) but display on front of the player object?

sentences:
how to start the game without entering into menu screen i am trying to play the game without entering to menu screen. i have placed only one scene. my ui and game both is placed within the same scene. in my game over screen i have two buttons. for home button i give

Application.LoadLevel (Application.loadedLevel);

by this code is loading the scene from the begning and its working perfectly. in my another button i want to play the game direcly without showing the main menu. so i tried

Application.LoadLevel (Application.loadedLevel);
launchGame();

but after loading the level my second line launchGame() is not working. how can i solve this problem? please help

sentences: Can someone help me with my mario-inspired timer scoring system? I am new to GameMaker's coding language or GML. I have learned and done a lot so far, but now i am having a problem. I have a countdown timer starting at 5 minutes counting down and I want the player to receive points based on how much time is left kind of like in Super Mario Bros. along with the points accumulated for performing other tasks. How do I go about doing this with the coding language? Thanks in advance!

sentences:
how to reference a variable in an anothere script i have a object which sets pickedup = true on collision
public class IDCARD : MonoBehaviour
    {
    private bool pickedup = false;

    // Start is called before the first frame update
    void Start()
    {

    }

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

    }

    private void OnCollisionEnter(Collision collision)
    {
       print("k");
        pickedup = true;
        Destroy(gameObject);
    }
}

now i want exit script in an another object to check if pickedup == true on collison
now what can i do pls  give a brief explanation  with a names i have given
i have written your code. but i think there is some issues

sentences:
How can I compute the common points when spheres intersect? When two spheres intersect they should share one or two points. I want to know how to compute those points?

I was thinking of something like this:

-check if the spheres intersect
-calculate radius_1 distance from center_1 in the direction of center_2
-calculate radius_2 distance from center_2 in the direction of center_1
-substract the smaller to the larger and have that one as "collision" point

This sounds to me a little too tricky, I wanted to know if there is a simplier way to achieve this?

sentences:
problem with SCNTransaction in Scene Kit I'm trying to move an object over a period of ten seconds from y coordinate 0 to y coordinate 10.  the object is created at y coordinate 0.  The problem is when the animation starts, the object pops to the end position for like one second or so then pops back down to the starting position and begins the animation properly.  Why is the object ending moving to the end location instantly, and how can I prevent this from happening?

//create box bottom
func createGrabBox() {
    grabbottom = grabBox.rootNode.childNodeWithName("grabbottom", recursively: true)!
    grabbottom.position.y = 0
    grabbottom.geometry!.firstMaterial!.transparency = 0.5
    grabbottom.physicsBody = SCNPhysicsBody(type: SCNPhysicsBodyType.Dynamic, shape: nil)
    grabbottom.physicsBody!.restitution = 0.0
    grabbottom.physicsBody!.friction = 1.0
    grabbottom.physicsBody!.categoryBitMask = ColliderType.grabBottomCatagory.rawValue
    grabbottom.physicsBody!.collisionBitMask = ColliderType.diceCatagory.rawValue
    scene.rootNode.addChildNode(grabbottom)

    //animation snippet
    SCNTransaction.begin()
    SCNTransaction.setAnimationDuration(10.0)
    SCNTransaction.setCompletionBlock() { }
    grabbottom.position.y = 10
    SCNTransaction.commit()

    //physics field for this object
    let field = SCNPhysicsField.linearGravityField()
    field.strength = 0
    field.direction = SCNVector3(x: 0, y: 0, z: 0)
    field.categoryBitMask = ColliderType.grabBottomCatagory.rawValue
    //only things with categories that match the field's will be affected by it
    let fieldNode = SCNNode()
    fieldNode.physicsField = field
    scene.rootNode.addChildNode(fieldNode)
}

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:
How to stop sinking bodies in physics engine C++ I'm writing a rigid body simulation in C++, and have come across a problem when an object should come to rest on the ground.

Because gravity is being applied to it's velocity, the object starts sinking through the ground, or whatever else it's resting on.

To combat this, I am adjusting the position of the object, by moving it along the collision normal by the penetration depth. This has the drawback of making the object look like its vibrating, so it never comes to rest.

I read somewhere ages ago, that there is a way to counter this, by generating a force along the normal which will cancel out the force which is causing it to sink. A google search did not return any useful answers however. I suspect this is because I'm not asking the right question, but I don't know a more concise way to word it, so I'd appreciate if someone here has solved this, and could steer me in the right direction.

sentences:
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:
Does anybody know of any resources to achieve this particular "2.5D" isometric engine effect? I understand this is a little vague, but I was hoping somebody might be able to describe a high-level workflow or link to a resource to be able to achieve a specific isometric "2.5D" tile engine effect. I fell in love with http://www.youtube.com/watch?v=-Q6ISVaM5Ww this engine. Especially with the lighting and the shaders!

He has a brief description of how he achieved what he did, but I could really use a brief flow of where you would start, what you would read up on and learn and the logical order to implement these things.

A few specific questions:

1) Is there a heightmap on the ground texture that lets the light reflect brighter on certain parts of it?

2) "..using a special material which calculates the world-space normal vectors of every pixel.." - is this some "magic" special material he has created himself, or can you hazard a guess at what he means?

3) with relation to the above quote - what does he mean by 'world-space normal vectors of every pixel'?

4) I'm guessing I'm being a little bit optimistic when I ask if there's any 'all-in-one' tutorial out there? :)

sentences:
Follow 3D Path Around Sphere I have currently have a path that wraps around a Sphere from one side to another - this is basically a 3D highway in the sky type object that is a textured road.  I have an Aircraft model that I can get to follow this path, however I'm having trouble getting it to rotate correctly so that it is parallel to the surface of the globe

Using the following code:

this.transform.forward = Vector3.RotateTowards(this.transform.forward, this.transform.position - TargetWaypointPos, Airspeed * Time.deltaTime, 0.0f);

this.transform.position = Vector3.MoveTowards(this.transform.position, TargetWaypointPos, Airspeed * Time.deltaTime);

This gets the plane to correctly face the next waypoint and follow the path, however I cannot get it to rotate correctly in the Z-space to be parallel to the path/globe.  I can compute the correct angle by:

Vector3 yAxis = this.transform.position;
yAxis.Normalize();
Vector3 zAxis = nextPoint - this.transform.position;
zAxis.Normalize();
xAxis = Vector3.Cross(yAxis, zAxis);
xAxis.Normalize();
float angleZ = Vector3.Angle(Vector3.right, xAxis);

However attempting to apply this to my model in any way appears to ruin the Vector3.RotateTowards logic.  I must be missing something simple to combine these two.

Any ideas?  I'm new to Unity, still figuring out all the available options.

sentences: how to play a video with Android or AndEngine I don't know if it's possible to show a video like the videos in Angry Birds (Something in Flash or another format) in middle of a game with Android or AndEngine or are they animations what they are made with Sprites and a more programming process?? How do they show those videos?

sentences:
Configure VR support that enables to "look" around and receive user input (Google Cardboard button) When the user moves the head this means that the phone in the HMD also moves and there are sensors that can detect the direction of the phone so that the image can update correctly. Also to note that the HMD has a button that can be clicked and trigger an action.
In early 2019, in order to implement both of the above mentioned functionalities (look around and click), stared by configuring Settings > Player > XR Settings and add Cardboard as Virtual Reality SDK. Then, I've used the prefab GVR Editor Emulator. It was basically going to this link, download Google VR SDK for Unity, drag it into Unity and import.
Once the import finished, it's possible to see in Assets a folder named Google VR. The prefab can be found then under Assets > Google VR > Prefabs > GvrEditorEmulator, copy and paste in our scene.
Now, more than 1 year after, when I go to the GvrEditorEmulator page, can see

November 6, 2019 update:

There's a new open source Cardboard SDK that offers a streamlined API, improved device compatibility, and built-in viewer profile QR
code scanning. We recommend that all developers actively building for
Google Cardboard migrate to the new Cardboard SDK: iOS, Android NDK,
Unity XR Plugin (SDK)

What changes in the process considering this update?

sentences:
How do I use guilayout toggle event to check if true or false? OnGUI()
{
            for (int i = 0; i < scenes; i++)
            {
                GUILayout.Toggle(false, SceneManager.GetSceneAt(i).name);
            }

            if (GUILayout.Toggle(true, "New Scene"))
            {
                Debug.Log("True now !");
            }
}

First in the loop I'm adding some toggles.
Then I want to do that if specific toggle is checked(true) do something and if unchecked(false) do something else.

But the way I did it it's just changing the toggle to true automatic.

sentences:
Physics.CheckSphere is not working I try to use Physics.CheckSphere to check if a coordonate is empty.
I use three for loop to cycle threw a 2 x Y x 2 chunk. The problem is that it return true if the corner is touching the coordonate

and its actually not even touching it, since I use a 0.5 sphere radius:
if(Physics.CheckSphere(new Vector3(x,y,z), 0.5f) == false)...

(by the way the white cubes you can see on the picture is only to visualize where it detected empty space, they dont have any collider enabled)

and the chunks have a mesh collider, so why is it returning true when its no even touching it ?

if(Input.GetKeyDown("i"))
    {

for(int y = 0; y <= amp + 3; y++)
{
    for(int x = 0; x <= chunkSize - 1; x++)
    {
        for(int z = 0; z <= chunkSize - 1; z++)
        {
            if(Physics.CheckSphere(new Vector3(Mathf.Round(x),Mathf.Round(y),Mathf.Round(z)),0.5f) == false)
            {
                Instantiate(grass,new Vector3(x,y,z), Quaternion.identity);
                dontPlaceHere.Add(new Vector3(x,y,z));
            }
        }
    }
}
}

sentences: How can obtain the relative orientation between two quaternions? How do I obtain the relative orientation given two orientations (represented by quaternions q0 and q1)?

sentences:
fading from one scene to another not working I am using the following code to fade from one scene to another, but it doesn't fade. It just loads the next scene without fading. I suspect there's something wrong with the image I'm using. I used a black .png image with dimensions 425×344 that I downloaded from Google. How can I solve this issue?

Fading.cs (I added this to an empty game object)

public Texture2D fadeOutTexture;
public float fadeSpeed = 0.8f;

private int drawDepth = -1000;
private float alpha = 1.0f;
private int fadeDir = -1;

void onGUI () {

    alpha += fadeDir * fadeSpeed * Time.deltaTime;
    alpha = Mathf.Clamp01(alpha);
    GUI.color = new Color (GUI.color.g, GUI.color.b, alpha);
    GUI.depth = drawDepth;
    GUI.DrawTexture (new Rect (0, 0, Screen.width, Screen.height), fadeOutTexture); }

public float BeginFade (int direction) {
    fadeDir = direction;
    return (fadeSpeed); }

void onLevelWasLoaded() {
    BeginFade (-1);

}

In the script of the trigger object:

IEnumerator gameScene2() {
    float fadeTime = GameObject.Find ("FadeObject").GetComponent<Fading>().BeginFade(1);
    yield return new WaitForSeconds(fadeTime);
    Application.LoadLevel("Scene2");
}

These are the image settings for the black .png image

sentences:
Unity Photon Networking - Cant understand OnPhotonSerializeView In all tutorials I see that an object sends data over the network and receives the data.

For sync in the same method:

Code:

void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info){
        if (stream.isWriting) {
            stream.SendNext (transform.position);
            stream.SendNext (transform.rotation);
        } else {

            Debug.Log("never gets called ");

            //never gets called...

            transform.position = (Vector3)stream.ReceiveNext ();
            transform.rotation = (Quaternion)stream.ReceiveNext ();

        }
    }

But when I test my code, the lower part, where the data gets received, is never executed!

I never see the logs. But the object is SYNCHED because it is set in the inspector:

But the problem is that the object is not interpolated so it looks kind of funny.

So, I need to know how can I make the upper method to work so I can do some interpolation stuff.

sentences:
creating cartoon explosions like in jetpack squad I followed this excellent tutorial for creating volumetric explosions: https://stevencraeynest.wordpress.com/2013/03/29/easy-volumetric-explosion-in-unity3d/

I get the explosions as the tutorial mentioned, however, I noticed that jetpack squad does a similar technique but has getting much nicer cloud formations.  My Question is, what kind of noise texture would I have to use to get a more cartoony explosion cloud like in jetpack squad vs the tutorial

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:
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:
Pong - Changing the Ball's Y location depending on where it hits the paddle I'm making my first game in, Pong, and I'm trying to make the ball's Y increase or decrease, depending on where it impacts the paddle. After implementing the code below, the ball only goes down, but not up. What could the problem be?

if(paddle.detectCollison(ball)){
    //30px on either side of the actual center of the paddle is considered the center
    if((ball.getY() > ((paddle.getH() / 2) + 30)))
        ball.setY(ball.getY() + 10);
    else if ((ball.getY() < ((paddle.getH() /2) - 30)))
        ball.setY(ball.getY() - 10);
    ball.setDX(-(ball.getDX()));
}

sentences:
Implications of variable run speeds in 2D I'm getting my feet wet trying to design and implement a 2D action platforming game. Combat will be a big focus, so I want to have tight ground and air control so players can be precise and express mastery. For now, I don't think I want high acceleration and deceleration times, as I think they detract from a 'tight' feeling control scheme, but feel free to correct me if there's data or examples saying otherwise.

I'm taking a lot of combat inspiration from, and want it to feel like, a fighting game. From a surface level analysis, in many fighting games, most notably smash brothers, there are usually two (or more) speeds of horizontal movement - a walk and a run, a run and a sprint, and so on. Naively, I thought 'well fighting games have it so if I want this to feel like a fighting game I need to have it as well' but thinking about it some more, I'm not sure if its worth implementing. Primarily because I don't understand the implications of having a sprint mechanic or not.

One thing I'm rapidly discovering is that any design question can boil down to 'it depends,' especially on the game itself and what I want to accomplish. If you need more context, my initial idea is to more closely marry the feelings you get when you pull off a new combo or link or discover new ways to use a system mechanic in a fighting game with that feeling of discovery from cracking open a game world in a Metroidvania. So a 2D metroidvania with action/fighting game level combat. My initial thought is sprinting would open up opportunity for dash attacks, maybe some cancels, and make moving around the world easier. It also means more implementation work, because I'm mostly out of buttons, so I'd have to do some sort of double tap or smash-attack-like analog input to work it in.

My main example of two run speeds in a non-fighting game is in some Kirby games, where you can start a dash by double tapping a direction. In the context of Kirby, what does having the dash do for the game as a whole? Would it be better to have a faster base walk speed and no dash? What opportunities would open up if I had a sprint, and what would become closed off from me?

Perhaps a better example, though not in 2D, is Raiden's Ninja Run from Metal Gear Solid Rising Revengeance. It helped him get from encounter to encounter faster, and served as a way to close gaps while under fire.

Initial reaction says that my players will just use sprint to run from encounter to encounter and will miss stuff I put in they might not if they're taking their time. I'd have to put in stuff that encourages the player to slow down, and be intelligent about it so as to not feel like I'm mangling whatever pacing the player is at. I think 'go as fast as I'm allowed to' is the default mode for most players, and that having a variable run speed doesn't actually add much of a choice. I think going fast, especially going fast-er by comparison, is fun, but is it a worthwhile tradeoff? I could offset this with a stamina system just for sprinting or some other artificial limiter, but I think that opens up a whole new set of implications I even further don't fully grasp.

TL;DR

What are the benefits and downsides of having a sprint?

sentences:
How to check if gun may shoot again (because animation has stopped playing)? When the user presses the fire button, I set a trigger:
_animator.SetTrigger("HG_Shoot");

This trigger causes a "pistol shoot" animation to be played.
The gun should only be able to shoot again as soon as the shoot animation has finished.
I could check at each Update() if that certain animation is still being played like this:
 bool isAnimationStatePlaying(Animator anim, int animLayer, string stateName)
 {
     if (anim.GetCurrentAnimatorStateInfo(animLayer).IsName(stateName) &&
             anim.GetCurrentAnimatorStateInfo(animLayer).normalizedTime < 1.0f)
         return true;
     else
         return false;
 }

But I don't like the frequent checks. I would rather like to have a variable to would be set by the animator. Or I would set it at the beginning of the shoot animation.
Because there are other animations that I have to check that would disallow shooting of the gun, too, like reloading the gun.
This would make everything even more complicated.
How can I solve this problem?

sentences:
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:
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 Perlin Noise be modified to not tile? In vanilla perlin noise, the texture repeats after 256 coordinates, due to the way it picks a gradient vector. In games that require an infinite procedural world, however, this is not an acceptable tradeoff. This requires a different method to pick the gradient vector. I need an alternative that is portable in C++, meaning that I will get the same noise for the same seed on different systems.

I have come across two options to do this:

Using C++'s random api, using bitshift-modified coordinates as the seed, but this is very slow in practice and is too reliant on the exact implementations of the C++ random number generators, which may or may not guarantee the same sequence of numbers across platforms.
Use a much faster random hash function I found in the old freespace virgin "perlin noise" (actually value noiswe) tutorial, which I saved before it went down. The issue with this one is that it has bitshift on signed integers, and thus has undefined behaviour in C++.

EDIT: Something I forgot to mention in the original question is that I need to be able to re-seed the perlin noise engine to get a different output. With vanilla perlin noise, I can simply use a seeded random shuffle on the hash table lookup array before calculating anything else.

sentences:
Prevent Wall Clipping with Bouncing Shape I'm currently working on a demo-type program involving bouncing objects. Currently, I have a rectangle that can bounce around the screen.
When the rectangle bounces against one of the walls imperfectly, part of it will clip into the side of the window (or other objects, in the future).
I'd like to have the rectangle bounce from an accurate position (as in when/where it begins to collide with the object). Is there a better or more efficient way to do this other than by going back a step and checking over again with smaller steps?

The relevant code is here, and for reference the rectangle's velocity is stored as an angle and speed.

    //Update position
    rect.setX(rect.getX() + (rect.getVelocity() * Math.cos(rect.getDirection())));
    rect.setY(rect.getY() + (rect.getVelocity() * Math.sin(rect.getDirection())));

    //Check for collisions
    for(Collider c : colliders) {
        if(c.isColliding(rect)) {
            bounce(rect, c);
            System.out.printf("Rect is colliding with %s%n", c);
        }
    }

Any help would be appreciated.

sentences:
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:
How to define axis of Sprites in a CCAnimation? I'm struggling to find how to define a kind of axis in my frames, when my sprite punches it moves back. I want to define the head as a pivot for the other sprites with different sizes.

How can I accomplish that?

sentences:
Keeping a UI element inside the screen at all times I have this UI element that follows an arrow around the screen. The problem is that sometimes, due to the parenting, the element goes outside the screen. I need a way for it to "hit the walls of the screen" and don't move beyond that point. This is made trickier by the fact that the UI element is animated, and "pops out" onto the screen.

I've tried several solutions and the best so far has only made it so that the pivot point does not go beyond the screen edge. I know I somehow have to  calculate a bounding rect for the UI element, and then Clamp() its edges in screen space, but I honestly have no idea how to do this in code.

sentences:
Effectively implementing a game view using java I am writing a 2d game in java. The game mechanics are similar to the Pokémon game boy advance series e.g. fire red, ruby, diamond and so on.

I need a way to draw a huge map maybe 5000 by 5000 pixels and then load individual in game sprites to across the entirety of the map, like rendering a scene. Game sprites would be things like terrain objects, trees, rocks, bushes, also houses, castles, NPC's and so on. But i also need to implement some kind of camera view class that focuses on the player. the camera view class needs to follow the characters movements throughout the game map but it also needs to clip the rest of the map away from the user's field of view, so that the user can only see the arbitrary proximity adjacent to the player's sprite. The proximity's range could be something like 500 pixels in every direction around the player’s sprite. On top of this, i need to implement an independent resolution for the game world so that the game view will be uniform on all screen sizes and screen resolutions.

I know that this does sound like a handful and may fall under the category of multiple questions, but the questions are all related and any advice would be very much appreciated. I don’t need a full source code listing but maybe some pointers to effective java API classes that could make doing what i need to do a lot simpler. Also any algorithmic/ design advice would greatly benefit me as well.

example of what i am trying to do in source code form below

package myPackage;

/**
 * The Purpose of GameView is to: Render a scene using Scene class, Create a
 * clipping pane using CameraView class, and finally instantiate a coordinate
 * grid using Path class.
 *
 * Once all of these things have been done, GameView class should then be
 * instantiated and used jointly with its helper classes. CameraView should be
 * used as the main drawing image. CameraView is the the window to the game
 * world.Scene passes data constantly to CameraView so that the entire map flows
 * smoothly. Path uses the x and y coordinates from camera view to construct
 * cells for path finding algorithms.
 */

public class GameView {

    // Scene is a helper class to game view. it renders the entire map to memory
    // for the camera view.
    Scene scene;

    // Camera View is a helper class to game view. It clips the Scene into a
    // small image that follows the players coordinates.
    CameraView Camera;

    // Path is a helper class to game view. It observes and calculates the
    // coordinates of camera view and divides them into Grids/Cells for Path
    // finding.
    Path path;

    // this represents the player and has a getSprite() method that will return
    // the current frame column row combination of the passed sprite sheet.
    Sprite player;
}

sentences:
Combining mesh on the fly without using gameObject I procedurally generate chunks and use the marching cube algorithm to create meshes in 3D.
At first, I just created a gameObject for each cube (of course, I knew it was not optimized, but I wanted to see if the algorithm worked).
For now I stock all gamesObject in child of "blocks" but it would be much more optimized to directly merge the meshes between them and only create a single gameObject.
However, i did not find any way to directly merge the meshes between them.
So my question is: is there a way to directly merge meshes between them without having to use gameObject? (don't worry about texturing)

Here's the code:

    public static GameObject GenerateChunk(int[,,] map, int chunkSize, Vector3 chunkPosition)
    {
        GameObject blocks = new GameObject("BlockList");
        GameObject newMesh;
        int[] cubeVertices = new int[8];

        // create each mesh in a gameObject as child of "blocks"
        for (int x = 0; x < chunkSize; x++)
            for (int z = 0; z < chunkSize; z++)
                for (int y = 0; y < chunkSize; y++) {
                    /*
                    define the vertices (cubeVertices)
                    */
                    Vector3 cubePosition = new Vector3(chunkPosition.x + x, chunkPosition.y + y, chunkPosition.z + z);
                    newMesh = GenerateCube(cubePosition, cubeVertices);

                    if (newMesh != null)
                        newMesh.transform.parent = blocks.transform;
                }

        //combine every children of "blocks" and delete them
        MeshFilter[] filters = blocks.GetComponentsInChildren<MeshFilter>();
        List<CombineInstance> combine = new List<CombineInstance>();
        for (int i = 0; i < filters.Length; i++) {
            if (filters[i].sharedMesh == null)
                continue;
            for (int j = 0; j < filters[i].sharedMesh.subMeshCount; j++) {
                CombineInstance ci = new CombineInstance
                {
                    mesh = filters[i].sharedMesh,
                    subMeshIndex = j,
                    transform = filters[i].transform.localToWorldMatrix
                };
                combine.Add(ci);
            }
            Destroy(filters[i].gameObject);
        }

        //create the chunk and set the final mesh with the CombineMeshes function
        GameObject chunk = new GameObject("Chunk", typeof(MeshFilter), typeof(MeshRenderer));
        chunk.GetComponent<MeshFilter>().mesh.CombineMeshes(combine.ToArray(), true, true);
        Destroy(blocks);
        return chunk;
    }

sentences:
Parsing OBJ file having multiple objects I am very new to game development and have been following the youtube channel ThinMatrix for its GameEngine tutorials
https://www.youtube.com/playlist?list=PLRIWtICgwaX0u7Rf9zkZhLoLuZVfUksDP
In one of the videos, an OBJ loader is created. However, I noticed that for simplicity purpose, only the bare minimum parameters like faces, textures, normals, and vertices are parsed. (It is the same case for almost all the OBJ Parsers available online).
What I understand is that the assumption of a single object or a group is made.
On reading through the OBJ file format, I realized that there are several other attributes like Sub-objects (-o), Groups (-g) etc.
I am having trouble understanding how to parse these other parameters (if necessary). Should I load the vertices and faces data of every (-o) into separate VAOs?
Also, in that case, how will the rotation of the whole object work? Will all Sub-objects start rotating about their own centers?
How to make the multiple sub-objects rotate in unison like a single object and still have independent control over each whenever necessary?
Kindly pardon me for my verbosity. This is my first post.
Thank you!

sentences:
Direction vector in raycasting When I read about how to get the direction vector in raycasting, for example on this site: http://www.daimi.au.dk/~trier/?page_id=98

They first render the mesh with front face culling and then with back face culling. And then subtract the backface from the front to get at a direction vector for each pixel.

But is this not to much work to get the direction vector, is it not more simpler and faster to just take the vertex position(in world coordinates) and subtract the camera position in the fragment shader to get the direction vector? This should give the exact same answer but we skip the backface and frontface rendering.

sentences:
Calling function every n second javascript game I making a game and I want to call a function that runs every random second to spawn something every time. I've seen some posts that said to use the setInterval() function to keep track of the time but I don't know where to implement it because I'm using the requestAnimationFrame() to loop the game. I also tried to implement it in the update function of the classes but it doesn't seem to work.
This is my main with the loop
import Game from '/src/game.js';

let canvas = document.getElementById('main');
let ctx = canvas.getContext('2d');

const WIDTH_SCREEN = 800;
const HEIGTH_SCREEN = 600;

let game = new Game(WIDTH_SCREEN, HEIGTH_SCREEN);
game.start();

function loop() {
    ctx.clearRect(0, 0, WIDTH_SCREEN, HEIGTH_SCREEN);

    game.update(ctx);

    requestAnimationFrame(loop);
}

window.addEventListener("keydown", (event) => game.controller.keyListener(event));
window.addEventListener("keyup", (event) => game.controller.keyListener(event));
requestAnimationFrame(loop);

sentences:
How can I render fonts in a game with correct hinting? I've used angel code's bitmap font generator quite a bit; though it's very good, I wonder if there would be a way to use the hinting information to provide a better and more readable result, by using hinting to provide differing thickness based on size/pixel coverage.

I imagine any solution would have to use the distance field tech presented in the valve paper on smoothing fonts while maintaining or reducing asset size. I haven't found any demos of it being used with hinting information turned on, or included in the field gradients in any way.

Another way of looking at this is whether there are any font bitmap generators that will output mipmaps that still maintain their readability in the face of pixel size. I think the lower mip levels would try to guarantee fill and space where it is necessary to maintain readability/topology over maintaining style/form; the point of hinting.

Is there a reason you can't just render the size you want?

The problem lies in the fact that font rasterisers currently don't render in 3D, and hinting information would be important in different amounts, due to the pixel density being different along different axes; even differing in importance along the length of a string, due to the size reducing over distance. For example, I only want horizontal hinting in a texture that is viewed from the side, and only really want vertical hinting in a font that is viewed from below or above. This isn't meant to be a renderer that tries to render a perfect outline as accurately as possible, as hinting distorts the reality of the font; instead, this is meant to be a rendering solution for static scenes, where the scenes use 3D transformed and warped text layout. In this case, the legibility is important; more important than the accuracy of representation of the polygon shape.

sentences:
Unity 2D animated tiles library: IsSelected variable not working or not present within RuleTileEditor.cs I have just tried downloading a library which will allow me to add animated tiles to unity. I have been following this tutorial:http://shadowpeakstudios.com/2018/10/22/unity-tutorial-animated-tiles/
It told me to download this library in order to work the animated tiles: https://github.com/Unity-Technologies/2d-extras
After this the tutorial told me to unzip the library and place it into my assets folder. It loaded into my assets folder and then got the following error:
Assets\2d-extras-master\2d-extras-master\Editor\Tiles\RuleTile\RuleTileEditor.cs(277,26): error
CS1061: 'ReorderableList' does not contain a definition for 'IsSelected' and no accessible extension
method 'IsSelected' accepting a first argument of type 'ReorderableList' could be found (are you
missing a using directive or an assembly reference?)

Does anyone perhaps know why this error is occuring.

sentences:
How do I use music analysis in a game? I'm thinking of writing a game in the vein of BeatHazard (where the music you're listening to affects the game), and after researching the subject of music analysis in programming, I know enough to know that it's a very complex subject.  So here are some questions:

What concepts do I as an engineer need to know about to do this?  What concepts do I probably not need to know about?
What kinds of analysis are simple, robust, and efficient enough to be used in a game (and preferably in that order - I would greatly prefer simplicity over efficiency and can trade some correctness if it keeps things simple)?
What cross-platform open source libraries exist that are easy to build and include?  I'm using MonoGame, but I'm willing to use p/invoke for a good library.  I've read about aubio, clam, and marsyas, and I'm not quite sure which I'm looking for.

sentences: 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:
Windows Forms game loop There is a very good game loop in the link which is tailored for windows forms. I need it in c++/cli so I converted the code as below. Here is my main loop.

using namespace System;
using namespace System::Windows::Forms;

HWND g_theAppHandle = nullptr;

bool IsApplicationIdle()
{
  MSG msg;
  return PeekMessage(&msg, g_theAppHandle, 0, 0, 0) == 0;
}

void OnIdle(System::Object ^sender, System::EventArgs ^e)
{
  while (IsApplicationIdle())
  {
    if (PunkEd::ABTCLI::g_initSuccess)
    {
      PunkEd::ABTCLI::Frame(0.0f);
    }
  }
}

[STAThread]
int CALLBACK WinMain(
  _In_ HINSTANCE hInstance,
  _In_ HINSTANCE hPrevInstance,
  _In_ LPSTR     lpCmdLine,
  _In_ int       nCmdShow
  )
{
  _CrtMemState memstate;
  _CrtMemCheckpoint(&memstate);

  PunkEd::PunkEdMain^ theApp = gcnew PunkEd::PunkEdMain;
  g_theAppHandle = (HWND)theApp->Handle.ToPointer();

  Application::Idle += gcnew System::EventHandler(&OnIdle);
  Application::Run(theApp);

  _CrtMemDumpAllObjectsSince(&memstate);
  return 0;
}

This loop triggers PunkEd::ABTCLI::Frame(0.0f); every time the application is idle. And Frame(float deltaTime); function triggers everyting related to game. Like render and physics. However my rendering window is a panel. And I override its mouse move callback as below.

private: System::Void panel1_MouseMove(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) {
  Debug::WriteLine(e->Location);

  glm::vec3 cp = glm::vec3(e->Location.X, e->Location.Y, 0);
  glm::mat4 view = g_camera->GetViewMatrix();
  glm::mat4 project = g_camera->m_projection;
  glm::unProject(cp, view, project, glm::vec4(0.0f, 0.0f, (float)panel1->Width, (float)panel1->Height));

  cp.x -= panel1->Width / 2.0f;
  cp.y -= panel1->Height / 2.0f;

  g_cursor->m_node->m_translation = cp.xzy;
}

This function updates my curser's position in the game. However my render function is get called after I stop moving the mouse. How can I overcome this stuation such that my curser position gets update and renders immediatly after I moved mouse.

sentences:
How can I get a 4x4 matrix from a bullet quaternion? I'm trying to make a game using JavaScript with Ammo.js ( an implementation of bullet ) and Sylvester to do my matrix maths. The problem is I don't know how to turn the WXYZ that bullet gives into the 4x4 matrix Sylvester needs.

If there is a way to just get Bullet Physics to give me the 4x4 matrix please tell me! I am completely lost here.

sentences:
What is the difference between Sprite and SpriteBatch, specifically in the context of libGDX? I'm using libGDX and I'm confused about the difference between the Sprite and SpriteBatch.

Anybody can explain it to me in a simple way?

sentences: Hearthstone suggest a card algorithm Does anyone have an insight of the suggest a card algorithm in hearthstone deckbuilding? I would like to try to see it that same suggestion can be applied in MtG, having for example to choose your total mana and get suggestions for color, colorless and enchantments/artifacts/sorceries/instants.

sentences:
Algorithm for procedural city generation? I am planning on making a (simple) procedural city generator using Java. I need ideas on whan algorithm to use for the layout, and the actual buildings. The city will mostly have skyscrapers, not really much complex stuff.

For the layout I already have a simple algorithm implemented:

Create a Map with java.awt.Point keys and Integer values. Fill it with all the points in the city's bounds with the value as -1 (unnassigned)
Shuffle the map, and assign the 1st 10 of the keys IDs (from 1-10)
Loop until all points have IDs:
Loop though all points:
Assign points next to an assigned point IDs of the point next to them, if 2 or more points border the point, then randomly choose which ID the point will get.
Stop looping #3-5 when all points have ids
You will end up with 10 random regions. Make roads bordering these regions.
Fill the inside of each region with a randomly spaced and randomly rotated grid

PROBLEM: This is not the fastest way to do it.

What algorithm should I use for the layout. And what should I use to make each building's design? I don't even know how I'm going to do that yet (fractals maybe). I just need some ideas, not actual code.

sentences:
Rotating on a slanted surface? I want to rotate (change it's yaw) an object when its sitting on slanted ground. Pretty much I want to rotate around the ground's normal.

Right now I ray cast down, get the ground's normal.
Then I do:

Tick(deltaTime)
{
  Quaternion rotationDelta = QuatFromAxisAngle(groundNormal, rotationRate * deltaTime);
  ObjectRotation = rotationDelta * ObjectRotation;
}

But this isn't giving me quite the right results. Any suggestions?

Before Rotation:

A rotation of 90 degrees:

sentences:
OUYA Developer Kit throws various errors on start I followed these instructions for Mac OS X using an existing IDE (shell + text editor) instead of the Eclipse ADT thingy. I activated “Use Host GPU”, and installed Intel HAXM.
Installing the ouya-framework.apk and ouya-launcher.apk appears to go well. But when I start up my AVD there’s a dialog box saying “Unfortunately, the OUYA Launcher has stopped.”, I still get the choice of starting up the OUYA Launcher. When I do so there’s another dialog box saying “Can’t play this video”. I skip the controller settings, and then there’s a JOIN A WIRELESS NETWORK screen which I can’t get past.

This is the ODK 1.0.2, and I tried it using both Mac OS X 10.8.3 and 10.7.5.

sentences:
Texture loading: Everything at once OR un-/loading the needed assets? Good evening. We've been developing quite a huge game for android on the basis of AndEngine. So we have a lot of assets to load, especially textures.

At the moment everything (sound, textures etc) for every screen (menu, shop, etc etc) is loaded when the app starts (while showing a progress bar). This way the user only has to wait once about 16 seconds at the start of the game. We think that this is a pretty pleasant solution from the users perspective but might it be bad in terms of battery usage / memory usage or any other reasons?

What arguments speak for a solution where we unload all the screen specific assets of the active screen and load the assets needed for the next screen? Thank you for your opinion!

sentences:
How do you support different VR platforms? I created an Android app for Gear VR in Java (using the GearVR framework) that I now want to port to Unity, so it can also be used for Microsoft's semi-new Mixed Reality headsets (for Windows; not HoloLens, though).

I've never worked with Unity (or C#) before, that's why I have a question:

How would you set up something like that? Can you simply create a single project and then put it on your (Android) phone/compile it on your PC depending on where you want to test it, or do you need separate projects for different platforms?

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:
A pattern for a contextual InputState in a Game State Management architecture Context of the question :

When developing a game using Game State Management I came across a problematic when it came to handling user input : I want my game to retrieve user input a single way, but to handle it in a completely different way, depending on the context.

For example, the [Up] key will always mean "Menu Up" when you're in a menu, but if you're in the game, it might do different things, depending on the key bindings. Another difference would be, for example, that in a menu, a .5sec KeyDown on a key should be interpreted as a single command, but when you're in game, a .5sec KeyDown should often be seen as a .5sec movement / burst / charge shot / etc...

Then way I though about to achieve this result is the following :

Have an InputState class that keeps the current and previous Keyboard/Gamepad input states, just like the usual InputState class. Have this InputState class implement all the methods I would need in all the different contexts.
Create an Interface per context. For example, IMenuInputState, IGameInputState, ICutsceneInputState, etc. These interfaces would only contain the method definitions related to the context.
Have the InputState implement all the I[...]InputState interfaces. If two or more context need the same method, the same implementation would be used.
In the ScreenManager's Update method, the InputState would be Updated, but depending on which screen must handle the InputState, a different I[...]InputState would be sent. Even though the screen could access the other methods by casting the interface, only the contextual methods would directly be usable.

My question is the following : Is my idea a proper / common way of handling this issue?

If it is, could you tell me the name of that "pattern" or direct me to some online resources so I can read on that and avoid the known pitfalls. If it's not, how would you suggest I handle the problem?

Note: I know this question is borderline since the answer is partially subjective but I'd appreciate some help on this issue since I think it's a critical decision in my project.

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:
Which is the way to pass parameters in a drawableGameComponent in XNA 4.0? I have a small demo and I want to create a class that draws messages in screen like fps rate. I am reading a XNA book and they comment about GameComponents. I have created a class that inherits DrawableGameComponent

public class ScreenMessagesComponent : Microsoft.Xna.Framework.DrawableGameComponent

I override some methods like Initialize or LoadContent. But when I want to override draw I have a problem, I would like to pass some parameters to it.

Overrided method does not allow me to pass parameters.

        public override void Draw(GameTime gameTime)
        {
            StringBuilder buffer = new StringBuilder();

            buffer.AppendFormat("FPS: {0}\n", framesPerSecond); // Where get framesPerSecond from???

            spriteBatch.DrawString(spriteFont, buffer.ToString(), fontPos, Color.Yellow);
            base.Draw(gameTime);
        }

If I create a method with parameters, then I cannot override it and will not be automatically called:

        public void Draw(SpriteBatch spriteBatch, int framesPerSecond)
        {
            StringBuilder buffer = new StringBuilder();

            buffer.AppendFormat("FPS: {0}\n", framesPerSecond);
            spriteBatch.DrawString(spriteFont, buffer.ToString(), fontPos, Color.Yellow);
            base.Draw(gameTime);
        }

So my questions are:

Is there a mechanism to pass parameter to a drawableGameComponent? What is the best practice?
In general is a good practice to use GameComponents?

sentences:
The best way to communicate between multiple iPhones/iPads in a card game I have been looking around for information about this topic but not found what i need.

Here is the scenario, i am planning a card based game (cocos2d) where the idea is that up to four players should be able to play.

One player will hand out the cards to all four and then they play. Next round the next player should do this and so on..

On the screen i would like the actual player to see his/her own cards as well as the others cards that they have played out meaning that each player should see the others active cards.

I would like to ask the following:

How would be the best way of implementing this from a communication point of view?
Would this go via game center?

A reference to information is appreciated.

Cheers

sentences:
How would you design a transformation matrix to project absolute coordinates to any orthographic projection desired? I am attempting to make an RTS based on AoE II HD Edition. I want to have ease of control by designing a transformation matrix given any style of projection I want.
This is a good example of what I mean. So, given each of those three angles, and any absolute x, y, and z, how can I design a transformation matrix to multiply the absolute position by to get the projected position on the screen? I just want full control, and I need to get better at matrices. I am about to graduate High School but I hardly learned anything related to matrices. Only a little in Physics and a little in Algebra II with Trig.

I just need to know how to create the matrix.

Also, after that, how would I convert a projected matrix back to the original position? Dividing it (Although, I know matrices can't divide - I mean multiply by the inverse)? Thanks so much for any help!

sentences:
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:
Make platformer character stay in the air at the top of a jump I have a player who can jump. I want the character to stay in its position and not fall to the floor.
This is the code I am using so far:
private void FixedUpdate()
{
        if(moveup)
        {
            rigid.AddForce(new Vector3(0, 1f, 0) * speed, ForceMode2D.Impulse);
            moveup = false;
        }
}

How can I stop the character from falling?

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:
Good example of a multi-pass effect? In XNA (and Direct3D in general AFAIK), rather than creating individual vertex and fragment shaders, you bundle potentially many related shaders into 'Effects'. When you come to use an effect you select a 'technique' (or iterate through all of them) and then each 'technique' has a number of 'passes'. You loop through the each pass it selects the relevant vertex and fragment shader and you draw the geometry.

What I'm curious about though is what you would need multiple passes for? I understand in the early days of 3d you only had one texture unit and then you had 2 and that often still wasn't enough if you also wanted to do environment mapping. But on modern devices, even in the mobile class, you can sample 8 or more textures and do as many lighting calculations as you'd want to in a single shader.

Can the more experienced here offer practical examples of where multi-pass rendering is still needed, or is this just over-engineering on the part of XNA/Direct3d?

sentences:
HTML5 platformer collision detection problem I'm working on a 2D platformer game, and I'm having a lot of trouble with collision detection. I've looked trough some tutorials, questions asked here and Stackoverflow, but I guess I'm just too dumb to understand what's wrong with my code.

I've wanted to make simple bounding box style collisions and ability to determine on which side of the box the collision happens, but no matter what I do, I always get some weird glitches, like the player gets stuck on the wall or the jumping is jittery. You can test the game here: Platform engine test. Arrow keys move and z = run, x = jump, c = shoot. Try to jump into the first pit and slide on the wall.

Here's the collision detection code:

function checkCollisions(a, b)
{
    if  ((a.x > b.x + b.width) ||
        (a.x + a.width < b.x) ||
        (a.y > b.y + b.height) ||
        (a.y + a.height < b.y))
    {
        return false;
    }
    else
    {
        handleCollisions(a, b);
        return true;
    }
}

function handleCollisions(a, b)
{
    var a_top = a.y,
        a_bottom = a.y + a.height,
        a_left = a.x,
        a_right = a.x + a.width,
        b_top = b.y,
        b_bottom = b.y + b.height,
        b_left = b.x,
        b_right = b.x + b.width;

        if (a_bottom + a.vy > b_top && distanceBetween(a_bottom, b_top) + a.vy < distanceBetween(a_bottom, b_bottom))
        {
            a.topCollision = true;
            a.y = b.y - a.height + 2;
            a.vy = 0;
            a.canJump = true;
        }
        else if (a_top + a.vy < b_bottom && distanceBetween(a_top, b_bottom) + a.vy < distanceBetween(a_top, b_top))
        {
            a.bottomCollision = true;
            a.y = b.y + b.height;
            a.vy = 0;
        }

        else if (a_right + a.vx > b_left && distanceBetween(a_right, b_left) < distanceBetween(a_right, b_right))
        {
            a.rightCollision = true;
            a.x = b.x - a.width - 3;
            //a.vx = 0;
        }
        else if (a_left + a.vx < b_right && distanceBetween(a_left, b_right) < distanceBetween(a_left, b_left))
        {
            a.leftCollision = true;
            a.x = b.x + b.width + 3;
            //a.vx = 0;
        }

}
function distanceBetween(a, b)
{
    return Math.abs(b-a);
}

sentences:
Per pixel normal mapping resulting in static on normals starting on Z axis For the past week I've been trying to implement bump mapping in DirectX 11 using the Frank Luna's '3D Game Programming with DirectX 11' book. I got it working until I tried to add a flat 2D plane facing in the -Z axis and the texture appeared distorted. After a while I found out it was the bumped normals that were causing it.

I've used Terathon to calculate tangents after generating a mesh.

My code is as follows:

void AddTangentToVertexArray(const UINT vertexCount, const UINT indexCount, PackedVertex* vertices, const WORD* indices)
    {
        const UINT triangleCount = indexCount/ 3;

        XMVECTOR* tan1 = new XMVECTOR[indexCount* 2];
        XMVECTOR* tan2 = tan1 + indexCount;
        ZeroMemory(tan1, indexCount* sizeof(XMVECTOR) * 2);

        for (UINT a = 0; a < indexCount; a++)
        {
            WORD i1 = indices[(a * 3)];
            WORD i2 = indices[(a * 3)+1];
            WORD i3 = indices[(a * 3)+2];

            const XMFLOAT3& v1 = vertices[i1].vertex;
            const XMFLOAT3& v2 = vertices[i2].vertex;
            const XMFLOAT3& v3 = vertices[i3].vertex;

            const XMFLOAT2& w1 = vertices[i1].uv;
            const XMFLOAT2& w2 = vertices[i2].uv;
            const XMFLOAT2& w3 = vertices[i3].uv;

            FLOAT x1 = v2.x - v1.x;
            FLOAT x2 = v3.x - v1.x;
            FLOAT y1 = v2.y - v1.y;
            FLOAT y2 = v3.y - v1.y;
            FLOAT z1 = v2.z - v1.z;
            FLOAT z2 = v3.z - v1.z;

            FLOAT s1 = w2.x - w1.x;
            FLOAT s2 = w3.x - w1.x;
            FLOAT t1 = w2.y - w1.y;
            FLOAT t2 = w3.y - w1.y;

            FLOAT r = 1.0f / (s1 * t2 - s2 * t1);
            XMVECTOR sdir{ (t2 * x1 - t1 * x2) * r, (t2 * y1 - t1 * y2) * r,
                (t2 * z1 - t1 * z2) * r };
            XMVECTOR tdir{ (s1 * x2 - s2 * x1) * r, (s1 * y2 - s2 * y1) *r,
                (s1 * z2 - s2 * z1) * r };

            tan1[i1] += sdir;
            tan1[i2] += sdir;
            tan1[i3] += sdir;

            tan2[i1] += tdir;
            tan2[i2] += tdir;
            tan2[i3] += tdir;
        }

        for (UINT a = 0; a < vertexCount; a++)
        {
            const XMVECTOR& n = XMLoadFloat3(&vertices[a].normal);
            const XMVECTOR& t = tan1[a];

            XMStoreFloat4(&vertices[a].tangent, XMVector3Normalize((t - n * XMVector3Dot(n, t))));

            vertices[a].tangent.w = (XMVector3Less(XMVector3Dot(XMVector3Cross(n, t), tan2[a]), XMVECTOR{ 0.0f, 0.0f, 0.0f, 0.0f })) ? -1.0f : 1.0f;
        }

        delete[] tan1;
    }

And I used Frank Luna's implementation to use those tangents to calculate the bitangent but in the the newer version of directX 11

float3 NormalSampleToWorldSpace(float3 normalMapSample, float3 NormalW, float4 TangentW)
{
    float3 NormalT = 2.0f*normalMapSample - 1.0f;
    float3 N = normalize(NormalW);
    float3 T = normalize(TangentW - dot(TangentW, N)*N);
    float3 B = cross(N, T) *TangentW.w;

    float3x3 TBN = float3x3(T, B, N);

    float3 bumpedNormalW = mul(NormalT, TBN);

    return normalize(bumpedNormalW);
}

EDIT: After a couple hours of debugging I've found that changing the T calculation to float3 T = normalize(TangentW - dot(TangentW, N));// *N); seems to have stopped any distortions. If someone can confirm that this isn't going to cause later issues I'm willing to say it's solved.

All surfaces are using the same normal map in the following gifs.

A visual example of what happens to normals facing down and up the Z axis

Here is the same plane but rotated 90 degrees

A visual example of a sphere that isn't affected by the distortion due to what i can only assume is having no normals along the Z axis

My guess is that something is wrong within the tangent calculator as the error persists when the plane is rotated, but I cannot seem to find anything different to the version on Terathon.

If there's anything else that you need to tackle the problem just let me know and I can supply it.

sentences:
Separating rendering from HWND I'm considering separating my game simulation from the message loop. It seems odd to me to have other systems tied directly to the window in which my game is running. Most examples I see are implemented similar to the following (I'm glossing over details here, code is only meant to get the idea across)

... WndProc(...)
{
    //PeekMessage
    //Update input
    //Update timer
    //Update simulation
    //Update renderer
}

To increase separation of concerns, I'd like to move the update of input, simulation and renderer out of the specific window itself. This seems simple to accomplish

... WinMain(...)
{
    //Update window
    //Update input
    //Update timer
    //Update simulation
    //Update renderer
}

... WndProc(...)
{
    //PeekMessage
}

There is information that must be obtained from the window to be consumed by the rest of the game. Namely, input (if using the message system), window size, window focus, etc. I should be able to use callbacks or passing in references to state objects the window will update to get this information.

This approach allows me to separate each concern into it's own class. The window code is implemented in a Window class, input in Input, etc. I can use WinMain or a Game class to create each system and coordinate state between them.

Further, it allows me to divorce the renderer from the HWND itself. It seems smelly to me to have the renderer embedded directly within the Window. What if something happens to the window? What if I want to use the same renderer to output multiple views into separate windows (via CreateAdditionalSwapChain)?

The questions that arise from this:

Primary:

It seems I can just rebuild the swap chain to hook up to a new window. Do scenarios exist where the HWND could be invalidated or destroyed but I want to retain my rendering context? Or is this overkill?

Secondary:

Are there flaws to this approach I'm not considering?
Are there better implementations I'm not considering?

sentences:
Creating a checker board in C# winform I am using the PictureBox class to create a checkerboard, and it not really working all that well. I've created the loop:

PictureBox[,] squares = new PictureBox[10,10];
        for (int i = 0; i < 10; i++)
        {
            for (int j = 0; j < 10; j++)
            {
                squares[i, j] = new PictureBox();
                squares[i,j].Image = Chess.Properties.Resources.square;
                squares[i, j].BackColor = Color.Transparent;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            for(int j = 0; j < 10; j++)
            {
                squares[i, j].Location = new Point(i * 30, j * 30);
                this.Controls.Add(squares[i, j]);
            }
        }

It's supposed to create a 10x10 grid, and I added the image into the application resources. Each square is 20x20 pixels, and I loop by column. I thought it would work, but all I get is 6 images and the size just gets smaller.

Am I missing something? Or any good alternatives in creating a checkerboard without using PictureBox? Any thing with a MouseLeave, MouseHover, MouseClick, events I can use.

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:
SharpDX / DirectX: How to render text to a transparent BitmapRenderTarget? I'm trying to render text to a BitmapRenderTarget, cleared with transparent color.

My TextBox is drawn on its own SharpDX.Direct2D1.BitmapRenderTarget, which I create in this way:

var bitmapRenderTarget = new SharpDX.Direct2D1.BitmapRenderTarget(renderTarget,
    SharpDX.Direct2D1.CompatibleRenderTargetOptions.None, null, null, null);

As you can see, I don't change the pixel format of BitmapRenderTarget. The pixel format of underlying SharpDX.Direct2D1.RenderTarget, on which I draw my TextBox through DrawBitmap method, is defined in the following code:

renderTargetProperties = new SharpDX.Direct2D1.RenderTargetProperties()
{
    PixelFormat = new SharpDX.Direct2D1.PixelFormat(SharpDX.DXGI.Format.Unknown,
    SharpDX.Direct2D1.AlphaMode.Premultiplied)
};

Here is the code, that produces visual results:

// In the case 1: opaque white background
bitmapRenderTarget.Clear(SharpDX.Color.White);
...

// In the case 2: white background with 50% transparency
bitmapRenderTarget.Clear(new SharpDX.Color4(1f, 1f, 1f, 0.5f));
...

// In the case 3: fully transparent background
bitmapRenderTarget.Clear(SharpDX.Color.Transparent);
...

// The color of textBrush in all these cases is the same solid Black.
bitmapRenderTarget.DrawTextLayout(vector, textLayout, textBrush, ...);

The results:

As you can see, alpha value of the text color is somehow bound to the one in the clear color. The black line around the text is cursor, and it is drawn as it should.

How to fix this issue?

sentences:
Contact friction for overlapping rectangles I am currently developing a top-down "tabletop simulator" where you are able to drag, drop and rotate playing cards on a table. The cards are able to overlap but do not interact as of yet. What I now want to implement is that whenever a card is being dragged over another card, that the bottom starts moving as a result of the dynamic friction between the overlapping cards. Right now I am thinking of two ways to approach this:

Determine the area of overlap and use the center of mass of this area as the point where the friction force is acting on
Rasterize the cards and determine the overlapping raster and let the friction force act on these points.

Unfortunately I expect these methods to be computationally demanding and was wondering if there are more efficient methods out there. So far I have not found any material referencing this type of problem. I assume it relates to determining the area of contact for 3D objects and applying a friction force.

sentences:
How to clip game objects to a rectangular area I'm trying to figure out how to do this but am coming up short. I'm making a slot machine in unity 2d and would like to clip the tile prefabs when they leave a given rectangular area.

I can't seem to figure out how to do this. All of the references I've found say to use a clipping shader with a mask texture, but it seems like massive overkill to use a masking texture when I just need an easy pre-defined rectangular area.

sentences:
How area-of-effect effects are projected into games world? I see a lot of skills in the games I play where they have a skill or a search area that projects a drawing on to a map, like a circle or something similar and I have no idea how that is done, and I don't think they use a texture to draw it. For the projection, I think, they use some kind of ray-cast to find the shape of the map and then go from there but I may be far off from truth.

In the linked image example you can see the circle is projected on the flat surface and the stairs. (And how is that glow effect around the circle achieved or is that part of a texture?)

Can someone tell me how is that done or point me to the right direction?

sentences:
LWJGL exception in JME3-JFX! Video playback in jMonkeyEngine 3.0 seemed to be in limbo for quite a while until I chanced upon this thread about playing videos by integrating JavaFX 2 into the JME3 framework. This coupled with the recent announcement of MP4 playback support in JavaFX made JME3 a real contender for a project I'm currently working on.

I followed the prescribed method as mentioned in the former thread, got the sources from the JME3-JFX project page and setup the project in eclipse. When I ran the example [TestMovie.java] with the given URL from Oracle, it ran smoothly with no issues. However when I attempted to play an MP4 file, it played for a brief period with messed up colours and then exited with a java.lang.IllegalArgumentException exception.

Here is the eclipse console output :

INFO: Audio effect extension version: 1.0
Nov 27, 2014 6:33:13 PM com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread
INFO: Audio max auxilary sends: 4
Nov 27, 2014 6:33:34 PM com.jme3.app.Application handleError
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.IllegalArgumentException: Number of remaining buffer elements is 6627840, must    be at least 14745600. Because at most 14745600 elements can be returned, a buffer with at least 14745600 elements is required, regardless of actual returned element count
at org.lwjgl.BufferChecks.throwBufferSizeException(BufferChecks.java:162)
at org.lwjgl.BufferChecks.checkBufferSize(BufferChecks.java:189)
at org.lwjgl.BufferChecks.checkBuffer(BufferChecks.java:230)
at org.lwjgl.opengl.GL11.glTexImage2D(GL11.java:2845)
at com.jme3.renderer.lwjgl.TextureUtil.uploadTexture(TextureUtil.java:352)
at com.jme3.renderer.lwjgl.LwjglRenderer.updateTexImageData(LwjglRenderer.java:1913)
at com.jme3.renderer.lwjgl.LwjglRenderer.setTexture(LwjglRenderer.java:1936)
at com.jme3.material.MatParamTexture.apply(MatParamTexture.java:86)
at com.jme3.material.Material.render(Material.java:1088)
at com.jme3.renderer.RenderManager.renderGeometry(RenderManager.java:523)
at com.jme3.renderer.queue.RenderQueue.renderGeometryList(RenderQueue.java:322)
at com.jme3.renderer.queue.RenderQueue.renderQueue(RenderQueue.java:374)
at com.jme3.renderer.RenderManager.renderViewPortQueues(RenderManager.java:763)
at com.jme3.renderer.RenderManager.flushQueue(RenderManager.java:719)
at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:983)
at com.jme3.renderer.RenderManager.render(RenderManager.java:1029)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:252)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:185)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:228)
at java.lang.Thread.run(Thread.java:745)

Now I'd like to clarify that the same MP4 file played flawlessly in a vanilla JavaFX project. Also, one of the developers has confirmed in the first mentioned thread on the jMonkeyEngine forums that he was able to play MP4 videos flawlessly and three of them simultaneously nonetheless. I'm testing these samples on Java 1.8 u25 on Windows 8.1 Pro [x86-64] running an Intel Core i5 [Haswell] with Intel HD 5000 graphics.

I'm a beginner to graphics development and am aware that the jMonkeyEngine forums are the best place to ask my question but their forum's Q/A section seems to be broken and I'm unable to post there. Any and all help will be appreciated.

sentences:
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:
How can I get multiple players play my multiplayer game at launch? Lets take a example of Apex Legends, it was release in February 4, 2019 and got 25 millions users in after a week (Source: The Verge). I know EA is the publisher so its easy for them to market and have huge user base but what if Im new in the industry and have been funded or invested to make huge game like that but could not get million of user in such short period of time?

How could I achieve something like this? How can I get a lot of players to play my game when I launch it? I thought of adding AI/bots to keep the real players in until my player mass is good enough, but is that just it? Are there other options?

sentences:
Check whether object is looking in between a minimum and maximum angle in 3d Space What I want to accomplish is to check whether an object is looking in between a minimum and maximum angle in 3D space

for example if a Helicopter is looking to the right...

it would have to check whether its rotation vector is within a cone like shape

when, the heli's rotation vector is inside, the method returns true, but false otherwise. So in the scenario above, the method would return false.

The answer is fairly simple in 2D as all I have to do is check whether minAngle < heli rot angle < maxAngle or use dot product to check, but in 3D I have to look at 2 dimensions against the Y axis to start.

I could define a cone class and check whether a vector is projected from the origin, but it seemed too excessive as I dont need variables like cone length, start radius, & end radius. I feel like I'm missing something simple that involves a bit of playing around from xz to xz->y. Is it possible to accomplish something similar just by checking heli's rot orientation?

sentences: Good introduction to all things game dev? I saw a lot of books which cover specific topics, but is there a book or a recommendation of a few books which covers the basic of everything involved in making a game? I know this would only cover the basics, but that would be a good starting point to later read more into specific topics.

sentences: Job based on development Are there any companies that offer jobs based on games or app development by an individual in his profile, with out any certificate from any institution ?

sentences:
SimpleOpenNI: Check if user hand is in specific area on image Concerning our Microsoft Kinect project, we need some help.

We control a robot with our movements tracked by the Kinect sensor. We display the depth image of the Kinect sensor on our screen, so we see what the sensor is acutally tracking.

Now we want to implement a feature that a user can turn the robot on and off by moving the hand on a specific area drawed on this depth image. You can see this in the image below. The problem now is, that the coordinates of this "on-drawed" ellipse obviously are relative in the 3d-space.  I know that there must be any possibility to translate the X-, Y- and Z-coordinates of the hand in the 2d-space, but honestly, I have no idea how to do this. I imagine a kind of "tunnel" from the point of view of the sensor, like in the picture below, which the user must hit.

I hope that somebody can help us here.

sentences:
VBO rendering crashed with glDrawArrays I'm playing around in LWJGL3 and I'm experiencing an issue regarding glDrawArrays.

At glDrawArrays the JVM crashes.

I'm using modern OpenGL and therefore I have my own shaders and matrix calculations.
The pipeline I've programmed is quite complex so pasting all the code here isn't of any use.

Vertex shader:

#version 330 core

uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;
uniform mat4 modelMatrix;

layout (location = 0) in vec3 in_position;

void main() {
    gl_Position = (projectionMatrix * viewMatrix * modelMatrix) * vec4(in_position, 1.0f);
}

Fragment shader:

#version 330 core

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

I'm trying to draw 1 point to the screen using a VBO. Creation of the VBO:

float[] vboData = new float[]{0.0f, 0.0f, 0.0f};
FloatBuffer buffer = BufferUtils.createFloatBuffer(vboData);

vbo_id = glGenBuffers();
glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
glBufferData(GL_ARRAY_BUFFER, buffer, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);

And the rendering of the point using glDrawArrays:

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    testShader.bind();
        pipeline.applyMatrices(testShader);

        glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
            glVertexAttribPointer(0, 3, GL_FLOAT, false, 12, 0);
            glDrawArrays(GL_POINTS, 0, 1);
        glBindBuffer(GL_ARRAY_BUFFER, 0);

        pipeline.setCameraPosition(new Vector3f(0.0f, 0.0f, 0.0f), new Vector3f(0.0f, 0.0f, 0.0f));
    testShader.unbind();

    GLFWUtils.swapBuffers();

Using GLIntercept I managed to get a log of every OpenGL call made:

glClearColor(1.000000,0.000000,1.000000,1.000000)
glPointSize(10.000000)
glGenBuffers(1,000000001E0F6FC0)
glBindBuffer(GL_ARRAY_BUFFER,1)
glBufferData(GL_ARRAY_BUFFER,12,0000000025EB8D90,GL_STATIC_DRAW)
glBindBuffer(GL_ARRAY_BUFFER,0)
glCreateProgram()=1
glCreateShader(GL_VERTEX_SHADER)=2
glCreateShader(GL_FRAGMENT_SHADER)=3
glShaderSource(2,1,000000001E0F6FC0,000000001E0F6FC8)
glShaderSource(3,1,000000001E0F6FC0,000000001E0F6FC8)
glCompileShader(2)
glCompileShader(3)
glGetShaderiv(2,GL_COMPILE_STATUS,000000001E0F6FC0)
glGetShaderiv(3,GL_COMPILE_STATUS,000000001E0F6FC0)
glAttachShader(1,2)
glAttachShader(1,3)
glLinkProgram(1)
glEnableVertexAttribArray(0)
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT)
glUseProgram(1)
glGetUniformLocation(1,"projectionMatrix")=1
glUniformMatrix4fv(1,1,false,[-0.671312,-0.000000,-0.000000,-0.000000,-0.000000,-0.895083,-0.000000,-0.000000,-0.000000,-0.000000,-1.000020,-1.000000,-0.000000,-0.000000,-0.020000,-0.000000])
glGetUniformLocation(1,"viewMatrix")=2
glUniformMatrix4fv(2,1,false,[1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,0.000000,1.000000])
glGetUniformLocation(1,"modelMatrix")=0
glUniformMatrix4fv(0,1,false,[1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,0.000000,1.000000])
glBindBuffer(GL_ARRAY_BUFFER,0)
glVertexAttribPointer(0,3,GL_FLOAT,false,12,0000000000000000)
glDrawArrays(GL_POINTS,0,1)

I've carefully tested a few things:

The shaders compile and link fine
The matrices calculated look correct (you can double check inside the GLIntercept log)
The VBO is correctly created and filled with the correct data
The attribute pointer ( = layout 1) is enabled
The matrices are correctly sent to the shader (this happens at pipeline.applyMatrices)

What am I missing?

Interesting debug finding: I'm running this on nVidia. On a Intel graphics CPU it runs, but nothing shows on the screen!

sentences:
Flash/Flex/Air and iOS I'm just a little confused with all of the news recently regarding the cancellation of mobile flash, so was hoping for a little help. I've had a search through and can't find the answers to these questions, so any help would be great.

First up, I'm looking to create a game in Flash first, to test whether the concept works as a fun game (on Newgrounds/Kongregate/Facebook etc.). Would it be best to use Flash CS5.5, or Flash Builder?

Secondly, with mobile flash now being discontinued by Adobe, could I still port this game over to iOS through the Flash platform, or would it be better at that point to re-write the whole game using Objective C? (NOTE: I'm not an Objective C developer, but am instead a Javascript and Actionscript dev).

Any help would be great. Thanks!

sentences:
Effect culling on uneven terrain I'm trying to integrate a "ground particle" effect (like a fire-circle or similar) in Unity3d, however since i'm using uneven terrain as my terrain mesh, the effect gets culled behind terrain parts that above it.

To better ilustrate it I created an image as attachment :
I want for the effect to always be displayed regardless of it's "depth".
How can this undesired effect be avoided/resolved properly ?

sentences:
GetCurrentAnimatorStateInfo(0) returns animation hash which is not found in list of animations I trigger the animation "hg reload g2f" from "Any State" using a trigger.
Here is a screenshot of my animator:

I would now like to detect if the  animation is still being played.
To do that, I have tried the following approaches. None of them returned True while the animation is being played:
void LateUpdate()
{
    Debug.Log(_animator.GetCurrentAnimatorStateInfo(0).IsName("hg reload g2f") + "\n");
    Debug.Log(_animator.GetCurrentAnimatorStateInfo(0).IsName("6 Reload Pistol") + "\n");
    Debug.Log(_animator.GetCurrentAnimatorStateInfo(0).IsName("Base.hg reload g2f") + "\n");
    Debug.Log(_animator.GetCurrentAnimatorStateInfo(0).IsName("Base.6 Reload Pistol") + "\n");

I have then tried a different approach which gives me deeper insights of what is currently being played:
At void Start(), I build a dictionary of the animations in the animator like that:
private void pBuildAnimationNameTable()
{
    _NamesTable = new Dictionary<int, string>();

    foreach (AnimationClip nClip in _animator.runtimeAnimatorController.animationClips)
    {
        _NamesTable[Animator.StringToHash(nClip.name)] = nClip.name;
    }
}

And then at LateUpdate, I call the following:
public string GetCurrentAnimatorStateName()
{
    if (_animator == null)
    {
        Debug.Break();
        return "nothing assigned yet";
    }

    AnimatorStateInfo stateInfo = _animator.GetCurrentAnimatorStateInfo(0);

    string sStateName;
    if (_NamesTable.TryGetValue(stateInfo.shortNameHash, out sStateName))
    {
        return sStateName;
    }
    else
    {
        return "Unknown animator state name.";
    }
}

However, it doesn't find the current animation's hash in the list:

What might be the reason why it's not found in the list of animations?

sentences:
Unity Pre Build Script - Add target dependent UI Elements I wrote a postbuild script that deploys my builds to google drive. That works great, but when I tried to use the same type of logic on a pre build script, it fails. I'm trying to enable all game objects with the tag Mobile if the platform is mobile (andriod or ios). Otherwise turn those off. This is what I have for a script:

#if UNITY_EDITOR
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
using UnityEngine;
using UnityEditor;

public class PreBuild : IPreprocessBuildWithReport
{
    public int callbackOrder => 0;

    public void OnPreprocessBuild(BuildReport report)
    {
        var mobileGameObjects = GameObject.FindGameObjectsWithTag("Mobile");
        switch (report.summary.platform) // todo: make sure all targets are populated here
        {
            // mobiles
            case BuildTarget.Android:
            case BuildTarget.iOS:
                //enable all game objects
                foreach (var mobileGameObject in mobileGameObjects)
                {
                    mobileGameObject.SetActive(true);
                }

                break;
            // standalones (desktops)
            case BuildTarget.StandaloneWindows:
            case BuildTarget.StandaloneLinux64:
            case BuildTarget.StandaloneOSX:
                foreach (var mobileGameObject in mobileGameObjects)
                {
                    mobileGameObject.SetActive(false);
                }

                break;
            // todo: consoles
        }
    }
}
#endif

The build runs fine, but when I run in mobile, none of the UI elements are there (off by default). Here is the heirarchy of them in my project:
 (screenshot not working):

- UI (Canvas Game Object)
  - Mobile ("Empty" Game Object, is tagged with "Mobile")
    - Joystick1
    - Joystick2
    - ActionButton

What am I missing?

sentences:
A decent design for handling large creation/deletion of random objects? So I was attempting a 'Hit the X' game (e.g Toss the turtle, spank the monkey) in which an uncontrollable object travels across the screen in hopes of hitting certain objects and avoiding others.

My dilemma is how to efficiently create and destroy these objects with respect to the character - that is, if the player is at, say, (90,34), all objects whose x position is less than 90 are garbage collected while more objects are generated at x > 90 or 100.

The only solution I could think of was to: randomly populate a tree that organizes by X values at the start of each round and to simply trim off the leaves at every so frames - if the player hits a certain spot, in which the tree is looking scrawny, start adding some more random objects on.

But this seems inefficient and unwieldy.  Does anyone have any suggestions?

sentences:
How can I play an animation in response to an event? I've written a script to play an animation, but it starts immediately as my level loads. Instead, I want it only to start when triggered by some event or after a given timeout.

How can I do this?

sentences: UNITY : I want to make my UI text fade in after 5 seconds I know this question has been asked and asked but none of the topics i visited gave me an answer. I'm making a game programmed in c# where you control a boat and i want my UI to appear smoothly by fading in after X seconds. May someone help me?

sentences:
How to render gameplay over UI? I'm working in 2D.

I have set up 2 cameras. One for UI and another one for gameplay.

I need the UI to be rendered after before game objects (over gameplay). I wanted to achieve this without using world space canvas, because It requires being scaled for every other device along with a camera.

UI can be drawn over gameplay using greater depth than gameplay camera. And because it's depth only there is no solid color, so it all works well.

But you cannot set gameplay camera to depth only because it doesn't render things right, it doesn't clear the render texture I guess.

So this is what happens if gameplay camera is set to depth only.

This is what happens when gameplay camera is set to Solid Color and UI Camera has bigger depth. You can see that the ring is covered by UI arrow.

If the UI Camera depth would be lower than gameplay camera (Solid Color). It would all be covered by gameplay camera without even displaying UI.

These are mine settings.

Is there a way to achieve this in Unity without using World Space Canvas Mode?

sentences:
How to instantiate an object to a randomised Vector2 So I'm trying to make a little game where squares randomly spawn around a set area and you have to tap them. The game is 2D. I'm having trouble using my randomly generated x and y floats to instantiate a cube in the game. Here is my code:

#pragma strict

public var play = false;
public var xpos : float;
public var ypos : float;
public var cube : GameObject;

function Start () {

}

function Update () {
}

function Game () {
    xpos = Random.Range(-10f,10f);
    ypos = Random.Range(-4.45f,4.45f);
    Instantiate(cube, new Vector2(xpos, ypos));
}

And here's the error!

Assets/gameController.js(18,20): BCE0023: No appropriate version of 'UnityEngine.Object.Instantiate' for the argument list '(UnityEngine.Rigidbody, UnityEngine.Vector2)' was found.

Any help would be appreciated. Thanks!
-Alex

sentences:
Correct way to project a texture with alpha and colors onto surfaces in Unity I am experimenting with Unity and wanted to project a unit circle beneath a unit and my very first naive approach was to create a child plane below the unit, assign the material to it and stretch it using the Pro Builder UV editor but it looked horrible:

In order to figure out what's wrong I read a lot of various approaches to "fix" that issue which were mostly the following:

use a higher resolution for the texture
do not use any compression
do not use a POT resolution
change the filtering option from bilinear to point
...

Eventually I figured that I have to do something completely different and that is how I stumbled upon the idea to use a shader attached to a projector game object in order to project a material. Unfortunately though it turns out the shader expects a grayscale image and only tints the projection based on a parameter. For reference this is the shader I have just copied from the web (source):

Shader "Projector/AdditiveTint" {
    Properties {
        _Color ("Tint Color", Color) = (1,1,1,1)
        _Attenuation ("Falloff", Range(0.0, 1.0)) = 1.0
        _ShadowTex ("Cookie", 2D) = "gray" {}
    }
    Subshader {
        Tags {"Queue"="Transparent"}
        Pass {
            ZWrite Off
            ColorMask RGB
            Blend SrcAlpha One // Additive blending
            Offset -1, -1

            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #include "UnityCG.cginc"

            struct v2f {
                float4 uvShadow : TEXCOORD0;
                float4 pos : SV_POSITION;
            };

            float4x4 unity_Projector;
            float4x4 unity_ProjectorClip;

            v2f vert (float4 vertex : POSITION)
            {
                v2f o;
                o.pos = UnityObjectToClipPos (vertex);
                o.uvShadow = mul (unity_Projector, vertex);
                return o;
            }

            sampler2D _ShadowTex;
            fixed4 _Color;
            float _Attenuation;

            fixed4 frag (v2f i) : SV_Target
            {
                // Apply alpha mask
                fixed4 texCookie = tex2Dproj (_ShadowTex, UNITY_PROJ_COORD(i.uvShadow));
                fixed4 outColor = _Color * texCookie.a;
                // Attenuation
                float depth = i.uvShadow.z; // [-1 (near), 1 (far)]
                return outColor * clamp(1.0 - abs(depth) + _Attenuation, 0.0, 1.0);
            }
            ENDCG
        }
    }
}

With that shader I was able to render the following effect:

Since I have no experience with shaders at all I just blatantly copy & pasted it and do not know (yet) how to customize them or even write custom ones in the first place.

Assuming my approach to combine a projector with such a shader is the way to go, I'd like to know whether there is any shader you can share that allows me to project an unlit texture with transparency and its own color such as the following example:

sentences:
How to reduce the time taken to path-find to an unreachable location? I have a 2048x2048 map and if I path-find to an unreachable location, it makes the pathfinder go through every node on the map which freezes the thread for 4 seconds.

How can I reduce that time?

I'm using JPS
It's a dynamic map (it changes at runtime)

sentences:
Is index drawing faster than non-index drawing I need to draw a lot of polygons consisting of 6 vertices's (two triangles).

Without any texture coordinates, normals etc., both approaches result in 72 bytes. In the future I would definitely also need texture coordinates and normals, which would make index drawing consume less memory. Not a lot though.

So my question is: For VAOs with few vertex overlaps, which approach is faster? I don't care about the extra memory consumed by non-index drawing, only speed.

Edit: To make it clear.

Non-index approach:

float[18] vertices = {
//Triangle 1
1,1,0,
1,0,0,
0,0,0,

//Triangle 2
1,0,0,
0,1,0,
0,0,0,
};

Index approach:

float[12] vertices = {
1,1,0,
1,0,0,
0,0,0,
0,1,0,
};

int[6] indices = {
//Triangle 1
0,1,2,

//Triangle 2
0,3,2
};

sentences:
How 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:
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:
Scaling along an arbitrary axis (Dealing with non-uniform scale) I'm trying to build my own little engine to get more familiar with the concepts of 3D programming.

I have a transform class that on each frame it creates a Scaling Matrix (S), a Rotation Matrix from a Quaternion (R) and concatenates them together (S*R). Once i have SR, I insert the translation values into the bottom of the three columns. So i end up with a transformation matrix that looks like:

[SR SR SR 0]
[SR SR SR 0]
[SR SR SR 0]
[tx ty tz 1]

This works perfectly in all cases except when rotating an object that has a non-uniform scale.

For example a unit cube with ScaleX = 4, ScaleY = 2, ScaleZ = 1 will give me a rectangular box that is 4 times as wide as the depth and twice as high as the depth.

If i then translate this around, the box stays the same and looks normal.

The problem happens whenever I try to rotate this scaled box. The shape itself becomes distorted and it appears as though the Scale factors are affecting the object on the World X,Y,Z axis rather than the local X,Y,Z axis of the object.

I've done some pretty extensive research through a variety of textbooks (Eberly, Moller/Hoffman, Phar etc) and there isn't a ton there to go off of. Online, most of the answers say to avoid non-uniform scaling which I understand the desire to avoid it, but I'd still like to figure out how to support it.

The only thing I can think off is that when constructing a Scale Matrix:

[sx 0  0  0]
[0  sy 0  0]
[0  0  sz 0]
[0  0  0  1]

This is scaling along the World Axis instead of the object's local Direction, Up and Right vectors or it's local Z, Y, X axis.

Does anyone have any tips or ideas on how to handle construction a transformation matrix that allows for non-uniform scaling and rotation?

Thanks!

sentences: Feasibility of nested voxels Out of curiosity, does anyone know how feasible it would be to have a voxel engine that allowed for voxels within other voxels? For example, you would have the usual chunks filled with voxels, but instead of stopping there each voxel could become a chunk of it's own to store more, smaller voxels. The first use case that comes to mind would be for showing damage to voxels, but there could be others, such as smoother terrain. Thoughts?

sentences: 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:
OpenGL Shadowmaps Limit I would like to render an OpenGL scene with an arbitrary number of point lights (at least 1024) with shadows enabled.

My current method of rendering shadowmaps, however, cannot do this.

Let me explain

There are only 32 textures you can pass to a fragment at a time.

I am using 31 of those 32 textures for shadowmaps at the moment.

pseudocode for my main code...

setShader("DepthBufferPointLight", -1); //the int is actually numlights, used for deciding whether or not to recompile a finalpass shader. Irrelevant in this stage and set to -1 for debugging purposes.
FBO fBO* = CreateFBOs[6 * numLights]
for (int j = 0; j < 6; j++)
for (int i = 0; i < 6; i++)
{
 setRenderTarget(fBO[i]);
 setupCameraforLight(j,i); //Move the camera to the right position
 renderSceneDepth(); //Textures aren't even rendered for this
}
setRenderTargetDefault();
setShader("FinalPass", numLights); //The shader dynamically recompiles for final pass calls if the number of lights has changed, because it will need to change how many uniform struct lights there are.
setLightTextureUnits(fBO, 6, numLights); //glActiveTexture calls and glBindTexture calls
renderSceneFinalPass(); //Textures and uniforms are all set up for this, also does the lights

and then in the shader pipeline I do my calculations using the shadowmaps.
My pseudocode is rough but you get the picture.

(SIDE NOTE: the dynamic recompiling is actually really simple and only changes one line of the shader, and I'm going to deprecate and remove the function once I figure out how uniform variable arrays work...)

my code breaks after numlights*6 is greater than 31.

Is there a better way to do this?

my ultimate goal is to render an arbitrarily high number of point lights using shadow mapping

sentences:
Tween animation with Universal Tween Engine LIbGDX Let me preface by saying that I'm new to libgdx...

I have an animation that I'm currently drawing to the screen using:

game.batch.draw(flyAnimation2.getKeyFrame(elapsedTime, true), 200,200,0, 0, 124, 90, 1.0f, 1.0f, 90);

Where flyAnimation2 is:
   Animation flyAnimation2;

This works correctly.  I now want to use UniversalTweenEngine to tween it from one side of the screen to the other.

I can't find any decent documentation on how to achieve this affect using an Animation.  Any help would be appreciated!!

sentences:
How exactly does XNA's SpriteBatch work? To be more precise, if I needed to recreate this functionality from scratch in another API (e.g. in OpenGL) what would it need to be capable of doing?

I do have a general idea of some of the steps, such as how it prepares an orthographic projection matrix and creates a quad for each draw call.

I'm not too familiar, however, with the batching process itself. Are all quads stored in the same vertex buffer? Does it need an index buffer? How are different textures handled?

If possible I'd be grateful if you could guide me through the process from when SpriteBatch.Begin() is called until SpriteBatch.End(), at least when using the default Deferred mode.

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:
How to create reproducible probability in map generation? So for my game, I'm using perlin noise to generate regions of my map (water/land, forest/grass) but I'd also like to create some probability based generation too. For instance:

if(nextInt(10) > 2 && tile.adjacentTo(Type.WATER))
    tile.setType(Type.SAND);

This works fine, and is even reproduceable (based on a common seed) if the nextInt() calls are always in the same order. The issue is that in my game, the world is generated on demand, based on the player's location. This means, that if I explore the map differently, and the chunks of the map are generated in a different order, the randomness is no longer consistent.

How can I get this sort of randomness to be consistent, independent of call order?

Thanks in advance :)

sentences:
Touchscreen panning in OpenGL ES 2.0 I'm trying to allow the user to pan a 2D scene by using the touch screen.  I have tried several methods including translating the projection matrix, translating the view matrix and haven't found anything that will work.  With these methods, the screen either pans extremely fast, or doesn't pan the amount that the user has moved with their finger.
The closest I've got is the following:

public void onDrawFrame(GL10 glUnused) {
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);

    // Projection matrix setup
    Matrix.frustumM(projectionMatrix, 0, -mSurfaceRatio * zoomFactor, // Left
        mSurfaceRatio * zoomFactor, // Right
        -1 * zoomFactor, // Bottom
        zoomFactor, // Top
        3, // Near
        7); // Far

    // panning
    Matrix.translateM(projectionMatrix, 0, mPositionX, mPositionY, 0);

    for (IDrawable drawable : mDrawables) {
        drawable.Draw(maPositionHandle, maTextureHandle, mvpMatrixHandle, mvpMatrix, viewMatrix, projectionMatrix);
    }
}

Gesture Detector:

@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX,
    float distanceY) {

    boolean panned = false;

    float currentZoomFactor = renderer.getZoomFactor();

    if (distanceX != 0) {
        renderer.mPositionX += -1f * (distanceX * (3.1f /renderer.mSurfaceWidth) * currentZoomFactor * renderer.mSurfaceRatio);
        panned = true;
    }

    if (distanceY != 0) {
        renderer.mPositionY += (distanceY * (3.8f /renderer.mSurfaceHeight) * currentZoomFactor * renderer.mSurfaceRatio);
        panned = true;
    }

    if (panned)
    {
        surfaceView.requestRender();
    }

    return panned;
}

Code for calculating the surface:

public void onSurfaceChanged(GL10 glUnused, int width, int height)
{
    GLES20.glViewport(0, 0, width, height);
    mSurfaceRatio = (float)width / height;
    mSurfaceWidth = (float)width;
    mSurfaceHeight = (float)height;
}

This code will pan somewhat correctly, but I just guessed at the 3.1f and 3.8f to make it look right.  By somewhat I mean that when the device (Xoom tablet) is held long-wise the area pans correctly in the x direction, but in the y direction, the scene will lag behind where the user's finger is moving.

Could someone help me with this?  Thanks!

sentences:
Drawing Sprites at Correct Z-Index without A Sprite Map? My game is in HTML5 canvas, but I assume this concept applies to any language.

In the past I've used a multi-dimensional array to keep track of sprite positions.  Here is a simplified example:

[
[ [],[[plant12]],[],[],[] ],
[ [],[[apple]],[],[],[] ],
[ [],[],[],[],[] ],
[ [[apple]],[],[[apple]],[],[] ],
[ [],[],[],[],[] ],
]

And this would always draw sprites with the correct z-index, as the map was always read left-to-right, top-to-bottom:

But with a more experienced game developer's advice, I started using quad trees for collision.

Since I will have a tree of objects with x/y coordinates, I thought I might as well abandon using a sprite map, and just draw the sprites based upon the quad tree data.

But the problem is that if the objects are not collected in a precise order, the sprites will be drawn in incorrect order, resulting in such:

If I am not using a sprite map, what is the best way for me to ensure I am drawing sprites in the correct order/z-index?

I am thinking that maybe I will make a collection method for the quad tree that will collect objects from a left->right, top->bottom order, and then draw each object's corresponding sprite in a loop.  But honestly, that sounds a lot less inefficient that a having a predefined map, especially considering that all that traversing is a lot of recursive calls.

Another approach is to create some sort of z-index system, but I think that may be over-complicating things as well.

Any advice on how to approach this?

sentences:
Tile based isometric depth sorting on different size objects. I am creating a tile based isometric game.

The problem we are having is with depth sorting, we tried a lot of methods but none work.

They all do a great job but its not perfect, they seem to bug sometimes.

We have tiled objects of different sizes, like 2x2, 2x6, 3x4. This makes it so hard.

We are trying to avoid slicing the bitmaps.

Anyone has a idea?

sentences:
Is Quake 3's shader language copyrighted? Right now I am using Quake 3 tools to make maps for my graphics engine, to have some kind of start and an idea on how to build one from scratch. I know that the BSP format is copyrighted and maps made with GTKRadiant cannot be used in commercial games.

But suppose that I would like to create/use a shading language with syntax that is similar or even identical to Quake 3's shading language's syntax, would I risk copyright issues?

sentences:
How to design parameters for events I'm working on the event system for my engine, and have some trouble deciding what types of parameters my events should have to be both generic and specific at the same time. I want to be able to notify entities in the world about anything that is happening using something similar to the observer pattern, but merely the notification message itself is not enough, some messages need to carry additional information such as location, radius, damage, and so on. How do I encapsulate all these different kinds of parameters in one event type without making it very bloated like it would be if every event held a field for every type of parameter?

Some examples to show what I would like to achieve and what I have considered so far:

struct Event {
    TYPE     type;
    int      x, y, z;
    unsigned radius;
    float    damage;
    unsigned cost;
    float    healing;
    ...
void Observer::notify(Event event) {
    if (event.type == explosion)
        handle_explotion(event.x, event.y, event.z, event.damage);
    else if (event.type == healing)
        add_hitpoints(event.healing);
    ...

That would make the Event type very bloated, and the handling gets tedious quickly. I considered having fewer parameters, but they would remain unspecified:

struct Event {
    int arg1, arg2, arg3, arg4;
    const char * str1, str2, str3;
    bool b1, b2, b3;
    ...

This would cut down on the amount of parameters because all types are condensed into the same few fields. However from a user point of view this approach is much worse because now I have to remember what each parameter was supposed to represent every time; was arg3 the radius or the damage in an explosion? To fix this maybe the parameters could live in a std::map, but that still makes handling obnoxious:

struct Event {
    std::map<const std::string, int> int_data;
    std::map<const std::string, float> float_data;
    ...
void Observer::notify(Event event) {
    if (event.type == collision)
        resolve_collision(event.int_data["x"], event.int_data["y"],
                          event.int_data["z"], event.int_data["width"],
                          event.int_data["height"]
    ...

I considered making the event hold some kind of general data field that can be cast to the appropriate type:

struct Event {
    void * data;
    TYPE type
};
void Observer::notify(Event event) {
    if (event.type == weapon_augment)
        modify_weapon((Weapon *)(event.data));

This makes instantiating and deleting the event somewhat more tedious, but at least it allows me to use specific types for every event handler.

What is the conventional approach to solving this problem? Even better, what is your own ingenious solution? Thanks.

sentences:
Use GKEntity's component(ofType:) with inheritance I'm writing a SpriteKit game in swift and making use of GameplayKit's entity-component system. There are many components that do different stuff but share the same methods in which they do it, so I thought I'd group them into categories. At first I thought about using protocols, but component(ofType:) only accepts classes. So then I thought about making a base class for each category, define methods and variables there and have the actual components classes override them to implement their own functionality (you know like basic OOP). So I had something like:

class InputComponent: GKComponent {
    func handleInput() {
        //Whatever
    }
}

class ControllerComponent: InputComponent {
    override func handleInput() {
        //Do something
    }
}

class KeyboardComponent: InputComponent {
    override func handleInput() {
        //Do something different
    }
}

Then somewhere in my code I'd call

entity.component(ofType: InputComponent)

and I thought I'd get both ControllerComponent and KeyboardComponent type objects. But I am getting none, it seems component(ofType:) doesn't return instances of subclasses.

I guess I can make an extension to GKEntity and define something like

component<P>(conformingTo protocol: P.Type)

and implement that behavior myself but I want to know if I can use the built in function to achieve the same.

sentences:
EXTREMELY Confused Over "Constant Game Speed Maximum FPS" Game Loop I recently read this article on Game Loops: http://www.koonsolo.com/news/dewitters-gameloop/

And the recommended last implementation is confusing me deeply. I don't understand how it works, and it looks like a complete mess.

I understand the principle: Update the game at a constant speed, with whatever is left render the game as many times as possible.

I take it you cannot use a:

Get input for 25 ticks
Render game for 975 ticks

Approach since you would be getting input for the first portion of the second and this would feel weird? Or is that what is going on in the article?

Essentially:

while( GetTickCount() > next_game_tick && loops < MAX_FRAMESKIP)

How is that even valid?

Let's assume his values.

MAX_FRAMESKIP = 5

Let's assume next_game_tick, which was assigned moments after initialization, before the main game loop is say... 500.

Finally, as I am using SDL and OpenGL for my game, with OpenGL being used for rendering only, let's assume that GetTickCount() returns the time since SDL_Init was called, which it does.

SDL_GetTicks -- Get the number of milliseconds since the SDL library initialization.

Source: http://www.libsdl.org/docs/html/sdlgetticks.html

The author also assumes this:

DWORD next_game_tick = GetTickCount();
// GetTickCount() returns the current number of milliseconds
// that have elapsed since the system was started

If we expand the while statement we get:

while( ( 750 > 500 ) && ( 0 < 5 ) )

750 because time has passed since next_game_tick was assigned. loops is zero as you can see in the article.

So we have entered the while loop, let's do some logic and accept some input.

Yadayadayada.

At the end of the while loop, which I remind you is inside our main game loop is:

next_game_tick += SKIP_TICKS;
loops++;

Let's update what the next iteration of the while code looks like

while( ( 1000 > 540 ) && ( 1 < 5 ) )

1000 because time has elapsed getting input and doing stuff before we reached the next ineteration of the loop, where GetTickCount() is recalled.

540 because, in the code 1000 / 25 = 40, therefore, 500 + 40 = 540

1 because our loop has iterated once

5, you know why.

So, since this While loop is CLEARLY depedent on MAX_FRAMESKIP and not the intended TICKS_PER_SECOND = 25; how is the game supposed to even run correctly?

It was no surprise to me that when I implemented this into my code, correctly I might add as I simply renamed my functions to handle user input and draw the game to what the author of the article has in his example code, the game did nothing.

I placed an fprintf( stderr, "Test\n" ); inside the while loop which doesn't get printed until the game ends.

How is this game loop running 25 times a second, guaranteed, while rendering as fast as it can?

To me, unless I am missing something HUGE, it looks like... nothing.

And isn't this structure, of this while loop, supposedly running 25 times a second and then updating the game exactly what I mentioned beforehand at the start of the article?

If that is the case why couldn't we do something simple like:

while( loops < 25 )
{
    getInput();
    performLogic();

    loops++;
}

drawGame();

And count for interpolation some other way.

Forgive my extremely long question, but this article has done more harm than good to me. I am severely confused now - and have no idea how to implement a proper game loop because of all these arisen questions.

sentences:
Why does 'InvalidCastException: Specified cast is not valid.' occur for ARKitFaceSubsystem? Why does 'InvalidCastException: Specified cast is not valid.' occur for ARKitFaceSubsystem in the snippet below?
    var faceManager = FindObjectOfType<ARFaceManager>();
    if (faceManager != null)
    {
        m_ARKitFaceSubsystem = (ARKitFaceSubsystem)faceManager.subsystem;
    }

sentences:
Avoiding lag when rendering Texture2D for first time I have found a similar question here, but it is about playing sounds.

I am using 2048 x 2048 textures for sprite sheets and every time I call spriteBatch.Draw using a sheet for the first time in game execution, causes a considerable lag. The lag doesn't appears for the next times.

Someone has faced this problem before? What can I do to overcome this?

Update:

I inserted a code in the end of content load routine that draws EVERY Texture2D that is loaded into ContentManager before follow to the game screen. This works well. None lag occurs when different textures are rendered over the time, EXCEPT if the IsFullScreen are changed. Apparently, changing this property makes the textures loaded in the GPU gone. Is that correct?

sentences:
OpenGL calculate UV sphere vertices I am trying to implement a class Sphere in C++.

Therefore I want to calculate the vertices in the constructor of the class (or in a seperate function..).
Although I read tons of articles about creating spheres in different ways (UV Sphere, Quad Sphere, Icosphere etc.) I did not understand how to create the vertices for my buffer object.

I decided to use the UV Sphere since it is easy to map a texture on it.

A "UV sphere" in this sense is one where the (quad) edges run like lines of latitude and longitude, and the texture is mapped to the sphere like an equirectangular projection.

(Equirectangular Earth texture by Strebe via Wikimedia Commons, CC BY-SA 3.0)

But how can I calculate all the vertex positions and texture coordinates?

For my vertices I use a Vertex struct:

struct Vertex
{
    glm::vec3 position;
    glm::vec2 texture;
};

sentences:
Tree batching problem in Unity I have some problems with batching trees.
I'm using the default unity terrain system and trees.
My problem is that trees won't get batched together (I've set up static, dynamic, and GPU instancing) and as I've inspected the frame debugger I've come to these results:
I used trees with the optimized bark material and optimized leaf material
What causes distinct draw call:
1- Wind
2- color and size variations for trees
draw call reason:
non instanced properties set for instanced shader
if I remove Wind or variations the GPU instancing would work (I don't want to remove wind and variations), Is there any way to batch trees in this case?

sentences:
Making an enemy follow player (Unity) I'm working on coding enemy ai for a star fox-esqe shooter and I need the enemy to approach the player, stay a certain distance away and stay in front of them until destroyed. I can get the enemy to approach the player and I can get the enemy to stay a certain distance from the player but I'm not sure how to get the enemy to actually stay in front of the player. For a bit of extra information, the player makes a number of sharp turns and the like throughout the level. Also, as a stand in I tried simply causing the enemy to parent to the player within a certain radius but that causes clipping issues with buildings and the ground.

public class EnemyCar: MonoBehaviour
{
    public float safeDistance = 20f; // How close the enemy can get to the player

    // ...

    // Update is called once per frame
    void Update()
    {
        transform.LookAt(player.transform);

        Vector3 targertLocation = player.transform.position - transform.position;
        float distance = targertLocation.magnitude;

        // Decrease our speed as we get closer
        rb.AddRelativeForce(Vector3.forward * Mathf.Clamp((distance - 30) / 50, 0f, 1f) * thrust);
    }
}

sentences:
What Game Development books should my partner/myself read? My partner and I are starting to get into game development on the iPhone. I'm a programmer and he's not. We are looking for some good language agnostic game programming books. Hopefully things that will explain basic game development principles without focusing too much on the particulars of a language and more on the concepts needed to build and design games.

We will probably focus on 2D games (at the beginning anyways) so no need for books on in depth 3D math, complex AI, etc.

Any suggestions?

sentences:
Libgdx - gesture dection I have made a card game, and have two methods that sort the players hand.

sortHandBySuit();
sortHandByValue();

I would like one method to be called when the user slides their finger from left to right across the screen, and the other from right to left.

public class InputHandler implements InputProcessor{
  .............
  public boolean touchDragged(int screenX, int screenY, int pointer) {
    world.getHand().sortHandBySuit();
    return false;
  }
  .............
}

How can I use touchDragged to call my methods?

sentences:
Getcomponent() vs this I am referencing singleton script's object from another script and I wonder what is difference between this two, or if even work the second one properly?

GameManager.Instance.selectedBuildSite = GetComponent<BuildSite>();

VS

GameManager.Instance.selectedBuildSite = this;

The code is written inside BuildSite class which inherits monobehaviour

sentences:
PlaySound() Lags opengl c++ I am new to OpenGL. I am making a game similar to this, shown in image below. The problem is when I detect collision, i.e cannon ball and ship collide, I play a sound using

PlaySound(TEXT("explode.wav"), NULL, SND_FILENAME);

After the sound is played, my background animation and the whole scene is stuck for a second and then it resumes. Any fix? Please help. It is my project.

sentences:
Animation with pivot-modification in Mecanim Assume I have two animation cycles:

Walking
Crouching

Both assume that the model's pivot is on the same level as the model's feet.

Now I also have two animated transitions:

Get on all fours while walking
Climb onto a (table)

The first is not too complex. The model walks upright, then gets down on all fours (animation 1) and crouches. Pivot remains on the same level, all fine.

What I want:

However, I can't get my head around the second transition. I want the model to

walk up to the table (pivot on ground level)
climb onto the table (animation 2) (pivot..?)
crouch on the table (pivot on table level, 1 m above ground)

What I have:

The climbing animation (2) assumes pivot to remain on ground level and simply animates the model's climbing up. I built a StateMachineBehaviour which raises the model to the table level as soon as the climbing animation is complete. From then on the pivot is on table level and the crouching can continue.

This seems to work fine in a standalone application, however, in multiplayer, where the models' transform and animator state are not necessarily synchronized in the same frame, this prooves problematic. One can clearly see the model jump when the change in the model's position arrives one frame earlier than the switch from climbing to crouching animation.

What I tried:

I thought it might be a better idea to have the pivot move gradually from ground level to table level over the duration of the climbing animation (2), instead of having one instant jump at the end. This way network synchronization would be much more robust because of the relatively small change per frame. Also this approach would much closer resemble the actual thing that's happening in the real world, which is generally a good thing. I tried offsetting the root transformation of the animation clip, and accomodate the modification by adding the negative offset to the root bones. This however did not work, as there seems to be no animatable translations in Mecanim animation clips. So im stuck at this approach.

Question:

Is there a better way? A simpler way? How are you guys tackling this?

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:
Generate next chunk with perlin noise I'm actually trying to generate a level with procedural generation using perlin noise.
So one chunk has a size of 30x30, it's a float 2d array and at first I'm filling it with values between 0 and 1. Next step is to calculate 7 octaves and merge them. In the end I normalize the values.
All this works quiet well if I only want to create one chunk but how can I create one more chunk beside my first so that they fit together smoothly?

sentences:
UE4: Apply texture on landscape based on angle I am creating a material for my landscape. I know that one could for example use the landscapes heightmap as a mask to apply textures at certain heights, but I want to apply textures at certain angles. For example, applying a cliff texture if the angle at that point in the landscape is larger than 45 degrees.

Thanks in advance!

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:
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:
How does one escape the GPL? DISCLAIMER I don't pretend to know anything about licensing. In fact, everything I say below may be completely false!

Backstory:

  Recently, I've been looking for a decent game engine, and I think I've
  found one that I really like, Cafu Engine.

  However, they have a dual licensing plan, where everything you make
  with the engine is forced under GPL, unless you pay for a commercial
  license. I'm not saying that it's a bad engine, they even say that
  they are very relaxed about the licensing fees. However, the fact that
  it even involves the GPL scares me.

So my question is basicly, how does one escape the GPL.

Here's an example: The id Tech engine, also known as the Quake engine, or the Doom engine, was the base for the popular Source engine. However, the id Tech engine has been released under the GPL, and the Source engine is proprietary. Did Valve get a different license? Or did they do something to escape the GPL? Is there a way to escape the GPL? Or, if you use GPL'd source code as a base for another project, are you forced to use the GPL, and make your source code available to the world. Could some random person take the id Tech engine, modify it past the point of recognition, then use it as a proprietary engine for commercial products? Or are they required to make it open source.

One last thing, I generally have no problem what-so-ever with open source. However I feel that open source has it's place, but that is not in the bushiness world.

sentences:
Displaying a grid based map using C++ and sdl I am trying to create a roguelike game using c++ and SDL. However, I am having trouble getting it to display the map, which is represented by a 2d array of a tile class.

Currently, my code is this:

for (int y = 0; y!=MAPHEIGHT; y++)
{
    for (int x = 0; x!=MAPWIDTH 1; x++)
    {
        apply_surface( x * TILEWIDTH, y * TILEHEIGHT, mymap[x][y].image, screen );
    }
}

However, running this code causes it to both dither for a while before opening the SDL window, and (usually) tell me there is an access violation.
How can I display my map?

sentences:
Where do you search/look for game developers for an indie game startup? I just recently saw stackoverflow had a game dev sister site so here I am, wondering if you experienced fellows know where one can search/look for game developers for an indie game startup? In other words:

I have a game idea which I've written down with as much detail as possible (so anyone else can understand how it works) and now I'm looking for a heavy php programmer with whom to pair up in order to go from idea to reality. I'm a front-end/interface designer and an intermediate programmer. I recognize my project requires heavy programming skills which I do not have as of today =)

So, what websites, communities or places do you recommend I go look into? Where do good programmers interested in indie games go look for projects if they don't have their own?

Thanks in advance
G.Campos

sentences:
How would I display a unit that is hidden behind another object Right, I've tried searching for this but as you might be able to tell from the title, I didn't really know how to word it anyway...

In some games such as rts games, when a unit is hidden or half hidden behind another object, such as a tree of building, the player will be able to see a translucent coloured version of that unit where it is hidden.

I was wondering how it would be possible to figure out which parts of the units sprite have actually been covered, and how to then use this information to then draw the translucent coloured version of the sprite.

If possible could the answers given relate to c++ and sfml? If not other answers will still be appreciated.

Sorry if my language is unclear its the first time I've asked a question on this site.

sentences:
Should "games played this week" be computed from a fixed or running time span? I'd like to create a leaderboard that shows how many games each player has played. This works fine for the "all time" section in Game Center, since I can just submit the total number. But what I really want to display is the number of games each player has played in a week, not for all time.

As I understand it, I would have to calculate the weekly numbers myself (if I submitted the all-time totals, the weekly tab in Game Center would still just show the total all time numbers from that week, not the weekly totals).

What would be the best way to do this? Count a user's tasks beginning on Monday, and reset them on Sunday? Or have everyone on their own unique 7 day timer?

sentences:
2-player online card game architecture This is the first game I have developed. Please correct me if I'm mistaken.

I want to build an online 2-player turn based card game (Shithead). I want to code it in Java as that is what I have most experience in.

Networking

From my research, I've gathered that for turn based card games a TCP connection is best (reliability over the need for constant packets). I plan to have a single Java game server that will be able to host multiple concurrent games using sockets to pair clients together in an events-based manor. I've read that it makes most sense to have the game state on the server in order to protect against cheating etc.

Client1 (C1) sends move to server.
Server validates move. If valid - Server sends updated game state (with certain information hidden such as opponents hand) to clients & tells C1 to wait for C2 and for C2 to make a move.
C2 sends move to server. Repeat.

Does my plan sound sensible? I don't want to start going down this route if I've miss-understood something.

A problem I am having is knowing which java frameworks (if any? SpringBoot?) to use to achieve this. Could anyone recommend any to me?

Client

I was planning on making the client browser-based but after some thought I think I would prefer to make a desktop client. I plan to make a Java client that uses the JavaFX GUI library that the user interacts with by clicking on cards to perform certain actions - would I be able to embed this in a webpage if I changed my mind? Would it take a lot of work?

At this point I don't want to put too much time into making a fancy GUI (by using a more sophisticated game engine) as I'd rather focus on making a mini-max AI player (and given I have time, a neural network AI to learn from playing tons of games against the mini-max AI).

sentences:
How can I rotate object on key press? The script:

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

public class ChangeScale : MonoBehaviour
{
    //Scaling change
    public GameObject objectToScale;
    public float duration = 1f;
    public Vector3 minSize;
    public Vector3 maxSize;

    private bool scaleUp = false;
    private Coroutine scaleCoroutine;

    //Colors change
    public Color startColor;
    public Color endColor;
    public float colorDuration; // duration in seconds

    //Lights change
    public DimLights dimlights;
    private Coroutine lightCoroutine;

    //Rotate
    public float rotationSpeed;
    public float rotationDuration;

    private void Start()
    {
        //startColor = GetComponent<Renderer>().material.color;
        endColor = Color.green;
        objectToScale.transform.localScale = minSize;
    }

    // Use this for initialization
    void Update()
    {
        //Scaling
        if (Input.GetKeyDown(KeyCode.F))
        {
            //Flip the scale direction when F key is pressed
            scaleUp = !scaleUp;

            //Stop old coroutine
            if (scaleCoroutine != null)
                StopCoroutine(scaleCoroutine);

            if (lightCoroutine != null)
                StopCoroutine(lightCoroutine);

            //Scale  up
            if (scaleUp)
            {
                //Start new coroutine and scale up within 5 seconds and return the coroutine reference
                scaleCoroutine = StartCoroutine(scaleOverTime(objectToScale, maxSize, duration));
                lightCoroutine = StartCoroutine(dimlights.dimLightOverTime(1, duration)); ;
            }

            //Scale Down
            else
            {
                //Start new coroutine and scale up within 5 seconds and return the coroutine reference
                scaleCoroutine = StartCoroutine(scaleOverTime(objectToScale, minSize, duration));
                lightCoroutine = StartCoroutine(dimlights.dimLightOverTime(0, duration)); ;
            }
        }

        //Change color
        if (Input.GetKeyDown(KeyCode.C))
        {
            StartCoroutine(ChangeColor());
        }

        //Rotate
        if (Input.GetKeyDown(KeyCode.R))
        {
            objectToScale.transform.Rotate(Vector3.up * rotationSpeed * Time.deltaTime);
            //StartCoroutine(RotateObject());
        }
    }

    IEnumerator scaleOverTime(GameObject targetObj, Vector3 toScale, float duration)
    {
        float counter = 0;

        //Get the current scale of the object to be scaled
        Vector3 startScaleSize = targetObj.transform.localScale;

        while (counter < duration)
        {
            counter += Time.deltaTime;
            targetObj.transform.localScale = Vector3.Lerp(startScaleSize, toScale, counter / duration);
            yield return null;
        }
    }

    IEnumerator ChangeColor()
    {
        float t = 0;

        while (t < colorDuration)
        {
            t += Time.deltaTime;
            GetComponent<Renderer>().material.color = Color.Lerp(startColor, endColor, t / colorDuration);
            yield return null;
        }
    }

    IEnumerator RotateObject()
    {
        float startTime = Time.time;

        while (Time.time - startTime < rotationDuration)
        {
            objectToScale.transform.Rotate(Vector3.up * rotationSpeed * Time.deltaTime);
            yield return null;
        }
    }
}

I tried using StartCoroutine but it didn't work.
So for testing I tried to make that if I'm click/pressing on R once it will rotate the object nonstop but it's not working either it's not rotating it all.

Nothing i click on R and nothing happen.
Tried to change the rotationSpeed from 1 to 10.

sentences:
Sprite always starts flipped Everytime I start the game, or I swap animator controllers in the inspector (in runtime), the character is flipped in X axis until I start moving him.

How do I prevent this to happen? This happens to me everytime I start a new project and I grow tired of this.

Update

8 animations which are all idle ones of just 1 frame

Down
DownRight
Right
UpRight
Up

The last 3 have the Sprite Renderer's flipX enabled within their animations:

UpLeft
Left
DownLeft

In the middle of the transitions, sprite remains flipped until it reaches 1 or -1.

I recorded recently a video to display the issue.

  https://www.youtube.com/watch?v=dC09snKvHAM

Same as above but in 1080p and showing entire Unity window.

  https://www.youtube.com/watch?v=Ww3GkUvb7bc

2nd update

PlayerControls.cs:

using UnityEngine;
using System.Collections;

public class PlayerControls : MonoBehaviour {

    Rigidbody2D rb;
    PlayerStats pStats;
    Animator anim;

    void Awake () {
        rb = GetComponent<Rigidbody2D>();
        pStats = GetComponent<PlayerStats>();
        anim = GetComponent<Animator>();
    }

    void Update () {
        if (Input.GetAxisRaw("Vertical") > 0)
        {
            rb.velocity = new Vector3(rb.velocity.x, pStats.pMoveSpeed, 0);
        }
        if (Input.GetAxisRaw("Vertical") < 0)
        {
            rb.velocity = new Vector3(rb.velocity.x, -pStats.pMoveSpeed, 0);
        }
        if (Input.GetAxisRaw("Horizontal") < 0)
        {
            rb.velocity = new Vector3(-pStats.pMoveSpeed, rb.velocity.y, 0);
        }
        if (Input.GetAxisRaw("Horizontal") > 0)
        {
            rb.velocity = new Vector3(pStats.pMoveSpeed, rb.velocity.y, 0);
        }
        if (Input.GetButton("Vertical") || Input.GetButton("Horizontal"))
        {
            anim.SetFloat("OrientationY", Input.GetAxisRaw("Vertical"));
            anim.SetFloat("OrientationX", Input.GetAxisRaw("Horizontal"));
        }
    }
}

PlayerStats.cs

using UnityEngine;
using System.Collections;

public class PlayerStats : MonoBehaviour
{

    public string pName;
    public string pClass;
    public int pLevel;
    public float pExperience;
    public float pBasicDamage;
    public float pMoveSpeed;

    public string[] pClassList;

    Animator anim;
    public RuntimeAnimatorController[] animCtrl;

    void Awake()
    {
        anim = GetComponent<Animator>();
    }

    void Update()
    {
        pLevel = 1 + (int)pExperience / 240;

        if (!CheckAssignedClass())
        {
            pClass = "Warrior";
            Debug.LogWarning("Player class not found. Using 'Warrior' as default.");
        }

        if (Input.GetKeyDown(KeyCode.J))
        {
            SetClass(pClass);
        }

    }

    bool CheckAssignedClass()
    {
        bool found = false;
        var i = 0;
        for (i = 0; i < pClassList.Length; i++)
        {
            if (pClassList[i] == pClass)
            {
                found = true;
                break;
            }
            else { found = false; }
        }
        return found;
    }

    void SetClass(string className)
    {
        switch (className) {
            case "Warrior": {
                    anim.runtimeAnimatorController = animCtrl[0];
                    break;
                }
            case "Archer": anim.runtimeAnimatorController = animCtrl[1]; break;
            case "Mage": anim.runtimeAnimatorController = animCtrl[2]; break;
            default: anim.runtimeAnimatorController = animCtrl[0]; break;
        }
    }
}

sentences:
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:
Applying different materials to an object I'm currently implementing an Object Loader for the Wavefront File Format (*.obj). When exporting a model (with associated materials) from blender, a material for a group of faces is specified like this:

usemtl MyMaterial
s off
f 2/1/1 4/2/1 3/3/1
f 1/4/1 2/1/1 3/3/1

Since each material consists of (at least) 3 components for each of ambient, diffuse specular color and also shininess (which totals up to 10 floats) I would consider it to be a tremendous waste of memory to store all of these values for each vertex.

Does OpenGL provide us with a more elegant/viable way to achieve the same result with a more reasonable memory consumption or do I have to swallow the bitter pill?

sentences:
Unity3d Rigidbody movement along slope slowdown I have a Rigidbody character controller (Unity, C#) which I'm trying to make work seamlessly when walking on sloped ground. I've got it working fine walking up and down a slope by changing the forward direction to always be parallel to the ground (using the surface normal). But a strange thing is happening when walking sideways on that same slope (and not up and down it)...the character slows to a crawl. Anyone have any idea why this might happen, or how to solve it?
private void Walk()
{
    isMoving = false;

    if (!inChatwithNpc && !ledgeChecker.isGrabbingLedge)
    {

        isMoving = true;

        playerRigidbody.AddForce(moveDirection * moveSpeed /** multiplier*/ * Time.deltaTime);

        if (playerOnGround)
        {
            playerRigidbody.velocity = Vector3.Lerp(playerRigidbody.velocity, moveDirection * playerRigidbody.velocity.magnitude, Time.deltaTime / 0.5f);

            if (!isRunning)
            {
                playerRigidbody.velocity = Vector3.ClampMagnitude(moveDirection * playerRigidbody.velocity.magnitude, 12f);
            }

            if (isRunning)
            {
                playerRigidbody.velocity = Vector3.ClampMagnitude(moveDirection * playerRigidbody.velocity.magnitude, 18f);
            }
        }

    }

    if(!isMoving && playerOnGround)
    {
        playerRigidbody.velocity = Vector3.Lerp(playerRigidbody.velocity, Vector3.zero, 0.2f);
    }
}
private void CalculateForward()
{
    if (!playerOnGround)
    {
        forward = transform.forward;
        return;
    }

    forward = Vector3.Cross(transform.right, touch.normal);

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:
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:
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: How does someone go about selling a game or making a royalties deal with Nintendo(or Pokemon Company)? It seems like Niantic did just that. If someone were to create their own game(Pokemon, hypothetically), how would they, if at all possible, sell that game to Nintendo or at least make a royalties deal? Or any other game, for that matter?

sentences:
Generating Unique Identifiers for Procedural Item Generation I have been writing all the necessary code for procedurally generated items within my game. The database mechanism that I have built supports new items at runtime, such as when a player opens a chest. Everything works fine, but I realized a fatal flaw with the way that I generate the "unique" item identifiers. I generate items using a Prefix, such as Fiery, an item type, such as Claymore, and a suffix, such as of Greater Shadow.

I generate the database Identifier using the format of:

Proc_ + Prefix + Type + Suffix + Iteration

As an actual example, the procedural item "Fiery Claymore of Greater Shadow" would then become:

Proc_FCOGS_01

All seems well right? This looks like it could work quite nicely. However, I then realized that I can easily receive identifier clashes. Or as an example: "Freezing Claymore of Greater Striking" would also be created as:

Proc_FCOGS_01

And that's where the problem arises. Because I went through all my affixes, located here and found that a few more of my chosen affixes could also lead to clashing within the database, despite the generated item not actually being the same as the one that is already entered. The routine that I am using to generate these identifiers is as follows:

        public string CreateIdentifier(string prefix, string itemType, string suffix)
        {
            if (!String.IsNullOrEmpty(prefix) && !String.IsNullOrEmpty(itemType) && !String.IsNullOrEmpty(suffix))
            {
                string input = prefix + " " + itemType + " " + suffix;
                string[] segments = input.Split(' ');
                StringBuilder builder = new StringBuilder(segments.Length + 5);
                builder.Append("Proc_");
                for (int i = 0; i < segments.Length; i++)
                {
                    builder.Append(Char.ToUpper(segments[i][0]));
                }
                return builder.ToString();
            }
            return null;
        }

After all of this, I can really only see two options:

Scrap my current Unique Identifier routine and think of another one.
If a collision exists within the Database, simply iterate the generated identifier ending number by 1, check again, and if necessary, iterate the the ending number by 1 again until an unused identifier is found.

As for number 1, that's why I'm here showing you all this. I need ideas about how I can do this in a way that will result in zero clashes unless the item is actually the same thing as previously generated.

And as for number 2, I would really prefer not doing this. I feel as though having fifteen or more database entries of Proc_FGSOTE plus the unique iteration, to be a little silly. Why have fifteen database entries of the same item? Although, I guess that would indeed be putting the iteration value to use...it's just not what I had intended it to be used for and seems like a terrible waste of resources. I really feel as though a better routine is the way to go.

Does anyone know of a better way that I can be generating unique identifiers?

Edit:

Sorry, I fogot to mention that I don't want to use the entire item name as an identifier, even if it's compressed to trim out all the spaces, mainly because the identifiers are still going to be way too long. This seems like an arbitrary limitation, I know, it's just one that I wanted to enforce so that way the Database could be loaded/parsed faster later down the road.

sentences:
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:
Mcreator (Minecraft Mod-making) Compile Error I'm trying to make a tool pack but every time I get the message:
New Dep: net.minecraftforge:forge:1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1
> Task :compileJava FAILED
C:\Users\MCreatorWorkspaces\tree\src\main\java\net\mcreator\tree\item\ObsidianAxeItem.java:43: error: illegal start of expression
                     new ItemStack(, (int)(1))
                                   ^
C:\Users\MCreatorWorkspaces\tree\src\main\java\net\mcreator\tree\item\ObsidianHoeItem.java:43: error: illegal start of expression
                     new ItemStack(, (int)(1))
                                   ^
C:\Users\\MCreatorWorkspaces\tree\src\main\java\net\mcreator\tree\item\ObsidianPickaxeItem.java:43: error: illegal start of expression
                     new ItemStack(, (int)(1))
                                   ^
C:\User\MCreatorWorkspaces\tree\src\main\java\net\mcreator\tree\item\ObsidianShovelItem.java:43: error: illegal start of expression
                     new ItemStack(, (int)(1))
                                   ^
C:\User\MCreatorWorkspaces\tree\src\main\java\net\mcreator\tree\item\ObsidianSwordItem.java:43: error: illegal start of expression
                     new ItemStack(, (int)(1))
                                   ^
5 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.3/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 7s
1 actionable task: 1 executed
BUILD FAILED

sentences:
Custom 3D Renderer: Frustum clipping I have recently been toying with the idea of creating a 3D-renderer from scratch and, after looking into it, doesn't seem like such a behemoth of a task as it sounds. Last night, I was tossing and turning in bed because I had tons of ideas and was originally going to base the whole entire renderer off of an index system using vector-lists it occlude points that I don't need, but tossed that out of the window as I realised I needed to prioritise on the main rendering.
As most 3D-based developers will know, all of the vertices move around the viewport. This is a nightmare for people who want to make 3rd/1st person games because, if you don't know semi-advanced geometry then you're practically screwed. I realise that people will have to know about their soh's and their toa's eventually but I wanted to release the burden of that by having the viewport (matrix) move around the "world".
This is surely better for performance as well, as moving a matrix around must be easier for a gpu/cpu to calculate. I could be totally wrong, but I wanted to give this a go.

In my head, everything sort of works and would produce a "3D" world.
The only thing stopping me jumping into C++ and SFML/SDL at this point is a bug (or technically "unimplemented feature") of my program. The way I was going to have my renderer work is like so:

Find all vertices inside of viewport. (Lets call these V[] )
Get depth information of all V[]
Draw lines between certain V[] (In my case, one V will contain information such as, the next V in memory to connect to. Drawing lines is only for debug purposes or for the kewl 80's look.)
Save as a polygon.
Fill colour/texture within a poly's bounds to show depth or for design.

This should work, I think. But there is one issue and that issue is the reason I'm posting all of this.

Let's say that we have something that is bigger/not completely in a view frustum bounds and the camera is not looking at a vertex, how would we figure out that there is a "shape" there. I'm going to draw a crappy example in MS Paint to explain. (Ain't nobody got time for Photoshop..)

Any help is appreciated and a fully understand if what I wrote doesn't 'click'.
Thanks!

sentences:
How to move player out of multiple penetrating colliders? The player in my game can teleport like Noctis from ffxv.The player shots a weapon projectile and then teleports to the projectile. I'm using raycast to calculate the weapon position after thrown. However, I need to check if the weapon is stuck in an unteleportable position after being thrown. It is possible to have multiple penetrating colliders. Ex: spear gets sandwiched between two walls that is narrow enough for the weapon to pass through but not tall enough for the player to stand. I want to somehow check for a nearby valid position for after teleporting in that situation.

I also want the teleport to fail if the weapon is horizontally in the middle of the "pipe".

I could do a bunch of overlapBox checks within a radius distance from the teleport point but that doesn't seem efficient. I want to give the player some leeway when aiming a teleport.

Also, the teleport is not immediate. The player can wait some time before teleporting to the weapon. So it is possible for a moving platform to block a raycast from the player. In which case I still want the raycast to succeed.

I'm using unity and a custom raycast based 2d character controller for normal movement.

sentences:
How can I hook into OpenGL initialization on Windows? I want hook all OpenGL games/applications. I want load my library only if application actually use OpenGL. Something like Direct3DCreate9 for Direct3D 9 or CreateDXGIFactory for Direct3D 10/11.

I thought this function wglDescribePixelFormat, but some app's/games not use it.

sentences:
2D Tile Engine Architecture I'm been working on a 2D tile game (sidescroller perspective) and I decided to rework my tile engine. Right now I store a new tile instance per block in the world (so there are like 1000 TileStone instances in memory). My plan was to change the current tile engine so that I store only a small object which tells the renderer a stone tile should be drawn there. The TileStone, TileDirt classes only store the block properties like hardness, texture and so on.

With this design I ran into a bit of a problem, some tiles, for example, a chest tile should be able to store custom data like the contents of the chest, or for instance a windmill block which needs to update all of its logic every update tick.

What would be a good way of implementing a tile engine, that meets these requirements?

Programming language: Java, Library: LibGDX

Thanks in advance
-ProRed

sentences:
How should I design an easing class in C++? I'm currently struggling to find a good approach for an easing class for my game.

The class holds some easing effects, like elastic-in-out, and should be called by menu buttons, players and enemies to polish my animations a bit.
(think about a cool bouncing button that fades in)..

This is my very basic easing class so far:

class Easing {

protected:
    double currentTime;
    double startTime;
    double endTime;

public:
    virtual double ease(double t) { return 0.0f; }

};

class Easing_ElasticInOut : Easing {

public:
    virtual double ease(double t) override {
        t--;
        return sqrt(1 - t*t);
    };

};

In my menu I've got a bunch of buttons and I'd like to animate them to ease in when they appear.

void EditorMenu::render() {

    if (is_open()) {
         // Easing_ElasticInOut ???
         // Draw a button with circle_radius depending on the easing
    }
}

This render() method gets called all the time.

How would you design these effects? I'm not sure about how to only call them once and let them finish, especially when there are more buttons or things at once, that need to be animated...

sentences: HUD Text not displaying/drawing I am trying to use blueprints to display my character's speed using a HUD, but for some reason the text is not displaying. What am I doing wrong? I am using the First Person template.

sentences:
How do I create a spherical world to explore? So to preface this question, I have done a lot of research on this, but most of it has proven unhelpful, possibly because I'm not sure the proper way to phrase what it is that I'm trying to ask, so I might make this a little long-winded to get my point across.

The basic idea that I am trying to explore is a small planet that can be navigated by the player, but I also want this planet to be similar, but different for each playthrough (hence the procedural-generation tag). At first, I looked into doing this by simply creating a sphere which has it's own type of gravity (doesn't have to be too realistic), but research proved that this had many (too many) obstacles to overcome. Making the gravity work on this sphere would have been complicated, but doable, but then I read that the terrain tools wouldn't work properly and that could be a problem. The last issue that I saw for this, which makes me think that this idea is dead is how strenuous this might be for the systems, since I want the planet to be fairly full of interesting things to explore.

This led me to the idea of a modular system of tiles (if I'm using that term correctly), where I could procedurally generate these tiles, and align them in a spherical shape. I could instantiate and destroy the tiles as needed to preserve system resources, and would make the procedural generation aspect of this easier for me as well (at least I think it will). The problem I see with this model is how to make square (or any other shaped tiles) form a sphere.

I am attempting to build this in UE4. If this is impossible, or at least prohibitively difficult, to do in the engine, then I rather find out now before I get too far along in the project. And any help or resources on how I can do this if possible will be greatly appreciated.

sentences:
AddForce results in stuttering movement I'm currently developing a simple breakout/arkanoid mobile game. Now, I noticed that my ball movement is noticably stuttering. I've read various approaches about how to make the ball move and decided to go for AddForce so I don't have to do any physics calculations myself.
The only thing im currently doing is using AddForce on my ball's rigidbody2D and have it collide with the walls and blocks. There's nothing done manually in Update or FixedUpdate and there are no other scripts running while the ball is moving. The scene is pretty empty actually.

Things I have tried so far without success:

Disable V-Synch
Increase the velocity iterations (I tried values 15-500)
Set the RigidBody2D's interpolation mode to: Interpolate/Extrapolate
Using different mass values and force values in AddForce
Checking, whether it's just an optical illusion (it seems to run more smoothly in editor and other breakout/arkanoid games don't have that problem on my Galaxy S7)

RigidBody settings of the ball:

Body Type: Dynamic
Material: Friction: 0 | Bounciness: 1
Mass: 0.025
Linear Drag: 0
Angular Drag: 0
Gravity Scale: 0
Collision Detection: Continous
Sleeping Mode: Start Awake
Interpolate: Interpolate

The walls and blocks are simple BoxCollider2D components. And I'm calling AddForce(new Vector2(0f, GameConstants.DESIRED_BALL_SPEED)) on the ball's RigidBody2D.

Edit:

public void OnPointerUp(PointerEventData eventData) {
    if(!_ballStarted) {
        PaddleController.ShootStickingBalls();
        _ballStarted = true;
    }
}

public void ShootStickingBalls() {
    int stickyBallsAmount = _stickingBallsRigidBody2D.Count;
    for (int i = 0; i < stickyBallsAmount; i++) {
        _stickingBallsRigidBody2D[i].AddForce(new Vector2(0f, GameConstants.DESIRED_BALL_SPEED));
        _stickingBallsRigidBody2D[i].transform.SetParent(_nonStickyBallsTransform);
    }
    Sticky = false;
}

sentences:
Tile tilemapping render error I'm having rendering issues in Tiled with a border tile I'm applying to shapes.

In Tiled:

In game:

I'm using Tile Flipping to reduce work. I thought this may be the issue, so I tested out a few tiles by themselves:

Tiled:

In game: They render as expected

What may be the cause of this?

My game engine is Melon JS

sentences:
How do I tag an empty space for an 'InAir' Boolean? I've been working with my game's settings to get the perfect jump height, gravity and movement that suits the player, however my problem is my player essentially floats back down to the ground, when I want them to fall much faster (it's a 3D game) but I don't want to tamper the gravity anymore solely for the player.

What I've done is created 2 extra Booleans alongside my Grounded Boolean, one for In Air and another for Extra Gravity, and this is where my problem comes in.

I have no idea how to set a tag to the empty space in the air, and I was wondering if anyone knew how to do this, or if there is a better method for detecting when my player is in the air?

This is what my script currently looks like:

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

public class PlayerScript : MonoBehaviour
{
    public float movementSpeed = 5f;
    public float jumpForce = 7;
    public float jumpSpeed = 7;
    public Rigidbody rigidbody;
    private Vector3 input;
    public GameObject Player;
    public bool grounded;
    public bool inAir;
    public float ExtraGravity;

    // Use this for initialization
    void Start()
    {
        var rigidbody = GetComponent<Rigidbody>();
        var col = GetComponent<CapsuleCollider>();
        Player = GameObject.FindWithTag("Player");
    }
    void FixedUpdate()
    {
        if (Input.GetKeyDown("space"))
        {

            if (grounded)
            {
                Debug.Log("Spacebar pressed");
                rigidbody.AddForce(0, jumpForce, 0);
            }

            if(inAir)
            {
                Vector3 vel = rigidbody.velocity;
                vel.y -= ExtraGravity * Time.deltaTime;
                rigidbody.velocity = vel;
            }

        }
    }

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

        if (Input.GetKey("w"))
        {
            transform.position += transform.TransformDirection(Vector3.forward) * Time.deltaTime * movementSpeed * 5.5f;
        }
        else if (Input.GetKey("s"))
        {
            transform.position -= transform.TransformDirection(Vector3.forward) * Time.deltaTime * movementSpeed * 4.5f;
        }
        else if (Input.GetKey("d"))
        {
            transform.position += transform.TransformDirection(Vector3.right) * Time.deltaTime * movementSpeed * 5.5f;
        }
        else if (Input.GetKey("a"))
        {
            transform.position -= transform.TransformDirection(Vector3.right) * Time.deltaTime * movementSpeed * 5.5f;
        }

        if (Input.GetKey(KeyCode.LeftShift))
        {
            transform.position += transform.TransformDirection(Vector3.forward) * Time.deltaTime * movementSpeed * 20.5f;
        }

    }

    void OnCollisionStay(Collision collision)
    {
        if (collision.gameObject.CompareTag("Floor"))
        {
            grounded = true;
        }
    }

    void OnCollisionExit(Collision collision)
    {
        if (collision.gameObject.CompareTag("Floor"))
        {
            grounded = false;
        }
    }

}

sentences:
Random number in a range, biased toward the low end of the range I have an input of two values, let's say 1 and 10.
Lesser numbers should overall occur more often in the output than higher numbers, while there is a peak in the probability at #2:

1: very common
2: extremely common
3: very common
4: common
5: somewhat common
...
10: extremely rare

How do I achieve this? My code until now looks like this:

function getValue($min, $max) {
    return random($min, $max);
}

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:
With GGPO rollback netcode, how many times might I need to update my game engine in one frame? I'm working on a game that's going to use GGPO for rollback netcode. I understand the need for a deterministic engine whose state can be saved, restored, advanced from user inputs, etc. I understand that I may need to do this several times in a frame, and that therefore, from a performance point of view, updating the game engine needs to be fast enough to be called more than once in a frame.
My question is.... how many updates in a frame do I realistically need to budget for? If I can identify a realistic worst case, I'll simply run my game engine that many times a frame while I'm developing it.

sentences:
How can I avoid a busy-wait in this game loop implementation? I've been developing a small framework for OpenGL and WinApi for some research purposes. My biggest problem right now is the game loop. Simplified I did something like this:
Main thread:

HANDLE hUpdate = (HANDLE)_beginthreadex(0, 0, updateThread, 0, 0, 0);
while (!done)
{
    if (PeekMessage(&msg, hWnd, 0, 0, PM_REMOVE))
    {
        if (msg.message == WM_QUIT)
        {
            done = TRUE;
        }
        else
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }
    else
    {
        Draw();
    }
}

Update thread:

unsigned int __stdcall updateThread(void *params)
{
    QueryPerformanceCounter(&nextTick);
    QueryPerformanceCounter(&lastUpdate);
    while (!done)
    {
        LARGE_INTEGER currentTick;
        QueryPerformanceCounter(&currentTick);

        while (currentTick.QuadPart > nextTick.QuadPart)
        {
            double frameTime = ((currentTick.QuadPart - lastUpdate.QuadPart) * 1.0) / clock.QuadPart;

            QueryPerformanceCounter(&lastUpdate);
            Update(frameTime);

            nextTick.QuadPart += TIME_STEP * clock.QuadPart;
            QueryPerformanceCounter(&currentTick);
        }
    }
    return 0;
}

This way i got fixed time step while draw will be called as much as it can (kinda what I was looking for). The BIG problem is that everything is operating using busy wait, and it just swallows CPU and still no real game logic has been written. Can anyone tell me, or redirect me to some good, efficient implementation of game loop? While I was researching I came across information that Sleep() is bad for game loop.

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:
Graphical quality of open source vs. commercial games I'm new in Game development. I have researched many open source games. But I have not met any open source game which has high quality graphics, comparable to these found in commercial games.

What is the reason for this? Are open source game engines not advanced enough to support such graphics or is there just a lack of assets, textures and models?

I know that this question is very general, I would like to hear some points of view.

sentences:
How to get current Microphone Frequency in Godot Let us say I want to create a singing game similar to SingStar, and for this purpose I want to get the audio pitch the microphone is getting, in real time, or as close as possible.
I know I can get audio input in Godot. Even record the microphone to a file, there is an official demo project that does that (mic_record). I also know there are libraries that can analyze the audio.
How can I get the microphone pitch in real time?

Yes, I'm answering my own question. This question is inspired on a similar one on StackOverflow, which asked for a library to do this, which lead to the question getting closed, and the asker deleted it instead of editing the question… Before I noticed. As it turns out, you don't need libraries to do this. This is a means to answer the question I believe that person should have asked.

sentences:
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: Creating an Isometric tile map with HTML5 I'm trying to create an isometric tile map using HTML5 Canvas.  Everything I've found online points me towards using a pre-built engine.  I'd like to learn how to do this without using an engine.  Is it possible to do this?  If so, how?  Would I need to look into WebGL?

sentences:
Splitting profit - Equal share vs equity investment (work & money spent = share) Coming up with an appropriate one-liner question was so hard I wrote the body before the header...

So we're a team of 4 developers; two designers, two coders to put it simply (naturally we don't tie ourselves up with labels). We've come up with a great game design together, and we're prepared to spend a great bulk of our time making a prototype.

Problem is, there's a major difference of opinion when it comes to sharing potential revenue made by the game.

Investment = Share

Two of us would like to have everyone keep a rough log of hours spent. Converting that to a previously agreed upon per-hour salary, we could add it up with real money invested, and from that determine each developer's 'stake' in the game, i.e. their share.

Equal Share

The other two do not agree with that, among other reasons because they think some pieces of work are worth more than others, like a really great idea for a feature. Because of such immeasurables, they think an equal share for all would be the easiest.

Another argument said: (paraphrasing) "logging hours would take away the fun. I'm serious about this project, but I want to work with it on hobbyist terms, not like a second job."

We need to formalize an agreement before development has gone too far, but how can we get past these core differences of opinion? Is this a common problem among first-time startups?

sentences: Sweep and Prune vs Quad Tree I need some broad phase algorithm for my 2d game (shmup, bullet hell). Does one or another solution have any major advantages?

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:
Unity Tile pallete isn't appearing in window tab I'm trying to add a tile pallette to my scene in Unity. But when I go to

Window - 2D there is no tile pallette option

I'm using

v2019.2.11f1 (Personal)

sentences:
Geometry shader-generated tile mesh isn't any faster than CPU-generated version For practice, I'm writing a Rogue-like. In order to speed up tile rendering I have a dynamic Mesh/MeshBuilder that collects all the vertices of the visible tiles' quads (4 vertices per tile: position, color, UV; and 6 indicies) CPU-side and emits a single draw call of the large tiled triangle mesh. At 600 FPS/0.0017 ms this is fast enough for my purposes.
I recently decided to practice with the various rendering pipeline stages and thought that this would be a great candidate for the geometry stage and have the GPU generate the tiles for me, passing in only a single vertex/index pair per tile.
There are as many as 2000 tiles visible per frame, yet it was no faster than the CPU version despite passing one quarter the amount of vertices and one sixth the indicies across to the GPU.
It's my understanding that it is a best practice to minimize the amount of data passed between the CPU and GPU, and hand off work to the GPU that it is better suited to do.
Am I wrong in this understanding?
It seems like the geometry shader isn't that useful if offloading work to it doesn't have a benefit?
What can be achieved with the geometry shader that other techniques can't do?

sentences:
android multitouch problem Im aware that there a a couple of posts on this matter, but Ive tried all of them and none of them gets rid of my problem.

Im starting to get close to the end of my game so I bought a cabel to try it on a real phone, and as I expected my multitouch dosnt work. I use 2 joysticks, one to move my character and one to change his direction so he can shoot while walking backwards etc.

my local variable:

public void update(MotionEvent event) {
    if (event == null && lastEvent == null) {
        return;
    } else if (event == null && lastEvent != null) {
        event = lastEvent;
    } else {
        lastEvent = event;
    }

    int index = event.getActionIndex();
    int pointerId = event.getPointerId(index);

statement for left Joystick:

if (pointerId == 0 && event.getAction() == MotionEvent.ACTION_DOWN && (int) event.getX() > steeringxMesh - 50 && (int) event.getX() < steeringxMesh + 50 && (int) event.getY() > yMesh - 50 && (int) event.getY() < yMesh + 50) {
    dragging = true;
} else if (event.getAction() == MotionEvent.ACTION_UP) {
    dragging = false;
}

if (dragging) {
     touchingPoint.x = (int) event.getX(); //used to calculate angle of sprites movement
     touchingPoint.y = (int) event.getY();

     //code for moving my character

statement for my right joystick:

if (pointerId == 1 && event.getAction() == MotionEvent.ACTION_DOWN && (int) event.getX() > shootingxMesh - 50 && (int) event.getX() < shootingxMesh + 50 && (int) event.getY() > yMesh - 50 && (int) event.getY() < yMesh + 50) {
    shooting = true;
} else if (event.getAction() == MotionEvent.ACTION_UP) {
    shooting = false;
}

if (shooting) {

    touchingPoint2.x = (int) event.getX(); //used to calculate sprites angle and get the correct direction
    touchingPoint2.y = (int) event.getY();
    // code for aiming
}

This class is my main-Views onTouchListener and is called in a update-method that gets called in my game-loop, so its called every frame.

Im really at a loss here, I've done a couple of tutorials and Ive tried all relevant solutions to similar posts.
Can post entire Class if necessary but I think this is all the relevant code. Just hope someone can make some sence out of this.

EDIT: both shooting and dragging joysticks work fine, but only when I press them one at a time, so I cant drag and shoot at the same time. I've looked around for a bit more and have understood that you need a MotionEvent.ACTION_POINTER_UP and MotionEvent.ACTION_POINTER_DOWN , but still dont know a way to implement it, some people use loops that goes through event.getPointerCount. Also with this Code my pointerId is always 0. To sum up: I want to be able to use both joysticks at the same time.

sentences: Casual gamer age distribution What is the age histogram of people who play casual mobile games like Cut The Rope, Angry Birds and so on?

sentences: How do I parent an object to a bone in the blender hierarchy? So, I'm trying to make a simple RPG game using Blender and Unity. I would like to have an empty object to be used as a weapon holding position parented to my right hand bone so that I can switch weapons in and out and they'll be able to animate along with my character by being the child of the empty position. The problem I am having is that I can't get the empty position to be a child of the specific right hand bone, only the armature. Is there a way to make this work? Also, if this isn't a good procedure to accomplish what I am trying to do, please enlighten me with the proper way, I'm kind of a noob, thanks.

sentences: Cannot use DLL in my Unity project I'm pretty new in Unity and i'm trying to write reusable code to use across multiple "project". So I wrote this class to POST and GET highscore via WebRequest. I compiled the project to a DLL and added the DLL in my assets folder, and then I created a test script added to a GameObject opened it in VS2013 and created a reference to the DLL in the Assets folder, and now im trying to use it and it keep saying that the class name doesnt exist.

sentences: vuforia unity how to detect that we have " lost track of" an object I'm working on a vuforia project and would like to be aware when vuforia can no longer detect the object in unity. Is there an easy way to write a script that is executed opon loosing track of an object for a given time?

sentences:
Double vision with Google Cardboard in Unity I am working on a VR app.

I have a terrain and some cube placed in the terrain.Even I have added the Reticle to point at the cube and display some message when the user gaze at the cube.

I have set the distortion to "None".

The problem I am facing here is,when I run the app the cubes and the pointer(reticle) is seeing as double in the scene.What will be the reason for it.Can anybody help me out please.

sentences:
Need help understanding this script I found this script on a tutorial that I want to implement into my game, but I first want to understand what it does and how it does it. The script is attached to a Joystick UI, which has the inner ring/button of the joystick as its child. The script makes the inner button of the joystick move within a certain confine, when the player uses the joystick. "joystickButton" is the child object.
public class Joystick : MonoBehaviour, IDragHandler, IPointerUpHandler, IPointerDownHandler
{

public Image joystickButton;

public Vector3 inputDirection;

void Start()
{
    inputDirection = Vector3.zero;
}

public void OnDrag(PointerEventData drag)
{
    Vector2 position = Vector2.zero;

    RectTransformUtility.ScreenPointToLocalPointInRectangle (joystickButton.rectTransform, drag.position, drag.pressEventCamera, out position);

    position.x = (position.x / joystickButton.rectTransform.sizeDelta.x);
    position.y = (position.y / joystickButton.rectTransform.sizeDelta.y);

    float x = position.x * 2;
    float y = position.y * 2;

    inputDirection = new Vector3(x, y, 0);
    inputDirection = (inputDirection.magnitude > 1) ? inputDirection.normalized : inputDirection;

    joystickButton.rectTransform.anchoredPosition = new Vector3(inputDirection.x * (joystickButton.rectTransform.sizeDelta.x / 3), inputDirection.y * (joystickButton.rectTransform.sizeDelta.y) / 3);
}

public void OnPointerDown(PointerEventData drag)
{

    OnDrag(drag);
}

public void OnPointerUp(PointerEventData release)
{

    inputDirection = Vector3.zero;
    joystickButton.rectTransform.anchoredPosition = Vector3.zero;
}

}
I did some research and some tests, and from what I understand, if I tap a point within the Joystick UI's RectTransform, the point I tap, "drag", gets converted to a position in the RectTransform of joystickButton. The position is then converted to a vector, inputDirection, which represents the direction and location of my tap. The vector is then normalized, and the joystickButton is moved to
(inputDirection.x * (joystickButton.rectTransform.sizeDelta.x / 3), inputDirection.y * (joystickButton.rectTransform.sizeDelta.y) / 3),
where the vector is pointing to the direction of my tap, and has a magnitude that is 1/3 the length of the side of joystickButton's RectTransform, since all the anchors are centered, and the RectTransform is a square.
What I don't get is why I need these lines:
RectTransformUtility.ScreenPointToLocalPointInRectangle (joystickButton.rectTransform, drag.position, drag.pressEventCamera, out position);

and
float x = position.x * 2;
float y = position.y * 2;

Is there any purpose to these lines?
Converting the 1st one to
position = drag.position

and the 2nd one to
float x = position.x;
float y = position.y;

doesn't seem to mess anything up.
Also, I didn't notice at first, but not dividing on by sizeDelta on these lines
position.x = (position.x / joystickButton.rectTransform.sizeDelta.x);
position.y = (position.y / joystickButton.rectTransform.sizeDelta.y);

does change the result slightly, so if anyone can tell me what function dividing the values does, it would be greatly appreciated.

sentences:
Visual Design for AI i'm developing an editor for a game...

and tonight i have been thinking about implement a visual ai designer...

this is how i think it should be:

What kind of visual components are used in theses tools? (Timers, Counters, Conditionals,...)
About implementation, i'm using C# and xna, how can i save/load this graphs?

sentences:
Switching camera position on collision I'm trying to switch the camera to another object on collision.

This is what I've tried to do:

    public Camera switchCamera1;
public GameObject player2;

private Vector3 offset;

void Start () {
    offset = transform.position - player2.transform.position;
}

void OnCollisionEnter (Collision col) {
    if (col.gameObject.name == "triggerCube") {
        //SceneManager.LoadScene ("test2");
        Debug.Log ("HIT SOMETHING");
        setWinText ();

        switchCamera1.transform.position = player2.transform.position + offset;

    }
}

However it simply doesn't work. I've set my camera to switchCamera1, I've set the other object to player2. The script is assigned to the collider object.

sentences:
Passing properties as arguments such that the resulting class can modify the original I'm really not experienced with c# so maybe my whole methodology is wrong but here goes.
I'm trying to build a GUI that allows many many parameters to be modified in real time and have a central repository for all those variables. So I am trying to build a wrapper class around the slider so I don't have to explicitly link it to each property in the parameters class manually, and make it easier to add other generic functionalities like events or whatever.
So right now I have a UI class that holds the sliders, a slider wrapper class that holds some extra functionality, and a central parameters class. The central class shouldn't have any dependencies of the other two classes.
The UI class instantiates the slider wrapper class, and passes a Unity slider object. That part works fine.
It also passes the property from the central parameter class to which it should be linked. That's the part I'm stuck on.
UI class:
public class UIParams : MonoBehaviour
{

    private GeneralParams _centralParams;   // reference to central parameters class
    private Transform _mainUI;               // reference to main UI panel
    private Transform _panel1;               // reference to sub panel

    private MySlider _mySlider1;           // instance of my slider wrapper class
    // more sliders go here

    void Start()

    {
        //init
        _centralParams = GameObject.FindObjectOfType<GeneralParams>();
        var Panel1 = GameObject.Find("MainUI").transform.Find("Panel1");

        //sliders
        _mySlider1 = new MySlider(
            Panel1.Find("Slider1").GetComponent<Slider>(),  //pass the actual slider to the wrapper
            _centralParams.Parameter_1);                     //pass the central parameters property to the wrapper

        // more sliders go here

    }

}

Slider wrapper class:
Code (CSharp):
class MySlider
{
    private Slider _slider;                 // object to hold the slider
    private float _sliderValue;                   // value of the slider

    public MySlider(Slider Slider, float CentralParameterProperty)
    {
        _slider = Slider;                                                   // reference to Slider
        _slider.onValueChanged.AddListener(delegate { update();});      // listen for changes to slider, don't want to be checking all the time
        _sliderValue = CentralParameterProperty;                            // set slider to default value in CentralParams. How do I modify that value???
    }

    private void update()
    {
        _sliderValue = _slider.value;       // how do I change the original value from Central Params without explicitly linking each property manually?
    }
}

Central parameter class:
Code (CSharp):
public class CentralParams : MonoBehaviour
{

    public Action GeneralUpdateEvent;       // tell other classes when an update has occured

    [SerializeField]
    private float parameter_1;
    public float Parameter_1
    {
        get => parameter_1;
        set
        {
            parameter_1 = value;
            GeneralUpdate();
        }
    }

    // more parameters go here

    void GeneralUpdate()
    {
        GeneralUpdateEvent?.Invoke();
    }
}

Passing the float CentralParameterProperty into the MySlider instance works to set the default value of the slider. But obviously from that point onwards the slider only modifies the internal variable _sliderValue, not the property of the central class.
Can I set it up so I pass some object from the UI class into the MySlider on instantiation such that the MySlider instance can both get and set the values of the CentralParams property, without explicitly linking to central class within the MySlider class? Or is this just Wong?
Hope that made sense...

sentences:
isometric background that covers the viewport The technique I use now is a loop with an innerloop that draws images on a canvas element, but it looks like a rotated square.

This is a nice example that covers the whole viewport.

I have read something vague about clickthrough maps? What kind of techniques are there that are most efficient with mobile devices and javascript?

Edit

I other words, howto create a grid, in HTML5 that looks like the picture above, where you can place elements on. ( in the picture, it is the garden ) If it's not isometric, what is it and can it be created in html5. What I use now, creates a repititive background.

function draw() {

    c.clearRect(0, 0, canvas.width, canvas.height);

    for (var row = 0; row < 10; row++) {
        for (var col = 0; col < 10; col++) {

            var tilePositionX = (row - col) * tile.height;

            // Center the grid horizontally
            tilePositionX += (canvas.width / 2) - (tile.width / 2);

            var tilePositionY = (row + col) * (tile.height / 2);

            if (tileMap[row] != null && tileMap[row][col] != null) {
                tilePositionY -= tileMap[row][col].height - tile.height;
                tilePositionX -= (tileMap[row][col].width / 2) - (tile.width / 2);

                if (!(tileMap[row][col] instanceof BuildingPortion)) {
                    c.drawImage(tileMap[row][col].texture, Math.round(tilePositionX), Math.round(tilePositionY), tileMap[row][col].width, tileMap[row][col].height);
                }
            } else {
                c.drawImage(tile, Math.round(tilePositionX), Math.round(tilePositionY), tile.width, tile.height);
            }
        }
    }
}
}

thanks

sentences:
OpenGL vs OGRE : Which is the best for beginner? I am interested in getting into game development and posses good C/C++ programming skills. I have tried OGRE before, and I am curious whether I should learn either OGRE or OpenGL as a starting point.

From my understanding, OGRE is a wrapper for OpenGL and DirectX. So, supposed that I learn OGRE, do I still need to learn OpenGL as well to develop a game?

Also, can someone points me good tutorial for OpenGL? I found that OGRE is well documented (it's even come with the distribution!) but for OpenGL, most of the tutorials I came over are outdated.

sentences: Dependency setup between libGDX projects in Eclipse IDE For my game I'd like to create another project that extends the functionality of libGDX and since it will be an independent project it could be easily reusable. How can I achieve this in Eclipse IDE? Do I have to use any building tools like Ant or Maven? I'd prefer not using them but I also don't want that the libgdx.jar file to get in the final jar twice. Do I have to create a full libGDX project (with gdx-setup-ui) for the extension project or is it enough to create a simpe Java Project and add the libGDX library?

sentences:
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:
Integration of homogenous wave I have a 2D matrix; each of its elements describes a homogenous coordinate in 3D wave (the values of wave coordinates are changed in time). The wave rendering is done with texture. I need to make an integration for the wave.

Does anyone have a clue? And another question; will the texture have any impact on integral calculation?
p.s maybe i can do this using opengl?

sentences:
Why are there fewer glitches in current day games? I remember that almost every single game in the early 2000s had at least a few amusing glitches, mostly related to animations, that often produced funny situations. I also remember that game magazines used to dedicate a section with the funniest screenshots people sent in.

As an example, I was just playing Far Cry from 2004 and out of nowhere, whenever I killed some bad guy, instead of dropping to the ground they'd start playing the running animation. This was getting me confused since I was trying to shoot them down from a large distance and didn't understand why they weren't dying.

I've rarely seen stuff like this in current-day games. Was there some change in the technique used to develop games that would make these programmer mistakes less likely?

P.S. I'm not talking about RPGs and other inherently complex genres. I'm talking about games like Far Cry; shooters like Battlefield 3, Modern Warfare 3, even Mass Effect. I've seen plenty of glitches in games like The Witcher 2, Skyrim, etc.

sentences:
Is game software design the same as non-game software design? Is the software design process for a game similar to a non-game?
Do developers create UML diagrams?
I ask because of the iterative nature of game development, I wonder if creating a UML diagram would just be a waste.

sentences:
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:
Are there any game engines in C# or Java that are cross-platform and support multitouch input? I'm looking for game engines (particularly 2D) that can run/create games for Windows, Mac, and Linux, and support multitouch inputs and gestures. I'm able to find many that meet the first two criteria, but don't mention anything about multitouch.

I know that Qt is an existing non-game framework that supports multitouch and is cross-platform. Unfortunately it doesn't seem to be geared for hardware-accelerated games.

sentences:
Lock Z axis from the gyroscope rotation Here's the code I use.

public class CameraGyro : MonoBehaviour {

private float initialX;
private float initialY;
private float initialZ;

// Use this for initialization
void Start () {
    Input.gyro.enabled = true;

    initialX = Input.gyro.rotationRateUnbiased.x;
    initialY = Input.gyro.rotationRateUnbiased.y;
}

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

    transform.Rotate (initialX - Input.gyro.rotationRateUnbiased.x, initialY - Input.gyro.rotationRateUnbiased.y, 0f);
}

}

The thing is when I rotate the phone, the Z axis seems to change even if I've set it to 0f in the code above. Is there a way to really lock this position to 0?

sentences:
Is there a way to get mouse coordinates relative to an sfml window without locking the mouse to the window border or monitor edges? As the title states, is there a way to get the relative mouse coordinates to the sf::RenderWindow without locking the mouse cursor inside of the window border or monitor edges?

In glfw using a mouse callback function and setting the cursor with a glfw call it grabs the mouse coordinates relative to the glfwwindow but doesn't lock the mouse anywhere, the mouse is free to move on the x-axis as much as the user can drag the mouse.

The sf::RenderWindow function of setMouseCursorGrabbed(boolean, window) is a good function to use but as stated this locks the mouse inside the window.

If there is no way to do this via sfml, then is there a way I can use the glfw callbacks with an sf::RenderWindow?

The goal here is to make a fully rotate-able (360 degree) First Person Camera. I am currently unable to rotate the full 360 degrees, there is about 50 degrees lost when the mouse hits the right or left edge of the sfml renderWindow.

Thanks!

sentences:
How do I make an object's y-axis align with a Vector3? I have a golf ball on the ground, and from a raycast, I have the normal which gives me the slope of the ground by the ball.

I have an object which is rendered on the HUD to show that slope to the player.

I have a parent object rotated -90 degrees around X, so that the indicator's Z-axis points up. This way I can do this:

Quaternion yRot = Quaternion.Euler(0, -CameraController.Instance.CachedTransform.eulerAngles.y, 0);
Vector3 displayGroundNormal = yRot * _groundNormal;
_lieIndicator3DParentCachedTransform.rotation = Quaternion.LookRotation(displayGroundNormal);

This, as far as I can tell, takes the ground normal, rotates it around the y-axis so that it shows the proper perspective given the camera's facing. Then it tells that parent object to look in that direction, which aligns its z-axis with the rotated ground normal.

This works, except the object I have also rotates around the y-axis depending on the orientation of the camera. I thought that I was throwing that information away in the second step by keeping only a Vector3 aligned with the ground normal rotated for the camera position.

So I want this:

Not this:

sentences:
How to embed icons in a font? I'm looking to have several icons within a label; for example a coin instead of a dollar sign. I'm using a TTF font, and as much as I'd like to keep it that way (simply because I've heard it's "better"), I've looked into using a Bitmap Font Generator to embed images and replacing some unicode characters with arbitrary icons specific to my game. Seems like you're not able to preserve color that way.

Here's an example tool I've looked at, Bitmap Font Generator, from the cocos2dx docs.

My question is there some other way to embed icons with color in either a TTF or BMP font, other than replacing arbitrary characters with icons?

sentences:
How do you make objects be pushed away from you? like pain from naruto, I wanna be able to press a button and be able to push objects
here's my push method
 void DoPush()
    {
        Collider[] colliders = Physics.OverlapSphere(transform.position, pushRadius);

        foreach (Collider pushedObject in colliders)
        {
            if (pushedObject.CompareTag("Enemy"))
            {
                Rigidbody pushedBody = pushedObject.GetComponent<Rigidbody>();

                pushedBody.AddForce(-transform.forward * 500, ForceMode.Force);

            }
        }

    }

the problem with this method is when I go behind the objects I push, they go towards me

sentences:
Which game logic should run when doing prediction for PNP state updates We are writing a multiplayer game, where each game client (player) is responsible for sending state updates regarding its "owned" objects to other players.

Each message that arrives to other (remote) clients is processed as such:

Figure out when the message was sent.
Create a diff between NOW and that time.
Run game specific logic to bring the received state to "current" time.

I am wondering which sort of logic should execute as part of step #3 ?

Our game is composed of a physical update (position, speed, acceleration, etc) and many other components that can update an object's state and occur regularly (locally).

There's a trade off here - Getting the new state quickly or remaining "faithful" to the true state representation and executing the whole thing to predict the "true" state when receiving state updates from remote clients.

Which one is recommended to be used? and why?

sentences:
How to loop through objects in class (XNA)? In my game I have an Enemy class, and in that I have a constructor which I use to make Enemy objects.

How do I add all Enemy objects to a list or loop through all of them using a foreach loop?

I have tried various variations of this:

foreach(object E in Enemy){
        //Do collision detection, set AIs next move, etc.
}

However, it always rejects the second part of the foreach loop, saying that Enemy is a type but is used as a variable.

sentences:
Calculation of a fight with many entities User A can have many entities

A Entity is a object that has properties such as health, attack, defence, agility, stamina, etcetera.

When User A want to attack User B with x entities I am looking for the algorithm/equation to calculate the fight. I have brought some couple of ideas but they all have some pros and cons and I am not sure which one I would use or If I should use one of them at all?

Model A - The while loop
Basically I would get all the entities that is suppose to fight in this battle, I would assign each of them (objects) in to an array (the User A array and the User B array). Now I would simply loop through until one of the array is empty. Inside the loop I would let one of the User attack first, calculate the result (If the Entity has 0 health, remove it) and then let the next User attack back, calculate the result (If the Entity has 0 health, remove it) And then continue.

The Pros with Model A would be that every entity would be battling and instead of just do a calculation on all around there would be a justice fight.

The Cons To loop through like 10 entities would be fine but what about 1000-2000 entities? And how about the different strength of each entity I mean how could I decide which entity should battle against what entity? This could be just an sorted array (weakest > to strongest) But then I couldn't have like different types of entities is better against a different type of entity, meaning like a Gunner  wouldn't mean anything If it met a Swordsman even though a Gunner would most likely win such in a real fight.

Model B The idea of Model B is quite simple basically calculate all the attributes (properties) together and then If User A army has greater stats than User B army, User A army would win the fight. The Pros with this is it easy on the performance. The Cons are "Which entities would survive?" And it would basically be, the one with greatest army would win. You wouldn't even have a "chance" to win.

Model B B Then I started to think what If I take the concept of Model B  calculate the stat and then I have a battle between just those two single entities. This way User B actually would have a chance ( a small one but the possibility to win) even though the User A has greater army (better stats). The Cons are yet again, How would I know which entities that would survive on the winning team?

The answer I am looking for to this question is what Model should I use? And how would I solve the cons in that particular Model. Or should I use some completely different model (idea) ? (If possible please provide some php pseudo code)

sentences:
Why isn't my method an option for onClick? Update: The problem went away when I restarted Unity and tried again.

The problem

I am using Unity 2019.1.8f1 Personal with Visual Studio for Mac 7.8.4. I have a button named Refresh; I would like its onClick handler to be the public instance method Refresh() in the class Libretto. My GameView has the Libretto script as a component:

The script Libretto.cs includes:

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

public class Libretto : MonoBehaviour, IInputHandler
{

    // Other members omitted

    public void Refresh()
    {
        // Code omitted
    }
}

My scene Scene_Libretto has a Canvas that contains a Button named Refresh:

In the onClick() section of the Refresh component, I selected GameView, which is a GameObject:

When I try setting the function, the method Libretto.Refresh() is not an option:

Attempted solutions

Searching online, I have found these solutions, none of which work for me:

The method must be public. (It is.)
The method must be void with 0 or 1 parameters. (It is void with 0 parameters.)
The script should contain using UnityEngine.UI; (It does.)
Try creating a new object with just the script and use that. (This makes no difference.)
Your code must compile with no errors. (It does.)

Full project

I have tried to make my question complete, but, if anyone wants to look at my code, it is available on GitHub in espertus/UnityWordGames (a fork of Roger Engelbert's code from his book Word Games With Unity).

A sibling scene, Scene_Crossing, in the same project has a similar Refresh button and Refresh() method that work properly.

Update

It worked after I restarted Unity.

sentences:
What kind of algorithms could I use to generate biome borders like in Minecraft? After I've found this post I'm curious what kind of algorithms they use to generate these shapes (second image).

I can't imagine that the basic shapes are basing on a perlin or simplex noise or a voronoi diagram. With voronoi I'm a bit uncertain to be honest.

Well, so what do you think. What algorithm could be used to generate biome borders like they do?

sentences:
Pygame platformer - Making sprite jump I am currently trying to make a Mario-type platformer using pygame and the MVC design pattern. My progress as of right now is getting a character on screen and having it move left and right.

My goal is to have this character have the ability to jump when spacebar is pressed. It is definitely recognizing that spacebar is pressed, but the character just stops in place instead of jumping. Here is the code for the character that I currently have:

import pygame

class Player(pygame.sprite.Sprite):
    def __init__(self, name, x, y, img_file):
        pygame.sprite.Sprite.__init__(self)

        self.image = pygame.image.load(img_file).convert_alpha()
        self.rect = self.image.get_rect()
        self.rect.x = x
        self.rect.y = y
        self.falling = True
        self.onGround = False
        self.v = 0
        self.speed = 2

    def moveLeft(self):
        self.rect.x -= self.speed
    def moveRight(self):
        self.rect.x += self.speed
    def jump(self):
        if self.onGround == False:
            return
        self.velocity = 8
        self.onGround = False

and here is the controller part corresponding to this:

if event.type == pygame.KEYDOWN:
    if(event.key == pygame.K_SPACE):
        self.player.jump()

Thanks

sentences:
Further improvement on algorithm A * i have a game use A*, this algorithm find path is good in many case.

But if I could not find the way to the destination, it would have to go through many nodes (my map is in gird format). I am looking for an algorithm to know that if I cannot find the way to the destination, A * algorithm will not work to avoid wasting CPU or then my object will only go straight to the target, when it collision with an object, it will stop. I saw a game like Age of Empires, when the farmer was locked in between the 4 walls, which meant he couldn't go out. If I want him to go to a point outside those four walls, he just goes straight to that point and stops when he hits a wall. If the 4 walls have a hole, he will go there and get there]1
[]2

Thanks everyone !

sentences:
What is the term for the level progression paradigm in Bejeweled? Looking at the various level progression paradigms for my puzzle game, I decided to rule out the common ones such as 3-star per level, linear campaign-like story, etc. I like the idea of Bejeweled's classic mode where the player simply keeps on going.

What exactly is this paradigm called? I can't find any write-ups on it so I can't quite tell what its structure is like. Is it infinite? Does the difficultly increase with each level in some shape, way or form (more likely to get "No moves")?

sentences:
Implementing an automatic navigation mesh generation for 2d top down map? I am currently in the middle of implementing an A* pathfinding for enemies. In order to implement the actual A* logic, I need a navigation mesh for my map.

I am working on a 2D top down rpg map. The world is static, meaning there is no requirement for dynamic runtime mesh generation. My world objects are freely placed (not snapped to grid), rotated and scaled, which means that using a grid based A* is going to be a little complicated.

For example, how would I know a grid tile contains a collidable object? Lets say that object is actually located on the tile next to this, but is rotated and scaled such that it is still blocking the way?

I could check for the middle pixel of the grid tile to see if it contains any of the nearby objects color data, but it still wouldn't be all that accurate and occasionally enemies could get stuck in between objects.

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:
Avoid threads/multithreading So here is the thing:
I have made a thread for each generator an outpost has. We have a total of 6 outposts , 5 generators each. 3 teams, engineers can only repair generators and prevent their overload. In order to make the whole generator logic I use threads. If the thread gets interrupted it means that the generator got prevented from being destroyed , if the thread is finished normally , the generator got destroyed and if the generator is destroyed an engineer can repair them. Is there any way of avoiding threads because in spite of high cpu usage there are also other thread issues.

The same thing happens with the shield regeneration of each player. I'll just post the code for this one:

public static void startRegenerate(final Player p){

    if(already_regenerating_arraylist.contains(p.getId())){
        return;
    }

    final int previous_shield_lvl = p.getShieldLevel();
    final int previous_hp_lvl = (int) p.getHealth();

    Thread reg = new Thread(){

        @Override
        public void run(){

            already_regenerating_arraylist.add(p.getUniqueId());
            try {
                sleep(3000);
            } catch (InterruptedException e1) {
            }

            for(;;){

                if(p.getShieldLevel() >= 20){
                    p.setShieldLevel(20);
                    already_regenerating_arraylist.remove(p.getUniqueId());
                    break;
                }

                if(p.getHealth() < previous_hp_lvl || p.getShieldLevel() < previous_shield_lvl){
                    already_regenerating_arraylist.remove(p.getUniqueId());
                    break;
                }

                p.setFoodLevel(p.getFoodLevel() + 6);

                try {
                    sleep(1000);
                } catch (InterruptedException e) {
                }
            }

        }

    };

    reg.start();
}

After having more than 50 players stuff stop working (lag , etc...)

sentences:
Stencyl or flash limitation? I have found that Stencyl doesn't seem to be very good at handling very many actors in a game. I had been trying to implement some basic AI at the moment all the behaviours were: wander (pick a random point and move directly to it) and wrap around screen (if it goes off the top of the screen it appears at the bottom). Even with these simple behaviours and calculations the frame rate dropped dramatically when there were more then 50 actors on screen:

10 actors: 60fps

50 actors: 30-50fps

75 actors: ~30fps

100 actors: 15-20fps

200 actors: 8-10fps

I had planned on having a maximum of around 200 actors but I see that's no longer an option and implementing a more complicated AI system with flocking behaviour, looking at creating a game in a similar vein to flOw.

I understand that a game is perfectly playable at 30fps but this is a super simple test with ultra simple graphics, no animations and no sounds is child's play in terms of calculations to be made.

Is this a limitation with Stencyl or is it flash?
Should I simply scale the scope of the game down or is there a better game engine that exports to .swf that I should look into?

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:
Wrong UV mapping when using small textures and positions I am using a really small texture (64x64) and when I use it as a UV map on my mesh, there are some incomplete lines from the color of the other side of the UV map rendered as well (in this case, white.)

The model was made in Blender, and it is rendered without this error. I set absolute coordinates, so the UV coordinates are multiple of 1.0 (1.0, 2.0, 3.0, 4.0, etc.) I am using Ogre as renderer

This is the UV map:

Image with error:

sentences:
How do I have multiple audio sources on a single object in Unity? I have an audio system set up wherein I have loaded all my audio clips centrally and play them on demand by passing the requesting audioSource into the sound manager.

However, there is a complication wherein if I want to overlay multiple looping sounds, I need to have multiple audio sources on an object, which is fine , so I created two in my script instantiated them and played my clips on them and then the world went crazy.

For some reason, when I create two audio Sources in an object only the latest one is ever used, even if I explicitly keep objects separated, playing a clip on one or the other plays the clip on the last one that was created, furthermore, either this last one is not created in the right place or somehow messes with the rolloff rules because I can hear it all across my level, havign just one source works fine, but putting a second one on it causes shit to go batshit insane.

Does anyone know the reason / solution for this ?

Some pseudocode :

guardSoundsSource = (AudioSource)gameObject.AddComponent("AudioSource");
guardSoundsSource.name = "Guard_Sounds_source";
// Setup this source

guardThrusterSource = (AudioSource)gameObject.AddComponent("AudioSource");
guardThrusterSource.name = "Guard_Thruster_Source";
// setup this source
   // play using custom Sound manager
soundMan.soundMgr.playOnSource(guardSoundsSource,"Guard_Idle_loop"
,true,GameManager.Manager.PlayerType);
   // this method prints out the name of the source the sound was to be played on and it always shows "Guard_Thruster_Source" even on the "Guard_Idle_loop" even though I clearly told it to use "Guard_Sounds_source"

sentences:
Animate Using setScale() I want to animate my player from bigger size to smaller size and then smaller size to bigger size continuously.
We can use setScale() method to re-size any sprite but is there any way to animate with it?

And one more thing, if I scale any sprite after creating it's physics body, the sprite is visually scaled but the physics body does not scaled.

So is there any optimum solution to animate the physics body from bigger to smaller and then smaller to bigger?

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:
3d Collision detection help xna? I was hoping if you could help me out here. I'm developing a 3d table tennis game, and got the collision detection working perfectly when the ball hits the racket. However, now I would like the ball to move depending on where it hit the racket (example if it hit the far left side, it goes to the left etc..) Heres the collision detection I used:

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

Any help would be greatly appreciated as to how i could improve this so as to get what I desire. Thanks

sentences:
How to attach two XNA models together? I go back on unsolved question I asked about attaching two models together, could you give me some help on this ?

For example, If I want to attach together Model1 (= Main model) & Model2 ?
I have to get the transformation matrix of Model1 and after
get the Bone index on Model1 where I want to attach Model2 and then apply some transformation to attach Model2 to Model1

I wrote some code below about this, but It does not work at all !! (6th line of my code seems to be wrong !?)

Model1TransfoMatrix=New Matrix[Model1.Bones.Count];

Index=Model1.bone[x].Index;

foreach (ModelMesh mesh in Model2.Meshes)
{
  foreach(BasicEffect effect in mesh.effects)
  {
     matrix model2Transform = Matrix.CreateScale(0.1.0f)*Matrix.CreateFromYawPitchRoll(x,y,z);

     effect.World= model2Transform *Model1TransfoMatrix[Index];
     effect.view = camera.View;
     effect.Projection= camera.Projection;
   }
   mesh.draw();
}

sentences:
Is it possible to develop multiplayer games with HTML5? I know HTML5 is great for web games, but I don't really know if it's possible to develop online games with multiple users, keeping everybody synchronized and handling logins, et cetera.
Is it possible to do this?

sentences:
Multiple lua scripts using newthread I'm trying to hook lua-scripts to my entities, where several entities of the same type want to use a separate instance of the same script. Problem is, when I run two or more scripts and use any C-api functionality, I get an access violation after some time. I'm guessing some kind of stack corruption occurs but I'm not sure. The application is single-threaded but uses lua_newthread for each entity, and I then use lua_resume on each new thread for when I want the scripts to run. The code looks like this.

Script 1

function Update(dt, owner)
   print("Script 1")
   pos = GetPosition(owner)
end

Script 2

function Update(dt, owner)
   print("Script 2")
end

GetPosition()

static int GetPosition(lua_State* L)
    {
        Core::Entity entity = lua_tonumber(L, 1);
        Core::TransformationComponent* tc = WGETC<Core::TransformationComponent>(entity);

        lua_newtable(L);

        for (int i = 0; i < 2; i++)
        {
            lua_pushnumber(L, tc->position[i]);
            lua_rawseti(L, -2, i);
        }

        return 1;
    }

How I create new lua threads (m_luaState is the global parent state to which I bind all my functions):

lua_State* LuaCore::CreateThread(std::string file)
    {
        lua_State* newState = lua_newthread(m_luaState);

        lua_newtable(newState); //new globals table
        lua_newtable(newState); //metatable

        lua_pushliteral(newState, "__index");
        lua_pushvalue(newState, LUA_GLOBALSINDEX); //original globals
        lua_settable(newState, -3);
        lua_setmetatable(newState, -2);
        lua_replace(newState, LUA_GLOBALSINDEX); //replace newState's globals

        luaL_dofile(newState, file.c_str());

        return newState;
    }

How each script is called:

            lua_State* ls = GetChildState(stateIndex)
            lua_pushstring(ls, functionName.c_str());
            lua_gettable(ls, LUA_GLOBALSINDEX);

            SimpleLuaCallData* slcd = (SimpleLuaCallData*)inData;

            lua_pushnumber(ls, slcd->dt);
            lua_pushnumber(ls, slcd->ownerID);

            lua_pcall(ls, 2, 0, 0);

            return nullptr;

If I remove the call to GetPosition from Script 1, the application runs without issue. Am I missing some kind of required clean-up or garbage collection problems? I'd like to try and avoid creating a new state for each entity, as that seems excessive and sharing globals via the core state is nice. lua_pcall doesn't produce any results. The application eventually stops running Script 1 and after a few more cycles it gets the access violation on

lua_gettable(ls, LUA_GLOBALSINDEX);

in the calling function.

sentences:
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:
Farseer circle hangs where it's spawned I'm currently trying to simply spawn a circle in Farseer. However, it's stuck wherever I spawn it! The game is updating fine, as I can see the circle spinning in place when I spawn it because of how I currently have gravity set up (following code from Game1.cs):

// Initialise the screen center for use with
// the Level class
screenCenter = new Vector2(graphics.GraphicsDevice.Viewport.Width / 2f, graphics.GraphicsDevice.Viewport.Height / 2f);

 world = new World(new Vector2(20, 20));
 currentLevel = new Level1(screenCenter, circleSprite, groundSprite, ref world);

Level1 constructor:

public Level1(Vector2 screenCenter, Texture2D circleSprite, Texture2D groundSprite, ref World world)
    {
        player = new Player(ref world, screenCenter, circleSprite);
        ground = new Ground(ref world, screenCenter, groundSprite);
        listLevelItems = new List<LevelItem>();
        listLevelItems.Add(player);
        listLevelItems.Add(ground);
    }

Player constructor:

public Player(ref World world, Vector2 screenCenter, Texture2D sprite)
    {
        setSprite(sprite);
        setPosition((screenCenter / MeterInPixels) + new Vector2(0f, 0f));

        playerBody = BodyFactory.CreateCircle(world, 96f / (2f * MeterInPixels), 1f, playerPosition);
        getBody().BodyType = BodyType.Dynamic;

        // Ball bounce and friction
        getBody().Restitution = 0.3f;
        getBody().Friction = 0.5f;
    }

If I use a breakpoint and change the playerBody position while the game is halted, the ball does move, but stays fixed in its new location.

Any help would be greatly appreciated.

sentences:
Is it allowed by social platforms to promote a game in exchange for in-game currency? I have a mobile game that uses a a hint system.
If the user needs help to solve a puzzle they can get a hint by watching an ad. I'm interested in offering some hints, let's say 5, if the user presses a Facebook/Twitter button and posts some predefined text on those platforms - something like "I've been playing X game, check it out".
I haven't seen many games that have something like this. For those more familiar with App Store and Play Store publishing guidelines, is there anything against such behaviour?

sentences:
Resolution Independence in libGDX How do I make my libGDX game resolution/density independent? Is there a way to specify image sizes as "absolute" regardless of the underlying density?

I'm making a very simple kids game; just a bunch of sprites displayed on-screen, and some text for menus (options menu primarily). What I want to know is: how do I make my sprites/fonts resolution independent? (I have wrapped them in my own classes to make things easier.)

Since it's a simple kids game, I don't need to worry about the "playable area" of the game; I want to use as much of the screen space as possible.

What I'm doing right now, which seems super incorrect, is to simply create images suitable for large resolutions, and then scale down (or rarely, up) to fit the screen size. This seems to work okay (in the desktop version), even with linear mapping on my textures, but the smaller resolutions look ugly.

Also, this seems to fly in the face of Android's "device independent pixels" (DPs). Or maybe I'm missing something and libGDX already takes care of this somehow?

What's the best way to tackle this? I found this link; is this a good way of solving the problem?: http://www.dandeliongamestudio.com/2011/09/12/android-fragmentation-density-independent-pixel-dip/

It mentions how to control the images, but it doesn't mention how to specify font/image sizes regardless of density.

sentences:
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:
Most efficient language for rewriting a tile-based board game as a video game? I've been working on a hex-based board game. Every time I make changes, especially changes that require redesigning the map, it takes a good chunk of time and money. It might be more efficient to write it as a video game, at least for designing it and showing off mock-ups. I've always wanted to learn a programming language anyways, so this gives me a good excuse.

Things that are important:

Hex grid movement, obviously
Hot-seat or online play - it's a multiplayer board game, thus a multiplayer video game
Keep track of what you might call "touchdowns" at a specific location, as well as HP and movement speed

AI would be unnecessary, so would sound effects or a matchmaking server. I just want to be able to show this to people.

Languages I've thought about learning before:

Flash, because it's ubiquitous
C seems to be an industry standard for video games
Javascript, because it seems to be the more powerful successor to flash
Python, because geeks always geek out about how awesome it is

If one of those languages would work well for my purposes, awesome! If there's a more efficient language to learn for this particular application though, I'm open to that.

sentences:
How to clear a buffer to 1.0 instead of 0.0 in OpenGL? Using glClear() you can set the buffer specified by the parameter to 0.0. This is useful say if you want pixels not covered by models to be black. Because vec3(0.0, 0.0, 0.0) results in black.

But for the depth buffer, clearing means to set it to the maximum value 1.0 since you don't want pixels not covered by models to have the depth 0.0 which is the camera's position but to have the depth 1.0 which means as far away as possible.

So how can I clear the depth buffer to 1.0 or come over this issue in another way?

sentences:
Shadow Mapping and Transparent Quads Shadow mapping uses the depth buffer to calculate where shadows should be drawn.

My problem is that I'd like some semi transparent textured quads to cast shadows - for example billboarded trees. As the depth value will be set across all of the quad and not just the visible parts it will cast a quad shadow, which is not what I want.

How can I make my transparent quads cast correct shadows using shadow mapping?

sentences:
Data structure to store map layers in each Tile while keeping the order of terrain, items and monsters intact My game represents its map as a 2D array of tiles, each of which stores a stack of layers. I'm looking for a data structure to efficiently represent this .

I want to be able to add layers dynamically, so fixed arrays won't do.

Additionally, the layers are applied in zones, to make sure that terrain is always drawn before items and monsters, and that items/monsters are drawn before the player. This is the order:

terrainlayer
terraineffectlayers
itemlayers
monsterlayers
playerlayers
specialeffectslayers

I want to store all those zones in the same data structure, so I can traverse it from end to end in either direction. I also need to be able to add a monster layer that would automatically go at the end of monsterlayers data structure while still having a global object that would let me traverse from the all the layers. I also need the ability to access the data structure with index, so I can get the 3rd monster in the tile easily or remove the 3rd monster. Add will always be sequential, but remove are at random indexes.

Does a data structure like this already exist or do I need to make some sort of vector/doubly linked list/deque hybrid?

I have already seen this question but it doesn't help me.

sentences: Changing the culling mode in the HLSL effect I'm writing a cel-shading effect in HLSL and Direct3D 11, and I need to be able to flip the culling mode on the outline pass of the effect.  I know you do this in XNA by setting CullMode to CW or CCW inside the pass definition, but is that how you do it in D3D11/SlimDX?

sentences:
C++ Using clock() with IsKeyDown I am trying to replicate the game Asteroids as a class project. I am having trouble measuring the time elapsed while the "W" key is pressed.

This code is supposed to increase the force applied to the spaceship to increase the movement speed incrementally. This is supposed to let the space ship rotate while moving along a 'line' and then force while be slowly applied to the new direction the ship is angled.

I have tried to research this over many hours and I still don't understand the concept. It seems there are a few ways to go about this but neither attempts have been successful.This is for school submission for the first project of the first year, so obviously my code is very basic and not making use optimal use of classes/structs however I would still like to achieve this movement I have been seeking so that I can understand the concept for use in future projects.

I have tried the use of current/previous variables for speed but haven't been able to come up with an equation to accomodate that. I have also attempted the use of a timestep but have been told that is not the correct approach. Any help would be appreciated. You can view the bulk of my program at https://gist.github.com/Rifuli/4762704

sentences:
Creating iOS shortcut game with levels How can I make levels in iOS shortcuts?
i'm making a game which will be about changing some settings to finish levels (logic game) i had idea to make autosave because levels will require that. my idea was about using rarely used system app named 'reminders' where i can save progress in a part of one reminder named 'notes' but shortuts app doesn't recognize 'otherwise' feature for if loop and when i tap shortcut it adds only one more reminder and doesn't show upcoming first level ios version is 14.4.1 (beta i think) and tablet is after JB (but i've never modified shortcuts app) .
xml source from shortcut (github) : https://github.com/hacknorris-notyetbanned/hacknorris.github.io/blob/77a47bff65bc13f21642dbebdf4023aa957ebb0a/Test.xml
where is bug in reminders?
Edit: now i wont mess up on shortcuts - im gonna update this : https://github.com/hacknorris-notyetbanned/glitched.git and leave project. I have 0 ideas and logged out of icloud...  :/

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:
Unity - Proper use of threads with procedural generation I have been working on a simple chunk based terrain generation system, with voxel octrees. The overall method works pretty well, but testing this system with large amounts of chunks completely freezes the game/main thread until the generation process is finished. Looking for a solution, I read about threads and coroutines and I implemented a simple thread class (based on this template) to call the "generate" function from it. The only advantage I had was a faster generation, with full CPU usage, but the game still freezes until the chunks are completely loaded. Am I doing something wrong? Here some parts of the code:

public class ChunkThread : ThreadedJob {
  public Chunk chunk;
  protected override void ThreadFunction(){
    chunk.root = chunk.root.BuildOctree (chunk.pos, Chunk.size, -1);
  }
  protected override void OnFinished(){
    chunk.RenderChunk ();
  }
}

This is the simple Thread class I use to call the Build function, and the Render function when finished. This piece of code below is the start\update method for every Chunk gameObject (I kept only the relevant part), that simply creates the Thread instance and calls Start() pressing the mouse button.

void Start () {
  t = new ChunkThread ();
  t.chunk = this;
}
void Update () {
  if (Input.GetButtonDown ("Fire1")) {
  t.Start ();
}

Now, coming to the questions, what should I do to generate the terrain while still being able to play? Is there something wrong in my thread? Should I use a thread pool, if so how?

sentences:
Is there a way to hardcode a JSON file into a Unity build? I'm currently creating an external tool to generate dialogues that are exported as JSON files.

The idea is that after you create a dialogue (as a JSON), my main Unity project reads that file and generates a dialogue.

Right now it works just fine, but the JSON is an external file that you can modify even after compiling the game (of course).

Is there a way to actually "hardcode" that JSON file so that the game doesn't need to find and read the file every single time it plays?

sentences:
Batching and object's transformation I'm trying to implement batching in my game (Sprite batching and 3D Mesh batching), I've read a lot of documentation about that but I don't understand something:

When each object have is own transformation (rotation, position, scale), how can I merge it with others geometries?
When each object use blending, how can I achieve depth with batching?

Thanks!

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:
Fair sharing income with designer I am developing my android game, 2D Sidescroll arcade game, its almost finished, I found artist who wants to cooperate with me, creating graphics for my game, but we have to discuss how much % he will receive if there will be any income from our game.

How do you game developers handle this? What is fair share for an artist? Here is little description on my and his work, to estimate work value:

Done by me:

game idea, story
game code (6 months of development) all game features, everything generally
visual level editor
levels created by me (more than 120)
android license bought be me (I know its cheap but still it is value)
sound purchased by me

Done by artist:

game graphics generally, ground tileset, game characters, 5 tiled monsters (animation), around 30 different graphics for different game objects (like environment elements, obstacles etc)

I would be grateful for some informations, thank you!

sentences:
Spherical harmonics lighting evaluation The following is taken from my current understanding of spherical harmonics. There may be errors involved which solve my question if they're resolved, so please notify me if I misunderstood something.

Evaluating reflected diffuse indirect illumination at a surface point is done by computing the integral (simplified rendering equation) in the last line of

(stolen from here).

An important property of functions in SH representation is that the integral in the last line boils down to a dot product between the vectors containing the SH coefficients for projected functions L(x,omega_i) and max(N_x dot omega_i,0).

For example, for each surface point in our target image that we wish to compute indirect illumination on, L(x,omega_i) is available in a precomputed vector of a 4 elements (for 2 bands SH approximation) containing spherical harmonics coefficients. It's not really important where it came from, just that it's available at this point.

From my understanding, to actually evaluate the lighting at a surface point [x] is to project the function max(N_x dot omega_i,0) into spherical harmonics, and dot it with the coefficient vector of the incoming radiance (and then, multiply it by the stuff in front of the integral, surface albedo / pi).
The first 4 coefficients (2 bands) for max(N_x dot omega_i,0) projected into SH basis are known, they are:

c_0 = 0.88622692545...

c_1 = -1.02332670795 * n_y

c_2 = 1.02332670795 * n_z

c_3 = -1.02332670795 * n_x

So the irradiance at that surface point with normal n would just be

E = dot(L_sh,n_sh)

where L_sh is the coefficient vector for the incoming radiance, and n_sh the coefficient vector for the cosine lobe that we just calculated. Specifically, L_sh is the same max(...) function projected into SH basis [with the normal from which the light originated], just scaled a little by the color its transporting.

The above actually looks fine and seems to produce somewhat correct lighting (hard to judge without ground truth reference). What's confusing me now, is that I've come across several sources (for example here, page 17), which, in the final step, when evaluating the lighting, don't actually use the coefficients from above to project max(N_x dot omega_i,0) into SH basis, but instead calculate n_sh as

n_sh0 =  0.282094792f

n_sh1 = -0.488602512f * -n_y

n_sh2 = 0.488602512f * -n_z

n_sh3 = -0.488602512f * -n_x

These four coefficients are actually just the spherical harmonics basis function coefficients parametrized in cartesian coordinates (here they are for spherical coordinates).

What's up with that? Why aren't they projecting the max(...) function into SH basis instead? Am I misunderstanding something? Unfortunately, the usual sources (gritty details and stupid SH tricks) don't seem to go into details of this either.

sentences:
Updating scene graph in multithreaded game In a game with a render thread and a game logic thread the game logic thread needs to update the scene graph used by the render thread. I've read about ideas such as a queue of updates.

Can someone describe to a newbie at scene graphs what kind of interface the scene graph exports. Presumably it would be rather complicated. So then how does a queue of updates get implemented in C++ in a way that can handle the complexity of the interface of the scene graph while also being type safe and efficient. Again I'm a newbie at scene graphs and C++.

sentences:
Gradual rotation of an object in Java I'm using Java to learn some movement algorithm. I would like to implement the "wandering" algorithm, but in order to do it, i should understand how to rotate an Object gradually.

Actually, my Player changes its orientation instantly (and too many times!) and it is not so good.

This is my code:

logic update

public void update(float delta) {
    // WANDERING

    // orientation as a vector
    float orientation_x = (float)Math.sin(orientation);
    float orientation_y = (float)Math.cos(orientation);

    // update velocity
    velocity_x = maxSpeed * orientation_x;
    velocity_y = maxSpeed * orientation_y;

    int max = 1;
    int min = 0;
    int random1 = (rand.nextInt((max - min) + 1) + min);
    int random2 = (rand.nextInt((max - min) + 1) + min);
    orientation = (random1 - random2) * maxRotation; // random binomial (i don't know which value i have to assign to maxRotation
    System.out.println(orientation);

    x += (velocity_x * delta);
    if(x >= GamePanel.PWIDTH) {
        x = 0.0f;
    }
    y += (velocity_y * delta);
    if(y >= GamePanel.PHEIGHT) {
        y = 0.0f;
    }
}

draw

public void draw(Graphics dbg) {
    // draws the player
    Graphics2D g2d = (Graphics2D)dbg;
    g2d.setColor(Color.RED);
    AffineTransform old = g2d.getTransform();
    g2d.rotate(orientation, x + SIZE/2, y + SIZE/2);
    g2d.fillRect((int)x, (int)y, SIZE, SIZE);
    g2d.setTransform(old);
}

With this code, the behavior that i get is horrible. The Player changes his direction too many times and instantly.

This is the pseudocode of the algorithm:

# Holds the static data for the character
character

# Holds the maximum speed the character can travel
maxSpeed

# Holds the maximum rotation speed we’d like, probably
# should be smaller than the maximum possible, to allow
# a leisurely change in direction
maxRotation

def getSteering():

# Create the structure for output
steering = new KinematicSteeringOutput()

# Get velocity from the vector form of the orientation
steering.velocity = maxSpeed *
character.orientation.asVector()

# Change our orientation randomly
steering.rotation = randomBinomial() * maxRotation

# Output the steering
return steering

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:
Connect-three game: Increasing level-of-difficulty as play progresses I'm writing a connect-three type game (think Chuzzle, but without all those nasty locks, and with no big chuzzles) and I'm trying to figure out how to increase the level of difficulty as play progresses.

As it stands, I've been adding an additional block colour/shape/type when the player advances to another multiple of num_blocks*1000, and it seems to work moderately well, aside from the fact that I keep running out of new colours/shapes/types that look distinct enough on the screen.
(currently, blocks only differ by colour, but I'm planning on adding a shaped highlight to help differentiate)

I'd like to know if manipulating the probabilities of each block type based on the blocks surrounding the new block in an attempt to minimize the chances of cascades and other types of easy matches would be a good idea.

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:
How to apply code of certain script to another? I have a code in my "OnCollider" script to respawn whenever the player dies and has taken an object containing tag 'Respawn'.
1st script: OnCollider ;

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

    public class OnColllider : MonoBehaviour {
        public GameObject Doorfinder;
        public GameObject Door2;
        public Transform Camera;
        public Transform target;
        public GameObject Coin;
        public bool collided;
        public GameObject Playee;
        public GameObject currentRespawn;
        void Start(){
            Door2 = GameObject.Find ("Door0.2");
            Playee = GameObject.Find ("Player");
        }
        public void OnCollisionEnter2D(Collision2D collision){

            if (collision.gameObject.name ==

"scroll") {
            Destroy (collision.gameObject);
            Destroy (Doorfinder);
        }
        if (collision.gameObject.tag == "Fire" ) {
            Playee.SetActive (false);
        }

        if (collision.gameObject.name == "PathFinder") {
            Destroy (collision.gameObject);
            Destroy (Door2);
        }

        if (collision.gameObject.tag == "Coin") {
            Destroy (collision.gameObject);
        }

        if (collision.gameObject.tag == "subVillains") {
            Playee.SetActive (false);
        }
        if (collision.gameObject.tag == "Bramble") {

            Playee.SetActive (false);
        }

        Respawnable (collision);
    }
    public void Respawnable (Collision2D collision){
        if (collision.gameObject.tag == "Respawn") {
            collided = true;
            collision.gameObject.SetActive (false);

        }
        if (collided = true && Playee.activeInHierarchy == false) {
            transform.position = currentRespawn.transform.position;
            Playee.SetActive (true);
            collided = false;
        }
        if (currentRespawn.activeInHierarchy == false && collision.gameObject.tag == "Respawn") {
            currentRespawn = collision.gameObject;

        }

    }

}

2nd Script: Enemy;

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

public class MaxyMory: MonoBehaviour {
    public Vector2 origin;
    public float distance;
    public int layerMask;
    public float sider;
    public Vector2 secondorigin;
    public float bringer;
    public float lesngther;
    public GameObject destroy;
    public Vector2 origination;
    public float middle;
    public float lengther;
    // Use this for initialization
    void Start () {
        origin = new Vector2 (transform.position.x + bringer, transform.position.y + sider);
        origination = new Vector2 (transform.position.x + bringer, transform.position.y + middle);
        secondorigin = new Vector2 (transform.position.x + bringer, transform.position.y + lengther);
    }

    // Update is called once per frame
    public void Update(GameObject Playee){
        Debug.DrawRay (origin, Vector2.right*distance,  Color.red);
        Debug.DrawRay (secondorigin, Vector2.right * distance, Color.cyan);
        Debug.DrawRay (origination, Vector2.right * (distance + 30f), Color.gray);
        RaycastHit2D hit = Physics2D.Raycast (origin, Vector2.right, distance);
        RaycastHit2D anotherhit = Physics2D.Raycast (secondorigin, Vector2.right, distance);
        RaycastHit2D checker = Physics2D.Raycast (origination, Vector2.right, distance + 2f);
        if (hit.collider.tag == "Player" || anotherhit.collider.tag == "Player") {
            Playee.SetActive (false);
        }

    }

}

OnCollider is attached to the player while the enemy script is attached to the enemy itself.

sentences:
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:
Minecraft Type Game Support Blocks OK I have a game that is similar to minecraft in a sense. Players can build castles block by block. I'm using Unity3D and Photon Network for my game and I was wondering how I would handle detecting if blocks have a support system to the ground. Here is the game in question. Let me know what are some solutions besides using rigid-bodies I've tried doing that and it has severe performance issues over a network. Thanks

Youtube Video of Game

sentences:
Is there an efficient way to identify in which run-time generated room a character is, in a non-grid 3D environment? How? Here is what I am trying to implement. I wrote a script that allows the player to place walls during run-time, in non grid-based 3D environment (walls can be diagonal with rotation increasing/decreasing in amounts of 10 degrees). Like the figure below shows, since wall can form different angles, rooms might end up having both convex and concave angles:

What I have been looking for, without success so far, is a way to detect in which room a given character is, according to its position. Of course, if that was a grid-based setting, I could only pass an ID for each cell and then retrieve the ID of the cell where the given character stands. However, that being a non-grid setting and with irregular rooms that have shapes unknown in advance, how could I accomplish that in an efficient way?

Many thanks.

EDIT:
Although it is a 3D environment, the problem may be treated as a 2D one since height is not a concern here.

sentences:
What are the free 3d OOP game engines? Could you please list a few free 3d OOP game engines, along with the pros and cons?
Embeddable in VB.net would be great.

sentences:
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:
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:
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:
Tween - keeping a constant velocity at different distances I am using a tweening library to move my units around. The problem is that the speed varies depending on the distance that the unit has to move because of the  tweening:

var time = 1000;
var tween = new TWEEN.Tween({ x: startX, y: startY })
    .to({ x: endX, y: endY }, time)
    .start();

^No matter the x and y values it will always take the same amount of time.

I tried fixing this by dividing the distance by the speed:

// distance = speed * time
// time = distance / speed
var x = endX - startX;
var y = endY - startY;
var distance = Math.sqrt(x * x + y * y);

var time = distance / speed * dt;
var tween = new TWEEN.Tween({ x: startX, y: startY })
    .to({ x: endX, y: endY }, time)
    .start();

However it still doesn't move at the same speed! Grr!

I made a snippet that shows a square endlessly moving in a rectangle, when done correctly ( which this isnt... ) it should move at the same velocity no matter the distance.

var rect = document.getElementById("rect");

var pos = [ [0, 0], [200, 0], [200, 50], [0, 50] ];
var i = 0;
var time = 1000;
var speed = 10 * 1000; // 10px per second

var tweenStart = { x: 0, y: 0 };
var tweenEnd = { x: pos[i][0], y: pos[i][1] };

var tween = new TWEEN.Tween(tweenStart)
    .to(tweenEnd, time)
    .onUpdate(function () {
        rect.style.top = this.y + "px";
        rect.style.left = this.x + "px";
    })
    .onComplete(function () {
        tweenStart.x = pos[i][0];
        tweenStart.y = pos[i][1];
        i += 1;
        if (i >= pos.length) i = 0;
        tweenEnd.x = pos[i][0];
        tweenEnd.y = pos[i][1];
        // time = distance / speed
        var x = tweenEnd.x - tweenStart.x;
        var y = tweenEnd.y - tweenEnd.y;
        var distance = Math.sqrt(x * x + y * y);
        time = distance / speed * dt;
        tween.start();
});

setTimeout(initiate, 0);

var now, then, dt;

function tick() {

    now = perfNow();
    dt = now - then;
    then = now;

    TWEEN.update();

    requestAnimationFrame(tick);

};

var perfNow = (self.performance && self.performance.now) ? self.performance.now.bind(performance) : Date.now;

function initiate() {

    var x = tweenEnd.x - tweenStart.x;
    var y = tweenEnd.y - tweenEnd.y;
    var distance = Math.sqrt(x * x + y * y);
    time = distance / speed * dt;

    tween.start();

    then = perfNow();

    tick();

};
body {
    margin: 0;
    overflow: hidden;
}
div {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: black;
}

sentences:
How to smooth terrain to lower polygon count? I'm using Unity.
I've created a simple Beach using Terrain editor.
The problem is that Stats show me already a lot of Triangles only for Terrain renderer: 40K .

So my question is: how can I create a Unity Terrain suitable for Mobile game ?
How can I smooth terrain edge ?

Thanks

sentences:
How does one generate mountains out of a Fourier transform? I am watching this IGN video of No Man's Sky in which the founder/programmer of this game talks about how different is his game from other games. Here he talks about how mathematical equations instead of art is used to render graphic of planets and animals and even their behavior.

Then he says that instead of seeing mountains he sees only equation like Fourier transform. I have no knowledge about game development and its intricacies, but I'm curious how one might use a Fourier transform or similar mathematical operation to generate terrain without art?

sentences:
How do I pass textures into a fragment shader in Slick? I've written a shader that uses three different textures, tex0, tex1, and tex2. I can load it into Slick and successfully display it, but I can't figure out how to set the three different textures. Whichever texture I last load or set is the one used for all three.

My code:

if (sp == null) {
    try {
        sp = ShaderProgram.loadProgram("passthrough.vert", "planet.frag");
        planet = TextureLoader.getTexture("png", new FileInputStream("earth.png"));
        clouds = TextureLoader.getTexture("png", new FileInputStream("clouds.png"));
        lights = TextureLoader.getTexture("png", new FileInputStream("lights.png"));
    } catch (Exception e) {
        e.printStackTrace();
        System.exit(0);
    }
}

sp.bind();

// Attempt to set tex0-tex2. This fails and just sets everything to tex2.
glUniform1i(sp.getUniform1i("tex0"), 0);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, planet.getTextureID());

glUniform1i(sp.getUniform1i("tex1"), 1);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, clouds.getTextureID());

glUniform1i(sp.getUniform1i("tex2"), 0);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, lights.getTextureID());

sp.setUniform1f("time", tick * 0.03f);
sp.setUniform2f("resolution", 400f, 400f);

// Render a quad. This works, except that the textures are all the same.
glBegin(GL_QUADS);
glVertex2i(0, 0);
glVertex2i(0, 400);
glVertex2i(400, 400);
glVertex2i(400, 0);
glEnd();

sentences:
Issues glVertexAttribPointer last 2 parameters? Introduction

Hello I will start out by explaining my setup, showing samples as I go along explaining the situation.

I'm using these tools:

OpenGL 3.3
GLSL 330
C++

Problem

The problem is when I render the wavefront obj 3d model it gives a very weird visual glitch the model was supposed to be a square but instead its a triangluated mess with parts of the vertexes pointing in a stretched direction in massive amounts towards the bottom left side of the frustum....

Explanation:

I'm using std::vectors to store my wavefront .obj model data using sscanf to get the floating point values into the structure members x,y,z and store them into the Points structure variable p;

int index = IndexAssigner(1, 1);
ifstream file (list[index].c_str() );
points.push_back(Point());
Point p;
int face[4];

while (!file.eof() ) {
    char  modelbuffer[10000];
    file.getline(modelbuffer, 10000);
    switch(modelbuffer[0]) {
        case 'v' :
        sscanf(modelbuffer, "v %f %f %f",  &p.x, &p.y, &p.z);
        points.push_back(p);
        break;
        case 'f':
        sscanf(modelbuffer, "f %d %d %d %d", face, face+1, face+2,  face+3 );
        faces.push_back(face[0]);
        faces.push_back(face[1]);
        faces.push_back(face[2]);
        faces.push_back(face[3]);
    }
    //Turn on FileReader aka "RENDER CODE"
    FileReader = true;
}

then I render the Points vector using the .data() member of std::vectors to the frustum.

Other declarations:

int numfloats = 4;
float* point=reinterpret_cast<float*>(&points[0]);
int num_bytes=numfloats*sizeof(float);

Vector declarations:

struct Point {float x,  y , z; };
std::vector<int>faces;
std::vector<Point>points;

Render code:

glGenBuffers(1, &vertexbuffer);
glGenTextures(1, &ModelTexture);
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
glBindTexture(GL_TEXTURE_3D, ModelTexture);
glTexImage2D(GL_TEXTURE_2D, 0,GL_RGBA,  ModelSurface->w, ModelSurface->h, 0, GL_BGR, GL_UNSIGNED_BYTE, ModelSurface->pixels);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glBufferData(GL_ARRAY_BUFFER, sizeof(points), points.data(), GL_STATIC_DRAW);
glVertexAttribPointer(3, 3, GL_FLOAT, GL_FALSE,num_bytes ,points.data());
glEnableVertexAttribArray(3);

//Translation Process
GLfloat TranslationMatrix[] = {
        1.0, 0.0, 0.0, 0.0,
        0.0, 1.0, 0.0, 0.0,
        0.0, 0.0, 1.0, 1.0,
        0.0, 0.0, 0.0, 1.0
      };

//Send Translation Matrix up to the vertex shader
glUniformMatrix4fv(translation, 1, TRUE, TranslationMatrix);

glDrawElements( GL_QUADS, faces.size(), GL_UNSIGNED_INT,  faces.data());

I tried looking at what was causing this and went through every function every parameter ,etc looked at the man pages.

Then found out that it could be my glVertexAttribPointer.

Here are the man pages for glVertexAttribPointer

http://www.opengl.org/sdk/docs/man/xhtml/glVertexAttribPointer.xml

The last 2 parameters is my problem

How do I write those 2 last parameters do I try putting the data from Points into it?.

glVertexAttribPointer(3, 3, GL_FLOAT, GL_FALSE,num_bytes ,points.data());

How does it work with vectors?

Is it fast?*

if you can not be bothered too look at the man pages here is the scripts coming from the man pages directly.

Stride

Specifies the byte offset between consecutive generic vertex attributes. If stride is 0, the generic vertex attributes are understood to be tightly packed in the array. The initial value is 0.

Pointer

Specifies a pointer to the first component of the first generic vertex attribute in the array. The initial value is 0.

If you want my full source -> http://ideone.com/fPfkg

Thanks Again if you do read this.

sentences:
Fixed timestep game loop, why interpolation This is a very standard way of doing a fixed timestep game loop, where you just accumulate time from the previous frame and consume it in discrete steps with the physics engine:
    while ( accumulator >= dt )
    {
        previousState = currentState;
        integrate( currentState, t, dt );
        t += dt;
        accumulator -= dt;
    }

A lot of articles suggest that with the residual lag we should do an interpolation between the previous update and the current one, BUT it does not make any sense to me!
If you have residual lag it means that you still have some time to catch and you should EXTRAPOLATE the current state. Why would you ever do an interpolation with the previous state?

sentences:
Is it possible to make isometric game of 200 * 200 tiles per map in Unity? We made an isometric game in AndEngine. Now we want to convert this game into Unity. I am searching for tiles map support/plugin in Unity. I come across a plugin called Map and nav http://forum.unity3d.com/threads/138355-Tile-Based-Map-amp-Nav . but the problem is it only support 50*50 tiles per map. My map is 200 * 200 tiles. I want to know is there any plugin or way to acheive 200 * 200 tiles per map in Unity ?

Thanks

sentences: Conversion of a C++ library to DLL I'm developing an augmented reality application and I'm supposed to use the ALVAR library for AR marker detection. I use Unity as the game engine and unfortunately it doesn't support C++. Is there any possible way to use the C++ library as a DLL?

sentences:
Advice on how to store level design info? I'm building a 2D tile-based puzzle game in C#, using Monogame. The game board is an 8x6 grid of tiles, each of which can contain a number of objects. Conveniently, the number of possibilities for what each tile can contain fits nicely into 1 byte. I was wondering what the most sensible way to store level design data would be. I'd like it to be at least vaguely human-editable, as I need to construct a level or two while I build the game. Once I'm sure the game logic is all working and it's playable, I intend to build a level editor to construct the rest of the levels, but I need to build the first few manually.

Currently I'm tempted by the idea of encoding the levels in the colour data of an 8x6 pixel bitmap, but that's possibly overkill. Thoughts?

sentences:
Failed to spawn server object, Unity UNET I'm familiar with Unity and programming but I'm new to this site.

So I have an issue with clients on Unity. I start servers with no errors, flawless. But when I join a server as a client I get a bunch of the error mentioned in the title. What causes this issue? I am using the UNET networking components.

I think it's lines like these, when executed by a client:

    NetworkServer.Spawn (objectNameHere);

How can I fix it if that's the case?

Edit

After hours of having this issue I have become so frustrated that I think it's best I take a break. I'll check back on this site from time to time.

sentences:
Method keyTyped in ClickListener is not working When im click my SelectBox and press some key, nothing happens.

sbNationality.addListener(new ClickListener() {
    @Override
    public boolean keyTyped(InputEvent event, char character) {
        System.out.println(character);
        return super.keyTyped(event, character);
    }
});

Im doing something wrong?

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:
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:
Organizing an entity system with external component managers? I'm designing a game engine for a top-down multiplayer 2D shooter game, which I want to be reasonably reuseable for other top-down shooter games. At the moment I'm thinking about how something like an entity system in it should be designed. First I thought about this:

I have a class called EntityManager. It should implement a method called Update and another one called Draw. The reason for me separating Logic and Rendering is because then I can omit the Draw method if running a standalone server.

EntityManager owns a list of objects of type BaseEntity. Each entity owns a list of components such as EntityModel (the drawable representation of an entity), EntityNetworkInterface, and EntityPhysicalBody.

EntityManager also owns a list of component managers like EntityRenderManager, EntityNetworkManager and EntityPhysicsManager. Each component manager keeps references to the entity components. There are various reasons for moving this code out of the entity's own class and do it collectively instead. For example, I'm using an external physics library, Box2D, for the game. In Box2D, you first add the bodies and shapes to a world (owned by the EntityPhysicsManager in this case) and add collision callbacks (which would be dispatched to the entity object itself in my system). Then you run a function which simulates everything in the system. I find it hard to find a better solution to do this than doing it in an external component manager like this.

Entity creation is done like this:
EntityManager implements the method RegisterEntity(entityClass, factory) which registers how to create an entity of that class.
It also implements the method CreateEntity(entityClass) which would return an object of type BaseEntity.

Now comes my problem:
How would the reference to a component be registered to the component managers? I have no idea how I would reference the component managers from a factory/closure.

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

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

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

sentences:
How to properly looping movement of an object I would like to create an intelligent (universal) class to looping movement object, like sliding doors, etc.

I've thought to declare two vectors:

From
To

And a Speed variable.

Then looping. I don't know how to check when current position is >= then To and looping reverse, considering that you can have starting position (x or y or z) greater then arriving position.

Thanks

sentences:
How to deal with raw values and percentages? What is the standard practice for dealing with attribute modifiers in games where units have attributes, such as RTSs, MOBAs and RPGs? Specifically, in which order are "buffs" given to the unit?

Suppose the case where unit X has 10 blah-points (BP). It obtains two modifiers that add +10% blah-points, and another one that adds 30 blah-points. Finally, a enemy unit applies a -40% blah-points modifier. What is the usual way of processing this, for player familiarity's sake?

Aggregate by grouped type

  (10+30)*(1.0+0.1-0.4) = 28

Obtention order

  (10*(1.1)+30)*(0.6) = 24.6

Aggregate iteratively by type

  (10+30)*1.1*0.6 = 26.4

Some other way?

sentences:
Textures occasionally rendering twice on a particular face I am learning how to render 3D objects using webgl (no third-party libraries).

I am currently facing a very confusing situation however, where my textures are rendering apparently twice over a particular triangle, but only on some of the triangles.

I have added a screenshot of the problem, and was rather hoping some gl-ninja in here would be able to point me in the direction of my mistake:

As you can see, most of the textures are rendering fine, the cobble stones and most of the triangles of the crates, I hope it is clear enough, in the top-right triangle of the bottom left crate the system is showing 2 textures (1 incorrect, quite strong, the other correct, quite weak).

I don't really expect you to wave a wand and fix this (though that would be nice!) I'm just hoping that you recognise the symptoms and can point me in the right direction, either terms to use in Google, or areas in my code that I should give some more thorough scrutiny.

UPDATE:
I'm so thankful for your help!

Somehow my object had set itself to render as a trianglestrip, instead of a triangle list. I realise there's no way you could have seen that, just leaving this here in case some fellow coder is stuck on the same strange issue!

Been looking into this for days now... live and learn!

sentences:
Where can I learn about Substance maps for 3ds Max 2012? A new feature in 3ds max 2012 is Substance procedural textures.

Are there any good online libraries or resources for substance maps?

sentences: Where should I store textures for a game? I am currently creating a game in SFML using C++ and I'm wondering: what is good practise for a location for textures? Should I store it with my project? Or my executable? Or even in something like the Documents folder? What would be the most efficient when the game would theoretically be released, as it will not simply include the project but rather a compiled and build version of it?

sentences:
How can I reproduce the physics that we can see in Dawn of Titans? I'm working on a hobby RTS project and I want to implement collision physics between soldiers like in the mobile game Dawn of Titans.

Here is a video reference https://youtu.be/Fnpot2NeJl8?t=341

How can I achieve this?

sentences:
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:
Creating a vertexbuffer to define vertices arranged in a grid with the view for easy editing later I'm using the marching square algorithm (2D version of marching cubes) to generate vertices.

I end up with vertices arranged in a grid.

I want to enable destructible terrain, and the way i was planning on doing this was to start simple - have one vertex buffer with the whole map, and edit the bits that change. In cases where I need to remove vertices I was thinking about just making them transparent so I can still render the whole map in one go.

Firstly, is this approach reasonable?

Secondly, I want to design my VB so that if I need to change vertices in 3x3, 5x5 or 7x7 etc. grids the locations of the vertices in the VB are close together.

Now, from university I vaguely remember an image compression algorithm that walked the image in an unusual way, which i think could apply. Basically it walked in a U / horseshoe direction. It would place a U over the image, large enough to cover the whole thing, then it would break the U up into 4 quadrants, and use a smaller U to walk those, and so on until it got down to the pixel level, or in my case it got down to a single grid unit.

Does this sound feasible? What is that algorithm called? (I can't remember the name and haven't found via general searching).

sentences:
2D Rope with verlet and Semi-implicit Euler integration I'm trying to create 2D rope. Chain based solution is not working pretty well, so I'm looking for new approach. Every good looking rope implementation is based on verlet integration, but this method is not good for rigid body based system.
Is there any save method to combine these methods - ropes with verlet and rigid bodies with Euler?
Basic requirement for method I'm looking for is proper (or good enough) collision detection for both of simulated bodies.

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

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

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

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

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

sentences:
Xna custom mouse not allowing me to move its sprite past certain bounds I have written a Custom mouse, with a Custom sprite, using MouseState, and getting the X and Y variables. However i also have a camera that i wrote, and this allows me to leave the initial box. One sprite that can freely move this area, but my mouse gets stuck in a box that seems proportional to my screen resolution some times.

  //This is where i create the Texture, Vector and MouseState of the Custom Cursor
Texture2D Mouse_texture;
MouseState mouse_state;
Vector2 Mouse_pos;

  // This is my Resolution and i have IsFullScreen = true
graphics.PreferredBackBufferWidth = 1600;
graphics.PreferredBackBufferHeight = 900;

  // Loading the Texture
Mouse_texture = Content.Load<Texture2D>("mouse");

  // Getting the current mouse State this is in the update function
mouse_state = Mouse.GetState();

  // How i set the mouse position Simple Vector2 stuff and i never do anything else
  //   to handle the the position of the mouse
Mouse_pos = new Vector2(mouse_state.X, mouse_state.Y);

  // and this is me Drawing it
spriteBatch.Draw(Mouse_texture, Mouse_pos, Color.White);

If you need any more code let me know

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

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

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

Calculating the specular BRDF

I use the generic Fresnel Shlick eq:

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

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

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

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

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

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

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

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

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

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

sentences:
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 to link OpenGL with my own static library? My game project is split up into three parts:

Core (lib)
Editor (exe)
Game (exe)

I'm using OpenGL in both my Core and Game parts, but as soon as I try to call an OpenGL function in my Core library the application crashes.  I assume this is because the static library is not being linked with OpenGL.  The build process goes like this:

# core library
g++  -c  ... -std=c++0x -g  -o ... -I. -I.
ar rcus libCore.a ...

# game exe
g++ -o Game ... -L. -L../Core/Debug/   -lCore -lglew32 -lglfw -lopengl32

Where ... stands for the various files.  How can I link OpenGL with my static library?

sentences:
Do >2-state cellular automata exist? I'm trying to implement a zone system into my game that randomly sets chunks (the cells) to a certain value from a list and that would effect nearby chunks. It's basically a cellular automaton in which instead of the cells being on/off, they would have multiple options, like red/green/blue/yellow/brown or such.

Do this kind of cellular automata exist?

sentences:
XNA DepthBias increases performance even when EarlyZ is turned off. Why? My 3d scene consists of three main polygons:

The first and the second polygons overlap each other (have the same World matrix and use the same geometry), the third one is perpendicular to the first two and is positioned a few meters away from them. All three polygons are rendered with a forward shader that uses clip() function to do alpha cutoffs. As I read in a Radeon's article,
this causes EarlyZ test to be turned off and my simple subjective tests proved it: I had around 480 FPS when the second polygon's texture was empty (resulting in clip being called in every pixel) and dropping to 415 when it had a colorful for-section square in it (see the picture).

I did try to make sure that Z-test happens: I tried drawing the second polygon first while "rising" it above the ground (polygon #2) and thus bringing it closer to camera - it changed nothing. I also tried removing clip() function from the shader and recieved an FPS boost just as expected. But obviously this produced incorrect results as the ground underneath the second polygon was never drawn as it always failed the Z-Test. So I decided to try using DepthBias to be able to draw two polygons one over another and have no depth-fighting. This is what MSDN writes about it:

  Sets or retrieves the depth bias for polygons, which is the amount of
  bias to apply to the depth of a primitive to alleviate depth testing
  problems for primitives of similar depth. The default value is 0.

  Property Value The amount of bias to apply to the depth of a
  primitive. The value ranges from 0 to 16 (inclusive).

When I finally managed to make it work, I surprisingly got a performance boost. Now the thing is I even managed to gain FPS applying it to the third polygon! This is how I render them to gain the best performance:

GraphicsDevice.RasterizerState = CCWLayer1;
DrawSecond(gameTime);
GraphicsDevice.RasterizerState = CCWLayer2;
DrawThird(gameTime);
GraphicsDevice.RasterizerState = CCWLayer3;
DrawFirst(gameTime);

public RasterizerState CCWLayer1 = new RasterizerState()
{
    CullMode = CullMode.CullCounterClockwiseFace,
    DepthBias = 0.005f,
};

public RasterizerState CCWLayer2 = new RasterizerState()
{
    CullMode = CullMode.CullCounterClockwiseFace,
    DepthBias = 1,
};

public RasterizerState CCWLayer3 = new RasterizerState()
{
    CullMode = CullMode.CullCounterClockwiseFace,
    DepthBias = 0.015f,
};

I now 525 FPS and it only drops down to 515 when I draw the huge colored square on the second polygon, which clearly shows that only one set of pixels is being drawn at a time in that particular place (which is similar to EarlyZ test!).

So here is the question: can anyone explain to me what is going on? If I could understand this system better I could make more use of it and gain even more FPS.

Update: now I only draw the two polygons (no other geometry), both using clip(), the one with the colored quad (second) is always closer to the camera. With this code:

DrawSecond(gameTime);
DrawFirst(gameTime);

I get 1.5 ms per frame. With this:

GraphicsDevice.RasterizerState = CCWLayer1;
DrawSecond(gameTime);
GraphicsDevice.RasterizerState = CCWLayer2;
DrawFirst(gameTime);

public RasterizerState CCWLayer1 = new RasterizerState()
{
    CullMode = CullMode.CullCounterClockwiseFace,
    DepthBias = 0.03f,
};

public RasterizerState CCWLayer2 = new RasterizerState()
{
    CullMode = CullMode.CullCounterClockwiseFace,
    DepthBias = 0.045f,
};

I get 1.2 ms.

NO BIAS:

BIAS APPLIED:

sentences:
How to sort tiled decal list? I have a tiled forward render pipeline (also called forward+). It assigns a list of lights for every 16*16 block of pixels (tiles) on the screen. Lights are accumulated additively so their order doesn't matter inside the list.

The problem comes when I add decals to the light list. Decals need to be evaluated before the lights (because they can modify surface properties), and even their order among themselves matter because their texture is alpha blended on top of each other.

Because the lights and decals are culled in parallel, and added to the list by keeping a shared pointer to the end of the list which is incremented atomically when a light is added, the order of them can not be guaranteed. This is how I add a light to the tile's light list from a thread:

// I have a [numthreads(16,16,1)] thread group
for (uint i = groupIndex; i < g_nNumLights; i += 16 * 16)
{
  Light light = GlobalLightArray[i];
  if(IsLightVisible(light))
  {
    uint index;
    InterlockedAdd(LightCount, 1, index); // LightCount is a groupshared uint (the whole threadgroup can see it)
    LightArray[index] = i; // A light is always added to the back of the per tile light array
  }
}

I thought I should try to sort the light list after the culling and the creation of the list has ended, but I have no experience with highly parallel sorting algorithms. I however came across a nice presentation: Holy smoke! Faster Particle Rendering using Direct Compute by Gareth Thomas
. From the 8th slide it has a brief explanation of the bitonic sort algorithm with pseudocode and nice pictures. I get the idea, but I have no idea how to implement it or if it could be even done efficiently for my case because my light list is variable in size for each tile. Maybe it could be done in the same dispatch when the culling occurs, on this array (which hold a variable amount of light indices <= 1024):

groupshared uint LightArray[1024]

I have also seen a DirectX11 example of the algorithm of this kind of sorting, but on a different kind of dataset and across multiple dispatches and other post-processing transposing which is not clear to me at all.

Or maybe there is a completely different approach that I should take which doesn't involve sorting? Maybe when adding lights to the back of the array, the order of addition could be enforced somehow?

I have also learnt that the new Doom game also renders its decals this way.

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: 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:
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:
Apple App Store: Publish your game under your organization name I am in the process of building a mobile game targeting Apple App Store. This is a co-op work done by me and my teammate. We do not want to publish the game under my personal Apple developer account, but rather use our fantasy org name (let's call it a game dev studio).

Is there a way of doing this without going through the hassle of founding a company? Do I need to get another Apple account type (other than individual person)?

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:
Assigning values on multiple clients in UE4 I am currently working on a multiplayer game and I am having difficulties on assigning values on variables for each clients. Originally I looped through available clients character from HUD then assigned the calculated the value but I decided to do it inside character blueprint's instead.
I don't know why only first clients gets the calculated values but the other client still having the default value.
This is the initial value that I assigned from inside Character C++
MaxHealth = 500;
Health = MaxHealth;

This is how I assigned the value from the Blueprint.

Set Initial Attributes is where I calculated the Health value based on player's Strength value etc and the reason I'm doing this is because I am planning to retrieve the stats from the datatable in the future. But I don't know why it becomes like this instead.
This is the correct final value that supposedly assigned on both clients.

But only first client gets the correct value, not second client.

I don't want to use loop to search the player characters' inside player character's blueprint and assigned the value because I don't think it's a wise move so I am looking for a better alternative if any. Thanks!

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:
Question of tilesheet efficiency For a 2d side scrolling game made in Java, should I make a sprite sheet for my character walking left and for walking right, or should I just do the one, and flip it when it loads?

Also, the way I've been doing it, both left and right would be in the same image file, if that makes any difference.

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:
Terminology in a hierarchy of levels My game has a 2-tier hierarchy of levels, it is composed of 6 or more "outer levels" that consist of 8 or more "inner levels". Reaching an inner level unlocks the next inner level. Reaching the top inner level of an outer level unlocks the next outer level. The first inner levels of an outer level resemble the inner levels of the previous outer level, but each outer level has more inner levels than its predecessor.

What terms are common to refer to "outer levels" and "inner levels" in such a situation? The game is very abstract, so something like "world" for the outer level would be inappropriate.

sentences:
How to make more jagged terrain I need some help with some terrain I'm working on. I'm developing a plugin for Minecraft, but these concepts will apply to any game with terrain. I am using Simplex noise to generate cavern-like terrain. I am using the power of the noise to generate hills that look like this:

As you can probably tell, it inst looking very cavern-like. What can I do to improve this terrain?

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:
Box Collider center relative to GameObject I'm trying to get the distance from the BoxCollider center of a gameobject to the bottom of that same BoxCollider. Note that the center of the collider is slighty modified.

So far, I have:

float halfHeightCollider = (bounds.size.y / 2);

I tried the following to take care of the slight modification:

float halfHeightCollider = bounds.center.y + (bounds.size.y / 2);

But seems like bounds.center give me the position of the center of the BoxCollider in the world, not relative to the gameobject, like in the inspector:

That value is the one I want. How can I get it?

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:
A* Pathfiding movement is not stopping and constant I'm trying to make my player move towards mouse click using A* Pathfinding but I'm having some odd issues that I can't solve.
One of the issues is that player is moving a little bit even though it arrives at the position of the other transform

The second one is that the force is that is applied to the player is not constant, I would like it to keep always the same movement speed. I've tried to change to use transform.Translate to move the player with constant movement speed but it makes the movement to be like walk a little then stop, walk a little then stop...

This is the code that I'm using
using System;
using System.Collections;
using System.Collections.Generic;
using Pathfinding;
using UnityEngine;
using UnityEngine.UI;

public class Player : MonoBehaviour
{

    [SerializeField] private float speed = 100;
    [SerializeField] private Text lifeText;
    [SerializeField] private int life;
    [SerializeField] private GameObject target;
    [SerializeField] private float nextWaypointDistance = 3f;

    //AI configurations
    private Path path;
    private Rigidbody2D rigidbody;
    private Seeker seeker;
    private int currentWaypoint = 0;
    private bool reachedEndOfPath = false;

    // Start is called before the first frame update
    void Start()
    {
        seeker = GetComponent<Seeker>();
        rigidbody = GetComponent<Rigidbody2D>();

        InvokeRepeating("UpdatePath", 0f, .2f);
    }

    // Update is called once per frame
    void Update()
    {
        lifeText.text = "Vida: " + life.ToString();

        if (Input.GetMouseButtonDown(1)) //right click
        {
            Vector2 mousePos = Input.mousePosition;
            Vector2 worldPos = Camera.main.ScreenToWorldPoint(mousePos);
            target.transform.position = worldPos;
        }
    }

    private void UpdatePath()
    {
        if (seeker.IsDone())
            seeker.StartPath(rigidbody.position, target.transform.position, OnPathComplete);
    }

    void FixedUpdate()
    {
        if (path == null) return;

        if (currentWaypoint >= path.vectorPath.Count)
        {
            reachedEndOfPath = true;
            return;
        }
        else
        {
            reachedEndOfPath = false;
        }

        Vector3 direction = (path.vectorPath[currentWaypoint] - (Vector3)rigidbody.position).normalized;

        Vector3 force = direction * speed * Time.deltaTime;

        rigidbody.AddForce(force);

        float distance = Vector2.Distance(rigidbody.position, path.vectorPath[currentWaypoint]);

        if (distance < nextWaypointDistance)
        {
            currentWaypoint++;
        }
    }

    private void OnPathComplete(Path p)
    {
        if (!p.error)
        {
            path = p;
            currentWaypoint = 0;
        }
    }

}

What I want to is to make the movement smoother and with constant movement speed.
Can you guys help me?

sentences:
Workaround for reading and writing same texture? To apply post effects, it is often needed to read the preliminary image, perform computations on its pixels and store the result in the same texture again. For example, think of a tone mapping or desaturation effect. The input and output should be the same texture, but this isn't allowed by OpenGL.

Therefore, what is a good workaround?

One idea I came up with but which isn't very satisfying is to have two image textures and automatically use them alternating. Also keeping track of which is the newer one to finally display it on the screen.

sentences:
Display a Message Box over a Full Screen DirectX application In our custom assertion handler, I'd like to display a message box asking to see whether or not this failure can be ignored.  However, when our DirectX game is full screen, I can't get the MessageBox function to display above the full screen.

Note: The first parameter to MessageBox is the the HWND used to create the device, and it still does not work.

Is this even possible?

sentences:
How can I allow players to draw decals for their avatar and items? I want the player to be able to draw a simple symbol, even if it's pixelated black or white, that their character can have on their weapons, armour, forehead or even markers and monuments. How would I go about that, if I want to do it?  Better if the suggestion is C#/Unity-specific.

PS: The game would be a turn-based, square grid RPG, maybe somewhat like Dofus, but it should probably be in 3D to allow for more flexibility.

sentences:
OpenGL ES 2.0: Moving Camera in Orthogonal (2D) Projection I have quite large 2D game scene. The scene is much larger than the screen of the LCD. Therefore, I have to move the camera (view) in desired directions, to display particular parts of the scene.

What is the correct way of moving viewport over the scene, in Orthogonal (2D) projection, please?

There are two solutions coming to my mind:

Using GluLookAt(), which is designed to move camera moslty in Perspective Projection, but it could work well for 2D as well. However, not all of the GluLookAt() parameters would be utilized in Ortho configuration.
Using opposite View Translate transformation. This would mean, if I need to move my 2D camera 10 units to the right(positive x axis), I would apply opposite Translate transformation to every scene vertex (negative x axis). This way, I would create illusion, the camera moves to the right.

These are the solutions coming from my mind. However, because, i am self taught, is there any correct and recommended way of moving camera over the 2D scene, please?

sentences:
Locust Swarm algorithm for path finding (devour and move on) I need to model a locust swarm that devour food stacks and move on to next stacks. I searched for articles and found few articles. These papers is about optimization applications but I want to convert it to a path finding algorithm to reach multiple targets (like randomly seeded many food stack). Swarm should split when food stack is not enough to feed them( multiple objective problem). How can I do this?

x: position
v: velocity vector

sentences:
2d stealth-type collision I'm curious as to how stealth games work. I am working with 2d right now to get the hang of it, and so far I have come up with the following ideas.

create a bounding circle around the player/enemy
if the circle comes in contact with and object, let's say a crate, shoot out rays 360 degrees.
if the ray contacts the player/enemy, trigger something saying you have been found.
if the ray contacts the crate, the ray will never hit the player, thus making him "hidden" to the enemy

Naturally, there will be some kind of crazy vector math involved in this. What I am wondering is if this is the right way to go about doing this? Is having rays being shot out every second or half-a-second something that's feasible and won't slow down the program drastically?

sentences:
Godot doesn't loop the sound Basically it's the sound of a fuse for a bomb, until the timer sends the signal the sound should stop playing and play the explosion sound, but right now only plays once and the stop.
What i did wrong/ what i did missed?
the code i use for the bomb scene:
extends StaticBody2D

func _ready():
    $AnimatedSprite.animation = "bomb"
    $CollisionShape2D.disabled = true
    $BombTimer.start()
    $FuseSound.play()

func _on_BombTimer_timeout():
    $AnimatedSprite.animation = "explosion"
    $CollisionShape2D.disabled = false
    $RemoveTimer.start()
    $ExplosionSound.play()

func _on_RemoveTimer_timeout():
    queue_free()

func _on_Bomb_body_entered(body):
    print("bomb collided with:" + body.get_name())

sentences:
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:
Rigidbody player controller on moving platforms So basically, I was trying to make moving platforms. When I finished my prototype, I noticed that the movement on the platform is very wobbly:
https://www.youtube.com/watch?v=hmBumsrlHGA&feature=emb_logo
To snap the player onto the platform, I am just making it a child of the platform. Anyway, I don't know what is causing this issue and was wondering if I can get any help. Thank you in advance
Here, the controller code:
private void Movement()
    {
        //Extra gravity
        rb.AddForce(Vector3.down * Time.deltaTime * 10);

        //Find actual velocity relative to where player is looking
        Vector2 mag = FindVelRelativeToLook();
        float xMag = mag.x, yMag = mag.y;

        //Counteract sliding and sloppy movement
        CounterMovement(x, y, mag);

        //If holding jump && ready to jump, then jump
        if (readyToJump && jumping) Jump();

        //Set max speed
        float maxSpeed = this.maxSpeed;
        if (sprinting)
        {
            this.maxSpeed = 25;
        }
        else
        {
            this.maxSpeed = 15;
        }

        if(sprinting && y < 0)
        {
            this.maxSpeed = 15;
        }

        //If sliding down a ramp, add force down so player stays grounded and also builds speed
        if (crouching && grounded && readyToJump)
        {
            rb.AddForce(Vector3.down * Time.deltaTime * 3000);
            return;
        }

        //If speed is larger than maxspeed, cancel out the input so you don't go over max speed
        if (x > 0 && xMag > maxSpeed) x = 0;
        if (x < 0 && xMag < -maxSpeed) x = 0;
        if (y > 0 && yMag > maxSpeed) y = 0;
        if (y < 0 && yMag < -maxSpeed) y = 0;

        //Some multipliers
        float multiplier = 1f, multiplierV = 1f;

        // Movement in air
        if (!grounded)
        {
            multiplier = 0.5f;
            multiplierV = 0.5f;
        }

        // Movement while sliding
        //if (grounded && crouching) { multiplierV = 0.5f; multiplier = 0.5f; }

        //Apply forces to move player
        rb.AddForce(orientation.transform.forward * y * moveSpeed * Time.deltaTime * multiplier * multiplierV);
        rb.AddForce(orientation.transform.right * x * moveSpeed * Time.deltaTime * multiplier);
    }

sentences:
Finding asset files in Linux games What is the usual method of storing 3D models, textures, sounds and scripts (e.g. Lua files) during development and in a release? I am developing a game with my friends in mainly C++; in the prototyping phase we only had a single texture that was saved as a C header with the GIMP, but of course, this approach does not scale well and increases compilation times greatly.

Under Windows, the usual practice is to just dump them to the %PROGRAMFILES% subdirectory in which the game executable resides, perhaps arranging them in an appropriate tree structure. However, on Linux the picture seems a lot more complicated. The executable usually resides in /usr/bin, whereas applications store their other files in /usr/share, and I think it would be an extremely bad practice to put non-executables in /usr/bin. However, the directory structure during development is totally different.

I could come up with two different possible solutions:

Let the executable find the asset files relative to itself, and install the game to /opt. Then place symlinks to /usr/bin. During development, the relative path of the assets to the binaries is the same as during deployment.
Access the files with an absolute path which is defined as a preprocessor symbol. Let the build process (in our case, raw Makefiles) take care of defining it as it is fit.

Both approaches seem somewhat inelegant to me in one aspect or another. Is there a common practice in the game development industry about this?

The only relevant questions I could find were Determining the location of installed/on disk game assets  and Directory paths for resources and assets, but those did not address the problem of running "from the source tree".

sentences:
Time passing display on UI in Unity in C# How can I display the time and how many days on a UI in Unity. Time would be moving faster like a week in 7 minutes?

Should I use Time.deltaTime and how do I excellerate the time it displays?

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:
How to correctly instantiate prefab in Unity I made a prefab and drag drop it to the Tile Prefab slot as shown in the picture

In my code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GameGrid :MonoBehaviour
{
    private int width;
    private int height;
    private int[,] gridArray;
    private float cellSize;

    [SerializeField]
    GameObject tilePrefab;// = default;

    public GameGrid(int width, int height, float cellSize)
    {
        this.width = width;
        this.height = height;
        this.cellSize = cellSize;

        gridArray = new int[width, height];

        Debug.Log(width + " " + height);

        for(int x = 0; x < gridArray.GetLength(0); x++)
        {
            for(int z = 0; z < gridArray.GetLength(1); z++)
            {

                GameObject tile =Instantiate(tilePrefab);
                tile.transform.SetParent(transform, false);
                tile.transform.localPosition = GetWorldPosition(x,z);
            }
        }
    }

    private Vector3 GetWorldPosition(int x, int z, int y = 0)
    {
        return new Vector3(x, 0, z) * cellSize;
    }

}

1.It throw out error, ArgumentException: The Object you want to instantiate is null, it is very strange because I have the Prefab assigned in the inspector, what could ran wrong, and it is strange that the console did not tell me which line is wrong.
2.Another error is "You are trying to create a MonoBehaviour using the 'new' keyword.  This is not allowed", it confused me because I did not new anything.
3.This line of code "tile.transform.SetParent(transform, false);" I copied from other resource which I do not fully understand, I looked to the Unity menu still did not get any idea of what it does, it setParent but what parent property this function tries to setup, is it trying to set its parent's transform or what?
Thanks very much I'm still new to Unity.
EDIT:
Here is my testing.cs
public class Testing : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        GameGrid grid = new GameGrid(20, 10, 1);
    }
}

1.Remove the default assignment is not working either.
2.Regarding to the setParent, I do not have a parent, then what parent this child is attached to, if this function will instantiate a parent, then no information is provided to the creation of the parent, still confused.

sentences:
How to determine what triangle in a mesh the cursor is pointing to? I have a game I'm working on in which items are "placed" and "selected".

In order to do this, I need to determine what triangle in a mesh the cursor is pointing to.  I have no trouble with getting the cursor position or the orientation/position of the camera - the problem is figuring out how they relate.

I'm guessing that this involves ray-picking, but I have no idea on how to convert a cursor position to a ray that I can test for intersection with a triangle.

A little bit of background:
Game engine: Irrlicht
Language: C++

sentences:
Need some help with Unity 2d animation controller So my animations don't transition right. I have a 2d top down prototype project and animations for 4 directional movement and an idle position. Right now i have the movement set up so the right animation activates when the player moves in one of 4 directions. problem is that the walking animation does not stop when the player stops, it doesn't transition over to the idle animation.

My animation controller looks like this:

The parameter between the animations are an integer that signals which direction needs to play, from 0 to 3. I have been messing around with a speed float parameter, but I don't really know how to get it to work.

if (Input.GetKey (KeyCode.D))
        {
            GetComponent<Rigidbody2D>().velocity = new Vector2(moveSpeed,GetComponent<Rigidbody2D>().velocity.y);
            animator.SetInteger("Direction", 2);
            animator.SetFloat("MoveSpeed", 0);
        }

        if (Input.GetKey(KeyCode.A))
        {
            GetComponent<Rigidbody2D>().velocity = new Vector2(-moveSpeed, GetComponent<Rigidbody2D>().velocity.y);
            animator.SetInteger("Direction", 0);
            animator.SetFloat("MoveSpeed", 0);
        }

        if (Input.GetKey(KeyCode.W))
        {
            GetComponent<Rigidbody2D>().velocity = new Vector2(GetComponent<Rigidbody2D>().velocity.x, moveSpeed);
            animator.SetInteger("Direction", 1);
            animator.SetFloat("MoveSpeed", 0);
        }

        if (Input.GetKey(KeyCode.S))
        {
            GetComponent<Rigidbody2D>().velocity = new Vector2(GetComponent<Rigidbody2D>().velocity.x, -moveSpeed);
            animator.SetInteger("Direction", 3);
            animator.SetFloat("MoveSpeed", 0);
        }

Here is my movement code if it helps.

If I'm missing something important that you need to help me, please tell me.

sentences:
What are some ways to prevent or reduce cheating in online multiplayer games? Punkbuster exists just to prevent cheating, and yet cheating is common in punkbuster enabled games. Modern Warefare 2 is seriously locked down from the end user running their own server or making any mods, and cheating happens constantly.

For a multiplayer game where each client is running on a PC, what can be done to reduce or eliminate cheating?

sentences:
Writing a leather shader I'm trying to write a leather material shader. I have a normal map, bump map (grayscaled), specular map, diffuse map, cube maps.

I have done the following

#version 100

precision highp int;
precision highp float;

uniform sampler2D diffuseColorMap;
uniform sampler2D ambientOcclusionMap;
uniform sampler2D normalMap;
uniform sampler2D specularMap;
uniform sampler2D bumpMap;
uniform samplerCube envMap;

varying vec2 texCoord[2];
varying vec3 viewWorld;
uniform float reflectionFactor;
uniform float diffuseFactor;
uniform float opacity;
varying vec3 eyeVector;
varying mat3 world2Tangent;
varying vec3 lightVec;
varying vec3 halfVec;
varying vec3 eyeVec;

void main()
{
    vec3 normal = 2.0 * texture2D (normalMap, texCoord[0]).rgb - 1.0;
    normal = normalize (normal);

    // compute diffuse lighting
    float lamberFactor= max (dot (vec3(0.0,0.0,1.0), normal), 0.1) ;

    vec3 bumpNormal = texture2D(bumpMap, texCoord[0]).rgb;

    vec3 normalWorld = normalize(world2Tangent * bumpNormal);
    vec3 refDir = viewWorld - 2.0 * dot(viewWorld,normalWorld) * normalWorld;

    vec4 diffuseMaterial = texture2D (diffuseColorMap, texCoord[0]);
    vec4 diffuseLight  =  vec4(1.0,1.0,1.0,1.0);

    // In doom3, specular value comes from a texture
    vec4 specularMaterial =  texture2D (specularMap, texCoord[0])  ;
    vec4 specularLight = vec4(1.0,1.0,1.0,1.0);
    float shininess = pow (max (dot (halfVec, normal), 0.0), 2.0)  ;
    vec4 reflection = textureCube(envMap, refDir);

    gl_FragColor=diffuseMaterial * diffuseLight * lamberFactor ;
    gl_FragColor+=specularMaterial * specularLight * shininess ;
    gl_FragColor+= reflection*0.3;
 }

The result is shown:

My question is how would I use the bump map (Grayscale) to the result of the reflection or what's wrong in my shader ?

sentences:
Pathfinding with Less Desirable Squares that are still passable I have been looking at different path-finding algorithms for my game. I have almost settled upon D* Lite, but have a question. (perhaps I missed it in the documentation) -
Are there any algorithms, D* included, that allow for squares that are less desirable to pass over, but still possible, should there be no other way? I believe that I saw this in A* but I believe that I need it dynamic, as I will be having objects placed and removed from the map.

UPDATE: Is it possible to have levels of undesirable squares? Eg. Some still arent desirable, but are better than really undesirable ones

sentences:
Pixel Animation is tearing in Unity I am working on a 2D game and I have created a simple sprite sheet. The sprite sheet represents a medkit. The size of the sprite sheet is 128x16 pixels with 8 different frames that animate the medkit bobbing up and down.

I have imported the sprite sheet into Unity as a Sprite with Sprite Mode set to multiple, Generate Mip Maps unchecked, Filter Mode set to Point, and Format set to Truecolor. I have sliced the sprite sheet using the Unity Sprite Editor and added the animation to my scene.

After doing so, I am able to see my sprite in my game. However I noticed that the animation of the sprite did not correspond to the sprite sheet. Some pixels seem to be distorted and tearing. I have searched online and couldn't find anyone with the issue I had. As you can see from the gif below, the top of the sprite is tearing.

Does anyone know what is causing this issue?

Gif of the issue:here

Sprite sheet used:

sentences:
Using deltaTime and Frame Rate Independence I'm working on one of my first games and I've read that linking your game logic to FPS is bad because it will run differently at different FPS (obviously).
I have already made some of the basic game dependent on frame rate and now that I know this, I would like to unlink the logic and render. I've learned that LibGdx has deltaTime in its render method for this, however I believe I'm misunderstanding how I am to use it.

For example, my movement currently looks something like this:

if (rightKeyisPressed)
    setVelocityX(movementSpeeD)
playerPos.add(getVelocity)

In my case, I would like the player to move 6 units per second. Since I built this on 60 fps, that means that movementSpeed is 0.1. Now the way I have seen deltaTime used is by scaling the movementSpeed based on the time like this:

setVelocityX(movementSpeed * deltaTime)

However, now I move very slow because delteTime is a very small number. How can I make movement still the same speed without depending on the fps?
Sorry if I'm missing something obvious, I just can't seem to wrap my head around this.

sentences:
How many polygons count are reasonable for an Android mobile game ? I'm trying to develop a mobile game but I'm facing issue regarding FPS.
So my question is: 2016/2017 smartphone hardware, how many polygon counts are reasonable ?

Thanks

sentences:
How to rotate multi-tile structure on grid? I need to be able to place structures in my game that span multiple tiles and can also be rotated.
My idea on how to solve this would be to use 2D arrays that hold data about the structure.
EXAMPLE: (simplified)
Crafting table layout: XOX
X - data
O - data, but also used as a pivot point
If we were to rotate it clockwise, it'd look like this:
X
O
X

My problem lies in that these positions have to be real-world coordinates, so here's the above example again but in a way that makes sense for my actual grid in-game. (replacing the X and O with coords):
(0,1)(1,1)(2,1)

And now, rotated clockwise (around the pivot point, which is (1,1)):
(1,2)
(1,1)
(1,0)

Another example purely for more information, but more complex (2x3 array):
Complex workstation ((6,4) IS THE PIVOT!):
(5,5)(6,5)(7,5)
(5,4)(6,4)(7,4)

Rotate it counterclockwise and we should get this:
(5,5)(6,5)
(5,4)(6,4)
(5,3)(6,3)

I have tried and succeeded in doing it only on a conceptual level with the "X" and "O"s, but I don't know how to implement actual coordinates.
I've never dealt with rotation matrices before so any advice, suggestion or solution on how to implement this is appreciated.

sentences:
What can I do to ensure that everyone can run my OpenGL game? I am currently learning OpenGL from here. That website teaches OpenGl 3.3 with GLSL 3.3 and says that it is best to learn those because they are well supported and that older versions work in a less efficient way.

So far, this has been going well, but, when I tried to get my OpenGl programs to run on my laptop with Intel HD Graphics 3000, I ran into issues with the lack of GLSL 3.3 support (glGetShaderiv() and such claim that GLSL 3.3 is unavailable. When I ignore these errors, anything beyond the background color isn't rendered).

I am learning OpenGl in order to create a video game for which my target market will contain many older non-gaming computers (in addition to users with brand-new GTX 1080s). It wouldn't surprise me if a few users were still on Windows XP. It is essential that I make sure that everyone can run my game without buying extra hardware. It is equally essential that it looks good on hardware that can support it. What single, non-deprecated graphics API is available on all hardware (using software emulation if needed) along with Windows, Mac, and Linux?

If no single such API is available, what can I do to ensure that my game will work properly everywhere while also taking advantage of new features when available without learning multiple APIs? I would strongly prefer to stay close to the hardware by avoiding higher level APIs such as Ogre3D. If to do this I need to learn multiple APIs, then, what are those and why hasn't the industry standardized this by creating an API then releasing drivers for old hardware?

Some possible solutions are:

A well-enough-performing software implementation of OpenGL 3.3 along with GLSL 3.3
A OpenGL 3.3 implementation that uses OpenGL 1.0 in the background that can be easily swapped out automatically at runtime if newer versions aren't directly available.
A simple to use older version of GLSL that allows me to load separate shaders as needed.

sentences:
2D day night mapping I'm looking for this kind of effect MINUS the lights and snow (Another problem).

It needs to change depending on the time of year.
Doesn't need snow or city lights.

Now I'm pretty new to shaders (learnt them yesterday in my spare time) but so far I have achieved:

This moves across the screen display light on both sides.

Now I'm completely lost, as to how I can make it seem like a light map I.E. it needs to be more square/sharper (As it's going off the edges) & have the bottom and top times of year.. I though maybe I could pass sphere mesh to the vertex? Or do something with the map-normal. Or maybe use blending with two textures but I've looked around and it looks extremely difficult.

Code I have so far:

Fragment / Pixel shader:

    //attributes from vertex shader
varying vec4 vColor;
varying vec2 vTexCoord;

//our texture samplers
uniform sampler2D u_texture;   //diffuse map
uniform sampler2D u_normals;   //normal map

//values used for shading algorithm...
uniform vec2 Resolution;      //resolution of screen
uniform vec3 LightPos;        //light position, normalized
uniform vec4 LightColor;      //light RGBA -- alpha is intensity
uniform vec4 AmbientColor;    //ambient RGBA -- alpha is intensity
uniform vec3 Falloff;         //attenuation coefficients
uniform float lightX;         //X Position of light. Can also feed Y for times of the year.

void main()
{
    //RGBA of our diffuse color
    vec4 DiffuseColor = texture2D(u_texture, vTexCoord);

    //RGB of our normal map
    vec3 NormalMap = texture2D(u_normals, vTexCoord).rgb;

    int numberOfLights = 3;
    vec3 lightPoses[3];
    vec3 lightDirections[3];
    //LightX goes to 0, then back to 1.
    lightPoses[0] = vec3(lightX - 1.0, LightPos.y, LightPos.z);
    lightPoses[1] = vec3(lightX, LightPos.y, LightPos.z);
    lightPoses[2] = vec3(lightX + 1.0, LightPos.y, LightPos.z);

    //TODO Introduce one extra light for top and bottom. OR Figure out how to squash the Y.
    //TODO Needs to be sharper light.

    vec3 Sum = vec3(0.0);

    //Go though both lights.
    for(int index=0; index < numberOfLights; index++)
    {
        //The delta position of light
        vec3 LightDir = vec3(lightPoses[index].xy - (gl_FragCoord.xy / Resolution.xy), LightPos.z);

        //Correct for aspect ratio
        LightDir.x = LightDir.x * (Resolution.x / Resolution.y);

        //Make it bigger. (smaller the value the bigger.)
        LightDir *= vec3(0.55, 0.4, 1.0);

        //Determine distance (used for attenuation) BEFORE we normalize our LightDir
        float D = length(LightDir);

        //normalize our vectors
        vec3 N = normalize(NormalMap * 2.0 - 1.0);
        vec3 L = normalize(LightDir);

        //Pre-multiply light color with intensity
        //Then perform "N dot L" to determine our diffuse term
        vec3 Diffuse = (LightColor.rgb * LightColor.a) * max(dot(N, L), 0.0);

        //pre-multiply ambient color with intensity
        vec3 Ambient = AmbientColor.rgb * AmbientColor.a;
        //Because there are more lights, take off total ambient power.
        Ambient *= vec3(1.0 / float(numberOfLights));

        //Calculate attenuation (The amount of fade the light has.)
        float Attenuation = 1.0 / (Falloff.x + (Falloff.y*D) + (Falloff.z*D*D));

        //the calculation which brings it all together
        vec3 Intensity = Ambient + Diffuse * Attenuation;

        vec3 FinalColor = DiffuseColor.rgb * Intensity;

        Sum += FinalColor;
    }

    gl_FragColor = vec4(Sum, DiffuseColor.a);
}

Vertex Shader:

//combined projection and view matrix
uniform mat4 u_projTrans;

//"in" attributes from our SpriteBatch
attribute vec4 a_position;
attribute vec4 a_color;
attribute vec2 a_texCoord0;

//"out" varyings to our fragment shader
varying vec4 vColor;
varying vec2 vTexCoord;

void main() {
    vColor = a_color;
    vTexCoord = a_texCoord0;
    gl_Position = u_projTrans * a_position;
}

sentences: How to 9 slice meshes? So let us assume I have a 3D model of a window and I would like to stretch it like a 9 sliced sprite. How would you go by doing 9 slice on meshes? All I found online was about quads. What about more complicated meshes?

sentences:
Unity3d : Make prefab follow raycast hit I've been trying to make a weapon script which fires a projectile (prefab) straight forward.I added to the bullet the first script shown here.And the second one to the main camera.The problem is that the gun doesn't shoot straight forward.I mean it shoots straight but in small distances it looks...crap.How can I make it so it follows the hit point of the raycast.I placed my attempt below.

Script 1:

var bulletSpeed : float = 20;

function Update ()
{
    transform.Translate(Vector3.forward * bulletSpeed * Time.deltaTime);
}

Script 2 :

var hit : RaycastHit;
    var forward = transform.TransformDirection(Vector3.forward);

    if(Physics.Raycast(transform.position, forward, hit, rayLength))
    {

    if(Input.GetButtonDown("Fire1") && canShoot==true && clip > 0)
    {
        var rocketInstance : Transform;
        rocketInstance = Instantiate(rocketPrefab, barrelEnd.position, transform.rotation);
        rocketPrefab.LookAt(hit.point);
        w();
        gun.animation.Play("Shoot");
        audio.PlayOneShot(soundEffect);
        clip -= 1;
    }
}

Thank you for your time,please help me!

sentences:
Why Godot over Cryengine, UE4, Armory3d or Unity3d? Godot have a low performance in linux systems and lack of functionalities? This appear not been in account when peoples vote for him over other engines and i wonther whi.
I know it is under MIT lisence, but the others engines have a very permisive licences and in some cases they help you with funding for your games.
I ask this because i have maded survey on google plus about a selection of engines, and people still bote for godot over other engines. I want to select an engine for my future games, and when i compared, godot's not get a good place.

sentences: Godot play video after file load I used WebM video in my game but it's lagging. The audio is few secs delayed then video. Is there any way to load the video first then play so that the lagging doesn't occurs

sentences: What is dead reckoning and how do you deal with it? I've come across this problem before and it would be good to know the different ways of solving this problem.

sentences:
Unity Pixel Perfect Camera - Adjusting the Viewport Rect? I am trying to make a pixel perfect Tetris style game.
I have the pixel perfect component attached and have tried playing with settings such as Crop Frame and Stretch Fill. It seems to override any setting made to the 'Viewport Rect'.
The problem here is I want to control where the play-area is shown on the screen. For example I want the single player game to be somewhere near centre (although preferrably slightly off to the left). But when they play 2-Player mode I want the P1 playarea to be near left, and P2 area at the right.
The screens below shows some of the settings I tried. The 3rd screen shot shows the play area approaching what I want, but I am unable to move it left to right for example (Im unable to move it at all).
(Also note, if I try leaving CropFrame and StretchFill unchecked my Camera Size value is also overridden).
I even tried to 'extend' the Pixel Perfect Camera class but haven't been able to do that, I'm starting to wonder if this is just a limitation of using this component and perhaps I would need to write my own implementation of the pixel perfect camera to achieve the full control I need.
UPDATE: Actually I am able to extend the Pixel Perfect Camera class by 'using UnityEngine.U2D'. So far this is what I am trying whilst I wait in hope of further help (It seems like a lost cause extending the class, because I am not sure I can override much from it and cannot see the code. I can't find a way to set the Viewport X or similar). All the best everyone!
Thanks for any help.

sentences:
Execute cloud build from script in Unity Want to make cloud build functionality in Unity.
How can I do it in Unity from script(in EditorWindow)?
Update: Found Pre- and post-export methods, but still can't find the way to execute cloud build...

sentences:
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: How do I get light to go through a window texture in Unity? I'm having trouble with the lighting (I have windows and the light wont go through). How do I get the light to proceed through the glass?

sentences:
Morph a sphere to a cube and a cube to a sphere with GLSL I'm getting started with GLSL with quartz composer.
I have a patch with a particle system in which each particle is mapped into a sphere with a blend value. With blend=0 particles are in random positions, blend=1 particles are in the sphere. The code is here:

vec3 sphere(vec2 domain)
{
    vec3 range;
    range.x = radius * cos(domain.y) * sin(domain.x);
    range.y = radius * sin(domain.y) * sin(domain.x);
    range.z = radius * cos(domain.x);
    return range;
}

// in main:

vec2 p0 = gl_Vertex.xy * twopi;
vec3 normal = sphere(p0);;
vec3 r0 = radius * normal;
vec3 vertex = r0;

normal = normal * blend + gl_Normal * (1.0 - blend);
vertex = vertex * blend + gl_Vertex.xyz * (1.0 - blend);

I'd like the particle to be on a cube if blend=0

I've tried to find but I can't figure out some parametric equation for the cube.
Maybe it is not the right way?

sentences: Line Rendere Default Pink Color still Visible I am using the line Renderer for shooting in my game. Everything works well except for the fact that the default pink color is still visible. I have a Material set, so I do not think it is a problem of materials lacking. Someone Help please.

sentences:
libGDX Error loading font file - Netbeans I'm trying to load a font in libGDX. But I can't figure out want I do wrong.

Code:

white = new BitmapFont(Gdx.files.internal("fonts/white.font"), false);

Error:

Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Error loading font file: fonts/white.font
    at com.badlogic.gdx.graphics.g2d.BitmapFont$BitmapFontData.load(BitmapFont.java:657)
    at com.badlogic.gdx.graphics.g2d.BitmapFont$BitmapFontData.<init>(BitmapFont.java:469)
    at com.badlogic.gdx.graphics.g2d.BitmapFont.<init>(BitmapFont.java:115)
    at scenes.GameMode.create(GameMode.java:61)
    at scenes.GameMode.<init>(GameMode.java:45)
    at com.circle.game.Circle.create(Circle.java:17)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:143)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:120)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring(String.java:1931)
    at com.badlogic.gdx.graphics.g2d.BitmapFont$BitmapFontData.load(BitmapFont.java:480)
    ... 7 more
:desktop:run

sentences:
How can I determine that a user actually followed me to give them an in-game reward? I have seen many apps where they will reward you if you follow them on social media. However, all you need to do is click on the link and then close the browser opened up and you will still be rewarded.

I would like to be able to spread my app through social media. I want people to get a reward only if they follow me so that the game can be spread through social media.

This does nothing if all they have to do is click on a link and then they can close the browser. Is there a way that I can only reward the user if they have actually followed me on social media.

Thanks

sentences:
2D animated sprite in 3d Game I have a model created in Blender for a character with a sprite as a child of the character that I would like to animate. I'm making a turn based strategy game in which I would like to be able to click a character and turn on a "selection circle" beneath the character, much like the way a circle appears underneath a selected unit in games like Star Craft. The selecting of the character(the circle turning on/off) works fine. However, I have a 32 sprite animation that I would like to apply to the selection circle to give it a bit more life. The steps I've take are as follows:

I put my character into the scene

I add the selection circle sprite to the character as a child

I add an animation & animator component to the selection circle

I open the animation window and create a new clip

I drag my 32 sprite sheet to the window

I make sure the "play automatically" check box is selected

When I play the animation in the editor it works fine, but at run time the animation is not present, only a single sprite appears when I select my character. I've noticed that there is warning that appears in the console that says "animation must be marked as legacy" there are about a bazillion questions on here already explaining how to fix this... I.E. Change to debug mode and change animation type to 1(Legacy). I do not see this option anywhere in the inspector when I have the sprite selected. I can change to debug mode but there is nothing under the heading or an component that resembles animation type. I'm using Unity 5. Please, any help would be appreciated.

sentences:
Help Improving Map Generation I've recently attempt for the first time to implement a map generation system and while it does work, it doesn't work exactly the same I want but I'm not really sure on what changes I can make it to make it generate the type of map I want.

This is my map generation code

///<summary>Generates a Room at a Start Position</summary>
    void GenerateMap(Vector2 roomStartPos)
    {
        Vector2 startPos = roomStartPos;

        int roomTileNum = random.Next(minRoomTiles, maxRoomTiles);
        for (int i = 0; i < roomTileNum; i++)
        {
            if (CheckTilePosValid(startPos)) //Checks if a position is taken by a tile already
            {
                Tile newTile = CreateTile(startPos); //Creates a Tile at a passed in Position
                startPos = GetRandomEdgeDirection(newTile.SpritePosition); //Gets a Random position next to the passed in Position

            }
            else
            {
                startPos = GetRandomEdgeDirection(startPos);
                i--;
            }
        }
    }

It's likely a really bad way of generating a map. It basically gets a random number of tiles to generate, it will then place a Tile at the start position and select a new position in a random direction (Up, Down, Left, Right). It'll then place a new tile at that new position specified, it will then simply loop through that till it's placed every tile.
The "CheckTilePosValid()" function is used to determine if the random position that is gathered has already been taken by a tile. If the position isn't taken then it will create the tile and continue through the loop, while if the position is taken then it will get a new position and basically keeping doing that till it gets a position that hasn't been taken already.

This generates maps like this:

The issue is mainly with the first image since as you can see, the map is very stretched out which isn't what I want. I'd more want a map similar to the second image, tiles much closer together and not so stretched out but is still random enough.

I'm just not sure how exactly I can achieve this so I was wondering if anyone would be able to help me? Would I need to completely rework my generation system or can I just make simple changes to fix this?
I'd very much appreciate the help :)

sentences:
AI / Pathfinding gets stuck In my tile-based game, I'm using a A-star algorithm, which I have not written myself but I believe should be correctly implemented.

The problem I have is that the enemy AI can get stuck so that the enemy never gets any closer to the player.

Here's an ascii example of what I mean (x = enemy, p = player, . = ground):

....
x..p
....
....

Now, if I move the player down and process turn (which moves the enemy), the pathfinder finds the the next tile to be at south... and if I move the player up again, the pathfinder finds the next tile to be at north... so the enemy never gets any closer to the player (unless there are some obstacles, or I am closer to the enemy).

I feel stupid not to be able to figure this out on my own (at least in a nice way), but here we are. Is this a common problem, or am I doing something stupid?

sentences:
Infinite ball bouncing problem (Unity) I am trying to develop a basic Breakout game using this tutorial using Unity 5. But the ball starts to bouncing infinitely very easily. I cannot understand why this happenes.

In my physics knowledge starting an infinite bounce is very hard, and even impossible. To return the ball to same position after bouncing we must send the ball with zero degrees with the vertical axis. To send the ball with zero degrees with vertical axis we must receive the ball with zero degrees with the vertical axis. To receive the ball with zero degrees with the vertical axis we must send the ball with zero degrees, and so on. We can send a ball with zero degrees only in initial ball throw. In all the other cases there must be an angle which is not equal to zero. Am I wrong?

I mean the ball does not change its rotation. Ball moves between two plates which are parallel to each other infinitely (for example between paddle and upper wall)

I added physics material to ball, paddle and the walls. This material has following settings:
Dynamic friction: 0
Static friction: 0
Bounceness: 1

Settings of the ball:
Mass: 0.5
Drag: 0
Angular Drag: 0
Is Kinematic: true (I changed to false just before firing)
Use Gravity: false

Settings of the paddle:
Mass: 0.5
Drag: 0
Angular Drag: 0
Is Kinematic: true
Use Gravity: false

sentences: Where can I find some good 3D character artists? I am searching for 3D artists for a 3D iPad game. Is there a good place in the net, where I could find one? He or she should have created game models before.

sentences:
How can I draw orbit paths for a solar system? I’m trying to make the orbital paths visible for my solar system simulation game. I have most around with trail renderers and solid line sprite but not achieving the desired look I want. I’m hoping to get something where the path is alway present but darker directly behind where the planet currently is, and lighter and more transparent ahead of where it’s going. This effect is achieved in the game Worbital.
If anyone could point me in the right direction how I can achieve this I would be much appreciated.

sentences:
How do I get a table of AABB's? I am not sure if this is the right site to put this question on.

What would be a good, time saving method to reference an AABB with an integer id in Java programming language?

AABB class:

public class AABB {
private EndPoint[] min = new EndPoint[3];
private EndPoint[] max = new EndPoint[3];
private int entityId = 0;
private Boolean isStatic = false;
private static Map<Integer, AABB> table = new HashMap<>();
private Vector3f pos;
private int id = 0;

public AABB(Vector3f min,Vector3f max,Vector3f pos,int entityId,Boolean isStatic) {
    this.min[0] = new EndPoint(true,pos.x - min.x,id);
    this.min[1] = new EndPoint(true,pos.y - min.y,id);
    this.min[2] = new EndPoint(true,pos.z - min.z,id);

    this.max[0] = new EndPoint(false, pos.x + max.x,id);
    this.max[1] = new EndPoint(false,pos.y + max.y,id);
    this.max[2] = new EndPoint(false,pos.z + max.z,id);
    this.pos = pos;
    this.entityId = entityId;
    this.id = UniqueIdentifier.nextInt();
    this.isStatic = isStatic;
}
public static AABB setAABB(AABB aabb) {
    return table.put(Integer.valueOf(aabb.getId()), aabb);
}

public static AABB getAABB(int id) {
    return table.get(Integer.valueOf(id));

}

public static AABB getAABB(EndPoint endpoint) {
    return getAABB(endpoint.getId());

}

@Override
public boolean equals(Object arg0) {
    if(arg0 == this) {
        return true;
    }
    if((arg0 == null) || !(arg0 instanceof AABB)) {
        return false;
    }

    AABB aabb = null;
    try {
        aabb = (AABB) arg0;
    } catch (ClassCastException e) {
        return false;
    }

    return ((aabb.getMax() == getMax()) && (aabb.getMin() == getMin()) && (aabb.isStatic() == isStatic || aabb.isStatic().equals(isStatic())) && (aabb.getPos() == getPos()) && (aabb.getId() == getId()) && (aabb.getEntityId() == getEntityId()));

}

@Override
public int hashCode() {
    int hash = 17;
    hash += 5 * ((Boolean) isStatic).hashCode();
    hash += 5 * ( min == null ? 0 : min.hashCode());
    hash += 5 * ( max == null ? 0 : max.hashCode());
    hash += 5 * ( pos == null ? 0 : pos.hashCode());
    hash += 5 * id;
    hash += 5 * entityId;
    return hash;
}

}

SAP class:

 public class SAP {
public static List<EndPoint> xaxis = new ArrayList<>();
public static List<EndPoint> yaxis = new ArrayList<>();
public static List<EndPoint> zaxis = new ArrayList<>();
private SAP() {}

public static void addObject(AABB aabb) {
    if(!PairManager.isInPairs(aabb)) {
        xaxis.add(aabb.getMax()[0]);
        xaxis.add(aabb.getMin()[0]);

        yaxis.add(aabb.getMax()[1]);
        yaxis.add(aabb.getMin()[1]);

        zaxis.add(aabb.getMax()[2]);
        zaxis.add(aabb.getMin()[2]);

                    // Where i set table
        AABB.setAABB(aabb);
    }
}

private static boolean  intersects(AABB a,AABB b, int axis)
{
            // Where exeption is thrown a and b == null
    return !(a.getMax()[axis].getValue() < b.getMin()[axis].getValue() || b.getMax()[axis].getValue() < a.getMin()[axis].getValue());
}

private static boolean intersects(AABB a,AABB b) {
    return intersects(a,b,0) && intersects(a,b,1) && intersects(a,b,2);
}

}

sentences:
how get collision callback of two specific objects using bullet physics? I have got problem implementing collision callback into my project. I would like to have detection between two specific objects. I have got normall collision but I want one object to stop or change color or whatever when colides with another. I wrote code from bullet wiki:

int numManifolds = dynamicsWorld->getDispatcher()->getNumManifolds();
    for (int i=0;i<numManifolds;i++)
    {
        btPersistentManifold* contactManifold =  dynamicsWorld->getDispatcher()->getManifoldByIndexInternal(i);
        btCollisionObject* obA = static_cast<btCollisionObject*>(contactManifold->getBody0());
        btCollisionObject* obB = static_cast<btCollisionObject*>(contactManifold->getBody1());

        int numContacts = contactManifold->getNumContacts();
        for (int j=0;j<numContacts;j++)
        {
            btManifoldPoint& pt = contactManifold->getContactPoint(j);
            if (pt.getDistance()<0.f)
            {
                const btVector3& ptA = pt.getPositionWorldOnA();
                const btVector3& ptB = pt.getPositionWorldOnB();
                const btVector3& normalOnB = pt.m_normalWorldOnB;
                bool x = (ContactProcessedCallback)(pt,fallRigidBody,earthRigidBody);
                if(x)
                    printf("collision\n");
            }
        }
    }

where fallRigidBody is a dynamic body - a sphere and earthRigiBody is static body - StaticPlaneShape and sphere isn't touching earthRigidBody all the time. I have got also other objects that are colliding with sphere and it works fine. But the program detects collision all the time. It doesn't matter if the objects are or aren't colliding.

I have also added after declarations of rigid body:

    earthRigidBody->setCollisionFlags(earthRigidBody->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK);
fallRigidBody->setCollisionFlags(fallRigidBody->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK);

So can someone tell me what I am doing wrong? Maybe it is something simple?

sentences: How do I add materials to a glTF model in Godot Engine? I'm using glTF Embedded files because I was told they are the best files to use with Godot, so I got a pack of a bunch of really lovely trees and other things to use in my game. But when I import it, it has all the materials on the side with the base being completely white. I know how to add textures onto things but it seems there is no way to add anything to the model? How would I use these materials then? Is this my fault or the model creator's fault?

sentences: How to disable an object after it goes outside camera's viewport? I have a gameobject at a certain position in the game. I want the gameobject to be disabled once it is outside the camera's viewport, and it should become visible only when the camera focuses at that position.

sentences:
Supporting Controllers on Mac I'm currently developing a small, cross-platform game for Windows/OSX. I have XInput support working correctly on the Windows version. I've left off Mac controller support until now and I'm struggling to find an analogous library on OS X.

Does something similar to the XInput API exist for OS X or am I on my own for that?

sentences:
Controlling the draw order (z-index) through instancing? Is there any way that I can control in which order elements are drawn with instancing?

Do all elements get drawn in the same order they are added to the instance buffer?

Edit: What about the Z coordinate! Since I am drawing my GUI through this, I should be able to just put elements in front of others, right? I am not at home to try this out yet. I will keep the thread updated.

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:
best way to implement movement after A* pathfinding? tile-based movement vs pixel-based? I was able to implement the A* pathfinding algorithm to calculate a path from the enemy to player.

After trying to do movement well, I realized I ran into all sorts of problems. I was able to add clearance to the pathfinding, so I'm now going to have sprites of variable size, which leads to even more issues.

I am currently doing movement like -
path[0] is first Tile in path and it is removed when you get to it:

            if (path.Count > 0) {
                if (path[0].isTouching(this))
                    path.RemoveAt(0);
                }
            }

                            if (path [0].getCenterX() > this.getCenterX()) {
                                speedX = speed;
                                speedY = 0;
                                System.Console.WriteLine("moving right");
                            }
                            else if (path [0].getCenterX() < this.getCenterX()) {
                                speedX = -speed;
                                speedY = 0;
                                System.Console.WriteLine("moving left");
                            }

                            if (path [0].getCenterY() > this.getCenterY()) {
                                speedX = 0;
                                speedY = speed;
                                System.Console.WriteLine("moving down");

                            }
                            else if (path [0].getCenterY() < this.getCenterY()) {
                                speedX = 0;
                                speedY = -speed;
                                System.Console.WriteLine("moving up");
                            }

                            this.move(speedX, speedY);

This doesn't work very well for a variety of reasons.

I am certain the pathfinding I implemented calculates the proper path of Tiles. Now I think I have to move from a pixel to pixel movement -> tile to tile in order to have this working better. This would probably help, right? How is movement usually done to work with A*? If the tile-based movement would aid, any tips on implementing this?

sentences:
Unity3D: Problems drawing on duplicated texture I'm trying to:

load texture from assets folder
create a clone of said texture that will be manipulated during runtime
set pixels on cloned texture

I have successfully set pixels on the original texture (ie. discarding the code in the start function), but I cannot
seem to be able to draw to the duplicated version.

void Start () {

    canvas = gameObject.GetComponent(typeof(SpriteRenderer)) as SpriteRenderer;
    Sprite oldSprite = canvas.sprite;
    Texture2D oldTex = oldSprite.texture;
    Rect oldRect = oldSprite.textureRect;

    tex = new Texture2D(oldTex.width, oldTex.height, TextureFormat.RGB24, false);
    tex.SetPixels32(oldTex.GetPixels32());
    tex.Apply();

    Rect r = new Rect(oldRect.x, oldRect.y, oldRect.width, oldRect.height);
    Vector2 pivot = new Vector2(oldSprite.pivot.x, oldSprite.pivot.y);
    float pixelsPerUnit = oldSprite.pixelsPerUnit;
    Sprite sprite = Sprite.Create(tex, r, pivot, pixelsPerUnit, 0, SpriteMeshType.FullRect);

    canvas.sprite = sprite;
}

public void draw(Tool tool, Color32 color, List<Vector2> locations) {
    Color32[] pixels = tex.GetPixels32(0);

    for(int i = 0; i < pixels.Length; ++i) {
        pixels[i] = color;
    }
    tex.SetPixels32(pixels);
    tex.Apply();
}

Please ignore the unused vars, I'm just trying to set the whole texture's color for now.

Anyways, any help is always appreciated - thanks :)

sentences:
How can I access a method via a string in Unity? I myself am new to unity and I would like to know how it is possible to access a method via a string, something like this:
public string PlayerPrefsName;

public GameObject Button;

public string GadgetForSkin;

private void Start()
{
    GadgetChanged = PlayerPrefs.GetInt(PlayerPrefsName);
    if (GadgetChanged == 0)
    {
        Button.SetActive(false);
    }
    GadgetForSkin = "GadgetForSkin" + GadgetChanged;
}

public void GadgetChecker()
{
    GadgetForSkin();
}

public void GadgetForSkin1()
{

}

If it's not possible, how can I achieve something similar?

sentences:
Refresh rate in PSM apps In main loop of PSM app:

public static void Main(string[] args)
{
    Initialize();
    while (true)
    {
        SystemEvents.CheckEvents();
        Update();
        Render();
    }
}

we are not actually controlling cycle length. I guess the delay is implemented internally in

SystemEvents.CheckEvents()

function since it's the only one that is no defined by us. My questions are:

Is my assumption right about how refresh rate controlled in app?
Is there any function (or app setting) in SDK that allows to set refresh rate to any other than 60 fps?

sentences:
Using xinput vibration with java I need to use vibration for my java game, which is only available through xinput since I use xbox controllers. How can I achieve this with jna? I've never worked with dlls before so any help is appreciated. I looked at some tutorials but I haven't found anything about using structures (specifically XINPUT_VIBRATION vibration;) and such.

This is what I want to do in the DLL:

XINPUT_VIBRATION vibration;
ZeroMemory( &vibration, sizeof(XINPUT_VIBRATION) );
vibration.wLeftMotorSpeed = 32000; // use any value between 0-65535 here
vibration.wRightMotorSpeed = 16000; // use any value between 0-65535 here
XInputSetState( i, &vibration );

The above is taken from http://msdn.microsoft.com/en-us/library/windows/desktop/ee417001(v=vs.85).aspx#setting_vibration_effects

Thanks!

sentences:
Coding a left/right object movement C# script for android phones in unity I have 2 spheres and a cube on screen.

I'm experimenting to make a 'left/right movement script' for the cube so that when I touch the left sphere, the cube moves left-wards and when I touch the right sphere, the cube moves right-wards.

I have 2 scripts. I have attached SphereLeft.cs to left sphere and SphereRight.cs to right sphere.

Any pointers on how to achieve this ?

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:
What is an efficient/safe way to broker head to head communication for a mobile game I have a mobile game written in XNA/MonoGame with a wcf server and I am currently designing the head to head competition mode. Previously I have created a game that used UDP to set up communication between several clients(one of which acts as server and client) over WiFi but now I want to be able to set up a game between players over the internet. Utilizing the wcf server, I already have methods which allow a player to indicate that they are looking for a game, retrieve a list of other players looking for a game, and indicate that they would like to initiate a game with one of those players.

What I want to know though, is what is the best way to transfer the connection info from one client to the next so that they can directly connect to one another or whether that is actually a good/necessary idea or not. The game only needs to send a list of words from one client to the competitor initially and then send/retrieve status updates every few seconds of how many words have been completed until one of them gets x number of words ahead.

Obviously a direct connection would allow a much tighter window of response to determine when someone has won but really Its not a first person shooter so some flexibility is ok. However, utilizing the server and database to determine each players state can theoretically add a lot of lag especially if there is a lot of load on it.

I haven't set up any push notification for the mobile client and besides the server itself does not have a main loop that would allow it to push out updates, it basically is a front end for access to the game database.

Hopefully I haven't been to vague or general, but I really am looking for suggestions as to where I should spend my effort without having to reinvent the wheel or go down some path that inevitably wont work/cause unforeseen problems. If anyone has a good reference for this that would be appreciated as well.

sentences:
How can SDL tell what Xbox360 controller is what player? I init my controllers like this:

if (SDL_WasInit(SDL_INIT_GAMECONTROLLER) == 1)
    return;
SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER);

int nJoysticks = SDL_NumJoysticks();
numGamepads = 0;
for (int i = 0; i < nJoysticks; i++)
    if (SDL_IsGameController(i))
        numGamepads++;

if (numGamepads > 0)
{
    for (int i = 0; i < numGamepads; i++)
    {
        SDL_GameController* pad = SDL_GameControllerOpen(i);
        if (SDL_GameControllerGetAttached(pad) == 1)
            joysticks.push_back(pad);
        else
            cout << "SDL_GetError() = " << SDL_GetError() << endl;
    }
    SDL_GameControllerEventState(SDL_ENABLE);
}

and I poll events like this:

SDL_Event sdl_Event;
while (SDL_PollEvent(&sdl_Event))
{
    switch (sdl_Event.type)
    {
    case SDL_CONTROLLERDEVICEADDED:
        cout << "DEVICEADDED cdevice.which = " << sdl_Event.cdevice.which << endl;
        break;
    case SDL_CONTROLLERBUTTONDOWN:
        cout << "BUTTONDOWN cdevice.which = "<< sdl_Event.cdevice.which << endl;
        HandleGamepadButtonsDown(sdl_Event);
        break;
    case SDL_CONTROLLERBUTTONUP:
        HandleGamepadButtonsUp(sdl_Event);
        break;
    case SDL_CONTROLLERAXISMOTION:
        HandleGamepadAxis(sdl_Event);
        break;
    case SDL_QUIT:
        _quit = true;
        break;
    default:
        break;
    }
}

With this I have currently two Xbox 360 controllers connected. On these pads there is a LED indicating if it is player 1, 2, 3, or 4.

When I run this my poll loop prints out this when I press a button on this controller:

When I hit a button on the controller with the player 2 LED it prints:

So that is wrong. How can I from inside the code find out what controller corresponds to the controller with the right LED light on?

Also, when I first start it then it prints:

So the controllers are 0 and 1 when I add them but 1 and 2 when I run the game.

sentences:
Altering Animation Playback Given Terrain Information Say my character has a jog animation.  Assuming Y is vertical, his feet leave the ground at Y=0 and hit the ground again at Y=0.  This works fine in a world like that of Minecraft, where every surface the player could traverse is flat.

Now say the character is jogging through hilly terrain.  Without any transformations, the animation would break through the ground at certain points.  (As the character's foot is lifted and moved forwards, it would go straight through the hill.)

How do I remove this artifact?  Do I ask the artists to create separate animations depending on the grade of the terrain?  Is there a standard system to resolve animation-world collisions that I'm unfamiliar with?  Or is there another more logical approach I haven't thought of yet?

sentences:
What is the proper way to handle data between scenes? I am developing my first 2D game in Unity and I have come across what seems an important question.

How do I handle data between scenes?

There seems to be different answers to this:

Someone mention using PlayerPrefs, while other people told me this should be used to store other things like screen brightness and so on.
Someone told me that the best way was to make sure to write everything into a savegame everytime that I changed scenes, and to make sure that when the new scene loads, get the info from the savegame again. This seemed to me wasteful in performance. Was I wrong?
The other solution, which is the one I have implemented so far is to have a global game object that isn't destroyed between scenes, handling all the data between scenes. So when the game starts, I load a Start Scene where this object is loaded. After this ends, it loads the first real game scene, usually a main menu.

This is my implementation:

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

public class GameController : MonoBehaviour {

    // Make global
    public static GameController Instance {
        get;
        set;
    }

    void Awake () {
        DontDestroyOnLoad (transform.gameObject);
        Instance = this;
    }

    void Start() {
        //Load first game scene (probably main menu)
        Application.LoadLevel(2);
    }

    // Data persisted between scenes
    public int exp = 0;
    public int armor = 0;
    public int weapon = 0;
    //...
}

This object can be handled on my other classes like this:

private GameController gameController = GameController.Instance;

While this has worked so far, it presents me with one big problem: If I want to load directly a scene, let's say for instance the final level of the game, I can't load it directly, since that scene does not contain this global game object.

Am I handling this problem the wrong way? Are there better practices for this kind of challenge? I would love to hear your opinions, thoughts and suggestions on this issue.

Thanks

sentences:
2D Sidescroller camera I'm using OpenGL. For my tiles, I'm using a display list and I'm just using immediate more for my player (for now). When I move the player, I want to center him in the center of the window, but allow him to jump around on the y axis and not have the camera follow him. But the problem is, is that I can't figure out how to center the player in the viewport! Here is the player update method:

public void update() {
    if (Keyboard.isKeyDown(Keyboard.KEY_D)) {
        World.scrollx -= Constants.scrollSpeed;
        setCurrentSprite(Sprite.PLAYER_RIGHT);
    }
    if (Keyboard.isKeyDown(Keyboard.KEY_A)) {
        World.scrollx += Constants.scrollSpeed;
        setCurrentSprite(Sprite.PLAYER_LEFT);
    }
    move((Constants.WIDTH) / 2  + -World.scrollx, getY());
}

World.scrollx and World.scrolly are variables that I increase/decrease to move the tiles. move() is just a method that sets the player position, nothing else. I render the player at his current coordinates like this:

public void render() {
    glBegin(GL_QUADS);
    Shape.renderSprite(getX(), getY(), getCurrentSprite());
    glEnd();
}

Shape.renderSprite is this:

public static void renderSprite(float x, float y, Sprite sprite){
    glTexCoord2f(sprite.x, sprite.y + Spritesheet.tiles.uniformSize());
    glVertex2f(x, y);
    glTexCoord2f(sprite.x + Spritesheet.tiles.uniformSize() , sprite.y + Spritesheet.tiles.uniformSize());
    glVertex2f(x + Constants.PLAYER_WIDTH, y);
    glTexCoord2f(sprite.x + Spritesheet.tiles.uniformSize(), sprite.y);
    glVertex2f(x + Constants.PLAYER_WIDTH, y + Constants.PLAYER_HEIGHT);
    glTexCoord2f(sprite.x, sprite.y);
    glVertex2f(x, y + Constants.PLAYER_HEIGHT);
}

Pretty simple, I just render the quad at the current player's position. This is how I actually render everything:

public void render(float scrollx, float scrolly) {
    Spritesheet.tiles.bind();
    glPushMatrix();
    glTranslatef(scrollx, scrolly, 0);
    glCallList(tileID);
    glPopMatrix();
    player.render();
}

This is the part I'm confused on. I translate the tiles according to the scrollx and scrolly variables, and then I render the player at his current position. But the player moves faster than the tiles scroll, and he can escape out the side of the screen! How do I center the player with moving tiles?

Thanks for any help!

sentences:
CSS Sprite position updates slow due to addition of 'px'? I'm moving fewer than 10 position: absolute elements around the screen. An enormous amount of CPU time (profiled in Chrome as (program) i.e. native code) is used where I do the following:

style.left = monster.x + 'px';
style.top  = monster.y + 'px';

... where style belongs to the DOM element representing the monster in question.

This is a string concatenation cost since as soon as I remove that + 'px', the problem disappears. Of course, then absolute positioning doesn't work onscreen since the px is required by the browser.

I'm running this logic via requestAnimationFrame which runs about 60FPS... am currently amending such that position updates only occur every 2-3 frames as this will certainly help. Am also modifying so that only when the numeric value changes, is the style property set anew, rather than setting the style property on every active frame.

Even so, is this how CSS sprite updates are done? Is it always this slow? The only alternatives I can see are to use canvas (usually also slow, for different reasons) or WebGL. I'd prefer CSS for simplicity.

sentences: Clearing a libGDX pixmap Is there a way to clear a libGDX Pixmap? Or is the only way to dispose it and create a brand new Pixmap?

sentences: 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 get our music into games? As a fairly unknown independent band, what is the best way to get our music into computer games? I'm not so much thinking about licensing issues, but more about what channels are available and how to get noticed by game devs that could be interested in our type of music.

sentences:
Critical input from server arrives late... it must not! To preface, my understanding of networking is mostly from Source Multiplayer Networking and 1000 Archers on a 28.8.  For various reasons I have decided to go with a client-server model instead of peer-to-peer.

My C#/Unity multiplayer game is ruled by an authoritarian server, which uses UDP. Each network instruction has a time index, and is inserted into PlayoutBuffer's data collection.  The buffer executes stored commands at the correct local time index, based on a fixed update loop.

The server is slightly ahead of time, and clients will pause if they have not received any regular update from the server, allowing them to catch up.

Each client will simulate object movement and this movement is corrected by the server (ten times a second).  I've got the basic system working, but when I'm testing it in two windows on the same machine sometimes input arrives late, and is dropped.

Usually the late message is 1 time index too late.  The fixed loop is 50 ticks per second.  The server is 5 ahead of time, and commands are scheduled 5 ahead of time (assuming negligible lag, since ping hasn't been implemented yet and is on the same machine).

This is a problem.  Inputs from server are grouped into a few specific channels:
Ping, Serialise, Inputs, Criticals, Corrections.

Ping has yet to be implemented.  Serialise packs and unpacks mostly pregame multiplayer lobby stuff.  Inputs are player commands; select unit, issue move order, etc.  Criticals are essential updates; create unit, shoot unit's weapon, damage unit, etc.  Corrections are mostly movement updates.

All channels are unordered and with the exception of Corrections all channels are "Reliable" in Unity terms (see Unity documentation).  Given that movement updates happen regularly, if a few are dropped or arrive late this is not a critical system failure.  But if a critical is lost, this would effectively result in a desync.

How can I prevent and handle critical data arriving late from the server?
My first thought is to implement a custom ping. This is used to set the time index for the data relative to the time the last ping took to get back from the client, plus server time index.

But I doubt that would be enough... and if it fails?  Should the client pause or catch up based on the difference between local time index and the time index in the late critical?  Does the PlayoutBuffer need to become an AdaptivePlayoutBuffer to resolve these issues to handle CPU and network lag?  If so, how so?  Any other ideas welcome!

EDIT: The reason inputs were arriving one time index too late sometimes was because the buffer's for loop which read inputs counted from 0 to list.count, and removed items as it iterated... when I changed it to reading from list.count to 0, it fixed the issue and no inputs arrived late.  Whoops.

sentences:
How can I move a ball to a clicked location using physics forces? I have a ball as a sphere in my game and I'm viewing it from top down view. The ball is a rigid body.

When I click somewhere on the screen, I want the ball to be moved towards that direction using physics forces.

The ball needs to move only on the X and Y axes, the Z axis can be ignored.

Here is what I tried, but gives me some weird results. The script is attached to the ball:

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

    void Update () {

        //
        Vector3 v3 = gameObject.transform.position;
        Vector3 v3Mouse = Input.mousePosition;

        //
        Vector2 pointA = new Vector2(v3.x, v3.y);
        Vector2 pointB = new Vector2(v3Mouse.x, v3Mouse.y);

        //
        float Angle = Vector2.Angle(pointA, pointB);
        float angleRad = Angle * (Mathf.PI / 180);

        Debug.Log ("Angle: " + Angle);
        //
        float dx = Mathf.Cos (angleRad) * 10;
        float dy = Mathf.Sin (angleRad) * 10;

        //
        if (Input.GetMouseButtonDown (0)) {

            rb.velocity = new Vector3(dx, dy, 0);

        }

    }

What should I do here? When I click on the top of the screen, the ball should move up toward the mouse, and in all the other directions.

Any ideas?

sentences:
How can I benefit when I don't use gpu? I am trying to make a 3D game with C++, SDL, and OpenGL.

My program roughly looks like this:

control function has only CPU operations.

draw function has CPU and OpenGL functions operations.

I just randomly pick numbers.

How can I use GPU when program at control function?

Or I need to use? Do game engines use at every time? For example Unity, or Unreal Engine.

sentences:
Unity build report for Android is missing information This is my build report for Android:

Build Report
Uncompressed usage by category:
Textures      3.4 mb     3.7%
Meshes        0.0 kb     0.0%
Animations    0.0 kb     0.0%
Sounds        0.0 kb     0.0%
Shaders       0.0 kb     0.0%
Other Assets  13.5 kb    0.0%
Levels        21.9 kb    0.0%
Scripts       687.9 kb   0.7%
Included DLLs 3.9 mb     4.3%
File headers  13.2 kb    0.0%
Complete size 92.5 mb    100.0%

The space used by all the categories does not add up to the complete size of 92.5 mb. The build report in the Unity manual shows full utilisation by the listed categories. Where does the other 91% of the utilisation go?

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:
Why are my target-following objects rotated the wrong way? I writing a script that would make my players reach a target destination. It looks like this so far:

private void MoveTowardsGoal() {
    if (Vector3.Distance (reachGoalTarget.transform.position, transform.position) > 2.0f) {
        rDirection = (reachGoalTarget.transform.position - transform.position).normalized;
        if (rAcceleration < rMaxSpeed) {
            rAcceleration += 0.5f;
        }
        rVelocity = rDirection * Time.deltaTime * rAcceleration;
        transform.Translate (rVelocity,Space.World);
    }
}

It works fine: The objects move towards the destination point. However, I want them to move looking at the target in the forward direction (forward z axis). Currently they move with their x axis facing front.

I tried a simple rotation inside Start() like transform.LookAt(reachGoalTarget.transform). With this, they look in the forward direction but then they completely move off their initial positions by rotating themselves to reach the goal.

What am I doing wrong?

sentences: 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:
Decouple GUI from Logic I don't have an educational background in the programming-world; however, I've been working on a programm in my spare time for the last two years.

I'm currently struggling with how to decouple the GUI (or the drawing-logic in general) from the internals. More precisely, how to retrieve the data that's needed to display all information on screen.
For example: There is a collection of items that I want to display in some sort of inventory.
Should there be a copy of the collection in both the modules that use these items and the GUI-module or should all of them referece to the same container?
Should the implementation already provide methods that are needed in the UI logic? (e.g. the game only needs to check if you can use an item, the UI would show why you cannot use it - should several functions be provided in the logic, even though the game doesnt care for which reason?)

I have been reading up on MVC and MVP but the problem hasnt really been adressed: How does the View retrieve the data needed to display the model?

I'm not using any frameworks, engines, etc. Just plain code - I'm more focused in the design than finishing the project.

sentences:
How to change a class's variables at runtime without knowing in advance which class's variables to change? I am creating a nuclear war simulation game a bit like Defcon if any of you have played that. In the game you can chose one of several regions to play as and in my game I want each region to have different stats for their weapons and I want these stats to be changeable throughout the game if a region decides to develop a particular weapon for instance.

So I have a generic Weapon class that has a damage, a cost, a range etc. I then have different types of Weapon all stored in a WeaponArsenal class (ICBM, MRBM etc). Each region has different values for each of these and it needs to be possible to change them when the player or AI decides to upgrade a weapon.

Of course I can't predict which region the player will pick and therefore can't determine which regions will be AI controlled and which will be the player region. At the moment each available region is a class which has its own values for its weapons through an object but I don't know how I can chose which class to use for the player at run time without very repetitive if statements.

How can I therefore allow the player to upgrade their selected region's weapons without knowing their chosen region and calling a function explicitly?

Should I make a pointer to an object and point it to a different class's object depending on input at the start and then use this object pointer to change a region's variables throughout the game, and is having each region be its own class the best way of setting the game up? I have heard that making each region a map might make things easier but do not now how I would implement this. Which data structure should I use and how should I implement it?

The weapon class:

class Weapon
{
private:
    int count;
    int damage;
    float cost;
    int range;

public:
    void upgradeRange(Weapon wep, float p) {
        float percentDecimal = p / 100;
        float modifier = percentDecimal + 1;
        wep.range * modifier;
    }
    // more functions for upgrading each stat
    // more functions for setting and getting each stat

}

The WeaponArsenal class:

class WeaponArsenal
{ /* Weapon Types */
public:
    Weapon icbm;
    Weapon mrbm;
    Weapon srbm;
    Weapon bomb;

    WeaponArsenal() {

        // DEFAULT ICBM VALUES
        icbm.setCount(0);
        icbm.setCost(120);
        icbm.setRange(8000);
        icbm.setDamage(80);

        // DEFAULT MRBM VALUES
        mrbm.setCount(0);
        mrbm.setCost(100);
        mrbm.setRange(2000);
        mrbm.setDamage(70);

        // DEFAULT SRBM VALUES
        srbm.setCount(0);
        srbm.setCost(80);
        srbm.setRange(800);
        srbm.setDamage(55);
    }
};

A region class:

class Europe
{
private:
    WeaponArsenal arsenal;

public:

    Europe() {
    }
};

Full main.cpp file so far is on Github:

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: Unity3D: Rigidbody2D not colliding with BoxCollider2D In Unity3D (Version 5.3.1f1 Personal) I have a scene with a sprite with a Rigidbody2D and some sprites with a BoxCollider2D. The BoxColliders don't have the Is Trigger enabled and the RigidBody is not Kinematic, but they are not colliding. What am I doing wrong?

sentences:
When should you roll your own game engine? I've been a software developer for 5 years, now, and I am wanting to get into iOS game development. I've played around with the iOS SDK for about 2 years, attending cocoaheads meetings, and I feel I have a good grasp on objective-c, cocoa and even c and c++.

I have a game idea, and know that I will use Box2D, but I'm wondering if I should use cocos2D or not. The main reasons are:

I may want to do things, graphics wise, that aren't available in cocos2d.
If I roll my own game engine, I'll have more control.

Of course, the main reason for using an already-existing game engine is the time it saves, and it makes the hard stuff easier; but for someone who has the technical chops to roll his own, does it make sense?

sentences:
Touching screen not working for move object or print message It's simple, i want to move an object when i touch the screen, but code's not working, i tried to just put a console printing on it, but nothing happens:

void Update()
{
   if (Input.touchCount > 0)
   {
     Debug.Log("Touch");
   }
}

What am i doing wrong ?, thanks in advance !!

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:
Ellipsoid v. Box collision detection I'm trying to write some collision detection code.

ATM i have the code properly resolving Ellipsoid v. Ellipsoid collisions, and Box v. Box collisions, but Ellipsoid v. Box collisions doesnt work.

In general how do you test for interesection between these two.

What i've been doing is:

Finding the closest point on the ellipsoid to the box, and vice versa.

vector3 closestVertexOnBox = // Closest vertex on the box to the ellipsoid;
vector3 closestPointOnEllipsoid = // Closest vertex on the ellipsoid to the box

In this case ( ellipsoid v. box ) you have 4 axes.

The axis from the center of the circle to the nearest point on the box.
The X,Y,Z standard axes ( assuming its an AABB ) -

Put them all in an array

 vector3[] axes = { normalize( closestVertexOnBox - ellipsoid.origin ), unitX, unitY, unitZ }

Then for each axis in that array, Project the vector from the center of each shape, to its vertex closest to the other shape; onto each axis to find the projected half widths.

float minOverlap = infinity
vector3 overlapAxis;

for each axis in axes
{
    float prjBoxHalfWidth = Dot ( axis , closestVertexOnBox - box.origin )
    float prjEllipsoidHalfWidth = Dot ( axis , closestPointOnEllipsoid - ellipsoid.origin )

If the sum of any of the projected half widths are smaller than the projected distance between the two, then their is no collision

    float prjDistance = Dot( axis , box.origin - ellipsoid.origin )

    if(prjBoxHalfWidth + prjEllipsoidHalfWidth < prjDistance) return // no collision

Now get the axis with the least overlap out of all of them

    float overlap = prjBoxHalfWidth + prjEllipsoidHalfWidth - prjDistance

    if(overlap < minOverlap) {

         minOverlap = overlap;
         overlapAxis = axis;

    }

Then resolve the overlap

ellipsoid.origin += overlapAxis * minOverlap/2
box.origin -= overlapAxis * minOverlap/2

Thats pretty much my ( pseduofied ) code. If thats good, then i might have an error, but thats wrong, then what am i not taking into consideration or forgetting.

sentences:
Making Basic Touch Behaviors I am trying to make Basic Touch behaviors for my game where i want to

Pan Camera by Single finger touch.
Zoom Camera by pinch With two fingers ofCourse.
Rotate Camera by two fingers rotation.
Rotate camera around an object and move only in x axis using Two fingers y position.

i am having problem in making camera to rotate on X axis but i am not able to do it correctly plz help and it also conflicts with my pan behaviour when input is given

   public float comfortZoneVerticalSwipe_A = 10;
    public float comfortZoneHorizontalSwipe = 50;
    public float minSwipeDistance = 100;

    public float startTime;
    public Vector2 startPos;
    public float maxSwipeTime = 0.5f;

    if (Input.touchCount > 0 && Input.touchCount < 2)
            {
                Touch touch = Input.touches[0];
                switch (touch.phase)
                { //following are 2 cases

                    case TouchPhase.Began: //here begins the 1st case
                        startPos = touch.position;
                        startTime = Time.time;

                        break; //here ends the 1st case

                    case TouchPhase.Moved:

           Vector3 offset = transform.right * (-Input.touches[0].deltaPosition.x * 0.9f) * panSpeed + transform.up * (-Input.touches[0].deltaPosition.y * 0.9f) * panSpeed;
                                Vector3 newTargetOffset = Vector3.ClampMagnitude(offset, maxOffsetDistance);

                                transform.position += newTargetOffset - targetOffset;

                        break;

                    case TouchPhase.Ended: //here begins the 2nd case

                         float swipeTime = Time.time - startTime;
                        float swipeDist = (touch.position - startPos).magnitude;

                              Debug.Log("Mathf.Abs(touch.position.x - startPos.x) " + Mathf.Abs(touch.position.x - startPos.x));

                            Debug.Log("swipe Time " + swipeTime);

                            Debug.Log("swipe Dist " + swipeDist);

                            if (Mathf.Abs(touch.position.x - startPos.x) < comfortZoneVerticalSwipe_A && swipeTime < maxSwipeTime && swipeDist > minSwipeDistance && Mathf.Sign(touch.position.y - startPos.y) > 0)
                        {

                            Debug.LogWarning(transform.rotation.x);
                            transform.rotation = new Quaternion(transform.rotation.x - 5 , transform.rotation.y , transform.rotation.z , transform.rotation.w);
                           if (transform.rotation.x > 0.2)
                           {
                                transform.Rotate(Vector3.right, -2);
                            }
                                Debug.LogError(transform.rotation.x);
                            Debug.LogWarning("Up");

                        }
                            else if (Mathf.Abs(touch.position.x - startPos.x) > comfortZoneVerticalSwipe_A && swipeTime > maxSwipeTime && swipeDist > minSwipeDistance && Mathf.Sign(touch.position.y - startPos.y) < 0)
                            {

                                 transform.rotation = new Quaternion(transform.rotation.x - 5 , transform.rotation.y , transform.rotation.z , transform.rotation.w);
                                if (transform.rotation.x < 0.9)
                                {
                                    transform.Rotate(Vector3.right, 2);
                                }
                                print("down");

                            }

                        break; //here ends the 2nd case
                }
            }

sentences:
Line rect intersection - lines behave like rays Why is this? I have a simple ship that is a 14x14 rectangle, and a contour map. I want to be able to determine when the ship hits the ground. Here's a link to the JSFiddle.

Here's what happens now: the crosshairs indicate where the ship "exploded". The red lines indicate the ground line that was last processed. It seems that the ship explodes when it hits the ray that the line is part of.

Here's the code...

function collision() {
  for(var i = 1; i < map.length; i++) {
    var res;
    var start = new VectorPoint((i - 1) * 20, map[i-1]);
    var end = new VectorPoint(i * 20, map[i]);
    c.strokeStyle = "#ff0000";
    c.beginPath();
    c.moveTo(start.x, start.y);
    c.lineTo(end.x, end.y);
    c.stroke();
    c.strokeStyle = "#00ff00";
    var d = VectorFunctions.sub(end, start);
    var len = VectorFunctions.len(d);
    d = VectorFunctions.norm(d);
    res = rectLineCollision(start, d);
    if(res != null && res > 0 && res < len) {
      var insec = VectorFunctions.add(start, VectorFunctions.mul(d, res));
      c.beginPath();
      c.moveTo(insec.x - 10, insec.y);
      c.lineTo(insec.x + 10, insec.y);
      c.moveTo(insec.x, insec.y - 10);
      c.lineTo(insec.x, insec.y + 10);
      c.stroke();
      console.log("Res: " + res + ", len: " + len);
      break;
    }
  }
  return res != null;
}

function rectLineCollision(start, d) {
    var largestMin = -Number.MAX_VALUE;
    var smallestMax = Number.MAX_VALUE;
    for(var i = 0; i < 2; i++) {
      var n = VectorFunctions.sub(shipCopy.body[i], shipCopy.body[i + 1]);
      n = VectorFunctions.norm(n);
      // the shipCopy.body is just an array of points
      var sub1 = VectorFunctions.sub(shipCopy.body[i], start);
      var sub2 = VectorFunctions.sub(shipCopy.body[i+1], start);
      var e0 = VectorFunctions.dot(n, sub1);
      var e1 = VectorFunctions.dot(n, sub2);
      var f = VectorFunctions.dot(n, d);
      if(Math.abs(f) > EPSILON) {
        var t0 = e0 / f;
        var t1 = e1 / f;
        if(t0 > t1) {
          var swap = t0;
          t0 = t1;
          t1 = swap;
        }
        largestMin = Math.max(largestMin, t0);
        smallestMax = Math.min(smallestMax, t1);
        if(largestMin > smallestMax) {
          return null;
        }
        if(smallestMax < 0) {
          return null;
        }
      }
      else if(e0 * e1 > 0) {
        return null;
      }
   }
   return largestMin > 0 ? largestMin : smallestMax;
}

sentences: Baking Key Frame Animation in Blender I have a rigged model using an armiture in blender, I was wonder how you could bake the animation as kayframed data so that I could remove the armiture and the model still walks without being rigged.

sentences:
3D Texture Mapping (Atlas) This is a pretty simple question. If I was to use multiple images in a single texture for a 3D cube, how would I go about re-using each vertex (having 8 total vs 24)?
With a single buffer of 8 vertices, I don't see how I'd properly reuse the UV values.
Any help on that? I know it's not terribly clear, but I figured it was a simple question.
The 2D method is pretty easy, the next coordinates would be the same as the first (0,0 and 0,1 respectively).

However, the above 3D version has me quite befuddled.

sentences:
Classes in Unity - internal vs public Why are classes created by the game developer in Unity public (by default) when you could just as easily make them internal? For example: I go Assets->Create->C# Script. Via the default script template, I have just created a public class that derives from MonoBehaviour. But technically shouldn't this class only have to be internal? If so, I really want to delete that public keyword, because having the word public is a slight distraction to me.

Do outside DLLs call functions within the developer-created DLL? I don't think so, right? Because the classes in other DLLs wouldn't know what funcitons are in there beforehand anyway.

I don't know much about how these DLLs interact with each other, but I get the feeling outside DLLs don't particularly care about the one DLL assembly the game developer himself generates.

Take a look at my picture - it seems like Unity just jams all developer-created scripts in one assembly. Yes, the assembly does reference MonoBehaviour, (so I assume other classes in all the other dlls are public, not internal) but no classes outside of this one need be concerned with the details inside this assembly.

It doesn't matter that much. Yes, I could go on living my life peacefully and making my classes public within Unity. But is there any potential drawback, and isn't it considered better practice, to make them internal? If there's nothing wrong with making my classes internal, then I'm going to edit the default template.

sentences:
I can't seem to figure out what's causing this bug with the "layout" keyword in GLSL I have a GL shader file whose first few lines currently look like this:

#version 120
layout (location = 0) in vec3 position;
layout (location = 1) in vec2 vertexUV;

When I try to compile this shader when running the program, it returns this error:

0:2(1): error: syntax error, unexpected NEW_IDENTIFIER

From what I know, this means that the word layout is giving it trouble. What am I doing wrong? Do I need to provide more information?

sentences:
Good way to manage multiple game modes? /UPDATE:
I took one of the suggested solutions and tried to implement them. I implemented a BaseGameWorld class that contains the basic tetris gameplay. Every game mode extends this base class. If any of the game modes differ from that classic gameplay they will simply override any methods needed or add new ones. My GameScreen class is now structured like this:

public class GameScreen  {
    private BaseGameWorld gWorld;
    private GameRenderer gRender;

    public GameScreen (int gameMode) {
         // PuzzleGameMode extends BaseGameWorld
         gWorld = new PuzzleGameMode();
         // Constructor of GameRenderer takes a BaseGameWorld object
         gRender = new GameRenderer(gWorld);
    }

    public void render() {
         // Update Game World
         gWorld.update();
         // Draw Game World
         gRender.draw();
    }
}

This is ofcourse not the complete code, but it should show everything important. The idea behind the GameWorld and the GameRenderer classes is to reduce any clutter in the GameScreen class and seperate the game world and the drawing of the game world in two seperate steps with the goal to improve maintainability. So far this approach works quite well.
The type gWorld get's initiated with depends on the gameMode input variable and is handled through a switch-case in the actual code. Just as an example I used the class PuzzleGameMode.

Now my problem is that any new things added in the PuzzleGameMode class can't be drawn inside the GameRenderer class, since the GameRenderer constructor takes a BaseGameWorld object. It can only draw things that are in the BaseGameWorld.

Is there a way to resolve this situation that doesn't involve making a seperate GameRenderer for every game mode? My hope was to only have different classes for each game mode but to have one universal GameRenderer class.

I am currently making a tetris clone to get back into game programming using libGDX. The game is currently seperated in different screens. MenuScreen (includes Options, Highscore, Credits etc.) and the GameScreen itself. The GameScreen also has one member (named GameWorld) that manages all the calculations and game states, aswell as another one (named GameRenderer) that does all the drawing.

This works fine for the moment, however I plan on adding multiple game modes. I could probably add them to the GameWorld class, but it is already very full and managing multiple game modes inside a single class would end up very confusing and not very nice to maintain later down the line.

I could make a different class for every game mode and just use one of them depending on the selected game mode. This would be a solution, however this seems like a waste since I would just copy most of the original code for some of the game modes.
Alternativly I could make a Superclass that all game modes inherit from, however I am not sure how well it would work since game modes can differ quite a bit from each other. One mode might change the fundamentals like collision or intoduce new mechanics that need to be implemented on a deeper level, while others only differ a bit from the classic tetris mode and use most of the already implemented stuff.

What would be a good way to implement different game modes?
If more information is needed or if I should specify something better, just tell me and I will add the missing information. :)

sentences:
NullReferenceException when accessing variables in a 2D array in Unity I have made a class including variables in Monodevelop which is:

public class GridInfo : MonoBehaviour {

    public float initPosX;
    public float initPosY;
    public bool inUse;
    public int f;
    public int g;
    public int h;
    public GridInfo parent;
    public int  y,x;
}

Now I am using its class variable in another class, Map.cs which is:

public class Map : MonoBehaviour {

    public static GridInfo[,] Tile = new GridInfo[17, 23];

    void Start() {

        Tile[0,0].initPosX = initPosX;  //Line 49
    }
}

I am not getting any error on runtime, but when I play in unity it is giving me error

NullReferenceException: Object reference not set to an instance of an object
Map.Start () (at Assets/Scripts/Map.cs:49)

I am not inserting this script in any gameobject, as Map.cs will make a GridInfo type array, I have also tried using variables using GetComponent, where is the problem ?

sentences:
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:
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:
Tools for generating texture atlases/sprites from source images? Is there an industry standard file format for texture atlases?

What are the apps that take a directory of images and turns it into a texture atlas png and a text file describing what's on it?

This is primarily for use in OpenGL iPhone/Objective-C, but it seems like there ought to be a standard across many platforms.  I can create these by hand or by writing a script to simply tile them, but it seems like there would be some tools already made for this.

sentences:
Problem with SAT collision detection overlap checking code I'm trying to implement a script that detects whether two rotated rectangles collide for my game, using SAT (Separating Axis Theorem). I used the method explained in the following article for my implementation in Google Dart.

2D Rotated Rectangle Collision

I tried to implement this code into my game. Basically from what I understood was that I have two rectangles, these two rectangles can produce four axis (two per rectangle) by subtracting adjacent corner coordinates.

Then all the corners from both rectangles need to be projected onto each axis, then multiplying the coordinates of the projection by the axis coordinates (point.x*axis.x+point.y*axis.y) to make a scalar value and checking whether the range of both the rectangle's projections overlap. When all the axis have overlapping projections, there's a collision.

First of all, I'm wondering whether my comprehension about this algorithm is correct. If so I'd like to get some pointers in where my implementation (written in Dart, which is very readable for people comfortable with C-syntax) goes wrong.

Thanks!

EDIT:
The question has been solved. For those interested in the working implementation: Click here

sentences: Avoid double compression of resources I am using .pngs for my textures and am using a virtual file system in a .zip file for my game project. This means my textures are compressed and decompressed twice. What are the solutions to this double compression problem? One solution I've heard about is to use .tgas for textures, but it seems ages ago, since I've heard that. Another solution is to implement decompression on the GPU and, since that is fast, forget about the overhead.

sentences:
How can I avoid jitter when working with a 2D movement system? How can I avoid jitter in Unity?

Let's suppose that I want to create a 2D movement system using a Rigidbody 2D(Dynamic), and I want make the camera follow the character (which is a pixel art sprite).

How can I create a "jitter proof" 2D movement system for 2D pixel art games in Unity?

sentences:
UI looks different between editor and in game I am very confused about Unity's UI system.

This is how my inventory menu looks in the Editor:

And this is the view in game:

Settings

Can someone please explain why this happens?

sentences:
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 do I enfroce efficiency concerning thread granularity? Lately, I've been thinking of ways to use multi-threading to improve the speed of different parts of a game engine. What confuses me is the appropriate granularity of threads, especially when dealing with single-instruction-multiple-data (SIMD) tasks.

Let's use line-of-sight detection as an example.  Each AI actor must be able to detect objects of interest around them and mark them.  There are three basic ways to go about this with multithreading:

Don't use threading at all.
Create a thread for each actor.
Create a thread for each actor-object combination.

Option 1 is obviously going to be the least efficient method.  However, choosing between the next two options is more difficult.  Only using one thread per actor is still running through every object in series instead of in parallel.  However, are CPU's able to create and join threads in the granularity posed in Option 3 efficiently?  It seems like that many calls to the OS could be really slow, and varying enormously between different hardware.

sentences:
Applying a torque to a different centre of mass In Unity I have an object with a circle collider attached to it and when I apply a torque to this object's rigidbody2D, it rotates as expected. However, I have now attached a sub-object to this object with a polygon (trigger) collider which I am using to detect when something is in a cone in front of the ship. There is no rigid body (2D or 3D) attached to the child object. The only rigid body on the object is the one I am applying torque to.

However, when I do this, the centre of mass of the ship is moved to the centre of this collider, which produces totally the wrong effect. This happens even if I move this collider to the root node (so both it and the circle collider are attached).

I either need a way of getting the rigid body to ignore the child collider/allow me to set the centre of gravity, or else some other way of detecting objects inside a region.

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:
Why doesn't OnCollisionStay execute continuously? I'm currently trying to build a simple demo where the player can jump. This is the script I have setup so far.

using UnityEngine;
using System.Collections;

public class PlayerJump : MonoBehaviour
{
    public Vector3 jumpForce;

    void OnCollisionStay (Collision other)
    {
        print("OnCollisionStay");
        if (Input.GetKey (KeyCode.Space) && other.gameObject.tag == "Block")
        {
            rigidbody.velocity += jumpForce;
        }
    }
}

Whenever I check the console, the message "OnCollisionStay" is only printed 21 times. Just for more details the GameObject this script is attached to contains a rigidbody that uses gravity, has the x, y, and z rotation axes frozen, and the z position axis forzen as well. The gameObject I'm trying to collide with has a simple box collider attached to a cube with a scale of (5, 1, 5). What am I doing wrong? I am under the impression that OnCollisionStay continuously executes until the player is no longer colliding with anything, then starts executing again on collision?

sentences:
When prototyping, how can I more easily explore game behaviour? I build indie games myself, but I'm usually out of energy once I've taken a newly developed game to a level where it's possible to play with behavior, so I settle for refinement instead of exploration. With awful results.

(picture from the Intercom blog)

For example, I find that the iteration cycles for tweaking behavior (i.e. linking and restarting a C++ application) are so long that they kill all creativity. I'm building a tool to deal with this.

What other ways exist to quickly explore game behavior? I'm interested in the methodologies used by indie developers as well as larger companies.

sentences:
Animating Two Objects' Interaction? I want to animate a character who could be doing any number of things.

Say for example, I want the character to get into bed, under the covers. Do I animate the character and the sheets moving together? Separately? If separately do I need to call both animations simultaneously to ensure it fits together properly?

Or, if two characters are going to hug. Do I animate them hugging or just animate them separately hugging and try to align them in-game?

sentences: Feathers and wind simulation in Unity I would like to create a bird simulation that will use its wings to interact with the surrounding air. How can I achieve this?

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:
GO Game, placing stones on grid intersections I'm currently making a GO game and I am stuck on the most basic functionality. That functionality is being able to click on the intersections of the grid and ONLY the intersections to place a stone, either can be black or white. I have made a 2D array to represent the board but what I don't really understand is:

How do I draw the stones on the grid?
How do I reference the GUI grid to the 2D array?

sentences:
Proper way to load assets with a FSM transition between menus and actual game So far I am making a game in C++ and SDL, and the way to switch between the different menus and the actual game is via a Finite State Machine, AKA a stack where I put each state (MenuState, GameState...) on top, and only render and update the top of said stack.

Now I need to load assets such as images, and I am thinking of creating a class for each state which will hold all the address of the textures, sound, etc and pass it to each state so that it can render, play sound, etc, properly.

Something like a GameAsset class that I pass to GameState(GameAsset ga) when I create one, so that GameState::render() can do its work fast.

Is there any better way (easier to implement, faster, whatever) to do this ? It seem like it's stretched out for me, as I haven't made games on this scale before. Will this become unmaintainable or whatever ?

Thanks.

sentences:
JavaScript character direction delay I am developing a top down game and I'm having trouble with a delay in switching from one character walk direction to another, particularly if the previous direction key is still being pressed by the user.

Take the following user interaction:

User presses up arrow;
User presses right arrow (up arrow is still pressed);
User releases up arrow (right arrow is still pressed).

The problem I am experiencing is that there is a delay in the character switching from the "walk up" movement to the "walk right" movement.

requestId: 0,
settimeoutID: 0,
counter: 0,

move: function(keyCode) {
  var _this = this;
  // Frame per seconds
  var fps = 60;

  if (this.requestId === 0) {
    (function animationLoop() {
      // Control the timing of an animation with requestAnimationFrame
      _this.settimeoutID = setTimeout(function() {
        _this.render();
        _this.requestId = requestAnimationFrame(animationLoop, _this.move);
      }, 1000 / fps);
    })();
  }
},

changeAnim: function() {
  if (this.counter % 10 === 0) {
    if (this.currentFrame > 1) {
      this.currentFrame = 0;
    } else {
      this.currentFrame++;
    }
  }
},

render: function() {
  // Add some drawing
  this.counter++;

  if (keyCode === config.PLAYER_DOWN) {
    this.action = 'Front';
    this.newPos.y += 1;
  } else if (keyCode === config.PLAYER_UP) {
    this.action = 'Back';
    this.newPos.y -= 1;
  }

  if (keyCode === config.PLAYER_RIGHT) {
    this.action = 'Right';
    this.newPos.x += 1;
  } else if (keyCode === config.PLAYER_LEFT) {
    this.action = 'Left';
    this.newPos.x -= 1;
  }
  this.changeAnim();
  // Draw player logic
  this.drawPlayer.reDraw(this.playerSprite[1].Walk[this.action][this.currentFrame], this.newPos);
},

onKeyUp: function() {
  // Cancel the animation request
  if (this.requestId) {
    clearTimeout(this.settimeoutID);
    cancelAnimationFrame(this.requestId);
  }
  // Allow a new request to be called
  this.requestId    = 0;
  this.counter      = 0;
  this.currentFrame = 0;
  this.drawPlayer.reDraw(this.playerSprite[1].Walk[this.action][this.currentFrame], this.newPos);
}

Note: The function move gets called every time a new key is being pressed.

sentences:
Unity - Display array of Objects in inspector I have an array of ScritableObject's, which should only be displayed in the inspector if a boolean is true. How would I do this? With my current code, I get an error saying:

  Cannot implicitly convert type Tile to `Tile[]

This is my current code:

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

[CreateAssetMenu (fileName="Data", menuName="Tiles/Map", order=1)]
public class Tile : ScriptableObject {

    public ETile eTile;
    public Sprite sprite;

    [Space(5), Header("Variety")]
    public bool variety;

    [Range(0f, 1f)]
    public float varietyChance;
    public Tile[] varietyTiles; <---- This should be hidden if variety is true
}

public enum ETile {
    Water,
    Grass
}

[CustomEditor(typeof(Tile))]
public class MyScriptEditor : Editor {

    override public void OnInspectorGUI() {
        var tile = target as Tile;

        tile.variety = EditorGUILayout.Toggle("Hide Fields", tile.variety);

        if (tile.variety) {
            tile.varietyTiles = (Tile)EditorGUILayout.ObjectField("Tile", tile, typeof(Tile), allowSceneObjects: true);         }
        }
    }
}

sentences:
Monogame - Sprite sheet animation I have a sprite sheet that contains a character walk cycle, and I have made a player class that allows the player to move and cycle through the walk animation, however the animation only works whilst walking to the right. I use the arrow keys to move up, down, left and right, meaning when I press any key, my player moves in the correct direction, but only performs the animation of walking to the right.

The current animation that works, has been called like this in the LoadContent() function:

spritesheet = Content.Load<Texture2D>("sprites2");

player = new Player(spritesheet, new Rectangle(0, 96, 32, 48),
new Vector2(100, 100), 4);

This does its job, as it calls each 4 sprites to complete the walking animation to the right, and new Rectangle(0,96,32,48) is the location cut out from the sprite sheet. However I need (for example) new Rectangle(30, 101, 65, 52) to be used also, which will correctly animate my character when the left arrow key has been pressed.

My question is, how would I get another location of the sprite sheet loaded, and then actually work when I press the correct key?

This is a very difficult question to ask and I very much apologize if it was difficult to understand. Accepting all edits to my question, and thank you in advanced.

sentences:
GODOT Change scene in node I will change a scene on button click. But not change the main scene with button.

Node structure:

main
- scene (with childs)
- button

button.gd:

func pressed():
    get_node("scene").change_scene("res://second_scene.tscn")

It doesn't works.

sentences:
When using Prefab Mode only one game object is adjusted while the others need to be manually selected in hierarchy window for changes I created a bezier curve prefab using the code in the post How to create an illustrator/photoshop-like pentool for creating bezier curves in Unity. I added a few copies of the prefab to my scene. When I open the original prefab in prefab mode (I am using Unity 2019.1.0a8) and adjust any of the points it only affects one of the prefabs, the changes are not recognised in the scene view till I select the other objects manually.

I added SceneView.RepaintAll(); after calling path.MovePoint(i, newPos); in the Draw() method but it still doesn't update the others.

Could it be that I haven't serialised by variables correctly?
How can I get all of the objects created from the prefab to recognise changes immediately when the original prefab is altered?

sentences:
"Your license does not cover Android Publishing" error I recently installed Unity 2017.1.0f3. I imported a project from an older version of Unity it worked perfectly and allowed me to build for Android. I logged in to the Asset Store through the tab in the Unity editor, now I can no longer build for Android.

This is the error I receive:

I created my Unity account before Android was free. Is there a way to update my account to allow me to build with Android again?

sentences:
Unreal - AI's can't target buildings After following some of the Unreal tutorials, I was able to create an AI that tracks the player. Now I want it to target specific buildings. I have tried various methods of modifying what was demonstrated in the Unreal videos but all I can get my AI controller to do is either stand in place or walk to the center of the nav mesh. Here is an example of what I have done:

If anyone can help, how can I get my AI to attack the Armory? Thanks.

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:
Sound effects in separate thread? Does it make sense to carry out all audio (music, sound effects, etc.) in a separate thread?

In your experience, how large would you expect the performance impact of playing some MP3 music and 10-30 sound effects to be?

Could performance be an issue with starting to play many different sound effects (e.g. in the same frame)?

sentences:
Add sprite flickering to a LibGDX object How can I make a LibGDX Actor object flicker over a set duration?

Many 2D platformers have the player character 'flicker' after taking damage to indicate temporary invincibility, (ie: invincibility frames). For an example, see the below gif from Shovel Knight.

It's fairly simple to make an object fade in or out over time using LibGDX's Actions library.

Actor player = new Actor();
// fade out in 0.25 seconds
player.addAction(Actions.fadeOut(0.25));

But searching through the documentation, I couldn't find any method for Actions.flicker(). How can I implement sprite flickering in LibGDX?

sentences:
How can I make tree foliage work with baked lighting? I have an issue in Unity where my trees are black and it seems to be due to the fact that I'm using baked lighting in my scene. Luckily, it seems that I'm not the only one who's experienced this. I found a post on the unity3d subreddit which goes into more detail about basically the same problem. I'll repost it here for convenience:

  So, I have some custom trees using the "Nature/Tree Soft Occlusion"
  shaders and they looked great before baking a lightmap. However, now
  that I have baked the lightmap, the trees have turned black. Or
  rather, when I tried baking with the trees set to static, they turned
  invisible, and now that Ive tried without, they're black. Also,
  they're not casting shadows.

  Anyone know how to fix this issue? Perhaps I need to use light probes?

  http://imgur.com/a/21At5 --> before and after (fyi the bark is not
  using the nature/occlusion shader. The shader definitely seems to be
  the root of the issue, but Im just not sure how to fix it without
  using a different shader)

Ultimately, the author of this post eventually "solved" his problem by just switching to realtime lighting instead of baked lighting. Unfortunately, this is not an option for me. However, the author did receive some useful comments before giving up.

One of the comments asks if the leaves have properly laid out UVs. The commenter goes on to say that the leaves all need to have their own unique space in the UV grid. I think this makes sense because I enabled the Generate Lightmap UVs option on my tree model in Unity. But it did nothing. The author apparently also had no luck with that option.

In any case, Maya was suggested (among other software) to check these leaves' UVs. Unfortunately, I've never used Maya and I absolutely can't make heads or tails out of it. I'm just using a borrowed copy from a friend so I've never gone through any tutorials or anything for it. I'm just trying to check this one thing, but I am really at a loss.

EDIT:

According to some comments from DMGregory, he suggests that since trees get spawned and varied dynamically, there's no single mesh to pull apart and check its UVs. His logic seems to make sense, so perhaps Maya is not the solution that I'm looking for. Now, though I'm having trouble with figuring out how to get my tree shaders to work with lightmapping. Details are in the comments.

sentences:
Loading large bitmaps in Android In a few games in the Android Market/Google Play Store, huge bitmaps are drawn onto the screen.

For example, the game Unicorn Dash:

and Robot Unicorn Attack:

I'm assuming the entire island (which is multiple screens long) is loaded into memory. With probably around 10 different islands, how can something like this be possible? I've attempted to do something similar in one of my games, but I always ran out of memory. The bitmaps are (estimated) at around ~2000px x 500px at the largest which comes out to about 4mb each uncompressed? If you had 10 of them it would require 40mb of memory! So obviously I'm missing something.
Is it plausible to be loading and unloading bitmaps into memory while the game runs? Or is there some other technique that I'm not aware of?

EDIT:

I extracted the images from Robot Unicorn Attack and saw that they were indeed whole images (not split up) of around 2000*500 pixels.

sentences:
Export object or scene with textures Is there a way to export or publish some work to a folder so somebody else can open the .max file and does not have to reassign all the textures again?

My problem is that i used lots of textures straight from my texture folder in a completely different folder tree. So when i sent the file to someone else he needs to rebuild this tree exactly the same as i did or reassign every texture.

If there is no option like that do i have to change my workflow, in case others need to work with my files, and keep everything in the same folder? What is normal procedure to keep everything organized and compatible for each user?

sentences:
Does each game asset always require a prefix such as 'spr' or 'obj' in their name? Having started only recently with using GameMaker for game development (keep in mind that this is the first time in a long while that I'm doing something like this, so I'm technically at beginner level), I've lately been thinking about something that seems to be common place throughout creating a game with the software.

Through all the tutorials I've been through so far in GameMaker:Studio, I've noticed that the tutorials seem to want the names of game assets to always have a prefix in their names depending on what the game asset is, usually something like spr_ for sprites or obj_ for objects.

I've never exactly liked this sort of naming method, but I don't know whether or not to keep doing this or to just avoid using the prefix entirely. Does the engine require these prefixes for a game to compile or something?

Are these prefixes necessary?

sentences:
What is "game logic code?" I'm using C#/XNA and have been told quite a few times not to mix update code with draw code -- and I'm certain I'm not! But could anyone please describe what exactly is 'logic code'?

As seen here: http://blogs.msdn.com/b/shawnhar/archive/2007/07/25/understanding-gametime.aspx

  [...] make sure you put all your game logic inside the Update method (not in Draw!) and everything will run at a nice constant speed.

I'm asking this since my game's speed is fluctuating relative to the FPS. Slow FPS equals slow-moving objects and visa versa. And yes, I am including the expected position += speed * (float)gt.ElapsedGameTime.TotalSeconds; code.

This is probably a big rookie question, but I just want to be absolutely clear on the definition of this.

sentences:
Smooth character movement I want my character to move smooth not instant stopping etc. I want it to decrease velocity slower not instant. I tried with keystates but that doesn't work for 2 keys at once. I tried using key.keysym.sym in switch to set bools: left, right, up, down if key is held but that does not work too when 2 keys are held.
Now I am using this

void CharProp::handleEvent(SDL_Event e)
{
    if (e.type == SDL_KEYDOWN && e.key.repeat == 0)
    {
        switch (e.key.keysym.sym)
        {
        //case SDLK_w:
        case SDLK_UP:
            cVelY -= CharVel;
            break;
        //case SDLK_s:
        case SDLK_DOWN:
            cVelY += CharVel;
            break;
        //case SDLK_a:
        case SDLK_LEFT:
            cVelX -= CharVel;
            break;
        //case SDLK_d:
        case SDLK_RIGHT:
            cVelX += CharVel;
            break;
        }
    }
    else if (e.type == SDL_KEYUP && e.key.repeat == 0)
    {
        switch (e.key.keysym.sym)
        {
            //case SDLK_w:
        case SDLK_UP:

            cVelY = 0;
            break;
            //case SDLK_s:
        case SDLK_DOWN:

            cVelY = 0;
            break;
            //case SDLK_a:
        case SDLK_LEFT:

            cVelX = 0;
            break;
            //case SDLK_d:
        case SDLK_RIGHT:

            cVelX = 0;
            break;
        }
    }
}

This works with multiple keys but I cannot figure out how to make increasing/decreasing velocity. Do you have any tips how to make it using SDL2?

EDIT: Code for decelerating looks like this

if (!accelerationX)
{
    if (cVelX > 0)cVelX -= 0.5;
    if (cVelX < 0)cVelX += 0.5;
}

Now when character is decelerating it can move through walls because I am subtracting 0.5. I want it to decelerate slow so I don't know what to do( If I changed it to subtract 1 it would work good)Any ideas how to do it?

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:
Exporting the frames in a Flash CS5.5 animation and possibly creating the spritesheet Some time ago, I asked a question here to know what would be the best way to create animations when making an Android game and I got great answers.

I did what people told me there by exporting each frame from a Flash animation manually and creating the spritesheet also manually and it was very tedious.

Now, I changed project and this one is going to contain a lot more animations and I feel like there has to be a better way to to export each frame individually and possibly create my spritesheets in an automated manner.

My designer is using Flash CS5.5 and I was wondering if all of this was possible, as I can't find an option or code examples on how to save each frame individually.

If this is not possible using Flash, please recommend me another program that can be used to create animations without having to create each frame on its own. I'd rather keep Flash as my designer knows how to use it and it's giving great results.

sentences: Developing Flash games on the Wii Has anyone used WiiFlash for developing Flash games? Any pointers on how to begin developing games for the Opera channel for the Wii?

sentences:
Camera roll has no effect Consider my following (abstracted) C# w/ SharpDX code:

class Game
{
    Camera _camera = new Camera();

    private void Window_KeyDown(object sender, KeyEventArgs e)
    {
        // Roll
        if (e.KeyCode == Keys.Home)
        {
            _camera.TurnRoll(-0.05f);
        }
        else if (e.KeyCode == Keys.End)
        {
            _camera.TurnRoll(0.05f);
        }
        // Other rotation / movement works...
    }
}

class Camera
{
    private Vector3 _position;
    private Vector3 _rotation;
    private Vector3 _right;
    private Vector3 _up;
    private Vector3 _forward;
    private Matrix  _view;

    public Camera()
    {
        _right = Vector3.Right;
        _up = Vector3.Up;
        _forward = Vector3.ForwardLH;
        UpdateViewMatrix();
    }

    public void TurnRoll(float roll)
    {
        // Relative rotation
        _rotation.Z += roll;
        UpdateViewMatrix();
    }

    private void UpdateViewMatrix()
    {
        Matrix cameraRotationMatrix = Matrix.RotationYawPitchRoll(_rotation.Y, _rotation.X, _rotation.Z);
        Vector3 cameraTarget = Vector3.TransformCoordinate(Vector3.ForwardLH, cameraRotationMatrix);
        cameraTarget = cameraTarget.Normalize();
        cameraTarget += _position;

        // I bet the problem lies in and/or after this line
        Matrix rotateYTempMatrix = Matrix.RotationY(_rotation.Y);

        _right   = Vector3.TransformCoordinate(Vector3.Right,     rotateYTempMatrix);
        _up      = Vector3.TransformCoordinate(Vector3.Up,        rotateYTempMatrix);
        _forward = Vector3.TransformCoordinate(Vector3.ForwardLH, rotateYTempMatrix);

        _view = Matrix.LookAtLH(_position, cameraTarget, _up);
    }
}

My problem: Even when pressing the Home and End keys, the camera roll visibly stays untouched. I have trouble correcting my UpdateViewMatrix function, and I bet that the error is in there. I'm a bit lost with the maths here and my tries to use another rotation matrix to update the _up vector all failed or created other problems.

Can anybody clear my math mind up and help me correct this method?

EDIT: Solved with the help of winged's answer below. I edited the code to be

private void UpdateViewMatrix()
{
    Matrix rotation = Matrix.RotationYawPitchRoll(_rotation.Y, _rotation.X, _rotation.Z);

    _forward = Vector3.TransformCoordinate(Vector3.ForwardLH, rotation);
    _forward += _position;

    _up = Vector3.TransformCoordinate(Vector3.Up, rotation);

    _view = Matrix.LookAtLH(_position, _forward, _up);
}

However, this is still not completely correct. The camera rolls now, which solves this question. But if it is rolled and I try to yaw it, the yaw happens like as if the camera is non-rolled and moves along the default Y-axis :/. Especially when looking downwards 90 degrees this causes something like gimble-lock to happen (or IS it gimble lock?) because rolling and yawing the camera has the same effect then.

EDIT2: I completely replaced my rotation with quaternions. I don't know why people think these are "harder" or at least "different" to understand. This solution works perfectly.

public void Turn(Vector3 turning)
{
    // Relative rotation
    Quaternion delta = Quaternion.RotationYawPitchRoll(-turning.Y, -turning.X, -turning.Z);
    _rotation = delta * _rotation;
    _rotation.Normalize();
    UpdateViewMatrix();
}

public void TurnRoll(float roll)
{
    Turn(new Vector3(0, 0, roll));
}

private void UpdateViewMatrix()
{
    Matrix view = Matrix.RotationQuaternion(_rotation);
    Matrix translation = Matrix.Translation(-_position.X, -_position.Y, -_position.Z);
    _view = translation * view;
}

sentences:
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:
PBR How to correcly use standard lighting and IBL I'm creating a physically based renderer but I am a bit confused on how to put together standard lighting with IBL, since like I'm doing now I think it's wrong.

Right now, for each light, I evaluate it's contribution to the scene lighting combined with IBL lighting (I use both the light contribution and diffuse and specular coming from the IBL) but like this I sum the IBL contribution for each light, and I don't think it's right.

To put together standard lighting with IBL, do I need to process all the lights alone and then, in another step, bake into the scene the IBL? I think this would be more correct.

sentences:
Create texture the size of my mesh I programmatically create a Mesh and want to generate a texture that patches coloured squares together so that the patchwork perfectly matches the vertices.
The mesh's dimensions are expressed in floats, the texture dimensions are expressed in pixels.

myMeshFilter.mesh = BuildMesh();
// todo: how to find out the values instead of ??
myMeshRenderer.sharedMaterials[0].mainTexture = BuildTexture(??, ??);

private Texture BuildTexture(int width, int height){
    var texture = new Texture2D(width, height);
    var pixels = textures[TileType.Grass.Value]; //array of 64*64 pixels
    var tileWidth = width/NumberOfColumns;
    var tileHeight = height/NumberOfRows;

    //todo: do this for all the tiles instead of only the first;
    texture.SetPixels(0,0, tileWidth , tileHeight, pixels);
}

In the editor, you can set the pixel-to-unit ratio, but not sure how to set this on generated textures.

My current implementation assumed that setting and using my source texture's pixel to unit ratio in my calculations would do the trick, but I noticed that it doesn't and
I Googled far and wide and have mostly become more confused with every hit.

I think I need the camera to translate my mesh's corner values to pixels, but not sure and wouldn't know how.

UPDATE
Pointing the UV's of the mesh to the correct points in the texture would be a solution (and probably a rather performant one), but would restrict me in my possibilities if I want the tiles to have visual-only 'overflows'.
eg: grass tile next to dirt tile would have a bit of grass over the dirt.

sentences:
SpriteBatch.Begin() making my model not render correctly I was trying to output some debug information using DrawString when I noticed my model suddenly was being rendered like it was inside-out (like the culling had been disabled or something) and the texture maps weren't applied

I commented out the DrawString method until I only had SpriteBatch.Begin() and .End() and that was enough to cause the model rendering corruption - when I commented those calls out the model rendered correctly

What could this be a symptom of? I've stripped it down to the barest of code to isolate the problem and this is what I noticed.

Draw code below (as stripped down as possible)

        GraphicsDevice.Clear(Color.LightGray);
        foreach (ModelMesh mesh in TIEAdvanced.Meshes)
        {
            foreach (Effect effect in mesh.Effects)
            {
                if (effect is BasicEffect)
                    ((BasicEffect)effect).EnableDefaultLighting();
                effect.CurrentTechnique.Passes[0].Apply();
            }
        }

        spriteBatch.Begin();
        spriteBatch.DrawString(spriteFont, "Camera Position: " + cameraPosition.ToString(), new Vector2(10, 10), Color.Blue);
        spriteBatch.End();

        GraphicsDevice.DepthStencilState = DepthStencilState.Default;
        TIEAdvanced.Draw(Matrix.CreateScale(0.025f), viewMatrix, projectionMatrix);

sentences:
Blender: projecting an image via a spotlight onto a plane I've create a plane with a spot light shining from above onto it. The spot light projects a texture of an image onto the plane. The light shots out at an angle but the texture is projecting in a flat 2d form on the plane.

I expected it to stretch out much like the advertisements you'd see drawn on the pitch during a rugby or cricket match. Any idea how I'd change the way the image is shawn onto the plane?

The image should stretch out with the nearer section looking a bit more narrow than the top far section.

sentences:
How to get surrounding tiles in a tile array I've created a tiled map that holds two layers, one for the tile type, and the other for whether it is solid or not. I plan on creating very big maps, and checking every tile seems like it would slow down my game immensely.

So lets say I had an array of integers. "0" representing solid, and "1" representing not solid. How would I check only the 8 surrounding integers instead of the whole array each update.

0 0 0

0 1 0

0 0 0

sentences:
How to set the force applied to RigidBody2D depending on the time user holds touch on screen? I trying to make an object jump from 1 point to another point. How far it jumps depends on how long the player holds the touch anywhere on the screen. It jumps when player releases his touch.

At the code below,I able to detect the moment player release his finger.

if (Input.touchCount > 0) {
    Touch touch = Input.GetTouch(0);

    // Handle finger movements based on touch phase.
    switch (touch.phase) {
        // Finger start touching the screen
        case TouchPhase.Began:
            print("Start tapping");
            break;

        // Finger leaving the screen
        case TouchPhase.Ended:
            //when finger release, the object jump
            float rightForce = Time.deltaTime * 10000 / 2;
            float jumpForce = Time.deltaTime * 30000 / 2;
            box2D.AddForce(new Vector2(rightForce, jumpForce), ForceMode2D.Force);
            break;
    }
}

As you can see I able to get the Time.deltaTime which is I assume is how long the player hold the screen.

What I want to do is calculate the rightForce and jumpForce added to the object depending on the Time user hold the touch.

float rightForce = Time.deltaTime * 10000 / 2;
float jumpForce = Time.deltaTime * 30000 / 2;

Because if I use the 2 line of code above, the result will be almost the same everytime.

So what is the correct way to determine the rightForce and jumpForce depending the time user hold touch?

sentences:
Graphical mesh lags behind collision shape in BulletPhysics debug drawing In Bullet Physics when I debug draw physics world the graphical mesh lags behind the collsion shape.

m_DynamicsWorld->stepSimulation(1 / 60.0f, 10);

btTransform trans, trans2;
trans2 = m_RigidBodies.at("CubeMesh")->m_Body->getWorldTransform();

m_RigidBodies.at("CubeMesh")->m_Body->getMotionState()->getWorldTransform(trans);
/*
 * using
 * m_RigidBodies.at("CubeMesh")->m_Body->getMotionState()->getWorldTransform(trans);
 *
 * causes the graphical mesh to lag behind the collision shape in DebugDraw call
 * Checking with debugger shows that the lag error keeps on increasing
 * */
//
//
glm::mat4 M;
trans.getOpenGLMatrix(glm::value_ptr(M));
m_RigidBodies.at("CubeMesh")->GetGraphicalObject()->Model = M;

if (m_DebugDraw) {
    m_DynamicsWorld->debugDrawWorld();
}

If I use the OpenGL matrix from trans2 then debug drawing is perferct.
But with trans the graphical mesh lags behind the collision shape in debug draw.

I am using btDefaultMotionState when setting the CubeMesh rigid body.

btTransform tr;
    tr.setIdentity();
    tr.setOrigin(btVector3(0.0f, 90.0f, 0.0f));
    cubeMesh->m_PhysicsBody->m_MotionState = new btDefaultMotionState(tr);

Can anyone explain reason for this lag?

sentences:
How to be sure that a name we came up with for an evil corporation is safe to use in our game? I need your advice. We are currently developing a pixel art point and click adventure game. We have an evil corporation in our game and we also came up with a name for it. Now, to be sure that the name has no other firm/corporation we did a google search. There are some that are close to our name but not exact as ours. For example, we replaced an o with 0 and added dots between each letter. Now I have a question for you, how to be 100% sure that the name we came up with is safe to use in our game?

We don't want any problems. I am a bit worried about it.

Also, what happens when we release the game and some firm chooses our name. Personally, I don't care about it, but could they come to us in the future and say that we have no right to use "their" name?

Thanks in advance!

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:
How to get last 20 banned Steam IDs I am working on a cheat analysis system using data from Steam. From this page, we can get the last 20 checked Steam IDs. Is there a way to get the last 20 banned Steam IDs?
VacList has a section with the last banned accounts, but I don't know how to extract the data. A solution like that provided by vacbanned.com would be much better.

sentences:
How do I do selective water surface rendering? I have a shader that renders the "texture" of a very realistic water on a tile in the 3D world using a Frame Buffer.

The problem is that, for example, I only want to render the part that isn't below the terrain, only for optimization. Does it make sense and how do I do that?

sentences:
Unity GUIText not visible and not WYSIWYG I have placed a Guitext in my hierarchy:

At first it was visible, now I can't see it when I run the game.

When it was visible:

When modifying the position on scene, the GUIText appears on one place,
but when I run the game it's somewhere else.

Why?

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:
3d Picking under reticle i'm currently trying to work out some 3d picking code that I started years ago, but then lost interested the assignment was completed (this part wasn't actually part of the assignment).

I am not using the mouse coords for picking, i'm just using the position in 3d space and a ray directly out from there.  A small hitch though is that I want to use a cone and not a ray.

Here are the variables i'm using:

float iReticleSlope = 95/3000; //inverse reticle slope
float baseReticle = 1; //radius of the reticle at z = 0
float maxRange = 3000; //max range to target
Quaternion orientation; //the cameras orientation
Vector3d position; //the cameras position

Then I loop through each object in the world:

Vector3d transformed; //object position after transformations
float d, r; //holder variables

for(i = 0; i < objects.length; i++) {

    transformed = position - objects[i].position; //transform the position relative to camera
    orientation.multiply(transformed); //orient the object relative to the camera

    if(transformed.z < 0) {

        d = sqrt(transformed[0] * transformed[0] + transformed[1] * transformed[1]);
        r = -transformed[2] * iReticleSlope + objects[i].radius;

        if(d < r && -transformed[2] - objects[i].radius <= maxRange) {

            //the object is under the reticle

        } else {

            //the object is not under the reticle

        }

    } else {
    //the object is not under the reticle
    }
}

Now this all works fine and dandy until the window ratio doesn't match the resolution ratio.  Is there any simple way to account for that

sentences:
What is the proper way to process joystick input? What is the proper way to process joystick input?

Take, for example, the Xbox One controller. XInput returns joystick input along the x and y axis. I'm not sure if the hardware just measures voltage across the two axis, or not; I'm not very knowledgeable, in the hardware domain.

I'm unsure what data processing is done by API's like XInput already - but since the dead zone is still prevalent, I'm assuming XInput does very little input massaging. This leaves me with a few questions:

Should the dead zone be clipped circularly or rectangularly?
What type of low-pass filter should be applied, if any? Perhaps a moving average should be applied?
Should a bias be introduced into the input based on the resting input?

sentences:
Streamline Facebook and Google Play Game Services integration in Android Game This has been confusing me a lot .

I am creating a simple 2D platformer which I wish to make social. So I thought of letting users do the following:

Share their in game objective completion/ their high score etc with their friends.
Challenge their friends to have a better score / better multiplier etc from their's
View leaderboards of high score , most distance traveled etc both social and global.

So My First preference was Facebook , simply because people have better social connections there.

But then Google Play game services integration has another advantage, It makes you game available in their game services app and may be boost your game ranking in play store if you have game services integrated. But then I'' need to have leaderboards(same ones) for google plus as well. That 'll be too confusing for people.

I do not want people to sign in twice in my app. That'll simple cut down and disperse the number of people getting social with the game.

I personally want to use facebook alone but then google game services may be boosts my app in store.

Can someone tell me a solution to use them both frictionlessly and get the most out of them in my game

sentences: How to use multiple shaders with LibGdx + SpriteBatch I'm programming a 2D game libgdx. I'm using a SpriteBatch of course to draw some Sprites. Now I wanted to use multiple ShaderPrograms with the SpriteBatch, but unfortunately you can set only one `ShaderProgram at a time. For example, I wanted to draw the whole scene with a specific color and wanted to add a parallax effect to some sprites by manipulating the texCoords in the shader. I know in native OpenGL you can just enable as much shaders as you want before your draw call. But it seems that in libgdx it is not possible.

sentences:
What is the "MSN Game API"? The other day I herd this "MSN Game API" mentioned, but I can not find any information about it anywhere. This particular API seems to be for browser based games (Such as Flash, and ActiveX embedded games).

What exactly is this API for? And is that its correct name? is it to do with the MSN Zone? Where can I find more information about it, and maybe even some documentation on the actual API.

sentences:
Custom inventory items based on inheritance So, here's the scenario:
I'm building an RPG. Like most of the other RPGs on the market, my game will feature an inventory and of course, inventory items. So far I've worked well with using a single class for all items, because I did not need anything else than character stat alteration on item usage (consumption). However, I'd like some items to have a more exotic effect. Think of something like when the user consumes a transformation potion, he automatically turns into a beast.

In order to achieve this I've thought about declaring a new class that inherits from BaseItem for each item. Each descendant would override some methods (like void OnConsume()), to change the base behavior.

This works fine, but when it comes to inventory management, I have some issues. The actual inventory will have to work with BaseItem components only (for obvious reasons, as it's an enumerable collection of objects of the same type); casting any descendant to the base class is possible, so no problems in adding items to the inventory. But how can I keep track of the descendant's type (class) for each item in the inventory? And how to perform the descendant's OnConsume from withint he inventory, for each item?

Let me know if you can think of a better solution than mine, or if you can think of a solution to my problem only.

Development is done in C#, inside Unity 3.5.

Thanks!

sentences:
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:
Unity: detect animation's end I need a way to detect if animation's clip finished playing and then execute a certain code. Here's some script, that I wrote (called in Update):

    if (Input.GetButtonDown ("Fire1") && pc_atttacking == false && PlayerStats.staminaCurrent != 0) {
        pc_atttacking = true;
        pc_anim.SetBool("attack", true);
    }

    if (pc_anim.GetCurrentAnimatorStateInfo (0).IsName ("attack")) {
        pc_atttacking = false;
        pc_anim.SetBool("attack", false);
    }

But it doesn't work as I want; it executes second code too early - when "attack" animation is at slightly more than half of playing position.
I want to execute it when "attack" animation is at last frame.

sentences:
Local shape color blending I am trying to implement this in Unity 4 Pro.

But I am stuck in the blending part. I don't understand how you could blend multiples textures/colors using multiples volumes on an object. How could you access those volumes in the shader and check for "collision"?

It's seems to be very similar to vertex/pixel lighting. But maybe I am wrong.

Here is the simple effect I am trying to create.

sentences:
How to create a magic orb like in Skyrim? How would I go about creating magic orb that looks like from magic menu in Skyrim in Unity3D?

Here is what I have in mind: Orb Image

And a video of that effect from 0:09-0:13: Orb Video

sentences:
Synchronize running code over the network Unity I want my code to run/perform the same on different Unity clients. I don't know if this is hard to achieve.
Here hare my problems:

The enemies movement:
I have a pathfinding that should always give the same results on server and on clients. Because I use the same pathfinding algorithm on server and client, and the position the algorithm chooses is synchronized with a network transform. But it does not give the same results on client and on server.

Bullets make enemies die over all clients:
I have a script with OnTriggerEnter2D(Collider2D collision) that never gets called at the same moment on clients and server. The clients might miss touching a bullet on an enemy on server but not on a client. So in server enemies died and on client they have not. How to synchronize OnTriggerEnter2D() ?

I will update the question to improve it with more examples when I find them.

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:
How to stop counting point when player dies (Destroy) In my game, I'd like to stop counting points when the player's y is -4. When the pink and red balls fall off the Plane the player gets points. But it seems a bit strange to be able to collect points after the player dies.

This is the code for the player:

     if (transform.position.y < -4)
    {
       Destroy(gameObject);
       gameManager.GameOver();
    }

And in the GameManager.cs I have this:

   public bool isGameActive;

   public void UpdateScore(int scoreToAdd)
   {
      score += scoreToAdd;
      scoreText.text = "POENG: " + score;
   }

   public void GameOver()
   {
      isGameActive = false;
      restartButton.gameObject.SetActive(true);
      gameOverText.gameObject.SetActive(true);
   }

And this is the code for adding points when the enemies fall over the edge:

    if (transform.position.y < -4)
    {
       Destroy(gameObject);
       gameManager.UpdateScore(pointValue);
    }

How can I make the game stop counting points when the player dies?

sentences:
Quality Current Free UDK Tutorials? I'm just getting started with the UDK, with experience in Unity, and would like a good tutorial series about getting to know my way around the basics of level design and a touch on programming. I have found some basic tutorials on level creation, but they are pretty old, and would like to know more.

Thank you!

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:
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:
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:
Need Help with Hovering Mouse Code I am new to Unity and C#.
I have a script here for a card game where my card is supposed to move up and down when the pointer is hovered over the card. But when my point hovers over each card, they all move up together and not separately. They also move when they touch other UI elements, regardless of what they are. I am doing something wrong but I don't know what.

Here is my code:

//My Codes I needs help on.
   using UnityEngine;
   using System.Collections;
   using UnityEngine.EventSystems;

   public class Mouse_Detector_Temp : MonoBehaviour {
    public bool hovered;
    // Use this for initialization
    void Start ()
    {
        hovered = false;
    }

    // Update is called once per frame
    void Update ()
    {
        //This checks to see if you are hovered over.
        if (EventSystem.current.IsPointerOverGameObject ())
        {
            Debug.Log(gameObject);
            if (hovered == false)
            {
                transform.Translate(0,10,0);
                hovered = true;
            }
        }
        else
        {
            if (hovered == true)
            {
                transform.Translate(0,-10,0);
                hovered = false;
            }
        }
    }

}

Additional Information:
This code is run UI elements that are part of a Canvas (only way to do it, so that should be obvious).

sentences:
Exporting unity features to your game I wonder if it is possible to export Unity features to my game.

For example if I want user to be able to modify scale or rotation of object, do I have to scritp it myself or can i somehow export it ?
Same question about some simple texturing, adding lights, etc.

sentences:
How to Rotate a Circle Around Its Own Midpoint I have rendered a circle using OBJ file. Now I want to rotate it around its own axis, like YouTube buffering icon.  How can I do that? I'm working in OpenGL.

I can change its x, y, and z rotation using a transformation matrix.

sentences:
Selected enemy off camera I'm facing a problem with a game I'm making.
Currently I can select an enemy and mark it as shown on the image:

But now I want to show the position of the selected enemy on the screen when it's off camera.
So my questions are:

How do I know when an enemy is off camera.
How can I show in GUI an arrow on the edge of the screen that points to the position of that enemy. Perhaps something related to what I did to point towards the crosshair?

Vector3 positionOnScreen = Camera.main.ScreenToWorldPoint(mousePos + Vector3.forward * range);
Vector3 targetDir = positionOnScreen - transform.position;

Thanks!

sentences:
Ways to move a character in Unity I am studying Unity, and so far I encountered three different ways to move a character. As far as I understand:

Directly changing the transform  - ignores both physics and colliders;
Using a CharacterController component - ignores physics but considers colliders;
Using a RigidBody component - considers both physics and colliders.

Are these descriptions correct? Which one should I use?

sentences:
What are pixel-based path finding algorithms? (path doesn't need to be shortest) I have a canvas of size of approximately 1000x1000 pixels. I also have a matrix that represents that canvas and returns -1 if that 'pixel' is walk-able. I need to find a path between one of my objects and some endpoint that DOESN'T necessarily need to be shortest. I just need a path.
What algorithm should I use?

sentences:
Can't get sprite to rotate correctly? I'm attempting to play with graphics using Java/Slick 2d. I'm trying to get my sprite to rotate to wherever the mouse is on the screen and then move accordingly. I figured the best way to do this was to keep track of the angle the sprite is at since I have to multiply the cosine/sine of the angle by the move speed in order to get the sprite to go "forwards" even if it is, say, facing 45 degrees in quadrant 3. However, before I even worry about that, I'm having trouble even getting my sprite to rotate in the first place. Preliminary console tests showed that this code worked, but when applied to the sprite, it just kind twitches. Anyone know what's wrong?

int mX = Mouse.getX();
    int mY = HEIGHT - Mouse.getY();
    int pX = sprite.x;
    int pY = sprite.y;
    int tempY, tempX;
    double mAng, pAng = sprite.angle;
    double angRotate=0;

    if(mX!=pX){
        tempY=pY-mY;
        tempX=mX-pX;

        mAng = Math.toDegrees(Math.atan2(Math.abs((tempY)),Math.abs((tempX))));
        if(mAng==0 && mX<=pX)
            mAng=180;
    }
    else{
        if(mY>pY)
            mAng=270;
        else
            mAng=90;
    }

    //Calculations
    if(mX<pX&&mY<pY){ //If in Q2
        mAng = 180-mAng;
    }
    if(mX<pX&&mY>pY){ //If in Q3
        mAng = 180+mAng;
    }
    if(mX>pX&&mY>pY){ //If in Q4
        mAng = 360-mAng;
    }

    angRotate = mAng-pAng;
    sprite.angle = mAng;

    sprite.image.setRotation((float)angRotate);

sentences:
How are the scripts connecting? I been following the playlist in brackeys for unity for beginners and it gets a little fast and complicated at the end and just curious about if a script makes a reference like:

FindObjectOfType<GameManager>().EndGame();

With GameManager being a empty and EndGame being a function to another script.

It runs it but does it connect to the script through the GameManager object since it's connected to the script?

I just want to know how it's getting to the script function and that is the only mention of GameManager in the whole script.

sentences:
Quaternion not giving correct value back. What am I doing wrong here? Right so I made a quaternion and assigned it a value but it reports back the wrong value.

Here is the relevant code...

Quaternion LeftTurnLimit = Quaternion.identity;
float test = 0.1f;

LeftTurnLimit = Quaternion.Euler(test, 0, 0);
Debug.Log(LeftTurnLimit);

Expected result: (0.1, 0, 0) / (x, y, z)
Result: (0.0, 0.0, 0.0, 1.0) / (x, y, z, w)

So what am I doing wrong here?

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:
How to make a TCP Client Server in java over multiple Networks So I am trying to write server code for my game, and I am kinda running in a wall. I have seen oracles example for a server and client, but how do I allow it to connect to computers outside my network? Pretty much I'm trying to do the following

Client presses a key to move 1 unit to the left, the server receives the Client's input, checks if any modification is made, if there is send Client back to where they started.

The problem I have is how do I connect a Server and Client on separate internet connections?

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:
Timestep in multiplayer game I'm trying to wrap my brain around the concept of creating a server/client multiplayer experience.

My problem is mainly related to timestep.  Consider the following scenario:

A client connects to a server.  The client sends his inputs to the server to indicate he wants to move.  Server simulates the input and determines the position of that client in the game world.

Since the client and the server are both running on different timesteps, how do you accurately simulate so that all clients are in sync with the server?   My server is currently set at at 30ms timestep.  When I process client movements, there are potentially hundreds of requests waiting to be processed, yet no way to indicate how long it took between each one of the requests.

I'm really not grasping how to properly simulate on the server based on time, in order to have everything sync up.

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:
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:
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:
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:
Ogre3D : seeking advices about game files management I'm working on a new game, and its related level editor, based on Ogre3D.
I was thinking about how i could manage the game files, knowing that Ogre use .mesh files for models, .material for materials/texture information etc... .
At first i thought about a common .zip folder decompressed at runtime (the same way Torchlight and Ogre samples do). But this way the game assets become a monolithic archive, loading takes time, and could be difficult to eventually patch them.
So, let's say i have a game object named "Cube" i want to load in my program.
Going for modularity, what if i create a compressed file (using zlib compression routines) named Cube.extname, containing its sub-files Cube.mesh, Cube.material and so on ?
Are there any alternatives or should i stick with compressed objects?

PS: Just to clear things, the answer is unrelated to my program code, at the moment i'm using "resources.cfg" pointing to the OgreSDK media directory.

sentences:
Godot 3.X Implementing a smooth movement for pitch, yaw & roll I'm implementing pitch, yaw and roll on airplane object, but when rotating the object (either pitch, roll or yaw), it starts rotating slowly but then the rotating movement goes awfully fast very quickly.
it's quite jarring. i'm not sure how to make more smooth.
The issues:

I think the problem lies in the acceleration when the object rotates, i want to be an uniform speed
Other problem from this code, it's that if want to change the rotating direction it's slow to change, takes a while to rotate to the opposite direction

The player input code:
extends Node
const MAX_CAM_ANGLE = 30
var pitch_dir = 0
var yaw_dir = 0
var roll_dir = 0
var thrust = 0.5
var input = ''
func _ready():
    $DebugStats.add_property($Plane, "transform:origin", "round")
    $DebugStats.add_property($Plane, "force", "round")
    $DebugStats.add_property($Plane, "torque", "round")
    $DebugStats.add_property(self, "pitch_dir", "round")
    $DebugStats.add_property(self, "input", "")

func _physics_process(delta):
    process_inputs(delta)
    process_movement(delta)

func process_inputs(delta):
    if Input.is_action_pressed("p1_fire"):
        $Plane.fire_weapon()
        input = 'fire'
    if Input.is_action_pressed("ui_up"):
        thrust += delta
        input = 'accel'
    if Input.is_action_pressed("ui_down"):
        thrust -= delta
        input = 'slow'
    if Input.is_action_pressed("p1_pitch_up"):
        pitch_dir += delta
        input = 'up'
    if Input.is_action_pressed("p1_pitch_down"):
        pitch_dir -= delta
        input = 'down'
    if Input.is_action_pressed("p1_roll_left"):
        roll_dir += delta
        input = 'yaw left'
    if Input.is_action_pressed("p1_roll_right"):
        roll_dir -= delta
        input = 'yaw right'
    if Input.is_action_pressed("p1_yaw_left"):
        yaw_dir += delta
        input = 'yaw left'
    if Input.is_action_pressed("p1_yaw_right"):
        yaw_dir -= delta
        input = 'yaw right'

    if Input.is_action_pressed("ui_quit"):
        get_tree().quit()

#TODO Adjust values to make movement more smooth
func process_movement(delta):
     thrust = clamp(thrust, 0.2, 1)
     pitch_dir  = clamp(pitch_dir, -.6, .6)
     yaw_dir  = clamp(yaw_dir, -.6, .6)
     roll_dir  = clamp(roll_dir, -.6, .6)
     $Plane.calc_force(thrust, pitch_dir, roll_dir, yaw_dir)

The plane movement script:
extends RigidBody

const v3 = Vector3(0, 0, 0)
const scalar_z = Vector3(0, 0, -1)
var force = v3
var torque = v3
var drag = v3
var lift = v3
var thrust = v3

const MAX_THRUST_TURN = 150
const MAX_THRUST = 1  # temporal value just to debug the rotating problem
const MAX_CAM_ANGLE = 30
const DRAG_CONST = 1 # temporal value just to debug the rotating problem

# Calculates flying speed and direction
func calc_force(thrust, pitch_dir, roll_dir, yaw_dir):
    var speed = MAX_THRUST * (thrust)
    var drag_coef = DRAG_CONST / MAX_THRUST / MAX_THRUST
    thrust = transform.basis.z * (-speed)
    drag = transform.basis.z * drag_coef
    lift = transform.basis.y * drag_coef

    force = thrust + drag + lift
    var pitch = global_transform.basis.x * pitch_dir * MAX_THRUST_TURN
    var yaw = global_transform.basis.z * yaw_dir * MAX_THRUST_TURN
    var roll = global_transform.basis.z * roll_dir * MAX_THRUST_TURN
    torque = pitch + yaw + roll

# Applies all force at once in the airplane object
func _integrate_forces(state):
    add_central_force(force)
    add_torque(torque)

How i can make the rotating movement more smoother?
Note: this is an arcade game, not really interested in a complex solution for the physics.
Note 2: if you want to test it, you can check out here
https://github.com/balmeidaa/godot_sky_aces

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: How can I prevent clicks from going through a GUI.Box? I have a GUI.Box that I slide in from the side of the screen. How can I prevent mouse interaction from going to any objects under it (another GUI.Button for instance, or for that matter an GameObject)?

sentences:
UDP server in unity not working I know there are a lot of UDP examples out there, but I really need to know specifically what I am doing wrong. I have Wireshark monitoring my data traffic and according to that program Unity is not sending data at all. Could some of you coding wizards look over this and help me find my mistake?

public class heatLampControl : MonoBehaviour { //Ben Stewart, june 6th, 2016
                                           //this code controls the                      "Position" of the heat lamps, ie what angle the heat should be coming from. The
// value will be added to a new UDP connection to the dSPACE machine

//Update 6-10: Added UDP functionality, as accessing the UDP class that was created for this purpose turned out to not function correctly
public float lampIntensity = 0.0f; //Multiplier for relative intensity of the sunlight
GameObject sun;
public GameObject player; // dropped in via GUI
public bool isNight = false; // is it night? if so, heat lamp should turn off
public double sunAngle; // angle about the y axis. that is the only angle that can be controlled.
public bool isOn = false;
public string keyDown;
public int port;
public string dataStr;
byte[] data;
public GameObject cycle; //following three keep track of day/night cycle
public Day_Night.TimeOfDay tod;
public Day_Night dayNight;
public int strLength;
private IPAddress ip;
private UdpClient udp;
private IPEndPoint ipep;
public float fruitIntensity;
public float hayIntensity;
OlfactoryControl olfactory;
string hostname;
IPAddress[] ipList;
void Start () {
    hostname = Dns.GetHostName ();
    ipList = Dns.GetHostEntry (hostname).AddressList;
    port = 13722;
    cycle = GameObject.Find ("DayNight");
    dayNight = cycle.GetComponent<Day_Night> ();
    sun = this.gameObject;
    olfactory = GameObject.Find ("Olfactory").GetComponent<OlfactoryControl>();
    ip = ipList [0];
    ipep = new IPEndPoint (ip, port);
    udp = new UdpClient (13722);
}

// Update is called once per frame
void Update () {
    sunAngle = player.transform.eulerAngles [1] - Math.Atan2 (sun.transform.position [2], sun.transform.position [0]);// gets the positional angle of the sun compared to the player
    keyDown = Input.inputString;
    if (isNight || Input.GetKeyUp (KeyCode.L)) { // IF L is pressed down, light will come on
        lampIntensity = 0f;
        isOn = false;
    }
    if (!isNight && Input.GetKeyDown (KeyCode.L)) {
        lampIntensity = 1f;
        isOn = true;
    }
    tod = dayNight.tod;
//      if (tod == Day_Night.TimeOfDay.Idle)
//                      lampIntensity = 1.0f;
//      if (tod == Day_Night.TimeOfDay.SunRise) {
//          lampIntensity = (dayNight.timeOfDay / (dayNight.sunSet - dayNight.StartTime));
//      }
        hayIntensity = olfactory.hayIntensity;
    fruitIntensity = olfactory.fruitIntensity;

    sendUdp ();

}

//june 30th edit
void sendUdp(){

    dataStr = hayIntensity.ToString () + fruitIntensity.ToString () + lampIntensity.ToString ();
    byte[] sendBytes = System.Text.Encoding.ASCII.GetBytes (dataStr);
    Debug.Log (dataStr);
    udp.Send (sendBytes, sendBytes.Length, ipep);
    Debug.Log ("Data sent to IP Address " + ip.ToString() +  " on port " + port.ToString());
}
}

sentences:
Graphics.drawImage will only fill a small portion of my control I'm trying to create a map class for a simple 2D game. The map has an array(100,100,5) of string, returning the kind of tiles to draw ( with 5 possible layers from 0 to 4) players will move on the 2nd layer, the background of the game is on layer 0)

I'm want a drawMap sub that I would be able to call as needed. ( not the onPaint method, because I'm loading the game data map from  a binary file, and this game contains the needed coordinates, number of tiles, etc and the array of tiles, so I need to load the map info 1st, then use the draw sub)

I'm struggling right now because only the Tiles(0 to 3, 0 to 1,0) are showing ... while my array is full of tiles  !

Heres the code :

Public class Map
   inherits Panel

'... properties and stuff ....'

 Public Sub New(Optional ByVal mapName As String = "")

    G = Me.CreateGraphics()

    Me.BorderStyle = Windows.Forms.BorderStyle.Fixed3D
    Me.Location = New Point(250, 50)

    Load(mapName)

    Me.Width = mapSizeX * tileSize
    Me.Height = mapSizeY * tileSize

End Sub

Public Sub DrawGraphics(ByVal layer As Integer, ByVal g As System.Drawing.Graphics)
    For y As Integer = 0 To Map.mapSizeY - 1
        For x As Integer = 0 To Map.mapSizeX - 1
            If Not Map.Tile(x, y, layer) = "" Then
                GetSourceRect( x, y, layer, Map) 'return rectangle from my spritesheet '
                dRect = New Rectangle((x * tileSize), (y * Map.tileSize), tileSize, tileSize)
                g.DrawImage(SpriteSheet, dRect, sRect, GraphicsUnit.Pixel)
            End If

        Next
    Next
End Sub
end class

Load(mapname) deserializes a binary file containing the value for mapSizeX and mapSizeY, as well as tileSize and the Tiles(100,100,5) array all filled up.

What am I doing wrong at this point ?

sentences: How to rotate an object to a specific transform? I am working on a car racing game and there are some times when the car rotates and ends up on its roof. On those situations I want the car to respawn on the same location. What can I do to rotate it so the car ends up on its wheels?

sentences: Importing a .x file to 3D Studio Max? I've been googling this for a while and haven't been able to find anything (blenders importer does not work). How can I import a .x file to 3D Studio Max? There are heaps of resources in converting formats readable by Max to .x but not the other way around.

sentences:
Detecting collision between a sprite and many tiles I have been looking at the following question:- Tile coordinates and am thinking of using this for collision detection in my tile game.

The set up in my game is similar to this, in that there is a grid of tiles, and the sprite will move to (x,y) coordinates. However, if I were to have an object such as a box in my world that is made from multiple tiles, how would I get the collision detection to work?

Any ideas welcome.

sentences:
Blender For Game Development, Pros And Cons Blender is one of those applications that you either love or hate. I know it is great for 3D modeling and and animations and there is a lot said about the UI and its steep learning curve.

I am more interested in how Blender stands out as far as Game Development goes. So my question is, what would be the Pros and Cons of choosing to use Blender to develop a high performance 3D game?

sentences: 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:
Have a particle system's particles obey transparency sort mode individually Background

In a top-down game, I have particles that spawn animated textures. I have my 2D renderer settings set-up so that it orders sprites based on their position on th Y-axis via "Transparency Sort Mode > Custom Axis > Y".

The Problem

But instead of sorting for each particle spawned, what happens is the particle system obeys the setting as a whole so that the sort order is only based on the particle's system's center.

Is there a way to have each particle obey Transparency Sort Mode individually?

What I want for each particle:

What actually happens:

Other Solutions

Other people seem to have an old workaround to use GetParticles and setting their "order in layer" individually. See this thread from 2015:

https://forum.unity.com/threads/particle-systems-with-sprites-order-in-layer.464533/

But I'm trying to find if there's a cleaner solution for Unity 2019 without having to fudge with "order in layer".

sentences:
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: Radiosity lightmap generation Is there any working C++ source code for a lightmap generation algorithm using Radiosity or any other GI system? I've found technical papers only, but I can't really find any implementation.

sentences:
How to make two keys pressed to make an action? Hey i am beginner gamedev. I couldn't find answer to this or I am bad articulating my problem. But really would like an answer to this. How can i make function to press two keys like A and D at the same time to make a jump animation if A and D are already taken separately to A = walk left and D = to walk right? Without them overlapping.
func _input(event):

if event.is_action_pressed("left") && event.is_action_pressed("right"):
    $DancerSprite.play("bluedouble")

if event.is_action_pressed("left"):
    $DancerSprite.play("blueleft")
    return

elif event.is_action_pressed("right"):
    $DancerSprite.play("blueright")
    return

sentences:
Deal with mini states in game Hi :)
I want to ask what is the best way to deal with "mini-states" in game? For example I making game like Simcity, i can build buildings, roads, rails, or I can change something in economy.
I am making something like:

enum
{
  ROAD_CONSTRUCT,
  BUILDING_CONSTRUCT
  VIEW_MAP
  etc..
}

and in the game loop big switch. But the code is getting big. Is there some solution for all popular languages? I am asking because I am writing in C++, AS3 and sometimes in C.

sentences:
How to Sort Shoebox frames by order? I ve been playing with ShoeBox lately and when trying to make a frame sheet i see that they don't appear alphabetically (frame_1 , frame_2 , etc). But they appear by best fitting. In Texture-Packer you can sort it by name but i cant see that option in ShoeBox.

How can i do this?
Thanks in advance

sentences:
"error CS0246: The type or namespace "NAMESPACE" could not be found" while declaring that namespace usage I have two scripts, one is located at:

  Assets / Scriptable Objects / ...

while the other one is located at:

  Assets / Scripts / ...

I have the first script encapsulated on a namespace.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using VoidlessNodes.LevelFlowNodes;

namespace VoidlessUtilities
{
[CreateAssetMenu]
public class LevelFlowData : BaseNodeEditorData<BaseLevelNode, LevelFlowEditorAttributes>
{
    private const string MENU_ITEM_PATH = "Create / ScriptableObjects / LevelFlowData";
    private const string NEW_ASSET_PATH = "ScriptableObjects / Level Flow Data";

    [SerializeField] private string _name;
    private RootLevelNode _root;

    /// Gets and Sets name property.
    public string name
    {
        get { return _name; }
        set { _name = value; }
    }

    /// Gets and Sets root property.
    public RootLevelNode root
    {
        get { return _root; }
        set { _root = value; }
    }

    [MenuItem(MENU_ITEM_PATH)]
    public static void CreateAsset()
    {
        LevelFlowData scriptableObject = ScriptableObject.CreateInstance<LevelFlowData>() as LevelFlowData;
        AssetDatabase.CreateAsset(scriptableObject, AssetDatabase.GenerateUniqueAssetPath(NEW_ASSET_PATH));
    }

    public BaseLevelFlowNode GetLevelFlow()
    {
        BaseLevelFlowNode rootLevelFlow = null;

        if(root != null)
        {
            rootLevelFlow = root.GetNode();
        }
        else
        {
            Debug.LogError("[LevelFlowData] Data has no RootLevelFlowNode saved");
        }

        return rootLevelFlow as RootLevelFlowNode;
    }
}
}

And the other one is using the same namespace, which is a namespace I use for my custom scripts, but the only difference is that LevelFlowData's location is not under Scripts.

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

public class TestLevelController : Singleton<TestLevelController>
{
    [SerializeField] private LevelFlowData _levelFlowData;
    [SerializeField] private List<GameObject> _testViews;

    /// Gets and Sets levelFlowData property.
    public LevelFlowData levelFlowData
    {
        get { return _levelFlowData; }
        protected set { _levelFlowData = value; }
    }

    /// Gets and Sets testViews property.
    public List<GameObject> testViews
    {
        get { return _testViews; }
        set { _testViews = value; }
    }

#region UnityMethods:
    void OnEnable()
    {
        BaseInteractable.onTriggeredEvent += (int _eventID, bool _triggered)=> { Debug.Log("[TestLevelController] Event Triggered: " + _eventID); };
    }

    void OnDisable()
    {
        BaseInteractable.onTriggeredEvent -= (int _eventID, bool _triggered)=> { Debug.Log("[TestLevelController] Event Triggered: " + _eventID); };
    }

    /// TestLevelController's' instance initialization.
    void Awake()
    {

    }

    /// TestLevelController's starting actions before 1st Update frame.
    void Start ()
    {

    }

    /// TestLevelController's tick at each frame.
    void Update ()
    {

    }
#endregion

#region PublicMethods:
    public void EnableView(int _index)
    {
        testViews.SetAllActive(false);
        testViews[_index].SetActive(true);
    }
#endregion

#region PrivateMethods:

#endregion
}

Do I need to move LevelFlowData to Scripts, and make platform independet compilation (e.g., #if UNITY_EDITOR) encapsulation for UnityEditor namespace usage? Or is there another point I am missing?

This is the specific error log:

  Assets/Scripts/Scene Controllers/TestLevelController.cs(10,27): error CS0246: The type or namespace name `LevelFlowData' could not be found. Are you missing an assembly reference?

Thanks in advance.

sentences:
Help with concrete examples of Perlin Noise variables for terrain generation I believe this question can help beginner game developers. I've looked through a dozen or so answers on perlin noise here and on Stackoverflow, and found only 1 concrete implementation of perlin noise that I have listed below. There's a lot of advice, but it's hard to translate into what I have to do with X and Y values, and if I have to do this at all times, or only when I want specific features to appear.

Here's what I got from Stackoverflow: I believe this was advised as mixing various noise octaves. It seems to generate a fairly interesting terrain, although it rarely generates mountains for me.

  float perlinNoiseValue =
    +1/15.0* fabsf([generator perlinNoiseX: perlinX y: localYIndex z: 0 t: 0])
    +2/15.0* fabsf([generator perlinNoiseX: 2*perlinX y: 2*localYIndex z: 0 t: 0])
    +4/15.0* fabsf([generator perlinNoiseX: 4*perlinX y: 4*localYIndex z: 0 t: 0])
    +8/15.0* fabsf([generator perlinNoiseX: 8*perlinX y: 8*localYIndex z: 0 t: 0]);

I'm looking at this answer on Perlin Noise by Byte56, and it's hard for me to translate verbal descriptions into what I have to do with X/Y inputs. Can someone provide concrete examples, along with descriptions of what terrain features such noise generates?

For example, does mixing noise by picking the max value equates to something along the lines of

float perlinNoiseValue1 =  fabsf([generator perlinNoiseX: perlinX y: localYIndex + 300 z: 0 t: 0]);
float perlinNoiseValue2 =  fabsf([generator perlinNoiseX: perlinX y: localYIndex z: 0 t: 0]);

float finalValue = fmax(perlinNoiseValue1,perlinNoiseValue2);

Do I always pick the max value in the case above, or only in some cases when I want a certain feature to manifest?

Does flatter terrain look like ?

float flatterTerrain =  fabsf([generator perlinNoiseX: perlinX y: 0.2*localYIndex z: 0 t: 0]);

Does wider valleys and hills look like?

float widerValleys =  fabsf([generator perlinNoiseX: perlinX*3.0 y: localYIndex z: 0 t: 0]);

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:
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:
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:
How can I synchronize ocean waves over the network? I've been performing a little bit of research in my spare time on ways to increase the interactivity of environments in a networked game or simulation.

One of my areas of research is fluid-dynamics and whether it would be possible to synchronize it over the network. I believe the short answer to that is - Yes of course you can. But there will obviously be trade-offs as there are with any network synchronization problem.

I was recently playing Battlefield 4 and a number of their maps have playable ocean areas with fully functional waves large enough to obscure entire boats during gameplay. It seems to work quite well as well.

My assumption here is that the ocean simulation is completely offline and each client performs synchronization with the server during initialization. This would allow all clients to run the exact same ocean simulation that appears to be dynamic but is in fact the same offline simulation every time.

Interaction with the ocean simulation appears to be only superficial with local splash/wave depression. I assume that is entirely local to the client and not synchronized.

My question here is:

Would the above be an appropriate way to synchronize fluid simulation over a networked game? If not, what would you suggest?

sentences:
Block picking / ray casting through 3d blocks always slightly off I've been working on adding a line-of-sight/ray-tracing system to my 3d block-world game. I've tried several different methods and they all work fairly well. At the moment I'm using something similar to what Bukkit uses.

Essentially, using the point of origin (the player location, plus the extra height for the "eye" of the camera), and the current yaw and pitch, I'm looking for every block that the line of sight would pass through.

For the most part it works - however, the "ray" is always slightly off, by roughly half a block or so. What I mean is, as I slowly move my cursor left/right or up/down, the block I'm actually focusing on doesn't "highlight" (for testing, I set it to snow) until the cursor is roughly to the middle. This offset varies a bit based on my angle to the block.

http://d.pr/i/vaZo

It seems like when my cursor is on the left 50% of a block, the block to the left highlights. The top 50% of the block, the block above highlights. Same for right/bottom 50%s.

I'm trying to understand where this discrepancy is coming from. I've been tweaking and toying with code based on the assumption that one of the following is the issue:

The "eye" offset or the player's location are wrong. I'm using the same y offset the camera uses and as far as I can tell from collision, the standing location of the player is accurate
The ray somehow needs adjusted yaw/pitch values? I don't see how, those yaw/pitch values are used for the camera. They should describe the exact direction the ray needs
The "normalization" code for the vector is wrong. I've found essentially same code in multiple examples, and it seems like it doesn't round/cast values, so I shouldn't be losing anything

I'm looking for advise on:

What values are the most likely cause for a half-block offset?
or, how do I fix?

The player's camera is set like this:

GL11.glLoadIdentity();
GL11.glRotatef(pitch, 1.0f, 0, 0);
GL11.glRotatef(360.0f - yaw, 0, 1.0f, 0);
GL11.glTranslatef(-position.x, -position.y - EYE_HEIGHT, -position.z);

EYE_HEIGHT is 1.8f

The "direction" vector is normalized like this:

Vector vector = new Vector(0,0,0);
vector.setY( (float)-Math.sin(Math.toRadians(pitch)) );
float v = (float)Math.cos(Math.toRadians(pitch) );
vector.setX( (float)(Math.sin(Math.toRadians(yaw))*-v)  );
vector.setZ( (float)(Math.cos(Math.toRadians(yaw))*v)  );

And the player's location is essentially just a `Vector3f.

I've found several alternate methods of calculating the right info here on gamedev, but the code I have is so close it doesn't seem worth ditching. Though I will if needed, lol.

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:
How to find the optimum path, on a road, for a car? For the moment I have an AI car, that follows points (let's call this Waypoints), that I built by myself.

Of course, it's not optimal because of my poor human hand, and car knowledge.

After this drawing, I put waypoints (about 80) on this red line, and my car is able to follow it (and dodge other cars, but that's another story).

But... It's not perfect: I read some articles, but I don't know how to  implement the generation of the perfect path..

http://www.drivingfast.net/techniques/racing-line.htm (speaking about an 'Apex', but I don't know how to find this particular point)
"Searching for the Optimal Racing Line Using Genetic Algorithms" (too complicated for my little game)

sentences:
Simple 3D collision detection for general polyhedra I have correctly set up a SAT system. I now need to determine a simple, fast, and general purpose collision detection mechanism to identify the collision points. These points will then be used to determine the constraints for Catto's algorithm.

Unfortunately there seems to be a huge set of candidate algorithms, hence my confusion.

My first take would be, given that SAT tells me the candidate triangle-vertex or triangle-triangle for the collision, to perform the following:
- if SAT results in a T-V collision, we are done; collision is at V
- if SAT results in a T-T collision, then the collision points are found by intersecting the vertices of triangle1 with triangle2 and the edges of triangle1 with triangle2

Am I missing something big?

sentences:
Lunar Lander calculating gravity, acceleration and collision in GameMaker I've already asked this on the GameMaker forums but had no response so far.

I'm making a little Lunar Lander game as my first foray in to GameMaker, I'm wanting to have the ship land and take off again too.  I'm new to scripting and programming in general and I'm having trouble with acceleration, in particular with gravity.

Basically I need to:

Be constantly pulled downwards to simulate gravity up to a maximum speed (terminal velocity)
Activate thrusters to accelerate my ship towards its current direction
Turn the ship left and right, therefore adjusting my current direction
Land on surfaces (I've been accomplishing the collision by setting my gravity to 0) and then take off again (thereby activating gravity again)

The problem:

I can't figure out a natural, correct way to accelerate the ship with gravity up to its terminal velocity
I also can't figure out how to add the ship's thrust to gravity (i.e. if I'm facing downwards and firing the thrusters I should be going faster than if I wasn't firing the thrusters). As gravity is only pulling me down in the y direction and the thrust of the ship could be a force pushing me in any direction (according to my ship's angle) this is tricky (for me...).
The whole thing doesn't feel like particularly smooth motion

An example of my code is as follows:

direction = image_angle

fallSpeed += grav

if fallSpeed > 2
{
fallSpeed = 2
}

y += fallSpeed

motion_add(direction,shipThrust)

if keyboard_check(ord('W')) and speed < maxSpeed
{
   shipThrust += 2/room_speed
}
else
{
    shipThrust -= 2/room_speed
}

if shipThrust > 20/room_speed
{
shipThrust = 20/room_speed
}

if shipThrust < 0
{
shipThrust = 0
}

if place_meeting(x,y,oGround)
{
    fallSpeed = 0
    grav = 0
}
else
{
    grav = 0.2
}

if keyboard_check(ord('A'))
{
    image_angle += 3
}

if keyboard_check(ord('D'))
{
    image_angle -= 3
}

speed = max(speed -0.1,0)

Some of that code is probably (read: clearly...) wrong and I figure I need an overall 'speed' value of the ship that I then affect with my two forces (gravity and thrust) but I can't for the life of me figure out how to do it.  Any help is appreciated, thanks! :)

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:
How to rotate a rectangle body around a fixed point? How to rotate a body around a point?
The body has x, y, speed and angle. Coordinates of the body relative to its center. Additional conditions: point position and distance from body to point.

sentences:
How does one calculate color intensity? How do I calculate color intensity if I have a image sample of RGB?

The sample is of a float3 of red, green, blue. I'm trying to do a bilateral blur and have to not change the image if the color intensity is the same so it will preserve edges.

 float4 BilateralFiltering(VertexOut input) : SV_Target
{

 const float pixel = 0.01f;

     float4 centralColor;
     float gaussianWeightTotal;
     float4 sum;
     float4 sampleColor;
     float distanceFromCentralColor;
     float gaussianWeight;
     float distanceNormalizationFactor = 1.0;
     centralColor = gDiffuseMap.Sample(samAnisotropic, input.Tex.xy + float2(0,0));
     gaussianWeightTotal = 0.18;
     sum = centralColor * 0.18;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(-pixel,-pixel));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.05 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(-pixel,0));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(-pixel,pixel));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.12 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(0,-pixel));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.15 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(0,pixel));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.15 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(pixel,-pixel));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.12 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(pixel,0));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(pixel,pixel));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.05 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     return sum / gaussianWeightTotal;

     }

sentences:
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:
Can I use a SkinnedMeshRenderer animation in a Canvas? I just downloaded an asset from the store: https://www.assetstore.unity3d.com/en/#!/content/67122

They're just animated characters. If you drag & drop the prefabs on the scene, it works fine.

The thing is, I work exclusively with Unity's new 2D Canvas/Image/Button/etc. These prefabs instead use a SkinnedMeshRenderer so it's not like you can put them inside your Canvas.

I want to have the prefabs work in my Canvas. For all intents and purposes I want those animations to act like a Image inside the Canvas.

This is what one of those prefabs looks like:

I want to take advantage of the Unity's canvas because it makes a lot of things easier - like scaling for all devices, scroll views, easy masks, etc.

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

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

http://youtu.be/xrJVKjFEzYg

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

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

What could be causing this problem?

sentences:
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:
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:
Question about BoundingSpheres and Ray intersections I'm working on a XNA project (not really a game) and I'm having some trouble with picking algorithm. I have a few types of 3D models that I draw to the screen, and one of them is a switch. So I'm trying to make a picking algorithm that would enable the user to click on the switch and that would trigger some other function. The problem is that the BoundingSphere.Intersect() method always returns null as result. This is the code I'm using:

In the declaration section:
`

//Basic matrices
private Matrix world = Matrix.CreateTranslation(new Vector3(0, 0, 0));
private Matrix view = Matrix.CreateLookAt(new Vector3(10, 10, 10), new Vector3(0, 0, 0), Vector3.UnitY);
private Matrix projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45), 800f / 600f, 0.01f, 100f);

//Collision detection variables
Viewport mainViewport;
List<BoundingSphere> spheres = new List<BoundingSphere>();
Ray ControlRay;
Vector3 nearPoint, farPoint, nearPlane, farPlane, direction;

`

And then in the Update method:
`

nearPlane = new Vector3((float)Mouse.GetState().X, (float)Mouse.GetState().Y, 0.0f);
farPlane = new Vector3((float)Mouse.GetState().X, (float)Mouse.GetState().Y, 10.0f);

nearPoint = GraphicsDevice.Viewport.Unproject(nearPlane, projection, view, world);
farPoint = GraphicsDevice.Viewport.Unproject(farPlane, projection, view, world);

direction = farPoint - nearPoint;
            direction.Normalize();
            ControlRay = new Ray(nearPoint, direction);
            if (spheres.Count != 0)
            {
                for (int i = 0; i < spheres.Count; i++)
                {
                    if (spheres[i].Intersects(ControlRay) != null)
                    {
                        Window.Title = spheres[i].Center.ToString();
                    }
                    else
                    {
                        Window.Title = "Empty";
                    }
                }

`

The "spheres" list gets filled when the 3D object data gets loaded (I read it from a .txt file). For every object marked as switch (I use simple numbers to determine which object is to be drawn), a BoundingSphere is created (center is on the coordinates of the 3D object, and the diameter is always the same), and added to the list. The objects are drawn normally (and spheres.Count is not 0), I can see them on the screen, but the Window title always says "Empty" (of course this is just for testing purposes, I will add the real function when I get positive results) meaning that there is no intersection between the ControlRay and any of the bounding spheres. I think that my basic matrices (world, view and projection) are making some problems, but I cant figure out what. Please help.

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:
Can unity playerprefs fail to save, and if they do how can I check? As the title says I would like to know if playerprefs can fail to save.

If they can, is there some way to check if it save properly / if it failed?

Example :

if (playerprefsFailed)
{
    Debug.Log("Failed to save playerprefs...");
}

I found PlayerprefsException in the Unity API, however I'm confused on how to use it.

I have also googled if they can fail, but couldn't find any results, however considering there is a exception for it, it can probably fail.

The PlayerprefsExceptionis also only thrown on the web player however I would like to know if it can fail, and when, and also how to stop it on a normal pc build.

sentences:
How do I sync multiplayer game state more efficiently than full-state updates? I've done a little game network coding before, but primarily with TCP for games without real-time needs.  I am working on a 2D Java game with networked multiplayer.  For learning, I want to do this myself, without an existing network API.

How do I efficiently represent the game state sent to clients from a server?  There is the most obvious but probably least efficient way, which would be to create some sort of game state context object with each player's location, animation state, etc., and send that out to each player every update.  That doesn't seem terribly difficult to implement, but would probably be too large to achieve anything close to real-time interaction (of course my experience with this is limited so I may be incorrect).

Is there a solid way any of you have used before to only transmit changes in state, and is there even a large enough disparity in performance that it is worth the extra work?

sentences:
Unity2D: Child class inheriting onCollisionEnter() methods I may be an idiot for asking this but I can't seem to solve it myself, I have a GenericWeapon class which has a onCollisionEnter() method which I want applying to all child classes which inherit from it, here is the code:

public void onCollisionEnter(Collider target){
    Debug.Log("Collided with player!");
    if(target.GetComponent<Player>()){
        bc2d.enabled = false;
        rb2d.Sleep();
        equip(target.GetComponent<Player>());
    }
}

My child class is the following:

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

public class RangedWeapon : GenericWeapon
{
    // Start is called before the first frame update
    void Start()
    {
    }
    // Update is called once per frame
    void Update()
    {
    }
    public void attack(){
    }
}

and my in GameObject has the RangedWeapon class as a component however the GameObject does not seem to be picking up any collisions with the player. Could someone point out where I'm going wrong with this?

sentences:
Is there a way to use an arbitrary number of lights in a fragment shader? Is there a way to pass an arbitrary number of light locations (and colors) for the fragment shader, and loop over them in the shader?

If not, then how are multiple lights supposed to be simulated? For example with respect to diffuse directional lighting, you can't just pass a sum of the light weights for the shader.

sentences:
Resource/Asset Manager I'm creating a ResourceManager.
At the beginning i'm creating a groups of resources which contain a map of resources. The role of groups is to quick load/unload resources, to find some constant, never unloading resources which placing to group, for example named Static and newer trying to unload, or find resources common for 2 scenes, or batches etc, this is work of pipeline. Also resource names are hashes of string, they are all unique and its checked off-line.

After i'm adding archives, where assets is stored and load table of contents and put it into group. After i'm calling InitializeGroup where i'm creating a raw resources with out creating or loading some data, only passing to them the Location, where their data is stored.

struct Location
{
    Archive* pArchive;

    size_t m_Offset;
    size_t m_Size;
};

class ResourceManager
{
public:
    struct RacingEngineExport ResourceGroup
    {
        LocationMap m_Locations;
        ResorceMap m_ResorceMap;
        String m_Name;
    };

    void CreateGroup(const String& name);
    void AddLocation(const String& path, const Archive::Type lType, const ResourceGroupName& group, bool recursive = true);

    void InitialiseGroup(const String& name);

    void RegisterResourceHandler(ResourceHandler* pResourceHandler);;

protected:

    ResourceGroupMap            m_ResourceGroups;
};

For each Resource type like Mesh, Texture etc. i'm creating specific ResourceHandler. ResourceHandler responsible to retrieve data from archive(not load, just ask some background queue to load it) and prepare resource for future using, also it's creating and unloading them.

class ResourceHandler
{
public:
    inline ResourcePtr Get(const ResourceID& id);
    ResourcePtr Create(const ResourceName& name, const PropertyMap& properties = PropertyMap(), const bool isManual = false);
    inline void Load(ResourcePtr pResource);
    inline void Unload(ResourcePtr pResource);
    inline void Destroy(ResourcePtr pResource);
}

In Load it's retrieving Archive from Resource::Location::pArchive, loading data from disk and creating some other stuff specific for Resource type.

So when the resource needed by some one, it's calling ResourceManager, retrieving ResourcePtr and asking ResourceHandler to load it if it's not loaded, ResourceHandler somehow (async or sync) loading it and returning ready to use resource.
So now the resources ready to load.

This model not friendly to real-time adding new resources, but it's possible, but i don't need it, just it's can't be loaded again after unload automatically.

So, the question is where i have to store resources, in the main ResourceManager, in all ResourceHandler, in Groups or everywhere? Also i want to hear some recommendations how to improve my impl. or defects in it, or some better way to manage resources. May be my question is stupid but i can't get rid of thoughts that that it's not OK at all.

sentences: 3rd person camera rotate around player with mouse I'm trying to make a 3rd person camera for a game with THREE.js and Physijs (if that's important), and so far I have set it up so that the camera follows behind the player using cos and sin etc. but I want to make it so that the user can rotate the camera in any direction around the player (and zoom in and out of course), and then when the player starts moving slowly lerp/reset the camera position to behind the player, but I'm not sure how to do this in THREE.js, I don't think OrbitControls let's it reset the position (or does it)?

sentences:
Predicting physics/trajectory for pool/billiards games I'm thinking of making a quick proof of concept of a billiard-style game mechanic, where the player has perfect information of what is about to happen.
Here's a good example:

I'm only mildly familiar with physics in both Unity and Flixel-Box2D, and I can't really off the top of my head imagine how to do this.

Should I even use physics at all, or should I just use basic math?

sentences:
which courses in Computer Science are really needed for game development? I would like to know what courses that somebody interested in game development, should take in a Computer Science Career?

I suppose that are necessary for example:

- Discrete Mathematics
- Computer Graphics
- some programming language courses, for example C++ or C#
- AI
- Web programming

what else does anybody involved in this field could recommend me? I got a group of universities that I would like to apply, but their computer science curricula are not the same for every case.

This question is not for generating a debate about which career to follow. I think the natural way will be to follow CS, but here the question is what model would be more suitable according to the standard curricula?

Somebody from mathematics would lack the background in CS, and also that problem comes with people from arts.

Any advice?

sentences:
Present fails randomly on mixed C++ Direct3D9 app I have a mixed .NET application (managed and unmanaged code bridged by C++/CLI wrappers) which uses unmanaged Direct3D9 9.0c to do rendering inside a control which is wrapped inside a C++/CLI class which extends System.WIndows.Forns.UserControl.

Everything has been working fine for years now, but I recently put another instance of this Direct3D9 control inside a new Windows Form. That is, I have two concurrent instances of the control. I had done that before and it worked, but now I have issues. Perhaps the problem was always there, but because it's related to a race condition, it started happening now...

Ok, the details: When I try to render an image over a texture on the new instance of the control, sometimes it works, sometimes it doesn't. And when it doesn't, nothing is rendered, and from that point onwards, all Present calls fail (I log those failures). If I close the form and open it again, it might work or not. Nasty.

If I use DXGetErrorString and DXGetErrorDescription, all I get is something like:

  EFAILED Undetermined error

Not really helpful... To make matters worse, I can't reproduce the issue in my development environment; I only see it in a production box.

As far as I know, the main reason Present fails like this is a Lost Device. But I implemented the usual scheme to handle that (I can post the code if necessary), and it seems like the device is not being lost... What else can I try?

sentences:
Why when using Mathf Lerp the speed is not changing according to Time.deltatime? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DetectCollision : MonoBehaviour
{
    public Transform player;
    public Transform target;
    public bool turnOnOffPlayerAnimator = false;

    float timeElapsed = 0;
    float lerpDuration = 3;
    float startValue = 1;
    float endValue = 0;
    float valueToLerp = 0;

    private Animator playerAnimator;
    private bool entered = false;
    private bool prevFacing = false;
    private Rigidbody rigidbody;
    private bool stopped = false;

    // Start is called before the first frame update
    void Start()
    {
        rigidbody = player.GetComponent<Rigidbody>();

        playerAnimator = player.GetComponent<Animator>();

        if (turnOnOffPlayerAnimator)
            playerAnimator.enabled = false;
    }

    // Update is called once per frame
    void Update()
    {
        var currFacing = IsFacing(target);
        if (currFacing != prevFacing)
        {
            // here you switched from facing to not facing or vise verca.
            timeElapsed = 0;
        }
        prevFacing = currFacing;

        var distance = Vector3.Distance(player.position, target.position);

        if (IsFacing(target))
        {
            if (entered && distance > 30)
            {
                if (timeElapsed < lerpDuration)
                {
                    valueToLerp = Mathf.Lerp(startValue, endValue, timeElapsed / lerpDuration);
                    playerAnimator.SetFloat("Forward", valueToLerp);
                    timeElapsed += Time.deltaTime;
                }
                playerAnimator.SetFloat("Forward", valueToLerp);

                valueToLerp = 0;
            }
        }
        else
        {
            if (valueToLerp < 0.9f)
            {
                if (timeElapsed < lerpDuration)
                {
                    valueToLerp = Mathf.Lerp(endValue, startValue, timeElapsed / lerpDuration);
                    playerAnimator.SetFloat("Forward", valueToLerp);
                    timeElapsed += Time.deltaTime;
                }
                playerAnimator.SetFloat("Forward", valueToLerp);
            }

            Mathf.Lerp(valueToLerp, 0, Time.deltaTime * 0.0001f);
        }

        if(turnOnOffPlayerAnimator)
        {
            playerAnimator.enabled = false;
        }
        else
        {
            playerAnimator.enabled = true;
        }
    }

    private void OnTriggerEnter(Collider other)
    {
        entered = true;

        Debug.Log("Entered !");
    }

    private void OnTriggerExit(Collider other)
    {
        entered = false;

        Debug.Log("Exited !");
    }

    private bool IsFacing(Transform target)
    {
        Vector3 forward = player.TransformDirection(Vector3.forward);
        Vector3 toTarget = target.position - player.position;
        return Vector3.Dot(forward, toTarget) > 0;
    }
}

I tried first 0.1f but it didn't change the lerp speed.
I want that if the player is pressing the W key and moving the player forward and then stop pressing the key W it will smooth slow will lerp to 0. and it does but I also wanted to control the lerp speed.
I want that when the player is starting moving backward direction if the player leave the W key the player should stop slowly to 0. This should be the line :
Mathf.Lerp(valueToLerp, 0, Time.deltaTime * 0.0001f);

but the Time.deltaTime does not seems to affect the lerp at all.
the lerp is working fine I just wanted to control the lerping speed too.

sentences:
Does iOS support BC4 compressed texture? I've been designing a new OpenGL image algorithm using BC4 textures at its core.
It works well accross Windows and Mac, my main targets up to now.

But today, the customer added a new requirement : it should work on iOS too !
I'm starting to worry : is BC4 texture (named GL_COMPRESSED_RED_RGTC1 in OpenGL) supported on iOS devices (tablets & iphones alike) ?

I've read that iOS is OpenGL ES 2.0 capable. But i'm unable to know which textures are supported under this API (except PowerVR ones, which are not compatible with PC & Macs...)

sentences:
Question on methods in Object Oriented Programming I’m learning Java at the minute (first language), and as a project I’m looking at developing a simple puzzle game.

My question relates to the methods within a class. I have my Block type class; it has its many attributes, set methods, get methods and just plain methods. There are quite a few.
Then I have my main board class. At the moment it does most of the logic, positioning of sprites collision detection and then draws the sprites etc...

As I am learning to program as much as I’m learning to program games I’m curious to know how much code is typically acceptable within a given method. Is there such thing as having too many methods?

All my draw functionality happens in one method, should I break this into a few ‘sub’ methods? My thinking is if I find at a later stage that the for loop I’m using to cycle through the array of sprites searching for collisions in the spriteCollision() method is inefficient I code a new method and just replace the old method calls with the new one, leaving the old code intact.

Is it bad practice to have a method that contains one if statement, and place the call for that method in the for loop?
I’m very much in the early stages of coding/designing and I need all the help I can get!
I find it a little intimidating when people are talking about throwing together a prototype in a day too! Can’t wait until I’m that good!

sentences:
Ping Pong bat is not detecting the collision with the wall I have been learning Unity for last couple of days. I want to make one simple ping pong game. The idea is simple. The game has a Sphere as a ball, a plane as ground, 2 rectangles as bats and 4 rectangles as walls. Look at the image

It is a 2 players game. One player will use 'W' and 'S' key and another player will use 'Up Arrow' and 'Down Arrow' on the keyboard to move the bat up and down.

But I have a problem here. If a player moves the bat at the limit (up or down), the bat does not detect the collision with the wall. It just goes through the wall. Look at the image.

The bats and the walls have Box Collider, but still the problem persists. So what should I do so that the bat detects the collision with the wall.

sentences:
How do I calculate a point between two points with a given distance percentage? I've made a simple drawing:

The distance between these two points is calculated with a simple formula:

Which gives: 5,38

I need to calculate the green point's coordinates, which is set at 80% distance from the B point towards the A point.

I could make a direction vector between A and B, and then, add (dir * 5.38 * 0.8) to the B point itself, but it gives me strange results.

Is there a simpler (and more efficient!) way to achieve 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: How can I check on a large number of points to see if they're inside the camera's frustum? I have a locally stored database on my Android project, it is a database of approx 100,000 Point3D(double,double,double). I need to check if each of these points are inside of the camera's frustum in unity. Will I most likely be running into performance issues querying the database and feeding all live Point3D's to unity per frame? What would be the best way to go about this if I am approaching this from the wrong direction?

sentences:
Unity UI Objects edges are not smooth I have this Unity UI Image placeholder and here is the snapshot

 As you can see its edges are not smooth. First I thought this is editor problem but after making the build it remains the same. What i am missing?

sentences:
HTML5 Jump and Run Game Performance issues we're developing a HTML5/Javascript jump and run game and therefore we have developed our own gameframework.
It consists of following most important structures:

Stage/Scene/Layer: divs
ObjectEntites/Rectangle/Sprite: canvas

In the gameloop things get moved by calculating an offset value: e.g. if we place a coin and this coin moves through the screen, it gets a new offset in each gameloop-call. The dirty area of the coin is cleared in the canvas and the coin is repainted. We pay attention that we just draw at int-values (no floating point).

Unfortunately we have some performance issues now and can't figure out why our macbook pro's are running hot while playing the game.

Are the drawing operations so crucial? We have layered Canvas, so just moving stuff gets repainted and even not the whole canvas but just dirty-areas get cleared.

IStat shows following values while playing the game:
Memory module A1 and Heatsink B get up to 60° and the rpm-Value of the Fans increases up to 3000-4000.
In firefox we see these values:

And chrome shows us this, where we also see how cpu increases:

Do you have any idea how to check performance of our game, how to find bottlenecks or general tips? We have searched for canvas performance, used firebug profiler...
We'd be grateful for any advice!

sentences:
Exporting prefab includes a lot of unneccessary asset dependencies I just exported one of my assets into a unitypackage.
It included all dependencies very nicely so I can use them.

Then I tried another prefab, but it included a lot of unrelated assets from all over the project. This is a very simple prefab and I don't know how the clutter is considered to be dependencies.

When I click "show dependencies" it brings up the clutter in the project menu. There should be no clutter dependencies whatsoever. It really isn't that complex of a prefab.

I also double checked the prefab elements to see if any of them are somehow using the said clutter, they aren't.

How can this happen? Is there a way to solve it (other than selective clicking in export menu)?

sentences: Calculating time until a ball fall How exactly can I calculate time until a ball fall if I know initial and final x and y position of a ball, gravity, delta time, initial dx and dy of a ball and its speed calculated from the formula sqrt(dx ** 2 + dy ** 2)?

sentences:
What do sandbox games usually do when generating new terrains? I am trying to make a minecraft. In my game, when the player moves to the boundary, new chunks will be generated.

What I do is creating new chunks in my main thread and generating a new VBO to store them. But I find that it's quite inefficient and you can obviously feel the FPS is decreasing.

What do these kinds of games usually do when generating new terrains? Do they use multi-threads or some specific efficient algorithms or compute shaders (I still don't know much about OpenGL)? I once tried to generate my new terrains in another thread. But I found I can't use GL operation to generate VBO in another thread. I am thinking about pre-generated some VBOs in my main thread. Is that the right way?

I want to know what most people do in this situation.

sentences:
How to prevent players from forcing the veto-holder to give up their veto power? In this game there is a President and the members of the Senate.  Most are good, but a few are evil pretending to be good.  Each day the majority attempts to figure out who is evil (using clues), takes that player to court (where they may argue in their own defense), and then the entire Senate votes on whether to convict that player (eliminate them from the game) or acquit them.

Only 2 such trials are allowed per day (at night, the evil players murder someone), but only 1 conviction per day.

The President may secretly be good or evil, and differs from the rest only in that he has a veto ability.  If someone is taken to court, the President may at any time before the verdict is declared, instantly acquit or convict them.

He may do this only 1 time.

IMPORTANT EDIT: The President must exercise his veto power while voting is in progress, before the decision of the majority has been made public.

The problem is, the other members of the Senate, unwilling to risk the possibility of an evil President overriding the majority decision to convict an evil player at a crucial point later in the game, have developed a meta where the very first time everyone agrees to convict or acquit someone during the first trial of the game, they vocally demand the President to "waste" his veto power in agreement with the majority vote.

If the President refuses they simply take him to court and convict him, eliminating him from the game.

This effectively reduces the President to a normal player.

How can this sort of meta be prevented?

I've tried giving evil players the ability to temporarily disable the President's veto power, in order to give the President a plausible excuse for not using it immediately.  This was an unsatisfactory solution because the evil players did not use it enough for the President's excuse "I was disabled by an evil player" to be convincing.  Evil players simply did not care whether the President could veto because it's too early for them to tell whether the President is on their side or not.

sentences:
Box2D Bicycle Wheels Motor Problem - Flash 2.1a I have made a bicycle with Box2D using several polygons for the frame at different angles connected using weld joints, and I have revolute joints on the wheels with a motor.

I have made some basic terrain (straight ground and a small ramp) and added keyboard input to control the bicycle with torque to balance it. All of this is done in with Box2D's Debug Draw.

When the bicycle is on its back wheel but diagonally forward (kinda like this position -> /) the motors just cause it go spinning backwards over when in reality it should either stay on its back wheel or go down onto both wheels.

Here's my code the revolute joints:

            //Front Wheel Joint

        var frontWheelJointDef:b2RevoluteJointDef = new b2RevoluteJointDef();
        frontWheelJointDef.Initialize(frontWheelBody, secondFrameBody, frontWheelBody.GetWorldCenter());
        frontWheelJointDef.enableMotor=true;
        frontWheelJointDef.maxMotorTorque=10000;
        frontWheelJoint = _world.CreateJoint(frontWheelJointDef) as b2RevoluteJoint;

        //Rear Wheel Joint

        var rearWheelJointDef:b2RevoluteJointDef = new b2RevoluteJointDef();
        rearWheelJointDef.Initialize(rearWheelBody, firstFrameBody, rearWheelBody.GetWorldCenter());
        rearWheelJointDef.enableMotor=true;
        rearWheelJointDef.maxMotorTorque=10000;
        rearWheelJoint = _world.CreateJoint(rearWheelJointDef) as b2RevoluteJoint;

And here's the relevant part of my update function:

            // up and down control wheels motor
        if (up) {
            motorSpeed-=0.5;
        }
        if (down) {
            motorSpeed += 0.5;
        }
        // left and right control cart torque
        if (left) {
            middleCentreFrameBody.ApplyTorque( -3);
            gearBody.ApplyTorque( -3);
            firstFrameBody.ApplyTorque( -3);
            secondFrameBody.ApplyTorque( -3);
            rearWheelToChainBody.ApplyTorque( -3);
            chainToFrontFrameBody.ApplyTorque( -3);
            topMiddleFrameBody.ApplyTorque( -3);
        }
        if (right) {
            middleCentreFrameBody.ApplyTorque( 3);
            gearBody.ApplyTorque( 3);
            firstFrameBody.ApplyTorque( 3);
            secondFrameBody.ApplyTorque( 3);
            rearWheelToChainBody.ApplyTorque( 3);
            chainToFrontFrameBody.ApplyTorque( 3);
            topMiddleFrameBody.ApplyTorque( 3);
        }
        // motor friction
        motorSpeed*=0.99;
        // motor max speed
        if (motorSpeed>100) {
            motorSpeed=100;
        }

        rearWheelJoint.SetMotorSpeed(motorSpeed);
        frontWheelJoint.SetMotorSpeed(motorSpeed);

Any ideas what might be causing this?

Thanks

sentences: how to android touch in Unity? I am creating simple game for android.I used touchphase.moved to power up my ball and touchphase.ended to throw the ball.But what happened is the ball is thrown when I moved my finger in both x and y direction.But I want the ball to be thrown only while swiping in y direction.How to do that Suggest me?

sentences:
Is Rigidbody a variable type? I been searching for this for a while online but found no good answer so now I'm asking here. I have a scripting question about Unity's Rigidbody.

When your making a game object move with Rigidbody you typically make a script for it that starts off with

public Rigidbody rigid;

Then you put in a GetComponent call like so

void Start() {
  rigid = GetComponent<Rigidbody> ();
}

And the part I don't understand is how the Rigidbody variable works. Is it a variable type that unity is using cause even in the GetComponent it starts looking for Rigidbody not rigid. That seems like making a int variable then calling it saying Debug.Log(Int);

Also in unity script from the documentations it uses

function Start () {
  var rb = GetComponent.<Rigidbody>();
}

Theres no Rigidbody in the declaration of the variable at all. Thats what made it even more confusing for me due to how GetComponent cleary shows it getting just the Rigidbody component but from the look of the script how does it connect to the game object?

With the C# example you drag and drop the GameObject in the Rigidbody variable even when the script is connected.

The reason why I'm asking is because I'm wanting to learn intuitively where I understand all the meaning of code like a second language. Is that normal?

sentences:
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:
How to leave a permanent skidmark on the ground in unity2d I am working on a 2D driving game.I have a sprite of a car.Set the car movement.Now I need to create a skid mark on the ground
 for that I have created a empte game object and added Trial Renderer component and set the skid mark material to it.The problem is that when i start moving the car ,the skid mark follows the car as if that a skid mark is attached to the car.

Is there any simple way to leave a permanent skid mark on the ground in unity2d.
Can anybody please help me

sentences:
How to linearly transform vertices for large coordinate systems Alright, so I'm working on a space game and well, I want it to have a lot of space! So I need a large coordinate system and for my rendering pipeline to not suffer from "vertex jittering" due to floating point rounding errors introduced in the world to view space matrix transformation.

So far I'm having some luck with a technique discusses in GPU Pro that was used for Just Cause 2. However, it's not quite there. It looks like the "world" (including the player's ship) is orbiting around my camera instead of the camera adjusting it's orientation and position to stay behind the player's ship when it rotates. It doesn't do this with the traditional World x View x Projection transformation.

Anywho, the technique basically merges the world and view space's translation matrices by translating directly to the object's offset from the camera.

The transformation is

objectScale x objectRotation x objectOffsetFromViewPosition x viewRotation x Projection

Where the offset is a translation matrix built from the object's world position - view position.

I've always built my view matrix simply using the XNA library's XMMatrixLookAtLH() function so I'm thinking I might be missing another vital aspect of the view matrix transformation. My view rotation matrix at the moment is only built from a quaternion representing the camera's orientation.

What am I missing or what is the correct way to build this transformation?

sentences:
Where is the error in my perspective projection implementation? My question is not really a game development question, but since it's based on 3D programming, I thought it would fit best here.

I've got a line made out of Point3D objects where the value of x, y, and z are somewhere in those regions:

x: 0 - 640
y: 0 - 480
z: 0 - 4000

I'd like to project those lines into a plane with the size of 640 * 480 (the same size as the base x * y values were) using a oerspective projection. I found some information about the matrix I should use in an old computer graphics script (there are a lot of different matrixes around the net too), but could not get it to work.

Based on this tutorial, I'm using the following parameters:

float n = 1000; // near plane
float f = 4000; // far plane
float l = 0;    // left side
float r = 640;  // right side
float b = 480;  // bottom
float t = 0;    // top

float m11 = (2 * n) / (r - l);
float m22 = (2 * n) / (t - b);
float m31 = (r + l) / (r - l);
float m32 = (t + b) / (t - b);
float m33 = (-1 * (f + n)) / (f - n);
float m43 = (-2 * f * n) / (f - n);
float m34 = (-2 * f * n) / (f - n);

m = new Matrix3D(m11,   0,   0,   0,
                   0, m22,   0,   0,
                 m31, m32, m33,  -1,
                   0,   0, m43,   0);

Now all the result-points I receive from doing a m.Transform(myPoint3D) are in ranges like:

x = -1,015 to -1,694
y = 1,568 to 1,572

In my understanding those values should be in ranges from -1 to 1, and I would scale them to fit into my plane, but those results look totally chaotic... Also, the resulting z-values aren't "flat" but ranging from 2.903 to 2.996.

Any ideas where my error is?

sentences: How to stop player falling through blocks without bounce So I have this game and I have applied gravity to it and when I load it up it just falls through the blocks and out of the screen. I have tried the bounce event but it just goes into an endless loop of bouncing.

sentences:
Common structure for MIDI systems? I'm thinking of writing a MIDI system for my game that would take in an instrument and a note, then play a sound.

Considering so many rhythm games have already been made, I am curious as to how others have tackled this issue, so I might learn what things they considered in making a better system.

To be clear, I am not asking for opinions of 'which way is better', but rather, 'what have others done?'

sentences: All sides shadow outline in Unity NGUI How can I make such exactly the same shadow using NGUI?

sentences:
How do I find the angle required to point to another object? I am making an air combat game, where you can fly a ship in a 3D space. There is an opponent that flies around as well. When the opponent is not on screen, I want to display an arrow pointing in the direction the user should turn, as such:

The arrow will be on the HUD. It will not actually turn to the opponent. I want it to indicate which direction a user should turn to see the enemy ship. This arrow will circle around the cross-hairs (radius 60 pixels).

So, I took the camera location and the opponent location and did this:

double newDirection =
   atan2(activeCamera.location.y-ship_wrap.location.y,
   activeCamera.location.x-ship_wrap.location.x);

After which, I get the position on the circumferance of a circle which surrounds my crosshairs, like such:

trackingArrow.position = point((60*sin(angle)+240),60*cos(angle)+160);

It all works fine, except it's the wrong angle! I assume my calculation for the new direction is incorrect. Can anyone help?

sentences:
Continuous Physics Engine's Collision Detection Techniques I'm working on a purely continuous physics engine, and I need to choose algorithms for broad and narrow phase collision detection. "Purely continuous" means I never do intersection tests, but instead want to find ways to catch every collision before it happens, and put each into "planned collisions" stack that is ordered by TOI.

Broad Phase
The only continuous broad-phase method I can think of is encasing each body in a circle and testing if each circle will ever overlap another. This seems horribly inefficient however, and lacks any culling.

I have no idea what continuous analogs might exist for today's discrete collision culling methods such as quad-trees either. How might I go about preventing inappropriate and pointless broad test's such as a discrete engine does? I also would like to be able to see collisions more than 1 frame ahead to.

Narrow Phase
I've managed to adapt the narrow SAT to a continuous check rather than discrete, but I'm sure there's other better algorithms out there in papers or sites you guys might have come across.
What various fast or accurate algorithm's do you suggest I use and what are the advantages / disatvantages of each?

Final Note:
I say techniques and not algorithms because I have not yet decided on how I will store different polygons which might be concave, convex, round, or even have holes. I plan to make a decision on this based on what the algorithm requires (for instance if I choose an algorithm that breaks down a polygon into triangles or convex shapes I will simply store the polygon data in this form).

sentences:
Instantiate and launch prefab that's overlapping player? I’m very new to Unity and C#. I’m trying to create my first game and I have now invested about 15+ hours trying to find solutions to this issue...I’m stumped!

My player sprite (blue square) needs to launch a prefab sprite (red circle) of similar size ‘appearing’ to originate from itself. Here is a GIF of what I have so far...I don’t want the blue cube to collide and go flying.

After clicking and dragging on Player (drag-to-aim) via OnMouseDrag to set the target vector, I’m trying to Instantiate a prefab sprite (Dynamic RigidBody2D, CircleCollider2D) using the Player sprite’s position (a Dynamic RigidBody2D, BoxCollider2D) and have it APPEAR to be originating from inside the Player object. Launch is triggered via function called in OnMouseUp. Both objects should immediately come under control of Physics to collide with the environment which will include other moving RigidBody2D objects later. Targeting should allow 360 degrees to include straight into an obstacle allowing rebound effect.

Here is some excerpts of my code:

using System.Collections;
using UnityEngine;

public class Teleportation_Grenade : MonoBehaviour {

/*
    This script is attached to Player and requires_
    projectile prefab.

    tested with thrust set between 100 and 200.
*/

    public float thrust;
    public Transform prefab;
    public LineRenderer playerShotLine;

    private Vector2 playerToMouse;
    private Vector2 targetVector;

//...

    void OnMouseDrag()

    {
        Vector3 mouseWorldPoint = Camera.main.ScreenToWorldPoint (Input.mousePosition);
        Vector2 playerToMouse = mouseWorldPoint - transform.position;
        mouseWorldPoint.z = 0f;

        playerShotLine.SetPosition (0, transform.position);
        playerShotLine.SetPosition (1, mouseWorldPoint);
        playerShotLine.sortingOrder = 3;

        //opposite direction of line renderer
        targetVector = -playerToMouse;

    }

    void OnMouseUp()

    {
        SpawnPrefab ();
    }

    void SpawnPrefab()

    {
        Instantiate(prefab, new Vector3(transform.position.x, transform.position.y, 0), Quaternion.identity);

        prefab.GetComponent<Rigidbody2D> ().AddForce (targetVector * thrust, ForceMode2D.Impulse);
    }
}

This is only one of many, many iterations. It's the gist of it though. I appreciate any insight from the community.

sentences:
DirectX11 Linker error I'm in the process of learning DirectX and in the examples supplied with the book I get the following error:

Error   29  error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1800' in d3dApp.obj

Google didn't really come up with anything, or rather I was struggling to understand how to fix it from what I read, could someone explain what it means/how to fix it?

The line of code that is causing it is:

ID3D10Blob* compiledShader = 0;

HR(D3DX11CreateEffectFromMemory(compiledShader->GetBufferPointer(), compiledShader->GetBufferSize(),
    0, md3dDevice, &mFX));

sentences:
crop a texture in unity I am working on cropping a texture in Unity. I have a button, when I click on the button, it takes the photo and the photo gets saved to a folder in the phone. But when taking the picture, I want to provide image cropping functionality for the user.

Here is the sample code to select the particular area for crop.

private Vector3 startPoint, endPoint;
private bool isMousePressed;

private LineRenderer leftLine, rightLine, topLine, bottomLine;

void Start ()
{
    isMousePressed = false;

    leftLine = createAndGetLine("LeftLine");
    rightLine = createAndGetLine("RightLine");
    topLine = createAndGetLine("TopLine");
    bottomLine = createAndGetLine("BottomLine");
}

private LineRenderer createAndGetLine (string lineName)
{
    GameObject lineObject = new GameObject(lineName);
    LineRenderer line = lineObject.AddComponent<LineRenderer>();
    line.SetWidth(0.03f,0.03f);
    line.SetVertexCount(2);
    return line;
}
void Update ()
{
    if(Input.GetMouseButtonDown(0) || isSpriteTouched(spriteToCrop))
    {
        isMousePressed = true;
        startPoint = Camera.main.ScreenToWorldPoint(Input.mousePosition);
    }
    else if(Input.GetMouseButtonUp(0))
    {
        if(isMousePressed)
            //cropSprite();
        isMousePressed = false;
    }
    if(isMousePressed || isSpriteTouched(spriteToCrop))
    {
        endPoint = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        drawRectangle();
    }
}

private void drawRectangle()
{
    leftLine.SetPosition(0, new Vector3(startPoint.x, endPoint.y, 0));
    leftLine.SetPosition(1, new Vector3(startPoint.x, startPoint.y, 0));

    rightLine.SetPosition(0, new Vector3(endPoint.x, endPoint.y, 0));
    rightLine.SetPosition(1, new Vector3(endPoint.x, startPoint.y, 0));

    topLine.SetPosition(0, new Vector3(startPoint.x, startPoint.y, 0));
    topLine.SetPosition(1, new Vector3(endPoint.x, startPoint.y, 0));

    bottomLine.SetPosition(0, new Vector3(startPoint.x, endPoint.y, 0));
    bottomLine.SetPosition(1, new Vector3(endPoint.x, endPoint.y, 0));
}

How can save the particular area of rectangle to gallery?

sentences: Difference between Decision Trees & Behavior Trees for Game AI What are some differences between Decision Trees and Behavior Trees for AI Game Development?  For what applications would you use one over the other?

sentences:
How to do gear physics I've realized this gear using primitive.

My object is:

Main cylinder with
with a Rigidbody and a script who rotate Y axis

All Prism as child who has MeshCollider

I've got also a pivot for each gear.

The problem is that the right gear not rotate when "prism" collide with others.
The collision not happen.

Any ideas ?

Thanks

sentences:
Shader authoring/editing tools for GLSL ES Since Render Monkey has been discontinued (perhaps due to the complexity of today's shading languages), there are few successors that can match its functionality. Is there any useful tool for material editing aimed at developers and artists alike, but concentrated (or with substantial support for) on embedded GLSL shaders?

Render Monkey itself wasn't that flexible (I'm not aware if it allowed the usage of several textures, each with its own set of texture coordinates - plus, it didn't seem to be that intuitive either).  Apart from complete engines, is there such a stand-alone tool that can be used together with a stand-alone engine (able to interface with a custom application)?

sentences:
How to apply numerical integration on a graph layout I've done some basic 1 D integration, but i can't wrap my head around things and apply it to my graph layout.
So, consider the picture below:

if i drag the red node to the right, i'm forcing his position to my mouse position
the other nodes will "follow" him, but how ?

For Verlet, to compute the newPosition, i need the acceleration for every node and the currentPosition.
That is what i don't understand.

How to i compute the acceleration and the currentPosition ?

The currentPosition will be the position of the RedNode ? If yes, doesn't that means that they will all overlap ?

http://i.stack.imgur.com/NCKmO.jpg

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:
Point system that is not competitive or has a clear goal I'm making a game in which the goal is to reach as much entries as possible and I want the player to see that he is making progress somehow. However the game shouldn't be of competitive nature (it co-operative), so I feel that points might not be the right measure. I thought instead of a progress bar, so you work towards a goal of entries. However the problem with this is that there isn't a specific number of entries the user should aim for; The more, the better.

Is there a way of showing progress without assuming there is an end and without it getting competitive?

sentences:
Cocos2D - Detect how many items an object collided with / negating more than one object In creating a small breakout clone, I've managed to get the ball to bounce whenever it hits a block by negating (or multiplying by -1) either the X or the Y values.

This works, at least until the ball (which is really a small rect with a sprite) manages to hit two blocks at once, at which point either the X or Y values are negated twice.

The ball then proceeds to continue on its path without bouncing, resulting in a very short and very strange Breakout game.

Is there any way to detect how many items have collided with the ball, and to disregard one?

Or is there some other way to do this?

Thanks.

Here's my collision code:

if (Tools.rectsIntersect(this, g_Ball)) {
      if (g_Ball.y < this.y || g_Ball.y > this.y) {
          g_Ball.yDirection = g_Ball.yDirection * -1;
      }
      else if (g_Ball.x < this.x || g_Ball.x > this.x) {
          g_Ball.xDirection = g_Ball.xDirection * -1;
      }
      this.destroyBlock();
}

Tools.rectsIntersect = function (obj1, obj2) {box
    var aRect = obj1.collideRect();
    var bRect = obj2.collideRect();
    return cc.rectIntersectsRect(aRect, bRect);
};

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

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

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

In my render I use this:

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

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

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

I'm also using this in my Launcher Class.

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

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

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

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

Pictures of the problem:

sentences: Making filled circles in cocos2d How can you make filled-in circles in cocos2d? I understand you have to create a new method, but I don't really understand how it works/how to do it. Could someone please provide maybe an example or tell me how to go about achieving this? Also, I need to create about 24 filled-in circles, would this cause lags of some sort? Thanks!

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:
Camera controller in a 2d platformer I'm basically bumming around using Unity's 2D creation tools, and I've managed to create a little platformer physics demo. There's a lot of work to be done, but I've got basic movement down, some sounds working, basic jumping physics, and whatnot.

One of the things that's on my list of things to tackle is the camera system.

I experimented with locking the camera to the player position; it's simple, but works. However, I'd like to attempt to develop a more complex camera system that would follow level constraints, but still allow for free vertical and horizontal movement. Currently, I have the camera only matching the player's movement on the X axis, which means that jumping doesn't affect the camera. However, the camera won't follow if you climb a tall ladder.

(Think of the viewport from the Megaman X SNES games; there are many vertical and horizontal segments, but the camera is smart enough to let the player character (X) jump or cling to walls at the edge of the viewport without moving, yet move when the player is in an open area. This is the type of camera I'd like to achieve.)

I'd like to know how this problem is commonly approached. I thought about creating a spline, perhaps, and having the camera follow the spline path while still tracking the player. This spline would be specific to each created level. However, I'm not sure if this is the correct solution (and I'm not sure how it would work in open areas). The other thing that might be possible could be to set bounds for the actual camera limits, and not allow the camera to move outside of that, but I feel as though that might be a brittle solution in tighter areas.

Could someone with experience point me to any resources, or suggest advice to go in the right direction? Thanks!

Edit: To make this more clear, I've included a link to Flame Mammoth's stage in Megaman X. Notice how, in the first part of the stage, X can dash along the ground, while the camera tracks his x-position; later, it tracks his y-position when he falls down a shaft. Further on, there's a large room where the camera tracks X's movement without any boundaries until he gets close to the top of the screen; the camera doesn't pan past those boundaries.

Of note, I found a solution here that helps with jumping; I believe that MMX uses a variant of this. However, notice that in the custom game at the bottom, the camera is allowed to pan "out of bounds" as it's not limited by the level.

sentences:
How can I compile SM 3.0 effects in D3D11 in SlimDX? var bytecode = ShaderBytecode.CompileFromFile("shaders\\testShader.fx", "fx_5_0", ShaderFlags.None, SlimDX.D3DCompiler.EffectFlags.None, null, null, out str);
var effect = new SlimDX.Direct3D11.Effect(gpu.Device, bytecode);

This works fine but if I try to use another shader model like 4.0 or 3.0 it throws an error on the new effect creation:

E_FAIL: An undetermined error occurred (-2147467259)

How do I compile older shaders?  And I've read about device context but I can't find any information on how to use them to maintain DX9 compatibility.

sentences:
Am I implimenting a sweep and prune broadphase correctly? The code that I am using is:

    std::vector <PhysicsBody*> physicsChildren; //containing all objects

    ...

    std::sort(physicsChildren.begin(), physicsChildren.end(), sortByLeft);
    std::vector <PhysicsBody*> activeList;

    unsigned int one;
    unsigned int two;
    for(one = 0; one < physicsChildren.size(); ++one)
    {
        activeList.push_back(physicsChildren[one]);
        for(two = 0; two < activeList.size(); ++two)
        {
            if (physicsChildren[one]->m_position.x + physicsChildren[one]->m_radius > activeList[two]->m_position.x - activeList[two]->m_radius)
            {
                CheckIntersectionBetween(physicsChildren[one], activeList[two]);
            } else {
                activeList.pop_back();
            }
        }
    }

I think something is wrong because for 800 objects 309169 calls to CheckIntersectionBetween. A bruteforce would use 640000 calls, I didn't think this was much improvement (considering only objects close in the x-axis should test).

I wrote the code from reading Jitter-Physics article about SAP:

Create a new temporary list called “activeList”.
You begin on the left of your axisList, adding the first item to the activeList.

Now you have a look at the next item in the axisList and compare it with all items
 currently in the activeList (at the moment just one):
 - If the new item’s left is greater then the current activeList-item right, then remove
the activeList-item from the activeList
 - otherwise report a possible collision between the new axisList-item and the current
 activeList-item.

Add the new item itself to the activeList and continue with the next item in the axisList.

What have I done wrong?

sentences:
Creating a custom mouse cursor with LWJGL2 in Java I have been trying to create a custom mouse cursor in my LWJGL2 application running under Linux and I am almost there. I have implemented the following method that I call right after creating the game window:

public void loadCursor(BufferedImage img) throws LWJGLException
{
    final int w = img.getWidth();
    final int h = img.getHeight();

    int rgbData[] = new int[w * h];

    for (int i = 0; i < rgbData.length; i++)
    {
        int x = i % w;
        int y = h - 1 - i / w; // this will also flip the image vertically

        rgbData[i] = img.getRGB(x, y);
    }

    IntBuffer buffer = BufferUtils.createIntBuffer(w * h);
    buffer.put(rgbData);
    buffer.rewind();

    Cursor cursor = new Cursor(w, h, 2, h - 2, 1, buffer, null);

    Mouse.setNativeCursor(cursor);
}

The resulting cursor is almost perfect, except for a horizontal blank line in the middle.

Note: The image is being flipped vertically in my code because otherwise the cursor is displayed upside down in OpenGL. I have seen other implementations that flip the IntBuffer instead of doing this in the for-loop but they lead to the same result for me.

I don't think it has to do with screen tearing either since I enabled VSync and the blank line is always at 50% of the cursor's height (there is no flickering).

Can anybody tell what I am doing wrong or if my code example is missing something essential in order to find the problem? Thank you!

sentences:
Excluding geometry from a shadow casting light in deferred rendering Is it possible to exclude geometry from a particular shadow casting light in a deferred rendering pipeline? If yes, can it be done correctly or are there limitations? This is mainly to reduce the rendering cost of each shadow casting light.

In UE4 this is currently not possible and one of the staff members simply replied with a rather cryptic message:

  "Unfortunately, this is not possible with Deferred Rendering."

Since we are rendering the depth map from the light's perspective, we should be able to exclude geometry from that render pass...? Are there edge cases that I am not thinking of when combining shadow casting lights with deferred rendering?

Link to forum post (and screenshot to follow in case the link goes down): https://forums.unrealengine.com/unreal-engine/feedback-for-epic/35667-exclude-object-from-a-specific-light

sentences:
Move a 2D point to a target (first accelerate towards the target, then decelerate) I have a point entity that I would like to move to a target point (in 2D).

I think I would like it to accelerate away from its current position (the point could already have a velocity), to some maximum velocity, and decelerate as it approaches the target, eventually coming to a stop on the target.

I think both the acceleration and deceleration should have constant magnitudes, but given that the entity can have a velocity, which may not be in the same direction as the target, the direction of the acceleration/deceleration could be different every frame.

I am not coding in any particular language or framework yet, and just want to know if this is easy/possible. Am I describing something that is quite common (like a targeted missile that stops at the target/an AI controlled space ship in a game)? If it is hard, is there another way I can achieve the same kind of motion?

sentences:
How can I add 3D animation to my Pygame window? I've developed a quiz game using Pygame but now I'm being asked to implement a 3D animation element (a game show host) to the game.

I used Pygame as I was told it would be an easy enough language to learn and make something simple, however I see now that it seems very limited in terms of 3D animation.

I've seen OpenGL being used with Pygame and what I need is for my game to run exactly as it is, but with the 3D element (game show host) added on the corner of the window for example.

How can I use OpenGL in Pygame in order to do this?

sentences:
Help to Code Bowling Like Feature in Unity for Mobile I need Code or Guidelines for Touch Feature. When We Drag ball back and Send it Forward.
I am Making feature like bowling, and I need Player to add force while dragging back and also curve the path of the Ball
Anybody, Please Help

sentences:
Why would typeof(T) kill performance? TLDR: using typeof(T) twice; assigning the value to a variable and reusing that = uber fast (30FPS), actually calling typeof(T) twice = derped (5FPS). Why?

I have a simple entity/component system; my basic entity had an array of IComponents, and methods like HasComponent<T> and GetComponent<T>. These just iterate over the arrays and return the first matching item (this.components.Any(c => c is T)).

Turns out a performance bottleneck I experience with 100k components "in memory" (albeit most off-screen) is actually these two methods. With a few components, no problem (30FPS+). With 100k components, just sprites, I get around 5FPS.

So I figured, why not use a Dictionary<Type, IComponent> instead? It'll be faster, right?

Right?!

Wrong. First, a complexity: I have a SpriteComponent class, and a SpriteSheetComponent component class (knows about frames, animation, etc.). To simplify everything, SpriteSheetComponent derives from SpriteComponent. This makes drawing, ordering, etc. simpler, because of the is-a relationship.

Second, querying for components became more complex; if I ask HasComponent<SpriteComponent>, and you have a SpriteSheetComponent, you should return true, right?

So the way I handle that is:

return this.components.Keys.Any(t => t == typeof(T) || t.IsSubclassOf(typeof(T)));

Ditto for fetching the element, except I use First instead of Any.

Anyway, I noticed that the performance actually degraded. What's even more surprising is that this fixed the performance issue:

var tType = typeof(T);
return this.components.Keys.Any(t => t == tType || t.IsSubclassOf(tType));

The only difference is that I'm checking typeof(T) once and reusing that. This fixed my FPS up to 30ish, hurrah.

But this is definitely a "lolwut" moment for me. Is typeof(T) really that slow? And in this case, it's shredding my performance with just one extra call?

sentences:
Spine + MonoGame > viewMatrix / camera offset we switched from frame by frame animations to Spine (this animation software).

The issue I am facing now, that it am unable to fit it in our coordinate system. (simple 2D game) I guess there is an issue with the projection or some other matrix-related stuff that I am not really good in. (It works perfectly in an empty project, Example provided here: https://github.com/EsotericSoftware/spine-runtimes/tree/3.7/spine-monogame
It's probably a one-liner, but I cant figure it out.
Target in this case I want to draw the tree at world position 100,100 - so the top left corner.

This is my sample class for spine objects:

public class SpineObject
    {
        private SkeletonRenderer skeletonRenderer;
        private Skeleton skeleton;
        private AnimationState state;
        private SkeletonBounds bounds = new SkeletonBounds();
        private string assetsFolder = "Content/Animations/";

        public SpineObject()
        {
            skeletonRenderer = new SkeletonRenderer(Orbs.graphics.GraphicsDevice);
            skeletonRenderer.PremultipliedAlpha = false;

            String name = "Objects/tree1/tree1";
            String atlasName = "Objects/tree1/tree1";

            Atlas atlas = new Atlas(assetsFolder + atlasName + ".atlas", new XnaTextureLoader(Orbs.graphics.GraphicsDevice));

            SkeletonJson json = new SkeletonJson(atlas);
            json.Scale = 1;
            SkeletonData skeletonData = json.ReadSkeletonData(assetsFolder + name + ".json");
            skeleton = new Skeleton(skeletonData);
            AnimationStateData stateData = new AnimationStateData(skeleton.Data);
            state = new AnimationState(stateData);
            state.SetAnimation(0, "animation", true);

            skeleton.X = 100;
            skeleton.Y = 100;
        }

        public void Update(GameTime gameTime)
        {
            state.Update(gameTime.ElapsedGameTime.Milliseconds / 1000f);
            skeleton.UpdateWorldTransform();
            state.Apply(skeleton);
        }

        public void Draw(Matrix viewMatrix)
        {
            ((BasicEffect)skeletonRenderer.Effect).Projection = Matrix.CreateOrthographicOffCenter(0, Orbs.graphics.GraphicsDevice.Viewport.Width, 0, Orbs.graphics.GraphicsDevice.Viewport.Height, 1, 0);
           ((BasicEffect)skeletonRenderer.Effect).View = Orbs.camera.GetViewMatrix();

            skeletonRenderer.Begin();
            skeletonRenderer.Draw(skeleton);
            skeletonRenderer.End();
        }
    }

The Draw-Call looks like this:

[...]
Animations.SpineObject tree1 = new Animations.SpineObject();
Camera2D camera = new Camera2D(GraphicsDevice.Viewport);
Matrix viewMatrix  = camera.GetViewMatrix();
[...]

protected override void Draw(GameTime gameTime)
{
    spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, null, null, null, viewMatrix);
    //Draw Map Layers and Stuff
    tree1.Draw(viewMatrix);
    spriteBatch.End();
}

I guess the tree is beeing drawn somwhere far off, so how do I get the trees X/Y value to be on par with the worlds coordinates?

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 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 to render a single texture across multiple tiles? (Unity2D) I'm making a top-down style game in Unity 5 (2D). The floor is made up of many tiles (which are each game objects) of different types, eg sand and dirt.

I want to render a single texture over all of a single type of tile. So if I had a large area of sand, a single texture would be displayed for all of it. However, if there was a small area of dirt within that sand, that would need its own texture as well. These areas wouldn't necessarily be square either.

I've seen this used in games such as RimWorld, but I have no idea how to accomplish it. Any ideas?

Edit: Added picture of what I am attempting. This is a screenshot from RimWorld. As you can see, the sand is made up of hundreds of tiles, but has only one texture over it.

This is all I have managed so far:

sentences:
Catan Optimal Placement Is it possible to calculate the best possible placements for settlements in Catan without using an ML algorithm?

While it is trivial to simply add up the numbers surrounding the settlement (highest point location), I'm looking to build a deeper analysis of the settlement locations. For example, if the highest point location is around a sheep-sheep-sheep, it might be better to go to a lower point location for better resource access. It could also weight for complementary resources, blocking other players from resources, and being closer to ports.

It seems feasible to program arithmetically, yet some friends said this is an ML problem. If it is ML, how would one go about training, as the gameboard changes every game?

Edit: Catan is fairly complex, but involves a setup of placing hexagonal "tiles" randomly to make the board (example board below) . One can then, in turn with the other players, place 2 settlements on the board at corners. Settlements cannot be placed on corners directly next to each other, giving you the ability to deny spots to others. Settlements give you the ability to get the 3 resources around them. One needs certain resources to do certain things, but generally even-ish balance of resources through the game. You also want resources with number chips closer to 7, as you only get the resource if the 2 die rolled every turn land on that number. After the 2 initial settlements, you can build roads out and build new settlements. If you have a settlement on a port, you can also trade according to that port's trade type.

see this video for a tutorial on Catan

sentences:
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:
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:
Smoothing Pathfinding on Tile-Based Terrain but Free-Roaming Player I'm sorry if this is a long post, but I feel as though the details should help clarify gray areas. I'll try and provide a detailed layout of what I'm trying to achieve, what I have so far, and where my questions stand/I'm stuck at.

(Will likely touch up how this post looks when seeing it live properly)

Game Overview:
I'm designing a top-down, single-layer, obstacle-based game that will consist of tile-based terrain (only squares). Players, enemies, and objects, however, will be capable of free-roaming and do not snap to any grid. Players, in particular, will vary in sizes and models, so as a generalization they could be circles, triangle, squares, X's, etc.

Since pathfinding is going to rely on solidity, this is the layout I am aiming for:

Tiles will always be solid or not solid.
Players and enemies will never be solid.
It would be nice for objects to go either-or, but if not they can be non-solids.

My Progress:
I've got the the grid-based terrain set up in a Tile[][] design. Since there's only 1 tile per (x,y) coordinate, this allows for clean referencing. Tiles, however, could change via triggers very seldom. So a non-solid Grass tile could turn into a solid Stone tile that is impassible.

Player movement via the mouse is in place. Although this will likely get overwritten with the pathfinding, it currently works with moving the player from point A to point B. The player class has its pixel-position, image, scale, and speed. A player will be 1 grid unit in size (currently 40x40px) and scaled from there. So 0.5 scale is always 20x20px.

Minor hit box detection is in place with bounding boxes as a very general design. Later this will likely get changed to a pixel-checking hitbox method.

My questions/concerns:
My main question for reference is which pathfinding method(s) can I use to know that my unit that isn't based on a grid can move through my map properly and not have clipping? Keeping in mind again that the player can vary in size and tiles can change solidity.

I've spent the past few days looking into pathfinding methods. I've looked into A*, HAA*, HPA*, NavMeshes, and lightly into things like D* and Dijkstra's algorithm. However, pathfinding in general is brand new to me when it comes to something that doesn't move directly on a grid.

Reference material:

The 2x2 teal box is the player. The green 2x2 is the goal. The dots are where the player's top left would be if he went on the grid one square at a time. The gold line is what I'd like to path like.

This HPA* method seems like it'd work, but I'm not sure how to get the path smoothing to work. Would I just constantly see if the next point in the list is something I can go directly to without clipping and remove it if I can?

End Comments:
I'm not sure if posting some structural code here would provide any benefit as my issue is with the methodology of how to approach this rather than what I have so far.

I do know there are some topics involving this. I cannot link since I'm limited to two, but I see one here titled 'Tile-wide extent tracing on a grid' that seems to ask a similar thing. The problem with almost all example pictures of pathfinding methods uses a size-less example. (Except this one, but it still clips in one of its turns)

The unit itself will have a turning speed involved, but I don't think that should affect the cornering. For the most part, I don't need smooth, car-like, turning if it's more work.

Please let me know if there's anything I missed, I should clear up, or if I've overlooked a topic that went deep into exactly what I'm asking. It's late and I wanted to get something up on here while I continue my search. I just feel lost in this implementation.

sentences:
Determine required camera pitch/yaw change based on mouse movement and roll? I'm sure this is going to be a pretty simple answer but I can't quite figure it out on my own. Each frame, I'm getting the mouse's distance from the center of the screen (left/up is positive) and using it to change the camera's pitch and yaw.

Then, I added camera roll. Now, if the camera is rolled 45° left, moving the mouse left needs to change both the pitch AND yaw. I know I need to use math.sin and math.cos but I can't get it to work quite right.

Pitch and yaw are relative to the world, not the camera's view.

AddYaw and AddPitch are hypothetical functions that apply world yaw/pitch to the camera. So if the camera is rolled 90 degrees left (so right is world-up), applying yaw will appear to make the camera pitch "up", which is still left according to the world.

Due to the functions available to me through the game's API, I can't just apply camera-relative pitch/yaw, I'm restricted to world-relative pitch/yaw only. Basically, it boils down to applying some trigonometry to the mouse x/y input to "rotate" the pitch and yaw values added to the camera.

-- change.x = distance mouse moved left/right in this frame
-- change.y = distance mouse moved up/down in this frame

-- Fix me!
local yawChange = math.sin(rollInRads) * change.x + math.cos(rollInRads) * change.y
local pitchChange = math.cos(rollInRads) * change.y + math.sin(rollInRads) * change.x

-- Apply pitch/yaw changes to the camera
Camera:AddYaw(yawChange)
Camera:AddPitch(pitchChange)

A few examples of what it needs to return. For clarity, yaw = left positive, right negative, pitch = up positive, down negative.

Situation 1: No roll. Moving the mouse left applies positive yaw to the camera, moving the mouse up applies positive pitch. No conversion needed since camera yaw = world yaw, camera pitch = world pitch.

Situation 2: Camera is rolled 90 degrees left. Now, positive camera yaw (left) is actually negative world pitch (down). Therefore, moving the mouse left needs to apply PITCH, not yaw. And moving the mouse up needs to apply YAW, not pitch.

Situation 3: Camera is rolled 45 degrees left. Now, the camera/world axes are a bit mixed. Moving the mouse left should apply equal amounts of negative pitch AND positive yaw so the camera's view moves left relative to its own view.

sentences:
Signed Distance Fields: How are different colour channels used to improve output of sharp corners? The naive approach to implementing signed distance field font rendering suffers quality issues where sharp corners get softened (either outward- or inward-facing corners, i.e. convex or concave corners).

Step-by-step, just how are a second and third channel used to improve the final output? How are these channels produced, as compared with a single channel (for which the process is straightforward)?

sentences:
How to properly multi thread an RPG I am working on an RPG type game in Java and I would like to know a few things relating to threading,

What is the best way to implement a "wait for this then do this" without hanging the whole thread? Like waiting for a player to move to a location then pick up an item? or to wait one second then attack?

Currently I am spawning new threads every time I need to wait for something, but that doesn't feel like the best solution.

Any help is appreciated.

EDIT:
Clarification and an example of how I currently do things.

User clicks on an item
The function walkToAndPickUp(item) is called which is basically this:

Make a new thread so we don't freeze the thread handling input while the player moves.
Tell player to move to the item
While the player is not at the item(The player moves through an update() function called in a different thread, I don't know how else to do it without freezing threads)
Repeat until the player is at the item
If the player is at the item then call delete item from map and add to inventory.

sentences:
How to set rotations to 0,0,0 in 3ds max for exporting in unity? I'm a modeler in 3ds max and the unity programmer ask me that the object must have:

pivot with Y up
rotations at 0,0,0

but every object that I export in fbx he says don't have rotations at 0,0,0.
I tryed different solutions as:
- reset xform
- freeze rotation
- rotation to zero
- $.rotation = eulerangles 0 0 0

but in unity he have values like this
[4.577637e-05, -1.525879e-05, 0] or [-90, 1.525879e-05, 0] and so on

It's a problem that can I fix in max or the programmer has to fix it in unity?

Thanks

sentences:
Position GUI Text in 2D game I am working on a 2D game, and my camera is a orthographic with a size of 320.

I want to display some text, but not with OnGUI(). Rather, with a GUI Text game object.

I couldn't help but notice that positioning my GUI Text object is a real pain: apparently, the onscreen coordinates where the text appears range from 0 to 1. That is, 0.5 is the center of the screen.

If I wanted to put my label at exactly (100,50) regardless of the screen size, I would have to calculate something like

(100f / Screen.width, 50f / Screen.height)

Is there a way to tell the GUI Text to appear at the actual transform position as it appears on the scene editor? Currently, if you move the GUI Text game object's transform slightly to the right, the rendered text will be displaced a LOT to the right instead...

sentences:
Can this script be edited to create a "shotgun" type spread when firing? [Top down shooter] I have this code and I'd like to add a shotgun to the game by slightly modifying the code. I've looked online for any example but everything I find is for FPS not a TDS.

void Shoot ()
{
    timer = 0f;

    gunAudio.Play ();

    gunLight.enabled = true;

    gunParticles.Stop ();
    gunParticles.Play ();

    gunLine.enabled = true;
    gunLine.SetPosition (0, transform.position);

    shootRay.origin = transform.position;
    shootRay.direction = transform.forward;

    if (Physics.Raycast (shootRay, out shootHit, range, shootableMask))
    {
        EnemyHealth enemyHealth = shootHit.collider.GetComponent <EnemyHealth> ();
        if(enemyHealth != null)
        {
            enemyHealth.TakeDamage (damagePerShot, shootHit.point);
        }
        gunLine.SetPosition (1, shootHit.point);
    }
    else
    {
        gunLine.SetPosition (1, shootRay.origin + shootRay.direction * range);
    }
}

I have a basic understanding of most of this code. I don't quite understand how shootRay.direction understands transform.forward means always the front of player. As DMGregory stated adding a variable of some sort that runs through a for loop firing multiple different angles (or simply different coordinates if making angle rays is over my head) is the route I first thought of but I cannot find a way to implement it. I'm having issues with understanding how to manipulate ray coordinates because they cannot be changed by floats which is the extent of my current knowledge of problem solving.

sentences: How can I pack repeated textures into one texture efficiently? I have an obj mesh with some textures, several of them are repeated(uvs are not within [0,1]). I'd like to merge all those textures into one texture and transform the uvs of obj.

sentences:
SteamVR No Longer Opening With Unity Projects I'm trying to get Unity to open/utilize SteamVR for development. Everything was working fine until today, but now Unity does not use SteamVR.
I did not make any changes to SteamVR recently, and I get the same results on multiple projects and Unity installs. I also tried rebooting.
It looks like Windows pushed an update today for KB4023057 but I can't uninstall it. It's not found within uninstall updates, not in add/remove programs, and even using command prompt wusa /uninstall /kb:4023057 results in "KB4023057 is not installed." So it seems I'm stuck with it.
Any other ideas to either try to uninstall the update or else to somehow get SteamVR working in Unity again?

sentences:
Mapping a C++ struct to an HLSL cbuffer Out of curiosity (and peace of the mind...) I wondered how DirectX decides which attribute from a struct corresponds to the right variable inside an HLSL cbuffer-register(x) (apart from the order/type they are declared with).

My main concern is my structs not only have member variables but 2 constructors each. So how can I be sure the constructors are not at the beginning of my struct definition (memory wise - C++ question I guess) so my variables would overflow after my cbuffer ? Additionnaly, can I only rely on declare-order/type matching ?

Is there a more precise/explicit way than doing :

struct foo {
    int a;
    int b;
    int c;

    foo () {}
    foo (int a, int b, int c) : a{a}, b{b}, c{c} {}
}

D3D11_BUFFER_DESC constantBufferDesc;
...
constantBufferDesc.ByteWidth = sizeof(foo) + (16 - sizeof(foo) % 16);
hr = g_d3dDevice->CreateBuffer(...);
g_d3dDeviceContext->VSSetConstantBuffers(0, 1, &fooBuffer);
g_d3dDeviceContext->UpdateSubresource(&fooBuffer, 0, nullptr, &foo, 0, 0);

With HLSL :

cbuffer foo: register(b0) {
    // constructor here ?
    int a;
    // constructor here ?
    int b;
    int c;
    // constructor here ?
}

I am aware this is more a C++ question - Thanks for your insight.

sentences:
Glenn Fiedler's fixed timestep with fake threads I've implemented Glenn Fiedler's Fix Your Timestep! quite a few times in single-threaded games.

Now I'm facing a different situation: I'm trying to do this in JavaScript. I know JS is single-threaded, but I plan on using requestAnimationFrame for the rendering part.

This leaves me with two independent fake threads:  simulation and rendering. Timing in these threads is independent too: dt for simulation and render is not the same.

If I'm not mistaken, simulation should be up to Fiedler's while loop end. After the while loop, accumulator < dt so I'm left with some unspent time (accumulator) in the simulation thread.

The problem comes in the draw/interpolation phase:

const double alpha = accumulator / dt;
State state = currentState*alpha + previousState * ( 1.0 - alpha );
render( state );

In my render callback, I have the current timestamp to which I can subtract the last-simulated-in-physics-timestamp to have a dt for the current frame.

Should I just forget about this dt and draw using the physics thread's accumulator? It seems weird, since, well, I want to interpolate for the unspent time between simulation and render too, right?

Of course, I want simulation and rendering to be completely independent, but I can't get around the fact that in Glenn's implementation the renderer produces time and the simulation consumes it in discrete dt sized chunks.

A similar question was asked in Semi Fixed-timestep ported to javascript but the question doesn't really get to the point, and answers there point to removing physics from the render thread (which is what I'm trying to do) or just keeping physics in the render callback too (which is what I'm trying to avoid.)

sentences:
How can I read values from a running instance of an existing game? I play an indie flight simulation game in Windows. I want to add a specific feature by means of creating a third-party add-on.

This apps will "link" and gather current altitude and position data from the game. My program will play sounds during certain altitude and airplane configurations (it's called GPWS).

I have seen the same thing done in an online RPG game where an external program counts damage dealt in the game (which requires peeking at the game's variables), so I think this is very possible.

My question is:

What is this data-gathering called? I googled many terms like hijacking or linking but the result is not what I meant.
How do i create program like this? I don't mind if its in other languages like Java or Visual Basic, but my main experience is in C++.

sentences:
Multiplace instances of an object in Game Maker with a variable changing I want to do a level selection menu in GameMaker. There's one button for each level. Clicking on the button 1 take you to level 1, button 2 take you to level 2 and so on.

But if I duplicate the first button, all of the buttons will get you to level 1. Is it possible for multiple instances of the same object to have different variables?

sentences:
Get derived Pawn from collision actor in UE4 I am trying to build a basic RTS unit selection but any time I try to possess the target pawn it crashes.

The pawn in the collision is a blueprint derived directly from APawn.

Am I casting from the actor incorrectly?

How do i correctly get a pointer to my target unit from a collision?

void A_test_PlayerController::Input(FHitResult HitResult)
{

    // hit something
    if (HitResult.bBlockingHit)
    {
        AActor* hitActor = HitResult.GetActor();
        APawn* hitPawn = Cast<APawn>(hitActor);

        // hit a pawn
        if (hitPawn != nullptr)
        {
            // pawn is not currently controlled
            if (!hitPawn->IsControlled())
            {
                Possess(hitPawn); // <- crashes here!
                // selected new pawn
            }
            else
            {
                // pawn is already controlled
            }
        }
        else
        {
            // did not hit any pawns
        }

    }

}

Edit: found this, seems i might be doing it the right way, but it still crashes..
https://answers.unrealengine.com/questions/59297/line-trace-not-recognizing-actor.html

sentences: i want to upload to 2gb model animation to vram with VBO technic but i am getting this error with nvidia (with amd no error) when i try to work with amd its working with amd hd6870 and ati x1550 but when i try to work with gtx 950 its giving this error. if i upload less than 2gb example 300mb then its working but i want to upload 2gb. what can i do ? sorry for bad english.

sentences:
How do I know if a perspective matrix is right or left handed coordinate system? For example, if I define my perspective matrix as the following:

m[0]  = 1.f / ( aspect * focalLength );
m[5]  = 1.f / focalLength;
m[10] = -zFar / (zFar - zNear);
m[11] = -1;
m[14] = -(zFar*zNear)/(zFar - zNear);

How can I tell if my perspective matrix is right or left handed coordinate system?

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 texture procedurally generated custom terrain mesh I am making an infinite procedural terrain for my game and currently trying to apply textures to it.
The generated terrain has different biomes, so I want to texturize the terrain based on biome and have different textures applied based on the steepness and height of the terrain. I also have different areas generated, such as settlements and also roads so I want to apply specific textures to specific places like those as well.
Unity terrain only supports I think 8 layers, but generally, it should be around 4 for 4 channels? In my case I generate a custom mesh, so I don't really need to worry about this, however, I am trying to figure out how to generate some sort of texture map (splatmap), and have lots of textures in it. I want to use (albedo, normal, height) for each 'layer'. Considering that the biomes are generated based on the noise map and each chunk can have many different biomes in it, I need to have more than 4 layers available. For example, steep areas like cliffs will need to have a rocky texture applied and each biome will have a different rocky texture. So if a chunk has two biomes in it, there are lots of different textures that need to be used, including various misc textures for paths and settlement grounds, etc.
Something like this, where a single chunk mesh has for example two biomes. Also, the terrain has a settlement that has a dirt texture applied to the terrain, which extends to both biomes. So essentially, lots of textures in just one mesh.

The other chunk(s) can have similar biomes or even completely other types of biomes. Also, would like to perhaps add the ability to apply different textures to a specific position on terrain chunk at runtime, for example, if the player would want to create a path or if a specific object is placed that would spread some specific texture around the object on the terrain. Something like this for example, where a placed tree has spread some leaf ground texture around:

So, I am looking for a flexible way in applying various different textures to generated terrain mesh. I would like to do that in the script when I am generating a chunk, so I would know which biomes is it at the position and as well as things like steepness and etc.
I am using Shader Graph to create the terrain shader. I'm not really experienced with shaders, so would like to ask for some help on what would be the correct way to achieve something like this?

sentences:
When do you get Mouse.getstate().X or Y as negative? I am creating a game in which I use a function:

int x()
        {
            int px = 100;
            int pxend = 128;
            int xx = 0;
            for (int i = 0; i < 6; i++)
            {
                l = Mouse.GetState().X;
                if (l> px && l < pxend)
                {
                    xx = px;
                    break;
                }
                else
                {
                    px += 128;
                    pxend += 128;
                }
            }
            return xx;
        }

and

int y()
        {
            int px = 100;
            int pxend = 128;
            int xx = 0;
            for (int i = 0; i < 4; i++)
            {
                l = Mouse.GetState().X;
                if (l > px && l < pxend)
                {
                    xx = px;
                    break;
                }
                else
                { px += 128;
                pxend += 128;
                }
            }
            return xx;

        }

But when I debug I get value a l as negative even though the debug is initiate after a click on the GameWindow screen. Sometimes it works fine sometime does not. I dont know why does it give me negative value. And when I used them with my Rectangle i get Rectangle.X and Rectangle.Y as 0.

sentences:
Why I get inconsistent occlusion query results? My system: Catalyst 15.12, mesa 11.2.1, Archlinux, kernel 4.5.1

Depending on camera position I get inconsistent occlusion query results. Following scene contains wall, objects behind wall and objects on sides. Objects behind wall are always invisible(correct). Objects on sides should be always visible but sometimes marked as invisible. Why? On screenshots green means visible, red boundary means occluded:

This is the code that I use:

void gems_render_objects(Scene *scene) {
    int i = 0, j = 0, res;
    AssetInstance *inst;

    if(!s_queryIds) {
        s_queryIds = (GLuint*)malloc(sizeof(GLuint)*(scene->numInstances));
        glGenQueries(scene->numInstances, s_queryIds);
    }

    //draw everything
    for(i = 0; i < scene->numInstances; i++) {
        glc_draw_inst(scene, scene->instances+i, &s_curProgramId, &s_curVaoId);
    }

    //query everything
    glDepthMask(GL_FALSE);
    glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
    for(i = 0; i < scene->numInstances; i++) {
        inst = scene->instances+i;

        glBeginQuery(GL_SAMPLES_PASSED, s_queryIds[i]);
        glc_draw_inst(scene, inst->bbInst, &s_curProgramId, &s_curVaoId);
        glEndQuery(GL_SAMPLES_PASSED);
    }
    glDepthMask(GL_TRUE);
    glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);

    //draw bounding boxes of invisible
    glDepthMask(GL_FALSE);
    glDisable(GL_DEPTH_TEST);
    for(i = 0; i < scene->numInstances; i++) {
        inst = scene->instances+i;

        res = 0;
        glGetQueryObjectiv(s_queryIds[i], GL_QUERY_RESULT, &res);

        if(res == 0) {
            GLenum prevDrawType = inst->bbInst->asset->drawType;
            inst->bbInst->asset->drawType = GL_LINE_STRIP;
            glc_draw_inst(scene, inst->bbInst, &s_curProgramId, &s_curVaoId);
            inst->bbInst->asset->drawType = prevDrawType;
        }
    }
    glEnable(GL_DEPTH_TEST);
    glDepthMask(GL_TRUE);
}

sentences:
Prefabs scaling change also the original prefab I want to work with a prefab as local and global variable? something like that.
So my question is how to change a prefab scale without affecting the original prefab.

sentences:
How to create terrain made of small tiles? The terrain in my game must be created using tiled assets. I have unique textures for each tile (all with the same height and width that can be used to compose the terrain) and the information of each map is baked in binary files; these binary files contains each tile height and texture.
I'm thinking about creating the terrain at runtime (or create a tool to bake the terrains in unity's proper formats). Each tile would be an mesh composed by 2 triangles. This way I can represent individually each tile and associate a unique tile texture for each tile. My concerns is about performance as it will end up with several different meshes just for the terrain.
Am I thinking in the right direction? Is there other better way to implement a tiled terrain like this in Unity3d?

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:
2d animation on html5 canvas using a vector and speed Im moving a starship from one location to the other. In creating a vector, normalize and magnitude it.

Lets assume my vector looks like this

Vector
    x: 156,
    y: -90,
    m:  180.0000000546,
    nx:  0.8661855860486004,
    ny: -0.49972245348957717,

The way im animating the ships movement currently is:

            if (! action.animated){
                if (action.type == "move"){
                    if (game.ships[i].actions[j].v.m > 0){
// v is the Vector above !
                       game.ships[i].x += action.v.nx;
                       game.ships[i].y += action.v.ny;
                       game.ships[i].actions[j].v.m--;
                    }
                    else {
                       game.ships[i].actions[j].animated = true;
                    }

So basicly, im using requestanimationframe and a loop to move the starship by what equals 1 magnitude / 1 unit length (px) per frame.
So far it is working (but for the fact that the vessel animates one more magnitude than it should).

However, assuming i have two starships and one has a vector magnitude of 180 while the other has a magnitude of 200 and im animating both at the same time, how can i create an animation that will move the faster starships quicker, i.e. both starships should begin moving and end moving in the same frame ?

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:
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:
Libgdx: Am I abusing Vector2? Is there a better way to do my position updates and rendering? I'm simulating hair in a game.  Currently I have a HairField object, which has a position defined by a Vector2.  Each HairField has multiple Hair objects in a list, each with a position defined by a Vector2.  Each hair has multiple HairParticle objects in a list, each with a Vector2 position.  Like so:

HairField class
    Vector2 pos;  //  In world coords
    List<Hair> hairs;

Hair class
    HairField hairField;
    Vector2 pos;  //  Relative to parent HairField
    List<HairParticle> hairParticles;

    public Vector2 getWorldPos() {
        return pos.cpy().add(hairField.getWorldPos());
    }

HairParticle class
    Hair hair;
    HairParticle parent;
    Vector2 pos;  //  Relative to parent HairParticle

    public Vector2 getWorldPos() {
        return pos.cpy().add(hair.getWorldPos());
    }

My hair physics/rendering loop looks like the following:

for each (Hair h : hairField):
    HairParticle parent = null;
    for each (HairParticle p : h):
        if (parent==null) continue;
        //  get position info from each HairParticle's getWorldPos()
        //  update p, constraining to certain distance from parent
        //  render line from parent --> p

You can see that I'm calling a metric buttload of getWorldPos() methods on the particles, all so I can have information for updating/rendering the particle.  Each of these calls involves multiple Vector2.cpy() calls and some vector math.

My question is, am I abusing Vector2's?  They make for easy math, but I'm wondering if there's some more primitive (but faster) way I should be doing things.  I've heard about transformation matrices, but don't know much about them yet (been reading).  Does Libgdx expose some quicker way to be doing this math for updating/rendering that I should be using instead?

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 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:
Shadowmap first phase and shaders I am using OpenGL 3.3 and am tryin to implement shadow mapping using cube maps.
I have a framebuffer with a depth attachment and a cube map texture.

My question is how to design the shaders for the first pass, when creating the shadowmap.

This is my vertex shader:

in vec3 position;

uniform mat4 lightWVP;

void main()
{
    gl_Position = lightWVP * vec4(position, 1.0);
}

Now, do I even need a fragment shader in this shader pass? from what I understand after reading http://www.opengl.org/wiki/Fragment_Shader, by default gl_FragCoord.z is written to the currently attached depth component (to which my cubemap texture is bound to).

Thus I shouldnt even need a fragment shader for this pass and from what I understand, there is no other work to do in the fragment shader other than writing this value.

Is this correct?

sentences:
Sprites do not refresh/reimport with ScriptedImporter using the SpriteEditor I've created an importer for Aseprite-Files with the ScriptedImporter classes.
I'm working on supporting the latest features of Unity like the secondary texture and this should work without bigger issues.

The current issue I'm facing is when I change the sprites in the Sprite Editor or from a feature of my own, the asset won't get changed in the project-window unless i switch to another folder and switch back.

Do I have something wrong in my importing order or is something missing? I tried to refresh or reload the asset in the AssetDatabase but that didn't worked.

The OnImportAsset method looks like the following. I implemented the ISpriteEditorDataProvider to support the sprite-editor.

    public override void OnImportAsset(AssetImportContext ctx)
    {
        name = GetFileName(assetPath);
        _aseFile = ReadAseFile(assetPath);

        GenerateAtlasTexture();

        if (spriteImportData == null || spriteImportData.Length == 0)
        {
            SetSingleSpriteImportData();
        }

        GenerateTexture(ctx.assetPath);

        ctx.AddObjectToAsset("Texture", texture);
        ctx.SetMainObject(texture);

        foreach (Sprite sprite in sprites)
        {
            ctx.AddObjectToAsset(sprite.name, sprite);
        }
    }

With the GenerateAtlasTexture method I create a sprite-atlas out of the aseprite-file.

I had to create my own SpriteImportData class because Unitys struct won't get stored through the serialization process and I have to store the import settings of each sprite in a way.

The GenerateTexture method uses Unitys own TextureGenerator class to generate the textures or sprites and store them in a instance-variable called sprites.

Here is the link to the repo. It is currently in the "sprite-editor" branch. https://github.com/martinhodler/unity-aseprite-importer/tree/sprite-editor

Thanks a lot

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:
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:
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:
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:
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:
How do I optimize searching for the nearest point? For a little project of mine I'm trying to implement a space colonization algorithm in order to grow trees.

The current implementation of this algorithm works fine. But I have to optimize the whole thing in order to make it generate faster. I work with 1 to 300K of random attraction points to generate one tree, and it takes a lot of time to compute and compare distances between attraction points and tree node in order to keep only the closest treenode for an attraction point.

So I was wondering if some solutions exist (I know they must exist) in order to avoid the time loss looping on each tree node for each attraction point to find the closest... and so on until the tree is finished.

sentences:
Feasible 4D first person gameplay I put together a quick demo of a 4d first person environment last night in XNA. It  uses 3d cross-sectioning instead of projection. (Use A and O to move in and out from 0 to 1 in the W axis.)

In my demo I made a tunnel where it's blocked off at first, but the path appears as you travel in W. I immediately noticed while trying it that it doesn't feel very interesting. It looks the same as if you were just pushing the block out of the way. Of course the block could change shape too but it doesn't help the feel much.

There are some other approaches I could try to make it more interesting:

Miegakure, from the demo videos, uses cross sectioning, but it also seems to allow you to swap one of your spatial axes for W, so you can see the movement in that direction.

I could try to do 3d projection instead of cross sectioning. For this to have any noticeable effect, I would have to also allow rotation that lets you look "around" objects in 4D, giving you something like this. I feel like this could be insanely confusing to a player, and also would make it really tough to design workable puzzles.

The last thing I could try that seems reasonable would be to keep my cross-section approach, but allow the objects to rotate in W, and implement the truncated solid calculations.

I'm looking for feedback on whether these would be usable as mechanics or if it's just way too confusing to a player, or even a level designer. What has been tried successfully, beyond simple demos? So far it looks like Miegakure is the only game that has been taken seriously.

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:
Unity - Hide GameObject that is behind UI I have the following example:

How can I prevent the part of the sprite that is highlighted in red and is behind the UI from being displayed on the camera, but having the background image still showing?

sentences:
How would you implement and differentiate between input actions and input states? Im currently trying to setup my game and Ive started to implement input. It works like this:

I have an Input class who notifies the InputMapper whenever some key is pressed (or released or whatever). This InputMapper gets the keys pressed and returns an Action or a State depending on the current InputContext (Action and State are enums) (I used this article to get idea of how it should work).

Action here represents one-time actions like Jump while State represents continuous things like move_right.

I now attach an InputListenerto the InputMapper, which gets the Action or State whenever pressed.

In the game I use an entity-component-system. I have a ControlComponent, which should have variables that dictate what an entity should do and a KeyBoardSystem, which should set these variables. ControlComponent is then used by things like WalkSystem or JumpSystem.

My question now is: How would you implement these States and Actions in an entity-component-system? I know that States could be represented by booleans in the ControlComponent, but Actions? They could be events, but the ControlComponent doesnt (shouldnt?) have any method or know about the systems that use it.

Any help is appreciated.

sentences:
What causes undefined geometry to be drawn? I am currently using the polygonSpriteBatch of libgdx to draw triangles, rectangles and a concave polygon as border. After adding the concave polygon for the colored borders everything seems to break and random geometry appears (sometimes even with a gradient).

Some Examples

Here you can see on the left everything looks good and after drawing the additional rectangle with its border and removing the other borders you can still see some weird red regions.

This is even more extreme. On the left part of the concave polygon is drawn with a different color, and after it despawns (on the right) there is still part of it left and other triangles not created by me are drawn.

I am quite confident that all convex polygons are defined in counter-clockwise ordering.

In the past I had trouble with providing the correct TextureRegion and it still doesn't feel like my current implementation is how it should be, but it worked for simple rectangles and triangles. Currently I have a (3px)*(3px) Region and all polygon vertices are between (0f,0f) and (3f,3f).

Because I define all triangles of the polygons myself the short array given to the PolygonRegion for a rectangle looks like this: (0, 1, 2, 3, 4, 5) and the corresponding Vector2 polygon array like this: ((0.0, 3.0), (0.0, 0.0), (3.0, 0.0), (0.0, 3.0), (3.0, 0.0), (3.0, 3.0))

I experienced even more artifacts when executing this on android and for some reason drawing a small rectangle for each vertice (for debugging) fixed some of the artifacts above.

This is quite a complex problem but I hope somebody knows what could cause such a behaviour.

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:
Image-Space coherence of the z-buffer algorithm I'm reading Hierarchical z-Buffer Visibility by Ned Greene et al. and they state that

  traditional Z buffering makes reasonably good use of image-space coherence in the course of scan conversion.

I don't see how the z-buffer algorithm that I know makes use of image-space coherence at all. In the paper, they state that

  implementations usually do a set-up computation for each polygon and then an
  incremental update for each pixel in the polygon.

How exactly is this "set-up computation" and "incremental update" defined?

sentences:
Drawing Sprites with Artemis I am trying to trace the StarWarrior code (the Artemis tutorial). I cannot figure out how these sprites are being drawn.  This is the code where the player's ship is initialized:

/// The initialize player ship.
private void InitializePlayerShip()
{
    Entity entity = this.entityWorld.CreateEntity();
    entity.Group = "SHIPS";

    entity.AddComponentFromPool<TransformComponent>();
    entity.AddComponent(new SpatialFormComponent("PlayerShip"));
    entity.AddComponent(new HealthComponent(30));

    entity.GetComponent<TransformComponent>().X = this.GraphicsDevice.Viewport.Width * 0.5f;
    entity.GetComponent<TransformComponent>().Y = this.GraphicsDevice.Viewport.Height - 50;
    entity.Tag = "PLAYER";
}

Which line of code actually leads to the ship being drawn? The drawing takes place in PlayerShip.cs. Here is a commented version of the code with what I think is happening:

/// The initialize player ship.
private void InitializePlayerShip()
{
    Entity entity = this.entityWorld.CreateEntity(); //declare and initialize entity
    entity.Group = "SHIPS"; //Unused label

    entity.AddComponentFromPool<TransformComponent>(); //Add the component to store X and Y
    entity.AddComponent(new SpatialFormComponent("PlayerShip")); //Add a component which is just a String (perhaps this has something to do with PlayerShip.cs?)
    entity.AddComponent(new HealthComponent(30)); //Add a health component with 30 hp

    entity.GetComponent<TransformComponent>().X = this.GraphicsDevice.Viewport.Width * 0.5f; //Initialize the TransformComponent's X
    entity.GetComponent<TransformComponent>().Y = this.GraphicsDevice.Viewport.Height - 50; //Initialize the TransformComponent's Y
    entity.Tag = "PLAYER"; //Unused label
}

So how is the actual sprite being drawn?  Because, I am not seeing it. :(

If it is being drawn by entityWorld.Draw() in the Draw() method, then which line(s) of code put it in the world to be drawn? Or what is actually happening in entityWorld.Draw()?

I believe the RenderSystem is the one that is doing the drawing, but I don't get how it is being called.

I am sorry for the uninformed question, but I have made no progress after about 12 hours, and I desperately need some guidance!

sentences:
How should I store and load structures for 2d tile based game? I am working on structure generation for my 2d tile based game. Structures can be anything from houses, castles, dungeons, mazes etc.

Structures are pre-defined, meaning I defined the width/height of the structure and wrote every single tile that should be placed for each coordinate.

Structure "template":

public class Structure
{
    private int width;
    private int height;

    private int[,] element;

    public Structure(int _w, int _h, int[,] _e)
    {
        width = _w;
        height = _h;
        element = _e;
    }
}

Creating a new structure:

// 0 = air

// 1 = wall

// 2 = door

Structure house = new Structure(4, 4,
{

{1, 1, 1, 1},

{1, 0, 0, 1},

{1, 0, 0, 1},

{1, 2, 1, 1}

});

This works fine for small amounts of structures. However, having tens/hundreds of structures in code is not only mess, but taking memory unnecessarily since structure generation gets called rarily. So how should I store that data?

1) Should I make a file for each structure and load from it?

2) Should I dump all structures in 1 file?

3) What file format should I use for this?

4) Does Unity provide some data containers that can be easily accessed and read from?

5) How is this usually done?

sentences:
How do I draw individual pixels in the distance? Hello everyone I am working with unity3d and I am faced with a task. I have a list of 3D points and I want to draw a pixel for every point on the list that exists after my cameras frustums far-plane. After I draw each of the pixels I would like to add a few simple effects to them. Sorry for the terminology I am new to unity!
Any help is much appreciated.

sentences:
Setting up a shader for RTS construction grid visibility (around cursor) I've set up a shader, thanks to the good help of @DMGregory over at : Draw animating grid with terrain deformation and variable colors
here's what I got so far :

here's what it's supposed to look like :

here's what my shader code looks like as it stands :

forgive my non-2K + screen it's only a 1080p but this is the full shader.
here's each bit in isolation :

here's the main options for the node :

If I set surface to transparent...
I get a much better result :

yet still not what I want because the grid area fades out immediately instead of staying at the center of the cube :

also the corner clearly has a green and red line overlap when line should only ever be red or green.
this is the mock file that I'm currently using for buildable and non buildable area :

it's 256x256 (the size of my map) for now because I want to start small (where 1px maps to one unity square on the terrain of 1 unit) before I move on to the real deal which should be a 3584x3584 Texture 2D (where 1px corresponds to 1/14th of a unity unit).
I want my grid to be 1/14th of an digit. eg cell one is (in diagonal) from (0.0f, 0.0f) to (0.14f, 0.14f).
I've got preliminary code which will serve to generate this texture 2D programmatically :
    editable2DconstructibleMap = new Texture2D(256, 256, TextureFormat.RGBA32, false);
    constructionGrid = GameObject.FindGameObjectWithTag("GridViewer").GetComponent<MeshRenderer>();

    // fill texture color corresponding to navMesh
    for (int x = 0; x < editable2DconstructibleMap.width; x++) {
        for (int y = 0; y < editable2DconstructibleMap.height; y++) {
            NavMeshHit hit;
            if (NavMesh.SamplePosition(new Vector3(x * 1.0f, 0f,y * 1.0f), out hit, 1.0f, NavMesh.AllAreas))
            {
                editable2DconstructibleMap.SetPixel(x, y, Color.white);
            }
            else
            {
                editable2DconstructibleMap.SetPixel(x, y, Color.black);
            }
        }
    }
    constructionGrid.sharedMaterial.SetTexture("BuildableMask", editable2DconstructibleMap);

Here I'm using the navMesh which itself is automatically generated based on terrain slope.
I target each point of the map and see if it falls in or out of the navmesh.
Instead of redrawing this texture 2D when a building is placed and placement becomes impossible. I think I'll simply programmatically edit the 2D texture to add the new black pixels whilst the navmesh will be updated independently.
Anyways, I guess the green + red overlap issue comes from my texture2D being currently too small, but if I don't know yet what one pixel corresponds to, I'll have trouble getting this right.

Update :
so changing the texture to one of 3584x3584 did not help. I still have the exact same behavior.
So basically what did I get wrong in following the instructions from the other answer?

sentences:
Unity3D : Retry Menu (Scene Management) I'm making a simple 2D game for Android using the Unity3D game engine. I created all the levels and everything but I'm stuck at making the game over/retry menu. So far I've been using new scenes as a game over menu. I used this simple script:

#pragma strict

var level = Application.LoadLevel;

function OnCollisionEnter(Collision : Collision)
{
    if(Collision.collider.tag == "Player")
    {
        Application.LoadLevel("GameOver");
    }
}

And this as a 'menu':

#pragma strict

var myGUISkin : GUISkin;

var btnTexture : Texture;

function OnGUI() {
GUI.skin = myGUISkin;

if (GUI.Button(Rect(Screen.width/2-60,Screen.height/2+30,100,40),"Retry"))
    Application.LoadLevel("Easy1");

if (GUI.Button(Rect(Screen.width/2-90,Screen.height/2+100,170,40),"Main Menu"))
    Application.LoadLevel("MainMenu");
}

The problem stands at the part where I have to create over 200 game over scenes, obstacles (the objects that kill the player) and recreate the same script over 200 times for each level. Is there any other way to make this faster and less painful?

sentences: How do you make use of all texture units on today's graphics cards? I saw a review of the GeForce GTX 460 graphics card.  It has 56 texture units.  I'm not that knowledgeable about graphics effects.  But, the ones I know use around 3 or 4 texture units.  In this graphics card case, that would leave a lot of texture units idle.  How are these graphics cards with so many texture units used?

sentences:
Fixed texture size (Pixel) libgdx, java If I resize the window (e.g. fullscreen) the texture size also changes!

I want that behaviour: If I change to fullscreen you will see more of the game world. The size (Pixel) of the texture stay the same. Not a scaling.

Thanks.

Regards,
Matthias

sentences: Unsure where to right click to delete Unreal C++ class Trying to delete a c++ class (this should not be this difficult!) and I have deleted the .h, .cpp, and binaries.  Next everybody says "now, right click on your .uproject file and select Generate Visual Studio files."  Where do i right click it?  I can't find the file in Visual Studio, and it doesn't give the option to generate the files in my file browser.  Sorry about the noob question, but I 've google searched to no avail.  thnx.

sentences:
Ligdx Box2d : convert box2d coordinates into screen coordinates I'm new in libgdx and i have a little problem. I created a body in box2d and i want to assign it a sprite; for that i need to get the position of the body,then insert into the main loop the updated position of the sprite, right ? So..i made so but the sprite doesn't align right on the body, but in a corner. What should I write in body.setPosition() and in sprite's position ?

P.S: sorry but i can't post a screenshot :(

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:
Keep 2d GUI shape through rotation I've been working on creating the GUI system for a 3d game I've been working on, and have hit a bit of an obstacle in trying to rotate GUI elements (Google searching did not yield what I was looking for). This is how the screen looks without any rotation. As of now, rotating each element distorts the GUI elements, like this, whereas I want an effect closer to this, without any stretch or skewing.

My code, using glm, looks like this:

void GUI::NewGUIBase::rebuildMatrix()
{
    glm::vec3 newModel = glm::vec3(absoluteTopLeft.x, absoluteTopLeft.y, 1.0f);

    glm::mat4 rotate = glm::rotate(glm::mat4(1.0f), glm::radians(this->rotation), glm::vec3(0, 0, 1));
    glm::mat4 trans = glm::translate(glm::mat4(1.0f), newModel);
    this->setModel(trans * rotate);
}

I believe that the issue is due to the fact that my game window is not a square given that OpenGL uses window coordinates from -1 to 1. However, I can't figure out how I would take this into account to achieve the desired effect of rotation without any stretch.

In case it helps, a GUI element knows its own top left corner and its own dimensions (in OpenGL coordinates), and the game window's width and height in pixels.

sentences:
How does an ECS work for a world subdivided into chunks (example)? I am trying to use an ECS for my 2d game at the moment. Up until now I had my world subdivided into chunks (as minecraft does) of size 64x64. They are loaded and drawn when they come onto screen. I did this to reduce the drawing calls.

How would something like this work in an ECS?
I would say my Chunks have the following properties at the moment: tile_is_water[64,64], humidity[64,64], sprite_batch (the thing that is drawn)

At some intervals I will need to call some kind of updatefunction which uses tile_is_water and humidity to generate a new sprite_batch (but not very often, these change rarely). On every frame I need to draw the sprite_batch. On every (or maybe every few) frame I need to check which areas are visible and set some kind of flag s.t. I only draw the visible ones.

It would help me a lot of someone could explain to me what the components, the entities and systems would be in this case.

Edit: To clarify. I don't have this modelled as an ECS yet and I have problems modelling this particular issue. What I have until now is just seperated everything into components:
Components: Is_Water_Area, HumidityArea, SpriteBatch
Is_Water_Area and HumidityArea just contain the corresponding 64x64 arrays and sprite_batch contains the drawable spritebatch.
I also have a BatchDrawer system that draws everything that has a SpriteBatch. But where do I do the updating of the SpriteBatch for example? Where do I check which areas are drawn?

For example I could just check this every frame or I could keep a list of drawable Areas and update that. But where would I keep such a list of the drawable areas?

sentences: Stop map from scrolling but let player still move? I have a basic method of scrolling around on a map (moving the map instead of the player), but at when the player gets to a certain proximity to the edge, how do you stop the map from scrolling, but still allow the player to move around until it is away from that proximity? I'm not looking for any code. Just a suggestion so that I can implement it myself. I can see it visually (creating 4 boxed intersecting boundaries for the player to enter), but not sure how to come about stopping and resuming the scrolling of the map.

sentences:
Hinge joint annoying wheels rotation in Unity I try to made a little skate game prototype in Unity 5 and I just encountered an issue. I added a hinge joint between the board and each of the wheels couples (front and behind) so the board can move forward. My problem is that when I try to rotate a wheels couple around the red axis (see picture below), the hinge joint seems to hindered the rotation, however I'm not sure. Is someone see how to do the trick ?

Here is a sample of my source code (0 index is the front couple of wheels, 1 is the behind) :

private void Turn(float hAxis) {
        wheelsTransform[0].Rotate (wheelsTransform[0].right * hAxis * turnAngle * Time.deltaTime, Space.Self);
        wheelsTransform[1].Rotate (wheelsTransform[1].right * hAxis * -turnAngle * Time.deltaTime, Space.Self);
    }

Thanks in advance !

sentences:
Can you create input actions using more than one key in the editor with the new Input System? The new input system documentation says it's possible to add actions that require input combinations within the editor or code. I only see an option to add one binding path per action within in the Actions UI.

From the documentation:

  ... require the left trigger to be held and then the A button to be pressed and held for 0.4 seconds?

var action = new InputAction();
action.AddBinding("/<gamepad>/leftTrigger")
    .CombinedWith("/<gamepad>/buttonSouth", modifiers: "hold(duration=0.4)");

  Again, setting this up with the inspector in the editor is an alternative to dealing with the path strings directly.

sentences:
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:
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: How do you simulate frictionless movement? I am building a game in which I want to simulate smooth movement of an object upon pressing a key or any other event. Could someone advice me to get that feel of gliding of an object, sliding on a frictionless surface. How could I have that?

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:
Start Position & Move Step Problem Swipe Motion Mobile Unity C# i am currently trying left & right, up & down swipe motion in unity C#.

I have done the scripting, it all working,

but after i debug the script,

the object's position suddenly changed to a very weird number:

from (-3, 0, 3) changed to (-3.000004, 0.00000464, 2.99999).

And i intend to move just 1 unit every time i swipe, but the unit seems different,

it always move around 1 but not exact 1 (Ex: maybe like 0.9954, or like 1.002931).

How i set the initial position to be exact integer number,

and also move only 1 unit every time i swipe? Thanks

  using UnityEngine;

    public class Player : MonoBehaviour
    {
        private Vector3 startTouchPosition, endTouchPosition;
        private Vector3 startRocketPosition, endRocketPosition;
        private float flyTime;
        public float speed = 1f;
        bool canMove;

        void Start()
        {
            transform.position = new Vector3(-3, 0, 3);
        }

        void Update()
        {
            if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)
            {
                startTouchPosition = Input.GetTouch(0).position;
            }
            if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Ended)
            {
                endTouchPosition = Input.GetTouch(0).position;

                float xDifference = Mathf.Abs(endTouchPosition.x - startTouchPosition.x);
                float yDifference = Mathf.Abs(endTouchPosition.y - startTouchPosition.y);

                if ((endTouchPosition.x < startTouchPosition.x) && xDifference >= yDifference && transform.position.x > -5.5f)
                {
                    //StartCoroutine(Fly("left"));
                    MoveLeft();
                }
                else if ((endTouchPosition.x > startTouchPosition.x) && xDifference >= yDifference && transform.position.x < -0.5f)
                {
                    //StartCoroutine(Fly("right"));
                    MoveRight();
                }
                else if ((endTouchPosition.y > startTouchPosition.y) && yDifference >= xDifference && transform.position.z < 5.5f)
                {
                    //StartCoroutine(Fly("up"));
                    MoveUp();
                }
                else if ((endTouchPosition.y < startTouchPosition.y) && yDifference >= xDifference && transform.position.z > 0.5f)
                {
                    //StartCoroutine(Fly("down"));
                    MoveDown();
                }
            }
            if (canMove)
            {
                transform.position = Vector3.Lerp(startRocketPosition, endRocketPosition, speed * Time.deltaTime);
                canMove = false;
            }
        }

        {
            startRocketPosition = transform.position;
            endRocketPosition = new Vector3(startRocketPosition.x - 10f, 0, transform.position.z);
            canMove = true;
        }
        void MoveRight()
        {
            startRocketPosition = transform.position;
            endRocketPosition = new Vector3(startRocketPosition.x + 10f, 0, transform.position.z);
            canMove = true;
        }
        void MoveUp()
        {
            startRocketPosition = transform.position;
            endRocketPosition = new Vector3(startRocketPosition.x, 0, transform.position.z + 10f);
            canMove = true;
        }
        void MoveDown()
        {
            startRocketPosition = transform.position;
            endRocketPosition = new Vector3(startRocketPosition.x, 0, transform.position.z -10f);
            anMove = true;
        }

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:
Creating a gradient for a texture - Why is the color becoming dark on one side? Updated
While debugging I looked at the lerp and it was calculating into a negative number at the start. So I added in checks for to low or high a value, and that seems to have fixed it. I'll answer the question myself unless someone can find a way to fix the formula that calculates the lerp, since that seems to be the culprit. My fix was this:

double lerp = (start - here) / (start - end);

if (lerp < 0d)
    lerp = 0d;
if (lerp > 1d)
    lerp = 1d;

Original Question
I'm applying a gradient to a texture per the answer in this topic: Code to generate a color gradient within a texture using a diagonal line

My code is referenced below. The code was seeming to work fine. I was using a two-color gradient: green to purple. However, when I changed it to two colors that blended well into a 3rd color, I could instantly see that something was wrong.

For example, blue to purple was producing a red element outside of the gradient area. If you also look closely, the blue itself is also enhanced on the outer edges. It's almost as if the two colors are mixing outside of the gradient area, when they should be the original colors.

Calling Code

This is applying to the center of an area 80x25.

Color[] colors = new Color[] { Color.Blue, Color.Purple };
float[] colorStops = new float[] { 0f, 1f };

Algorithms.GradientFill(new Point(40, 12), 3, 33, new Rectangle(0, 0, CellData.Width, CellData.Height), colors, colorStops);

Gradient Calculation Code

public static void GradientFill(Point position, int strength, int angle, Rectangle area, Color[] colors, float[] colorStops)
{
    double radians = angle * Math.PI / 180; // = Math.Atan2(x1 - x2, y1 - y2);

    Vector2 angleVector = new Vector2((float)(Math.Sin(radians) * strength), (float)(Math.Cos(radians) * strength)) / 2;
    Vector2 location = new Vector2(position.X, position.Y);

    Vector2 endingPoint = location + angleVector;
    Vector2 startingPoint = location - angleVector;

    double x1 = (startingPoint.X / (double)area.Width) * 2.0f - 1.0f;
    double y1 = (startingPoint.Y / (double)area.Height) * 2.0f - 1.0f;
    double x2 = (endingPoint.X / (double)area.Width) * 2.0f - 1.0f;
    double y2 = (endingPoint.Y / (double)area.Height) * 2.0f - 1.0f;

    double start = x1 * angleVector.X + y1 * angleVector.Y;
    double end = x2 * angleVector.X + y2 * angleVector.Y;

    for (int x = area.X; x < area.Width; x++)
    {
        for (int y = area.Y; y < area.Height; y++)
        {
            // but we need vectors from (-1, -1) to (1, 1)
            // instead of pixels from (0, 0) to (width, height)
            double u = (x / (double)area.Width) * 2.0f - 1.0f;
            double v = (y / (double)area.Height) * 2.0f - 1.0f;

            double here = u * angleVector.X + v * angleVector.Y;

            double lerp = (start - here) / (start - end);

            float newLerp;
            int counter;
            for (counter = 0; counter < colorStops.Length && colorStops[counter] < (float)lerp; counter++) ;

            counter--;
            counter = Math.Max(counter, 0);
            counter = Math.Min(counter, colorStops.Length - 2);

            newLerp = (colorStops[counter] - (float)lerp) / (colorStops[counter] - colorStops[counter + 1]);

            SetPixel(x, y, color);
        }
    }
}

sentences: 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:
SDL 2.0 filtering mouse events I have a simple 2-D breakout clone. It works fine, except for one bug.

If I move mouse over game window, it will get input from mouse(mouse movement), and event queue will instantly be flooded with this input. For example, if player pressed left arrow, but moved his mouse over a window before, he will have to wait enough frames for mouse events to get processed.
Is there a way to ignore mouse event? At least these movement ones. Everything is okay when mouse doesn't move, but after it moves it's terrible.

I'm using SDL 2.0, programming on Debian-based linux. Using C++.

Code for handling events looks like this(requested):

void gameEngine::HandleEvents()
{
    if( SDL_PollEvent(&gameEvent) != 0 )
    {
        HandleEngineEvents();
        gameLevel.HandleEvents(gameEvent);
    }
}

HandleEngineEvents() :

void gameEngine::HandleEngineEvents()
{
    if( gameEvent.type == SDL_QUIT)
    {
        running = false;
    }
    else if( gameEvent.type == SDL_KEYDOWN && gameEvent.key.repeat == 0 )
    {
        if( gameEvent.key.keysym.sym == SDLK_ESCAPE )
        {
            running = false;
        }
    }
}

Level::HandleEvents() :

void Level::HandleEvents(SDL_Event& gameEvent)
{
    player.HandleEvents(gameEvent);
}

Player::HandleEvents() :

void Player::HandleEvents(SDL_Event& gameEvent)
{
    if(gameEvent.type == SDL_KEYDOWN && gameEvent.key.repeat == 0)
    {
        switch(gameEvent.key.keysym.sym)
        {
        case SDLK_RIGHT:
             velocity += 1;
            break;
        case SDLK_LEFT:
            velocity -= 1;
            break;
        default:
            break;
        }
    }
    else if(gameEvent.type == SDL_KEYUP && gameEvent.key.repeat == 0)
    {
        switch(gameEvent.key.keysym.sym)
        {
        case SDLK_RIGHT:
             velocity -= 1;
            break;
        case SDLK_LEFT:
            velocity += 1;
            break;
        default:
            break;
        }
    }
}

sentences:
Android game to iOS, go with an engine? I have developed a game on android using native coding. However I am being asked to port it to ios.

So I thought that I should bite the bullet and recode it in unity so I can go cross platform.

I am just upset that I have to recode everything in unity. Is there any other way or tool that at least will make me use half of my code or so thing?
Basically what would you do.

Ps:I don't even know unity but I heard learning it is easy

sentences:
Correct way to control a scene I'm trying to build an '90s style rpg game, think dragon warrior series, where it will have a UI box at the bottom of the screen where the user makes a choice like attack, move, eat etc

I'm thinking of having a game controller (phaser scene?) which updates a board scene and a UI box  scene and displays other scenes if necessary

I am thinking of passing in to the UI box an object with  message, an array of choices and  each choice will have a callback method

So as far as I can tell there are three ways to pass event information to a scene

1) use get scene method to get an instance of a scene and then make calls to that scenes methods

2) using event emitter

3) stopping and starting a scene and passing parameters into the create method

Is one way preferable or another? is there a good coding standard?  Would anyone be able to offer any other helpful hints on how to accomplish the above task

sentences:
Assets bundles have higher size than uncompressed sprites I've created a script that generates assets bundles by compressing sprites using LZ4 compression. I need this in order to generate smaller files that I'll download from a server at runtime but after taking a look at those bundles. I've found out that they actually have a higher size than the uncompressed sprites.
For example, I've generated a bundle from three sprites that have a size of 201KB together, but if I take a look at its generated bundle, its size is 300KB. This is only one example, there are other bundles that are 6MB but their original files are only 500KB and that doesn't make any sense to me. Can someone point me in the right direction?

sentences:
SpriteBatch.Draw() rectangle is different from destinationRectangle passed in When I ask SpriteBatch to draw a rectangle as within the following method :

    public static void DrawSolidRectangle(Rectangle rectangle, Color color)
    {
        // the output from this is shown in the screenshot
        System.Console.WriteLine(rectangle.ToString());
        spriteBatch.Draw(pixel, rectangle, color);
    }

I am getting different sized rectangles to the rectangles I am providing. This is an issue I am having after resizing the window. As you can see in the screenshots, the difference in width of the two rectangles is only 2 pixels and there is an offset of 1 pixel, while the two gray rectangular draw results clearly have greater than a 3 pixel difference in width.

screen shot of issue http://users.tpg.com.au/gavinw77//SpriteBatchIssue.jpg

Does anyone know what's going on ? Is this a known issue with SpriteBatch or the BackBuffer after resizing or what ?

sentences: Updating code at runtime, without recompiling Hey guys i was wondering if anyone has come across a c++ ide that you can actively play test the updates without having to recompile all the code.

sentences: The best algorithm enhancing alpha-beta? I'm studying AI. My teacher gave us source code of a chess-like game and asked us to enhance it. My exercise is to improve the alpha/beta algorithm implementing in that game. The programmer already uses transposition tables, MTD(f) with alpha/beta+memory (MTD(f) is the best algorithm I know by far). So is there any better algorithm to enhance alpha-beta search or a good way to implement MTD(f) in coding a game?

sentences: What are the units when reading depth using glReadPixels()? Suppose I use glReadPixels() to read the depth of a pixel from the depth buffer. What are the units of this? Is it the distance from the camera? Or the distance from the near clip plane? And is the distance normalized to clip space, or in real units?

sentences: How does level design work in 2D Java games with multiple levels? I'm building a small platformer game with multiple levels, similar to old-school Mario, and I was wondering how devs created levels. This is my first game, so I'm pretty new to design & such. I've seen people use Paint.NET or Photoshop to create a level where certain colors in the world represent various tiles & such, that are rendered throughout the level. For instance, a red block in the world on a blue background would represent a tile that a player can jump on, and would be rendered so when the game is started. Is this an effective way of designing levels, or is there a better way? Please explain your process.

sentences:
How to access "move" values from move node in Rain behavior tree? I have a blend tree for the NPC that takes an "input magnitude" value--0 to 1.0--for how fast the character should move...and an "angular input" float-- negative pi to positive pi--for how fast the character should turn.

How do I get the rain behavior tree to update these values correctly in the behavior tree "set parameter" leaves?

I see that I can set the parameter with some kind of variable name, but I don't see where I can specify that variable with a script...and I don't see how I can access the "move" instructions given from the move node on the behavior tree, and use them to set the variables either.

How would I accomplish this steering with Rain?

sentences:
Multithreading MMO Server. A thread per area OK? As a personal project, I'm setting up a MMO, and writing the server in C#/.NET Core.

As of now my architecture is as follows: The world exists of different areas ( you can go from area to area trough portals ). An area is called a 'room' on my server. Each room has it's own list of clients ( players, each with their TCP stream ).

Now I was wondering if it was ok that I run each room on it's own thread. Each room will manage it's own update cycle ( game loop / room ), as it's independant of other rooms.

My worry is that as the game grows, I will get lots of areas and that a thread per area isn't that great of an idea.

So my question is: Am I doing something wrong or non-benificial in the future ? Am I better off having 1 thread for the game logic for all the rooms ? Or is it ok to have a thread per room ?

sentences:
Is there any API that returns information about "all games"? I'm building a project about games and I need to make a "portfolio" of games.

Something like a catalog of Netflix, but about games, and I need some basic information about the game, like Publisher, Genre, Developer, Release Date and some more information.

Someone know a free API that returns the date that I need? I tried Steam API, but doesn't work for me.

Obs: Returns a JSON.

sentences:
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:
Removing walls of a tilemap at runtime in unity I've been trying to implement some light procedural generation into my game, nothing fancy. Just spawning rooms down in different areas in order to add some replayability. I watched a few videos and the prevailing wisdom seems to be creating room prefabs and placing them at points in the world which I have done.

Its at this point I want to differ my implementation than those online, I would like to at runtime remove tiles at the North, South, East and west parts of the walls like so.

My main problem is trying to figure out where these points are in the tile map, I have tried creating empty game objects and adding them as children to the Tilemap and taking their positions and then using Tilemap.SetTile(child.transform.position,null) to remove the tiles, however the tile that ends up being set is always wrong and offset by a certain amount, I have tried to use Tilemap.bounds and Tilemap.localbounds to try calculate the width and height of the Tilemap in order to get the midpoint between 0-width and 0-height but the bounds of the Tilemap is actually way bigger than the space my tiles actually cover in the world, so that's also untenable. Using Tilemap.WorldToCell or Tilemap.LocalToCell also has not worked.
If this is impossible, or just way more complicated than its worth, are there other ways for me to draw rooms at runtime that dont involve me creating a big 2D of gameobjects with sprites and colliders because that'll just tank my performance.
Heres the Code I'm using to loop through all the children of my Grid and check if they contain the correct tag (North South East West) and then using that position to swap the tile
 void clearTiles(string dir){
    List<Transform> tiles = FindComponentInChildWithTag(this.gameObject,dir);
    foreach(Transform t in tiles){
        map.SetTile(new Vector3Int((int)t.position.x,(int)t.position.y,0),tile);
    }
}
    public static List<Transform> FindComponentInChildWithTag(GameObject parent, string tag){
       Transform t = parent.transform;
       List<Transform> children = new List<Transform>();
       foreach(Transform tr in t)
       {
              if(tr.tag == tag)
              {
                   Debug.Log(tr.name + " " + tr.localPosition + " " + tr.position);
                   children.Add(tr);
              }
       }
       Debug.Log("Children size " + children.Count);
       return children;
 }

sentences:
Find index of GameObject in array of GameObjects In my script, i have declared an array of GameObjects like this:

public GameObject[] go;ld object name. `String temp;`

Also, i have a temporary variable to ho
Then, i assigned objects to elements in Inspector.

I'm using Raycasting to find which object was clicked. Block of code for handling Raycast:

Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
        RaycastHit2D hit = Physics2D.Raycast (ray.origin, ray.direction, Mathf.Infinity,layerMask);

        if (hit) {
            temp=hit.collider.gameObject.name;
            index=ArrayList.IndexOf(go,GameObject.Find (temp));

                }

Ray casting works well. It will print object name if i insert a Debug.Log. However, what i want to do is, find the GameObject's index in the array "go".
I need this index because i have another boolean array isSelect[] which, has a property that needs to be set to true when the corresponding GameObject is selected.

With the IndexOf code above, i get the following error:

An object reference is required to access non-static member `System.Collections.ArrayList.IndexOf(object)

What changes do i need to make to this code?

sentences:
Predict Time of projectile flight I am trying to matemathically predict how long will projectile fly until it reach
 the target. I am trying to implement this formula:

t = [V * sin(α) + √(V * sin(α))² + 2 * g * h)] / g

where I know V (velocity of projectile) , α (angle of launch) , h (height of launch) The problem is it shows some weird results. I am not sure what is wrong (using ue4):

float Time = Velocity * FMath::Sin(AngleDeg) + FMath::Sqrt(FMath::Square(Velocity * FMath::Sin(AngleDeg)) + (2.f * Gravity * Height));
Time /= Gravity;

For example this test inputs:
        Gravity = 9.8;
        Height = 10;
        Velocity = 10;
        AngleDeg = 10;
shows 0.97 seconds but theresult should be 1.61 according this calculator: https://www.omnicalculator.com/physics/projectile-motion ... When I try different inputs the result is always wrong... I also got the formula from this website so not sure what's wrong. Thanks for any advice

sentences:
multi-thread in mmorpg server For MMORPG, there is a tick function to update every object's state in a map. The function was triggered by a timer in fixed interval. So each map's update can be dispatch to different thread. At other side, server handle player incoming package have its own threads also: I/O threads. Generally, the handler of the corresponding incoming package run in I/O threads. So there is a problem: thread synchronization. I have consider two methods:

Synchronize with mutex. I/O thread lock a mutex before execute handler function and map thread lock same mutex before it execute map's update.
Execute all handler functions in map's thread, I/O thread only queue the incoming handler and let map thread to pop the queue then call handler function.

These two have a disadvantage: delay. For method 1, if the map's tick function is running, then all clients' request need to waiting the lock release. For method 2, if map's tick function is running, all clients' request need to waiting for next tick to be handle.

Of course, there is another method: add lock to functions that use data which will be accessed both in I/O thread & map thread. But this is hard to maintain and easy to goes incorrect. It needs carefully check all variables whether or not accessed by both two kinds thread.

My problem is: is there better way to do this? Or from practical view, the delay can be accepted because nothing will happen between 2 tick (the world is driven by continuous tick, all object will paused in 2 tick's interval) Generally, the interval is about 50ms to 100ms

Notice that I said map is logic concept means no interactions can happen between two map except transport. I/O thread means thread in 3rd part network lib which used to handle client request.

sentences:
Light on every model and not in the whole scene I am using a custom shader and try to pass the effect on my Models like that:

foreach (ModelMesh mesh in Model.Meshes)
{
       foreach (ModelMeshPart part in mesh.MeshParts)
       {
           part.Effect = effect;
       }
       mesh.Draw();
}

My only issue is that every Model now has its own light source in it. Why is this happening and is this a problem of my shader?

Edit:

These are the parameters passed to the shader:

      private void Get_lambertEffect()
            {
                if (_lambertEffect == null) _lambertEffect = Engine.LambertEffect;

                //Lambert technique (LambertWithShadows, LambertWithShadows2x2PCF, LambertWithShadows3x3PCF)
                _lambertEffect.CurrentTechnique = _lambertEffect.Techniques["LambertWithShadows3x3PCF"];
                _lambertEffect.Parameters["texelSize"].SetValue(Engine.ShadowMap.TexelSize);

                //ShadowMap parameters
                _lambertEffect.Parameters["lightViewProjection"].SetValue(Engine.ShadowMap.LightViewProjectionMatrix);
                _lambertEffect.Parameters["textureScaleBias"].SetValue(Engine.ShadowMap.TextureScaleBiasMatrix);
                _lambertEffect.Parameters["depthBias"].SetValue(Engine.ShadowMap.DepthBias);
                _lambertEffect.Parameters["shadowMap"].SetValue(Engine.ShadowMap.ShadowMapTexture);

                //Camera view and projection parameters
                _lambertEffect.Parameters["view"].SetValue(Engine._camera.ViewMatrix);
                _lambertEffect.Parameters["projection"].SetValue(Engine._camera.ProjectionMatrix);
                _lambertEffect.Parameters["world"].SetValue(
                Matrix.CreateScale(Size) *
                world
            );
                //Light and color
                _lambertEffect.Parameters["lightDir"].SetValue(Engine._sourceLight.Direction);
                _lambertEffect.Parameters["lightColor"].SetValue(Engine._sourceLight.Color);
                _lambertEffect.Parameters["materialAmbient"].SetValue(Engine.Material.Ambient);
                _lambertEffect.Parameters["materialDiffuse"].SetValue(Engine.Material.Diffuse);
                _lambertEffect.Parameters["colorMap"].SetValue(ColorTexture.Create(Engine.GraphicsDevice, Color.Red));

            }

Image:

sentences: How to create a transparent mask in Love2D Since Love2D doesn't support SVG, I'm looking for other ways to create solid, compound shapes.  Anything that has straight edges can be drawn using a polygon, but I haven't yet found a way to mask an circle or ellipse, or in other words, subtract a circle or ellipse from the object being drawn.  Is this possible with Love2D?

sentences:
In a browser, is it best to use one huge spritesheet or many (10000) different PNG's? I'm creating a game in jQuery, where I use about 10000 32x32 tiles. Until now, I have been using them all separately (no sprite sheet). An average map uses about 2000 tiles (sometimes re-used PNG's but all separate divs) and the performance ranges from stable (Chrome) to a bit laggy (Firefox). Each of these divs are positioned absolutely using CSS. They do not need to be updated every tick, just when a new map is loaded.

Would it be better for performance to use spritesheet methods for the divs using CSS background-positioning, like gameQuery does?

Thank you in advance!

sentences:
What is SpriteStudio? In the game, I've seen asset types for animations that are of SpriteStudio.
I have searched the documentation and cannot find any information on what this is.
I looked at the template project that purportedly covers SpriteStudio, but I don't see anything that really explains how to use it. There are various entities of type "SpriteStudio" that reference assets called SpriteStudio Animations. These assets show their source to be files with a ".ssae" extension. I assume these entities, assets, and resources are purposed to create the 2D animations within the demo.
I don't see how to generate ".ssae" files, nor is there any editor that I could find for the SpriteStudio Animation assets.
Is SpriteStudio separate software? Is it a sub-editor of the Game Studio? How do I create ".ssae" files?

sentences:
SFML RenderWindow Unhandled Exception So I've been following an SFML tutorial but unfortunately, it doesn't seem to be working.  The tutorial shows a RenderWindow as a global variable and then accesses it like this:

LevelState.h:

struct LevelStateAssets
{
sf::Texture img_background;
sf::Texture img_player;
sf::Texture img_enemy;
};

extern LevelStateAssets ls_Assets;

class LevelState : public StateBase
{
public:
    LevelState();
    void Input(sf::Event event);
    void Update(void);
    void Render(void);

private:
    sf::Sprite spr_background;
};

LevelState.cpp:

LevelStateAssets ls_Assets;

LevelState::LevelState()
{
ls_Assets.img_background.loadFromFile("res/images/background.png");
ls_Assets.img_player.loadFromFile("res/images/player.png");
ls_Assets.img_enemy.loadFromFile("res/images/enemy.png");

spr_background.setTexture(ls_Assets.img_background);
spr_background.setPosition(0, 0);
}
/* More unnecessary code in the middle */

void LevelState::Render(void)
{
window.draw(spr_background);
}

But when I do this, I get an error that says: "Unhandled exception at 0x774F3632 (ntdll.dll) in SFMLTutorial.exe: 0xC0000005: Access violation writing location 0x00000004"

If you could help me that would be great!
Thanks for your time! :)

sentences:
pre-rendering light on texture based on bump map Using a gray-scale bump-map and N sources of colored light, what is the algorithm to render the light on the textured surface, assuming I have the angle(s) and distance of each light source? (I am pre-rendering in software).

I have the part where it renders light based on the position and angle of light source.
My question is twofold:

How do I decide on an RGB color based on multiple different light sources? Is it simply additive by nature?
What do I do about cases where the angle is not a sufficient way to determine intensity? For instance when there is a deep caveat in the surface and a higher elevated area is blocking the light to that lower shaded area? How do you handle something like that?

sentences:
Create 3D line instead of a thin line in Unity in runtime with mouse drag I know how to use line renderer to drag and drop to create line in runtime, but the line appears to be thin when looking from the end of the line, I want to create a real line that has a thickness(think of it as a tube or pipe shape), no mater where the look direction is, they should has a thinkness. How would you achieve this effect, I've got two ideas,
1.Create a rectangle shape, then extrude this shape to create mesh during runtime, but the manipulation of mesh during runtime is too complicated for me.
or
2.Create prefabs, and spawn new prefabs and connect them along the cursor routing to make them looked as they were a continous line.
Would you suggest me of some new ideas or existing package to achieve this effect, or is the first option is the way to go? What I want to do is to make a shader editor like appearence in 3D space, what I need to create is the edges, and the edges should look 3D instead of 2D line.

sentences:
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:
Is a game based on a specific cellular automation a copyright infringement? If one creates a game which is based on some cellular automation algorithm like Conway's Game of Life or Langton's Ants would that be a copyright infringement?

Are such famous algorithms protected by intellectual property rights, or as long as they aren't mentioned by their official names, the actual effect they create is free to be used?

sentences:
How do I generate a random curve for landscape (like Worms)? Possible Duplicate:
  How do I generate terrain like that of Scorched Earth?
  How can I generate Worms-style terrain?

I must build random curve line for the 2D Game on the BitMap (like in Worms, from the side).

Teacher said that I should do it using Terrain Generation through recourcy
(I work in Delphi 7).
I understand the main principle, but I don't know how to introduce it as code.

All measurements according to the screen resolution.

sentences:
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:
Creating a delay by using Invoke Is it possible to delay the effects of a script that is attached to a game object?

I have 2 characters in a scene, both receiving live motion capture data, so they are both animated identically. I have rotated one by 180 degrees and placed it in front of the other one, to create the impression that they are copying/mirroring each other.

Each has several scripts attached to them, of course...

Now, I would like to be able to delay one character a bit (e.g. 1 sec) to make it look more realistic, as if one character is observing the other character and then copying its exact movements.

Is it possible to do this by somehow using the Invoke method on the other character's Update perhaps? Or any other possibilities to achieve what I described?

EDIT :: I used a buffering mechanism, as suggested by all the helpful comments and answers, instead of delaying, because delaying would have resulted in the same network data being used, except after a delay, but I needed the same old data being used to animate a second character to create the impression of a delayed copying...

private Queue<Vector3[]> posQueue;
private Queue<Quaternion[]> rotQueue;
int delayedFrames = 30;

void Start()
{
    posQueue = new Queue<Vector3[]>();
    rotQueue = new Queue<Quaternion[]>();
}

void Update()
{
    Vector3[] latestPositions;
    Quaternion[] latestOrientations;

    if (mvnActors.getLatestPose(actorID-1, out latestPositions, out latestOrientations))
    {
        posQueue.Enqueue(latestPositions);
        rotQueue.Enqueue(latestOrientations);

        if ((posQueue.Count > delayedFrames) && (rotQueue.Count > delayedFrames))
        {
            Vector3[] delayedPos = posQueue.Dequeue();
            Quaternion[] delayedRot = rotQueue.Dequeue();

            updateMvnActor(currentPose, delayedPos, delayedRot);
            updateModel(currentPose, targetModel);
        }
    }
}

sentences:
Box2d Body to follow mouse movement I am trying a box2d body to rotate following the mouse. Here's an image to clarify what I mean.

The red and blue circles are current point of the mouse and the body (of corresponding color) moving/rotating to follow it. Basically the rectangle should rotate with its one end pointed towards where the mouse pointer is.

Here's my code so far,

 World world;
    Body body, bullet;
    Box2DDebugRenderer debugRenderer;
    OrthographicCamera camera;

    @Override
    public void create() {

        world = new World(new Vector2(0, 0f), true);
        debugRenderer = new Box2DDebugRenderer();
        float w = Gdx.graphics.getWidth();
        float h = Gdx.graphics.getHeight();

        BodyDef bodyDef = new BodyDef();
        bodyDef.type = BodyDef.BodyType.DynamicBody;
        bodyDef.position.set(10, 10);
        body = world.createBody(bodyDef);

        PolygonShape shape = new PolygonShape();
        shape.setAsBox(2, 5);
        FixtureDef fixtureDef = new FixtureDef();
        fixtureDef.shape = shape;
        fixtureDef.density = 1f;
        Fixture fixture = body.createFixture(fixtureDef);

        shape.dispose();

        Gdx.input.setInputProcessor(this);

        camera = new OrthographicCamera(200, 100 * (h / w));
        camera.position.set(camera.viewportWidth / 2f, camera.viewportHeight / 2f, 0);
        camera.update();

    }
 @Override
    public void render() {

        Gdx.gl.glClearColor(1, 1, 1, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        world.step(Gdx.graphics.getDeltaTime(), 6, 2);
        camera.update();
        debugRenderer.render(world, camera.combined);
    }

  @Override
    public boolean mouseMoved(int screenX, int screenY) {
        int mouseX = screenX;
        int mouseY = Gdx.graphics.getHeight() - screenY;
        float rotateAngle = MathUtils.radiansToDegrees * MathUtils.atan2((float) mouseY - (float) body.getPosition().y, (float) mouseX - (float) body.getPosition().x);
        body.setTransform(body.getPosition(), rotateAngle / 57.2957795f);
        return true;
    }

And here's a gif of how it appears now.

as you can see the body gets skewed and also doesn't rotate properly. What am I missing?

sentences: Unity Button Without an Image? I want to create a button whose clickable area is only specified by a BoxCollider with Unity's new UI (similar to how you would do it from within NGUI). I can't get a Unity Button to work without the presence of an Image component (which ultimately represents the clickable area of the button).

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:
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: What does Unity's "Speed of Sound"-option do? I've been reading Unity's manual on the AudioManager's properties.  Speed of Sound is the only undocumented option. What is it for?

sentences: Approaches to partner trick taking card game AI I am creating an android game out of a partner based trick taking card game. What are some generic approaches to AI players for these types of games and what are the advantages/disadvantages of each?

sentences:
Spatial Hashing is set up.. now how should I go about actual collision logic? So I have a spatial hashing system set up and it works. It puts players in buckets based on their x/y/width/height

So I was going to check collisions on each frame when I loop through the entity for updating their physics. But how would I go about duplicate collisions? Say I'm checking for player a, which is in the same bucket as bullet a.. I check if there's a collision and there is, should I do the collision logic right there? Or should I add the collision to a list and iterate through that list at the end of the frame to handle the logic for each collision? This way I can also apply logic to prevent duplicate collisions. Or should I just do all the logic right there and then when the initial collision is made?

sentences:
Steady zoom on center in LWJGL (Modelview) I am having a problem in LWJGL with zooming in and out. I am using glScaled(zoom, zoom, 1) before glTranslated. There are 2 problems:
1. The rate of zoom speeds up a lot when zooming out (lower zoom value).
2. It zooms in on the bottom left corner of the screen rather than the center. Eventually, I would like to have the zoom focused on the mouse position.

I have tried to fix these problems by make it glScaled(zoom^12, zoom^12, 1) so that the greater the zoom value, the faster it will zoom in order to balance out the faster zoom at lower zoom values. To compensate for the zoom focused on the bottom left, I have tried to subtract (zoom+1)^10 + 2^10 from the X and Y of each sprite. This results in a curved zoom path, first to the left and then to the right. It is a 2D game.

sentences:
How do I refer to a native library with Unity 5 on Android? I have a library called mylibandroid.a. This is given to me by another developer. I also have the iOS version of this lib, and have been able to access it from Unity.

It is supposedly built for android. I have included it in my Plugins folder in my Unity 5 project, but I renamed it mylibandroid.so as droid libs use this naming convention. I can see the library included in the .apk file, so Unity seems to know it should go in there.

My code looks like this:

public class AlmoTest : MonoBehaviour
{
#if UNITY_ANDROID
    [DllImport("mylibandroid.so")]
    private static extern void FreeGlobals();

    public void TestFreeGlobalsButtonPress()
    {
        Debug.Log("Pressed");
        FreeGlobals();
    }
#endif
}

When my function is called, I get this error:

E/Unity   ( 4188): Unable to find mylibandroid.so
I/Unity   ( 4188): Pressed
I/Unity   ( 4188):
I/Unity   ( 4188): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebug.gen.cpp Line: 56)
I/Unity   ( 4188):
I/Unity   ( 4188): DllNotFoundException: mylibandroid.so
I/Unity   ( 4188):   at (wrapper managed-to-native) AlmoTest:TestFreeGlobalsButtonPress ()
I/Unity   ( 4188):   at AlmoTest.TestFreeGlobalsButtonPress () [0x00000] in <filename unknown>:0

sentences:
NAT punchthrough failed I finished my game while I was unaware of this error since it only shows up when I disable "WIFI" on my phone and testing it with 3G and 4G. Otherwise, when both devices are on my personal network (and I believe the same network in general) the game works perfectly fine.

Whenever two players connect via my own MasterServer I have setup on Amazon AWS services I get this error Receiving NAT punchthrough attempt from target "XXXXXXXXXXXXX" failed in the Unity console for both players. I am running both the Unity MasterServer and Facilitator on the server.

There are many question around the internet like this but not a single one with a answer. If this is really not easily fixable Unity should at least mention it's flaws where it provides the MasterServer. I would love to have an answer or at least some insight since now I have my own Linux server on Amazon I'd like to use it too. Currently it looks like my best alternative is using the multi-player options from Google Play Services.

This is the log I get from the server. Looks perfectly fine but it might help answering.

03-02-2015 02:28:31     INFO    New connection established to 24.XXX.XXX.X:62501
03-02-2015 02:28:31     INFO    Query request from 24.XXX.XXX.X:62501
03-02-2015 02:28:31     DEBUG   Version 2.0.0 connected
03-02-2015 02:28:31     INFO    Table Buckrider_Studio_FourInARow3D not found during query or row removal from 24.XXX.XXX.X:62501
03-02-2015 02:28:41     INFO    Connection with 24.XXX.XXX.X:62501 closed
03-02-2015 02:28:41     INFO    Removing rows for IP 24.XXX.XXX.X:62501
03-02-2015 02:28:41     INFO    24.132.7.159:62501 has diconnected
03-02-2015 02:28:41     INFO    New connection established to 24.XXX.XXX.X:61335 (166633197962428130)
03-02-2015 02:28:41     INFO    New connection established to 24.XXX.XXX.X:61336
03-02-2015 02:28:41     INFO    Update row request from 24.XXX.XXX.X:61336
03-02-2015 02:28:41     DEBUG   Version 2.0.0 connected
03-02-2015 02:28:41     DEBUG   Table Buckrider_Studio_FourInARow3D created.
03-02-2015 02:28:41     INFO    Sent row ID 0 in Buckrider_Studio_FourInARow3D to host at 24.XXX.XXX.X:61336
03-02-2015 02:28:41     DEBUG   Updating, inserting 4 at column 4
03-02-2015 02:28:41     DEBUG   Updating, inserting public at column 5
03-02-2015 02:28:41     DEBUG   Updating, inserting 6 at column 6
03-02-2015 02:28:41     DEBUG   Updating, inserting 7 at column 7
03-02-2015 02:28:41     DEBUG   Updating, inserting 8 at column 8
03-02-2015 02:28:41     DEBUG   Updating, injecting 24.XXX.XXX.X at column 9
03-02-2015 02:28:41     DEBUG   Updating, injecting 61336 at column 10
03-02-2015 02:28:41     DEBUG   Updating, inserting Welcome to Connect four 3D! at column 11
03-02-2015 02:28:41     DEBUG   Updating, inserting 166633197962428130 at column 12
03-02-2015 02:28:41     DEBUG   Internal port is 23466 IPs set as 192.XXX.XXX.X
03-02-2015 02:28:50     INFO    New connection established to 188.XXX.XXX.X:46374
03-02-2015 02:28:50     INFO    Query request from 188.XXX.XXX.X:46374
03-02-2015 02:28:50     DEBUG   Version 2.0.0 connected
03-02-2015 02:28:50     INFO    Fetching existing table Buckrider_Studio_FourInARow3D
03-02-2015 02:28:51     INFO    Connection with 188.XXX.XXX.X closed
03-02-2015 02:28:51     INFO    Removing rows for IP 188.XXX.XXX.X:46374
03-02-2015 02:28:51     INFO    188.XXX.XXX.X:46374 has diconnected
03-02-2015 02:28:51     INFO    New connection established to 188.XXX.XXX.X:46375 (300946669)

sentences:
Javascript-How to create a moving bullet animation from canvas the bullet cant see to move at all

function bullet() {
    this.x=playerx;
    this.y=playery;
    this.init=function(){
        this.x+=5;
        draw(this.x,this.y,10,10,"blue");
        console.log(this.x)
    }
}

in another function

if(k.keyCode==17){
    bullets=new bullet();
    bullets.init();
}

sentences:
Battle Simulation for Singleplayer/Online Hybrid Game So I was playing Clash of Clans, and just wondered on how they authenticate the result of the battle.

This isn't exactly specific to Clash of Clans though. In my observation, while CoC is an online game. Their battle is just a singleplayer, but still I feel like the battle is verified somewhere in their server?

This would apply to games that are :

Singleplayer (no 2nd player to sync to).
Doesn't need constant communication to server during battle.
But the result still important and must be authenticated/verified.

My current guess is during/after a battle, the client app will send the inputs/actions of the player to the server. Then in server, the battle will be re-simulated again using the input/actions at a much faster time/pace.

For this to work, the battle has to be deterministic (unsure if that's the right word) so that same inputs/actions will produce the same result.

But if this is the "proper" way, then it would be really heavy on the server CPU's side isn't? even with scaling, I think.

I am leaning on this solution, but something doesn't feel right... there might be a better way...

That's why I came here today to consult for ideas/suggestions..

I'm thinking if there is a safe way to do the simulation/result on the client side? like encrypt the sensitive stuffs? is this even possible?

Thank you!

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 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:
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:
Framerate limitation The most successful competitive game engines like id Tech, GoldSrc, Source and such allow for framerate limitations.

You can play with 30, with 60, with 99, with 72, with 68 etc. In short, you can cap it and control the cap.

I was wondering, how do I limit the framerate?

Not interested in code, but theory.

sentences:
Unity sprites rendering problems on Android I'm creating a simple 2d game for android, with normal sprites and animations. The problem is that when I open the game on my smartphone (Samsung galaxy trend plus), The sprites are rendered this way:

Of course, this is not what should happen. Moreover, within the Unity editor everything works flawlessly. My settings for the export are:

Texture compressions: ETC2 (GLES 3.0) - Tested also with "Don't override"
Player settings

Default orientation: landscape
Use 32 bit display buffer: unchecked - tried also with this option checked
Rendering path: forward - tried also with Legacy Deferred
Static batching/Dynamic batching: both checked

Camera settings

Clear flags: Solid color - tried also skybox

I don't have any other scene, and this one has only one camera (I saw some topics where people were having problems because they had two or more cameras). The sprites are all .png images with transparence, except for the background, that has no transparence, but is lagging. There are three sprites which are animated using the spritesheet, but they're terribly lagging, and almost can't be seen in this screenshot. I really can't understand why, I'll continue to try, waiting for your answers. Thank you in advance!

EDIT:
If in the player settings the orientation is set to auto-rotate and the device is in portrait, all the sprites works perfectly!!! The problem is that my game is meant for landscape...

sentences:
Level Representation in a 2D Game I would like to create a 2D game, where a character should move on a stage/level. My stage would be static, constructed some little cubes, similar to the well-known Mario game: some of the elements should represent an element of the way where the character can step, but if the element is missing, the character should fall.

My problem is, how to represent this programmatically? My first thought was to represent the stage with a vector, which should contain boolean elements, depending on the state of the element on the stage - if it's missing or not. But this means, I have to verify at my character's x or y position change if it has a stage element under or not (if not, to simulate the falling of the character) - I think it is not the best practice, it's not the beautiful solution.

Can you help me with some advice, how to represent the stage?

sentences:
Are there any good engines for isometric collision detection and platforming? I've decided to resurrect an old game idea I had years ago. I currently have zero experience with programming, but I'm going to begin studying either C#, Python or both in the near future.

The issue I'm currently facing is that what I plan on making is an isometric Metroidvania-type game, similar to that old GBA title Scurge: Hive on a very basic level. Naturally, this means that there will be some emphasis on platforming. The problem is, I hear that programming those kinds of physics into a 2D game is highly impractical. General consensus, from what I've seen, seems to be that it's easier to just make isometric games in 3D so that programming collision detection and the like is simpler.

I really want this to be a 2D game, as I have absolutely no experience with 3D modeling. Yet I also don't want to have to build the entire underlying physics engine from scratch. I've looked around a bit and there don't seem to be any engines for this type of game that are compatible with C# or Python. There are isometric engines, but most seemed to be geared toward 3D games and RPGs.

So I guess what I'm trying to ask is, are there any engines available that would make it easier to program an isometric 2D platformer? Or would I have to do the collision detection coding myself?

(As an aside, while I'm considering both #C and Python, I'm leaning toward Python due to the fact that it's multiplatform and apparently better for beginners. So please take that into consideration if possible.)

Edit: After some more research, I've chosen to go with Lua, but I may still study Python and C# as well if possible. Hopefully I'm not biting off more than I can chew.

sentences:
Is this bad design to have a static class which plays sound effects? I am trying to make a audio manager. I want this audio manager to setup itself and be accessible from everywhere. So I made a static class that creates the audio sources when you need them. Is this bad design?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using NodeEditorFramework.Utilities;

public static class AudioManager {

    private static bool musicIsSetup;
    private static AudioSource musicSource;
    private static bool sfxIsSetup;
    private static AudioSource sfxSource;

    public static void ManualSetup()
    {
        SetupSFXSystem();
        SetupMusicSystem();
    }

    public static void PlaySFX(AudioClip clip)
    {
        if (!sfxIsSetup) SetupSFXSystem();
        sfxSource.PlayOneShot(clip);
    }

    public static void PlayMusic(AudioClip clip)
    {
        if (!musicIsSetup) SetupMusicSystem();
        musicSource.clip = clip;
        if (!musicSource.isPlaying) musicSource.Play();
    }

    private static void SetupMusicSystem()
    {
        musicIsSetup = true;
        GameObject MusicHandler = new GameObject("MusicHandler");
        musicSource = MusicHandler.AddComponent<AudioSource>();
    }

    private static void SetupSFXSystem()
    {
        sfxIsSetup = true;
        GameObject SFXHandler = new GameObject("SFXHandler");
        sfxSource = SFXHandler.AddComponent<AudioSource>();
    }
}

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:
Player object glitching around when there is a low framerate Unity C# I just started to make this game, it runs fine on my computer. 60fps, but when I tested it on another computer, with lower fps, the player just started to jitter and glitch around a lot. The game is basically unplayable like that, and I want to make sure that everyone who plays my game will be able to enjoy the full experience. I have pasted the specific part of the code for the movement below.

void Update () {

    rb.AddForce (Vector3.forward * ForwardSpeed);

    if (Input.GetKeyDown (KeyCode.A) && side > maxSideLeft) {
        rb.AddForce (-Vector3.right * Speed);
        side -= 1;
    } else if (Input.GetKeyDown (KeyCode.D) && side < maxSideRight) {
        rb.AddForce (Vector3.right * Speed);
        side += 1;
    }

    if (Input.GetKeyDown (KeyCode.W) && level < maxLevelHeight) {
        rb.AddForce (Vector3.up * Speed);
        level += 1;
    } else if (Input.GetKeyDown (KeyCode.S) && level > minLevelHeight) {
        rb.AddForce (-Vector3.up * Speed);
        level -= 1;
    }

    if (Input.GetKeyDown (KeyCode.R) || Input.GetKeyDown(KeyCode.Space)) {
        SceneManager.LoadScene ("Scene1");
        Time.timeScale = 1;
    }
}

sentences:
How to display Render Target live to HUD widget in UE4 I'm making a security camera system in Unreal Engine 4. It allows the player to 'activate' the monitor, which should display the Render Target texture or the material made from it on the HUD. However, that just doesn't work. There's just no image when I try to play it. Nothing appears on the screen. I'm using blueprints btw, not C++. And yes, I did check and make sure that it's not the part that displays the HUD that's going wrong, it's the displaying of the render target to the UI widget. To display it, i've tried using the image component in the UI widget.

Can anyone help?

sentences:
Unity: Exporting Game creates Texture Glitches In the editor the textures are fine, however upon exporting I'm constantly faced with glitches like these:

I mainly use the Built-in Standard Specular Shader and the texture that gets glitched is always the Detail Texture. When re-exporting the game multiple times the texture gets glitched exactly the same way in the same spots.

Meshes are always below 65536 polygons. In game size is usually around 2x2 kilometres. The smallest Terrainmesh is 500x300metres and the origins are usually close to the terrain, always at 0,0,0. Scale and Rotation are always reset.

This has happened in pretty much every scene so far.

Screenshot of UV coordinates:

sentences:
Got garbage when getting shader compile log I got garbage when trying to compile shader and get error log. I checked my code against some sample code, and could figure out where I did wrong.

Below is my code:

bool LoadShader(GLuint ShaderType, char const* ShaderFileName)
{
    os_file ShaderFile = OSReadFile(ShaderFileName);
    GLint ShaderHandle = glCreateShader(ShaderType);
    DebugPrint("Shader source: %s\n%.*s\n", ShaderFileName, ShaderFile.Length, ShaderFile.Contents);

    GLchar* ShaderSource = (GLchar*)&ShaderFile.Contents;
    GLint ShaderSourceLength = ShaderFile.Length;
    glShaderSource(ShaderHandle, 1, &ShaderSource, &ShaderSourceLength);
    glCompileShader(ShaderHandle);

    OSFreeFile(&ShaderFile);

    GLint Success;
    glGetShaderiv(ShaderHandle, GL_COMPILE_STATUS, &Success);
    if (!Success)
    {
        GLchar CompileLog[512];
        glGetShaderInfoLog(ShaderType, 512, NULL, CompileLog);
        switch (ShaderType)
        {
#define SHADER_TYPE_ERROR(ShaderType) case ShaderType: { DebugPrint(#ShaderType " Compile error!\n"); } break;
            SHADER_TYPE_ERROR(GL_VERTEX_SHADER);
            SHADER_TYPE_ERROR(GL_FRAGMENT_SHADER);
#undef SHADER_TYPE_ERROR
        }
        DebugPrint("%s\n\n", CompileLog);
        return false;
    }
    return true;
}

Below is some output:

Shader source: shader/fragment.glsl
#version 330 core

out vec4 Colour;

void main()
{
    Colour = vec4(1.0, 0.5, 0.2, 1.0);
}

GL_FRAGMENT_SHADER Compile error!
p��R�

sentences:
Can I use a translate function to implement a viewport? I read this great question and its accompanying great answer about rendering a viewport in a top down 2D game:

  As for actually drawing the objects the camera can "see", you now draw all objects relative to the camera's world coordinates. To compute an object's screen position relative to the camera, simply do:

int screenX, screenY; //screen position of the object being drawn

screenX = object.x-camera.x;
screenY = object.y-camera.y;

After thinking about this, it would be really invasive to change every place I render to run this object.coord - camera.coord equation first.

I'm wondering if this could be accomplished in one non-invasive step that translates the coordinate system first.  I'm rendering on the html5 canvas and this translate function says:

  Moves the origin point of the context to (x, y).

I'm having trouble visualizing this though.  Does this mean I simply plug (-camera.x, -camera.y) into the function?  Should I use a translate function to render a viewport or is there a good reason to apply the equation on every thing I render?

sentences:
World Canvas InputField cursor precision/control from RenderTexture output in Overlay UI How do you have a world canvas input field cursor be controllable from the input being mapped from a UI overlay with its raw image supplied from render texture from a render camera?
Described another way:
World Canvas Input Field -> Render Camera creates renderTexture for -> Screen Overlay UI Raw Texture -> Main Camera
How do you have the cursor position be mapped from the Screen Overlay UI Raw Texture?

sentences:
storing array of pixels for sprites I am trying to write some code in Java for drawing sprites on a BufferedImage.

As of now I have each sprite in a single dimension array. However this is not good for my game because each sprite would only have one image for their sprite.

I would like each sprite to be animated meaning there would be more images to be stored. I have tried using two dimensional arrays for this but I keep running into the same issue with only one frame being stored.

What would be the proper way to solve this?

int[][] pxArry;
this.pxArry = new int[][]{
    new int [pxArry.length],
    new int [pxArry[1].length]
};
for(int i = 0; i < pxArry[0].length; i++)
    for(int i2 = 0; i2 < pxArry[1].length; i2++){
        this.pxArry[1][i2] = pxArry[1][i2];
    }

sentences:
Calculate average of arbitrary amount of quaternions (recursion) Simply calculate the average for 2 Quaternions should work like follows right? :

Quaternion.Lerp(rotationlist[0].transform.rotation, rotationlist[1].transform.rotation, 0.5f);

And now I tried to put this into a recursive function, like this:

private Quaternion calcAvg(int pos, List<GameObject> rotationlist)
{
    if (pos < rotationlist.Count)
    {
        return Quaternion.Lerp(rotationlist[pos].transform.rotation, calcAvg(++pos, rotationlist), 0.5f);
    }
    return ???;
}

But I'm not absolutely sure, what to put into the second return.

Edit, I added the last position into the second return but now I get an out of bounds exception:

private Quaternion calcAvg(int pos, List<GameObject> markerList)
{
        if (pos < markerList.Count)
        {
            return Quaternion.Lerp(markerList[pos].transform.rotation, calcAvg(++pos, markerList), 0.5f);
        }
        return markerList[pos].transform.rotation;
}

Edit, fixed the issue, I will test this now but it looks alright :

private Quaternion calcAvg(int pos, List<GameObject> markerList)
{
        if (pos < markerList.Count)
        {
            return Quaternion.Lerp(markerList[pos].transform.rotation, calcAvg(++pos, markerList), 0.5f);
        }
        return markerList[pos].transform.rotation;
}

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:
When I add UPROPERTY or UFUNCTION to TEnumAsByte the compiler throw a link error FootstepSound.h
#pragma once

#include "CoreMinimal.h"

#include "Sound/SoundCue.h"

#include "FootstepSound.generated.h"

UCLASS(Blueprintable)
class MyProject_API UFootstepSound : public UObject
{
    GENERATED_BODY()

public:

    UFootstepSound();
    ~UFootstepSound();

    UFUNCTION()
        FORCEINLINE TEnumAsByte<enum EPhysicalSurface> GetPhysicalMaterial() const { return this->vPhysicalMaterial; }

    UFUNCTION()
        FORCEINLINE TArray<USoundCue*> GetLeftStepSound() const { return this->sLeftSteps; }

    UFUNCTION()
        FORCEINLINE TArray<USoundCue*> GetRightStepSound() const { return this->sRightSteps; }

    UFUNCTION()
        FORCEINLINE TArray<USoundCue*> GetJumpSound() const { return this->sJump; }

    UFUNCTION()
        FORCEINLINE TArray<USoundCue*> GetSprintingSound() const { return this->sSprinting; }

    UFUNCTION()
        FORCEINLINE float GetWalkVolume() const { return this->fWalkVolume; }

    UFUNCTION()
        FORCEINLINE float GetSprintVolume() const { return this->fSprintVolume; }

    UFUNCTION()
        FORCEINLINE float GetCrouchVolume() const { return this->fCrouchVolume; }

private:

    UPROPERTY(EditDefaultsOnly)
        TEnumAsByte<enum EPhysicalSurface> vPhysicalMaterial;

    UPROPERTY(EditDefaultsOnly)
        TArray<USoundCue*> sLeftSteps;

    UPROPERTY(EditDefaultsOnly)
        TArray<USoundCue*> sRightSteps;

    UPROPERTY(EditDefaultsOnly)
        TArray<USoundCue*> sJump;

    UPROPERTY(EditDefaultsOnly)
        TArray<USoundCue*> sSprinting;

    UPROPERTY(EditDefaultsOnly)
        float fWalkVolume = 0.2f;

    UPROPERTY(EditDefaultsOnly)
        float fSprintVolume = 0.5f;

    UPROPERTY(EditDefaultsOnly)
        float fCrouchVolume = 0.1f;
};

FootstepSound.cpp
#include "Character/Sound/FootstepSound.h"

UFootstepSound::UFootstepSound() {}

UFootstepSound::~UFootstepSound() {}

When I add to TEnumAsByte<enum EPhysicalSurface> UPROPERTY() or UNFUNCTION() the compiler throw a link error (unresolved externals), if I remove UFUNCTION() and UPROPERTY() on TEnumAsByte<enum EPhysicalSurface>, compile completing without any errors. Idk how fix this. On others properties or functions UPROPERTY() and UFUNCTION() works fine

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 to give the player the feeling of being chased by enemies and force him/her to rush I have already asked a question about the difficulty progression in my endless runner game: How to make difficulty progression in my endless-runner game?

Now I have to decided that it is a good approach to make the following:

Camera is always drifting up, slowly, but preventing the player from idling.
If squirrels jump, the camera follows them and the spiders also update their position to be slightly below visible area. Their speed is a little bit faster than the camera's drifting speed, so the player will panic out of the fear of the spiders catching them.
Something else?

I want to make feel of constant chase by spiders and force player to run, make quick decisions and make mistakes. Player need to know exactly how close the spiders to squirrels are.

P.S: You can see earlier version of this game here: http://ludumdare.com/compo/ludum-dare-34/?action=preview&uid=66055

EDIT: The problem is that spiders are always relatively close to player and distance between them and the spiders matters. Once spiders have left the visible area, player feels safe. Firstly, spiders run with constant speed and if the player runs a little bit faster, he is always in the safe area and doesn't see any spiders.

The idea is to have player under pressure all time. The difficulty is that the visible area between the spiders and squirrels is small

FINAL DECISION: The final decision was made because of majority votes, and I suppose this answer suits for many games. But there is more than one good answer, and most of the answers are worth reading and implementing. That is what I am going to do.

Thanks everyone for your great answers!

FINAL NOTE: you can check final implementation finding released game on market - https://play.google.com/store/apps/details?id=by.Ludum.Vaverki

sentences:
Is it possible to apply a texture to a 2D-sprite in unity 2-d? I want to take an (animated) 2-d sprite and apply a texture to it. Basically, I want every non-transparent pixel to be covered by the texture (color is disregarded). I understand I can probably accomplish this using masks but I am worried that may not be the most performant solution. I know you can put textures onto 3-d models, so I was wondering if there was a similar process for 2d sprites. Below I have a graphic demonstrating what I want.

What I have tried so far

I see there is an option to add a material to a sprite, so I tried creating various materials.

1. Default material

When I tried applying this material to my sprite, the sprite disappeared entirely. I suspect because this default material type only works on 3D objects

2. Sprite Material

I figured sprites probably expect sprite materials, so I tried creating one. However, there does not appear to be anywhere to upload an image to use as a texture. This appears to only be useful for adding tints to sprites.

sentences:
How 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 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:
Why do GPUs have limited amount of allocations? I've been learning Vulkan lately and I read that you can allocate VRAM memory only set amount of times and it doesn't matter if it's 2gb or 2kb, why is it?

I'm specifically referring to VkPhysicalDeviceLimits structure which has a field maxMemoryAllocationCount.

sentences:
Efficiently pathfinding many flocking enemies around obstacles I'm working on trying to improve the pathfinding for my game's enemies. Right now, they basically just constantly move towards the player's exact position by calculating the angle between themselves and the players and moving in that direction. I also have a flocking algorithm which prevents the enemies from stacking on top of each other, so they will form up into groups rather than clip through each other.

However, now that I've added a tile-based map, I need the enemies to also be able to path around obstacles and walls for example. I initially tried adding a separation value to "non-walkable" tiles so that the flocking algorithm would consider the walls and obstacles as objects to move away from. I have yet to work out whether or not this is feasible because my initial test showed the enemies hitting an invisible "wall" where there are no non-walkable tiles, yet for some reason, they hit it and start spazzing out.

I was wondering if it might be too performance heavy to calculate a path to the player using A* and then use the flocking algorithm to prevent clumping. Originally my game was going to be a wave-based shooter, but I've decided instead to make it level-based in the vein of Hotline Miami, so it's likely I'll have fewer enemies, with the occasional horde, and just make them stronger.

Is this a viable solution? I'm using Java with Slick2D as my game engine. Or is there a better solution / algorithm that tackles both these problems?

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:
PyGame QIX clone, filling areas I'm playing around with PyGame.

Now I'm trying to implement a QIX clone.

I have my game loop, and I can move the player (cursor) on the screen.

In QIX, the movment of the player leaves a trace (tail) on the screen, creating a polyline.

If the polyline with the screen boundaries creates a polygon, the area is filled.

How I can accomplish this behaviour ?

How store the tail in memory ?

How to detect when it build a closed shape that should be filled ?

I don't need an exact working solution, some pointers, algo names would be cool.

At start, there is only the gray border, where the player can move his cursor around.

First scenario:

The user moves his cursor from point A trough point B, drawing the red multiline until point C. At this point, because of crossing the border, the point A should be connected with point C automaticaly, creating a polygon, which should be filled (that orange stuff on my drawing). Filling the polygon is damn simple in PyGame, because I provide the sequence of points,and PyGame cares of the rest.

Second scenario:

The user moves on the border to point D, from where he draws a line to point E. Because he is crossing the line of the previous polygon, and with his lines and the border another polygon can be created, it should be filled too. (the green one).

Third scenario:

The player moves further on the polygon (he can move on existing polygon lines), and draws a line from point G to point F. Here again, because of the border and the existing lines, another polygon should be filled (the blue one).

sentences:
iOS Game Development - Where to start? I'm a web developer with a keen interest in game development for the iOS platform. I develop mostly with Ruby for the day job but I have dabbled quite a bit with Java in the past, random world generators, platform games, space invaders etc, never anything serious though and only using Java2D.

It seems to be an extremely steep learning curve to get into iOS game development, so my question is where do I start?

I'm not particularly interested in 3D initially, top down / isometric would probably suit the first game I have in mind.

Can anyone recommend a good skills path to learn through, or any videos/tutorials or books to get? I realise this will take a while but I'm happy as long as I know I'm on the right track.

Thanks,
Matt

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:
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:
C# XNA How to work out minimum distance to decelerate and stop at a point I am building a game in C# using XNA.

I am currently trying to get a character to always travel to the middle of the map which is located a point (0,0,0). I want the character to accelerate to the middle and then decelerate before it hits the middle so it will come to a stop at (or very close to) the middle.

Rate of acceleration does not change. Velocity is a Vector3 and for the purpose of this i will only worry about the X axis.

What I am trying to work out is at what point should I start decelerating to come to a stop in the middle depending on velocity and position.

I have tried to simplify the following code as much as possible

In My Update Method I basically call two methods

    Move(gameTime);
    HandleAcceleration();

Handle Acceleration is very simple

 this.Transform.TranslateIncrement = this.Velocity;

Move method

protected void Move(GameTime gameTime)
{
    //GetDirection just returns 1 or -1 to accelerate the appropriate direction
    int direction = GetDirection((int)this.Transform.Translation.X);

    //This Is where I have trouble With GetMinDecelerationDistance()
    if (GetDistanceToMiddle() <= GetMinDecelerationDistance())
    {
        //Pass in -direction to decelerate(Accelerate opposite direction)
        Accelerate(gameTime, AxisDirectionType.X, -direction);
    }
    else
    {
        Accelerate(gameTime, AxisDirectionType.X, direction);
    }
}

My Accelerate Method

    VelocityX += (this.acceleration * gameTime.ElapsedGameTime.Milliseconds) * direction;

    this.Velocity = (new Vector3(VelocityX, 0, 0));

The problem I am having is how to implement the GetMinDecelerationDistance() Method. I know I need to do something with the Velocity and the position but I have no Idea what. Keep in mind the acceleration rate is always the same and the middle is at point 0.

Basically my question is how do I implement GetMinDecelerationDistance() given that I know the Velocity and position, Acceleration is constant and I want to stop at point 0.

sentences:
Avoiding audio transcoding in Unity? I'm working on a project where I only have access to MP3s versions of audio tracks I'd like to use. Unity  is trying to be helpful and recompressing everything as Vorbis, which is not ideal due to quality loss. Even if I override the audio clip settings and set it to use MP3, Unity still transcodes the file for me, resulting in quality loss. I can set the clip to PCM, which would avoid re-encoding the file into another lossy format, but the resulting file size is too large to be practical.

In a perfect world I would have WAV versions of all the tracks I want to use, but that is not the case. Is there anyway to tell Unity to use the file the way it is and to leave it alone and not recompress it?

For the record I am using Unity 5.3.1 and my project target is iOS.

sentences:
The saturate function is not working in my pixel shader I wrote a pixel shader for my game and when I tried to compile it an error occurred:

ID3DXEffectCompiler::CompileEffect: There was an error compiling expression

When I removed all the saturate functions from the shader it compiled without problems. Strangely the saturate function works for all techniques in this effect file but one.

This code worked for me:

float4 PixelShader(VertexToPixel PSIn) : COLOR0
{
    return xAmbientColor * xAmbientIntensity;
}

And this didn't work:

float4 PixelShader(VertexToPixel PSIn) : COLOR0
{
    return saturate(xAmbientColor * xAmbientIntensity);
}

-EDIT-

When I added some diffuse lighting the saturate function worked perfectly for the diffuse lighting calculation while it still didn't work for ambient lighting. This is really strange and I hope you can help me with this problem.

sentences:
database design for a game like "Empires and Alies" in facebook recently im trying to create a isometric game for facebook pretty much like Empires and Allies in facebook , i have used as3isolib to create the game , the user interactions are almost ready , but im stuck in designing the database for it .

i tried to search online but i could'not find any source or sample db designs for it ,,, i have big problem in design db in the way that can handle the different item types , like , housing , research labs , units , their staus and so on, let's say when we build a house it would have different levels to be completed , or different building has different product , and some item's product is still a product , like military house which produce soldiers ... if any body can guid me or a sample design i'll really appreciate it . Thanks.

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:
Prefab disables its script when a clone is instantiated A clone of a cube is spawned when it is destroyed, however the clones disable the script in the editor (example: http://gfycat.com/SnarlingScornfulEgg). Used the exact same script for a different kind of 'enemy' and it worked as intended.

Relevant part of script:

function Start () {
    health = 100;
}

function Update () {
    if(health <= 0){
        Dead();
    }
}

function OnCollisionEnter (col : Collision) {
    if(col.gameObject.tag == "Bullet"){
        health-=25;
    }
}

function Dead () {
    Destroy(gameObject);
    var posx = Random.Range(-50, 50);
    var posz = Random.Range(-50, 50);
    Instantiate(enemyl, Vector3(posx, 0.5, posz), transform.rotation);
}

Is there something I'm missing?

EDIT: The clone takes damage but doesn't die like the original when its health is <= 0.

sentences:
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:
Unity 5.x Network Synchronization Concepts Bear with me, It will be long read^^

I am working on the new Unity Networking system. I was using Photon and old (legacy) unity network API's before. But as it seems there are some good benefits of the new system than the previous ones, so I want to stick with it. (Despite of it being uncompleted)

But there are some points that doesn't make sense to me with the API. Data Sync for example.
So, in the old systems (both in Photon and legacy unet) we had functions called OnPhotonSerializeView or OnSerializeNetworkView depending on which API we use. Both API's are very similar as you may know. So in these functions we could send and recieve data between clients and server. Which makes sense, and was really usefull.

But aperantly they changed this concept, (or it still exists, and i couldn't find it)

There is a new thing called [SyncVar], which syncs the data "ONLY" from server to client automatically. (Which really, literally doesn't make sense, I mean why not sync both server to client AND client to server? That would make everything much easier)

According to the documents, you can ONLY send data from client to server by using [Command]'s. Which is basically (as far as I understand), "one way" version of old good [RPC] calls. Instead of calling function in all other clients, it calls it in the server.

So, you can send data to server with function parameters like the way we did it with the old [RPC]'s before. Which is usefull on point but If this is the only way to send data to server, then it doesn't make any sense to me..

I mean there are variables that needs to be kept synced all the time, back and forth, like position or rotation vectors. And sending them with [Command] calls, contradicts with the concept of network framework in my mind. We used to avoid this kind of situation before, right? Why make it the obligation now?

Or are there simply any other ways to send data from client to server that I couldn't find yet?
There is a custom serialization with the [SyncVar], with OnSerialization and OnDeserializaton functions. Which really looks like the good old OnSerialize functions but apperantly it's diffrent as it does what the [SyncVar] does.
OnSerialization is only called on server, and Deserialization is only called on client. So we can only send from server to client even with it.

If [Command] is the only way to send data to server, please say so. And clarification about why this concept is reasonable would be really nice.

Please enlighten me more with the new concepts of the new UNET framework. Thanks in advance for any help.

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:
My timer won't work in Unity In my game, you can spawn a cube by clicking. After 10 seconds I want the cube to disappear. That's what I'm trying to do in my code but it won't work:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class circleThing : MonoBehaviour
{
    public GameObject circle;
    public GameObject block;
    public float time;
    void Start() {
         Vector3 temp = Camera.main.ScreenToWorldPoint(Input.mousePosition);
         temp.z = 5f;
         transform.position = temp;
         if (Input.GetMouseButtonDown(0)) {
             StartCoroutine(timer());
             Instantiate(block, temp, Quaternion.identity);
         }
         if (time >= 10) {
             Destroy(block);
         }
    }
    void Update()
    {

    }
     IEnumerator timer(){

        while (true)
        {
            Debug.Log(time);
            yield return new WaitForSeconds(1);
            time++;
        }
    }
}

What am I doing wrong? I get the error: Destroying assets is not permitted to avoid data loss.

sentences:
Blur effect on background to make the forground more clear unity I'm making a game in unity and I'm trying to add a background blur effect to my game to make things a bit more clear.

Here is an example of what I am looking to do:

I'm trying to get the background blurriness and cloudy effect, but I have no idea how to go about getting a similar effect. It looks like a blur + cloudiness of some sort, but I've tried blurring my background objects and it just looks terrible.

Here is what I currently have:

I'm using Unity, it's all 2D sprites so I don't think I can use shaders, which is the only solution I could find people talking about, and have no idea how to proceed. Any help would be appreciated, Thanks.

Edit: Even knowing the terms I could use to search for a solution would help as I'm not quite sure what it is called.

sentences:
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:
How to properly handle sending arrow-key movement data to a authoritative server? I've made a little C# server which receives UDP packets and shows me the incoming information. I want to make an authoritative server in C# which simulates character movement and interaction in a 2D real-time world and sends information back to a Unity game client where the information is then represented.

My question is: How does my server know how long a button is pressed in real-time (example: right arrow key to move character right)?

My guess is that the client would send a UDP packet to the server on-key-press saying move-this-direction. The server would then simulate the character moving and new positional information is constantly sent back. When the Client releases the key a new UDP packet is sent to the server saying the movement key has been released thus stop-moving-this-direction. BUT the problem is UDP unreliability and the lag between letting the key press up, and the server knowing that the key press is up; which would make the character keep moving for a period of time after letting go of the key - is this solved with proper movement interpolation?.

Any ideas or information sources how to properly handle sending arrow key movement data to a authoratative server?

sentences:
How to add a UI Text for keeping Score in Unity 5 My Problem is simple I want to show scores on my game. The examples on internet are good but in Unity 5 there are no GUI elements but instead these are now UI elements. I was following this example: https://unity3d.com/learn/tutorials/projects/space-shooter/counting-points but it didn't work.
I followed the code and added a new UI text to the scene as in the picture.

After adding the script to a .cs file and declaring public GUIText scoreText; and making this text as prefab when I drag it to the inspector panel it didn't get attached.

and it gave this error:

The variable scoreText of Fruits has not been assigned.
You probably need to assign the scoreText variable of the Fruits script in the inspector.

Fruit is a projectile and every time this projectile hits the container it should add the score. So how to do this in Unity 5. I've seen in one example online that on previous versions of unity there was this option of adding GUI Text in GameObject.

sentences:
Can't give my pictures the right location in libGDX I have this code here

 sb.draw(title, (PPlane.WIDTH / 2) - (title.getWidth() / 2), (float) (PPlane.HEIGHT / 10));
 sb.draw(playBtn, (PPlane.WIDTH / 2) - (playBtn.getWidth() / 2), PPlane.HEIGHT / 2);

This gives me a picture in the middle (playBtn) and a picture beneath it (title). But I want the picture title to be above picture playBtn. So what i did was:

 sb.draw(title, (PPlane.WIDTH / 2) - (title.getWidth() / 2), (float) (PPlane.HEIGHT / 1.2));
 sb.draw(playBtn, (PPlane.WIDTH / 2) - (playBtn.getWidth() / 2), PPlane.HEIGHT / 2);

I changed the number that divide PPlane.HEIGHT in draw.title so it would appear above playBtn, but instead it just dissapeared.

I also tried to change the cam.setOrtho to True with the first code but that didn't work either.

What should I do to fix this?

sentences: Can i use art from another videogame as base for my art? For example: if I take the 3d models and textures from GTA: San Andreas and I modify them making better models and textures, can i use this new art to make a game with a different gameplay and sell it without infringing the game's copyright?

sentences: How do you make Minecraft mods? I'm new to making minecraft mods and I'm wondering what I need to do to get started.

sentences: Should I used Box2D for a Flash platformer or use something for gaming like Fixel or Flashpunk? I'm trying to make a platformer with Flash/AS3 and have been looking for something to help with some of the collision etc. I've look at a few engines and Box2D/WCK seems the most sophisticated. Do I need that level of sophistication or should I just stick to something simple like Fixel or Flashpunk? OR should I just do everything myself?

sentences:
Unity3d: Delay between animation cycles trying to create simple 360 rotation animation on 2d object but can't understand delay between animation cycles, please check youtube video with issue:
https://www.youtube.com/watch?v=JlLJLHvnkgo

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:
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:
Mouse position not updating while mouse buttons are pressed I have a simple mouse manager class: https://imgur.com/MuUhh73

Whenever any of the mouse buttons are pressed the mouse position does not update when calling getMouseX() or getMouseY() on the mouse manager object via a basic handler that gets passed everywhere.

Is the problem in my implementation or is it a bug in general?

sentences:
Is there a common invitees/players ratio during closed beta? The question itself is fairly straight forward, but the answer takes a lot of industry insight.

To give an example scenario, I am playing a game that's in closed beta right now. They have about 5000 people invited and the game is only open from Fridays to Mondays. On average there are only about 200-400 players online at any given time, across EU and US. For a closed beta, this looks like a bit of a low turn-over if you ask me.

sentences:
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 release a new level without having to publish a new version What can I do to extend the gameplay. So if I know that I will update the game with new levels and dont want to publish a new version every time I have a new level. How can I handle this.

Ex: I have a unity3d game with 3 levels now and I know that i will have a 4th level. So what should i do in order to extend the game play without publishing a new build after i finish making the 4th level?

I wanna download the new level on the fly instead of new release

I know i need to use external help like a server to import all the files but how would that work?

I am using same scene and different setups to implement levels. I am currently hardcoding the levels. But if that's wrong I can change it.

sentences:
LWJGL Lighting advice / fix Problem: The spotlight I've set up with OpenGL won't light up anything behind it, no matter what values I set for GL_SPOT_DIRECTION

    float[] LightDir = new float[]{0,0,-1,0};
    float[] LightPos = new float[]{0,0,15f,1};

Initialization code for lighting

        glEnable(GL_LIGHTING);
        glEnable(GL_LIGHT0);
        glLightModel(GL_LIGHT_MODEL_AMBIENT,asFlippedFloatBuffer(new float[]{0.1f, 0.1f, 0.1f, 1f}));
        glLight(GL_LIGHT0,GL_DIFFUSE,asFlippedFloatBuffer(new float[]{0.5f, 0.5f, 0.5f, 1f}));
        glLight(GL_LIGHT0, GL_POSITION, asFlippedFloatBuffer(new float[]{0, 0, 0, 1}));
        glLightf(GL_LIGHT0,GL_SPOT_CUTOFF,60.0f);
        glLightf(GL_LIGHT0,GL_SPOT_EXPONENT,2.0f);

        glEnable(GL_COLOR_MATERIAL);
        glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
        glShadeModel(GL_SMOOTH);

Lighting code ran every loop

         glLight(GL_LIGHT0,GL_SPOT_DIRECTION,asFlippedFloatBuffer(LightDir));
         glLight(GL_LIGHT0,GL_POSITION,asFlippedFloatBuffer(LightPos));

The Following shows:

To try and change the direction I hit a key that does

LightDir[1]++;

The angle of the light goes up as expected, but seems to stop turning once it's pointed straight up. Which looks like

Which is the problem, it wont turn around.
Iv'e tried every possible value for LightDir in all it's values, but I cannot get it to illuminate the back pf the tube. I've even tried to transform to light around the scene with glRotate and glTranslate.
The light is supposed to function as a flashlight.
Is this something that would be potentially solved with Shaders?
Thanks in advance!

EDIT:

Anytime LightDir[2] goes above 0 the light goes dark.

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:
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:
Minecraft: Players Held Item Type How can I check if a players held item is of a specific item type - for example an axe. (can be iron axe, gold axe, wooden axe, etc.)?

Or do I have to do multiple if statements to have this done?

@EventHandler(priority= EventPriority.HIGH)
    public void onInteract(PlayerInteractEvent event){
        Player p = event.getPlayer();
        ItemStack heldItem = p.getInventory().getItemInMainHand();

        if(heldItem.getType() == Material.DIAMOND_AXE){ //I dont want to do multiple if statements for multiple type of Axes
            //...
        } //other if statement for Material.WOODEN_AXE etc.
    }

sentences:
How can I implement screen transitions like in the 2D Zelda games? I want to implement a screen transition in the style of the 2D Legend of Zelda games (like this). That is, I'd the screen to remain static until the player moves to an exit, at which point the next screen smoothly scrolls into view as the old screen scrolls out of view.

How can I accomplish this?

sentences:
When should I publish my Steam page? I developing my game, which still in alpha, and plan to sell it via Steam. I already applied to Steam partnership program and want to publish my 'coming soon' Steam page to start gather wishlists, but it on hold for now.
I don't have any promotional material yet, but people on social media positively reacting to gifs of my game. Is it good idea to publish Steam page right now with temporary thumbnail and screenshots of current version and then change everything later? Or should I make my page appealing first?

sentences:
How to draw the imagebutton and place it in the lower left corner I have the button:

soundBtnStyle = new ImageButton.ImageButtonStyle();
    soundBtnStyle.up = skinBac.getDrawable("on");//
    soundBtnStyle.down = skinBac.getDrawable("off"); //

    soundsButton = new ImageButton(soundBtnStyle);
    soundsButton.setSize(120, 120);

    soundsButton.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            game.rainMusic.setVolume(0.0f);
        }
    });

call the button in the constructor,I can not figure out how to add a button to the stage.

game.batch.begin();
    game.batch.draw(soundsButton, 0, 0,120, 120);
game.batch.end();
enter code here

It does not work, an error

sentences:
How irregularly shaped rooms should be placed in a dungeon I have made a procedurally generated dungeon that places every room successfully so it is accessible via at least one other room. A 'successfully' placed room is a room who's wall cells are right net to another room's wall cells. This is because there are no corridors in my dungeon, but doorways, 2 cells thick:

       ###########
       #.........#     // Where '[]' is the Doorway.
########.........#
#.....[].........#
#.....############
#.....#
#######

However I have now moved on to procedurally generate irregular shaped rooms, such as 'L' shaped rooms, 'T' shaped rooms, and so on.

I am wondering how I can place, for example, a square room next to an 'L' shaped room, without wasting any space: i.e.:

     ##########
     #........#
######........#
#...[]........#
#...###########
#...#
#...#######
#.........#
#.........#
###########

This is not possible with my previous algorithm because it only took into account the room's bounds, where as now an 'L' shaped room's bounds contains empty space that a square room could possibly fit.

sentences:
How can I make my camera follow the player movement in a different position Basically my camera follows the character rotation and position, although the position of it its pretty uncomfortable to use, this is what I needed:

But this is what the I get:

I used a code that someone suggested me yesterday to use, I got a bit creative with it and changed some stuff to get other camera positions, but no matter how much I tweak the values the camera never gets the position that I need:

void LateUpdate()
{
    transform.position = player.transform.position - (player.transform.up * -10) + (player.transform.forward * -15);
    transform.LookAt(player.transform);

}

I have no idea how I can make it show less of the player back

sentences: Updating a multithreaded Entity-Component-System I am currently trying to implement an (sort-of) Entity-Component-System. I've got the gist of it, that is, how an ECS is supposed to work. So far i have 4 classes in my design (not yet fully implemented): EntityWorld is a global container for systems, entities and their respective components. It is responsible for updating systems/stepping. EntitySystem represents the base class for a system, with a virtual update-function. Entity is a container, basically with a list of components and an id, nothing more. EntityComponent represents a component. Now, i thought about making it possible to multithread my systems, but i think i've ran into a problem here. Suppose my EntityWorld stores its entities in the simplest way possible, in a std::vector<Entity*> for example. Now, that list would either be fully passed to a system when it is updated, or the EntityWorld loops through this list and sends the entities to the systems one-by-one. In my understanding though, when using multiple threads, this would require me to lock the whole list every time a system is being updated. That would practically equal zero increase in performance, since the other threads are always waiting for the list to get free. Is there a better way to implement this? So multiple threads can be updated (and r/w to entites at the same time)? Thanks in advance!

sentences:
Benefits of going full AABB? By "going full AABB" I mean using only AABBs for all of your objects (both dynamic and static), with dynamic objects colliding both with each other and static objects. In what specific ways does this simplify physics calculations? Are there any special techniques that require a world made entirely of AABBs? Some way to, say, remove the need for TOI-ordering (or similar) by taking advantage of that fact that all objects are AABBs?

In particular I'm looking for specific large-scale benefits, not just small things like collision detection being slightly faster. There seem to be quite a few games that use only AABBs, like Minecraft for example, so there must be a significant benefit to it or they wouldn't be doing it. Only thing I can think of is getting to do position/velocity corrections per-axis, though I'm not sure how one would exploit that to its full potential.

sentences:
Udp VS Tcp connection for a platformer multiplayer Tcp is connection based so it's really good for chat or login or anything that needs reliability. Udp should be used for lots of small packets like position packets... The problem is that in a game like what I'm doing right now (terraria like), I can't decide what to use and how to use it properly. I though about using both at the same time, but can't find a way to ensure the udp "connection" will work.

If I were to choose UDP, is there a way I could make a "connection" out of it? to rely on it for login or chat messages?

And if I were to use TCP, would there be a way to speed it up?

More info : I'm doing this in C#.NET with XNA (I know it's no longer developped but I like it :P).
I would also like to use Serialized objects (.Net BinaryFormatter), but it uses streams, and stream are only available in TCP... which makes it more attractive...

Thanks a lot!

sentences:
Why does Google keep rejecting my update for my game? I'm trying to push an update to my game that is on the Google Play Store. I've submitted the update over 4 times and Google keeps rejecting it due to the type of ads that are being displayed. I'm using Unity Ads and I've disabled all ads that would be inappropriate such as gambling, dating, 18+..etc.

The annoying part is that I have the game already on the store and I never disabled any of the ads or filtered the ads. Unity Ads are an approved service by Google. Is there something that I am missing? I also have a privacy policy in place as well? Is there something that I could do to keep it from getting rejected? How does Google test games or apps for ad content?!

Update So I've tired submitting the update over 8+ times and it's still being rejected. I've disabled the banner ads and I've changed the ads to not show ads rated for 5+. I'm at a loss for why it's being rejected. I've emailed Google over it and they just send me the same information they sent when it was rejected the first time. Still no answer..

(https://i.stack.imgur.com/wDlj1.jpg)!

(https://i.stack.imgur.com/OHGPi.jpg)

sentences:
Multiplayer (Database, Users,etc) for game I'm am looking to add multiplayer into my game (2D Platformer in XNA C#) My worlds are quite large (Up to 30 Million tiles max, Average 20 million maybe. 2000x10000). You could say the game is quite like Terraria.

I have been using Player.IO, It has everything I could need, Except for the fact that I will easily run out of bandwidth with such large worlds.

So I have been experimenting with the Lidgren Networking Library, Its okay, But not having to port forward for users would be nice, But Minecraft and terraria still get away with it.

So if I have serverside Code figured out (Lidgren). Now I just Need unique usernames, and possibly a Database for them (as player.io has PlayerObjects), a way to make a server list would also be a plus.

Almost something such as The way minecraft does it would be fine, Players have accounts, but they also have to make a server.

So how should I go about adding,

Unique Usernames (Login and registration)
Database for players acheivements and stats
A way to easily intergrate it with a server ran by players (Unless the service
includes this)

By the way, We are Indie, So if we can do users through SQl and a site it would be cheap, or a cheaper multiplayer service would be cool

sentences:
How to implement marching cube algorithm for rendering clouds I would like to render clouds using C#, directX9.0

using Microsoft.DirectX.Direct3D;
using Microsoft.DirectX;

Now I have roughly add and render the vertex as per below:

As you can see, the vertex is added in a cubic structure. And what I need to do now is to change the cubic structure to curve structure so that the whole cubic structure should looks like a cloud.

I am not using any graphic library but to build this structure solely using Microsoft.DirectX and DirectX.Direct3D

I did some Google search, and it seems the cube marching algorithm is a useful method to be implemented on these kind of 3D rendering.

From what I researched, there are no ready source for C#, but only for C++ for cube marching algorithm.

So, I would like to ask, if I only want to do the cloud rendering, is the marching cube algorithm a must? Or are there other options to align the structure to let it look like a cloud?

I totally have no idea at all, hope could look for some snipshot of source code or any good reference in C# using DirectX.dll

sentences: How to make box2d bodies block each other but not push each other? I want to use box2D to create a movement system for an RTS game.  How can I make bodies block the movement of other bodies while preventing these bodies from pushing each other?

sentences:
Android : glowing/pulsing line/triangle I would like to create a simple Android app using Opengl ES 2.0 that is showing a simple shape (like line or triangle) that is glowing and pulsing like Nexus X logo in this video : http://youtu.be/jBKVAfZUFqI?t=59s

What should I look for?

So far I googled around for glowing effects and found techniques like "bloom" or "additive blending". Are they relevant here? how I would implement pulsing glow with them?

Any links to relevant works very appreciated
Thanks!

P.S - I am very familiar with Android SDK; just started with OpenGL ES

sentences:
DX11 Mixing 2D and 3D So I am somewhat new to working with DirectX rendering, and I have done some 2d and 3d work.  I am planning on working on a new application where I will be rendering a bunch of 3d scenery, and then overlaying some 2d 'sprites'

My plan is to draw the 3d stuff, then change to an orthographic projection for the 2d stuff and so on.  I was wondering if this was a normal thing to do, or if I am somehow going to be shooting myself in the foot later because of performance problems, etc.

Sorry if the question is vague, I don't quite know enough to be more technical / elaborate.

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:
The number of shaders a large game or game engine has Wondering the scale basically. The number of shaders a large game or game engine has. I've seen some metal repos but they typically just have 1 or 2 shaders for small demos. I think I've seen a few with 5 or 10, 1 with maybe 20. But I haven't seen anything where there is like 100 or 1,000 shaders or anything like that.

Wondering what the scale is like for typical large games or game engines, if they are on the order of 1-10, or 100, or 1000, sorta thing. And if it's a large number, maybe a quick idea of what the various tasks they are used for would be interesting but not required :). Thank you!

sentences:
Löve2d: How can i select object with mouse if it's overlap? I have already some code but i can't solved this.
How can i select one object with mouse if the objects are overlap? It's looks like solitaire game.
I wish you can understand me...

For example my code;

function love.load()

    love.graphics.setBackgroundColor(245, 255, 255)
    --1
    carda = {}
    carda.x       = 110
    carda.y       = 5
    carda.width   = 100
    carda.height  = 150
    carda.dragged = false
    carda.dropped = false
    --3
    cardb = {}
    cardb.x       = 110
    cardb.y       = 20
    cardb.width   = 100
    cardb.height  = 150
    cardb.dragged = false
    cardb.dropped = false
end
function love.draw()
    love.graphics.setColor(255, 255, 255)
    love.graphics.rectangle("fill", carda.x, carda.y, carda.width, carda.height)
    love.graphics.setColor(255, 128, 128)
    love.graphics.rectangle("line", carda.x, carda.y, carda.width, carda.height)
    love.graphics.setColor(0, 0, 100)
    love.graphics.print("Card\nA", carda.x + 5, carda.y + 5)
    --2
    love.graphics.setColor(215, 255, 225)
    love.graphics.rectangle("fill", cardb.x, cardb.y, cardb.width, cardb.height)
    love.graphics.setColor(255, 128, 128)
    love.graphics.rectangle("line", cardb.x, cardb.y, cardb.width, cardb.height)
    love.graphics.setColor(0, 0, 100)
    love.graphics.print("Card\nB", cardb.x + 5, cardb.y + 5)
end
function love.keypressed(key)
    if key=="escape" then
        love.event.quit()
    end
end
function love.mousepressed(x, y, button)
    if button == 1 and x >= carda.x and x <= carda.x + carda.width and y >= carda.y and y <= carda.y + carda.height then
        carda.dragged = true
    end
    --2
    if button == 1 and x >= cardb.x and x <= cardb.x + cardb.width and y >= cardb.y and y <= cardb.y + cardb.height then
        cardb.dragged = true
    end
end
function love.mousemoved(x, y, dx, dy)
    if carda.dragged then
        carda.x = carda.x + dx
        carda.y = carda.y + dy
    end
    --2
    if cardb.dragged then
        cardb.x = cardb.x + dx
        cardb.y = cardb.y + dy
    end
end
function love.mousereleased(x, y)
    carda.dragged = false
    --2
    cardb.dragged = false
end

sentences:
Instantiate Prefab From Script Inside A Canvas I am trying to instantiate a Prefab inside a Canvas. Right now, it keeps appearing behind the canvas. I was reading online and it said to set the parent of the GameObject you are trying to instantiate. However, I can't figure out how to get the Canvas component.

My hierarchy looks like this:

My EnemyFormation object has this script attached to it:

public class EnemySpawner : MonoBehaviour {

    public GameObject enemyPrefab;

    void Start () {
        Instantiate(enemyPrefab, new Vector3(0, 0, 0), Quaternion.identity);
        Debug.Log("Spawning enemy");
    }
}

I attach the prefab inside Unity editor. I tried adding this line under Instantiate():

enemyPrefab.transform.SetParent(GameObject.FindGameObjectWithTag("Canvas"), false);

However, I get an error saying it can't convert from Unity.GameObject to Unity.Transform.

How do I make the prefab appear inside the Canvas instead of behind it? Thanks in advance!

This is what it looks like when it creates it in-game: Enemy_Orange3(Clone) is created outside of the canvas and at the bottom left instead of the center. My camera is in the same position and is the same size of the canvas.

sentences:
Instantiating Prefabs at run time I'm trying to move my project to Addressables and upload assets, prefabs and screens to an archive on the server.
I'm a new in Unity and this a bit challenging for me.
I've prepared all prefabs for addressable usage and now I'm trying load them.

All my prefabs have loads throw GameObject.Instantiate
For example:

    public class PlatformObject : LocationObject
        {
//other properties and methods
            public PlatformObject Clone()
            {
                var clone = ((Runner.PlatformObject)GameObject.Instantiate(this));
                clone.Id = this.Id;
                clone.NextPlatforms = this.NextPlatforms;
                clone.IsStartPlatform = this.IsStartPlatform;
                clone.Level = this.Level;
                clone.Type = this.Type;
                clone.MinimumDistance = this.MinimumDistance;
                clone.AllowDispose = false;
                clone.Size = this.Size;
                return clone;
            }
    }

I've tried change this code for usage Addressables.

public async Task<PlatformObject> Clone()
        {
            var handle = Addressables.LoadAssetAsync<GameObject>(this.name);
            var clone = (await handle.Task).GetComponent<PlatformObject>();
            clone.Id = this.Id;
            clone.NextPlatforms = this.NextPlatforms;
            clone.IsStartPlatform = this.IsStartPlatform;
            clone.Level = this.Level;
            clone.Type = this.Type;
            clone.MinimumDistance = this.MinimumDistance;
            clone.AllowDispose = false;
            clone.Size = this.Size;
            return clone;
        }

I've got a cloned object successfully, but object doesn't appears on the scene. Looks like object not initialized properly, bcouz I've got a lot of warnings like that:

  Setting the parent of a transform which resides in a Prefab Asset is
  disabled to prevent data corruption (GameObject: 'Mid_Town_07').
  UnityEngine.Transform:set_parent(Transform)

I've googled and have found a few solution related with parent location.
Made changed but it didn't help. I'm still getting those warnings.

sentences:
libgdx Vector.cpy question Why do people use this:

public void set(Vector2 v) {
    this.vector2 = v.cpy();
}

insted of just using:

public void set(Vector2 v) {
    this.vector2 = v;
}

What I don't know that I should know?

sentences:
Engine for a Football Manager Type game (data driven, menu clicking) A friend and I had started developing a football manager two years ago, but ultimately squashed the whole thing because we found ourselves in a mess with developing UI and saving/loading.
The basic game loop of simulating matches and advancing days until the match day was already done. We also had a e-mail system up and running (for receiving messages which might need decisions/trigger events).
In our lack of of knowledge, we tried building the game in GameMaker2. It made saving all the objects (a Team has 23 Player, a league has 20 Teams, there are several Leagues) a nightmare. Also, UI development (things like scrollbars for example) ate up incredible amounts of our time and still everything looked relatively bland. Short: GameMaker2 seemed not suitable for the type of game we wanted to build.
There must be a better engine/system for developing a manager type game. Most of the game is spent in menus, There's no time-critical interaction going on.
Since we've benched the project, I started working a legit software development job and I have gained some skills which I hadn't have before, like knowledge of databases and a heap of Python experience.

It has me looking at the game again. Now I see it as having a 'data backend' and an point-and-click-frontend, with game design elements, like tough decisions, events and goals as the driving force in the middle.
We want nice looking menus, where players can set the training schedule, make the line-up for match day, talk to players/executives/whoever. The other necessity is managing all data objects, which there will a lot of. A league might easily contain 400 players which all need to have stats and so on and so forth. I see a relational database for this, but maybe there's something smarter regarding game-development?

So my Question is:

What is a suitable game engine/development stack for developing data-heavy, non real-time menu-clicking type manager games  such as a football manager?

sentences:
Checkpoints in a racing game? The game would be a race from A to B through several checkpoints. I think there are two approaches for the concept of time.

The game starts with some time and player has to make it to the finish before it runs out. Extra time is granted at the checkpoints. Time left at the finish is counted as a score.
The time at the start is 00:00 and the stopwatch is halted at the finish. Player still has to go through checkpoints.

Opinions about these? I think the option 1 is more common but I find it frustrating for beginners.

sentences:
Distorted LookAt When Looking Up or Down? I have a weird problem and I have no idea what's going on with it.

Recently started doing some OpenGL programming, going pretty well, hit some rough spots but worked my way through them and otherwise pretty happy! But I've hit a roadblock with something that has me confused as hell.

I'm doing an OpenGL 4 based rendering system, it's early days and I've got some basic stuff like 3D model importer happening, but I've been having some problem with the maths involved in creating my own "LookAt" function like present in OpenGL 2. I've created my own Matrix & Vector class, I think most of the functions are right but the LookAt does something weird when looking at different angles.

For a simple test to show what happens, I created a slowly moving focus point for the lookat that starts off a few units ahead of the camera, then slowly moves closer and closer till it's 1 unit below the camera. As the focus point comes closer to the point of looking straight down, for some reason it's like the field of view is narrowing?

It eventually zooms in so close that all you can see is one solid colour covering the entire screen, whatever pixel just happens to be on the ground directly below the camera as it zooms in with a field of view of basically 0 degrees.

It may be nothing to do with field of view at all but I don't know and hence why I'm here. Here is some related code to the problem, forgive me if these implementations are not perfect, again I'm just starting out and I don't know the best methods yet, still learning:

My function for calculating a lookAt:

public static Transformation lookAt(Vector position, Vector target, Vector updirection) {
        Transformation lookAt = new Transformation();

        Vector vz = position.clone();
        vz.subtract(target);
        vz.normalise();

        Vector vx = Vector.xProduct(updirection, vz);
        vx.normalise();

        Vector vy = Vector.xProduct(vz, vx);

        lookAt.m[0] = vx.x; lookAt.m[1] = vy.x; lookAt.m[2] = vz.x; lookAt.m[3] = position.x;
        lookAt.m[4] = vx.y; lookAt.m[5] = vy.y; lookAt.m[6] = vz.y; lookAt.m[7] = position.y;
        lookAt.m[8] = vx.z; lookAt.m[9] = vy.z; lookAt.m[10] = vz.z; lookAt.m[11] = position.z;
        lookAt.m[12] = 0; lookAt.m[13] = 0; lookAt.m[14] = 0; lookAt.m[15] = 1;

        return lookAt.inverse();
    }

My function for calculating perspective:

public static Transformation perspective(double FoV, double aspectRatio, double nearClip, double farClip) {
    Transformation proj = new Transformation();
    double FoVR = Math.toRadians(FoV);
    proj.m[0] = FoVR/aspectRatio;
    proj.m[5] = FoVR;
    proj.m[10] = (farClip + nearClip)/(nearClip - farClip);
    proj.m[11] = 2*(farClip*nearClip)/(nearClip-farClip);
    proj.m[14] = -1;
    proj.m[15] = 0;
    return proj;
}

I use the function later on when generating a matrix to apply to the 3D letter G in the scene, like so:

Transformation MVP = new Transformation();

Transformation proj = Transformation.perspective(FoV, (double)canvas.getWidth()/(double)canvas.getHeight(), near, far);
MVP.multiply(proj);

Transformation view = Transformation.lookAt(cameraPosition, cameraFocus, cameraUp);
MVP.multiply(view);

Transformation model = Transformation.scaleRotateTranslate(objectScale, objectRotation, objectTranslation);
MVP.multiply(model);

And the MVP is simply sent to the shader and used as you'd expect to multiple against all the verticies/normals.

What do you think I'm doing wrong? What should I check first? Is there a better way of doing what I'm trying to do? Any help/answers at all is greatly appreciated, I just don't know what to go after first. The perspective/lookAt seems like it's almost working but something must be broken?

sentences: .blend scenes are not showing texture in Unity I am new to Unity and Blender. I am getting a problem when importing .blend files into Unity: in Unity scenes the textures created in Blender are not showing.  But there are no problems with color. How can I fix this problem?

sentences:
Which algorithm for controlling cars on a race track? I think A* is a good place to start, but since cars cannot move in all directions (they move like cars do, trying to move forward and steer), I was wondering if someone could point me at other approaches they've used.

Also, I was wondering about the "Racing Line". Should one just precompute the optimal paths, and then use the A* to select the path that isn't blocked by other cars ?

EDIT: My question is different from Driver AI in racing game because that question is about approaches.

I am interested in learning about specific tried and trusted algorithms like A*.

sentences: What are the advantages and disadvantages to using a game engine? How do I know whether or not to use a game engine? I want to make a relatively complex 2D game for Android. What factors should I weigh to decide whether to find, install and learn a game engine or just do everything manually?

sentences:
Easy SpriteKit question on creating a function The following code is what I'm working on to animate characters in a SK scene class. I can run the code without building, no problem, but I can't build it and run it; I get one error message: Binary operator '+=' cannot be applied to operands of type '[(SKTexture)]' and '[SKTexture!}'.
The code is below:

func initStoryBegin() {
    let CaitAtlas = SKTextureAtlas(named: "cait")
    let DrewAtlas = SKTextureAtlas(named: "drew")

    CwalkAnimation = self.animateSheet(CaitAtlas, walkAnimation: CwalkAnimation, formattedword: "cait%01d")

}
// ***This is where I am having trouble. In the walkAnimation += line.
func animateSheet(nameAtlas: SKTextureAtlas!, walkAnimation: [(SKTexture)], formattedword: String) -> [SKTexture] {
    for index in 1...nameAtlas.textureNames.count {
        let imgName = String(format: formattedword, index)
        walkAnimation += [nameAtlas.textureNamed(imgName)]
        println(walkAnimation)
        return walkAnimation
    }
}

override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
    let charNode = self.childNodeWithName("charNode")

    if (charNode != nil) {
        let animation = SKAction.animateWithTextures(CwalkAnimation, timePerFrame: 0.2)

    charNode?.runAction(animation)

    }
}

I can't figure out why the code works when I run it, but it doesn't work when I try to build and run? Any help would be greatly appreciated.

sentences:
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:
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: Tile walking algorithm for already known set of walkable tile? Suppose I already have a list of tile that specify which tile the character can move to, and these tiles are clustered around the character. If I want to produce a path (maybe not shortest, but just a short path) to the desired tile, how would I construct it with the given list of tiles? I was going to do an A* algorithm, however, thinking again, it will complicate my coding process. Therefore, is there a better way to find short path for known list of movable tile?

sentences:
How to apply Buoyant force to a Box2d body? I have been following a formula to calculate the buoyant force needed to apply to a dynamic body to be able to simulate water.

  Fb = ρgV

Fb - is the buoyant force
ρ - density of the liquid
g - gravity
V - volume of the object

My box2d body will always be submerged to the sensor so I don't have to detect what portion of the body is in the water, basically the entire body is always in the water and I will always apply the force to the center of the body.

body.applyForceTocenter(0, Fb, true);

If I apply the force on upon collision to the censor then it will just fall cause there is not enough force, and if I type this to the render method then the body will fly cause there is too much force. So how do I implement the force? and how to compute for the drag? so that it won't bounce.

sentences: Linux OgreXML model viewer Is there an OgreXML model viewer for Linux? I know about OgreMax but apparently that's Windows only.

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:
TileEntitySpecialRenderer only renders from certain angle I'm developing a Minecraft mod with Forge. I've added a tileentity and a custom renderer for it. The problem is: The block is only visible from sertain angles. I've compaed my code to other peoples code and it looks pretty much like them.

The block is opaque and not to be rendered and the renderer is registered normally so the fault must be in the renderer.

Here's the renderer code:

public class TERender extends TileEntitySpecialRenderer
{
    public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float f)
    {
        GL11.glPushMatrix();
        GL11.glTranslatef((float)d, (float)d1, (float)d2);
        HeatConductTileEntity TE = (HeatConductTileEntity)tileEntity;
        renderBlock(TE, tileEntity.getWorldObj(), tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, mod.EMHeatConductor);
        GL11.glPopMatrix();
    }

    public void renderBlock(HeatConductTileEntity tl, World world, int i, int j, int k, Block block)
    {
        Tessellator tessellator = Tessellator.instance;
        GL11.glColor3f(1, 1, 1);
        tessellator.startDrawingQuads();
        tessellator.addVertex(0, 0, 0);
        tessellator.addVertex(1, 0, 0);
        tessellator.addVertex(1, 1, 0);
        tessellator.addVertex(0, 1, 0);
        tessellator.draw();
    }
}

sentences:
set sprite to current animation texture In my game I have some box2d bodies where I add sprites using the following code in my render() method.

for (Body body : worldBodies) {
        if (body.getUserData() instanceof Sprite) {
            Sprite sprite = (Sprite) body.getUserData();

            Vector2 position = body.getPosition();
            sprite.setPosition(position.x - sprite.getWidth() / 2 , position.y - sprite.getHeight() / 2);
            sprite.setRotation(body.getAngle() * MathUtils.radiansToDegrees);
            sprite.draw(batch);
        }
    }

One of the bodies has to be animated.

birdAnimation = new Animation(1, birdAtlas.getRegions());
birdAnimation.setPlayMode(Animation.PlayMode.LOOP_PINGPONG);

This is the animation and now I tried to set the body's sprite obstacle6 to the current textureRegion from the Animation unsing this code:

obstacle6.setRegion(birdAnimation.getKeyFrame(delta));

Somehow it just shows the first texture of the atlas. How can I get it to change? Or is there an other way to animate a box2d body?
If you need any other information just comment.

sentences:
Parse and iterate over SVG path I need to parse a SVG path expression like

m8,295c-4,-292 441,-291 446,-26c5,265 440,263 442,-9

and have a way of iterating over it in [0 ... 1]. I looked into Apache Batik but it doesn't seem to have this specified function. I also looked at Salamander SVG but in the end the path is a wrapper around java.awt.geometry, which is not ported to android so I can't really use it.

sentences:
Flash  server, protocol protection I am making a flash game that will interact heavily with the server. For quite some time already I am using 'request hashing' technique to make sure that request data hasn't been tampered with. This works pretty well. However, in this game I'd like to go a little bit further and completely hide the protocol from the observer (right now it's plain JSON).

I imagine that I could zip and encrypt data (using one of symmetric algorithms). That would make it pretty unreadable by human, right (also smaller)? And SWF encryption/obfuscation should protect the encryption key (it is being done anyway).

As a side benefit that will also protect dynamically loaded resources from directly saving them to disk (or copying from the cache).

Questions:
* are there tools that allow you to simply dump the SWF with all its content, received and decrypted? If yes, this will render 'the side benefit' invalid.
* do you think it's worth it to burn all that CPU power?

To support my point, I will say that I like to inspect data being exchanged between client and server. And occasionally I find a bug or two which I can use to my benefit. But then there was a game that was sending and receiving some binary data. Being a lazy attacker, I decided not to analyze further. Otherwise, who knows what I could find :-)

Comments, ideas, criticism, suggestions? :-)

sentences:
HLSL How to flip geometry horizontally I want to flip my asymmetric 3d model horizontally in the vertex shader alongside an arbitrary plane parallel to the YZ plane. This should switch everything for the model from the left hand side to the right hand side (like flipping it in Photoshop). Doing it in pixel shader would be a huge computational cost (extra RT, more fullscreen samples...), so it must be done in the vertex shader.
Once more: this is NOT reflection, i need to flip THE WHOLE MODEL.

I thought I could simply do the following:

Turn off culling.
Run the following code in the vertex shader:

input.Position = mul(input.Position, World);

// World[3][0] holds x value of the model's pivot in the World.
if (input.Position.x <= World[3][0])
    input.Position.x += World[3][0] - input.Position.x;
else
    input.Position.x -= input.Position.x - World[3][0];

...

The model is never drawn. Where am I wrong? I presume that messes up the index buffer. Can something be done about it?

P.S. it's INSANELY HARD to format code here.

Thanks to Panda I found my problem. SOLUTION:

// Do thins before anything else in the vertex shader.
Position.x *= -1;   // To invert alongside the object's YZ plane.

sentences:
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:
Slope handling in a tile-based platformer I'm trying to implement slopes in my 2D tile-based platformer made in GameMaker Studio 1.4.

I'm done with the normal solid block tiles, they work like charm, but slopes are even harder than I expected.

There are many problems with what I already tried. At some point, I was somewhat OK with it, but somewhat OK is not enough, it must be perfect.

So let's talk about uphill and let's assume our slope is going right.

So I need to check if we are in a slope. When we are, I need to calculate how much we are in the slope. Since it's a 45 degree slope for now, we should move the character upwards the same amount of pixels as we are in the slope. That looks and works fine for most of the cases.

But let's face some of the issues: If there are not wall tiles (black
ones in the picture) then the player may fall down between two slope
tiles.
Going down doesn't work in my current implementation, it works    if
I ignore, how much I am in the tile (but then, it snaps to the
slope even if I don't touch it, but I'm really in the slope tile),
really visible, when I am at the left-most part of the slope (snaps
to the bottom). Also sometimes it just positions kinda badly... Look
at the Grounded variable state.

If I ignore the intrusion amount (so it snaps into the tile), then
I'm still not good yet, as reaching the bottom of the slope may move me out
sideways. Applying the x velocity may make me leave the slope tile
before applying the y position and since I left the tile, there won't be y position applying. My character will be above ground
for a while depends on x velocity and gravity. At higher x velocity,
the player may left the slope tile more than one pixels above the
ground.

In overall, all the solutions I tried were imperfect. Most of the times, it work, but there are those situations where it becomes unreliable, especially at higher speeds. I think I will go until 8 pixels / frames speed with a very few of the objects. I wonder how specific games did it? I tried to learn from games like Castlevania - Dawn of Sorrow, since I got an editor for it and I experimented with slopes. To make the slopes work perfectly, there must be an solid block below the slopes at the intersections, or the player will fall between them. I wouldn't mind this that much. Worst case scenario, I would mark some tiles with some special flag below the slopes.

Screenshots from Symphony of the Night's hidden debug mode room:

This is how Dawn of Sorrow (not) handles slopes:

So I'm a bit confused / puzzled about the situation.

sentences:
What data structure to use for the map in Pac-Man? I am trying to make a Pac-Man game in C# using GDI+. I have done some basic work and I have previously replicated games like Copter-It and Minesweeper, but I am confused about how I can implement the map in Pac-Man. I mean: which data structure to use, so I can use it for moving AI controlled objects and check collisions with walls.

I thought of a 2D array of ints but that didn't make sense to me. Looking for some help.

sentences:
Welzl Algorithm to find the Smallest Bounding Sphere I'm implementing Welzl's Algorithm to find the Smallest Bounding Sphere.

In brief, the algorithm works by maintaining:

a set of points to contain in the sphere (inside its interior, or on its boundary)
a set of points known to be on the boundary of the sphere (the "set of support")

It works recursively, starting with the full set of points in the contained set and no boundary points in the set of support. At each level, it tries removing a point from the contained set, and recursively finding the minimal bounding sphere of this reduced set (with the current set of support).

If the removed point is in/on the resulting sphere, then it returns that result up the recursive chain.
If not, then the removed point must be on the boundary of the minimal bounding sphere, so it adds it to the set of support and recurses again.

Once it boils down to no remaining contained points or 4 boundary points, the recursion bottoms-out and returns an explicitly calculated sphere based on the boundary points found.

I'm not sure of a few details of the implementation, and haven't found on the net the answer to my questions :

How can I construct a sphere is uniquely defined by four (non co-planar) points?
Do I have to check in the algorithm if these four points are non co-planar?
I used the barycenter (centroid) of the boundary points in by set of support when the number such points is three or more. Is that correct ?
My algorithm may fall into cases with more than four boundary points in the set of support, so I had to add a default case to handle this - is this normal?

Here's my current code:

Sphere ComputeMinimalBoundingShpere(glm::vec3*              points,
                                    std::size_t             numberPoints,
                                    std::vector<glm::vec3>& sos,
                                    std::size_t             numberSos)
{
  // Stop the recursion when we have no more points
  // Or the number of support is more than three
  if (numberPoints == 0 || numberSos >= 4) {
    switch (numberSos) {
      case 0: return Sphere();
      case 1: return Sphere(sos[0], 0.000f);
      case 2: {
        const glm::vec3 center = (sos[1] - sos[0]) * 0.5f;
        return Sphere(center, glm::length(center) * 0.5f);
      };
      case 3: {
      // If we have three points: Look for the barycenter
        const glm::vec3& A = sos[0];
        const glm::vec3& B = sos[1];
        const glm::vec3& C = sos[2];
        const float      v = 1.0f / 3.0f;
        const float      w = 1.0f / 3.0f;

        const glm::vec3 P      = ((1 - v - w) * A) + v * B + w * C;
        const float     radius = glm::length(P - A);
        return Sphere(P, radius);
      };
      case 4: {
      // If we have four points: Look for the barycenter
        const glm::vec3& A = sos[0];
        const glm::vec3& B = sos[1];
        const glm::vec3& C = sos[2];
        const glm::vec3& D = sos[3];
        const float      v = 0.25f;
        const float      w = 0.25f;
        const float      x = 0.25f;

        const glm::vec3 P = ((1 - v - w - x) * A) + v * B + w * C + x * D;
        const float     radius = glm::length(P - A);
        return Sphere(P, radius);
      };
      default:
        assert(false && "We cannot have more than four Set of Support");
    }
  }

  const int    indexPoint = numberPoints - 1;
  const Sphere smallestSphere =
    ComputeMinimalBoundingShpere(points, numberPoints - 1, sos, numberSos);
  if (smallestSphere.contains(points[indexPoint])) { return smallestSphere; }

  sos[numberSos] = points[indexPoint];
  return ComputeMinimalBoundingShpere(points, numberPoints - 1, sos,
                                      numberSos + 1);
}

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:
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:
Touch sides of tablet, moves that direction I am making a game where the player flies a balloon through a cavelike structure.

I am having trouble making him fly correctly when I try it out on my android tablet, seeing as it requires different input to move.

How can I make the player move towards the touched side? By creating a ray? through touched objects? :)

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:
Playing Audio in Unity 5.x I've started using Unity recently and have ran into some snags with the built audio features. I am trying to have multiple sounds play from the Player Game Object. I'm not sure what the best way to do this.

I have looked into solutions that involve changing the audio clip in the audio source. The problem I ran into with this method was that using the function "PlayOneShot" allows the sounds to stack. So if I try using this method for the walking noise it creates a new instance of that sound that layers on top of each other each frame the player walks. I figure I need to make just a player noise track that starts and stops depending on when the player is walking.

I've also considered trying to use multiple audio sources on the game object.

I'm really not sure what the best approach is for this and I'm having a hard to finding resources in this subject area.

sentences:
Where do I start if I want to make music and audio for video games? I am a singer/songwriter/instrumentalist, as well as a video game lover. I have some basis in informatics but I have spent 1000x the time on music in comparison with programming. I came to think that making music and audio for video games could be a great way to make money while making something exciting. I dream of making my own game someday, and I thought that starting by making what I do best (music and audio) could make me discover the universe of game development, while giving me the opportunity to work on something that makes sense to me.

I can make many kinds of music and my vocal skills make it easier to create audio for games (beast sounds, animal sounds, human sounds, and so on). That said, I could tell this and that, but having credibility is very hard since no one knows how I sound. Where do I start? And how do I contact people that are seeking the kind of service that I offer?

I have almost 20 years of experience as a singer, 11 as a songwriter and 5 as an instrumentalist. I can use software to program audio performances, and I have professional quality microphone (Audio Technica 4050) and audio interface. I have all the equipment and the softwares (Pro Tools) necessary to record music and audio for video game.

sentences:
Scale my pixel art files when designing them or when rendering? If I create pixel art files that need to be scaled up on the screen later, so that a single pixel becomes a box of 4 pixels. Should I create my pixel art with 2x2 pixels or should I create it with 1x1 pixels so that I can I 1:2 scale it later in XNA to 2x2 pixels?

I tend to believe that 1:1 would result in too much detail rather than the pixel art effect, thus I want the end result in 2:1 style where a 1x1 pixel of my intended sprite will take 2x2 pixels on the screen.

sentences:
How do I make the background color fade into a different color after hovering it? I was trying to make the starter inputs for my text rpg change the background color in a fade effect with JQuery, but I cant figure out what i did wrong. Heres the part im focusing on:

  <script>
    $(document).ready(function() {
      $Intro_Inputs = $('#Header_Intro input');
      $Intro_Inputs.hover(function() {
        $(this).animate({'background-color':'#2E8AE5'}, 'slow');
      });
    });
  </script>

If anyone could help me out with the mistake i made i would greatly appreciate it!

(The problem was that it wouldnt fade the colors in)

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:
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 do I visualize parallax layers in a level editor? I'm making a 2D game in Unity, but this would apply to any 2D game engine.

If I implement multiplane parallax with orthographic cameras, it is difficult to lay out the background layer's sprites and know where they will line up with sprites in other layers.

My first instinct was to use multiple cameras, one for each layer, and scale down the movement speed of cameras for background layers. This avoids having to move all background sprites every frame.  The problem is that a layer that moves at half speed will take up half the space of the main layer when viewed in the editor. So it is difficult to know where to place sprites as you're laying out the game. The problem gets exponentially worse as you increase the number of layers.

How do I get around this? I've tried inversely scaling the layers by their intended movement speeds while working with them in the editor. That puts all background sprites in the correct locations relative to the main layer, but they're horribly distorted.

Do I need to just suck it up and constantly switch between the editor and the running game to test the parallax backgrounds?

sentences:
Can I develop a game for Kinect without a Kinect? I have to make a game in Unity3D using Kinect. The problem is I don't have the Kinect yet. I need to wait until they deliver it to me.

Can I imitate Kinect's movement for debugging my app?

sentences:
Issues using NetworkServer.Spawn with Unity and Mirror-Networking I am using Mirror to handle the networking aspect

When I spawn an object on the network, I Instantiate it on the server and then use NetworkServer.Spawn to notify all clients to spawn the object.

However, when this object is eventually spawned on the client side, it seems to be spawned at the wrong position for a few seconds and then corrected itself and move to the correct position as is reflected by the server. Is there something I am not doing? Is this normal?

Also I noticed if I changed the Network Sync Mode to 0, then it will only spawn in the wrong spot for a split second.

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

public class EnemySpawner : NetworkBehaviour
{
    public uint theId;
    public int maxNumEnemies;
    public int spawnDelay;
    public GameObject enemyToSpawn;
    float curSpawnTime;
    BoxCollider2D boxColl;
    // Start is called before the first frame update
    public override void OnStartServer()
    {
        curSpawnTime = spawnDelay;
        boxColl = GetComponent<BoxCollider2D>();
    }

    void Start()
    {
        if (!isServer) return;
        theId = netId;
    }

    // Update is called once per frame
    void Update()
    {
        if (!isServer) return;
        if (transform.childCount < maxNumEnemies && curSpawnTime <= 0.0f)
        {
            Vector2 spawnPoint = new Vector2(Random.Range(boxColl.bounds.min.x, boxColl.bounds.max.x),Random.Range(boxColl.bounds.min.y, boxColl.bounds.max.y));
            curSpawnTime = spawnDelay;
            SpawnEnemies(spawnPoint,netId);
        } else
        {
            curSpawnTime -= Time.deltaTime;
        }
    }

    [Server]
    void SpawnEnemies(Vector2 spawnPoint, uint theId)
    {
        GameObject gobj = Instantiate(enemyToSpawn, new Vector2(60.7f,1.3f), Quaternion.identity);
        gobj.GetComponent<EnemyController>().parentNetId = netId;
        NetworkServer.Spawn(gobj);
    }
}

The way I've organized things, in the hierarchy I have:

Enemies
   Area1
      Spider(Clone)
      Spider(Clone)

Area1 has the EnemySpawner script.  The spider is registered a spawnable prefab.
Both Area1 and the Spider have a NetworkIdentity with no boxes checked.
Additionally, the Spider has a NetworkTransform and NetworkAnimator.

sentences:
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:
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: How to Play YouTube Videos Within Asset Store for Unity On every computer I've ever tried to use Unity, the Asset Store seems incapable of showing the YouTube video previews of assets. It always claims my "browser" does not currently recognize any of the video formats available and recommends I click for a visit to a FAQ about HTML5 video. I would expect this to be built into Unity, yet it seems not to be. I can't find anything online about what the deal is. So how do I get the videos to work within the Asset Store within Unity??

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: First Mobile Indie Game - Monetization Model. Ad based or in app purchases? We are a team of 3 (1 graphics designer, 2 developers). We're almost done with our first Android based indie game. Which monetization model will be suitable for us? We don't want to disturb users with a lot of ads (at this point we're thinking to put only banner ads) also, if we go with in app purchases, can we also keep ads as well? or is it a better practice to follow one model at a time? How much will it affect the user experience?

sentences:
Problem with calculating velocity for a car with multiple gear ratios I hope this is the right place for this but I have a problem with calculating velocity for my car game. The higher the gear, and therefore lower the gear ratio, the lower the top speed.
Given that

Acceleration = Forward Force - Drag - Rolling Resistance

Velocity += Acceleration * dt

and

Wheel Torque = Engine torque * Gearbox ratio * Differential ratio

Forward Force = Wheel Torque/Wheel Radius

I feel like I am missing something because if we decrease the gear ratio we decrease the torque and therefore the forward force causing lower acceleration so the car cannot gain additional velocity, and actually loses it due to resistive forces.

sentences:
Forcing a game to use Direct3D WARP I am making a study for a research project that involves measuring the performance and quality impact of rendering 3d games using a software rasterizer (like WARP).

I wonder if there is a way to force games to use WARP. Maybe something easier would be to just use games that support using warp or the reference rasterizer. Are there any relatively new game (no more than 8 years old) that supports that? I don't remember seeing that option in games in a long time.

If there is no tool or setting to do that, I was thinking I could use something like Detours (http://research.microsoft.com/en-us/projects/detours/) or EasyHook (http://easyhook.codeplex.com/), and perform binary rewriting on the code. For DirectX 10 games I think it should be enough to intercept the CreateDevice call and change the device. For DirectX9 games is it enough to change the D3D9CreateDevice for a D3D10CreateDevice? I tried with samples from the SDK and it seems it is not the case. Any suggestions on what to do there?

sentences:
Using model tools as map editor I want to make a game which would require a 3D map editor. Of course, I would like to avoid creating such an editor. My idea is now to use modeling tools (3DS Max, Maya, Blender) to create the map, and to give game specific objects specified names. This way I'd just need to write an COLLADA -> native map format converter. But I'm not sure if this is possible the way I imagine it, that's why I'd like to hear your thoughts on the matter.

Are modeling tools suitable to create big open world maps?
Can this "naming convention"-idea for game specific objects work?
Are the modeling tools able to export a scene in chunks / in a way that occlusion culling and collision detection can be properly done? If not: Is there a way to build a suitable data structure from the exported data?

sentences:
How to get a point to the left/right of a vector I have a position vector of a point in space and a quaternion for it's rotation. What i'm trying to calculate is a point too the left and a point to the right.

I have the position and rotation(quaternion) of the red dot. What I want is to get the position of the green dots. I have a float value for the distance I want these points to be.

With only the position and rotation is it possible to get a unit direction vector pointing left/right which I can multiply by my float value?

Edit: I also know the original direction vector.

sentences:
How to define a proper protocol for a turn-based combat system? I'm working on the server side of a turn-based strategy game. The game has a really complex combat system, like:

  When you are hit, you summon a phoenix to attack the enemy that deals X damage, and the phoenix fly back to heal Y of your health.

Well, such skill does sounds interesting, but requires a great amount of work on the skill and combat system.

We did not use script on the server. We just split one skill into several skill effects. For instance, we have DamageEffect, AddBuffEffect and so on. However, we have a lot of skills like the phoenix stuff above, they can be triggered at a specific moment. And some of them even replace the main attack skill. So we designed several SkillConditions for that. It worked, although not very well.

However, the question is: For such a complex combat system, how to define the protocol between client and server?

For example:

  A attacks B using skill X for 30 damage points. B uses the phoenix skill Y when he is hit that damage A for 20 points, and heals himself 10 points.

How can we express this to the client? We currently use a structure like this:

useSkillAction:
    skill: id_of_X
    source: id_of_A
    target: id_of_B
    subActions:
        damageAction:
            timing: onHit  // Timing means the the damageAction will trigger when the skill animation triggers a 'hit' event.
            character: id_of_B
            damage: 30
            subActions:
                propertyChangedAction:
                    timing: onFinished
                    character: id_of_B
                    property: health
                    value: health_of_B
                useSkillAction:
                    timing: onFinished
                    skill: id_of_Y
                    source: id_of_B
                    target: id_of_A
                    subActions:
                        damageAction:
                            timing: onHit
                            character: id_of_A
                            damage: 20
                            subActions:
                                propertyChangedAction:
                                    timing: onFinished
                                    character: id_of_A
                                    property: health
                                    value: health_of_A
                        healAction:
                            timing: onFlyBack??
                            character: id_of_B
                            damage: 10
                            subActions:
                                propertyChangedAction:
                                    timing: onFinished
                                    character: id_of_B
                                    property: health
                                    value: health_of_B

Well, I think you got the idea. For now, this structure can handle only simple skills. The solution currently have three problems:

For complex skills, like above, it's hard to describe the timing of phoenix fly back.
For the onHit timing in damageAction, that means the server even knows that there's an animation trigger called 'hit'.
It's hard to maintain.

Is there a better way to do this? Thanks anyway, for my broken English...

EDIT: As Petr suggested, I reduced the question to a simpler one:

Is there a way to define the protocol so that server does not care about animation trigger stuffs like 'onHit'? Because, generally speaking, server should only care about the logic.

sentences:
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:
Creating 3D objects from code and their normals I'm trying to create my own 3D objects from scratch so I can generate my own terrain for a game I'm making.

So I created a cube and realized the lighting was strange, I looked up the cause and found that each face needed multiple vertices so they could hold their own individual normal because face x's normal will be different to face y's normal, even though the vertices are the same.

So I re-made my cube this way and went on with my terrain generating code. Now that I'm getting into creating more sophisticated meshes the number of vertices and indices are getting quite high (atleast compared to my cube) and a big reason for it is because I have to replicate a lot of the vertices just to have a different normal.

I just wanted to ask if this is normal (I know, I'm so funny) and that I'm doing everything right? Or is there a simple way for a single vertice to hold multiple normals?

sentences:
What would be the simplest way to create a 2D board game for Android? I'd like to create a very simple 2D board game for Android, it would be a concept/mockup so I can see how the game works out.

Let's for the sake of this question that it's a clone of Othello - board game with score display, clickable game pieces/spots on a square grid and some animations.

I have to choose from these approaches:

do it all myself, draw the game on Canvas - I've done one game this way, and it took some time to code it. Then, that was a casual action game and the animations would be hard to implement.
implement it with Android widgets - I'd use RelativeLayout/TableLayout; the pieces will be ImageViews - this way I'd get the animations for free with Android tween animations. This would be the quickest of all solutions timewise, but I might run into some problems that may be a deal breaker.
use AppInventor - it may do the task, but don't know anything about it, this approach would also require some time to go through the tutorials.
use a proper game engine. That will take time to learn how to use it, which I view as the biggest disadvantage as I do mostly business apps, not games. And I don't know which one to choose from.

I really only want to throw this together in the shortest amount of time to see how it works, so I don't want to invest a lot of time to do it in the most "correct" way - that I'll do later if the concept works.

sentences:
Movement for Box2D Bodies I'm having trouble wrapping my head around something that should be relatively simple. I'm making a breakout clone using LibGDX and Box2D. I'm also using the Ashley ECS. For movement with bodies, I have two components - a BodyComponent (BC) which contains a reference to the Body that was created for the owning entity, and a PhysicsComponent (PC) which contains a velocity vector.

What I'm currently doing is manipulating the PC's velocity vector when providing input, then setting the BC's body's linear velocity to the velocity vector in the PC. This allows my bodies to move how I want them to move but there are two issues:

Bodies have no maximum velocity
If the pad bumps into a static body, it should bounce. However it quickly snaps back to its original position because the PC's velocity is unaffected when bodies collides.

How can I manipulate bodies and make them move and interact with other bodies without the need to use another component for velocity?

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:
Is there a javascript physics engine that does not require canvas? I just need a really simple and small physics engine for squares or circles that moves images using javascript. For the project that I am working on, I can't use canvas, so I will be moving the images via the dom. If I understand it correctly, Box2D and PhysicsJS both require the canvas (or at least in my testing that seemed to be the case). I don't really want to make my own, because I bet there is something out there that already does this.

So, is there a javascript physics engine that does not require canvas?

sentences:
How to implement homing missiles with loops while in transit? I have implemented missiles that steer towards a target, however this feels kind of boring.

I want to add loops! Loops are cool! To do this I thought I could use catmull-rom splines, but that seems very static - loops would always end up at the same position unless I made several premade patterns.

Anyone have any other ideas on how I can do this?

I'm using a simple steering function: EDITED

         var toTarget = player.Position - missile.Position;
        toTarget.Normalize();

        float turnSpeed = 0.1f;
        float momentum = 3f;
        float speed = 1f;

        currentDirection = Vector2.Lerp(lastDirection, toTarget, turnSpeed);

        currentDirection.Normalize();

        lastDirection = currentDirection;
        lastPosition = missile.Position;

        player.Update(gameTime);
        missile.Update(gameTime);

        missile.Position = lastPosition + currentDirection * speed + lastDirection * momentum;

I have tried using the player as an attractor object which kind of works - the missile orbits the player object, but it mainly looks like it's moving backwards and forwards while the player object is standing still.

sentences:
What design pattern should be used when there are a lot of different possible jobs? Some background information on what I am trying to accomplish. I am creating the game in Unity using C#. Basically, I am trying to create an RPG type of game where it really harps on the idea of a lot of different possible classes/jobs(I will call them jobs so not to confuse anyone). Basically, every job will have its own unique set of skills and can only do certain tasks, not dissimilar to a lot of games out there. However, the way I see most of the advice given down this path is simple inheritance, mostly because the user is only trying to implement 2 or 3 unique jobs. I feel as though this is just the easy answer that ends up causing a lot more headaches in the long run when you have lots of different jobs to implement.

So my main question is, what design patterns would someone use when there are a lot of different jobs that the programmer needs to implement?

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: Difference between Spherical Harmonics and Spherical Harmonics Lighting What is the difference between Spherical Harmonics and Spherical Harmonics Lighting in OpenGL?

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:
Pathfinding in non tile-based 2d map (maybe potential field) I am developing a top-down 2d zombie shooter in AS3.
I have implemented collisions against segments (line from point a to point b), polygons (array of points, convex) and round obstacles (center and radius)
Player and enemies are basically moving round obstacles, with different radii.

Now, I'm having trouble with zombie AI's pathfinding.
I have read about potential fields, and I found it fascinating, but I can't figure out how to adapt it to a non tile-based map.
I can calculate the distance from a point to the closest obstacle, and get the obstacle repulsive potential in that point.
I don't know how to get the player's attracting potential in that point though. In tile-based maps you use the A* algorithm, considering every walkable tile as a node. This is my first problem.

Once I have calculated the player's attracting potential in a point, what I get is a Number. In tile-based maps, I would test this number against the potential of the 8 adjacent tiles, and move the enemy to the tile with the lowest potential. In my non-tile based map instead I do not have a fixed set of tiles to test, so I can't understand how to get the moviment vector to apply to the enemy. This is my second problem.

If I, say, set a waypoint every x*y pixels, I could use it as the centre of a tile, but that sounds very unelegant, mainly because enemies would be forced to move along the 8 directions of adjacent nodes.

Should I forget PFs and try a different approach?

sentences:
How 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:
How do I get the full path of Content? To display an image from Content in a .NET Forms Dialog, I'm trying to make a function that loads an image through .NET's Image.FromFile(string fileName) function, but instead of taking a whole path, it takes the path you'd usually put in Content.Load<T>(string assetName).

For this, I need to be able to get the complete root directory of the Content folder, but how do I get that?

I've already tried Content.RootDirectory, but that seems to give only a relative file path (in my case, it just says "Content" because I left it at default)

Thanks in advance!

sentences:
Where should I store an object? - QuadTree I'm designing a QuadTree to scene partitioning, I've read theory and seen some code examples.

When a node has more than 4 objects, it will be splitted into 4 sub-nodes and its objects will be put into them, but if an object is on the edges of any sub-node, it will be placed in the parent node. Why should I do this?

I think it's better put it on every sub-node where it's colliding. Am I wrong?. I've designed a pattern to achieve this ;).

sentences:
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 converting absolute top-down coordinates into relative third-person coordinates I'm working on 2D top down zombie game. I started working on it as having a static 2D map and on every tick you update the coordinates of every object, including the player itself relative to the static map. Every object has x, y and angle against x axis x, y, theta.

But I would like to also provide a way to see it as a kinda third-person shooter (still top down 2d just different center of coordinates), where camera and coordinates are connected to the moving player object. So the player would always have the 0, 0, 0 coordinates and every other object transformed xT, yT, thetaT coordinates.

What approach should be used in such cases? Should I still keep the static coordinates and simulate the world over a static map, and then transform the coordinates of every object into relative coordinates? So every tick there will be two transformations - world simulation and static -> relative coordinate transformation?

sentences:
How do I employ an arcball to allow the user to look around the screen? How do I apply an arcball (using quaternions) along with mouse events, to allow the user to look around the screen using the o3d WebGL framework?

This sample uses the arcball for rotating the transform of an "object," but rather than apply this to a transform, I would like to apply the rotation to the camera's target, to create a first person style ability to look around the scene, as if the camera is inside the centre of the arcball instead of rotating from the outside.

The code that is used in this sample is

var rotationQuat = g_aball.drag([e.x, e.y]);
var rot_mat = g_quaternions.quaternionToRotation(rotationQuat);
g_thisRot = g_math.matrix4.mul(g_lastRot, rot_mat);

The code that I am using which doesn't work

var rotationQuat = g_aball.drag([e.x, e.y]);
var rot_mat = g_quaternions.quaternionToRotation(rotationQuat);
g_thisRot = g_math.matrix4.mul(g_lastRot, rot_mat);

var cameraRotationMatrix4 = g_math.matrix4.lookAt(
  g_eye, g_target, [g_up[0], g_up[1] * -1, g_up[2]]
);
var cameraRotation = g_math.matrix4.setUpper3x3(
  cameraRotationMatrix4, g_thisRot
);
g_target = g_math.addVector(cameraRotation, g_target);

where am I going wrong?

sentences:
XNA / Monogame Camera flickering on collision I have my camera follow my player and it works perfectly, I had some issues with collision and managed to get it working, but now my camera follows my player when it gets pushed back so the camera just flickers when holding down the button towards a collision since it's following the player! I tried to stop the camera from following the player on an axis when colliding with something but it still makes the character look weirdly bouncing from walls. This is my code:

Camera Updating

if (player.CameraFollow)
{
    Camera.IsFollowingObject = true;
    if (Camera.IsFollowingObject)
    {
        Vector2 relativePlayerpos = -player.CurrentPos;
        relativePlayerpos.X += Camera.Viewport.Height;
        relativePlayerpos.Y += Camera.Viewport.Width/2 - player.Sprite.SourceRect.Height/2;
        Camera.Pos = relativePlayerpos;
    }
}

Collision Handler

public void CollisionHandler(ref Player player, Rectangle tileRect)
{
    //push left
    int left = Math.Abs(tileRect.Left - player.CollisionBox.Right);
    //push top
    int top = Math.Abs(tileRect.Top - player.CollisionBox.Bottom);
    //push right
    int right = Math.Abs(tileRect.Right - player.CollisionBox.Left);
    //push bottom
    int bottom = Math.Abs(tileRect.Bottom - player.CollisionBox.Top);

    if (left < top && left < right && left < bottom)
    {
        player.Velocity.X = 0;
        player.Sprite.Position.X -= left;
    }
    else if (right < top && right < left && right < bottom)
    {
        player.Velocity.X = 0;
        player.Sprite.Position.X += right;
    }
    else if (top < left && top < right && top < bottom)
    {
        player.Velocity.Y = 0;
        player.Sprite.Position.Y -= top;
    }
    else if (bottom < left && bottom < right && bottom < top)
    {
        player.Velocity.Y = 0;
        player.Sprite.Position.Y += bottom;
    }
}

This is what the collision basically does:

Any help is appreciated, thank you!

sentences: SDL sprite animation problem I'm currently drawing my character from a single file, and my sprite class handles it taking the file path as an argument. Now, I need to add a simple animation, cycling between two frames. The problem is that I have the other animation frame in another file, not in the same file as the first frame. How can I handle the animation without loading and unloading the two files and without merging the files into one?

sentences:
Models with more than one mesh in JMonkeyEngine I’m a new jmonkey engine developer and I’m beginning to import models. I tried to import simple models and no problems appeared, but when I export some obj models having more than one mesh in the OgreXML format, Blender saves multiple meshes with their own materials (e.g. one mesh for face, another for body etc). Can I export all the meshes in one? I’ve tried to join all the meshes to a major one with blender (face joins body), but when I export the model and then create the Spatial in jme(loading the path of the “merged” mesh), all the meshes that are joined to the major doesn’t have their materials!

I give a more clear example:

I have an .obj model with 3 meshes and I export it. I have :

mesh1.mesh.xml , mesh2.mesh.xml , mesh3.mesh.xml
and their materials

mesh1.material, mesh2.material mesh3.material

so I import the folder in Assets/Models/Test and now I have to create something like:

Spatial head = assetManager.loadModel( [path] );
Spatial face = assetManager.loadModel( [path] )

one for each mesh and than attach them to a common node. I think there is a way to merge those mesh maintaining their materials! What do you think?
Thanks

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:
how to put elements around circle with equal distance? I know circle formula and know how to draw it. but I want put 4 points on it with equal distance from each other. how can I do that?

I work with unity.

sentences: How does pixeljunk shooter simulate its liquids? I am really impressed by the liquids in pixeljunk shooter. I would love to know how they do it.

sentences: FBX Importer - Vertex Color I imported vertex positions, indices and normals successfully in OpenGL using fbx sdk, but I just can't figure out how to import vertex colors. I tried to fetch the pointer to array of colors trough mesh layer but it returns null. Can anyone help me with this one please?

sentences:
Good resources for learning about graphics hardware I'm looking for some good learning resources for graphics hardware (and associated low level software). Basically I want to learn more about what goes on underneath the opengl/direcx API layers in terms of how things are implemented.

I familiar with what happens in principle during the various stages of the rendering pipeline (viewing, projection, clipping, rasterization etc).

My goal is to be able to make better and more informed decisions about tradeoffs and potential optimisations when graphics/shader programming with respect to the following kinds of issues;

batching
view culling
occlusions
draw order
avoiding state changes
triangles vs pointsprites
texture sampling
etc

Basically whatever the graphics programmer needs to know about modern graphics hardware in order to become more effective.

I'm not really looking for specific optimisation techniques, rather I need  more general knowledge so that I will naturally write more efficient code.

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: UE4 - Cloth collision How is collision working in UE4 Free Asset Paragon-Kallari? It seems like the body of the character and the cape is somehow colliding but I wasnt able to find any physics asset or any setting. Could someone help me with this?

sentences:
How can I compress resources into a single file in Java? Today I've finished my game, but there's a problem. There're more than 500+ images in my resources folder and I want to compress them into a single file, like other games do (for example put everything in a .pak file). I've searched on the internet, but I can't find something that tells about how to do it with Java.

There's maybe a library that I can use to avoid that problem?

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:
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:
Android native database organization I am developing an Android native game, but I have problems with Data Storage.
For a better comprehension think it like as i am developing Clash of Clans, but with Native Andorid.

Now imagine I have to store all datas for Buildings, moneys, troups, ecc in my local phone DB.

I read some guides about SQLite for Android, but i don't really like it. It picks always a Cursor object and i have to create an "Helper" class for each table so I can convert the Cursor into the object I picked.

My question is: is there a way to do it in a "easier" way but still complete as SQLite?

I learned SugarORM and it is really simple and intuitive, but it has no possibilities for ID and a lot of other limitations.

I want a library or anything else that allows you to do like windows phone c#:

SQLiteConnection conn = new SQLiteConnection(DBPath);
return conn.Query<TABLE_NAME>(SQL_QUERY);
//in this way i have a list of TABLE_NAME items without any casting or similar.

Is there a way to do it?

sentences:
Main game objects as static I'm making a game for Android using Android Studio with Libgdx in Java.
In my game there are main object like Screen, ObjectFactory, SoundPlayer, Painter (Responsible for drawing) and a few more. 'til now I passed them to each GameObject that uses them but then I realized I could just make them static and every GameObject who needs them will just call them statically.
I wonder if I make these main objects static, would it hurt the performance? Because it seems like such a comfortable solution...
Thanks in advance.

sentences:
Unity and lots of objects. Can this way of designing levels bring problems? Ok, question.

I've been fiddling for Unity for a while and now trying to make a cohesive game.

Up until now I've found the quickest way to design levels for me is to create a block of wall/floor to work as a "unit", and copy it lots of times.

The result is something like this

The blocks are basically just a transform + a sprite renderer + a box collider.

Now my question is: Can this approach bring problems given that it basically creates lots and lots of objects? If so what alternatives there are? Creating bigger blocks?

sentences:
Opengl drawing a section of a texture stretched over a quad Current Situation

I have a spritesheet loaded in for a texture when drawing the specific portions of the sheet that I'd like to have on my quads I do some simple math to get their location on the sheet and normalize it.

My texture is setup like this:

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_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

The Problem

Where I'm facing the problem is that because I'm using a "chunk" of the total texture I can't take advantage of using 1.0 for the mapping of values to glTexCoordPointer to cause the texture to stretch over the entire face.

Looked Into

I've looked for a glTexParameterf option for scaling options but I failed to find anything.

Question

Is it possible with my current methods to stretch the texture over the face of the quad without having to load a separate image for every "sprite" of the texture? Or am I just doing everything completely wrong?

Picture that hopefully sort of clarifies:

Thanks for any help.

edit
The problem was another issue all together:
Turns out it was another issue all together, I thought this didn't make sense cause it was mapping it to the vertices so it should stretch regardless and infact it does work right I was assigning the wrong the width and height values to the drawing routines calculations. And now I feel really stupid, thanks for the help Byte56. Sorry for taking up your time. The GL_CLAMP solution would be the correct answer if I hadn't made a huge fail.

sentences:
PHP Browser Game Private Messages? First off, I'm asking this question here because gaming and messaging are intimately connected.  Why win if you can't gloat?  Nevertheless, I won't be offended if this needs to be moved to overflow.

I need a PM system for my browser game, which already has a user and authentication system (To clarify: the game already has a user system).  Specifically, I'm wondering if a PHP library already exists that I can use to save some time.  Better yet, if anyone knows of a nice Codeigniter library for messaging, that would be perfect.

I already have a good idea on how I would approach this if I have to write my own, but it seems like something that would already exist in a robust form (despite my failed Google searches).

Requirements:

Messages can be sent to individuals,  multiple users, and guild mates (which is essentially just multiple users with server-side selecting who to target).
Users can reply to individual or all recipients
Messages appear in sender's outbox and receiver's inbox.
Utilizes some 2-table design to handle marking read / deleting messages on a user-by-user basis
Messages are semi-threaded.  I.e. I won't necessarily have them appear in the GUI as threaded, but previous messages should be included at the bottom of a reply.  Maybe better to say, previous messages are identifiable and accessible.  (This, I'm not yet 100% sure how I would design if I write my own.  I.E. whether to include the text of the previous message into the new message or somehow remember the previous message's database ID to link later)

Technology in Use: PHP, Codeigniter, Javascript, JQuery, Ajax, Sqlite

Note:
I have seen that there are some similar questions on overflow, but they were very little help in the answer department. Otherwise, people were looking for either chat boxes or more umm.. like social media site threads, which I find a bit different than something you would find in a game.

sentences: How can I make a power-up spawn system semi-random? Basically I'm working on a similar game to achtung die kurve (http://curvefever.com). I'm almost done with the game, however I'm not completely fine with the way power up spawning works. As for now, I have setup a timer loop runs the spawn code block every 1 second. I have setup so each spawning period for each power up (total of 11 powers) is between 19.25 - 1.925 seconds. However this is fine, but it's to random I would say. For example it can be times were no power-ups spawn at all and there can be times were 5 power-ups spawn at the same time. I have made alot of games and this problem comes up every time.

sentences:
Acceleration problems Im trying to make a car game, but i cannot get the acceleration code right. With this code:

        if(gas){
        speed += 3;
    }else if(break_ && !(speed < 6)){
        speed -= 3;
    }else if(!break_ && !gas && !(speed < 6)){
        speed -= 0.3;
    }else{
        speed = 6;
    }

it is up on 1000 within 5 secounds. I tried multiplying it with smaller numbers, but it still doesnt work(in fact it got worse). So, how can this be improved so it has reasonable parameters? Asof the maximum speed, i can implement that on my own.

sentences:
It lags when it collides. Help? :( I am trying (and believing) to make a game of pong. I have got a slightly decent working game. I haven't implemented the scoreboard or AI yet because I want the physics to work first. I am trying to reverse the direction of the ball when it hits either paddle just to make it work cleanly and am having the issue where it changes direction twice, it bounces off the paddle as expected and then goes in the opposite direction to when it hit the paddle -.- If anyone could help me, it would be much appreciated.

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

    public class BallController : MonoBehaviour {

        private float randomNumber;
        private float range;
        private float pointOfContact;
        private float paddleTop;
        private float paddleBottom;
        private float[] limits;
        private int speed;
        private int caseNumber;
        private Vector2 direction;
        private Rigidbody2D ballRigidbody;

        void Start () {
            //Getcomponent finds the rigidbody of the attached object.
            ballRigidbody = GetComponent<Rigidbody2D> ();

            speed = 5;
            caseNumber = Random.Range (0, 2);
            range = PickARange (caseNumber);
            ballDirection (speed, range);
        }

        void FixedUpdate() {

        }

        void OnCollisionEnter2D (Collision2D coll) {
            if (coll.gameObject.tag == "Player" || coll.gameObject.tag == "Computer") {
    //          pointOfContact = ballRigidbody.position.y;
    //          print (pointOfContact);

                ballRigidbody.velocity = new Vector2 (ballRigidbody.velocity.x, ballRigidbody.velocity.y * -1);
            }
        }

        void ballDirection (int ballSpeed, float yDirection) {
            randomNumber = (Random.Range (0, 100));

            if (randomNumber < 49) {
                direction = new Vector2(Random.Range (-1.0f, -0.5f), yDirection);
                ballRigidbody.velocity = (direction * ballSpeed);
            } else {
                direction = new Vector2(Random.Range (0.5f, 1.0f), yDirection);
                ballRigidbody.velocity = (direction * ballSpeed);
            }
        }

        float PickARange (int number) {
            switch (number) {
            case(0):
                range = Random.Range (0.5f, 1.0f);
                return range;
            case(1):
                range = Random.Range (-1.0f, -0.5f);
                return range;
            default:
                range = 1.0f;
                return range;
            }
        }
    }

I thought to multiply the whole velocity by -1 but that just caused a loop because of the lag. Even though that's the right way to reverse the direction. I think.

Thanks Peeps!

sentences:
Calculate initial velocity for trajectory given duration, launch angle, and distance I need my entity to go from point A to point B with a given launch angle over a given time.

I've been able to figure out the initial velocity without the constraint of the launch angle, but I can't figure out how to incorporate that into the equation.

After launch the entity is only affected by gravity, and point A and B are not necessarily at the same height.

Thanks!

sentences:
XNA Content Loading works on my machine but not others I'm using XNAWinForm series 2 from App Hub for some task that needs 3d rendering.
It works fine on my PC, but I have problems in running this code on other machines.

I installed XNA framework redistributable on that machine, I tried 32 and 64bit computers and still its not working.
Even the code on app hub is not working on other machines.

What should I do?

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:
Handling game states for Android Currently developing a game for Android. I went through a tutorial to get sprites, loop, etc. up and running, and it all works fine. The way it is currently set up is that Main creates a canvas, the canvas then runs a thread which has the while loop calling update() and display() functions in the canvas class. All of the game code and classes are essentially called from the canvas.

My question is, how do I expand this to include multiple screens/states, like menus, level selection, options, etc?

sentences:
Bejeweled-like game, managing different gem/powerup behaviors? In general, what I am asking is, given any game where a game element can look/behave/affect-other-elements one way under one set of conditions, and look/behave/affect-other-elements a different way under another, and there are many such conditions, what is the best approach to developing this flexibility into the core? (with one aim being to keep the game "fresh" by introducing variation on the game-play during the life of a game...)

Specifically,
In a Match 3 game, a valid move involves swapping a pair of adjacent tiles so that three-identical-tiles in a row are formed. The identical tiles are removed from the grid and replaced by those above them. New spaces (on top) on the grid are now filled with new tiles. This is the standard behavior. Richer Match-3 games, such as Bejweled, offer modified behavior based on the same mechanic when a player matches 4 tiles-in-row resulting in retention of the one tile that was swapped, and triggering alternative animations, sounds, scoring, etc. And yet still, 5-in-a-row, and cross-patterns, "power-up" tiles behave in very different ways and affect neighboring tiles in alternative ways as well.

ANY pointers for good practices here would be highly appreciated.

sentences:
Creating SurfaceView cause short screen blink When I create SurfaceView for first time since app launch, the app screen blinks black for small time (about 1/4 second). It blinks over UI, so its really visible and doesn't look nice at all.
I've tried to comment all of my code in surfaceCreated, but effect is same, so problem is not here. How do I remove or "hide" this screen blink?
In activity:
RelativeLayout layout = (RelativeLayout) findViewById(R.id.relative);
layout.addView(new Surface(getApplicationContext())); // causes short screen black blink

Surfaceview class:
public class Surface extends SurfaceView implements SurfaceHolder.Callback
{
        public Surface(Context context)
        {
            super(context);

            getHolder().addCallback(this);
            this.setZOrderOnTop(true);
            getHolder().setFormat(PixelFormat.TRANSPARENT);
            setFocusable(true);
        }

        @Override
        public void surfaceChanged(SurfaceHolder holder, int format, int width, int height)
        {
        }

        @Override
        public void surfaceDestroyed(SurfaceHolder holder)
        {
        }

        @Override
        public void surfaceCreated(SurfaceHolder holder)
        {
              ... stuff
        }
}

sentences:
How do I reload an object back to its original state? I have a game where a wall is destroyed. I would like to click a button to reload the wall back to its initial state. I have only managed to reload the scene, using Application.LoadLevel(Application.loadedLevel)), but it takes to long.

How do I reload an object back to its original state?

sentences: HLSL defined render states As described in this article you can define render states such as ZFunc inside of the HLSL shader. You can also set these from application code. If you set the same state (e.g. ZFunc) in both application and HLSL, which one wins and gets used? Does it always use application over HLSL?

sentences:
Graphics not being displayed on OUYA I hope its not too early to be asking OUYA dev questions, but I just got my dev kit and I want to get my game running ASAP! I am using LibGDX as my framework for my game and launching the Android backend on the OUYA. Everything seems fine except that none of my graphics are being displayed! I can only tell what's going on because of Box2D's DebugDraw showing my physics. I am using LibGdx's Spritebatch and OpenGL ES 2.0. Everything is working pefectly on my desktop and Android (phone) backends.

Am I doing something wrong with handling my resources for OUYA? What could be the problem? Could this be because I store my graphics in the assets folder instead of /res?

Edit: Here's a logcat output: http://pastebin.com/BbPyPCcR

sentences:
How to I get a rotated sprite to move left or right? Using Java/Slick 2D, I'm using the mouse to rotate a sprite on the screen and the directional keys (in this case, WASD) to move the spite. Forwards and backwards is easy, just position += cos(ang)*speed or position -= cos(ang)*speed. But how do I get the sprite to move left or right? I'm thinking it has something to do with adding 90 degrees to the angle or something. Any ideas?

Rotation code:

int mX = Mouse.getX();
        int mY = HEIGHT - Mouse.getY();
        int pX = sprite.x+sprite.image.getWidth()/2;
        int pY = sprite.y+sprite.image.getHeight()/2;
        double mAng;

        if(mX!=pX){
            mAng = Math.toDegrees(Math.atan2(mY - pY, mX - pX));
            if(mAng==0 && mX<=pX)
                mAng=180;
        }
        else{
            if(mY>pY)
                mAng=90;
            else
                mAng=270;
        }

        sprite.angle = mAng;
        sprite.image.setRotation((float) mAng);

And the movement code (delta is change in time):

Input input = gc.getInput();

                Vector2f direction = new Vector2f();
                Vector2f velocity = new Vector2f();

                direction.x = (float) Math.cos(Math.toRadians(sprite.angle));
                direction.y = (float) Math.sin(Math.toRadians(sprite.angle));
                if(direction.length()>0)
                    direction = direction.normalise(); //On a separate note, what does this line of code do?

                velocity.x = (float) (direction.x * sprite.moveSpeed);
                velocity.y = (float) (direction.y * sprite.moveSpeed);

                if(input.isKeyDown(sprite.up)){
                    sprite.x += velocity.x*delta;
                    sprite.y += velocity.y*delta;
                }if (input.isKeyDown(sprite.down)){
                    sprite.x -= velocity.x*delta;
                    sprite.y -= velocity.y*delta;
                }if (input.isKeyDown(sprite.left)){
                    //???
                }if (input.isKeyDown(sprite.right)){
                    //???
                }

sentences:
Good Configuration Manager System Design for medium-large sized projects? I've create smaller games which simply needed a class which basically opens an INI file (with feather-ini-parser library) with config values for the whole game (rendering ops, music, bindings).

But I want to go to medium-larger projects and my current configuration managing system I used earlier will be getting more complicated when my engine grows. I need a new config manager system and I tried to research but found nothing. My current config manager for 'mid-large games' is this:

The ConfigManager class interface:

    class ConfigManager
    {
    protected:
        class INIFile
        {
        protected:
            std::string id;
            ini_t ini;
        public:
            INIFile(std::string &id, Poco::Path& filename);
            ~INIFile();

            void Destroy() { delete this; }
            std::string& getId() { return id; }
            ini_t& getINI() { return ini; }
        };

        typedef std::vector<INIFile*> INIFiles;
        INIFiles files;
    public:
        ConfigManager();

        bool openConfiguration (Poco::Path& filepath, std::string& id);
        void closeConfiguration(std::string& id);

        void flushConfigsToDisk();

        void getConfiguration(Ogre::String &id, ConfigModule& mod);
        void setConfiguration(Ogre::String &id, ConfigModule& mod);
    };

ini_t is a typedef of an INI Reading/Writting library (feather-ini-parser) this class is instanced in the main Engine class (avoid Singleton use), id is the unique identifier to the file opened like "Input", "MyGameCfg", "Rendering", etc. the ConfigModule is a "section" from the INI file opened and it's structure is:

    class ConfigModule
    {
        friend class ConfigManager;

    protected:
        optValuesVector keyValues;
        Ogre::String section;
        bool is_empty;
        bool nominal;

    public:
        ConfigModule();
        ~ConfigModule();

        Ogre::String getOptionVal(Ogre::String& key);
        Ogre::String setOptionVal(Ogre::String& key, Ogre::String& val);

        bool is_empty() { return is_empty; }
        bool status() { return nominal; }

    };

ConfigModules are "wrapped C++ INI sections" and stored in specific game classes like Input, GameLogic, Rendering classes. Instead to invoking an instance of the ConfigManager every time to get an setting every time, the ConfigManager is ONLY invoked when some of the game classes needed to write configurations and re-parse the config file with the new values.

My Question is: Is this a good approach (at least I feel this system has it's flaws, probably change configuration formats from INI to Lua ) to handle multiple configurations in large games? or there is another better design I can follow?. Thanks.

sentences:
How to clamp a direction vector within a direction pyramid? In 2D you can specific an angle range such as [-45 to +45] and clamp a 2D direction vector within that angle range. I want to have something similar for 3D. I want to specify the allowed directional range as a center directional axis with a local y-axis range and a local x-axis range and clamp an arbitrary 3D directional vector within that range. How do I do that?

For example, I want to specify a angle range as axis (1,0,0) with [-30 to 30] as the local y-axis angle angle and [-10 to 10] as the local x-axis range. So that something like (0.95,0.1,0.1).normalized() would not be changed but (-1,0,0) would be clamped to an appropriate vector.

sentences:
Hit detection for partially covered object? Say you have a character standing behind cover such that some of its body parts like a shoe or a palm is still outside the cover.

An explosion takes place close to the cover . In real life this would mean the player getting damage in his arm or whichever body part was outside the cover.

How would you simulate this kind of hit detection efficiently in a game ?

An approximation would be to line trace from center of the explosion to each bone in the character mesh. But it might still not be accurate enough for larger bones , would be performance intensive and would not work for objects which are not skeletal meshes.

sentences:
How can I create a templated function to add components to their necessary containers using an ECS system? I had implemented a basic ECS system and was then informed that it should be changed as each system should not directly store their required components.

I have created a ComponentManager which will own all of the registered components, and I would like to keep all of the different components in their own containers

class ComponentManager
{

    template <typename T> T& AddComponent(Entity entity)
    {
        //...
    }

    std::vector<2DRenderComponent>  m_renderComponents;
    std::vector<TransformComponent> m_transformComponents;
};

I could create a different function for each component type but I would like to get familiar with using templates for tasks like this. It will also make it a little easier further down the line when I try to do more complex tasks.

Could anyone point me in the right direction as to how I would achieve something like this, whilst keeping the components isolated from each other?

My usage would be something like the code below

Entity entity = entityManager->CreateEntity();
TransformComponent& transformComponent = componentManager->AddComponent<TransformComponent>(entity);

When I call AddComponent with a TransformComponent, how do I add it to the correct container (m_transformComponents). If I have to change the structure slightly to get this to work, i.e a map of types to vectors that is fine. Any guidance on this is appreciated.

So after looking into the entt framework, the functionality there is what I want to achieve, on a much smaller scale. Code example of how it functions (https://github.com/skypjack/entt#code-example)

I've done some digging into how they register components through what they describe as a registry (https://github.com/skypjack/entt/blob/master/src/entt/entity/registry.hpp).

From what I can gather after looking they identify component containers by ids but I'm confused as to what it is doing so if someone could help me to understand this it would be appreciated.

First entry point when we want to add a component to a given entity

template<typename Component, typename... Args>
decltype(auto) assign(const entity_type entity, [[maybe_unused]] Args &&... args) {
    ENTT_ASSERT(valid(entity));
    return assure<Component>()->assign(*this, entity, std::forward<Args>(args)...);
}

assure() is called to obtain the correct pool for the component being added

template<typename Component>
const pool_type<Component> * assure() const {
    const auto ctype = to_integer(type<Component>());

    //....
}

type function - this returns what I can see to be an enum? But how is the function constructing and returning an enum like it does. When I try this in a separate application it fails to compile

    ENTT_OPAQUE_TYPE(component, ENTT_ID_TYPE) //enum is created from this macro, along with the to_integer function

//macro
#define ENTT_OPAQUE_TYPE(clazz, type)\
    enum class clazz: type {};\
    constexpr auto to_integer(const clazz id) ENTT_NOEXCEPT {\
        return std::underlying_type_t<clazz>(id);\
    }

template<typename Component>
static component type() ENTT_NOEXCEPT {
    return component{runtime_type<Component, component_family>()}; //how is this compiling?
}

runtime_type function - ENTT_ID_TYPE is defined as std::uint32_t

#define ENTT_ID_TYPE std::uint32_t

    template<typename Type, typename Family>
    static ENTT_ID_TYPE runtime_type() ENTT_NOEXCEPT {
        if constexpr(is_named_type_v<Type>) {
            return named_type_traits<Type>::value;
           //this looks like it returns a hashed string of the type name as std::uint32_t
        } else {
            return Family::template type<Type>;
        }
    }

sentences:
How to limit players to low-level content before they advance, if they can't die I am making a game with the basic RPG elements: levels, xp, items, currency, stats, spells and monsters. The only different thing is that the player doesn't have hitpoints, you can't die. It's a simple game where you basically just kill and farm monsters.

Now a problem I'm facing right now is "content restriction". I don't want my players to skip the low-level monsters simply because they can't die by the high-level ones. So how can I achieve this?

sentences:
Equivalent of glDrawTexfOES in OpenGL ES 2.0? I have been using the glDrawTexf extension to draw labels in my Android app using OpenGL ES 1.1.

But I have now moved to OpenGL ES 2.0 and can't figure out what is the equivalent of this call? I could create triangles to hold the texture and draw it like a regular texture. But the glDrawTexf was very convenient:

It didn't require any triangles/quads to be setup.
You could give it screen co-ordinates.
You could specify cropping parameters to pick smaller areas from a large texture.

sentences:
XNA Rotation results in a pixelated image I have a "problem" with XNA 4 and spriteBatch. When I draw a rectangle and rotate it, the sides get quite pixelated and look bad: example:

What do I need to do to make the edges look smooth?

spriteBatch.Draw(box, new Rectangle(350, 350, 100, 100), null, Color.Red,MathHelper.ToRadians(65), new Vector2(50, 50), SpriteEffects.None, 0.0F);

EDIT: Found the solution.

As Tetrad's comment suggested, one needs to activate anti-aliasing. Under XNA4.0 you can use this code

GraphicsDeviceManager graphics;
graphics.PreferMultiSampling = true;
graphics.ApplyChanges();

sentences:
Collision from the underside of a cylinder (Unity C#) A quick introduction to my problem at the moment: I am currently having trouble with checking whether or not a cylinder is grounded. I am using a mesh collider (octagonal prism) as my main collider for the object, however I can't seem to get a reliable ground detection beneath it. I have tried using a trigger and raycasting, but neither seem to work correctly.

It would be a great help if you could either provide a method of correctly raycasting the cylinders base, or an alternate method (bearing in mind the object rotates on all axis). Many thanks in advance. (terrible diagram below)

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:
How to implement a pixelated screen transition shader? I am interested in creating a screen transition seen in a lot of retro games. The transition is just a kind of pixelated distortion that increases or decreases in granularity over time.

The effect is present in Super Mario World, and can be seen recreated in this clip.

Also, here is an image depicting the transition (ignore the gradual lightening of the screen):

I want to achieve this by animating the uniforms of a GLSL shader.

Unfortunately, I don't know how to design the shader.

I know how to sample gradient textures to create various screen wipes, as well as how to sample noise textures to create simple distortion effects. But I can't figure out exactly how to create this effect.

Any advice on how to set up a shader to achieve this effect?

sentences:
How should I develop my Android game efficiently? I have attached a image of a flow chart that I made in paint.

The image shows how I want to develop my game. I want a game that runs great with smart coding that is easy to update and ad features over time. My target platform is the Android smartphone and all code will be written in java with XML inflated resources, if that matters. I am not looking for hard code,although pseudo code will help, I would more so prefer suggestions and advise from the pros.

My questions are :

Is this a good way to program a game or are there better ways to do this? Are there any modifications that need to be made? Any suggestions would be useful because I am not experienced in game programming so I would prefer the advice from someone who has written several games and knows from experience how one should go about setting their code up to run efficiently.

sentences:
Good way of handling class instances in game development? I'm a new indie game developer, and I've made a few games, but often times when coding I wonder "Is this the way most people do it? Am I doing it wrong?" because I'd like to become a game developer some day, and I really want to get rid of bad practices in time.

The way I'm doing it right now is like this:

#include <some libraries>
#include "Some classes"

    int main()
    {
      Class1 a;
      Class2 b;
      Class3 c;

      a.init();
      b.init();
      c.init();

      // game logic;
    }

Now as I see the game grow, I have more and more classes to initialize and create instances of. This is clean but I'm not sure if this is standard practice. Is this a regular way of creating instances of your game classes or is there a cleaner and more efficient way to do it?

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:
Unity3D C# Drag object smoothly on it's x axis that's already bouncing In my scene, I have a bouncing ball that collides with a cube. On each collision the ball returns to the same height. How can I get the ball to smoothly move along the x-axis by dragging my finger across the screen, while at the same time having no effect on the y or z values?

The y position is changing every frame depending on the state of the jump, so setting it's y position to transform.position.y in the Update function causes the movement to be jittery if the frame renders when it isn't caught up with the position of the ball.

Also, I set the interpolate value of the rigidbody to interpolate to get a smoother jumping motion, not sure if this is relevant to my problem or not.

Here is where I am at so far with little success. A few mobile games that replicate what I'm trying to achieve in terms of ball movement are Hop, Color Hop, and Splashy!

void Update()
{
    if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved)
    {
        // Control sliding using touch input.
        Vector2 touchDeltaPosition = Input.GetTouch(0).deltaPosition;
        transform.Translate(touchDeltaPosition.x * slidingSpeed, 0, 0);
    }
    transform.position = new Vector3 (Mathf.Clamp(transform.position.x, - xPosLimit, xPosLimit), transform.position.y, transform.position.z);
}

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:
Camera follows object and has a target object on the y-axis I have two capsule objects in a split screen shooter. At this moment, the first camera follows player one, and has the target player two. The second camera follows player two, and has the target player one.

It feels a bit strange to play, because the game has different platforms with different height. How can I only follow the target along the y-axis?

The followed object shouldn't change at all. It should only look at the target. This is what I have, so far:

using UnityEngine;
using System.Collections;

public class CameraFollow : MonoBehaviour
{
    [SerializeField]
    private float distanceAway;
    [SerializeField]
    private float distanceUp;
    [SerializeField]
    private float smooth;
    [SerializeField]
    private Transform followedObject;
    [SerializeField]
    private Transform target;
    private Vector3 toPosition;

    void LateUpdate()
    {
        toPosition = followedObject.transform.position - target.transform.position;

        GetComponent<Camera>().transform.position
            = followedObject.transform.position + toPosition.normalized *distanceAway;

        transform.LookAt(followedObject);
    }
}

sentences: Is the series of books "GPU Gems" still good for a modern OpenGL 3.0+ approach? I noticed that this series of free books from Nvidia is really popular and well know in the devs world, the problem is that is simply old; you would recommend to read those 3 books to a developer that wants to improve his skills with a programmable pipeline and is starting to do so in the 2012 ?

sentences:
Can inflation exist in a fixed price Mmorpg world? Assumptions:

Crafting materials are infinite. Limit is player boredom.
Players can only trade through the auction house. All prices are fixed. Players cannot decide arbitrary prices.
Goods in auction house stay stored for infinite duration and cannot be withdrawn by auction creator (except if he pays 100% item price + 10% auction fee).
Sell algorithm is FIFO (First item placed by any player is first item sold).
Crafting and gathering professions have a cool-down of 10 craft points per day.

Questions / Points to talk about:

All players will be happy, fair 100% prices, scam free, no need to play stock exchange market to make a profit through crafting. New Players would have the same experience even if they arrive too late to the game.
Money never loses its value, you could store money in a bank, arrive after 10 years to the game and buy everything at the same price. In contrast in WOW, a simple copper ore was worth 10 silver at the game start and now has ended as 200 silver. That's 2000% inflation.
By having fixed prices, you guarantee that even if all players in the universe have 99999999999g in their pocket, the goods are worth the same. So that's guaranteed 0% inflation. Hackers may cry all they want, but goods prices will never change.
Why didn't WOW / Diablo III used this model? They would have become billionaires with the 10% money grab technique.

Btw: my previous question on economy overflow was never answered, probably that site is dead. https://economics.stackexchange.com/questions/14609/understanding-inflation-in-a-video-game

sentences:
What should a game engine do? I'd like to improve my skills/try something new and I'd like to start with 3D. I have read Starting programming in 3D with C++ but I have question about engines:

What should engine do? I know it is abstraction layer above 3D API (i.e. OpenGL or DirectX) but what should it exactly do?

sentences:
Interactive music games I've been seeing lots of simple interactive programs popping up all over the internet that generate basic music, usually quite nice sounding, from simple interactions from the user. Otomata is one recent popular example; on the iDevices there are a variety of programs, like Bloom.

I'm just wondering how these programs work. How do they generate the music live? Are there established APIs for doing this? I'm interested in the technical aspects of how this is implemented. My knowledge is so lacking here I'm honestly not sure how to better phrase the question. Ask if anything isn't clear!

sentences: How to Simulate Height in a Tiled Top-Down Game How can I simulate height in a top-down tiled 2D game? One way I thought was to make tiles which are supposed to be higher brighter, but I was wondering if there was a standard or better implementation.

sentences:
If I were to start an Android or iPhone app or game, what program should I use? I don't really know a lot about programming and the only things I do is using codes with Gamemaker, but I have read that it is too basic and it can't be used with iPhone or Android.

Is there anything free that I can use to make games for those platforms? Or if not, any suggestions for engines or anything else? I was wondering about Unity, for example, is that a good investment to use for making games?

sentences:
How to pass depth buffer from OGRE to CUDA? I am using OGRE for rendering some objects. At every frame, I would like to pass the resulting depth buffer to CUDA for running some kernels on it and computing a result.

How can I achieve this? How do I get access to depth buffer in OGRE? How do I pass this to CUDA for processing? I do not need to write to the depth buffer in the CUDA kernels, it can be read-only.

sentences:
Odd Jumping Behavior? While testing my player's jumpinig algorithm, I've come across two odd problems.

1) My player's hard-coded jump height is always much greater (roughly 1.5 times) than the in-game result, making me enter completely abstract numbers for the hard-coded value.

2) My player's jump height increases with lower FPS. At 60 FPS, the jump height was found to be 237, and at 30 FPS it was 269.

This has me completely bumfuzzled. I've been using this article pretty heavily while implementing my jumping function which can be seen below.

Player::Player(param1, param2, int init_jumpheight, double init_jumptime, param3..)
{
  jumpheight = init_jumpheight;
  jumptime = init_jumptime;

  m_gravity = -(2 * jumpheight) / (jumptime*jumptime);
  // other stuff
}

void Player::handleJump()
{
   if(animState != JUMPRISE && animState != JUMPFALL)
   {
      animState = JUMPRISE;
      jumpspeed = 2*jumpheight/jumptime;
      jumpTimer.start();
   }
   else if(animState == JUMPRISE || animState == JUMPFALL)
   {
      jumpspeed += m_gravity*jumpTimer.get_ticks()/1000;
      int yshift = jumpspeed*jumpTimer.get_ticks()/1000;

      if(DEBUGMODE) printf("%0.2f\t%d\t%d\t%d\n",jumpspeed,yshift,jumpTimer.get_ticks(),m_coords.y);

      shifty(-yshift);
      jumpTimer.start();
      if(yshift < 0 && animState != JUMPFALL) animState = JUMPFALL;
   }
}

And here's my console log (the bit that records the details of the jump):

1258.40 20      16      1520
1219.40 18      15      1502
1180.40 17      15      1486
1146.60 14      13      1471
1107.60 16      15      1459
1068.60 16      15      1445
1034.80 13      13      1431
1001.00 13      13      1420
962.00  14      15      1409
923.00  13      15      1397
886.60  12      14      1386
852.80  11      13      1376
816.40  11      14      1367
777.40  11      15      1358
738.40  11      15      1349
704.60  9       13      1340
668.20  9       14      1333
631.80  8       14      1326
598.00  7       13      1320
559.00  8       15      1315
520.00  7       15      1309
483.60  6       14      1304
449.80  5       13      1300
410.80  6       15      1297
371.80  5       15      1293
332.80  4       15      1290
293.80  4       15      1288
257.40  3       14      1286
228.80  2       11      1285
189.80  2       15      1285
153.40  2       14      1285
117.00  1       14      1285
80.60   1       14      1286
39.00   0       16      1287
0.00    0       15      1289
-36.40  0       14      1291
-65.00  0       11      1293
-104.00 -1      15      1295
-143.00 -2      15      1298
-182.00 -2      15      1302
-218.40 -3      14      1306
-252.20 -3      13      1311
-288.60 -4      14      1316
-325.00 -4      14      1322
-361.40 -5      14      1328
-403.00 -6      16      1335
-442.00 -6      15      1343
-478.40 -6      14      1351
-517.40 -7      15      1359
-551.20 -7      13      1368
-590.20 -8      15      1377
-629.20 -9      15      1387
-665.60 -9      14      1398
-694.20 -7      11      1409
-746.20 -14     20      1418
-782.60 -10     14      1434
-821.60 -12     15      1446
-860.60 -12     15      1460
-899.60 -13     15      1474
-938.60 -14     15      1489
-980.20 -15     16      1505

sentences:
Algorithm for a dense crowd of people who avoid the player? I want to make a game like this. When player moves other humans will move too. And other humans will push people around. Are there any algorithm for this ? How can i solve this very efficient way ?

I dont want to check all objects at scene with loop. And i dont want people overlap.

Video:

https://youtu.be/V5ZMicq05LQ

sentences:
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: TMP Square Characters when adding Chinese I'm trying to implement Chinese language in my app. But I'm seeing nothing but squares. I've tried to create from file and hex. They can't be added. For example, there are 3000 letters but only 17 are included.

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:
OpenGL ES texture rendered not as expected with disproportional aspect ratio triangles I cannot seem to understand how texture coordinates work.
I try to render a texture into two triangles and this is what I get

Where the expected output is a normal continuous image as you can imagine.

Triangles coordinates (where w = 1080, h = 1920):

0, 0, w, 0, 0, h,
w, 0, 0, h, w, h

Texture coordinates

0, 1, 1, 1, 0, 0,
1, 1, 1, 0, 0, 0

Texture parameters

gl.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE, GL10.GL_REPLACE);

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_CLAMP_TO_EDGE);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE);

sentences:
Clamping after forcing aspect ratio I'm using the following script to force aspect ratio of 16:9:

https://forum.unity.com/threads/force-camera-aspect-ratio-16-9-in-viewport.385541/

It works perfectly. However now my game objects are allowed to move off the edges. The camera of the game is fixed, and never needs to move or scale.

I have changed my code to WorldToViewportPoint for this but half my of character still goes off the edge.

void Update()
 {
     Vector3 pos = cam.WorldToViewportPoint(transform.position);
     pos.x = Mathf.Clamp01(pos.x);
     transform.position = Camera.main.ViewportToWorldPoint(pos);
 }
 private void FixedUpdate()
 {
     Vector3 pos = cam.ScreenToWorldPoint(Input.mousePosition);
     if (pos.x - transform.position.x > 0.5f)
     {
         transform.eulerAngles = new Vector2(0, 180);
         animateOgre(true);
         Vector2 move = new Vector2(1, 0);
         rb.MovePosition((Vector2)transform.position + (move * speed * Time.deltaTime));
     }
     else if (pos.x - transform.position.x < -0.5f)
     {
         transform.eulerAngles = new Vector2(0, 0);
         animateOgre(true);
         Vector2 move = new Vector2(-1, 0);
         rb.MovePosition((Vector2)transform.position + (move * speed * Time.deltaTime));
     }
     else
     {
         animateOgre(false);
     }
 }

My questions are:

How do I allow the whole character to stay within the Viewport?
How can I clamp within the fixed update method rather than making a
seperate update method.
Is there anyway to prevent character from moving when the mouse is
aligned up with the position of the character. Right now I'm using a
hacky solution to find if the x difference is > 0.5. (If i don't do
this the character just moves back and forth when mouse stops)

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:
Smallest increment for a SpriteBatch depth between 0.0 and 1.0? I experienced some problems with SpriteBatch in XNA when I tried to mix two different SpriteSort modes. (Begin with deferred, end, begin with BackToFront wasn't sorting properly.) I've settled on just giving everything I draw with SpriteBatch a depth value.

To that end, what is the smallest increment I can use on the floating point variable that will be used as the depth parameter without running into rounding problems? The valid values for this float are between 0.0 and 1.0. It is a float, not a double, and the language is C#.

UPDATE:
My testing has shown that 0.008f is the smallest amount I can change my depth value by and be certain the sorting will work. I'm guessing there is something else at play in BasicEffect or SpriteBatch.

What I am trying to use this for is the rendering of my game's map grid. I want to make heavy use of transparency and overlapping to create a specific visual look for the tiles, the doodads, and the characters.

Essentially, I am using a painter's algorithm to draw the tiles in order from the back row to the front. I have them numbered so I know the ordering is correct. The doodads I am trying to draw on top of the map are not appearing when my depth decrementor is set to a low enough number to draw everything I will need. It only works properly in a range where I can only access about 100 unique depths.

UPDATE about SpriteSortMode problems (as requested):

Thus far in my project I have got by just fine using SpriteSortMode.Deferred for everything. I have all of the standard UI components you would expect, windowing, clipping, etc. working.

Now I am attempting to draw my map grid. Like windowing/clipping this requires things to be done in a specific order to look right. The grid tiles draw in a certain order. To accommodate overlapping, doodads/characters draw on top of a tile before the next tile is drawn.

No matter what I did, my doodads/characters would always be drawn under the tiles. Changing the order of draws had no impact. Even drawing all of the tiles and then drawing the doodads resulted in them showing up underneath the tiles. Especially odd was that my UI elements continued to appear above the problem tiles as I scrolled around the map.

I switched to SpriteSortMode.BackToFront and with a high enough depth difference (~0.01) I see things drawing on the grid as expected, but this depth difference is way too high to support every visible tile of the map. I am searching for a better solution than to write code that will End and Begin a new SpriteBatch every time ~100 pieces are drawn.

sentences:
Model texturing not seamless at certain zooms? (C# XNA) I found a very odd glitch with my game this morning. XNA doesn't render certain textured models properly, while other models are completely unaffected. And it's not even like my models are made incorrectly - even one of my spheres doesn't render properly at certain zoom levels. Agh, it's hard to explain, here's a picture:

The arrow on the left is in blender. The right two pictures are from within my game. At first, I thought that this was some sort of bleeding / collision issue of the arrow and the space-y background. But when I removed the background, the issue was still there.

So what are all those weird pink dots and seams? This is what my texture looks like:

Oddly enough, all of the other models in my game render correctly, except for the space sphere you see behind the arrow. (It only looks incorrect at other zoom levels, although no pink dots, just more black seams)

So I tried to find a similarity between the two malfunctioning objects, the arrow and the sphere. It occurred to me that they were the only objects whose textures did not cover the entire model, but instead were tiled. So like the UV unwrapping was not totally contained in the texture... here's a picture of what the UV looks like in blender:

Based off of this, I concluded that somehow XNA is not tiling the texture properly when it maps it to the objects. Since blender renders the model correctly and XNA doesn't, I'm assuming the problem is with XNA. (although correct me if I'm wrong)

So finally, my question is: I'm totally lost - does anybody know how to fix this?

Thanks!

EDIT: As requested in comments, here is my drawing code. It's nothing special, just your basic model draw code.

class OrderedDrawModel
{
    Model M;
    Matrix Transform;
    float Transparency;
    Vector3 Ambience;
    public float Distance;
    float Reflect;
    public OrderedDrawModel(Model M, float Transparency, Vector3 Ambience, Matrix Transform, float Distance, float Reflectivity)
    {
        this.M = M;
        this.Transparency = Transparency;
        this.Ambience = Ambience;
        this.Distance = Distance;
        this.Transform = Transform;
        Reflect = Reflectivity;
    }
    public void Draw(GraphicsDeviceManager graphics, Camera_Edit C)
    {
        Matrix[] T = new Matrix[M.Bones.Count];
        M.CopyAbsoluteBoneTransformsTo(T);
        foreach (ModelMesh mesh in M.Meshes)
        {
            foreach (BasicEffect basicEffect in mesh.Effects)
            {
                basicEffect.World = T[mesh.ParentBone.Index] * Transform;
                basicEffect.View = C.view;
                basicEffect.Projection = C.projection;
                basicEffect.LightingEnabled = true;

                basicEffect.AmbientLightColor = Ambience;
                basicEffect.DirectionalLight0.DiffuseColor = Color.White.ToVector3();
                basicEffect.DirectionalLight0.Direction = Vector3.Normalize(new Vector3(-3, -3, 1));
                basicEffect.DirectionalLight0.SpecularColor = new Vector3(Reflect, Reflect, Reflect);

                graphics.GraphicsDevice.BlendState = BlendState.AlphaBlend;
                basicEffect.Alpha = Transparency;
            }
            mesh.Draw();
        }
    }
}

I create the object with this line:

DrawModel(Arrow, 1.0f, Matrix.CreateScale(5f), new Vector3(0, 0, 0), 0.4f);
        //Model  alpha transform_matrix        ambience            specular

Which adds it to a list of back-to-front ordered models that get drawn by calling their draw method.

sentences:
How do I rotate the Camera around the player by Keypress in Unity? I want to rotate the camera around the player by pressing E and Q but it doesnt rotates around the player. I tried RotateAround but didnt worked.

Code:

public Transform player;
public float smoothSpeed = 0.125f;
public float rotateSpeed;
public Vector3 offset;
private Vector3 velocity = Vector3.zero;

void LateUpdate ()
{
    transform.position = Vector3.SmoothDamp(transform.position, player.position + offset, ref velocity, smoothSpeed * Time.deltaTime);
}

void Update()
{
    if(Input.GetKey (KeyCode.E))
    {
        transform.RotateAround(player.position, Vector3.up, rotateSpeed * Time.deltaTime);
    }

    if(Input.GetKey (KeyCode.Q))
    {
        transform.RotateAround(player.position, -Vector3.up, rotateSpeed * Time.deltaTime);
    }
}

}

sentences:
Unity 2018.3.0f2 Blank Errors I am getting these blank errors in unity for quite a while now, as soon as I create a new Project 2D or 3D I am presented with the following and can't enter in play mode.

And as a workaround I have to change the Scripting Runtime Version to 3.5 in the project settings to make it work.

I cannot able to work with version 4.x

I have the Window 7, .NET Framework 4.7.2 Installed, any help or advice is much appreciated.

Thank you.

sentences:
Accessing DualShock 4 motion sensor in Windows I am attempting to access the accelerometer and gyroscope functionality of the dualshock 4 controller for implementation into Unity.

DMGregory seems to have found a solution to this problem, my question is how he succeeded in getting the motion input working here.

He mentions that he reached his solution by grabbing the DS4Tool source and copying parts of the files: NativeMethods, HidDevices and HidDevice

I understand a lot of what is happening here, I just do not have the coding chops to get it working. I believe I should be "using NativeMethods" but do not fully understand how to access the read report to retrieve the necessary data.

Any help is greatly appreciated!

sentences:
2D physics performance on iPhone/Android using Unity 3D? I've been looking into making 2D games with Unity. One thing which concerns me is the performance of the physics engine. Since Unity is a 3D game engine I'm going to have to assume it uses a 3D physics engine. Obviously I can turn this 3D engine into a 2D one by locking off various axis such that objects only move physically in 2D space.

However this worries me, for example Box2D being a specialized 2D physics engine is optimized for 2D. Would the physics in Unity3D be fast enough to say, duplicate the sorts of physics we see in games like Angry Birds on a handheld device?

sentences:
Isometric drawing "Not Tile Stuff" on isometric map? So I got my isometric renderer working, it can draw diamond or jagged maps...Then I want to move on...How do I draw characters/objects on it in a optimal way?

What Im doing now, as one can imagine, is traversing my grid(map) and drawing the tiles in a order so alpha blending works correctly.

So, anything I draw in this map must be drawed at the same time the map is being drawn, with sucks a lot, screws your very modular map drawer, because now everything on the game (but the HUD) must be included on the drawer..

I was thinking whats the best approach to do this, comparing the position of all objects(not tile stuff) on the grid against the current tile being draw seems stupid, would it be better to add an id ON the grid(map)? this also seems terrible, because objects can move freely, not per tile steps (it can occupies 2 tiles if its between them, etc.)

Dont know if matters, but my grid is 3D, so its not a plane with objects poping out, its a bunch of pilled cubes.

sentences:
Why do games ask for screen resolution instead of automatically fitting the window size? It seems to me that it would be more logical, reusable and user-friendly to implement flexible, responsive UI layout over a 3d or 2d screen, which can then be run on any screen resolution.

Some modern games auto-detect screen resolution and adjust the game to that, but the option to change the resolution still remains in the settings.

Why is this option there?

My guess is that this is one way to provide older machines with a way to improve performance by rendering less graphics and just stretching them across the screen, but surely there are better ways of improving performance (choosing different texture and model qualities, for example).

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:
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:
Why is this orthographic projection matrix not showing my textured quad? I've been following tutorials, mainly this one, and I am still not quite sure why my textured quad is not showing inside the frustum that I've rendered before. I can see it if and only if I don't multiply gl_Position with OrthoProjMatrix * vertexmodelspace, and instead, multiply gl_position with vertexmodelspace.

Here is some of my code; my Main.CPP is also available via PasteBin.

Orthographic Projection Matrix Setup Code:

void OpenGL_Engine::OrthoProjectionSetup(GLuint program)
{
    GLfloat Right = 100.0;
    GLfloat Left = 50.0;
    GLfloat Top = 100.0;
    GLfloat Bottom = 50.0;
    GLfloat zFar = 1.0;
    GLfloat zNear = -1.0;

    GLfloat LeftAndRight = 2.0f / (Right - Left);
    GLfloat TopAndBottom = 2.0f / (Top - Bottom);
    GLfloat ZFarAndZNear = - 2.0f / (zFar - zNear);

    GLfloat orthographicprojmatrix[] = {
    //XX XY XZ XW
    LeftAndRight,
    0.0, 0.0,
    - (Right + Left) / (Right - Left),

    //YX YY YZ YW
    0.0,
    TopAndBottom,
    0.0 ,
    - (Top + Bottom) / (Top - Bottom),

    //ZX ZY ZZ ZW
    0.0,
    0.0 ,
    ZFarAndZNear,

    //WX WY WZ WW
    - (zFar + zNear ) / (zFar - zNear),
    0.0,
    1.0
    };

    GLint orthographicmatrixloc = glGetUniformLocation(program, "OrthoProjMatrix");
    glUniformMatrix4fv(orthographicmatrixloc, 1, GL_TRUE,
        &orthographicprojmatrix[0]);
}

Vertex Shader Code :

#version 330 core

layout(location = 0) in vec4 vertexposition_modelspace;
layout(location = 1) in vec2 vertexUV;
out vec2 UV;
uniform mat4 OrthoProjMatrix;

void main()
{
    gl_Position =  OrthoProjMatrix * vertexposition_modelspace;
    UV = vertexUV;
}

I'm having problems with the orthographic projection matrix; either it is not being done correctly, not setup correctly, my shader is not setup correctly or it's the textured quad that is not in view. Please note that I do not want to use a library for this. What am I doing wrong?

sentences:
Converting shader to ShaderGraph Is there a way to convert the below piece of shader code to shader graph?
I am not sure how to find float2(i, i) in shader graph.
fixed4 frag (v2f input) : SV_Target
            {
                float2 res = _MainTex_TexelSize.xy;
                float i = _offset;

                fixed4 col;
                col.rgb = tex2D( _MainTex, input.uv ).rgb;
                col.rgb += tex2D( _MainTex, input.uv + float2( i, i ) * res ).rgb;
                col.rgb += tex2D( _MainTex, input.uv + float2( i, -i ) * res ).rgb;
                col.rgb += tex2D( _MainTex, input.uv + float2( -i, i ) * res ).rgb;
                col.rgb += tex2D( _MainTex, input.uv + float2( -i, -i ) * res ).rgb;
                col.rgb /= 5.0f;

                return col;
            }

sentences:
First Person Shooter vertical mouse aim I've just started writing a 3D First Person Shooter in Java, and I'm having a bit of trouble with tracking the mouse movements and moving the camera accordingly. I'm implementing typical FPS movement, in that the mouse stays at the center of the screen.

Moving the mouse left and right (horizontal movement) is fine - each time the mouse is moved, I get it's position on the screen. I then use atan2 to get the angle I need to rotate around the y axis to get to this position, and apply the rotation accordingly.

My problem is when I try to change the pitch of the view (i.e. rotating around the x axis - essentially looking up and down). I can get the y coordinate of the mouse, and the y coordinate of the center of the screen, but how do I calculate how much I need to rotate around the x axis to get to that point?

Thanks in advance!

sentences:
Why does the player grab the object outside the trigger zone? I want the player to be able to grab an object (in this case the knife) when he is in the object's trigger zone. He can get the knife but there is a problem: if I press grab button outside of the trigger zone, then he can get the knife immediately after entering the zone. I want Unity to get the input only when the player is in the trigger, otherwise it should not be working.
Here's the grab script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Grab : MonoBehaviour
{
    public GameObject player;
    private bool grabbed;
    public GameObject knifePosition;
    private bool isInTrigger;

    void Update()
    {
        if (Input.GetButtonDown("Grab"))
        {
            grabbed = true;

        } else
        {
            grabbed = false;
        }

       if (grabbed && isInTrigger)
        {
            gameObject.transform.position = knifePosition.transform.position;
       }
    }

    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject == player && grabbed)
        {
            gameObject.transform.SetParent(player.transform);
            isInTrigger = true;
            Debug.Log("Picked up");
        }
    }
}

sentences:
How to generate AABB, OBB & Sphere from polygon soup How can I generate AABB, OOBB and Sphere from a polygon soup, where the bounding volumes are defined as follows:

AABB should be specified by min(x,y,z) max(x,y,z)
OOBB should be specified by min(x,y,z) max(x,y,z) and a quaternion for rotation
Sphere is specified as position(x,y,z) and radius

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:
Pseudo-magnet implementation with chipmunk How should I go about implementing "natural" magnet on a certain body in chipmunk space? Context is of simple bodies lying in the space (think chessboard). When one of the figures is activated as a magnet - others should start moving towards it.

Currently I'm applying force (cpBodyApplyForce)to the other figures with vector calculated towards the activated figure. However this doesn't really feel "natural". Are there any known algorithms for imitating magnets?

sentences:
ClickListener getTapCount() returns 0 I want to detect the double tap on a Container. If it is detected, then i have to remove the Actor associated with it.

This is my first attempt:

addListener(new ClickListener() {
    if(getTapCount() == 2) {
        System.out.println("double click detected");
    }
    return true;
});

It does not work. The method getTapCount() returns always 0.

sentences:
Expected numbers for user engagement I run a free-to-play online game that involves collecting creatures and simply clicking on a button to give them a small amount of EXP. The idea is to do this for other people and they're likely to return the favour and help you make your own progress.

The initial tutorial guides you through the basic idea until you've successfully obtained a full Party of 6 before leaving you to your own devices, to make your own objectives and stuff.

I've noticed that players who make it through the tutorial tend to stay quite engaged with the game, but I also found these numbers:

25% of users join but never complete the first step of the tutorial, that is they never hatch their very first Egg.
A further 25% of users drop out of the game before finishing the tutorial, so having hatched only 1-5 Eggs.
Barely 50% of registered users actually complete the tutorial.

The problem is that I've never run this kind of game before. This is my first real project, but it's been going for several years now. I don't have any kind of baseline on what numbers to expect.

I can only imagine reasons right now, such as it being quite jarring to people that, in order to make progress, they have to help others make their progress and hope they return the favour.

So we have about half our users leaving before the tutorial is complete. Is this kind of thing normal? Am I worrying too much about this?

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:
What harm would be done if a user were able to play the client side of a multiplayer game without logging in? I am currently developing a multiplayer game for a university project. The purpose of the assignment is to learn about the use of a cluster architecture, but I have a question concerning security.

The multiplayer role-playing game that I'm developing for class utilizes a client-server architecture. The client holds all of the game assets and a 2D game engine. The server provides authentication to log into a user account, provides access to characters and their progression, etc. The server also provides the positions of non-player characters and other players on the same server, and also provides their actions and movements.

My question is whether a tech savvy user that modified the source code of the client could "play the game" without authenticating, forcing a kind of single player version of my game? I am imagining a user sending the client his/her own custom information about where to spawn enemies and whatnot. Maybe he/she would simply want to move around the game world freely.

1) Does this scenario seem possible?

2) Most importantly, what harm could this cause to a multiplayer game? Perhaps I have content that I don't want someone to be able to access without properly purchasing the game, or if they have been banned for some reason.

3) If this is a problem I should try to mitigate, how could I go about preventing this kind of thing from happening?

sentences:
Photon2 billboards take a long time to face the camera I'm using PUN2 and trying to use nametag billboards for my players, but they are not facing forward correctly and I have to wait more than 20 seconds to make the name tag of player return to facing forward.
here's my code for my BillBoard Script:
public class BillBoard : MonoBehaviour
{
    protected Transform ThisCameraPlayerBillBoard ;

    private void Start()
    {
        ThisCameraPlayerBillBoard = GameSetup.GS.ThisCameraToBillBoard.GetComponent<Camera>().transform;

    }

    private void FixedUpdate()
    {
        transform.LookAt(transform.position + ThisCameraPlayerBillBoard .rotation * Vector3.forward,
            ThisCameraPlayerBillBoard .rotation * Vector3.up);

    }
}

sentences: Infinite time of rotation I want the rotation of the sprite. So that I used RotationModifier, but in that I have to specify the time interval you want the rotation. But I want to create rotation which was infinite. So please help me.

sentences:
added a pipeline and now my terrain is pink...how do I fix it? I needed to add a pipeline to my world because an asset required it.  I was following the directions here.

Since adding the pipeline, my terrain is pink.

I found a references that stated the pipelines do not support terrain, there are problems with more than 4 textures (I have 1) etc...but this was a year ago.

Is this fixable or am I at choice between no pipeline or buying pipeline enabled terrain (and hence redoing all of my scenes)?

What is the solution?
Thnx
Matt

sentences:
Do you really have to sync Physics over the network? Let's say you want to create a 2D game where a character can shoot a bullet. You have the same code running on the Client and Server (JavaScript so it's exactly the same code).

If the client and the server create the same bullet instance at the same tick X, with the same position, direction and velocity, is it safe to assume that the bullet will end on the same place on both the server and the client? Does the server need to send back the exact position at which the bullet collided, or can the client just predict that as it uses the same physics and same bullet initial data.

Can the bullet hit the target on a different tick, or at a different position on the server from the client? My initial thought is that this shouldn't happen, but could this happen because of a different CPU architecture or a different JavaScript engine?

sentences:
How are simple smoke trails for rockets made? I'm trying to make a simplistic 2d shmup, simple enough to be implemented with a widget toolkit (like Qt, for example), without requiring a game engine.

Everything fits except for the smoke trails for rockets. For me, a simplistic trail without billowing smoke effects would be sufficient. Basically just a long, curved line, which will begin to slowly and smoothly fade out after a while, starting from its rear end.

They are supposed to cross most of the screen, and they can go diagonally or in a curved path. Therefore, each one having its own image in its own transparent layer would be horribly inefficient, as there should be dozens of missiles moving at the same time on the screen.

I thought of using a particle system, but it would just take too many particles to do it nicely.

My current approach is to have one big image covering the entire screen with one matrix of the same size, the cells of the matrix representing a time-to-live for its respective pixel. For example, when a missile passes over a pixel, the pixel lights up, its time-to-live is set to 255, it ticks down every frame, and if it's below 100, the brightness of the pixel will be reduced in proportion. This allows for multiple missiles at the same time, and needs only one image layer.

However, still every pixel of the screen has to be recalculated at every frame, with time wasted on lots of places where there is nothing to be done, as the total area of the smoke trails is very small in relation to the total screen area.

Are there any better methods than the one I sketched? There have been games over 20 or 30 years ago which could do this very nicely, on very primitive computers.

sentences:
Streaming player voice (client -> server) without (minimal) noticeable voice breaking I recently started to jump into voice streaming for my RPG game, for players to communicate by a central server point. I use TCP packets to communication from client->server and from server->client(s).

What I currently do is streaming the microphone from the client (push-to-talk), send the voice data in 4096 bytes chunks, and send them to the client. However, since TCP packets take some time to send and process, as well as standard latency issues, the server forwards the packets to other clients with a certain delay (sometimes up to half a second).

How should I compensate for this delay? (What technique do you recommend?)

sentences:
Unity: Smooth collision I'm making a topdown 2D RPG in Unity.
All moveable objects have Rigidbody2D-components with gravity set to 0, linear drag set to 5 and different masses.
Walls are stationary boxes with BoxCollider2Ds.

Here's my problem:
http://a.pomf.se/nifmcn.webm
The rock is not particularly easy to see, but if you watch when I'm trying to walk into a wall, the player kind of jags in and out of the wall.

Of course, this is because I'm moving the player by moving it's Rigidbody2D, for example:

rigidbody2D.transform.position += Vector3.up*Time.deltaTime*speed;

The box then throws the player in the opposite direction of what he was going.

What's a good way of stopping a player from moving in the direction he's trying to go?
More specifically, how do you detect which way he's going? Do you find the angle between the player and the object/wall?

This is kind of an open question, but I think it's extremely important.

sentences:
How do videogames store information offscreen? I'm trying to make a videogame from scratch, but I'm really new to this and keep running into basic issues. Most importantly, how do videogames store offscreen information? What I mean is, how does the program know what to display next onto the screen? Or even, if the player changes the environment, how does this change remain for the next time it loads onto the screen?

For example, in New Super Mario Bros, if you hit a ? block and then go off screen, and come back, it still remains hit. How is this information kept and then executed the next time the player loads the block? Why doesn't it just reset?

sentences:
Unity3D - How to create flat map render based on endless noise data The Project

I'm working actually on a Endless Map Generator (with chunks, height-map noise, threading system, etc..)
This is actually what "dev data display" look like:

The Goal

Now I want to create another flat rendering (for example the mini-map) with simple Sprite (I have some Photoshop Brush, or other images).

Example (from internet):

Questions

This post isn't really about seed data recovery but more How do I transform that data into nice map ?

Do I have to keep doing 3D or replace by a 2D Canvas ?
Do Texture is good for the job ? Or it will be easier to instantiate multiple sprite ? (Or maybe a shader ?)
I have a special question for Shapes (like actually water). I didn't found anything who can help me to transform a list of dots (like all coords next to the ground) into a smooth shape who can be used on shader or other display.

A already try to use plane (instead of generated mesh) and apply the texture with a Level Of Detail system to smooth the closest part of the map. But it's still very ulgy.

sentences:
Render moveable entities into 3D isometric world? I have a separate list of moveable entities, and then the regular 3D map, represented by a 2D array of stacks of tiles. My problem is that right now, I'm rendering my moveable entities after the map, and so they end up in the right place, but rendering over everything. If I were to render my entity list at the right place, however, in the map rendering process, it would be very slow because I'd have to iterate over the moveable entity list to find one with the correct (x, y) coordinates each tile that's rendered. Here's what my world looks like:

Here is a screenshot of a particularly awkward example of this issue. The colonists are positioned (or seem to be) on the right tiles, but they draw in front of trees and hills they are actually behind.

Here's my current moveable entity drawing code:

Apologies for using a screenshot, but I can't paste into this text box for some reason. Anyway, my map drawing code is just a nested for loop over the map, pretty much. How do I merge these two? My drawing library doesn't have a Z-axis function.

sentences:
What are these rendering artifacts and how can I fix them? Here is the artifact:

Here is some clarifying information:

This appears only at 480 units from the origin, and seems to get worse (to a point) as I move away.
All water should have sand rendered behind it, but the sand should be occluded (since I will eventually be rendering the water semi-transparently).

Here is my guess:

This looks like z-fighting, but my issue with this hypothesis is that none of these polygons are co-planar.

sentences:
How do I control which calculations are done on the CPU and which are done on the GPU? My current understanding is that anything done in a shader file is done on the GPU, and anything done in my (Java, in my case) code is done on the CPU.

Is this an accurate description?

sentences:
convert gl_Position into screen coordinates Pretty simple question I think. I need to convert model space coordinates into screen space coordinates for a special shader effect.
I am of course able to just convert them into gl_Position coordinates by just multplyng them with the wold view and projection matrices.
Unfortunately though, thats where I am at my wits end. Since opengl somehow converts normal vertices them into screen coordinates itself, and I need a few extra vertices for a special effect, I have no idea how to achieve this.
So does anybody have any idea how I convert model space coordinates into gl_Fragcoord screen coordinates?
I basicly want to be able to give the vertex shader a bunch of model space coordinates and have it spit out where exactly they are on the screen if they were rendered.

sentences:
How to do 1.5x scaling for pixel art where only one dimension has to scale? I'm working on a point and click adventure game where the top third of the screen is a 16:3 single piece background with sprites on top. The width has to be edge to edge. It can't be cropped because the screen doesn't move.

The bottom of the screen will be one where you can interact with objects. Think Papers, Please. It can be any dimension, it can be 16:6 for 16:9 screens and 16:9 for 4:3(16:12). The objects on the bottom screen can be scaled imperfectly so say a notebook that is 64x64 on 720p can be 2x scaled to 128x128 on 1080p. It will only be compared to other 2x scaled objects so it won't look out of place.

Shades of green indicate areas where light green can be stretched to fill, orange indicates the area that I don't know what to do with. Black can't be scaled 2x because it wouldn't fit and it can't be cropped.

Am I still forced to make 2 different sets of art if I want it to look right?

sentences:
How to expose game data in the game without a singelton? I'm quite new to cocos2d and games programming, and am currently I am writing a game that is currently in Prototype stage. Everything is going okay, but I've realized a potentially big problem and I am not sure how to solve it.

I am using a singelton to store a bunch of arrays for everything, a global list of planets, a global list of troops, a global list of products, etc.  And only now I'm realizing that all of this will be in memory and this is the wrong way to do it.

I am not storing files or anything on the disk just yet, with exception to a save/load state, which is a capture of everything.

My game makes use of a map which allows you to select a planet, then it will give you a breakdown of that planets troops and resources,

Lets use this scenario:

My game has 20 planets. On which you can have 20 troops.

Straight away that's an array of 400!

This does not add the NPC, which is another 10.

So, 20x10 = 200

So, now we have 600 all in arrays inside a Singelton.

This is obviously very bad, and very wrong.  Especially as the game scales in the amount of data.

But I need to expose pretty much everything, especially on the map page, and I am not sure how else to do it.

I've been told that I can use a controller for the map page which has the information I need for each planet, and other controllers for other items I require global display for.

I've also thought about storing each planet's data in a save file, using initWithCoder however there could be a boatload of files on the user's device?

I really don't want to use a database, mainly because I would need to translate NSObjects and non-NSObjects like CGRects and CGPoints and Colors into/from SQL.

I am open to other ideas on how to store and read game data to prevent using a singelton to store everything, everywhere.

Thanks for your time.

sentences: Why do games run so much better in Windows than in OSX? For example, on my Mac Mini with Bootcamp, Team Fortress 2 runs at about 20fps in OSX and 80fps in Windows. This seems to be a common case. Why is this?

sentences:
What technique would I use to animate a 2D curling tentacle? I have played around in Cocos2D-X and I think I understand the limitations of sprite-based animation fairly well.

I want to have a game with some characters curling and extending a tentacle which varies in length and amount of curl depending on the terrain.

Maybe imagine a sloth swinging from a tree but with arms that stretch at times (Gumby character?).

Is there a name for such a technique?

Would this be a variant on Animating Bezier Curves as seen in Jason Davies's example or discussed in this blog on tweening control points?

I'm a very experienced polyglot programmer but relatively naive in games and graphics.

sentences:
Weird stuttering with fixed-timestep, variable-framerate game loop I've been trying to set up fixed-timestep loop for my game, using the technique from here. I have no need for the interpolation step as I intend to run the logic at or above vsync speed.

Here is a simplified version of my test code (C#):

const double MILLISECONDS = 1000.0;
const double TARGET_SPEED = 60.0; //Logic tick rate in hertz

const double dt = MILLISECONDS / TARGET_SPEED;

double currentTime;
double accumulator = 0.0;
Stopwatch logicTimer = new Stopwatch();

double theta = 0;
float spinSpeed = 0.005f;

//Game loop:
while (true)
{
    double newTime = logicTimer.ElapsedMilliseconds;
    double frameTime = newTime - currentTime;

    currentTime = newTime;
    accumulator += frameTime;

    while (accumulator >= dt)
    {
        theta = (theta + spinSpeed * dt) % (Math.PI * 2.0);
        accumulator -= dt;
    }

    //Draw sprite, rotated theta radians
    Draw();
}

With TARGET_SPEED at 60Hz on a 60Hz monitor, most of the time it runs smoothly. However, often when I run the test I see periodic jumps in the rotation. The time to complete a revolution does not change, but it appears to stand still for an extra frame or two and then jump ahead to make up the difference. The frequency of these stutters is constant during a run, but subsequent runs with the same settings will stutter at different rates.

I've measured how much theta changes each logic step, and it's rock steady across multiple runs regardless of stuttering.

This leads me to believe the problem is something to do with differences between my game's clock and my monitor's refresh clock. However, I can't figure out anything beyond that.

The problem still happens whether vsync is on or off. It happens less often when TARGET_SPEED is a multiple of 60; for any other value it happens on every run. Increasing TARGET_SPEED past 1000 or 10,000 Hz appears much smoother, but there's no way I can run a real game that fast. Drawing more or fewer sprites to control the time spent rendering doesn't seem to have any consistent effect on the problem.

So basically I'm completely stumped. Any idea why this is happening and how I can fix it?

Here's the full source file for my test project (XNA) if you want to try it for yourself.

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: SVG textures for 3D game objects in Unity? Is there a way to make textures using vector graphics and use it for 3d models so that textures would be object size independent and won't get blurry?

sentences:
How to make a procedural tilemap island with more than one tile in unity? I have been working on a simple survival game. I made the character and some basic elements (I'm new to the field though).
But what I could figure out how to make is the world generation.
I just wanted to make a program that generates an island procedurally. I tried Perlin Noise before, but it wasn't that efficient. The results were too random.

In the past few days, I found a unity package that generates tilemap islands, and I really liked the results, but I didn't know how to make more tiles than just grass.

The problem is that I don't know how can I make a script like this because I am still new to unity. That's why I tried asking for some help.

I just want something that looks like this :

I would really appreciate any help!

sentences:
"Blinking" graphical bug when rotating shadow matrix So, we have implemented Krypton shadows into our code for our 2D game, and it's working beautifully. Only issue is that we're running into a bizarre graphical bug when rotating the shadows with the world on the Z axis.

As of right now, the shadows are perfect, until we get to a 45 + 90n degree (45, 135, 225, ... etc, all the "diagonal" angles). At this diagonal angle, the shadow's collapse on the X or Y axis, causing a "blink" effect. We are unsure if this is something inherent with rotating matrices (which Krypton uses) that needs to be worked around, or if this is a bug related to Krypton (and whether or not it can be worked around).

Video Example Of Bug on Youtube

You can find our draw code below. The bool "useFakeFPSPerspective" is used to display this rotating perspective, which has the graphical bug. Our normal perspective does not come across this issue, as it has a fixed angle.

protected override void Draw(GameTime gameTime) {
        //Create a world view projection matrix to use with krypton.
        var world = Matrix.Identity;
        var viewVector = new Vector3(graphics.PreferredBackBufferWidth / 2, -graphics.PreferredBackBufferHeight / 2, 0f) * -1f;
        viewVector.X = -player.LevelPosition.X;
        viewVector.Y = player.LevelPosition.Y;
        var view = Matrix.CreateTranslation(viewVector);

        Matrix? rotateZ = null, shift = null;
        if (useFakeFPSPerspective) {
            var pos = player.Size / 2f;
            viewVector.X -= pos.X;
            viewVector.Y += pos.Y;
            view = Matrix.CreateTranslation(viewVector);

            viewVector.X = pos.X;
            viewVector.Y = -pos.Y;
            shift = Matrix.CreateTranslation(viewVector);

            var mouseState = Mouse.GetState();
            rotateZ = Matrix.CreateRotationZ((float) mouseState.X / -90); //rotates on Z axis (which points "outward", instead of up/down or left/right)
        }

        var projection = Matrix.CreateOrthographic(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight, 0f, 1f);

        //Assign the matrix and pre-render the lightmap.
        //Make sure not to change the position of any lights or shadow hulls after this call, as it won't take effect till the next frame!

        var shadowMatrix = view;
        if (useFakeFPSPerspective) shadowMatrix *= (Matrix) rotateZ * (Matrix) shift;
        Krypton.Matrix = shadowMatrix * world * projection;
        Krypton.Bluriness = 3;
        Krypton.LightMapPrepare();

        GraphicsDevice.Clear(ClearColor);

        SpriteBatch.Begin();

        level.draw();

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:
How can auto-click software be detected to stop botting/cheating? I have to completely change my question, because it was far too general. I now want to focus on how I can detect one type of cheating method.

How can auto-clicking be detected? In general, I am referring to software that will simulate mouse clicks or keyboard input automatically. It seems this would be useful for botting behaviour.

Can my software see other software the user's computer is running. If so, how does the software know what the other program is doing? Will it need to check the byte code for routines that simulate mouse/keyboard input?

Would it be useful for my software to detect if the mouse is jumping across the screen in a non-human-like behaviour? That is the first thing I can think of to stop it, as it would be the simplest but also the cheater might be able to simulate mouse movement that is human-like.

I should probably mention that I am most comfortable with Python and C++, and I am currently learning the Windows API.

sentences:
Use a different target framework version in a unity c# project, other than 4.6 I'm using a dll in my project which is built against a higher target framework (4.6.1 actually)

I can't build or attach to Unity because of this. Visual Studio shows this error:

The primary reference "MQTTnet" could not be resolved because it was built against the ".NETFramework,Version=v4.6.1" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.6".

The only option in player settings in Unity for API compatibility level is .NET 4.6

how can I change that to 4.6.1 in order to be able to build or attach to Unity?

sentences:
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:
Why does OnControllerColliderHit not work while Physics.CheckSphere() does? Using the following code below, when my character hits a crate and goes over it, it ends up floating in the air, while jumping is no issue. That successfully lands on the ground.
using UnityEngine;

public class Testing: MonoBehaviour
{
    public CharacterController Controller;
    //speed of the character
    public float Speed = 12f;
    // earth gravitational value
    public float Gravity = -9.81f;
    Vector3 velocity;
    //hit point of character
    float hp = 90;

    bool Grounded = true;

    public void OnControllerColliderHit(ControllerColliderHit hit)
    {
        Grounded = true;
        hp -= velocity.magnitude;
        velocity.y = 0;
        Debug.Log(hp);
    }

    public void OnControllerColliderExit(ControllerColliderHit hit)
    {
        Grounded = false;
    }

    public void Checkstatus()
    {
        if (Grounded == false)
        {
            velocity.y += 0.5f * Gravity * Time.deltaTime;
        }
    }

    void Update()
    {
        float x = Input.GetAxis("Horizontal");
        float z = Input.GetAxis("Vertical");
        Vector3 move = transform.right * x + transform.forward * z;

        Controller.Move(move * Speed * Time.deltaTime);

        if (Input.GetKeyDown(KeyCode.Space) && velocity.y == 0)
        {
            velocity.y = 12;
            Grounded = false;
        }

        //check if it grounded
        Checkstatus();
        Controller.Move(velocity * Time.deltaTime);
    }
}

Here's an image showing the floating player:

And why does the code below (using Physics.CheckSphere()) have no issue? Feels like the above code is better (if working correctly), as it doesn't need to waste resource on checking the condition of Grounded (like in checkstate1()) every frame.
using UnityEngine;

public class NewPlayerMovement : MonoBehaviour
{
    public CharacterController Controller;
    public float Speed = 12f;
    public float Gravity = -9.81f;
    Vector3 velocity;
    public LayerMask groundmask;
    float hp = 90;

    bool Grounded = true;
    // Update is called once per frame

    void checkstate1()
    {
        Grounded = Physics.CheckSphere(this.transform.position, 0.85f,groundmask);
        if (Grounded==true)
        {
            hp -= velocity.magnitude;
            Debug.Log(hp);
            velocity.y = 0; }
     }

    public void Checkstatus()
    {
        if(Grounded==false)
        {
            velocity.y += Gravity * Time.deltaTime;
        }
    }
    void Update()
    {
        checkstate1();
        float x = Input.GetAxis("Horizontal");
        float z = Input.GetAxis("Vertical");
        Vector3 move = transform.right * x + transform.forward * z;

        Controller.Move(move * Speed * Time.deltaTime);

        if (Input.GetKeyDown(KeyCode.Space)&&Grounded==true)
        {
            velocity.y = 12;
            Grounded = false;

        }

        Checkstatus();
        Controller.Move( velocity * Time.deltaTime);

    }
}

sentences:
Are there any clever methods of regulating bandwidth usage for voice chat payload packets? For example, suppose my code can determine that upstream bandwidth is unusually limited.  And suppose I'm using a fully-connected mesh topology combined with a UDP-like protocol for voice chat.  Is there an established way to reduce the risk of packet loss so that the voice playback will either be solid or muted, but not jittery or choppy?  This must be a solved problem in the VoIP world, but I'm not sure where to look.

EDIT: To clarify my abuse of the term jitter: I mean, if two UDP voice packets arrive out of order, the audio would sound jittery in a colloquial sense (i.e. I mean packet jitter, not audio signal displacement).  The choppy sound I'm referring to is related, where a UDP packet is lost instead of arriving late and causes a gap or jump in the audio.

When I refer to muting the playback, I don't mean as a function of source input to avoid background noise.  I mean on the receiving end of the conversation, if there's high packet loss, just stop playback instead of playing choppy audio.

sentences:
Unity 2d square position not lining up with its size I want to have one square that rests at the Unity 2d coordinates (5,5). Using transform.localScale I make the square be 3 units by 3 units large. So I thought that if I made another square that is the exact same except it is at the coordinate (8,5), the second square would be directly to the right of the first one, touching it. But instead, the square spawns a bit more to the right than it should, implying that the size x,y units are smaller than the position x,y units. Any way I can solve this problem, and have both touching? Thank you.

Code for placing the squares (tileHeight = 3 and tileWidth = 3):

GrassTile.transform.localScale = new Vector3(tileWidth, tileHeight, 0f);
Instantiate (GrassTile, new Vector3 (0f, 15f, 0f), Quaternion.identity);
Instantiate (GrassTile, new Vector3 (3f, 15f, 0f), Quaternion.identity);

Screenshot of what it looks like, as well as what the prefab looks like:

Screen shot of the grassTile stats:

sentences:
Is there a way to limit the size of the D3DPOOL_MANAGED pool? I have over 2GB of textures that I need to put in D3D9's D3DPOOL_MANAGED pool.

D3D9 charges the system copy of anything in the D3DPOOL_MANAGED to my process space. I'm working on a 32-bit system so I have less than 1.7GB of available process space.

Is there a way to limit the size of the pool D3D9 stores in my process, that is to tell it to keep anything else it needs to cache on disk?

sentences:
How to render multiple objects as a single object for fluid simulation? I'm trying to do fluid simulation using particles in 2d game. I have larger particles, which interactive each other physically, those particles collide with environment (e.g wall,obstacles) to simulate fluid.

However drawing things doesn't go well. I'm trying to figure out how to render the circles without the gaps in between. I've tried blurring the circles like so:

But the gaps remain. Also, blurring the particles causes the particles dimension to change visually every frame. Meaning the physics shape and the visual shape don't match up.

How can I render these objects as one?

finally, i got some effect like this, even artefacts exists:

here is my solution, steps as following:
1.draw water or fluid with SPH.
2. blur all of it.
3. does metaball with it.

sentences:
Why a point light not cast shadow on my moving object, but only on static? In my Unity3d scene i've two light: a directional (sun, outside the window) and a point light.
In my scene, I can see shadow correctly, also if i "play" with settings like Intensity or Range.
But in Play mode, my moving player don't cast shadow when hitted by my point light, but cast shadow  correclty when hitted by directional light.

The image here is explicative: the shadow you see is from a chair, hitted by the point light.
My player instead, hasn't shadow.

What am i wrong ?

sentences:
What does it actually mean by World, Window and Viewport? I am studying Computer Graphics myself. I am stuck with the concept of World, Window and View-port.

As far as I understood:

(1) World - is an abstract and imaginary space that is imagined to exist inside the Graphics rendering software (like Blender, 3D Studio Max, and so on) or a framework/library/engine like OpenGL or Directx, or, Unreal Engine where the objects/models (to be displayed) are measured in units specific to that software or library or engine. We are generally habituated to measure pictures of all geometric objects as the units of integer/real numbers on papers or books. And, in computer monitor screens they are measured in Pixels. But, due to some problems like ________________, developers use a coordinate system imagined and implemented in their software/framework/library/ engine and that is called a World Coordinate system. For example, OpenGL uses fractional values to measure and plot an object which seems to be totally impossible, because, computer screens do not have such abilities, they only understand pixels. So what is the catch? Before displaying on the computer screen, the OpenGL's world coordinate measurements are converted to actual screen pixels (through a mechanism called Graphics Pipeline) and that is how a model or object can be displayed on the computer screen.

(2) Window - Window is the a cut-section area (that we want to display on the computer screen) of the imaginary graphics World.

(3) Viewport - Viewport is the actual image we see on the screen. That is displayed by converting the world coordinate into screen pixels.

Am I correct?

Please, fill in the blank and review my conception thus far.

And, if you do down-vote, or, closed-vote, please, leave a comment so that I can understand the reason.

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:
How to optimize classes I am currently working on a game based on SFML and written in C++. For the HUD of the game I have a HUD class with a lot of different variables and methods. Basically most of the variables have a set and get method. We are talking about 14 variables currently and I am sure this will increase.

Example excerpts:

sf::Text m_AmmoText;
sf::Text m_ScoreText;

sf::Text getAmmoText();
sf::Text getScoreText();

void setAmmoText(sf::String text);
void setScore(sf::String text);

Questions

Optimize context is performance vs. code mantainability

1. Prototyp or Inheritance?

I searched the web and found the prototype pattern or the inheritance of classes as the most useful ones to apply. Since I never use both I am quite unsure which solution will have a positive impact on the code and performance. I am aware that with these few classes the performance impact is hardly measurable. It is more for practice and to get it right from the beginning. I started to re-write the code to apply inheritance but thought it might be better to ask the experts first.

Here is an example of the classes. Implementation of methods accordingly to read or write the variable (skipped here).

class HUD{
    protected:
        sf::Text m_Text;
    public:
        getText();
        setText();
}

class HudAmmo : public Hud {};
class HudScore : public Hud {};

So instead of hud.getAmmoText() I could use hudammo.getText().
I did not code the prototyping yet. But read a lot about its pros and cons on the internet. Suprisingly I could not find a clear direction since most examples I found were abstract. I tend to apply the prototyping pattern from what I understood so far mainly because of this post:

2. Alternative

Re-write the class and have only 1 set and get method which passes the context, e.g. hiscore or other solutions?

sentences:
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:
glTranslate, how exactly does it work? I have some trouble understanding how does glTranslate work.
At first I thought it would just simply add values to axis to do the transformation.

However then I have created two objects that would load bitmaps, one has matrix set to GL_TEXTURE:

public class Background
{
    float[] vertices = new float[]
        { 0f, -1f, 0.0f,
          4f, -1f, 0.0f,
          0f, 1f, 0.0f,
          4f, 1f, 0.0f };

    ....
    private float backgroundScrolled = 0;
    public void scrollBackground(GL10 gl)
    {
        gl.glLoadIdentity();
        gl.glMatrixMode(GL10.GL_MODELVIEW);
        gl.glTranslatef(0f, 0f, 0f);
        gl.glPushMatrix();

        gl.glLoadIdentity();
        gl.glMatrixMode(GL10.GL_TEXTURE);
        gl.glTranslatef(backgroundScrolled, 0.0f, 0.0f);
        gl.glPushMatrix();

        this.draw(gl);
        gl.glPopMatrix();

        backgroundScrolled += 0.01f;
        gl.glLoadIdentity();
    }
}

and another to GL_MODELVIEW:

public class Box
{
    float[] vertices = new float[]
        { 0.5f, 0f, 0.0f,
          1f, 0f, 0.0f,
          0.5f, 0.5f, 0.0f,
          1f, 0.5f, 0.0f };

    ....

    private float boxScrolled = 0;
    public void scrollBackground(GL10 gl)
    {
        gl.glMatrixMode(GL10.GL_MODELVIEW);
        gl.glLoadIdentity();
        gl.glTranslatef(0f, 0f, 0f);
        gl.glPushMatrix();

        gl.glMatrixMode(GL10.GL_MODELVIEW);
        gl.glLoadIdentity();
        gl.glTranslatef(boxScrolled, 0.0f, 0.0f);
        gl.glPushMatrix();

        this.draw(gl);
        gl.glPopMatrix();

        boxScrolled+= 0.01f;
        gl.glLoadIdentity();
    }
}

Now they are both drawn in Renderer.OnDraw. However background moves exactly 5 times faster. If I multiply boxScrolled by 5 they will be in sinc and will move together. If I modify backgrounds vertices to be

    float[] vertices = new float[]
        { 1f, -1f, 0.0f,
          0f, -1f, 0.0f,
          1f, 1f, 0.0f,
          0f, 1f, 0.0f };

It will also be in sinc with the box.
So, what is going under glTranslate?

sentences:
Rolling my own scene graph Hello Game Development SE!

I'm crawling my way through OpenGL with the hopes of creating a simple and very lightweight game engine. I view the project as a learning experience that might make a little money in the end, but will be fun either way.

So far I've used GLFW to gain some basic I/O, a window (with a oh so fancy F11 fullscreen key) and of course an OpenGL context. I've also used GLEW to expose the rest of the OpenGL extensions because I'm using Windows and I want to use all of OpenGL 3.0+.

Which brings me to the scene graph. In short, I'd like to roll my own. This decision came after looking at OSG and reading a few articles on how the concept of a scene graph has become twisted, bent and broken. One such article described how scene graphs have developed as...

  Then we added in all this extra stuff, like hanging ornaments on a Christmas tree, except that some of the ornaments are nice juicy steaks and some are whole live cows.

Following the analogy, I'd like the steak, the meat of what a scene graph should be, without having to strap on piles of extra code, or any whole cows.

So with that in mind, I find myself wondering exactly what a scene graph should be and how a simple scene graph should be implemented? Here's what I have so far...

A one parent, n-children tree or DAG which...

Should keep track of game object transformations (position, rotation, scale)
Should hold render states for optimizations
Should provide a means of culling objects not within the view frustum

With the following properties...

All nodes should be treated as renderable (even if they don't render) This means they...

Should all have cull(), state() and draw() methods (return 0 if non-visible)
cull() recursively calls cull() on all children, thus generating a complete cull mesh for the entire node, and all children. Another method, hasChanged() could allow so-called static meshes to not need to have their culling geometry computed each frame. This would work such that if any node in the sub-tree has changed then all geometry down to root is rebuilt.

Render states will be held in a simple enumeration, each node will select from this enumeration an OpenGL state set that it requires and that state will be setup before draw() is called on that node. This allows for batching, all nodes of a given state set will be rendered together, then the next state set is setup and so on.
No node should directly hold geometry/shader/texture data, instead nodes should point to shared objects (perhaps managed by some singleton object like a resource manager).
Scene graphs should be able to reference other scene graphs (maybe using a proxy node) to allow situations like this, thus allowing complex multi-mesh models/objects to be copied around the scene graph without adding a ton of data.

I'm hoping to get some valuable feedback on my current design. Is it missing functionality? Is there a vastly better way/design pattern? Am I missing some larger concept that will be necessary to include in this design for a somewhat simple 3D game? Etc.

Thanks, -Cody

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

btVector3 rigidBodyPos;
btCollisionShape* collisionShape;

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

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

Here's a look at my getMinMaxVertexCoords():

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

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

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

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

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

Does anybody know a solution to this problem?

sentences:
Create Mesh in gap between tiles (in Unity3D) I am loading two kinds of tiles (meshes in tile format) in Unity, both are placed in the environment correctly but there is a gap between these two tiles (see the picture below).
I want to fill this gap automatically either through scripting or a shader. With scripting, there is an algorithm I thought of, but its first step is taking too much time.

Get each tile and get the outer edges of the mesh (it's taking too much time to calculate with each tile, as there are thousands of tiles)

Then raycast from the outer edges of the mesh and get intersection points of outer tiles

Take vertices and draw the mesh.

I get stuck in the first steps, as it's taking so much time to calculate the outer edges of a tile. Maybe there is a solution available in form of a shader that works in the gaps of two meshes?
Here is visual representation:

sentences:
Create a crosshair openGL How do I draw a white crosshair in the middle of screen in openGL, it's all well and good knowing how to render objects in 3d space, but I have literally no idea on how to draw something that sticks on the screen no matter what

Would this require a shader? one that does not take into account model view projection matrix? at what point would i draw the cross? after everything to coincide with the painters algorithm? Or do I give it a z value?

sentences:
How 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:
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:
Hard edges with non power of 2 images in OpenGL When down scaling 2D images in Java2D, it does a great job at preserving hard edges while downscaling to non power of 2s. However, in OpenGL, I have been unable to find a solution to this. I have tried using GL_NEAREST to get hard edges, but it also creates the wonky edges aswell. I cannot use GL_LINEAR in this case either, but still, the linear interpolation still looks wonky.

Example (Both rendering 30x30 hard image, rendering at 30x30 pixels).

Please note : I am aware that this occurs with images that aren't power of twos, like 30, but the main problem is, if I try to upscale or downscale an image that is power of two (say 16x16) to something that isn't a power of two (say 20x20), I still get this effect. This issue with scaling this occurs in Java2D, but it is by far less noticable.

My question is: What parameters will I need to use when rendering a non power of two image? So I can get a similar effect that I get in Java 2D.

I can post source code if needed.

EDIT

Original Image (30 x 30 png)

Turns out I wasn't scaling them at all! Both were being rendered at the original 30 x 30 pixels on both OpenGL and Java2D.

Sample Code:
Java2D:

 g.drawImage(heart, 0, 0, 30, 30, null);

No rendering hints are being applied, just the bare minimum.

In OpenGL

Vertex Shader:

#version 400

in vec2 position;

out vec2 textureCoords;

uniform float width;
uniform float height;
uniform float xOffset;
uniform float yOffset;
uniform mat4 transformationMatrix;

void main(void)
{

    gl_Position = transformationMatrix * vec4(position.x, position.y, 0.0, 1.0);
    gl_Position.x += (xOffset) / (width / 2);
    gl_Position.y += (yOffset) / (height / 2);
    gl_Position.y = gl_Position.y;

    textureCoords = vec2(position.x / 1, position.y / 1);
}

Fragment Shader:

#version 400

in vec2 textureCoords;

out vec4 out_Color;

uniform sampler2D texture2d;
uniform float transparency;

void main()
{
    out_Color = texture2D(texture2d, vec2(textureCoords.x, textureCoords.y));
    if(textureCoords.y > 1 || textureCoords.y < 0)
    {
        discard;
    }
}

Rendering methods:

public void makeWonkyImage()
{
    render(0, 0, 30, 30, heart);
}
public void render(float x, float y, float width, float height, int textureID)
{
    PostProcess.imageRenderer.render(x, Gfx.HEIGHT - y, width / 1000, -height / 1000, textureID);
}
public void render(float x, float y, float width, float height, int textureID)
{
        shader.start();

        prepare(textureID);
        Vector2f position = new Vector2f((-Display.WIDTH / (width * 1000f))
                , (-Display.HEIGHT / (height * 1000f)));
        Matrix4f matrix = Maths.createTransformationMatrix(position,
                new Vector2f(width / Gfx.WIDTH * 1000f, height / Gfx.HEIGHT * 1000f));
        shader.loadTransformation(matrix);
        shader.loadScreenDimensions((float) Display.getWidth(), (float) Display.getHeight());
        shader.loadOffsets(x, y);
        GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, quad.getVertexCount());
        end();
        shader.stop();
}

public void prepare(int texture)
{
        GL30.glBindVertexArray(quad.getVaoID());
        GL20.glEnableVertexAttribArray(0);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL13.glActiveTexture(GL13.GL_TEXTURE0);
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
}

sentences:
How do I find the name of the current audio clip being played? I have a title scene and a credits scene that use the same music. When I start my game the title scene music plays, and I have my game set up so the audio manager is not destroyed on load. When I enter my credits scene I do not instruct any new music to play, but each time I reload my title scene the title music restarts because a script in the scene tells it do so.

How can I get the name of the current audio track so that I will only play audio if it differs from what's currently being played?

This is my "LevelMaster" script which is responsible for handling the audio in each scene.

public class LevelMaster : MonoBehaviour
{
private AudioManager AudioManager;

[SerializeField]
private string trackName;

private void Start()
{
    AudioManager = GameObject.Find("AudioManager").GetComponent<AudioManager>();
    AudioManager.Play(trackName);
}

public void PlaySound(string soundName)
{
    AudioManager.Play(soundName);
}

public void StopSound(string soundName)
{
    AudioManager.Stop(soundName);
}

sentences:
Composite collider 2D mysteriously adds x velocity to player rigidbody As you can in the gif above there is an x velocity being set in the players rigidbody upon contact with the tilemap surface (Tilemap collider using composite). It was fine when I was using standalone colliders but now this happens.
Is this a bug or am I missing something. Help is much appreciated.
Unity ver. 2019.4.8f1

sentences:
LibGdx: How to check if VSync is enabled I am just about finished my options screen, the only thing I need is some way of detecting if Vsync is enabled or not.

I'm using LibGdx 1.5. I have tried to find an access to wglSwapIntervals, but haven't found one. Libgdxs API only allows a setVsync options that accepts a Boolean.

If anyone could shed some light on this, it would be greatly appreciated!

sentences: How to show iPad keyboard? I am developing a game, a word game. I have UIView, in this I have to show the keyboard, without using UITextField. Could you please suggest me something on how to do this?

sentences:
Any technical references for game-oriented icons and symbols? To make localizing easier, I'm using icons to show in-game information like achievements and bonuses. Coming up with good designs isn't easy, especially when it has to be integrated into the rest of the game's art style.

Can I do better than looking at some random selection of existing games?

Are there any reference books or sites that cover game graphics specifically?

I'm looking for more theory and best-practices rather than pre-made graphics.

sentences:
Applying velocity to parent that ignores children's mass not working I am making a VR data visualisation app in Unity and I have a parent with many children (just some primitive cubes) that I can toss around the scene by just setting the parent's rigidbody to the same velocity as my tracked VR controller.
Rigidbody rb = GetComponent<Rigidbody>();
Vector3 controllerVelocity = Player.instance.rightHand.GetTrackedObjectVelocity(); // how I ref the controller velocity in SteamVR
rb.velocity = controllerVelocity * 2f; // the 2f is just to speed up the velocity

The above code works fine, but the problem is I think the scale of the children objects, which can be adjusted by the player, is affecting the velocity the parent moves at. Or maybe just when the children are very large...the controller velocity is comparatively too slow? Basically I need this to not be the case; I want the parent's rigidbody to move at roughly the same velocity no matter the children's scales/masses.
So to achieve that I thought to use Rigidbody.AddForce but it doesn't seem to be making any difference i.e. larger children are still moving slower. Here is what I have so far:
Rigidbody rb = GetComponent<Rigidbody>();
Vector3 controllerVelocity = Player.instance.rightHand.GetTrackedObjectVelocity();
rb.AddForce(controllerVelocity  * 2f, ForceMode.VelocityChange);

I also tried ForceMode.Acceleration but then nothing moved at all? Am I using AddForce incorrectly? Or do I just need a scaling multiplier based on the size of the children? Any help is welcome.

sentences:
Draw line inwards in Unity using Line Renderer Is there a way to draw the line inwards instead of from the center using Line Renderer in Unity?

Another option would be to move the Vector points inwards by half the width of the line, but If I have a complex polygon how do I do it uniformly?

EDIT: Found this https://stackoverflow.com/questions/1109536/an-algorithm-for-inflating-deflating-offsetting-buffering-polygons which may be useful

sentences:
How to start external AS file playing on frame 2 (instead of frame 1) I am using actionscript 3 and I have used an external actionscript file (.as) for my game.

I would like the external actionscript file to be played at frame 2 (instead of frame 1, as it is an introductory page of the game) on the timeline.

How do I do that? I have been trying and looking for answers for hours, appreciate if you can help on this. Many thanks in advance!

sentences:
Where do I place XNA content pipeline references? I am relatively new to XNA, and have started to delve into the use of the content pipeline. I have already figured out that tricky issue of adding a game library containing classes for any type of .xml file I want to read.

Here's the issue. I am trying to handle the reading of all XML content through use of an XMLHandler object that uses the intermediate deserializer. Any time reading of such data is required, the appropriate method within this object would be called. So, as a simple example, something like this would occur when a character levels:

public Spell LevelUp(int levelAchived)
{
    XMLHandler.FindSkillsForLevel(levelAchived);
}

This method would then read the proper .xml file, sending back the spell for the character to learn. However, the XMLHandler is having issues even being created. I cannot get it to use the using namespace of Microsoft.Xna.Framework.Content.Pipeline. I get an error on my using statement in the XMLHandler class:

using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate;

The error is a typical reference error:

  Type or namespace name "'Pipeline' does not exist in the namespace 'Microsoft.Xna.Framework.Content' (are you missing an assembly reference?)"

I THINK this is because this namespace is already referenced in my game's content. I would really have no issue placing this object within my game's content (since that is ALL it deals with anyways), but the Content project does not seem capable of holding anything but content files.

In summary, I need to use the Intermediate Deserializer in my main project's logic, but, as far as I can make out, I can't safely reference the associated namespace for it outside of the game's content. I'm not a terribly well-versed programmer, so I may be just missing some big detail I've never learned here. How can I make this object accessible for all projects within the solution? I will gladly post more information if needed!

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: What is framerate-independent motion? What is the definition of framerate-independent motion and why is important to have it in games?

sentences:
Get normal dependent on collisions position As I hask ask here I'm working on how my objects can move over the terrain and other objects. My proposal and also an idea in the answers was to calculate the rotation from the object with the normals from other objects around (under and in front) the moving object.

My main problem for that is how I can get the normal from an object at a special position. Let's take the ramp on the road from the old example. It depends from which side my car comes. If it comes from front it can drive along the ramp but if it comes from back it moves against the wall. Of course there are other normals if I come from the other side. All my objects have these variables:

float vertices[];
float normals[];
short drawOrder[];

float[] modelMatrix;
AABBox boundingBox;

So you see I can allways get the vertices, normals and the position. I can also test if the object collides with another object with the bounding box (axis aligned) but I have no idea how I can get the normal where the collision happens but that is the important thing for the rotation of the car. Do you have any ideas or are there usual way how to do this?

sentences:
Rigidbody has unintended effect, velocity limiter from unknown source I have made a script that alters a rigidbody's angular velocity. It works well but has one issue, its speed plateaus past a certain point.

Here is the script:

    void Start(){
    //Get references.
    bat = transform.GetChild (0).gameObject;
    rig = bat.GetComponent<Rigidbody> ();
    //Initialize variables.
    initPos = bat.transform.position;

    initAngle = bat.transform.rotation.eulerAngles.y;
    if (leftSide) {
        maxAngle = bat.transform.rotation.eulerAngles.y - 45;
        rig.centerOfMass = bat.transform.localPosition;
    } else {
        maxAngle = bat.transform.rotation.eulerAngles.y + 45;
        rig.centerOfMass = -bat.transform.localPosition;
    }
}

void Update(){
    if(leftSide){ // True and false does the same but mirrored effect.
        if(Input.GetButton ("Left Bat")){// button pressed?
            if(bat.transform.rotation.eulerAngles.y > maxAngle){//lower than max angle?(since this is the mirrored version, its rot starts at 180 and turns CCW, thus the '>')
                currAngle = -1 * turnSpeed; // then allow turning
            } else {// otherwise
                currAngle = 0f; //prevent further turning
            }
        } else {// button not pressed?
            if(bat.transform.rotation.eulerAngles.y < initAngle){// greater than resting angle?(same reason as above explanation)
                currAngle = 1 * turnSpeed; // then automatically return
            } else {//otherwise
                currAngle = 0f; //stop returning
                bat.transform.rotation = Quaternion.Euler (new Vector3 (bat.transform.rotation.eulerAngles.x, initAngle, bat.transform.rotation.eulerAngles.z));// this statement re-aligns the rotation of the flipper its initial state(instantly) to prevent slight kinks due to inconsistencies.
                bat.transform.position = initPos;//turning the flipper for some reason can deviate its own position(slight but cumulative), this returns the flipper to its initial position.
            }
        }
    } else { // default version.
        if(Input.GetButton ("Right Bat")){
            if(bat.transform.rotation.eulerAngles.y < maxAngle){
                currAngle = 1 * turnSpeed;
            } else {
                currAngle = 0f;
            }
        } else {
            if(bat.transform.rotation.eulerAngles.y > initAngle){
                currAngle = -1 * turnSpeed;
            } else {
                currAngle = 0f;
                bat.transform.rotation = Quaternion.Euler (new Vector3 (bat.transform.rotation.eulerAngles.x, initAngle, bat.transform.rotation.eulerAngles.z));
                bat.transform.position = initPos;
            }
        }
    }
}

void FixedUpdate(){// rigidbodies should be processed in fixedupdate I think
    rig.angularVelocity = new Vector3( 0, currAngle, 0);
}

The issue is, no matter how high a value I enter for the movement part, it doesn't get faster than a specific speed. I tried hardcoding a value instead of changing the variable but it didn't make a difference. If I enter a small value, the movement is slower though.

sentences:
Libgdx: converting between two camera coordinates I had a similar issue to the question here: Why is my text is too large even when scaled to .05f in libGDX?

So I created a second camera for my text elements. I'm rendering the text above some other elements, and under others, so I was trying to map between the two camera's coordinates when rendering.

That seems to be working OK, but I need to invert the y coordinate during the transformation. I'm wondering why that's the case?

Here's the code:

    // Setup camera
    OrthographicCamera camera = new OrthographicCamera(VIEWPORT_UNITS, VIEWPORT_UNITS * (height / width));
    camera.position.set(camera.viewportWidth / 2f, camera.viewportHeight / 2f, 0);

    // Setup text camera
    FitViewport fitViewport = new FitViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    fitViewport.apply(true);
    gameContext.setHudViewport(fitViewport);
    OrthographicCamera textCamera = fitViewport.getCamera();

    // ... later, during render(), convert between coordinates
    Vector3 textPosition = new Vector3(fontX, fontY, 0);
    camera.project(textPosition);
    textPosition.y = Gdx.graphics.getHeight() - textPosition.y; // why?
    textCamera.unproject(textPosition);

    font.draw(spriteBatch, text, textPosition.x, textPosition.y);

sentences:
How remove banner adView from a Screen in libgdx? I have an AdMob banner in the game. But I need this banner not to be shown in Screen_1 and when user enter Screen_2 I need to show the banner.
When I call AdView.gone() it dissapears from screen but coordinates becomes wrong and touch position doesn't match with coordinates. How can I properly remove AdView.

sentences:
Why do old platformers typically scroll to the right? Lots of old platformers are only left-to-right-ish and they don't allow you to move viewport left.

I'm interested was it just a game design choice or it's due to some limitations back then.

I have a lot of possible reasons in my head, but I'm interested in actual one, so please consider reply with citation.

Not sure I'm in correct community with this question, sorry in advance.

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:
Should I scrap my own leader board and go for the Facebook built in one? Currently I'm rolling my own score and leader board functionality in my FB canvas game.
In my game, users can see what score they have, in addition I have a public leader board where everybody can see all scores from all other users.(I also have possibility for each user to set themselves as anonymous in the leader board, if desired)

But now I started thinking; why do I have my own leader board system?
Facebook has this scores API and I started play around with it.
It, of course, integrates well with Facebook, scores and achievement showing up in the ticker and what not.

But it seems that I can't let each user see a public leader board in much the same way I currently have it. But it do let the users see their friends score.
Let's face it, this is all what FB is all about, right? Friends.

So the question is; should i scrap my own leader board and go for the Facebook built in one (and skip the public part of it)?

My gut feeling says yes, but I wanted to hear what other thinks.

sentences: Manual per-glyph rendering with SDL_TTF I'm trying to create a font atlas with SDL_TTF. My idea was to create an SDL_Surface for every character using TTF_RenderGlyph_Blended() and use TTF_GlyphMetrics() to get glyph metrics so that I can position the surface relative to a baseline. I'm struggling with a correct positioning of a glyph. It looks like SDL_TTF creates a surface with height which is at least the height of the font and width which is at least advance of a glyph, so the surface is bigger than just the glyph. How do I extract glyph's rectangle from the created surface? How do I position the glyph correctly relative to the base line on the screen? I thought y position of the glyph it should be baselineY - maxy (where maxy is from TTF_GlyphMetrics), but that places glyph too high above the base line.

sentences:
Why is the background image less smooth on the phone? I've just downloaded Gamestate code from create.msdn.com, and as you can see from the image below:

The result is less smooth then the image imported to visual studio, how do I increase the quality?

sentences:
What is the difference between genre and game mechanics? In some local vacancies I read something like "a genre = match3", or like "a game mechanics = adventure". I thought, a game mechanics is match3, or any sequences of operations that do something to solve something. A verb. For example, to connect three candies of one color in a line.

And genre is just a structure about what elements should be in a story. Like in "The Hero with a Thousand Faces". For example, an adventurer + an artifact + a map (or any key) to find it + competitor (or a let) = adventure.

Am I wrong?

sentences:
I can't set the Source image for a UI image; how to fix it? I am new to Unity. As a learning project, I started to make a very basic car racing game. In order to add an on-screen speedometer for my car, I imported an image UI.

The problem is that I can't set a source image for my speedometer UI. I tried using .jpg .png or .psd image files as well. In any case, I'm not able to drag and drop the image.

Under the list Source Image, I already have selected UISprite from the drop-down list, but still, I'm not able to set source image.

Can anyone provide me any solution? I also have attached a screenshot of what I have.

sentences:
How 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:
Drawing UI using density pixels I have a question about proper ways to draw UI, since I've learned what I know from the internet and by experimenting I often dont code the "proper" way, instead I do it my own way, not knowing if it will have consequenses that Im unaware of. So, Is it "wrong" to draw your UI using density pixels?

For Example:

canvas.drawText(bullets, this.getWidth() - 134 * dp, 32 * dp, paint);

I try to use getWidth() and getHeight() as much as possible but sometimes I just need to use constants in my code to place stuff where I want it, is this ok as long as I use dp? or will this effect the layout on screens with different resolutions/performance? (Don't have anything except my own to run the game on)

sentences:
How to transition a coin to the middle of the screen then up when collecting it? I have a coin sprite that animates spinning in place, like this.
When the player picks up the coin, I want to make a transition while keeping the animation. First moving towards middle, then much faster all the way up until it leaves the screen like this:

My question: Is this done mostly via adjusting the Transform component component via scripting? Or are games implementing something like this in a different way?

sentences:
Unity Serialization depth warnings I've got this class to store spells for my game
[Serializable]
public class Spell
{
    public SpellComponents component;
    public SpellSequence sequence;
    public float delay;
    public Vector3 offset;

    public List<Spell> next = new List<Spell>();

}

but always get warnings like this
Serialization depth limit 7 exceeded at 'Magic.SpellSystem::Spell.next'. There may be an object composition cycle in one or more of your serialized classes.

Spells are made in a node based editor and can branch off like this

How can i fix this?

sentences:
Java - how to reduce iteration loops for enemies I have many places in my code where I'm iterating through the enemies array and it seems to me it could be optimised somehow, but I can't see how it can be done. For example these two loop checks:
private void arc1() {
    for (Enemy e : gs.getEnemies())
        if (e.distanceFromPlayer() < 32 && !e.seen) {
            arc1.setActive(true);
            return;
        }
    arc1.setActive(false);
}

private void arc2() {
    for (Enemy e : gs.getEnemies())
        if (e.distanceFromPlayer() < 24) {
            arc2.setActive(true);
            return;
        }
    arc2.setActive(false);
}

They're both just checking the distance from the player with one having an extra condition and a different distance. Is there a way to combine them into one? I tried doing it but it didn't work correctly.
Will it actually give any benefit performance wise to combine into one in any case? It does look like duplicate code but not sure if there would actually be any performance benefit.

sentences:
Basic billiards game: Can't detect collision between cuestick and cueball I have a basic Unity project on GitHub.

Basically, I have a Cuestick that aims and shoots using the mouse. You can rotate around the cueball with your mouse and when you're ready to shoot, you can hold down the right mouse button and move the mouse forward. The game came follows the cuetip.

However, the collision between the cuestick and cueball is wonky. The cuestick protrudes through the ball and only pushes the ball forward only a little bit.

I've created rigid bodies and colliders for both cuestick and cueball. I've set the cuestick's rigid body to kinematic (if it's unchecked, the poolstick will barely dent the ball). I've tried using OnCollisionEnter and a Debug.Log statement to no avail.

Any help would greatly be appreciated. You can find my scripts in /GameLogic (they're F# sharp scripts whose binaries get compiled and outputted into the /assets folder).

sentences:
How can I ensure I still get correct touch inputs when my scene is offset? How can I accept touch input beyond the scene's bounds, so that no matter what I set self.position to, touches can still be detected?

I'm creating a tile based game from Ray Winderlich on Cocos2d version 3.0. I am at the point of setting the view of the screen to a zoomed in state on my tile map. I have successfully been able to do that although now my touches are not responding since I'm out of the coordinate space the touches used to work on.

This method is called to set the zoomed view to the player's position:

-(void)setViewPointCenter:(CGPoint)position{
    CGSize winSize = [CCDirector sharedDirector].viewSizeInPixels;
    int x = MAX(position.x, winSize.width/2);
    int y = MAX(position.y, winSize.height/2);
    x = MIN(x, (_tileMap.mapSize.width * _tileMap.tileSize.width) - winSize.width / 2);
    y = MIN(y, (_tileMap.mapSize.height * _tileMap.tileSize.height) - winSize.height / 2);
    CGPoint actualPosition = ccp(x, y);

    CGPoint centerOfView = ccp(winSize.width/2, winSize.height/2);
    NSLog(@"centerOfView%@", NSStringFromCGPoint(centerOfView));
    CGPoint viewPoint = ccpSub(centerOfView, actualPosition);
    NSLog(@"viewPoint%@", NSStringFromCGPoint(viewPoint));

    //This changes the position of the helloworld layer/scene so that
    //we can see the portion of the tilemap we're interested in.
    //That however makes my touchbegan method stop firing
    self.position = viewPoint;
}

This is what the NSLog prints from the method:

2014-01-30 07:05:08.725 TestingTouch[593:60b] centerOfView{512, 384}
2014-01-30 07:05:08.727 TestingTouch[593:60b] viewPoint{0, -832}

As you can see the y coordinate is -800. If i comment out the line self.position = viewPoint then the self.position reads {0, 0} and touches are detectable again but then we don't have a zoomed view on the character. Instead it shows the view on the bottom left of the map.

Here's a video demonstration.

How can I fix this?

Update 1

Here is the github page to my repository.

Update 2
Mark has been able to come up with a temporary solution so far by setting the hitAreaExpansion to a large number like so:

self.hitAreaExpansion = 10000000.0f;

This will cause touches to respond again all over! However, if there is a solution that would not require me to set the property with an absolute number then that would be great!

sentences:
what is the legality behind "openMW" ( an open source implementation of morrowind) knowing bethesda those people probably sue hard....yet there is an open source implementation of morrowind which is actually quite good.
but that question remains, what is the legality behind all of this?
is it legal to distribute a free open-source implementation/adaptation of a videogame?

sentences:
Support multiple gamepad layouts (Unity 2017.3) My game supports touchscreen, keyboard + mouse and the Xbox One controller and the input so far works properly. Now I also want to add a second layout for the gamepad the player can then pick in the settings, e.g.:

Layout 1: Fly up with "A", fly down with "B" (so two buttons)

Layout 2: Fly up with "LB", fly down with "LT" (LT uses an axis, not a button!)

With keyboard/touchscreen and gamepad input I was able to create two different inputs in Unity's InputManager for the same thing and they would then trigger depending on which input device you're using.

I thought about adding a bool for the layouts and checking it every time a button is pressed but that sounds more like a quick and dirty solution. Descriptions of InputManagers I've found so far make it sound like they're used for rebinding keys or to support different gamepads (e.g. Xbox One and PS4), which I don't want/need (plus, these InputManagers are usually pretty expensive).

How do you handle actual different layouts that use the same buttons/axis for different things, especially with something using a button in the first layout and an axis in the second?

sentences:
Flixel Development in Ubuntu/Linux I've been trying to setup a development environment for Flixel on Ubuntu using this guide http://forums.flixel.org/index.php?topic=4545.0 but thus far have been unsuccessful mainly due to the guide being dated and using an outdated and inactive plugin for Eclipse (axdt).

I was wondering if anyone currently develops Flixel based games using Ubuntu/Linux, and if so how you got yourself setup. Ideally I would want to use an IDE like Eclipse but I would be open to other options.

sentences:
Combine a light and water shader in libgdx glsl I am trying to combine a light shader with a water shader in libgdx. Shader programming is not one of my strengths at all.

This is the water effect rendering nicely:

And when I have added the flickering light code I am getting this:

The light is meant to be a flickering white circle and the water should show up. It doesn't.
What I have done so far is try to re-arrange texture binding, combine drawing in one pass. I can render the other scene content on top of the water but the water has to be the top-most item. That is what I am failing to do,

Here is my wall of code (just the render function):

public void render() {
    float dt = Gdx.graphics.getDeltaTime();

    // water
    time += dt;
    float angle = time * (2 * MathUtils.PI);
    if (angle > (2 * MathUtils.PI))
        angle -= (2 * MathUtils.PI);

    // light
    zAngle += dt * zSpeed;
    while (zAngle > PI2)
        zAngle -= PI2;

    fbo.begin();
    batch.setProjectionMatrix(cam.combined);
    batch.setShader(defaultShader);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    batch.begin();
    float lightSize = 140.75f + 0.25f * (float) Math.sin(zAngle) + 27.2f * MathUtils.random();
    batch.draw(lighttex, 400 - lightSize * 0.5f + 0.5f, 300 + 0.5f - lightSize * 0.5f, lightSize, lightSize);
    batch.end();
    fbo.end();

    // draw the actual scene
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    batch.setProjectionMatrix(cam.combined);
    batch.setShader(finalShader);
    batch.begin();
    fbo.getColorBufferTexture().bind(1);
    lighttex.bind(0);
    batch.draw(map1BgTex, 0, 0, 960, 540);
    batch.setShader(waterShader);
    waterShader.setUniformMatrix("u_worldView", cam.combined);
    batch.end();

    Gdx.gl20.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
    Gdx.gl20.glEnable(GL20.GL_BLEND);
    watertex.bind(1);
    waterdisptex.bind(2);

    defWaterShader.begin();
    defWaterShader.setUniformMatrix("u_worldView", matrix);
    defWaterShader.setUniformi("u_texture", 2);
    defWaterShader.setUniformi("u_texture2", 3);
    defWaterShader.setUniformf("timedelta", -angle);
    waterMesh.render(defWaterShader, GL20.GL_TRIANGLE_FAN);
    defWaterShader.end();

    }

I uploaded a more complete source file and the shaders to my server, I hope it's not too inconvenient - http://agexdev.com/files/shaders.tar.xz

sentences:
Why is my TextMesh always on top? I have a 2-d game that I am making, using 3-d assets, including TextMeshes for text. I have decided that in some instances, I would like to have the TextMesh appear behind objects in the foreground. The below is one such example.

It seems that the TextMesh is always in front. I have tried a number of things to get the text between the map and object layers, with no success. These include:

Moving the text between the map and object.
Changing the SortingLayers and SortingOrder. The map, objects, and labels are on 3 different layers, with the Objects being the highest layer, the map the lowest, and default and label in between.
Using a perspective camera, not orthographic.

Any ideas as to what else could be going on? Thanks!
How can I make the TextMesh appear that isn't on the top layer? Thanks!

sentences:
Finding texture coordinates for plane I am creating a 3D ray tracer and want to add textured planes.

My planes are stored using a position vector and a normal vector.

I want to use a square texture and map it repetitively onto the plane.

How do I figure out a transformation from points (3D vectors) on the plane and points (2D vectors) on a texture? Once I know how to do this transformation, I don't think making it repetitive will be hard, as we can just apply modulo arithmetic.

I thought I could make a basis on the plane by calculating a vector B1 perpendicular to the normal, and then another one, B2, perpendicular to the normal and B1. But once I have these two vectors, I still don't know how to express the point (which is the argument for the function below) in this basis.

Vector3 position, normal;
Bitmap texture;

public override Vector3 GetColor(Vector3 point) {
    int u = ?
    int v = ?

    return texture.GetPixel(u, v);
}

sentences:
FPS horizontal smooth camera rotation I have a problem, my camera is parented to the FPS Controller prefab, then there is a script I wrote for the rotation of the player horizontally by mouse movement, it all works but the rotation is very choppy and not smooth. How can I have the camera rotating smoothly or should I not parent my camera to the FPS Controller at all and make the rotation through scripting if so then how?

here's the script of character rotation:

void Update () {
    float rotationY = Input.GetAxis ("Mouse X") * 50f;
    transform.Rotate (0, rotationY, 0);

}

sentences: Smoothing found path on grid I implemented several approaches such as A* and Potential fields for my tower defense game. But I want smooth paths, first I tried to find path on very small grid ( 5x5 pixels per tile) but it is extremly slow. I found nice video showing an RTS demo where paths are found on big grid but units dont move from each cell's center to center. How do I implement such behavior? Some examples would be great.

sentences:
Calling and functions/methods from different Classes in Unity I am learning some of the basics with Unity and am running into calling/sending code to a different script.

For example, the code below is a basic menu of options. I have a different Scene set up in Unity for each one of the menu options. As you can see from the if/else if statements, depending on which option a user checks, will take them to a different portion of the program.

At this point it will obviously not compile because the 4 methods for each menu option are not referenced anywhere.

Lets say the user selects option 1 which is the StudyScreen() method. Now in the StudyScreen.cs script that I created, how do I link those so when option 1 is selected, it goes to the StudyScreen.cs and runs what I need it to run.

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

public class MainMenu : MonoBehaviour {

public Text menu;

// Use this for initialization
void Start () {
    menu.text = "Main Menu Options\r\n\r\n" +
                "1. Study\r\n" +
                "2. Quiz\r\n" +
                "3. Test\r\n" +
                "4. Exit\r\n";
}

// Update is called once per frame
void Update () {
    if      (Input.GetKeyDown(KeyCode.Alpha1))  {StudyScreen();}
    else if (Input.GetKeyDown(KeyCode.Alpha2))  {QuizScreen();}
    else if (Input.GetKeyDown(KeyCode.Alpha3))  {TestScreen();}
    else if (Input.GetKeyDown(KeyCode.Alpha4))  {ExitScreen();}

    }
}

I hope I was able to make it clear as to what I was trying to accomplish. Please let me know if anything is unclear.

Thanks in Advance.
Curtis

sentences:
In MMO game, how to handle user characters, who are offline? In my medieval MMO game, players have their own character, that represents themselves inside game. Like a King. Players could have cities and armies, but King acts as main driving force.

Then it comes to player, going offline/vacation/disconnect. How to deal with "offline King", to keep some sort of reality in game, without ruining everything for player.
I have never liked unrealistic stuff in games, like appearing/dissapearing from thin air, like in WoW or other MMO RPG's, when it comes to connect/disconnect, like in Matrix movie, when you are disconnected, your "avatar" inside the system just vaninshes.

Ok, if player char stays where it was left, other players who are online could kick his ass like offline player char was frozen? I see only one solution - give player char, while offline, some sort of AI, that controls char. Is there any other solutions? May be, some sort of legend/story, could make users only as inner-voice, leaving King just passively controlled by user, or other stuff... Please, help!

I hope you understand my question.

sentences:
How to Implement Screen Freeze in Godot Many 2D games have an intentional screen freeze (say, 75 milliseconds) when the player takes or deals damage. During this freeze, all physics and animation processing stops.

How can one implement a screen freeze in Godot?

If you want to suggest how to do this in Unity or another engine, that's fine too. It might help me to figure out how to do it in Godot.

My only idea is to have a boolean called is_screen_freeze along with some variables freeze_start_time and freeze_duration. In all my nodes' _process() and _physics_process()methods, I can just pass if is_screen_freeze is true. This seems like a rather inelegant way of going about a screen freeze, and I'm not even sure it would work since animations would probably keep playing. Is there a better way?

sentences:
Destroy a single list member im trying to destroy a single game object using the following script but it destroys all of them , not the ones I want. I want to destroy the ones that the transform that holds this script collides with.

It's a 2D unity3d game btw.

The script :

var keys : List.<Transform>;

function OnTriggerEnter2D(coll : Collider2D)
{
    for(var i = 0; i < keys.Count; i++)
    {
        Destroy (keys[i].gameObject);
    }
}

I hope I was clear enough , don't hesitate to ask any questions.

Thank you for your time.

sentences:
LibGdx Camera Movement I just started learning a few things about libGdx and i don't really understand how the camera works because i've created a camera, then set the camera position to viewport.getWorldWidth()/2 and viewport.getWorldHeight()/2 and then i would like to draw a image at 0,0 or where the camera starts drawing but i don't really understand why it's not working.Here's the code:

public class PlayScreen implements Screen {

    private OrthographicCamera cam;
    private Viewport viewport;
    private MainClass mainClass;
    Texture img;

    public PlayScreen(MainClass mainClass){
        this.mainClass = mainClass;
        img = new Texture(Gdx.files.internal("badlogic.jpg"));
        cam = new OrthographicCamera();
        viewport = new StretchViewport(400, 200, cam) ;
        cam.position.set(viewport.getWorldWidth()/2, viewport.getWorldHeight()/2, 0);

    }

    @Override
    public void show() {

    }

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

        if(Gdx.input.isKeyPressed(Input.Keys.RIGHT)) {
            cam.position.x += 100 * delta;
            System.out.println(cam.position.x);
        }

        if(Gdx.input.isKeyPressed(Input.Keys.LEFT)) {
            cam.position.x -= 100 * delta;
            System.out.println(cam.position.x);
        }

        cam.update();
        mainClass.batch.setProjectionMatrix(cam.combined);

        mainClass.batch.begin();
        mainClass.batch.draw(img, 0  , 0); //here i'm not sure what position should it be
        mainClass.batch.end();
    }

The output it's just a blank window, i don't understand where it starts drawing

sentences: How do you come up with ideas for new games? What is the best way in your opinion to find new ideas for games? I want to invent something really new (like Gish, World of Goo, Crayon Physics etc), but I'm having problems coming up with new, creative ideas.

sentences:
Prefab instatiation not going well I'm trying to Instantiate a prefab when the mouse goes over collider of some GameObject so I'm using OnMouseEnter to instantiate and will use OnMouseExit to destroy it after (when this part of code works fine), the problem is that no error appears in the console but the prefab are not being instantiated, does not appear in the inspector or in the scene, even so, when I print it's name in the console (last line), it appears right. Is my syntax correct?

void OnMouseEnter ()
{
    string nomeSeta = "SETA" + direcao.getNome ();
    GameObject seta = Resources.Load<GameObject> (nomeSeta);
    float[] pontosXeZ = Util_CalculosGeometricos.ObterPontosCentraisXeZDeUmRetanguloPorNumeracaoSemRotacao (terrenoPai, direcao.getCoeficienteHorario ());
    seta.transform.localPosition = new Vector3 (pontosXeZ [0], 0.0f, pontosXeZ [1]);
    seta.name = nomeSeta;
    print ("seta.name: " + seta.name);
}

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:
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:
In Unity, can I load a local (/Resources folder) website to safari on an ipad In Unity, can I load a local (/Resources folder) website to safari on an ipad?
This works fine on a Mac, opening up a wepage from my Resources folder.

string path = "file://"+(Application.dataPath)+"/Resources/testsite.html";
    void OnGUI(){
        if(GUI.Button(new Rect(20, 20, 100, 100), "site")){
           Application.OpenURL(path);
        }
    }

but when I try to load this on an iPhone or iPad, it doesn't seem to work.
Am I accessing the address incorrectly for iOS using "file://"?
If this is not possible, is there an alternative way I can load a locally stored website on an iOS device?

sentences:
How to make changes to Pawn.cpp Unreal? I am trying to figure out a problem related to CableComponents.

As part of my learning and problem identification I'm trying to place some UE_LOGs/Debug Messages within Pawn.cpp and CableComponent.cpp

These changes are not reflected when the c++ code is compiled within unreal. which is consistent with Unreal only building project code.

So My question is, how can I make these changes to the source code and have them be used?

Alternatively, is there a better way to do what I'm trying to do?

The reason i'm trying to do this

I'm trying to figure out how often the dynamic data of UCableComponent is recalculated compared to the rendering update of APawn.

sentences:
Preventing a Child object (eg. some weapon) from going inside other objects in the scene? I have Cube with a sword like object as its child object. But when the cube moves in the scene the sword goes into the other objects in the scene. The sword have a BoxCollider attached to it but the scene contains objects that are stationary and don't have a Rigidbody attached as I don't want them to be controlled by physics, same for the sword. If I attach Rigidbody to it then it will be displaced from its main position on collision.

I tried to render only the Cube including the sword with one camera having higher depth value then the main camera in the scene. If my game was in first person then this works fine but In 3rd person when object get behind other objects in the scene we can still see the object.

How can I prevent the sword from going into other object without being controlled by physics?

Image:

sentences:
Programmatically creating a continuous scrolling background in Game Maker: Studio I have 15 background images for a 2D horizontal scrolling shooter game and I have been wondering how to insert programmatically those background images in the first level room, as I want them to be displayed one after the other looking as they were one large background image, repeating the last four ones until the boss is defeated.

I have seen that in Game Maker: Studio only 8 background slots are available in each room, so how could I achieve doing what I need here?

sentences:
How can I organize code for views efficiently? I'm making a video game for the Android platform and I need advice on the overall set up of the activities and views in the code. I don't need actual code, psuedocode will do, but actual code always helps. I will basically have the following:

A surface view that draws bitmaps in a 2d scene and rearranges them according to what ever is happening on the screen.
A main UI interface that needs to be shown on top of the surface view at all times that has buttons like the attack, defend, hotkeys and so on.
A start menu as a seperate activity that the user can choose options like volume, orientation, graphics quality, save & exit and so on.

Also I want dialogs throughout the games that pop up when interacting with NPCs and these dialogs need to display pictures as well.

That pretty much encompasses the first version of the game. I will add complexity to it maybe later on down the road but for now I would just like a general plan of how to set all of this up in a functional way. Again code would be nice but I really just need an idea of how to efficiently do these things without wasting memory resources and utilizing the Android APIs capabilites with smart programming methods.

sentences:
Strange result, when changing variable name I have no idea, what is going on. The mat4 xxx is the cause. Renaming it to "bones"/"bone_transfromations" etc. won't work it gives me an error. Renaming it to "test" works perfectly fine... This is my GLSL code:

#version 400 core

//data from VBO
in vec3 position;
in vec2 texture_coordinates;
in vec3 normal;
//bone data
in int bone_pointer;
in float bone_intensity;
//vertex color output
out vec4 color;
//texture coordinates
out vec2 pass_texcoords;
out vec2 texCoord0;
//normal
out vec3 surface_normal;
//vector pointing towards the light
out vec3 to_light_vector;

//position, rotation, scale
uniform mat4 transformationMatrix;
//perspective projection
uniform mat4 projectionMatrix;
//TODO: material color
uniform vec3 in_color;
//camera viewmatrix
uniform mat4 viewMatrix;
//lights
uniform vec3 lightPosition;
uniform vec3 lightColor;
//skeleton data
uniform mat4 xxx;

void main()
{
mat4 total_transform = xxx * transformationMatrix;
vec4 worldPosition;

worldPosition =  total_transform * (vec4(position, 1)) ; //

vec4 pos =  projectionMatrix * viewMatrix * worldPosition;
gl_Position = pos;

//Texture
pass_texcoords = texture_coordinates;

//light
surface_normal = (total_transform *  vec4(normal, 0)).xyz;
to_light_vector = lightPosition * worldPosition.xyz;

//textures
 texCoord0 = texture_coordinates;

}

sentences:
The animation state could not be played because it couldn't be found! If I try to use animation.Play() or have Play automatically ticked in the inspector on the animtion object, it gives me the follwing error:

The animation state could not be played because it couldn't be found!

I searched around the web and everywhere they say you need set the animation type to 'legacy', but I already changed type to legacy and it did NOT fix the problem.

Thanks in advance.

sentences: 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:
Understanding the rendering of the raycasting on flat screen I have a misunderstanding of the raycasting formulas on flat screen because my rendering is not what I expected, this is some parts of the code to show my projection formulas that I wrote by myself

This is the code for the function intersection

int         intersection(t_wolf3d *w, int i, t_vec2f *dir, int iter){
int             mapx;
int             mapy;
unsigned int    length;

length = -1;
while (++length < w->cam->raylength)
{
    mapx = (int)(w->cam->position.x + (length * dir->x));
    mapy = (int)(w->cam->position.y + (length * dir->y));
    if ((mapy / BLOC_SIZE < w->map->h && w->map->board[mapy / BLOC_SIZE]
                    [mapx / BLOC_SIZE]) || (i == 1 && mapy >= HEIGHT_MM))
    {
        w->cam->intersection.x = mapx;
        w->cam->intersection.y = mapy;
        return (1);
    }
}
return (0);

}

Code used for the raycasting algorithm:

void                    raycasting(t_wolf3d *w, int limit){
int         i;
int         hit;
t_vec2f     dir;
t_vec2f     forward;
t_vec2f     right;
double      halfwidth;
double      offset;

i = -1;
forward.x = tcos(w->cam->angle);
forward.y = tsin(w->cam->angle);
right.x = forward.y;
right.y = -forward.x;
halfwidth = ttan(w->cam->fov / 2.0);
while (++i < limit && !(hit = 0))
{
    w->cam->rays[i].startpoint = w->cam->position;
    w->cam->rays[i].startpoint.color = 0xff0000;
    offset = ((i * 2.0 / (limit - 1.0)) - 1.0) * halfwidth;
    dir.x = forward.x + offset * right.x;
    dir.y = forward.y + offset * right.y;
    if ((hit = intersection(w, limit, &dir)))
        w->cam->rays[i].endpoint = w->cam->intersection;
    else
    {
        w->cam->rays[i].endpoint.x = w->cam->position.x + w->cam->raylength
            * dir.x;
        w->cam->rays[i].endpoint.y = w->cam->position.y + w->cam->raylength
            * dir.y;
    }
    limit == w->width ? render(w, i, hit) : 0;
}

}

For non-straight walls, I thought it was my variable types, it seems like not, I changed them from integers to double and i still got the same result, this is a look of my structures :

typedef struct      s_point{
int             x;
int             y;
int             color;}                 t_point;

typedef struct      s_vec2f{
double          x;
double          y;}                 t_vec2f;
typedef struct      s_camera{
double          radius;
double          angle;
double          fov;
double          raylength;
double          speedmove;
double          speedangle;
t_point         position;
t_point         intersection;
t_point         rays[WIDTH];}                   t_camera;
typedef struct      s_map{
int             **board;
int             w;
int             h;}                 t_map;
typedef struct      s_wolf3d{
t_map           *map;
t_camera        *cam;
int             hit;
t_image         *img;
void            *mlx_ptr;
void            *win_ptr;
char            texture;
t_image         *textures[3];
int             colors[3];
int             mini_h;
int             mini_w;
int             width;
int             height;}                    t_wolf3d;

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:
How can I uniquely identify a GameObject in Unity? I'm trying to serialize and deserialize my custom classes with Unity. I've got an ISerialize interface that mandates the class can Load() and Save(), so then I setup one master class to iterate across everyone and find the ISerialize components and trigger them to Load() and Save() correctly:

public class SerializationTest2 : MonoBehaviour, ISerializationCallbackReceiver
{
    GameObject[] gameObjects = null;
    // Start is called before the first frame update
    void Start()
    {
        gameObjects = UnityEngine.SceneManagement.SceneManager.GetActiveScene().GetRootGameObjects();
    }
    // comment

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

    public void OnBeforeSerialize()
    {
        Debug.Log("Unity is serializing... saving state!");
        foreach (GameObject gameObject in gameObjects)
        {
            Save(gameObject);
        }
    }
    public void OnAfterDeserialize()
    {
        Debug.Log("Unity finished serializing... loading state!");
        foreach(GameObject gameObject in gameObjects)
        {
            Load(gameObject);
        }
    }

    private void Load(GameObject gameObject)
    {
        Debug.LogFormat("Found {0}", gameObject.name);
        ISerialize[] serializers = gameObject.GetComponents<ISerialize>();
        foreach (ISerialize serializer in serializers)
        {
            serializer.Load();
        }
        int nChildren = gameObject.transform.childCount;
        for (int i = 0; i < nChildren; i++)
        {
            Load(gameObject.transform.GetChild(i).gameObject);
        }
    }

    private void Save(GameObject gameObject)
    {
        Debug.LogFormat("Found {0}", gameObject.name);
        ISerialize[] serializers = gameObject.GetComponents<ISerialize>();
        foreach(ISerialize serializer in serializers)
        {
            serializer.Save();
        }
        int nChildren = gameObject.transform.childCount;
        for(int i=0; i<nChildren; i++)
        {
            Save(gameObject.transform.GetChild(i).gameObject);
        }
    }
}

So this works GREAT and exactly as intended - I get a list of all the top-level root objects on Start(), then I get the serialize/deserialize callback. I iterate down the tree of GameObjects for each root and get everyone.

The idea here is that this class will eventually open an XML file and save to that file for serializing or will load from that file for deserializing.

I need to build that XML hierarchy, though. I could have multiple instances of a class scattered across a bunch of different GameObjects, so I need some way of identifying which GameObject I've currently got so I can serialize/deserialize to the correct components for that GameObject.

The problem is that, when I use the above code, I get:

UnityException: GetName is not allowed to be called during serialization, call it from Awake or Start instead. Called from MonoBehaviour 'SerializationTest2' on game object 'Registrar'.

See "Script Serialization" page in the Unity Manual for further details.

So, then, how do I uniquely identify the GameObject I'm currently on? If I can't call gameObject.name, what should I be calling?

:EDIT:

As an example, consider two enemies - one has a scale of 2x the other and a hitDamage of 2x the other, but they otherwise use the same EnemyAttack script. I need to deserialize the hitDamage values to the correct GameObject, but if I can't use the GameObject's name during the serialization process then I don't know how I'm supposed to distinguish the two.

sentences:
Can various browsers be assumed to maintain predictible state accurately in multiplayer online gaming? With many games it is said that server will assume that clients keep track of the world accurately. Assuming this is true, for a browser based multiplier space invaders game you would only tell the client when new bullets or the players ship moves and everything that behaves in a predetermined manner in the js client.

It would be expected that positions would be the same in the browsers. Do you think you could trust browsers to do this? I feel that timings could differ between rendering loops and cause positions to get out of sync and might just get the server to maintain all the positions to make sure.

sentences:
Unity text is very blurry. How can I fix it? Unity text is very blurry. How can I fix it?
To be honest, I have no idea why it behaves this way:

Hope that someone faced the same problem and will be able to share how it was tackled.

sentences:
Networked Physics - Interpolation Causes Physics Engine to Explode A major issue I am encountering right now is that my physics engine (BEPU) and my network interpolation are conflicting with each other.

The player is a physics object, and so the physics engine updates it every update on the client.  When the client receives an authoritative position from the server, it replays the player's commands since the position was sent, and sets a "serverPos" variable in the player controller to that value.

Unfortunately, if a player should be on the other side of a bump in the terrain, the interpolation code will move the player into the terrain, which will cause loop of the player getting pushed back, the interpolation algorithm trying to push the player back in, and so forth until the engine literally explodes and gives me an NaN error.

My interpolation algorithm is extremely simple; each update, I keep track of how far the player has moved, add that to the interpolation target, and subtract away the distance interpolated from the last frame:

Vector3 serverPos;
Vector3 interpolationDistance;

void interpolate()
{
   serverPos += Position - lastPosition - interpolationDistance; // interpolated distance should not be factored into the target, as it will cause an infinite chain

   Vector3 preInterp = Position;

   Position = Vector3.Smoothstep(Position, serverPos, 0.3f);

   interpolationDistance = Position - preInterp;
}

Any advice on how to deal with this is greatly appreciated.

sentences:
Space nebula cloud generation? I found a cool kickstarter project called "Skywanders".
It's an minecraft like space game with a lego like building system and pretty cool graphics.

One thing I noticed are the "nebula clouds". They are procedurally generated 3D Objects and they look amazing.

How do I generate such nebulas? I bet there's a way to do that. And is it possible to convert a 2D nebula into a 3D one? I didn't found any algorithm yet or other sources.

sentences:
How do I edit this texconv "IMGtoBC3.bat" file so it "READS FROM & PRESERVES the directory structure when writing the "resulting" dds files Like the title says:
How do I edit this texconv "IMGtoBC3.bat" file so it "READS FROM & PRESERVES the directory structure when writing the "resulting" dds files?
THIS IS FOR END USERS, OF A GAME MOD "EASY CUSTOM ASSET BUILDER"

SO I NEED TO ALLOW "MANY" INSTALL LOCATIONS
PLUS "ENDLESS" CUSTOM DIRECTORY STRUCTURES OF INPUT FILES inside the "directed to use "folders""

I have a large folder/sub-folders with many tiff's that "have the same file name" divided up into "sets".
These dds files are for custom textures in a unity game, file naming is a forced event, but "sorted/selected" by folder.
I have about 3000 file sets ready to convert and I'm not doing them 1 by 1 in Nvidia tool (I hope) and AMD tool and the game have a MAJOR conflict (its as a no go)
BONUS points to anyone that could show me this "bat" file using unity's new tree of "CRUNCH" cmd line dds compressor/encoder.
Suggestions of other tools:
I have tested over 50 apps, for my needs its: Nvidia, texconv and then crunch in level of quality/support
HERE IS THE CODE:
ECHO OFF
Setlocal EnableDelayedExpansion

::Variables
SET @FORMAT=BC3_UNORM
SET @InputFolder=%~dp0Input_IMG_TO_BC3\
SET @OutputFolder=%~dp0Output_DXT5_BC3\
SET @TEXCONVEXE=%~dp0texconv.exe
SET @TEXCONVEXE02=%~dp0texconv.exe
:: Check for texconv.exe
IF EXIST "%@TEXCONVEXE%" SET @TEXCONVEXE=1
IF "%@TEXCONVEXE%"=="1" GOTO EXESTATE_1

:EXESTATE_0
TITLE - ERROR! texconv.exe not found!!!
COLOR 04
ECHO: && ECHO: && ECHO:
ECHO                 === ERROR! texconv.exe not found!===
ECHO:
ECHO     Install Path: "%~dp0texconv.exe"
ECHO:
ECHO    The script needs texconv.exe in order to work properly.
ECHO:
ECHO    Please make sure texconv.exe is in: "%~dp0"

ECHO: && ECHO:

GOTO CONT01

:EXESTATE_1
TITLE - Texconv.exe found!!!
COLOR 0A

ECHO: && ECHO: && ECHO:
ECHO                 [ texconv.exe Is Installed! ]
ECHO:
ECHO     "%~dp0texconv.exe"
ECHO:
GOTO CONT00
:CONT01
ECHO: && ECHO:
ECHO        Please copy/move the missing texconv.exe executable to where the script needs it to be and refresh this window.
ECHO:
:CONT00
IF "%@TEXCONVEXE%"=="1" GOTO START
ECHO: && ECHO: && ECHO     [Press any key to refresh the window] && PAUSE>NUL
GOTO SetTexConvPath

:START

:: Customize CMD Window
TITLE HumanStuff TexConv Batch Directory Script v1.0.2
PROMPT $G
COLOR 04
CLS

:: Make The Folders
IF NOT EXIST "%@InputFolder%" MKDIR "%@InputFolder%"
IF NOT EXIST "%@OutputFolder%" MKDIR "%@OutputFolder%"

::Run TexConv.exe
::-srgb was added because PNG images were getting high contrast colors
::Sorry about the messy code but this was harder to do than it sounds

FOR /R "%@InputFolder%" %%i IN (*.*) DO (
set word=%@OutputFolder%
set str=%%~dpi
CALL :REPLACESTRING
SET @IFOL=!@OSTRING!
CALL :MKFOL
SET @ISTRING=%%i
CALL :TexConv01
)

PAUSE
GOTO SCRIPTEND

:MKFOL
IF NOT EXIST "%@IFOL%" (
    MKDIR "%@IFOL%"
)
GOTO SCRIPTEND

:TexConv01
IF NOT "%@LOGO%"=="" SET @LOGO=-nologo
"%@TEXCONVEXE02%" %@LOGO% -srgb -nogpu -pow2 -vflip -if triangle -bc u -f %@FORMAT% "%@ISTRING%" -o "%@OSTRING%" -y
ECHO:
SET @LOGO=
GOTO SCRIPTEND

:REPLACESTRING
call set str=%%str:%@InputFolder%=%word%%%
set @OSTRING=!str:~0,-1!
GOTO SCRIPTEND

:SCRIPTEND
```

sentences:
How can I support different resolutions with Monogame? I want to support the following 4 resolutions in my Windows Phone 8 game: 480 × 800, 768 × 1280, 720 × 1280, 1080 x 1920.
How can I do that with Monogame? If I draw a sprite with Monogame, the sprite is not drawn on the right place in every resolution. For example, with a resolution of 768 × 1280, the sprite is drawn in the center of the screen, but if I use another resolution, the sprite is no more drawn in the center of the screen.

What should I do so that the sprite is in every resolution on the same place?

sentences:
Terrain (mesh) textures in Unity - blurry? I've created a 3D mesh in blender which will be used as a terrain in Unity. Additionaly, I created a 900x900 texture which I'd like to apply as material to the mesh. However, unlike with the normal Unity terrain, the material is only blurry/unrecognizable, not matter how many times I repeat the texture/what import settings I set for the texture.

Some googling brought up that it may have to do something with the shader, but I tried many with no results.

current result

texture

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:
Random.range giving me the same value at the same time I created a random direction in x and y-axis at where to move, then my problem is when I tried to randomize it sometimes I get the same value at the same time on both x and y-axis. How do I not let this happen, I only want one axis to have a value, not both?

ERROR

HOW I WANT IT TO HAPPEN

CODE

public Vector2 randomDirection;

void Awake()
{
}

void Update()
{
    randomDirection = new Vector2(Random.Range(-1, 2), Random.Range(-1, 2));
}

sentences:
pathfinding with obstacles in a Warcraft 3 like game Consider A* searching on a tile based map. A straight forward code would be: If there is an unit inside that cell, then it is unreachable, this is ok.

But there is map resolution issue. When I look into Warcraft 3, there monsters and structures does have different radius, and you can walk very close, which is more like vector based, how this was implemented?

Also, what is the standard solution to incorporate moving obstacles collision detection with path finding algorithm, like Warcraft 3?

sentences:
How to move the generated polygon horizontally in openGL? I am trying to develop a small ball game in OpenGL where rectangular bars of random height is generated and moved towards left and there is a ball which should be moved up and down(like jump action) whenever mouse left button is pressed. I am generating the polygon pattern but the problem is the movement

What is the best way to move the rectangles(of random height) horizontally? (or any generated pattern preferably polygon from right to left.)

I tried code below for movement of a single rectangle but i am getting a blank screen

void move_polygon()
 {
    int px,py;
    px=randr(50,100);
    py=randr(100,600);
    float r,g,b;
    r=(float)(rand()%10);
    g=(float)(rand()%10);
    b=(float)(rand()%10);
    float rf=r/10,gf=g/10,bf=b/10;
    glColor3f(rf,gf,bf);
    for(int pos=800;pos<=0;pos-=10)
    {
        Sleep(200);
        glClear(GL_COLOR_BUFFER_BIT);
        glBegin(GL_POLYGON);
        glVertex2f(pos,0);
        glVertex2f(pos,py);
        glVertex2f(px+pos,py);
        glVertex2f(px+pos,0);
        glEnd();
        glFlush();
        Sleep(100);
    }
}

sentences:
Lense distortion correction with unity5 I am working on lens distortion correction in Unity. I created a new scene dragged the "Cardboard" prefab to the scene. In the cardboard setting I have set the Distortion correction as "Non". and I havent made  any changes to the CardboadDistortion.cginc shader code.  But still the performance is not clear.What will be the issue.How can I improve the performance.

I am using Unity 5.3.5
GoogleVRForUnity Package

sentences:
Prevent Unity from crashing your computer? Recently, I made a very dumb mistake that caused Unity to crash my computer. I could move the mouse sometimes, but everything else became completely unresponsive, leading to me having to shut off my PC.

What happened: I had an object, let's say an arrow, that could collide with another object, let's call it spawner. When the arrow collides with the spawner, it's supposed to destroy the arrow that activated the spawner. The spawner would then, as the name might imply, spawn more arrows. The problem was that I forgot to temporarily disable to collision on the newly spawned arrows, meaning that as soon as they would spawn inside the spawner's collision box, they'd spawn more arrows, and those arrows would spawn more arrows, and those arrows would... you get the idea. It was a very stupid mistake I realized the moment I hit play, but it was too late.

Now, I know that was entirely my fault, but I was wondering if you could prevent Unity from sending your PC into a coma like that? (Besides not making a dumb mistake like that, of course...) I'll be honest, I kind of expected Unity would have some sort of fail safe for this kind of error. Is there a way to limit the object count for example?

sentences:
How do I stop stretching during window re-size in XNA? In my windowed mode XNA game when the user resizes the window the game stops updating the window and the last frame drawn is stretched and distorted until the user releases the mouse and the resize completes.

Is there any way to have the game continue to run "normally", updating frames and redrawing the screen, during the resize event?

I realize that keeping the render loop going while resizing may not be possible or recommended due do hardware managed resources getting continually created and destroyed, but is there any way to stop the ugly stretching?  Ideally by leaving the existing frame unscaled in the top left, or with a black screen if that isn't possible.

sentences:
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:
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 do I change the level of my game by changing the file loaded? I am making this 2d canvas game in JavaScript and I want to switch to file level2/level2.html when the boss of level 1 (level1/level1.html) is dead. This way I can have my stuff organized better.

This is the condition statement where I want to put the file change.

if(e.bosshealth <= 0){
  enemies = [];
  alert("LEVEL 1 COMPLETED");
  // I want the file switch to be here if possible.
}

sentences:
If SpriteBatch.Draw's SourceRectangle is null does a rectangle still get created? If you use the following SpriteBatch.Draw overload, does a Rectangle get created for the texture?

spriteBatch.Draw(texture, textureRectangle, null, Color.White, 0f, textureOrigin, SpriteEffects.None, 1f);

If so how would you access the Rectangle?

sentences:
Custom Music in Skyrim's Creation Kit? Can you bring in external music such as mp3s?  If so, how?  I didn't see anything about this in the wiki Bethesda released.

Also how does this work with regards to the Steam Workshop?  Don't imagine they would appreciate uploading copyrighted content.  I don't particularly care about making a public mod, I just want to screw around privately and create dungeons/towns using music from some of my favorite games.

Thanks.

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

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

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

e.g.

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

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

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

thanks!

sentences:
Unity Input System On-Screen Button doesn't work with touchscreen 2019.3.2f1 I am trying to make my player jump whenever the space button is pressed (if a keyboard is present), and I'm adding a on-screen button for players on mobile. The on-screen button works fine in the editor but when I try the game in a device the on-screen button doesn't work.

Here's how things are set up:

Change the Active Input Handling to Input System Package (New) on
the player settings.
Create the Jump action for the Player action map.
Bind <Keyboard>/space to my Jump action.
Add a PlayerInput component to my player object, pass my actions
file to it, and set up the events to call for each action.
Change the StandaloneInputModule to an InputSystemUIInputModule in my
event system object.
In my canvas I add an image and add OnScreenButton component to it (I
do NOT add a Button component).
Set the control path to <Keyboard>/space.

When I try the game on the device the rest of the UI buttons work fine except the on-screen button. On the editor though (using mouse input), the on-screen button works fine.
This is my first time using the Input System, I had actually found it somewhat nice to work with, however this does seem really strange. It is either a really strange bug (unlikely), or I messed up some setting (the setup process feels really convoluted actually).

sentences:
Simple shader for sprite interface I have been looking for any examples for a long time, I cant get anything to work (from the examples).  I have tried using vertex/pixel shaders, effects files, but they never have any effect on the rendering.  I am using seemingly simple shaders (adding a value to the red color, or removing a color entirely). This has led me to believe that the code setting up/rendering the shader is not working correctly.  Almost every example is for non sprite based rendering, but I dont know if that matters (I cant find any info on that).

A lot of forum posts/answers point to sites that no longer exist.

I want to get a proof of concept simple shader that does anything in particular, to the entire rendered screen.

The technology I am using is C++ Directx 9 Sprite interface. Any help/links in the right direction is appreciated.

Thanks in advanced!

sentences:
Game/Level Design Career translations in other fields Although I would love to get a job in the gaming industry I can't help but feel I should have a backup plan.  What I wanted to ask is game/level design a marketable skill that translates to other industries?

For example if your a programming in game development, you can be a software engineer in business, health care, finance, scientific etc, industries

If your an artist in game development, you can be an graphic artist, web designer, animator, advertisement, etc.

Do game/level designers have other industries they can get into other than gaming?  If you think so, what are some industries that level design (or game design) would be marketable for?

sentences:
How to convert a premade mesh into voxels so I can use algorithms such as marching cubes I have a mesh that was created in a 3D program which is the terrain the player will walk on.  I want to allow the terrain to be deformable by the player, but for it to be smooth (not like Minecraft).

From what I have read from existing questions similar to mine, I need to use an algorithm such as Marching Cubes (which I don't understand yet).  From what I understand, those types of algorithms are suited for procedural generation.

My question is;  How do I convert my mesh into voxels so that I can use algorithms such as Marching cubes?

Is it simply a matter of cutting up my mesh in chunks?

If it helps, I will be using C# and Unity 3D.

sentences:
(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:
Trouble Positioning Object In World I have a lightning effect that travels from point A to point B, I am having trouble placing placing point B correctly.

As you can see from the object hierarchy the points (LightningStart, LightningEnd) are nested 3 levels deep. _parentReaction.affectorWidget.transform.positionis the position I would like the object to be at.

As you can see below I have tried setting the position equal to the other widgets transform, I have also tried using transform.InverseTransformDirection and transform.TransformDirection in varying combinations, I have tried many options the code below is just me going back to basics to see what I missed.

I am not sure even which object I am supposed to call TransformPoint from, the Widget with the effect )(Point A) or the Widget at Point B?

Given the above scenario how would I position LightningEnd so that is at the same position as_parentReaction.affectorWidget.transform.position?

I understand this is a very common question and I have read many previous questions related to this but two hours later, I would just like to know how its done so I can understand where I am getting this wrong.

Thank you.

Edit: _controller is the Widget Running this effect, since it spawns as a child of this I dont need to worry about its position.

    public override IEnumerator Do(Widget _controller, WidgetReaction _parentReaction)
{
    effect = _controller.GetComponent<Widget_Effect_Comp>().AddEffect(effect);

    while (true)
    {
        start = effect.effectPrefab.transform.Find("LightningStart").transform;
        end = effect.effectPrefab.transform.Find("LightningEnd").transform;

        Debug.Log("End Position : " + effect.effectPrefab.transform.Find("LightningEnd").transform.position);

        //Debug.Log("Widget World Pos : " + _controller.transform.position);
        //Debug.Log("Widget Local Pos : " + _controller.transform.localPosition);

        //Debug.Log("AffectorWidget World Pos : " + _parentReaction.affectorWidget.transform.position);
        //Debug.Log("AffectorWidget Local Pos : " + _parentReaction.affectorWidget.transform.localPosition);

        effect.effectPrefab.transform.Find("LightningEnd").transform.position = _parentReaction.affectorWidget.transform.position;

        Debug.Log("End Position : " + effect.effectPrefab.transform.Find("LightningEnd").transform.position);

     yield return new WaitForSeconds(2f);
    }

}

public class WidgetEffect : ScriptableObject
{
    public string effectName;
    public GameObject effectPrefab;
}

public WidgetEffect AddEffect(WidgetEffect _widgetEffect)
{
    if (!activeEffects.ContainsKey(_widgetEffect))
    {
        GameObject go = Instantiate(_widgetEffect.effectPrefab);
        go.transform.parent = effectContainer.transform;
        go.transform.position = Vector3.zero;
        go.transform.localPosition = Vector3.zero;
        activeEffects.Add(_widgetEffect, go);

        return _widgetEffect;
    }
    return null;
}

Edit: Removed Extended Explanation not related to initial question!
[![enter image description here]]

sentences:
Is there any harm in having the main game loop run uncontrolled? I was wondering if there is any possible harm when my game loop runs as fast as the system allows?

I currently have a loop, that, by measuring passed time in nanoseconds, runs the game logic and rendering logic at predefined speeds without a problem. In fact any logic I do in the loop is clocked to a certain amount of calls each second.

The loop itself though just runs about as fast as it likes to which comes up to around 11.7 million loops a second on my machine.

Loop (simple pseudocode):

while(!isGameOver){

 if(canPollInputs){
    pollInputs()
 }

 while(canStepLogic){
    stepLogic()
 }

 if(canRender){
    render()
 }
}

My question is basically if that simple loop, if its not running at a controlled speed, can do any harm to a system?

Edit:
That means my logic is running 30 times a second (30 tps), my renderer is running at 60 fps, I'm polling inputs a 100 times a second and there's also some logic to cope with logic or rendering taking longer than expected. But the loop itself is not throttled.

Edit:
Using Thread.sleep() to e.g. Throttle the main loop down to 250 loops per second leads to a reduction but the loops runs at around 570 loops per second instead of the desired 250 (will add code when I'm at my desktop machine..)

Edit:
Here we go, a working java gameloop in order to clarify things. Also feel free to use it but don't claim it yours ;)

private void gameLoop() {

    // Time that must elapse before a new run
    double timePerPoll = 1000000000l / targetPPS;
    double timePerTick = 1000000000l / targetTPS;
    double timePerFrame = 1000000000l / targetFPS;
    int maxFrameSkip = (int) ( (1000000000l / MINIMUM_FPS) / timePerTick);

    int achievedPPS = 0;
    int achievedFPS = 0;
    int achievedTPS = 0;

    long timer = TimeUtils.getMillis();

    int loops = 0;

    int achievedLoops = 0;

    long currTime = 0l;
    long loopTime = 0l;

    long accumulatorPPS = 0l;
    long accumulatorTPS = 0l;
    long accumulatorFPS = 0l;

    long lastTime = TimeUtils.getNano();

    while(!isRequestedToStop) {
        currTime = TimeUtils.getNano();
        loopTime = currTime - lastTime;
        lastTime = currTime;

        loops = 0;

        accumulatorPPS += loopTime;
        accumulatorTPS += loopTime;
        accumulatorFPS += loopTime;

        if(accumulatorPPS >= timePerPoll) {
            pollInputs();
            playerLogic();
            achievedPPS++;
            accumulatorPPS -= timePerPoll;
        }

        while(accumulatorTPS >= timePerTick && loops < maxFrameSkip) {
            tick();
            achievedTPS++;
            accumulatorTPS -= timePerTick;
            loops++;
        }

        // Max 1 render per loop so player movement stays fluent
        if(accumulatorFPS >= timePerFrame) {
            render();
            achievedFPS++;
            accumulatorFPS -= timePerFrame;
        }

        if(TimeUtils.getDeltaMillis(timer) > 1000) {
            timer += 1000;
            logger.debug(achievedTPS + " TPS, " + achievedFPS + " FPS, "
                    + achievedPPS + " Polls, " + achievedLoops + " Loops");
            achievedTPS = 0;
            achievedFPS = 0;
            achievedLoops = 0;
        }

        achievedLoops++;
    }
}

As you can see there is almost no code run on each loop but always a certain selection based on how much real time has passed. The question is referring to that 'worker loop' and how it does influence the system.

sentences:
LWJGL not streching texture to quad I'm having problems with texturing in LWJGL. The texture is not being stretched to a quad.
As you can see, the texture is not being sized to the quad, marked with pink border. The problem doesn't exist when using square quad and square texture. Scaling the texture to 960x320 px doesn't help
The texture size is 96px width and 32px height.(1 tile is 32x32, this object is 3 by 1)

The code:

//rendering the textured quad. This method also renders everything else
public static void renderTile(Texture tex, int x, int y, int sizex, int sizey) {
    tex.bind();

    glBegin(GL_QUADS);
    glColor4f(1, 1, 1, 1);
    glTexCoord2f(0, 0);
    glVertex2f(x, y);

    glTexCoord2f(1, 0);
    glVertex2f(x + sizex, y);

    glTexCoord2f(1, 1);
    glVertex2f(x + sizex, y + sizey);

    glTexCoord2f(0, 1);
    glVertex2f(x, y + sizey);
    glEnd();
}

//opengl initialization code, called before any rendering
public static void initOGL(){
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0, 800, 600, 0 , 1, -1);
    Log.info("Display W=" + Display.getWidth() + " H=" + Display.getHeight());
    glMatrixMode(GL_MODELVIEW);
    glEnable(GL_TEXTURE_2D);
    glEnable (GL_BLEND);
    glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}

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:
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:
Rigidbody AddForce() skipping/teleporting I'm surprised that this issue is nowhere to be found on these forums... Well at least when I searched. So, on my setup I have created a cube and applied a Rigidbody to the object with the following C# script:

using UnityEngine;
using System.Collections;

public class Movement : MonoBehaviour {
    Rigidbody movement;
    float distToGround;
    bool doubleJump=false;
    void Start() {
        movement = GetComponent<Rigidbody>();//Initialize movement as their rigidbody
        distToGround = GetComponent<Collider>().bounds.extents.y;//Get the distance from the user to the ground
    }
    void Update() {

        /*If they aren't moving the horizontal or vertical axes, cancel out their velocity.*/
        if(Input.GetAxis("Horizontal")==0&&isGrounded()) movement.velocity = new Vector3(0, movement.velocity.y, movement.velocity.z);
        if(Input.GetAxis("Vertical")==0&&isGrounded()) movement.velocity = new Vector3(movement.velocity.x, movement.velocity.y, 0);

        /*Horizontal Movement*/
        if(Input.GetAxis("Horizontal")>0) movement.velocity = new Vector3(5, movement.velocity.y, movement.velocity.z);
        if(Input.GetAxis("Horizontal")<0) movement.velocity = new Vector3(-5, movement.velocity.y, movement.velocity.z);

        /*Vertical Movement*/
        if(Input.GetAxis("Vertical")>0) movement.velocity = new Vector3(movement.velocity.x, movement.velocity.y, 5);
        if(Input.GetAxis("Vertical")<0) movement.velocity = new Vector3(movement.velocity.x, movement.velocity.y, -5);

        /*Jumping and Falling*/
        if(Input.GetButtonDown("Jump")&&isGrounded()) Jump();//For jumping
        if(!isGrounded()) {//If they are in the air
            Gravity();//They're free... free falling!
            if(Input.GetButtonDown("Jump")&&doubleJump) {//If they jumped once
                if(Input.GetAxis("Horizontal")==0&&Input.GetAxis("Vertical")==0) {//And they aren't moving
                    Jump(); doubleJump=false;//Double Jump
                }
                else if(Input.GetAxis("Horizontal")>0) {//Otherwise, if they're trying to dodge right...
                    movement.AddForce(10, 0, 0, ForceMode.Impulse); doubleJump=false;//Dodge Right!
                    print("Dodged!");
                }
            }
        }
        if(isGrounded()) doubleJump=true;//Reset Double Jump bool
    }

    void Gravity() {
        movement.AddForce(movement.velocity.x, -20, movement.velocity.z);//Simply push them down consistently
    }
    void Jump() {
        movement.velocity = Vector3.zero;
        movement.velocity = new Vector3(movement.velocity.x, 15, movement.velocity.z);//Simply push them up consistently
    }
    bool isGrounded() {
        return Physics.Raycast(transform.position, -Vector3.up, distToGround + 0.1f);//returns whether or not the object is grounded
    }
}

Everything works fine in this code except for the code that allows them to dodge mid-air. Whenever I perform a jump successfully and jump again without pressing an arrow key, it double jumps as expected.
Whenever I dodge right, I noticed that the object seemed to "teleport" or "skip" in the direction a bit instead of actually applying the force. The more force I apply, the more it skips.
Why is my code executing it in this way? Is it a glitch with Rigidbody or is it a problem with my code that I'm not realizing?

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:
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:
Sounds and buttons show up in simulator, not in an Android device I'm a noob in android game development, started with corona sdk and outlaw.
My project runs just fine with the corona simulator on my win8, however, when building it to my android device (galaxy s3) and running it - it behaves differently than in the simulator:

First thing: in my project I have wav sound files that work just fine in the corona simulator, but on my android device the sound files do not play (I use the audio.play api).

Second thing: I have 2 buttons created with the widget.newButton api, which are displayed on a lua screen. The buttons do show in the simulator, but are not shown on the android app.

Any help will be appreciated!

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

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

sentences:
How should I make a jump-timing game's character static on screen? I decided to learn Pygame and try to make a simple game inspired by Google's T-rex jump game. However, I stumbled upon a problem that I can not seem to figure out: How can I implement a scroller/camera that can keep up with my character and platform?

Now it just disappears off the screen. I have made it so the platform moves to the right with the same speed as the character. Here is a GIF of what it looks like at the moment:

Is this the best way to do it for a game like this where speed of the character is always constant or is there a better way that will make adding obstacles in the future more easy?

sentences:
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:
Having trouble writing a controller class Okay so I'm writing a controller class to expand the SFML joystick library capabilities.  Since the different controllers I want to use for this game have different integer values mapped to different buttons, I want to be able to pass integer values to the class to map these values to buttons I have defined.  As well, SFML can detect whether a button is pressed with sf::Joystick::isButtonPressed(unsigned int joystick, unsigned int button).  However, this only detects if a button is currently pressed and thus holding the button will just register as repeated presses.  So I wrote my own code to detect for a button press without a hold.

So here's the issue: What is the proper way for the player (outside the class) to access the set of buttons without exposing data?  I could have getters for the buttons, but then the buttonPressed method couldn't change the value of held.  The only way I could see this working is if I gave full access to the Button's.  Or should I go about this a different way?  Any help would be greatly appreciated.  Here's the relevant code:

// Controller.h

class Controller
{
public:
    struct Button
    {
        unsigned int id;
        bool held;
    };

    // constructor which assigns a controller ID
    // and a set of buttons
    Controller(...);

    // Checks each frame for each button if
    // any are not held and sets held to false
    void update();

    bool buttonPressed(Button& button);
private:
    unsigned int controllerId_;
    Button A_, B_, X_, Y_, Z_, R_, L_,
    START_, D_PAD_UP_, D_PAD_LEFT_, D_PAD_DOWN_, D_PAD_RIGHT_;
};

// Controller.cpp

bool Controller::buttonPressed(Button& button)
{
    if (sf::Joystick::isButtonPressed(controllerId_, button.id) && !button.held)
    {
        button.held = true;
        return true;
    }
    else
    {
        return false;
    }
}

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:
Platformer collision detection problems I'm having a few problems with collision detection in my game (written in C# with SDL.Net). Detecting the floor and roof is fine, as does detecting sides of tiles when not jumping/falling. My problem comes when the player jumps and hits one of the sides of a tile.

Sometimes the player (blue) enters the tile, like this:
http://i.stack.imgur.com/SSjtR.png
At first I thought this was because it was checking for a collision then moving the player then drawing, but changing it has no effect.

Other times it will randomly move from the overlapping position above to here:
http://i.stack.imgur.com/0esSw.png

    public void PlayerCollision2 (ref Player player)
    {
        Rectangle rectLeft = new Rectangle (new Point ((int)player.x, (int)player.y), new Size (1, Player.HEIGHT));
        Rectangle rectRight = new Rectangle (new Point ((int)(player.x + Player.WIDTH), (int)player.y), new Size (1, Player.HEIGHT));
        Rectangle rectTop = new Rectangle (new Point ((int)player.x, (int)player.y), new Size (Player.WIDTH, 1));
        Rectangle rectBot = new Rectangle (new Point ((int)player.x, (int)(player.y + Player.HEIGHT + 1)), new Size (Player.WIDTH, 1));

        List<TileDirectionRelPlayer > lst = new List<TileDirectionRelPlayer> ();
        foreach (List<Tile> r in map) {
            foreach (Tile c in r) {
                if (c.tileType == TileType.Air)
                    continue;
                TileDirectionRelPlayer t = new TileDirectionRelPlayer ();
                t.tile = c;
                if (c.rect.IntersectsWith (rectBot)) {
                    t.below = true;
                    lst.Add (t);
                } if (c.rect.IntersectsWith (rectTop)) {
                    t.above = true;
                    lst.Add (t);
                } if (c.rect.IntersectsWith (rectLeft)) {
                    t.left = true;
                    lst.Add (t);
                } if (c.rect.IntersectsWith (rectRight)) {
                    t.right = true;
                    lst.Add (t);
                }
            }
        }

        if (lst.Count == 0 && !player.jumping) {
            player.falling = true;
        } else {
            foreach (TileDirectionRelPlayer t in lst) {
                MovePlayer (ref player, t, new Rectangle[] {rectLeft, rectRight, rectTop, rectBot});
            }
        }
    }

    private void MovePlayer (ref Player player, TileDirectionRelPlayer tile, Rectangle[] rectangles)
    {
        if (tile.above && rectangles[2].IntersectsWith(new Rectangle(new Point((int)tile.tile.x,(int)tile.tile.y+Tile.HEIGHT), new Size(Tile.WIDTH,7)))) {
            player.falling = true;
            player.jumping = false;
            player.ySpeed = 0;
            player.y = tile.tile.y + Tile.HEIGHT + 1;
        }
        if (tile.left && tile.tile.y < player.y) {
            player.x = tile.tile.x + Tile.WIDTH;
        }
        if (tile.below && !player.jumping && rectangles[3].IntersectsWith(new Rectangle(new Point((int)tile.tile.x,(int)tile.tile.y), new Size(Tile.WIDTH,7)))) {
            player.y = tile.tile.y - Player.HEIGHT - 1;
            player.falling = false;
            player.ySpeed = 0;
        }
        if (tile.right && tile.tile.y < player.y) {
            player.x = tile.tile.x - Player.WIDTH - 1;
        }
    }

I have no idea why this is happening or how to fix it, can someone point me in the right direction please?

EDIT: There is a video here if it helps

sentences:
What framework provides mouse-interactive components as game sprites? Background:

I wish to make a really flashy chess game.  The squares on the board will be unique terrain. The pieces will be colourful images.  The pieces will be animated. The pieces will sometimes be overlaid with each other at times.  It will have sound, allow saving, and need keyboard input sometimes.

The basic question (tl;dr):

I am looking for a free framework that will allow me to use interactive GUI components as sprites, that would make such a game easy to develop.

Things I want:

I need to be able to overlay partially transparent/translucent images on some sort of game canvas.
The images, or an invisible component holding them, should receive mouse events like clicks, click-and-drag, and mouse-over.  Pre-defined checking methods/functions are ok too.
The framework should allow animation of the images.
The framework must not exclude easy support for music, sound effects, keyboard or file IO.  I am happy to use compatible libraries or frameworks top do these things separately, but there's no point saving effort on mouse interaction only to find it has made everything else too difficult.
The framework and all its dependencies must be free.  I want to be able to distribute my game, free or for profit, without ever having to pay money for the tools or frameworks used in development. (Even if you think this is unfair or unrealistic, you won't change my mind.)
Documentation must be available.
Cross-platform i.e. should look and behave the same on linux or windows without major tweaking.

Things I don't care about:

Whether what you suggest is technically a framework, a library, an engine, or even a tutorial on how to easily do it.
I don't need bleeding-edge performance like you need for a fast-paced shooter.
The precise language or paradigm used.
Your (correct) belief that flashy graphics won't improve the chess experience. :-)
Anything relating to chess AI, marketing, or other important but out-of-scope considerations.

I appreciate any suggestions.

sentences:
Problem with a TinyOBJLoader Renderer I was working on implementing a renderer for SYOYO's tiny obj loader and when it came to testing time, it failed to render. Here is an image of the result:

I believe that i have made the error with my renderer, in which i have no idea of what is wrong.

Here is the code for the renderer:

void flushTerrain() {
            while (!pr_Models.empty()) {
                const Model3D* model = pr_Models.front();

                model->getVAO()->bind();

                glm::mat4 a;
                glm::translate(a, glm::vec3(model->getPosition()));

                model->getShader().setUniformMat4("ml_matrix", a);
                glDrawArrays(GL_TRIANGLES, 0, model->getShapeVerticies().size());

                model->getVAO()->unbind();

                pr_Models.pop_front();
            }
        }

and the code for the Model3D Constructor:

Model3D(std::vector<tinyobj::shape_t> shapes, std::vector<tinyobj::material_t> materials ,glm::vec3 position, Shader& shader) :
            pr_shapes(shapes), pr_materials(materials), pr_position(position), pr_shader(shader)
        {
            pr_VAO = new VertexArray();
            for (tinyobj::shape_t shape : pr_shapes) {
                pr_VAO->addBuffer(new Buffer(shape.mesh.positions, shape.mesh.positions.size(), 3), 1);

                pr_VAO->addBuffer(new Buffer(shape.mesh.texcoords, shape.mesh.texcoords.size(), 2), 2);
                pr_VAO->addBuffer(new Buffer(shape.mesh.normals, shape.mesh.normals.size(), 3), 3);
            }
        }

and finally, for the Buffer and VertexArray class:

Buffer::Buffer(tinyobj::shape_t data, GLsizei count, GLuint componentCount) {
        glGenBuffers(1, &pr_BufferID);
        glBindBuffer(GL_ARRAY_BUFFER, pr_BufferID);
        glBufferData(GL_ARRAY_BUFFER, count * sizeof(tinyobj::shape_t), &data, GL_STATIC_DRAW);
        glBindBuffer(GL_ARRAY_BUFFER, 0);
    }

void VertexArray::addBuffer(Buffer* buffer, GLuint index) {
        bind();
        buffer->bind();

        glEnableVertexAttribArray(index);
        glVertexAttribPointer(index, buffer->getCount(), GL_FLOAT, GL_FALSE, 0, 0);

        buffer->unbind();
        unbind();
    }

sentences:
Synchronize turn based browser game I'm writing a browser game in php and Sql. I'm also using Javascript - Ajax and Mysql.

I'm stack on the battle system because I want to Synchronize the turns of the players in the battle.

What I doing is to put two players on a battle. So from the first turn a countDown of 60sec will start.
What I am thinking is to use a server function to check the countdown, not to the client side. This because I think that in that case a bad synchronization will came, instead if it is the server to count down.

But.. how can I let the server do all this stuff?

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:
Unity 2D loading Spritesheet Atlas at runtime from web and using it dynamically I am new to Unity (came from AS3/Starling) and just started for 2D games in Unity. I have a spritesheet / texture-atlas (many different sized images packed in a single png) which I want to download at runtime (I can use WWW classes for that) in game .

Than use all those images (in that sprite atlas) and show them up on screen and use them as regular unity sprites, like applying Rigidbody2D or Collider2D etc. I googled for this but mainly what I found is using Unity3D's editor, importing the sprite atlas and using its own sprite editor. Not much on how I would do that in runtime. I am expecting something like what we used to do in Flash or evening in Cocos2d, like we have a related XML file for each sprite atlas and their SDK have functions for reading that sprite in conjunction with that XML.

Any help would be highly appreciated.

sentences:
Calculation of distance while switching between two speeds There are two speed values, that are used by moving object. After a while speed switching occurs from V1 to V2. I need the formula that can be used for calculation of current distance (at specified time).

Input variable:

T - Current time

Constants:

V1 - first speed
V2 - second speed
Ts - switching time between V1 and V2
P - switching power

Output variable:

S = ?

I tried to use next formula:
S = Lerp[Clamp(T / Ts, 0, 1) ^ P), V1, V2] * T

But in this case the moving object will be returned back after time and moves forward again.

Probably acceleration should be used in the formula?

sentences:
How to search for a visible player? I've an enemy static tank with a "rotable" cannon turret.
I would like to rotate it in the player's direction .
How to implement it ?
I've thought something like

void Update {
    SearchForPlayer();
    RotateTurret();
}

I don't know how to implement a sort of radar function.
Thanks

sentences:
Unity Rigidbody2d jittering movement in the y-axis As said, rigidbody moves fine, even smoothly in the x axis.

Problem comes in on the y axis. Whenever the character goes up or down, it noticeably shakes.

Additional Info:

Unity 5.6
Using linear interpolation
Mass is 5
Linear Drag is 20
Gravity is 0
Angular Drag is 0
Locked rotation on the z-axis
Dynamic Rigidbody
No parent Object, not even a child

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

public class PlayerMovement : MonoBehaviour {

Rigidbody2D rbody;
//Animator anim;
public float speed = 0;
/*SpriteRenderer sr;
Vector2 movementVector;
void Start () {
    rbody = GetComponent<Rigidbody2D> ();
    anim = GetComponent<Animator> ();
    sr = GetComponent<SpriteRenderer>();
}*/

void Update(){
    //sr.sortingOrder = ((int)Camera.main.WorldToScreenPoint (sr.bounds.min).y) * -1;
    movementVector = new Vector2 ((Input.GetAxisRaw("Horizontal"))*3, Input.GetAxisRaw("Vertical"));
    /*if (movementVector != Vector2.zero) {
        anim.SetBool ("isWalking", true);
        anim.SetFloat ("inputX", movementVector.x);
        anim.SetFloat ("inputY", movementVector.y);
    } else
        anim.SetBool ("isWalking", false);
}*/

void FixedUpdate(){
    rbody.AddForce (movementVector * speed);
}

}

I also noticed that changing the mass and linear drag affected the movement speed on the y axis but not on the x axis, and movement on the y axis is noticeably faster than on the x axis, which is why I multiplied the horizontal input by 3.

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:
What is causing this problem with my object rotation? I'm having an issue here with rotation in OpenGL. Before I changed my rendering function the rotation I had for my object worked fine, but now it seems to be messed up.

I changed my rendering function because I wanted to be able to clip the image (render frames of the image), whereas before I was just rendering things on a 1 object, 1 image basis.

The rendering is fine, just the rotation to clarify that. Here's my current rendering code:

void DrawRotateAdv(int x, int y, int width, int height, float sourceX, float sourceY, float imageWidth, float imageHeight,
    GLuint texture, float angle, bool blendFlag)
{
    glTranslatef((GLfloat) x + (width / 2),  (GLfloat) y + (height / 2), 0.0);
    glRotatef(angle, 0.0, 0.0, 1.0);

    if (blendFlag)
    {
        glEnable(GL_BLEND);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    }

    glBindTexture(GL_TEXTURE_2D, texture);
    float texscaleX = 1.0f / (float)(imageWidth / width);
    float texscaleY = 1.0f / (float)(imageHeight / height);
    sourceX = sourceX / (float)imageWidth;
    sourceY = sourceY / (float)imageHeight;

    glBegin(GL_QUADS);

    // Top-left vertex (corner)
    glTexCoord2f(sourceX, sourceY);
    glVertex2i( (-width / 2), (-height / 2));

    //Bottom-left vertex (corner)
    glTexCoord2f(sourceX, sourceY + texscaleY);
    glVertex2i( (width / 2), (-height / 2));

    //Bottom-right vertex (corner)
    glTexCoord2f(sourceX + texscaleX, sourceY + texscaleY);
    glVertex2i( (width / 2), (height / 2));

    //Top-right vertex (corner)
    glTexCoord2f( sourceX + texscaleX, sourceY);
    glVertex2i( (-width / 2) , (height / 2));

    glEnd();
    glLoadIdentity();
}

I think that perhaps my translation is wrong? Unsure though, guess that's a stab in the dark on my part. As for the getting the angle:

     angle = atan2((cEnemy->position.y - (float)position.y), cEnemy->position.x -        (float)position.x) / 3.14159265f * 180;

But I don't think that's the issue, like I said it worked before-hand perfectly. Screenshot of the output:

sentences:
How can I convert between float3 and float2 in HLSL? I want to offload some 3D calculations to the GPU without raising my requirements to DX10.  Specifically, I am generating densities in 64x64x64 3D blocks, which fit nicely into 512x512 2D textures.  I would like to be able to convert my float2 texture coordinates to float3 values, so I can offset them, convert back to float2, perform lookups against my randomness texture, and interpolate the results manually.

This has been easy to do with integer values on the CPU side, but the GPU's texture coordinates are all floating points.  Is there an easy way to do this?  Or is there a way to coax pixel shader 3.0 into using something similar to 3D textures, so I can take advantage of automatic interpolation?

Another caveat is that I am using the Vector4 image format for my render targets (need better resolution in each channel) in XNA, so I am restricted to Point sampling.

sentences:
OpenGL multiple mesh management I've been working on coding a new 3D engine in Java. For the moment at least I'm sticking to openGL...

Currently I'm reworking how meshes get transformed and then drawn. ATM each mesh created has its own VBO and IBO along with its own draw method so if I wanted to draw multiple meshes it would look like this:

mesh1 = MeshLoader.loadMesh("cube.obj");
mesh2 = MeshLoader.loadMesh("pyramid.obj");

mesh1.addToBuffers(); //adds vertex and index data to vbo and ibo
mesh2.addToBuffers();

mesh1.draw();
mesh2.draw();

The draw method defined in class Mesh enables vertex attribute arrays, binds the bufffers, and then draws elements based on the ibo.

Then I send my projection matrix (transformation and perspective) as a uniform to the vertex shader.

QUESTION:

Games are made of many many meshes and each has to be identified so that transformation can be applied. I want to be able to apply transformations (translate, rotate, scale) directly to a given mesh, independent of the other meshes. In other words I want to move mesh1 and only mesh1 5 units to the right (on its own axis) without it affecting mesh2.
How do I do all this without making a million draw calls to the gpu?

Any advice appreciated.

sentences: Should all stats only exist on MySQL database for my Flash browser RPG? I'm creating a browser RPG in Flash which will have some multiplayer elements and in-app purchases so security is a high concern. Would it be better to have all game stats like health and such exist only in the MySQL database and retrieve them every time I need them? The game is turn based, but that would still require very frequent connections to the database. I could use local copies to cut down on the number of connections, but I imagine that would make it much easier for people to cheat.

sentences:
Why can't UObject derived objects call BlueprintFunctionLibrary functions? My question is a very simple one.

Why can't UObject derived classes (direct inheritance) call functions from Blueprint Function Libraries?

__

Edit:

My question relates to Blueprints only.

An Object derived Blueprint seems to be incapable of calling functions from an editor-created BlueprintFunctionLibrary

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:
In unity 5 export package is not working correctly I am using unity 5. I Created an objects with layer names. I tried to export a package. After Exporting, i import the package in new project and ran the project its not working. observed that objects layer name is missing for all the objects. i attached the screenshot with this.

Before Export :

After Import the Exported Package :

In layer drop down box no layer name was found. only the default layer name is available. if anyone knows the answer please tell me.

sentences: Don't Render always on top Unity world space canvas UI I have a World Space Canvas where I have a text object which is always rendering on top. I checked that it has UI/Default Shader attach. Is there any way available to not render always on top, the 3d UI text.? Any built-in or custom shader available to restrict it? I tried diffuse shader but now the text is not readable. I have also tried a shader from another post at gamedev but the problem is still persist.

sentences:
Check if coroutine crashed I can check if coroutine still running by setting boolean variable outside the coroutine and then letting the coroutine itself set the value to true when it runs and set it to false when it decide to stop .
But this method of detecting whether coroutine still active or not doesn't work when the coroutine crashed due to error (invalid input, null reference , ect) because the boolean variable remain true while the coroutine itself has stopped due to error.
How do i check if coroutine still running or not in current frame ? i can't spend my code checking for next frame .
Preferably C# , but answer in javascript also accepted.

sentences:
Gamma Space and Linear Space with Shader I am using Unity and I can choose between two color space mode in the settings: Gamma or Linear Space.

I am trying to build a Custom Lighting Surface shader but I am facing some problems with those Color Space. Because the render is not the same depending of the Color Space.

If I render the lightDir, Normal or viewDir I can see that they are different depending of the Color Space I use.

I made some test and the result I have in Linear Space is great but how can I obtain the same result in Gamma Space ?
Are there some transformations ? On what component should I apply those transformations ?

Thank you very much !

sentences:
Overlap detection does not work correctly when there is more than one warrior colliding with the tower I have a project where warriors are generated and they follow a route. In this route has a tower, when a warrior overlaps that tower, it takes 5 of it life, and he does it every 1 second.

Code of the moment of the collision of the warrior with the tower (Warrior Blueprint): Call Even Lose Life

Look that the moment he overlaps the tower, he starts to move towards it. After that he calls an event that is present in the blueprint of the tower.

Event that was called (Tower Blueprint): Execute Event Lose Life and call Event Attack Tower

This event causes the life of the tower to be shortened by 5. Soon afterwards it is called an event in the warrior that is colliding with the tower.

Event called by the tower (Warrior Blueprint): Execute Event Attack Tower and Call Event Lose Life

This event is only to be given a 1 second interval between each attack by each warrior. At least that was the idea.

I could simply loop in the blueprint of the tower and multiply the damage (5) by the amount of warriors colliding, but it does not seem right to me.

I imagine the problem is because the event in the tower (image 2 of question) is being called multiple times without even being finalized.

In the game, when there is only one warrior overlapping the tower, everything happens correctly:

1 second interval between images.

With more than one warrior overlapping the tower, tower life only decreases with the arrival of a new warrior. While a new warrior does not come to life he remains intact:

When in reality what should happen was each of them take 5 life per second. Then 3 warriors, 15 life per second.

The way I did these 15 lifetimes will not be taken away at the same time, as the warriors have come at different times.

Exemplifying:

Warrior 1 arrived in the tower at 15.2 seconds.
Warrior 2 arrived in the tower at 21.5 seconds.
Warrior 3 arrived in the tower at 32.8 seconds.

Then in the second 33 (moment where the three warriors have already arrived):

Warrior 1 will take 5 life from the tower at 33.2 seconds.
Warrior 2 will take 5 life from the tower at 33.5 seconds.
Warrior 3 will take 5 life from the tower at 33.8 seconds.

How to make the damage to the tower correctly applied, regardless of the amount of warriors?

EDIT 1 (Attempt made based on Stephen's answer)

Warrior Blueprint:

It works perfectly when it is colliding with only one warrior, when it reaches 1 more, life stops to decrease and decreases 5 for each new warrior that overlaps.

EDIT 2 (getting deeper into the tests)

Pretty much the same code as the first edition, with the difference that I added a print at the end of the loop (when it is finalized) and added another condition to take the test:

In the print will appear the actor's name + the word "acabou" + condition value.

In Game:

As soon as the second warrior overlaps the tower, the loop of the first and second warrior ends. This happens with both conditions.

The loop is ending incorrectly and I do not know why. Something is making the condition false.

Message Log:

sentences:
How to change something inside an switch statement? So my question is how would you draw a list of strings, and then if a case of the enum is a certain way, then draw them a different way? Here is an example of what I mean:

enum CurrentState
{
    Menu1,
    SubMenu1,
    SubMenu2
}
private CurrentState _currentState = CurrentState.Menu1;
public void Draw(SpriteBatch spriteBatch, GameTime gameTime)
{
    //Draw list here so it is always displayed in all cases
    switch (_currentState)
    {
        case CurrentState.Menu1:
        {
            //How would you erase the previous list and draw it in a different way here?
        } break;
        case CurrentState.SubMenu1:
        {
            //How would you erase the previous list and draw it in a different way here?
        } break;
        case CurrentState.SubMenu2:
        {
            //How would you erase the previous list and draw it in a different way here?
        } break;
    }
}

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:
in an ECS framework why are components indexed via their name rather than an Enum? I have been reading through a number of discussions on ECS framework and very often I see components being referred to via name rather than through a string object such as an enum or a struct.

I'm starting to build a test implementation myself and feel as though they should have a strong type rather than a string so that I can pick the component I am looking for from a list rather than 'guessing' with a string.

As an example you will often see:

Entity.GetComponent("Position");

rather than:

Entity.GetComponent(ComponentTypes.Position);

sentences:
WebSocketSharp For Unity I have integrated WebSocketSharp with Unity 2018.4.14f1 and it works well with Android and IOS. I wanted to know that most of the other socket.io plugins for unity have a wrapper of Class Packet over the top which binds and sends packetID, EventType along with Data.

My question is, do we need to write such a wrapper for WebSocketSharp also in Unity?

sentences:
Why is it that I’m still able to call a coroutine from another script, even though I marked it as private? I have this private coroutine in my WinDialogue script:

private IEnumerator ActivateStars(int count)
{
    for (int i = 0; i < count; i++)
    {
        _stars[i].SetActive(true);
        yield return new WaitForSeconds(.3f);
    }
}

And somehow I’m still able to call it from my UIManager script:

_winDialogue.GetComponent<WinDialogue>().StartCoroutine("ActivateStars", starCount);

How can that be if I marked it as private?

sentences:
How to implement a tractor beam? I'm working on a game where the player can pick up objects using something like a tractor beam, and carry them around.

Attracting the object towards the center of the beam is not difficult. But once the object is close enough to the center, I need to keep it there while the player moves, which is what I'm having problems with. I can think of two ways to do it, and both have issues:

Update the object's position whenever the player position changes, keeping it centered on the beam.
Update the object's velocity to point directly towards the center of the beam, the further away, the more velocity.

Moving and rotating works just fine with both approaches, but the physics are wrong when the carried object collides with other objects:

With the first approach, physics are completely ignored. The carried object just pushes anything out of the way. That is because position changes are only supposed to be done as part of the world physics, based on velocity.

With the second approach, physics basically behave how they should, but overreact. The problem is: In order to keep the carried object at the center of the beam even when rotating and moving, I need to use high velocity values. So once the carried object touches another one, it gets way too much velocity from the collision.

How can I implement this properly? My best guess right now is to go with the second approach and add special handling for carried objects to the world physics, reducing the velocity to sane values for collisions or when the player stops carrying them. But that seems like a pretty inelegant workaround.

Edit: Adding some pseudo code to illustrate how it works right now (that'd be the second approach above)

void attract_object(object, ticks) {
    Vector distance = beam_center - object.center;
    // If the object is not close to the beam center, attract it slowly
    if (magnitude(distance) > 10) {
        object.velocity += distance.normalized() * ticks * 0.1;
        return;
    }

    // Here comes the part we're talking about. That magic 0.5 is just high enough
    // that the object isn't lost while moving around. But it's still so high that
    // other objects are repelled with way too much force.
    object.velocity = distance * ticks * 0.5;
}

From what I see, this happens when the carried object pushes another object away:

The carried object collides with another object
The objects' velocities are distributes properly, so the carried object is pushed away from the center of the beam in the process
The code above causes the carried object to return to the center of the beam, with so much velocity that it'll get back there quickly
When the carried object moves back towards the center of the beam, half of its high velocity is transferred to the other object, repelling it violently. Since the initial velocity of the carried object appears to be sane, I can imagine that steps 2 to 4 are repeated multiple times, building up such a high velocity.

That appears to be the cause. I can't think of a nice way to fix it though :(

sentences:
Unity - PoolingSystem failing to instantiate I am wanting to spawn monsters into my scene in Unity. I was told to use a Pooling System, so I got the free one Unity offers in the Asset store. I have followed the little documentation that there is, and am encountering an error. I do not know if I am just missing something but I am getting an object reference not set error.

NullReferenceException: Object reference not set to an instance of an object
PoolingSystem.InstantiateAPS (System.String itemType) (at Assets/Advanced Pooling     System/PoolingSystem.cs:104)
MobSpawner.Start () (at Assets/_Scripts/MobSpawner.cs:16)

It throws this on the following code:

private PoolingSystem poolingSystem;

// Use this for initialization
void Start () {
    poolingSystem = PoolingSystem.Instance;

    poolingSystem.InstantiateAPS("Resources/EnemyPrefabs/Skeleton");
}

Could someone please guide me in the right direction or tell me what is wrong here?

sentences:
How to place a sprite in the center of the world in Phaser I am very new to Phaser. Here is what I did:

  <!DOCTYPE html>
  <html>
    <body>
    <script src="phaser.js"></script>
    <script>
        var game = new Phaser.Game(500, 500, Phaser.AUTO, '', {
            preload : preload,
            create : create,
            update : update
        });

        function preload() {
            game.load.image('dog', 'assets/dog.png');
        }

        function create() {
            game.stage.backgroundColor = "#1BDCFF";
            game.physics.startSystem(Phaser.Physics.ARCADE);
            game.physics.startSystem(Phaser.Physics.ARCADE);
            dog = game.add.sprite(game.world.centerX, game.world.centerY, 'dog');
            game.physics.arcade.enable(dog);
        }

        function update() {

        }

    </script>
</body>

Shouldn't the dog appear in the center of the "world"?
Here is how it looks like :

I then tried something like this :

var dogImage = game.cache.getImage('dog');
dog = game.add.sprite(game.world.centerX-dogImage.width/2, game.world.centerY-  dogImage.height/2, 'dog');

And now that I edited in this way the create function it does place the dog in the center. Is this the way of doing it or there's a more elegant way ?

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:
Time limit on puzzle games: yea or nay? Of course, it goes without saying that this can only work when the puzzle is randomly generated (say, something like minesweeper/bejeweled) and not hand-designed levels (such as trainyard, theseus & the minotaur etc).

I am currently thinking that this can instill a sense of urgency to the player and make them feel more challenged. Along with increasing the actual puzzle difficulty, a time restriction could be another way to increase difficulty, and the combination of both can be used as a way to give a sense of progress.

Also possibly, incremental time increases when solving parts of the puzzle (like time extensions in racing games) could be used for these games.

What I'm wondering about is, what's the accepted thought about using time limits? Would they work as I'm currently thinking or am I missing anything?

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:
Why isn't the bitangent calculated? In teh tangent space vertex attributes why is the bitangent (aka binormal) provided as an attribute instead of calculated?

If the three vectors of the tangent space must be perpendicular then the bitangent can be calculated as the cross-product of the other two vectors. There are technically two perpendiculars here, but surely we could consistently calculate the one we want, even if it requires a boolean marker to negate it.

Similarly the bitangent itself doesn't need a full vector to be represented. From the normal alone we know the plane on which the tangent must reside. In theory a simple angle would be enough to calculate the tangent vector.

Given that GPU memory is at a premium why do we provide the full vectors for these values rather than calculating them (with reduced data input)?  Or am I wrong in assuming the tangent space must be a cartesian system?

sentences:
Jumping up quicker? (Paper Mario style jump) As shown here, Paper Mario's jump takes 8 frames go reach the max jump height and 12 frames to get back to the ground. This is pretty unusual, any idea how to jump up that quick with a rigidbody?
I tried to AddForce when rigidbody.velocity.y > 0, but that didn't work out.
Any help would be appreciated, thanks in advance!
//Jump when pressing button and on ground
//jumpForce is a public float variable

if (Input.GetButtonDown("Jump") && isGrounded)
{
    theRB.velocity += new Vector3(0, jumpForce, 0);
}

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:
Windows-Linux cross platform game The answers to this cross-platform related question are useful, however I want my (C++) game to run on Windows and Linux (and be packaged for Ubuntu) only. I'm not interested in platforms like mobile or consoles.

Are there any specific tips or suggestions for this case?

Also, if I get the game to work on linux, is it difficult to add support for OSX?

Updating with more information:

It will be a 3D game simulating the motion of spacecraft in the solar system. We will use Ogre3D for the graphics. We're still in the design phase, so there's no code written yet.

sentences:
Unity - Inaccurate rotation if object is rotated on two axis at once I have an object which i want to rotate relative to world space. I have three variables (one for every axis) which store the rotation. By pressing buttons on my controller I add or subtract 90 to these variables (rotX, rotY, rotZ). Then I rotate my Object like this:

transform.Rotate (rotX * delta, rotY * delta, rotZ * delta, Space.World);

As this is called every frame the object would spin forever so i subtract the ammount I've allready rotated afterwards:

rotX -= rotX * delta;
rotY -= rotY * delta;
rotZ -= rotZ * delta;

This works fine as long as I don't rotate two axis at once. Then the object rotates rotates only partially to the desired position (e.g. 83 if I want to rotate to 90).

I can't see what I've done wrong. It actually seems like the moment I start an rotation around an axis all other axis get canceled. But if I monitor the variables they look exactly as they should.

Thank you in advance and have a amazing day!

sentences:
combining multiple materials into one material (Unity) I am confused with how should I texture my character.

I am using blender for modelling. And while my model is too complex I dont want to use uv map techniuqe. I can get what I need with using seperate materials. Therefore I assign different materials to different meshes in Blender then import it to Unity. Therefore I have lots of different material in one model and I think it increases draw call. What can I do to combine these material into just one.

I thought baking would be sollution but while my character is dynamic I can not get a good result.

sentences:
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:
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:
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:
Unity Trail for Eyes 2D i want to make some kind of an Eye Tail effect for this charakter:

I found the Unity Trail Renderer effect but the start of the Trial is perpendicular to the dragged/moved direction:

Can i make the start of the Trail look like the eye block of the charakter? So that if he move left or right, the Trail is only as width as the Eyes height and if the moves up or down, the Trail is correspondingly width. Or is there a better method for making a cool Eye Tail effect?

sentences:
does cocos2d cache texture automatically I know if we want the textures cached we can use the sharedtexture manager to cache them, but since this is on mobile platform , why don't cocos2d-x just do this for all texture loads ?

when creating sprites with images, are these textures cached as well ?

sentences:
x-inverted obj importer in BulletSharp - what's wrong? See [dead link removed] at the repository.

Screenshot:

[broken image removed]

Left: bullet imported version, right: correct 3ds max version.

It's somehow inverted. If you think that left part is just 180 degrees rotated you are wrong. Just rotate it yourself in Paint and you'll see - they will be different.

What's wrong with the bullet importer?

Usage:

        var wo = new WavefrontObj();

        int tcount = wo.LoadObj(path);

        Vector3 localScaling = new Vector3(1, 1, 1) * 1f;

        var vertices = wo.Vertices.Select(v => Vector3.Modulate(new Vector3(v.X, v.Y, v.Z), localScaling)).ToArray();
        var indices = wo.Indices;

        if (tcount > 0)
        {
            var trimesh = new TriangleMesh();
            int i;
            for (i = 0; i < tcount; i++)
            {
                int index0 = indices[i * 3];
                int index1 = indices[i * 3 + 1];
                int index2 = indices[i * 3 + 2];

                Vector3 vertex0 = vertices[index0];
                Vector3 vertex1 = vertices[index1];
                Vector3 vertex2 = vertices[index2];

                trimesh.AddTriangle(vertex0, vertex1, vertex2);
            }
            CollisionShape concaveShape = new BvhTriangleMeshShape(trimesh, false);
            CreateRigidbody(transform.Position, transform.Rotation, concaveShape);
        }

I tried to import with Assimp and got the same result. So the importer is correct but something inside the bullet mirrors it.

sentences:
Free animated character models for my first Unity game I am creating my first game in Unity for my intra-college game development competition. A hack and slash type of game. It's about a warrior who is escaping from a prison. Setting is medieval times.
Thing is, I am looking for 3 free (low poly) animated character models which are appropriate for this game.
1. The hero (has a sword, with optional shield)
2. Basic enemy guard (with sword/ hammer/ other melee weapon, no shields)
3. Boss (with melee weapon)
I searched for the above over the last couple of days, but couldn't find them.

My modeling skills are not such that I can create my own character models. However I have managed to create the game levels.
Now I am looking for some help with the character models.

Can anyone please link me to the appropriate free models?

Last date of game submission is March 8. So I need the models urgently. Please help.

P.S.  The game is slightly inspired by Prince of Persia: Warrior Within

sentences:
How to hide player when in Shadow using Unity 2D Light System? I have been looking for this for a couple of days now and cant find an answer; how can I hide a player when they are in the shadow when am using Unity 2D Light System? I know I can choose not to cast light on objects, but when I do it still shows the object in the shadow. What am looking for is hiding the player completely when they are in shadow, and when the light hits them it would reveal the player. This effect is in the game Among Us, I know that they are using some sort of shaders and they didn't have 2D light when they were developing it.
So am assuming this would be a shader as well where it would reveal the player when they are in the light and hide them when they are in the shadow. Below are pictures of what I have and what I want it to look like.
This is what I have in Unity

So you can see that the player is not hidden in the shadows, but rather its blacked out.
But this is what am looking to recreate:

You see how the top half of the body which is in the shadow is hidden while the bottom half is revealed because its in the light? This is the effect that I want to recreate.
Is there some sort of Shader or code that can do this? I really been looking for something like this for so long and couldn't find it. Any help will be really appreciated.

sentences:
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:
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:
Where is the part of the code of the mouse click in the TopDownCharacter blueprint? I have a project where by pressing the B key, the character after a time interval is teleported to a point on the map.

I can do this. It turns out that I imposed conditions so that at the end of the time interval the teleportation would be executed successfully.

For example:

Pressing the D key prevents the teleportation from happening.
Character moves around

It is as if the character must be meditating/channeling/motionless.

To do this correctly I use 2 variables:

varCanalizando => becomes true if the B key is pressed / becomes false if the D key is pressed or the character walks.
varInterrompeu => becomes true if varCanalizando is true and D key is pressed or the character walks.

Pressing the D key will cancel the meditating/channeling/motionless and the character will not teleport at the end of the time interval.

I can not identify the part of the blueprint that makes the character walk.

But I say almost certainly, that it's not in the TopDownCharacter default code.

The closest I got to something related to the mouse in the blueprint:

I suspect it may be in some of the TopDownCharacter components and I've tried something related based on this post:

https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/1455206-on-mouse-click-event-won-t-work

My attempt:

I consider it pertinent to inform that I have modified the standard click button from left to right, but I do not know if that is the cause of the problem.

I looked for the event in the component of the character that I found most suspicious, but none of them seems to me correct:

EDIT 1 (attempt)

I tried using the Right Button Mouse, but neither the print worked:

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 can I block Copy/Paste from Input Fields in Unity? I don't want the user to write a text by copying and then pasting the content to an Input Field, how can I do that?

sentences:
How to Fetch a Frame Number from Animation Clip I'm trying to find out how to fetch the frame number from an animation clip accurately. I don't want to get a value between 0 and 1 that shows as a percentage-as-a-decimal how much of the animation has played (example: 0.5 = the 5th frame of 10 frames) because it doesn't seem to be accurate. This also seems impractical, so is there a way to accurately fetch a frame number from an animation clip?

Thanks.

sentences:
OpenGL 2D Depth Perception I have a 2D RPG game written in Java using LWJGL. All works fine, but at the moment I'm having trouble deciding what the best way to do depth perception is. So , for example, if the player goes in front of the tree/enemy (lower than the objects y-coordinate) then show the player in front), if the player goes behind the tree/enemy (higher than the objects specific y-coordinate), then show the player behind the object.

I have tried writing a block of code to deal with this, and it works quite well for the trees, but not for the enemies yet. Is there a simpler way of doing this in LWJGL that I'm missing?

sentences:
Redefining the SDL rect struct Upon checking the docs of SDL (1.2) I saw that the SDL_Rect struct defines the x and y as Sint16. I'm making a bitmap font text scroller and I need those specifically to be unsigned ints because the text does need to go offscreen, yet still using the same struct because the SDLBlit method needs it. I tried creating my own and typecasting it as an SDL_Rect but that didn't work. Any ideas?

Also, to be more clear. The string of text scrolls to the left, therefore the first letter of my text does indeed go off screen but the rest doesn't. I assumed this was the problem.

for(int i=0;i<strlen(string);i++) {
  SDL_Blitsurface(bitmapsurface, rects[chars[i]], screen, destrect);
  destrect.x+=8;
}

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

This is my conversion code:

// get `orientation` from OpenVR controller sensor data

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

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

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

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

39.3851 5.17816 3.29104
39.3851 5.17816 3.29104

32.7636 144.849 44.3845
-147.236 35.1512 -135.616

39.3851 5.17816 3.29104
39.3851 5.17816 3.29104

32.0103 137.415 45.1592
-147.99 42.5846 -134.841

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

What am I doing wrong?

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

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

Some more examples of discrepancies:

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

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

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

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

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

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

GIF + video of the behavior:

Full video on YouTube

Visual representation of my intuition/current understanding:

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

sentences: 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 Outline shader in GLSL I have a simple prototype with 2D worms-like destructible terrain.
I use a trivial shader to discard pixels based on a mask.

varying vec2 v_texCoords;
uniform sampler2D u_texture;
uniform sampler2D u_mask;

void main()
{
    vec4 colour = texture2D(u_texture, v_texCoords);
    vec4 mask = texture2D(u_mask, v_texCoords);

    if (mask.a > 0)
        discard;
    else {
        gl_FragColor = colour;
    }
}

What would be a good and simple way to add few pixels thick black outlines to the terrain to make the carved parts look better?

I've researched something about edge detection algorithms, but my hunch says that such a fullblown thing would be kind of an overkill for this task?

I'm not after quality or high performance, but simplicity.

Thanks for any ideas.

sentences:
Adversarial Search AI having problems with too many choices I'm a game designer working with a set of coders trying to create a card game. Currently we're trying to implement a drawing mechanic in which you choose which card you draw, but the Adversarial Search AI can't keep up with that many choices and can only look two turns ahead without this new mechanic. I'm pretty set on finding a way to make this work, does anyone have and alternatives to fixing this problem?

I've tried reducing the space down to having only a few choices out of the deck, but the problems comes from the AI having to see what the player is going to draw. I'm pulling my hair over this problem, any thoughts?

sentences:
Unity's Box Collider isn't preventing an object from falling through the floor I'm working on a little "Tower of Hanoi" AR game in Unity using Vuforia, where the game is projected onto an image target.
Now I wanted to make the rings "fall" into place, so I added an invisible ground floor plane, with a box collider, and added mesh collider and rigid body to my ring.

Here are the settings:

Now there are quite a few questions about objects falling through the floor around and I tried many of the different suggestions (thickness of box collider, continuous instead of discrete collision detection,...) but none of them solved my issue.

Since this is my second little Unity project, I guess the issue is obvious (maybe my ring is too small (few centimeters) or something, but I'm not sure.

The problem is also, that I can't really see what is happening during runtime, since the camera has to find the image target first, after that the ring (currently testing only the bottom one) is gone and I just see the y-value of it's position changing.

Any help is much appreciated!

sentences:
How to check what part of an gameobject is seen by a camera? Could anyone please give me a hint on how to determine how much of an object is seen by a camera. There have to be a threshold value (e.g. 30% of an object is seen). If value is below the threshold then I don't cast rays otherwise I will do.
Now I am using WorldToViewPoint-function w.r.t. center of an object, but it doesn't working properly in my view.

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:
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:
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:
How can determine the number of instances of an object in Game Maker? I am making a small puzzle based game.  I want the number of instances of an object to be equal to the ammo count plus 2.

Each time a new room is loaded, the main object's creation method with run this script:

var ammo = instance_count(jellyfish)+2;

Then each time a bullet is fired, I subtract one. When there is no ammo left, the player goes to the 'failure' room.

However, I get the error: Unknown function or script: instance_count.

I have see this script on Google, but am not sure if it has deprecated or not. Is there a way I can do this?

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:
Examples of RESTful Web Services for Browser Games Can anyone point me towards examples of Browser Games / Browser Game Sites that use RESTful web services?

I have been convinced time and again that building web sites using RESTful principles is a good idea. And I agree.  But I just can't wrap my head around what RESTful means when the service you're providing is just a single (or a few) games.

Any ideas or thoughts would be nice, but I'd also love to see some solid examples.

sentences:
Can I take a finished game based on a licence to the holding company? Ok so I went through 11 pages on here and have done a decent amount of Google searching, but found nothing specific to my question. I'm working on a game based on a movie. For the purpose of this I'm going to use a different movie as my example. Let’s say I'm making a game based on "Driving Miss Daisy" (because why not?).

Now I've seen plenty of questions about taking an "idea" to a company (both game and rights holders) and trying to get funding but I have no reputation and this is a side project at this point so that's probably not a good idea. But let’s say I work on my "Driving Miss Daisy" game for a year or so and at some point call it "finished". It has good art, co-op, a campaign, and achievements (because, why not?) all made 100% by me and me alone. Does anyone know the process or the likelihood of me going to Warner Bros. and their games division with some kind of deal splitting profits if they allow the release or help with it etc etc.

Even if I hear "There’s no way, ‘Driving Miss Daisy: the Game’, while awesome, will never see the light of day", I'll probably keep working. I just wanted an idea of what kind of outcome could come from this and this is a different situation than I've generally seen asked. Like I said, most are about getting money for the development itself or trying to re-release old games that have been abandoned.

Thank you to anyone who might have information about this.

sentences:
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:
How to implement mutable functionality at runtime? I am making a game in which the player character can gain traits that change how their character behaves in my world model or add functionality to it. For example, the character might gain the "feather" trait that changes how fall damage is calculated or the "strong" trait that means the player can now pick up items that were previously just part of the scenery.

I have been hard coding traits in their relevant classes and switching a boolean to change behavior when they come into play, but it is getting rather unmanageable as my trait list grows.(I am also missing out on a lot of the emergence I was hoping to get) There must be a more scalable and decoupled way of doing this.

How would you code such a feature where code behavior changes or expands at runtime? If you are not inclined to do my work for me, which programming patterns would you use to achieve this kind of behavior?

sentences:
Volumetric Fog Shader - Camera Issue I am trying to build an infinite fog shader. This fog is applied on a 3D plane.
For the moment I have a Z-Depth Fog. And I encounter some issues.
As you can see in the screenshot, there are two views.
The green color is my 3D plane. The problem is in the red line. It seems that the this line depends of my camera which is not good because when I rotate my camera the line is affected by my camera position and rotation.

I don't know where does it comes from and how to have my fog limit not based on the camera position.

Shader

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

            uniform float4      _FogColor;
            uniform sampler2D   _CameraDepthTexture;
            float               _Depth;
            float               _DepthScale;

            struct v2f {
                float4 pos : SV_POSITION;
                float4 projection : TEXCOORD0;
                float4 screenPosition : TEXCOORD1;
            };

            v2f vert(appdata_base v) {
                v2f o;
                o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
                o.projection = ComputeGrabScreenPos(o.pos);
                o.screenPosition = ComputeScreenPos(o.pos);
                return o;
            }
            sampler2D _GrabTexture;

            float4 frag(v2f IN) : COLOR {
                float3 uv = UNITY_PROJ_COORD(IN.projection);
                float depth = UNITY_SAMPLE_DEPTH(tex2Dproj(_CameraDepthTexture, uv));
                depth = LinearEyeDepth(depth);
                return saturate((depth - IN.screenPosition.w + _Depth) * _DepthScale);
            }
        ENDCG
    }

Next I want to rotate my Fog to have an Y-Depth Fog but I don't know how to achieve this effect.

It seems that this is caused by _CameraDepthTexture, that's why depth is calculated with the camera position.
But I don't know how to correct it... It seems that there is no way to get the depth from another point. Any idea ?

Here is another example. In green You can "see" the object and the blue line is for me the fog as it should be.

sentences:
Raycast algorithm fails to collide with diagonal walls in specific locations I'm having a problem with my ray-cast algorithm in a 2D tile-based universe. I feel the situation would be best explained with a picture, so here it is:

The ray, represented by the blue line, is passing "through" the wall to hit its target when the wall passes through a point where the quantized line moves diagonally and the wall is perpendicular to it. The raycast function is as such:

def raycast(pos, direction, level):
    dx, dy = direction
    t=0
    x, y = pos
    obj=None
    while not obj and t < 5000:
        t+=1
        x+=dx
        y+=dy
        obj=level.get_at((round(x),round(y)),True)
        pass
    return obj

Is there a simple, efficient way to eliminate this kind of edge case?

sentences:
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:
Enum Vs. Integer for Skill Values I'm implementing a basic skill and attribute system, though I'm having second thoughts about how I should go about it.

For example, I could use a Dictionary/HashMap which uses SkillType enums to represent keys, and integer values representing the values. But should I do this?

public class Skills
{
    public IDictionary<StatType, Int> skills; //StatType is enum, being the key; the int //is the value.

}

vs.

public class Skills
{
    public int LongBlade, Armor, Marksman; //...etc
}

I'd like to know the benefits of type safety here, as opposed to just using basic integers. Any recommendations?

sentences:
How to animate material change to get a status bard effect, in unity Imagine a long cube, like a bar, that has a dark material, and you want to animate changing its material to a light material, but do it gradually from one end to the other, like filling up a tube, or like a progress bar that fills from one end to the other.
Is there a way to achieve this in Unity?
Or do you need to generate the animations in Blender or similar and control them in unity?

sentences:
How do I test my Octree implementation? I decided to use an Octree subdivision in my game. After implementing it, I do some research (a few tests and comparisons) and came up with several questions about.

The main question:
How to test my Octree implementation?
Are there some points that I must note while coding an octree? Is it possible to decide how my code works (good or not enough good) without actual game? Or it would be better if I test the Octree in real situation? Is it right to compare my C++ Octree with Octree implementation for other engines (as example I found C# one for Unity)?

sentences:
from where do i start to learn game ai Possible Duplicate:
  New to creating AI - where to start?

i have been programming 2-3 games till now. but i have not used ai in any of them...so can u please suggest good ebooks or net articles or tutorials on game ai...problems featuring shortest path, pathfinding etc...
Thankyou

sentences:
How to implement auto-aiming / auto-targeting We all know how auto-aiming or auto-targeting works in games.

Now, I need to find how to implement it in my game.

In fact I should implement it in UDK and I would be glad if anyone gave me more specific explanation for UDK. But conceptual explanation is also enjoyable and I'll implement it myself in my way.

sentences:
Multithreading: Each system on a different thread or a thread pool? I'm building a fairly involved game using OpenGL and C++. I've been thinking about how to implement multithreading, and the two options are:

1) Each system (Graphics, Audio, Physics, et cetera) gets their own dedicated thread that they run off of.

2) Implement a thread pool, that picks up a jobs from a queue (priority queue), executes it and gets re-inserted into the pool to wait for new available job.

I was wondering which one is generally considered better: in terms of performance, maintenance, scalability, code smell, et cetera.

sentences:
Design pattern for level editor modes? In a level editor that supports multiple editing modes, written in an oop language, how would you go about switching from mode to mode, considering that data itself remains the same?

I am using a MVC pattern like so.

A data model for the level's structure.
One model for the editor's state depending on the current editing mode and it contains data about the user's editing activities that was not applied or does not affect the level model (i.e what entities or item are currently selected).
A view for each mode (they all render similarly but differently cause they put emphasis on different items in the level).
Controllers accepting input and manipulating the state. These also differ from one mode to another.

The Controller accepts input from the user. It calls the corresponding methods on the State model which in turn modifies the LevelData. The controller refreshes the View after changes are made to the LevelData and State so these changes are properly reflected to the user.

Currently, to switch, I have all controllers inherit from a base controller that contains the mode switching capability. I have a class called AppContainer (each mode is like an app) that is being informed that a switch needs to be made. This class deactivates the controller and activates a new controller instead. The new controller refreshes the view and clears the state upon reinitialization.

I am wondering if there is a simple way to accomplish the same thing that I haven't though of.

I basically need to switch the Controller, the State and the View. HaxeFlixel does this pretty elegantly. Does anyone know how that is accomplished in high level abstraction?

sentences:
Things to do to port game made for iOS in Unity to Android? I have just made my first game for iOS and submitted it to app store. I was thinking of porting my game to Android also. I would like to know things one need to do/remember to port game made for iOS in Unity to Android. How to handle different screen resolutions and pixel densities, optimizations required, etc. Any other suggestions and important things you think I should know?

EDIT:
Also, should I handle builds according to device resolutions or by pixel density?

sentences:
In Unity, why does my IndexOutOfRange exception disappear when trying to debug it? I don't get errors when playing from Unity "Game" tab. But when I build an executable (development or not) it stucks. I get "IndexOutOfRange" exception.
Which also magically disappears (yes) when I add some debug lines:

This does not work:

for (int i = x1; i <= x2; i++)
for (int j = y1; j <= y2; j++)
{
    int a, b;
    a = 7 + i; // Out of range
    b = 7 + j; // Out of range

    submap[a, b] = world.WalkableMap[(int)CurrentWalkableTile.x + i, (int)CurrentWalkableTile.y + j];
}

This works:

for (int i = x1; i <= x2; i++)
for (int j = y1; j <= y2; j++)
{
    int a, b;
    a = 7 + i;
    b = 7 + j;

    if (a < 0 || a > 15) // now with this never gets out of range
        Debug.Log("A out of range: " + a);

    if (b < 0 || b > 15) // now with this never gets out of range
        Debug.Log("B out of range: " + b);

    submap[a, b] = world.WalkableMap[(int)CurrentWalkableTile.x + i, (int)CurrentWalkableTile.y + j];
}

I can't find any sense. The exception literally hides from me

Additional info maybe is useful:

x1 = (CurrentWalkableTile.x - 7) >= 0 ? -7 : -(int)CurrentWalkableTile.x;
x2 = (CurrentWalkableTile.x + 7) < world.wmap_x_size ? 7 : (world.wmap_x_size - (int)CurrentWalkableTile.x - 1);

y1 = (CurrentWalkableTile.y - 7) >= 0 ? -7 : -(int)CurrentWalkableTile.y;
y2 = (CurrentWalkableTile.y + 7) < world.wmap_y_size ? 7 : (world.wmap_y_size - (int)CurrentWalkableTile.y - 1);

I'd like to post more information, but I can't even debug to find the problem.

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:
Does a detailed texture take longer to render? Let's say I want to render a square; its texture is "square.png."

Is it easier for the computer to render it if the texture is just a plain color?

And what about if it is a very noisy texture with completely random colors here and there?

Or what if that texture is noisy in the sense that every pixel in it is different from one to another, but only by a tiny bit?

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:
Is my idea of how to use matrices to layer 2D on top of 3D correct? I'm new to using matrices, so I'd like some input on whether I've understood the use of them in the context described in the title.

Right now I have a small Direct3D 11-based game engine which renders a stack of scenes, or screens if you will, from bottom to top. I have a static 2D orthographic view-projection matrix that simply maps to screen coordinates from ( 0, 0 ) to ( screen width, screen height ). The position and resulting world matrix of the different entities are set with coordinates relative to this.

However, I'd like to expand on this by enabling different scenes to use different perspectives, so that I would be able to render a 3D scene with perspective, and then a flat 2D GUI on top of it. But since I'm very new to using matrices, I'd like confirmation on whether I have the correct idea of what will happen before I change things, because it takes a fair amount of work to refactor the engine with the way it is set up now.

Let's say I have Scene A as the 3D scene, and Scene B as my 2D overlay.

When entities in Scene A is rendered, the following matrices are passed to the shader:

View = camera position/orientation in the 3D world
Projection = perspective matrix with FoV, aspect ratio and near/far depth
World = the individual entity's position in the 3D world

Then, when I want to render Scene B, I pass these matrices instead:

View = identity matrix since the view is static
Projection = orthographic matrix with screen coordinates
World = the individual entity's position in the screen coordinate system

In both cases the vertex shader multiplies the matrices like so: world * view * projection

Is this correct? Will this draw my 3D scene as expected first, and then correctly draw the 2D elements relative to the screen coordinate system instead? Or have I misunderstood how the matrices work?

EDIT: scratch the question below; I found the answer under related questions...:
Should the modelview and projection matrices be calculated in the shader or on the CPU?

Original question:
And one more thing, would it be more efficient to compute the View-Projection-World matrix on the CPU end before passing it to the shader's constant buffer, or is the GPU better suited at receiving the three matrices and multiplying them on the shader side? I've seen both approaches used, but I haven't found any conclusions on which way is more practical/efficient. I have two constant buffers by the way, one with the View and Projection matrices which is updated once per scene, and one with the World matrix updated for each individual entity, so the memory bandwidth savings would be insignificant if I moved the multiplications to the CPU instead. But would that be faster in theory, and are there any eventual drawbacks to this?

sentences:
Loading Bitmap by name in Android Currently, I'm loading images as follows:

sampleimage= BitmapFactory.decodeResource(context.getResources(), R.drawable.sampleimage);

This automatically chooses the correct image from the drawable-hdpi, drawable-mdpi or drawable-ldpi folders.

How can I load the bitmap using the image name as the string "sampleimage.png"?

sentences:
How do games on Windows locate libraries? I've always wondered how games handle libraries. What if you want to use a dynamic library in a game, let's say OpenGL.

You could just put it inside the /lib folder on Linux(-like), and have everything working properly; even better, on Debian systems you could just set it as a dependency.

How does this work on Windows?
There is no clear /lib directory, where do you put it?

Obviously you cannot ask the user to manually install the libraries!
Do you simply create a folder for it somewhere and add that to the PATH environment variable?
Or do you first check where other programs might have put it?

Is there a 'standard' to do this?

sentences:
How can I protect beta test versions of my game from piracy? I want to open my game for public feedback and testing quite early as such certain features like steams coming soon might not be available.

How could I protect my game against being pirated around from testing?

Even if we dis-regard piracy I'd not want the testers running random copies of the game whenever etc.

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:
If I want to create game for mobile and tablet on android and ios, which aspect ratio or screen resolution should I use? Now my game is currently use 3:4 aspect ratio ,which is 480*640
, so my game has the letterbox (I don't like stretch) on my android mobile and my friend mobile. I don't like letterbox, so I have just change color of my letter box to the color that blend with my game background, but I don't like it either. So now I think about change aspect ratio and screen resolution of my game.

how about 480x800 ?

sentences:
How to retrieve vertex information from ID3DXMesh I need to know the position of each vertex (and triangles) from a mesh (a pointer to ID3DXMesh, created by calling functions like D3DXCreateBox, D3DXCreateTeapot and D3DXCreateSphere) to perform some collision detection.

I've tried using GetVertexBuffer() and GetIndexBuffer() but I don't know how to use the structures to retrieve point data in the world coordinate system. How can I achieve that?

sentences:
python for game development Possible Duplicate:
  Famous games written in Python

Is python any good for game development? Can I have some examples of great indie python games.

So I can have an idea what it's capable of?

I'm looking for games which are on a realistic scale for one person.

thanks.

sentences:
How can I make car respawn with temporary invulnerability i.e. no collisions? I'm using Unity's standard assets scripts to move my car, but the camera just follows the road.

At certain moments when the car misses or overturns the player can press 'R' to reposition the car in the middle of the road in the position where I miss or turn over.

When the car respawns, it should not collide with other cars in the race, for a few seconds. After those few seconds everything returns to normal.

I thought about using layers, but I did not find how to modify the "Layer Collision Matrix" dynamically from a script. How do I do that?

sentences:
Unity - Particle System Shuriken - Setting particles in code with random row in texture animation? Good day, I'm attempting to randomly generate a space scene (quite large actually) in Unity through C# code mainly. So far, I've gotten stunning results up to what image #2 will show you. However, now I'm looking to expand the look with more random particles. So, I've made a texture atlas of 8 in a vertical row, which works on the random setting if you have an emitter and the particle system is called with PS.Play();

Assigning different materials would only work on a per particle system basis(which would be new texture PER cloud, so to speak) which is not what I want. So, my question:

How can I use the Shuriken Particle System's Texture Sheet Animation functionality through code, without having an "active" particle system? More precisely, I wish to use the 'Random Row' feature of it to assign random textures to each particle.

Since I can't share my code (due to policies), here is a bit more info on how I do it:

I create an array with coordinates for each cloud.
Assign a particle system to that cloud.
Randomly generate all the particles for the cloud with relative offsets.
Use PS.setParticles(particlesArray);

Using a Texture Atlas consisting of the letters A to H to test, only B showing on all particles.

Using a Texture Atlas consisting of the fog particles to test, only 2nd showing on all particles.

Thank you @DMGregory for the help, I've tested it multiple times and it works perfectly now, I've also went ahead and tweaked a few of my settings just to get a more "clear" space:

sentences:
Timebased transition from start to end value I'm trying to implement time line objects, the purpose of those would be to issue events at specific times. When and what is specified through objects called units, which is what you attach in the time line.

Got two types of time units, Action and Transit. Action counts to the end of the time unit, then issue whatever event with provided values intact.

My problem is Transit, which, frame by frame, modifies provided value(s) by multiplying time ratio before issuing the event.

I calculate ratio as: (in pseudo code)

ratio = (counter += delta time) / unit end time

My issue is that I keep getting either different results, or unbalanced progress, like adding 90% of the value quick then the last 10% of value at a much slower phase.

I've tried something like (in pseudo code) so far:

delta value = (end value - earlier delta values) * ratio

for each new frame.

Not sure how to put this together, so could really use a few pointers on this. Hope I made myself clear.

PS. I'm doing this in JavaScript, I know JS isn't the most accurate language when it comes to precision numbers, but it should be able to handle something like this.

Thank you in advance.

sentences:
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:
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:
Best way to test if some point on a line if in front of another point on the same line in 3D I have a line in 3D defined by point P0 and direction vector D.
For given input point P on a line defined as above, I want to test if P is in front of point P0. The code will be used in GLSL fragment shader.

So far, my best solution is following GLSL function:

bool IsInFront(vec3 P, vec3 P0, vec3 D)
{
  float d = length(P - P0);
  vec3 Pp = P0 + d * D;
  return (length(Pp - P) < 1.0E-4);
}

Explanation is simple. d is distance between P and P0, and there are only two possible positions on a line where a point with distance d from point P0 can be on a line: in front, or behind point P0. Then I just check if positive point is same as input P.

However, this code uses precision 1.0E-4, and recalculation of input point P. Is there a faster and numerically more stable way to do this?

Regards

sentences:
Creating materials in modeling program vs in Unity: when to do either? This is something I should know the answer to by now, so I'm asking to clear up the gaps in my knowledge:

As I (re)learn about shaders, specifically in relation to Unity, I see all sorts of ways to create shaders/materials from within Unity to achieve various visual effects. (using Shader Forge / Shader Graph / manually writing ShaderLab or other shader languages).

I'm also aware that you can create shaders/materials from 3D modeling programs such as 3DS Max.  My questions are: When would you choose one method over the other, or could you use both in conjunction?  What is a normal workflow?  Does material creation in Unity offer context-specific features that are not supported by modeling programs?

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:
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:
How to calculate a score algorithm based on elapsed time? I'm trying to calculate an alogirthm based on elapsed time to calculate score based on a music beat.
I have the music beat divided into 4 because that's the time measure of that beat.
So If the user presses the correct key at the third beat, which is of course when the perfect beat would be, I'd like it to obtain the best score.
I've tried doing this:

score=percent(bpmt.elapsed,bpm/3);
int scoref(int int1,int int2) {
return int1*100/int2;
}

bpmt.elapsed being how much time was elapsed between the start of that beat and the time that the user  pressed the key and bpm being the total number of milliseconds of that particular beat.

Can anyone tell me a better way to do this please? I think it requires more advanced math and it's kind of beyond me.

sentences:
Why does my blur shader implementation produce this strange result? I tried to implement the blur shader shown here.

Instead of having a simple 2D texture I use Unity's GrabPass function to capture what's behind the plane to have a transparent effect. Then I apply this on a 3D plane:

struct v2f {
    float4 pos : SV_POSITION;
    float4 screenPos : TEXCOORD3;
    float3 uv;
};

v2f vert(appdata_full v)
{
    v2f o;
    o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
    o.screenPos = ComputeScreenPos(o.pos);
    o.uv = UNITY_PROJ_COORD(o.screenPos);
    return o;
}

// In the frag part there is the shader blur computation but based on XYZ, with Z = 0

Then I apply the blur and this leads to this when I zoom in:

Is there a way to avoid this effect?

sentences:
Armor VS Weapon types I have these armor types:

LEATHER
MAIL
PLATE

which are, basically, light, medium and heavy, and these weapon types:

BLADE
PIERCE
BLUNT

I need a sensible 3x3 table which tells what armor type is succeptible to (and, possibly, good against, though it's not necessary) which damage type. In other words, how good the mail armour actually is against pikes/arrows, etc... Any ideas?

P.S. Wikipedia search and personal gameplay experience didn't help me too much, as both are mostly concluding: the heavier, the better.

sentences:
libGDX - Scene2d Actions or Frame Animation, which is better for performance? I only use Scene2d for the UI layer of my libGDX game. But I need some animations like fading or rotating on my players.

Which is better for performance:

Scene2d fade action or having multiple frames with different opacity and using them in the Animation class?

Also scene2d rotate action or having multiple frames with different angle?

Thanks!

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:
Using idle time in turn-based (RPG) games for updating If you take any turn based RPG game there will be large periods of time when nothing is happening because the game is looping over 'wait_for_player_input'. Naturally it seems sensible to use this time to update things.

However, this immediately seems to suggest that it would need to be threaded. Is this sort of design possible in a single thread?

loop:
if not check_something_pressed:
    update_a_very_small_amount
else
  keep going

But if we says 'a_very_small_amount' is only updating a single object each loop, it's going to be very slow at updating.

How would you go about this, preferably in a single thread?

EDIT: I've tagged this language-agnostic as that seems the sensible thing, though anything more specific to Python would be great. ;-)

Second edit: This game is not planning on having any animated components; that is, I'm currently running it as a wait-for-player-input then update everything and draw. So rather than X FPS it depends on the user's speed.

sentences:
Heightmap vertex list to vertex + index list Right now I'm trying to load a heightmap into my LWJGL application. I load it like that into a float[][] array and I can read the height value at a given x and z position in the map:

public class HeightMap
{

float[][] heightMap;

public HeightMap (String fileName)
{
    int height, width;
    try
    {
        BufferedImage image = ImageIO.read(getClass().getResourceAsStream(fileName));
        heightMap = new float[image.getWidth()][image.getHeight()];
        for (int x = 0; x < image.getHeight(); ++x)
        {
            for (int z = 0; z < image.getWidth(); ++z)
            {
                heightMap[x][z] = new Color(image.getRGB(x, z)).getRed() / 255f;
            }
        }
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
}

My problem is that I don't understand how to create the float[] vertices and byte[] indices arrays that I can pass to the vao and iao(and also texture coords (tco)).

Hope you can help me,

bebe

sentences:
Changing AnimationOverrideController "sometimes" fails - Unity 5.2.1 I have the following code, in a menu where you can chose the armor and weapon of a character:

private List<string> armors = new List<string> { "armor1", "armor2", "armor2" };
private List<string> weapons = new List<string> { "weapon1", "weapon2", "weapon3", "weapon4", "weapon5", "weapon6", "weapon7", "weapon8", "weapon9" };

private int  armor_index = 0;
private int weapon_index = 0;

public GameObject avatar_body;
public GameObject avatar_weapon;

void Update() {
         if (Input.GetKeyDown(KeyCode.RightArrow)) nextArmor();
    else if (Input.GetKeyDown(KeyCode.LeftArrow))  previousArmor();
    else if (Input.GetKeyDown(KeyCode.DownArrow))  nextWeapon();
    else if (Input.GetKeyDown(KeyCode.UpArrow))    previousWeapon();
    else if (Input.GetKeyDown(KeyCode.Return))     loadLevel();
}

void nextArmor() {
    if (armor_index < armors.Count - 1)
        armor_index += 1;
    else
        armor_index = 0;

    setArmor();
    setWeapon();
}

void previousArmor() {
    if (armor_index > 0)
        armor_index -= 1;
    else
        armor_index = armors.Count - 1;

    setArmor();
    setWeapon();
}

void nextWeapon() {
    if (weapon_index < weapons.Count - 1)
        weapon_index += 1;
    else
        weapon_index = 0;

    setWeapon();
}

void previousWeapon() {
    if (weapon_index > 0)
        weapon_index -= 1;
    else
        weapon_index = weapons.Count - 1;

    setWeapon();
}

void setArmor() {
    avatar_body.GetComponent<Animator>().runtimeAnimatorController =
        Resources.Load("AnimationControllers/player/"+armors[armor_index]+"/body" ) as AnimatorOverrideController;
}

void setWeapon() {
    avatar_weapon.GetComponent<Animator>().runtimeAnimatorController =
        Resources.Load("AnimationControllers/player/"+armors[armor_index]+"/"+weapons[weapon_index] ) as AnimatorOverrideController;
}

The problem is when I start switching between the weapons, sometimes the sprite showing does not update. Inspecting the GameObject, it is weird, because the Animator Component has successfully updated, but the Sprite Renderer still shows a fixed sprite from the last Animator.

Here are 2 examples:

Here we see that the animator is set for the weapon Gladius, and that the Sprite renderer is looping through all the frames of that animation

Here we can see that even though we have moved to the Flanged mace animator, the Sprite Renderer is still stuck on a sprite of Gladius

The problem is hard to recreate, because it happens just SOMETIMES. If I were to switch back to gladius and then once again back to flanged_mace...

Now it works... but I didn't change anything.

What is going wrong??

sentences:
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: 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:
Compute world position by walking N units along spline? My goal is to move ahead along a spline 'x' world units, unfortunately there is no way to map spline points to world points.

What I do is I iterate along the spline by a small alpha amount (say 0.001), get the new spline point vs the old one and add the difference to a total up until it equals or is slightly greater than the distance I wanted to move in world space.

This works fine but there is a huge bottleneck with the sqrt, basically to calculate the distance between two vector points you need to do a square root calculation.

I feel it should be possible to just get the squared value and just use that, unfortunately I can't get the code working, here is what I have:

Where _distance is the amount to move, Distance is the alpha value along the spline.

        float distanceMoved = 0;

        float oldDistance = Distance;

        while (distanceMoved < (_distance))
        {
            Vector3 before = Position;
            float oldAlpha = Alpha;
            float oldDist = Distance;
            Distance += _iteration;

            distanceMoved += (before - Position).magnitude;
        }

Notice the line with (before - Position).magnitude, the .magnitude property performs a square root.

I've tried changing it to .sqarMagnitude and say distanceMoved < distance * distance but it has accelerated the rate of movement forwards.

Any ideas what is going wrong or how I can get rid of the square rooting or do this differently entirely?

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:
Grid-Based 2D Lighting Problems I am aware this question has been asked before, but unfortunately I am new to the language, so the complicated explanations I've found do not help me in the least.

I need a lighting engine for my game, and I've tried some procedural lighting systems. This method works the best:

if (light[xx - 1, yy] > light[xx, yy]) light[xx, yy] = light[xx - 1, yy] - lightPass;
if (light[xx, yy - 1] > light[xx, yy]) light[xx, yy] = light[xx, yy - 1] - lightPass;
if (light[xx + 1, yy] > light[xx, yy]) light[xx, yy] = light[xx + 1, yy] - lightPass;
if (light[xx, yy + 1] > light[xx, yy]) light[xx, yy] = light[xx, yy + 1] - lightPass;

(Subtracts adjacent values by 'lightPass' variable if they are more bright) (It's in a for() loop)

This is all fine and dandy except for:

The system favors whatever comes first in the for() loop

This is what the above code looks like applied to my game:

On the left side you can see some weirdness going on:

The loop goes top to down then to the right column:

This is how the for() loop goes:

Light provided from my mouse, should be a full light, but is only half:

If I could get some help on creating a new procedural or otherwise lighting system I would really appreciate it!

sentences:
How to disable touch in Quintus? I'm  trying to build card game using the Quintus game engine. I have objects called Card. I can touch and drag it in the screen but I want just to touch and drag it one time but I can't figure out how to disable the touch after I dragged the card and I try to Google it but no luck.

My code:

Q.Sprite.extend("Card", {

init: function(p){

    this._super(p,{
        asset: "Queen_OF_Hearts.png",
        x: Q.el.width / 2,
        y: Q.el.height - 120
    });

   this.on("drag");
   this.on("touchEnd");
},

drag: function(touch) {
   this.p.dragging = true;
   this.p.x = touch.origX + touch.dx;
   this.p.y = touch.origY + touch.dy;
 },

touchEnd: function(touch) {
   this.p.dragging = false;
   // put a line on the screen if the card pass it put the card in the new position if not put the card in the orginal(old) postion
   if(touch.origY + touch.dy > Q.el.height - 200) { //define the line that the card should pass if the amount of draged > the screen line in Q.el.height - 200
       // put the card in the same old postion if is not pass the line
       this.p.x = touch.origX;
       this.p.y = touch.origY;

    } else {
        // put the card if it pass the line in the new postion
        this.p.x = Q.el.width / 2;
        this.p.y = Q.el.height - 280;

    }
}
});

so in the else statement in the touchEnd I'm trying to do some thing like that

this.p.touch = false;

but is not working.

sentences:
How do you use your own tileset in Tiled? I'd like to create a 2d platformer and I understand that using tiles helps you a lot.

I think many use the map editor "Tiled" but I can't find anywhere how do you make your own tileset from a given image that you created.

I spent most of today searching a reference for this on Google, without much luck..
The only hint comes from a couple of python scripts, but I didn't manage to make them work
Am I missing something?

sentences:
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:
Monogame crashes without any change I've written a game in MonoGame, which works great on my desktop computer. It's running Windows 8, has a good graphics card and can be assumed to be up to date with everything.

However, when I run on my laptop, it crashes within the starting function game.Run(). I created a new template project, and it still crashes. I've check the obvious places, it's running x86 config, I've installed the openAL, and the dlls are in the right places.

The error is "NullReferenceException" occurred in MonoGame.Framework.dll

I can't post images, but I've changed nothing about the new project. It runs the init and the loadContent functions, then crashes.

The thing that might be important, the laptop has openGL 2.1, Windows 7. I have OpenTK, OpenAL installed. If anyone has even suggestions on things that might be the cause, or want more info, just say.

EDIT: The stack is as follows:

at Microsoft.Xna.Framework.Audio.OpenALSoundController.Update()
at Microsoft.Xna.Framework.OpenTKGamePlatform.BeforeUpdate(GameTime gameTime)
at Microsoft.Xna.Framework.Game.DoUpdate(GameTime gameTime)
at Microsoft.Xna.Framework.Game.Tick()
at Microsoft.Xna.Framework.OpenTKGameWindow.OnUpdateFrame(Object sender, FrameEventArgs e)
at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
at OpenTK.GameWindow.OnUpdateFrame(FrameEventArgs e)
at OpenTK.GameWindow.OnUpdateFrameInternal(FrameEventArgs e)
at OpenTK.GameWindow.RaiseUpdateFrame(Stopwatch update_watch, Double& next_update, FrameEventArgs update_args)
at OpenTK.GameWindow.DispatchUpdateAndRenderFrame(Object sender, EventArgs e)
at OpenTK.GameWindow.Run(Double updates_per_second, Double frames_per_second)
at OpenTK.GameWindow.Run(Double updateRate)
at Microsoft.Xna.Framework.OpenTKGamePlatform.RunLoop()
at Microsoft.Xna.Framework.Game.Run(GameRunBehavior runBehavior)
at Microsoft.Xna.Framework.Game.Run()
at Mojo.Program.Main(String[] args)

Posted as an error report to MonoGame, I'll answer this depending on their response.

sentences:
Finding shapes in 2D Array, then optimising I've just been allowed an image...The image below from my game shows some darkened blocks, which have been recognised as being part of a "T" shape.  As can be seen, the code has darkened the blocks with the red spots, and not seen the "T" shapes with the green outlines.

My code loops through x/y, marks blocks as used, rotates the shape, repeats, changes colour, repeats.

I have started trying to fix this checking with great trepidation.  The current idea is to:

loop through the grid and make note of all pattern occurrences (NOT marking blocks as used), and putting these to an array
loop through the grid again, this time noting which blocks are occupied by which patterns, and therefore which are occupied by multiple patterns.
looping through the grid again, this time noting which patterns
obstruct which patterns

That much feels right... What do I do now?

I think I would have to

try various combinations of conflicting shapes, starting with those
that obstruct the most other patterns first.How do I approach this one?
use the rational that says I have 3 conflicting shapes occupying 8 blocks, and the shapes are 4 blocks each, therefore I can only have a maximum of two shapes.

(I also intend to incorporate other shapes, and there will probably be score weighting which will need to be considered when going through the conflicting shapes, but that can be another day)

I don't think it's a bin packing problem, but I'm not sure what to look for.  Hope that makes sense, thanks for your help

EDIT Despite clarity of question, everyone seems to have understood, yes,

I want to find the maximum "T" shapes within each colour

(because if I gave you points for two and you had made three, you'd be a bit annoyed)

sentences:
Is there a 3D animation tool that meets these requirements? I'm searching a 3D physics / transforms animation editor. It should be able to import 3D meshes from OBJ or FBX, then it should be able to animate transforms. I need such a tool for my 3D games, where many dynamic and inorganic elements appear, like doors, traps, robots, lifts, and so on.

Where I can find such a tool?

sentences:
Approximating a fourth point with a weighted average between three points? Given three points \$p_1,p_2,p_3\$, how would one approximate the best positive weights \$(u, v, w)\$ such that \$u+v+w = 1\$ and that the distance between the new \$up_0 + vp_1 + wp_2\$  from \$p_3\$ is minimal?
Basically, the enemy's unit is positioned between several "bases" on a 2d plainand it's easy to tell which is closest or even find the "weights" between two bases \$(t, 1-t)\$ to compute the relative fractions (eg. 0.3, 0.7). How does one find the optimal weights for three surrounding points?

sentences:
What is the cleanest way to code predictable client/server components Lots of classic games that I've read the source code to do things like

if (clientside)
    // ...

or the same but with serverside. The code is littered with this and it becomes an extreme nightmare to test. This is especially so when the games I've looked at all happen to use global variables for the above so testing goes out the window, and I am fortunate enough to be able to write tests for such things (hobby projects with no time constraints!)

I'm at a point where I need to care about this now (especially with having to deal with prediction and actions, scripts, etc, in a level). As such, I've gone searching for how people architected solutions to this problem such that there was the ability to have clientside prediction of some stuff, while preventing the code from becoming a gigantic series of if statements strewn about everywhere.

What is the best way to approach this? I am willing to trade a bit speed for clean code with good OOP. Is there a good example that I can learn from? Or am I stuck with littering if (client/serverside) everywhere?

Ideally I want to write the least code possible, write it in the cleanest way possible, and have something that I can easily reason about without having a ton of branching thinking "ok what if condition A, not B, C and D, not E" when trying to figure something out.

I've been trying to see if there's a way to make some kind of common base class which shares all the code between them, and then making a bunch of abstract methods that either the Client implementation or Server implementation would do their own stuff on top of it, but part of me is worried that because I've neither done anything like this before nor seen anyone ever do it this way, I'm scared of wasting a significant amount of time on something that may be architecturally bad. This is primarily why I'm posting this.

In short: What is the cleanest way to architect the code? Are there any examples or articles I can learn from?

Edit: The code should all be in one binary, so people can host a multiplayer server from an offline experience.

Note: This question is completely different from how to do prediction, unlagged, etc, and as such is not about that (and I already know exactly what I need to do). It's about the implementation of such things such that I can write a client that supports predicting and server code that reduces the amount of duplication as much as possible.

sentences:
How to implement a lightmap I saw this answer and I got what he has done, but how do I create a lightmap same as this one?

thanks in advance!

(from what lightmap should be built from (array?) and how do I calculate a lightmap like this?)

sentences:
What's the best way to handle slopes for a platfomer game using Box2D I would like to know if there is any known solution for handling the player's movement on slopes using Box2D engine.

I tried to do it using a circle as the player. Everything was fine until I tried to walk on slopes, the main problem is that due to gravity, the circle does not stop on the slope.

Please if somebody has tried this before I'll appreciate it. If you have a better solution without the physics engine would be fine for me too.

Thank you.

sentences:
I cannot save my game data on Godot Engine I'm trying to save my game on Godot Engine by pressing a "save" button but I get this message error when i do:

  Attempt to call function 'get_nodes_in_group' in base 'null instance' on a null instance

this is my project code:

#File.gd, contains the methods to write and read over the file
extends Node

var path_name := "res://resource/debug/save"
var file := "sav.tres"

class_name WriterReader

func write():
    var writer := Save.new()
    var directory := Directory.new()

    writer.version = ProjectSettings.get_setting("application/config/Version")
    for node in get_tree().get_nodes_in_group("persistance"): #it's  the line that thows the error
        node.save(writer)
    print(writer.version)

    if not directory.dir_exists(path_name):
        directory.make_dir_recursive(path_name)

    if ResourceSaver.save(path_name.plus_file(file), writer) != OK:
        print("ERROR")

#the save button gdscript file
extends Button

func _ready():
    var save = Save.new()
    self.connect("pressed", self, "save_game", [save])

func save_game(save):
    var s = WriterReader.new()
    s.write()

#it's the part of code where of the player character is saving
extends KinematicBody2D
...

func save(write: Resource):
    write.dat = {"position": position, "health": health}

#sav.gd, singleton used to save the player data

extends Resource

class_name Save

var dat : Dictionary = {}
var version := ""

I'm a beginner on Godot so I cannot figure out why this happens.

could somebody explain me, please?

Thanks

sentences:
Unity WheelCollider motorTorque acceleration with ps4 triggers I'm fairly new to Unity and i'm struggling to find some answers. Every car script and wheelCollider tutorial I can find is based in the horizontal and vertical axis and that works great. But I'd like to move the car while holding a trigger and brake the car while holding another trigger (ps4 controller. Inputs are already mapped and working), but I need some help on that.

This is the part of the script that handles the acceleration:

 float motor = maxMotorTorque * Input.GetAxis("Vertical");
 foreach (AxleInfo axleInfo in axleInfos) {
     axleInfo.leftWheel.motorTorque  = motor;
     axleInfo.rightWheel.motorTorque = motor;
 }

Is there anyone that can point me in the right direction or possibly provide some example scripts?

Thanks in advance.

sentences:
opengl bump mapping (normal mapping) problem with VBO and GLSL hi i am beginner i am trying to implement bump mapping with vbo and glsl.
My question is: did i make bump mapping ? if i did why these edges didnt disappear ?

high and low meshes (i used low meshes of course)

sentences:
Enemy movement in straight line to player in chase game I'm creating a game where the enemies spawn randomly on a map then move towards the player every frame at a random speed. The map has no obstacles so the enemies should always move in a straight line. I wrote the movement function a few times but no matter what the enemies always hit 0, 45, 90, 135, 180, 225, 270, 315 angles but never a straight line. Here is an example of the code:

    base_speed = random();

    diff_x = abs(enemy_y_pos - player_x_pos);
    diff_y = abs(enemy_x_pos - player_y_pos);
     if (diff_x > diff_y) {
      y_speed = base_speed;
     } else if (diff_y > diff_x) {
      x_speed = base_speed;
     }

     if (enemy_x_pos < player_x_pos) {
      velocity.x = x_speed;
     } else if (enemy_x_pos > player_x_pos) {
      velocity.x = -x_speed;
     } else {
      velocity.x = 0;
     }

     if (enemy_y_pos < player_y_pos) {
      velocity.y = y_speed;
     } else if (enemy_y_pos > player_y_pos) {
      velocity.y = -y_speed;
     } else {
            velocity.y = 0;
    }

    enemy_x_pos = enemy_x_pos + velocity.x;
    enemy_y_pos = enemy_y_pos + velocity.y;

This is my first attempt at game programming. I guessing it's should use algorithm like Bresenham’s Line( http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm) but my attempts to implement have the same issue. How do I make enemies move in a straight line?

sentences:
How should I design my score to visually accommodate large numbers? I am creating a simple punching game that counts the total number of punches dealt.

Could you suggest a way for my game to visually accommodate very large numbers (>100000). Currently my wire-frame looks like this:

How should I display very large numbers here? I thought about shrinking the fonts, and creating abbreviations, but I'm not sure it's the proper way to go.

sentences:
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:
How to annotate a BinaryFormatter packet with a header describing its length? I am working on a project that is sending data from pc to tablet via usb, using android adb. To serialize the data, we are using BinaryFormatter. The problem I'm running into is that the client is sending packets of size 1161 bytes.
Now I could hard code in 1161 as the length of the byte array on the receiving in, and this would fix my problem. But what I would rather do is put the length in the header of the packet being sent, so the receiving end can check that and create the packet according to the size, just incase we get a different packet type of a different size.
However, BinaryFormatter also encodes the names of the fields, so as far as I can tell, you can't determine the length the object will be before serializing it, at which point, it's too late to set the length property in the header.
Does any one know a solution to this that will elegantly handle different packet sizes, and packets over the size of 1024 bytes? Thank you!

sentences:
When creating a game engine, how should I define the position of objects? I'm building a custom game engine, in C++ using SDL, and I'm not sure how I should define the position of my game objects. I tried googling a bit, but I wasn't sure how to refine my search terms to get what I'm looking for.

Should I define the position (x, y) of my object to be the top left of the object, for ease of rendering? Since my game is tile based, it also makes sense to have the position of the tiles as the top left position.

Perhaps I should define it to be the center of the object, which seems to make more sense, logically? If we use width/2 and height/2 to calculate it, does the slightly-truncated integer for even-sized objects matter?

How do other games do this? Right now, my objects are defined by the top left corner, and it's annoying to do operations that find the center of the object.

sentences:
LibGDX Json writes only part of class Hello I've been developing this game for awhile and now trying to implement save data via Json.
I've gotten to where when the app is first launched it will write the Json file with the variables I would like the game to save, but it only writes part of the class that I am passing.

Here is my implementation

@Override
    public void create()
    {

        batch = new SpriteBatch();
        file = Gdx.files.external("/bin/save.json");
        create.setFirstSpawn(true);
        create.setSpawnX(-7);
        create.setSpawnY(417);
        create.setTime(0);
        create.setMap("cabinMap");

        if(!file.exists()) {
            Json json = new Json();

            json.setOutputType(JsonWriter.OutputType.json);
            file.writeString(json.prettyPrint(create), false);

        }
        if (file.exists()) {
            JsonReader jread = new JsonReader();
            JsonValue base = jread.parse(file);
            SpawnX = base.getFloat("SpawnX", -7);
            SpawnY = base.getFloat("SpawnY", 417);
            map = base.getString("map", "cabinMap");
            time = base.getFloat("time", 0);
firstSpawn = base.getBoolean("firstSpawn", true);
        }
        if(map == "cabinMap") {
            this.setScreen(new cabinMap(this));
        }
        if(map == "tMap") {
            this.setScreen(new tMap(this));
        }
        if(map == "lowerTMap") {
            this.setScreen(new lowerTMap(this));
        }
        if(map == "rightTMap") {
            this.setScreen(new rightTMap(this));
        }
        else {
            this.setScreen(new cabinMap(this));
        }
    }

Here is the class that I am passing

public class create
{
    boolean firstSpawn;
    float SpawnX;
    float SpawnY;
    float time;
    String map;

    public void setFirstSpawn(boolean firstSpawn)
    {
        this.firstSpawn = firstSpawn;
    }

    public void setTime(float time)
    {
        this.time = time;
    }

    public float getTime()
    {
        return time;
    }

    public void setMap(String map)
    {
        this.map = map;
    }

    public String getMap()
    {
        return map;
    }

    public boolean isFirstSpawn()
    {
        return firstSpawn;
    }

    public void setSpawnX(float spawnX)
    {
        SpawnX = spawnX;
    }

    public float getSpawnX()
    {
        return SpawnX;
    }

    public void setSpawnY(float spawnY)
    {
        SpawnY = spawnY;
    }

    public float getSpawnY()
    {
        return SpawnY;
    }
}

And this is my result

{
"map": "cabinMap",
"SpawnX": -7,
"SpawnY": 417
}

As you can see from the output file I am missing 2 values.
float time and boolean firstSpawn are missing from the file. I've worked for hours trying to find out why. I have no clue why it omitted part of the code... If anyone knows why that would be very helpful to me.

sentences:
Object have the same "speed" all time JavaScript I try to create a 2D game with a big map and multiple objects. The player is always in the middle of the screen and all the other objects is moving around so it feels like a big map.

I want the player to always move after the mouse location. I have modified the mouse location to (0,0) by this:

                var mouseX = 0;
                var mouseY = 0;
                if (e.pageX < window.innerWidth/2) {
                    mouseX = -(window.innerWidth/2-e.pageX);
                }else{
                    mouseX = e.pageX-window.innerWidth/2;
                }
                if (e.pageY < window.innerHeight/2) {
                    mouseY = -(window.innerHeight/2-e.pageY);
                }else{
                    mouseY = e.pageY-window.innerHeight/2;
                }

That is working just fine. When it comes to the moving part i can't relly get it to move with the same "speed". I have made some animations to explain how it is now and how i want it to be.

How it is now:

DC is the speed that my player would go and as you can see it is moving the most when its closest to x=0 and y=0, i have done it like this so far:

            var all = mouseX + mouseY;
            clientsID[key]['x'] += mouseX / all * speed;
            clientsID[key]['y'] += mouseY / all * speed;

But as i know it is not working well. Here is a animation to show how i want it to be:

DA would be the speed and it's always 1 because it's radius of the circle. But as i don't know how far the mouse is from the center (mouse is E on the last animation) i have to scale it down somehow.

Does anyone know how to get how much i have to add x and y so the speed always will be the same?

Thank you

EDIT: See the solution under here

sentences:
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: What's the difference between a game engine and a physics engine? What's the difference between a game engine and a physics engine? How do they work together, and what's the meeting point between them?

sentences:
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:
Can't open scripts in Unity 2019.2.11.f1 version I'm using Visual Studio 2017, Unity Hub to 2.1.3 and just created a project using Unity's 2019.2.11.f1 version.

Once trying to open a script in Unity, it doesn't open and then I'm forced to use Task Manager to End Unity's task because can't even close it normally due to not being able to interact with the screen. No errors or warnings, VS doesn't open, can't interact with Unity anymore.

This doesn't block me from working, it just isn't as convenient as before.

sentences:
Hide "No custom tool available" window I have this annoying window in the bottom right of the scene view.  From the manual, it seems like I opened it by clicking on the wrench & scribe button next to the movement buttons.

How do I make it do away now?

Restarting doesn't make a difference, neither does creating a brand new project.

The documentation say this appears it I've clicked on the tools icon and there aren't any custom tools (which I'm sure I have done).  Surely is should vanish after a while though.

sentences:
How to create a 2d jelly/soft/blob body? I'm a developer looking into game development. I have an idea that requires a 'character' that needs a jelly like body. I've found this video which really demonstrates what I want.

I've looked around and there are libraries/assets that do this (like Jelly Sprites) but none state how they do it, and that's what I'm interrested in.

What I've read so far is that a way of doing it is using multiple rigid bodies joined with joints that don't collide with each other. Witht he common sidenote that it might not perform that well.

I'm hoping anyone has any pointers or tutorials that explain the concepts of jelly/soft/blob bodies. Any pointers towards achieving the effect shown in the video would be awesome.

sentences:
How many textures can usually I bind at once? I'm developing a game engine, and it's only going to work on modern (Shader model 4+) hardware. I figure that, by the time I'm done with it, that won't be such an unreasonable requirement.

My question is: how many textures can I bind at once on a modern graphics card? 16 would be sufficient. Can I expect most modern graphics cards to support that number of textures?

My GTX 460 appears to support 32, but I have no idea if that's representative of most modern video cards.

sentences:
OpenGL Arc-Ball Camera Yaw Pitch GLM::Rotate I'm currently working on a small Voxel-Editor Project. In the editor, I plan on using an Arc-Ball camera which rotate around the model. My camera is currently working but in an odd way. I can't seem to be able to move around the Z-Axis on my model which cause my camera angle to get smaller as I reach one side. For example, if I go to the left side of my ball, I wont be able to turn around it completly.

Here is my code which update my current View-Matrix into the updated one.

void t_Math::CreateLookAt(glm::mat4& InMatrix, sf::Vector3f pointToFix,   GLfloat InPitch, GLfloat InYaw, GLfloat valueToScale)
{

    glm::mat4 rotationMatrix = glm::mat4(1.0);

    const GLfloat FinalPitchDegree = InPitch / 57.2958;
    const GLfloat FinalYawDegree = InYaw / 57.2958;

    rotationMatrix = glm::rotate(rotationMatrix, FinalPitchDegree,                               glm::vec3(1.0, 0.0, 0.0));
    rotationMatrix = glm::rotate(rotationMatrix, FinalYawDegree, glm::vec3(0.0, 1.0, 0.0));

    const glm::vec4 cameraPosition4 =  rotationMatrix * glm::vec4(1.0);
    const glm::vec3 cameraPositionFinal = valueToScale * glm::vec3(cameraPosition4);

    const glm::vec3 constObjetMiddle = glm::vec3(pointToFix.x, pointToFix.y, pointToFix.z);

    InMatrix = glm::lookAt(cameraPositionFinal, constObjetMiddle,         glm::vec3(0.0, 1.0, 0.0));
}

Here is what I believe my code do.

The function receive a View Matrix, The model Center Coords, The Pitch, The Yaw and finally the Scalar (The zoom). Note: My Pitch and Yaw are simple GLFloat which mean they don't have limits and can go from -R to +R.

Now for the code. -We first create a base Matrix 4 -We Divide the Pitch and Yaw by 57.2958 (a radian) because GLM::rotate works with radian and I want it to be precise so in degree. -We then rotate the base Matrix on their respective Axis using the proper Pitch and Yaw -We then calculate the position of the Camera by using the ROTATED matrix which we transform into a Vec4 -We calculate the final Camera position by multiplying by the Scaling Vector (The Zoom) and we transform this Vector4 into a Vec3 -We create another Vec3 which is the Camera Target by using the value received by the function -We use all we collected to create a new lookAt matrix and we apply it to the view matrix.

I think I might be missing the Z-Axis rotation but how am I suppose to calculate it ? Should I use the Pitch or the Yaw ? Since i'm using (W-A-S-D) to move around here is what my keys does.

W: Increase Pitch S: Decrease Pitch D: Increase Yaw A: Decrease Yaw

Do I need to put the Roll into this and which keys should increase and decrease it ?

sentences:
Area of surface contained in pixel Let's say I have some surface rasterized and stored to a texture. How do I calculate the actual surface area that is visible in one of the rasterized pixels, from some other location?

So far, I'm assuming it's

A_visible = A * cos(theta) / d^2

where d = distance from viewer, theta = angle between normal and viewer-surface direction, A = ... I'm not even sure how to express it. I guess you could call it the "world space area" of the pixel.

Is the above equation even correct? How do I determine "A? Notice that I'm not only looking for the area strictly as visible from the (e.g. perspective) camera. I'd also like to compute this area as visible from other surfaces, i.e. other surface areas that receive light from all around its hemisphere above the surface.

sentences:
OpenGL light not shining quad I've constructed a scene using OpenGL/GLUT with a spot light but I'm getting troubles with light shining some of the walls

what is going on and how to solve?

sentences: How to efficiently organize different game zones with different functionality? For now I have a list of basic data class like position in game world, dimensions, type and stuff like that, but since I am starting to implement their functionality it seems kind of a bad pattern, I need each zone to have totally different data and behaviour, use different UIs etc, is there a pattern to realize that other that just making one totally different class for each zone?

sentences:
SFML drawing Tiles low fps int main()
{
sf::RenderWindow window(sf::VideoMode(800, 800), "SFML works!");
sf::VertexArray Tquad(sf::Quads, 40*40*4);
int size{ 20 };
int width{ 40 };
for (int x = 0; x < width; x++)
{
    for (int y = 0; y < width; y++)
    {
        sf::Vertex* quad = &Tquad[(x + y * width) * 4];
        quad[0].position = sf::Vector2f(x, y);
        quad[1].position = sf::Vector2f((x+1)*size, y);
        quad[2].position = sf::Vector2f((x+1)*size, (y+1)*size);
        quad[3].position = sf::Vector2f(x, (y+1)*size);
    }
}

while (window.isOpen())
{
    sf::Event event;

    while (window.pollEvent(event))
    {
        if (event.type == sf::Event::Closed)
            window.close();
    }

    window.clear();
    window.draw(Tquad);
    window.display();
}

return 0;

}

Hello , im getting very low fps with only 40x40 tiles, in release mode i get 21 fps. If i disable the window.draw i get 2000+- fps.

sentences:
How to print Depth to a Texture2D and then read it in the next pass on a shader in DirectX11 I'm programming a two-pass effect in DirectX 11 (SharpDX). It's supposed to write the depth to a texture in the first pass and then use that texture to extract data on the second one in the pixel shader.

What I get is a white screen, with nothing but the interface and I don't know why nothing is being printed. What could be the problem? I would say I should get at least something from the Depth Texture.

This is how I'm setting the depth texture values:

this.depthBuffer = new Texture2D(device, new Texture2DDescription()
        {
            Format = Format.R32_Typeless,
            ArraySize = 1,
            MipLevels = 1,
            Width = (int)host.ActualWidth,
            Height = (int)host.ActualHeight,
            SampleDescription = new SampleDescription(1, 0),
            Usage = ResourceUsage.Default,
            BindFlags = BindFlags.DepthStencil | BindFlags.ShaderResource,
            CpuAccessFlags = CpuAccessFlags.None,
            OptionFlags = ResourceOptionFlags.None,
        });

this.depthBufferShaderResourceView = new ShaderResourceView(this.device, this.depthBuffer, new ShaderResourceViewDescription()
        {
            Format = Format.R32_Float,
            Dimension = ShaderResourceViewDimension.Texture2D,
            Texture2D = new ShaderResourceViewDescription.Texture2DResource()
            {
                MipLevels = 1,
                MostDetailedMip = 0,
            }
        });
var depthStencilDesc = new DepthStencilStateDescription()
        {
            DepthComparison = Comparison.LessEqual,
            DepthWriteMask = global::SharpDX.Direct3D11.DepthWriteMask.All,
            IsDepthEnabled = true,
        };

And here is how I sample the depth in the .fx file:

int3 posTex = int3(input.p.xy, 0);
float depthPixel = DepthTexture.Load(posTex);
float4 color = float4(depthPixel, depthPixel , depthPixel, 1.0f );
return color;

And here the way I'm now setting the Depth Buffer stencil view as a Render Target in 2 passes. In the first I try to set the depthstencilview as a target. In the second pass I'm trying to set teh depth texture as a shader resource to read from it.

this.device.ImmediateContext.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(this.vertexBuffer, LinesVertex.SizeInBytes, 0));

// PASS 0
this.device.ImmediateContext.OutputMerger.SetTargets(depthBufferStencilView);
this.device.ImmediateContext.ClearDepthStencilView(this.depthBufferStencilView,     DepthStencilClearFlags.Depth | DepthStencilClearFlags.Stencil, 1.0f, 0);
this.technique.GetPassByIndex(0).Apply(this.device.ImmediateContext);
this.device.ImmediateContext.DrawIndexed(this.geometry.Indices.Length, 0, 0);

// PASS 1
this.device.ImmediateContext.OutputMerger.ResetTargets(); // unbinding the depthStencilView

this.device.ImmediateContext.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(this.vertexBuffer, LinesVertex.SizeInBytes, 0));
this.depthStencilShaderResourceVariable = effect.GetVariableByName("DepthTexture").AsShaderResource();
this.depthStencilShaderResourceVariable.SetResource(this.depthBufferShaderResourceView);
this.technique.GetPassByIndex(1).Apply(this.device.ImmediateContext);
this.device.ImmediateContext.DrawIndexed(this.geometry.Indices.Length, 0, 0);

Finally, this is how I set the two passes in the .fx file:

technique11 RenderMyTechnique
{
pass P0
{

SetDepthStencilState( DSSDepthLessEqual, 0 );
SetVertexShader     ( CompileShader( vs_4_0, VShader() ) );
    SetHullShader       ( NULL );
    SetDomainShader     ( NULL );
    SetGeometryShader   ( NULL  );
SetPixelShader      ( NULL );
}

pass P1
{
SetDepthStencilState( DSSDepthLessEqual, 0 );
SetVertexShader     ( CompileShader( vs_4_0, VShader() ) );
    SetHullShader       ( NULL );
    SetDomainShader     ( NULL );
    SetGeometryShader   ( CompileShader( gs_4_0, GShader() ) );
SetPixelShader      ( CompileShader( ps_4_0, PShader() ) );
}
}

sentences: Changing Hitbox from a single spritesheet I have different animation in a single spritesheet. I wonder how do you guys assigning these hitboxes?

sentences:
Transform check should return null, but returns as initialized instead In my Player script, I initialize my FirePoint transform using GameObject.Find in the Awake function. In the editor, I purposely misspelled the name of FirePoint to test if the null check inside of my Fire function will print an error to the console. The only error that shows up is from the Awake function giving a NullReferenceException, but why don't I see my Debug.LogError? Instead, the else statement prints that the FirePoint is not null.

public class Player : MonoBehaviour
{

   [HideInInspector] public Transform FirePoint;

   private void Awake()
   {
       FirePoint = GameObject.Find("FirePoint").transform;
   }

   private void Fire()
   {
       if (FirePoint == null)
       {
           Debug.LogError("FirePoint is null.");
       }
       else
       {
           print("FirePoint is NOT null.");
       }
   }
}

sentences:
Texture disappearing from landscape I am using Unreal Engine 4.25, and I have an issue with adding textures.
I have some textures right now in my landscape, but lately when I add a texture to the landscape, suddenly all texture disappear from my landscape - it looks like I did not add any textures at all.
How can I fix this issue?

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:
Using Box2D in LibGDX, is there a reason a fixture set to be a sensor would only -sometimes- detect a collision? I am working on a 2D game in LibGDX. Currently, I am testing interactions between a player's weapon and enemies - in particular, a sword and an enemy monster.

The player has a hurtbox and the sword has a hitbox. The player's hitbox and hurtbox are filtered so that they do not interact with each other. However, the p
layer's hitbox and hurtbox are supposed to interact with the monster. However, a collision between the sword and the monster is only registered sometimes - specifically, four times when I launch the application, and then no more collisions will register. However, if the player bumps into the monster so that the monster gains some velocity, collisions will register again until the enemy stops moving.

Is there a reason for this / is there a pattern here for when collisions are registering and when they're not that I'm missing?

Note: I have tried both creating the hitbox only when the player is attacking, and having the hitbox be inactive until the player is attacking, then making it active, then setting it to be inactive again. Both cases result in the same failure to register all collisions.

This is the general code for the creation of the hitbox fixture:

    CircleShape shape = new CircleShape();
    shape.setRadius(25f * Constants.MPP);
    shape.setPosition(new Vector2(0f, 0f).scl(Constants.MPP));

    FixtureDef fixture = new FixtureDef();
    fixture.filter.categoryBits = Constants.CATEGORY_PLAYER_WEAPON;
    fixture.filter.maskBits = (short) (Constants.CATEGORY_MONSTER);
    fixture.isSensor = true;
    fixture.shape = shape;
    f = hitbox.createFixture(fHitbox);

    hitboxShape.dispose();

Thanks in advance!

sentences:
How to iterate a sprite group correctly in Pygame avoiding "maximum recursion depth exceeded"? I'm making a game and I have almost finished it, but I'm usually finding the error RuntimeError: maximum recursion depth exceeded when I iterate a sprite group.

This is an example and the group is self.nextStageCollision():

def nextStageCollision(self):
    for tile in self.nextStageCollision():
        if tile.rect.colliderect(self.rect):
            self.rect.x = 18*20
            self.rect.y = 20*20
            return True

    return False

The group self.nextStageCollision() has 4 sprites (tiles) and I'm checking collision between my player and those 4 tiles to go to the next stage but I have to be doing something wrong iterating the sprite group because (I don't know why) it becomes recursive and raises the maximum recursion depth runtime error. I've debugged it and when it reaches the for each line, it loops a lot of times there (althought there are only 4 sprites in that group).

I know I can increase the recursion depth, but probably it's better to not play with that and try to improve the code. So, what am I doing wrong? Is there another better way to interate a sprite group to check collisions?

sentences:
Level of Detail/Load on Demand for crowds: replace groups of objects instead of individual ones? I have been thinking of using level of detail to make rendering crowds easier. The idea is to replace a group of meshes with a single one representing a group.

For example, you have 1 individual cube mesh. If you get 100 cubes together in a close space, replace all of those with a generic "blob of 100 cubes" mesh, that would be simplified and hopefully have a lower polycount than the sum of all 100 cubes. If 100 "blob of 100 cubes" meshes are together, then replace them with a simpler "blob of 10000 cubes" mesh. And so on.

There are many different challenges in doing this. Such as how to detect the objects are close? How to render the blob so it looks realistic enough? What to do about each object's metadata (physics, game variables)? etc So before I delve too much into it, I would like to see what is the current state of this technology and how people have been using this.

But I cannot find anything related to it. I've been looking for it for days, but every search I do about "LOD" and "crowds" only returns things about how to simplify each individual mesh of each game unit (ie. replacing a high poly count character, with a low poly character). Instead of replacing many game units with fewer ones, which is what I want to do. I've obviously played many games, and I can easily tell when they're using LoD for simplifying individual units. But I don't remember a single game that would replace groups. Am I looking it up wrong? Is there a specific term for this thing that I should be looking up for instead? Do you guys happen to know some case study examples of games that do this that I could check? Or maybe this isn't done at all?

Any help to point me in the right direction would be appreciated. Thanks.

sentences:
Playing Tetris on non-linear surfaces I am considering designing a Tetris game where instead of a traditional flat game board, the game will transform the board into different kinds of surfaces. I think I lack the appropriate mathematical terms to describe the behavior I'm looking for, but here is one example of the design. The board starts as a flat plane, and starts bending outwards until it forms a cylinder (at which point the entire board is not visible in one view). My question is what strategy can I use to implement the interactive graphics on non-uniform surfaces? I've seen that meshes are used a lot, but how can I show this Tetris board on any random mesh?

Here is an example of the transformation I am trying to make. Note that it will not be limited to curvature on a single axis.

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:
Build Unity3D project from source without Unity Editor I am trying to create an installer which will download the source of the latest release of a Unity project from a repository hosted on Github and then build it into an executable file. I have tried looking online for a solution, but, they all require the Unity Editor to be installed.

Is it possible to build a Unity project from the source code into a .exe file or a .dmg file without the Unity Editor?

EDIT: From @DMGregory's answer, it seems that using an external tool to build Unity Projects will violate Unity's Terms of Service. Therefore, I am updating the question.

Does Unity provide a lightweight (installer) tool that can allow clients to build and install Unity projects from source rather than requiring the client to install the entire Unity Editor?

sentences:
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:
My game is not shown in Play Market New Releases I've published my app for like an 36 hours ago. It is possible to find it with exact search query ("Village Keeper") and it is available via the direct link.

Thing is I can't find it in "New Releases" ("New Free Games") and I can't find it by typing something like "village game" or "keeper". So I have only 3 installs by me and my friends.

Is it a bug or is a new app not guaranteed to get in "New Releases"? I tried to google it but found no answers. If so, how can indie developer get into the market with no money for an ad campaign?

P. S. I tried to contact Google Support twice and 24 hours after first email passed with no reaction.

sentences:
Voxel terrain rendering with marching cubes I was working on making procedurally generated terrain using normal cubish voxels (like minecraft) But then I read about marching cubes and decided to convert to using those. I managed to create a working marching cubes class and cycle through the densities and everything in it seemed to be working so I went on to work on actual terrain generation. I'm using XNA (C#) and a ported libnoise library to generate noise for the terrain generator. But instead of rendering smooth terrain I get a 64x64 chunk (I specified 64 but can change it) of seemingly random marching cubes using different triangles.

This is the code I'm using to generate a "chunk":

public MarchingCube[, ,] getTerrainChunk(int size, float dMultiplyer, int stepsize)
    {
        MarchingCube[, ,] temp = new MarchingCube[size / stepsize, size / stepsize, size / stepsize];
        for (int x = 0; x < size; x += stepsize)
        {
            for (int y = 0; y <size; y += stepsize)
            {
                for (int z = 0; z < size; z += stepsize)
                {
                    float[] densities = {(float)terrain.GetValue(x, y, z)*dMultiplyer, (float)terrain.GetValue(x, y+stepsize, z)*dMultiplyer, (float)terrain.GetValue(x+stepsize, y+stepsize, z)*dMultiplyer, (float)terrain.GetValue(x+stepsize, y, z)*dMultiplyer,
                    (float)terrain.GetValue(x,y,z+stepsize)*dMultiplyer,(float)terrain.GetValue(x,y+stepsize,z+stepsize)*dMultiplyer,(float)terrain.GetValue(x+stepsize,y+stepsize,z+stepsize)*dMultiplyer,(float)terrain.GetValue(x+stepsize,y,z+stepsize)*dMultiplyer };
                    Vector3[] corners = { new Vector3(x,y,z), new Vector3(x,y+stepsize,z),new Vector3(x+stepsize,y+stepsize,z),new Vector3(x+stepsize,y,z), new Vector3(x,y,z+stepsize), new Vector3(x,y+stepsize,z+stepsize),
                       new Vector3(x+stepsize,y+stepsize,z+stepsize), new Vector3(x+stepsize,y,z+stepsize)};
                    if (x == 0 && y == 0 && z == 0)
                    {
                        temp[x / stepsize, y / stepsize, z / stepsize] = new MarchingCube(densities, corners, device);
                    }
                    temp[x / stepsize, y / stepsize, z / stepsize] = new MarchingCube(densities, corners);
                }
            }
        }

(terrain is a Perlin Noise generated using libnoise)

I'm sure there's probably an easy solution to this but I've been drawing a blank for the past hour.

I'm just wondering if the problem is how I'm reading in the data from the noise or if I may be generating the noise wrong? Or maybe the noise is just not good for this kind of generation? If I'm reading it wrong does anyone know the right way?

the answers on google were somewhat ambiguous but I'm going to keep searching.

Thanks in advance!

sentences:
How to read neighbor pixels in GLSL? I'm using SFML 2.1, it's much more straightforward for me so I can jump directly to learning the shading language.

I'm trying to do something similar to conway's game of life. I already learned that I will need to use 2 textures since I need to read and write at the same time.

My questions:

How do I read neighbor pixels ? Do I need to pass a vec2 from the vertex shader to the fragment shader like this ? :

vertex shader:

out vec2 pixelpos;
void main(){
    pixelpos = gl_Position;
}

fragment shader:

in sampler2d mytexture;
in vec2 pixelpos;
void main(){
    if(mytexture[pixelpos.x][pixelpos.y].r > 0.5)
    {}
}

How do I write to a texture ?

sentences:
Smooth+Flat shaded meshes cause shadow artifacts (understanding the source of the problem) I'm using blender to create assets to use in Unity3D, and I'm having some trouble understanding how the smooth/flat shading interacts with shadows, I'm sorry if it has been asked before, but all the "related" answers refer only to the shading of the object itself, not the shadow it casts.

I'm a 3D artist, I do not understand Unity and the mechanics behind it the same way I understand 3D stuff, I'm also trying to understand if the problem lies in the 3D object or some configuration in Unity.

I'm using a real time directional light.

1 and 2 are flat shaded. 2 has open geometry while 1 has closed geometry, both have such artifact but it's clearly seen on 2.

3 and 4 both have closed geometry. 3 is fully smooth shaded while 4 is flat shaded.

Solution A: Mess around with Bias and Normal Bias. With Normal Bias at 0, the shadow artifacts are gone but the mesh itselt gets some other artifacts.

Solution B: Use Two-sided shadows, this method completely fixes the problem, in any situation, but it adds another draw call and makes it more expensive (I'm not 100% sure it does) - is this an optimal solution?

This same issue was discussed in a closed group but no one could give me a conclusive answer. However, someone who works with 3DS Max said that exporting a mesh with proper smoothing groups does not result in these artifacts, I tested that in 3DS Max and it did not work - I think I did it the right way, but I'm not 100% certain.

For all the proposed methods, I tested several times, with diferent mesh/modifier and exporting options. I'm using mostly .fbx but I also tested in .obj format (which includes a specific option for smoothing groups in blender).

Smooth shaded objects work perfectly, flat or smooth+flat shaded objects result in this drama.

Please help me to bring light to this issue, I might be blind to some obvious aspect, I'm confused because in the other discussion I was presented with contradicting arguments without conclusive proof of anything. Now I don't know if the problem lies with Blender/export or Unity configuration.

Let me know if I can provide more information.

sentences:
How do I know the data has arrived at server without requesting every frame of the game? I have a game where I have to get data from the server but the problem is I don't know when the data will become available on server. So I decided to use co-routine and hit server at after specific time or on every frame. But certainly this is not the right, scale able and efficient approach.

Now my question is that how do I know that data has arrived at server so that I can use this data to run my game. Or how should I direct the back-end team to design the server in an efficient way that it responds efficiently.

Our back-end team currently uses REST Web services with JSON with Python. And they want to push data to my unity player without my frequent requests.

sentences:
Retrieving shader byte code using D3D11 I have a shader as an 'ID3D11VertexShader' (or generally any 'ID3D11*Shader') instance. For my application I would like to read the shader byte code that is associated with this instance.

The goal is the create an D3D11InputLayout without having to carry around the byte code blob.

Is there a way in DirectX 11 to retrieve the byte code, that was used to create this shader? I was looking for something similar to glGetProgramBinary (that would return the byte code instead of the binary code).

sentences:
Designing Character Movement Need Advice (This game is written in C++ with GDI+ It's a simple side-scroller.)

I am having a problem deciding on how I should handle player movement. Currently it runs at 20 frames per second (I just chose that number, it could no doubt run at higher fps.)

Now I have one function that moves the character 1 pixel. It checks collisions with anything around.

There is two ways I can do this (because moving 20px/ second is too slow.)

I can use a for loop and then I can move any amount of space per frame. One minor problem is that the player will be moving several pixels between screen updates, so the player moves 5px (or any amount) increments every second.
I can turn up the fps, and then, consistently move the character 1px per frame, and it would be smooth movement.

I am having trouble deciding which way of doing this is better and need a bit of input, ideas, advice, etc...

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 to determine what direction an object should orbit around another I am creating a game in Unity with 2D. When a button is clicked a static object is attaching a hinge joint to a dynamic object, so the dynamic object orbits it. When the dynamic object gets attached, I am setting the dynamics objects transform.up vector to be pointing at the static object. Then, taking what ever the dynamic objects magnitude was and setting that as its velocity to the right. I do this because I want the dynamic object to orbit the planet at the same exact speed as when it wasn't orbiting.

The problem I am having, is I don't know how to determine if the object should orbit clockwise or counter-clockwise. It's easy for me to determine this when I look at an image, but I don't know how to via code.

Here is an example

Does anyone know how I can determine this?

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:
Freeglut: Functions missing I'm currently learning OpenGL (in class) and we're using freeglut 2.8.2, which works just fine (using Visual Studio 2012). As an additional learning resource I'm reading the "OpenGL Superbible, 5h Edition". However, I've noticed that there are some functions that aren't available using the freeglut library.

For example, gluGenerateMipmap or setting anisotropic filtering doesn't work:

glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, fLargest);
void glGenerateMipmap(GLenum target);

It simply does not know these functions (glTexParameterf is known, GL_TEXTURE_MAX_ANISOTROPY_EXT is not). I've googled a bit but didn't really find anything. And since glGenerateMipmap seems to belong to the standard openGL Library (and not glu/glut), it should be available (I hope).

Is there anything I'm missing?

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:
In MySQL, how would I model moves that Pokemon can learn? I'm making a Pokemon MMO Game with Unity + SmartFoxServer/MySQL. At the moment I'm creating the base structure for the database.

If you are not familiar with Pokemon Games, every Pokemon can learn only a fixed set of moves. I want to represent this in my database. How should I do it?

Currently I have a pokemon_base table that is storing all the base data of the Pokemon, like name, elemental types, base stats, etc, and a Unique Identifier. I need for every Pokemon inside this table to have a list of learnable moves.

I have these ideas to continue:

Have a field on the Pokemon table containing comma-separated IDs of learnable moves
Have a field on the Moves table containing comma-separated IDs of Pokemon that can learn this move, or
Have another Table with a Field for Pokemon ID and boolean fields for each move

The first one to me seems the better because once I have a Pokemon ID I can get all the moves in a string, which I can split by commas and do my checks. Have I missed something?

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:
Identify an object currently selected in the game I am making a 2D isometric game that uses the mouse. When I left click on an object, this object should be selected, but how do I determine what object that's currently selected and show a halo around it?

My objects are stored in a list of game objects as std::vector<Game_Object *> Object_Game. I am using the SDL library with C++. I did some research on Google but only found articles about Unity. Can someone help me with this?

sentences:
How can I test if a point is behind a polygon in 2D? In order to improve the performance of my visibility graph generator I am trying to figure out the following.

Given the image below; is there a way to find out if a point is 'behind' the polygon? For example, from the blue points perspective green and pink would be behind the polygon so there is no need to do expensive visibility checks. Is there an easy way to figure this out?

Basically, what I need to know is, when drawing a line from Blue to Green, does it start in or outside the polygon? There must be some simple math for this.

So green and pink are 'behind' and purple and red are in front.

sentences:
how to generate mipmap, and check if done properly? i am implementing Mipmapping for my texture for the first time.

i have 2 questions

HOW TO CHECK IF MIPMAP IS DONE PROPERLY ?
HOW TO SET MIPMAP FOR TEXTURE FROM FILE ?

First one. i implemented texture in application.

ID3D11Texture2D* TEX;
D3D11_TEXTURE2D_DESC DESC;
DESC.ArraySize = 1;
DESC.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
DESC.CPUAccessFlags = 0;
DESC.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
DESC.Width = 256;
DESC.Height = 256;
DESC.MipLevels = 9;
DESC.MiscFlags = D3D11_RESOURCE_MISC_GENERATE_MIPS;
DESC.SampleDesc.Count = 1;
DESC.SampleDesc.Quality = 0;
DESC.Usage = D3D11_USAGE_DEFAULT;
r_assert(graphic->Device()->CreateTexture2D(&DESC, nullptr, &TEX));
ID3D11ShaderResourceView* TEXV;
D3D11_SHADER_RESOURCE_VIEW_DESC TEXVDESC;
TEXVDESC.Format = DESC.Format;
TEXVDESC.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
TEXVDESC.Texture2D.MipLevels = -1;
TEXVDESC.Texture2D.MostDetailedMip = 0;
r_assert(graphic->Device()->CreateShaderResourceView(TEX, &TEXVDESC, &TEXV));
graphic->DContext()->GenerateMips(TEXV);
D3D11_TEXTURE2D_DESC desc;
TEX->GetDesc(&desc);

not sure, but i think i generate Mipmap for TEX
and i just want to know the ways how to check/debug if mipmap actually done well.

Second.
i am also using DirectX::CreateWICTextureFromFileEx to create texture from file.

resource=nullptr;
newSRV=nullptr;

r_assert(
    DirectX::CreateWICTextureFromFileEx(
        graphic->Device(),
        (L"Data\\Texture\\" + fileName).c_str(),
        0,
        D3D11_USAGE_DEFAULT,
        D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE,
        0,
        D3D11_RESOURCE_MISC_GENERATE_MIPS,
        DirectX::WIC_LOADER_DEFAULT,
        &resource,
        &newSRV)
);
graphic->DContext()->GenerateMips(newSRV);
ID3D11Texture2D* tex = nullptr;
r_assert(
    resource->QueryInterface(IID_ID3D11Texture2D, (void**)&tex)
);
D3D11_TEXTURE2D_DESC desc;
tex->GetDesc(&desc);

and i checked desc.MipLevels is 1, which means there is no mipmapping.
so wonder how to generate mipmap when using WIC function?

any advice would be appreciated^

sentences:
render() can't seem to reference my sprite properly This is driving me a little crazy. We use libGDX, working on making a simple side scroller for fun. I've got it switching from screens alright, loading from my main menu into my level one class, which implements screen.

public class levelOne implements Screen

Don't know if that effects this. When I try to initialize my sprite, my editor (AIDE) highlights it. Gives me an error saying that there is no access to the variable, as it does when you declare something but don't use it.

Texture faceTexture = new Texture(Gdx.files.internal("faceSprite.png"));
faceGuy = new TextureRegion(faceTexture, 50, 50, 95, 95);
Sprite player = new Sprite(faceGuy);

I do actually call up the sprite in render() though,

batch.begin();

// Background
batch.draw(backGround,0,0,2900,800);

// Player
player.draw(batch);

// Enemies
batch.draw(faceGuy, baddieOnePosition.x, baddieOnePosition.y, 150, 150);

batch.end();

It doesn't generate an error there, but trying to run it generates a crash. I can do a batch.draw of the texture, but every attempt at doing it as a sprite fails. I have it being initialized in show(), thought maybe making a new method to do so would help, but had the same result. The only way I've managed to make it work was to initialize it in render(), but that not only resets the sprites position multiple times a second, but I expect is also a memory hog. Help!

sentences:
In the Unity Editor, how to push a parent's transform down to its children? I've inherited a Unity scene with quite a deep object hierarchy. Some GameObjects in the hierarchy don't have any geometry of their own, and just exist to group their children and apply a MonoBehaviour to all of their children. Because of the way the scene was authored, some of these objects have arbitrary transforms, which makes it hard to edit the child transforms, to align the children with other objects outside the group.

As a one-off operation in the editor, I'd like to reset these objects' transforms, without changing the world-space positions and orientations of the children. Put another way, I'd like to push the effect of the transform down to the children.

What's the easiest way to achieve this in the editor? I've seen a lot of questions from people who want to achieve this in code, to have the effect of detaching the parent and child transforms while keeping the relationship, but that's not what I want. I'm just looking for a one-off, manual operation to make my scene file easier to edit.

sentences:
How do i approach these inheritance problem? (Pokemon Gen III) I'm currently making a Pokemon clone on Python just for the heck of it. After fiddling a bit with some GBA ROM editing tools, i've found out that on these games there are, among other things:

Events placed on a map, each with a script that is run when you interact with it (Either by running into them or pressing the A button at them).
Examples of this are Signposts, hidden items, doors, and more importantly...
NPCs, which, aside from having scripts (talking, triggering a pokemon battle, etc) can move and/or look around (at least some of them).
The Player character, which can also move and look around, controlled by the human player or by some outside event that may be manipulating it. But the Player itself is not an event, as it has no associated event scripts on its own. It just triggers everyone else's.

So how should i go about recreating this with Python? By using multiple inheritance, i'd get something like this:

class Event(object):
    def __init__(self, x, y script):
        self.x = x
        self.y = y
        self.script = script

class Moving(object):
    ''' objects that can move '''
    def __init__(self, x, y, direction):
        self.x = x
        self.y = y
        self.direction = direction

    def move_one_space_to(self, direction):
        self.x += direction.x
        self.y += direction.y
        self.turn_to(direction)

    def turn_to(self, direction):
        self.direction = direction

class NPC(Event, Moving):
    def __init__(self, x, y, script, movetype):
        Event.__init__(self, x, y, script)
        Moving.__init__(self, x, y, DOWN)
        self.movetype = movetype

class Player(Moving):
    # many methods that an NPC shouldn't have go here
    pass

However, even though i may be sidestepping any problems that come with it, i'm still reluctant to use multiple inheritances. So...

Should i stick with this approach?
And if not... why not? and can you post a better one?

sentences:
Using Flash IDE to link nodes for Dijkstra algorithm I'm trying to use plash to set up the node connections, but having a really hard time to use the IDE as a tool to do so. Before giving up completely, and getting into creating a tool that would take assets and encode the information (by placing nodes and allowing one to drag links from one to another), I wanted to put this question out there and see if anyone has any idea how I can show a connection between these nodes as a line.

Drawing actual lines is not working well, because lines have to be moved as objects are updated, they are imprecise, and cannot carry weight information.

I'm experimenting with components and live views, which allows placement of nodes, but I can't get it to draw the lines.

I don't want to forgo using the connections completely, because it could make paths that go through objects unless I set up low proximity settings, which would require way too many objects.

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:
Best way to network the movement of 2D tanks? I'm working on a multiplayer Flash game with a Python server and I have a quick question regarding how I should send positional updates for tanks for other players.

Should I choose

Option A:

When the player presses the move key, send the new velocity to the server and let the server calculate the new position per tick?

or

Option B:

When the player presses the move key, send the new position to the server and calculate the velocity clientside?

Which is the best option, in your opinion? What is most common? What will have less issues?

Other suggestions are welcome, I don't really know what I'm doing here. ;)

sentences:
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 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:
Frustum culling only working at certain angles So how I'm doing this is a little sketchy but I plan on changing it to either AABBs or spheres once I get it working. So the problem I'm having right now is that the frustum culling I've implemented is only working at certain angles and is not even close to accurate, personally I believe that the problem is at a calculation level. I am fairly new to 3D game development so I just whipped up this class fairly quickly based on some thread I read. My ViewFrustum class can be found here: https://www.dropbox.com/s/3b97bgcwoyh2oq8/ViewFrustum.java?dl=0

So all I'm doing outside this class is calling the update method from my renderer class and I have an ungodly amount of if statements checking if an entity's xyz is within the min and max xyz of the frustum (This is temporary).

So my main question is, am I calculating the frustum right or did I make any mistakes?

Values (when game starts, rotation matrix is a identity matrix) :

centerNear: [134.49167, 7.3502045, -271.4365]
centerFar : [134.49167, 7.3502045, -1170.7365]
points[0-7] :

[0] 2607.2214 1714.3507 -621.8992 1.0
[1] -2338.238 1714.3507 -621.8992 1.0
[2] 2607.2214 -899.70605 -1573.3379 1.0
[3] -2338.238 -899.70605 -1573.3379 1.0
[4] 136.4149 100.760254 -252.18294 1.0
[5] 132.56844 100.760254 -252.18294 1.0
[6] 136.4149 98.727104 -252.92294 1.0
[7] 132.56844 98.727104 -252.92294 1.0

sentences:
How to access network player from internet I just followed a guide about basic UNet tut Here, Its spawning network car player which can be controlled by local player. I can make or join server through Network Manager HUD which is provide by the unity.

I am able to run and connect application on my LAN on different PCs but failed to connect it on other network. I don't know what are the reasons. Do I need to make or purchase a server for it or I am doing something wrong.

sentences:
How to generate interresting procedural terrain I work on a voxel-like game, and I have finally managed to create some basic terrain generation using simplex noise. Heres what it looks like:

Sure I can generate different kind of terrains (more or less hilly/aggressive), but there wont really be any variation.

At the moment I only know one way to make it more interesting, and that would be to add stone blocks under the grass (I would simply check the above block).

So my questions are: What techniques would I need to use, to generate different kind of terrains, which still kind of blended together at the edges. And how would I go about caves and rivers? And lastly how would I make a better variation of blocks?

If any could lead me in the right directions, I would appreciate it a lot.

Ps. It's not a valid answer to say that I just need to mix a lot of noises, to generate it. How?

sentences:
How to 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:
Isometric Movement in Javascript In the DOM I am creating a game using Javascript. I am not using the HTML5 Canvas Element.
The game requires both side view controlles, and Isometric controls, hence the movementMode variable.

I have got the specific angles, but I am stuck on an aspect of this.

https://chillibyte.makes.org/thimble/movement

function draw() {
            if (keyPressed) {
                if (whichKey == keys.left) {
                    move(-1,0)
                }
                if (whichKey == keys.right) {
                    move(1,0)
                }
                if (whichKey == keys.up) {

                    move(0,-1)
                }
                if (whichKey == keys.down) {

                    move(0,1)
                }
            }
        }

This gives normal up, down , left, and right. i want to refactor this so that i can plugin two variables into the move() function, which will give the movement wanted.

Now for the trig.

         /|
        / |
       /  | y
      /   |
     /a___|
        x

Take This Right angled Triangle.

given that x is 1, y must be equal to tan(a)

That Seems right.
However, when I do Math.tan(45), i get a number similar to 1.601.
Why?

To Sum up this question.

I have a function, and i need a function which will converts an angle to a value, which will tell me the number of pixels that i need to go up by, if i only go across 1. Is it Math.tan that i want? or is it something else?

sentences:
Unity3D (5.1) NavMesh Agent Error This is my first post in GameDev StackExchange, so please excuse me if I make any mistakes on best practices here (if I do, please refer me so I can learn).

I'm making a prototype where I have 2 types of enemy units: Uninfected and Infected. The Uninfected are to seek out Infected via AI pathfinding. However, I came across an issue when implementing the NavMesh in the scene. If the Player collides with an Uninfected, they go flying backwards. If they hit the walls, the walls collectively get hit. Here's some screenshots.

Example 1:
http://s7.photobucket.com/user/Korudo/media/GameDev/RoboInfect%20Scene%20-%20WallWeirdness1_zpsg0k2wbyk.png.html

Example 2:
http://s7.photobucket.com/user/Korudo/media/GameDev/RoboInfect%20Scene%20-%20WallWeirdness1_zpsg0k2wbyk.png.html

Thanks in advance.

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:
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:
Automated Unity iOS command line build on Mac I am doing the iOS builds for a group of Unity (Unity3d) game developers.

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

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

sentences:
Collision Detection For A Maze/Cave I have a simple code written in Processing 3.x that I am using to test out the collision detection for a cave/maze.

The code is here: https://github.com/NoahJon3s/New-Journey-The-Game/blob/master/sketch_190820a.pde

If you where to run said code, you'd see that I have the code so that it detects collisions on the x-axis (top of the rectangle) and y-axis (left side of the rectangle), and correctly prevents the movement of the "player" from moving out of the rectangle, but I cannot seem to find a solution for preventing the movement out of the bottom or the right side of the rectangle, even though I am able to detect the collision. Every solution I try seems to lock the "player" to those respective sides. Any suggestions?

Thanks in advance.

sentences:
How can I ensure procedural levels in an RTS are fair? I've seen that symmetry and coherance is important in RTS level design, but I'm lazy and want to do procedurally generated levels.

How can I ensure I generate a fair playing field when procedurally creating levels for an RTS?

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:
Collisions between players in multiplayer racing game I'm creating a simple racing game (spaceships, no gravity) using p2.js, phaser and node.js.

What I have done:
Client receives world state from server:

extrapolate other players based on latest velocity/position from server
check if client-side prediction was correct - if no apply position from server and process inputs that server was not aware of.
fixed physics step

Server:

receives inputs from clients and apply
fixed physics step
sends world state to each client

Now I'm struggling with collisions between players.
Colliding player is jumping all time during collision. I think it's because client-side prediction is not calculating similar results to the server.

Server doesn't know all inputs from player (lag).

Player doesn't have the same position of colliding player as the server (lag).

Combining this two makes the client to resolve collision different than the server and when world state arrives player has to make a big correction.

sentences:
Get GameObject which instantiated me in Unity How can I get a GameObject from another GameObject? If I know, that the GameObject I want to get instantiated(using function Instantite()) the GameObject from which I want to get it.

If there is no solution, how can I get the direction in which should move the instantiated bullet? I mean should it be 1 or -1.

sentences:
Need to save UI.Image to png I have ui.Image1 with Mask component and ui.Image2 that is placed inside ui.Image1, then I want to save the result to Texture2d to save the resulting image to png.

Sprite sprite = sourceImage.sprite;
Texture2D newText = new Texture2D((int)sprite.rect.width,(int)sprite.rect.height);
Color[] newColors = sprite.texture.GetPixels((int)sprite.textureRect.x,
                                             (int)sprite.textureRect.y,
                                             (int)sprite.textureRect.width,
                                             (int)sprite.textureRect.height );
newText.SetPixels(newColors);
newText.Apply();

System.IO.File.WriteAllBytes(_SavePath + "photo.png", newText.EncodeToPNG());

but I have the error:

  Texture 'mask' is not readable, the texture memory can not be accessed
  from scripts. You can make the texture readable in the Texture Import
  Settings.

If I change the texture type of 'mask' from Sprite to Advanced - the mask stop work. Let me know what need to do.

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:
Resurrecting XNA 3.0 projects I have some old XNA 3.0 projects that used stuff that has totally been changed in XNA 4.0.

Really I just want to revisit some of my old code, dust it off and refactor it.

Can XNA 3.0 and XNA 4.0 be installed together in Visual Studio 2010, or will there be problems?

Should I just install C# Express Edition 2008 with XNA 3.0, and work with my old projects that way?

sentences:
Increase maximum tracking distance of Kinect So according to the Kinect v2 SDK specs, the maximum skeletal tracking distance is only 4.5M.

Is there any way to increase this distance, perhaps with reduced skeletal tracking accuracy since I only need to track the head?

sentences:
How to create sprites, programatically without using prefabs? I have different types of images for different sprites. and i am not certain that how much different sprites(images) i will have to show. So, i gotta create the sprites and apply textures programatically at runtime.

Now, I defiantly can't use prefabs because it will restrict me with the number of different sprites i can use. and also, changing texture on one sprite prefab instance in game, will change all the sprites prefab, that's not acceptable in my case.

Is there a way i can create sprites without having to create static prefab ?

where ever i looked for the solution every time i got the same answer "create a prefab", which is what can not be done in my case.

sentences:
Nvidia Nsight 4.6 VS Edition. The Graphics debugger can't find glew32.dll I'm trying to debug some textures and FBO's with Nvidia Nsight 4.6 VS Edition.
But when I select either "Start CUDA debugging" or "Start graphics debugging" I get an error.

"The program can't start because glew32.dll is missing for your computer. Try reinstalling theprogram to fix this problem"

The application runs just fine when I'm not using Nsight. What might be my problem?

My system;
Windows 7 x64 bit.
Nsight 4.6 x64 bit.
GTX 580 with lastest drivers.
OpenGL version 3.3.
Building a Win32 application. (Tried to change the build target to x64 but that just resulted in a bunch of linking errors for glfw and glew)

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:
ECS - Lantern implementation / How does the RenderSystem determine which one to choose? Entity-Datastructure I want to implement ECS in my game. The more I read the more insecure I get.

The current available Components for a Entity processed by the RenderSystem are:

RenderComponent (mesh, texture, normalmap, etc.)
TransformationComponent (position, scale, rotation)
LightComponent (light color, brightness)
CameraComponent (view Matrix)

Let's assume that my EntityManager has a methode: getEntitiesByComponents(Class[] components): List and is a singleton.

Here is my pseudocode with the issues I have:

cclass RenderSystem {

    EntityManager em = EntityManager.getInstance();
    Renderer renderer = new Renderer();

    update(float dt) {

        //This one contained only  RenderSystem related components
        RenderSystemComponents rsc = em.getRenderSystemComponents();

        // Try to get the Camera
        [CameraComponent,TransformationComponent][] cameraArray = rsc.getComponentByType(TRANSFORMATION,CAMERA);
        // Check if Camera is avaible
        if(cameraArray.length != 1) {
            // Do some error Stuff here
            // Not sure if I should allow more then one Camera
            // e.g. MiniMap
        }

        // lights
        [TransformationComponent,LightComponent][] lightArray = em.getComponentByType(TRANSFORMATION, LIGHT);

        // 'default' entities
        [TransformationComponent,LightComponent][] entityArray = em.getComponentByType(TRANSFORMATION, RENDER);

        renderer.render(cameraArray,lightArray,entityArray);
    }

    public enum ComponentType {
        RENDER, TRANSFORMATION, LIGHT, CAMERA
    }
}

This implementation could work if my method getEntitesByComponents is fast enough. But the floor is literally the floor. The Terrain has seen from the component's point of view no difference but the RenderEngine should know that it is processing an Entity ( box, tree, player, mob, ... ) or a terrain (different shaders). This isn't a only RenderSystem problem even the Collision detection has to know if it's a terrain or an entity.

This is my first problem understanding how I detect differences. The second problem is the method getEntitesByComponents. Current this peace of code doesn't exists in a way I would use it. The basic concept I current use is the one here. The Structure is a Map<String, Map<Id, Component>>. The String is the Component class, which maps to a Map with the EntityId as key and the actual component as value.

if you want to get the components from an entity you ask map.get(Component.class).get(Entity#getId()) but you can't direct ask this structure to get all entities who refer to certain components without looping throw the map. So I need a proper management for the objects.

My first idea is to modify the entity class with a new attribute map and give each Component a unique static Id. So you can easily loop throw the entities and check with something like map.keySet().conatains(x) and y without checking one entity multiple times. But this seems not to be a common implantation. I often see a 'ComponentManager' but unfortunately the article I read doesn't describe the inner datastructure.

sentences:
Alternative solutions to applying an overly large and detailed texture to a mesh I have a very large spherical mesh in my Unity scene (the earth), to which one very large texture is applied (a map of the earth). Now it just so happens that Unity's max texture size (8192 pixels I believe) is not enough to capture the details I need on this huge mesh.

What's the proper way to deal with this situation in Unity? That is, not only overriding the 8192 pixels limitations (although that would be nice as a temporary solution), but also making sure the overhead won't become unbearable...

Is there a way to dynamically stream higher quality sections of textures as the camera gets closer to that specific part of the mesh?

Additionally, I see the Granite add-on (http://graphinesoftware.com/products/granite-for-unity) seems to do just this (if I understood it well), but it's only for Windows, and I'm developing on a Mac. Is there any other adding out there?

sentences:
Why will my server not execute a command sent by the client in Unity 5.1? I'm working on a very simple/basic client-server networking program, the basis of a future game I hope to create. Now the client program/project DOES successfully connect with the 'server program/project' (both completely separate). However when it comes to having the client send a request/command to the server. Well it doesn't send the command to the server, it executes it on the client.

I read about changing the 'Monodevelop' inheritance to 'NetworkBehaviour' so I did and it resulting in an error along the lines of;

Command xxx was sent to the server
...Debug.logerror(object
So I seemed to have got half way there, it allegedly sent the command to the server, but the server did nothing with it. I don't know why.

Below are the relatively short programs I've got for my server and client and are pretty much the same, but if anyone can help me out I'd greatly appreciate it, as my University course didn't really go into Network Programming all that much;

Server Code

using UnityEngine;
using UnityEngine.Networking;
using System.Collections;

public class server : MonoBehaviour
{

    public string IP = "127.0.0.1";
    public int port = 25001;
    public int prevConns = 0;
    private int currConns = 0;

    public virtual void OnServerReady (NetworkConnection conn)
    {
        NetworkServer.SetClientReady (conn);
    }

    void OnGUI ()
    {
        if (Network.peerType == NetworkPeerType.Disconnected) {
            if (GUI.Button (new Rect (100, 100, 100, 25), "Start Client")) {
                Network.Connect (IP, port);
            }
            if (GUI.Button (new Rect (100, 125, 100, 25), "Start Server")) {
                Network.InitializeServer (20, port, false);
            }
        } else {
            //CLIENT - NOT NEEDED
            if (Network.peerType == NetworkPeerType.Client) {
                GUI.Label (new Rect (100, 100, 100, 25), "Client");
                if (GUI.Button (new Rect (100, 125, 100, 25), "Disconnect")) {
                    Network.Disconnect (250);
                }
            }
            if (Network.peerType == NetworkPeerType.Server) {
                currConns = Network.connections.Length;
                GUI.Label (new Rect (100, 100, 100, 25), "Server");
                GUI.Label (new Rect (100, 125, 100, 25), "Connections: " + currConns);

                if (prevConns != currConns) {
                    if (prevConns < currConns) {
                        Debug.Log ("NEW CONNECTION");
                        prevConns++;

                    } else if (prevConns > currConns) {
                        Debug.Log ("Lost CONNECTION");
                        prevConns--;
                    }
                }

                if (GUI.Button (new Rect (100, 15, 100, 25), "Shutdown")) {
                    Network.Disconnect (250);
                }
            }
        }
    }

}

Client Code

using UnityEngine;
using UnityEngine.Networking;
using System.Collections;

public class connection : MonoBehaviour
{

    public string IP = "127.0.0.1";
    public int port = 25001;
    public GameObject player;

    public virtual void OnClientConnect (NetworkConnection conn)
    {
        ClientScene.Ready (conn);
    }

    void OnGUI ()
    {
        if (Network.peerType == NetworkPeerType.Disconnected) {
            if (GUI.Button (new Rect (100, 100, 100, 25), "Start Client")) {
                Network.Connect (IP, port);
            }
        } else {
            if (Network.peerType == NetworkPeerType.Client) {
                GUI.Label (new Rect (100, 100, 100, 25), "Client");
                if (GUI.Button (new Rect (100, 125, 100, 25), "Disconnect")) {
                    Network.Disconnect (250);
                }

                if (GUI.Button (new Rect (100, 150, 100, 25), "Send Cmd")) {
                    CmdSendCommand ();
                }

            }
        }
    }

    [Command]
    void CmdSendCommand ()
    {
        NetworkBehaviour.print ("HELLO");
    }
}

sentences:
How does condition 5 of the Open Font License apply to using a font in my game/engine? For my game-engine I have created an debug-console I use for more complex operations and tests, logging, etc.

When looking for a good & clean font I considered using Google Fonts. Many if not all fonts on there are licensed under the Open Font License1, which seems to be the real deal.

Yet when reading the license I got confused if condition 5 also applies to videogames/engines:

  5) The Font Software, modified or unmodified, in part or in whole,
  must be distributed entirely under this license, and must not be
  distributed under any other license. The requirement for fonts to
  remain under this license does not apply to any document created
  using the Font Software.

emphasis mine

So, how does this condition translate to me using it for my engine/game? And how would I go about properly attributing?

1Link to the license definition: http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL

sentences:
Snake game steering with Java FX I am currently trying to make a snake game with Java FX, I read several posts about it and I understand on theory how to move the snake body (for each part of the snake reference the previous one and move it to its former location) but I am facing some issues, my snake is not able to turn around properly:

I would just like it to react as a normal snake, when the head steers into a direction then the other body parts follow one by one.

In my case I created a vector class to store positions and velocity (I use velocity to be able to move all the part at the same speed and therefore be able to keep the 3 pixel gap between them).

I usually trying my best to resolve issues but this time I've spent almost 3 hours knowing the theory and groping for a proper way to do it but without any improvements.

I tested different approaches but this one seems to be the clearest and the nearest to the solution to me:

I got 2 simple classes that are Vector (only holding reference to X and Y) and Block that holds references such as Position, Velocity for the current motion, nextVelocity to anticipate steering, Previous for the previous block in the snake body.

I initialize my snake like that :

    public Snake(){
    this.head = new Block(250,250);
    for(int i = 0; i < 5; i++){
        if(i == 0){
            body.add(i, new Block(new Vector(head.getPosition().getX() - 18 , head.getPosition().getY())));
            body.get(i).setPrevious(this.head);
        }else{
            body.add(i, new Block(new Vector(body.get(i-1).getPosition().getX() - 18, body.get(i-1).getPosition().getY())));
            body.get(i).setPrevious(body.get(i-1));
        }
    }
    this.head.setPrevious(body.get(0));
}

Then there are my steer() method for the head as well as my follow() method for the other body parts.

I used the variable nextVelocity that stores the velocity of the previous part if this one is different from the current one, in this case nextVelocity is passed to velocity at the next frame to avoid that the whole body moves at the same time in the direction taken by the head (which apparently doesn't work):

public void steer(Vector velocity){
    this.velocity = velocity;
    this.position.add(velocity);
    this.shape.relocate(this.getPosition().getX(), this.getPosition().getY());
}

public void follow(Block previous){
    if(this.velocity == null) {
        this.velocity = new Vector(previous.velocity);
    }else if(this.nextVelocity != null) {
        this.velocity = new Vector(this.nextVelocity);
        this.nextVelocity = null;
    }else if(this.previous.velocity != this.velocity){
        this.nextVelocity = new Vector(this.previous.velocity);
    }
    this.position.add(this.velocity);
    this.shape.relocate(this.getPosition().getX(), this.getPosition().getY());
}

And finally my move() method handling the whole snake moves:

public void move(Vector direction){
    this.head.steer(direction);
    for(int i = 0; i < body.size(); i++){
        if(i == 0){
            body.get(i).follow(this.getHead());
        }else{
            body.get(i).follow(body.get(i-1));
        }
    }
}

If anyone could point me into the right direction or just let me know where I am mistaking it would be amazing.

sentences:
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:
Most optimal way to find closest object So currently ive been using the physics.castSphere method with a small radius to find the closest of an object with a tag.

However this is pretty performance heavy so my question is, is there a way to optimize it?

i  have also been looking at keeping a list of gameobjects and just looping through those however doing that a few times a frame for each object searching also seems rather performance intensive.

Here is my case:

  50 individual characters on team 1

  50 individual characters on team 2

each character has to find the closest of the character from the other team.

What is the fastest and least performance heavy way of doing it?

sentences:
Registering XNA Custom Pipeline A while back I was looking for a way to export / load Models in XNA for animations. I took the advice from a comment, and tried using the "SkinnedModelProcessor" he linked me to. It worked great at home, but at school, I can't seem to get XNA to acknowledge that I have a custom pipeline in the solution. I've added the references to both the content project and the main project, but no luck. When I compile the example, Visual Studio complains that the content processor can't be found. When using my own project, Visual Studio doesn't have the custom Pipeline Processor as an option. When using the example, "SkinnedModelProcessor" is the value in the fields, but if I click on the combobox, that option isn't there, and VS still complains. Obviously this is a problem with how Visual Studio is configured, but I have absolutely no clue what I should do about it. Any suggestions guys? I guess I could build the code for animations at home, and not worry about it at school, but that sounds like the easy way out.

[/walloftext]

Some notes that are probably worth mentioning:
* Any settings that I apply are reset when I log out.
* Any changes to the C drive are reset when the computer shuts down.
* The project is stored on a network location, which has caused problems in the past, evidently. ( Although, I personally don't know what these problems would include ).

sentences:
Calculate smooth transition between local space angles I'm trying to calculate direction of moving character (to rotate it's animation).
I have something like this:

Character can have 4 cardinal directions. The rotation is calculated from the current cardinal direction.
So for example For north we have -90 degrees from N to W and 90 degrees from N to E.
From E to N we have -90 degrees and from E to S we have 90 degrees.

The problem occurs when character is switching directions.It happens at about half the distance between cardinal directions. At this point current rotation is switching from negative to positive number (or other way around), and there is noticeable hitch. When for example going from E to N, it switches to N direction but it was at about -45 degrees which in N space it places for a frame or two between N and W directions.

Why do I calculate angles in cardinal direction space ? Animations are prepared for strafing or moving backward (or any other angle) and I need to assume that the direction of animation is 0 degrees and calculate from here.

Is there way to smoothly change angle between cardinal directions ?

For now I tried to lerping between them when switching (which improved overall look but is far from smooth transition), tried to  track from which direction the switch is coming, but it didn't really improved anything.

FVector Right = Character->GetActorRightVector();
FVector Forward = Character->GetActorForwardVector();
FTransform Transform = Character->GetTransform();
FVector CurrentAcceleration = CMC->GetCurrentAcceleration();
FVector CurrentVelocity = CMC->Velocity;

FVector AccelerationDirection = CurrentAcceleration.GetSafeNormal2D();
FVector VelocityDirection = CurrentVelocity.GetSafeNormal2D();

FVector LocalAcceleration = Transform.InverseTransformVectorNoScale(AccelerationDirection);
FVector LocalVelocity = Transform.InverseTransformVectorNoScale(VelocityDirection);

float DeltaTime = Output.AnimInstanceProxy->GetDeltaSeconds();

float Atan2Angle = FMath::Atan2(LocalVelocity.Y, LocalVelocity.X);
const int32 ChildIndex = FMath::RoundToInt((Atan2Angle * 2 / PI) + 4) % 4;

float VelAngle = FMath::RadiansToDegrees(VelQuat.GetAngle());
float OldOrient = CurrentOrient;

EFCardinalDirection Dir = static_cast<EFCardinalDirection>(ChildIndex);
EFCardinalDirection OldDir = static_cast<EFCardinalDirection>(OldDirection);

float DirDot = 0;
//main switch wihin which I determine from where calculate angle.
switch (Dir)
{
case EFCardinalDirection::N:
{
    FQuat ForwardQuat = FQuat::FindBetween(Forward, CurrentVelocity);
    float OrientN = FRotator(ForwardQuat).Yaw;
    CurrentOrient = OrientN;// FMath::FInterpConstantTo(OldOrient, OrientN, DeltaTime, 300.0f);
    break;
}
case EFCardinalDirection::E:
{
    FQuat LeftQuat = FQuat::FindBetween(Right, CurrentVelocity);
    float OrientE = FRotator(LeftQuat).Yaw;
    CurrentOrient = OrientE;// FMath::FInterpConstantTo(OldOrient, OrientE, DeltaTime, 300.0f);
    break;
}
case EFCardinalDirection::S:
{
    FQuat BackQuat = FQuat::FindBetween(Forward*(-1), CurrentVelocity);
    float OrientS = FRotator(BackQuat).Yaw;
    CurrentOrient = OrientS;
    break;
}
case EFCardinalDirection::W:
{
    FQuat RightQuat = FQuat::FindBetween(Right*(-1), CurrentVelocity);
    float OrientW = FRotator(RightQuat).Yaw;
    CurrentOrient = OrientW;// FMath::FInterpConstantTo(OldOrient, OrientW, DeltaTime, 300.0f);
    break;
}
default:
    break;
}

sentences:
Why is my control scheme is not casual enough? I am building a game like counter strike but 2dimensional and for android, it is already in beta phase. I have already share it with my friends and classmates to play it. Almost all of them said the controls are bad. Followings are the current controls:

tap on player: shoot
tap NOT on player: pathfind to touchposition
vertical drag on screen: rotate the camera left or right

The camera position and rotation will respect the player's position and rotation to help them aim before shooting. I am trying to build this game as casual as possible, so the player can only shoot, hide (stop moving/idle), and seek (move). Is there a better controls or gameplay than the current one? I am willing to cut features or change the whole gameplay.. Thanks in advance.

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:
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:
Unity 2019 Error : com.unity.xr.arsubsystems@2.2.0-preview.3/Runtime/ImageTrackingSubsystem/XRImageTrackingSubsystem.cs57,30): error CS0506: I am opening an old project created in 2019.3 inside my new Unity 2019.4.  I got this error message in Unity Console:
Library/PackageCache/com.unity.xr.arsubsystems@2.2.0-preview.3/Runtime/ImageTrackingSubsystem/XRImageTrackingSubsystem.cs(57,30): error CS0506: 'XRImageTrackingSubsystem.Destroy()': cannot override inherited member 'Subsystem.Destroy()' because it is not marked virtual, abstract, or override

Please note that this current project does not use anything related to AR "Augmented Reality" or XR package.
I have already Googled this error message, but have not seen a solution yet.
However, I guess that this error likely comes from some conflicts in the AR or XR versions.
To fix this error, should I install or update the basic Unity XR or AR package ?
Thank you very much.

sentences:
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:
Circular class dependency Is it bad design to have 2 classes which need each other?

I'm writing a small game in which I have a GameEngine class which has got a few GameState objects. To access several rendering methods, these GameState objects also need to know the GameEngine class - so it's a circular dependency.

Would you call this bad design? I am just asking, because I am not quite sure and at this time I am still able to refactor these things.

sentences:
How to create a view looking down the sight of the gun I am in the midst of creating an FPS game using XNA.  I am using the camera class from the First Person camera demo from dhpoware.com, and everything is working great.  What I'd like to implement is the ability to press the right mouse click and then the view changes so that you look down the gun, like the following image:

I have searched and searched but haven't found anything that will help me out, or at least point me in the right direction.  Can anyone help?

sentences:
How can one impliment multiple control schemes for a single player? I am working on a platformer and I want to have the player be able to switch control types based on items that may be carried + default controls for things such as water, in the air, on the ground etc...

I understand how to make a player move in anyway I desire but I don't understand how I can encapsulate these behaviors into their own classes and call and apply them to the player when needed.

The way I have it is this:

Input is handled by the input class.
During the update, the player looks at the input class.  It then figures out how it should move itself with a bunch of if statements to figure out what rule set should be applied. For example:  Am I in the water?  Am I on the ground? Am I in the air?  and so on.  Based on the previous questions the player object then decides how to interpret the input.  After everything is done, the results are edited by world rules which applies things such as gravity, etc...

This seems to work but it is not elegant and results in duplicated code.  Its ugly.  How should I set up some classes and how should they talk to each other?  All I manage to do is make a mess of my code trying to class it out.  I have searched around for sometime on how I need to do this but can't find anything.

Any pointers on where I can go to figure this out?  Any advice?  I just know I need the code contained so it's easy to debug later and figure out what is happening.

sentences:
Physics fixed time step with client/server games I'm trying to make a 2D platforming multiplayer game with client/server system.
I want to use Node.js and Phaser for the display.

I read a lot about fixedTimeStep : http://gafferongames.com/game-physics/fix-your-timestep/

Do you think it's viable with JS (and Phaser)?
Do you think it's possible to decouple update() and render() loop with a single-threaded language like JS?

sentences:
What is the correct way of changing image of existing CCSprite? How do I correctly change sprite to show another image? Or to have another texture?
This is the way I do it now. When I need to change sprite image I increase state variable. So i have one picture for 0, another for 1 and another for 2.
First i tried just saying mysprite = [CCSpriteWithFile:@"sprite.png"] but that didn't end up too well since I was making new objects every frame and it got messy pretty fast.
So I added a check. There is another variable that is stateChanged and it starts at zero. So I compare state to stateChanged before actually making any sprites and if it differs I do the magic.
But here comes the problem. Somehow this sprite won't flip. And I believe the problem is in this method.

- (void) updateState
    {
        if (stateChanged != state) {

        if (state == 0)
            {
                currentSprite = [CCSprite spriteWithFile:@"eggclosed.png"];
                [self addChild:currentSprite];
            }

        if (state == 1)

        {
            currentSprite = nil;
            [self removeAllChildrenWithCleanup:YES];
            currentSprite = [CCSprite spriteWithFile:@"eggopen.png"];
            [self addChild:currentSprite];
        }

        if (state == 2)
        {
            currentSprite = nil;
            [self removeAllChildrenWithCleanup:YES];
            currentSprite = [CCSprite spriteWithFile:@"yoshi.png"];
            [self addChild:currentSprite];
        }

            stateChanged = state;
        }
            }

TLDR: How to correctly change image of sprite. I have a Pet object that has a CCSprite property. And I sometimes need to change sprte to look another way. How do?

sentences:
XNA 4.0 HLSL - strange depth map I want to draw my pre-rendered depth map to the scene.

I get my depth value in the following way:

basically (Pixel Shader)

// Depth is stored as distance from camera / far plane distance, 1-d for more precision
output.Depth = float4(1-(input.Depth.x / input.Depth.y),0,0,1);

where (Vertex Shader)

output.Position = mul(input.Position, worldViewProjection);
output.Depth.xy = output.Position.zw;

(input = output of Vertex Shader)

and store it in a RenderTarget2D

depthTarg = new RenderTarget2D(GraphicsDevice, viewWidth,
                viewHeight, false, SurfaceFormat.Single, DepthFormat.Depth24, samples, RenderTargetUsage.DiscardContents);

But somehow, when I draw that (Single), I get this result:
(displaying rgb)

channel r:

(all black)

channel g:

channel b:

channel a:

Why is there data in every color channel althrough i only defined a value on the red parameter (and 1 on a, but you can somehow see the outlines of the model, so it cant be all 1)

And surprisingly, the b channel looks almost like what I am looking for, but has strange lines in it which stay at the same distance to the camera if I move it.

sentences:
Calculated normals for mesh not working I am trying to implement a 3D mesh viewer with C++ and OpenGL ES 2. I am currently struggling with the calculation of the normals for the vertices, or at least I think that is where the problem lies... I tried to use the technique described in http://www.iquilezles.org/www/articles/normals/normals.htm to calculate the normals for my mesh. Here is the code that I came up with:

    // Calculate the non-unit normals for each face first
    glm::vec3 faceNorms[mesh->trigCount];
    for (std::size_t i = 0; i < mesh->trigCount; i++)
    {
        glm::vec3 vecs[3];

        for (uint8_t j = 0; j < 3; j++)
        {
            auto idx = (mesh->indices[i + j]) * 3;
            vecs[j].x = mesh->vertexFloats[idx];
            vecs[j].y = mesh->vertexFloats[idx + 1];
            vecs[j].z = mesh->vertexFloats[idx + 2];
        }

        glm::vec3 e1 = vecs[0] - vecs[1];
        glm::vec3 e2 = vecs[2] - vecs[1];
        faceNorms[i] = glm::cross(e1, e2);
    }

    // Now we need to sum the face normals for each vertex with larger faces carying more weight
    // due to their non-unit normals. We can then normalize the sum to get the vertex normals.
    for (std::size_t i = 0; i < mesh->vertexCount; i++)
    {
        glm::vec3 norm(0.0f);

        for (std::size_t j = 0; j < mesh->vertices[i].trigIdxs.size(); j++)
        {
            norm += faceNorms[mesh->vertices[i].trigIdxs[j]];
        }

        mesh->vertices[i].trigIdxs.shrink_to_fit();

        if (norm != glm::vec3(0.0f))
            norm = glm::normalize(norm);

        std::size_t pos = i * 3;
        mesh->normalFloats[pos]       = norm.x;
        mesh->normalFloats[pos + 1]   = norm.y;
        mesh->normalFloats[pos + 2]   = norm.z;
    }

At the moment I believe that all the importing code is correct as I thoroughly checked it out and tested what I could. The model is imported with arrays for all the vertex and normal floats and a float with indices. This is so that I can easily pass the data to OpenGL. As part of the importing I am keeping track of which faces share a vertex.

As far as I can see this code should be compatible with that in the article. I don't really have too much experience with OpenGL and the math involved to know if it should work in the first place though.

I tried to implement some shading using the information on http://www.learnopengles.com/android-lesson-two-ambient-and-diffuse-lighting/ but quickly ran into some trouble. It seems that the moment I try to translate the normals to eye-space, the dot product of the normal and the "light vector" becomes 0 and any form of lighting vanishes, leaving me with a black silhouette of my model. The below shader is an attempt to try an determine if the value is indeed 0. It is not a proper shader though so please don't comment on it being incomplete as to any specific lighting model.

uniform mat4 uModelMatrix;
uniform mat4 uViewMatrix;
uniform mat4 uProjMatrix;

attribute vec4 aPosition;
attribute vec4 aNormal;

varying vec4 vColor;

const vec3 lightPos = vec3(10.0, 10.0, 10.0);
const vec4 baseColor = vec4(1.0, 0.5, 0.25, 1.0);

void main()
{
    vec3 norm = vec3(uViewMatrix * uModelMatrix * aNormal);
    vec3 objPos = vec3(uViewMatrix * uModelMatrix * aPosition);
    vec3 lightVector = normalize(lightPos - objPos);
    float cosine = dot(norm, lightVector) * 100000000.0;
    vColor = baseColor * cosine;
    vColor.w = 1.0;

    gl_Position = uProjMatrix * uViewMatrix * uModelMatrix * aPosition;
}

And the other half:

varying vec4 vColor;

void main()
{
    gl_FragColor = vColor;
}

This happens with any model that I try to load. I can post more information if needed but I have a feeling that my mistake is glaringly obvious (for an OpenGL expert of course) and somewhere in the code that I have here.

PS. If I use some basic non calculated shading like just using a semi-transparent color for each vertex then I can see that my model appears to be correctly loaded.

sentences: Dynamically editing a movieclip at runtime I am trying to make a flash game(actionScript-3 if it matters) to test what I learned so far. And, in the game, I want to make the character(a robot?) customizable. The first solution I found was to edit the character movieclip directy. Is it possible to edit a movieclip at runtime? If yes, how?

sentences:
Which Box2D-like physics engine parameters need pixel conversion? The official guide does not have any useful details on the matter:

http://www.box2d.org/manual.html

Position is an obvious one. What about velocity? Density? Anything else?

Update: the context is wrapping/interfacing a physics engine to make it more usable. E.g. units of measure in the game editor should be consistent.

sentences:
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:
Collision 100% avoidance implementation I'm an absolute beginner with game development and all I know about collision avoidance/resolution, I learnt it on or through this site in the past week... so don't hesitate to correct me if what I'm asking here is based on wrong assumptions / misunderstanding. I tried of my best to be clear, but that said, the subject is still novel to me.

Vehicles

In my game, I have vehicles that move autonomously. They are placed in a 3D space, and their motion is governed by a number of variables which are different for each vehicles. The one of interest here are primarily:

Only forward motion.
A speed that can vary between min & max, but whose min is not (even close to) zero.
A steering radius that is dependent from the speed (the higher speed, the larger radius)
Two maximum accelerations (for decreasing and increasing speed)

Goal

My goal is to implement some sort of AI that will a 100% accurate collision avoidance (i.e. I will be sure that the vehicles will never ever collide).

Design

Although I would prefer more the idea of having the AI "onboard" (i.e. each vehicle having it's own "collision avoidance AI", eventually querying and/or sending messages to other vehicles) it is also possible for me to implement the CA AI at a central level (dispatching commands to the vehicles).
In most of the cases, the vehicle will simply have to steer clear of each other in any direction, but under certain circumstances, they will have to avoid collision and going towards the same target

What I found so far and where I got stuck

Within the many many links I found in other questions on this very site, I found of particular use these ones:

Collision between pool balls
Unalligned collision avoidance
Queuing

While these three links "opened my eyes" in many ways, it is not immediately clear to me how to use that information in my case. In particular article #2 only "tries" to prevent collision (but collisions do happens time to time). While article #3 needs to stop vehicles sometimes to prevent collisions.

What I also noticed, is that the collision avoidance algorithms linked above use a "instant projection" of linear speed to check if something is on the way of the vehicle. I was wondering if this is enough in my case or if I had to project my position in a more realistic way (e.g.: If I am 60° into a steering 90° to the right, I should calculate my position for the rest of the 30° of the curve, and then assuming linear motion).

Finally, I am particularly afraid of deadlocks. In other words: although the density of vehicles in the world will be fairly low, I am worried that given a certain numbers of vehicles converging towards the same point, once they will realise they are on a collision course, any evasive manoeuvres will be impossible as it would bring the vehicle on a collision path with some other ones.

Question

How can I reach my "goal"? An in depth-explanation is of course very much appreciated, but links to external resources would also be of great help (I'm sure I'm not the first with this problem, but probably I used the wrong keywords to search the web?)

Thank you in advance for your help!

sentences:
How to update model transform of components when using physics? I implemented a high level components system for my renderer and am curious about the right way to update the transforms components of models that have a physics rigidbody attached. I am using bulletsharp. To clarify. Transformcomponents holds the model matrix that is used for rendering. Rigidbody holds the worldmatrix that is getting modified by step simulation of bulletsharp. I want my rigidbody and transformcomponents matrices to stay synced.

My idea is to do it like this per render loop:

Always use transformcomponent for rendering
Execute physics step simulation
Update all transformcomponents with new matrices from  rigidbody
Whenever transformcomponent gets a matrix update from user input and not physics... Update the matrices recursive for the attached rigidbody and all children
Render with matrices of transformcomponents

Is there a better way to implement rigidbody physics in a components system for rendering? I use the physics mainly for raycast picking and OBB collision detection.

And when I use the term "better", I mean more efficient in terms of least updates on scene components. Syncing two components matrices seems tedious and I want to know if there is a solution without syncing.

sentences:
How to change the intensity of a light I just want to change the intensity of a light.

The script is already in the light object, but I can't turn it up or down to save my life, and wherever I look, no one has the answer.

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

public class Flashlight : MonoBehaviour
{

    public bool flashOn;

    void Update()
    {
        if (flashOn)
        {
            light.intensity = 0;

            if (Input.GetKey("q"))
            {
                flashOn = false;
            }
        }
        else
        {
            light.intensity = 1;

            if (Input.GetKey("q"))
            {
                flashOn = true;
            }
        }
    }
}

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

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

Is there a way to prevent this?

sentences:
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:
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:
Rotation of a 3D ball on a plane This used to be on the physics stack exchange but I was told to put it here:

I'm making a game (with physics) and I have a 3D ball rolling down a flat plane. It moves perfectly fine, but the rotation is messed up. It seems way too fast, and the axis seems to be all wrong. Here's the code that runs every tick (20 times per second). (normal is the normal to the plane, acceleration is gravity vector projected onto the plane, in m/tick2, and velocity is the velocity in m/tick.)

vec3 rotationAxis = normalize(cross(normal, acceleration));
quat newRotation = rotate(oldRotation, length(velocity) / sphereRadius, rotationAxis); // rotate by v/r radians about the rotationAxis

I'm not sure why this doesn't work, since according to angular mechanics, v=rω and ∆θ=v∆t/r (and ∆t=1 since velocity is in meters/tick). Am I doing something wrong? Why is the rotation so much faster than it should be? And is my axis of rotation correct?

Rephrased in a more physics way, is this correct in 3D:

$$\hat{x} = \frac{\hat{N} \times \vec{a}}{|\hat{N} \times \vec{a}|}$$

$$\Delta \theta \textrm{ about } \hat{x} = \frac{v}{r} \Delta t$$

And if it is correct, then what’s wrong with my code?

sentences:
Best way to initialize values on 32-bit FP framebuffer in OpenGL I have a framebuffer bound to 32-bit FP texture:

glGenTextures(1, &texColor);
glBindTexture(GL_TEXTURE_2D, texColor);
glTexImage2D(GL_TEXTURE_2D, 0, GL_R32F, w, h, 0, GL_RGBA, GL_FLOAT, (GLvoid*)NULL);
glBindTexture(GL_TEXTURE_2D, 0);

glGenFramebuffers(1, &fbo);
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texColor, 0);

What's the best way to initialize framebuffer to a value 1000.0?

The problem is that

glClearColor(1000.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);

clamps values to [0,1] interval, and clearing the texture texColor would require memory allocation of w * h * sizeof(float) bytes of memory and manual filling of that buffer with value 1000.0 which is slow (I would inject it using glTexImage2D).

I'm using OpenGL 3.2 Core profile.

Thanks,
Josip

sentences:
LAN game in Actionscript 3 I know this may be a somewhat dumb idea, but is there any "easy" resource that anyone can point me towards that shows how to set up a simple LAN connection in an Actionscript application? I only need to have two clients connected. Nothing extremely robust.

This is not an AIR application. It's for a game idea that I have that will need two players essentially. It will be local, so having each other's IP addresses will be an option. So no need to find or detect any IP addresses.

Thanks.

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:
Path Planning in a chaotic, ever-changing environment I've implemented Path Planning a few times, using A* on nav meshes, and also Continuum Crowds but now I am trying to plan paths in very chaotic environments.

In this environment, new routes and new blockages are created constantly, and chaotically. This is because the environment is fully destructible, and the debris can create new obstacles.

In such an environment, nothing can be pre-computed. What would be a good way to sense the traversability in such a world? There is no concept of a grid in my world, b.t.w, but I wonder if I should introduce an artificial one for the purpose of planning.

But if navigation could be achieved without a grid, that would be much better of course.

Note that the navigation is not merely dynamic in the sense that certain transitions get opened/closed, but actually chaotic. This stops me from a simple approach of enabling/disabling certain edges on the navigation mesh. That approach would be usable if, e.g. a gate gets locked/unlocked. But in my case, in a blink of an eye, the routes could be drastically changed where simple mutations of a pre-computed mesh are not doable.

sentences:
Exporting a simple mesh from Blender for reading in Assimp I'm trying to create some simple assets for using in my rendering engine. What I'm trying to do is to generate simple low poly models and then importing them into my application using Assimp. I can successfully import models I find on the web so everything works fine application-wise. But since I'm a total noob at Blender (I managed to learn some interface basics through tutorials) I just seem able to export a model with geometry information (vertex positions) and that's it. My models don't have normals or uv-cordinates, and no textures whatsoever.
What I'm asking is a simple workflow to create and export a very simple mesh to a obj or collada format that I can read into my code.

sentences:
How to monetize and protect a engine's and its framework's copyrights and patents? I created a game engine that handles:

Rendering levels with 2d textured curved surfaces
Collisions with curved surfaces
Animationn paths on and navigation in 2d-sapce

I have also made a framework for:

Procedural organic level generation with round surfaces
Level editing
Light weight sprite design

The engine and framework are written in AS3 and I am in the process of translating the code into HaXe to better support other platforms.

I am also interested in adding

Animated curved platforms
More advanced level editing features

Currently, I have a part time job and any time I spend on this engine is either taken out of my limited free time (I'm a student working to support myself through school) or out my time working at my job.

I really believe this engine can make life much easier for people designing Tower Defence games, Shooters and and Platformers while also possibly improving their results. It could also support RTS, RPGs and racing games very well.

It continains original algorithms that could be used for procedural generation of organic round and smooth levels. The algorithms I used are new and are not available in any other level editor I've seen.

In order to constantly improve the Engine and have it tested thoroughly I think the best route is releasing it to the public.

What are the best ways to benefit myself and others with my new framework?

I want to have some lisence, allowing me to share the framework and still benefit from it.

Any advice would be appreciated. This issue has been on my mind a lot this year. I am hoping to find a solution that will bring me some relief.

I am thinking of designing three sample games, releasing them and starting a kickstarter, any advice and thoughts on the matter would be valuable.

My goal is like Markus von Broady suggested, to get people involved in developing the engine and let people use it for games for either a symbolic fee or for free and charge for support.
That or use some form of croud sourcing.

Do I need to hire a lawyer to get some sort of legal document to protect my work?

sentences:
How can I bake several variations of a substance? I have a substance (sbsar) that I'm using to generate a procedural material .  I have applied this texture to reversi pieces.  It works well, but all the pieces look identical.  I addressed this by using a script to change the $randomseed property and then call the RebuildTextures method for each piece.  The effect is exactly what I want: each piece has a slightly distinct marble pattern.

The problem is that the process of rebuilding the textures for 64 pieces takes about 20 seconds.  For a simple Android game, this is not acceptable performance.

The designer has the option to "bake" the material under Load Behavior, but this only works for one variation.  Is there a way I can bake many different random seeds?  I'd be OK with pre-generating a batch of non-procedural materials from the substance and picking randomly from that batch at runtime, but I'm not sure how that can be done.

sentences:
Is a final yield return 0 required in corutines? I have the following code run in a coroutine.

I would like to know if the last yield return 0 is necessary and why.

Thank you!

private IEnumerator pChangeFoV()
{
    float duration = 0.7f;
    float zValue = 5f;

    for (float t = 0f; t < duration; t += Time.deltaTime)
    {
        float fNew = Mathf.Lerp(_camera.fieldOfView, zValue, t / duration);
        _camera.fieldOfView = fNew;
        yield return 0;
    }
    _camera.fieldOfView = zValue; //make sure we're really where we want to be

    //now do everything that should be done after we're done with this coroutine

    pEnableSomeScripts();

    yield return 0; //is this final yield return 0 required???
 }

sentences: TRS Matrix between 2 points I have got 2 Points in 3D Space whose TRS Matrix' from 0.0 to there current place is known. Now I want to change the Matrix of the left point so that the matrix of the right point combined with the new Matrix results in the point being at the same position as before. Here a short illustration that I hope helps a little. Sorry for the bad explanation

sentences:
Material tiling and offset in unity Ambiguity:
What exactly is the difference between Tiling the material and Offset of material?

Need to do:

I need the material to be repeated n times on the object where I need to set the value of n via script.How do I do it?

It seems to happen through Tiling(tried via inspector) but again what is difference between mainTextureOffset and setTextureOffset?

Tried:

Following is the line of code that I tried to repeat the texture n number of times on an object(repeat across the width of object), but it does nothing significant that I can see.

sentences:
game server - fault tolerant If you have for example an MMO with 2000 players, and players are constantly removing / creating / swapping items (and doing some other important things that can't be lost).

If the updates are saved instantly in the database, since they are too many, the database dies. If you save them every "x" minute, there's a window where if your server app dies, players may lose items, and sometimes they may be expensive, let's say 100$, so that can't happen.

Is there a design or a guide I could read that handles this issue? The games I play today do not have that problem.

sentences:
Creating a model procedurally through coding? Possible Duplicate:
  Creating a basic character skeleton from code

I'd like to have a procedural system that uses a string of data to create a 3d creature. The way I've thought to do this is to use the code to generate a simple creature frame, and later add something to add additional detail.The goal is to create creatures of different forms and frame. The creation will be mirrored down the spine so both sides are the same.

I assume it will work best to generate it like bones so the code would have information used to show what type of bone it was(hierarchy), the bone length, and how the bone was positioned and use this to make the model. (At least in planning, I don't know how to implement it)

I'd like it to be highly adaptable but I'd like to specify a max of 4 legs and 4 arms (8 limb max only 4 on ground for walking). Being able to create a basic structure for humanoids, quadrupeds, and mixes (like a centaur or biped with no arms) is the goal.

I've looked into turtle graphics, l-systems, metaballs, and FReps. But I still don't know what to use. How can I use a set of data to generate the simple 3d frame?

sentences:
Monogame: Texture anti-aliasing result in transparent edges This is a follow-up question on a previous issue I faced with a game I'm trying to make. It's in a 2D isometric perspective and the levels are created from individual tiles. A simple 3x3 map can be seen here:

The tiles are individually added to the sprite batch, and (at least, this is what I think is happening) each one get anti-aliased on their edges, resulting in a small blur which creates the thin edges that you can see in the picture.

To make matters worse, I actually want to provide a bit more complex tiles in my game than what is displayed above. For example, I want to be able to show roads. To do so, I wanted to layer multiple sprites on top of each other, resulting in the picture below:

I think you can see where I'm going here. The same problem that I described with the aliasing is now occuring aroud each texture. So sad.

I know I can use Point sampling to make the textures align pixel perfect, but even though this does work, the (relatively) high resolution textures really do not seem fit for such a setting:

I mean, these edges simply need to be anti-aliased.

So, my question to you all is: Is there a way to stitch my tiles (and tile-pieces) together in a way so that anti-aliasing does not ruin it with those annoying edges, while still being able to produce a nicely anti-aliased result?

I hope there is, and that someone here can show me how :)

Thanks,

Rutger

Edit 1: Changed the title to be more representative to the problem (I hope?)

sentences:
Drawing Chess Board vs Using Picture Would it be better to actually draw the board in a script and attach colliders to each piece or get a picture and add the colliders before the game starts?  Is the difference in processing power needed significant?

Which way would be the easiest for figuring out where a specific piece is?

sentences:
Legally possible to re-create/remake an old game? Recently I started remaking an old game on Unity. Basically I want to remake an old RPG that was released for Playstation 1. I'm not ripping anything from the old game, all the assets are being created by me. I'm creating everything from the scratch, music, 3D models, gameplay however I will keep the (copyrighted ?) names, I will try to create the characters and maps/levels as they were in the original version of Playstation 1 but with better graphics.

I'm not planning on selling it or adding in on a platform like Steam (for obvious reasons, copyrights etc), just giving it for free. But I wanna know when I will finish the development, can I share the game on public with other people so they can download it?

Can the company that made the original game sue me/fine me because of copyrights reasons even though I'm not planning on selling for money?

tl;dr Remake an non-profit game of PS1 from the scratch, can the company that holds the copyrights of the game sue me/fine me?

sentences:
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: Use a different language for engine and game Just a quick question that I haven't been able to find an answer to, I am creating an engine for a game, I have begin making the engine in C++ but I want to make the game in java. My question is, is there a way to maker my game in a different language on a separate "layer"?

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:
Pathfinding in non-quantized space? Pretty much whenever anyone thinks about pathfinding, they think about algorithms like A* and DFS - graph search algorithms, which also just so happen to work as pathfinding algorithms when you quantize the space you're pathing in into a graph.

What if that's not an option, though? Are there efficient pathfinding algorithms that work in space that hasn't been split in to chunks? The "left hand rule" is one example; walk forward and when you hit a wall, turn left - but there's plenty of situations where that won't ever find the target. Are there others like that?

sentences:
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:
OnTriggerExit2D called multiple times when two triggers touch I have two GameObjects tagged "Point", each with a Collider 2D set to Is Trigger.

I have another GameObject, "pencil", which also has a Collider2D set to Is Trigger

I want to move the pencil the first point to the start drawing a line, and then stop drawing when it hits the second point.

My problem is that when the pencil hits a point, it calls OnTriggerExit2D multiple times. How can I only detect first contact with the point?

Pencil script:

private void OnTriggerExit2D(Collider2D collision)
{
    if (!collision.isTrigger)
    {
        if (collision.gameObject.tag == "Point")
        {
            writing = !writing;
        }
    }
}

sentences: Mute sound in editor in Unity Is it possible to mute sound in editor in Unity? I mean not in the game, but in the editor, so that when I am debugging there would be no sound whatsoever.

sentences:
Unity, Does camera ALWAYS render to RenderTexture? I have a camera that renders a simple model to a RenderTexture. I then use that RenderTexture as a texture for my UI with a RawImage component. However, sometimes I disable my UI and therefore you can not see the RenderTexture.

My question is: Does the camera continue to render to the texture in the background even when the texture is not visible?

If I understand how this works I believe it should. If so, simply disabling the camera should prevent it from rendering in the background?

Thanks.

sentences:
Making quick time events in my text adventure more noticable I'm making a post-apocalyptic text adventure in Unity. One of the gameplay features I've added is a quick time events on certain parts. Whether a part is a quick time event is defined inside the story json data like this:

  "PartName": {
    "text": "",
    "choices": {
    },
    "timer": { // if this key exists, the timer event will be triggered..
      "time": "10",
      "nextPart": "" //what part it goes to when the timer ends.
    },
    "background": "" //background of part
  },

When the timer runs out, you'll be forced into a part where the player dies or a unfavorable decision is made that will effect you later on in the game.

Here's a screenshot of a part that contains a quick time event:

Notice anything? The timer is the circle(radial timer) in the right hand corner. My main problem is trying to make sure players know there's a quick time event happening. These will be rare occurrences since I don't want to over-do them(ex: a quick time event every couple of parts) so I feel like the average player will not know that there's a quick time event.

One way I've thought of addressing this issue is by stating what a quick time event looks like in the how-to-play section of my menu, but since that's "locked" away by a button (you have to click a button to get to the section), people may just skip it entirely since text adventures aren't really known for the most complex controls in gaming.

Other ways I've thought of addressing it:

Music cues

pros: I have complete control over what music I can put there
cons: Since some parts have a defined background music, it might not be noticed by the player

Background tints (changing color of background)

pros: Easily noticeable change and will be unique only to timed parts.
cons: Might look ugly or players may not notice the significance of why the background suddenly changed color

Large timer in the middle of the screen

pros: Easily noticeable and players will notice it's a timer
cons: May be obscured by a text and or look ugly.

So I need help either deciding which the best course of action will be to address the issue from the list above over

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:
Algorithm to select all cells inside rooms/regions I have a 2d game map consisting of several 'rooms'

For example, here is a 2D map grid: (Brown cells = wall tiles)

If I click on a tile (that isn't brown), I would like to obtain an array of all the cells in the region that I clicked. (If the region is bounded by brown tiles, otherwise do nothing)

For example, there are two regions in the image above, both colored in grey. If I clicked cell (4,4) I would get a 4x5 array of cells starting at (3,3).

Does anyone know a good performance efficient algorithm for this? I need to account for non-square rooms ideally.

sentences:
How to set an EditorGUI foreground color for the light Unity skin? Writing an asset management GUI as part of our editor tools, I am in some places colouring LabelFields. Working mostly in the dark Pro skin, this seems to work just fine:

GUI.color = Color.green;
EditorGUILayout.LabelField("Name", GUILayout.Width(75f));
GUI.color = Color.white;

When switching to the light default skin however, this colouring is no longer visible. The usual GUI.backgroundColor still functions fine there as it does in the dark skin.

Is this "foreground" colour something specific to the dark Pro skin? If so, is there perhaps another way to achieve a similar effect?

sentences:
Screen or World Coordinates to tile Coordinates I have Plane made of tiles in opengl. I start drawing them at (0, 0, -20) after that i do my translations so that the view is rotated somewhat similar to an isometric (kind of) perspective.

I'd now like to know, how many tiles are visible in each direction. So what i need to know basicly is, which coordinates (int the "before translation" - space) are now visible in the translated view.

The "tiles" before the translations" (for example in x direction there are 14 tiles visible):

And after the translations ( now there are 28 tiles visible in "old" x direction):

I tried to get the visible area via gluUnproject with no success.

EDIT: I already asked this question when i was trying to build the exact same thing in 2D and i got a good answer:

Calculating the number of tiles shown on an isometric map

maybe this helps to describe my problem further.

sentences:
How can I limit the rotation angle of the object? At the top
float speed = 1.0f;
float rotationAngle = 45;

In Update :
private void Update()
    {
            if (Mathf.Approximately(transform.localPosition.y, 7))
            {
                float rotationY = rotationAngle * Mathf.Sin(Time.time * speedRot);
                transform.Rotate(new Vector3(0f, rotationY, 0));
            }
    }

but it's just rotating nonstop at the same direction.
I need it to rotate for example in the limited range of 45 to both sides like a ping pong from side to side. and optional to make it to rotate in limited angle/s for all axis but now for the Y how to limit it like a ping pong to rotate 45 degrees to the right then back to the left and so on nonstop but in limited angle/s.

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:
2D Collision : detection and design So, listening to this very smart piece of advice, I've already completed a basic Tetris game. Moving on, I started a small breakout. But suddenly : a nightmare came. Collisions.

Since I've been struggling with this a lot, I read a bunch of article of the web. Being a beginner, I thought that, in the first approach, I would only use Rectangle to detect collisions.

Right.

Now I still have some problems.

First of all, all the articles I stumbled upon on the Internet told me how to detect collisions, e.g. checking if objects A and B collided with each other. But it is not what I really need. In order to respond properly, I need to tell my objects if the collision happened on the X or Y axis and then setting the new velocity according to some rules. The problem is that there are so many possibilities when making the distinction between types of collisions that I don't think I've taken the right path.

The second point (which, I believe, is really tied with the first) is the pattern in which the detection and the resolution of a collision happen.
Right now, I have a CollidableObject classes and a CollisionDetector classes which knows about these objects. Each frame, the detector is looking for collision (or at least for me, is trying) and when he finds one, it alerts each collided object, saying "Hey you ! You've have collided with Z on the X axis, change that velocity now." and the object abides.

The main issue right now is that I can detect the collision axis and therefore, when saying "Hey you ! You collided !", I cannot respond properly. In which direction should my velocity change ?

I've been thinking a lot about this lately, trying to figure it out on my own, but I haven't find something that I liked so I am asking here now.

Thank you for your answers !

(Note : I don't know if this is relevant, but I'm coding in C++ using SDL)

sentences:
How to lead a moving target from a moving shooter I saw this question: Predicting enemy position in order to have an object lead its target.  My situation is a little different though.

My target moves, and the shooter moves.  Also, the shooter's velocity is added to the bullets' velocities, i.e. bullets fired while sliding to the right will have a greater velocity toward the right.

What I'm trying to do is to get the enemy to be able to determine where they need to shoot in order to hit the player.  Using the linked SO solution, unless the player and enemy are stationary, the velocity difference will cause a miss.  How can I prevent that?

Here is the solution presented from the stack overflow answer.  It boils down to solving a quadratic equation of the form:

a * sqr(x) + b * x + c == 0

Note that by sqr I mean square, as opposed to square root. Use the following values:

a := sqr(target.velocityX) + sqr(target.velocityY) - sqr(projectile_speed)
b := 2 * (target.velocityX * (target.startX - cannon.X)
      + target.velocityY * (target.startY - cannon.Y))
c := sqr(target.startX - cannon.X) + sqr(target.startY - cannon.Y)

Now we can look at the discriminant to determine if we have a possible solution.

disc := sqr(b) - 4 * a * c

If the discriminant is less than 0, forget about hitting your target -- your projectile can never get there in time. Otherwise, look at two candidate solutions:

t1 := (-b + sqrt(disc)) / (2 * a)
t2 := (-b - sqrt(disc)) / (2 * a)

Note that if disc == 0 then t1 and t2 are equal.

sentences:
Problem calculating normals for heightmaps So far I have been using normal avering to calculate the normals for my vertices in my heightmap, with good graphical result (see picture), however it is terribly slow. With a incresing image size the calculation time increases exponationally.

So I wanted to try implementing this algorithm insteed, but it isn't going very well. I have tried to trow around the variables a bit and tried diffrent combinations but nothing seems to work. Something that seems to be recurring is this shadow line pattern i get everywhere (the picture is a bit dark but i hope you can see the pattern).

My best guess to why this isnt working is because the algorithm isnt taking 2 of the neighboring vertices in to account in the calculation (See picture, blue is vertice we are trying to calculate normal for, green is the ones used in algorithm, red isnt used)

However, this algorithm seem to pop up in alot of places so that makes me think it has to be rigth. So im not sure if im doing it wrong somehow or if the algorithm is wrong. I was hoping some of you guys had runed in to the same problem and could give me some tips to what might cause this problem.

This is my translation of the algorithm im using

int cols = hmInfo.terrainWidth;
int rows = hmInfo.terrainHeight;

#define height(x, y)  hmInfo.heightMap[(y*cols) + x].y
XMVECTOR normal;
for(DWORD y = 0; y < rows; ++y)
{
    for(DWORD x = 0; x < cols; ++x)
    {

        float sx =  height( x < cols-1 ? x+1 : x, y) - height(x ? x-1 : x, y);
        if (x == 0 || x == cols-1)
              sx *= 2;

        float sy =height( x , y < rows-1 ? y+1 : y)- height(x, y ?  y-1 : y);
        if (y == 0 || y == rows -1)
            sy *= 2;

        normal=  XMVectorSet(-sx , 2.0f,  sy , 0.0f);
        normal = XMVector3Normalize(normal);

        tempSubset.vertices[y*cols+x].normal = XMFLOAT3(XMVectorGetX(normal),XMVectorGetY(normal), XMVectorGetZ(normal));

    }
}

PS. Seeing how it works with normal averaging im fairly sure that all other parts of the program is working fine DS.

sentences:
Reducing the number of edges in a pathfinder I've worked out an algorithm for pathfinding in a quite free-form terrain (not constrained to grids), with the limitation that it doesn't allow the moving character to rotate. I'll use it for AABBs so that's not a problem, and I'll assume AABBs below.

However, one of the steps consists of creating a graph in which the path is to be found, and that's where the problem is: it seems to me that the number of graph edges to construct is going to be O(V²) where V is the number of vertices. Yet when looking at a typical graph, it is apparent that many of these edges do not need any consideration at all. So the question is if there is a way to reduce the number of edges.

The algorithm goes like this. The input is a traveler, a series of boxes (the maze) and a destination point:

http://www.formauri.es/personal/pgimeno/temp/rect4572.png

(in this example, the reference point of the traveler is at the bottom right of the rectangle because I made a mistake estimating the MDs by hand; sorry about that)

Calculate the Minkowski difference of the traveler and each box in the maze: http://www.formauri.es/personal/pgimeno/temp/rect4574.png - this reduces the problem to having a point crossing that maze, simplifying analysis.
Create the graph:

2.1. Each vertex is a corner of one of the boxes in the Minkowski difference.
2.2. For each pair of vertices, there is an edge iff the line between them does not have any point inside one of the boxes. In other words, if there is a direct line of sight between them.

Result: http://www.formauri.es/personal/pgimeno/temp/rect4758.png (done by hand - I may have forgotten edges)
Run a pathfinding algorithm on that graph. http://www.formauri.es/personal/pgimeno/temp/rect4776.png

The path found is directly usable in the original map: http://www.formauri.es/personal/pgimeno/temp/rect5158.png

The problem is step 2.2. Is it possible to reduce the number of edges?

I'm not aware of any pitfalls in the algorithm, but if you see one, please let me know as well.

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:
Find point along x axis where yz plane flips to back facing after perspective projection. Have a solution but don't know why it works I am trying to find the point along the x axis where a plane with normal pointing along the x axis would flip to back facing after perspective projection. Essentially the red line in this image.
My first attempt to find it I just sampled along the x axis checking if a triangle there was back facing after projection. This only gave me an approximation but I could make the approximation as accurate as I wanted by just sampling more planes so I used this as a baseline to verify other solutions.
I then tried the following:
vec4 center = projection.inverse()*vec4(0,0,0,1);
center /= center.w;
float d = dot(center.xyz, vec3(1,0,0));
vec3 point = vec3(1,0,0)*d;

But this did not work, it was close but not right. See this image, the red line is the sampled point and the blue is the one calculated from that.
I then tried changing the calculation for center to projection.inverse()*vec4(0,0,-1,1) to see what that would look like. With the the sampled point in red, the blue line being the previous version and the green the new version. I got the following image which as you can see is still not correct.
But I noticed that the green was always directly between the blue and the red so I tried the following.
vec4 c1 = projection.inverse()*vec4(0,0,0,1);
c1 /= c1.w;
float d1 = dot(c1.xyz, vec3(1,0,0));
vec4 c2 = projection.inverse()*vec4(0,0,-1,1);
c2 /= c2.w;
float d2 = dot(c2.xyz, vec3(1,0,0));
float d = (d2-d1)*2 + d1;
vec3 point = vec3(1,0,0)*d;

Which seems to be correct but I have no idea why that works. It is always extremely close to the sampled point so I assume it is correct.
My question is why does this work?

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: generating complex maps in xna I just wonder how does these maps like in this video are made. http://www.youtube.com/watch?v=TM6kcOau5oQ  I was looking for some tutorials on the web but no success. All I found was some 2D Vectors (Matrixes) with 0,1,2 values on it but I think these maps are generated and stored in a different ways. Can somebody help me or give me some advice about these maps.  I saw some presentations about indie games and I was just amazed by these games. I want to make my own game. I am a beginner and already started an XNA book and some tutorials. I would like to learn how these games are made. Thanks!

sentences:
Lost on OpenGL versions, which to start? I was reading about OpenGL, and found out the Red Book is a great book for me to read to learn. I then read that even though they have 3.x and 4.x versions, I should still stick to 2.x so I don't create an artificial limit on who can play my game (older computers with older but powerful graphics cards would not be able to run 3.x and 4.x GL software).

So where do I start? I'm lost. Which book? I have no problem reading the 2.x version of the Red Book, which I believe is this one: http://www.amazon.com/OpenGL-Programming-Guide-Official-Learning/dp/0321335732/ref=sr_1_2?ie=UTF8&qid=1290869828&sr=8-2
but I won't know whats deprecated :(

cry for help

sentences:
How 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:
Can I use DirectX with C#? I thought that if you wanted to make games using DirectX, you had to know C++. But I recently found out that that is not actually true. It looks like some parts of Direct3D can be used from C#. This MSDN document, for example, which has C# examples.

Am I understanding this incorrectly? Have I waited all these years for nothing?

sentences:
Calculate the starting position of a turning aircraft with inertial force to make it stop at desired position and heading Continued from the answer here, I have some problem when the aircraft in my game has inertial forces after going forward and turning itself. To illustrate, from the following image (https://imgur.com/a/Xvqu2A7) the aircraft is moving from the point A -> B -> C'-> D. I planned to maneuver the aircraft from the point C' which is the point that would make the aircraft stop at the point D after turning with its full performance (using minimum turning radius).

The question is how do I calculate the position of the point C' to make the aircraft roughly stop at the point D with the desired position and heading (It is roughly since there is also an inertial force after stopping the aircraft's engine.)?
Any suggestions and answers would be appreciated.

sentences:
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: Checking if two lines are crossing How can I check if two lines (created with function love.graphics.line) are crossing themselves? I may use this ability to create procedural maps via graphs.

sentences: What is the price to license EA's GlassBox game engine? "SimCity 5" is powered by the GlassBox engine. If we want to use the engine for building our own simulations, what is the price for a license?

sentences:
Is it possible or not to share a geometry among many meshes and apply a different shaderMaterial for each? I instantiate one PlaneGeometry, then I instantiate 200 meshes sharing this geometry and with their own instance of a given shaderMaterial. Here is a simplified version of the code :

...
var geom = new THREE.PlaneGeometry(10,10,2,2);
var meshes = [];
var material=null;

for (var i=0 ; i<200 ; i++)
{
   var elevations = getElevations(i); //return an array of 9 values, values are different for each mesh
   var mat = new THREE.ShaderMaterial({
               vertexShader : vsAlti, //process displacement on y coordinate of the vertex
               fragmentShader : fsAlti,
               attributes : { elevation :  { type : 'f',value : elevations }}
            };
   meshes.push(new THREE.Mesh(geometry , mat));
}
...

Although the array value of the elevation attributes is different for each mesh, only one is applied for all of them. It looks like only one instance of shaderMaterial is applied to all the meshes. I would rather expect that for each mesh the shader with the matching attribute elevation values would be applied.

Here is the jsFiddle illustrating the problem : http://jsfiddle.net/McNulty/L584j/119/

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: The recommended road map to be a good graphics/game engine programmer I am a computer science student and I am developing with C/C++ and Python and I want to begin learning graphics tools to start developing with game engines, especially the Blender Game Engine. So what is your recommendation for me to learn and to read? And recommend me a road map for it.

sentences:
How to create "broken glass" animation? I have started making a 3D game in Unity5 that consists in avoiding obstacles. It is very easy but I want to add a collision effect when I collide on the wall.

I would like to slice the screen into many parts (random pieces is better) that are falling down from screen with gravity.

An example of what I mean:

How can I do this?
I've tried using a lot of different images (shapes) but I'm sure that is not the best way...

Thanks for any suggestions.

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:
Sudoku generation doesn't finish Heyho,

i got problems with my sudoku generator. First of all I generate some numbers between 1 and 9 and put them (according to the sudoku rules) into my game. After that I solve it using my second algorithm, but there's a problem with. It stops solving in the middle of the sudoku and says that there isn't a single solution for it, even if this sudoku has around 200 solutions.

private void generateSudoku()
{
//iSeed für den Random-Generator
iSeed = seeder.Next();
rnd = new Random(iSeed);

for(int i = 0; i < FIELDSIZE; i++)
{
    iContent[i] = 0;
    bEditable[i] = true;
}

switch(iDifficulty)
{
    case 0:  iNumbers = rnd.Next(30, 35);
        break;
    case 1:  iNumbers = rnd.Next(24, 29);
        break;
    case 2:  iNumbers = rnd.Next(18, 23);
        break;
    default: iNumbers = rnd.Next(24, 29);
        break;
}

for(int i = 0; i <= iNumbers; i++)
{
    int iValue = rnd.Next(1, 10);
    int iRow = rnd.Next(0, ROWSIZE);
    int iCol = rnd.Next(0, ROWSIZE);

    if(check(iRow, iCol, iValue) == 0)
    {
        iIndex = (ROWSIZE*iRow+iCol);
        iContent[iIndex] = iValue;
        bEditable[iIndex] = false;
    }else
    {
        i--;
    }
}

iSolutionCounter = 0;
solveSudoku(0);

Console.WriteLine("Solutions: " + iSolutionCounter);

if(iSolutionCounter != 1)
{
    //generateSudoku();
    //return;
}

for(int i = 0; i < FIELDSIZE; i++)
{
    if(bEditable[i] == true)
    {
        iSolution[i] = iContent[i];
        //iContent[i] = 0;
    }else
    {
        iSolution[i] = iContent[i];
    }
}

}

FIELDSIZE = 81;    The number of fields in complete sudoku (9x9)
ROWSIZE = 9;       The number of fields in a single row or column (9)
iNumbers           The amount of random generated startnumbers

And the solveSudoku(), which should solve the sudoku and sum up all solutions (but fails)

private bool solveSudoku(int iPos)
{
    int iCol = (iPos % ROWSIZE);
    int iRow = (int)(iPos / ROWSIZE);

    if(iPos >= FIELDSIZE)
    {
        iSolutionCounter++;
        return false;
    }

    if(iContent[iPos] >= 1)
    {
        return solveSudoku(iPos + 1);
    }
    for(int i = 1; i <= ROWSIZE; i++)
    {
        if(check(iRow, iCol, i) == 0)
        {
            iContent[iPos] = i;
            if(solveSudoku(iPos + 1))
            {
                return true;
            }
        }
    }

    return false;
}

That's what I mean (grey numbers are the ones, which are available at start, so you (or my algorithm) can't edit them:

sentences:
Trying to understand the range of Improved Perlin noise I've been implementing Improved Perlin Noise for a small library I'm writing. Everything was hunky dory when it was just in the 3rd dimension, but I recently expanded to the 1st, 2nd, and 4th dimension, which is where things started get weird.

I originally thought that the range of Improved Perlin was +-1.0. When I implemented the 1st dimension version, I noticed that the unmodified range was +-0.5, ie, you had to multiply the result by 2, but figured nothing of it. 2nd dimension worked just like 3rd, with both working within the +-1.0 range. Then when I got to 4th, I ran a large number of samples and saw that I was getting results outside the -1.0 to +1.0 range.

I started Googling, and apparently the +-1.0 range is a common misconception? The solution I've read in a couple places, which is +-1/2(sqrt(N)), where N is the number of dimensions, implies the following ranges for dimensions 1 through 4:

0.5, ~0.71, ~0.87, 1, respectively

However, the only version I have which matches this is the 1st dimension, which as I said, works out to +-0.5 before multiplying by 2. For dimensions 2 and 3, I get +-1.0 without any need to modify the result, and for the 4th dimension, I believe my results are actually in the range of the 6th dimension according to that solution.

The following is my code:
https://pastebin.com/CpAi3PUF
And for those who aren't familiar, it's Cython, so yes, a weird Frankenstein of Python and C.

I use the following code to test the ranges of each dimension: https://pastebin.com/yUpw1Z00
Since my method involves just running tons of random inputs over and over, I did run this test a few times to make sure the results are consistent, which they are, and here is an example of the output:

DIM1 - Minimum: -0.999999999999943 | Maximum: 0.9999999999871175 | Average: 0.0003455999808678627
DIM2 - Minimum: -0.9999515602331069 | Maximum: 0.999900249691747 | Average: -0.00011840974404335401
DIM3 - Minimum: -0.9932063986908607 | Maximum: 0.9931959744642007 | Average: -0.00010701170753012655
DIM4 - Minimum: -1.0576886515898196 | Maximum: 1.123720946368049 | Average: 0.00022555631399532482

You can clearly see that as my code is written, dimensions 1 through 3 have a limit of +1.0, and then with the 4So clearly there is some contradiction between the alleged result ranges, and the code I'm implementing. The 3rd and 4th dimensions were implemented straight from Perlin's own example code.

3rd Dimension: https://mrl.nyu.edu/~perlin/noise/

4th dimension: https://mrl.nyu.edu/~perlin/noise/ImprovedNoise4D.java

The only major changes I've made to the implementation are in the grad functions, where I use what is essentially a switch case, rather than Perlin's fancy pants (but extremely expensive) bitshifting method. But afaik doing so is functionally equivalent.

Can anyone provide some insight as to what is going on? What is causing the difference between the supposed expected ranges, and my actual results? And what can I do to get the 4th dimension "in shape", like how modifying the 1st dimension is required?

Thanks so much for any help.

sentences:
How to play a video with audio using an image marker I want to play a video with audio using an image marker. In other words, user scans image marker with phone and a video with audio plays.
I am finding plenty with vuforia but how can I do this with AR Foundation?

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:
Handling incoming packets immediately or queuing them I'm using Golang to write a game server. I was wondering what the advantages of queuing the incoming packets for processing over processing them immediately.

For example (processing immediately) each new connection/client a new goroutine/coroutine is created and within that goroutine a loop that reads from the network socket and has a switch statement that routes and handles each packet.

Or (queuing) each new connection/client a new goroutine is created and within that goroutine a loop that reads from the network socket and passes it to a queue. A second dedicated goroutine for this connection/client has a loop that process the packets in the queue.

Is this a pre-optimization? How are MMORPG's (server side) packet recv/handling handled in principle?

I'm using TCP.

sentences:
Character controller collision edge cases Im trying to implement a basic 3d character controller. The way i currently do collision is; i check wether or not the character is inside any geometry before movement. If this is the case, i find the closest point of this geometry, and subtract the vector from the character to the point from the characters velocity. This works for some surfaces, but of course has a lot of issues. There are two that i am trying to figure out right now.

If the character moves into a wall and the floor at the same time, it will be moved out in two frames, because they are seperate objects. One way to fix this is to do the check two times, but this amount increases by one for every object the character moves into, and i do not know the amount beforehand.

If the character moves into a v shape, it will bounce back and forth between the two side each frame, because the collision detection moves it into the other side.

Does anyone know how these are commonly handeled?

sentences:
Is it possible to render / project / flatten a 3d model onto a 2d plane in Unity? If I have a 3d Object (character) could I use a renderer / shader / camera mode to essentially render the 3d object as a 2d sprite?
Not looking for a full tutorial on this one, I realize its a large question; just looking for a direction to head in.
My thought on this one is that it would be easier to create a 3d model and move it to a position for a book-style game. The character could be posed in a number of different positions. I'd add some sort of outline and Cel shader and outline to get the affect, but in order to get it to view properly on my otherwise 2d game, I would need it to be in a panel or something that could have a "Sorting Layer" added to it.

sentences:
How do I generate a random map with islands (like the Earth), using Perlin Noise, on a tilemap in Unity? EDIT: I've tried this with Perlin Noise with no success, then with Voronoi diagrams, and now I'm editing the question to reflect the issues I had with Perlin Noise, trying again.

I'm developing a game in Unity and trying to build a map generator that is capable of creating random maps like the Earth, on a 2D tilemap. The map should contain 2 types of tiles (let's call them grass and ground), while the grass should be the "main" tile, and there should be islands of ground on top of the grass.

This was already asked here. My purpose is to create something like the second picture in the question (that picture is showing water and grass, but it doesn't really matter).

This blog post suggested a simple way to fill a map (2d array) with Perlin Noise values (float numbers between 0-1), which I did. Eventually each value was rounded to 0 or 1 to present a grass or ground tile.

What I can control now is the frequency of the noise, but it's not enough.

The map generated by the code below: (frequency of 0.3)

The problems with this method:

No randomness. I know Perlin Noise is NOT a random function, so how can I add random factors to generate a different map each time?
How can I control the number of islands (e.g.: with a factor that can determine "more islands" or "less islands", not an approx. number)?
How can I control the size of each island (again, with a factor. I don't care about exact size)?

My code: (C#)

using System;
using UnityEngine;
using UnityEngine.Tilemaps;
using Random = UnityEngine.Random;

namespace TankMayhem {

    public class GroundTilemapGenerator : MonoBehaviour {

        private const string TilesPath = "Tiles";
        private Tilemap tilemap;
        private TileBase[] possibleTiles = new TileBase[2];

        private void Awake() {
            tilemap = GetComponent<Tilemap>();
            var tiles = Resources.LoadAll<Tile>(TilesPath);

            possibleTiles[0] = Array.Find(tiles, tile => tile.name == "ground");;
            possibleTiles[1] = Array.Find(tiles, tile => tile.name == "grass");

            int i;
            int j;
            int[, ] map = new int[tilemap.size.x, tilemap.size.y];

            const float Frequency = 0.3f;
            PerlinNoiseCave(map, Frequency);

            float[] probabilities = new float[2];

            foreach (var position in tilemap.cellBounds.allPositionsWithin) {
                i = position.x;
                j = position.y;

                var tile = possibleTiles[map[i, j]];
                tilemap.SetTile(position, tile);
            }
        }

        private static int[, ] PerlinNoiseCave(int[, ] map, float frequency) {
            for (int i = 0; i < map.GetUpperBound(0); i++) {
                for (int j = 0; j < map.GetUpperBound(1); j++) {
                    // Generate a new point using Perlin noise, then round it to a value of either 0 or 1
                    map[i, j] = Mathf.RoundToInt(Mathf.PerlinNoise(i * frequency, j * frequency));
                }
            }
            return map;
        }
    }
}

sentences:
How do I design API-agnostic classes? I am writing a game engine in C++, or rather, a framework of reusable classes. So far, I have created low-level wrappers for OpenGL constructs. For example, a VBO class, a VAO class, and a texture class. I figure it would be a better idea to design my engine/framework to be agnostic of the API backends used below - so basically, make higher-level classes like Texture and Mesh, which are then implemented differently depending on if you use OpenGL or Direct3D.

The problem I'm having is that I can't quite figure out a good way to do this. How would I structure my classes? How high-level is enough?

I'm aware that OGRE3D uses the above mentioned approach, but I find the way Ogre does this to be confusing, to say the least. Can anybody provide me with good information on how to create an API agnostic game framework, or at least briefly explain how Ogre does it?

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:
Unintended window opening when pressing Unity's "Submit" button I've been working on a top down 2D game for a while now, and yesterday I found a strange bug that I just can't explain to myself whatsoever. I have a loot window for looting enemies, as well as a character panel to equip gear/see stats. I realized that after I open and close a loot window, if I press the space button (used for attacking, not for opening any windows) while holding A/LeftArrow or W/UpArrow it opens the character panel. Once this happens, I can press space to open/close the character panel.

Went to the character panels OpenClose() function (all it does is set the canvas group alpha to 0 and block raycast to false and vice versa) which is being called unintentionally, put a debug.log inside to verify if it really was being called, and yes, it is. I look up all references to see where I used it, but I only use it in a single place in the project that is behind an if-statement looking for they keycode C (NOT space). I added a debug.log for the Input.inputstring to see if somehow a magic C button press is ending up in that function, but no. If I press C to open the window, the debug log pops up, if I press space, the inputstring appears to be empty, so the if statement to get to the only place in the code referencing that function cannot be met. Removed the space button from my Player entirely, the behaviour still persists.

Added another debug.log with stackTrace.GetFrame(1).GetMethod().Name to show who is actually running this function, but it turns out that if I run it and press C, it says it's being opened by the update function in the UIManager (as expected). If I run it the strange, unintended way, it says it is being run by the EventSystems Invoke function. Coupled with the fact that the behaviour persists despite the space button being removed from the player, I realized that it's Unity's built in "Submit" button being pressed.

Strange behaviour:

It appears to call the submit function on the OpenClose button for the character panel, but only under the circumstance that I closed a loot window and haven't clicked the mouse anywhere yet afterwards. If I deactivate the button that holds the character panels OpenClose function, the behaviour stops. The button shouldn't be pressed though, because it is on a canvas group with alpha 0/block raycast=false, just like all the other buttons with the identical function that work fine. The loot window has no idea about the character panel either, and all the windows are properly wired to their own OpenClose function.
Upon further inspection, the window only starts showing up if, after closing a loot window, i press A/LeftArrow+Space or W/UpArrow+Space. This is getting more and more confusing for me.

So basically my issue is; how do I figure out why this function is being called? It feels as if closing the loot window somehow "caches" the OpenClose button for the character panel onto the submit button, but only until I click elsewhere on the screen. Did you guys have any experience with a similar situation? Could you share some pointers on how to debug this? What is the "submit" button usually used for, and what would make it only work in combination with the left/top directional buttons?  I've spent about 4 hours on this now and don't know how to get any further.

sentences:
How can I plug a Unity application into native Android and native iOS? There are a lot of questions about running native Android and iOS code in Unity.  I am trying to run Unity inside of native Android and native iOS apps.

My problem is that I have two native apps, and I don't want to write code twice when I add a feature.

I currently have two native apps - one in Android and one in iOS.  I am trying to write code once, and add it to both.  Can I write a Unity program, and put that into my native apps?

I am thinking something along the lines of writing a Unity Android app, building it as an Activity instead of an APK, and launching that Activity from the native android app.  Then also the equivalent in iOS, whatever that may be.

Does anyone know a solution to this problem?

sentences: Javascript Audio solution still has issues. Flash works but... requires flash (an issue for iOS). What do you use in Javascript for audio?

sentences:
How to invert a damage formula? I have created simple damage formula based on source percent, which return fixed percent of damage.

DAMAGE_PERCENT = Exp(Log(100) * (1 - (100 - SOURCE_PERCENT) / 150)

Here is the result:

percent[0]: 4.641589
percent[1]: 4.786301
percent[2]: 4.935525
....
percent[98]: 94.04449
percent[99]: 96.97654
percent[100]: 100

How can I make it return same results but with reversed SOURCE_PERCENT value?

So percent[0] should return 100 and percent[100] return 4.641589?

sentences:
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:
Mute/Unmute Sound For All Game Scenes by pressing Button My Question is simple i just want to Mute/Pause All Sound of the Game having different scenes.

From Scene 1 Which is a Main Menu I Have Two Button On/Off .
When i press On Button it stops or mute full game sound or music like Car sound etc in all Scenes.
When i press off button then Sound become active again in all scenes ..

I'm new in this field so please give me some help My Game is almost Complete But i can not Control or Mute All scene Sound at the same time..Waiting

sentences:
Why are 16×16 pixel tiles so common? Is there any good reason for tiles (e.g. Minecraft's) to be 16×16?

I have a feeling it has something to do with binary because 16 is 10000 in binary, but that might be a coincidence.

I want to know is because I want to make a game with terrain generation, and I want to know how big my tiles should be, or if it doesn't really matter.

sentences:
How to move an image back and forth with javascript I currently am trying to make a baseball game and have this code here: http://jsfiddle.net/769BK/ I have the baseballX set to a decrement, and then I try increasing the value using baseballX++; but it won't stop the baseballX--; after that so it stays in the same place. I need to somehow stop the baseballX--; and that way I can use baseballX++;

Thanks for any help at all!

sentences:
What is the best method to serve a real time game on websockets? The game consists of a world with just one force, gravity. All the players can do is jump and set their velocities with arrow keys. Physical AABBs and sphere's are used for collision.

What is the best method to serve this game on websockets? Dead-reckoning? Sending positions only for play back?

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:
Is it possible (and practical) to dynamically create normal maps from graphics in Pixi.js? I am building a tile game using Pixi.js. The game features dynamically-generated terrain and a day/night cycle. I'd like to use a normal map to give the sense of sloping hills or mountains.

Luckily pixi.js supports normals. I've recreated a demo app from their examples here:

var viewWidth = 1024 // /2;
 var viewHeight = 1024 //512 /2;

  // Create a pixi renderer
 var renderer = PIXI.autoDetectRenderer(viewWidth, viewHeight);
 renderer.view.className = "rendererView";

  // add render view to DOM
 document.body.appendChild(renderer.view);

  // create an new instance of a pixi stage
 var stage = new PIXI.Stage(0xFFFFFF);

  //EXPERIMENTAL: Trying to dynamically create textures. Doesn't work.
  //If using this method, comment out line 24.
 /*var rect = new PIXI.Graphics();
 rect.beginFill(0xFFFFFF);
 rect.drawRect(0,0,600,600);
 rect.endFill();
 var pondFloorTexture = rect.generateTexture();*/

  // create a background texture
  var pondFloorTexture = PIXI.Texture.fromImage("http://www.goodboydigital.com/pixijs/examples/20/counch_norm.jpg");

  // create a new background sprite
  //var pondFloorSprite = new PIXI.Sprite(pondFloorTexture);
  //stage.addChild(pondFloorSprite);

 var filter = new PIXI.NormalMapFilter(pondFloorTexture);

 var sprite = PIXI.Sprite.fromImage("http://www.goodboydigital.com/pixijs/examples/20/couch.jpg"); //(pondFloorTexture);

 sprite.filters = [filter];
 stage.addChild(sprite);

 var tick = 0;
 requestAnimationFrame(animate);

 function animate() {

   // increment the ticker
   tick += 0.1;

   var mouse = stage.interactionManager.mouse;

   if (mouse.global.x < 0) mouse.global.x = 0;
   else if (mouse.global.x > viewWidth) mouse.global.x = viewWidth;

   if (mouse.global.y < 0) mouse.global.y = 0;
   else if (mouse.global.y > viewHeight) mouse.global.y = viewHeight;

   filter.uniforms.LightPos.value[0] = mouse.global.x;
   filter.uniforms.LightPos.value[1] = mouse.global.y;
   // time to render the state!
   renderer.render(stage);

   // request another animation frame..
   requestAnimationFrame(animate);
 }
<script src="http://www.goodboydigital.com/pixijs/examples/20/pixi.js"></script>
<script src="http://www.goodboydigital.com/pixijs/examples/20/NormalMapFilter.js"></script>

Note that at line 15 I've added a bit of code that attempts to replace the normal map with a dynamically created rectangle. But for some reason this results in everything appearing black. Am I doing something wrong? Is there a better way to do this?

But more importantly, should I be creating normal maps dynamically? Obviously generating them on the fly will be computationally expensive, but how else would I get a normal map for something I won't know the shape of until last minute?

sentences:
Creating smooth lighting transitions using tiles in HTML5/JavaScript game I am trying to implement a lighting effect in an HTML5/JavaScript game using tile replacement. What I have now is kind of working, but the transitions do not look smooth/natural enough as the light source moves around. Here's where I am now:

Right now I have a background map that has a light/shadow spectrum PNG tilesheet applied to it - going from darkest tile to completely transparent. By default the darkest tile is drawn across the entire level on launch, covering all other layers etc.

I am using my predetermined tile sizes (40 x 40px) to calculate the position of each tile and store its x and y coordinates in an array.

I am then spawning a transparent 40 x 40px "grid block" entity at each position in the array

The engine I'm using (ImpactJS) then allows me to calculate the distance from my light source entity to every instance of this grid block entity.

I can then replace the tile underneath each of those grid block tiles with a tile of the appropriate transparency.

Currently I'm doing the calculation like this in each instance of the grid block entity that is spawned on the map:

var dist = this.distanceTo( ig.game.player );
var percentage = 100 * dist / 960;

if (percentage < 2) {
    // Spawns tile 64 of the shadow spectrum tilesheet at the specified position
    ig.game.backgroundMaps[2].setTile( this.pos.x, this.pos.y, 64 );
}
else if (percentage < 4) {
    ig.game.backgroundMaps[2].setTile( this.pos.x, this.pos.y, 63 );
}
else if (percentage < 6) {
    ig.game.backgroundMaps[2].setTile( this.pos.x, this.pos.y, 62 );
}
// etc...

The problem is that like I said, this type of calculation does not make the light source look very natural. Tile switching looks too sharp whereas ideally they would fade in and out smoothly using the spectrum tilesheet (I copied the tilesheet from another game that manages to do this, so I know it's not a problem with the tile shades. I'm just not sure how the other game is doing it). I'm thinking that perhaps my method of using percentages to switch out tiles could be replaced with a better/more dynamic proximity forumla of some sort that would allow for smoother transitions? Might anyone have any ideas for what I can do to improve the visuals here, or a better way of calculating proximity with the information I'm collecting about each tile?

(PS: I'm reposting this from Stack Overflow at someone's suggestion, sorry about the duplicate!)

sentences:
How does the 3G network assign IP to smartphones? I am playing a game on the 3G network using Android or Iphone.
Suppose I am moving from one cell to another; Will the IP Address change?
If yes, then how can I continue the same game while changing the base station, as my IP address is already registered in The game server?
Is there something DHCP?

sentences:
Where do you put the game window in fullscreen mode? My game, like most games, supports running in fullscreen exclusive mode. And I'd like to give my players the choice of which monitor the game will display on.

In order to prevent the player from clicking through to the desktop, I need to position my game window to exactly cover the entire monitor's area.

My game works fine when displaying on adapter 0. I simply set the window's location to 0,0 and its size to the fullscreen resolution.

However, this doesn't work if the player chooses a different monitor. The game will render on the correct monitor, but the window will still be located on the primary monitor.

How do I determine the location for my window when the player chooses a monitor other than 0?

sentences:
Can someone explain me how rayCast works? Im learning libgdx and one of the things that really confuses me its raycasting. I read a tutorial of how to use it and I understand it but I really want to know what's in the back. I searched for the source code of this method.

public void rayCast (final RayCastCallback callback, float point1X, float point1Y, float point2X, float point2Y) {   // FIXME pool RayCastCallback?
    world.raycast(new org.jbox2d.callbacks.RayCastCallback() {
    @Override
    public float reportFixture (org.jbox2d.dynamics.Fixture f, Vec2 p, Vec2 n, float fraction) {
        return callback.reportRayFixture(fixtures.get(f), point.set(p.x, p.y), normal.set(n.x, n.y), fraction);
    }
}, this.point1.set(point1X, point1Y), this.point2.set(point2X, point2Y));

}
How we can see this method calls itself recursively and returns a call to reportRayFixture of the callback variable. The thing that really confused me it's from where the code select the Fixture, and how its checks every fixture. Can someone explain me really how its works.

This its the source code page https://github.com/libgdx/libgdx/blob/master/extensions/gdx-box2d/gdx-box2d-gwt/src/com/badlogic/gdx/physics/box2d/gwt/emu/com/badlogic/gdx/physics/box2d/World.java

I will appreciate it!

sentences:
Path Modifier in Tower Of Defense Game I implemented PathModifier for path of each enemy in my tower of defense game. So I applied fixed time to path modifier in that enemy complete their path. Like following code describe.

new PathModifier(speed, path);

Here speed define the time to complete the path. But in tower of defense game my problem is, there is a tower which slow down the movement of the enemy. In that particular situation I was stuck. please someone provide me some guidance what to do in this situation.

EDIT :

        Path path = new Path(wayPointList.size());
        for (int j = 0; j < wayPointList.size(); j++) {
            Point point = grid.getCellPoint(wayPointList.get(j).getRow(),
                    wayPointList.get(j).getCol());
            path.to(point.x, point.y);
        }

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:
Is this a reasonable method of detecting JS memory hacks? I'm working on a single-player browser-based RPG in my free time. I do allow for saving the user's game on the server, but the game is largely going to run locally and I therefore acknowledge that it is impossible to outright prevent a user from cheating in a myriad of ways.

I'm just looking at the idea of a "dookie" achievement for editing the game data, and was wondering if this solution is in any way viable?

if (Reflect.set.toString() !== 'function set() { [native code] }') {
  throw new TypeError('Missing native Reflect.set');
}
if (Error.constructor.toString() !== 'function Function() { [native code] }') {
  throw new TypeError('Missing native Error constructor');
}
if (Proxy.constructor.toString() !== 'function Function() { [native code] }') {
  throw new TypeError('Missing native Proxy constructor');
}

function setTrap(target, _1, _2, receiver) {
  const res = Reflect.set(...arguments);
  const stack = new Error().stack.split('\n');
  if (stack.length >= 2 && stack[1].indexOf('<anonymous>') >= 0) {
    Reflect.set(target, 'cheated', true, receiver);
  }
  return res;
}

const myData = new Proxy({
  data1: valueA,
  data2: valueB,
  data3: valueC,
  // ...
}, {set: setTrap});

If the user edits myData in the browser console, their changes will remain, but myData will also get cheated: true after whatever change they make. Assuming setTrap is defined in a local scope, circumventing this would require editing the actual code loaded by the browser rather than simply editing a value in the console, and minified & packed JS would make that a more frustrating task than most would bother with, I think.

This would let someone who derives enjoyment from cheating do so without additional difficulties on their part, while letting me offer them a mild rebuke with a dookie achievement for cheating.

Of course, a determined cheater could prevent the game from sending the cheating marker to the server when saving the game. Even trying to alert the server from within the setTrap function could be easily defeated by simply cutting off the web connection while cheating, but this idea is more of a wagging finger than an attempt at preventing any cheating from occurring.

But my question is this: have I missed anything obvious with this idea? Is there a better way to write my conditional (I admit, I came up with it after just a few minutes messing around in Chrome, so it may not work the same in Firefox or something)?

sentences:
Scale a normalized 2D vector always to the same length For any normalized 2D vector, except for ( 0, 0 ), how would I scale the vector to always be the same length?

For example:

int length = 10;

vector v = vector( 0.1, 0.5 );
vector v2 = vector( 0.3, 0.8 );

// Scale v to be length of 10
// Scale v2 to be length of 10

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:
Is a mesh OK to use for grass if there will be 1000's of them across the terrain? Am creating a low poly game in Unity 3D for PC.  The terrain is made in Blender, so it's a fixed size, but quite large for the player to explore.  I want to add things such as grass and flowers, but am not sure the best practices are for creating those types of assets.

Is using a mesh for small clumps of grass the wrong way to do this if there will be 1000's of them?

I will likely be using the occlusion culling system Unity provides, but I'm not sure if I still need to look at doing things such as grass in a different way for performance sake.

sentences: How can I implement a percentage chance to perform some action? Let's say that there is an X% chance that a character will shoot a target, or some other action. How do I determine if the action should be taken or not (how do I implement the percentage chance)?

sentences:
Units of measurement in a tile world I've started to make a 2D sidescroller, the camera and world rendering works as I expect, but now comes the physics part of world.

What I need is that one tile in x or direction should correspond to 1 meter. Since I have a variable time step (Android mobile game), I can't figure it out, since the timing and velocity always will be dependent of the device. So, is there any good way to make one tile to correspond 1 meter? This would be good, otherwise the physics implementation would later be weird.

sentences:
Drawing a depth map properly I want to render a depth map by importing it from a file, then creating an array of vertices and indices, and then displaying it using a basic shader (just apply the view and projection matrices on it and then display). I'm aware of GPU-based solutions, however, I want to perform additional calculations using the CPU on the vertices before rendering them.

So, basically what I do is that I have my vertices with there depth in a grid, and then I import my triangles as follows:

+--+--+--+--+--+--+
¦ \¦ \¦ \¦ \¦ \¦ \¦
+--+--+--+--+--+--+   meaning that I simply split every quad spanned by four pixels
¦ \¦ \¦ \¦ \¦ \¦ \¦   into two triangles.
+--+--+--+--+--+--+
¦ \¦ \¦ \¦ \¦ \¦ \¦
+--+--+--+--+--+--+

When I took the first best depth map that I've found on google, I've got this result:

However, as soon as I'm moving the camera up, strange things happen:

The problem seems to only arise when multiple triangles are rendered behind each other. In this case, a triangle from the back (a black one at infinity depth or a wall behind the front object) seems to shine through. Also, when I use "PIX for Windows", and I use the "Debug this pixel" functionality, I get two triangles for each of the buggy pixels I've checked.

The rendering is done as follows:

Initialize

graphics.PreferredBackBufferWidth = 1280;
graphics.PreferredBackBufferHeight = 720;
graphics.IsFullScreen = false;
graphics.ApplyChanges();
IsMouseVisible = true;

Draw

GraphicsDevice.Clear(ClearOptions.DepthBuffer | ClearOptions.Target, Color.Black, 0, 0);
DrawModel();
spriteBatch.Begin();
DrawControls();
DrawFileBrowser();
spriteBatch.End();
base.Draw(gameTime);

DrawModel

GraphicsDevice.RasterizerState =
    new RasterizerState {
        CullMode = CullMode.None
    };
// [...]
// set up view and projection matrix
// [...]
GraphicsDevice.DrawUserIndexedPrimitives(
    PrimitiveType.TriangleList,
    vertices,
    0,
    vertices.Length,
    indices,
    0,
    indices.Length / 3);

What could be the problem in my rendering method? Do I have to somehow order my triangles from back to front? (no alpha-values are used) If yes, how can I order them?

Is it maybe some problem with the depth buffer? How can I fix it?

Any other ideas on how to fix the problem?

Edit

Shader code is basic:

float4x4 View;
float4x4 Projection;

void VS_Model(in  float4 inPosition            : POSITION,
              in  float4 inColor               : COLOR,
              out float4 outPosition           : POSITION,
              out float4 outColor              : TEXCOORD0)
{
    outPosition = mul(mul(inPosition, View), Projection);
    outColor = inColor;
}

void PS_Model(in  float4 inColor               : TEXCOORD0,
              out float4 outColor              : COLOR)
{
    outColor = inColor;
}

technique Model
{
    pass
    {
        VertexShader = compile vs_3_0 VS_Model();
        PixelShader = compile ps_3_0 PS_Model();
    }
}

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

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

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

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

sentences:
How to compose a matrix to perform isometric (dimetric) projection of a world coordinate? I have a 2D unit vector containing a world coordinate (the player's direction), and I want to convert that to screen coordinates (classic isometric tiles).

I'm aware I can achieve this by rotating around the relevant axis but I want to see and understand how to do this using a purely matrix approach? Partly because I'm learning 'modern OpenGL' (v2+) and partly because I will want to use this same technique for other things so need a solid understanding and my math ability is a little lacking.

If needed my screen's coordinate system has it's origin at top left with +x & +y pointing right and down respectively. Also, my vertex positions are converted to the NDC range in my vertex shader if that's relevant.

Language is C++ with no supporting libraries.

sentences:
What is an acceptable input delay? It is common knowledge that if the framerate of a game is over 25-30 fps, we humans perceive it as running smoothly. More is better, but if it is above that, it at least doesn't lag.

I have been looking for research as to how long  a mouse input can take to reach the screen, and still feel instantaneous to the average person, for example. I'm sure it may vary a little bit, from person to person, but I'm sure we all have a limit on how fast anyone can perceive small time differences between events.

I'm interested in this because I want to try and statically update the data for my game, for example every 0.05 seconds, instead of as soon as I get a new input. This will save computer power, while still not causing delay in the game.

What is an acceptable input delay?

sentences: Optimized rendering of a cube mesh world I want to render a cube-mesh (a.k.a. Minecraft-style) world. If I render each existing cube it will eat up FPS pretty quickly. How can I optimize it? I understand that the point is to not render invisible meshes (faces?) but my problem is to find out what is invisible and what isn't.

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:
UE4 Drag and Drop: Place PaperCharacter Over Image Widget I'm working on adding drag and drop functionality to my game. I have it working with the exception of I can't get what I'm dropping to be placed where it was dropped. I've tried a number of different things but I can't seem to get it to work.

The image shows my OnDrop with some leftovers of things I have been trying. And when I adjust the MakeTransform manually, a change of 1.0 seems to move the character much more than 1 pixel. The item I am creating in the OnDrop is a PaperCharacter.

Here is an image from part of the level showing the result. The white blocks circled in red are UMG images so I can eventually adjust them to look better and change dynamically as the player is dragging. The player can only drop the item over one of there squares. This functionality works. But no matter which square I drop over the item always gets placed at the point circled in green or nowhere to be seen in the viewport. This is a 2d game so everything has to be in the viewport to be seen. The white squares are attached to a PaperSpriteActor. Not sure if that matters or not.

What I need to have happen is when the player drops the item above one of the squares, the PaperCharacter must be dropped right in the middle of that square. How do I go about making that happen?

EDIT

Another observation, if I manually set the MakeTransform location to 0, 0, 0 and drop the item on the same white square multiple times, the item is dropped in a slightly different spot each time.

sentences:
How to code a multi level isometric map? I have already worked with isometric grids in the past, but in my current project I found an issue I am not sure on how to solve. I am trying to produce something similar to what's in the below screen:

What I am having trouble with is how to represent the tiles. With a flat 2d isometric grid all you need is an 2d array (even if you have elevation you can just have a z variable in there to track it and then render based on the z variable plus the z variable of nearby tiles). I am not sure how to proceed with this, however.

My plan was to have the map composed of 4-sided polygons that can be placed anywhere, and have a (x, y, z) position. Rendering is easy enough (start with lowest z tiles, go up to the next level, add any stairs that end on that level, keep repeating until all tiles are rendered).

However, how can I do collision checking? Checking if a point (a player) is inside the polygon is not too difficult, but how can I know whether he can move to another tile?

What would be best:

Have tiles holding a pointer to neighbouring tiles? (Seems like a lot of trouble to code for the editor).
Sort the array by Z-level, then search through the array for tiles that are close enough? (Seems slow)
Something else entirely?

sentences:
Float inaccuracy. libgdx only? java only? also why? Hey all I have just come to notice that floats are not accurate even when they are explicitly set and unchanged. For example i have some basic code running and it is:

 if (bike.getY() < previousBikeY){
        bike.accelY = 50f;

        System.out.println("bike accel Y :" + bike.accelY);
    }

The result in the log is:

I/System.out: accelY: 49.770126

If I wanted 49.77 id have set 49.77, this also makes me wonder about all the other uses of float i have (such as position, speed, gravity, time, etc).

A) Does this happen in other languages such as C++ or C#?
B) is this normal and something i should ignore OR do I need to take action?

sentences:
How do I sample a Depth/Stencil Texture in HLSL? I am shadow mapping in Direct3D 9. I'm trying to avoid rendering depth to a 32-bit render target. So, I've created a depth/stencil texture( a texture w/usage Depth/Stencil ). When I render I do this:

//device
IDirect3DDevice9 *pd3dDevice = GetDevice();

// set an rt the same size as the depth/stencil texture(needs attention...this render target will not be rendered to)
pd3dDevice->SetRenderTarget(0, GetShadowMapRT());

// set the shadow map depth/stencil texture surface
pd3dDevice->SetDepthStencilSurface(GetShadowMapDSSurface());

pd3dDevice.SetStreamSource(0, GDEOctree.Geometry,
                Constants.OctreeVertexSize * GDEOctree.StaticGeometryVertexCount, 12);

// set vertex format
pd3dDevice.VertexFormat = SlimDX.Direct3D9.VertexFormat.Position;

// set indices
pd3dDevice.Indices = GDEOctree.ShadowCasterIndices;

// set render states
DeviceManager.SetRenderState(RenderState.ZEnable, 1);
DeviceManager.SetRenderState(RenderState.ZWriteEnable, 1);
DeviceManager.SetRenderState(RenderState.ZFunc, (int)Compare.LessEqual);
DeviceManager.SetRenderState(RenderState.CullMode, (int)Cull.Counterclockwise);
DeviceManager.SetRenderState(RenderState.StencilEnable, 0);
DeviceManager.SetRenderState(RenderState.AlphaBlendEnable, 0);
DeviceManager.SetRenderState(RenderState.ColorWriteEnable, 0);

// draw shadow casting geometry
...

// get the effect
ID3DXEffect *pFX = GetFX();

// set the shadow map depth/stencil texture
pFX->SetTexture(GetShadowMapDSTexture());

// in pixel shader sample shadow map...
?

The problem is that the depth/stencil texture is a D24SX format...How do I sample from a texture of this format?

My original attempt which of course will not work:

tex2D(g_SamplerShadowMap, vShadowMapUV);

I read a post here that says:

  When reading from the texture, one extra component in texture
  coordinates will be the depth to compare with.

Or, how do I convert the color returned from the sampler code above to a single floating point value? The above code will return a 4-component vector but depth should be one value for comparison.

EDIT:

Below is the vertex shader for the shadow map pass...I do not compile a pixel shader for the shadow map pass because color is not written...only depth.

//--------------------------------------------------------------//
// ShadowMap Pass
//--------------------------------------------------------------//
void VS_ShadowMap( in float4 Position : POSITION0,
                    out float4 oPos : POSITION0 )
{
    // position of geometry in the shadow emitting light's clip space
    oPos = mul(mul(Position, mW), g_mShadowViewProjection);
}

technique DeferredShading
{
    pass ShadowMap
    {
        VertexShader = compile vs_3_0 VS_ShadowMap();
        PixelShader = NULL;
    }
}

sentences:
CreateGraphicsPipelineState Hi!

Would someone answer my question, please?
Does the title's method create the same components always or verify possible duplicates?

For exaple:
I have one D3D12_INPUT_LAYOUT_DESC struct and two shaders need the same IL.
How many ILs will it create? (In the D3D11 one was enough).
Is it possible to avoid duplicates?

I highly appreciate the answer.

sentences:
Why is BayazitDecomposer inaccessible when upgrading from Farseer 3.3.1 to Farseer 3.5? I used the following code in Farseer 3.3.1 and it worked correctly, but in Farseer 3.5, I always get an error message in the following line:

list = BayazitDecomposer.ConvexPartition(textureVertices);
'FarseerPhysics.Common.Decomposition.BayazitDecomposer' is inaccessible due to its protection level

What is wrong? Why is the code not working with Farseer 3.5? How can I use the decomposition tools in Farseer 3.5?

sentences: Map state in XNA on WP8 I am developing an RPG for Windows Phone 8 using XNA. I have a map screen and a fight screen. I want to use XNA for both to utilize the graphics helpers and because XNA is awesome. My question is, how do I save the map state between the two screens? That is , how do I save the location of the PC and the enemies when I travel back and forth between the two screens?

sentences: Calling opengl32.DLL from java? I don't like LWJGL in some cases, so I prefer to use Swing. The thing is that Swing doesn't have OpenGL. I have tried JOGL and it's a mess to install, needs external jars, and I have yet to get it working. So I was wondering if I could just make an OpenGL class that uses opengl32.DLL and put the graphics into a window made with Swing? Also, is opengl32.DLL able to be called with a 64 bit Java program?

sentences:
Playing an animation in Godot I have been working on making a platformer in Godot but can't seem to get a walk cycle to play when I press left or right.

extends KinematicBody2D

export (int) var run_speed = 300
export (int) var jump_speed = -400
export (int) var gravity = 1000

var velocity = Vector2()
var jumping = false

func get_input():
    velocity.x = 0
    var right = Input.is_action_pressed('ui_right')
    var left = Input.is_action_pressed('ui_left')
    var jump = Input.is_action_just_pressed('ui_select')

    if jump and is_on_floor():
        jumping = true
        velocity.y = jump_speed
    if right:
        velocity.x += run_speed
    if left:
        velocity.x -= run_speed

    if left or right and jumping != false:
       get_node("AnimationPlayer").play('walkcyc')

    if left or right and jumping != true:
        $AnimatedSprite.animation = 'run'
        $AnimatedSprite.flip_h = velocity.x < 0

    if is_on_floor() and velocity.x == 0 or velocity.y == 0:
        $AnimatedSprite.animation = 'stand'
        $AnimatedSprite.flip_v = false
        $AnimatedSprite.flip_h = velocity.x < 0

    if jumping != false:
        $AnimatedSprite.animation = 'jump'
        $AnimatedSprite.flip_v = false
        $AnimatedSprite.flip_h = velocity.x < 0

func _physics_process(delta):
    get_input()
    velocity.y += gravity * delta
    if jumping and is_on_floor():
        jumping = false
    velocity = move_and_slide(velocity, Vector2(0, -1))

sentences:
How can I set my application to run on the High performance GPU by default? Nowadays a good deal of laptops come with 2 GPUs - a high-performance one and a power-saving one (less powerful). Most of the application, which I use on my laptop run with my integrated(power-saving) GPU, but still some of them are set to open with the high-performance card. I am trying to config the app which I am building to run on the high performance GPU by default, but I can't find any information about the topic anywhere. I hope that someone can shed a bit of light onto this. I will distribute my application with an NSIS installer and I guess that I'll have to add the path of my application to a list of applications for NVidia/ATI cards. The application is programmed in C#. Also, does anyone know how things stand with desktop PCs? What happens if a PC has 2 GPUs and I have to choose the more powerful one?

Milcho

sentences:
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: How to create a standard pbr material with shader graph? I want to create a standard pbr material that is editable with the shader graph, but when I install the package and go the Create -> Shader tab, I only have 2 graph options:  Empty Shader Graph, and Sub Graph.  Isn't there a shader graph that starts me off with a basic pbr material with color and reflections?  I'm using unity 2020, and the default render pipeline.  Do I need to switch to ldrp or hdrp?

sentences:
Send info about gun shots via UDP I am writing a small multiplayer game in C++. But I am confused about how to send info about gun shots to achieve best performance. I am thinking of different ways to do that:
Let's say we have a gun that can shoot 10 times per second (when left mouse button is held).

When user presses LMB game sends TCP packet telling that shooting has started.
When user releases LMB game send TCP packet telling that shooting has stopped.
When LMB is held game send UDP packet every (1/10) sec telling about one shot.
When LMB is held game send TCP packet every (1/10) sec telling about one shot.

I think that the last one is the best because it allows to check hits on the server side, not on the client side (cause this way it can be easily hacked). But I am not sure if TCP can handle 10 packets per second. What do you suggest?

sentences:
Textures loading too large on smaller monitors I have an XNA game, and when i run the game the textures load all good on my computer and on my tv and they're all bring drawn in the right position. But on my laptop, which screen is smaller then both my othe computers monitor and my tv screen, all the textures are being drawn way to large. Example: i have a background which is just grass, and a stone path, and the image size is 1920x1080. It loads fine and is centered on my other computer and TV, but on my laptop, its drawn way too big and where the center should be is in about the bottom right corner of the laptop screen. Is it possible to edit the code to make it resize better on smaller screens, or is it just my laptop and my laptop's screen size is messed up. I believe that my laptop is in the 16:9 aspect ratio.

Update 1

I have noticed that the textures load fine when the window is not in full screen, but in full screen the textures have problems. How should i change this Draw Method to fix this problem, and draw this in the right spot in a full screen 1920x1080 window?

spriteBatch.Draw(backgroundTexture, Vector.Zero, Color.White);

(keep in mind the backgroundTexture is 1920x1080)

sentences:
Tips / pitfalls in selecting and working with publishers? I am thinking about working with a publisher for an iPhone game that I have developed.  I have been independent until now, but want to look into the publishing route because I just don't have the resources to market the game myself, and I would rather not take outside investment.

So, those of you who have gone this route, what should I be looking for in a publisher?  What should I avoid?

sentences:
Emissive material from white texture I have texture with black and white shapes.

I would like that white parts are emissive and black parts are transparent/glass.

How to make such material ?

sentences:
Is an ECS viable in garbage collected languages? I've done some research on Entity Component System architectures. Right now I have a convoluted OOP implementation which I'm planning on rewriting, so I was considering switching to a different architecture. Since everything was already composed using components, the switch from OOP to ECS shouldn't be too difficult. However, I'm doing my project in a language with managed memory and GC, and  a lot of the benefits of ECS are to do with memory management, processor cache, etc. so I was wondering whether there is any real performance advantage of ECS over OOP in a garbage collected language?
Also, I'm not too familiar with manual memory management and I haven't really used C/C++ for anything big.

sentences:
Component System - Editor Data Management I'm trying to construct an editor in C# that exposes game components to IronPython, so it may create the game object definitions to be used within the editor:

C# Exposes the components to the python script (Spatial, Movement, SpriteView, etc.)
IronPython creates the game object definitions (or templates) by attaching components to a game object.

At the startup of the editor:

The Python script is loaded with all of the game object definitions.
Tools are updated with the new objects (availability for painting).

The problem I'm having lies when I'm saving and opening the editor data:

When saving, I use C# to serialize all of the constructed game objects (including the game object definitions generated from python) to a file.
When opening, I use C# to deserialize the data.  - Since the Python script is not synchronized with the serialized components, I will run into a big problem when I change anything in the script.

One solution I had was to only serialize the definition name of a game object, therefore when I deserialize my data I will have to do a lookup for the target definition (created by the script) and simply clone it. But, it still will not be entirely in sync with the editor data (some data will be changed on each game object like for example the position (note when I say game object I do not mean the definition)).

Another solution might be to use a database and save out all of my editor data to it (perhaps using the entity database in C#). I'm not entirely sure if this will solve my problem.

Any help would be appreciated, thanks!

sentences:
How can I move my box collider temporarily? I'm very new to game development, I mostly program other things. I'm trying to write a basic whack-a-mole type of game. I've gone ahead and created a hammer with a swinging animatio in the FBX. I've also attatched a box collider to the head of the hammer.

The issue is that when I play the hammer swing animation (and the hammer moves down), the box collider does not follow. I understand that this is because the animation is only for the object, but in this case it presents a problem since I need the collider to be at the hammer's lowest point once the animation gets there.

What is the right way to approach this problem? I've thought of a couple solutions on my own, are any of these valid?

1) Move the Collider with the animation. I've got no clue on how to do this.

2) Store the time when I start the animation, check if enough time has ellapsed for completed animation. Then manually move collider to the contact point. Wait a few milliseconds, then move it back. I tried this, the issue with this is that it moves the entire object with the collider.

void Update() {
   if (Input.GetMouseButtonDown(0)) {

       animator.SetTrigger("hammer");
       animationStartTime = Time.time;
       toAnimate = true;
   }
   if(Time.time-animationStartTime > 0.38 && toAnimate == true) {
       toAnimate = false;
       //bc = attatched box collider
       bc.transform.position = new Vector3(0, 0, 0); //move to target point (won't be 0,0,0 for real, just a test point)

    }
    if(Time.time- animationStartTime > 0.50)
    {
           bc.transform.position = transform.position + bcOffset; //reset to original position
     }
}

3) Do what I did in step 2, but create a collider not attatched to a parent object so that the parent object isn't moved. I don't know how to create a collider on its own however.

BoxCollider bc = new BoxCollider();
//I then use bc.size and bc.position and set them but it does not show up
//on my scene view so I don't think this works.

NOTES:

This script is attatched to hammer object.

The hammer is moved with this code:

hPos = Input.GetAxis("Mouse X") * -0.7f;
fPos = Input.GetAxis("Mouse Y") * 0.7f;
transform.position += new Vector3(fPos, transform.position.y, hPos);

Edit:
is it possible for me to apply the animation to the collider? This would probably be the easiest way.

sentences:
Camera scrolling and game boundaries I am making a platformer game in JBox2D and LWJGL that has a scrolling camera, but I have hit a wall with the boundaries of the camera.

Essentially what I have right now is a Box2D world that is being draw on the screen, a viewport being moved by gluLookAt and several boundaries specified by Box2D edges that also help keep the player from moving out of bounds. It looks a bit like this:

What I'd like to do is "push" the camera when ever it comes in contact with the edge, but otherwise be centered on the player.

I've tried a couple of methods for this, such as finding the min and max width and height, and simply doing an easy box hit test, and moving the screen accordingly, but that has it's limitations, such as if the world is not in a rectangular shape e.g.

Another method I've tried is doing something where I raytrace from one vertex to another of each edge, and if it comes into contact with the screen, I "push" the screen out of the way, but that hasn't quite worked either

    Fixture fixture = boundary.getFixtureList();
    Vec2 point = null;
    boolean hit = false;
    fixtureLoop:
    for(int i = 0; i < boundary.m_fixtureCount; i++)
    {
        EdgeShape edge = (EdgeShape)fixture.getShape();
        Vec2 origin = new Vec2(edge.m_vertex1.x*Main.OPENGL_SCALE, edge.m_vertex1.y*Main.OPENGL_SCALE);
        Vec2 direction = new Vec2(edge.m_vertex2.x*Main.OPENGL_SCALE, edge.m_vertex2.y*Main.OPENGL_SCALE).sub(origin);
        for(float t = 0; t < 1.0f; t += 0.001f) //Raytrace loop
        {
            point = origin.add(direction.mul(t));
            //See if point is within screen bounds
            if(point.x > screenX-Main.WIDTH/2 && point.x < screenX+Main.WIDTH/2 && point.y > screenY-Main.HEIGHT/2 && point.y < screenY+Main.HEIGHT/2)
            {
                hit = true;
            }
        }
            //If hit, find closest vertex
        if(hit)
        {
            float shortestDistance = Float.MAX_VALUE;
            Vec2 vertex = new Vec2();
            for(int v = 0; v < screenVertices.length; v++)
            {
                float distance = point.sub(screenVertices[i]).length();
                if(distance < shortestDistance)
                {
                    shortestDistance = distance;
                    vertex = screenVertices[v];
                }
            }
            Vec2 displacement = point.add(vertex.sub(new Vec2(screenX, screenY)));
            screenX = displacement.x;
            screenY = displacement.y;
            break fixtureLoop;
        }
        fixture = fixture.getNext();
    }

What I have here is my attempt that I have played around with WAAAY too much. Essentially what I'm trying to do is detect if and edges are hitting the screen, find the point where they hit, find the closest screen vertex, subtract them to find the displacement between them, and apply it to the screen so that they're no longer in contact: (The screenVertices array is essentially 4 vertices that look like Vec2(screenX+WIDTH/2, screenY+HEIGHT/2), etc)

I was wondering if anyone could help me out, I'm not sure if I'm having logic problems, code problems, or both. Absolutely any help would be appreciated, thanks!

sentences:
How to rotate an image around its own center in AndEngine? I'm beginner in Android programming with Andengine framework. And my question:

How to rotate an image around its own center in AndEngine?

I use Body and AnimatedSprite.

Update

This is my code:

        final AnimatedSprite face;
        final Body body;
        face = new AnimatedSprite(pX, pY, this.mCircleFaceTextureRegion,
                this.getVertexBufferObjectManager());
        body = PhysicsFactory.createCircleBody(this.mPhysicsWorld, face,
                BodyType.DynamicBody, FIXTURE_DEF);
        face.setUserData(body);
        face.animate(200);
        face.applyTorque(100);
        face.setUserData("monster");
        this.mScene.registerTouchArea(face);
        this.mScene.attachChild(face);
        this.mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(face,
                body, true, true));

And here in the ContactListener when have a collision with other object.

private ContactListener createContactListener() {
        ContactListener contactListener = null;
        contactListener = new ContactListener() {
            @Override
            public void beginContact(Contact contact) {
                try {
                    Fixture x1 = null;
                    Fixture x2 = null;
                    x1 = contact.getFixtureA();
                    x2 = contact.getFixtureB();
                    if (x2.getBody().getUserData().equals("player")
                            && x1.getBody().getUserData().equals("monster")) {
                        x1.getBody().setFixedRotation(true);
                        hitsound.play();
                        mEngine.vibrate(100);
                        Log.i("CONTACT", "BETWEEN PLAYER AND MONSTER!");
                    }
                } catch (Exception e) {
                    Log.d("ErrorMessage", e.getMessage());
                }
            }
            @Override
            public void preSolve(Contact contact, Manifold oldManifold) {
            }
            @Override
            public void postSolve(Contact contact, ContactImpulse impulse) {
            }
            @Override
            public void endContact(Contact contact) {
            }
        };
        return contactListener;
    }

I have set  x1.getBody().setFixedRotation(true);. But position of this object isn't kept. What is wrong with my code?

sentences:
Sprites with same position rendered in different places on screen In LibGDX I have few sprites that all have set position (0,0). So in theory they all should render in one place on top of each other but what ends up happening is that all the sprites are being rendered in different spot on screen. For all sprites objects all I do is:

Sprite sprite = new Sprite(new Texture("texture.png"));
sprite.setOriginCenter();
sprite.setScale(1/PPM);

And then when rendering it:

batch.begin();
sprite.draw(batch)
...
batch.end();

And here is what I get:

rocket sprite is in completely different place than fire sprite and some other sprites I couldn't even find. I marked "real" 0,0 point with yellow circle.
So why are does sprites in different spots? I've heard that it could be because of scaling but since I am setting sprite's origin to center it shouldn't be a problem, right?

sentences:
How to handle complex input In my Libgdx project i need to handle several types of inputs.

In particular these input events are needed in order to interact with the Actors that the user puts in the Stage.

The possible interactions are:

1) Drag And Drop with DragAndDrop class.

2) Rotate the Actor (90 degrees clockwise each time)

3) Remove the Actor

I thought that i could rotate the Actor with a simple click (touchDown), and remove the Actor with double tap, but this strategy gives rise to some issues.

1) When the user does double tap on the Actor, before the Actors gets removed it rotates 2 times.

2) If the user wants to drag and drop the Actor, when he clicks on the Actor it rotates.

Then, i thought that i could rotate the Actor in the touchUp method, only if the current position of the Actor is the same as before in order to avoid to rotate the Actor when the user just want to move it.

This gives rise to another problem. In order to detect the double tap, i need to implement GestureListener interface that does not have the touchUp method!

I could remove the actor when the user does long press on it, but this will be a game that will require fast interaction.

So.. i need your help, any kind of help, thank you very much!

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: Unity 5 2D drawing sprites programmatically How can I draw sprites in Unity 5 programmatically ? I am looking for something similar to spriteBatch.Draw() in XNA. The results I get when I search about it are either outdated http://wiki.unity3d.com/index.php?title=SpriteManager (this was written in 2012), or they are done using the unity interface. All I can find is a Sprite class in UnityEngine.dll. Is this what I need ? How would the drawing work ? I really don't get it.

sentences:
Running a WindowsGL MonoGame release on end Machine Can anyone tell me what is required of a PC to run a released MonoGame.
I mean what software the PC needs to have installed to run the games.
I have some problems running my released games on other PC's than my developer machine. They simply stops responding when I try to run them.

sentences:
What data am I allowed to collect for statistical purpose ? Description

I would like to know where is the limit between the data I am allowed to store and the data that is private. I don't know if there is a legal limit or if it is ethical. I know what kind of statistics the games usually display but there may be others that they hide. I would like to collect data and combine them to make conclusions, I don't want the player to see the raw data.

Some examples

1) Information about the character (usual data)

  Number of type A enemy killed.
  Max gold collected.
  ...

2) Information about the player himself

  Number of hour played.
  Time when he started to play.
  Number of time playing between 11pm and 6am.
  ...

3) Information about the messages (if there is a chat in the game for example)

  Number of message sent.
  Most used word.
  Most contacted person.
  ...

I would prefer not to display a warning on the first launch of the game saying that informations are being collected or something like this.

The actual question

My question can be separated into the following questions:

Am I allowed to collect type 1, 2, 3 datas ?
Is there a difference of autorisation if the datas are stored/used localy or in an online database ?

sentences: If you create a game, do you automatically have the rights to it? I am creating a game in c++ that will me multiplier and am going to post it on https://indiegamestand.com  Here is one of the requirements "Must own the rights to distribute your game and to assign those rights to us (non-exclusively) for the purpose of selling here."  If I compile my game as an .exe do I have that right?  How can I make sure I retain it, and what can they do with the game if I give them that right?

sentences:
Unity ball not bouncing off wall correctly I have been making a brick breaker game in Unity in 2D as my first game. I have got the ball bouncing off the paddle correctly and can bounce it of the paddle at different angles. However, when the ball hits a wall or the roof it always bounces so its either traveling exactly in the X-directon or Y-direction regardless of what angle it hits the wall with instead of bouncing off at 90'.

Im not using any scripts to control the bouncing off the walls or roof just using  2D box colliders on the roof and walls (which are cubes) and a circle collider and 2D rigidbody on the ball (sphere) which Ive given a bouncy material.

Any help would be really appreciated.

Here's a gif of the problem: http://imgur.com/a/YJyNH

sentences:
Quaternion Lerp never reaches target I seem to have misunderstood something about how LERP works. Im not sure what is missing. The object is rotating as it should, but it cant seem to get it to end. The transform.rotation dont seem to reach its target even if it has done so visually.

Quaternion rotationTarget;
    Vector3 travelTarget;
    float rotationLerpProgress;
    float rotationLerpDuration = 1f;

    // Use this for initialization
    void Start ()
    {

    }

    // Update is called once per frame
    void Update ()
    {
            if (Input.GetMouseButtonDown (0)) {
                    var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
                    RaycastHit rayHit;
                    if (Physics.Raycast (ray, out rayHit)) {
                            var rayHitPoint = rayHit.point;
                            travelTarget = rayHitPoint;
                            var rotationDirection = rayHitPoint - transform.position;
                            rotationDirection.y = 0;

                            rotationTarget = Quaternion.LookRotation (rotationDirection);
                            rotationLerpProgress = Time.deltaTime;
                    }
            }
            if (transform.rotation != rotationTarget) {

                    if (rotationLerpProgress < rotationLerpDuration) {

                            transform.rotation = Quaternion.Lerp (transform.rotation, rotationTarget, rotationLerpProgress / rotationLerpDuration);
                            rotationLerpProgress += Time.deltaTime;
                            print (string.Format ("({2}) - progress: {0} - duration: {1}  ", rotationLerpProgress, rotationLerpDuration, rotationLerpProgress / rotationLerpDuration));
                    } else {

                            print (string.Format ("setting rotation ({0}) to target ({1})", transform.rotation, rotationTarget));
                            transform.rotation = rotationTarget;
                    }
            } else {
                    print ("rotaton is at target! :)");
                    if (transform.position != travelTarget) {
                            rigidbody.AddForce (Vector3.forward);
                    }
            }

    }

sentences:
Entity-Component-System and 2D map with tiles : how to do it? I have a question : I'm currently programming a roguelike game (with tiles) using the ECS programming paradigm, and I'm struggling with how to implement the map.

At first, I made every terrain square an entity (with a screenPosition and a sprite components), but that quickly lead to performance issues (a 100x100 map is already 10k entities).

So now, I want to treat the whole map of a level as a single entity, but I'm unsure on how to do it. Should I make a map component, that will store every terrain properties? That seems "bad" to me. Is there a better way?

Thanks

Edit :

My implementation is something like this :

Each entity is a struct that store a list of pair of component_id (an int) and component_handle (an int).
Components are struct
an EntityManagerSystem store all the entities in a vector, and all the components, each kind in its own vector. Each vector is public, the id of each entity is its vector index, and the component handle is the component index too
a RenderSystem that iter over the entity vector from EntityManagerSystem, and draw the ones that have the corresponding components
an EngineSystem store pointers to all the Systems and call them sequentially to update : it's the "main" class

In RenderSystem, it's this loop the culprit :

em is the entityManager and CT_HASH is a compile time hash.

for (std::vector<GameObject>::iterator it = em->entities.begin(); it != em->entities.end(); ++it)
{
    if (it->HasComponent(CT_HASH("ScreenPosition")) && it->HasComponent(CT_HASH("Sprites")))
    {
        ScreenPosition pos = em->screenPosition[it->GetComponent(CT_HASH("ScreenPosition"))];
        if (0 <= pos.x && pos.x < xSize && 0 <= pos.y && pos.y < ySize)
        {
            Sprites sprites = em->sprites[it->GetComponent(CT_HASH("Sprites"))];
            for (int z = 0; z < 10; z++)
            {
                if (sprites.sprites[z] != 0)
                {
                    spriteMap[pos.x][pos.y][z] = sprites.sprites[z];
                }
            }
        }
    }
}

It takes around 300ms for a 100x100 map with only the terrain entities

sentences:
How can one add a level to an already published ios/android unity3D game on a daily basis? How can one add a level to an already published iOS/Android Unity3D game on a daily/weekly basis?

I know this probably isn't feasible but it won't harm if I just made sure of it. Our game requires to allow access to just one level a day/week. You may access levels that were released on previous days and play to your heart's content but all players will get access to a new level every day/week. I know this may sound crazy but the concept requires it so just roll with me.

Is there anyway to achieve this for iOS/Android games built with Unity? Of course, we could package a whole game with 10 levels and allow access to each level after a set time, but the game will need to talk to a back-end CMS all the time to allow login and verification of users, make sure they aren't cheating, etc, etc, over proper security and https (proper anti-cheat solutions are a must and that's why maybe HTML5 route is better).

We are now moving towards doing all this in HTML5 and completely bypass Unity, but was hoping to find a solution with Unity because 3D is better than 2D depending on the situation, and some levels could be 3D while others 2D. Patching/updating everyday to upload new levels won't go down well with anyone, the app stores or the users.

sentences:
Proper way to do texture mapping in modern OpenGL? I'm trying to do texture mapping using OpenGL 3.3 and GLSL 150.

The problem is the texture shows but has this weird flicker I can show a video here.

My texcords are in a vertex array. I have my fragment color set to the texture values and texel values. I have my vertex shader sending the texture cords to texture cordinates to be used in the fragment shader. I have my ins and outs setup and I still don't know what I'm missing that could be causing that flicker.

Here is my code:

Fragment shader

#version 150

uniform sampler2D texture;
in vec2 texture_coord;

varying vec3 texture_coordinate;
void main(void) {
    gl_FragColor = texture(texture, texture_coord);
}

Vertex shader

#version 150

in vec4 position;
out vec2 texture_coordinate;
out vec2 texture_coord;
uniform vec3 translations;

void main() {
    texture_coord = (texture_coordinate);
    gl_Position = vec4(position.xyz + translations.xyz, 1.0);
}

Last bit

Here is my vertex array with texture coordinates:

GLfloat vVerts[] = {
   0.5f, 0.5f, 0.0f, 0.0f, 1.0f,
   0.0f, 0.5f, 0.0f, 1.0f, 1.0f,
   0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
   0.5f, 0.0f, 0.0f, 1.0f, 0.0f}; //tex x and y

If you need to see all the code, here is a link to every file.

Thank you for your help.

sentences:
How can I create gradiented Fog of War? I'm creating a top down 2D RTS game for educational purposes.  Currently, I'm really just copying Starcraft's design/ideas.  I've decided I should probably implement Fog Of War too.

My expectations:

Areas currently explored (units are there) should be lit up.
Areas previsouly explored (units were there) should be darker but show what things were there when your unit was there.
Areas not explored (areas your units have never been to) should be completely black.
There should be a gradient change from each type (e.g. explored to previously explored) See picture below.

Just the rough details: How would I do this?

sentences:
Character doesnt move along with his rotation Decided to change my character movement from transform.Translate to a rigidbody movement, the only problem is that my character is not moving to where he is facing, also it falls really slowly in the Y axis. Heres the code related to the movement:

    float moveHorizontal = Input.GetAxis("Horizontal") * rotSpeed;
    float moveVertical = Input.GetAxis("Vertical") * speed;

    rb.velocity = new Vector3(0, 0, moveVertical);
    transform.Rotate(0,moveHorizontal, 0);

sentences:
How do I construct the planes for my camera's frustum? I'm trying to get a handle on frustum culling, but I'm not quite there yet.

I have a camera in three-dimensional space

Camera
    position (cx, cy, cz)
    rotation (tx, ty, tz)
    fieldofview
    near-plane
    far-plane

and a quadtree containing my chunks of terrain

Quadtree
    Chunk
        bottomleft (x, y)
        width
        length
        heightmap

Currently, I am rendering every chunk within the quadtree. However, I would like to cull all chunks outside the six planes of the camera's frustum.

I am unsure how to:

Generate these planes given the information in the camera class.
Efficiently test for intersection using my quadtree. If one region of the quadtree fails, do all of its children (that seems reasonable, I just want to make sure)? What is the process for running through a quadtree for culling?
Perform the intersection test using the planes and my terrain chunks. How do I quickly tell if a piece of terrain (square with varying y values) lies within the 6 camera planes?

sentences:
Should I post a playable demo on Kickstarter? I am asking this question way in advance of my progress, but I am still curious and would like if to know in case I ever make it this far. So I'll phrase this hypothetically in the future.

The game I am making has a fully functional demo. It has programmer art and only one level. All of the "extra" features are missing. It is bug free and the core mechanics are fully implemented, but there are very few enemy types, and planned features like a leveling system are missing.

For game designers, it is relatively clear what the game will be, as the mechanics are clearly seen and understood. But I don't know how it will be perceived by non-game designers.

When I look at other kick starters, I have seen video game kickstarters that range from only text, to videos of developers talking about the game, to videos of actual gameplay. But I have not seen a single link to a playable demo.

Would it help or hurt to link to the playable demo that would show where the game is headed? Would the potential funders look at the unpolishedness of it and write it off, or would they take it for what it is: a concept?

sentences:
Isometric rendering and picking? I've been looking for a formula to plot (world->screen) and mouse pick (world->screen) isometric tiles in a diamond-shaped world.
The ones I've tried always seem to be, well, off.
What's the usual/correct way to do this?

sentences:
Can I remove the systems from a component entity system? After reading a lot about entity-component based engines, I feel like there is no real definition for this kind of engine. Reading this question, and the linked articles, made me think a lot. I do not feel that comfortable using the system concept, so I'll write something else that is inspired by this pattern. I'd like to know if it is a good way to organize game code, and what improvements can be made.

Regarding a more strict implementation of the entity-component based engine, is my solution viable? Do I risk getting stuck, at any point, due to the lack of flexibility of this implementation, or anything else?

My engine, as for entity-component patterns, has entities and components, but no systems, since the game logic is handled by components. I also think the main difference is the fact that my engine will use inheritance and object-orientated programming concepts, in general. I don't try to minimize them.

Entity: an entity is an abstract class. It holds a position, width, height, scale and a list of linked components. Every frame, the entity will be updated (i.e. all the components linked to this entity will be updated), and rendered, if a render component is specified.
Component: like for entity, a component is an abstract class that must be extended to create new components. The behavior of an entity is created through the components collection. Components are updated when the owning entity is updated, or for only one specific component (render component), rendered.

sentences:
Box 2d and really complex big shapes I intended to use jbox2d for my project. But as I went deeper into it's manual I'd found out that it supports dynamic objects between 0.1 and 10 meters (if use scaling and assume that 0.1 is smallest unit we would have 100 units). I want to create pretty complex and big shapes about 1000 units width.

So will box2d will handle it?
Or I should simplify them more to achieve 100 units width max?
Or my calculations about 100 units width max are wrong? ( But if 0.1 meter is box2d minimum I don't think than I can get smaller unit as measure.)

I had also read about kollider2d, but can't find any info about stress testing it.

As in comment below:

I understand that it doesn't matter if 32 pixels of my system represents 0.1 meter of box2d system nor if it is 50 pixels. With good scale I can manage any value as minimum. I wan't to create objects 1000 times larger than smallest one. And I don't know if box2d will crash or try to handle it but will be very slow or inaccurate.

sentences:
How to know if an overriden method calls its super method or not? Consider this situation, where a Player class inherits from a more general Actor class:
Actor.gd
class_name Actor extends KinematicBody2D

func _ready():
    print("I am an actor")
    _foo()

func _foo():
    print("I was thinking I was an actor")

Player.gd
class_name Player extends Actor

func _ready():
    print("I am a player")

func _foo():
    print("I was thinking I was a player")

When one instantiate a player in a scene, we have this output:
I am an actor
I was thinking I was a player
I am a player

How to know when a method will call its super class?

sentences:
How can I find the perpendicular to a 2D vector? I'm making a top down game where the player moves forwards towards the position of the mouse cursor. As part of the player's movement code, I need to determine a vector that is perpendicular to the player's current facing vector (to implement strafing behavior).

How can I compute the perpendicular vector of a given 2D vector?

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: Create a normal map using a script? Unity I don't have a software that can create normal maps from an image so I usually make a grayscale image and then let unity make the normal map from that image. But I can't save the image to use for later, Instead I have to convert it to a normal map every time I use it. So how would I make a normal map from a greyscale using a script? i prefer c# but js works fine.

sentences:
Should we always prefer OpenGL ES version 2 over version 1.x OpengGL ES version 2 goes a long way into changing the development paradigm that was established with OpenGL ES 1.x. You have shaders which you can chain together to apply varios effects/transforms to your elements, the projection and transformation matrices work completly different etc. I've seen a lot of online tutorials and blogs that simply say "ditch version 1.x, use version 2, that's the way to go". Even on Android's documentation it sais to "use version 2 as it may prove faster than 1.x".

Now, I've also read a book on OpenGL ES (which was rather good, but I'm not gonna mention here because I don't want to give the impression that I'm trying to make hidden publicity). The guy there treated only OpenGL ES 1.x for 80% of the book, and then at the end only listed the differences in version 2 and said something like "if OpenGL ES 1 does what you need, there's no need to switch to version 2, as it's only gonna over complicate your code. Version 2 was changed a lot to facillitate newer, fancier stuff, but if you don't need it, version 1.x is fine".

My question is then, is the last statement right? Should I always use Open GL ES version 1.x if I don't need version 2 only stuff? I'd sure like to do that, because I find coding in version 1.x A LOT simpler than version 2 but I'm afraid that my apps might get obsolete faster for using an older version.

sentences:
Java and Eclipse setup properly, how do I install JOGL or LWJGL? I have my Java environment installed alongside Eclipse, and I was successfully able to create and run a new project (simple System.out.println("Yay I work!");

I have the OpenGL SuperBible, and I primarily want to code 3D things (I'll take my time using the book to learn how to draw shapes in 3D space, etc..)

Can you help me get setup with OpenGL in Java? I dont really need LWJGL, although I WILL make games eventually. I just can't even figure out with all of these terrible (and old) tutorials floating around on the net how to install either JOGL or LWJGL.

If you can give me a hand with that, I'd appreciate it. I'd like to feel I contributed by having this page show the answer to the question, so that other poor souls googling for this same information can benefit.

sentences:
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:
Traffic estimation for a multiplayer flash game hey, i want to know if my rough traffic estimations are right, it would be for a pretty simple realtime flashgame in the style of haxball (but not as a soccer game) heres a video of it http://www.youtube.com/watch?v=z_xBdFg1RcI

So here comes my estimation, i dont know if they are realistic! i hope someone can help me.

consider the packet attached as a typical one sent every 200ms, its 148bytes + 64 bytes of header will make around a 200bytes packet. The server will receive 200bytes x 6 players x 5 times a sec=6000bytes/s=5.85Kbytes/s=46.9kbit/s plus he has to send all back to the players, so at this point are 94Kbit/s.The server received all the information, perform the definitive calculation and send the new position to all players, in a bigger packet of around 900bytes that have to be delivered to the others 6, which makes 900bytes x 6 players x 5 times a sec=27000bytes/s=26Kbytes/s=210kbit/s. overall that would be 26kbyte per second. thats like 130mb traffic per hour for a 6player room. but somehow i think the numbers are too high? that would be really much traffic for such a simple game.

did i calculate something wrong?

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:
Positional noise changes in Unity Editor vs compiled I have a surface shader that adds a bit of positional noise, using the following code:

float2 uv_main = IN.uv_MainTex +
    float2(
        tex2D(_PosNoise, IN.uv_MainTex).r - 0.5,
        tex2D(_PosNoise, IN.uv_MainTex).r - 0.5
    ) / float2(_Width, _Height) * _MovementOffset;
o.Albedo = tex2D(_MainTex, uv_main);

_MovementOffset is a float, the _Width and _Height are the size of the map in world coordinates. _PosNoise is a texture that is the same for both versions.

The problem I'm seeing is that the effective noise changes between how the image looks in the Unity Editor vs when it is compiled. The effect is such that I need to multiply the MovementOffset by a factor of 2-3 to have the same effect in the compiled version.

Unity:

Compiled:

I don't understand what could be causing this, and am having some real difficulties figuring it out. Any suggestions on where to look? Thanks!

sentences:
Can I generate character with several layers? Newbie question: I wonder if it is possible in terms of performance to generate characters in several layers in phaser (and in general). And overall if it is a good idea/practice in terms of pro/cons.

For instance, one character would be the sum of the following layers (from top to bottom)

Hairs
Face
Head
hands and forearms
clothes and shoes
arms, legs, neck and feet

I suppose that I will have to realize most of the animations for every layers and it will not be possible to change the layer orders during an animation, but by combining all these layers, I could generate more combinations, hence more characters.

sentences:
How to load and unload objects at a certain radius from the player? I am making a procedurally generated space exploration game in unity. I'm currently generating 5000 stars in a cube of a fixed size. Each star just gets a random 3d coordinate. What I would like to do is to dynamically load and unload stars at a certain radius from the player. This would be the maximum view distance. The algorithm that does this must be working with a seed for the universe, as the stars need to be loaded in the same spot when you revisit them.

My idea is something like in the amazing Space Engine.

I have pretty much no knowledge of algorithms that can do this, so I ask for your help.

sentences:
Loading an image from Disk to used to replace a source image for an image object I am working on a Unity project where I need to be able to grab an image from disk and then have it be replaced as the source image for an image gameobject. Currently I already have a filebrowser implemented that gives me the filepath.

if (File.Exists(output)){
    GameOjbect imageselect = GameObject.Find("ImageSelection");
    imageselect.GetComponent<Image>();
    //I need to make the file location at path output be the sprite?/sourceimage? for imageselect
}

Sorry if this has already been asked, I have been looking at other examples this morning with no luck.

sentences:
UE4 Image Asset From String I have a custom widget with an image component.  I want to change the image dynamically based on a string from a data table.
How do I do this?

sentences:
My object just automatically "launch" or do stuff without me clicking on my mouse when it respawn? I've already set the ball (my object) initially at the start where I have to click for the ball to launch from the paddle (it's a ping pong game).
private void LockBallToPaddle() {
    Vector2 paddlePos = new Vector2(Paddle.transform.position.x,
        Paddle.transform.position.y);
    transform.position = paddlePos + paddleToBall; //For the ball to stick to the paddle
}

Launch the Ball:
private void LaunchBall() {
    if (Input.GetMouseButtonDown(0)) {
        hasStarted = true;
        rbBall.velocity = new Vector2(Random.Range(-2f, 2f),speedVelocity);
    }
}

Both of which I put under Update()
private void LaunchBall() {
    if (Input.GetMouseButtonDown(0)) {
        hasStarted = true;
        rbBall.velocity = new Vector2(Random.Range(-2f, 2f),speedVelocity);
    }
}

Now the problem is when my ball hits a certain collider, I want it to respawn the position back to the paddle. So instead of Destroy the game object, I just copy and paste those same methods under collision
if (collision.gameObject.tag == "bottom") {
    LockBallToPaddle();
    LaunchBalls();
}

But now it just launches straight away from the paddle when hit the collision without me clicking anything like what "Launchballs()" intended to. What should I do?

sentences:
Game-Design: Turn-based ship-to-ship combat with *simultaneous* movement Im currently building a browser-based game, which basicly goes like:
2 Players place starships on a 2d plane, move them around and fire their guns at each other.
The game is divided by turns, each one has 2 phases
Phase 1 - Movement
Phase 2 - Firing

Summarized, it is basicly a table-top game played in the browser.

Due to earlier experience i want to avoid the issue of Players talking movement in turns, i.e. Player A moves ship 1, B moves 2, A moves 3, B moves 4. It makes for some awkward experience and delays the actual firing Phase too Long.

So instead im aiming for something along the lines of "Both Players move all their ships in one step and see the actual Resolution of ALL ships movement afterwards - they then can issue weapons fire".

The Problem is: Manovering ships in this game is Kind of important, because weapons have different arcs of fire and ships different parts of structure. So ideally i want to make "smart" movement choices in order to bring as many weapons as possible to bear while also protecting damaged parts of my fleet / ships.

However, with parallel, "blind" movement, i cant really make smart choices.

What would be a way, from a game-design Point of view, to allow parallel, blind movement while also ensuring impactful choices ?

sentences: LibBDX create a tail when the object is moved I am looking for a way to implement in my game a kind of shadow/tail which will be displayed after the object is moved. Should I use animation? If yes how? Here an example:

sentences:
Tilesets with two dimensions I have done tiled maps and tile sets quite often, but in a rather simplified way. My tile sets were linear images of the size (tile_width * num_tiles) * tile_height, so I could find an index easily by using val src_pos = (index * tile_width, 0).

But in reality, I've come to notice, tile sets are actually fully sized images of two dimensions. That has some advantages, clearly, it's easier to draw. So I wanted to support that. The problem would be just to turn the index to the right source position. Failed a bit, so I wanted to ask here.

I've had two ideas dealing with it:

Turn the index into two values with

src_x = index modulo num_tiles_x
src_y = index div num_tiles_y

which lead me to some quite weird results. The tiles are correctly cut, but they're the wrong ones for the position.

The other idea is to take the image and turn it into a 1D-tile set by cutting it up. But I am afraid that would not be an option, as I am using Textures.

How is this solved in 'professional' applications?

sentences:
In a shader how to map UV coordinates of texture to the UV coordinates of a tile in a tile set? I am writing a fragment shader for a tile set. In the shader I have the UV coordinates of the whole texture, however, I am interested in the UV coordinates of the current tile that is being rendered. In other words: in my shader I am interested to know where the current pixel is within the current tile, not within the whole texture.
So given the overall texture size and the rectangle that defines the tile to render within that texture, and given the UV coordinates of the current pixel corresponding to the whole texture, how can I convert these UV coordinates to the "inner" UV coordinates of the current tile, but also in the range of [0.0,1.0]?

sentences:
My gameObject does not move, when it returns to its original scene I have a map where I have a 2d Ship as gameObject, which can be dragged with the finger to travel between islands and do the corresponding activities, when the player finishes playing on the island he returns to the map where the ship is, but when you try to drag it, you can not do it anymore.

for the change of scene use collisions, as shown in the code.

public string name;

public void OnTriggerEnter2D (Collider2D other)
{
    if (other.gameObject.tag == "Player")
    {
        SceneManager.LoadScene(name);
    }
}

Does anyone know the cause of this error?

The drag code:

public float moveSpeed = 5f;
private Vector3 mousePosition;
private Rigidbody2D _rigidbody;

private void Awake ()
{
    _rigidbody = GetComponent <Rigidbody2D> ();
}

private void Update ()
{
    if (Input.GetMouseButton (0))
    {
        mousePosition = Camera.main.ScreenToWorldPoint (Input.mousePosition);
        mousePosition.z = transform.position.z;

        Vector3 targetPosition = Vector3.MoveTowards (transform.position, mousePosition, moveSpeed * Time.deltaTime);

        _rigidbody.MovePosition (targetPosition);
    }
}

sentences: Controlling the snake in a snake game with the mouse I am trying to implement a snake game in C# using the WPF forms. Well I know to implement the snake game, where the snake is controlled by the keyboard. But how would I do it, if I wanted to control the snake using a mouse rather than a keyboard?

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:
Examples of transforming camera in its local coordinates vs world coordinates OpenGL I am trying to learn OpenGL and am doing some beginners learning exercises. One of the exercises is to translate and then to rotate the camera along its own local coordinates and not the world coordinate system.

I am at a loss at how to do one vs the other. I'm aware how to perform translations and rotations using glTranslatef() and glRotatef() functions. Through research I'm also aware of using the 4x4 transformation matrix to multiply our vector/s with to create the desired transformations, although I've not yet messed around with it personally so I'm not too familiar with the transformation matrix.

This being said, I still have questions regarding the local vs world coordinates. I understand that we can put into effect translations and rotations via these functions or the transformation matrix, but I'm concerned with understanding how we do one vs the other. I haven't found any explicit code/examples of transforming a camera (or a model, but I'm more concerned with the camera in this instance) with respect to the world coordinates, and likewise for transforming it with respect to its local coordinates. I feel like at this point I need something rather explicit, because I've felt confused for several days now.

Furthermore, there may be some conceptual things I am confused about. This is to my understanding: If we strictly move objects and the camera (which to my understanding functions like any other object in the world) by the local coordinate system, does that mean that all the local coordinate systems share the same position of their origin with each other and the origin of the world coordinate system? Then, on the other hand, if we strictly move objects/camera with respect to the world coordinate system, then all objects will always be on their own local coordinate system's origin, right? And assuming no object is positioned on the same spot, then no local coordinate systems origin will be positioned on the same spot, right?

sentences:
How could I implement 3D player collision with rotation in LWJGL? I have a problem with my current collision implementation.

Currently for player collision, I just use an AABB where I check if another AABB is in the way of the player, as shown in this code.
(The code below is a sample of checking for collisions in the Z axis)

for (int z = (int) (this.position.getZ()); z > this.position.getZ() - moveSpeed - boundingBoxDepth; z--)
{
    // The maximum Z you can get.
    int maxZ = (int) (this.position.getZ() - moveSpeed - boundingBoxDepth) + 1;
    AxisAlignedBoundingBox aabb = WarmupWeekend.getInstance().currentLevel.getAxisAlignedBoundingBoxAt(new Vector3f(this.position.getX(), this.position.getY(), z));
    AxisAlignedBoundingBox potentialCameraBB = new AxisAlignedBoundingBox(this, "collider", new Vector3f(this.position.getX(), this.position.getY(), z), boundingBoxWidth, boundingBoxHeight, boundingBoxDepth);
    if (aabb != null)
    {
        if (potentialCameraBB.colliding(aabb) && aabb.COLLIDER_TYPE.equalsIgnoreCase("collider"))
        {
            break;
        }
        else if (!potentialCameraBB.colliding(aabb) && z == maxZ)
        {
            if (this.grounded)
            {
                playFootstep();
            }
            this.position.z -= moveSpeed;
            break;
        }
    }
    else if (z == maxZ)
    {
        if (this.grounded)
        {
            playFootstep();
        }
        this.position.z -= moveSpeed;
        break;
    }
}

Now, when I tried to implement rotation to this method, everything broke. I'm wondering how I could implement rotation to this block (and as all other checks in each axis are the same) and others. Thanks in advance.

sentences:
Java OpenGl Rotating Cube Problem! OK, so I successfully learned how to bind textures to quads and display this cool looking crate. However, when I rotate the cube something goes wrong. During rotation the back-face of the cube overlays the front-face and appears in front of the front-face. This is also the case with the right and left faces. They overlay each other giving a weird perception. I'm not sure why this happens. Here is the code where I draw only four face of the quad (front, back right, left).

gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT);      // clear the screen and depth buffers
gl.glLoadIdentity();                            // reset the current modelview matrix

    // draw quad
    gl.glTranslatef(0.0f, 0.0f, -6.0f);                 // translate to the left and into the screen
    gl.glRotatef(rotateAngle, 0.0f, 1.0f, 0.0f);        // rotate triangle around the y-axis
    gl.glBindTexture(GL2.GL_TEXTURE_2D, textures[2]);   // bind the texture you want to use to gl_texture_2d
    gl.glBegin(GL2.GL_QUADS);

        // front face
        gl.glTexCoord2f(0.0f, 1.0f);                // bottom left
        gl.glVertex3f(-1.0f, -1.0f, 1.0f);
        gl.glTexCoord2f(1.0f, 1.0f);                // bottom right
        gl.glVertex3f(1.0f, -1.0f, 1.0f);
        gl.glTexCoord2f(1.0f, 0.0f);                // top right
        gl.glVertex3f(1.0f, 1.0f, 1.0f);
        gl.glTexCoord2f(0.0f, 0.0f);                // top left
        gl.glVertex3f(-1.0f, 1.0f, 1.0f);

        // right face
        gl.glTexCoord2f(0.0f, 1.0f);                // bottom left
        gl.glVertex3f(1.0f, -1.0f, 1.0f);
        gl.glTexCoord2f(1.0f, 1.0f);                // bottom right
        gl.glVertex3f(1.0f, -1.0f, -1.0f);
        gl.glTexCoord2f(1.0f, 0.0f);                // top right
        gl.glVertex3f(1.0f, 1.0f, -1.0f);
        gl.glTexCoord2f(0.0f, 0.0f);                // top left
        gl.glVertex3f(1.0f, 1.0f, 1.0f);

        // left face
        gl.glTexCoord2f(0.0f, 1.0f);                // bottom left
        gl.glVertex3f(-1.0f, -1.0f, -1.0f);
        gl.glTexCoord2f(1.0f, 1.0f);                // bottom right
        gl.glVertex3f(-1.0f, -1.0f, 1.0f);
        gl.glTexCoord2f(1.0f, 0.0f);                // top right
        gl.glVertex3f(-1.0f, 1.0f, 1.0f);
        gl.glTexCoord2f(0.0f, 0.0f);                // top left
        gl.glVertex3f(-1.0f, 1.0f, -1.0f);

        // back face
        gl.glTexCoord2f(0.0f, 1.0f);                // bottom left
        gl.glVertex3f(-1.0f, -1.0f, -1.0f);
        gl.glTexCoord2f(1.0f, 1.0f);                // bottom right
        gl.glVertex3f(1.0f, -1.0f, -1.0f);
        gl.glTexCoord2f(1.0f, 0.0f);                // top right
        gl.glVertex3f(1.0f, 1.0f, -1.0f);
        gl.glTexCoord2f(0.0f, 0.0f);                // top left
        gl.glVertex3f(-1.0f, 1.0f, -1.0f);

    gl.glEnd();

Moreover, the way I draw textures and then vertices is not yet clear to me. According to what I've read the bottom-left corner (0, 0) is where the textures start drawing, so I should also start drawing my quad from bottom-left accordingly. I tried that but it didn't work. The texture was drawn, but up side down. So I had to go through some trial and error till I got the texture drawn correctly. I wish I could attach a picture to this post so I can show you how the back face of the cube overlays the front one during rotation, but I think this facility isn't provided in stack exchange. Thanks.

sentences:
What is an optimum failure rate that will keep people coming back to my game? I'm guessing some research has been done into this but I can't find much information. The question might be a bit too vague in itself as it depends on so many other factors.

I'm developing a puzzle game that I want to be challenging, but not so challenging that users don't bother coming back to try again if they fail. I'm assuming the shorter the game length to more willing a user will be to try again.

For example, if a level takes an hour with a 95% failure rate, I suspect that many users wouldn't bother trying again after a couple of failures. But if a game takes 30 seconds then they'll probably keep trying again until they succeed.

I'm wondering if anyone has, or can point me in the direction of information that offers guidance on this aspect of game development.

sentences:
Linking classes together My game is now getting to the point where I have alot of classes. Currently, I'm linking all those together through my MainGame Gamestate class. So in my MainGame class I have a Camera instance, a World instance, a Player instance etcetera. Now I know this is bad practise, as this is gonna get real dirty real quick.

What is the correct way of 'linking' loads and loads of classes and systems together?

For example:

In my MainGame class I have a GUI (own GUI library) defined called DebugMenu. Now in this menu I have an input field to change my FOV. When I click the button to update the FOV, the ClickButton event i called in the DebugMenu class which is inherited from the GUI class. To change the FOV I have to call camera.setFOV(40). This camera is an instance, so I need to find the instance that the system is using! That instance is declared in the MainGame class.

I'm using Java.

sentences:
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:
Is there a size limit when using UICollectionView as tiled map for iOS game? I'm working on a turn-based strategy game for iOS, (picture Civilization 2 as an example), and I'm considering using a UICollectionView as my game map. Each cell would be a tile, and I could use the "didSelectCell" method to handle player interaction with each tile.

Here's my question: I know that UICollectionViewCells are dequeued and reused by the OS, so does that mean that the map could support an effectively infinitely-large map, so long as only a few cells are onscreen at a time? However many cells were onscreen would be held in memory, and obviously the data source would take up some memory, but would my offscreen map be limited to a certain size or could it be enormous so long as the number of cells visible at any one time wasn't too much for the device to handle? Basically, is there any memory weight to offscreen cells, or do only visible cells have any impact?

sentences: Visual Studio not recognizing Unity's new Input system I'm attempting to learn Unity's new input system, but when I try to add using UnityEngine.InputSystem; to my code  it gets a red squiggly line under it. It doesn't cause any compiler errors, but it's very annoying.  How do I get Visual Studio to recognize this so Intellisense will work again?

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:
What is a good method to randomly generate edges between graph nodes? I am doing a random map generator for a 4X space game.

Each node in the game is place at a random (x,y) coordinate on a 2d grid. A node can have one or more bi-directional edges to another node (representing wormholes). All nodes must have at least one wormhole, and all nodes must belong to the same graph.

Ideally, a wormhole should not exceed a maximum length and if possible, wormholes should not cross each other.

My naive implementation is to iterate through all the nodes and have the node link to the closest 3 nodes. However, I end up with numerous sub graphs. What's a good method to generate the edges for the nodes?

sentences:
Why doesn't this formula double the value properly? Making a clicker game: Amount awarded per click not increasing based on how many increasers purchased.

I have a few global variables set up.

global.ramen_1 = 1

This part says how many ramen makers I have,
or what my cursor level is, if you purchase another one it goes to 2, then 3 etc...

global.ramen_1_bonus = (global.ramen_1 * 2)

This is the formula that I want to work. If I own 10 ramen makers. Every time I click the ramen picture it is going to increase based on the value of global.ramen_1 times by two. So in theory the more I buy, the higher it should go up when I click it.

I made the ramen image and clicking on it does the following code.

//Increases the amount of money by clicking the ramen
global.money += global.ramen_1_bonus

I have the object that you click that does this code which subtracts from the amount of money you have, but increases the amount of ramen makers you have. And for the time being I just have a static price, nothing that increases yet.

if (global.money >= 10) {
    global.money -= 10;
    global.ramen_1 += 1;
}

This works perfectly, ramen_1 goes up by one, the money goes down by ten when you have enough.

BUT

After I have 2 ramen makers or global.ramen_1 = 2. The formula does not work.

When I click on the ramen bowl, my money doesn't go up 4 like it's supposed to, it still only goes up by two. Why not?

sentences: Is there any reason for doing back face culling in software? I, a newbie, have been doing back face culling in javascript for my WebGL app because I didn't know gl.cullFace() existed. Is there any reason to use software-based culling instead of just passing all faces to GPU and let it do the culling?

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:
Is Time.deltaTime framerate dependent? I have a game that calculates your score via Time.deltaTime (the more time the more score). On my PC I get about 1200 points if I just idle the game while on my phone I only get about 400 points.

I believe my code must be FPS dependant and that's why my phone is getting a lower score for the same time.

Here's the code:

void Update ()
{
    time += Time.deltaTime;

    score += (int)time;

    timerLabel.text = score.ToString();
}

Sorry if it's something very obvious. I'm quite new at c#.

Can't seem to get the solution to work. It just stays at 0:

Full Code:

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

public class EndGame : MonoBehaviour {

    public Text textWin;
    public Text timerLabel;
    public GameObject retryButton;
    public GameObject points;

    private Vector3 offset;
    private float time;
    private float score;

    void OnTriggerEnter (Collider col) {
        if (col.gameObject.name == "Player") {
            setWinText ();
            retryButton.SetActive (true);
            points.SetActive (false);
        }
    }

    void setWinText () {
        textWin.text = "Final score: " + score.ToString();
    }

    void Update ()
    {
        time += Time.deltaTime;
        if (time >= 1.0f) {
            ++score;
            score -= 1.0f;
        }

        timerLabel.text = score.ToString();
    }

}

sentences:
How to make my 2D character stand normally on slope? I've got this character in Unity3D (2D Mode)...
in a a slope which looks like this,

But I want the character to stand along the red line..Like below

How can I make it in Unity3d?

I've got this setup..

I'm using simple Addforce for movement...
If I remove the z position constraint it results in weird movement like rolling and so on....
Any help would be appreciated :)

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

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

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

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

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

sentences:
Target a specific Entity in a Component-Entity design I'm starting to work on a game with Entity-Component Model Architecture (Artemis in C#).
I'm beginning with something pretty simple, entities which are living things, with HealthComponent, PositionComponent, SpriteComponent, MoveComponent. I want them to be able to target other entities (for example other Living things or even other entities of the game (like say inerts objects)) for them to move to them and grab them or be able to do other actions with them.

I can find which entity they will target by going through the mechanic of searching through all entities having the good components (PositionComponent, TargetableComponent) but i don't see how I can store the information of the target except by saving somewhere the ID of the entity.

So I would have a TargetComponent which is basically the ID of an entity that has for exemple a PositionComponent

That does not seem right, does it?

sentences:
Calculate target angle to a certain Vector I'm developing a 3D game in LWJGL.
I have a player class and a monster class and I need the monster class to chase the player when the player is within a certain distance.
For that I have the monster directional vector (let's call it monDirVector) and the directional vector that points from the monster to the player (let's call it dirToPlayer)

So the way my monster class works is that it increments its current rotation to match a target angle (this way I can simulate the walking + turning animation). Given this I need to calculate the target angle so that the monDirVector overlaps the dirToPlayer making the monster walk right towards the player.

How would I go about this?

Here's a diagram for better understanding of what I need.

I pretty much need to get the cº angle and assign it as the target angle for the monster.
The aº is the monster current rotation and the bº is the angle between the two vectors. Both of these are known.
Please notice that the monster can be oriented any way and the player can be in any quadrant relative to the monster. This stands for a problem because I can't simply subtract the angle towards the player to the current rotation of the monster.

I would really apreciate if someone helped me.

sentences:
Ground contact point for animated character sprites in an isometric game? I'm working on an isometric game. I have the 3D pre-rendered sprites for directions per state (walking/running, etc.) per frame. Now I need to know where a particular character stands on the ground to have it synchronized. But this "ground contact point" (GCP) changes from frame to frame, and is basically (slightly) different for every combination. At this moment I have some rough average, but sprite wiggles a bit during animation. It's rendered correctly (1024x768), but cropping of the frames even though it correctly removes empty borders, it also removes the "offset" information, which is no longer there. So I basically need to remove empty borders while taking into account all the frames in all the animations. So the character in the sprite animation is still stabilized, but unneeded space is removed.

Example:

Is there any software that does it, or is there some technique to do it?

sentences:
What units does Sprite Kit use for physics? I'm developing a simple ball game in Sprite Kit. I need to predict the ball's trajectory, so I went back to my physics book for the equations for acceleration, time, speed and space.

The problem is that Sprite Kit documentation does not declare the units of measurement of the properties of physics bodies, so it's hard to calculate the needed values.

Based on my experiments/research I suppose that:

gravity is expressed in m/s/s  (m/s^2)
since gravity is a CGVector, all CGVectors are expressed in m/s/s (m/s^2)
velocity (instant speed) is m/s

Then I realized a simple scene where a ball is falling:

Gravity: CGVector(0,1.2);
Height: 218.009499 pixels
Time: 0.302499747
Then acceleration should be:   2*Height / Time^2 = 1441.3863 pixels/s/s
And gravity of 1.2m/s/s corresponds to 1441.3863 in a world measured in pixels

Someone says the internal PTM (pixel to meter ratio) is 150.

Any hints?

sentences:
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:
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:
Sometimes can't use the rendered mesh as a collider in Unity? Most of the times I can use the Mesh Filter's mesh as collider in Mesh Collider

But sometimes there is just nothing. No collider. Why?

I used this free asset: https://assetstore.unity.com/packages/3d/environments/fantasy/green-forest-22762

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

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

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

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

sentences:
Move 2D Rotating object in its facing direction I have a 2D object that constantly moving forward (in the direction its facing). So initially its facing right, and moving right, but as the rotation z-axis changes, so should its direction. Most of what I'm finding is based on the Asteroids game physics, but what I'm doing is not like that (I think), I'm not adding force to the object when I want its direction to change. Basically what I'm trying to do have it's X & Y velocity change based on its z rotation value. Here is an example of something similar to what I'm attempting to do:
Moving object

sentences:
How to store 3D entity position, offset, and transformation data for parent and children? I am looking for a cleaner pattern to storing character position data, offsets, and transformations. I currently have a character with a vec3 for position.

Entity{
 position: vec3
 rotation: vec4Quaternion
 velocity: vec3
}

I use this position vector as the world coordinate. So that when Y=0 I imagine the characters feet are on the ground. This makes it easier to think about where the entity is in world space.

The problem I am having is that mesh entities like colliders or the skin mesh will assume a position vector at the center of the mesh.  This is causing me to have to do a bunch of transformation juggling. I can't 1-to-1 map these meshes to the entities world position.

I will update my characters 'ground position' when they move. then have to calculate the new 'center position' which is calculated like

centerPosition = [
groundPosition.x
groundPosition.y + entityHeight/2,
groundPosition.z
]

I"m wondering if there is a better pattern for this. Maybe I assume the entities position vector is a 'center position' as well? but not clear to me how to handle the ground offset in that case.

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:
Binding BoundingSpheres to a world matrix in XNA I made a program that loads the locations of items on the scene from a file like this:

using (StreamReader sr = new StreamReader(OpenFileDialog1.FileName))
                    {
                        String line;
                        while ((line = sr.ReadLine()) != null)
                        {
                            red = line.Split(',');
                            model = row[0];
                            x = row[1];
                            y = row[2];
                            z = row[3];
                            elements.Add(Convert.ToInt32(model));
                            data.Add(new Vector3(Convert.ToSingle(x), Convert.ToSingle(y), Convert.ToSingle(z)));
                            sfepheres.Add(new BoundingSphere(new Vector3(Convert.ToSingle(x), Convert.ToSingle(y), Convert.ToSingle(z)), 1f));
                        }

I also have a list of BoundingSpheres (called spheres) that adds a new bounding sphere for each line from the file.
In this program I have one item (a simple box) that moves (it has its world matrix called matrixBox), and other items are static entire time (there is a world matrix that holds those elements called simply world). The problem i that when I move the box, bounding spheres move with it. So how can I bind all BoundingSpheres (except the one corresponding to the box) to the static world matrix so that they stay in their place when the box moves?

sentences:
Shader that render canvas before any object I have a canvas (in world space/3d) which is not showing to camera due to this shader which is applied to another (sphere) object.

Shader "Custom/TextureHolderCustom" {
    Properties {

        _MainTex ("Albedo (RGB)", 2D) = "white" {}
        _Mask ("Mask Texture", 2D) = "white" {}

    }
    SubShader {
    Tags{"Queue" = "Transparent"}
       Cull Off
       Lighting On
       Zwrite On
       Blend SrcAlpha OneMinusSrcAlpha

       Pass
       {
       SetTexture[_Mask]{combine texture}
       SetTexture[_MainTex]{combine texture,previous}
       }
    }
    FallBack "Diffuse"
}

sphere object where my above shader is attached showing first but my canvas is not showing. I want to show the canvas first. I think i attach above shader to my canvas but it is not possible to apply m

I am zero in shader programming

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:
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:
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:
How to have a tilted FNT font on Godot? Since FNT is a bitmap font I was thinking perhaps making the padding negative to the right and left side of the characters and rasterizing each glyph already skewed by an angle could make the font appear to be tilted. Does any one know whether FNT sports negative padding or whether Godot support some form of skewing that could accomplish that?
Please take a look at the image to see what I'm describing

sentences:
Cinematographic camera manipulation techniques for a 2D adventure game I'm coding a subsystem to manipulate camera for our 2D adventure game.

I plan to support panning and zooming. Also, perhaps, rotation (but current scenario does not call for that). We also support parallax scrolling, if that matters.

To better understand what means of expression my level-designer would need to design best experience for the player in cutscenes, I'm looking for a good documentation on relevant cinematographic camera manipulation techniques. (Yes, of course, I plan to have a discussion with my level-designers as well.)

Maybe there is a good basic guide for a camera manipulation in a 2d-animation movie or something like that — what techniques are there, and when to use what.

Or maybe there is some relevant document that is written from the game-development point of view?

Any advice welcome.

sentences:
Trees made with Unity's Tree Editor have 2 sides: 1 bright and 1 normal (The directional light lits the side shown at the right side of the picture.)

I tried changing shaders, but that just makes the bright side fully dark.

I tried changing Ambient Occlusion but that make the normal side fully dark, and the bright side normal.

I use the "Green Forest" (free) asset from the Unity Store.

Currently it uses the "Hidden/Nature/Tree Creator Leaves Optimized" shader.

Some types of trees got fixed by turning off AO, and setting shadow strength to 0 both at the shader and at the Tree component, but for example the tree on the picture can't be fixed for some reason.

One type got fixed by setting its shader to "Tree Creator Leaves Fast". But that way shadows "float" around the leaves.

Why does this happen?

sentences:
Unity How does Time.smoothDeltaTime work I can't seem to find any actual information on what Time.smoothDeltaTime does or how it works.

I would assume it takes a rolling average of previous deltaTimes but how does it do that? Is the average asymptotic? How sensitive is it to outliers? What is it's actual intended use case?

If anyone could explain how it works, or link to a resource on what it is doing it would be really helpful.

sentences:
Objective-c Cocos2d moving a sprite I hope someone knows how to do the following with cocos2d:

I want a sprite to move but not in a single line by using

[cocosGuy runAction: [CCMoveTo actionWithDuration:1 position:location]];

What I want is the sprite to do some kind of movements that I preestablish. For example in some point i want the sprirte to move for instance up and then down but in a curve. Do I have to do this with flash like this documents says?

http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:animation

Does animation in this page means moving sprites or what?

thanks

sentences:
Why does my gameobject fly of into the air when the screen is touched? I am encountering a peculiar problem when updating a piece of code that translates my gameobject left and right based on mobile touch input.

To provide context, the platform upon which the gameobject, which is a sphere in my case, translates, is this:

The platform is 10 units wide, with the sphere in the center.

In its original form, the code looks like this:

void FixedUpdate () {
    if(Input.touchCount == 1) {
        float touchXComponent = Input.GetTouch(0).deltaPosition.x;
        transform.Translate(Vector3.right * Time.smoothDeltaTime * touchXComponent * 0.5f);
    }
}

It provides the desired left and right movement, but it has a tendency to allow the ball to leave the platform, and then start moving up and down in the air with each further touch.

To combat that, I tried editing the code as follows:

void FixedUpdate(){
    if (Input.touchCount == 1){
        float touchXComponent = Input.GetTouch(0).deltaPosition.x;
        transform.Translate((Vector3.right * Time.smoothDeltaTime * touchXComponent * 0.5f).x, transform.position.y, transform.position.z);
    }
}

This, however, causes the ball to fly of the screen the second it is touched, leaving me with this error in the console:

Assertion failed: Invalid worldAABB. Object is too large or too far away from the origin.

I would have thought that the update I made to the code would keep the ball stationary on the y and z-axes, while allowing it to translate freely on the x-axis. Why is that not the case?

Thank you.

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:
Unity Tilemap.BoxFill is not filling correctly So I have a tilemap that already has tiles on it. What I want is to clear it all out and create a solid rectangle of one tile, with which the rest of the monobehaviour will 'carve out' to create a cave complex.
So in my Start() I begin with:
tilemap.ClearAllTiles();

tilemap.BoxFill(Vector3Int.zero, wallTile, -mapSize, -mapSize, mapSize, mapSize);

Let's say mapSize is 8, and "tilemap" is a reference to a Tilemap that previously had some tiles on it. I expect to see all the prior tiles removed, and a new filled area of "wallTile" that goes from -8,-8 to 8,8
Instead I get a single tile at 0,0,0 and that's it.
If I leave out the ClearAllTiles(), it does nothing; the old tiles remain, and no new tiles are placed at all.
The only way it seems to do anything is if the tilemap was empty before in the scene, but I need to work with a tilemap that was previously in use.
Any suggestions on what I'm doing wrong?

sentences:
How to calculate whether a cuboids face edge is infront of or behind another for sorting I'm building an isometric game, I want to position and sort objects in a particular way.
All my entities have 3d bounds which determines their cuboid, looking my example, a different edge is used to decide if a cuboid is in front of another, depending on whether the point b2 is left or right of a2.

I have already calculated all the points a1,a2,b1,b2 which are x,y,z
I think I basically need to virtually draw "aedge" and "bedge", and compare some intersection.

If b2 is right of a2 the green cuboid (b) is consider in front of the red cuboid when bline is south east of aline.

If b2 is left of a2 the green cuboid (b) is considered in front of the red cuboid when bline is south west of aline.

Please forgive my ignorance here, I'm sure there's some terminology I should have used here. I'm struggling to put down in words what it is I need.

sentences:
ShapeRenderer efficiency on games I want to draw a rectangle box to use as a text background for a visual novel library I'm writing, I wanted some flexibility of color and transparency and the ShapeRenderer class seems to fit the need but the doc brings this disclaimer:

This class is not meant to be used for performance sensitive applications but more oriented towards debugging.

If I use it as background the most action on screen would probably be the text scrolling over it.
Can someone more experient on the engine tell me if it is viable to use it under those premises, or it is really for debug only?

sentences:
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:
Boolean checks with a single quadtree, or multiple quadtrees? I'm currently developing a 2D sidescrolling shooter game for PC (think metroidvania but with a lot more happening at once). Using XNA.

I'm utilising quadtrees for my spatial partitioning system.

All objects will be encompassed by standard bounding geometry (box or sphere) with possible pixel-perfect collision detection implemented after geometry collision (depends on how optimised I can get it).

These are my collision scenarios, with <> representing object overlap (multiplayer co-op is the reason for the player<>player scenario):

Collision scenarios (true = collision occurs):
Player              <>      Player          =   false
Enemy               <>      Enemy           =   false
Player              <>      Enemy           =   true
PlayerBullet        <>      Enemy           =   true
PlayerBullet        <>      Player          =   false
PlayerBullet        <>      EnemyBullet     =   true
PlayerBullet        <>      PlayerBullet    =   false
EnemyBullet         <>      Player          =   true
EnemyBullet         <>      Enemy           =   false
EnemyBullet         <>      EnemyBullet     =   false
Player              <>      Environment     =   true
Enemy               <>      Environment     =   true
PlayerBullet        <>      Environment     =   true
EnemyBullet         <>      Environment     =   true

Going off this information and the fact that were will likely be several hundred objects rendering on-screen at any given time, my question is as follows:

Which method is likely to be the most efficient/optimised and why:

Using a single quadtree with boolean checks for collision between
the different types of objects.
Using three quadtrees at once (player, enemy, environment), only testing the player and enemy trees against each other while testing both the player and enemy trees against the environment tree.

sentences:
Make models not see through All my models are see through and I can't figure out why. For example:

Here's what it looks like when you are not looking through them:

And when I look through one of them:

Why can I see the black cube through the other Model? It's the same the other way around. I can see the gray object through the black cube. I draw the models like this:

public void Draw(GraphicsDevice graphicsDevice)
{
    foreach (ModelMesh mesh in model.Meshes)
    {
        foreach (BasicEffect effect in mesh.Effects)
        {
            effect.View = camera.View;
            effect.World = worldMatrix;
            effect.Projection = camera.Projection;

            mesh.Draw();

            // Debug: Draw bounding boxes
            modelBox.Draw(effect, camera.View, camera.Projection, effect.World, graphicsDevice);
        }
    }
}

What am I doing wrong?

More screenshots: http://imgur.com/qRA34Ul, http://imgur.com/K4PGWfL

sentences: Can flixel or a similar engine be used with reddwarf server? I like the sgs/projectdarkstar or now known as reddwarf server for a back end game server.  However I am looking for a good front end, preferably 2D.  I was thinking of something such as flixel.  I know there is an AS3 library available for reddwarf, so I am hoping someone already has connected up flixel or a similar engine?   Or if you have a recommendation for another easy client side engine that will connect to reddwarf?

sentences:
Open GL Android frame-by-frame animation tutorial/example code My first question was asked wrong, so I need to ask again :)

I found out, that I will have to do an OpenGL animation for my Android game. The closest (known) example is Talking Tom (but I don't know how they did the animations).

I have large PNGs which I would like to put into a animation. For example - 30 PNGs 427×240px at 8 FPS.

I know some things already about Open GL, but I am used to learn from example code. And it is quicker that way (so I don't need to invent hot water all over again :)). Does anybody has any points to direct me?

sentences:
Best practices for periodically saving game state to disk I'm working on an MMO. All of the player and environment data lives on a server and is kept in memory. There's a "world" object which keeps track of all of the maps, characters, etc. and their relations to each other.

To avoid data loss in case of a crash, I've been periodically serializing the world to disk. The trouble is, this object can be quite large, so when the server starts writing, there's noticeable in-game slowdown for a few seconds, which I'd like to avoid.

Any pointers on how to go about this in a more efficient way?

sentences:
Jumping onto higher ground Collider issues What's the general solution to the following character animation problem (I'm using Unity)?

You have a character with a capsule collider and a jump animation that allows you to jump onto higher ground (such s boxes, etc.). The character shouldn't be able to jump unrealistically high so she goes into a crouched posture while in the air and the collider is scaled accordingly in an animation curve.

However when the character jumps onto the box to land, the character animation (and collider) want to extend back to wards the ground but there is not enough space and either collision detection fails and the character falls into the geometry or the collider starts a collision fight with the box and keeps bumping up and down, keeping the character in an airborne state.

Please see screenshots to get a better idea...

What would be a good way to work around this problem?

sentences:
TexturePacker ignores extensions I'm using TexturePacker in one of my games, though when packing a bunch of textures their extension is kept in the data file. So when I want to find a texture I need to search for "image.png" instead of just "image". Is there an option to let texture packer ignore the extensions of my source images in the data file?

Solved:

So if anyone else wants this, here's the exported I made: https://www.box.com/s/bf12q1i1yc9jr2c5yehd Just extract it into "C:\Program Files (x86)\CodeAndWeb\TexturePacker\bin\exporters\UIToolkit No Extensions" (or something similar) and it should show op as an exporter.

sentences:
How do I deal with floating-point error given a far-away camera? Whenever a camera is "far" away (its location is some "large" vector), trouble arises when rendering objects close to it: It is the classic precision loss from subtracting 2 floating point numbers.

I know these ways around it:

using doubles for projection/viewing transformations (may not be feasible/possible on mobile devices),
doing the subtraction on the CPU (with doubles or integers) and uploading the (relative) position of the object into the shader. This position vector is then added to the vector, that is to be transformed in the vertex shader,
tweaking the camera view matrix or model matrix. These matrices are then combined on the CPU and uploaded.

How do these methods compare? Have I missed some other approach?

sentences:
Sound Synthesis from object collision in Virtual Reality Environment I have a project whose subject is "Sound Synthesis from object collision in Virtual Reality Environment" First of all, I have to define some objects with certain attributes (like shape, mass, material) and then I have to create sound from the collision of these objects in C++ according to their attributes, area of collision etc. I think I have to use some sort of Physics Engine like Bullet or ODE but I'm not sure how to start this project. Is there any Physics Engine specialized in Sound Synthesis?

I've come up with PhyA but I don't know how to download it and implement it. http://www.tech.dmu.ac.uk/~dylan/z/phya/

P.S. I intend to use CHAI3d or H3dApi because I have to use the Falcon device.

sentences:
Controllable color blending? I'm relatively new to color blending in DirectX, and I'm hoping there is a relatively simple answer to this question. I am targeting Direct10.1.
What I am trying to achieve is colour blending of two overlapping 2D shapes, where the blend factor between the two layers varies (in quite a simple manner).

The shapes in the output I want should be completely opaque. I can achieve the blend variation I need very easily using alpha blending and modifying the alpha value in the pixel shader, but of course this then ends up giving me a final image with areas of partial transparency. One way I think I could resolve this would be to simply render the original render target again in a quad, and multiply out the alpha values to give me a 100% opaque images, but I have a niggling feeling that the blend operation I want must be possible via some blend state configuration.

sentences:
LWJGL: Camera distance from image plane? Let me paste some code before I ask the question...

public static void createWindow(int[] args) {

    try {

        Display.setFullscreen(false);
        DisplayMode d[] = Display.getAvailableDisplayModes();
        for (int i = 0; i < d.length; i++) {
            if (d[i].getWidth() == args[0] && d[i].getHeight() == args[1]
                    && d[i].getBitsPerPixel() == 32) {
                displayMode = d[i];
                break;
            }
        }

        Display.setDisplayMode(displayMode);
        Display.create();

    } catch (Exception e) {
        e.printStackTrace();
        System.exit(0);
    }

}

public static void initGL() {
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    GL11.glClearDepth(1.0);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthFunc(GL11.GL_LEQUAL);

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();

    GLU.gluPerspective(45.0f, (float) displayMode.getWidth()
            / (float) displayMode.getHeight(), 0.1f, 100.0f);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
}

So, with the camera and screen setup out of the way, I can now ask the actual question: How do I know what the camera distance is from the image plane? I also would like to know what the angle between the image plane's center normal and a line drawn from the middle of one of the edges to the camera position is.

This will be used to consequently draw a vector from the camera's position through the player's click-coordinates to determine the world coordinates they clicked (or could've clicked).

Also, when I set the camera coordinates, do I set the coordinates of the camera or do I set the coordinates of the image plane?

Thank you for your help.

EDIT: So, I managed to solve how to calculate the distance of the camera... Here's the relevant code...

private static float getScreenFOV(int dim) {
    if (dim == 0) {
        float dist = (float) Math.tan((Math.PI / 2 - Math.toRadians(FOV_Y))/2) * 0.5f;
        float FOV_X = 2 * (float) Math.atan(getScreenRatio() * 0.5f / dist);
        return FOV_X;
    } else if (dim == 1) {
        return FOV_Y;
    }
    return 0;
}

FOV_Y is the Field of View that one defines in gluPerspective (float fovy in javadoc). This seems to be (and would logically be) for the height of the screen. Now I just need to figure out how to calculate that vector.

sentences:
More efficient in range checking I am going to use a specific example in my question, but overall it is pretty general. I use java and libgdx.

I have a ship that moves through space. In space there is debris that the ship can tractor beam in and and harvest. Debris is stored in a list, and the object contains it own x and y values. So currently there is no way to to find the debris's location without first looking at the debris object. Now at any given time there can be a huge (1000+) amount of debris in space, and I figure that calculating the distance between the ship and every single piece of debris and comparing it to maximum tractor beam length is rather inefficient.

I have thought of dividing space into sectors, and have each sector contain a list of every object in it. This way I could only check nearby sectors. However this essentially doubles memory for the list. (I would reference the same object so it wouldn't double overall. I am not CS major, but I doubt this would be hugely significant.) This also means anytime an object moves it has to calculate which sector it is in, again not a huge problem.

I also don't know if I can use some sort of 2D MAP that uses x and y values as keys. But since I am using float locations this sounds more trouble than its worth.

I am kind of new to programming games, and I imagined there would be some eloquent solution to this issue.

sentences:
Placing Zones in Cities Skylines I'm trying to build a mod that places zones on a keypress. How would I accomplish this?
So far I've detected the keypress. But when I modify m_blocks in ZoneManager by calling block.setZone(x,y,zone) The block appears to have changed, but only for the moment. When I run the keycommand again, the data appears to have  been reset. I never see the zone change in game, only when I print it to the console.
string outtext = "";
            uint blockCount = Singleton<ZoneManager>.instance.m_blocks.m_size;
            outtext += "start{\n";
            for (int index = 0; index < blockCount; index++) {
                var block = Singleton<ZoneManager>.instance.m_blocks.m_buffer[index];
                if (block.m_valid != 0) {
                    block.SetZone(1, 1, ItemClass.Zone.Industrial);
                    block.RefreshZoning(0);
                    outtext += " valid:" + block.m_valid + " position:" + block.m_position.ToString() + " zone:" + block.GetZone(1, 1) + " \n ";
                }
            }
            outtext += "}";
            Debug.Log("OUTTEXT " + outtext);

I've tried calling block.refreshZoning() as well, but I'm not sure how to calculate the blockid :(.

sentences:
Level loading works in Unity editor, but quits when deployed In my level selection screen, all but the first level start out locked.

When I click on a level, it loads perfectly in Unity editor. However, when I build the game on a real device, the game stops as though I had pressed the back button on my device instead of launching the level.

What happened? How can I debug this, given it works fine in the editor?

sentences:
Rotation with respect to world instead of the object itself using Quaternion.Euler in unity [Other answers on similar questions on stackexchange didnt help]

This script is giving some weird outputs

On running this script If I press rightarrow once followed by 's' the object rotates on 'z' axis and 'x' axis correctly but there after if I press arrowkeys or 'a/s' in both the cases the object rotates on y axis forever. I dont understand why this is happening.

I want it to rotate w.r.t. the world axis always.

code:

public float speed = 1;
private int xtimesHit = 0;
private int ytimesHit = 0;
private int ztimesHit = 0;

void Update () {
    if( Input.GetKeyDown( KeyCode.RightArrow ) ){
        ztimesHit--;
    }
    if( Input.GetKeyDown( KeyCode.LeftArrow ) ){
        ztimesHit++;
    }

    if( Input.GetKeyDown( "a" ) ){
        ytimesHit++;
    }
    if( Input.GetKeyDown( "d" ) ){
        ytimesHit--;
    }

    if( Input.GetKeyDown( "w" ) ){
        xtimesHit++;
    }
    if( Input.GetKeyDown( "s") ){
        xtimesHit--;
    }

    this.transform.rotation = Quaternion.Lerp(this.transform.rotation, Quaternion.Euler(xtimesHit*90,ytimesHit*90,ztimesHit*90), Time.deltaTime*speed);

How can I do that?
I have created this code with help from other, so I'd wish to edit it rather than using totally new functions.

[Optional]
Code explanation:
My code is fulfilling partial requirements, I want to rotate my object on x,y,z axis by 90 deg on  respective keyboard inputs. (Example: keys a and s should rotate the object by 90 deg on z axis, w and s should rotate the object by 90 deg on y axis and arrow keys should rotate the object by 90 deg on y axis). Also pressing 'a' n times should rotate the object by 90 deg n times.

sentences:
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: Is it possible to move a parent object independent of the child object I need to be able to move a Parent Object without moving the Child Objects.

sentences:
Why texture coordinate of flat surface reflection is calculated like this in fragment shader? The whole project is here: https://developer.apple.com/library/mac/#samplecode/GLEssentials/Introduction/Intro.html

The rendering flow is like this:

Render the character upside down to a texture.
Render the character normally.
Render the flat reflection surface below the character using the texture from step 1.

I don't understand the texture coordinate calculation in the fragment shader, specifically the block marked with ??? below:

precision highp float;

// Color of tint to apply (blue)
const vec4 tintColor = vec4(0.0, 0.0, 1.0, 1.0);

// Amount of tint to apply
const float tintFactor = 0.2;

varying vec3  varNormal;
varying vec3  varEyeDir;

uniform sampler2D diffuseTexture;

void main (void)
{
    // Compute reflection vector
    vec3 reflectDir = reflect(varEyeDir, varNormal);

    // Compute altitude and azimuth angles
    vec2 texcoord;

    texcoord.t = normalize(reflectDir).y;
    // ???????????????????????????????????????????????
    reflectDir.y = 0.0; // Why clear reflectDir.y?
    texcoord.s = normalize(reflectDir).x * 0.5; // Why times 0.5?

    // Translate index values into proper range
    if (reflectDir.z >= 0.0) {
        texcoord = (texcoord + 1.0) * 0.5;
    } else {
        texcoord.t = (texcoord.t + 1.0) * 0.5;
        texcoord.s = (-texcoord.s) * 0.5 + 1.0; // Why translation of s is like this, different from t?
    }
    // ???????????????????????????????????????????????

    // Do a lookup into the environment map.
    vec4 texColor = texture2D(diffuseTexture, texcoord);

    // Add some blue tint to the image so it looks more like a mirror or glass
    gl_FragColor = mix(texColor, tintColor, tintFactor);
}

Thanks in advance to anyone who can demystify this for me!

sentences:
How to orient a surface normal to a cubic surface The immediate question is: in HLSL, how can I orient a surface normal generated in UV space so that I can apply it to a cube face?

The overall project is that I'm trying to build a procedural planet generator.  I'm using a cube projected to a sphere where each face is a quad-tree.  The intermediate project is that I want to generate a normal map for the terrain.  I think the best way for me to do this (and understand what I'm doing) is to generate the normals for the cube version first, then work out the transformations to warp those normals to the sphere.

Ideally the method would not involve branching code based on which face I'm working on (i.e., if we're on the top side of the cube, then U = X and V = Y).  In other words, what I'm hoping for is some math-magic like "Oh, just cross multiply the terrain normal by the dot product of the cube face normal and blah blah blah".

9/20/10 ETA:

I know how to calculate normals for a flat surface.  My subsequent problem is two-fold:

How do I rotate the normal map so it is oriented correctly on each of the cube faces?
how do I warp the flat normal map so that it wraps the sphere?

I've found one solution that uses a Jacobian matrix, but I can't get it to work.  Even when all of the normals are pointing straight up (i.e. a flat surface), the HLSL code involving the Jacobian totally messes up the lighting--so it makes me not trust my implementation of the solution.

sentences: Tower defense endless levels logic sprite kit I am making a tower defense game for iOS using Sprite Kit. I would like for my game to support an endless number of levels, like in Bloons TD 5. What approach should I take to implement this?

sentences:
Show the tooltip when mouse over at the object unity3d i wanted to show the tooltip like this when the mouse over at the object, here is the example image:

and

i already tried this below code, but the message on the debug.log didn't showed up when i am hovering my mouse to the object, the object i give the name same like this:

void Update()
{

    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

    RaycastHit hit;

    if (Physics.Raycast(ray,out hit) && hit.collider.gameObject.name == "Yify")
    {

        Debug.Log("Yify");

    }

}

And here is my object (i use List to multiple the objects and each object i gave the name), (The object's name "Yify" is on the right side, dark green color):

Please help. Thank you!

Update:

i already got the script that hold movement and attack logic like the image that shown below sir @Korchkidu:

sentences:
Independent game developer career advice I recently left my full-time job for an independent game development career.  So far things are going well:  I've created two games for the iPhone (one has been in the app store for a month or so and the other has been in review for about a week).  I'm working on a third game now.  Each time the game development life cycle is shorter while the product quality is higher.  However I am not yet making a living from my games.

My savings can support me for another year.  Here's my general plan:

make a few more games
in 8-9 months look for a job in the game industry (if my games are not paying the bills yet)

How would you proceed in this situation?

Perhaps you would look for a game dev job immediately.  Or you would move somewhere with a lower cost of living hence maximizing your time to work independently.  Or something else.

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:
How can I make the player spawn at a specific location on the map? I'm trying to make a game in Unreal Engine 4.8,

I've got a Player Start actor in the main level and a box collision that loads a new level, but when you return to the main level you obviously spawn at the Player Start, how can I make the player spawn at a specific location on the map, because I've tried with a lot of things and they didn't work.

For example I start at the tent and you walk to the house, you enter the house level, and after a few minutes you leave, what happens is that you spawn at the Player Star and I want to spawn in front of the house.

sentences:
How To Display a friend list Using Play fab? I m making a multiplayer game using playfab.

One player send  a friend request Second player then not display a player name?? I want the access(display) a player name??? see the referance,

Code:

ListingPrefab.cs

   public class ListingPrefab : MonoBehaviour
   {
      public static ListingPrefab Instance;

      public Text playerNameText;
    }

FriendRequest.cs

public class FriendRequest : MonoBehaviour
{
    public GameObject listingPrefab;   //btn
    public Transform panel;           //parent

    //Display Friend
    void DisplayFriends(List<FriendInfo> friendsCache)
    {
        foreach (FriendInfo f in friendsCache)    // I think problem is here
        {
            GameObject listfriend = Instantiate(listingPrefab);
            ListingPrefab templisting = listfriend.GetComponent<ListingPrefab>();
            templisting.transform.SetParent(panel, true);

            //PlayerPrefs.GetString("PlayerName", ListingPrefab.Instance.playerNameText.text.ToString());
            //PlayerPrefs.SetString("PlayerName",  ListingPrefab.Instance.playerNameText.text.ToString());

            Debug.Log("playername:" + templisting.playerNameText + friendsearch);
            //Debug.Log("helloone"+ f.TitleDisplayName);
            templisting.playerNameText.text = f.TitleDisplayName;                               // TitleDisplayName PlayFab unique username for this friend.
        }
    }

    void DisplayPlayFabError(PlayFabError error)
    {
        Debug.LogError(error.GenerateErrorReport());
    }
    void DisplayError(string error)
    {
        Debug.LogError(error);
    }

    //Getfriend
    List<FriendInfo> _friends = null;

    public void GetFriends()  //you can call button click
    {
        PlayFabClientAPI.GetFriendsList(new GetFriendsListRequest
        {
            IncludeSteamFriends = false,
            IncludeFacebookFriends = false
        }, result => {
            _friends = result.Friends;
            DisplayFriends(_friends); // triggers your UI
        }, DisplayPlayFabError);
        Debug.Log("Inside GetFriends");
    }

    //Add friend
    enum FriendIdType { PlayFabId, Username, Email, DisplayName };

    void AddFriend(FriendIdType idType, string friendId)
    {
        var request = new AddFriendRequest();
        switch (idType)
        {
            case FriendIdType.PlayFabId:
                request.FriendPlayFabId = friendId;
                break;
            case FriendIdType.Username:
                request.FriendUsername = friendId;
                break;
            case FriendIdType.Email:
                request.FriendEmail = friendId;
                break;
            case FriendIdType.DisplayName:
                request.FriendTitleDisplayName = friendId;
                break;
        }
        // Execute request and update friends when we are done
        PlayFabClientAPI.AddFriend(request, result =>
        {
            Debug.Log("Friend added successfully!");       //Add a friend
        }, DisplayPlayFabError);
    }

    string friendsearch;
    [SerializeField]
    GameObject friendpanel;

    public void InputFriendID(string inputfriendid)
    {
        friendsearch = inputfriendid;
    }

    public void SubmitFriendRequest()
    {
        AddFriend(FriendIdType.PlayFabId, friendsearch);
    }

    public void OpenCloseFriends()
    {
        friendpanel.SetActive(!friendpanel.activeInHierarchy);
    }

}

Prerequisites
SDK: Unity

The title ID is set in the PlayFabSharedSettings object (alaready i have)
The project can successfully log in a user  (alaready i have)
The title has at least two registered users  (alaready i have)

image:

I have 15 Player.

How To access a PlayerName??

sentences:
How can I flip a coin? I am working in unity and have flattened out a cylinder object to make a coin for a 3d coin flipping game, but I am not sure how to get the coin to flip when the player swipes across it and allow for a double flip if the player swipes over it a second time while in mid air.

here is what I have tried:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CoinFlip : MonoBehaviour {

    private Vector3 start;

    private void Start() {
        start = gameObject.transform.position;
    }

    void Update() {
        transform.position += transform.right * Mathf.Sin(Time.time * 0.45f) * -0.025f;
    }

    void OnEnable() {
        gameObject.transform.position = start;
    }
}

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:
Different Sprite sizes for animation I have a character which has a size of 32x64 when walking or standing. Using the libgdx animation class I can easily animate him with a texture atlas.
When I want to make him attack however, the Sprite appears squished because the frames for the attack animation are 64x64 to accommodate the sword.
My question is as the artist and programmer, would it make more sense to have each Sprite frame for every animation be 64x64? Or in code, resize the Sprite origin and bounds before the attack animation and set them back to 32x64 when the attack is done?

sentences:
Why are modern open world games so quiet? When I first got Skyrim, my friends kept ranting about how great the music was. I found this odd, since I only remembered the same old music only popping up during random encounters. After awhile I just assumed that my installation was broken (for some reason the music files were corrupted or something). Then I saw my one of my friends playing their copy, and lo and behold, their game was just as quiet—with only footsteps sound effects.

Now my roommate's version of Breath of The Wild shows up, and even Legend of Zelda games are following this trend?! What happened? What happened to the obnoxious Morrowind music? The ambient musical feel of each region in Ocarina of Time? Why would game developers eliminate such a powerful tool for creating atmosphere?

sentences:
How to generate mesh at runtime using raycast points? I'm trying to make a clone of the trail/line renderer with the difference that everything is perfectly flat, i.e. the faces are not designed to face the camera. I'm using two raycasts to get the position of the edges of where I want those faces but now I'm struggling to generate the mesh...I've gone through the mesh docs but I don't really understand it. Could someone help me do this?

Here is my code so far:

    public Transform[] probes;
    public float probeDistance;

    public Vector3[] newVertices;
    public Vector2[] newUV;
    public int[] newTriangles;

    void Update () {
        //Generating the mesh
        Mesh mesh = new Mesh();
        GetComponent<MeshFilter>().mesh = mesh;
        mesh.vertices = newVertices;
        mesh.uv = newUV;
        mesh.triangles = newTriangles;

        //Defining the rays
        Ray l_ray = new Ray(probes[0].position, -probes[0].forward * probeDistance);
        Ray r_ray = new Ray(probes[1].position, -probes[1].forward * probeDistance);

        RaycastHit l_hit;
        RaycastHit r_hit;

        Debug.DrawRay(probes[0].position, -probes[0].forward * probeDistance, Color.blue);
        Debug.DrawRay(probes[1].position, -probes[1].forward * probeDistance, Color.red);

        //Getting the position of the left ray point
        if(Physics.Raycast(l_ray, out l_hit)){
            print (l_hit.point);
        }

        //Getting the position of the right ray point
        if(Physics.Raycast(r_ray, out r_hit)){
            print (r_hit.point);
        }
    }

sentences:
Setting up CCMenu for Cocos2d I am very new to Cocos2d programming and was thinking to build up my first app. I learnt some basics related to CCMenu and CCMenuItems. But I was wondering whether I could provide animations in such a way that every CCMenuItem would animate first and then appear in the CCMenu. Will that be possible in Cocos2d? Can I get some tutorials or samples regarding this?

Thanks.

sentences:
UNIT_SPELLCAST_START event, spell names, localization issues? I have created a small addon for myself, SheepWhisperer which listens for me casting Polymorph on my mage or Shackle Undead on my priest.

When it detects this, and I'm in a party, it will check if I'm targetting a mob that one of the other party members are also targetting. If so then it will send them a whisper telling them about my incoming spell.

So far the addon works for me, but I'd like to publish this addon for others to use.

The event gets called with the spell names, not the spell id's, which means that my code currently looks for the following two spells by their names:

Polymorph
Shackle Undead

The question is this: If someone is running the German client (or any of the other clients, other than the English one), will they get different names or will this event still be called with "Polymorph"?

I have checked Wowhead: Polymorph but it doesn't tell me the German (as an example) name for that spell. Perhaps there is none? Perhaps all the clients use Polymorph so this is a non-starter?

sentences:
Desire advice on implementing this animation timeline system I have read a lot of questions on here, as well as books regarding game architecture. I have a general question about the implementation of a game's animation timeline, on which many isolated animations sit. I implemented one recently that proved rather inefficient and bug-prone, so I'm doing it again but this time seeking some advice. According to one book I've looked at, the implementation of a timeline does not have a well-known standardized technique and everyone seems to roll their own. Perhaps some of you can offer advice.

Here is the general situation, where "Time" is the game's passing time, starting at 0 when game launches:

The task: Finding the best data structures to be used such that I can throw any arbitrary value of t at the timeline entity and retrieve the active animation objects at that point in time, and finding these quickly. (Note: this is not a question about finding keyframes, but rather about finding valid animation objects on a timeline of many scheduled animations.)

I am using STL for simplicity. One idea I thought of was to have a general map of animations as my timeline, where the map's key was the start time, since maps automatically sort based on keys. Then, for any value of t I can stop iterating as soon as the key is a value higher than t since I know the animation has not started yet.

But this seems inefficient:

I would always iterate from the beginning, even for animations that have already completed. I don't want a technique that stores flags or pointers for completed animations, because I want to always be able to jump to any t and get active animations for that point in time.

Another problem, the map can only have one key, in this case the start time. To know if an animation is active, the algorithm must also peer inside the value of the map to see if its duration has been completed yet. This seems wasteful, surely there is a better way.

I think you get the path I'm going down, and I know this is an issue that everyone tackles. Any advice?

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:
Why not show progress towards achievements/badges? Achievements are everywhere now — Xbox Live, iOS Game Center, many individual games, and even in social communities with gaming elements like Stack Overflow.

A common user request of Stack Overflow is to show progress toward badges.

This has been denied by SO, as seen in this uservoice request, where Jeff Atwood made the following statement:

  this is modelled on the xbox live achievements model, and that does not show progress, either.. by design

Jeff defers to the design of Xbox Live when denying the request to show progress.  Certainly, SO is technically nothing like Xbox Live, so it can be inferred that this is a design decision, not a technical one.

I am working on a game where we have achievements and right now the intention is to show progress.  So, I have two questions:

If it's known that Xbox Live achievements "by design" do not show progress, is there a source for this?
Why is this "by design"?  In other words, in terms of game design, what reason is there to intentionally not show achievement progress?

sentences:
How to do profiling and memory pooling per system? I have been interesting in profiling and keeping a managed memory pool for each subsystem, so I could get statistic on how much memory was being used in something such as sounds or graphics. However, what would be a design that works for doing this? I was thinking of using multiple allocators and just using one per subsystem, however, that would result in global variables for my allocators (or so it would seem to me). Another approach I have seen/been suggested is to just overload new and pass in an allocator for a parameter.

I had a similar question over on stackoverflow here with a bounty, however, it seems as if perhaps I was too vague or just there is not enough people with knowledge in the subject.

sentences:
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:
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:
Intented name for my game already exists as a book title I have found that the name I have planned for my game have been already used for the title of a book.

After checking the trademark database, this is the description they have used:

"Paper Goods and Printed Matter"

Would I be infringing the trademark if I use the same exact title for my game ?

(Looks like the owner wanted to trademark the same name as a videogame in 2006, but they didn't complete the proccess: Abandoned-failure to respond or late response)

sentences:
Where can I find True Type fonts that are free for commercial use? Possible Duplicate:
  Where can I find fonts for my game?

Does anyone know of fonts that are true type and unicode that can be used in a commercial game for free?

sentences:
glViewport() Win10 doesn't draw new parts I've been steadily working through building a basic 2D tile framework in python.

I'm trying to use modern openGL so I have a simple shader and some vertex buffers and it's mostly doing what I want so far. I have a Scene with a method for centering the viewport on a Sprite:

def centre_viewport(self, x, y):
    x = -x+self.viewport_width//2
    y = y-self.viewport_height//2
    if x > 0:
        x = 0
    if y < 0:
        y = 0
    if x - self.viewport_width < -self.width:
        x = -self.width + self.viewport_width
    if y + self.viewport_height > self.height:
        y = self.height - self.viewport_height
    self.viewport_x = x
    self.viewport_y = y
    glViewport(x, y, self.viewport_width, self.viewport_height)

self.viewport_width and _height are set when a scene is added to the window, so they have the same dimensions as whatever window is created.

In my test game, the scene width and height are twice the window dimensions of 704x512. Everything works fine on my main mac development machine. On my work windows machine though, when the sprite moves and causes the scene to scroll, the previously hidden parts of the scene are not drawn:

My draw loop is very simple:

def _draw(self):
    glBindBuffer(GL_ARRAY_BUFFER, self.sprite_vertex_buffer)
    glVertexAttribPointer(self.vertices, 3, GL_FLOAT, GL_FALSE, 0, None)

    glBindBuffer(GL_ARRAY_BUFFER, self.sprite_texture_buffer)
    glVertexAttribPointer(self.tex_coords, 2, GL_FLOAT, GL_TRUE, 0, None)

    glDrawArrays(GL_TRIANGLES, 0, self.sprite_vertex_count)

    glBindBuffer(GL_ARRAY_BUFFER, self.tile_vertex_buffer)
    glVertexAttribPointer(self.vertices, 3, GL_FLOAT, GL_FALSE, 0, None)

    glBindBuffer(GL_ARRAY_BUFFER, self.tile_texture_buffer)
    glVertexAttribPointer(self.tex_coords, 2, GL_FLOAT, GL_TRUE, 0, None)

    glDrawArrays(GL_TRIANGLES, 0, self.tile_vertex_count)

and as mentioned, it works fine on my mac.

Is glViewport() the appropriate way to be doing this, and why isn't it working properly on windows?

sentences:
Moving Rect with KEYDOWN I tried to move my obstacle with the event type KEYDOWN, but it seems it is not working.
This is my code.
import pygame
import time

pygame.init()
res=(500,500)
blue_color=(0,0,255)
black_color=(0,0,0)
red_color=(255,0,0)
title=pygame.display.set_caption("Pygame Game")
screen=pygame.display.set_mode(res,pygame.RESIZABLE)

coord_rec=pygame.Rect(250,2,20,20)
coord_obs=pygame.Rect(150,450,200,20)
rectangle=pygame.draw.rect(screen,blue_color,coord_rec)
obstacle= pygame.draw.rect(screen,red_color,coord_obs)

pygame.display.flip()
launched= True
while launched:
    for event in pygame.event.get():
        if event.type== pygame.QUIT:
            launched=False
        elif event.type==pygame.KEYDOWN:
            if event.key==pygame.K_LEFT:
                    coord_obs.x+=10
            elif  event.key==pygame.K_RIGHT:
                    coord_obs.x +=-10

    while not coord_rec.colliderect(coord_obs):
              time.sleep(0.0500)
              screen.fill(black_color)
              coord_rec.y+=10
              rectangle=pygame.draw.rect(screen, blue_color, coord_rec)
              obstacle=pygame.draw.rect(screen, red_color, coord_obs)
              pygame.display.flip()

sentences:
Why does the location of my vehicle spawner change when I open a matinee? I'm doing work with InterActors and vehicle spawners in Unreal Tournament 3's editor, and have it set up like so:

(The Walkway its on is the InterActor)

However if I go in Kemsit and open the matinee that handles the InterActor, this happens:

It does look to me like the editor is moving it out of the way so I can see the InterActor (which would be very clever) because only the image of the vehicle moves, not the gizmo, nor does the vehicle spawn in that location in game.

Is this the case?

sentences:
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: What are some of the tricks engine can use to render object that have extremely high polygons efficiently? What are some of the tricks engine can use to render object that have extremely high polygons efficiently? I know one thing we do is render only the parts that the camera points at, but I am wondering if there are many more techniques used other than that one.

sentences:
2D Camera Acceleration/Lag I have a nice camera set up for my 2D xna game. Im wondering how I should make the camera have 'acceleration' or 'lag' so it smoothly follows the player, instead of 'exactly' like mine does now. Im thinking somehow I need to Lerp the values when I set CameraPosition. Heres my code

private void ScrollCamera(Viewport viewport)
    {

        float ViewMargin = .35f;

        float marginWidth = viewport.Width * ViewMargin;
        float marginLeft = cameraPosition.X + marginWidth;
        float marginRight = cameraPosition.X + viewport.Width - marginWidth;

        float TopMargin = .3f;
        float BottomMargin = .1f;
        float marginTop = cameraPosition.Y + viewport.Height * TopMargin;
        float marginBottom = cameraPosition.Y + viewport.Height - viewport.Height * BottomMargin;

        Vector2 CameraMovement;
        Vector2 maxCameraPosition;

        CameraMovement.X = 0.0f;
        if (Player.Position.X < marginLeft)
            CameraMovement.X = Player.Position.X - marginLeft;
        else if (Player.Position.X > marginRight)
            CameraMovement.X = Player.Position.X - marginRight;

        maxCameraPosition.X = 16 * Width - viewport.Width;
        cameraPosition.X = MathHelper.Clamp(cameraPosition.X + CameraMovement.X, 0.0f, maxCameraPosition.X);

        CameraMovement.Y = 0.0f;
        if (Player.Position.Y < marginTop) //above the top margin
            CameraMovement.Y = Player.Position.Y - marginTop;
        else if (Player.Position.Y > marginBottom) //below the bottom margin
            CameraMovement.Y = Player.Position.Y - marginBottom;

        maxCameraPosition.Y = 16 * Height - viewport.Height;
        cameraPosition.Y = MathHelper.Clamp(cameraPosition.Y + CameraMovement.Y, 0.0f, maxCameraPosition.Y);

    }

sentences:
How to align a hint arrow to point along a path? I am using CalculatePath and trying to use path.corners in order to give user a hint for path, that where should he lead next. I am using first two instances of Vector3 of path.corners. Lets call those vectors A and B. Let me illustrate this using figure.

Now I want to position my arrow above the midpoint of the line from B to A, and orient it so it's pointing along the direction from B to A.

When I orient the arrow with LookAt(), it doesn't point in the same direction as the path. Here is an image of my arrow prefab, showing how it's oriented:

sentences:
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:
How to find a safe path for an AI snake? I have been working on a game in which a player can compete with a snake ai to get the most apples.  The current path finding technique i use (A* Pathfinding) works fine. But I am struggling with coming with an effective way to make sure that the AI snake does not go for an objective that leads to it trapping itself. Consider that the snake can teleport and that there may be max 4 apples on the map at any given time. The decision tree I am trying to create looks somewhat like this:

If path to goal is safe : go for apple!
Else check next apple until a safe path is found or all apples are checked.
If no path to any apple is safe including the paths produced if teleportation is possible, Then find the farthest path to the tail and remain chasing the tail until a safe path to an objective becomes available. If no path to tail is found : stall until death!

The problem is that it is really hard to find a fast and efficient way to determine if a path is safe!

My question is: what is a good way to determine if a path into an enclosed area is safe given that you cannot take the same path back out of that area?

sentences:
How can I check if my object just stopped rotating this frame? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RotateRandom : MonoBehaviour
{
    private void Update()
    {
        if(Whilefun.FPEKit.FPEInteractionManagerScript.naviRotate == true)
        {
            transform.Rotate(0,0,100);
        }
        else
        {
            transform.eulerAngles = new Vector3(0, 0, 0);
        }
    }
}

I set the flag to true and false in another script.
And here I want that each time the transform stops spinning, it should revert to looking forward once.

But since I wrote transform.eulerAngles = new Vector3(0, 0, 0); in the Update method, it will try to go back to facing forward every frame. I want it to do it only once each time it stops spinning.

sentences:
How do I create a draggable object which snaps to obstacles in the way? I bring yet-another-drag-with-mouse question (I am using Unity with C#), but with a less common particular detail: the existence of obstacles in the middle of the way trough which dragging occurs (3D space, not 2D).

Let me explain. Suppose I have a plane over which I want to drag a cube called "obj" .That's easy. Here is my simple implementation for that:

void Update () {
  Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
  RaycastHit hit;
  if(Physics.Raycast(ray, out hit, 1000000))
  obj.transform.position = new Vector3(hit.point.x,0.25F,hit.point.z);
}

It works. However, suppose that I also have a few other cubes over the plane, which are the obstacles. Obviously, when the player moves "obj" over the plane, such movement should be blocked by the obstacles. And then, while colliding with the obstacles, "obj" should move only snipped to the sides of that obstacle. If mouse is moved and "obj" stops colliding with obstacles, free dragging-style movement resumes again.

To make the challenge harder, I am trying hard to achieve that without the use of RigidBody components at the obstacles (the dragged object can have it). Any ideas on what is the most efficient way of achieving that? Many thanks!

EDIT:
Commentators have brought to my attention that I should mention that objects are allowed to rotate when snapping.

EDIT 2:
Considering the difficulty of the original formulation, I changed the question allowing the use of Rigidbody components at the dragged objects. The solution just can not use Rigidbody components at the obstacles.

sentences:
Physics for movement in a topdown 2d game? I'm implementing player movement for a simple topdown game, how would I handle more "advanced" concepts in physics to make my player movement feel more natural?
Right now I have something like this:

void update(double delta) {
    dx = dy = 0;

    if (left) {
        dx -= 1;
    }
    if (right) {
        dx += 1;
    }
    if (up) {
        dy -= 1;
    }
    if (down) {
        dy += 1;
    }

    if (dx != 0 || dy != 0) {
        x += dx * delta;
        y += dy * delta;
    }
}

How would I go about implementing things like friction, acceleration, drag, and so on?

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:
Collision on the first rectangle only - Why? I've made a very simple collision detection, it works fine. However, when I decided to load in all my rectangles into a list and then give each of them collision, it only adds it to the first one. Any ideas? I've tried it with a for loop as well.

Here's the code:

    Rectangle interaction, interaction2, interaction3;

    List<Rectangle> collisionList = new List<Rectangle>();

        public GamePlayScreen()
            {

                interaction = new Rectangle(200, 200, 32, 32);
                interaction2 = new Rectangle(400, 200, 32, 32);
                interaction3 = new Rectangle(200, 400, 32, 32);

                collisionList.Add(interaction);
                collisionList.Add(interaction2);
                collisionList.Add(interaction3);

            }
    // This right here is just to show you guys that it is getting updated.
    // This is not the real update, I refrained from posting that since it might confuse
    // people.
    public override Update(GameTime gameTime)
    {
    CheckCollision();
        }

     float xx;
     float yy;

        private void

CheckCollision()
            {
                foreach (Rectangle rect in collisionList)
                {
                if (player.Sprite.Bounds.Y > rect.Top - 33 && player.Sprite.Bounds.Y < rect.Bottom && player.Sprite.Bounds.X < rect.Right && player.Sprite.Bounds.X > rect.Left - 30)
                {
                    player.Sprite.position.Y = yy;
                }
                if (player.Sprite.Bounds.Y < rect.Bottom && player.Sprite.Bounds.Y > rect.Top && player.Sprite.Bounds.X < rect.Right && player.Sprite.Bounds.X > rect.Left - 30)
                {
                    player.Sprite.position.Y = yy;
                }
                if (player.Sprite.Bounds.X > rect.Left - 30 && player.Sprite.Bounds.X < rect.Right && player.Sprite.Bounds.Y > rect.Top - 30 && player.Sprite.Bounds.Y < rect.Bottom)
                {
                    player.Sprite.position.X = xx;
                }
                else
                {
                    xx = player.Sprite.position.X;
                    yy = player.Sprite.position.Y;
                }
                }

            }

    //The Draw method

    spriteBatch.Draw(scrollDownButtonNormal, interaction, Color.White);
                spriteBatch.Draw(scrollDownButtonNormal, interaction2, Color.White);
                spriteBatch.Draw(scrollDownButtonNormal, interaction3, Color.White);

I will of course continue to work on this, and post a solution if I find one.

~Etarnalazure

UPDATE
Just checked with a boolean if the other boxes react, it changes to true. So it means it works just fine (I put the boolean in between each if loop to check if it registered any collision).

sentences: how to calculate smooth normals for 10,000,000 vertices? I am trying to calculate smooth normals with angle weight for a huge mesh with 10 million vertices. Currently, i am using map/dictionary to store the traingles connected to a vertex. That is, for each vertex,  I loop through the entire mesh to find triangles connected to a single vertex and store them in a map for that vertex. I am doing this for 10 million triangles. So, i iterate 10 million x 10 million times to calculate normals for the whole mesh. It takes around 8 seconds to create the map itself. I also have to animate this mesh dynamically calculating the normals for 10 instances. Is there a possibility to move these computations to shaders?

sentences:
Creating A Selectable Object in SDL/C++ I'm trying to create a clickable object. I wrote a pseudo code to try it. When I add a new member to object it works fine, that is when I hold the mouse cursor on the rectangle determined it returns true even it's moved around. But once the rectangle moves out of the visible area and returns back to the visible area, the if statement  return false when I hold the cursor on the rectangle determined(I'm using an int variable for camera effect.). I'm using SDL 2.0.3.

This is the loop:

multiset<IDrawable*, Drawable_compare> objects;

for(auto i = objects.begin(); i != objects.end(); ++i)
{
  if((*i)->Collision(*MouseX, *MouseY) == true)
  {
    (*i)->Update();
    cout<<"true"<<endl;
  }
  else
  {
    cout<<"false"<<endl;
  }
}

These are the base and derived classes:

class IDrawable
{
public:
  IDrawable();
  virtual ~IDrawable(void) = 0;

  virtual bool Collision(int Mouse_X, int Mouse_Y) = 0;
};

.

class Object1: public IDrawable
{
public:

  Sprite *Object1 = new Sprite(
    sdl_set->GetRenderer(),
    "data/Trees/Tree1.png",
    X_pos, Y_pos,
    100, 200,
    CamX, CamY,
    SelectionRect(0, 0, 100, 200) );

  bool Collision(int Mouse_X, int Mouse_Y)
  {
    return (Object1->MouseOver(&Mouse_X, &Mouse_Y));
  }
};

This is the sprite class:

class Sprite
{
public:

  void CSprite::Update()
  {
    SelectionRectangle.SetX(rect1.x + *CamX);
    SelectionRectangle.SetY(rect1.y + *CamY);
  }

  bool CSprite::MouseOver(int *MouseX, int *MouseY)
  {
    return !(
       ( (SelectionRectangle.GetRectangle().x + SelectionRectangle.GetRectangle().w )
          < *MouseX )
    || ( *MouseX < SelectionRectangle.GetRectangle().x )
    || ( ( SelectionRectangle.GetRectangle().y + SelectionRectangle.GetRectangle().h )
          < *MouseY )
    || ( *MouseY < SelectionRectangle.GetRectangle().y) );
  }
};

This is the class to determine a selectable area:

class SelectionRect
{
public:

  SelectionRect(int x, int y, int w, int h);
  ~SelectionRect(void);

  SDL_Rect GetRectangle() { return SelectRect; }

  void SetX(int x) { SelectRect.x = x + OffsetX; }
  void SetY(int y) { SelectRect.y = y + OffsetY; }

  void SelectionRect::SetRectangle(int x, int y, int w, int h);

};

What might be causing this? How can I correct my code?

Thanks.

Edit : I did some trial and error work and found out that when I use the alternative MouseOver() function no problem occurs. What do you think the reason is?

My Draw() function for objects:

void CSprite::Draw()
{
    Camera1.x = rect1.x + *CamX;
    Camera1.y = rect1.y + *CamY;

    SDL_RenderCopy(renderer,image, NULL, &Camera1);

}

Alternative MouseOver function:

bool CSprite::MouseOver(int *MouseX, int *MouseY)
{
        cout<<"Called"<<endl;

        return !(Camera1.x + Camera1.w < *MouseX || *MouseX < Camera1.x || Camera1.y + Camera1.h < *MouseY || *MouseY < Camera1.y);
    }

sentences:
Exporting .FBX model into XNA - unorthogonal bones I create a butterfly model in 3ds max with some basic animation, however trying to export it to .FBX format I get the following exception.. any idea how i can transform the wings to be orthogonal..

One or more objects in the scene has local axes that are not perpendicular to each other (non-orthogonal).
The FBX plug-in only supports orthogonal (or perpendicular) axes and will not correctly import or export any transformations that involve non-perpendicular local axes.
This can create an inaccurate appearance with the affected objects:
    -Right.Wing

I have attached a picture for reference . . .

sentences:
Why do games have different ports for different maps? A little old example for that would be Metin2, this is the only game I know which have that, but there may be more.
In Metin2 there are maps which are accessable through other ports.
I'm not a network specialist, but I think then it is needed to connect to an other port on an map change.

So would it not be possible todo all that on one port? Are there any benefits from that?

Could it be that there is a limit on port connections on a server, that this would be something for loadbalancing?

sentences:
What i'm missing in this multiplayer Unity / photon code? i'm having some troubles in my first, simple, multiplayer racing game, using Photon and Unity.
Following classic photon tutorial i've written the code below, but, it won't work properly.
In particular there are any smooth movement and "other" player car continue to appear and disapper... maybe i could post a video.

void Update() {
if (gsAppSettings.gameType == Enumerators.GameType.MultiPlayer) {
            if (pv.isMine) {    //pv is PhotonView
                GetPlayerInput ();
                WeaponsManagement ();
            } else {
                SyncMovement ();
            }
        }
        else if (gsAppSettings.gameType == Enumerators.GameType.SinglePlayer) {
            GetPlayerInput ();
            WeaponsManagement ();
        }
}
void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
    {
        if (stream.isWriting) {
            if (photonView.isMine) {
                stream.SendNext (transform.position);
                stream.SendNext (transform.rotation);
                stream.SendNext (rb.velocity);
            }
        } else {
            correctPlayerPos = (Vector3)stream.ReceiveNext();
            correctPlayerRot = (Quaternion)stream.ReceiveNext();
            currentVelocity = (Vector3)stream.ReceiveNext();
            updateTime = Time.time;
        }
    }

private void SyncMovement() {
        Vector3 projectedPosition = this.correctPlayerPos + currentVelocity * (Time.time - updateTime);
        transform.position = Vector3.Lerp (transform.position, projectedPosition, Time.deltaTime * 4);
        transform.rotation = Quaternion.Lerp (transform.rotation, this.correctPlayerRot, Time.deltaTime * 4);
    }

EDIT: This is video. As you can see, the low car is "flipping" up and down
https://www.youtube.com/watch?v=QKpYl7C5rl0&feature=youtu.be

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:
Rendering models in isometric view How to setup the rendering and camera for isometric gameworld projection? And specifically how do i get the images exactly the right size?

What angles to use to get the exact 2/1 isomtric view?
Methods to set the camera on the right position?
Options to set like anti alias off.

I have tried many things, 45, 30, 35.264 degree angles. What i do is set the angle of the camera, then place the camera in front of the model then use dolly/fov/lens settings to get the left and right edge of the model lined up with the save frame. Then adjust camera height so the bottom lines up with the bottom of the save frame. But i keep getting jagged edges and not the isometric style 2 width one height.

sentences:
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:
Developing an interactive book for Windows-Runtime My three year old loves playing with the interactive books on our iPad, and I love playing with code and I love my Surface RT...

So I thought I'd try and make a basic animated book using WinRT, I've spent some time reading about animations
(granted the book isn't WinRT based), and thought I'd try and use the Storyboard approach rather than rolling any kind
of bespoke animation framework.

That was until I saw the Faresee Physics Engine, and the Physics XAML Helper.

I've played around with some of the more basic examples, and it seems pretty good - very easy in-fact.

My issue is when I start thinking about stringing together animations that can react to input,
the Farsee and Physics XAML Helper blows my mind a little.

As a proof of concept I was thinking about getting a character to walk from a path (in the top right),
and while moving closer (getting larger) walk to the front at the center.

Then, based on some kind of decision, via an input, walk either back to the right, or up to the left.
Both are back into the distance (getting smaller) as if walking away.

The character should have basic humoid movement, athough slightly cartoon-like - swinging arms, moving head and legs.
Also, it would be nice to have the ability for the character model to swap images when it walks back up the path.

My question (finally!), is do you think that it's better to use the built in Storyboarding features of WinRT, with it's
animations - primarily using easing and descrete key frames to create each animation 'scene'. Or, use something like
Farsee and the Physics XAML Helper to create the scene using real word objects and physics?

Are there any examples, samples, tutorials etc of creating anything similar?

Thanks,
Kieron

sentences:
Camera rotation around point, but without centering Let's say i have the following:

Point somewhere in space
Camera with position and orientation (up, right, forward)

I want to rotate camera around the point, but also keep this point in same place on screen. So, if point was on (32, 32) on window, after rotation i want it to still be on (32, 32).

I've seen How can I orbit a camera about it's target point? , and it was somewhat helpful. I needed code to rotate point around arbitrary axis (camera's up and right), so i used this resource.

Problem is, i got something like numerical errors and my camera started to wander weirdly when rotating around camera's both up and right (it seems fine when i rotate only around one of them).

I tested my implementation with code:

Matrix m1=MatrixRotate(Vector(-1, -1, 1),  33);
Matrix m2=MatrixRotate(Vector(-1, -1, 1), -33);
Vector a=Vector(-1, -1, -1);
Vector c=a;

c=m1*c;
c=m2*c;
printf("%f %f %f %f\n", c.x, c.y, c.z, c.w);

And got:

-1.028036 -0.960396 -1.124331 0.000000

It worked fine when rotation axis was something 'normal' like (1, 0, 0) or (0, 0, -1).

So, how else can i rotate camera around point, while keeping said point in same point on screen?

sentences:
Performance problems with scrolling html5 canvas for large tile-based game I try programming a splix.io clone as an electron app and do the visualization via the html5 canvas. The movement across the tiles should look fluent like the original, so I target 60 frames a second. The programm worked fine till I tried to replace the tiles created through fillRectangle() with svg images using drawImage(). This resulted in a huge performance drop, which I now try to fix. To mention here is that, like splix.io, I have a quite large playfield with a targeted size of 500x500 tiles and a fullscreen viewport, so basically the canvas has to draw the whole screen each frame.

Known performance improvements, that I implemented are:

Separating the logic calculations and "rendering" into their own
windows, separated from the main process.
Only drawing the area visible to the player
Foreach tileType hold a offscreen canvas, so that I can copy the
ImageData to the onscreen canvas.
Draw tiles and the players on separate canvases.

A drawing loop with requestAnimationFrame() instead of setTimeout() seemed to be impractical because the ultimate goal is to let AIs, which will run in their own child-process, play against each other. Therefore I can't rely on requestAnimationFrame which throttles performance when the window loses focus or is minimzed.

What further performance improvements can you recommend? Is the scale of my game maybe too large for the canvas and would a switch to OpenFL / WebGL may be the better solution?

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:
Send post request with content type I used a php server to communicate with my unity application . I want to send post data with content type so that my php server can use the approriate variable for the content type , for example if i send post request with content type "file" , my php server can use $_FILES[][] instead of $_POST[], and i am a beginner and i'm too skeptical to use $_POST[] to handle upload request from unity application to server .
My best guess is that i must use something from WWWForm to achieve it , but in my opinion the documentation isn't friendly enough for beginner like me . Can someone here lend me a hand to achieve this ? (sending post request with content type)
Oh , also , i'm sorry for too much using php in my example , below is how i achieve it in html, i can achieve it in html by using something similar to this code :
(this html send POST request to upload a pictures with "file" as it content type)

<form method="POST" enctype="multipart/form-data">
<label>
Browse Image
<input type="file" name="pictures" style="display:none">
</label><br>
<button name="upload">
Upload Now
</button>
</form>

Please forgive me if my english is too bad , thank you .

sentences:
Max Row and Col for Animating Sprite in Andengine I want to animate a Sprite in Andengine , I have used the following

this.mSnapdragonTextureRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(this.mBitmapTextureAtlas, this,"arrow.png", 10, 10);

As show above in code its array is 10x10 that means I have 100 images to be animated, here is the image (I had individual image and joined it online so I created image below):

My issue is if I place this code and image it show black patch instead of animated image, i hv tried with 2x3, 4x2 animated sprite that is > working fine . Is my issue because of 10x10 ? what is the max row and col I can place to animate a Sprite in Above Code

Here is my output :

sentences: 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:
Is the TCP protocol good enough for real-time multiplayer games? Back in the day, TCP connections over dialup/ISDN/slow broadband resulted in choppy, laggy games because a single dropped packet resulted in a resync. That meant a lot of game developers had to implement their own reliability layer on top of UDP, or they used UDP for messages that could be dropped or received out of order, and used a parallel TCP connection for information that must be reliable.

Given the average user has faster network connections now, can a real time game such as an FPS give good performance over a TCP connection?

sentences:
How can I sync billiard balls in network? I'm developing a billiard game my problem is I don't know how can I sync balls in network
I use forge for networking but feel free to answer photon or unet because I know them.

What I tried
1.sending position and rotation of each ball in network
2.sending force direction and Intensity inside network

networkObject.SendRpc(RPC_SHOOT,Receivers.AllBuffered,force);

    public override void Shoot(RpcArgs args)
    {
       Vector3 Force = args.GetNext<Vector3>();
       GetComponent<Rigidbody>().AddForce(Force);
    }

I don't know why but when I send force direction and Intensity in network sometimes Physics is different!
I asked this question in forge forum and they tell me:

It's non-deterministic It's how most physics simulations work Because
of floating point inaccuracies and different CPU architectures and a
whole load of other factors That's how PhysX works Well PhysX is
technically deterministic for the same inputs But all inputs have to
be identical

source is available:
https://github.com/smkplus/BilliardNetwork

sentences:
Unity: OnTriggerEnter2D does not get called when using Raycast In a previous post I talked about creating wires (using Bézier curve) using LineRenderer. I am using a PolygonCollider2D to wrap the wire (see below):

GameObject wire = new GameObject ();
LineRenderer lineRenderer = wire.AddComponent<LineRenderer> ();
PolygonCollider2D wireCollider = wire.AddComponent<PolygonCollider2D> ();

After drawing the curve and attaching the collider (as described in previous post), I added a new component to my gameObject (a WireController):

WireController wireController = wire.AddComponent<WireController> ();

The WireController currently has only one method:

void OnTriggerEnter2D(Collider2D other) {
    Debug.Log ("I'm hit!");
}

I use a Physics2D.Raycast to check if my mouse pointer is at any point interacting with the wire:

void CastRay() {
    Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
    RaycastHit2D hit = Physics2D.Raycast (ray.origin, ray.direction, 100);

    if (hit) {
        Debug.Log (hit.collider.gameObject.name);
    }
}

If I call CastRay() inside a Update() loop, if (hit) returns true (if the mouse pointer is over the gameObject, in this case, the wire), but the OnTriggerEnter2D method never gets called.

A few observations:

collider.isTrigger = true;
The WireController is attached to the newly created gameObject (it's visible in the Unity editor at runtime)

Any help is much appreciated!

sentences:
LWJGL - How to draw text on screen After some months on libGDX, I chose to make a little java game library based on LWJGL.
I have already tried to do it, but got stuck on this same problem: how render text on screen.
The first time, I used Sick, but it was deprecated... how do I should do?
This time I tried this code, of couse it doesn't work (I read it on StackOverflow):
public class Starter {

private String GAME_NAME;
public String VERSION;
private int WIDTH, HEIGHT;
private static long window;

public Starter(@NotNull JJGLInfo info){
    Objects.requireNonNull(info);
    GAME_NAME = info.getGAME_NAME();
    VERSION = info.getGAME_VERSION();
    WIDTH = info.getWidth();
    HEIGHT = info.getHeight();
}

public void run(){

   System.out.println("Hello player by JJGL\nJJGL Version: " + VERSION + "\nLWJGL Version: " + Version.getVersion());

   this.init();
   this.loop();

   this.terminate();
}

private void terminate() {
    glfwFreeCallbacks(this.window);
    glfwDestroyWindow(this.window);

    glfwTerminate();
    glfwSetErrorCallback(null).free();
}

ByteBuffer pixels = this.getByteBufferFromString();
private void loop() {

    GL.createCapabilities();
    glClearColor(1f, 1f, 0f, 0f);

    while (!glfwWindowShouldClose(this.window)){
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        glfwSwapBuffers(this.window);

        ByteBuffer pixels = this.getByteBufferFromString();
        glEnable(GL_TEXTURE_2D);
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, 1000, 200, 5, GL_BLUE, GL_UNSIGNED_BYTE, pixels);
        glEnd();

        if(Input.isKeyPressed(GLFW_KEY_A))
            System.out.println(1);

        glfwPollEvents();
    }
}

private ByteBuffer getByteBufferFromString(){

    String text = "ABCD";
    int s = 256; //Take whatever size suits you.
    BufferedImage b = new BufferedImage(s, s, BufferedImage.TYPE_4BYTE_ABGR);
    Graphics2D g = b.createGraphics();
    g.drawString(text, 0, 0);

    int co = b.getColorModel().getNumComponents();

    byte[] data = new byte[co * s * s];
    b.getRaster().getDataElements(0, 0, s, s, data);

    ByteBuffer pixels = BufferUtils.createByteBuffer(data.length);
    pixels.put(data);
    pixels.rewind();
    return pixels;
}

/**
 * Initialize window
 */
private void init() {
    //Set Callback, when library get an error, it will be print
    GLFWErrorCallback.createPrint(System.err).set();

    //Let's initialize GLFW. Without this call, most of functions won't work
    if(!glfwInit()){
        throw new JJGLInitException("Could not initialize GLFW");
    }

    glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);   //Make window hidden
    glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE);  //Make window resizeable

    window = this.createWindow();

    glfwMakeContextCurrent(this.window);

    glfwShowWindow(this.window);
}

/**
 * Creating window. If you have passed -1 at one side,
 * it will be maximize (-1, 30 only width will be maximized)
 * @return
 */
private long createWindow() {
    //Getting info about screen
    GLFWVidMode glfwVidMode = glfwGetVideoMode(glfwGetPrimaryMonitor());

    if(this.WIDTH <= -1)
        this.WIDTH = glfwVidMode.width();

    if(this.HEIGHT <= -1)
        this.HEIGHT = glfwVidMode.width();

    //Creating window
    return  glfwCreateWindow(this.WIDTH, this.HEIGHT, this.GAME_NAME, MemoryUtil.NULL, MemoryUtil.NULL);
}

public static long getWindow() { return window; }
}

sentences:
Why can't I reference "targetVelocity" variable to this script? Recently, I implemented a shooting system for my 2D game but this system has a problem. The problem is that when the player is facing left, the bullets are still being shoot to the right. For fixing this, I need to access a Vector2 named targetVelocity to check whether the player is facing right or not. targetVelocity  is defined in another script called PhysicsObject that is specifically for the player physics and the player script inherits from it (the variable was protected but I changed it to public). I just don't know how to reference this in my Bullet script and I don't want to add the player script to the bullet.  Also, I've read the past questions and answers that were similar to this but I haven't found the answer yet because this is a different case. Thanks in advance.
This is my Bullet script and I want to somehow reference targetVelocity.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Bullet : MonoBehaviour
{
    [SerializeField] float speed;
    [SerializeField] float lifeTime;

    public GameObject destroyEffect;

    private void Start()
    {
        Invoke("DestroyBullet", lifeTime);
    }

    private void Update()
    {
        transform.Translate(Vector2.right * speed * Time.deltaTime);
    }

    void DestroyBullet()
    {
        Instantiate(destroyEffect, transform.position, Quaternion.identity);
        Destroy(gameObject);
    }

}

Here is the weapon script.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Weapon : MonoBehaviour
{
    public GameObject bullet;
    public Transform firePoint;

    private float timeBtwShots;
    public float startTimeBtwShots;

    private void Update()
    {
        if (timeBtwShots <= 0)
        {
            if (Input.GetButton("Fire1"))
            {
                Instantiate(bullet, firePoint.position, transform.rotation);
                timeBtwShots = startTimeBtwShots;
            }
        }
        else
        {
            timeBtwShots -= Time.deltaTime;
        }
    }
}

This is the player script.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NewPlayer : PhysicsObject
{
    [Header("Attributes")]
    [SerializeField] private float jumpPower = 10;
    [SerializeField] private float maxSpeed = 1;

    //Singleton instantation
    private static NewPlayer instance;
    public static NewPlayer Instance
    {
        get
        {
            if (instance == null) instance = GameObject.FindObjectOfType<NewPlayer>();
            return instance;
        }
    }

    // Update is called once per frame
    void Update()
    {
        targetVelocity = new Vector2(Input.GetAxis("Horizontal") * maxSpeed, 0);
        //If the player presses "Jump" and we're grounded, set the velocity to a jump power value
        if (Input.GetButtonDown("Jump") && grounded)
        {
            velocity.y = jumpPower;
        }
        //Flip the player's localScale.x if the move speed is greater than .01 or less than -.01
        if (targetVelocity.x < -.01)
        {
            transform.localScale = new Vector2(-1, 1);
        }
        else if (targetVelocity.x > .01)
        {
            transform.localScale = new Vector2(1, 1);
        }
}
}

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:
Transfer Codes between OS I'm making a mobile game and had the idea of using transfer codes for taking one account to another device.

Lately, I've seen this function being used in a lot of mobile games, you go to the game settings, issue a transfer code, input it in the new device and the game account is transferred. However it's not clear for me as to how this works? since many games I have seen with this function can't transfer premium currency between different OS, for example. Or some of them, after transferring the game disable the old device from transferring back the same account before certain time has passed.

I have been looking for some information about this system but haven't been able to find out anything. So I was hoping if anyone could point me into the right direction, specially in the point about currency transfer between different OS.

Edit: I'll try to be a little more clear about the issue. I want to have a feature where the user cas generate a code to transfer his account or progress to another device, that's it.

The other question I had was because this kind of systems do exist actually. Mostly on games developed in Asia. They allow you to transfer your progress this way to any other device BUT if you do this from one OS to another normally you can keep your progress intact but not the in-game currency. So I was wondering why

sentences:
naming conventions in game code / vocabulary I'm just starting out as a game developer, and I'm finding some difficulty when naming classes.

I usually call the class that handles everything World, Map, or Grid. Then there's the names, inside.

For example, I'm making a Frogger clone, and I have a class for everything that moves on screen (I try to use MVC and I'm talking about the model here - I have Sprite classes in the view), and I named it Object for lack of a better name. Then there's a subclass from Object which I named Frog (though I could name it Player)  and another one for the things controlled by the computer, which I don't know what to call (it could be Enemy or Obstacle or something appropriate for cars and trucks). This class also includes the turtles, which are more like helpful objects, yet are not powerups.

How should I manage my naming conventions?

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:
How do I prevent falling tiles from bouncing on each other in my match 3 game? I am working on a match 3 game in Unity. The tiles have a RigidBody2D in dynamic mode and a BoxCollider2D. When a match occurs and the tiles are removed, the tiles above (including spawned replacement tiles) fall until they land on another tile or the tile catcher at the bottom of the board. There is a routine which checks when everything is settled (all tile rigidbodies are asleep) and then processes any new matches. However, the tiles push each other down on impact, causing a rebound and a very slow process of "settling" to their final position. The physics material for the tiles has no bounciness, so I believe this is being caused by the cumulative force of the tiles landing on each other in the physics simulation.

What I'm hoping to do is have the tiles drop the way they do (the gravity simulation is just right!) but essentially stop when they collide with another tile (i.e. not transfer any force at the point of collision). This way, they shouldn't rebound visually and also should sleep more rapidly, so matches from falling can process more immediately.

So far, the suggestions I've seen are:

Set the velocity to 0. This doesn't work, and I assume it's because there is still being force applied.
Detect the tile collision and set the tile to kinematic, then set it back to dynamic. I haven't been able to get this to work, as they won't turn back to dynamic. I even tried to disable the colliders until they turn back in case the collision detection keeps happening and is just overwriting it too rapidly. At any rate, this feels like a dead end.
Scrap the rigidbodies and essentially write my own, scripted gravity simulation. I'm simply hoping to avoid this because the rest of the simulation is working great.
Create a kinematic rigidbody on a child object, set the dynamic parent and kinematic child to ignore collisions with each other, make the kinematic collider slightly (0.1) larger so it collides first. I gather the idea here is to have the physics simulation pull down the dynamic body, while the kinematic child will stop on collision. At any rate, this also did not work, and also sounds like a bad idea.

I've considered trying to calculate the impact force and apply an equal opposing force, but I haven't figured that out yet, and I imagine at that point I should just write my own gravity simulation, per above.

I've recorded a video for visual reference on the "bounciness": https://youtu.be/aSCEJX4nzoI

sentences:
How do I convert screen coordinates to isometric tile map coordinates in libGDX using matrices I know this has been asked many times but my question doesn't quite fit the others. I have an IsometricTiledMap and I need to get the tile under a set of screen X and Y coordinates. Here is a picture of my game:

I need to get the tile that the player is standing on. I need to convert screen coordinates to isometric tile coordinates and the way that seemed the easiest was by using a matrix as described here: http://www.alcove-games.com/advanced-tutorials/isometric-tile-picking/#comment-56390

Unfortunately I have no idea how to change that code to fit a 128x64 tile instead of a 1.0x.5 tile. Here is my code

isoTransform = new Matrix4();
isoTransform.idt();
isoTransform.translate(0.0f, 32f, 0.0f);
isoTransform.scale((float) (Math.sqrt(2.0) / 2.0), (float) (Math.sqrt(2.0) / 4.0), 1.0f);
isoTransform.rotate(0.0f, 0.0f, 1.0f, -45.0f);

invIsotransform = new Matrix4(isoTransform.inv());

//touch vector
touch = new Vector3();

@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
    touch.set(screenX, screenY, 0);
    touch = gameCamera.unproject(touch);
    touch.mul(invIsotransform);

    pickedTileX = (int)touch.x / 64;
    pickedTileY = (int)touch.y / 32;

    debug(touch.x + " " +  touch.y);
    debug(pickedTileX + " " + pickedTileY);

    return false;
}

I think the problem is in this line isoTransform.scale((float) (Math.sqrt(2.0) / 2.0), (float) (Math.sqrt(2.0) / 4.0), 1.0f); but I'm not sure what to change.

sentences:
Subdivision of a triangle in HLSL How can I subdivide a triangle more than once. I can not use recursion as directx 11 hlsl will not allow it. Are there any links to a HLSL code. This has to be done in the geometry shader as my book says.

my code that will subdivide once is:

  void Subdivide(VertexOut inVerts[3], out VertexOut outVerts[6])
{
    //          1
    //          *
    //         / \
    //        /   \
    //     m0*-----*m1
    //      / \   / \
    //     /   \ /   \
    //    *-----*-----*
    //   0     m2     2

    VertexOut m[3];

inVerts[0].PosL = normalize(inVerts[0].PosL);
inVerts[1].PosL = normalize(inVerts[1].PosL);
inVerts[2].PosL = normalize(inVerts[2].PosL);
// compute edge midpoints
m[0].PosL = 0.5f * (inVerts[0].PosL + inVerts[1].PosL);
m[1].PosL = 0.5f * (inVerts[1].PosL + inVerts[2].PosL);
m[2].PosL = 0.5f * (inVerts[2].PosL + inVerts[0].PosL);
m[0].PosL = normalize(m[0].PosL);
m[1].PosL = normalize(m[1].PosL);
m[2].PosL = normalize(m[2].PosL);

    // derive normals
    m[0].NormalL = m[0].PosL;
    m[1].NormalL = m[1].PosL;
    m[2].NormalL = m[2].PosL;

    // interpolate texture coordinates
    m[0].Tex = 0.5f * (inVerts[0].Tex + inVerts[1].Tex);
    m[1].Tex = 0.5f * (inVerts[1].Tex + inVerts[2].Tex);
    m[2].Tex = 0.5f * (inVerts[2].Tex + inVerts[0].Tex);

    outVerts[0] = inVerts[0];
    outVerts[1] = m[0];
    outVerts[2] = m[2];
    outVerts[3] = m[1];
    outVerts[4] = inVerts[2];
    outVerts[5] = inVerts[1];
}

void OutputSubdivision(VertexOut v[6], inout TriangleStream<GeoOut> stream)
{
    GeoOut gout[6];

    [unroll]
    for(int i = 0; i < 6; ++i)
    {
        // Transform to World Space
        gout[i].PosW = mul(float4(v[i].PosL, 1.0f), gWorld).xyz;
        gout[i].NormalW = mul(v[i].NormalL, (float3x3)gWorldInvTranspose);

        // Transform to homogeneous clip space
        gout[i].PosH = mul(float4(v[i].PosL, 1.0f), gWorldViewProj);

        gout[i].Tex = v[i].Tex;
    }

    //          1
    //          *
    //         / \
    //        /   \
    //     m0*-----*m1
    //      / \   / \
    //     /   \ /   \
    //    *-----*-----*
    //   0     m2     2

    // We can draw the subdivision in two strips:
    // strip 1: bottom three triangles
    // strip 2: top triangle

    [unroll]
    for(int j = 0; j < 5; ++j)
    {
        stream.Append(gout[j]);
    }
    stream.RestartStrip();

    stream.Append(gout[1]);
    stream.Append(gout[5]);
    stream.Append(gout[3]);

    }

[maxvertexcount(8)]
void GS(triangle VertexOut gin[3], inout TriangleStream<GeoOut> stream)
{
    VertexOut v[6];

    Subdivide(gin, v);

    OutputSubdivision(v, stream);
}

How can I subdivide twice or even three or four times.
thx

sentences:
Unity Android: Truecolor texture performance hit and alternatives for truecolor After integrating the graphics assets to my application, I noticed that when the textures are compressed they look very bad compared to truecolor. This happens to all the textures and it did not seem to help changing the texture type to GUI nor did it help to switch the 32-bit display buffering on.

Does using truecolor textures make the application much heavier to run? Or does it just increase the size of the .APK? Are there alternatives to getting a good texture quality and a smaller texture size instead of using truecolor?

EDIT:
I did some experiments with the dithering. I created a textures in GIMP 2.8, one which was RGB and one which was indexed with 255 colours and Floyd-Steinberg dithering with reduced colour bleeding. In the Windows Explorer this looked promising, the image quality had hardly been reduced but the size was halved.

But when they were imported to Unity, they were exactly the same size. And trying out different formats, there was not much noticeable difference between the image quality. Although the banding was a little bit less pronounced but still clearly seen.

EDIT 2:
I played around with the importing settings. And the only conclusion I can come up with is: Don't use alpha! Without the alpha channel, there is no banding with the ETC-compression which is supported by all OpenGL ES 2.0 GPUs.

To have an alpha channel and no banding. I had to go all the way to RGBA 32-bit, which increased the texture file size to 64Kb compared to the no alpha channel ETC's 8Kb.

Here again: not much difference between the GIMP dithered and the RGB versions. So conclusion with this: Dithering in GIMP did next to nothing.

sentences:
Compiling Quake 3 in Snow Leopard First of all I have Xcode 4 installed in Mac OS X Snow Leopard 10.6.8. I have downloaded the Quake 3 source code 1.32b release but I can't open the Xcode project that is inside the /macosx folder since it is in the old .pbproj format and therefore it throws an "incompatible version" error. Has anyone been able to convert this to a Xcode format or is there any other way to compile the source code in Mac OS X Snow Leopard?

Thanks

sentences:
why am I being unable to access public array of a class inside other class? I know this question has been asked before but my case is different(or i could not gather any kind of help from those)

I am facing "NullReferenceException: Object reference not set to an instance of an object" Error

in Class 1 I tried to make an array of a Class2 type and that class2 had two arrays of type "int"

but when i am filling up values in those arrays of Class2, by making object of Class2. it seems to be null.

well right now its not a problem but when i will use those value in other place it will create one. so i would really like to solve this right now.

PS:-
At first I used to fill those value by inspector plane in unity.
but now i want to fill them up by programatically at runtime

Class1 Code

public class LevelStructure : MonoBehaviour
{
public static LevelStructure instance;

public int numberOfColumns=5;
public int numberOfRows=5;
internal ColumnStructure[] columnStructures;

int[] tilemap = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
int[] jellymap = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
void Awake()
{
    instance = this;
    //numberOfColumns = transform.GetChildCount();
    //columnStructures = transform.GetComponentsInChildren<ColumnStructure>();

    // I added the below code to put values at runtime programatically.
    // before that i used to put those from unity inspector plane.
    for (int i = 0; i<numberOfColumns; i++)
    {

        ColumnStructure cs = new ColumnStructure();

        for(int j = 0; j<numberOfRows; j++)
        {

            if(cs==null)
            {
                Debug.Log("CS is null");

            }
            else
            {
                Debug.Log("CS is not null "+j);
                cs.itemAvailability[j] = (int)tilemap[i*numberOfColumns+j]; //This line is getting null reference exception
                cs.jelly[j] = (int)jellymap[i*numberOfColumns+j];

            }

        }
        columnStructures[i] = cs;

    }

}

}

Class2 Code :-

public class ColumnStructure
{

public int[] itemAvailability;
public int[] jelly;

}

Console Log :-

CS is not null 0
UnityEngine.Debug:Log(Object)
LevelStructure:Awake() (at Assets/CM3/Scripts/Game Scripts/LevelStructure.cs:35)

NullReferenceException: Object reference not set to an instance of an object
LevelStructure.Awake () (at Assets/CM3/Scripts/Game Scripts/LevelStructure.cs:36)

ANSWER :-

Thanks to Petr Abdulin, I modified Class2 Code like this.

public class ColumnStructure
{

public int[] itemAvailability = {1,1,1,1,1,1,1,1};
public int[] jelly = {1,1,1,1,1,1,1,1};
void Awake()
{

}
}

sentences:
Optimal data size for a 3G client-server game? I'm currently working on an iOS turn-based client-server game and I am concerned over later performance issues.

How much data per message is too big? I am planning to use JSON to transfer data (and, if possible, gzip it for more compression) and try to send as little as possible to make it work, but is there a figure I should keep in mind so that I do not exceed and is there a best-practice way of compressing this data?

On a side note, will this prevent me or affect whether I will use secure connections like SSL?

sentences:
Which features belong to the engine and which ones to a game? Right now, I find myself implementing and testing new features for my 2D game engine, by directly coding them into the engine. Simultaneously, I have a showcase game with scripting support, which should call the engines functions. I attach e.g. a fixed tile movement to the Entity class in the engine, rather than scripting this specifically for the game. This is definitely breaking the idea of a general engine used for more than one game.

Are there any best practices to keep focusing on the correct implementation in the right parts (that is engine vs. game)?

sentences:
What is "Rapid" in reference to the MSN Games GDK? I have herd a little talk about the MSN Games GDK lately, and what wondering what Rapid was.

It sounds like some sort of testing environment, is this true? How can I get access to it? Or find out more about it?

sentences:
Get a camera's frame-buffer in Unity Is there a way to "record" the display of a camera instead of rendering it on screen?

For example, if I want to stream a camera's frame block to an external application.

sentences:
How should I handle functions, where two classes have equal use? I'm working on a few features for a strategy engine I'm making. I'm trying to figure out the best spots to separate the components, as either option will provide the same amount of coupling, with the same effectiveness.

For example, all players have a Damage component, a Player component, and a HealthBar component:

abstract class Damage
{
    protected abstract void sendDamage(Player targetPlayer, int rawDamage);
    public abstract int calculateRawDamage(Attack attackUsed);
    public abstract void receiveDamage(int rawDamage);
}

class Player
{
    List<Armor> equippedArmor;
    List<Buffs> currentBuffs;
    public Damage damageComponent;
    public List<HealthBars> healthBarComponents;
}

abstract class HealthBar //can be inherited for mana or health bar
{
    protected Color color;
    public float percent; //0.0 - 1.0
}

When a player receives damage, I need to show a red number floating up from their head, indicating the amount of damage. This can either be implemented in HealthBar, or in Damage. It fits damage better, but then healing works in the same way, and wouldn't be called from damage. I could abstract damage into something like ChangeValue, which would change mana, health, etc in any direction, or I could use the abstract HealthBar class to show this number being changed.

I'm trying to think of a general rule that would solve this and other problems, where two classes use the same function equally. This is an oversimplified version of my classes, but it makes more sense this way.

How should I handle functions, where two classes have equal use?

sentences: How to swallow touches on CCMenu while sliding? I'm creating a sliding menu for my game something like angry birds level selection but I'm having problem with buttons. If I accidentally touch any of the buttons while swiping the level starts to load.

sentences:
What's the best way to create animations when doing Android development? I'm trying to create my first Android game and I'm currently trying to figure out (with someone that will do the drawings and another programmer) what the best way to create animation is. (Animations such as a character moving, etc.)

At first, the designer said that she could draw objects/characters and animate them with flash so she didn't have to draw every single frame of an action. The other programmer and I don't know Flash too much so I suggested extracting all the images from the Flash animation and making them appear one after the other when the animation is to start.

He said that would end up taking too much resource on the CPU and I tend to agree, but I don't really see how we're supposed to make smooth animations without it being too hard on the hardware and, if possible, not have the designer draw every single frame on Adobe Illustrator.

Can an experienced Android game developper help me balance this out so we can move on to other parts of the game as I have no idea what the best way to create animations is.

sentences:
HLSL - Shore fading in a water shader I am modifying an old water shader for the game "MTA San Andreas" (the multiplayer modification). MTA uses HLSL and comes with some builtin predefined variables and functions. The water shader itself is already modified by me, but now I want to add shore fading to it. Objects slightly below water surface should be visible, but objects deeper in the water should be completely invisible and that effect should be configurable. I found a water shader that has shore fading included, but it was covered within very complex other things in a very large file. I managed to extract most of the necessary information (i think) but I get an error message in the game:
Invalid PS 3_0 input semantic "POSITION" in water.fx 139,23
I know that this line 138 has no errors and the only reason why the game throws this error is actually line 268... Debugging HLSL is a pain, horrible language. And there may be much more wrong stuff. This is the water shader:

https://pastebin.com/VDFxS7RX

I started my modifications in line 268, where objdepth seems to be "wrong" and causes the compile error:

float objdepth = input.position.z/input.position.w;
float nonlinearobjdepth = objdepth;
objdepth = 1.0/max(1.0-objdepth, 0.000000001);
float planardepth = tex2D(SamplerDepth, input.textureCoords.xy).r;
float depth = tex2D(SamplerDepth, input.textureCoords.xy).r;
if (nonlinearobjdepth>depth)
{
    depth = planardepth;
}

float scenedepth = depth;
      planardepth = 1.0/max(1.0-planardepth,0.000000001);
      depth = 1.0/max(1.0-depth,0.000000001);
float depthfact = (depth-objdepth)*WaterParameters1.z;
      depthfact = depthfact*WaterParameters1.x;
      depthfact = depthfact/(depthfact*0.50+1.0);
if (scenedepth>0.99999) depthfact = 1.0;
float backside = saturate(WaterParameters1.w*10.0);
      depthfact*= 1.0-backside;
float shorefade = (planardepth-objdepth);
      shorefade = shorefade*WaterParameters1.x;
      shorefade = saturate(13.40*shorefade*1000.0 - 0.05);
      depthfact*= shorefade;
finalColor.a *= shorefade;

return finalColor;

sentences:
Editor-Assignable function pointer in UE4 C++? So I have a TriggerBox that I'm using as a pressure pad, and I want to be able to attach objects to it that, when the TriggerBox is activated, will have specific functions called. Similar to unity's UI buttons, where you can assign a function to be called when the button is clicked.

I am working as the sole programmer, and the rest of my team are designers. They need to be able to assign the object's function to the TriggerBox from within the editor.

I have attempted to use C++'s function pointers, but I have not been able to find a way to make them assignable in the editor.

Is there a solution to this? If not, any suggestions on better ways to do this?

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:
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:
Phone complains that identical GLSL struct definition differs in vert/frag programs When I provide the following struct definition in linked frag and vert shaders, my phone (Samsung Vibrant / Android 2.2) complains that the definition differs.

struct Light {
    mediump vec3 _position;
    lowp vec4 _ambient;
    lowp vec4 _diffuse;
    lowp vec4 _specular;
    bool _isDirectional;
    mediump vec3 _attenuation; // constant, linear, and quadratic components
};

uniform Light u_light;

I know the struct is identical because its included from another file. These shaders work on a linux implementation and on my Android 3.0 tablet. Both shaders declare "precision mediump float;"

The exact error is:

Uniform variable u_light type/precision does not match in vertex and fragment shader

Am I doing anything wrong here, or is my phone's implementation broken? Any advice (other than file a bug report?)

sentences:
Rectangular area light illuminance - colour banding I'm currently working on an implementation of rectangular area lights but I am having some issues with the illuminance calculation, which gives me serious colour banding across the entire lit area. I'm using the paper published by DICE, "Moving Frostbite to Physically Based Rendering" (http://www.frostbite.com/2014/11/moving-frostbite-to-pbr/) as my base for implementation (Listing 12).

This is the relevant code used:

Solid angle of the rectangle

#define M_PI 3.14159265358979323846
float RectangleSolidAngle(vec3 worldPos, vec3 p0, vec3 p1, vec3 p2, vec3 p3)
{
    vec3 v0 = p0 - worldPos;
    vec3 v1 = p1 - worldPos;
    vec3 v2 = p2 - worldPos;
    vec3 v3 = p3 - worldPos;

    vec3 n0 = normalize(cross(v0, v1));
    vec3 n1 = normalize(cross(v1, v2));
    vec3 n2 = normalize(cross(v2, v3));
    vec3 n3 = normalize(cross(v3, v0));

    float g0 = acos(dot(-n0, n1));
    float g1 = acos(dot(-n1, n2));
    float g2 = acos(dot(-n2, n3));
    float g3 = acos(dot(-n3, n0));

    return g0 + g1 + g2 + g3 - 2.0f * M_PI;
}

Illuminance calculation

float RectangleIlluminance(vec3 worldPos, vec3 worldNormal, AreaLightData lightSource)
{
    float result = 0.0f;

    if (dot((worldPos - lightSource.position), lightSource.normal) > 0.0f)
    {
        float hWidth = lightSource.halfWidth;
        float hHeight = lightSource.halfHeight;

        vec3 p0 = lightSource.position + lightSource.right * -hWidth + lightSource.up * hHeight;
        vec3 p1 = lightSource.position + lightSource.right * -hWidth + lightSource.up * -hHeight;
        vec3 p2 = lightSource.position + lightSource.right * hWidth + lightSource.up * -hHeight;
        vec3 p3 = lightSource.position + lightSource.right * hWidth + lightSource.up * hHeight;

        float solidAngle = RectangleSolidAngle(worldPos, p0, p1, p2,    p3);

        float illuminance = solidAngle * 0.2f * (
                            Saturate(dot(normalize(p0 - worldPos), worldNormal)) +
                            Saturate(dot(normalize(p1 - worldPos), worldNormal)) +
                            Saturate(dot(normalize(p2 - worldPos), worldNormal)) +
                            Saturate(dot(normalize(p3 - worldPos), worldNormal)) +
                            Saturate(dot(normalize(lightSource.position - worldPos), worldNormal)));

        result = illuminance;
    }

    return result;
}

The paper mentions some level of banding but it should not be on the level which I am currently getting, which can be seen in motion in this video: https://youtu.be/gmkOOxIYc9s .
These images show the illuminance without shadows or anything.

From what I can gather from the paper, the code is correct. The current solution is deferred, reconstructing position using the depth stencil texture and sampling normals from a RGBA32F texture (trying to eliminate precision issues). A directional light also seems to produce some level of banding, although not as visible as with the area light, which can be seen in the following images.

So maybe it's still just a precision issue? The code for handling my depth and position reconstruction looks like this:

uniform sampler2D gDepthStencil;

vec4 ReconstructWSPosition(float z, vec2 uv_f)
{
     vec4 sPos = vec4(uv_f * 2.0f - 1.0f, z, 1.0f);
     sPos = gInvProjView * sPos;
     return vec4((sPos.xyz / sPos.w ), sPos.w);
}

void main()
{
    ivec2 pixel = ivec2(gl_GlobalInvocationID.xy);
    float depth = texelFetch(gDepthStencil, pixel, 0).r * 2.0f - 1.0f;
    vec4 wPosition = ReconstructWSPosition(depth, uv);
}

Which to me looks correct, but I might be missing something. Any other ideas or suggestions? Maybe a matter of tonemapping/HDR problems?

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:
Maya Animated Character export for XNA 4.0 problem To begin with, I'm trying to export an animated character in .fbx format from Maya 2013 to XNA 4.0

In Maya, The Model has a basic rig and the animations are in clips made in the Trax editor.

so the issue i'm having is after selecting the model and the root joint and then hitting export in .fbx format, for some reason when i open the exported .fbx file the joint system is detached from the model with no animation.

Btw, i have the animations in clips so that they can be called in code, for example "run","walk","attack".

So, what can i do to solve this problem?

Thank you.

sentences:
Efficiently transforming a series of points into curves to be serialized I’m working on a video game where I need to display a map (in 2D) of an actual big European city (Paris, London, Madrid… that kind of big) and the player, displayed as a simple dot on the map, can take different routes while following the street lines.
To do so I extract real data from OpenStreetMap.org. Thanks to it I have access to a ton of data and geographic information, and among them I have street visual settings given as series of coordinates (long/lat converted to X/Y points using the right projection). In OpenStreetMap a street is composed of a set of points so drawing a line between these points is enough to display streets.
However it represents a huge number of points to load which means a lot of time spent processing the data which means: not ideal. For example, a big city like Paris is composed of 65.000 street points. That is huge. In order to reduce this number and still being able to draw / follow street curves I’m thinking about using a graph only composed of points implied in street intersections alongside curve equations to describe the street display. This way a street composed of 2000 points would be not much bigger than one composed of 10 points in theory.
Example

In this example my initial set is composed of 13 points (red crosses) to display a street. What I’m aiming to in this case is keeping only 4 points (intersections with other streets) and an actual “equation” (or something similar) between each couple of points in order to reduce the size on disk of the final map.
This is where I’m stuck. I suck at Math (and regret it every day). So I can’t figure what would be the best way to transform a series of points into a simple equation that would allow me to follow the actual street curve at runtime.
I don’t know how to do it… I’ve read things about Bezier curves, about Clothoids, Circular Arcs… but I don’t know where to start, what is the best solution here, how to convert my series of points using one of these techniques, or if it’s really the clever thing to do in order to reduce the size (in bytes) of the map…

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:
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 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: .png file to Sprite(2D and UI) - still not visible under source image I am trying to use an image as a UI Image but even after changing its texture type to Sprite(2D and UI), it isn't visible in the source image menu. The file was created in MS Paint and I'm accessing the source image menu via the "circle selector" next to Source Image in the Inspector. I'm pretty sure I've never had this issue before. I wish I could share more details but there's nothing much to say. What could be causing this issue?

sentences:
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:
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:
Basic Random Tile Map Generation Currently I've got a map like this:

It's pretty simple but what I want is that area of tiles to be random, with the number of tiles present being random (Within a minimum and maximum amount of tiles of course) and the positions of the tiles being random (but still all connected to each other), but I'm not exactly sure how I should go about implementing that.

I'm sort of looking for a system that will generate random sections of tiles, a bunch of tiles within a group at random positions around the screen with all these sections being connected to each other via a larger section of tiles.
Like the example shown in this perfect drawing I've quickly done:

Each square would be a group of tiles, they're all of different shapes and sizes but all connected together via another large (or small) group of tiles in the middle.

I have looked into grid map generation before making this post but all the information I found would tend to go over more advanced map generation methods that have multiple layers which is not really what I need for my game so I was wondering if someone would possibly be able to advice me on what the best method would be to do this?

I'd very much appreciate it.

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:
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:
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:
Billboarding + aligning with velocity direction I'm working on a particle system where I'm orientating the billboard using the inverted orientation matrix of my camera. This works quite well and my quad are rotated correctly towards the camera.

But, now I want to to rotate the quads in such a way that they point towards the direction they are going to.

In 2D this can be done by normalizing the velocity vector and using that vector for a rotation around the Z-axis  (where vel.x = cos(a) and vel.y = sin(a)). But how does this work in 3D?

Thanks
roxlu

sentences:
How to move a static Body in Farseer 3.2 using touchpad I'm developing a 2D game for windows phone using Xna and Farseer library. For now I have two objects/bodies. One is falling from the top and the other one which is static is at the button of the screen and is supposed to be used to catch the object that is falling.

I need to move the static body at the button using mobile phones touch screen only on X axis.

Here is the sample code that I wrote for using the touch pad, note that "tray" is the static body.

private void UpdatePlayer(GameTime gameTime)
    {
        // Windows Phone Controls
        while (TouchPanel.IsGestureAvailable)
        {
            GestureSample gesture = TouchPanel.ReadGesture();
            if (gesture.GestureType == GestureType.FreeDrag)
            {
                tray.Position.X += gesture.Delta.X;
            }
        }

        // Make sure that the player does not go out of bounds
        tray.Position.X = MathHelper.Clamp(tray.Position.X, 0, GraphicsDevice.Viewport.Width - trayTexture.Width);
        tray.Position.Y = MathHelper.Clamp(tray.Position.Y, 0, GraphicsDevice.Viewport.Height - trayTexture.Height);
    }

and this is the initialization of this Body

//Create Floor (tray)
        tray = BodyFactory.CreateRectangle(MyWorld, ConvertUnits.ToSimUnits(143), ConvertUnits.ToSimUnits(12), 10);
        tray.Restitution = 0.2f;        //Bounceability
        tray.Friction = 0.1f;           //Friction
        tray.IsStatic = true;         //Static objects wont move when hit by other objects

        tray.Position = new Vector2(((int)ConvertUnits.ToSimUnits(playerPosition).X),
            ((int)ConvertUnits.ToSimUnits(playerPosition).Y)); //set the position of tray

But the problem is I cannot modify the return value of tray.Position because it's not a variable.

So how can I do it?

sentences:
3D collision for non mathematician I am having an extremely hard time understanding smooth 3D collision. I have spent a month trying to figure out the math and still cannot get perfect collision detection that perform the same way as in games such as Quake.

I've resorted to a virtual 2D rectangle collision model applied to 3D plane, but it's full of bugs and doesn't handle slopes. It seems that very complex math is required like matrices and vectors. There are lots of tutorials online but they are full of mathematical symbols and it's impossible for a math novice like me to understand it, I also don't have time to go through a mathematics basics from the beginning. Is it possible to do collision without vectors or matrices or a guide somewhere that can explain in non mathematical terms how to implement smooth collision? How can a nonmathematician overcome 3D math?

sentences: Monster Spawner Reference Issue I have a monster spawner that spawns the "enemy" kid which is red, and it has a line in the script where it references the "player" gameobject's transform. Before I made the spawner, I had the enemies put by hand and I could reference the player object without issue. Now they're not handplaced, they are spawned from the prefab folder by the spawner. When they spawn the game gives the null reference exception error and stops. I look up to the enemies that are spawned and none of them have the player gameobject referenced. Also when I click on to the enemy prefab to reference the player object, it just doesnt allow me to. How can I resolve this issue?

sentences:
Calculate when round object is inside an ellipse I want to calculate in java when a circle is inside an ellipse. I drew an example below:

For this particular problem, the top left corner of the field has the position 0.0f, 0.0f. The bottom right corner has the position 1.0f, 1.0f. The position of the bat is: 0.48f, 0.94f. The goal is located at: 0.5f, 1.0f, height is 0.1f and the radius 0.4f.

How can I calculate if the bat is inside the ellipse?  What is the general algorithm?

sentences: 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:
How to place text centered on the player? XNA As I can make a text of the size of this, it is centered taking reference of the player?

Right now the following happens:

I want:

code:

spriteBatch.DrawString(Font, player.Name, new Vector2(player.position.X, player.position.Y - 12), Color.White);

PS: Sorry for my English.

sentences:
Deferred Shading and material ID I am implementing a deferred rendering framework, and I wanted to allow programmers to write custom materials.
However, I did not find yet how to handle different materials.
For now, a material is just a set of uniforms for me.

I wanted to write the material ID in the GBuffer, however, I don't see the point of doing it as the lightning pass is using the same shader for every fragment (obviously).

In the frosbite paper (page 15), they explain they use a Material ID and a MatDat parameter, but I did not really get what it can be and how they handle it during the lightning pass.

Is the material ID used in a simple branching condition? In this case, when a new material is created, do I have to rebuild the lightning pass uber shader by adding this branching and the code to execute?

UE4 seems to build GLSL code from the material editor, which is not something hard, but how do they handle it with the deferred renderer?
Do they only plug the GLSL code into the Uber Shader?

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:
Open Source HTML/JS game(s) with license that would allow embedding in my app? I'm working on an educational app for kids. At the end of the sign-up process, the kids must wait for a confirmation from their parents in order to gain access to the app.

While they wait for this to happen, we want to let the kid play a simple game as a way to keep their interest up.

Is there a marketplace or repository for games with such a license that we could either purchase (affordably) or use for free in our own app?

sentences:
Godot - Quaternion slerp is altering initial rotation of an object I have a player that shoots a rocket. If the rocket has a target, I use a quaternion slerp to make it home in on that target. Free firing the rocket goes directly forwards as expected. Setting a tracking_speed of 1 homes directly towards the target as expected. But for some reason if I set tracking_speed to less than 1, the rocket's initial direction becomes (0 0, 1) no matter where the ship is pointing and then proceeds to rotate towards the target. Code below.
var transformed_rotation:Transform = global_transform.looking_at(target.global_transform.origin, Vector3.UP)
var new_rotation:Quat = Quat(global_transform.basis).slerp(transformed_rotation.basis, tracking_speed)

set_global_transform(Transform(new_rotation, global_transform.origin))

sentences:
Libgdx problem while converting TextureRegion to Pixmap I'm developping a Tile base game where I have to generate transition tiles. To do so, I have a method that generate those tiles from 2 existing one and 1 "filter tile". I use this method to make a pixMap from the region I retrieved from my TextureAtlas.

public Pixmap getPixMapFromRegion(TextureRegion region){

    Texture texture = region.getTexture();
    TextureData data = texture.getTextureData();
    if (!data.isPrepared()) {
        data.prepare();
    }
    Pixmap pixmap = data.consumePixmap();
    int width = region.getRegionWidth();
    int height = region.getRegionHeight();
    Pixmap px = new Pixmap(width, height, Format.RGBA4444);
    for (int x = 0; x < width; x++) {
        for (int y = 0; y < height; y++) {
            int colorInt = pixmap.getPixel(region.getRegionX() + x, region.getRegionY() + y);

        }
    }
    return px;
}

Them I apply this method

public Pixmap generateMixedTile(TiledMapTileSet tileset, AssetManager assMan,String template, TextureRegion region1, TextureRegion region2) {
    TextureAtlas atlas = assMan.get("../core/assets/tuiles/MergeFilter.atlas")
    AtlasRegion region = atlas.findRegion(template);
    Pixmap templ = getPixMapFromRegion(region);
    Pixmap img1 = getPixMapFromRegion(region1);
    Pixmap img2 = getPixMapFromRegion(region2);
    Pixmap res = newPixmap(region.getRegionWidth(),region.getRegionHeight(),Format.RGBA4444);

    for (int y = 0; y < templ.getHeight(); y++) {
        for (int x = 0; x < templ.getWidth(); x++) {
            if(0xFF000000 == templ.getPixel(x, y))
                res.drawPixel(x, y, img1.getPixel(x, y));
            else
                res.drawPixel(x, y, img2.getPixel(x, y));
        }
    }
    return res;
}

It seems that after asking again and again for the same texture in the AssetManager, I get a Couldn't load file ../core/assets/tuiles/Water3.png  Exception. But this happen after the system success a lot of time to access that same file.

So I don't know how I could handle that because I thought that using assetManager and Atlas was the bests practices

Any Idea of how to fix that or to do it in another way?

sentences:
Error with Cocos2d-JS when using Skeletal animation from Cocos Studio Here is the JavaScript code：

var size = cc.winSize;
ccs.ArmatureDataManager.getInstance().addArmatureFileInfo(res.skeleton);
// The error comes from the following line
var armature = ccs.Armature.create("Skeleton");
armature.getAnimation().play("hit");
armature.x = size.width / 2;
armature.y = size.height / 2;
this.addChild(armature);

And at runtime I get this error：

  Assert failed: AnimationData not exist!

I know that error is from the specified line, but I'm very confused as to how I can solve it.

I have tried many different methods, but unfortunately those didn't work.

In the resources, I load all the image files and JSON files which made by Cocos Studio, and the file path and name are correct.

What could be causing this error?

sentences:
Some questions about lists I've been looking for articles or tutorials on this and I can't seem to find any, so I thought I'd ask here. I've created a bullet class in my game that is added and removed through a list. If I'm going to make these bullets work the way I want them to I need to be able to do two things:

One, I need to check if the bullets are colliding with each other and then remove the two bullets that are colliding. I've tried doing it by updating the bullet list with a for statement and then checking for collision with another for statement, but that occasionally crashes the game.

Two, I need to be able to check how far away every other bullet in the list is from the current one.

So how can I go about doing this?

sentences:
Select a block of tiles from tilemap by click and dragging I'm creating my first game in Godot 3.1, a top-down 2D sim game where you can build rooms on a space station. I am using a tileset I created inside a TileMap node. I placed a script inside the node that checks for the mouse position in the world, converts it into a tilemap coordinate, then loads a tile into that tilemap coordinate.

func _input(event):
if (event is InputEventMouse):
    var button = event.get_button_mask()
    if (button == 1):
        var tile_pos = world_to_map(event.position)
        var name = _tileset.tile_get_name(0)
        set_cellv(tile_pos, _tileset.find_tile_by_name(name))

Works like a champ! As long as the left mouse button is held down, any tile the mouse pointer touches is filled with the tile from the tileset.

Now I am trying to expand this function so that I can click the world and drag across several tiles to form a rectangle or square, then have all of the tiles inside the selected area filled with the selected tile.

func _input(event):
if (event is InputEventMouse):
    var button = event.get_button_mask()
    if (button == 1):
        var tile_pos = world_to_map(event.position)
        if (dragStart == Vector2(-1,-1)):
            dragStart = tile_pos
        var name = _tileset.tile_get_name(0)
        if (dragStart != Vector2(-1,-1) && dragStart != tile_pos):
            var newX = dragStart.x - tile_pos.x
            var newY = dragStart.y - tile_pos.y
            while (newX != 0 && newY != 0):
                var next = Vector2(-1,-1)
                if newX > 0:
                    next = Vector2(dragStart.x - 1,dragStart.y)
                    newX = newX - 1
                elif newX < 0:
                    next = Vector2(dragStart.x + 1,dragStart.y)
                    newX = newX + 1
                elif newX == 0:
                    if newY > 0:
                        next = Vector2(dragStart.x,dragStart.y - 1)
                        newY = newY - 1
                    elif newY < 0:
                        next = Vector2(dragStart.x,dragStart.y + 1)
                        newY = newY + 1
                print(next)
                set_cellv(next, _tileset.find_tile_by_name(name))
    else:
        dragStart = Vector2(-1,-1)

However, it seems to only load some of the tiles and functions sporadically. Am I not understanding how the system iterates through the while loop or am I missing something else?

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 draw lines and curves on a canvas that's not rendered? I need to draw lines and curves on a canvas that is not rendered on the screen but just updates the array of pixels that would otherwise be rendered. I need this to separate my game engine from my renderer.

This has proven rather difficult for my case because I don't use sprites that are loaded, but I draw lines and curves on a canvas.

I have used the p5.js library to accomplish my game, but p5 doesn't let you work without a "setup()" and "draw()" function. I don't want any draw loop or something because that beats the purpose of separating my game engine from my rendering.

I want to use p5 to render after I have all my game logic separate and I can just call nextFrame() or something from my game logic inside draw() in a constant 60 fps.

In p5 it is possible to createGraphics() which works outside of the canvas and doesn't have to render but again, p5 needs a draw() loop to work.

Does anyone know how I can accomplish this?

sentences:
Is it safe to cast my 2D points to 3D points for a library which only takes Vector3s? I need to cast a ray in 2D space for bullet collision detection, but the Ray.Intersects method requires a BoundingBox which uses vector3's not vector2's. My question is should I just ignore the Z value and pretend it's a vector2? Raycasting is already slow enough so I think having calculations done in an unnecessary 3rd deminsion should be eliminated even if the value is just 0, but I don't know.

So should I implement my own raycasting system maybe using Bresenham's line algorithm which is for 2 dimensions or should I go the cheap way and make a bounding box a bounding plane?

sentences:
Dragging text element into Text variable unity 4.6 So I was trying to make a UI element to keep score in a unity (4.6) project and I'm having trouble assigning the 'Text' element to the Text variable.

So I have the text element with the script attached to it. At the moment the script is empty except from some variables being created, here it is:

using UnityEngine;
using UnityEngine.UI;

public class TextController : MonoBehaviour {

public Text text;
public int score1, score2;

// Use this for initialization
void Start () {
}

// Update is called once per frame
void Update () {
    //text.text = "a" + "";
}
}

In the unity UI the Text variable shows but it is empty, and it will not let me drag the 'Text' object from the hierarchy into the variable box. It shows the outline like its going to accept it but remaing 'None (Text)' when I release the click. I tried importing an already working UI from another project into this but when I added it to the hierarchy it removed the text element again (just for reference the text worked perfectly in the other project).

Also a screenshot of the hierarch just in case:

Is there a problem with the scipt or the prject or have I messed something else up?

Edit:

Clicking the circle next to the text variable brings up the window to select the element. Mine shows up without anything in it. I expect it to show the text object I have made.

sentences:
How do I create a closed beta on Google Play? As per suggestion I'm splitting How do I create a closed beta on the App Store? up.

Can I upload the game I'm developing to Google Play as a closed beta, so I could generate a couple of keys/tokens for my testers? I'm hoping to only publish the game for the public after I'm happy with the game as it's offered on Google Play, as a complete user experience which includes the installation process.

If this is not the usual workflow, how should I do it?

sentences:
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:
Square collision: Detect which side of the wall it collided I'm using a standard square collision in my 2D game. The player shoots little balls, and when they hit any wall it should bounce.

The problem is that I know when it hits a wall but I don't know if the collision happened on the side or top/bottom of the wall.

Here's my collision algorithm (pseudo code):

If
A.x < (B.x + B.width) AND
B.x < (A.x + A.width) AND
A.y < (B.y + B.height) AND
B.y < (A.y + A.height)
Then a collision happened

Is it easy to detect if the collision happened on a side or top/bottom? If yes how should I do it?

sentences:
Eye Parallax Refraction Shader I am trying to implement the Parallax Refraction effect explained by Jorge Jimenez on this presentation:  http://www.iryoku.com/downloads/Next-Generation-Character-Rendering-v6.pptx and I am facing some difficulties. Here is a screenshot of the interesting part.

But this document lacks a bit of explanations especially the second part with the Physically based Refraction.

Here is what I've achieved for the moment.
This is the simple Parallax Refraction effect and, as you might notice in the screenshot, there is small glitch at grazing angles in the iris when the Parallax Scale value is too high.

This seems to be caused by the parallax calculation but are there some tricks to avoid or minimize such issue ?

I don't want to go deeper with parallax mapping for the moment, so I don't want to use Steep Parallax Mapping or Parallax Occlusion Mapping.

This is the simple Parallax Refraction part.

// height value comes from a texture
float2 offset = height * viewDir;
offset.y = -offset.y;
texcoord -= ParallaxScale * offset;
// Next there is the texture sampling with the texcoord value

Here is the way I calculate the refraction vector according to Snell's law.

float cosine = dot(viewDir, worldNormal);
float sine = sqrt(1 - cosine * cosine);

float sine2 = (_IOR * sine);
float cosine2 = sqrt(1 - sine2 * sine2);

float3 x = -worldNormal;
float3 y = normalize(cross(cross(viewDir, worldNormal), worldNormal));
float3 refractedW = x * cosine2 + y * sine2;

This is integrated with the Physically based Refraction and it gives interesting results but I still don't know how to get rid of the high parallax scale issue which appear at grazing angles...

Any idea how to get rig of that ?
Thanks a lot.

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:
How to load game resources correctly regardless of the working directory? I am writing a resource manager for a hobby game project that reads textures/fonts etc.

Up to now, I was giving the location of the files relative to the executable path, like:

my_texture.loadFromFile("textures\\my_texture.png");

However, now I realized that the relative path I'm giving is relative to the working directory of the game. So, for example, if I run the executable from my IDE (which sets the working directory to the project directory instead of executable directory), the game fails to load the texture and crashes.

I was thinking about using the main's argv[0] and did some research on it, but apparently it is not reliable (it might just give the name of the exe).

So, how can I get the path to my resource files reliably? How does the professionals do it?

I'm using the SFML and C++17. I would like a portable solution if possible, otherwise Windows.

I checked this question but it wasn't helpful.

sentences:
Sprite erasing text in Pygame I'm making a Pong clone in which the user can press the 'p' button to pause/unpause the game. When the user presses the 'p' button the word 'PAUSE' is drawn to the screen and when he presses again the word is erased. My problem is this:

As you can see, the ball sprite is erasing the text. Any clue on why this is happening? Here is the code for the main stuff.

sentences:
Netty: Disconnect client from server keeps reconnecting automatically I have a game that connects to a server using the Netty API. Everything works correctly it seems when I click 'Login'; it will connect to server. However i've added an ingame button 'Back To Lobby'. All this button does is call channel.disconnect(). However when it goes back to the login screen it continously reconnects on its own. Is there something I am missing?
My goal is to make it disconnect from server completely and only reconnect when user clicks login again.
Client Task Class:
public class ClientConnectionTask extends Bootstrap implements Runnable {

    /**
     * The game context
     */
    private GameContext context;

    /**
     * The worker
     */
    private EventLoopGroup worker = new NioEventLoopGroup();

    /**
     * The IP Address to connect
     */
    private String ip;

    /**
     * The callback to notify
     */
    private ClientConnectionCallback callback;

    public ClientConnectionTask(GameContext context, String ip, ClientConnectionCallback callback) {
        this.context = context;
        this.ip = ip;
        this.callback = callback;
    }

    @Override
    public void run() {
        group(worker);
        channel(NioSocketChannel.class);
        option(ChannelOption.TCP_NODELAY, true);
        handler(new ChannelInitializer<SocketChannel>() {
            @Override
            protected void initChannel(SocketChannel socketChannel) throws Exception {
                ChannelPipeline p = socketChannel.pipeline();
                p.addLast("encoder", new PacketEncoder());
                p.addLast("decoder", new PacketDecoder());
                p.addLast("handler", new ClientChannelHandler(context));
            }
        });

        try {
            ChannelFuture future = connect(ip, Constants.PROTOCOL_PORT).syncUninterruptibly();
            if (future.isSuccess()) {
                callback.onSuccess(future.channel());
            }
            future.channel().closeFuture().sync();
            future.channel().flush();
        } catch (Exception e) {
            e.printStackTrace();
            callback.onFailure();
        } finally {
            worker.shutdownGracefully();
        }
    }

}

Login method:
    public void connect(final String displayName, String ip, String code, int team) throws UnknownHostException {
        haveServerResponse = false; // reset for next connect
        if(!RandomUtils.validIP(ip) && RandomUtils.validUrl(ip)) {
            try {
                InetAddress address = InetAddress.getByName(ip);
                ip = address.getHostAddress();
            } catch(UnknownHostException e) {
                return;
            }
        }
        service.execute(new ClientConnectionTask(this, ip, new ClientConnectionCallback() {
            @Override
            public void onSuccess(Channel channel) {
                serverChannel = channel; // initialize the server channel
                connectScene.setState(ConnectionSceneState.CREATING_PROFILE);
                sendLoginPacket(code, displayName, team); // send login packet
            }

            @Override
            public void onFailure() {
                // only show if server appears dead
                if (!haveServerResponse) {
                    connectScene.loginFailed();
                    dispose();
                }
            }
        }));
    }

When debugging it seems like some threads are still staying alive, which may keep it from disconnecting completely. Sometimes it disconnects completely other times it just auto logs in.

sentences:
OpenGL - Index buffers problem I have a custom file format that has all the needed information for a 3D mesh (exported from 3ds Max). I've extracted the data for vertices, vertex indices and normals.

I pass to OpenGL the vertex data, vertex indices and normals data and I render the mesh with a call to glDrawElements(GL_TRIANGLES,...)

Everything looks right but the normals. The problem is that the normals have different indices. And because OpenGL can use only one index buffer, it uses that index buffer for both the vertices and the normals.

I would be really grateful if you could suggest me how to go about that problem.

Important thing to note is that the vertex/normal data is not "sorted" and therefore I am unable to use the functionality of glDrawArrays(GL_TRIANGLES,...) - the mesh doesn't render correctly.

Is there a way/algorithm that I can use to sort the data so the mesh can be drawn correctly with glDrawArrays(GL_TRIANGLES,..) ? But even if there is an algorithm, there is one more problem - I will have to duplicate some vertices (because my vertex buffer consists of unique vertices - for example if you have cube my buffer will only have 8 vertices) and I am not sure how to do that.

sentences:
3ds max "thread stiching" plugin for cloths or furniture i`m trying to find a plugin or way to add 3D thread stiching to a mesh.

It would be perfect if you could creat thread stiches along edges in "editpoly" mode.
I know that you can somehow do this in Z-Brush with customized alpha brushes but in my opinion its a bit complicated. I could also imagine alining a editable spline along a mesh edge.
Important for me would be that this "unknown tool" would also add the displacement on the canvas and the stiches so i can use "render to texture" to give seems realistic look. Thisway you could always creat perfect stiches with realistic looking displacement like in the picture below without to much affort.

http://www.esunroof.com/contrast_stitch.jpg

http://t1.gstatic.com/images?q=tbn:ANd9GcQplgCvhur-ynthz15Qdaqpv1QRwkG4K6sjhVjDqzzxm6OaY9Bt

would be awesome if you know a way to do this, Thanks a lot lot :)

sentences:
How can I implement Offline Skilling An example of offline skilling would be EvE Online. Your character (pilot) does not gain skills by getting experience. Instead, your character gains skillpoints towards a skill you are training whether you are in or out of game. Also, I am fairly certain that skills continue to build even when the game servers are down.

Anyone have any broad ideas of how they go about this, or better yet how I could go about implementing something like this in a game I am developing. I'm not looking for a detailed explanation here (don't let me hold you back though), but I am looking for a signpost that points me in the correct direction.

Thanks!

sentences:
SDL2 taskbar icon notification (blinking / flashing orange)? In steam when you get a message, or in CS:GO when you find a match the taskbar icon flashes orange and your taskbar becomes unhidden if that's how you have it setup.

In SDL2 you can set a window icon fairly easily, but is there a way to notify the user such as bringing "up" the taskbar?

sentences:
How to make model's arms + weapon follow cursor? 0
Just like the title says. I currently have my controlling movement working just how I want it to. Now in order to proceed with shooting I first should focus on how the model should look like to determine how my script should act when firing. Currently I am using Unity's Constructor model, but now I need to create my own model just to get the arm movements to follow how I want it to. I have an idea how to make the arms follow the cursor, by adjusting the X and Y axis rotation to follow the position of the cursor, taking on screen coordinates then using Atan to find the right angle. First I have no idea how to make a model, so I guess I need to figure that out first, but how can I make it move like the constructor model from Unity. I have heard of rigging, but still not sure what that is. I have played with C4D when in high school which I noticed while modeling it help provide a human like effect when controlling joints. I am planning on using Blender so if anyone had 3D modeling humanoids video with rigging or skeletal joint or something. Not an artist at all, but I need a model I suppose.

This is a 2.5D platform game, 3D environment with 2D physics.

sentences:
Developing AI for Zatacka I am trying to develop a stronger AI for the popular game, Zatacka.
The basic aim of the game is to survive the longest. It's like the TRON game, but the characters can only turn smoothly, instead of 90 degree turns.

I am new to game AI. I have the following ideas in mind, but I don't know how they can be implemented.

Collision prediction. If another player is about to come into the same area, then the player should turn around and try to evade.
Hole taking capability. How to detect holes. How to distinguish holes from a normal empty area.
Early detection of a dead end and being able to turn around before its too late. The problem with this how do we determine a dead end, it could be a bit far than our current position. Doing a path finding algorithm and searching for the wall or a player's body might not be efficient enough as this has to be done for each steps.

Are there any standard algorithms for these problems? Can somebody throw some light on how I can approach these problems?

sentences:
What might cause edges of an FBX model to appear curved? I'm developing an importer/exporter using the FBX SDK. One model I've been using for testing really has me scratching my head:

http://www.turbosquid.com/3d-models/maya-tower-bridge/328242

When I look at the model with my own viewer, with some other 3rd party ones (like the Clockstone one), or based on the screenshots on TurboSquid, all the edges of the bridge look straight. But when I open it with Autodesk FBX Review, it looks all "bulgy":

The scene is composed entirely of meshes and I tried a variety of calls on the mesh parts to see if anything would be returned that didn't just look like default values. All to no avail.

Any perspective would be much appreciated!

sentences: What are different types of online game formats besides Flash? I am currently looking into making a website that hosts various online games and would like to support as many formats as possible no matter how obscure. I was wondering if anybody could inform me on what these different formats(Flash, JavaScript, etc.) may be and possibly even provide me with some insight on how to embed them.

sentences:
How do I create a HeightField in pybullet? I've been looking for documentation on PyBullet, the python implementation of Bullet, but I haven't yet found a way to implement the btHeightfieldTerrainShape collision object, which I need to make, well, terrain.

If this isn't possible, is there another way within PyBullet to turn a set of points into a collide-able object?

sentences:
Testing my game in the engine works fine, I export to HTML5 and try but all the tiles in tilemap have disappeared Here is a link to the live game:
https://44351-w21.github.io/one-screen-platformer-francescainfranca/
As the title says all the platforms in the tilemap do not appear when you run the game on the HTML5 export. I have no missing assets, and I made sure the filenames match where they are referenced. I have no idea why this is. Any help is much appreciated.
Error in the console:
**ERROR**: No loader found for resource: res://Assets/Platform/grassLeft.png.
put_char @ tmp_js_export.js:8
tmp_js_export.js:8    At: core/io/resource_loader.cpp:286:_load() - Method failed. Returning: RES()
put_char @ tmp_js_export.js:8
tmp_js_export.js:8 **WARNING**: Couldn't load external resource: res://Assets/Platform/grassLeft.png
put_char @ tmp_js_export.js:8
tmp_js_export.js:8    At: scene/resources/resource_format_text.cpp:175:_parse_ext_resource() - Couldn't load external resource: res://Assets/Platform/grassLeft.png

sentences:
Handling collisions with ground How do you usually solve collisions between entities and the ground? Sending collision events hardly seems appropriate since almost everything touches the ground at almost all points in time. Calling collision handling functions doesn't sound any better.

How is this normally achieved? Is handling of slopes significantly harder?

sentences:
IsoSurface Normals\Texture Coords Problems(DX11\SharpDX) Hi and thanks for your time!

So over the past few days I have been playing with isosurface construction from volume textures, I have it running on the cpu and all is well from a "just got it working" stand point eg. surface reconstruction works and I have my really cool voxel mesh drawing.

I have based my code(converted to VB.net) on Paul Bourke's work here: Polygonising a scalar field
and like I said it works well apart from the fact that my normals are wrong and I have these strange fully black on both sides triangles, I think I'm doing my normals wrong but the way they are now is the beast I can get, I tried a few ways to build the normals and this one is the only way I could get smooth normals.

Here you can see how my normals are wrong, green should be up, gray\dark should be unlit and the hay'ish colour is the lit side.

I have tried to flip and invert them but as you can see they are not wrong all the same way.

HLSL Normals 1st try:

float3x3 cotangent_frame(float3 N, float3 p, float2 uv)

// get edge vectors of the pixel triangle
float3 dp1 = ddx(p);
float3 dp2 = ddy(p);
float2 duv1 = ddx(uv);
float2 duv2 = ddy(uv);

// solve the linear system
float3 dp2perp = cross(dp2, N);
float3 dp1perp = cross(N, dp1);
float3 T = dp2perp * duv1.x + dp1perp * duv2.x;
float3 B = dp2perp * duv1.y + dp1perp * duv2.y;

// construct a scale-invariant frame
float invmax =   -sqrt(max(dot(T, T), dot(B, B)));
return float3x3(T * invmax, B * invmax, N);

HLSL Normals 2nd try:

NormalData CalcWS_Normal(float2 WS_TexCoord, float3 WS_Pos)

NormalData dout;

float3 dp1 = ddx(WS_Pos);
float3 dp2 = ddy(WS_Pos);
float2 duv1 = ddx(WS_TexCoord);
float2 duv2 = ddy(WS_TexCoord);

float3x3 M = float3x3(dp1, dp2, cross(dp1, dp2));
float2x3 inverseM = float2x3(cross(M[1], M[2]), cross(M[2], M[0]));

float3 t = mul(float2(duv1.x, duv2.x), inverseM);
float3 b = mul(float2(duv1.y, duv2.y), inverseM);
float3 normal = normalize(cross(normalize(b), normalize(t)));

dout.Normal = normal;
dout.Tang = t;
dout.BiTang = b;

return dout;

Heres is how I'm doing it now, takes a vertex and then samples the volume texture

VB.net

   Private Function vGetNormal(fX As Single, fY As Single, fZ As Single, fScale As Single) As Vector3
    Dim rfNormal As Vector3
    rfNormal.X = fSample1(fX - fScale, fY, fZ) - fSample1(fX + fScale, fY, fZ)
    rfNormal.Y = fSample1(fX, fY - fScale, fZ) - fSample1(fX, fY + fScale, fZ)
    rfNormal.Z = fSample1(fX, fY, fZ - fScale) - fSample1(fX, fY, fZ + fScale)
    Return Vector3.Normalize(rfNormal)
End Function

Private Function vGetNormal(fX As Single, fY As Single, fZ As Single, fScale As Vector3) As Vector3
    Dim rfNormal As Vector3
    rfNormal.X = fSample1(fX - fScale.X, fY, fZ) - fSample1(fX + fScale.X, fY, fZ)
    rfNormal.Y = fSample1(fX, fY - fScale.Y, fZ) - fSample1(fX, fY + fScale.Y, fZ)
    rfNormal.Z = fSample1(fX, fY, fZ - fScale.Z) - fSample1(fX, fY, fZ + fScale.Z)
    Return Vector3.Normalize(rfNormal)
End Function

Volume sampling code:

VB.net

Public Function GetVolumeData(_pos As Vector3) As Half
    Dim x2 As Single = Math.Abs((_pos.X / CellsPerPatch * 32) Mod mWidth)
    Dim y2 As Single = Math.Abs((_pos.Y / CellsPerPatch * 8) Mod mDepth)
    Dim z2 As Single = Math.Abs((_pos.Z / CellsPerPatch * 32) Mod mHeight)

    Return mScalars(CInt(Math.Truncate(x2)) + (CInt(Math.Truncate(z2)) * mWidth) + (CInt(Math.Truncate(y2) * mWidth * mWidth)))
End Function

The rest of the isosurface construction code is just a copy-> convert-> paste of Paul Bourke's c code.

Just to makes sure everyone knows what I'm asking: Can anyone tell me what I'm doing wrong? Is it a problem with my normals or the isosurface stuffs or both?

All of the above is just so u have some context, I'm happy to post more code if ppl need to see it

[EDIT]: Black squares come from having no depth info at that point so my deferred render hates those spots, this is leading back to maybe a problem with the surface reconstruction? But why its only happening in those spots, one would think that it would happen everywhere?

sentences:
Entity Component Systems, Input, and Angry Birds! I am using Artemis ECS. I have the very basics of a game already. I am now trying to determine how to gracefully handle input and to a lesser extent collisions. Some people say with ECSs, everything should be a component and data driven and you shouldn't really use events/messages, or at least avoid them where possible.

Input handling in component based design covers what I am asking as well, but I would understand when and how to raise events, add components or whatever much more fully by using a game we all know (Angry Birds) as an example.

So, for Angry Birds I would have some entities with components (where components are pure data, and an entity is just an id):

catapult (position, sprite, state{free, available}?, clickable?, dragable? releasable?)
bird (position, velocity, physics{density}, sprite)
baddy (position, velocity, physics {density}, sprite, health)
box (position, velocity, physics{density}, sprite, health)

And the following systems to start with:

SpriteSystem (has all entities with sprite component)
PhysicsSystem (has all entities with position, velocity and physics components)
HealthSystem (has all entities with health component)
InputSystem (knows about keyboard/mouse events such as clicked, dragged, released, key down etc, not sure what entities should have...)

How would the InputSystem interact with other Systems to say the catapult was clicked, and if there are birds left, and none are in flight, allow it to be dragged and release/fire the bird.

Would the InputSystem modify ClickableComponent, DragableComponent and ReleasableComponents on the catapult entity? Or, should it raise some sort of Click, Drag and Release Events? What System would listen for the component changes/events? A CatapultSystem perhaps?

When the PhysicsSystem notices a collision between the bird and a baddy, should it create a Collision event, that I guess the HealthSystem would listen for? Or again, should it modify a collision Component already on the Entity?

Collision and click components would need to be cleared every game loop if I took the component approach (seems a bit naff...)

sentences:
Slick - create new texture from part of existing texture Say I have the following image:

I want to resize this texture, so I can have resizable buttons with a texture.
Now, as you can't repeat a certain area of an image in OpenGL, I have to create a new texture from the center (from (0.1f, 0.1f) to (0.9f, 0.9f) in texture coordinates.

How can I create a new texture from the inside of this image using the Slick library?

sentences:
Will using a fixed point library in C++ give me 100% deterministic replays? I'm working on a scrolling arcade shooter in C++ with SDL2 and I'd like to have a replay function so players can save, share, and replay good runs. I understand that floating point math is not consistent from CPU to CPU, so saving inputs with frame counters won't give you stable replays. I saw someone mention that fixed point math is a possible solution, so I'm currently working on a C++ engine using Libfixmath fix16_t datatypes in place of anything that would be a floating point.
Should this give me 100% deterministic replays across hardware if I save the random seed? From my understanding of how a fixed point math library works that should be the case, but I would like some confirmation before I bank my entire engine around this. Really my only concern is that I'm using literal floats to set the starting values for some things, like fix16_from_float(1.2) to set the player's movement speed and I'm not entirely sure if CPU inconsistency could mess up that initial value and thus defeat the purpose. If so, could I solve the problem by using fix16_from_int() paired with some Libfixmath arithmetic to get the same non-integer values without ever using floats? I don't quite have a complete grasp on how literals are stored into a compiled program.
I am also a tad worried about performance with potentially hundreds of onscreen bullets using high level fixed point math every frame, but I'll have to see how much impact that has when I get to it.

sentences:
SpriteBatch memory leak I have a strange problem with XNA 4. I'm constructing a SpriteBatch using this.spriteBatch = new SpriteBatch( GraphicsDevice );.
This leads to a memory leak up to 600 MB memory consumption.

This problem didn't exist two days ago.

I have a static class called Resources:

public static GraphicsDeviceManager gdm;

This gets set in the Game-constructor

public class Game : Microsoft.Xna.Framework.Game {
    public Game() {
        Resources.gdm = new GraphicsDeviceManager( this );
        Content.RootDirectory = "Content";
    }
}

In the Initialize-Method I'm creating a SpriteBatch in the Resources

protected override void Initialize() {
    base.Initialize();
    Resources.Game = this;
    Resources.spriteBatch = new SpriteBatch( GraphicsDevice );
}

At the point Resources.spriteBatch = new SpriteBatch( GraphicsDevice ); it allocates up to 600 MB memory.

Why is XNA allocating so much after I created a SpriteBatch? How can I fix it? (It worked two days ago and I didn't change anything that could cause this problem.)

sentences:
Default color for 3D scene I have webgl 3D scene with background image and few shapes with textures.
I want to add some lines and other shapes and apply on them default color which not affect the shapes with textures.
How can I do this?
this is what I have now:

gl.clearColor(0.0, 0.0, 0.0, 0.0); //alpha=0 for background img
gl.enable(gl.DEPTH_TEST);

sentences:
GLSL Bokeh using Quads and Textures I'm trying to create a depth of field effect with bokeh sprites in GLSL. Specifically, what i would like to do is, for each pixel:

See if the pixel is out of the focal range
If it is, draw a quad and apply a texture to provide a bokeh sprite.

This kind of implementation is seen in the Unreal Engine and by Matt Pettineo, however, both implementations are in DX11 and I'm using OpenGL.

I'm a bit stuck on the drawing a quad and applying a texture bit. Does anyone know how I can do this, or provide any relevant links as to how I can do this?

Thanks

sentences:
Data structures for interpolation and threading? I've been dealing with some frame-rate jittering issues with my game lately, and it seems that the best solution would be the one suggested by Glenn Fiedler (Gaffer on Games) in the classic Fix Your  Timestep! article.

Now - I'm already using a fixed time-step for my update. The problem is that I'm not doing the suggested interpolation for rendering. The upshot is that I get doubled or skipped frames if my render rate doesn't match my update rate. These can be visually noticeable.

So I'd like to add interpolation to my game - and I'm interested to know how others have structured their data and code to support this.

Obviously I will need to store (where?/how?) two copies of game state information relevant to my renderer, so that it may interpolate between them.

Additionally - this seems like a good place to add threading. I imagine that an update thread could work on a third copy of the game state, leaving the other two copies as read-only for the render thread. (Is this a good idea?)

It seems that having two or three versions of the game's state could introduce performance and - far more importantly - reliability and developer productivity problems, compared to having just a single version. So I'm particularly interested in methods for mitigating those issues.

Of particular note, I think, is the problem of how to handle adding and removing objects from the game state.

Finally, it seems that some state is either not directly needed for rendering, or would be too difficult to track different versions of (eg: a third-party physics engine that stores a single state) - so I'd be interested to know how people have handled that kind of data within such a system.

sentences:
How can I optimize performance when updating tiles? So I'm making a side-scrolling adventure type game in Java. The worlds are procedurally generated, so I can't manually place tiles. Therefore, I every 20 ticks (1/3 second) I update every block's tile on the screen. I know this is a terrible solution, and it's causing a bit of lag. I tried only updating the blocks' tiles once when it was created, but it doesn't work well with the way I've programmed my world generation.

Basically, how the ground is generated is the top layer of ground is generated first, then when the player gets close enough, the layers below are created.

public void testForBlocks()
{
        topTaken=false;
        bottomTaken=false;
        rightTaken=false;
        leftTaken=false;

        for(int i=0;i<handler.screenBlocks.size();i++)
        {
                Block b = handler.screenBlocks.get(i);
                if(b.solid)
                {
                        if(b.oneWay==oneWay)
                        {
                                if(b.x==x&&b.y==y+32)
                                        bottomTaken=true;
                                if(b.x==x&&b.y==y-32)
                                        topTaken=true;
                                if(b.y==y&&b.x==x+32)
                                        rightTaken=true;
                                if(b.y==y&&b.x==x-32)
                                        leftTaken=true;
                        }
                }
        }

        setSprite();
}

This means that if I only update the tile's position once, the tile won't recognize that there is a block below it yet(because there isn't), and will be assigned the wrong tile.

Basically, my question is: How can I update tiles, while keeping it efficient?

I feel like I'm missing an obvious solution. Can anyone help me? Thanks in advance. :)

sentences:
3D Zoom To Mouse Cursor accounting for Change in Camera Pitch Overview:

Simply put, I'm trying to make a zoom to cursor algorithm. This would normally be very simple, but the implementation of the camera is making it difficult.

As the camera zooms in and out, the pitch of the camera (angle relative to the ground) changes. At its farthest position from the ground, it looks nearly directly at the ground, and at its closest position, it looks at about a 40 degree angle toward the ground.

This greatly complicates the method for zooming into a mouse position on a non-uniform 3d terrain.

Specifics:

More details for those who are still interested in trying to help.

The camera is implemented in unreal engine using a spring-arm (basically a large stick) attached to an actor that serves as the center of the screen. Zooming in and out simply requires us to shorten the spring-arm and change the angle of the spring-arm. moving the camera around the world is done my moving the actor around the plane at z=0 (0 height).

The problem then becomes: Where should my actor be after zooming in such that the point that the cursor is over doesn't change?

There is already an algorithm in place to determine the current pitch of the camera and the new pitch of the camera, so you can assume that information is already known. We can also easily find the new height of the camera, and the new distance between the camera and the actor (length of the spring-arm). We can fairly easily determine the point the cursor is over in the game world, and we can determine that point when it is projected along the plane at z=0.

I had originally tried implementing this using a naive solution based on some 2D trigonometry, but this didn't account for the direction that the new actor position would be in relative to the cursor position after the translation occurs. After working on this for as long as I have, I'm having trouble coming up with a new solution that also finds this value.

I'm thinking now that I can use an alternative method that would involve drawing a plane with the same normal as the camera using the vector directions of the actor and cursor position as corners, then rotating about a line going through the cursor position and scaling the new triangle to make it identical to the previous one when viewed from the camera. This, though, seems like it would be unnecessarily complicated, and expensive to implement.

I was wondering if anyone had a simpler solution (or any solution for that matter) that they know of for this problem. Or at least if anyone has some kind of direction they could point me in for finding out how I might be able to solve this problem in a reasonable amount of time without it being too computationally expensive.

Let me know if you need any more details.

(Programming language is kind of irrelevant here, so feel free to use whatever you want for explanation or examples, or just use English or pseudo code. I don't really expect anyone to write me an algorithm to do this, I'd just like some ideas on how I ought to approach this problem to keep me from ripping off my head)

Thanks,

Zac Taylor

sentences: How to write reuseable components for pygame Is there a recommended way to write reuseable components for pygame? Simple example would be a FPS counter. Should I write a class which has an init, update and draw method and call them from inside a game loop?

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:
Why do not Easy Mobile Pro scripts know about each other? I am getting this error when I try to build the project:

Assets\EasyMobile\Scripts\Modules\NativeAPIs\NativeUI\Nati
veUI_AlertPopup.cs(68,17): error CS0103: The name 'AndroidNativeAlert' does not exist in the current context

I tried adding this to my NativeUI_AlertPopup.cs:

    #if UNITY_ANDROID
        using EasyMobile.Internal.StoreReview.Android;
    #endif

Hint says unnecessary using.
Googling, searching Unity EMP forum and thread did not bring any results.
Unity version 2019.2 .net 4.x EMP 2.5
If I try adding a breakpoint it says:

The breakpoint will not currently be hit. Unable to find a corresponding location.

AndroidNativeAlert is a static class, have have no clue why it can't been seen from the other one.

sentences: Why is a baked normal map more efficient to render than additional physical detail? I was just contemplating about why I improve performance by baking additional details into the object rather than just rendering the more detailed model. How does the GPU get to take a shortcut to render potentially the same amount of detail on screen, just because the detail is represented in a different way?

labels: unity directx movement opengl javascript c# 2d c# opengl javascript animation game-design procedural-generation unity unity physics c++ unity unity sdl2 terminology unity physics android unity graphics c++ 2d opengl octree opengl java ios unity 2d cocos2d-iphone tools 2d terrain c++ xna html5 android 2d unity opengl unity physics rendering unity physics java xna html5 xna 2d mathematics procedural-generation xna java unity java unity publishing unity ios architecture matrix unity android-studio javascript cubemap opengl lighting directx java unity javascript unity procedural-generation c# shaders libgdx opengl unity unity unity path-finding path-finding c++ unity android pc xna unity mmo unity collision-detection xna architecture java c++ graphic-effects c++ unity unity sdl 3d unity unity collision-detection blender software-engineering unity gpu mathematics design-patterns c# box2d opengl xna unity 2d unity physics color unity udk unity architecture transformation 3d 2d tiles xna unity android camera legal 2d unity raycasting python game-design mathematics shaders 2d unity unity camera collision-detection udk unity unity 2d ios multiplayer unity c# unity andengine unity unity opengl java python unity unity unity ios unity distribution java python unity graphics xna libgdx opengl shaders xna lua c++ architecture c++ c++ algorithm xna opengl c++ procedural-generation tilemap 2d unity xna opengl java camera c++ c++ game-maker c++ opengl game-design game-maker unity directx java directx unity unity ai architecture xna unity c++ javascript unity animation java procedural-generation java unity pygame c++ xna unity animation collision-detection networking graphics unity game-maker libgdx matrix unity unity javascript java opengl c++ physics flash unity 2d sprites animation unity javascript flash java java unity 2d unity architecture xna movement unity simulations virtual-reality unity xna unity unity opengl unity hlsl unity waypoints audio unity c++ c# unity ios c++ opengl mmo python terrain textures opengl unity game-mechanics unity unity unity xna ios html5 c# intersection collision-detection unity camera procedural-generation opengl camera opengl java c++ 3d shaders facebook unity software-engineering java physics java java collision-detection unity xna java manuals architecture unity c# unity level-design game-maker rigging unity java open-source opengl c++ unity java software-rendering publishing unity shaders books libgdx objects physics unity graphics opengl unity minecraft-modding unity xna java rotation storyboard iphone physics unity html5 blender unity c++ unity blender java sprites 2d opengl unity c# textures sharpdx 3d c++ mathematics xna unity unity glsl textures 2d android android c++ unity javascript game-design opengl java python xna c# game-maker unity unity unity 3d unity c++ animation networking unity 2d unity java unity c++ animation opengl opengl-es mathematics networking textures unity unity loading unity unity effects unity xna accessibility c# performance physics-engine unity 3d physics opengl xna unity browser-based-games collision-detection rendering unity c# path-finding algorithm fund-raising unity 2d game-design flash unity unity camera xna game-design xna game-design c++ c# sdl2 java textures directx android xna unity 2d unity c++ xna-4.0 unity java unity opengl mathematics java unity monogame unity c# opengl c++ unity opengl animation game-loop c++ opengl xna music xna level-design unity unity c++ unity xna unity architecture 3d opengl unity collision-detection board-game graphics 2d collision-detection unity unity opengl-es2 unity camera collision-detection unity animation unity unity game-industry game-design 3d unity unity unity 2d java game-design java unity c++ unity opengl c# physx 3d javascript xna unity java xna opengl camera xna hlsl networking opengl android c# android 2d xna 2d input c++ c++ unity unity unity ai collision-detection physics libgdx algorithm xna unreal c# unity unity opengl shaders unity 2d unity opengl java c++ c++ xna unity android licensing javascript udk unity unity c++ iphone starcraft-2 minecraft-modding opengl opengl hlsl c# 3d unity unity javascript html5 performance cocos2d-iphone music architecture opengl java box2d geometry python directx11 opengl animation java c++ unity 2d python c# 2d opengl c++ unity c# smartfox opengl jobs unity quaternion flash unity unity unity game-design xna java android unity javascript unity libgdx unity unity mathematics actionscript-3 android unity performance unity opengl unity 3d unity education art unity rendering graphics c++ opengl c# architecture unity networking copyright unity 2d unity libgdx directx java c++ java unity legal unity unity roguelikes 2d xna unity unity shaders opengl java unity unity graphics java orientation unity shaders python unity unity libgdx unity unity unity 2d directx unity android terminology android c# projection architecture steam c# unity game-design unity animation java 3d xna unity sdl javascript unity algorithm 3d phaser unity algorithm unity game-loop textures collision-detection android unity sdl opengl antialiasing android c# browser-based-games 3dsmax unity xna opengl unity geometry java xna unity directx11 c++ opengl android isometric mouse c# mathematics html5 unreal-4 game-design spritesheet c# cocos2d libgdx sdl mathematics 3d assets javascript nintendo unity unity sdl2 opengl c++ asset-management c++ mathematics java animation loading unity game-design opengl unity directx game-design mobile unity unity c++ performance networking opengl c++ 2d textures game-industry unity graphics-programming camera java unity opengl opengl java maya unity iphone unity unity control directx11 iphone mathematics java unity opengl unity unity unity unity opengl c# unity xna-4.0 android 2d opengl opengl architecture java java architecture unity game-mechanics unity 2d tiles unity unity opengl unity opengl android legal directx9 ios android java collision-detection unity windows c++ java c++ opengl android c++ component-based unity 3d xna xna java game-design java textures gpu procedural-generation 2d unity java collision-detection game-design rendering java unity gui rendering libgdx 3d c++ directx xna shaders c# movement unity c# unity mathematics unity c# 3d c++ unity xna xna-4.0 xna java actionscript-3 unity unity unity adventure-game-studio facebook mmo libgdx c# c++ c# c++ collision-detection unity physics java geometry roblox unity unity algorithm iphone rotation c++ opengl game-design unity c++ java java game-design game-design game-design c# legal java opengl xna unity 2d libgdx cocos2d-iphone networking xna unity xna planning java storyboard xna c++ unity mathematics unity unity 3d java unity java physics unity unity sprites uv-mapping java 3d unreal input xna cross-platform unity c# unity opengl 2d unity c++ opengl xna java input c# c# opengl opengl xna c music networking unity directx9 directx mathematics unity frame-buffer c# opengl legal unity shaders 2d unity unity xna camera xna collision-detection legal unity unity c++ unity unity unity c++ unity unity unity xna c++ vector java sdl2 opengl-es unity tiles collision-detection c# c++ opengl 2d unity unity ai opengl unreal-4 blender xna unity opengl c++ python terrain-rendering multiplayer c++ screen opengl unity glsl xna 2d performance planning opengl c# unity unity c# xna textures opengl monogame unity opengl game-maker flash opengl java xna mathematics camera unity unity unity 3d architecture c# physics sdl unity unity unity c# c++ unity c++ flash unity unity actionscript-3 unity unity iphone unity project-management libgdx unity unity collision-detection game-design rendering c# camera unity iphone 2d xna textures input architecture game-design unity procedural-generation 2d xna-4.0 android java c++ java unity unity collision-detection unity unity c++ textures physics android legal iphone data-structure unity rpg collision-detection unity iphone c# directx9 2d unity opengl balance procedural-generation transformation ios c++ c++ java java unity tiles libgdx unity c# graphics-programming unity unity unity javascript unity opengl unity xna architecture sprites architecture 3dsmax unity cocos2d-iphone movement unity libgdx architecture unity physics java unity actionscript-3 xna-4.0 assets unity opengl c++ networking unity algorithm c# unity xna java unity libgdx opengl 3d collision-detection android unity c# unity algorithm rotation 2d android maya unity xna mathematics management c# unity sprites c++ unreal-4 unity unity game-design opengl 3d source-engine 2d opengl game-mechanics java opengl unity java java assets windows-phone-7 unity 2d mathematics c++ unity testing unity actionscript-3 c# controllers c++ unity unity xna unity opengl 3d xna jobs box2d android unity java 2d c# opengl game-design mathematics opengl c++ animation game-mechanics java xna projectile-physics algorithm 2d andengine godot unity xna unity 2d software-engineering game-design unity unity unity game-mechanics unity android opengl textures c++ game-loop c++ android android flash mathematics procedural-generation unity unity collider multiplayer udk opengl opengl user-experience unity textures mobile collision-detection unity opengl unity unity procedural-generation xna c++ opengl xna java opengl unity unity lua unity maps unity opengl unity android java c# box2d c++ java textures collision-detection unity unity collision-detection unity camera software-engineering android virtual-reality python glsl opengl-es2 xna unity free-to-play c++ c++ directx unity opengl rpg 2d physics-engine c++ unity textures unity unity opengl keyboard algorithm cocos2d-iphone c# libgdx unity graphics unity unity opengl c++ unity geometry physics unity graphics multiplayer c++ path-finding unity 3d c# unity mathematics xna unity xna unity java game-design 2d java unity c++ mouse unity unity opengl unity 3d game-design unity 2d physics unity shaders c# unity 2d camera game-industry xna c# unity directx 2d physics unity game-design android shaders unity unity xna path-finding unity mathematics unity directx unity 2d c++ directx11 xna opengl architecture mmo architecture c++ libgdx opengl path-finding c# opengl random flash fragment-shader windows unity opengl java unity javascript unity xna c# android unity networking opengl unity libgdx unity c++ opengl architecture file-format unity xna java c++ ios c# unity java bullet-physics 3d shadow-mapping blender matrix udk monogame server shaders unity c++ unity shaders java legal game-design unity unity directx opengl java opengl racing libgdx opengl unity unity graphics movement algorithm networking c# unityscript opengl sdl2 xna java 3d libgdx andengine xna game-maker color libgdx graphics-programming architecture collision-detection gui collision-detection legal game-loop camera unity 2d game-mechanics unity algorithm libgdx simulations directx10 directx9 c++ unity physics rendering unity unity java unity opengl opengl javascript unity opengl mathematics first-person-shooter xna xna-4.0 opengl unity c++ architecture opengl glsl collision-detection physics algorithm 2d unity unity unity unity unity licensing android opengl unity lua xbox360 animation unity opengl xna unity unity java java unity multithreading unity opengl c# c++ unity 2d sprites file-format 2d point-cloud c++ unity multiplayer opengl terrain python mathematics opengl android xna java opengl java xna 2d unity python terrain actionscript-3 sfml opengl unity multiplayer unity modding architecture physics unity java libgdx c++ sprites flash unity textures graphics path-finding unity unity opengl unity unity unity mathematics logic unity c++ unity movement xna 2d collision-detection xna ai vulkan game-design unity unity unity unity ios libgdx iphone multiplayer unity html5 c++ unity game-design unity tilemap android unity game-design unity unity unity c++ game-design unity directx textures mathematics unity game-design unity adventure-games physics udk c# xna unity directx11 architecture unity movement 2d unity unity sharpdx 2d iphone unity java development-speed c# mathematics xna education directx11 java game-design c++ graphics unity 2d unity unity unity directx unity procedural-generation c# physics directx11 c# xna publishing camera unity game-design xna c++ libgdx opengl opengl game-design opengl collision-detection architecture unity javascript shaders unity game-design java opengl c++ savegame unreal-4 unity terrain mathematics algorithm java opengl physics opengl 2d multiplayer unity xbox360 unity unity unity c++ competition unity unity education game-industry unity unity unity android unity unity unity opengl graphics-programming unity path-finding unity unreal-4 unity 2d physics unity 3d unity javascript unity voxels c# collision-detection project-management architecture rotation game-design ai unity unity c++ unity game-design unity unity unity unity mathematics networking game-design unity shaders architecture unity rpg shaders 3d unity opengl libgdx unity textures legal performance xna xna software-engineering shaders unity android javascript c++ game-design 3d xna unity perspective c# physics unity unity unreal-4 c++ multiplayer c# c++ unity c++ unity html5 unity ios rotation libgdx unity unity shaders javascript unity xna javascript libgdx unity android c++ unity xna unity opengl unity rendering 2d rendering game-design collision-detection camera unity directx java java unity unity unity obj 3d unity java unity game-industry business c# unity 2d unity android c++ game-design tiles architecture game-loop xna opengl c# javascript javascript unity unity tilemap terrain-rendering lua game-design networking game-maker directx11 c++ unity unity unity c++ 2d xna flash c++ opengl opengl logic unity unity mathematics unity unity 3d c++ unity collision-detection unity java c++ java c++ unity libgdx java entity-system c++ copyright unity unity unity c++ 3d-meshes udk 3d unity opengl unity java procedural-generation xna opengl game-design unity unity cocos2d-iphone hlsl unity unity unity game-design unity unity directx java 3d c# c# cocos2d-iphone opengl unity unity assets 2d 2d unity audio libgdx unity unity unity unity 2d 2d unity path-finding iphone opengl architecture unity java c++ 2d flash tilemap c++ c# databases ios unity android unity unity unity rotation html-canvas unity sprites 2d unity architecture unity tiles unity unity camera c++ mathematics c# game-industry opengl java opengl-es game-design sprites unity opengl unity path-finding collision-detection php unity unity unity unity xna xna unity unity xna procedural-generation c++ xna opengl unity unity c++ java opengl-es2 textures multiplayer unity legal actionscript-3 cocos2d-x-js entity-system assets unity unity directx11 game-design unity opengl opengl unity opengl iphone box2d movement mathematics xna udk unity 2d unity unity javascript game-mechanics c++ libgdx unreal-4 opengl unity unity box2d c++ unity c# hardware legal unity algorithm unity architecture unity unity game-maker unity shaders networking unity opengl c++ xna javascript terminology xna-4.0 c++ unity trigonometry android graphics unity unity xna game-industry xna levels testing unity 2d unity unity godot unity c# algorithm 3d unity cross-platform game-maker cocos2d-iphone collision-detection multiplayer xna c# 2d ios 3d opengl opengl collision-detection unity java sprites android unity unity java unreal-4 unity physics java windows-phone-7 unity c++ javascript unity unity xna opengl architecture tilemap unity ai c++ networking godot unity c# unity unity c++ 2d c# mathematics xna opengl javascript unity c# blender-game-engine opengl opengl 2d xna-4.0 libgdx java terminology java matrix iphone box2d collision-detection game-mechanics unity unity flash unity unity path-finding physics 2d unity unity bullet-physics unity unreal opengl xna unity libgdx opengl unity libgdx camera unity unity unity xna unity unreal 2d control c++ game-mechanics box2d 2d xna java collision-detection physics mathematics unity collision-detection collision-detection java unity unity 2d unity c# unity architecture xna android licensing unity physics opengl java java cocos2d-iphone blender xna opengl unity c++ java touch physics 2d unity unity mathematics 2d java java unity xna architecture unity javascript animation c# c# rendering sprites xna unity flash unity unity 2d game-design unity 2d unity unity c# unity xna unity c++ architecture game-design game-maker directx algorithm unity gui collision-detection unreal-4 xna game-industry c# c# algorithm c++ java unity java 3d lighting unity opengl unity waypoints control pygame c++ networking java flash unity unity unity unity java opengl unity game-design opengl java unity unity c# c# opengl unity java monogame java xna opengl java shaders xna c++ xna unity unity unity c++ collision-detection unity c++ unity tiles unity unreal-4 algorithm physics unity rotation unity sprites mathematics libgdx unity 3d c++ graphics marketing path-finding architecture unreal-4 browser-based-games xna unity phaser unity opengl c# c# 2d networking unity java unity xna unity events android 3d flash unity unity xbox360 physics c++ 3dsmax c# tools java physics shaders unity unity collision-detection architecture architecture game-industry graphics spatial-partitioning unity vector macos c++ procedural-generation server java physics unity android c++ unity c++ xna mmo c++ iphone unity lua unity collision-detection macos unity unity c++ mathematics unity rendering maps game-maker java mathematics opengl unity ios java game-design isometric leaderboards unreal-4 unity textures unity unity unity c# unreal-4 c# unity glsl xna opengl lighting unity ai flash c++ 3d unity android pygame xna networking directx algorithm ai game-design unity unity unity java c++ java unreal-4 2d 2d rotation matrix unity opengl unity unity unity c# unity unity unity unity textures unity android collision-detection ai sprites java animation java unity unity game-design opengl collision-detection unity java 3d-meshes android server unreal-4 unity unity javascript shaders webgl android android unity web lua legal java unity c++ c# monetization xna-4.0 javascript textures unity sfml c++ animation 3d unity shaders unity publishing unity opengl c++ unity unity xna unity xna savegame opengl unity unity software-engineering libgdx software-engineering physics-engine 2d unity godot mathematics graphics c# tools xna unity unity xna multiplayer unity 2d unity shaders c# unity xna mathematics java 2d opengl game-design c++ unity frustum-culling unity entity-component-system 3d unity cocos2d-iphone libgdx modding collision-detection unity python roblox gui textures 2d c# game-design user-experience unity textures unity graphics algorithm c++ mathematics javascript box2d c++ game-design networking unity opengl libgdx unity 3d unity textures c# html5 collision-detection c# unity android c# java copyright unity roblox java android java c++ textures c# legal game-design c++ xna unity game-design shaders unity xna unity shaders pygame architecture unity java physics c# unity architecture animation unity opengl java mathematics unity unity flash unity unity resolution c++ c++ game-design c++ entity-system unity unity mathematics java xna c# architecture opengl opengl opengl-es algorithm tiles mathematics unity opengl legal game-design collision-detection unity java 2d camera unreal-4 opengl particles opengl physics xna javascript java unity 2d unity opengl-es unity octree shaders steam unity xna-4.0 c# graphics-programming mathematics c# data-structure unity unity legal directx 3d blender-game-engine c# unity opengl opengl unity unity java 3d-meshes architecture ai c++ javascript java game-design unity minecraft-modding game-design physics c# unity java pygame 3d-meshes sdl2 steering-behaviors libgdx java android dev-groups mathematics game-design game-design unity entity-system unity c++ leaderboards xna entity-system c++ unity xna javascript mathematics control lua box2d c# 2d c# unity unity xna architecture java collision-detection unity javascript unity opengl rotation algorithm c++ algorithm physics physics-engine java xna java game-mechanics java opengl android xna java unity opengl 2d 2d mathematics special-effects collision-detection monogame client-server unity server c# unity unity collision-detection 2d c++ user-experience opengl 3d terrain android xna scene-graph directx c++ game-maker unity unity path-finding unity opengl xna models unity 3d-meshes collision-detection unity textures unity c++ 2d java 3d mathematics directx c++ vector unity algorithm lighting godot directx11 c# ai path-finding c# unity unity physics opengl unity 2d angelscript unity opengl c# directx unity animation directx unity timer opengl mathematics c# xna java box2d unity rpg unity unity unity unity textures unreal-4 java c# geometry python opengl architecture mathematics procedural-generation phaser opengl c# corona-sdk unity xna unity c++ unity javascript ios unity unity unity unity android java java opengl unity unity mathematics unity unity unity unity directx xna c++ ai unity xna game-loop tilemap movement architecture unity opengl unity physics opengl xna java unity projectile-physics legal collision-detection android 3d animation unity unity unity animation game-design collision-detection 3d xna random xna opengl unity rpg game-design xna unity unity actionscript-3 c++ opengl architecture game-loop unity rendering xna java unity javascript c++ node.js unity opengl opengl opengl opengl directx libgdx graphics c++ unity c++ directx unity game-design c++ c# opengl procedural-generation security xna xna unity 3d unity unreal-4 c# rendering opengl c++ c# unity java java xna c++ opengl 2d opengl physics 3d java unity unity raycasting tiles mathematics c++ glsl procedural-generation unity mathematics unity first-person-shooter unity opengl game-industry unity c++ opengl-es2 unity raycasting directx c# unity unity architecture 3d jmonkeyengine c++ xna unity 2d unity unity collision-detection c++ unity javascript opengl 2d directx9 android unity javascript java unity unity opengl glsl unity collision-detection c# unity c++ opengl mathematics unity sky unity opengl xna opengl unity java android andengine unity opengl java xna xna maya unity flash unity opengl android rendering unity libgdx javascript android c# animation shaders godot flash 2d c# python c# libgdx c unity unity unity 2d c# unity xna minecraft-modding deferred-rendering xna business unity ai unity c# game-design java game-loop tiles jobs textures unity multithreading c# unity physics lighting unity 2d c# c# opengl open-source javascript unity c# physics python game-recording unity xna networking c++ game-design unity unity java vector game-design unity algorithm opengl multiplayer c++ opengl 2d javascript shaders javascript collision-detection unity tilemap unity unity textures c# opengl-es mathematics game-design algorithm game-mechanics networking unity unity c++ xna physics xna 3d unity unity opengl unity java xbox360 architecture game-design javascript xna c++ multiplayer javascript optimization textures unity unity c# unity animation python unity rotation animation unity unity game-design c++ tilemap opengl opengl unity algorithm unity opengl unity 2d game-mechanics physics unity 2d graphics c# xna opengl unity unity rendering opengl unity hlsl path-finding unity collision-detection 3dsmax unity unity rendering opengl unity opengl unity c# mathematics xna textures client-server xna xna 2d shaders unity corona-sdk networking camera browser-based-games unity godot algorithm xna c++ game-design game-design efficiency maps 2d c++ xna-4.0 unity browser-based-games unity unity character html5 path-finding unity javascript multiplayer collision-detection unreal-4 unity game-maker algorithm unity unity javascript unity xna unity unity android c++ ios javascript architecture unity opengl bullet-physics unity c++ python cocos2d-iphone unity monogame java camera 3dsmax opengl c# game-industry opengl java opengl asset-management terrain sharpdx c++ unity c++ xna appstore libgdx path-finding unity c++ blender ios unity game-design xna 2d unity unity geometry unity unity collision-detection xna unity java android actionscript-3 c# physics graphics databases unity steam software-engineering java selection networking glsl rendering camera unity game-design actionscript-3 unity antialiasing rigidbody c++ java textures c# c++ xna game-design opengl javascript game-design unity opengl-es unity tilemap unity libgdx tiles unity javascript c# collision-resolution shaders game-industry java physics xna unity algorithm unity objective-c unity tools unity physics 2d opengl 3d models opengl lighting game-design java opengl physics shaders java textures unity unreal tools unity unity c# transparency opengl java opengl textures unity animation box2d animation unity maps mathematics java unity c++ java unity unity unity software-engineering unity unity unity opengl 3d java 2d logic unity jmonkeyengine xna game-maker unity gui c# unity tools unity architecture tools rotation ranking lighting tiles unity mathematics java 2d unity c# unity c++ iphone c++ unity unity flash mesh objects xna-4.0 xna xna opengl c# android unity directx mathematics algorithm minecraft-modding tools android unity xna collision-detection unity game-mechanics inventory architecture c# godot unity xna unity pygame java collision-detection c# physics opengl glsl opengl opengl opengl xna unity opengl c# c# 2d unity unity architecture directx unity c# multiplayer java opengl opengl unity unity cocos2d-x c++ game-design procedural-generation collision-detection unity collision-detection unity xbox360 cocos2d unity architecture opengl unity html5 unreal-4 opengl unity c++ unity 3d unity unity client-server game-maker unity input unity unity xna unity collision-detection c# timestep c++ 3d unity godot directx11 unity unity marketing assets c++ java xna c# behavior box2d unity game-maker graphics unity c# opengl xna coordinates component-based unity unity javascript collision-detection java xna libgdx unity c# xna unity unity collision-detection assets opengl c++ animation xna unity c++ unity c++ c# javascript unity ogre xna opengl wpf unity java security c++ unity mathematics graphics unity c# collision-detection c++ android algorithm game-design unity c++ procedural-generation opengl 3d floating-point c++ opengl xna opengl ai java path-finding multiplayer opengl mmo opengl unity lua entity-system xna unity multiplayer movement procedural-generation java xna unity unity voice java xna unity xna graphics algorithm java java unity xna-4.0 3d web 2d java c# unity physics mathematics unity hlsl flash space-partitioning opengl unity javascript opengl unity android unity unity c++ box2d 3d c++ java unity unity game-design c++ android xna architecture c++ xna physics modding sprites monogame mathematics java audio android iphone opengl game-design opengl unity simulations textures mathematics unity mmo unity unreal unity unity unity unity architecture sound unity input textures architecture opengl libgdx unity c# unity planning libgdx 2d color unity game-design shaders c# actionscript-3 unity ios deployment unity ios java collision-detection 3dsmax unity mathematics blender game-maker-dnd unity unity unity game-design shaders 3d unity unity c# c# java flash game-design console textures opengl game-maker java 3d marketing c++ java javascript development-speed unity java unity javascript xna gui algorithm 2d physics unity 3dsmax xna 3d ios opengl android c++ opengl unity unity unity architecture 2d game-design performance directx11 unity c++ rpg unity algorithm android opengl box2d flash c++ terrain-rendering unity unity javascript android 2d unity xna opengl lua input opengl rotation c++ unity behavior-tree c# opengl android java xna unity libgdx unity game-maker architecture java directx unity android java opengl sprites unity unity c++ unity xna software-engineering xna graphics box2d unity c# file-format c++ sfml unity shaders flash opengl graphics java unity unity xna unity movement c# c# unity 3d animation directx11 xna terrain c# unity android game-maker unity java legal java copyright godot libgdx unity xna shaders 2d unity cocos2d-iphone algorithm shadows c# networking collision-detection directx11 java havok unity unity algorithm xna-4.0 rotation three.js unity databases unity xna 2d unity algorithm unity opengl physics 3d collision-detection unreal-4 animation unity scripting 3d browser-based-games android unity unity unity path-finding java xna architecture xna unity graphics unity architecture directx unity c++ c# java unity c++ libgdx xna collision-detection unity c# c# collision-detection movement software-engineering c# opengl c++ c# collision-detection 2d 2d libgdx unity game-design html5 opengl xna game-maker c++ xna mathematics opengl opengl c++ xna collision-detection opengl 2d architecture opengl opengl textures game-maker c++ unity unity mathematics c++ godot c++ unity opengl collision-detection libgdx unity game-design unity python jmonkeyengine unity architecture databases geometry unity level-design c++ php vector 2d android unity opengl xna hlsl c++ python unity java opengl libgdx opengl xna-4.0 xna unity xna c++ opengl unity javascript andengine unity scene-graph architecture javascript client-server 3d android 2d javascript game-design opengl 2d architecture ios animation unity android software-engineering c++ physics unity 2d joystick networking unity mathematics collision-detection c++ java opengl java unity monogame libgdx java path-finding sdl path-finding unity opengl android xna raytracing unity level-of-detail unity unity libgdx opengl game-design unity unity unity graphics unity opengl unreal-4 marketing architecture camera 3d unity geometry libgdx xna android unity unity xna collision-detection minecraft-modding 2d xna unity java opengl unity unity unity opengl iphone 3d unity ai quake3 xna xna shaders color opengl 3d c++ collision-detection unity c++ unity unity opengl unity javascript business opengl 2d 3d 2d unity data-structure unity game-design path-finding mathematics xna box2d audio libgdx unity unity opengl loading xna xna 3d c++ unity android java camera c++ architecture c++ cocos2d-x game-maker unity tiles opengl unity flash 2d c# xna 3d opengl-es2 unity unity game-design xna-4.0 unity architecture xna java unreal-4 java 3d 2d unity graphics 2d textures javascript unity shaders opengl javascript opengl unity vector 2d java 3d-meshes java c++ unity rendering unity unity c++ unity xna 2d xna javascript facebook normals c++ camera mathematics c# deployment collision-detection directx 2d game-design xna unity algorithm unity unity c++ sprites 2d unity unity ios 2d directx11 textures unity coordinates unity 3d console libgdx c# procedural-generation 3d interpolation unity unity graphics java unity random c# unity opengl opengl rendering unity lighting xna c++ 3d actionscript-3 rendering xna-4.0 c# opengl frame-rate collision-detection unity javascript mathematics sfml spritekit xna-4.0 design-patterns algorithm android unity physics flash 2d 3d java java unity unity php libgdx directx sdl javascript sprites multiplayer unity xna 2d unity andengine unity unity textures c++ unity glsl 3d unity c# opengl xna file xna animation unity unity unity sales project-management xna-4.0 software-engineering animation collision-detection xna-4.0 c# physics unity unity unity multiplayer mathematics unity cocos2d-iphone animation maps leaderboards c++ legal libgdx unity directx xna unity c++ java java javascript xna shaders c++ c# c# opengl cocos2d-iphone unity opengl collision-detection game-maker animation xna sprites unity c++ unity 2d c# physics sprites mmo game-design collision-resolution mathematics 3d cocos2d-iphone game-design unity c# mobile unity project-management unity 3d c# c++ c++ unity unity unity xna 2d sound-effects xna mathematics opengl opengl c++ physics unity physics opengl unity game-maker c++ c# xna game-design c++ libgdx google-play software-engineering opengl 2d cocos2d-iphone libgdx opengl unity opengl unity keyboard 2d unity opengl ios unity unity c++ game-design algorithm textures controllers collision-detection unity 2d game-maker physics unity java java unity tetris game-design unity unity unity unity xna vulkan libgdx opengl physics unity animation unity libgdx c# unity xna entity-system separating-axis-theorem unity c++ xna java glsl android unity c++ c++ c# directx mathematics unity c++ unity unity networking c# 3d xna unity java opengl c# game-maker unity xna xna c# java ruby java graphics optimization c# unreal-4 java lua opengl unity unity javascript game-design flash unity modding unity unity opengl opengl opengl opengl c++ unity multiplayer unity unity textures c++ game-design 3d unity game-design unity c java architecture c# graphics camera game-design 3d terminology c++ python c++ unity c++ business unity graphics game-loop unity shaders opengl marketing xna c c# opengl game-maker xna 3d android java 3d xna xna c# directx c# unity scripting 2d unity mathematics unity c++ unity unity unity c++ mathematics c# rotation minecraft-modding iphone java networking unity unity multithreading directx xna physics animation c++ java c# android game-design unity directx unity c# sprites directx11 opengl unity shaders libgdx php c++ unity xna rendering java gimp geometry python android c# unity ai c# c# c++ opengl java java game-design xna java libgdx c++ java sprites java mathematics unity c# unity unity unity ai rendering java unity 3d unity graphics mathematics unity 2d data-structure rotation xna java c++ iphone c# opengl opengl collision-resolution box2d unity java game-design physics unity unity unity opengl opengl java java xna unity opengl 3dsmax unity c++ java iphone ios animation unity unity blender java c++ 2d opengl actionscript-3 unity performance algorithm collision-detection opengl libgdx opengl unity iphone python graphics unity c# physics java unity unity legal unity box2d c++ maps tilemap flash xna-4.0 3d c++ c# unity unity shaders opengl unity 2d opengl javascript c++ shaders game-design c++ xna xna xna c++ unity rotation java physics unity unity javascript networking unity unity 2d java opengl mmo opengl opengl android java unity opengl marketing xna unity unity grid unity sprites assets unity c++ java libgdx unity networking algorithm geometry c++ opengl webgl unity unity opengl c++ c++ browser-based-games collision-detection collision-detection unity 3d libgdx c# graphics-design heuristics c# unity java unity ai c# java unity unity java opengl-es pygame android unity xna andengine c# xna 3d javascript unity java c# xna unity ai animation android opengl unity unity multiplayer ios entity-system c++ android performance unity xna unity unity unity opengl c++ inventory xna unity 2d physics unity directx11 java collision-detection opengl-es2 networking opengl unity unity python xna xna rpg xna unity monogame libgdx c# unity sprites unity opengl unity sdl2 2d physics sprites unity c++ opengl libgdx unity architecture xna iphone xna opengl directx11 opengl physics 2d c# c++ collision-detection ai opengl unity unity unity unity collision-detection textures opengl unity unity animation procedural-generation architecture tools multiplayer opengl opengl c++ 2d opengl c# unity directx cocos2d-iphone c++ java unity xna flash xna unity 2d c# bullet-physics java hlsl path-finding unity roblox 3d game-design 2d java unity unity c++ java gui opengl unreal flash xna unity opengl c# shaders game-design python unity shaders unity unreal-4 c++ python c# unity maya unity architecture unity html-canvas 2d c++ 3d opengl unity google-play-services c++ xna iphone game-mechanics opengl procedural-generation physics godot collision-detection c# directx tilemap java game-maker unity java unity design-patterns unity particles unity c# xna xna-4.0 directx architecture unity racing rotation xna unity unreal opengl c# android unity component-based xna unity android unreal-4 unity c++ unity opengl scene-graph unity movement intersection unity xna-4.0 unity 3d c++ lwjgl collision-detection shaders architecture networking java pygame modding unity unity flash javascript tilemap 2d mathematics 3d vector unreal xna opengl javascript unity adventure-game-studio blender unity unity mathematics mathematics c++ opengl cocos2d unity animation unity software-engineering unity java unity tiles opengl unity unity unity mathematics xna unity unity xna collision-detection unity c# collision-detection java unity java 2d algorithm physics unity copyright unity unity unity game-design collision-detection legal xna visual-studio c# game-mechanics animation iphone performance unity unity graphics unity unreal c++ 3d-meshes animation game-design opengl java unity tools directx playstation4 open-source architecture movement random unity 3d camera flash unity java java multiplayer opengl multithreading collision-detection javascript xna xna opengl opengl unity collision-detection unity unity unity directx lua 3d-meshes 2d opengl architecture c++ xna algorithm flash xna source-engine ai xna voxels c++ javascript 3d 3d blender android architecture directx architecture path-finding game-design networking c++ game-design unity libgdx c++ unity java architecture mathematics unity phaser tilemap legal non-photorealistic c# game-design opengl legal mathematics android unity actionscript-3 unity physics collision-detection unity c++ c# unity 3d physics assets unity monogame collision-detection libgdx opengl path-finding xna python xna collision-detection unreal-4 unreal-4 unity c++ c# unity procedural-generation c# unity opengl c++ unity architecture 2d c++ android java opengl algorithm unity udk java entity-system 3d shaders opengl multiplayer unity unity lighting unity python unity textures unity architecture java unreal-4 unity unity unity xna line-of-sight unity opengl 2d sdl 3d unity probability c# opengl unity unity c++ art unity java collision-detection java javascript unity entity-system unity 3d legal ai mathematics refactoring unity opengl unity copyright path-finding java java 3d unity c# unity opengl interactive-fiction unity rendering appstore tilemap 3d c# 2d rpg scoring geometry networking directx11 unity andengine c# animation networking c# opengl unity python unity unity mathematics unity sprites music xna javascript unity software-engineering android box2d c# unity unity java opengl unreal-4 html5 opengl unity 2d android c# mathematics unity c# xna ios java c# opengl shaders unity copyright xna coordinates marketing xna gui unity interpolation textures minecraft-modding music game-mechanics c++ game-design opengl-es raycasting java 3d opengl directx game-design xna user-experience ios javascript game-state 2d mathematics unity unity c++ unity 3d-meshes open-source unity unity actionscript-3 iphone 3d java java opengl java libgdx leaderboards python opengl unity directx unity c# collision-detection mathematics unity unity java android xna xna unity unity opengl unity c++ audio unity unity sdl input javascript unity animation maps flash collision-detection python opengl 2d xna ai unity events java unity algorithm unity terrain-rendering opengl fluid-dynamics unity libgdx anti-cheat android rpg-maker javascript unity xna rotation opengl mathematics xna 2d textures animation sprites xna xna java 3d unity unity opengl design-patterns unity directx unity collision-detection unity unity xna c++ c++ unity c# libgdx unity javascript c++ 2d unity flash xna javascript collision-detection architecture c++ unity unity java polymorphism game-design 2d camera android unity textures unity unity c++ libgdx algorithm xna xna direct3d12 unity opengl unity unity opengl unity opengl-es2 unity unity android pygame architecture unity xna 3d xna-4.0 opengl mathematics glsl android unity scripting camera collision-detection unity unity mathematics xna physics opengl libgdx c++ xna mathematics javascript java javascript box2d shaders unity legal events c# opengl art opengl parallax-scrolling unity xna unity unity c++ software-engineering unity xna oculus unity opengl unity unity c++ ai c++ xna libgdx sprites xna legal tiles unity java android unity opengl c# collision-detection ai multiplayer 2d gui unity xna android 2d c++ java xna python opengl memory shaders directx lighting unity mathematics 3d libgdx c++ opengl java c++ unity unity movement c++ xna unity unity 2d xna networking unity 2d opengl android camera iphone rpg opengl opengl 2d unity algorithm hlsl pc game-loop opengl game-design java c++ opengl mathematics textures c++ xna unity javascript game-design android xna unity unity unity opengl unity directx11 c++ unity java mathematics c# multithreading algorithm game-design unity c# flash leaderboards 2d c# collision-detection monogame camera game-design unity java state c++ 2d xna opengl unity audio unity xna unity unity c++ resource-management unity algorithm unity android tools java unity android opengl 2.5d opengl game-design c++ shaders unity c# mathematics physics 2d c++ opengl unity unity unity unity unity php game-mechanics unity collada ogre 2d xna animation unity unity opengl terminology udk unity c++ java isometric java java performance animation construct-2 box2d xna unity opengl textures 2d unity unity collision-detection opengl unity opengl java antialiasing server unity unity 2d opengl appstore lighting ai java xna unity unity node.js 2d c# geometry networking unity unity color opengl unity c# xna unity c++ c# shaders opengl java 3d c# game-design unity copyright xna xna android opengl user-experience platformer flash unity 2d unity rendering c++ networking c mmo xna xna game-mechanics raycasting 3d c# 2d c++ unity xna libgdx iphone opengl ai unity physics opengl unity c++ algorithm mathematics unity opengl unity opengl libgdx unity java collision-detection collision-detection xna mathematics unity 2d unity sprites shaders c++ replays c++ c# c++ algorithm unity javascript software-engineering motion unity cross-platform c++ java game-design unity physics unity xna physics algorithm algorithm unity unity architecture xna xna android unity andengine unity unity unity multithreading tilemap unity xna procedural-generation unity unity architecture shaders unity flash c# javascript networking unity xna c++ unity unity maps unity godot unity opengl rendering mathematics unity xna javascript curves unity game-design game-design xna xna unity unity opengl rendering unreal unity unity android opengl c++ shaders unity transformation unity unity unity algorithm xna-4.0 java udk unity udk libgdx 2d textures collision-detection java unity opengl box2d unity timer ai animation c++ unity mathematics xna javascript unity unity ios unity scala android c++ c++ c# unity unity libgdx c# 2d unity unity random xna xna unity modding unity physics graphics unity graphics physics shaders c# modding c++ python java audio unity unity component-based xna 2d architecture unity opengl aabb java android unity opengl c++ porting c# xna-4.0 opengl opengl networking algorithm textures networking unity cryengine xna xna opengl c++ c++ c# 3d lighting textures unity java unity unity unity tiles shaders unity directx c++ performance xna opengl opengl libgdx javascript directx xna opengl architecture xna xna ai opengl unity xna java android xna modding unity c# unity audio opengl game-design c# glfw c++ testing unity libgdx unity iphone unity c++ mathematics xna java 2d c++ android unity c++ unity mathematics architecture unity 2d game-design unity sdl2 android tiles java algorithm mathematics opengl game-design unity game-design unity actionscript-3 unity graphics collision-detection unity unity android unity android directx10 unity collision-detection shaders unity sdl2 directx11 game-design java business opengl mathematics asset-management unity copyright c# iphone xna unity 2d loading xna java c# collision-detection networking unity opengl unity game-design modding opengl voxels unity unity opengl unity opengl c++ unity 3d directx opengl shaders c++ c++ unity c# unity ai unity unity terrain c# rendering xna-4.0 collision-detection game-design ios c++ unity unity unity cocos2d-iphone java android collision-detection unity iphone unity blender software-engineering java xna unity c# opengl project-management c++ game-loop opengl unity directx unity java c# c++ xna xna collision-detection c++ gui game-design 2d libgdx game-loop unity legal andengine .net projectile-physics android physx 2d javascript unity unity game-mechanics unity modding mathematics networking unity unity unity 2d c++ opengl-es terrain unity java xna directx11 unity architecture unity opengl game-design unity unity c++ unity models unity xna-4.0 unity xna unity c# javascript facebook libgdx monogame unity graphics unity raytracing libgdx architecture physics game-design java opengl xna mouse java unity c++ c# unity 2d xna-4.0 physics c# unity unity c++ c++ android 3d game-maker c# opengl java matrix unity algorithm mmo software-engineering shaders unity rendering unity path-finding libgdx c++ xna unity opengl java unity unity rotation algorithm unity physics collision-detection python hlsl monogame game-design platformer unity opengl unity networking ai c++ unity c++ opengl unity game-design software-engineering terrain game-design directx11 xna unity unity c# unity unity unity unity unity c++ unity 2d sprites 2d box2d java c++ 2d networking c++ unity xna xna unity java unity xna box2d opengl-es unity cross-platform unity unity android 3dsmax 2d procedural-generation javascript unity unity multiplayer xna c++ box2d glsl html-canvas unity physics c# 2d unity c++ opengl models algorithm opengl unity xbox360 rotation performance unity android opengl collision-detection xna xna blender android xna opengl opengl xna java unity unity xna java graphics 3d xna unity sprites c++ unity networking xna unity unity algorithm unity opengl opengl server graphics ios c# architecture opengl rendering unity java algorithm directx unity unity unity ai c++ mathematics opengl 3d special-effects unity unity 2d android unity opengl shaders opengl unity unity pygame 3d opengl c++ 3d collision-detection unity unity lua unity opengl databases libgdx c++ java c++ c++ c# fmod textures android opengl unity opengl opengl c++ unity transformation opengl md5mesh shaders mathematics unity unity windows animation software-engineering cocos2d-iphone xna ogre tools camera c++ unity unity unity c++ xna legal projectile-physics 2d architecture cocos2d-x unity unity ai unity c++ c# c++ mathematics unity unity xna unity level-design 2d android mathematics c++ java opengl c++ unity opengl-es physics android javascript unity collision-detection tiles sprites javascript directx11 fixed-timestep c# box2d unity xna unity java java unity xna mathematics 3d unity unity algorithm phaser c# unity opengl unity directx11 2d cocos2d-x game-design unreal-4 unity c++ c# 3d algorithm unity android xna c# c++ mmo unity unity steam libgdx mathematics algorithm opengl unity physics architecture xna textures unity xna rotation 3d opengl unity opengl 3d unity c++ iphone monogame unity opengl unity opengl 3d-meshes libgdx java procedural-generation physics unity resolution unity java xna java path-finding unity c# textures cocos2d-iphone architecture unity mathematics unity algorithm unity unity unity networking java camera opengl physics legal opengl c++ legal javascript opengl game-design physics unity c++ unity monogame mathematics c# unity unity unity unity entity-system unity unity javascript box2d 2d unity c# cocos2d-iphone xna unity physics matrix c# game-design unity opengl xna-4.0 unity browser-based-games unity unity unity libgdx 2d unity unreal-4 camera 3d collision-resolution unity javascript flixel opengl-es game-design javascript unity multiplayer unity xna 2d java unity opengl java c# android unity hdr opengl directx11 unity 3d unity unity algorithm platform collision-detection unity mmo unity c++ 2d unity c++ unity unity c# shaders java 3d unity ruby unity directx9 java community-management unity ai graphics libgdx mathematics windows java unity html5 3d mathematics design-patterns xna java unity opengl architecture box2d loading mathematics libgdx java geometry c++ mathematics opengl xna multiplayer c# xna unity collision-detection c# path-finding c++ xna unity mesh unity path-finding java unity unity path-finding software-engineering blender opengl javascript unity libgdx opengl xna rendering opengl c# python c# steam procedural-generation unity xna java game-maker hexagonal-grid c++ libgdx flash blender collision-detection graphics data-structure opengl game-design opengl gui networking unity unity procedural-generation unity c# unity html-canvas java data-structure opengl unity opengl open-source unity unity c# xna unreal-4 opengl box2d xna c# android unity unity libgdx opengl opengl materials c++ unity unity unity xna xna physics spritesheet unity unity unity opengl game-maker unity java path-finding javascript pygame mathematics gpu sdl mathematics unity unity game-design java unity andengine cocos2d-iphone game-design unity unity xna input libgdx libgdx java multithreading career shaders xna c++ unity javascript opengl java lua opengl optimization algorithm libgdx game-design game-industry client-server unity animation terminology 2d c# unity unity game-design algorithm corona-sdk unity java unity unity directx libgdx c# glsl c++ tiles ai rpg game-design android opengl unreal-4 unity rendering unity unity libgdx opengl game-design lwjgl c++ collision-detection c++ installer unity xna libgdx 2d opengl unity c++ mathematics 3d unity java c# unity game-design unity c++ coordinates component-based unity android 3d java c++ movement c++ c++ transparency c++ path-finding javascript unity unreal-4 unity 3d game-design java 2d lua opengl graphics unity unity maps unity libgdx spatial-partitioning terrain distribution rendering movement game-design vector unity opengl rendering c# java architecture unity xna ai unity unity 3d java java xna unity unity unity java opengl opengl unity android music unreal-4 unity unity c opengl client-server android java libgdx algorithm javascript c++ unity unity optimization unity gui game-design shaders animation java opengl unity performance game-design python unity networking sprites unity sprites mathematics libgdx game-mechanics performance input unity python rendering unity ogre unity java cocos2d-iphone unity software-engineering textures android unity collision-detection xna flash playstation3 pyglet xna directx unreal c# opengl xna opengl uv-mapping directx11 c++ xna opengl algorithm unity android c++ unity game-design java game-design unity directx11 c# game-design opengl unity game-design java game-design collision-detection slick xna c# c++ javascript c# architecture javascript game-design java xna unity path-finding unity unity xna opengl game-design input java algorithm xna directx c# c# iphone c++ image terrain allegro sql multiplayer java 2d physics opengl opengl maps animation xna unity flash steam libgdx unity 2d 2d rts unity unity unreal unity architecture c++ assets opengl unity animation ios unity xna unity unity geometry localization unity rpg java sdl c++ c# iphone 3d 2d unity unity directx unity unity android 3d unity unreal-4 mathematics networking text 2d unity browser-based-games c++ c++ architecture directx c# models unity multiplayer unity collision-detection android matrix voice unity unity rendering unreal mathematics libgdx map-editor unity unity 2d libgdx directx unity procedural-generation libgdx java xna unity opengl opengl 2d javascript directx unity unity opengl unity unity xna unity viewport libgdx libgdx graphics unity libgdx java cocos2d-iphone directx game-design c++ lighting c++ unity textures 2d java unity unity opengl javascript opengl unity rigidbody unity shaders unity c++ libgdx unity opengl android unity 2d c# c++ unity java php blender unity unity xna android unity 3d java textures directx11 game-loop physics unity opengl unity unity physics 2d software-engineering legal android c# 2d phaser unity c# unity game-design c++ flash libgdx java unity xna unity unity c++ unity deferred-rendering c++ databases unity unity c++ unity android animation 2d libgdx physics game-design java unity xna face algorithm scripting java unity xna opengl mathematics opengl unity 3d unity libgdx 3d unity unity unity xna c++ projection unity unity physics 3d unity monogame architecture path-finding unity xna game-maker loading xna unreal-4 path-finding opengl unity 3d state c# c# c++ opengl xna c++ unity level-design c# unity path-finding unity opengl c++ html5 game-mechanics c++ xna java mathematics rendering c++ java 2d first-person-shooter maps unity unity c# rendering unity collision-detection architecture unity algorithm unity c++ collision-detection unity unity c# game-design rendering collision-detection 3d 2d project-management legal xna unity shaders unity 3d unity unity xna xna unity unity rendering unity unity android algorithm algorithm opengl c++ unity opengl noise unity android java unity animation 3d unity tilemap opengl unity graphics android 2d java textures unity javascript vector box2d directx libgdx 3d-meshes java xna unity movement godot javascript cocos2d-iphone unity c# mouse timing 2d opengl game-design unity mathematics unity mathematics unity opengl libgdx android unity ios sdl 3d unity opengl javascript collision-detection xna tower-defense unity collada textures google-play java game-design opengl game-design c# unity hlsl modding c++ unity java shaders game-design unity unity textures rendering physics unity unity javascript animation unity 3d textures android legal c++ rotation c# performance collision-detection xna 3d java xna graphics graphics movement 2d android javascript game-design xna unity directx java 2d directx android c# c++ javascript unity spritesheet editors javascript xna unity libgdx box2d unity server mathematics xna unity unity android unity java 3d server unity c++ c++ opengl unity mathematics textures opengl rotation entity-system xna game-design opengl xna actionscript-3 game-maker unity c# opengl entity-system java game-loop rendering unity unity ai unity career unity udk xna game-design textures unity game-mechanics unity architecture pygame shaders community-management html5 directx mmo javascript unity c# unity unity game-design 3d c# monogame unity c# opengl c++ opengl xna sprites c# c++ java unity networking java mmo c++ input collision-detection unity directx unity html5 node.js ios c++ opengl unity debugging software-engineering android unity java unity xna game-design game-maker 2d collision-detection unity unity unity marketing unity unity python algorithm c++ unity java maps unity unity unity android shaders opengl mmo unity architecture c++ iphone java xna 2d component-based java libgdx unity unity physics libgdx c# unity xna java 2d c++ c++ c# google-play android opengl physics sfml xna optimization opengl xna ai path-finding algorithm unity java movement unity unity terrain unity unity opengl tutorials unity unity textures android normal-mapping javascript unity unity sharpdx collision-detection directx11 unity unity unity c# unity java opengl xna-4.0 unity 2d unity unity unity android android unity 2d libgdx unity c# component-based unity unity unity java 2d unity ios physics java c# xna mathematics 3d-meshes 3d 3d camera unity libgdx c++ jbox2d xna xna c++ 3d c++ unity mathematics unity unity libgdx unity opengl opengl lua unity unity java unity android opengl unity tools unity unity ai bullet-physics c++ unity game-design cocos2d-iphone c# unity pc databases c++ unity sprites input 3dsmax xna path-finding architecture unity unity data-structure javascript html5 android server c# java c++ 2d java c++ xna algorithm mathematics opengl xna data-structure c++ unity unity phaser c++ opengl c++ unity collision-detection unity unity physics xna algorithm cocos2d unity xna unity iphone c# xna fsm unity ai opengl unity unity c# textures unreal-4 unity physics unity xna c++ unity unity unity java opengl android unity javascript collision-detection multiplayer java unity input unity models c++ unity mathematics unity unity c++ java matrix unity flash unity models unity unity unreal-4 unity graphics-programming graphics c# unity unity sdl2 level-design c# java jobs interpolation algorithm facebook rotation opengl networking animation legal unity ai game-design entity-system c++ unity unity unity unity directx c# publishing unity level-design 2d java unity game-design unity java unity cocos2d libgdx unity algorithm unity content-rating unity java libgdx unity c++ xna unity .net java architecture animation unity rotation c# unity xna movement javascript directx unity java box2d audio unity ios java copyright 3d path-finding shaders xna unity c# unity unity cocos2d-x movement opengl opengl unity iphone 2d 2d opengl unity html5 unity unity entity-system opengl mesh unity game-design collision-detection c++ unity android isometric unity java unity opengl c# collision-detection c++ opengl c++ java java textures java game-design unity android antialiasing unity opengl opengl game-design 2d game-design opengl c# unity directx unity collision-detection game-design multiplayer c# unity unity unity android c++ 2d c++ c java animation glut c++ java xna rotation unity cocos2d-iphone opengl c# game-design opengl javascript hlsl c++ c# unity c# xna unity java parallax-scrolling android java unity shaders ios udk opengl collision-detection game-mechanics textures unity java game-maker xna java javascript mathematics unreal-4 graphics unity unity opengl unity xna android component-based unity unity opengl iphone 2d unity maps android java c++ legal algorithm unity unity java 3d unity unity game-design opengl c++ assets java collision-detection game-design sdl libgdx unity unity unity geometry c++ box2d turn-based c++ c++ architecture compression android textures c++ unity opengl javascript nintendo unity architecture c# unity unity opengl unity android unity android c++ 2d unity xna opengl-es three.js unity education mathematics c++ sdl testing c# unity 3d unity 2d architecture software-engineering unity multiplayer playstation4 vertex directx11 c++ unity game-design unity libgdx networking algorithm flash unity javascript android c++ iphone unity opengl unity teamwork ai mathematics game-maker unity unity collision-detection unity unity libgdx unity ios java java unity java c++ xna c++ java 2d c++ path-finding architecture unity c# input c++ networking geometry unity 3d frame-rate c# unity 3d animation unity flixel xna java unity unity unity assets libgdx opengl unity c# 2d textures html5 2d java unity 3d c++ mathematics game-loop appstore unity rotation xna unreal opengl slimdx actionscript-3 voxels spritesheet assets unity unity version-control unity algorithm mathematics javascript opengl xna c# unity 2d unity physics java game-loop unity java collision-detection java c++ unity plugin opengl c++ directx11 xna selection android libgdx unity python opengl software-engineering mathematics project-management scripting c# opengl unity mathematics unity software-engineering networking xna xna unity game-design project-management xna networking collision-detection unity sprites collision-detection opengl python unity opengl shaders c++ unity xna opengl java cocos2d-iphone unity libgdx unity python transparency unity c++ unity unity c++ c# legal camera unity 2d unity opengl rotation networking java flash 3d opengl directx unity c# textures 2d java unity 3d android voxels xna c++ xna actionscript-3 c# unity opengl unity 2d unity game-design bullet-physics legal android flash-develop unity c++ game-design facebook graphics python textures opengl directx graphics xna physics unity java unity libgdx xna-4.0 unity collision-detection steam camera c++ java unity mmo architecture java opengl unity java directx rendering libgdx game-design unity architecture vector java xna unity opengl game-maker javascript xna unity unity game-design mathematics 2d opengl libgdx unity unity unity game-design c# loading c++ opengl java mathematics game-industry unity multiplayer unity xna unity education networking ai unity c# game-maker unity intersection 3d unity c++ unity xna unity android unity unity unity rotation unity unity unity java camera java 2d unity javascript ios c++ java opengl sprites c# java unity opengl shaders javascript rendering unity music xna game-loop javascript libgdx algorithm java collision-detection mathematics android opengl unity opengl xna unity xna iphone matrix unity unity unity xna collision-detection c++ directx c# mobile directx 2d unity graphic-effects jmonkeyengine c++ marketing unity books jobs 2d opengl flash unity unity unity 2d unity unity unity unity unity path-finding opengl physics unity 3d performance xna opengl libgdx xna legal java android 2d tiles shading c++ entity-component architecture unity xna-4.0 opengl unity unity iphone android unity c++ unity unity procedural-generation textures textures c++ licensing c++ game-design c++ ios java unity unity 3d opengl unity unity unreal-4 html5 nintendo c# minecraft-modding java 3d unity opengl java c++ unreal-4 procedural-generation unity tilemap rigidbody mathematics c++ networking game-loop xna open-source godot collision-detection javascript legal collision-detection java unity directx 2d casual-games unity unity c# unity unity xna unity unity tiles opengl java algorithm 3d software-engineering software-engineering xna c# c# sfml unity fonts unity networking xna game-design unity procedural-generation sprites c++ game-design ai project-management java flash java textures unity android opengl 3d xna multiplayer entity-system c++ xna unity android vector architecture opengl shadows xna hlsl c++ ios architecture c# unity opengl-es2 lwjgl android spherical-harmonics rendering java camera game-design unity unity business unity c# vb.net xna unity blender javascript unity procedural-generation opengl c++ physics unity unity xna unity java unity user-experience entity-system opengl movement game-design 3d textures c++ collision-detection mathematics xna 2d collision-detection xna opengl java c++ procedural-generation xna-4.0 rendering game-maker unity architecture ios 3d c++ unity java spritesheet terminology procedural-generation opengl unity unity unity opengl software-engineering c# opengl algorithm 2d godot c++ unity assets unity java unity camera unity multiplayer shaders java unity libgdx unity unity opengl shaders unity unity unity godot multiplayer unity unity software-engineering unity glsl unity java ios unity procedural-generation java physics 3d unity java collision-detection models unity c++ xna objective-c xna unity unity psm java c# unity xna-4.0 c++ physics unity opengl javascript libgdx unity music unity physics opengl unity xna unity unity c++ data-structure c# unity ios unity mathematics collision-detection c# collision-detection animation xna unity opengl libgdx c# c# opengl iphone collision-detection textures unity unity unity architecture unity unity c# c++ animation unity turn-based java c++ javascript unity c# 2d unity unity ai java xna libgdx unity android 3d game-maker terminology c++ physics animation actionscript mathematics xna graphics unity xna textures java unity opengl legal opengl steam java c# opengl opengl input android libgdx microsoft c# mathematics unity opengl unity unity minecraft-modding unity level-design java java c++ unity unity opengl unity unity 2d java unity unity opengl java game-design xna architecture c# opengl movement ogre godot 2d unity unity 2d unity 3d collision-detection tools algorithm unity unity c++ godot architecture spritesheet unity procedural-generation unity puzzle rigging physics java unity car collision-detection collision-resolution unity mathematics directx opengl unity sound hardware opengl collision-detection c++ unity networking unity lighting c++ three.js physics career c++ unity textures architecture unity vector unity unity unity javascript unity 2d terrain game-design flash unity unity opengl unity mathematics c# collision-resolution sound-effects unity c++ 2d unity directx unity architecture unity shaders physics unity game-design collision-detection android physics iphone unity 2d directx collision-detection opengl unreal-4 2d opengl unity c# camera unity unity unity java networking xna java lua opengl java unity unity physics textures unity c++ javascript c++ game-maker c++ opengl matrix game-design c# xna opengl unity unity networking javascript algorithm directx libgdx opengl-es procedural-generation opengl unity java unity c# algorithm collision-detection algorithm xna html-canvas unity libgdx libgdx xna algorithm sprites unity unity unity unity graphics java c++ libgdx unity opengl game-design java rotation unity unity sdl movement opengl unity c++ xna mathematics c++ unity phaser unity xna c++ algorithm opengl java unity c# game-design android unity c# mathematics mmo xna love2d javascript 2d c++ textures unity ios legal graphics algorithm unity physics unity java 2d unity ai collision-detection 2d unity unity javascript client-server c++ unity game-maker frame-rate unity 2d c# unity opengl unity gui unity opengl game-design unity java c# entity-system c++ unity game-design unity unity game-design graphics-programming java collision-detection algorithm ios unity unity c# unity xna databases unity unity unity unity textures unity c# path-finding networking c# java copyright minecraft-modding physics unity fragment-shader networking java beta opengl unity opengl xna vector minecraft-modding xna marketing java procedural-generation unity c++ physics xna google-play xna c# box2d opengl 2d unity shaders lua unity unity java software-engineering game-design opengl unity path-finding game-design game-design c# unity path-finding java 3d opengl java libgdx java flash shaders deployment game-maker c# c++ flash android unity collision-detection unity sound xna javascript javascript unity 2d unity unity xna unity unity collision-detection android physics directx tools mathematics client-server xna mesh android libgdx game-design physics physics unity c++ opengl unity 2d collision-detection c# quadtree sprites coordinates 3d c# animation models xna unity physics opengl graphics-programming java unreal-4 java architecture unity java java unity opengl multiplayer random java unity linear-algebra xna directx java animation java unity hlsl java java c++ mathematics collision-detection c++ game-design android xna unity state opengl java software-engineering unity unity opengl unity shaders game-design software-engineering sound 2d android opengl jumping algorithm unity unity c++ textures unity console xna xna unity unity c# android xna graphics game-design 2d opengl unity java unity 3d-meshes unity physics libgdx game-design 3d mmo unity andengine unity physics graphic-effects networking unity game-design unity rendering xna shaders opengl scale cocos2d performance animation xna c++ unity unity xna collision-detection c++ unity game-design unity software-engineering unity directx9 opengl-es unity coordinates scripting c++ opengl opengl opengl collision-detection unity opengl unity 2d opengl unity unity libgdx ipad graphics-design unity unity actionscript xna unity frame-rate collision-detection unity libgdx android game-design 2d facebook rendering xna terminology unity game-design java unity unity java unity cocos2d-iphone legal unity linux opengl unity textures unity algorithm unity ai 2d unity libgdx game-design unity unity opengl unity c++ unity game-maker 2d shaders animation xna-4.0 raycasting unity unity multiplayer unity xna algorithm unity xna unity java unity collision-detection opengl c# unity xna optimization textures javascript xna music opengl unity c++ game-design unity global-illumination unity java java unity unity unity libgdx c++ android input camera unity c++ c++ c# graphics opengl server unity 2d mathematics unity unity python opengl xna opengl flash unreal-4 collision-detection unity unity unity opengl unreal-4 xna xna-4.0 entity-system unity-networking unity 2d unity phaser unity game-design algorithm mathematics unity unity c++ unity unity unity unity c# unity textures c# unity unity unity java unreal-4 2d unity unity opengl sdl opengl vector opengl game-design unity unity crusader-kings-2-modding 3d shaders game-maker unity browser-based-games legal unity architecture unity algorithm algorithm c# unity octree ai algorithm architecture design-patterns c# unity c++ textures unity matrix android deployment playtesting unity android collision-detection python unity unity mathematics unity xna 3d unity xna javascript algorithm opengl game-design libgdx java architecture heightmap unity collision-detection unity c# xna xna javascript tiles collision-detection c# algorithm 3d mathematics architecture xna box2d godot unity opengl ai game-design unity c# game-design libgdx javascript unity physics-engine c++ unity unity unity opengl opengl mathematics opengl architecture c++ textures c# unity textures libgdx java collision-detection optimization game-design physics unity android android xna shaders unity unity c++ c++ java unity algorithm opengl playstation4 data-structure sfml c++ 2d textures libgdx unity python flash unity flash unity java opengl unity mathematics architecture mathematics unity unity havok unity collision-detection procedural-generation c++ collision-detection unity unity unity xna kinect c# opengl windows-phone-7 entity-component-system unity c# fonts java javascript unity xna animation 2d game-design unity unity unity c++ xna xna 2d cocos2d-iphone xna opengl 2d physics c# collision-detection c# unity unity java opengl physics opengl networking movement path-finding models game-industry unity unity 3d unity architecture models textures unity legal 2d c++ unity algorithm ios unity unity unity text android algorithm unity opengl unity unity collision-detection c++ directx path-finding shaders graphics unity xna c++ algorithm c# unity xna graphics simulations webgl unity graphics-programming unity java c# algorithm unity cocos2d-iphone networking collision-resolution unity unity c++ directx unity unity 2d javascript mathematics unity unity sprites 2d unity websocket unity graphics-programming javascript networking c++ java andengine xna javascript 2d xna-4.0 unity algorithm android xna c# opengl input c++ c# 2d collision-detection java hlsl direct3d12 xna xna opengl animation c# unity unity c++ xna publishing unity architecture c# unity opengl sprites libgdx libgdx opengl c# monogame statistics publishing c# unity c++ server c++ 2d unity terrain-rendering alpha rendering architecture collision-detection godot vector android unity opengl-es 3d unity flash java unity character unity unity unreal-4 unity game-design libgdx tiles mathematics unity c# c++ opengl java opengl game-design java vector ios unity 2d random game-maker javascript shaders unity 2d xna c# opengl graphics ios rendering architecture unity graphics 2d collision-detection c# collision-detection unity game-maker unity c++ godot adventure-games unity unity animation unity collision-detection unity javascript libgdx c++ xna xna java java mmo unity textures transformation c++ directx java java unity unity c# unity unity textures procedural-generation ios c# career unity unreal-4 unity unity legal libgdx art unity game-design modding c++ unity game-design c++ iphone animation legal legal opengl movement unreal mathematics physics xna unity libgdx algorithm unity unity physics unity 2d opengl c++ xna networking unity physics rendering unity c# opengl javascript libgdx unity android c++ networking unity collision-detection java unity unity mobile software-engineering career unity libgdx directx android macos c# networking 2d microsoft unity software-engineering c++ android shaders c++ unity cross-platform android opengl unity xna mathematics opengl 2d legal unity unity xna procedural-generation geometry opengl sprites c++ xna collision-detection unity java unity c# opengl game-design javascript rotation libgdx javascript xna godot xna javascript xna unity google-play 3d algorithm opengl software-engineering c++ python java opengl textures mmo sdl2 models ai fbx file-format collision-detection tilemap architecture directx11 input opengl c++ xna opengl opengl physics java 3d python unity unity normal-mapping